@cratis/screenplay-language 4.160.0 → 4.162.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.
@@ -1 +1 @@
1
- {"version":3,"file":"SpecificationParser.js","names":["parseMappingSource","operationStepPrefix","pattern","operationStep","header","callerPersonaPattern","nativePattern","prefix","exactly","dotNetWhitespace","givenPattern","whenAppendPattern","whenPattern","thenEventPattern","thenQueryPrefix","readModelPrefix","givenReadModelPattern","thenReadModelPattern","thenNoPrefix","thenErrorPattern","stringBodyPattern","mappingPattern","nativeMappingPattern","givenClockPrefix","givenCapturePrefix","whenClockPrefix","whenTriggerPrefix","whenCapturePrefix","whenQueryPrefix","thenResultPrefix","noResultPrefix","whenRedeliveredPrefix","whenRedeliveredPattern","noEventsPrefix","clockPattern","whenTriggerPattern","capturePattern","whenQueryPattern","thenResultPattern","thenAbsentReadModelPattern","absentKeyStringPattern","thenQueryPattern","name","line","context","DiagnosticCodes","locationOf","description","parameters","cases","body","child","isFileDirective","keyword","firstWord","parameter","parseParameter","row","parseCase","parseDescription","_","_noEventsLine","members","specification","validateTable","match","values","value","parseConcreteMapping","rejectOperationChildren","capture","readModel","event","callerRolePattern","callerClaimPattern","authenticated","roles","claims","role","claim","containsCaseReference","unescapeString","appends","code","generatedValues","thenReturnsPrefix","expectation","parseReturn","caseValue","parseSpecificationValue","error","absent","key","exact","at","message","args","results","hasArguments","keyText","concrete","hasChildren","indent","regex","expected","create","queryArguments","specificationStream","sourceStreamPattern","specificationStreamId","addInlineValue","parent","inline","eventSource","stream","noStream","hasRoute","generated","generatedFixturePrefix","fixture","generatedFixturePattern","mapping","addFixtureValue","eventKeyword","route","source","streamId","streamIdParts","block","directiveLocations","parseRouteParts","part","location","nativeIdentifiers","queryArgumentsContext","existing"],"sources":["../../../../../../Compiler/Parsing/SpecificationParser.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 { parseRouteParts } from './EventSourceParser';\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { ExpressionSyntax, PropertyMappingSyntax } from '../Syntax/Expressions';\nimport {\n SpecificationCaptureSyntax, SpecificationClockSyntax, SpecificationCommandSyntax, SpecificationErrorSyntax, SpecificationEventSyntax, SpecificationStreamSyntax, SpecificationNoStreamSyntax,\n SpecificationNoResultSyntax, SpecificationQueryResultSyntax, SpecificationReadModelSyntax, SpecificationSyntax, SpecificationTriggerSyntax,\n SpecificationWhenQuerySyntax, SpecificationCallerPersonaSyntax, SpecificationOperationFailureSyntax, SpecificationOperationSyntax, SpecificationCompensatedSyntax, SpecificationRedeliverySyntax,\n} from '../Syntax/Specifications';\nimport { SpecificationDeniedSyntax, SpecificationReturnSyntax } from '../Syntax/Responses';\nimport { dotNetWhitespace, nativePattern, pattern } from '../Text/patterns';\nimport { sourceStreamPattern } from '../Text/SourceStreamNames';\nimport { stringBodyPattern, unescapeString } from '../Text/StringLiteral';\nimport { containsCaseReference, parseCase, parseParameter, parseSpecificationValue as parseMappingSource, validateTable } from './SpecificationCaseParser';\nimport { parseDescription } from './DescriptionParser';\nimport { isFileDirective } from './FileReferences';\nimport { firstWord } from './LineText';\nimport { ParserContext } from './ParserContext';\nimport { addFixtureValue, addInlineValue } from './SpecificationExampleParser';\nimport { rejectOperationChildren } from './OperationParser';\nimport { generatedFixturePattern, generatedFixturePrefix, parseConcreteMapping, parseReturn, thenReturnsPrefix } from './SpecificationResponseParser';\nimport { locationOf, SourceLine } from './SourceLine';\nimport { SpecificationAbsentReadModelSyntax, SpecificationCallerClaimSyntax, SpecificationCallerSyntax, SpecificationQuerySyntax } from '../Syntax/Specifications';\n\nconst operationStepPrefix = pattern('^(?:given\\\\s+operation|then\\\\s+(?:operation|compensated))(?:\\\\s|$)');\nconst operationStep = pattern('^(given operation|then operation|then compensated)\\\\s+([A-Za-z_]\\\\w*(?:\\\\.[A-Za-z_]\\\\w*)*)(\\\\s+fails)?$');\nconst header = pattern('^specification\\\\s+([A-Za-z_]\\\\w*)$');\nconst callerPersonaPattern = pattern('^given caller as ([A-Za-z_]\\\\w*)$');\nconst stepName = '([A-Z]\\\\w*(?:\\\\.\\\\w+)*)';\nconst inlineAssignment = '(?:\\\\s+(?<property>[\\\\w.]+)\\\\s*=(?!=|>)\\\\s*(?<value>.+))?';\nconst stepPattern = (prefix: string, exactly = ''): RegExp => nativePattern(`^${prefix}\\\\s+${stepName}${exactly}${inlineAssignment}$`.replaceAll('\\\\s', dotNetWhitespace));\nconst givenPattern = stepPattern('given');\nconst whenAppendPattern = stepPattern('when\\\\s+append');\nconst whenPattern = stepPattern('when');\nconst thenEventPattern = stepPattern('then');\nconst thenQueryPrefix = pattern('^then\\\\s+query\\\\b');\nconst readModelPrefix = pattern('^(?:given|then)\\\\s+readmodel\\\\b');\nconst givenReadModelPattern = stepPattern('given\\\\s+readmodel');\nconst thenReadModelPattern = stepPattern('then\\\\s+readmodel', '(?<exactly>\\\\s+exactly)?');\nconst thenNoPrefix = pattern('^then\\\\s+no\\\\b');\nconst thenErrorPattern = pattern(`^then\\\\s+error\\\\s+\"(${stringBodyPattern})\"$`);\nconst mappingPattern = pattern('^([\\\\w.]+)\\\\s*=(?!=|>)\\\\s*(.+)$');\nconst nativeMappingPattern = nativePattern('^([\\\\w.]+)\\\\s*=(?!=|>)\\\\s*(.+)$');\nconst givenClockPrefix = pattern('^given\\\\s+clock\\\\b');\nconst givenCapturePrefix = pattern('^given\\\\s+capture\\\\b');\nconst whenClockPrefix = pattern('^when\\\\s+clock\\\\b');\nconst whenTriggerPrefix = pattern('^when\\\\s+trigger\\\\b');\nconst whenCapturePrefix = pattern('^when\\\\s+capture\\\\b');\nconst whenQueryPrefix = pattern('^when\\\\s+query\\\\b');\nconst thenResultPrefix = pattern('^then\\\\s+result\\\\b');\nconst noResultPrefix = pattern('^then\\\\s+no\\\\s+result\\\\b');\nconst whenRedeliveredPrefix = nativePattern('^when\\\\s+redelivered\\\\b');\nconst whenRedeliveredPattern = nativePattern('^when\\\\s+redelivered\\\\s+([A-Za-z_]\\\\w*(?:\\\\.\\\\w+)*)\\\\s+to\\\\s+([A-Za-z_]\\\\w*(?:\\\\.\\\\w+)*)$');\nconst noEventsPrefix = pattern('^then\\\\s+no\\\\s+events\\\\b');\n\n// An instant in ISO 8601 - a date, a time to the minute or finer, and an explicit offset or Z - so the same text\n// means the same moment wherever the specification runs.\nconst clockPattern = pattern('^(given|when)\\\\s+clock\\\\s+\"(\\\\d{4}-\\\\d{2}-\\\\d{2}T\\\\d{2}:\\\\d{2}(?::\\\\d{2}(?:\\\\.\\\\d+)?)?(?:Z|[+-]\\\\d{2}:\\\\d{2}))\"$');\nconst whenTriggerPattern = pattern('^when\\\\s+trigger\\\\s+([A-Za-z_]\\\\w*)$');\nconst capturePattern = pattern('^(?:given|when)\\\\s+capture\\\\s+([A-Za-z_]\\\\w*)$');\nconst whenQueryPattern = pattern('^when\\\\s+query\\\\s+([A-Za-z_]\\\\w*(?:\\\\.\\\\w+)*)$');\nconst thenResultPattern = pattern('^then\\\\s+result(\\\\s+exactly)?$');\nconst thenAbsentReadModelPattern = nativePattern('^then\\\\s+no\\\\s+readmodel\\\\s+([A-Z]\\\\w*)\\\\s+for\\\\s+(.+)$');\nconst absentKeyStringPattern = nativePattern(`^(?:\"${stringBodyPattern}\"|'(?:[^'\\\\\\\\]|\\\\\\\\.)*')$`);\nconst thenQueryPattern = nativePattern('^then\\\\s+query\\\\s+([A-Za-z_]\\\\w*(?:\\\\.\\\\w+)*)(\\\\s+exactly)?$');\n\ninterface SpecificationBody {\n given: SpecificationEventSyntax[];\n givenReadModels: SpecificationReadModelSyntax[];\n when: SpecificationCommandSyntax | null;\n whenAppended: SpecificationEventSyntax | null;\n whenRedelivered: SpecificationRedeliverySyntax | null;\n whenDeclared: boolean;\n thenEvents: SpecificationEventSyntax[];\n thenEventsInAnyOrder: boolean;\n thenNoEvents: boolean;\n noEventsLine?: SourceLine;\n thenReadModels: SpecificationReadModelSyntax[];\n thenErrors: SpecificationErrorSyntax[];\n thenAbsentReadModels: SpecificationAbsentReadModelSyntax[];\n thenQueries: SpecificationQuerySyntax[];\n givenClock: SpecificationClockSyntax | null;\n givenCaptures: SpecificationCaptureSyntax[];\n whenClock: SpecificationClockSyntax | null;\n whenTrigger: SpecificationTriggerSyntax | null;\n whenCapture: SpecificationCaptureSyntax | null;\n whenQuery: SpecificationWhenQuerySyntax | null;\n thenResults: SpecificationQueryResultSyntax[];\n thenNoResult: SpecificationNoResultSyntax | null;\n thenDenied: SpecificationDeniedSyntax | null;\n givenCaller: SpecificationCallerSyntax | null;\n givenCallerPersona?: SpecificationCallerPersonaSyntax;\n thenReturns: SpecificationReturnSyntax | null;\n givenOperationFailures: SpecificationOperationFailureSyntax[];\n thenOperations: SpecificationOperationSyntax[];\n thenCompensated: SpecificationCompensatedSyntax[];\n}\n\nexport function parseSpecification(context: ParserContext, line: SourceLine): SpecificationSyntax {\n const name = header.exec(line.content)?.[1] ?? '';\n if (name === '') {\n context.error(DiagnosticCodes.InvalidSpecificationDeclaration, `Invalid specification declaration '${line.content}' - expected 'specification <Name>'`, locationOf(line));\n }\n let description: string | null = null;\n const parameters: NonNullable<SpecificationSyntax['parameters']>[number][] = [];\n const cases: NonNullable<SpecificationSyntax['cases']>[number][] = [];\n const body: SpecificationBody = {\n givenOperationFailures: [], thenOperations: [], thenCompensated: [], thenAbsentReadModels: [], thenQueries: [],\n given: [], givenReadModels: [], when: null, whenAppended: null, whenRedelivered: null, whenDeclared: false,\n thenEvents: [], thenEventsInAnyOrder: false, thenNoEvents: false, thenReadModels: [], thenErrors: [],\n givenClock: null, givenCaptures: [], whenClock: null, whenTrigger: null, whenCapture: null, whenQuery: null, thenResults: [], thenNoResult: null, thenDenied: null, givenCaller: null, thenReturns: null,\n };\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n if (isFileDirective(child)) {\n continue;\n }\n if (parseOperationStep(context, child, body)) continue;\n // Absence assertions admit any whitespace after 'then'; every other directive keeps its first word.\n const keyword = thenNoPrefix.test(child.content) ? 'then' : firstWord(child.content);\n if (keyword === 'parameter') {\n const parameter = parseParameter(context, child);\n if (parameter !== null) parameters.push(parameter);\n } else if (keyword === 'case') {\n const row = parseCase(context, child);\n if (row !== null) cases.push(row);\n } else if (keyword === 'description') {\n description = parseDescription(context, child, description, `Specification '${name}'`);\n } else if (keyword === 'given') {\n parseGiven(context, child, body);\n } else if (keyword === 'when') {\n parseWhen(context, child, body, name);\n } else if (keyword === 'then') {\n parseThen(context, child, body);\n } else {\n context.error(DiagnosticCodes.UnknownSpecificationDirective, `Unexpected '${firstWord(child.content)}' in specification body`, locationOf(child));\n context.skipBlock(child.indent);\n }\n }\n if (body.noEventsLine !== undefined && (body.thenEvents.length > 0 || body.thenEventsInAnyOrder || body.thenErrors.length > 0 || body.thenDenied !== null)) {\n context.error(DiagnosticCodes.InvalidNoEventsExpectation,\n \"'then no events' cannot accompany event, event-order, error or denial expectations.\", locationOf(body.noEventsLine));\n }\n const { whenDeclared: _, noEventsLine: _noEventsLine, ...members } = body;\n const specification: SpecificationSyntax = { kind: 'SpecificationSyntax', sourceOptions: context.sourceOptions, name, description, ...members,\n ...(parameters.length === 0 ? {} : { parameters }), ...(cases.length === 0 ? {} : { cases }), location: locationOf(line) };\n validateTable(specification, context);\n return specification;\n}\n\nfunction parseOperationStep(context: ParserContext, line: SourceLine, body: SpecificationBody): boolean {\n if (!operationStepPrefix.test(line.content)) return false;\n const match = operationStep.exec(line.content);\n if (match === null || (match[1] === 'given operation') !== (match[3] !== undefined)) {\n context.error(DiagnosticCodes.InvalidOperationSpecification, \"Expected 'given operation <Name> fails', 'then operation <Name>' or 'then compensated <Name>'.\", locationOf(line));\n skipBody(context, line.indent);\n } else if (match[1] === 'then operation') {\n const values: PropertyMappingSyntax[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n const value = parseConcreteMapping(context, child, mappingPattern, DiagnosticCodes.InvalidOperationSpecification);\n if (value !== null) values.push(value);\n }\n body.thenOperations.push({ kind: 'SpecificationOperationSyntax', operation: match[2], values, location: locationOf(line) });\n } else {\n rejectOperationChildren(context, line, DiagnosticCodes.InvalidOperationSpecification, 'Failure and compensation assertions cannot have children.');\n if (match[1] === 'given operation') body.givenOperationFailures.push({ kind: 'SpecificationOperationFailureSyntax', operation: match[2], location: locationOf(line) });\n else body.thenCompensated.push({ kind: 'SpecificationCompensatedSyntax', operation: match[2], location: locationOf(line) });\n }\n return true;\n}\n\nfunction parseGiven(context: ParserContext, line: SourceLine, body: SpecificationBody): void {\n if (givenClockPrefix.test(line.content)) {\n if (body.givenClock !== null) {\n context.error(DiagnosticCodes.InvalidSpecificationClock, 'A specification states its clock at most once.', locationOf(line));\n skipBody(context, line.indent);\n } else {\n body.givenClock = parseClock(context, line, 'given');\n }\n } else if (givenCapturePrefix.test(line.content)) {\n const capture = parseCapture(context, line, 'given');\n if (capture !== null) {\n body.givenCaptures.push(capture);\n }\n } else if (line.content.startsWith('given caller')) {\n if (body.givenCaller !== null || body.givenCallerPersona !== undefined) {\n context.error(DiagnosticCodes.DuplicateSpecificationCallerOrDenied, \"A specification has at most one 'given caller' block.\", locationOf(line));\n context.skipBlock(line.indent);\n } else if (line.content.startsWith('given caller as')) {\n const match = callerPersonaPattern.exec(line.content);\n if (match === null) context.error(DiagnosticCodes.InvalidSpecificationCallerPersona, \"Expected 'given caller as <Persona>'.\", locationOf(line));\n const child = context.peekChild(line.indent);\n if (child !== undefined) context.error(DiagnosticCodes.InvalidSpecificationCallerPersona, \"'given caller as <Persona>' has no body; use an explicit 'given caller' for refinements.\", locationOf(child));\n skipBody(context, line.indent);\n if (match !== null) body.givenCallerPersona = { kind: 'SpecificationCallerPersonaSyntax', name: match[1], location: locationOf(line) };\n } else {\n body.givenCaller = parseCaller(context, line);\n }\n } else if (readModelPrefix.test(line.content)) {\n const readModel = parseReadModelStep(context, line, givenReadModelPattern, 'given');\n if (readModel !== undefined) {\n body.givenReadModels.push(readModel);\n }\n } else {\n const event = parseEventStep(context, line, givenPattern, 'given');\n if (event !== undefined) {\n body.given.push(event);\n }\n }\n}\n\nconst callerRolePattern = pattern(`^role${dotNetWhitespace}+\"(${stringBodyPattern})\"$`);\nconst callerClaimPattern = pattern(`^claim${dotNetWhitespace}+\"(${stringBodyPattern})\"${dotNetWhitespace}*=${dotNetWhitespace}*\"(${stringBodyPattern})\"$`);\n\n// 'given caller' and the authenticated, role and claim lines under it.\nfunction parseCaller(context: ParserContext, line: SourceLine): SpecificationCallerSyntax | null {\n if (line.content !== 'given caller') {\n context.error(DiagnosticCodes.InvalidSpecificationCaller, \"Expected exactly 'given caller'.\", locationOf(line));\n context.skipBlock(line.indent);\n return null;\n }\n let authenticated = false;\n const roles: string[] = [];\n const claims: SpecificationCallerClaimSyntax[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n const role = callerRolePattern.exec(child.content);\n const claim = callerClaimPattern.exec(child.content);\n if (child.content === 'authenticated' && !authenticated) {\n authenticated = true;\n } else if (role !== null) {\n roles.push(unescapeString(role[1]));\n } else if (claim !== null) {\n claims.push({ kind: 'SpecificationCallerClaimSyntax', type: unescapeString(claim[1]), value: unescapeString(claim[2]), location: locationOf(child) });\n } else {\n context.error(containsCaseReference(child.content) ? DiagnosticCodes.InvalidSpecificationCaseReference : DiagnosticCodes.InvalidSpecificationCaller, `Invalid caller fixture '${child.content}' - expected authenticated, role \"...\", or claim \"...\" = \"...\".`, locationOf(child));\n }\n }\n return { kind: 'SpecificationCallerSyntax', authenticated, roles, claims, location: locationOf(line) };\n}\n\nfunction parseWhen(context: ParserContext, line: SourceLine, body: SpecificationBody, name: string): void {\n const appends = line.content.startsWith('when append');\n if (body.whenDeclared) {\n const code = body.whenAppended !== null || appends ? DiagnosticCodes.ConflictingSpecificationActions : DiagnosticCodes.DuplicateSpecificationWhen;\n context.error(code, `Specification '${name}' already declares a 'when' - a specification can have at most one`, locationOf(line));\n skipBody(context, line.indent);\n return;\n }\n body.whenDeclared = true;\n if (appends) {\n body.whenAppended = parseEventStep(context, line, whenAppendPattern, 'when append') ?? null;\n return;\n }\n if (whenRedeliveredPrefix.test(line.content)) {\n const match = whenRedeliveredPattern.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.UnmatchedRedeliveredOccurrence, \"Expected 'when redelivered <Event> to <Reaction>'.\", locationOf(line));\n skipBody(context, line.indent);\n } else {\n body.whenRedelivered = { kind: 'SpecificationRedeliverySyntax', eventType: match[1], reaction: match[2], ...parseValuesWithEventSource(context, line, undefined, undefined, 'when redelivered'), location: locationOf(line) };\n }\n return;\n }\n if (whenClockPrefix.test(line.content)) {\n body.whenClock = parseClock(context, line, 'when');\n return;\n }\n if (whenTriggerPrefix.test(line.content)) {\n body.whenTrigger = parseNamedStep(context, line, whenTriggerPattern, DiagnosticCodes.InvalidSpecificationTrigger, 'when trigger', 'when trigger <Trigger>',\n (trigger, values) => ({ kind: 'SpecificationTriggerSyntax', trigger, values, location: locationOf(line) }));\n return;\n }\n if (whenCapturePrefix.test(line.content)) {\n body.whenCapture = parseCapture(context, line, 'when');\n return;\n }\n if (whenQueryPrefix.test(line.content)) {\n body.whenQuery = parseNamedStep(context, line, whenQueryPattern, DiagnosticCodes.InvalidSpecificationQueryAction, 'when query', 'when query <Query>',\n (query, values) => ({ kind: 'SpecificationWhenQuerySyntax', query, arguments: values, location: locationOf(line) }), true);\n return;\n }\n const match = whenPattern.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidSpecificationWhen, `Invalid 'when' declaration '${line.content}' - expected 'when <CommandType>' or 'when append <EventType>'`, locationOf(line));\n skipBody(context, line.indent);\n return;\n }\n const generatedValues: PropertyMappingSyntax[] = [];\n const values = parseValuesWithEventSource(context, line, generatedValues, match);\n body.when = { kind: 'SpecificationCommandSyntax', commandType: match[1], ...values, generatedValues, inlineProperty: match.groups?.property ?? null, location: locationOf(line) };\n}\n\nfunction parseThen(context: ParserContext, line: SourceLine, body: SpecificationBody): void {\n if (noEventsPrefix.test(line.content)) {\n if (line.content !== 'then no events' || body.thenNoEvents) {\n context.error(DiagnosticCodes.InvalidNoEventsExpectation, \"Expected one 'then no events' directive.\", locationOf(line));\n } else {\n body.thenNoEvents = true;\n body.noEventsLine = line;\n }\n const child = context.peekChild(line.indent);\n if (child !== undefined) context.error(DiagnosticCodes.InvalidNoEventsExpectation, \"'then no events' cannot have child mappings.\", locationOf(child));\n skipBody(context, line.indent);\n return;\n }\n if (thenReturnsPrefix.test(line.content)) {\n const expectation = parseReturn(context, line);\n if (body.thenReturns !== null) {\n context.error(DiagnosticCodes.InvalidReturnExpectation, 'A specification declares at most one return expectation.', locationOf(line));\n } else {\n body.thenReturns = expectation;\n }\n return;\n }\n if (line.content.startsWith('then events')) {\n if (line.content !== 'then events in any order' || body.thenEventsInAnyOrder) {\n context.error(DiagnosticCodes.InvalidSpecificationEventOrder, 'Expected one \\'then events in any order\\' directive.', locationOf(line));\n } else {\n body.thenEventsInAnyOrder = true;\n }\n skipBody(context, line.indent);\n return;\n }\n if (thenResultPrefix.test(line.content)) {\n parseResult(context, line, body);\n return;\n }\n if (noResultPrefix.test(line.content)) {\n if (line.content !== 'then no result' || body.thenNoResult !== null) {\n context.error(DiagnosticCodes.InvalidSpecificationQueryAction, 'Expected one \\'then no result\\' directive.', locationOf(line));\n } else {\n body.thenNoResult = { kind: 'SpecificationNoResultSyntax', location: locationOf(line) };\n }\n skipBody(context, line.indent);\n return;\n }\n if (line.content.startsWith('then denied')) {\n if (line.content !== 'then denied') {\n context.error(DiagnosticCodes.InvalidSpecificationDenied, 'Expected exactly \\'then denied\\'.', locationOf(line));\n skipBody(context, line.indent);\n } else if (body.thenDenied !== null) {\n context.error(DiagnosticCodes.DuplicateSpecificationCallerOrDenied, \"A specification has at most one 'then denied' outcome.\", locationOf(line));\n } else {\n body.thenDenied = { kind: 'SpecificationDeniedSyntax', location: locationOf(line) };\n }\n return;\n }\n if (line.content === 'then error') {\n body.thenErrors.push({ kind: 'SpecificationErrorSyntax', name: null, location: locationOf(line) });\n return;\n }\n if (line.content.startsWith('then error case.')) {\n const caseValue = parseMappingSource(line.content.substring(11), { ...locationOf(line), column: locationOf(line).column + 11 }, context);\n if (caseValue.kind === 'CaseValueExpressionSyntax') body.thenErrors.push({ kind: 'SpecificationErrorSyntax', name: null, caseValue, location: locationOf(line) });\n return;\n }\n const error = thenErrorPattern.exec(line.content);\n if (error !== null) {\n body.thenErrors.push({ kind: 'SpecificationErrorSyntax', name: unescapeString(error[1]), location: locationOf(line) });\n return;\n }\n if (firstWord(line.content.substring('then'.length).trim()) === 'error') {\n context.error(DiagnosticCodes.InvalidThenError, `Invalid 'then error' declaration '${line.content}' - expected 'then error' or 'then error \"<reason>\"'`, locationOf(line));\n skipBody(context, line.indent);\n return;\n }\n if (thenNoPrefix.test(line.content)) {\n // Legacy documents keep skipping these assertions silently; Exact mirrors the native diagnostics.\n if (context.sourceOptions.numericMode === 'exact') {\n const absent = parseAbsentReadModel(context, line);\n if (absent !== null) body.thenAbsentReadModels.push(absent);\n return;\n }\n const match = thenAbsentReadModelPattern.exec(line.content);\n if (match !== null && !match[2].endsWith(' exactly')) {\n const key = parseMappingSource(match[2].trim(), locationOf(line), context.valueContext);\n if (key.kind === 'LiteralExpressionSyntax' || key.kind === 'ObjectExpressionSyntax' || key.kind === 'CaseValueExpressionSyntax') body.thenAbsentReadModels.push({ kind: 'SpecificationAbsentReadModelSyntax', name: match[1], key, location: locationOf(line) });\n }\n context.skipOpaqueBlock(line.indent);\n return;\n }\n if (thenQueryPrefix.test(line.content)) {\n // Legacy documents keep skipping malformed query bodies silently; Exact reports what the native parser reports.\n const exact = context.sourceOptions.numericMode === 'exact';\n const reject = (code: string, message: string, at: SourceLine): void => {\n if (!exact) return context.skipOpaqueBlock(at.indent);\n context.error(code, message, locationOf(at));\n context.skipBlock(at.indent);\n };\n const match = thenQueryPattern.exec(line.content);\n if (match === null) return reject(DiagnosticCodes.InvalidSpecificationQuery, `Invalid 'then query' declaration '${line.content}' - expected 'then query <Query> [exactly]'`, line);\n const args: PropertyMappingSyntax[] = [];\n const results: SpecificationQueryResultSyntax[] = [];\n let hasArguments = false;\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n if (child.content === 'arguments' && !hasArguments) args.push(...parseValues(context.valueContext, child, true, undefined, context));\n else if (child.content === 'arguments') reject(DiagnosticCodes.DuplicateSpecificationQueryArguments, `Query assertion '${match[1]}' already declares arguments`, child);\n else if (child.content === 'result') results.push({ kind: 'SpecificationQueryResultSyntax', properties: parseValues(context.valueContext, child, true), exactly: false, location: locationOf(child) });\n else reject(DiagnosticCodes.UnknownSpecificationQueryDirective, `Unexpected '${firstWord(child.content)}' in 'then query' body - expected arguments or result`, child);\n hasArguments ||= child.content === 'arguments';\n }\n body.thenQueries.push({ kind: 'SpecificationQuerySyntax', query: match[1], arguments: args, results, exactly: match[2] !== undefined, location: locationOf(line) });\n return;\n }\n if (readModelPrefix.test(line.content)) {\n const readModel = parseReadModelStep(context, line, thenReadModelPattern, 'then');\n if (readModel !== undefined) {\n body.thenReadModels.push(readModel);\n }\n return;\n }\n const event = parseEventStep(context, line, thenEventPattern, 'then');\n if (event !== undefined) {\n body.thenEvents.push(event);\n }\n}\n\n// The Exact port of C# ParseAbsentReadModel: every malformed part is reported rather than dropped.\nfunction parseAbsentReadModel(context: ParserContext, line: SourceLine): SpecificationAbsentReadModelSyntax | null {\n const match = thenAbsentReadModelPattern.exec(line.content);\n if (match === null || match[2].endsWith(' exactly')) {\n context.error(DiagnosticCodes.InvalidAbsentReadModelStep, `Invalid absence assertion '${line.content}' - expected 'then no readmodel <ReadModelType> for <key>'`, locationOf(line));\n skipBody(context, line.indent);\n return null;\n }\n const keyText = match[2].trim();\n const validString = !(keyText.startsWith('\"') || keyText.startsWith(\"'\")) || absentKeyStringPattern.test(keyText);\n const key = validString ? parseMappingSource(keyText, locationOf(line), context.valueContext) : null;\n const concrete = key !== null && (key.kind === 'LiteralExpressionSyntax' || key.kind === 'ObjectExpressionSyntax' || key.kind === 'CaseValueExpressionSyntax');\n if (!concrete) context.error(DiagnosticCodes.InvalidAbsentReadModelStep, `Invalid absence key '${keyText}' - expected exactly one concrete value.`, locationOf(line));\n let hasChildren = false;\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n context.error(DiagnosticCodes.InvalidAbsentReadModelStep, 'An absent read model assertion cannot have child mappings.', locationOf(child));\n hasChildren = true;\n }\n return hasChildren || !concrete ? null : { kind: 'SpecificationAbsentReadModelSyntax', name: match[1], key, location: locationOf(line) } as SpecificationAbsentReadModelSyntax;\n}\n\nfunction skipBody(context: ParserContext, indent: number): void {\n if (context.sourceOptions.numericMode !== 'exact') return context.skipBlock(indent);\n context.skipOpaqueBlock(indent);\n}\n\nfunction parseClock(context: ParserContext, line: SourceLine, keyword: string): SpecificationClockSyntax | null {\n const match = clockPattern.exec(line.content);\n skipBody(context, line.indent);\n if (match === null || match[1] !== keyword) {\n context.error(containsCaseReference(line.content) ? DiagnosticCodes.InvalidSpecificationCaseReference : DiagnosticCodes.InvalidSpecificationClock,\n `Invalid '${keyword} clock' - expected '${keyword} clock \"<ISO 8601 instant>\"', such as '${keyword} clock \"2026-10-05T08:00:00Z\"'`, locationOf(line));\n return null;\n }\n return { kind: 'SpecificationClockSyntax', instant: match[2], location: locationOf(line) };\n}\n\nfunction parseCapture(context: ParserContext, line: SourceLine, keyword: string): SpecificationCaptureSyntax | null {\n return parseNamedStep(context, line, capturePattern, DiagnosticCodes.InvalidSpecificationCapture, `${keyword} capture`, `${keyword} capture <Capture>`,\n (capture, record) => ({ kind: 'SpecificationCaptureSyntax', capture, record, location: locationOf(line) }));\n}\n\n// A step naming one thing on its header line, with '<field> = <value>' lines beneath it.\nfunction parseNamedStep<T>(\n context: ParserContext, line: SourceLine, regex: RegExp, code: string, keyword: string, expected: string,\n create: (name: string, values: PropertyMappingSyntax[]) => T, queryArguments = false): T | null {\n const match = regex.exec(line.content);\n if (match === null) {\n context.error(code, `Invalid '${keyword}' declaration '${line.content}' - expected '${expected}'`, locationOf(line));\n skipBody(context, line.indent);\n return null;\n }\n return create(match[1], parseValues(context, line, false, undefined, queryArguments ? context : undefined));\n}\n\nfunction parseResult(context: ParserContext, line: SourceLine, body: SpecificationBody): void {\n const match = thenResultPattern.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidSpecificationQueryAction, `Invalid 'then result' declaration '${line.content}' - expected 'then result [exactly]'`, locationOf(line));\n skipBody(context, line.indent);\n return;\n }\n body.thenResults.push({ kind: 'SpecificationQueryResultSyntax', properties: parseValues(context, line), exactly: match[1] !== undefined, location: locationOf(line) });\n}\n\nfunction parseReadModelStep(context: ParserContext, line: SourceLine, regex: RegExp, keyword: string): SpecificationReadModelSyntax | undefined {\n const match = regex.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidReadModelStep, `Invalid '${keyword} readmodel' declaration '${line.content}' - expected '${keyword} readmodel <ReadModelType>'`, locationOf(line));\n skipBody(context, line.indent);\n return undefined;\n }\n return {\n kind: 'SpecificationReadModelSyntax',\n name: match[1],\n properties: parseValues(context, line, false, match),\n exactly: keyword === 'then' && match.groups?.exactly !== undefined,\n inlineProperty: match.groups?.property ?? null,\n location: locationOf(line),\n };\n}\n\nfunction parseEventStep(context: ParserContext, line: SourceLine, regex: RegExp, keyword: string): SpecificationEventSyntax | undefined {\n const match = regex.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidEventStep, `Invalid '${keyword}' declaration '${line.content}' - expected '${keyword} <EventType>'`, locationOf(line));\n skipBody(context, line.indent);\n return undefined;\n }\n return { kind: 'SpecificationEventSyntax', eventType: match[1], ...parseValuesWithEventSource(context, line, undefined, match, keyword), inlineProperty: match.groups?.property ?? null, location: locationOf(line) };\n}\n\nexport const specificationStream = sourceStreamPattern('^stream\\\\s+([A-Za-z_]\\\\w*)\\\\.([A-Za-z_]\\\\w*)$');\nconst specificationStreamId = pattern('^streamId\\\\s*=(?!=|>)\\\\s*(.+)$');\n\nfunction parseValuesWithEventSource(context: ParserContext, parent: SourceLine, generated?: PropertyMappingSyntax[], inline?: RegExpExecArray, eventKeyword?: string): { values: PropertyMappingSyntax[]; for: ExpressionSyntax | null; stream?: SpecificationStreamSyntax; noStream?: SpecificationNoStreamSyntax } {\n const values: PropertyMappingSyntax[] = [];\n addInlineValue(context, parent, inline, values);\n let eventSource: ExpressionSyntax | null = null;\n let stream: SpecificationStreamSyntax | undefined;\n let noStream: SpecificationNoStreamSyntax | undefined;\n let hasRoute = false;\n for (let child = context.peekChild(parent.indent); child !== undefined; child = context.peekChild(parent.indent)) {\n context.reader.takeSignificant();\n if (generated !== undefined && generatedFixturePrefix.test(child.content)) {\n const fixture = parseConcreteMapping(context, child, generatedFixturePattern, DiagnosticCodes.InvalidGeneratedFixture);\n if (fixture !== null) generated.push(fixture);\n continue;\n }\n const mapping = mappingPattern.exec(child.content);\n if (mapping !== null) {\n addFixtureValue(context, values, mappingOf(context, child, mapping));\n } else if (firstWord(child.content) === 'stream' || child.content.startsWith('no stream')) {\n if (eventKeyword === undefined) {\n context.error(DiagnosticCodes.SpecificationStreamOnCommand, 'A command occurrence cannot declare a route; assert it on a then event.', locationOf(child));\n context.skipBlock(child.indent);\n continue;\n }\n if (hasRoute) {\n context.error(DiagnosticCodes.InvalidSpecificationStream, 'An event occurrence declares at most one stream or no stream directive.', locationOf(child));\n context.skipBlock(child.indent);\n continue;\n }\n const route = specificationStream.exec(child.content);\n if (child.content === 'no stream' && (eventKeyword === 'then' || eventKeyword === 'when redelivered')) {\n noStream = { kind: 'SpecificationNoStreamSyntax', location: locationOf(child) };\n hasRoute = true;\n rejectSpecificationRouteChildren(context, child);\n } else if (route !== null) {\n stream = parseSpecificationStream(context, child, route);\n hasRoute = true;\n } else {\n context.error(DiagnosticCodes.InvalidSpecificationStream, \"Expected 'stream Source.Stream', or 'no stream' on a then event.\", locationOf(child));\n context.skipBlock(child.indent);\n }\n } else if (firstWord(child.content) === 'for') {\n const source = child.content.substring('for'.length).trim();\n if (source.length === 0) {\n context.error(DiagnosticCodes.InvalidSpecificationEventSource, 'Invalid event-source assertion \\'for\\' - expected \\'for <value>\\'', locationOf(child));\n } else if (eventSource !== null) {\n context.error(DiagnosticCodes.DuplicateSpecificationEventSource, 'A specification step can declare its event-source assertion only once', locationOf(child));\n } else {\n eventSource = parseMappingSource(source, locationOf(child), context);\n }\n } else {\n context.error(DiagnosticCodes.InvalidSpecificationValue, `Invalid property mapping '${child.content}' - expected '<property> = <value>'`, locationOf(child));\n }\n }\n return { values, for: eventSource, ...(stream === undefined ? {} : { stream }), ...(noStream === undefined ? {} : { noStream }) };\n}\n\nexport function parseSpecificationStream(context: ParserContext, header: SourceLine, route: RegExpExecArray): SpecificationStreamSyntax {\n let streamId: PropertyMappingSyntax | null = null;\n let streamIdParts: PropertyMappingSyntax[] = [];\n let block = false;\n const directiveLocations: Record<string, ReturnType<typeof locationOf>> = {};\n for (let child = context.peekChild(header.indent); child !== undefined; child = context.peekChild(header.indent)) {\n context.reader.takeSignificant();\n if (child.content === 'streamId') {\n if (streamId !== null || block) {\n context.error(DiagnosticCodes.InvalidSpecificationStream, \"Declare either one 'streamId = <literal>' mapping or one streamId part block.\", locationOf(child));\n context.skipBlock(child.indent);\n } else {\n block = true;\n directiveLocations.streamId = locationOf(child);\n streamIdParts = parseRouteParts(context, child, DiagnosticCodes.InvalidSpecificationStream).map(part => part.source.kind === 'PathExpressionSyntax' && part.source.path.startsWith('case.')\n ? { ...part, source: parseMappingSource(part.source.path, part.source.location, context) } : part);\n }\n continue;\n }\n const mapping = specificationStreamId.exec(child.content);\n if (mapping === null || streamId !== null || block) {\n context.error(DiagnosticCodes.InvalidSpecificationStream, \"Declare either one 'streamId = <literal>' mapping or one streamId part block.\", locationOf(child));\n context.skipBlock(child.indent);\n continue;\n }\n const location = { ...locationOf(child), column: child.indent + 1 + child.content.indexOf(mapping[1], child.content.indexOf('=') + 1) };\n streamId = { kind: 'PropertyMappingSyntax', property: 'streamId', source: parseMappingSource(mapping[1], location, context), location: locationOf(child) };\n rejectSpecificationRouteChildren(context, child);\n }\n return { kind: 'SpecificationStreamSyntax', eventSource: route[1], stream: route[2], streamId, streamIdParts, directiveLocations,\n referenceLocation: { ...locationOf(header), column: header.indent + 1 + header.content.indexOf(route[1], 'stream'.length) },\n referenceLength: route[1].length + 1 + route[2].length, location: locationOf(header) };\n}\n\nexport function rejectSpecificationRouteChildren(context: ParserContext, line: SourceLine): void {\n const child = context.peekChild(line.indent);\n if (child !== undefined) {\n context.error(DiagnosticCodes.InvalidSpecificationStream, 'This directive cannot have children.', locationOf(child));\n context.skipBlock(line.indent);\n }\n}\n\nfunction parseValues(context: ParserContext, parent: SourceLine, nativeIdentifiers = false, inline?: RegExpExecArray, queryArgumentsContext?: ParserContext): PropertyMappingSyntax[] {\n const values: PropertyMappingSyntax[] = [];\n addInlineValue(context, parent, inline, values);\n for (let child = context.peekChild(parent.indent); child !== undefined; child = context.peekChild(parent.indent)) {\n context.reader.takeSignificant();\n const mapping = (nativeIdentifiers || context.sourceOptions.numericMode === 'exact' ? nativeMappingPattern : mappingPattern).exec(child.content);\n if (mapping === null) {\n context.error(DiagnosticCodes.InvalidSpecificationValue, `Invalid property mapping '${child.content}' - expected '<property> = <value>'`, locationOf(child));\n continue;\n }\n const value = mappingOf(context, child, mapping, nativeIdentifiers);\n if (queryArgumentsContext !== undefined) {\n if (values.some(existing => existing.property === value.property)) {\n queryArgumentsContext.error(DiagnosticCodes.UnknownSpecificationQueryArgument, `Query argument '${value.property}' is repeated.`, value.location);\n }\n values.push(value);\n } else {\n addFixtureValue(context, values, value);\n }\n }\n return values;\n}\n\nfunction mappingOf(context: ParserContext, line: SourceLine, match: RegExpExecArray, nativeIdentifiers = false): PropertyMappingSyntax {\n return { kind: 'PropertyMappingSyntax', property: match[1], source: parseMappingSource(match[2], locationOf(line), context, nativeIdentifiers), location: locationOf(line) };\n}\n"],"mappings":"6jCA0BA,MAAMC,EAAsBC,EAAQ,oEAAoE,EAClGC,EAAgBD,EAAQ,yGAAyG,EACjIE,EAASF,EAAQ,oCAAoC,EACrDG,EAAuBH,EAAQ,mCAAmC,EAGlE,aAAe,EAAgB,EAAU,KAAeI,EAAc,IAAIC,EAAO,6BAAiBC,8DAA8B,WAAW,MAAOC,CAAgB,CAAC,EACnKC,EAAe,YAAY,OAAO,EAClCC,EAAoB,YAAY,gBAAgB,EAChDC,EAAc,YAAY,MAAM,EAChCC,EAAmB,YAAY,MAAM,EACrCC,EAAkBZ,EAAQ,mBAAmB,EAC7Ca,EAAkBb,EAAQ,iCAAiC,EAC3Dc,EAAwB,YAAY,oBAAoB,EACxDC,EAAuB,YAAY,oBAAqB,0BAA0B,EAClFC,EAAehB,EAAQ,gBAAgB,EACvCiB,EAAmBjB,EAAQ,uBAAuBkB,EAAkB,IAAI,EACxEC,EAAiBnB,EAAQ,iCAAiC,EAC1DoB,EAAuBhB,EAAc,iCAAiC,EACtEiB,GAAmBrB,EAAQ,oBAAoB,EAC/CsB,EAAqBtB,EAAQ,sBAAsB,EACnDuB,EAAkBvB,EAAQ,mBAAmB,EAC7CwB,EAAoBxB,EAAQ,qBAAqB,EACjDyB,EAAoBzB,EAAQ,qBAAqB,EACjD0B,EAAkB1B,EAAQ,mBAAmB,EAC7C2B,EAAmB3B,EAAQ,oBAAoB,EAC/C4B,EAAiB5B,EAAQ,0BAA0B,EACnD6B,EAAwBzB,EAAc,yBAAyB,EAC/D0B,EAAyB1B,EAAc,2FAA2F,EAClI2B,EAAiB/B,EAAQ,0BAA0B,EAInDgC,EAAehC,EAAQ,kHAAkH,EACzIiC,EAAqBjC,EAAQ,sCAAsC,EACnEkC,EAAiBlC,EAAQ,gDAAgD,EACzEmC,GAAmBnC,E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gB,2BAA4B,uCAAwCC,EAAWK,CAAK,CAAC,EACnHP,EAAQ,UAAUD,EAAK,MAAM,EAErC,CAEA,SAAS,YAAY,EAAwB,EAAoB,EAAoB,GAAO,EAA0B,EAAgE,CAClL,IAAMuB,EAAkC,CAAC,EACzC4C,EAAelE,EAASmE,EAAQC,EAAQ9C,CAAM,EAC9C,IAAK,IAAIf,EAAQP,EAAQ,UAAUmE,EAAO,MAAM,EAAG5D,IAAU,IAAA,GAAW,EAAQP,EAAQ,UAAUmE,EAAO,MAAM,EAAG,CAC9GnE,EAAQ,OAAO,gBAAgB,EAC/B,IAAM6E,GAAWY,GAAqBzF,EAAQ,cAAc,cAAgB,QAAUtB,EAAuBD,EAAA,CAAgB,KAAK8B,EAAM,OAAO,EAC/I,GAAIsE,IAAY,KAAM,CAClB7E,EAAQ,MAAMC,EAAgB,0BAA2B,6BAA6BM,EAAM,QAAQ,qCAAsCL,EAAWK,CAAK,CAAC,EAC3J,QACJ,CACA,IAAMgB,EAAQ,UAAUvB,EAASO,EAAOsE,EAASY,CAAiB,EAC9DC,IAA0B,IAAA,GAM1BZ,EAAgB9E,EAASsB,EAAQC,CAAK,GALlCD,EAAO,KAAK,GAAYqE,EAAS,WAAapE,EAAM,QAAQ,GAC5DmE,EAAsB,MAAMzF,EAAgB,kCAAmC,mBAAmBsB,EAAM,SAAS,gBAAiBA,EAAM,QAAQ,EAEpJD,EAAO,KAAKC,CAAK,EAIzB,CACA,OAAOD,CACX,CAEA,SAAS,UAAU,EAAwB,EAAkB,EAAwB,EAAoB,GAA8B,CACnI,MAAO,CAAE,KAAM,wBAAyB,SAAUD,EAAM,GAAI,OAAQjE,EAAmBiE,EAAM,GAAInB,EAAWH,CAAI,EAAGC,EAASyF,CAAiB,EAAG,SAAUvF,EAAWH,CAAI,CAAE,CAC/K"}
1
+ {"version":3,"file":"SpecificationParser.js","names":["parseMappingSource","operationStepPrefix","pattern","operationStep","header","callerPersonaPattern","nativePattern","prefix","exactly","dotNetWhitespace","givenPattern","whenAppendPattern","whenPattern","thenEventPattern","thenQueryPrefix","readModelPrefix","givenReadModelPattern","thenReadModelPattern","thenNoPrefix","thenErrorPattern","stringBodyPattern","mappingPattern","nativeMappingPattern","givenClockPrefix","givenCapturePrefix","whenClockPrefix","whenTriggerPrefix","whenCapturePrefix","whenQueryPrefix","thenResultPrefix","noResultPrefix","whenRedeliveredPrefix","whenRedeliveredPattern","noEventsPrefix","clockPattern","whenTriggerPattern","capturePattern","whenQueryPattern","thenResultPattern","thenAbsentReadModelPattern","absentKeyStringPattern","thenQueryPattern","name","line","context","DiagnosticCodes","locationOf","description","parameters","cases","body","child","isFileDirective","keyword","firstWord","parameter","parseParameter","row","parseCase","parseDescription","_","_noEventsLine","members","specification","validateTable","action","query","outcome","match","values","value","parseConcreteMapping","rejectOperationChildren","capture","readModel","event","callerRolePattern","callerClaimPattern","authenticated","roles","claims","role","claim","containsCaseReference","unescapeString","appends","code","generatedValues","thenReturnsPrefix","expectation","parseReturn","caseValue","parseSpecificationValue","error","absent","key","exact","at","message","args","results","hasArguments","keyText","concrete","hasChildren","indent","regex","expected","create","queryArguments","specificationStream","sourceStreamPattern","specificationStreamId","addInlineValue","parent","inline","eventSource","stream","noStream","hasRoute","generated","generatedFixturePrefix","fixture","generatedFixturePattern","mapping","addFixtureValue","eventKeyword","route","source","streamId","streamIdParts","block","directiveLocations","parseRouteParts","part","location","nativeIdentifiers","queryArgumentsContext","existing"],"sources":["../../../../../../Compiler/Parsing/SpecificationParser.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 { parseRouteParts } from './EventSourceParser';\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { ExpressionSyntax, PropertyMappingSyntax } from '../Syntax/Expressions';\nimport {\n SpecificationCaptureSyntax, SpecificationClockSyntax, SpecificationCommandSyntax, SpecificationErrorSyntax, SpecificationEventSyntax, SpecificationStreamSyntax, SpecificationNoStreamSyntax,\n SpecificationNoResultSyntax, SpecificationQueryResultSyntax, SpecificationReadModelSyntax, SpecificationSyntax, SpecificationTriggerSyntax,\n SpecificationWhenQuerySyntax, SpecificationCallerPersonaSyntax, SpecificationOperationFailureSyntax, SpecificationOperationSyntax, SpecificationCompensatedSyntax, SpecificationRedeliverySyntax,\n} from '../Syntax/Specifications';\nimport { SpecificationDeniedSyntax, SpecificationReturnSyntax } from '../Syntax/Responses';\nimport { dotNetWhitespace, nativePattern, pattern } from '../Text/patterns';\nimport { sourceStreamPattern } from '../Text/SourceStreamNames';\nimport { stringBodyPattern, unescapeString } from '../Text/StringLiteral';\nimport { containsCaseReference, parseCase, parseParameter, parseSpecificationValue as parseMappingSource, validateTable } from './SpecificationCaseParser';\nimport { parseDescription } from './DescriptionParser';\nimport { isFileDirective } from './FileReferences';\nimport { firstWord } from './LineText';\nimport { ParserContext } from './ParserContext';\nimport { addFixtureValue, addInlineValue } from './SpecificationExampleParser';\nimport { rejectOperationChildren } from './OperationParser';\nimport { generatedFixturePattern, generatedFixturePrefix, parseConcreteMapping, parseReturn, thenReturnsPrefix } from './SpecificationResponseParser';\nimport { locationOf, SourceLine } from './SourceLine';\nimport { SpecificationAbsentReadModelSyntax, SpecificationCallerClaimSyntax, SpecificationCallerSyntax, SpecificationQuerySyntax } from '../Syntax/Specifications';\n\nconst operationStepPrefix = pattern('^(?:given\\\\s+operation|then\\\\s+(?:operation|compensated))(?:\\\\s|$)');\nconst operationStep = pattern('^(given operation|then operation|then compensated)\\\\s+([A-Za-z_]\\\\w*(?:\\\\.[A-Za-z_]\\\\w*)*)(\\\\s+fails)?$');\nconst header = pattern('^specification\\\\s+([A-Za-z_]\\\\w*)$');\nconst callerPersonaPattern = pattern('^given caller as ([A-Za-z_]\\\\w*)$');\nconst stepName = '([A-Z]\\\\w*(?:\\\\.\\\\w+)*)';\nconst inlineAssignment = '(?:\\\\s+(?<property>[\\\\w.]+)\\\\s*=(?!=|>)\\\\s*(?<value>.+))?';\nconst stepPattern = (prefix: string, exactly = ''): RegExp => nativePattern(`^${prefix}\\\\s+${stepName}${exactly}${inlineAssignment}$`.replaceAll('\\\\s', dotNetWhitespace));\nconst givenPattern = stepPattern('given');\nconst whenAppendPattern = stepPattern('when\\\\s+append');\nconst whenPattern = stepPattern('when');\nconst thenEventPattern = stepPattern('then');\nconst thenQueryPrefix = pattern('^then\\\\s+query\\\\b');\nconst readModelPrefix = pattern('^(?:given|then)\\\\s+readmodel\\\\b');\nconst givenReadModelPattern = stepPattern('given\\\\s+readmodel');\nconst thenReadModelPattern = stepPattern('then\\\\s+readmodel', '(?<exactly>\\\\s+exactly)?');\nconst thenNoPrefix = pattern('^then\\\\s+no\\\\b');\nconst thenErrorPattern = pattern(`^then\\\\s+error\\\\s+\"(${stringBodyPattern})\"$`);\nconst mappingPattern = pattern('^([\\\\w.]+)\\\\s*=(?!=|>)\\\\s*(.+)$');\nconst nativeMappingPattern = nativePattern('^([\\\\w.]+)\\\\s*=(?!=|>)\\\\s*(.+)$');\nconst givenClockPrefix = pattern('^given\\\\s+clock\\\\b');\nconst givenCapturePrefix = pattern('^given\\\\s+capture\\\\b');\nconst whenClockPrefix = pattern('^when\\\\s+clock\\\\b');\nconst whenTriggerPrefix = pattern('^when\\\\s+trigger\\\\b');\nconst whenCapturePrefix = pattern('^when\\\\s+capture\\\\b');\nconst whenQueryPrefix = pattern('^when\\\\s+query\\\\b');\nconst thenResultPrefix = pattern('^then\\\\s+result\\\\b');\nconst noResultPrefix = pattern('^then\\\\s+no\\\\s+result\\\\b');\nconst whenRedeliveredPrefix = nativePattern('^when\\\\s+redelivered\\\\b');\nconst whenRedeliveredPattern = nativePattern('^when\\\\s+redelivered\\\\s+([A-Za-z_]\\\\w*(?:\\\\.\\\\w+)*)\\\\s+to\\\\s+([A-Za-z_]\\\\w*(?:\\\\.\\\\w+)*)$');\nconst noEventsPrefix = pattern('^then\\\\s+no\\\\s+events\\\\b');\n\n// An instant in ISO 8601 - a date, a time to the minute or finer, and an explicit offset or Z - so the same text\n// means the same moment wherever the specification runs.\nconst clockPattern = pattern('^(given|when)\\\\s+clock\\\\s+\"(\\\\d{4}-\\\\d{2}-\\\\d{2}T\\\\d{2}:\\\\d{2}(?::\\\\d{2}(?:\\\\.\\\\d+)?)?(?:Z|[+-]\\\\d{2}:\\\\d{2}))\"$');\nconst whenTriggerPattern = pattern('^when\\\\s+trigger\\\\s+([A-Za-z_]\\\\w*)$');\nconst capturePattern = pattern('^(?:given|when)\\\\s+capture\\\\s+([A-Za-z_]\\\\w*)$');\nconst whenQueryPattern = pattern('^when\\\\s+query\\\\s+([A-Za-z_]\\\\w*(?:\\\\.\\\\w+)*)$');\nconst thenResultPattern = pattern('^then\\\\s+result(\\\\s+exactly)?$');\nconst thenAbsentReadModelPattern = nativePattern('^then\\\\s+no\\\\s+readmodel\\\\s+([A-Z]\\\\w*)\\\\s+for\\\\s+(.+)$');\nconst absentKeyStringPattern = nativePattern(`^(?:\"${stringBodyPattern}\"|'(?:[^'\\\\\\\\]|\\\\\\\\.)*')$`);\nconst thenQueryPattern = nativePattern('^then\\\\s+query\\\\s+([A-Za-z_]\\\\w*(?:\\\\.\\\\w+)*)(\\\\s+exactly)?$');\n\ninterface SpecificationBody {\n given: SpecificationEventSyntax[];\n givenReadModels: SpecificationReadModelSyntax[];\n when: SpecificationCommandSyntax | null;\n whenAppended: SpecificationEventSyntax | null;\n whenRedelivered: SpecificationRedeliverySyntax | null;\n whenDeclared: boolean;\n thenEvents: SpecificationEventSyntax[];\n thenEventsInAnyOrder: boolean;\n thenNoEvents: boolean;\n noEventsLine?: SourceLine;\n thenReadModels: SpecificationReadModelSyntax[];\n thenErrors: SpecificationErrorSyntax[];\n thenAbsentReadModels: SpecificationAbsentReadModelSyntax[];\n thenQueries: SpecificationQuerySyntax[];\n givenClock: SpecificationClockSyntax | null;\n givenCaptures: SpecificationCaptureSyntax[];\n whenClock: SpecificationClockSyntax | null;\n whenTrigger: SpecificationTriggerSyntax | null;\n whenCapture: SpecificationCaptureSyntax | null;\n whenQuery: SpecificationWhenQuerySyntax | null;\n thenResults: SpecificationQueryResultSyntax[];\n thenNoResult: SpecificationNoResultSyntax | null;\n thenDenied: SpecificationDeniedSyntax | null;\n givenCaller: SpecificationCallerSyntax | null;\n givenCallerPersona?: SpecificationCallerPersonaSyntax;\n thenReturns: SpecificationReturnSyntax | null;\n givenOperationFailures: SpecificationOperationFailureSyntax[];\n thenOperations: SpecificationOperationSyntax[];\n thenCompensated: SpecificationCompensatedSyntax[];\n}\n\nexport function parseSpecification(context: ParserContext, line: SourceLine): SpecificationSyntax {\n const name = header.exec(line.content)?.[1] ?? '';\n if (name === '') {\n context.error(DiagnosticCodes.InvalidSpecificationDeclaration, `Invalid specification declaration '${line.content}' - expected 'specification <Name>'`, locationOf(line));\n }\n let description: string | null = null;\n const parameters: NonNullable<SpecificationSyntax['parameters']>[number][] = [];\n const cases: NonNullable<SpecificationSyntax['cases']>[number][] = [];\n const body: SpecificationBody = {\n givenOperationFailures: [], thenOperations: [], thenCompensated: [], thenAbsentReadModels: [], thenQueries: [],\n given: [], givenReadModels: [], when: null, whenAppended: null, whenRedelivered: null, whenDeclared: false,\n thenEvents: [], thenEventsInAnyOrder: false, thenNoEvents: false, thenReadModels: [], thenErrors: [],\n givenClock: null, givenCaptures: [], whenClock: null, whenTrigger: null, whenCapture: null, whenQuery: null, thenResults: [], thenNoResult: null, thenDenied: null, givenCaller: null, thenReturns: null,\n };\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n if (isFileDirective(child)) {\n continue;\n }\n if (parseOperationStep(context, child, body)) continue;\n // Absence assertions admit any whitespace after 'then'; every other directive keeps its first word.\n const keyword = thenNoPrefix.test(child.content) ? 'then' : firstWord(child.content);\n if (keyword === 'parameter') {\n const parameter = parseParameter(context, child);\n if (parameter !== null) parameters.push(parameter);\n } else if (keyword === 'case') {\n const row = parseCase(context, child);\n if (row !== null) cases.push(row);\n } else if (keyword === 'description') {\n description = parseDescription(context, child, description, `Specification '${name}'`);\n } else if (keyword === 'given') {\n parseGiven(context, child, body);\n } else if (keyword === 'when') {\n parseWhen(context, child, body, name);\n } else if (keyword === 'then') {\n parseThen(context, child, body);\n } else {\n context.error(DiagnosticCodes.UnknownSpecificationDirective, `Unexpected '${firstWord(child.content)}' in specification body`, locationOf(child));\n context.skipBlock(child.indent);\n }\n }\n if (body.noEventsLine !== undefined && (body.thenEvents.length > 0 || body.thenEventsInAnyOrder || body.thenErrors.length > 0 || body.thenDenied !== null)) {\n context.error(DiagnosticCodes.InvalidNoEventsExpectation,\n \"'then no events' cannot accompany event, event-order, error or denial expectations.\", locationOf(body.noEventsLine));\n }\n validateQueryRejection(context, line, body);\n const { whenDeclared: _, noEventsLine: _noEventsLine, ...members } = body;\n const specification: SpecificationSyntax = { kind: 'SpecificationSyntax', sourceOptions: context.sourceOptions, name, description, ...members,\n ...(parameters.length === 0 ? {} : { parameters }), ...(cases.length === 0 ? {} : { cases }), location: locationOf(line) };\n validateTable(specification, context);\n return specification;\n}\n\nfunction validateQueryRejection(context: ParserContext, line: SourceLine, body: SpecificationBody): void {\n if (!isQueryRejectionCandidate(body) || isWellFormedQueryRejection(body)) return;\n context.error(DiagnosticCodes.MismatchedSpecificationQueryResult,\n \"A query rejection requires exactly one query and one 'then error', no action, and no other outcomes\", locationOf(line));\n}\n\nfunction isQueryRejectionCandidate(body: SpecificationBody): boolean {\n return body.thenErrors.length > 0 && queriedCallCount(body) > 0 && (body.whenQuery !== null || !hasAction(body));\n}\n\nfunction isWellFormedQueryRejection(body: SpecificationBody): boolean {\n return !hasAction(body) && hasOneQueryAndOneError(body) && !hasOtherOutcome(body);\n}\n\nfunction hasOneQueryAndOneError(body: SpecificationBody): boolean {\n return queriedCallCount(body) === 1 && body.thenErrors.length === 1;\n}\n\nfunction hasAction(body: SpecificationBody): boolean {\n return [body.when, body.whenAppended, body.whenClock, body.whenTrigger, body.whenCapture, body.whenRedelivered].some(action => action !== null);\n}\n\nfunction queriedCallCount(body: SpecificationBody): number {\n return body.thenQueries.length + (body.whenQuery === null ? 0 : 1);\n}\n\nfunction hasOtherOutcome(body: SpecificationBody): boolean {\n return [\n body.thenResults.length > 0,\n body.thenNoResult !== null,\n body.thenDenied !== null,\n body.thenEvents.length > 0,\n body.thenNoEvents,\n body.thenEventsInAnyOrder,\n body.thenReadModels.length > 0,\n body.thenAbsentReadModels.length > 0,\n body.thenReturns !== null,\n body.thenQueries.some(query => query.results.length > 0)\n ].some(outcome => outcome);\n}\n\nfunction parseOperationStep(context: ParserContext, line: SourceLine, body: SpecificationBody): boolean {\n if (!operationStepPrefix.test(line.content)) return false;\n const match = operationStep.exec(line.content);\n if (match === null || (match[1] === 'given operation') !== (match[3] !== undefined)) {\n context.error(DiagnosticCodes.InvalidOperationSpecification, \"Expected 'given operation <Name> fails', 'then operation <Name>' or 'then compensated <Name>'.\", locationOf(line));\n skipBody(context, line.indent);\n } else if (match[1] === 'then operation') {\n const values: PropertyMappingSyntax[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n const value = parseConcreteMapping(context, child, mappingPattern, DiagnosticCodes.InvalidOperationSpecification);\n if (value !== null) values.push(value);\n }\n body.thenOperations.push({ kind: 'SpecificationOperationSyntax', operation: match[2], values, location: locationOf(line) });\n } else {\n rejectOperationChildren(context, line, DiagnosticCodes.InvalidOperationSpecification, 'Failure and compensation assertions cannot have children.');\n if (match[1] === 'given operation') body.givenOperationFailures.push({ kind: 'SpecificationOperationFailureSyntax', operation: match[2], location: locationOf(line) });\n else body.thenCompensated.push({ kind: 'SpecificationCompensatedSyntax', operation: match[2], location: locationOf(line) });\n }\n return true;\n}\n\nfunction parseGiven(context: ParserContext, line: SourceLine, body: SpecificationBody): void {\n if (givenClockPrefix.test(line.content)) {\n if (body.givenClock !== null) {\n context.error(DiagnosticCodes.InvalidSpecificationClock, 'A specification states its clock at most once.', locationOf(line));\n skipBody(context, line.indent);\n } else {\n body.givenClock = parseClock(context, line, 'given');\n }\n } else if (givenCapturePrefix.test(line.content)) {\n const capture = parseCapture(context, line, 'given');\n if (capture !== null) {\n body.givenCaptures.push(capture);\n }\n } else if (line.content.startsWith('given caller')) {\n if (body.givenCaller !== null || body.givenCallerPersona !== undefined) {\n context.error(DiagnosticCodes.DuplicateSpecificationCallerOrDenied, \"A specification has at most one 'given caller' block.\", locationOf(line));\n context.skipBlock(line.indent);\n } else if (line.content.startsWith('given caller as')) {\n const match = callerPersonaPattern.exec(line.content);\n if (match === null) context.error(DiagnosticCodes.InvalidSpecificationCallerPersona, \"Expected 'given caller as <Persona>'.\", locationOf(line));\n const child = context.peekChild(line.indent);\n if (child !== undefined) context.error(DiagnosticCodes.InvalidSpecificationCallerPersona, \"'given caller as <Persona>' has no body; use an explicit 'given caller' for refinements.\", locationOf(child));\n skipBody(context, line.indent);\n if (match !== null) body.givenCallerPersona = { kind: 'SpecificationCallerPersonaSyntax', name: match[1], location: locationOf(line) };\n } else {\n body.givenCaller = parseCaller(context, line);\n }\n } else if (readModelPrefix.test(line.content)) {\n const readModel = parseReadModelStep(context, line, givenReadModelPattern, 'given');\n if (readModel !== undefined) {\n body.givenReadModels.push(readModel);\n }\n } else {\n const event = parseEventStep(context, line, givenPattern, 'given');\n if (event !== undefined) {\n body.given.push(event);\n }\n }\n}\n\nconst callerRolePattern = pattern(`^role${dotNetWhitespace}+\"(${stringBodyPattern})\"$`);\nconst callerClaimPattern = pattern(`^claim${dotNetWhitespace}+\"(${stringBodyPattern})\"${dotNetWhitespace}*=${dotNetWhitespace}*\"(${stringBodyPattern})\"$`);\n\n// 'given caller' and the authenticated, role and claim lines under it.\nfunction parseCaller(context: ParserContext, line: SourceLine): SpecificationCallerSyntax | null {\n if (line.content !== 'given caller') {\n context.error(DiagnosticCodes.InvalidSpecificationCaller, \"Expected exactly 'given caller'.\", locationOf(line));\n context.skipBlock(line.indent);\n return null;\n }\n let authenticated = false;\n const roles: string[] = [];\n const claims: SpecificationCallerClaimSyntax[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n const role = callerRolePattern.exec(child.content);\n const claim = callerClaimPattern.exec(child.content);\n if (child.content === 'authenticated' && !authenticated) {\n authenticated = true;\n } else if (role !== null) {\n roles.push(unescapeString(role[1]));\n } else if (claim !== null) {\n claims.push({ kind: 'SpecificationCallerClaimSyntax', type: unescapeString(claim[1]), value: unescapeString(claim[2]), location: locationOf(child) });\n } else {\n context.error(containsCaseReference(child.content) ? DiagnosticCodes.InvalidSpecificationCaseReference : DiagnosticCodes.InvalidSpecificationCaller, `Invalid caller fixture '${child.content}' - expected authenticated, role \"...\", or claim \"...\" = \"...\".`, locationOf(child));\n }\n }\n return { kind: 'SpecificationCallerSyntax', authenticated, roles, claims, location: locationOf(line) };\n}\n\nfunction parseWhen(context: ParserContext, line: SourceLine, body: SpecificationBody, name: string): void {\n const appends = line.content.startsWith('when append');\n if (body.whenDeclared) {\n const code = body.whenAppended !== null || appends ? DiagnosticCodes.ConflictingSpecificationActions : DiagnosticCodes.DuplicateSpecificationWhen;\n context.error(code, `Specification '${name}' already declares a 'when' - a specification can have at most one`, locationOf(line));\n skipBody(context, line.indent);\n return;\n }\n body.whenDeclared = true;\n if (appends) {\n body.whenAppended = parseEventStep(context, line, whenAppendPattern, 'when append') ?? null;\n return;\n }\n if (whenRedeliveredPrefix.test(line.content)) {\n const match = whenRedeliveredPattern.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.UnmatchedRedeliveredOccurrence, \"Expected 'when redelivered <Event> to <Reaction>'.\", locationOf(line));\n skipBody(context, line.indent);\n } else {\n body.whenRedelivered = { kind: 'SpecificationRedeliverySyntax', eventType: match[1], reaction: match[2], ...parseValuesWithEventSource(context, line, undefined, undefined, 'when redelivered'), location: locationOf(line) };\n }\n return;\n }\n if (whenClockPrefix.test(line.content)) {\n body.whenClock = parseClock(context, line, 'when');\n return;\n }\n if (whenTriggerPrefix.test(line.content)) {\n body.whenTrigger = parseNamedStep(context, line, whenTriggerPattern, DiagnosticCodes.InvalidSpecificationTrigger, 'when trigger', 'when trigger <Trigger>',\n (trigger, values) => ({ kind: 'SpecificationTriggerSyntax', trigger, values, location: locationOf(line) }));\n return;\n }\n if (whenCapturePrefix.test(line.content)) {\n body.whenCapture = parseCapture(context, line, 'when');\n return;\n }\n if (whenQueryPrefix.test(line.content)) {\n body.whenQuery = parseNamedStep(context, line, whenQueryPattern, DiagnosticCodes.InvalidSpecificationQueryAction, 'when query', 'when query <Query>',\n (query, values) => ({ kind: 'SpecificationWhenQuerySyntax', query, arguments: values, location: locationOf(line) }), true);\n return;\n }\n const match = whenPattern.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidSpecificationWhen, `Invalid 'when' declaration '${line.content}' - expected 'when <CommandType>' or 'when append <EventType>'`, locationOf(line));\n skipBody(context, line.indent);\n return;\n }\n const generatedValues: PropertyMappingSyntax[] = [];\n const values = parseValuesWithEventSource(context, line, generatedValues, match);\n body.when = { kind: 'SpecificationCommandSyntax', commandType: match[1], ...values, generatedValues, inlineProperty: match.groups?.property ?? null, location: locationOf(line) };\n}\n\nfunction parseThen(context: ParserContext, line: SourceLine, body: SpecificationBody): void {\n if (noEventsPrefix.test(line.content)) {\n if (line.content !== 'then no events' || body.thenNoEvents) {\n context.error(DiagnosticCodes.InvalidNoEventsExpectation, \"Expected one 'then no events' directive.\", locationOf(line));\n } else {\n body.thenNoEvents = true;\n body.noEventsLine = line;\n }\n const child = context.peekChild(line.indent);\n if (child !== undefined) context.error(DiagnosticCodes.InvalidNoEventsExpectation, \"'then no events' cannot have child mappings.\", locationOf(child));\n skipBody(context, line.indent);\n return;\n }\n if (thenReturnsPrefix.test(line.content)) {\n const expectation = parseReturn(context, line);\n if (body.thenReturns !== null) {\n context.error(DiagnosticCodes.InvalidReturnExpectation, 'A specification declares at most one return expectation.', locationOf(line));\n } else {\n body.thenReturns = expectation;\n }\n return;\n }\n if (line.content.startsWith('then events')) {\n if (line.content !== 'then events in any order' || body.thenEventsInAnyOrder) {\n context.error(DiagnosticCodes.InvalidSpecificationEventOrder, 'Expected one \\'then events in any order\\' directive.', locationOf(line));\n } else {\n body.thenEventsInAnyOrder = true;\n }\n skipBody(context, line.indent);\n return;\n }\n if (thenResultPrefix.test(line.content)) {\n parseResult(context, line, body);\n return;\n }\n if (noResultPrefix.test(line.content)) {\n if (line.content !== 'then no result' || body.thenNoResult !== null) {\n context.error(DiagnosticCodes.InvalidSpecificationQueryAction, 'Expected one \\'then no result\\' directive.', locationOf(line));\n } else {\n body.thenNoResult = { kind: 'SpecificationNoResultSyntax', location: locationOf(line) };\n }\n skipBody(context, line.indent);\n return;\n }\n if (line.content.startsWith('then denied')) {\n if (line.content !== 'then denied') {\n context.error(DiagnosticCodes.InvalidSpecificationDenied, 'Expected exactly \\'then denied\\'.', locationOf(line));\n skipBody(context, line.indent);\n } else if (body.thenDenied !== null) {\n context.error(DiagnosticCodes.DuplicateSpecificationCallerOrDenied, \"A specification has at most one 'then denied' outcome.\", locationOf(line));\n } else {\n body.thenDenied = { kind: 'SpecificationDeniedSyntax', location: locationOf(line) };\n }\n return;\n }\n if (line.content === 'then error') {\n body.thenErrors.push({ kind: 'SpecificationErrorSyntax', name: null, location: locationOf(line) });\n return;\n }\n if (line.content.startsWith('then error case.')) {\n const caseValue = parseMappingSource(line.content.substring(11), { ...locationOf(line), column: locationOf(line).column + 11 }, context);\n if (caseValue.kind === 'CaseValueExpressionSyntax') body.thenErrors.push({ kind: 'SpecificationErrorSyntax', name: null, caseValue, location: locationOf(line) });\n return;\n }\n const error = thenErrorPattern.exec(line.content);\n if (error !== null) {\n body.thenErrors.push({ kind: 'SpecificationErrorSyntax', name: unescapeString(error[1]), location: locationOf(line) });\n return;\n }\n if (firstWord(line.content.substring('then'.length).trim()) === 'error') {\n context.error(DiagnosticCodes.InvalidThenError, `Invalid 'then error' declaration '${line.content}' - expected 'then error' or 'then error \"<reason>\"'`, locationOf(line));\n skipBody(context, line.indent);\n return;\n }\n if (thenNoPrefix.test(line.content)) {\n // Legacy documents keep skipping these assertions silently; Exact mirrors the native diagnostics.\n if (context.sourceOptions.numericMode === 'exact') {\n const absent = parseAbsentReadModel(context, line);\n if (absent !== null) body.thenAbsentReadModels.push(absent);\n return;\n }\n const match = thenAbsentReadModelPattern.exec(line.content);\n if (match !== null && !match[2].endsWith(' exactly')) {\n const key = parseMappingSource(match[2].trim(), locationOf(line), context.valueContext);\n if (key.kind === 'LiteralExpressionSyntax' || key.kind === 'ObjectExpressionSyntax' || key.kind === 'CaseValueExpressionSyntax') body.thenAbsentReadModels.push({ kind: 'SpecificationAbsentReadModelSyntax', name: match[1], key, location: locationOf(line) });\n }\n context.skipOpaqueBlock(line.indent);\n return;\n }\n if (thenQueryPrefix.test(line.content)) {\n // Legacy documents keep skipping malformed query bodies silently; Exact reports what the native parser reports.\n const exact = context.sourceOptions.numericMode === 'exact';\n const reject = (code: string, message: string, at: SourceLine): void => {\n if (!exact) return context.skipOpaqueBlock(at.indent);\n context.error(code, message, locationOf(at));\n context.skipBlock(at.indent);\n };\n const match = thenQueryPattern.exec(line.content);\n if (match === null) return reject(DiagnosticCodes.InvalidSpecificationQuery, `Invalid 'then query' declaration '${line.content}' - expected 'then query <Query> [exactly]'`, line);\n const args: PropertyMappingSyntax[] = [];\n const results: SpecificationQueryResultSyntax[] = [];\n let hasArguments = false;\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n if (child.content === 'arguments' && !hasArguments) args.push(...parseValues(context.valueContext, child, true, undefined, context));\n else if (child.content === 'arguments') reject(DiagnosticCodes.DuplicateSpecificationQueryArguments, `Query assertion '${match[1]}' already declares arguments`, child);\n else if (child.content === 'result') results.push({ kind: 'SpecificationQueryResultSyntax', properties: parseValues(context.valueContext, child, true), exactly: false, location: locationOf(child) });\n else reject(DiagnosticCodes.UnknownSpecificationQueryDirective, `Unexpected '${firstWord(child.content)}' in 'then query' body - expected arguments or result`, child);\n hasArguments ||= child.content === 'arguments';\n }\n body.thenQueries.push({ kind: 'SpecificationQuerySyntax', query: match[1], arguments: args, results, exactly: match[2] !== undefined, location: locationOf(line) });\n return;\n }\n if (readModelPrefix.test(line.content)) {\n const readModel = parseReadModelStep(context, line, thenReadModelPattern, 'then');\n if (readModel !== undefined) {\n body.thenReadModels.push(readModel);\n }\n return;\n }\n const event = parseEventStep(context, line, thenEventPattern, 'then');\n if (event !== undefined) {\n body.thenEvents.push(event);\n }\n}\n\n// The Exact port of C# ParseAbsentReadModel: every malformed part is reported rather than dropped.\nfunction parseAbsentReadModel(context: ParserContext, line: SourceLine): SpecificationAbsentReadModelSyntax | null {\n const match = thenAbsentReadModelPattern.exec(line.content);\n if (match === null || match[2].endsWith(' exactly')) {\n context.error(DiagnosticCodes.InvalidAbsentReadModelStep, `Invalid absence assertion '${line.content}' - expected 'then no readmodel <ReadModelType> for <key>'`, locationOf(line));\n skipBody(context, line.indent);\n return null;\n }\n const keyText = match[2].trim();\n const validString = !(keyText.startsWith('\"') || keyText.startsWith(\"'\")) || absentKeyStringPattern.test(keyText);\n const key = validString ? parseMappingSource(keyText, locationOf(line), context.valueContext) : null;\n const concrete = key !== null && (key.kind === 'LiteralExpressionSyntax' || key.kind === 'ObjectExpressionSyntax' || key.kind === 'CaseValueExpressionSyntax');\n if (!concrete) context.error(DiagnosticCodes.InvalidAbsentReadModelStep, `Invalid absence key '${keyText}' - expected exactly one concrete value.`, locationOf(line));\n let hasChildren = false;\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n context.error(DiagnosticCodes.InvalidAbsentReadModelStep, 'An absent read model assertion cannot have child mappings.', locationOf(child));\n hasChildren = true;\n }\n return hasChildren || !concrete ? null : { kind: 'SpecificationAbsentReadModelSyntax', name: match[1], key, location: locationOf(line) } as SpecificationAbsentReadModelSyntax;\n}\n\nfunction skipBody(context: ParserContext, indent: number): void {\n if (context.sourceOptions.numericMode !== 'exact') return context.skipBlock(indent);\n context.skipOpaqueBlock(indent);\n}\n\nfunction parseClock(context: ParserContext, line: SourceLine, keyword: string): SpecificationClockSyntax | null {\n const match = clockPattern.exec(line.content);\n skipBody(context, line.indent);\n if (match === null || match[1] !== keyword) {\n context.error(containsCaseReference(line.content) ? DiagnosticCodes.InvalidSpecificationCaseReference : DiagnosticCodes.InvalidSpecificationClock,\n `Invalid '${keyword} clock' - expected '${keyword} clock \"<ISO 8601 instant>\"', such as '${keyword} clock \"2026-10-05T08:00:00Z\"'`, locationOf(line));\n return null;\n }\n return { kind: 'SpecificationClockSyntax', instant: match[2], location: locationOf(line) };\n}\n\nfunction parseCapture(context: ParserContext, line: SourceLine, keyword: string): SpecificationCaptureSyntax | null {\n return parseNamedStep(context, line, capturePattern, DiagnosticCodes.InvalidSpecificationCapture, `${keyword} capture`, `${keyword} capture <Capture>`,\n (capture, record) => ({ kind: 'SpecificationCaptureSyntax', capture, record, location: locationOf(line) }));\n}\n\n// A step naming one thing on its header line, with '<field> = <value>' lines beneath it.\nfunction parseNamedStep<T>(\n context: ParserContext, line: SourceLine, regex: RegExp, code: string, keyword: string, expected: string,\n create: (name: string, values: PropertyMappingSyntax[]) => T, queryArguments = false): T | null {\n const match = regex.exec(line.content);\n if (match === null) {\n context.error(code, `Invalid '${keyword}' declaration '${line.content}' - expected '${expected}'`, locationOf(line));\n skipBody(context, line.indent);\n return null;\n }\n return create(match[1], parseValues(context, line, false, undefined, queryArguments ? context : undefined));\n}\n\nfunction parseResult(context: ParserContext, line: SourceLine, body: SpecificationBody): void {\n const match = thenResultPattern.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidSpecificationQueryAction, `Invalid 'then result' declaration '${line.content}' - expected 'then result [exactly]'`, locationOf(line));\n skipBody(context, line.indent);\n return;\n }\n body.thenResults.push({ kind: 'SpecificationQueryResultSyntax', properties: parseValues(context, line), exactly: match[1] !== undefined, location: locationOf(line) });\n}\n\nfunction parseReadModelStep(context: ParserContext, line: SourceLine, regex: RegExp, keyword: string): SpecificationReadModelSyntax | undefined {\n const match = regex.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidReadModelStep, `Invalid '${keyword} readmodel' declaration '${line.content}' - expected '${keyword} readmodel <ReadModelType>'`, locationOf(line));\n skipBody(context, line.indent);\n return undefined;\n }\n return {\n kind: 'SpecificationReadModelSyntax',\n name: match[1],\n properties: parseValues(context, line, false, match),\n exactly: keyword === 'then' && match.groups?.exactly !== undefined,\n inlineProperty: match.groups?.property ?? null,\n location: locationOf(line),\n };\n}\n\nfunction parseEventStep(context: ParserContext, line: SourceLine, regex: RegExp, keyword: string): SpecificationEventSyntax | undefined {\n const match = regex.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidEventStep, `Invalid '${keyword}' declaration '${line.content}' - expected '${keyword} <EventType>'`, locationOf(line));\n skipBody(context, line.indent);\n return undefined;\n }\n return { kind: 'SpecificationEventSyntax', eventType: match[1], ...parseValuesWithEventSource(context, line, undefined, match, keyword), inlineProperty: match.groups?.property ?? null, location: locationOf(line) };\n}\n\nexport const specificationStream = sourceStreamPattern('^stream\\\\s+([A-Za-z_]\\\\w*)\\\\.([A-Za-z_]\\\\w*)$');\nconst specificationStreamId = pattern('^streamId\\\\s*=(?!=|>)\\\\s*(.+)$');\n\nfunction parseValuesWithEventSource(context: ParserContext, parent: SourceLine, generated?: PropertyMappingSyntax[], inline?: RegExpExecArray, eventKeyword?: string): { values: PropertyMappingSyntax[]; for: ExpressionSyntax | null; stream?: SpecificationStreamSyntax; noStream?: SpecificationNoStreamSyntax } {\n const values: PropertyMappingSyntax[] = [];\n addInlineValue(context, parent, inline, values);\n let eventSource: ExpressionSyntax | null = null;\n let stream: SpecificationStreamSyntax | undefined;\n let noStream: SpecificationNoStreamSyntax | undefined;\n let hasRoute = false;\n for (let child = context.peekChild(parent.indent); child !== undefined; child = context.peekChild(parent.indent)) {\n context.reader.takeSignificant();\n if (generated !== undefined && generatedFixturePrefix.test(child.content)) {\n const fixture = parseConcreteMapping(context, child, generatedFixturePattern, DiagnosticCodes.InvalidGeneratedFixture);\n if (fixture !== null) generated.push(fixture);\n continue;\n }\n const mapping = mappingPattern.exec(child.content);\n if (mapping !== null) {\n addFixtureValue(context, values, mappingOf(context, child, mapping));\n } else if (firstWord(child.content) === 'stream' || child.content.startsWith('no stream')) {\n if (eventKeyword === undefined) {\n context.error(DiagnosticCodes.SpecificationStreamOnCommand, 'A command occurrence cannot declare a route; assert it on a then event.', locationOf(child));\n context.skipBlock(child.indent);\n continue;\n }\n if (hasRoute) {\n context.error(DiagnosticCodes.InvalidSpecificationStream, 'An event occurrence declares at most one stream or no stream directive.', locationOf(child));\n context.skipBlock(child.indent);\n continue;\n }\n const route = specificationStream.exec(child.content);\n if (child.content === 'no stream' && (eventKeyword === 'then' || eventKeyword === 'when redelivered')) {\n noStream = { kind: 'SpecificationNoStreamSyntax', location: locationOf(child) };\n hasRoute = true;\n rejectSpecificationRouteChildren(context, child);\n } else if (route !== null) {\n stream = parseSpecificationStream(context, child, route);\n hasRoute = true;\n } else {\n context.error(DiagnosticCodes.InvalidSpecificationStream, \"Expected 'stream Source.Stream', or 'no stream' on a then event.\", locationOf(child));\n context.skipBlock(child.indent);\n }\n } else if (firstWord(child.content) === 'for') {\n const source = child.content.substring('for'.length).trim();\n if (source.length === 0) {\n context.error(DiagnosticCodes.InvalidSpecificationEventSource, 'Invalid event-source assertion \\'for\\' - expected \\'for <value>\\'', locationOf(child));\n } else if (eventSource !== null) {\n context.error(DiagnosticCodes.DuplicateSpecificationEventSource, 'A specification step can declare its event-source assertion only once', locationOf(child));\n } else {\n eventSource = parseMappingSource(source, locationOf(child), context);\n }\n } else {\n context.error(DiagnosticCodes.InvalidSpecificationValue, `Invalid property mapping '${child.content}' - expected '<property> = <value>'`, locationOf(child));\n }\n }\n return { values, for: eventSource, ...(stream === undefined ? {} : { stream }), ...(noStream === undefined ? {} : { noStream }) };\n}\n\nexport function parseSpecificationStream(context: ParserContext, header: SourceLine, route: RegExpExecArray): SpecificationStreamSyntax {\n let streamId: PropertyMappingSyntax | null = null;\n let streamIdParts: PropertyMappingSyntax[] = [];\n let block = false;\n const directiveLocations: Record<string, ReturnType<typeof locationOf>> = {};\n for (let child = context.peekChild(header.indent); child !== undefined; child = context.peekChild(header.indent)) {\n context.reader.takeSignificant();\n if (child.content === 'streamId') {\n if (streamId !== null || block) {\n context.error(DiagnosticCodes.InvalidSpecificationStream, \"Declare either one 'streamId = <literal>' mapping or one streamId part block.\", locationOf(child));\n context.skipBlock(child.indent);\n } else {\n block = true;\n directiveLocations.streamId = locationOf(child);\n streamIdParts = parseRouteParts(context, child, DiagnosticCodes.InvalidSpecificationStream).map(part => part.source.kind === 'PathExpressionSyntax' && part.source.path.startsWith('case.')\n ? { ...part, source: parseMappingSource(part.source.path, part.source.location, context) } : part);\n }\n continue;\n }\n const mapping = specificationStreamId.exec(child.content);\n if (mapping === null || streamId !== null || block) {\n context.error(DiagnosticCodes.InvalidSpecificationStream, \"Declare either one 'streamId = <literal>' mapping or one streamId part block.\", locationOf(child));\n context.skipBlock(child.indent);\n continue;\n }\n const location = { ...locationOf(child), column: child.indent + 1 + child.content.indexOf(mapping[1], child.content.indexOf('=') + 1) };\n streamId = { kind: 'PropertyMappingSyntax', property: 'streamId', source: parseMappingSource(mapping[1], location, context), location: locationOf(child) };\n rejectSpecificationRouteChildren(context, child);\n }\n return { kind: 'SpecificationStreamSyntax', eventSource: route[1], stream: route[2], streamId, streamIdParts, directiveLocations,\n referenceLocation: { ...locationOf(header), column: header.indent + 1 + header.content.indexOf(route[1], 'stream'.length) },\n referenceLength: route[1].length + 1 + route[2].length, location: locationOf(header) };\n}\n\nexport function rejectSpecificationRouteChildren(context: ParserContext, line: SourceLine): void {\n const child = context.peekChild(line.indent);\n if (child !== undefined) {\n context.error(DiagnosticCodes.InvalidSpecificationStream, 'This directive cannot have children.', locationOf(child));\n context.skipBlock(line.indent);\n }\n}\n\nfunction parseValues(context: ParserContext, parent: SourceLine, nativeIdentifiers = false, inline?: RegExpExecArray, queryArgumentsContext?: ParserContext): PropertyMappingSyntax[] {\n const values: PropertyMappingSyntax[] = [];\n addInlineValue(context, parent, inline, values);\n for (let child = context.peekChild(parent.indent); child !== undefined; child = context.peekChild(parent.indent)) {\n context.reader.takeSignificant();\n const mapping = (nativeIdentifiers || context.sourceOptions.numericMode === 'exact' ? nativeMappingPattern : mappingPattern).exec(child.content);\n if (mapping === null) {\n context.error(DiagnosticCodes.InvalidSpecificationValue, `Invalid property mapping '${child.content}' - expected '<property> = <value>'`, locationOf(child));\n continue;\n }\n const value = mappingOf(context, child, mapping, nativeIdentifiers);\n if (queryArgumentsContext !== undefined) {\n if (values.some(existing => existing.property === value.property)) {\n queryArgumentsContext.error(DiagnosticCodes.UnknownSpecificationQueryArgument, `Query argument '${value.property}' is repeated.`, value.location);\n }\n values.push(value);\n } else {\n addFixtureValue(context, values, value);\n }\n }\n return values;\n}\n\nfunction mappingOf(context: ParserContext, line: SourceLine, match: RegExpExecArray, nativeIdentifiers = false): PropertyMappingSyntax {\n return { kind: 'PropertyMappingSyntax', property: match[1], source: parseMappingSource(match[2], locationOf(line), context, nativeIdentifiers), location: locationOf(line) };\n}\n"],"mappings":"6jCA0BA,MAAMC,EAAsBC,EAAQ,oEAAoE,EAClGC,EAAgBD,EAAQ,yGAAyG,EACjIE,EAASF,EAAQ,oCAAoC,EACrDG,EAAuBH,EAAQ,mCAAmC,EAGlE,aAAe,EAAgB,EAAU,KAAeI,EAAc,IAAIC,EAAO,6BAAiBC,8DAA8B,WAAW,MAAOC,CAAgB,CAAC,EACnKC,EAAe,YAAY,OAAO,EAClCC,EAAoB,YAAY,gBAAgB,EAChDC,EAAc,YAAY,MAAM,EAChCC,EAAmB,YAAY,MAAM,EACrCC,EAAkBZ,EAAQ,mBAAmB,EAC7Ca,EAAkBb,EAAQ,iCAAiC,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,UAAU1B,EAASO,EAAOyE,EAASY,CAAiB,EAC9DC,IAA0B,IAAA,GAM1BZ,EAAgBjF,EAASyB,EAAQC,CAAK,GALlCD,EAAO,KAAK,GAAYqE,EAAS,WAAapE,EAAM,QAAQ,GAC5DmE,EAAsB,MAAM5F,EAAgB,kCAAmC,mBAAmByB,EAAM,SAAS,gBAAiBA,EAAM,QAAQ,EAEpJD,EAAO,KAAKC,CAAK,EAIzB,CACA,OAAOD,CACX,CAEA,SAAS,UAAU,EAAwB,EAAkB,EAAwB,EAAoB,GAA8B,CACnI,MAAO,CAAE,KAAM,wBAAyB,SAAUD,EAAM,GAAI,OAAQpE,EAAmBoE,EAAM,GAAItB,EAAWH,CAAI,EAAGC,EAAS4F,CAAiB,EAAG,SAAU1F,EAAWH,CAAI,CAAE,CAC/K"}
@@ -12,8 +12,11 @@ import"./_virtual/_virtual/_rolldown/runtime.js";import{identityProperties as e}
12
12
  acknowledge`,documentation:`Handles validation and constraint refusals, not authorization. ${T}`},{label:`on refused by validation`,insertText:`on refused by validation
13
13
  acknowledge`,documentation:`Handles error-severity property, concept and require refusals. ${T}`},{label:`on refused by constraint`,insertText:`on refused by constraint \${1:Name}
14
14
  acknowledge`,documentation:`Handles a named constraint refusal; omit the name for any constraint. ${T}`},{label:`on refused by authorization`,insertText:`on refused by authorization
15
- acknowledge`,documentation:`Explicitly handles unauthorized results, never Unsupported. ${T}`}],D=[{label:`acknowledge`,insertText:`acknowledge`,documentation:`Acknowledges alone, without productions. ${T}`},{label:`produces`,insertText:"produces ${1:Event}\n ${2:reason} = \\$refusal.reason",documentation:`Records the refusal with ordinary event productions. ${T}`}],O=[{label:`file`,insertText:"file ${1:Path}",documentation:`Names the repository relative file this declaration is realized by, so the document can be navigated back to the code.`},{label:`description`,insertText:'description "${1:when this occurs}"',documentation:`What makes an occurrence of this trigger happen.`},{label:`value`,insertText:"${1:name} ${2:Type}",documentation:`A value an occurrence hands the reaction. The type is optional.`}],k=[{label:`parameter`,insertText:"parameter ${1:name} ${2:Type}",documentation:`One typed value, supplied exactly once by every case.`},{label:`case`,insertText:"case ${1:Name}\n ${2:parameter} = ${3:value}",documentation:`One named complete set of concrete parameter values.`},{label:`given caller as`,insertText:"given caller as ${1:Persona}",documentation:`An authenticated deterministic witness of a top-level persona; no body. Use explicit callers for negation, ownership claims and implementations.`},{label:`description`,insertText:'description "${1:rule or case witnessed}"',documentation:`Authoring-only description of what this scenario demonstrates.`},{label:`when redelivered`,insertText:"when redelivered ${1:Event} to ${2:Reaction}\n for ${3:value}",documentation:`Selects exactly one given event occurrence and delivers it again to one named event-trigger reaction; the event is not appended again. Executable from ESM v17.`},{label:`given operation fails`,insertText:"given operation ${1:Name} fails",documentation:`Failure fixture leaf; not admitted by any supported executable model (ESM) version yet (PLAY0268).`},{label:`then operation`,insertText:"then operation ${1:Name}\n ${2:input} = ${3:value}",documentation:`Partial requested-operation assertion; not admitted by any supported executable model (ESM) version yet (PLAY0268).`},{label:`then compensated`,insertText:"then compensated ${1:Name}",documentation:`Compensation assertion leaf; not admitted by any supported executable model (ESM) version yet (PLAY0268).`},{label:`file`,insertText:"file ${1:Path}",documentation:`Names the repository relative file this declaration is realized by, so the document can be navigated back to the code.`},{label:`given`,insertText:"given ${1:EventType}\n ${2:property} = ${3:value}",documentation:`Establishes prior state by replaying an event before the command runs.`},{label:`given readmodel`,insertText:"given readmodel ${1:ReadModelType}\n ${2:property} = ${3:value}",documentation:`Establishes prior read model state directly.`},{label:`when`,insertText:"when ${1:CommandType}\n ${2:property} = ${3:value}",documentation:`The command being exercised.`},{label:`then`,insertText:"then ${1:EventType}\n ${2:property} = ${3:value}",documentation:`An event expected to be produced by the command.`},{label:`then readmodel`,insertText:"then readmodel ${1:ReadModelType}\n ${2:property} = ${3:value}",documentation:`The read model state expected after the command.`},{label:`then no readmodel`,insertText:"then no readmodel ${1:ReadModelType} for ${2:key}",documentation:`Asserts that precisely one keyed read-model instance does not exist; another key may still be present.`},{label:`then query`,insertText:"then query ${1:QueryName}\n arguments\n ${2:argument} = ${3:value}\n result\n ${4:property} = ${5:value}",documentation:`The ordered query results expected for explicit arguments. Remove the result block to assert an empty result.`},{label:`then error`,insertText:`then error`,documentation:`A rejection, for a reason this specification does not name.`},{label:`then error "..."`,insertText:'then error "${1:reason}"',documentation:`A rejection, for the named reason.`},{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, as the action.`},{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
16
- \${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 what it returns with `then result` or `then no result`."},{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
15
+ acknowledge`,documentation:`Explicitly handles unauthorized results, never Unsupported. ${T}`}],D=[{label:`acknowledge`,insertText:`acknowledge`,documentation:`Acknowledges alone, without productions. ${T}`},{label:`produces`,insertText:"produces ${1:Event}\n ${2:reason} = \\$refusal.reason",documentation:`Records the refusal with ordinary event productions. ${T}`}],O=[{label:`file`,insertText:"file ${1:Path}",documentation:`Names the repository relative file this declaration is realized by, so the document can be navigated back to the code.`},{label:`description`,insertText:'description "${1:when this occurs}"',documentation:`What makes an occurrence of this trigger happen.`},{label:`value`,insertText:"${1:name} ${2:Type}",documentation:`A value an occurrence hands the reaction. The type is optional.`}],k=[{label:`parameter`,insertText:"parameter ${1:name} ${2:Type}",documentation:`One typed value, supplied exactly once by every case.`},{label:`case`,insertText:"case ${1:Name}\n ${2:parameter} = ${3:value}",documentation:`One named complete set of concrete parameter values.`},{label:`given caller as`,insertText:"given caller as ${1:Persona}",documentation:`An authenticated deterministic witness of a top-level persona; no body. Use explicit callers for negation, ownership claims and implementations.`},{label:`description`,insertText:'description "${1:rule or case witnessed}"',documentation:`Authoring-only description of what this scenario demonstrates.`},{label:`when redelivered`,insertText:"when redelivered ${1:Event} to ${2:Reaction}\n for ${3:value}",documentation:`Selects exactly one given event occurrence and delivers it again to one named event-trigger reaction; the event is not appended again. Executable from ESM v17.`},{label:`given operation fails`,insertText:"given operation ${1:Name} fails",documentation:`Failure fixture leaf; not admitted by any supported executable model (ESM) version yet (PLAY0268).`},{label:`then operation`,insertText:"then operation ${1:Name}\n ${2:input} = ${3:value}",documentation:`Partial requested-operation assertion; not admitted by any supported executable model (ESM) version yet (PLAY0268).`},{label:`then compensated`,insertText:"then compensated ${1:Name}",documentation:`Compensation assertion leaf; not admitted by any supported executable model (ESM) version yet (PLAY0268).`},{label:`file`,insertText:"file ${1:Path}",documentation:`Names the repository relative file this declaration is realized by, so the document can be navigated back to the code.`},{label:`given`,insertText:"given ${1:EventType}\n ${2:property} = ${3:value}",documentation:`Establishes prior state by replaying an event before the command runs.`},{label:`given readmodel`,insertText:"given readmodel ${1:ReadModelType}\n ${2:property} = ${3:value}",documentation:`Establishes prior read model state directly.`},{label:`when`,insertText:"when ${1:CommandType}\n ${2:property} = ${3:value}",documentation:`The command being exercised.`},{label:`then`,insertText:"then ${1:EventType}\n ${2:property} = ${3:value}",documentation:`An event expected to be produced by the command.`},{label:`then readmodel`,insertText:"then readmodel ${1:ReadModelType}\n ${2:property} = ${3:value}",documentation:`The read model state expected after the command.`},{label:`then no readmodel`,insertText:"then no readmodel ${1:ReadModelType} for ${2:key}",documentation:`Asserts that precisely one keyed read-model instance does not exist; another key may still be present.`},{label:`then query`,insertText:"then query ${1:QueryName}\n arguments\n ${2:argument} = ${3:value}\n result\n ${4:property} = ${5:value}",documentation:`The ordered query results expected for explicit arguments. Remove the result block to assert an empty result.`},{label:`then query rejected`,insertText:`then query \${1:Query}
16
+ arguments
17
+ \${2:argument} = \${3:value}
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
+ \${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
17
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:`The property must match a regular expression.`},{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}"
18
21
  on success
19
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