@cratis/screenplay-language 4.125.0 → 4.127.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/dist/bundles/compiler/Authoring/QuickFixes.js +2 -2
  2. package/dist/bundles/compiler/Authoring/QuickFixes.js.map +1 -1
  3. package/dist/bundles/compiler/Diagnostics/DiagnosticCodes.js +1 -1
  4. package/dist/bundles/compiler/Diagnostics/DiagnosticCodes.js.map +1 -1
  5. package/dist/bundles/compiler/Parsing/CaptureParser.js +1 -1
  6. package/dist/bundles/compiler/Parsing/CommandParser.js +1 -1
  7. package/dist/bundles/compiler/Parsing/CommandResponseParser.js +1 -1
  8. package/dist/bundles/compiler/Parsing/CompositionParser.js +1 -1
  9. package/dist/bundles/compiler/Parsing/ConceptComplianceParser.js +1 -1
  10. package/dist/bundles/compiler/Parsing/ConceptComplianceParser.js.map +1 -1
  11. package/dist/bundles/compiler/Parsing/ConditionParser.js +1 -1
  12. package/dist/bundles/compiler/Parsing/ConstraintParser.js +1 -1
  13. package/dist/bundles/compiler/Parsing/DeclarationParsers.js +1 -1
  14. package/dist/bundles/compiler/Parsing/DependencySourceParser.js +1 -1
  15. package/dist/bundles/compiler/Parsing/DescriptionParser.js +1 -1
  16. package/dist/bundles/compiler/Parsing/EventMetadataParser.js +1 -1
  17. package/dist/bundles/compiler/Parsing/EventSourceParser.js +1 -1
  18. package/dist/bundles/compiler/Parsing/ExpressionParser.js +1 -1
  19. package/dist/bundles/compiler/Parsing/FeatureBody.js +1 -1
  20. package/dist/bundles/compiler/Parsing/GuardedActionParser.js +1 -1
  21. package/dist/bundles/compiler/Parsing/IdentityParser.js +1 -1
  22. package/dist/bundles/compiler/Parsing/ImplementationParser.js +2 -2
  23. package/dist/bundles/compiler/Parsing/InputUses.js +1 -1
  24. package/dist/bundles/compiler/Parsing/InteractionAlternatives.js +1 -1
  25. package/dist/bundles/compiler/Parsing/ModuleBody.js +1 -1
  26. package/dist/bundles/compiler/Parsing/OperationParser.js +1 -1
  27. package/dist/bundles/compiler/Parsing/PolicyParser.js +1 -1
  28. package/dist/bundles/compiler/Parsing/ProducesParser.js +1 -1
  29. package/dist/bundles/compiler/Parsing/ProjectionParser.js +1 -1
  30. package/dist/bundles/compiler/Parsing/PropertyLineParser.js +1 -1
  31. package/dist/bundles/compiler/Parsing/PurposeParser.js +1 -1
  32. package/dist/bundles/compiler/Parsing/QueryParser.js +1 -1
  33. package/dist/bundles/compiler/Parsing/ReactionIdentityParser.js +1 -1
  34. package/dist/bundles/compiler/Parsing/ReactionParser.js +1 -1
  35. package/dist/bundles/compiler/Parsing/ScreenParser.js +1 -1
  36. package/dist/bundles/compiler/Parsing/ScreenplayParser.js +1 -1
  37. package/dist/bundles/compiler/Parsing/ScreenplayParser.js.map +1 -1
  38. package/dist/bundles/compiler/Parsing/SeedParser.js +1 -1
  39. package/dist/bundles/compiler/Parsing/SliceParser.js +1 -1
  40. package/dist/bundles/compiler/Parsing/SourceOptionsParser.js +1 -1
  41. package/dist/bundles/compiler/Parsing/SpecificationCaseParser.js +1 -1
  42. package/dist/bundles/compiler/Parsing/SpecificationExampleParser.js +1 -1
  43. package/dist/bundles/compiler/Parsing/SpecificationParser.js +1 -1
  44. package/dist/bundles/compiler/Parsing/SpecificationResponseParser.js +1 -1
  45. package/dist/bundles/compiler/Parsing/TriggerDataParser.js +1 -1
  46. package/dist/bundles/compiler/index.js +1 -1
  47. package/dist/bundles/diagnostic-codes.js +1 -1
  48. package/dist/bundles/diagnostic-codes.js.map +1 -1
  49. package/dist/bundles/validation.js +1 -1
  50. package/dist/bundles/validation.js.map +1 -1
  51. package/dist/diagnostic-codes.d.ts +1 -0
  52. package/dist/diagnostic-codes.d.ts.map +1 -1
  53. package/package.json +1 -1
@@ -1,2 +1,2 @@
1
- import"../../_virtual/_virtual/_rolldown/runtime.js";import{DiagnosticCodes as e}from"../Diagnostics/DiagnosticCodes.js";import{dotNetWhitespace as t,nativePattern as n,pattern as r}from"../Text/patterns.js";import{stringBodyPattern as i,unescapeString as a}from"../Text/StringLiteral.js";import{firstWord as o}from"./LineText.js";import{locationOf as s}from"./SourceLine.js";import{generatedFixturePattern as c,generatedFixturePrefix as l,parseConcreteMapping as u,parseReturn as d,thenReturnsPrefix as f}from"./SpecificationResponseParser.js";import{containsCaseReference as p,parseCase as m,parseParameter as h,parseSpecificationValue as g,validateTable as ee}from"./SpecificationCaseParser.js";import{parseDescription as te}from"./DescriptionParser.js";import{sourceStreamPattern as _}from"../Text/SourceStreamNames.js";import{parseRouteParts as v}from"./EventSourceParser.js";import{isFileDirective as y}from"./FileReferences.js";import{rejectOperationChildren as ne}from"./OperationParser.js";import{addFixtureValue as b,addInlineValue as x}from"./SpecificationExampleParser.js";const S=r(`^(?:given\\s+operation|then\\s+(?:operation|compensated))(?:\\s|$)`),C=r(`^(given operation|then operation|then compensated)\\s+([A-Za-z_]\\w*(?:\\.[A-Za-z_]\\w*)*)(\\s+fails)?$`),w=r(`^specification\\s+([A-Za-z_]\\w*)$`),T=r(`^given caller as ([A-Za-z_]\\w*)$`),stepPattern=(e,r=``)=>n(`^${e}\\s+([A-Z]\\w*(?:\\.\\w+)*)${r}(?:\\s+(?<property>[\\w.]+)\\s*=(?!=|>)\\s*(?<value>.+))?$`.replaceAll(`\\s`,t)),E=stepPattern(`given`),D=stepPattern(`when\\s+append`),O=stepPattern(`when`),k=stepPattern(`then`),A=r(`^then\\s+query\\b`),j=r(`^(?:given|then)\\s+readmodel\\b`),M=stepPattern(`given\\s+readmodel`),N=stepPattern(`then\\s+readmodel`,`(?<exactly>\\s+exactly)?`),P=r(`^then\\s+no\\b`),F=r(`^then\\s+error\\s+"(${i})"$`),I=r(`^([\\w.]+)\\s*=(?!=|>)\\s*(.+)$`),L=n(`^([\\w.]+)\\s*=(?!=|>)\\s*(.+)$`),re=r(`^given\\s+clock\\b`),R=r(`^given\\s+capture\\b`),z=r(`^when\\s+clock\\b`),B=r(`^when\\s+trigger\\b`),V=r(`^when\\s+capture\\b`),H=r(`^when\\s+query\\b`),U=r(`^then\\s+result\\b`),W=r(`^then\\s+no\\s+result\\b`),G=n(`^when\\s+redelivered\\b`),K=n(`^when\\s+redelivered\\s+([A-Za-z_]\\w*(?:\\.\\w+)*)\\s+to\\s+([A-Za-z_]\\w*(?:\\.\\w+)*)$`),q=r(`^then\\s+no\\s+events\\b`),J=r(`^(given|when)\\s+clock\\s+"(\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}(?::\\d{2}(?:\\.\\d+)?)?(?:Z|[+-]\\d{2}:\\d{2}))"$`),Y=r(`^when\\s+trigger\\s+([A-Za-z_]\\w*)$`),X=r(`^(?:given|when)\\s+capture\\s+([A-Za-z_]\\w*)$`),ie=r(`^when\\s+query\\s+([A-Za-z_]\\w*(?:\\.\\w+)*)$`),ae=r(`^then\\s+result(\\s+exactly)?$`),Z=n(`^then\\s+no\\s+readmodel\\s+([A-Z]\\w*)\\s+for\\s+(.+)$`),oe=n(`^(?:"${i}"|'(?:[^'\\\\]|\\\\.)*')$`),se=n(`^then\\s+query\\s+([A-Za-z_]\\w*(?:\\.\\w+)*)(\\s+exactly)?$`);function parseSpecification(t,n){let r=w.exec(n.content)?.[1]??``;r===``&&t.error(e.InvalidSpecificationDeclaration,`Invalid specification declaration '${n.content}' - expected 'specification <Name>'`,s(n));let i=null,a=[],c=[],l={givenOperationFailures:[],thenOperations:[],thenCompensated:[],thenAbsentReadModels:[],thenQueries:[],given:[],givenReadModels:[],when:null,whenAppended:null,whenRedelivered:null,whenDeclared:!1,thenEvents:[],thenEventsInAnyOrder:!1,thenNoEvents:!1,thenReadModels:[],thenErrors:[],givenClock:null,givenCaptures:[],whenClock:null,whenTrigger:null,whenCapture:null,whenQuery:null,thenResults:[],thenNoResult:null,thenDenied:null,givenCaller:null,thenReturns:null};for(let u=t.peekChild(n.indent);u!==void 0;u=t.peekChild(n.indent)){if(t.reader.takeSignificant(),y(u)||parseOperationStep(t,u,l))continue;let n=P.test(u.content)?`then`:o(u.content);if(n===`parameter`){let e=h(t,u);e!==null&&a.push(e)}else if(n===`case`){let e=m(t,u);e!==null&&c.push(e)}else n===`description`?i=te(t,u,i,`Specification '${r}'`):n===`given`?parseGiven(t,u,l):n===`when`?parseWhen(t,u,l,r):n===`then`?parseThen(t,u,l):(t.error(e.UnknownSpecificationDirective,`Unexpected '${o(u.content)}' in specification body`,s(u)),t.skipBlock(u.indent))}l.noEventsLine!==void 0&&(l.whenAppended!==null||l.thenEvents.length>0||l.thenEventsInAnyOrder||l.thenErrors.length>0||l.thenDenied!==null)&&t.error(e.InvalidNoEventsExpectation,`'then no events' cannot follow 'when append' or accompany event, event-order, error or denial expectations.`,s(l.noEventsLine));let{whenDeclared:u,noEventsLine:d,...f}=l,p={kind:`SpecificationSyntax`,sourceOptions:t.sourceOptions,name:r,description:i,...f,...a.length===0?{}:{parameters:a},...c.length===0?{}:{cases:c},location:s(n)};return ee(p,t),p}function parseOperationStep(t,n,r){if(!S.test(n.content))return!1;let i=C.exec(n.content);if(i===null||i[1]===`given operation`!=(i[3]!==void 0))t.error(e.InvalidOperationSpecification,`Expected 'given operation <Name> fails', 'then operation <Name>' or 'then compensated <Name>'.`,s(n)),skipBody(t,n.indent);else if(i[1]===`then operation`){let a=[];for(let r=t.peekChild(n.indent);r!==void 0;r=t.peekChild(n.indent)){t.reader.takeSignificant();let n=u(t,r,I,e.InvalidOperationSpecification);n!==null&&a.push(n)}r.thenOperations.push({kind:`SpecificationOperationSyntax`,operation:i[2],values:a,location:s(n)})}else ne(t,n,e.InvalidOperationSpecification,`Failure and compensation assertions cannot have children.`),i[1]===`given operation`?r.givenOperationFailures.push({kind:`SpecificationOperationFailureSyntax`,operation:i[2],location:s(n)}):r.thenCompensated.push({kind:`SpecificationCompensatedSyntax`,operation:i[2],location:s(n)});return!0}function parseGiven(t,n,r){if(re.test(n.content))r.givenClock===null?r.givenClock=parseClock(t,n,`given`):(t.error(e.InvalidSpecificationClock,`A specification states its clock at most once.`,s(n)),skipBody(t,n.indent));else if(R.test(n.content)){let e=parseCapture(t,n,`given`);e!==null&&r.givenCaptures.push(e)}else if(n.content.startsWith(`given caller`)){if(r.givenCaller!==null||r.givenCallerPersona!==void 0)t.error(e.DuplicateSpecificationCallerOrDenied,`A specification has at most one 'given caller' block.`,s(n)),t.skipBlock(n.indent);else if(n.content.startsWith(`given caller as`)){let i=T.exec(n.content);i===null&&t.error(e.InvalidSpecificationCallerPersona,`Expected 'given caller as <Persona>'.`,s(n));let a=t.peekChild(n.indent);a!==void 0&&t.error(e.InvalidSpecificationCallerPersona,`'given caller as <Persona>' has no body; use an explicit 'given caller' for refinements.`,s(a)),skipBody(t,n.indent),i!==null&&(r.givenCallerPersona={kind:`SpecificationCallerPersonaSyntax`,name:i[1],location:s(n)})}else r.givenCaller=parseCaller(t,n)}else if(j.test(n.content)){let e=parseReadModelStep(t,n,M,`given`);e!==void 0&&r.givenReadModels.push(e)}else{let e=parseEventStep(t,n,E,`given`);e!==void 0&&r.given.push(e)}}const Q=r(`^role${t}+"(${i})"$`),ce=r(`^claim${t}+"(${i})"${t}*=${t}*"(${i})"$`);function parseCaller(t,n){if(n.content!==`given caller`)return t.error(e.InvalidSpecificationCaller,`Expected exactly 'given caller'.`,s(n)),t.skipBlock(n.indent),null;let r=!1,i=[],o=[];for(let c=t.peekChild(n.indent);c!==void 0;c=t.peekChild(n.indent)){t.reader.takeSignificant();let n=Q.exec(c.content),l=ce.exec(c.content);c.content===`authenticated`&&!r?r=!0:n===null?l===null?t.error(p(c.content)?e.InvalidSpecificationCaseReference:e.InvalidSpecificationCaller,`Invalid caller fixture '${c.content}' - expected authenticated, role "...", or claim "..." = "...".`,s(c)):o.push({kind:`SpecificationCallerClaimSyntax`,type:a(l[1]),value:a(l[2]),location:s(c)}):i.push(a(n[1]))}return{kind:`SpecificationCallerSyntax`,authenticated:r,roles:i,claims:o,location:s(n)}}function parseWhen(t,n,r,i){let a=n.content.startsWith(`when append`);if(r.whenDeclared){let o=r.whenAppended!==null||a?e.ConflictingSpecificationActions:e.DuplicateSpecificationWhen;t.error(o,`Specification '${i}' already declares a 'when' - a specification can have at most one`,s(n)),skipBody(t,n.indent);return}if(r.whenDeclared=!0,a){r.whenAppended=parseEventStep(t,n,D,`when append`)??null;return}if(G.test(n.content)){let i=K.exec(n.content);i===null?(t.error(e.UnmatchedRedeliveredOccurrence,`Expected 'when redelivered <Event> to <Reaction>'.`,s(n)),skipBody(t,n.indent)):r.whenRedelivered={kind:`SpecificationRedeliverySyntax`,eventType:i[1],reaction:i[2],...parseValuesWithEventSource(t,n,void 0,void 0,`when redelivered`),location:s(n)};return}if(z.test(n.content)){r.whenClock=parseClock(t,n,`when`);return}if(B.test(n.content)){r.whenTrigger=parseNamedStep(t,n,Y,e.InvalidSpecificationTrigger,`when trigger`,`when trigger <Trigger>`,(e,t)=>({kind:`SpecificationTriggerSyntax`,trigger:e,values:t,location:s(n)}));return}if(V.test(n.content)){r.whenCapture=parseCapture(t,n,`when`);return}if(H.test(n.content)){r.whenQuery=parseNamedStep(t,n,ie,e.InvalidSpecificationQueryAction,`when query`,`when query <Query>`,(e,t)=>({kind:`SpecificationWhenQuerySyntax`,query:e,arguments:t,location:s(n)}));return}let o=O.exec(n.content);if(o===null){t.error(e.InvalidSpecificationWhen,`Invalid 'when' declaration '${n.content}' - expected 'when <CommandType>' or 'when append <EventType>'`,s(n)),skipBody(t,n.indent);return}let c=[],l=parseValuesWithEventSource(t,n,c,o);r.when={kind:`SpecificationCommandSyntax`,commandType:o[1],...l,generatedValues:c,inlineProperty:o.groups?.property??null,location:s(n)}}function parseThen(t,n,r){if(q.test(n.content)){n.content!==`then no events`||r.thenNoEvents?t.error(e.InvalidNoEventsExpectation,`Expected one 'then no events' directive.`,s(n)):(r.thenNoEvents=!0,r.noEventsLine=n);let i=t.peekChild(n.indent);i!==void 0&&t.error(e.InvalidNoEventsExpectation,`'then no events' cannot have child mappings.`,s(i)),skipBody(t,n.indent);return}if(f.test(n.content)){let i=d(t,n);r.thenReturns===null?r.thenReturns=i:t.error(e.InvalidReturnExpectation,`A specification declares at most one return expectation.`,s(n));return}if(n.content.startsWith(`then events`)){n.content!==`then events in any order`||r.thenEventsInAnyOrder?t.error(e.InvalidSpecificationEventOrder,`Expected one 'then events in any order' directive.`,s(n)):r.thenEventsInAnyOrder=!0,skipBody(t,n.indent);return}if(U.test(n.content)){parseResult(t,n,r);return}if(W.test(n.content)){n.content!==`then no result`||r.thenNoResult!==null?t.error(e.InvalidSpecificationQueryAction,`Expected one 'then no result' directive.`,s(n)):r.thenNoResult={kind:`SpecificationNoResultSyntax`,location:s(n)},skipBody(t,n.indent);return}if(n.content.startsWith(`then denied`)){n.content===`then denied`?r.thenDenied===null?r.thenDenied={kind:`SpecificationDeniedSyntax`,location:s(n)}:t.error(e.DuplicateSpecificationCallerOrDenied,`A specification has at most one 'then denied' outcome.`,s(n)):(t.error(e.InvalidSpecificationDenied,`Expected exactly 'then denied'.`,s(n)),skipBody(t,n.indent));return}if(n.content===`then error`){r.thenErrors.push({kind:`SpecificationErrorSyntax`,name:null,location:s(n)});return}if(n.content.startsWith(`then error case.`)){let e=g(n.content.substring(11),{...s(n),column:s(n).column+11},t);e.kind===`CaseValueExpressionSyntax`&&r.thenErrors.push({kind:`SpecificationErrorSyntax`,name:null,caseValue:e,location:s(n)});return}let i=F.exec(n.content);if(i!==null){r.thenErrors.push({kind:`SpecificationErrorSyntax`,name:a(i[1]),location:s(n)});return}if(o(n.content.substring(4).trim())===`error`){t.error(e.InvalidThenError,`Invalid 'then error' declaration '${n.content}' - expected 'then error' or 'then error "<reason>"'`,s(n)),skipBody(t,n.indent);return}if(P.test(n.content)){if(t.sourceOptions.numericMode===`exact`){let e=parseAbsentReadModel(t,n);e!==null&&r.thenAbsentReadModels.push(e);return}let e=Z.exec(n.content);if(e!==null&&!e[2].endsWith(` exactly`)){let i=g(e[2].trim(),s(n),t.valueContext);(i.kind===`LiteralExpressionSyntax`||i.kind===`ObjectExpressionSyntax`||i.kind===`CaseValueExpressionSyntax`)&&r.thenAbsentReadModels.push({kind:`SpecificationAbsentReadModelSyntax`,name:e[1],key:i,location:s(n)})}t.skipOpaqueBlock(n.indent);return}if(A.test(n.content)){let i=t.sourceOptions.numericMode===`exact`,reject=(e,n,r)=>{if(!i)return t.skipOpaqueBlock(r.indent);t.error(e,n,s(r)),t.skipBlock(r.indent)},a=se.exec(n.content);if(a===null)return reject(e.InvalidSpecificationQuery,`Invalid 'then query' declaration '${n.content}' - expected 'then query <Query> [exactly]'`,n);let c=[],l=[],u=!1;for(let r=t.peekChild(n.indent);r!==void 0;r=t.peekChild(n.indent))t.reader.takeSignificant(),r.content===`arguments`&&!u?c.push(...parseValues(t.valueContext,r,!0)):r.content===`arguments`?reject(e.DuplicateSpecificationQueryArguments,`Query assertion '${a[1]}' already declares arguments`,r):r.content===`result`?l.push({kind:`SpecificationQueryResultSyntax`,properties:parseValues(t.valueContext,r,!0),exactly:!1,location:s(r)}):reject(e.UnknownSpecificationQueryDirective,`Unexpected '${o(r.content)}' in 'then query' body - expected arguments or result`,r),u||=r.content===`arguments`;r.thenQueries.push({kind:`SpecificationQuerySyntax`,query:a[1],arguments:c,results:l,exactly:a[2]!==void 0,location:s(n)});return}if(j.test(n.content)){let e=parseReadModelStep(t,n,N,`then`);e!==void 0&&r.thenReadModels.push(e);return}let c=parseEventStep(t,n,k,`then`);c!==void 0&&r.thenEvents.push(c)}function parseAbsentReadModel(t,n){let r=Z.exec(n.content);if(r===null||r[2].endsWith(` exactly`))return t.error(e.InvalidAbsentReadModelStep,`Invalid absence assertion '${n.content}' - expected 'then no readmodel <ReadModelType> for <key>'`,s(n)),skipBody(t,n.indent),null;let i=r[2].trim(),a=!(i.startsWith(`"`)||i.startsWith(`'`))||oe.test(i)?g(i,s(n),t.valueContext):null,o=a!==null&&(a.kind===`LiteralExpressionSyntax`||a.kind===`ObjectExpressionSyntax`||a.kind===`CaseValueExpressionSyntax`);o||t.error(e.InvalidAbsentReadModelStep,`Invalid absence key '${i}' - expected exactly one concrete value.`,s(n));let c=!1;for(let r=t.peekChild(n.indent);r!==void 0;r=t.peekChild(n.indent))t.reader.takeSignificant(),t.error(e.InvalidAbsentReadModelStep,`An absent read model assertion cannot have child mappings.`,s(r)),c=!0;return c||!o?null:{kind:`SpecificationAbsentReadModelSyntax`,name:r[1],key:a,location:s(n)}}function skipBody(e,t){if(e.sourceOptions.numericMode!==`exact`)return e.skipBlock(t);e.skipOpaqueBlock(t)}function parseClock(t,n,r){let i=J.exec(n.content);return skipBody(t,n.indent),i===null||i[1]!==r?(t.error(p(n.content)?e.InvalidSpecificationCaseReference:e.InvalidSpecificationClock,`Invalid '${r} clock' - expected '${r} clock "<ISO 8601 instant>"', such as '${r} clock "2026-10-05T08:00:00Z"'`,s(n)),null):{kind:`SpecificationClockSyntax`,instant:i[2],location:s(n)}}function parseCapture(t,n,r){return parseNamedStep(t,n,X,e.InvalidSpecificationCapture,`${r} capture`,`${r} capture <Capture>`,(e,t)=>({kind:`SpecificationCaptureSyntax`,capture:e,record:t,location:s(n)}))}function parseNamedStep(e,t,n,r,i,a,o){let c=n.exec(t.content);return c===null?(e.error(r,`Invalid '${i}' declaration '${t.content}' - expected '${a}'`,s(t)),skipBody(e,t.indent),null):o(c[1],parseValues(e,t))}function parseResult(t,n,r){let i=ae.exec(n.content);i===null?(t.error(e.InvalidSpecificationQueryAction,`Invalid 'then result' declaration '${n.content}' - expected 'then result [exactly]'`,s(n)),skipBody(t,n.indent)):r.thenResults.push({kind:`SpecificationQueryResultSyntax`,properties:parseValues(t,n),exactly:i[1]!==void 0,location:s(n)})}function parseReadModelStep(t,n,r,i){let a=r.exec(n.content);if(a===null)t.error(e.InvalidReadModelStep,`Invalid '${i} readmodel' declaration '${n.content}' - expected '${i} readmodel <ReadModelType>'`,s(n)),skipBody(t,n.indent);else return{kind:`SpecificationReadModelSyntax`,name:a[1],properties:parseValues(t,n,!1,a),exactly:i===`then`&&a.groups?.exactly!==void 0,inlineProperty:a.groups?.property??null,location:s(n)}}function parseEventStep(t,n,r,i){let a=r.exec(n.content);if(a===null)t.error(e.InvalidEventStep,`Invalid '${i}' declaration '${n.content}' - expected '${i} <EventType>'`,s(n)),skipBody(t,n.indent);else return{kind:`SpecificationEventSyntax`,eventType:a[1],...parseValuesWithEventSource(t,n,void 0,a,i),inlineProperty:a.groups?.property??null,location:s(n)}}const $=_(`^stream\\s+([A-Za-z_]\\w*)\\.([A-Za-z_]\\w*)$`),le=r(`^streamId\\s*=(?!=|>)\\s*(.+)$`);function parseValuesWithEventSource(t,n,r,i,a){let d=[];x(t,n,i,d);let f=null,p,m,h=!1;for(let i=t.peekChild(n.indent);i!==void 0;i=t.peekChild(n.indent)){if(t.reader.takeSignificant(),r!==void 0&&l.test(i.content)){let n=u(t,i,c,e.InvalidGeneratedFixture);n!==null&&r.push(n);continue}let n=I.exec(i.content);if(n!==null)b(t,d,mappingOf(t,i,n));else if(o(i.content)===`stream`||i.content.startsWith(`no stream`)){if(a===void 0){t.error(e.SpecificationStreamOnCommand,`A command occurrence cannot declare a route; assert it on a then event.`,s(i)),t.skipBlock(i.indent);continue}if(h){t.error(e.InvalidSpecificationStream,`An event occurrence declares at most one stream or no stream directive.`,s(i)),t.skipBlock(i.indent);continue}let n=$.exec(i.content);i.content===`no stream`&&(a===`then`||a===`when redelivered`)?(m={kind:`SpecificationNoStreamSyntax`,location:s(i)},h=!0,rejectSpecificationRouteChildren(t,i)):n===null?(t.error(e.InvalidSpecificationStream,`Expected 'stream Source.Stream', or 'no stream' on a then event.`,s(i)),t.skipBlock(i.indent)):(p=parseSpecificationStream(t,i,n),h=!0)}else if(o(i.content)===`for`){let n=i.content.substring(3).trim();n.length===0?t.error(e.InvalidSpecificationEventSource,`Invalid event-source assertion 'for' - expected 'for <value>'`,s(i)):f===null?f=g(n,s(i),t):t.error(e.DuplicateSpecificationEventSource,`A specification step can declare its event-source assertion only once`,s(i))}else t.error(e.InvalidSpecificationValue,`Invalid property mapping '${i.content}' - expected '<property> = <value>'`,s(i))}return{values:d,for:f,...p===void 0?{}:{stream:p},...m===void 0?{}:{noStream:m}}}function parseSpecificationStream(t,n,r){let i=null,a=[],o=!1,c={};for(let r=t.peekChild(n.indent);r!==void 0;r=t.peekChild(n.indent)){if(t.reader.takeSignificant(),r.content===`streamId`){i!==null||o?(t.error(e.InvalidSpecificationStream,`Declare either one 'streamId = <literal>' mapping or one streamId part block.`,s(r)),t.skipBlock(r.indent)):(o=!0,c.streamId=s(r),a=v(t,r,e.InvalidSpecificationStream).map(e=>e.source.kind===`PathExpressionSyntax`&&e.source.path.startsWith(`case.`)?{...e,source:g(e.source.path,e.source.location,t)}:e));continue}let n=le.exec(r.content);if(n===null||i!==null||o){t.error(e.InvalidSpecificationStream,`Declare either one 'streamId = <literal>' mapping or one streamId part block.`,s(r)),t.skipBlock(r.indent);continue}let l={...s(r),column:r.indent+1+r.content.indexOf(n[1],r.content.indexOf(`=`)+1)};i={kind:`PropertyMappingSyntax`,property:`streamId`,source:g(n[1],l,t),location:s(r)},rejectSpecificationRouteChildren(t,r)}return{kind:`SpecificationStreamSyntax`,eventSource:r[1],stream:r[2],streamId:i,streamIdParts:a,directiveLocations:c,referenceLocation:{...s(n),column:n.indent+1+n.content.indexOf(r[1],6)},referenceLength:r[1].length+1+r[2].length,location:s(n)}}function rejectSpecificationRouteChildren(t,n){let r=t.peekChild(n.indent);r!==void 0&&(t.error(e.InvalidSpecificationStream,`This directive cannot have children.`,s(r)),t.skipBlock(n.indent))}function parseValues(t,n,r=!1,i){let a=[];x(t,n,i,a);for(let i=t.peekChild(n.indent);i!==void 0;i=t.peekChild(n.indent)){t.reader.takeSignificant();let n=(r||t.sourceOptions.numericMode===`exact`?L:I).exec(i.content);n===null?t.error(e.InvalidSpecificationValue,`Invalid property mapping '${i.content}' - expected '<property> = <value>'`,s(i)):b(t,a,mappingOf(t,i,n,r))}return a}function mappingOf(e,t,n,r=!1){return{kind:`PropertyMappingSyntax`,property:n[1],source:g(n[2],s(t),e,r),location:s(t)}}export{parseSpecification,parseSpecificationStream,rejectSpecificationRouteChildren,$ as specificationStream};
1
+ import"../../_virtual/_virtual/_rolldown/runtime.js";import{DiagnosticCodes as e}from"../Diagnostics/DiagnosticCodes.js";import{stringBodyPattern as t,unescapeString as n}from"../Text/StringLiteral.js";import{dotNetWhitespace as r,nativePattern as i,pattern as a}from"../Text/patterns.js";import{locationOf as o}from"./SourceLine.js";import{firstWord as s}from"./LineText.js";import{generatedFixturePattern as c,generatedFixturePrefix as l,parseConcreteMapping as u,parseReturn as d,thenReturnsPrefix as f}from"./SpecificationResponseParser.js";import{containsCaseReference as p,parseCase as m,parseParameter as h,parseSpecificationValue as g,validateTable as ee}from"./SpecificationCaseParser.js";import{parseDescription as te}from"./DescriptionParser.js";import{sourceStreamPattern as _}from"../Text/SourceStreamNames.js";import{parseRouteParts as v}from"./EventSourceParser.js";import{isFileDirective as y}from"./FileReferences.js";import{rejectOperationChildren as ne}from"./OperationParser.js";import{addFixtureValue as b,addInlineValue as x}from"./SpecificationExampleParser.js";const S=a(`^(?:given\\s+operation|then\\s+(?:operation|compensated))(?:\\s|$)`),C=a(`^(given operation|then operation|then compensated)\\s+([A-Za-z_]\\w*(?:\\.[A-Za-z_]\\w*)*)(\\s+fails)?$`),w=a(`^specification\\s+([A-Za-z_]\\w*)$`),T=a(`^given caller as ([A-Za-z_]\\w*)$`),stepPattern=(e,t=``)=>i(`^${e}\\s+([A-Z]\\w*(?:\\.\\w+)*)${t}(?:\\s+(?<property>[\\w.]+)\\s*=(?!=|>)\\s*(?<value>.+))?$`.replaceAll(`\\s`,r)),E=stepPattern(`given`),D=stepPattern(`when\\s+append`),O=stepPattern(`when`),k=stepPattern(`then`),A=a(`^then\\s+query\\b`),j=a(`^(?:given|then)\\s+readmodel\\b`),M=stepPattern(`given\\s+readmodel`),N=stepPattern(`then\\s+readmodel`,`(?<exactly>\\s+exactly)?`),P=a(`^then\\s+no\\b`),F=a(`^then\\s+error\\s+"(${t})"$`),I=a(`^([\\w.]+)\\s*=(?!=|>)\\s*(.+)$`),L=i(`^([\\w.]+)\\s*=(?!=|>)\\s*(.+)$`),re=a(`^given\\s+clock\\b`),R=a(`^given\\s+capture\\b`),z=a(`^when\\s+clock\\b`),B=a(`^when\\s+trigger\\b`),V=a(`^when\\s+capture\\b`),H=a(`^when\\s+query\\b`),U=a(`^then\\s+result\\b`),W=a(`^then\\s+no\\s+result\\b`),G=i(`^when\\s+redelivered\\b`),K=i(`^when\\s+redelivered\\s+([A-Za-z_]\\w*(?:\\.\\w+)*)\\s+to\\s+([A-Za-z_]\\w*(?:\\.\\w+)*)$`),q=a(`^then\\s+no\\s+events\\b`),J=a(`^(given|when)\\s+clock\\s+"(\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}(?::\\d{2}(?:\\.\\d+)?)?(?:Z|[+-]\\d{2}:\\d{2}))"$`),Y=a(`^when\\s+trigger\\s+([A-Za-z_]\\w*)$`),X=a(`^(?:given|when)\\s+capture\\s+([A-Za-z_]\\w*)$`),ie=a(`^when\\s+query\\s+([A-Za-z_]\\w*(?:\\.\\w+)*)$`),ae=a(`^then\\s+result(\\s+exactly)?$`),Z=i(`^then\\s+no\\s+readmodel\\s+([A-Z]\\w*)\\s+for\\s+(.+)$`),oe=i(`^(?:"${t}"|'(?:[^'\\\\]|\\\\.)*')$`),se=i(`^then\\s+query\\s+([A-Za-z_]\\w*(?:\\.\\w+)*)(\\s+exactly)?$`);function parseSpecification(t,n){let r=w.exec(n.content)?.[1]??``;r===``&&t.error(e.InvalidSpecificationDeclaration,`Invalid specification declaration '${n.content}' - expected 'specification <Name>'`,o(n));let i=null,a=[],c=[],l={givenOperationFailures:[],thenOperations:[],thenCompensated:[],thenAbsentReadModels:[],thenQueries:[],given:[],givenReadModels:[],when:null,whenAppended:null,whenRedelivered:null,whenDeclared:!1,thenEvents:[],thenEventsInAnyOrder:!1,thenNoEvents:!1,thenReadModels:[],thenErrors:[],givenClock:null,givenCaptures:[],whenClock:null,whenTrigger:null,whenCapture:null,whenQuery:null,thenResults:[],thenNoResult:null,thenDenied:null,givenCaller:null,thenReturns:null};for(let u=t.peekChild(n.indent);u!==void 0;u=t.peekChild(n.indent)){if(t.reader.takeSignificant(),y(u)||parseOperationStep(t,u,l))continue;let n=P.test(u.content)?`then`:s(u.content);if(n===`parameter`){let e=h(t,u);e!==null&&a.push(e)}else if(n===`case`){let e=m(t,u);e!==null&&c.push(e)}else n===`description`?i=te(t,u,i,`Specification '${r}'`):n===`given`?parseGiven(t,u,l):n===`when`?parseWhen(t,u,l,r):n===`then`?parseThen(t,u,l):(t.error(e.UnknownSpecificationDirective,`Unexpected '${s(u.content)}' in specification body`,o(u)),t.skipBlock(u.indent))}l.noEventsLine!==void 0&&(l.whenAppended!==null||l.thenEvents.length>0||l.thenEventsInAnyOrder||l.thenErrors.length>0||l.thenDenied!==null)&&t.error(e.InvalidNoEventsExpectation,`'then no events' cannot follow 'when append' or accompany event, event-order, error or denial expectations.`,o(l.noEventsLine));let{whenDeclared:u,noEventsLine:d,...f}=l,p={kind:`SpecificationSyntax`,sourceOptions:t.sourceOptions,name:r,description:i,...f,...a.length===0?{}:{parameters:a},...c.length===0?{}:{cases:c},location:o(n)};return ee(p,t),p}function parseOperationStep(t,n,r){if(!S.test(n.content))return!1;let i=C.exec(n.content);if(i===null||i[1]===`given operation`!=(i[3]!==void 0))t.error(e.InvalidOperationSpecification,`Expected 'given operation <Name> fails', 'then operation <Name>' or 'then compensated <Name>'.`,o(n)),skipBody(t,n.indent);else if(i[1]===`then operation`){let a=[];for(let r=t.peekChild(n.indent);r!==void 0;r=t.peekChild(n.indent)){t.reader.takeSignificant();let n=u(t,r,I,e.InvalidOperationSpecification);n!==null&&a.push(n)}r.thenOperations.push({kind:`SpecificationOperationSyntax`,operation:i[2],values:a,location:o(n)})}else ne(t,n,e.InvalidOperationSpecification,`Failure and compensation assertions cannot have children.`),i[1]===`given operation`?r.givenOperationFailures.push({kind:`SpecificationOperationFailureSyntax`,operation:i[2],location:o(n)}):r.thenCompensated.push({kind:`SpecificationCompensatedSyntax`,operation:i[2],location:o(n)});return!0}function parseGiven(t,n,r){if(re.test(n.content))r.givenClock===null?r.givenClock=parseClock(t,n,`given`):(t.error(e.InvalidSpecificationClock,`A specification states its clock at most once.`,o(n)),skipBody(t,n.indent));else if(R.test(n.content)){let e=parseCapture(t,n,`given`);e!==null&&r.givenCaptures.push(e)}else if(n.content.startsWith(`given caller`)){if(r.givenCaller!==null||r.givenCallerPersona!==void 0)t.error(e.DuplicateSpecificationCallerOrDenied,`A specification has at most one 'given caller' block.`,o(n)),t.skipBlock(n.indent);else if(n.content.startsWith(`given caller as`)){let i=T.exec(n.content);i===null&&t.error(e.InvalidSpecificationCallerPersona,`Expected 'given caller as <Persona>'.`,o(n));let a=t.peekChild(n.indent);a!==void 0&&t.error(e.InvalidSpecificationCallerPersona,`'given caller as <Persona>' has no body; use an explicit 'given caller' for refinements.`,o(a)),skipBody(t,n.indent),i!==null&&(r.givenCallerPersona={kind:`SpecificationCallerPersonaSyntax`,name:i[1],location:o(n)})}else r.givenCaller=parseCaller(t,n)}else if(j.test(n.content)){let e=parseReadModelStep(t,n,M,`given`);e!==void 0&&r.givenReadModels.push(e)}else{let e=parseEventStep(t,n,E,`given`);e!==void 0&&r.given.push(e)}}const Q=a(`^role${r}+"(${t})"$`),ce=a(`^claim${r}+"(${t})"${r}*=${r}*"(${t})"$`);function parseCaller(t,r){if(r.content!==`given caller`)return t.error(e.InvalidSpecificationCaller,`Expected exactly 'given caller'.`,o(r)),t.skipBlock(r.indent),null;let i=!1,a=[],s=[];for(let c=t.peekChild(r.indent);c!==void 0;c=t.peekChild(r.indent)){t.reader.takeSignificant();let r=Q.exec(c.content),l=ce.exec(c.content);c.content===`authenticated`&&!i?i=!0:r===null?l===null?t.error(p(c.content)?e.InvalidSpecificationCaseReference:e.InvalidSpecificationCaller,`Invalid caller fixture '${c.content}' - expected authenticated, role "...", or claim "..." = "...".`,o(c)):s.push({kind:`SpecificationCallerClaimSyntax`,type:n(l[1]),value:n(l[2]),location:o(c)}):a.push(n(r[1]))}return{kind:`SpecificationCallerSyntax`,authenticated:i,roles:a,claims:s,location:o(r)}}function parseWhen(t,n,r,i){let a=n.content.startsWith(`when append`);if(r.whenDeclared){let s=r.whenAppended!==null||a?e.ConflictingSpecificationActions:e.DuplicateSpecificationWhen;t.error(s,`Specification '${i}' already declares a 'when' - a specification can have at most one`,o(n)),skipBody(t,n.indent);return}if(r.whenDeclared=!0,a){r.whenAppended=parseEventStep(t,n,D,`when append`)??null;return}if(G.test(n.content)){let i=K.exec(n.content);i===null?(t.error(e.UnmatchedRedeliveredOccurrence,`Expected 'when redelivered <Event> to <Reaction>'.`,o(n)),skipBody(t,n.indent)):r.whenRedelivered={kind:`SpecificationRedeliverySyntax`,eventType:i[1],reaction:i[2],...parseValuesWithEventSource(t,n,void 0,void 0,`when redelivered`),location:o(n)};return}if(z.test(n.content)){r.whenClock=parseClock(t,n,`when`);return}if(B.test(n.content)){r.whenTrigger=parseNamedStep(t,n,Y,e.InvalidSpecificationTrigger,`when trigger`,`when trigger <Trigger>`,(e,t)=>({kind:`SpecificationTriggerSyntax`,trigger:e,values:t,location:o(n)}));return}if(V.test(n.content)){r.whenCapture=parseCapture(t,n,`when`);return}if(H.test(n.content)){r.whenQuery=parseNamedStep(t,n,ie,e.InvalidSpecificationQueryAction,`when query`,`when query <Query>`,(e,t)=>({kind:`SpecificationWhenQuerySyntax`,query:e,arguments:t,location:o(n)}));return}let s=O.exec(n.content);if(s===null){t.error(e.InvalidSpecificationWhen,`Invalid 'when' declaration '${n.content}' - expected 'when <CommandType>' or 'when append <EventType>'`,o(n)),skipBody(t,n.indent);return}let c=[],l=parseValuesWithEventSource(t,n,c,s);r.when={kind:`SpecificationCommandSyntax`,commandType:s[1],...l,generatedValues:c,inlineProperty:s.groups?.property??null,location:o(n)}}function parseThen(t,r,i){if(q.test(r.content)){r.content!==`then no events`||i.thenNoEvents?t.error(e.InvalidNoEventsExpectation,`Expected one 'then no events' directive.`,o(r)):(i.thenNoEvents=!0,i.noEventsLine=r);let n=t.peekChild(r.indent);n!==void 0&&t.error(e.InvalidNoEventsExpectation,`'then no events' cannot have child mappings.`,o(n)),skipBody(t,r.indent);return}if(f.test(r.content)){let n=d(t,r);i.thenReturns===null?i.thenReturns=n:t.error(e.InvalidReturnExpectation,`A specification declares at most one return expectation.`,o(r));return}if(r.content.startsWith(`then events`)){r.content!==`then events in any order`||i.thenEventsInAnyOrder?t.error(e.InvalidSpecificationEventOrder,`Expected one 'then events in any order' directive.`,o(r)):i.thenEventsInAnyOrder=!0,skipBody(t,r.indent);return}if(U.test(r.content)){parseResult(t,r,i);return}if(W.test(r.content)){r.content!==`then no result`||i.thenNoResult!==null?t.error(e.InvalidSpecificationQueryAction,`Expected one 'then no result' directive.`,o(r)):i.thenNoResult={kind:`SpecificationNoResultSyntax`,location:o(r)},skipBody(t,r.indent);return}if(r.content.startsWith(`then denied`)){r.content===`then denied`?i.thenDenied===null?i.thenDenied={kind:`SpecificationDeniedSyntax`,location:o(r)}:t.error(e.DuplicateSpecificationCallerOrDenied,`A specification has at most one 'then denied' outcome.`,o(r)):(t.error(e.InvalidSpecificationDenied,`Expected exactly 'then denied'.`,o(r)),skipBody(t,r.indent));return}if(r.content===`then error`){i.thenErrors.push({kind:`SpecificationErrorSyntax`,name:null,location:o(r)});return}if(r.content.startsWith(`then error case.`)){let e=g(r.content.substring(11),{...o(r),column:o(r).column+11},t);e.kind===`CaseValueExpressionSyntax`&&i.thenErrors.push({kind:`SpecificationErrorSyntax`,name:null,caseValue:e,location:o(r)});return}let a=F.exec(r.content);if(a!==null){i.thenErrors.push({kind:`SpecificationErrorSyntax`,name:n(a[1]),location:o(r)});return}if(s(r.content.substring(4).trim())===`error`){t.error(e.InvalidThenError,`Invalid 'then error' declaration '${r.content}' - expected 'then error' or 'then error "<reason>"'`,o(r)),skipBody(t,r.indent);return}if(P.test(r.content)){if(t.sourceOptions.numericMode===`exact`){let e=parseAbsentReadModel(t,r);e!==null&&i.thenAbsentReadModels.push(e);return}let e=Z.exec(r.content);if(e!==null&&!e[2].endsWith(` exactly`)){let n=g(e[2].trim(),o(r),t.valueContext);(n.kind===`LiteralExpressionSyntax`||n.kind===`ObjectExpressionSyntax`||n.kind===`CaseValueExpressionSyntax`)&&i.thenAbsentReadModels.push({kind:`SpecificationAbsentReadModelSyntax`,name:e[1],key:n,location:o(r)})}t.skipOpaqueBlock(r.indent);return}if(A.test(r.content)){let n=t.sourceOptions.numericMode===`exact`,reject=(e,r,i)=>{if(!n)return t.skipOpaqueBlock(i.indent);t.error(e,r,o(i)),t.skipBlock(i.indent)},a=se.exec(r.content);if(a===null)return reject(e.InvalidSpecificationQuery,`Invalid 'then query' declaration '${r.content}' - expected 'then query <Query> [exactly]'`,r);let c=[],l=[],u=!1;for(let n=t.peekChild(r.indent);n!==void 0;n=t.peekChild(r.indent))t.reader.takeSignificant(),n.content===`arguments`&&!u?c.push(...parseValues(t.valueContext,n,!0)):n.content===`arguments`?reject(e.DuplicateSpecificationQueryArguments,`Query assertion '${a[1]}' already declares arguments`,n):n.content===`result`?l.push({kind:`SpecificationQueryResultSyntax`,properties:parseValues(t.valueContext,n,!0),exactly:!1,location:o(n)}):reject(e.UnknownSpecificationQueryDirective,`Unexpected '${s(n.content)}' in 'then query' body - expected arguments or result`,n),u||=n.content===`arguments`;i.thenQueries.push({kind:`SpecificationQuerySyntax`,query:a[1],arguments:c,results:l,exactly:a[2]!==void 0,location:o(r)});return}if(j.test(r.content)){let e=parseReadModelStep(t,r,N,`then`);e!==void 0&&i.thenReadModels.push(e);return}let c=parseEventStep(t,r,k,`then`);c!==void 0&&i.thenEvents.push(c)}function parseAbsentReadModel(t,n){let r=Z.exec(n.content);if(r===null||r[2].endsWith(` exactly`))return t.error(e.InvalidAbsentReadModelStep,`Invalid absence assertion '${n.content}' - expected 'then no readmodel <ReadModelType> for <key>'`,o(n)),skipBody(t,n.indent),null;let i=r[2].trim(),a=!(i.startsWith(`"`)||i.startsWith(`'`))||oe.test(i)?g(i,o(n),t.valueContext):null,s=a!==null&&(a.kind===`LiteralExpressionSyntax`||a.kind===`ObjectExpressionSyntax`||a.kind===`CaseValueExpressionSyntax`);s||t.error(e.InvalidAbsentReadModelStep,`Invalid absence key '${i}' - expected exactly one concrete value.`,o(n));let c=!1;for(let r=t.peekChild(n.indent);r!==void 0;r=t.peekChild(n.indent))t.reader.takeSignificant(),t.error(e.InvalidAbsentReadModelStep,`An absent read model assertion cannot have child mappings.`,o(r)),c=!0;return c||!s?null:{kind:`SpecificationAbsentReadModelSyntax`,name:r[1],key:a,location:o(n)}}function skipBody(e,t){if(e.sourceOptions.numericMode!==`exact`)return e.skipBlock(t);e.skipOpaqueBlock(t)}function parseClock(t,n,r){let i=J.exec(n.content);return skipBody(t,n.indent),i===null||i[1]!==r?(t.error(p(n.content)?e.InvalidSpecificationCaseReference:e.InvalidSpecificationClock,`Invalid '${r} clock' - expected '${r} clock "<ISO 8601 instant>"', such as '${r} clock "2026-10-05T08:00:00Z"'`,o(n)),null):{kind:`SpecificationClockSyntax`,instant:i[2],location:o(n)}}function parseCapture(t,n,r){return parseNamedStep(t,n,X,e.InvalidSpecificationCapture,`${r} capture`,`${r} capture <Capture>`,(e,t)=>({kind:`SpecificationCaptureSyntax`,capture:e,record:t,location:o(n)}))}function parseNamedStep(e,t,n,r,i,a,s){let c=n.exec(t.content);return c===null?(e.error(r,`Invalid '${i}' declaration '${t.content}' - expected '${a}'`,o(t)),skipBody(e,t.indent),null):s(c[1],parseValues(e,t))}function parseResult(t,n,r){let i=ae.exec(n.content);i===null?(t.error(e.InvalidSpecificationQueryAction,`Invalid 'then result' declaration '${n.content}' - expected 'then result [exactly]'`,o(n)),skipBody(t,n.indent)):r.thenResults.push({kind:`SpecificationQueryResultSyntax`,properties:parseValues(t,n),exactly:i[1]!==void 0,location:o(n)})}function parseReadModelStep(t,n,r,i){let a=r.exec(n.content);if(a===null)t.error(e.InvalidReadModelStep,`Invalid '${i} readmodel' declaration '${n.content}' - expected '${i} readmodel <ReadModelType>'`,o(n)),skipBody(t,n.indent);else return{kind:`SpecificationReadModelSyntax`,name:a[1],properties:parseValues(t,n,!1,a),exactly:i===`then`&&a.groups?.exactly!==void 0,inlineProperty:a.groups?.property??null,location:o(n)}}function parseEventStep(t,n,r,i){let a=r.exec(n.content);if(a===null)t.error(e.InvalidEventStep,`Invalid '${i}' declaration '${n.content}' - expected '${i} <EventType>'`,o(n)),skipBody(t,n.indent);else return{kind:`SpecificationEventSyntax`,eventType:a[1],...parseValuesWithEventSource(t,n,void 0,a,i),inlineProperty:a.groups?.property??null,location:o(n)}}const $=_(`^stream\\s+([A-Za-z_]\\w*)\\.([A-Za-z_]\\w*)$`),le=a(`^streamId\\s*=(?!=|>)\\s*(.+)$`);function parseValuesWithEventSource(t,n,r,i,a){let d=[];x(t,n,i,d);let f=null,p,m,h=!1;for(let i=t.peekChild(n.indent);i!==void 0;i=t.peekChild(n.indent)){if(t.reader.takeSignificant(),r!==void 0&&l.test(i.content)){let n=u(t,i,c,e.InvalidGeneratedFixture);n!==null&&r.push(n);continue}let n=I.exec(i.content);if(n!==null)b(t,d,mappingOf(t,i,n));else if(s(i.content)===`stream`||i.content.startsWith(`no stream`)){if(a===void 0){t.error(e.SpecificationStreamOnCommand,`A command occurrence cannot declare a route; assert it on a then event.`,o(i)),t.skipBlock(i.indent);continue}if(h){t.error(e.InvalidSpecificationStream,`An event occurrence declares at most one stream or no stream directive.`,o(i)),t.skipBlock(i.indent);continue}let n=$.exec(i.content);i.content===`no stream`&&(a===`then`||a===`when redelivered`)?(m={kind:`SpecificationNoStreamSyntax`,location:o(i)},h=!0,rejectSpecificationRouteChildren(t,i)):n===null?(t.error(e.InvalidSpecificationStream,`Expected 'stream Source.Stream', or 'no stream' on a then event.`,o(i)),t.skipBlock(i.indent)):(p=parseSpecificationStream(t,i,n),h=!0)}else if(s(i.content)===`for`){let n=i.content.substring(3).trim();n.length===0?t.error(e.InvalidSpecificationEventSource,`Invalid event-source assertion 'for' - expected 'for <value>'`,o(i)):f===null?f=g(n,o(i),t):t.error(e.DuplicateSpecificationEventSource,`A specification step can declare its event-source assertion only once`,o(i))}else t.error(e.InvalidSpecificationValue,`Invalid property mapping '${i.content}' - expected '<property> = <value>'`,o(i))}return{values:d,for:f,...p===void 0?{}:{stream:p},...m===void 0?{}:{noStream:m}}}function parseSpecificationStream(t,n,r){let i=null,a=[],s=!1,c={};for(let r=t.peekChild(n.indent);r!==void 0;r=t.peekChild(n.indent)){if(t.reader.takeSignificant(),r.content===`streamId`){i!==null||s?(t.error(e.InvalidSpecificationStream,`Declare either one 'streamId = <literal>' mapping or one streamId part block.`,o(r)),t.skipBlock(r.indent)):(s=!0,c.streamId=o(r),a=v(t,r,e.InvalidSpecificationStream).map(e=>e.source.kind===`PathExpressionSyntax`&&e.source.path.startsWith(`case.`)?{...e,source:g(e.source.path,e.source.location,t)}:e));continue}let n=le.exec(r.content);if(n===null||i!==null||s){t.error(e.InvalidSpecificationStream,`Declare either one 'streamId = <literal>' mapping or one streamId part block.`,o(r)),t.skipBlock(r.indent);continue}let l={...o(r),column:r.indent+1+r.content.indexOf(n[1],r.content.indexOf(`=`)+1)};i={kind:`PropertyMappingSyntax`,property:`streamId`,source:g(n[1],l,t),location:o(r)},rejectSpecificationRouteChildren(t,r)}return{kind:`SpecificationStreamSyntax`,eventSource:r[1],stream:r[2],streamId:i,streamIdParts:a,directiveLocations:c,referenceLocation:{...o(n),column:n.indent+1+n.content.indexOf(r[1],6)},referenceLength:r[1].length+1+r[2].length,location:o(n)}}function rejectSpecificationRouteChildren(t,n){let r=t.peekChild(n.indent);r!==void 0&&(t.error(e.InvalidSpecificationStream,`This directive cannot have children.`,o(r)),t.skipBlock(n.indent))}function parseValues(t,n,r=!1,i){let a=[];x(t,n,i,a);for(let i=t.peekChild(n.indent);i!==void 0;i=t.peekChild(n.indent)){t.reader.takeSignificant();let n=(r||t.sourceOptions.numericMode===`exact`?L:I).exec(i.content);n===null?t.error(e.InvalidSpecificationValue,`Invalid property mapping '${i.content}' - expected '<property> = <value>'`,o(i)):b(t,a,mappingOf(t,i,n,r))}return a}function mappingOf(e,t,n,r=!1){return{kind:`PropertyMappingSyntax`,property:n[1],source:g(n[2],o(t),e,r),location:o(t)}}export{parseSpecification,parseSpecificationStream,rejectSpecificationRouteChildren,$ as specificationStream};
2
2
  //# sourceMappingURL=SpecificationParser.js.map
@@ -1,2 +1,2 @@
1
- import"../../_virtual/_virtual/_rolldown/runtime.js";import{DiagnosticCodes as e}from"../Diagnostics/DiagnosticCodes.js";import{pattern as t}from"../Text/patterns.js";import{stringBodyPattern as n}from"../Text/StringLiteral.js";import{parseMappingSource as r}from"./ExpressionParser.js";import{locationOf as i}from"./SourceLine.js";import{containsCaseReference as a,parseSpecificationValue as o}from"./SpecificationCaseParser.js";const s=t(`^then\\s+returns\\b`),c=t(`^generated\\s+(?=\\S)(?![=])`),l=t(`^generated\\s+([a-z_]\\w*)\\s*=(?!=|>)\\s*(.+)$`),u=t(`^([\\w.]+)\\s*=(?!=|>)\\s*(.+)$`),d=t(`^(?:"${n}"|'(?:[^'\\\\]|\\\\.)*')$`);function parseConcrete(t,n,i,s){if(n.startsWith(`case.`))return o(n,i,t);if(a(n)&&t.error(e.InvalidSpecificationCaseReference,`A case reference fills a whole value position; it cannot occur inside a structured value or expression.`,i),(n.startsWith(`"`)||n.startsWith(`'`))&&!d.test(n))return t.error(s,`Expected exactly one concrete value.`,i),null;let c=r(n,i,t);return![`LiteralExpressionSyntax`,`ObjectExpressionSyntax`,`ListExpressionSyntax`].includes(c.kind)||c.kind===`LiteralExpressionSyntax`&&typeof c.value==`number`&&!Number.isFinite(c.value)?(t.error(s,`Expected exactly one concrete literal or structured value, not an expression.`,i),null):c}function parseConcreteMapping(e,t,n,r){let a=n.exec(t.content);if(a===null)return e.error(r,`Expected a named fixture or assertion with exactly one concrete value.`,i(t)),e.skipBlock(t.indent),null;let o=i(t),s=parseConcrete(e,a[2],{...o,column:o.column+t.content.indexOf(a[2],t.content.indexOf(`=`)+1)},r),c=e.peekChild(t.indent);return c!==void 0&&(e.error(r,`A fixture or return field cannot have child directives.`,i(c)),e.skipBlock(t.indent)),s===null?null:{kind:`PropertyMappingSyntax`,property:a[1],source:s,location:o}}function parseReturn(t,n){let r=s.exec(n.content)[0].length,a=n.content.substring(r).trim(),o=i(n);if(a.length>0){let s=parseConcrete(t,a,{...o,column:o.column+n.content.indexOf(a,r)},e.InvalidReturnExpectation),c=t.peekChild(n.indent);return c!==void 0&&(t.error(e.InvalidReturnExpectation,`A scalar return expectation cannot have child assertions.`,i(c)),t.skipBlock(n.indent)),s===null?null:{kind:`ScalarSpecificationReturnSyntax`,value:s,location:o}}let c=[];for(let r=t.peekChild(n.indent);r!==void 0;r=t.peekChild(n.indent)){t.reader.takeSignificant();let n=parseConcreteMapping(t,r,u,e.InvalidReturnExpectation);n!==null&&c.push(n)}return{kind:`RecordSpecificationReturnSyntax`,fields:c,location:o}}export{l as generatedFixturePattern,c as generatedFixturePrefix,parseConcrete,parseConcreteMapping,parseReturn,s as thenReturnsPrefix};
1
+ import"../../_virtual/_virtual/_rolldown/runtime.js";import{DiagnosticCodes as e}from"../Diagnostics/DiagnosticCodes.js";import{stringBodyPattern as t}from"../Text/StringLiteral.js";import{pattern as n}from"../Text/patterns.js";import{locationOf as r}from"./SourceLine.js";import{parseMappingSource as i}from"./ExpressionParser.js";import{containsCaseReference as a,parseSpecificationValue as o}from"./SpecificationCaseParser.js";const s=n(`^then\\s+returns\\b`),c=n(`^generated\\s+(?=\\S)(?![=])`),l=n(`^generated\\s+([a-z_]\\w*)\\s*=(?!=|>)\\s*(.+)$`),u=n(`^([\\w.]+)\\s*=(?!=|>)\\s*(.+)$`),d=n(`^(?:"${t}"|'(?:[^'\\\\]|\\\\.)*')$`);function parseConcrete(t,n,r,s){if(n.startsWith(`case.`))return o(n,r,t);if(a(n)&&t.error(e.InvalidSpecificationCaseReference,`A case reference fills a whole value position; it cannot occur inside a structured value or expression.`,r),(n.startsWith(`"`)||n.startsWith(`'`))&&!d.test(n))return t.error(s,`Expected exactly one concrete value.`,r),null;let c=i(n,r,t);return![`LiteralExpressionSyntax`,`ObjectExpressionSyntax`,`ListExpressionSyntax`].includes(c.kind)||c.kind===`LiteralExpressionSyntax`&&typeof c.value==`number`&&!Number.isFinite(c.value)?(t.error(s,`Expected exactly one concrete literal or structured value, not an expression.`,r),null):c}function parseConcreteMapping(e,t,n,i){let a=n.exec(t.content);if(a===null)return e.error(i,`Expected a named fixture or assertion with exactly one concrete value.`,r(t)),e.skipBlock(t.indent),null;let o=r(t),s=parseConcrete(e,a[2],{...o,column:o.column+t.content.indexOf(a[2],t.content.indexOf(`=`)+1)},i),c=e.peekChild(t.indent);return c!==void 0&&(e.error(i,`A fixture or return field cannot have child directives.`,r(c)),e.skipBlock(t.indent)),s===null?null:{kind:`PropertyMappingSyntax`,property:a[1],source:s,location:o}}function parseReturn(t,n){let i=s.exec(n.content)[0].length,a=n.content.substring(i).trim(),o=r(n);if(a.length>0){let s=parseConcrete(t,a,{...o,column:o.column+n.content.indexOf(a,i)},e.InvalidReturnExpectation),c=t.peekChild(n.indent);return c!==void 0&&(t.error(e.InvalidReturnExpectation,`A scalar return expectation cannot have child assertions.`,r(c)),t.skipBlock(n.indent)),s===null?null:{kind:`ScalarSpecificationReturnSyntax`,value:s,location:o}}let c=[];for(let r=t.peekChild(n.indent);r!==void 0;r=t.peekChild(n.indent)){t.reader.takeSignificant();let n=parseConcreteMapping(t,r,u,e.InvalidReturnExpectation);n!==null&&c.push(n)}return{kind:`RecordSpecificationReturnSyntax`,fields:c,location:o}}export{l as generatedFixturePattern,c as generatedFixturePrefix,parseConcrete,parseConcreteMapping,parseReturn,s as thenReturnsPrefix};
2
2
  //# sourceMappingURL=SpecificationResponseParser.js.map
@@ -1,2 +1,2 @@
1
- import"../../_virtual/_virtual/_rolldown/runtime.js";import{DiagnosticCodes as e}from"../Diagnostics/DiagnosticCodes.js";import{pattern as t}from"../Text/patterns.js";import{firstWord as n}from"./LineText.js";import{locationOf as r}from"./SourceLine.js";import{parseProperty as i}from"./PropertyLineParser.js";import{parseDescription as a}from"./DescriptionParser.js";import{isFileDirective as o}from"./FileReferences.js";const s=t(`^@?[a-z_]\\w*\\s+[\\w.]+`);function parseTriggerData(t,n){let a=i(t,n);a===void 0?(s.test(n.content)&&/\?|\boptional\b/.test(n.content)&&t.error(e.InvalidTriggerData,`Invalid trigger value '${n.content}' - expected '<name>' or '<name> <Type>'`,r(n)),t.skipOpaqueBlock(n.indent)):(a.isGenerated&&t.error(e.GeneratedPropertyOutsideCommand,`Generated properties can only be declared on commands.`,a.location),a.isSubject&&t.error(e.InvalidSubjectOwner,`The subject modifier is only valid on event properties, not trigger or reaction data properties (decision 0008: one data subject per event).`,a.location),t.triggerData.push(a))}function parseTriggerDeclaration(e,t){let r=e.triggerData.length;for(let r=e.peekChild(t.indent);r!==void 0;r=e.peekChild(t.indent))e.reader.takeSignificant(),n(r.content)===`description`?a(e,r,null,`Trigger '${t.content}'`):o(r)||parseTriggerData(e,r);return e.triggerData.slice(r)}export{parseTriggerData,parseTriggerDeclaration};
1
+ import"../../_virtual/_virtual/_rolldown/runtime.js";import{DiagnosticCodes as e}from"../Diagnostics/DiagnosticCodes.js";import{pattern as t}from"../Text/patterns.js";import{locationOf as n}from"./SourceLine.js";import{firstWord as r}from"./LineText.js";import{parseProperty as i}from"./PropertyLineParser.js";import{parseDescription as a}from"./DescriptionParser.js";import{isFileDirective as o}from"./FileReferences.js";const s=t(`^@?[a-z_]\\w*\\s+[\\w.]+`);function parseTriggerData(t,r){let a=i(t,r);a===void 0?(s.test(r.content)&&/\?|\boptional\b/.test(r.content)&&t.error(e.InvalidTriggerData,`Invalid trigger value '${r.content}' - expected '<name>' or '<name> <Type>'`,n(r)),t.skipOpaqueBlock(r.indent)):(a.isGenerated&&t.error(e.GeneratedPropertyOutsideCommand,`Generated properties can only be declared on commands.`,a.location),a.isSubject&&t.error(e.InvalidSubjectOwner,`The subject modifier is only valid on event properties, not trigger or reaction data properties (decision 0008: one data subject per event).`,a.location),t.triggerData.push(a))}function parseTriggerDeclaration(e,t){let n=e.triggerData.length;for(let n=e.peekChild(t.indent);n!==void 0;n=e.peekChild(t.indent))e.reader.takeSignificant(),r(n.content)===`description`?a(e,n,null,`Trigger '${t.content}'`):o(n)||parseTriggerData(e,n);return e.triggerData.slice(n)}export{parseTriggerData,parseTriggerDeclaration};
2
2
  //# sourceMappingURL=TriggerDataParser.js.map
@@ -1 +1 @@
1
- import{DiagnosticCodes as e}from"./Diagnostics/DiagnosticCodes.js";import"./Text/patterns.js";import{eventDeclarations as t}from"./Syntax/EventDeclarations.js";import{operationDeclarations as n}from"./Syntax/Operations.js";import{AuthoringProductionResolver as r}from"./Syntax/AuthoringProductionResolver.js";import"./Syntax/DependencySources.js";import{ScreenplaySyntaxWalker as i}from"./Syntax/ScreenplaySyntaxWalker.js";import{isExactNumberToken as a,parseExactNumber as o}from"./Syntax/ExactNumber.js";import{unescapeString as s}from"./Text/StringLiteral.js";import{EventSourceCatalog as c}from"./Syntax/EventSourceCatalog.js";import{implicitDestination as l,requiresExplicitDestinations as u}from"./Syntax/ProductionDestinations.js";import{InvalidExactNumber as d,canonicalExactText as f,exactIsIntegral as p}from"./Syntax/ExactMathFacts.js";import{synthesizePersonaCaller as m}from"./Syntax/PersonaCallers.js";import"./Syntax/SpecificationCaseOrigin.js";import{sourceLocation as h}from"./Diagnostics/SourceLocation.js";import"./Parsing/SpecificationCommandExamples.js";import{DeclaredDependencyTargets as g}from"./Dependencies/DeclaredDependencyTargets.js";import{describePlacement as _,documentPlacement as v,isDocumentPlacement as y}from"./Files/PlayPlacement.js";import"./Syntax/InvalidSyntaxJson.js";import"./Syntax/SourceOptions.js";import{isSourceStreamName as b,isSourceStreamTypeName as x,sourceStreamPattern as S}from"./Text/SourceStreamNames.js";import{sliceTypes as C}from"./Syntax/Structure.js";import{consumedEvents as w,eventsSourceKind as T,fromSetting as E,isEventsSource as D}from"./Syntax/CaptureEventsSource.js";import{eventBodyReservedWords as O}from"./Text/ReservedWords.js";import"./Files/AuthoredOrder.js";import{dependencyKinds as k}from"./Dependencies/DependencyKind.js";import{InvalidDependencyQuery as A}from"./Dependencies/InvalidDependencyQuery.js";import{SliceReferenceCollector as j,buildingReadModelReferences as M,referenceClassifications as N,sliceReferences as P}from"./Dependencies/SliceReferences.js";import{stronglyConnectedGroups as F}from"./Dependencies/StronglyConnectedGroups.js";import{DependencyGraph as I}from"./Dependencies/DependencyGraph.js";import{streamIdFailureMessage as L,tryFormatInteger as R,tryFormatText as z,tryFormatUuidText as B}from"./Syntax/StreamIdFormatter.js";import{parseForAuthoring as V}from"./ScreenplayCompiler.js";import{applyQuickFixEdits as H,isQuickFixDiagnostic as U,legacyOptionalTypeLength as W,prepareQuickFixes as G}from"./Authoring/QuickFixes.js";import"./Dependencies/index.js";import{EventSourceReadConfidence as K}from"./Syntax/EventSourceReadConfidence.js";import"./Syntax/SyntaxJson.js";import"./Syntax/index.js";import"./Files/OrderingRoot.js";import{mergeDocuments as q}from"./Files/PlayFolderMerge.js";import"./Files/PlayImports.js";import{parsePlacedDocuments as J}from"./Files/PlayApplicationAssembly.js";export{r as AuthoringProductionResolver,g as DeclaredDependencyTargets,I as DependencyGraph,e as DiagnosticCodes,c as EventSourceCatalog,K as EventSourceReadConfidence,A as InvalidDependencyQuery,d as InvalidExactNumber,i as ScreenplaySyntaxWalker,j as SliceReferenceCollector,H as applyQuickFixEdits,M as buildingReadModelReferences,f as canonicalExactText,w as consumedEvents,k as dependencyKinds,_ as describePlacement,v as documentPlacement,O as eventBodyReservedWords,t as eventDeclarations,T as eventsSourceKind,p as exactIsIntegral,E as fromSetting,l as implicitDestination,y as isDocumentPlacement,D as isEventsSource,a as isExactNumberToken,U as isQuickFixDiagnostic,b as isSourceStreamName,x as isSourceStreamTypeName,W as legacyOptionalTypeLength,q as mergeDocuments,n as operationDeclarations,o as parseExactNumber,V as parseForAuthoring,J as parsePlacedDocuments,G as prepareQuickFixes,N as referenceClassifications,u as requiresExplicitDestinations,P as sliceReferences,C as sliceTypes,h as sourceLocation,S as sourceStreamPattern,L as streamIdFailureMessage,F as stronglyConnectedGroups,m as synthesizePersonaCaller,R as tryFormatInteger,z as tryFormatText,B as tryFormatUuidText,s as unescapeString};
1
+ import{DiagnosticCodes as e}from"./Diagnostics/DiagnosticCodes.js";import{unescapeString as t}from"./Text/StringLiteral.js";import"./Text/patterns.js";import{sourceLocation as n}from"./Diagnostics/SourceLocation.js";import{eventDeclarations as r}from"./Syntax/EventDeclarations.js";import{operationDeclarations as i}from"./Syntax/Operations.js";import{AuthoringProductionResolver as a}from"./Syntax/AuthoringProductionResolver.js";import"./Syntax/DependencySources.js";import{ScreenplaySyntaxWalker as o}from"./Syntax/ScreenplaySyntaxWalker.js";import{isExactNumberToken as s,parseExactNumber as c}from"./Syntax/ExactNumber.js";import{EventSourceCatalog as l}from"./Syntax/EventSourceCatalog.js";import{implicitDestination as u,requiresExplicitDestinations as d}from"./Syntax/ProductionDestinations.js";import{InvalidExactNumber as f,canonicalExactText as p,exactIsIntegral as m}from"./Syntax/ExactMathFacts.js";import{synthesizePersonaCaller as h}from"./Syntax/PersonaCallers.js";import"./Syntax/SpecificationCaseOrigin.js";import"./Parsing/SpecificationCommandExamples.js";import{DeclaredDependencyTargets as g}from"./Dependencies/DeclaredDependencyTargets.js";import{describePlacement as _,documentPlacement as v,isDocumentPlacement as y}from"./Files/PlayPlacement.js";import"./Syntax/InvalidSyntaxJson.js";import"./Syntax/SourceOptions.js";import{isSourceStreamName as b,isSourceStreamTypeName as x,sourceStreamPattern as S}from"./Text/SourceStreamNames.js";import{sliceTypes as C}from"./Syntax/Structure.js";import{consumedEvents as w,eventsSourceKind as T,fromSetting as E,isEventsSource as D}from"./Syntax/CaptureEventsSource.js";import{eventBodyReservedWords as O}from"./Text/ReservedWords.js";import"./Files/AuthoredOrder.js";import{dependencyKinds as k}from"./Dependencies/DependencyKind.js";import{InvalidDependencyQuery as A}from"./Dependencies/InvalidDependencyQuery.js";import{SliceReferenceCollector as j,buildingReadModelReferences as M,referenceClassifications as N,sliceReferences as P}from"./Dependencies/SliceReferences.js";import{stronglyConnectedGroups as F}from"./Dependencies/StronglyConnectedGroups.js";import{DependencyGraph as I}from"./Dependencies/DependencyGraph.js";import{streamIdFailureMessage as L,tryFormatInteger as R,tryFormatText as z,tryFormatUuidText as B}from"./Syntax/StreamIdFormatter.js";import{parseForAuthoring as V}from"./ScreenplayCompiler.js";import{applyQuickFixEdits as H,isQuickFixDiagnostic as U,legacyOptionalTypeLength as W,prepareQuickFixes as G}from"./Authoring/QuickFixes.js";import"./Dependencies/index.js";import{EventSourceReadConfidence as K}from"./Syntax/EventSourceReadConfidence.js";import"./Syntax/SyntaxJson.js";import"./Syntax/index.js";import"./Files/OrderingRoot.js";import{mergeDocuments as q}from"./Files/PlayFolderMerge.js";import"./Files/PlayImports.js";import{parsePlacedDocuments as J}from"./Files/PlayApplicationAssembly.js";export{a as AuthoringProductionResolver,g as DeclaredDependencyTargets,I as DependencyGraph,e as DiagnosticCodes,l as EventSourceCatalog,K as EventSourceReadConfidence,A as InvalidDependencyQuery,f as InvalidExactNumber,o as ScreenplaySyntaxWalker,j as SliceReferenceCollector,H as applyQuickFixEdits,M as buildingReadModelReferences,p as canonicalExactText,w as consumedEvents,k as dependencyKinds,_ as describePlacement,v as documentPlacement,O as eventBodyReservedWords,r as eventDeclarations,T as eventsSourceKind,m as exactIsIntegral,E as fromSetting,u as implicitDestination,y as isDocumentPlacement,D as isEventsSource,s as isExactNumberToken,U as isQuickFixDiagnostic,b as isSourceStreamName,x as isSourceStreamTypeName,W as legacyOptionalTypeLength,q as mergeDocuments,i as operationDeclarations,c as parseExactNumber,V as parseForAuthoring,J as parsePlacedDocuments,G as prepareQuickFixes,N as referenceClassifications,d as requiresExplicitDestinations,P as sliceReferences,C as sliceTypes,n as sourceLocation,S as sourceStreamPattern,L as streamIdFailureMessage,F as stronglyConnectedGroups,h as synthesizePersonaCaller,R as tryFormatInteger,z as tryFormatText,B as tryFormatUuidText,t as unescapeString};
@@ -1,2 +1,2 @@
1
- const e={repeatedSingularDeclarationAcrossFiles:`PLAY0172`,invalidIdentityDeclaration:`PLAY0633`,duplicateIdentity:`PLAY0634`,invalidIdentityDetail:`PLAY0635`,unknownIdentitySource:`PLAY0636`,identityDetailWithoutSource:`PLAY0637`,identitySourceWithBody:`PLAY0638`,duplicateIdentityDetail:`PLAY0639`,builtInIdentityDetail:`PLAY0640`,unknownIdentityQuery:`PLAY0641`,invalidIdentityQuery:`PLAY0642`,identityQueryWithoutKey:`PLAY0643`,invalidIdentityQueryKey:`PLAY0644`,identityQueryAuthorizationDependency:`PLAY0645`,identityQueryTypeMismatch:`PLAY0646`,invalidReactionIdentity:`PLAY0647`,gatedInvocationWithoutIdentity:`PLAY0648`,unusedReactionIdentity:`PLAY0649`,unusedReactionRole:`PLAY0650`,unsatisfiedReactionIdentity:`PLAY0651`,reactionPrivilegeEscalation:`PLAY0652`,commandProducesPublicEvent:`PLAY0607`,publicEventRequiresOutboundTranslation:`PLAY0608`,outboundPublicEventCount:`PLAY0609`,foreignPublicEventConsumer:`PLAY0610`,outboundTranslationInput:`PLAY0611`,inboundTranslationOutput:`PLAY0612`,foreignPublicEventProduced:`PLAY0613`,publicTranslationRequiresDirection:`PLAY0614`,translationConstructDirection:`PLAY0615`,inboundTranslationInput:`PLAY0616`,outboundTranslationOutput:`PLAY0617`,eventTargetOutsideOutboundTranslation:`PLAY0618`,eventsSourceOutsideInboundTranslation:`PLAY0619`,invalidCaptureEventsSource:`PLAY0620`,invalidDescription:`PLAY0145`,emptyDescription:`PLAY0146`,duplicateDescription:`PLAY0147`,unknownConceptDirective:`PLAY0010`,attributeReasonWithoutAttribute:`PLAY0012`,duplicateAttributeReason:`PLAY0013`,legacyComplianceMarker:`PLAY0565`,unknownComplianceMarker:`PLAY0566`,invalidSecretScope:`PLAY0567`,duplicateSecretScope:`PLAY0568`,secretScopeIgnoredForPii:`PLAY0569`,invalidPersonalDataQualifier:`PLAY0570`,duplicateSpecialCategory:`PLAY0571`,invalidPurposeDeclaration:`PLAY0596`,invalidPurposeVocabulary:`PLAY0597`,duplicatePurposeField:`PLAY0598`,duplicatePurposeDeclaration:`PLAY0599`,unknownPurpose:`PLAY0600`,purposeInterestMismatch:`PLAY0601`,personalDataWithoutPurpose:`PLAY0602`,specialDataWithoutCondition:`PLAY0603`,criminalDataWithoutAuthorization:`PLAY0604`,purposeWithoutBasis:`PLAY0605`,unusedPurpose:`PLAY0606`,duplicateEventSubject:`PLAY0590`,invalidSubjectType:`PLAY0591`,protectedSubjectType:`PLAY0592`,invalidSubjectOwner:`PLAY0593`,readModelSubjectNotSupported:`PLAY0594`,invalidSubjectModifierOrder:`PLAY0595`,conflictingScreenDataBinding:`PLAY0530`,screenDataQueryMismatch:`PLAY0531`,actionWithoutInputSurface:`PLAY0532`,commandWithoutInputSurface:`PLAY0533`,readModelFieldWithoutOrigin:`PLAY0534`,queryParameterNotHeldByView:`PLAY0535`,unconsumedEvent:`PLAY0536`,unreachableScreen:`PLAY0537`,invalidSpecificationCallerPersona:`PLAY0572`,unsynthesizablePersonaCaller:`PLAY0573`,personaWithoutGate:`PLAY0574`,gateWithoutPersona:`PLAY0575`,ambiguousPersonaCaller:`PLAY0576`,invalidSpecificationParameter:`PLAY0577`,invalidSpecificationCase:`PLAY0578`,duplicateSpecificationParameter:`PLAY0579`,duplicateSpecificationCase:`PLAY0580`,incompleteSpecificationTable:`PLAY0581`,invalidSpecificationCaseAssignment:`PLAY0582`,invalidSpecificationCaseValue:`PLAY0583`,invalidSpecificationCaseReference:`PLAY0584`,optionalSpecificationParameterTarget:`PLAY0585`,specificationCaseNameCollision:`PLAY0586`,incompatibleSpecificationParameterType:`PLAY0587`,unusedSpecificationParameter:`PLAY0588`,singularSpecificationTableExpansion:`PLAY0589`,invalidActionAlternative:`PLAY0341`,guardedActionWithoutAlternatives:`PLAY0342`,misplacedActionOtherwise:`PLAY0343`,unsupportedActionConditionOperand:`PLAY0344`,unknownActionSubjectField:`PLAY0345`,unresolvedActionSubject:`PLAY0346`,unreachableActionAlternative:`PLAY0347`,unknownActionArgumentProperty:`PLAY0348`,invalidRefusalBranch:`PLAY0538`,invalidRefusalBranchBody:`PLAY0539`,unreachableRefusalBranch:`PLAY0540`,invalidRefusalValue:`PLAY0541`,unknownRefusalConstraint:`PLAY0542`,unmatchedRedeliveredOccurrence:`PLAY0543`,unknownRedeliveryReaction:`PLAY0544`,invalidNoEventsExpectation:`PLAY0545`,indeterminateNegatedClaimTarget:`PLAY0546`,invalidAbsentReadModelStep:`PLAY0453`,unknownConstraintProperty:`PLAY0391`,invalidSpecificationExample:`PLAY0518`,duplicateSpecificationAssignment:`PLAY0519`,unknownReadModelProperty:`PLAY0514`,piiNotSupportedOnIdentifier:`PLAY0515`,invalidEventSourceDeclaration:`PLAY0503`,invalidCommandStream:`PLAY0504`,invalidSpecificationStream:`PLAY0547`,specificationStreamOnCommand:`PLAY0548`,invalidSpecificationStreamRoute:`PLAY0549`,invalidSpecificationStreamEventSource:`PLAY0550`,specificationStreamContradictsCommand:`PLAY0551`,ambiguousCommandStream:`PLAY0505`,unsupportedStreamIdType:`PLAY0506`,redundantSourceStreamId:`PLAY0507`,eventFromLaterSlice:`PLAY0516`,timelineCycleGroup:`PLAY0517`,invalidSpecificationExampleBody:`PLAY0526`,undeclaredDependency:`PLAY0552`,unusedDependencyDeclaration:`PLAY0553`,invalidDependencyTarget:`PLAY0554`,repeatedDependencyDeclaration:`PLAY0555`,mutualDependencyDeclarations:`PLAY0556`,authorizationRefusalWithoutIdentity:`PLAY0557`,invalidDocumentation:`PLAY0558`,conflictingDocumentationAcrossFiles:`PLAY0559`,unsupportedInteractionAlternatives:`PLAY0560`,mixedInteractionAlternatives:`PLAY0561`,interactionAlternativeWithoutActions:`PLAY0562`,inlineInteractionAlternative:`PLAY0563`,legacyInteractionWhere:`PLAY0564`,ambiguousReference:`PLAY0198`,invalidImplementationBlock:`PLAY0492`,invalidImplementationHint:`PLAY0493`,conflictingImplementationSources:`PLAY0494`,eventSourceIdInPayload:`PLAY0469`,explicitProducesTargetsRequired:`PLAY0470`,redundantEventId:`PLAY0471`,invalidEventId:`PLAY0472`,inlineEventCollision:`PLAY0473`,inlineEventOutsideCommand:`PLAY0474`,inlineEventGeneration:`PLAY0475`,reservedProductionMetadata:`PLAY0476`,invalidEventDocumentation:`PLAY0477`,tabIndentation:`PLAY0006`,unknownPrimitiveType:`PLAY0008`,unknownSliceType:`PLAY0028`,duplicateCommandIdentifier:`PLAY0036`,unknownContextPath:`PLAY0153`,unknownContextCausedByProperty:`PLAY0154`,unknownContextIdentityProperty:`PLAY0155`,unclosedCodeBlock:`PLAY0164`,unknownType:`PLAY0165`,unknownEvent:`PLAY0166`,unknownPolicy:`PLAY0167`,duplicateDeclaration:`PLAY0168`,unknownEventContextMember:`PLAY0295`,unknownEventContextPath:`PLAY0296`,eventContextPathBelowCollection:`PLAY0297`,missingEventContextPath:`PLAY0298`,unresolvedDynamicKeySource:`PLAY0299`,invalidFileImport:`PLAY0454`,omittedProductionDestination:`PLAY0478`,legacyOptionalSuffix:`PLAY0479`,invalidOptionalModifierOrder:`PLAY0480`,optionalReadsNotSupported:`PLAY0481`,unavailableResponseExecution:`PLAY0268`,generatedPropertyOutsideCommand:`PLAY0482`,invalidGeneratedType:`PLAY0483`,invalidGeneratedModifierOrder:`PLAY0484`,generatedPropertyInput:`PLAY0485`,invalidCommandResponse:`PLAY0486`,invalidResponseSource:`PLAY0487`,duplicateResponseField:`PLAY0488`,invalidResponseShape:`PLAY0489`,invalidGeneratedFixture:`PLAY0490`,invalidReturnExpectation:`PLAY0491`};export{e as diagnosticCodes};
1
+ const e={repeatedSingularDeclarationAcrossFiles:`PLAY0172`,invalidIdentityDeclaration:`PLAY0633`,duplicateIdentity:`PLAY0634`,invalidIdentityDetail:`PLAY0635`,unknownIdentitySource:`PLAY0636`,identityDetailWithoutSource:`PLAY0637`,identitySourceWithBody:`PLAY0638`,duplicateIdentityDetail:`PLAY0639`,builtInIdentityDetail:`PLAY0640`,unknownIdentityQuery:`PLAY0641`,invalidIdentityQuery:`PLAY0642`,identityQueryWithoutKey:`PLAY0643`,invalidIdentityQueryKey:`PLAY0644`,identityQueryAuthorizationDependency:`PLAY0645`,identityQueryTypeMismatch:`PLAY0646`,invalidReactionIdentity:`PLAY0647`,gatedInvocationWithoutIdentity:`PLAY0648`,unusedReactionIdentity:`PLAY0649`,unusedReactionRole:`PLAY0650`,unsatisfiedReactionIdentity:`PLAY0651`,reactionPrivilegeEscalation:`PLAY0652`,commandProducesPublicEvent:`PLAY0607`,publicEventRequiresOutboundTranslation:`PLAY0608`,outboundPublicEventCount:`PLAY0609`,foreignPublicEventConsumer:`PLAY0610`,outboundTranslationInput:`PLAY0611`,inboundTranslationOutput:`PLAY0612`,foreignPublicEventProduced:`PLAY0613`,publicTranslationRequiresDirection:`PLAY0614`,translationConstructDirection:`PLAY0615`,inboundTranslationInput:`PLAY0616`,outboundTranslationOutput:`PLAY0617`,eventTargetOutsideOutboundTranslation:`PLAY0618`,eventsSourceOutsideInboundTranslation:`PLAY0619`,invalidCaptureEventsSource:`PLAY0620`,invalidDescription:`PLAY0145`,emptyDescription:`PLAY0146`,duplicateDescription:`PLAY0147`,unknownConceptDirective:`PLAY0010`,attributeReasonWithoutAttribute:`PLAY0012`,duplicateAttributeReason:`PLAY0013`,duplicateComplianceMarker:`PLAY0653`,legacyComplianceMarker:`PLAY0565`,unknownComplianceMarker:`PLAY0566`,invalidSecretScope:`PLAY0567`,duplicateSecretScope:`PLAY0568`,secretScopeIgnoredForPii:`PLAY0569`,invalidPersonalDataQualifier:`PLAY0570`,duplicateSpecialCategory:`PLAY0571`,invalidPurposeDeclaration:`PLAY0596`,invalidPurposeVocabulary:`PLAY0597`,duplicatePurposeField:`PLAY0598`,duplicatePurposeDeclaration:`PLAY0599`,unknownPurpose:`PLAY0600`,purposeInterestMismatch:`PLAY0601`,personalDataWithoutPurpose:`PLAY0602`,specialDataWithoutCondition:`PLAY0603`,criminalDataWithoutAuthorization:`PLAY0604`,purposeWithoutBasis:`PLAY0605`,unusedPurpose:`PLAY0606`,duplicateEventSubject:`PLAY0590`,invalidSubjectType:`PLAY0591`,protectedSubjectType:`PLAY0592`,invalidSubjectOwner:`PLAY0593`,readModelSubjectNotSupported:`PLAY0594`,invalidSubjectModifierOrder:`PLAY0595`,conflictingScreenDataBinding:`PLAY0530`,screenDataQueryMismatch:`PLAY0531`,actionWithoutInputSurface:`PLAY0532`,commandWithoutInputSurface:`PLAY0533`,readModelFieldWithoutOrigin:`PLAY0534`,queryParameterNotHeldByView:`PLAY0535`,unconsumedEvent:`PLAY0536`,unreachableScreen:`PLAY0537`,invalidSpecificationCallerPersona:`PLAY0572`,unsynthesizablePersonaCaller:`PLAY0573`,personaWithoutGate:`PLAY0574`,gateWithoutPersona:`PLAY0575`,ambiguousPersonaCaller:`PLAY0576`,invalidSpecificationParameter:`PLAY0577`,invalidSpecificationCase:`PLAY0578`,duplicateSpecificationParameter:`PLAY0579`,duplicateSpecificationCase:`PLAY0580`,incompleteSpecificationTable:`PLAY0581`,invalidSpecificationCaseAssignment:`PLAY0582`,invalidSpecificationCaseValue:`PLAY0583`,invalidSpecificationCaseReference:`PLAY0584`,optionalSpecificationParameterTarget:`PLAY0585`,specificationCaseNameCollision:`PLAY0586`,incompatibleSpecificationParameterType:`PLAY0587`,unusedSpecificationParameter:`PLAY0588`,singularSpecificationTableExpansion:`PLAY0589`,invalidActionAlternative:`PLAY0341`,guardedActionWithoutAlternatives:`PLAY0342`,misplacedActionOtherwise:`PLAY0343`,unsupportedActionConditionOperand:`PLAY0344`,unknownActionSubjectField:`PLAY0345`,unresolvedActionSubject:`PLAY0346`,unreachableActionAlternative:`PLAY0347`,unknownActionArgumentProperty:`PLAY0348`,invalidRefusalBranch:`PLAY0538`,invalidRefusalBranchBody:`PLAY0539`,unreachableRefusalBranch:`PLAY0540`,invalidRefusalValue:`PLAY0541`,unknownRefusalConstraint:`PLAY0542`,unmatchedRedeliveredOccurrence:`PLAY0543`,unknownRedeliveryReaction:`PLAY0544`,invalidNoEventsExpectation:`PLAY0545`,indeterminateNegatedClaimTarget:`PLAY0546`,invalidAbsentReadModelStep:`PLAY0453`,unknownConstraintProperty:`PLAY0391`,invalidSpecificationExample:`PLAY0518`,duplicateSpecificationAssignment:`PLAY0519`,unknownReadModelProperty:`PLAY0514`,piiNotSupportedOnIdentifier:`PLAY0515`,invalidEventSourceDeclaration:`PLAY0503`,invalidCommandStream:`PLAY0504`,invalidSpecificationStream:`PLAY0547`,specificationStreamOnCommand:`PLAY0548`,invalidSpecificationStreamRoute:`PLAY0549`,invalidSpecificationStreamEventSource:`PLAY0550`,specificationStreamContradictsCommand:`PLAY0551`,ambiguousCommandStream:`PLAY0505`,unsupportedStreamIdType:`PLAY0506`,redundantSourceStreamId:`PLAY0507`,eventFromLaterSlice:`PLAY0516`,timelineCycleGroup:`PLAY0517`,invalidSpecificationExampleBody:`PLAY0526`,undeclaredDependency:`PLAY0552`,unusedDependencyDeclaration:`PLAY0553`,invalidDependencyTarget:`PLAY0554`,repeatedDependencyDeclaration:`PLAY0555`,mutualDependencyDeclarations:`PLAY0556`,authorizationRefusalWithoutIdentity:`PLAY0557`,invalidDocumentation:`PLAY0558`,conflictingDocumentationAcrossFiles:`PLAY0559`,unsupportedInteractionAlternatives:`PLAY0560`,mixedInteractionAlternatives:`PLAY0561`,interactionAlternativeWithoutActions:`PLAY0562`,inlineInteractionAlternative:`PLAY0563`,legacyInteractionWhere:`PLAY0564`,ambiguousReference:`PLAY0198`,invalidImplementationBlock:`PLAY0492`,invalidImplementationHint:`PLAY0493`,conflictingImplementationSources:`PLAY0494`,eventSourceIdInPayload:`PLAY0469`,explicitProducesTargetsRequired:`PLAY0470`,redundantEventId:`PLAY0471`,invalidEventId:`PLAY0472`,inlineEventCollision:`PLAY0473`,inlineEventOutsideCommand:`PLAY0474`,inlineEventGeneration:`PLAY0475`,reservedProductionMetadata:`PLAY0476`,invalidEventDocumentation:`PLAY0477`,tabIndentation:`PLAY0006`,unknownPrimitiveType:`PLAY0008`,unknownSliceType:`PLAY0028`,duplicateCommandIdentifier:`PLAY0036`,unknownContextPath:`PLAY0153`,unknownContextCausedByProperty:`PLAY0154`,unknownContextIdentityProperty:`PLAY0155`,unclosedCodeBlock:`PLAY0164`,unknownType:`PLAY0165`,unknownEvent:`PLAY0166`,unknownPolicy:`PLAY0167`,duplicateDeclaration:`PLAY0168`,unknownEventContextMember:`PLAY0295`,unknownEventContextPath:`PLAY0296`,eventContextPathBelowCollection:`PLAY0297`,missingEventContextPath:`PLAY0298`,unresolvedDynamicKeySource:`PLAY0299`,invalidFileImport:`PLAY0454`,omittedProductionDestination:`PLAY0478`,legacyOptionalSuffix:`PLAY0479`,invalidOptionalModifierOrder:`PLAY0480`,optionalReadsNotSupported:`PLAY0481`,unavailableResponseExecution:`PLAY0268`,generatedPropertyOutsideCommand:`PLAY0482`,invalidGeneratedType:`PLAY0483`,invalidGeneratedModifierOrder:`PLAY0484`,generatedPropertyInput:`PLAY0485`,invalidCommandResponse:`PLAY0486`,invalidResponseSource:`PLAY0487`,duplicateResponseField:`PLAY0488`,invalidResponseShape:`PLAY0489`,invalidGeneratedFixture:`PLAY0490`,invalidReturnExpectation:`PLAY0491`};export{e as diagnosticCodes};
2
2
  //# sourceMappingURL=diagnostic-codes.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"diagnostic-codes.js","names":["diagnosticCodes"],"sources":["../../diagnostic-codes.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\n// The PLAY codes the editor reports. Every one of them mirrors a condition the compiler checks and\n// carries the compiler's own code for it, so the same problem is called the same thing whether it was\n// found by the CLI or by a squiggle - see Documentation/screenplay/diagnostics.md for the catalogue.\n//\n// A code is only ever added here for a condition the compiler can also report. The editor makes a few\n// structural checks the compiler does not - the capture and projection validators are where they live -\n// and those stay codeless deliberately: minting a PLAY number for something no compiler run can emit\n// would make the catalogue describe two different tools.\nexport const diagnosticCodes = {\n repeatedSingularDeclarationAcrossFiles: 'PLAY0172',\n invalidIdentityDeclaration: 'PLAY0633',\n duplicateIdentity: 'PLAY0634',\n invalidIdentityDetail: 'PLAY0635',\n unknownIdentitySource: 'PLAY0636',\n identityDetailWithoutSource: 'PLAY0637',\n identitySourceWithBody: 'PLAY0638',\n duplicateIdentityDetail: 'PLAY0639',\n builtInIdentityDetail: 'PLAY0640',\n unknownIdentityQuery: 'PLAY0641',\n invalidIdentityQuery: 'PLAY0642',\n identityQueryWithoutKey: 'PLAY0643',\n invalidIdentityQueryKey: 'PLAY0644',\n identityQueryAuthorizationDependency: 'PLAY0645',\n identityQueryTypeMismatch: 'PLAY0646',\n invalidReactionIdentity: 'PLAY0647',\n gatedInvocationWithoutIdentity: 'PLAY0648',\n unusedReactionIdentity: 'PLAY0649',\n unusedReactionRole: 'PLAY0650',\n unsatisfiedReactionIdentity: 'PLAY0651',\n reactionPrivilegeEscalation: 'PLAY0652',\n // Preserve supplied C# whole-model diagnostics; these checks are not yet run by the editor.\n commandProducesPublicEvent: 'PLAY0607',\n publicEventRequiresOutboundTranslation: 'PLAY0608',\n outboundPublicEventCount: 'PLAY0609',\n foreignPublicEventConsumer: 'PLAY0610',\n outboundTranslationInput: 'PLAY0611',\n inboundTranslationOutput: 'PLAY0612',\n foreignPublicEventProduced: 'PLAY0613',\n publicTranslationRequiresDirection: 'PLAY0614',\n translationConstructDirection: 'PLAY0615',\n inboundTranslationInput: 'PLAY0616',\n outboundTranslationOutput: 'PLAY0617',\n eventTargetOutsideOutboundTranslation: 'PLAY0618',\n eventsSourceOutsideInboundTranslation: 'PLAY0619',\n invalidCaptureEventsSource: 'PLAY0620',\n invalidDescription: 'PLAY0145',\n emptyDescription: 'PLAY0146',\n duplicateDescription: 'PLAY0147',\n unknownConceptDirective: 'PLAY0010',\n attributeReasonWithoutAttribute: 'PLAY0012',\n duplicateAttributeReason: 'PLAY0013',\n legacyComplianceMarker: 'PLAY0565',\n unknownComplianceMarker: 'PLAY0566',\n invalidSecretScope: 'PLAY0567',\n duplicateSecretScope: 'PLAY0568',\n secretScopeIgnoredForPii: 'PLAY0569',\n invalidPersonalDataQualifier: 'PLAY0570',\n duplicateSpecialCategory: 'PLAY0571',\n invalidPurposeDeclaration: 'PLAY0596',\n invalidPurposeVocabulary: 'PLAY0597',\n duplicatePurposeField: 'PLAY0598',\n duplicatePurposeDeclaration: 'PLAY0599',\n unknownPurpose: 'PLAY0600',\n purposeInterestMismatch: 'PLAY0601',\n personalDataWithoutPurpose: 'PLAY0602',\n specialDataWithoutCondition: 'PLAY0603',\n criminalDataWithoutAuthorization: 'PLAY0604',\n purposeWithoutBasis: 'PLAY0605',\n unusedPurpose: 'PLAY0606',\n duplicateEventSubject: 'PLAY0590',\n invalidSubjectType: 'PLAY0591',\n protectedSubjectType: 'PLAY0592',\n invalidSubjectOwner: 'PLAY0593',\n readModelSubjectNotSupported: 'PLAY0594',\n invalidSubjectModifierOrder: 'PLAY0595',\n // Supplied compiler diagnostics are preserved, even for checks only the C# tool can run.\n // See Documentation/screenplay/editor-diagnostics.md for the validation boundary.\n conflictingScreenDataBinding: 'PLAY0530',\n screenDataQueryMismatch: 'PLAY0531',\n actionWithoutInputSurface: 'PLAY0532',\n commandWithoutInputSurface: 'PLAY0533',\n readModelFieldWithoutOrigin: 'PLAY0534',\n queryParameterNotHeldByView: 'PLAY0535',\n unconsumedEvent: 'PLAY0536',\n unreachableScreen: 'PLAY0537',\n invalidSpecificationCallerPersona: 'PLAY0572',\n unsynthesizablePersonaCaller: 'PLAY0573',\n personaWithoutGate: 'PLAY0574',\n gateWithoutPersona: 'PLAY0575',\n ambiguousPersonaCaller: 'PLAY0576',\n invalidSpecificationParameter: 'PLAY0577',\n invalidSpecificationCase: 'PLAY0578',\n duplicateSpecificationParameter: 'PLAY0579',\n duplicateSpecificationCase: 'PLAY0580',\n incompleteSpecificationTable: 'PLAY0581',\n invalidSpecificationCaseAssignment: 'PLAY0582',\n invalidSpecificationCaseValue: 'PLAY0583',\n invalidSpecificationCaseReference: 'PLAY0584',\n optionalSpecificationParameterTarget: 'PLAY0585',\n specificationCaseNameCollision: 'PLAY0586',\n incompatibleSpecificationParameterType: 'PLAY0587',\n unusedSpecificationParameter: 'PLAY0588',\n singularSpecificationTableExpansion: 'PLAY0589',\n invalidActionAlternative: 'PLAY0341',\n guardedActionWithoutAlternatives: 'PLAY0342',\n misplacedActionOtherwise: 'PLAY0343',\n unsupportedActionConditionOperand: 'PLAY0344',\n unknownActionSubjectField: 'PLAY0345',\n unresolvedActionSubject: 'PLAY0346',\n unreachableActionAlternative: 'PLAY0347',\n unknownActionArgumentProperty: 'PLAY0348',\n invalidRefusalBranch: 'PLAY0538',\n invalidRefusalBranchBody: 'PLAY0539',\n unreachableRefusalBranch: 'PLAY0540',\n invalidRefusalValue: 'PLAY0541',\n unknownRefusalConstraint: 'PLAY0542',\n unmatchedRedeliveredOccurrence: 'PLAY0543',\n unknownRedeliveryReaction: 'PLAY0544',\n invalidNoEventsExpectation: 'PLAY0545',\n indeterminateNegatedClaimTarget: 'PLAY0546',\n invalidAbsentReadModelStep: 'PLAY0453',\n unknownConstraintProperty: 'PLAY0391',\n invalidSpecificationExample: 'PLAY0518',\n duplicateSpecificationAssignment: 'PLAY0519',\n unknownReadModelProperty: 'PLAY0514',\n piiNotSupportedOnIdentifier: 'PLAY0515',\n invalidEventSourceDeclaration: 'PLAY0503',\n invalidCommandStream: 'PLAY0504',\n invalidSpecificationStream: 'PLAY0547',\n specificationStreamOnCommand: 'PLAY0548',\n invalidSpecificationStreamRoute: 'PLAY0549',\n invalidSpecificationStreamEventSource: 'PLAY0550',\n specificationStreamContradictsCommand: 'PLAY0551',\n ambiguousCommandStream: 'PLAY0505',\n unsupportedStreamIdType: 'PLAY0506',\n redundantSourceStreamId: 'PLAY0507',\n eventFromLaterSlice: 'PLAY0516',\n timelineCycleGroup: 'PLAY0517',\n invalidSpecificationExampleBody: 'PLAY0526',\n undeclaredDependency: 'PLAY0552',\n unusedDependencyDeclaration: 'PLAY0553',\n invalidDependencyTarget: 'PLAY0554',\n repeatedDependencyDeclaration: 'PLAY0555',\n mutualDependencyDeclarations: 'PLAY0556',\n authorizationRefusalWithoutIdentity: 'PLAY0557',\n invalidDocumentation: 'PLAY0558',\n conflictingDocumentationAcrossFiles: 'PLAY0559',\n unsupportedInteractionAlternatives: 'PLAY0560',\n mixedInteractionAlternatives: 'PLAY0561',\n interactionAlternativeWithoutActions: 'PLAY0562',\n inlineInteractionAlternative: 'PLAY0563',\n legacyInteractionWhere: 'PLAY0564',\n ambiguousReference: 'PLAY0198',\n invalidImplementationBlock: 'PLAY0492',\n invalidImplementationHint: 'PLAY0493',\n conflictingImplementationSources: 'PLAY0494',\n eventSourceIdInPayload: 'PLAY0469',\n explicitProducesTargetsRequired: 'PLAY0470',\n redundantEventId: 'PLAY0471',\n invalidEventId: 'PLAY0472',\n inlineEventCollision: 'PLAY0473',\n inlineEventOutsideCommand: 'PLAY0474',\n inlineEventGeneration: 'PLAY0475',\n reservedProductionMetadata: 'PLAY0476',\n invalidEventDocumentation: 'PLAY0477',\n tabIndentation: 'PLAY0006',\n unknownPrimitiveType: 'PLAY0008',\n unknownSliceType: 'PLAY0028',\n duplicateCommandIdentifier: 'PLAY0036',\n unknownContextPath: 'PLAY0153',\n unknownContextCausedByProperty: 'PLAY0154',\n unknownContextIdentityProperty: 'PLAY0155',\n unclosedCodeBlock: 'PLAY0164',\n unknownType: 'PLAY0165',\n unknownEvent: 'PLAY0166',\n unknownPolicy: 'PLAY0167',\n duplicateDeclaration: 'PLAY0168',\n unknownEventContextMember: 'PLAY0295',\n unknownEventContextPath: 'PLAY0296',\n eventContextPathBelowCollection: 'PLAY0297',\n missingEventContextPath: 'PLAY0298',\n unresolvedDynamicKeySource: 'PLAY0299',\n invalidFileImport: 'PLAY0454',\n omittedProductionDestination: 'PLAY0478',\n legacyOptionalSuffix: 'PLAY0479',\n invalidOptionalModifierOrder: 'PLAY0480',\n optionalReadsNotSupported: 'PLAY0481',\n unavailableResponseExecution: 'PLAY0268',\n generatedPropertyOutsideCommand: 'PLAY0482',\n invalidGeneratedType: 'PLAY0483',\n invalidGeneratedModifierOrder: 'PLAY0484',\n generatedPropertyInput: 'PLAY0485',\n invalidCommandResponse: 'PLAY0486',\n invalidResponseSource: 'PLAY0487',\n duplicateResponseField: 'PLAY0488',\n invalidResponseShape: 'PLAY0489',\n invalidGeneratedFixture: 'PLAY0490',\n invalidReturnExpectation: 'PLAY0491',\n} as const;\n\nexport type DiagnosticCode = (typeof diagnosticCodes)[keyof typeof diagnosticCodes];\n"],"mappings":"AAWA,MAAaA,EAAkB,CAC3B,uCAAwC,WACxC,2BAA4B,WAC5B,kBAAmB,WACnB,sBAAuB,WACvB,sBAAuB,WACvB,4BAA6B,WAC7B,uBAAwB,WACxB,wBAAyB,WACzB,sBAAuB,WACvB,qBAAsB,WACtB,qBAAsB,WACtB,wBAAyB,WACzB,wBAAyB,WACzB,qCAAsC,WACtC,0BAA2B,WAC3B,wBAAyB,WACzB,+BAAgC,WAChC,uBAAwB,WACxB,mBAAoB,WACpB,4BAA6B,WAC7B,4BAA6B,WAE7B,2BAA4B,WAC5B,uCAAwC,WACxC,yBAA0B,WAC1B,2BAA4B,WAC5B,yBAA0B,WAC1B,yBAA0B,WAC1B,2BAA4B,WAC5B,mCAAoC,WACpC,8BAA+B,WAC/B,wBAAyB,WACzB,0BAA2B,WAC3B,sCAAuC,WACvC,sCAAuC,WACvC,2BAA4B,WAC5B,mBAAoB,WACpB,iBAAkB,WAClB,qBAAsB,WACtB,wBAAyB,WACzB,gCAAiC,WACjC,yBAA0B,WAC1B,uBAAwB,WACxB,wBAAyB,WACzB,mBAAoB,WACpB,qBAAsB,WACtB,yBAA0B,WAC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AA6B,WAC7B,wBAAyB,WACzB,8BAA+B,WAC/B,6BAA8B,WAC9B,oCAAqC,WACrC,qBAAsB,WACtB,oCAAqC,WACrC,mCAAoC,WACpC,6BAA8B,WAC9B,qCAAsC,WACtC,6BAA8B,WAC9B,uBAAwB,WACxB,mBAAoB,WACpB,2BAA4B,WAC5B,0BAA2B,WAC3B,iCAAkC,WAClC,uBAAwB,WACxB,gCAAiC,WACjC,iBAAkB,WAClB,eAAgB,WAChB,qBAAsB,WACtB,0BAA2B,WAC3B,sBAAuB,WACvB,2BAA4B,WAC5B,0BAA2B,WAC3B,eAAgB,WAChB,qBAAsB,WACtB,iBAAkB,WAClB,2BAA4B,WAC5B,mBAAoB,WACpB,+BAAgC,WAChC,+BAAgC,WAChC,kBAAmB,WACnB,YAAa,WACb,aAAc,WACd,cAAe,WACf,qBAAsB,WACtB,0BAA2B,WAC3B,wBAAyB,WACzB,gCAAiC,WACjC,wBAAyB,WACzB,2BAA4B,WAC5B,kBAAmB,WACnB,6BAA8B,WAC9B,qBAAsB,WACtB,6BAA8B,WAC9B,0BAA2B,WAC3B,6BAA8B,WAC9B,gCAAiC,WACjC,qBAAsB,WACtB,8BAA+B,WAC/B,uBAAwB,WACxB,uBAAwB,WACxB,sBAAuB,WACvB,uBAAwB,WACxB,qBAAsB,WACtB,wBAAyB,WACzB,yBAA0B,UAC9B"}
1
+ {"version":3,"file":"diagnostic-codes.js","names":["diagnosticCodes"],"sources":["../../diagnostic-codes.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\n// The PLAY codes the editor reports. Every one of them mirrors a condition the compiler checks and\n// carries the compiler's own code for it, so the same problem is called the same thing whether it was\n// found by the CLI or by a squiggle - see Documentation/screenplay/diagnostics.md for the catalogue.\n//\n// A code is only ever added here for a condition the compiler can also report. The editor makes a few\n// structural checks the compiler does not - the capture and projection validators are where they live -\n// and those stay codeless deliberately: minting a PLAY number for something no compiler run can emit\n// would make the catalogue describe two different tools.\nexport const diagnosticCodes = {\n repeatedSingularDeclarationAcrossFiles: 'PLAY0172',\n invalidIdentityDeclaration: 'PLAY0633',\n duplicateIdentity: 'PLAY0634',\n invalidIdentityDetail: 'PLAY0635',\n unknownIdentitySource: 'PLAY0636',\n identityDetailWithoutSource: 'PLAY0637',\n identitySourceWithBody: 'PLAY0638',\n duplicateIdentityDetail: 'PLAY0639',\n builtInIdentityDetail: 'PLAY0640',\n unknownIdentityQuery: 'PLAY0641',\n invalidIdentityQuery: 'PLAY0642',\n identityQueryWithoutKey: 'PLAY0643',\n invalidIdentityQueryKey: 'PLAY0644',\n identityQueryAuthorizationDependency: 'PLAY0645',\n identityQueryTypeMismatch: 'PLAY0646',\n invalidReactionIdentity: 'PLAY0647',\n gatedInvocationWithoutIdentity: 'PLAY0648',\n unusedReactionIdentity: 'PLAY0649',\n unusedReactionRole: 'PLAY0650',\n unsatisfiedReactionIdentity: 'PLAY0651',\n reactionPrivilegeEscalation: 'PLAY0652',\n // Preserve supplied C# whole-model diagnostics; these checks are not yet run by the editor.\n commandProducesPublicEvent: 'PLAY0607',\n publicEventRequiresOutboundTranslation: 'PLAY0608',\n outboundPublicEventCount: 'PLAY0609',\n foreignPublicEventConsumer: 'PLAY0610',\n outboundTranslationInput: 'PLAY0611',\n inboundTranslationOutput: 'PLAY0612',\n foreignPublicEventProduced: 'PLAY0613',\n publicTranslationRequiresDirection: 'PLAY0614',\n translationConstructDirection: 'PLAY0615',\n inboundTranslationInput: 'PLAY0616',\n outboundTranslationOutput: 'PLAY0617',\n eventTargetOutsideOutboundTranslation: 'PLAY0618',\n eventsSourceOutsideInboundTranslation: 'PLAY0619',\n invalidCaptureEventsSource: 'PLAY0620',\n invalidDescription: 'PLAY0145',\n emptyDescription: 'PLAY0146',\n duplicateDescription: 'PLAY0147',\n unknownConceptDirective: 'PLAY0010',\n attributeReasonWithoutAttribute: 'PLAY0012',\n duplicateAttributeReason: 'PLAY0013',\n duplicateComplianceMarker: 'PLAY0653',\n legacyComplianceMarker: 'PLAY0565',\n unknownComplianceMarker: 'PLAY0566',\n invalidSecretScope: 'PLAY0567',\n duplicateSecretScope: 'PLAY0568',\n secretScopeIgnoredForPii: 'PLAY0569',\n invalidPersonalDataQualifier: 'PLAY0570',\n duplicateSpecialCategory: 'PLAY0571',\n invalidPurposeDeclaration: 'PLAY0596',\n invalidPurposeVocabulary: 'PLAY0597',\n duplicatePurposeField: 'PLAY0598',\n duplicatePurposeDeclaration: 'PLAY0599',\n unknownPurpose: 'PLAY0600',\n purposeInterestMismatch: 'PLAY0601',\n personalDataWithoutPurpose: 'PLAY0602',\n specialDataWithoutCondition: 'PLAY0603',\n criminalDataWithoutAuthorization: 'PLAY0604',\n purposeWithoutBasis: 'PLAY0605',\n unusedPurpose: 'PLAY0606',\n duplicateEventSubject: 'PLAY0590',\n invalidSubjectType: 'PLAY0591',\n protectedSubjectType: 'PLAY0592',\n invalidSubjectOwner: 'PLAY0593',\n readModelSubjectNotSupported: 'PLAY0594',\n invalidSubjectModifierOrder: 'PLAY0595',\n // Supplied compiler diagnostics are preserved, even for checks only the C# tool can run.\n // See Documentation/screenplay/editor-diagnostics.md for the validation boundary.\n conflictingScreenDataBinding: 'PLAY0530',\n screenDataQueryMismatch: 'PLAY0531',\n actionWithoutInputSurface: 'PLAY0532',\n commandWithoutInputSurface: 'PLAY0533',\n readModelFieldWithoutOrigin: 'PLAY0534',\n queryParameterNotHeldByView: 'PLAY0535',\n unconsumedEvent: 'PLAY0536',\n unreachableScreen: 'PLAY0537',\n invalidSpecificationCallerPersona: 'PLAY0572',\n unsynthesizablePersonaCaller: 'PLAY0573',\n personaWithoutGate: 'PLAY0574',\n gateWithoutPersona: 'PLAY0575',\n ambiguousPersonaCaller: 'PLAY0576',\n invalidSpecificationParameter: 'PLAY0577',\n invalidSpecificationCase: 'PLAY0578',\n duplicateSpecificationParameter: 'PLAY0579',\n duplicateSpecificationCase: 'PLAY0580',\n incompleteSpecificationTable: 'PLAY0581',\n invalidSpecificationCaseAssignment: 'PLAY0582',\n invalidSpecificationCaseValue: 'PLAY0583',\n invalidSpecificationCaseReference: 'PLAY0584',\n optionalSpecificationParameterTarget: 'PLAY0585',\n specificationCaseNameCollision: 'PLAY0586',\n incompatibleSpecificationParameterType: 'PLAY0587',\n unusedSpecificationParameter: 'PLAY0588',\n singularSpecificationTableExpansion: 'PLAY0589',\n invalidActionAlternative: 'PLAY0341',\n guardedActionWithoutAlternatives: 'PLAY0342',\n misplacedActionOtherwise: 'PLAY0343',\n unsupportedActionConditionOperand: 'PLAY0344',\n unknownActionSubjectField: 'PLAY0345',\n unresolvedActionSubject: 'PLAY0346',\n unreachableActionAlternative: 'PLAY0347',\n unknownActionArgumentProperty: 'PLAY0348',\n invalidRefusalBranch: 'PLAY0538',\n invalidRefusalBranchBody: 'PLAY0539',\n unreachableRefusalBranch: 'PLAY0540',\n invalidRefusalValue: 'PLAY0541',\n unknownRefusalConstraint: 'PLAY0542',\n unmatchedRedeliveredOccurrence: 'PLAY0543',\n unknownRedeliveryReaction: 'PLAY0544',\n invalidNoEventsExpectation: 'PLAY0545',\n indeterminateNegatedClaimTarget: 'PLAY0546',\n invalidAbsentReadModelStep: 'PLAY0453',\n unknownConstraintProperty: 'PLAY0391',\n invalidSpecificationExample: 'PLAY0518',\n duplicateSpecificationAssignment: 'PLAY0519',\n unknownReadModelProperty: 'PLAY0514',\n piiNotSupportedOnIdentifier: 'PLAY0515',\n invalidEventSourceDeclaration: 'PLAY0503',\n invalidCommandStream: 'PLAY0504',\n invalidSpecificationStream: 'PLAY0547',\n specificationStreamOnCommand: 'PLAY0548',\n invalidSpecificationStreamRoute: 'PLAY0549',\n invalidSpecificationStreamEventSource: 'PLAY0550',\n specificationStreamContradictsCommand: 'PLAY0551',\n ambiguousCommandStream: 'PLAY0505',\n unsupportedStreamIdType: 'PLAY0506',\n redundantSourceStreamId: 'PLAY0507',\n eventFromLaterSlice: 'PLAY0516',\n timelineCycleGroup: 'PLAY0517',\n invalidSpecificationExampleBody: 'PLAY0526',\n undeclaredDependency: 'PLAY0552',\n unusedDependencyDeclaration: 'PLAY0553',\n invalidDependencyTarget: 'PLAY0554',\n repeatedDependencyDeclaration: 'PLAY0555',\n mutualDependencyDeclarations: 'PLAY0556',\n authorizationRefusalWithoutIdentity: 'PLAY0557',\n invalidDocumentation: 'PLAY0558',\n conflictingDocumentationAcrossFiles: 'PLAY0559',\n unsupportedInteractionAlternatives: 'PLAY0560',\n mixedInteractionAlternatives: 'PLAY0561',\n interactionAlternativeWithoutActions: 'PLAY0562',\n inlineInteractionAlternative: 'PLAY0563',\n legacyInteractionWhere: 'PLAY0564',\n ambiguousReference: 'PLAY0198',\n invalidImplementationBlock: 'PLAY0492',\n invalidImplementationHint: 'PLAY0493',\n conflictingImplementationSources: 'PLAY0494',\n eventSourceIdInPayload: 'PLAY0469',\n explicitProducesTargetsRequired: 'PLAY0470',\n redundantEventId: 'PLAY0471',\n invalidEventId: 'PLAY0472',\n inlineEventCollision: 'PLAY0473',\n inlineEventOutsideCommand: 'PLAY0474',\n inlineEventGeneration: 'PLAY0475',\n reservedProductionMetadata: 'PLAY0476',\n invalidEventDocumentation: 'PLAY0477',\n tabIndentation: 'PLAY0006',\n unknownPrimitiveType: 'PLAY0008',\n unknownSliceType: 'PLAY0028',\n duplicateCommandIdentifier: 'PLAY0036',\n unknownContextPath: 'PLAY0153',\n unknownContextCausedByProperty: 'PLAY0154',\n unknownContextIdentityProperty: 'PLAY0155',\n unclosedCodeBlock: 'PLAY0164',\n unknownType: 'PLAY0165',\n unknownEvent: 'PLAY0166',\n unknownPolicy: 'PLAY0167',\n duplicateDeclaration: 'PLAY0168',\n unknownEventContextMember: 'PLAY0295',\n unknownEventContextPath: 'PLAY0296',\n eventContextPathBelowCollection: 'PLAY0297',\n missingEventContextPath: 'PLAY0298',\n unresolvedDynamicKeySource: 'PLAY0299',\n invalidFileImport: 'PLAY0454',\n omittedProductionDestination: 'PLAY0478',\n legacyOptionalSuffix: 'PLAY0479',\n invalidOptionalModifierOrder: 'PLAY0480',\n optionalReadsNotSupported: 'PLAY0481',\n unavailableResponseExecution: 'PLAY0268',\n generatedPropertyOutsideCommand: 'PLAY0482',\n invalidGeneratedType: 'PLAY0483',\n invalidGeneratedModifierOrder: 'PLAY0484',\n generatedPropertyInput: 'PLAY0485',\n invalidCommandResponse: 'PLAY0486',\n invalidResponseSource: 'PLAY0487',\n duplicateResponseField: 'PLAY0488',\n invalidResponseShape: 'PLAY0489',\n invalidGeneratedFixture: 'PLAY0490',\n invalidReturnExpectation: 'PLAY0491',\n} as const;\n\nexport type DiagnosticCode = (typeof diagnosticCodes)[keyof typeof diagnosticCodes];\n"],"mappings":"AAWA,MAAaA,EAAkB,CAC3B,uCAAwC,WACxC,2BAA4B,WAC5B,kBAAmB,WACnB,sBAAuB,WACvB,sBAAuB,WACvB,4BAA6B,WAC7B,uBAAwB,WACxB,wBAAyB,WACzB,sBAAuB,WACvB,qBAAsB,WACtB,qBAAsB,WACtB,wBAAyB,WACzB,wBAAyB,WACzB,qCAAsC,WACtC,0BAA2B,WAC3B,wBAAyB,WACzB,+BAAgC,WAChC,uBAAwB,WACxB,mBAAoB,WACpB,4BAA6B,WAC7B,4BAA6B,WAE7B,2BAA4B,WAC5B,uCAAwC,WACxC,yBAA0B,WAC1B,2BAA4B,WAC5B,yBAA0B,WAC1B,yBAA0B,WAC1B,2BAA4B,WAC5B,mCAAoC,WACpC,8BAA+B,WAC/B,wBAAyB,WACzB,0BAA2B,WAC3B,sCAAuC,WACvC,sCAAuC,WACvC,2BAA4B,WAC5B,mBAAoB,WACpB,iBAAkB,WAClB,qBAAsB,WACtB,wBAAyB,WACzB,gCAAiC,WACjC,yBAA0B,WAC1B,0BAA2B,WAC3B,uBAAwB,WACxB,wBAAyB,WACzB,mBAAoB,WACpB,qBAAsB,WACtB,yBAA0B,WAC1B,6BAA8B,WAC9B,yBAA0B,WAC1B,0BAA2B,WAC3B,yBAA0B,WAC1B,sBA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rC,qBAAsB,WACtB,oCAAqC,WACrC,mCAAoC,WACpC,6BAA8B,WAC9B,qCAAsC,WACtC,6BAA8B,WAC9B,uBAAwB,WACxB,mBAAoB,WACpB,2BAA4B,WAC5B,0BAA2B,WAC3B,iCAAkC,WAClC,uBAAwB,WACxB,gCAAiC,WACjC,iBAAkB,WAClB,eAAgB,WAChB,qBAAsB,WACtB,0BAA2B,WAC3B,sBAAuB,WACvB,2BAA4B,WAC5B,0BAA2B,WAC3B,eAAgB,WAChB,qBAAsB,WACtB,iBAAkB,WAClB,2BAA4B,WAC5B,mBAAoB,WACpB,+BAAgC,WAChC,+BAAgC,WAChC,kBAAmB,WACnB,YAAa,WACb,aAAc,WACd,cAAe,WACf,qBAAsB,WACtB,0BAA2B,WAC3B,wBAAyB,WACzB,gCAAiC,WACjC,wBAAyB,WACzB,2BAA4B,WAC5B,kBAAmB,WACnB,6BAA8B,WAC9B,qBAAsB,WACtB,6BAA8B,WAC9B,0BAA2B,WAC3B,6BAA8B,WAC9B,gCAAiC,WACjC,qBAAsB,WACtB,8BAA+B,WAC/B,uBAAwB,WACxB,uBAAwB,WACxB,sBAAuB,WACvB,uBAAwB,WACxB,qBAAsB,WACtB,wBAAyB,WACzB,yBAA0B,UAC9B"}
@@ -1,3 +1,3 @@
1
1
  import"./_virtual/_virtual/_rolldown/runtime.js";import{causedByProperties as e,contextRoots as t,identityProperties as n,primitiveTypes as r,sliceTypes as i}from"./language.js";import{DiagnosticCodes as a}from"./compiler/Diagnostics/DiagnosticCodes.js";import{legacyOptionalTypeLength as o}from"./compiler/Authoring/QuickFixes.js";import"./compiler/index.js";import{enclosingChain as s,fenceMap as c,indentOf as l}from"./document-context.js";import{eventAnalysisSource as u}from"./event-analysis-source.js";import{resolveEventContextPath as d}from"./event-context.js";import{responseAnalysis as f}from"./response-analysis.js";import{knownEventNames as p,knownTypeNames as m,mergeSymbols as h,propertyTypeReference as g,scanDocument as _,symbolsForBuffer as v}from"./symbols.js";import{diagnosticCodes as y}from"./diagnostic-codes.js";import{validateInlineEvents as b}from"./inline-event-validation.js";import{fileImportOn as x,isFileImportLine as S}from"./file-imports.js";function issue(e,t,n,r,i,a){return{severity:e,message:i,line:t,startColumn:n,endColumn:n+r,code:a}}function tokenIssue(e,t,n,r,i,a){return issue(e,t,n.indexOf(r)+1,r.length,i,a)}function validateDeclarations(e,t,n){let i=[],a=/* @__PURE__ */ new Set([...m(t,r),...m(n,[])]),checkProperties=(e,t)=>{for(let n of e.filter(e=>!a.has(g(e).name))){let e=g(n).name;i.push(issue(`warning`,n.line,n.sourceType.startColumn,n.sourceType.text.length,e===`optional`?`Unknown type 'optional' on '${n.name}' of ${t} — did you forget the type before 'optional'?`:`Unknown type '${e}' on '${n.name}' of ${t} — declare it with 'concept ${e} : <Primitive>' or 'type ${e}'.`,y.unknownType))}};for(let e of t.types)checkProperties(e.properties,`type '${e.name}'`);for(let e of t.events)checkProperties(e.properties,`event '${e.name}'`);for(let e of t.queries)checkProperties(e.parameters,`query '${e.name}'`);for(let n of t.commands){checkProperties(n.properties,`command '${n.name}'`);let t=n.properties.filter(e=>e.isIdentifier);for(let r of t.slice(1))i.push(tokenIssue(`error`,r.line,e[r.line],`identifier`,`Command '${n.name}' already marks '${t[0].name}' as identifier — only one property can be the identifier.`,y.duplicateCommandIdentifier))}let o=/* @__PURE__ */ new Map;for(let n of[...t.concepts,...t.types])o.get(n.name)===void 0?o.set(n.name,n.line):i.push(tokenIssue(`error`,n.line,e[n.line],n.name,`Duplicate declaration of '${n.name}' — concept and type names must be unique.`,y.duplicateDeclaration));return i}function validateLines(s,u={}){let d=c(s),m=_(s),g=u.application??h(),x=v(s,{...g,authoringPath:u.path??g.authoringPath,authoringPlacement:u.placement??g.authoringPlacement}),S=f(s,x.authoringDocuments??x.authoringSources?.filter(e=>e!==s.join(`
2
- `)),x.authoringPlacement,x.authoringPath,x.authoringPlacementResolved),C=new Set(S.eventSources.routes.map(e=>e.location.line-1)),w={...m,commands:m.commands.map(e=>({...e,properties:e.properties.filter(e=>!C.has(e.line)),produces:e.produces?.filter(e=>!S.operationProductionLines?.has(e.line)),productionHeaders:e.productionHeaders?.filter(e=>!S.operationProductionLines?.has(e))}))},T=/* @__PURE__ */ new Set([...p(w),...p(g)]),E=new Set([...w.policies,...g.policies].map(e=>e.name)),D=validateDeclarations(s,w,g);D.push(...validateProductionDestinations(s,w));let O=/* @__PURE__ */ new Set([a.LegacyOptionalSuffix,a.InvalidOptionalModifierOrder,a.OptionalReadsNotSupported]),k=/* @__PURE__ */ new Set([a.UnexpectedTokenInPolicyCondition,a.ExpectedPolicyCondition,a.UnclosedPolicyConditionGroup,a.ExpectedRoleName,a.ExpectedClaimName,a.ExpectedClaimMatches,a.ExpectedClaimMatchTarget]),A=/* @__PURE__ */ new Set([a.UnknownEvent,a.UnknownReadModelProperty,a.PiiNotSupportedOnIdentifier]),j=/* @__PURE__ */ new Set([a.EventFromLaterSlice,a.TimelineCycleGroup]),M=/* @__PURE__ */ new Set([a.UndeclaredDependency,a.UnusedDependencyDeclaration,a.InvalidDependencyTarget,a.RepeatedDependencyDeclaration,a.MutualDependencyDeclarations,a.AmbiguousReference]),N=/* @__PURE__ */ new Set([a.InvalidEventDeclaration,a.InvalidImportDeclaration,a.InvalidSliceDeclaration,a.InvalidDescription,a.DuplicateDescription,a.EmptyDescription,a.DuplicateEventSubject,a.InvalidSubjectType,a.ProtectedSubjectType,a.InvalidSubjectOwner,a.ReadModelSubjectNotSupported,a.InvalidSubjectModifierOrder,a.UnsupportedInteractionAlternatives,a.MixedInteractionAlternatives,a.InteractionAlternativeWithoutActions,a.InlineInteractionAlternative,a.LegacyInteractionWhere,a.InvalidSpecificationParameter,a.InvalidSpecificationCase,a.DuplicateSpecificationParameter,a.DuplicateSpecificationCase,a.IncompleteSpecificationTable,a.InvalidSpecificationCaseAssignment,a.InvalidSpecificationCaseValue,a.InvalidSpecificationCaseReference,a.OptionalSpecificationParameterTarget,a.SpecificationCaseNameCollision,a.IncompatibleSpecificationParameterType,a.UnusedSpecificationParameter,a.SingularSpecificationTableExpansion,a.InvalidSpecificationCallerPersona,a.UnsynthesizablePersonaCaller,a.PersonaWithoutGate,a.GateWithoutPersona,a.AmbiguousPersonaCaller,a.InvalidDocumentation,a.ConflictingDocumentationAcrossFiles,a.InvalidAbsentReadModelStep,a.UnknownConstraintProperty,a.OmittedProductionDestination,a.InvalidSpecificationExample,a.DuplicateSpecificationAssignment]),P=/* @__PURE__ */ new Set([a.InvalidPurposeDeclaration,a.InvalidPurposeVocabulary,a.DuplicatePurposeField,a.DuplicatePurposeDeclaration,a.UnknownPurpose,a.PurposeInterestMismatch,a.PersonalDataWithoutPurpose,a.SpecialDataWithoutCondition,a.CriminalDataWithoutAuthorization,a.PurposeWithoutBasis,a.UnusedPurpose,a.UnknownConceptDirective,a.AttributeReasonWithoutAttribute,a.DuplicateAttributeReason,a.LegacyComplianceMarker,a.UnknownComplianceMarker,a.InvalidSecretScope,a.DuplicateSecretScope,a.SecretScopeIgnoredForPii,a.InvalidPersonalDataQualifier,a.DuplicateSpecialCategory]),F=/* @__PURE__ */ new Set;for(let e of u.compilerDiagnostics??S.diagnostics){let t=e.code===a.UnknownType&&(S.identityDetails??[]).some(t=>t.line===e.location.line-1),n=e.code===a.RepeatedSingularDeclarationAcrossFiles&&e.message.includes(`identity block`);if(!t&&!n&&!P.has(e.code)&&!O.has(e.code)&&!k.has(e.code)&&!A.has(e.code)&&!j.has(e.code)&&!M.has(e.code)&&!N.has(e.code)&&e.code!==a.InvalidSpecificationExampleBody&&e.code!==a.UnknownRuleImplementationDirective&&e.code!==a.InvalidValidationRule&&e.code!==a.RepeatedDeclarationAcrossFiles&&!/^PLAY049[0-9]$|^PLAY050[0-7]$|^PLAY054[7-9]$|^PLAY055[01]$|^PLAY048[2-9]$|^PLAY004[56]$|^PLAY053[0-9]$|^PLAY054[0-6]$|^PLAY034[1-8]$|^PLAY0557$|^PLAY060[7-9]$|^PLAY061[0-9]$|^PLAY0620$|^PLAY063[3-9]$|^PLAY064[0-9]$|^PLAY065[0-2]$/.test(e.code))continue;let r=e.location.line-1;if(e.code===a.OmittedProductionDestination&&D.some(t=>t.code===e.code&&t.line===r))continue;if(e.code===a.UnknownEvent){if(F.has(r))continue;F.add(r)}let i=o(s[r],e)||s[r].length-e.location.column+1;D.push(issue(e.severity,r,e.location.column,i,e.message,e.code))}let checkEvent=(e,t,n)=>{!T.has(n)&&!F.has(e)&&D.push(tokenIssue(`warning`,e,t,n,`Unknown event type '${n}' — declare it in a slice or import it.`,y.unknownEvent))},I=-1;for(let a=0;a<s.length;a++){let o=s[a],c=o.trim();if(d[a]||c.length===0)continue;let u=o.match(/^[ ]*(\t+)/);if(u&&D.push(issue(`warning`,a,u[0].length-u[1].length+1,u[1].length,`Screenplay is indentation-based — use spaces, not tabs.`,y.tabIndentation)),I>=0){if(l(o)>I&&/^(?:or\s+)?[A-Z]\w*(?:\s+or\s+[A-Z]\w*)*$/.test(c)){for(let e of c.split(/\s+/).filter(e=>e!==`or`))E.has(e)||D.push(tokenIssue(`warning`,a,o,e,`Unknown policy '${e}' — declare it with 'policy ${e}'.`,y.unknownPolicy));continue}I=-1}let f=validateImport(s,d,a);f&&D.push(f);let p=c.match(/^slice\s+(\w+)/);p&&!i.includes(p[1])&&D.push(tokenIssue(`error`,a,o,p[1],`Unknown slice type '${p[1]}' — expected ${i.join(`, `)}.`,y.unknownSliceType));let m=c.match(/^concept\s+\w+\s*:\s*(\w+)/);m&&m[1]!==`Enum`&&!r.includes(m[1])&&D.push(tokenIssue(`error`,a,o,m[1],`Unknown primitive type '${m[1]}' — expected ${r.join(`, `)} or Enum.`,y.unknownPrimitiveType));let h=c.match(/^authorize\s+(.*)$/);if(h){I=l(o);for(let e of h[1].split(/\s+/).filter(e=>e!==`or`&&e.length>0))E.has(e)||D.push(tokenIssue(`warning`,a,o,e,`Unknown policy '${e}' — declare it with 'policy ${e}'.`,y.unknownPolicy))}let g=c.match(/^on\s+([A-Z]\w*)\s*$/);g&&checkEvent(a,o,g[1]);let _=c.match(/^produces\s+([A-Z]\w*)\s*$/);if(_&&!S.operationProductionLines?.has(a)&&checkEvent(a,o,_[1]),/^produces\s+when\b/.test(c)&&!S.operationProductionLines?.has(a))for(let e=a+1;e<s.length;e++){let t=s[e];if(!(d[e]||t.trim().length===0)){if(l(t)>l(o)){let n=t.trim().match(/^([A-Z]\w*)\s*$/);n&&checkEvent(e,t,n[1])}break}}let v=c.match(/^unique\s+event\s+([A-Z]\w*)/);v&&checkEvent(a,o,v[1]);let b=c.match(/^unique\s+[a-z_]\w*\s+on\s+([A-Z]\w*)/);b&&checkEvent(a,o,b[1]);for(let e of o.match(/\$identity\.[\w.]+/g)??[]){let t=e.substring(10).split(`.`)[0],r=[...n,...(S.identityDetails??[]).map(e=>e.name)];r.includes(t)||D.push(tokenIssue(`warning`,a,o,e,`Unknown $identity property '${t}' — expected ${r.join(`, `)}.`,y.unknownContextIdentityProperty))}for(let r of o.match(/\$context\.[\w.]+/g)??[]){let i=r.substring(9).split(`.`);t.includes(i[0])?i[0]===`causedBy`&&i.length>1&&!e.includes(i[1])?D.push(tokenIssue(`warning`,a,o,r,`Unknown $context.causedBy property '${i[1]}' — expected ${e.join(`, `)}.`,y.unknownContextCausedByProperty)):i[0]===`identity`&&i.length>1&&!n.includes(i[1])&&D.push(tokenIssue(`warning`,a,o,r,`Unknown $context.identity property '${i[1]}' — expected ${n.join(`, `)}.`,y.unknownContextIdentityProperty)):D.push(tokenIssue(`warning`,a,o,r,`Unknown $context path '${i.join(`.`)}' — expected one of ${t.join(`, `)}.`,y.unknownContextPath))}}D.push(...validateEventContextPaths(s,d)),D.push(...b(s,w,g,S.operationProductionLines));let L=s.map((e,t)=>({line:e,index:t})).filter(({line:e})=>/^\s*```(?:[a-z]+)?\s*$/.test(e));if(L.length%2==1){let e=L[L.length-1];D.push(issue(`error`,e.index,1,e.line.length+1,"Unclosed inline code block — expected a closing ``` line.",y.unclosedCodeBlock))}return D}function validateProductionDestinations(e,t){let n=[];e=u(e);for(let r of t.commands){let t=r.properties.filter(e=>e.isIdentifier&&!g(e).isOptional&&!g(e).isCollection);if(t.length===1)for(let i of r.produces??[]){if(i.inline||i.conditional||i.target!==void 0)continue;let r=i.line;n.push(issue(`information`,r,l(e[r])+1,e[r].trim().length,`Plain 'produces ${i.name}' omits its destination — use 'for ${t[0].name}' to explicitly select the command's identifier.`,y.omittedProductionDestination))}}return n}function validateImport(e,t,n){let r=e[n],i=r.trim().replace(/\s*\/\/.*$/,``);if(!/^import\b/.test(i)||x(r,n))return;let a=l(r);if(a>0&&[`module`,`feature`].includes(s(e,t,n,a)[0])||S(r))return issue(`error`,n,a+1,i.length,`Invalid import '${i}' — inside a module or feature, import names files: 'import "<path or glob>"'.`,y.invalidFileImport)}const C=/^(?:(?:increment|decrement|count|clear|add|subtract|set)\s+)?@?([$\w.]+)(?=\s|=|$)/;function validateEventContextPaths(e,t){let n=[],names=e=>e.map(e=>e.name).join(`, `);for(let r=0;r<e.length;r++){let i=e[r];if(t[r])continue;for(let e of i.matchAll(/(\.)?\$eventContext((?:\.(?:\w+(?:\(\))?)?)*)/g)){let t=e[0].substring(e[1]?.length??0),i=e[2];if(i.length===0){e[1]&&n.push(issue(`error`,r,(e.index??0)+2,t.length,`'$eventContext' names no member - expected one of ${names(d(``).expected)}.`,y.missingEventContextPath));continue}let a=i.substring(1),o=d(a),s=(e.index??0)+(e[1]?.length??0)+1;switch(o.status){case`missing`:n.push(issue(`error`,r,s,t.length,`'$eventContext.${a}' names no member - expected one of ${names(o.expected)}.`,y.missingEventContextPath));break;case`unknownMember`:n.push(issue(`warning`,r,s,t.length,`Unknown event context member '${o.segment}' in '$eventContext.${a}' - expected one of ${names(o.expected)}.`,y.unknownEventContextMember));break;case`unknownSubPath`:{let e=o.expected.length===0?`no members to address`:`members ${names(o.expected)}`;n.push(issue(`warning`,r,s,t.length,`Unknown event context path '$eventContext.${a}' - '${o.member?.name}' (${o.member?.type}) has ${e}.`,y.unknownEventContextPath));break}case`belowCollection`:n.push(issue(`error`,r,s,t.length,`'$eventContext.${a}' cannot resolve - '${o.member?.name}' is a collection (${o.member?.type}) and cannot be addressed below.`,y.eventContextPathBelowCollection))}}let a=i.trim().match(C)?.[1],o=a?.match(/\.\$(\w+)/)?.[1];a&&o&&o!==`eventContext`&&n.push(tokenIssue(`warning`,r,i,a,`Dynamic dictionary key '$${o}' in '${a}' is never resolved - only '$eventContext.<path>' is, so the literal text '$${o}' becomes the key.`,y.unresolvedDynamicKeySource))}return n}export{validateEventContextPaths,validateLines};
2
+ `)),x.authoringPlacement,x.authoringPath,x.authoringPlacementResolved),C=new Set(S.eventSources.routes.map(e=>e.location.line-1)),w={...m,commands:m.commands.map(e=>({...e,properties:e.properties.filter(e=>!C.has(e.line)),produces:e.produces?.filter(e=>!S.operationProductionLines?.has(e.line)),productionHeaders:e.productionHeaders?.filter(e=>!S.operationProductionLines?.has(e))}))},T=/* @__PURE__ */ new Set([...p(w),...p(g)]),E=new Set([...w.policies,...g.policies].map(e=>e.name)),D=validateDeclarations(s,w,g);D.push(...validateProductionDestinations(s,w));let O=/* @__PURE__ */ new Set([a.LegacyOptionalSuffix,a.InvalidOptionalModifierOrder,a.OptionalReadsNotSupported]),k=/* @__PURE__ */ new Set([a.UnexpectedTokenInPolicyCondition,a.ExpectedPolicyCondition,a.UnclosedPolicyConditionGroup,a.ExpectedRoleName,a.ExpectedClaimName,a.ExpectedClaimMatches,a.ExpectedClaimMatchTarget]),A=/* @__PURE__ */ new Set([a.UnknownEvent,a.UnknownReadModelProperty,a.PiiNotSupportedOnIdentifier]),j=/* @__PURE__ */ new Set([a.EventFromLaterSlice,a.TimelineCycleGroup]),M=/* @__PURE__ */ new Set([a.UndeclaredDependency,a.UnusedDependencyDeclaration,a.InvalidDependencyTarget,a.RepeatedDependencyDeclaration,a.MutualDependencyDeclarations,a.AmbiguousReference]),N=/* @__PURE__ */ new Set([a.InvalidEventDeclaration,a.InvalidImportDeclaration,a.InvalidSliceDeclaration,a.InvalidDescription,a.DuplicateDescription,a.EmptyDescription,a.DuplicateEventSubject,a.InvalidSubjectType,a.ProtectedSubjectType,a.InvalidSubjectOwner,a.ReadModelSubjectNotSupported,a.InvalidSubjectModifierOrder,a.UnsupportedInteractionAlternatives,a.MixedInteractionAlternatives,a.InteractionAlternativeWithoutActions,a.InlineInteractionAlternative,a.LegacyInteractionWhere,a.InvalidSpecificationParameter,a.InvalidSpecificationCase,a.DuplicateSpecificationParameter,a.DuplicateSpecificationCase,a.IncompleteSpecificationTable,a.InvalidSpecificationCaseAssignment,a.InvalidSpecificationCaseValue,a.InvalidSpecificationCaseReference,a.OptionalSpecificationParameterTarget,a.SpecificationCaseNameCollision,a.IncompatibleSpecificationParameterType,a.UnusedSpecificationParameter,a.SingularSpecificationTableExpansion,a.InvalidSpecificationCallerPersona,a.UnsynthesizablePersonaCaller,a.PersonaWithoutGate,a.GateWithoutPersona,a.AmbiguousPersonaCaller,a.InvalidDocumentation,a.ConflictingDocumentationAcrossFiles,a.InvalidAbsentReadModelStep,a.UnknownConstraintProperty,a.OmittedProductionDestination,a.InvalidSpecificationExample,a.DuplicateSpecificationAssignment]),P=/* @__PURE__ */ new Set([a.InvalidPurposeDeclaration,a.InvalidPurposeVocabulary,a.DuplicatePurposeField,a.DuplicatePurposeDeclaration,a.UnknownPurpose,a.PurposeInterestMismatch,a.PersonalDataWithoutPurpose,a.SpecialDataWithoutCondition,a.CriminalDataWithoutAuthorization,a.PurposeWithoutBasis,a.UnusedPurpose,a.UnknownConceptDirective,a.AttributeReasonWithoutAttribute,a.DuplicateAttributeReason,a.LegacyComplianceMarker,a.DuplicateComplianceMarker,a.UnknownComplianceMarker,a.InvalidSecretScope,a.DuplicateSecretScope,a.SecretScopeIgnoredForPii,a.InvalidPersonalDataQualifier,a.DuplicateSpecialCategory]),F=/* @__PURE__ */ new Set;for(let e of u.compilerDiagnostics??S.diagnostics){let t=e.code===a.UnknownType&&(S.identityDetails??[]).some(t=>t.line===e.location.line-1),n=e.code===a.RepeatedSingularDeclarationAcrossFiles&&e.message.includes(`identity block`);if(!t&&!n&&!P.has(e.code)&&!O.has(e.code)&&!k.has(e.code)&&!A.has(e.code)&&!j.has(e.code)&&!M.has(e.code)&&!N.has(e.code)&&e.code!==a.InvalidSpecificationExampleBody&&e.code!==a.UnknownRuleImplementationDirective&&e.code!==a.InvalidValidationRule&&e.code!==a.RepeatedDeclarationAcrossFiles&&!/^PLAY049[0-9]$|^PLAY050[0-7]$|^PLAY054[7-9]$|^PLAY055[01]$|^PLAY048[2-9]$|^PLAY004[56]$|^PLAY053[0-9]$|^PLAY054[0-6]$|^PLAY034[1-8]$|^PLAY0557$|^PLAY060[7-9]$|^PLAY061[0-9]$|^PLAY0620$|^PLAY063[3-9]$|^PLAY064[0-9]$|^PLAY065[0-2]$/.test(e.code))continue;let r=e.location.line-1;if(e.code===a.OmittedProductionDestination&&D.some(t=>t.code===e.code&&t.line===r))continue;if(e.code===a.UnknownEvent){if(F.has(r))continue;F.add(r)}let i=o(s[r],e)||s[r].length-e.location.column+1;D.push(issue(e.severity,r,e.location.column,i,e.message,e.code))}let checkEvent=(e,t,n)=>{!T.has(n)&&!F.has(e)&&D.push(tokenIssue(`warning`,e,t,n,`Unknown event type '${n}' — declare it in a slice or import it.`,y.unknownEvent))},I=-1;for(let a=0;a<s.length;a++){let o=s[a],c=o.trim();if(d[a]||c.length===0)continue;let u=o.match(/^[ ]*(\t+)/);if(u&&D.push(issue(`warning`,a,u[0].length-u[1].length+1,u[1].length,`Screenplay is indentation-based — use spaces, not tabs.`,y.tabIndentation)),I>=0){if(l(o)>I&&/^(?:or\s+)?[A-Z]\w*(?:\s+or\s+[A-Z]\w*)*$/.test(c)){for(let e of c.split(/\s+/).filter(e=>e!==`or`))E.has(e)||D.push(tokenIssue(`warning`,a,o,e,`Unknown policy '${e}' — declare it with 'policy ${e}'.`,y.unknownPolicy));continue}I=-1}let f=validateImport(s,d,a);f&&D.push(f);let p=c.match(/^slice\s+(\w+)/);p&&!i.includes(p[1])&&D.push(tokenIssue(`error`,a,o,p[1],`Unknown slice type '${p[1]}' — expected ${i.join(`, `)}.`,y.unknownSliceType));let m=c.match(/^concept\s+\w+\s*:\s*(\w+)/);m&&m[1]!==`Enum`&&!r.includes(m[1])&&D.push(tokenIssue(`error`,a,o,m[1],`Unknown primitive type '${m[1]}' — expected ${r.join(`, `)} or Enum.`,y.unknownPrimitiveType));let h=c.match(/^authorize\s+(.*)$/);if(h){I=l(o);for(let e of h[1].split(/\s+/).filter(e=>e!==`or`&&e.length>0))E.has(e)||D.push(tokenIssue(`warning`,a,o,e,`Unknown policy '${e}' — declare it with 'policy ${e}'.`,y.unknownPolicy))}let g=c.match(/^on\s+([A-Z]\w*)\s*$/);g&&checkEvent(a,o,g[1]);let _=c.match(/^produces\s+([A-Z]\w*)\s*$/);if(_&&!S.operationProductionLines?.has(a)&&checkEvent(a,o,_[1]),/^produces\s+when\b/.test(c)&&!S.operationProductionLines?.has(a))for(let e=a+1;e<s.length;e++){let t=s[e];if(!(d[e]||t.trim().length===0)){if(l(t)>l(o)){let n=t.trim().match(/^([A-Z]\w*)\s*$/);n&&checkEvent(e,t,n[1])}break}}let v=c.match(/^unique\s+event\s+([A-Z]\w*)/);v&&checkEvent(a,o,v[1]);let b=c.match(/^unique\s+[a-z_]\w*\s+on\s+([A-Z]\w*)/);b&&checkEvent(a,o,b[1]);for(let e of o.match(/\$identity\.[\w.]+/g)??[]){let t=e.substring(10).split(`.`)[0],r=[...n,...(S.identityDetails??[]).map(e=>e.name)];r.includes(t)||D.push(tokenIssue(`warning`,a,o,e,`Unknown $identity property '${t}' — expected ${r.join(`, `)}.`,y.unknownContextIdentityProperty))}for(let r of o.match(/\$context\.[\w.]+/g)??[]){let i=r.substring(9).split(`.`);t.includes(i[0])?i[0]===`causedBy`&&i.length>1&&!e.includes(i[1])?D.push(tokenIssue(`warning`,a,o,r,`Unknown $context.causedBy property '${i[1]}' — expected ${e.join(`, `)}.`,y.unknownContextCausedByProperty)):i[0]===`identity`&&i.length>1&&!n.includes(i[1])&&D.push(tokenIssue(`warning`,a,o,r,`Unknown $context.identity property '${i[1]}' — expected ${n.join(`, `)}.`,y.unknownContextIdentityProperty)):D.push(tokenIssue(`warning`,a,o,r,`Unknown $context path '${i.join(`.`)}' — expected one of ${t.join(`, `)}.`,y.unknownContextPath))}}D.push(...validateEventContextPaths(s,d)),D.push(...b(s,w,g,S.operationProductionLines));let L=s.map((e,t)=>({line:e,index:t})).filter(({line:e})=>/^\s*```(?:[a-z]+)?\s*$/.test(e));if(L.length%2==1){let e=L[L.length-1];D.push(issue(`error`,e.index,1,e.line.length+1,"Unclosed inline code block — expected a closing ``` line.",y.unclosedCodeBlock))}return D}function validateProductionDestinations(e,t){let n=[];e=u(e);for(let r of t.commands){let t=r.properties.filter(e=>e.isIdentifier&&!g(e).isOptional&&!g(e).isCollection);if(t.length===1)for(let i of r.produces??[]){if(i.inline||i.conditional||i.target!==void 0)continue;let r=i.line;n.push(issue(`information`,r,l(e[r])+1,e[r].trim().length,`Plain 'produces ${i.name}' omits its destination — use 'for ${t[0].name}' to explicitly select the command's identifier.`,y.omittedProductionDestination))}}return n}function validateImport(e,t,n){let r=e[n],i=r.trim().replace(/\s*\/\/.*$/,``);if(!/^import\b/.test(i)||x(r,n))return;let a=l(r);if(a>0&&[`module`,`feature`].includes(s(e,t,n,a)[0])||S(r))return issue(`error`,n,a+1,i.length,`Invalid import '${i}' — inside a module or feature, import names files: 'import "<path or glob>"'.`,y.invalidFileImport)}const C=/^(?:(?:increment|decrement|count|clear|add|subtract|set)\s+)?@?([$\w.]+)(?=\s|=|$)/;function validateEventContextPaths(e,t){let n=[],names=e=>e.map(e=>e.name).join(`, `);for(let r=0;r<e.length;r++){let i=e[r];if(t[r])continue;for(let e of i.matchAll(/(\.)?\$eventContext((?:\.(?:\w+(?:\(\))?)?)*)/g)){let t=e[0].substring(e[1]?.length??0),i=e[2];if(i.length===0){e[1]&&n.push(issue(`error`,r,(e.index??0)+2,t.length,`'$eventContext' names no member - expected one of ${names(d(``).expected)}.`,y.missingEventContextPath));continue}let a=i.substring(1),o=d(a),s=(e.index??0)+(e[1]?.length??0)+1;switch(o.status){case`missing`:n.push(issue(`error`,r,s,t.length,`'$eventContext.${a}' names no member - expected one of ${names(o.expected)}.`,y.missingEventContextPath));break;case`unknownMember`:n.push(issue(`warning`,r,s,t.length,`Unknown event context member '${o.segment}' in '$eventContext.${a}' - expected one of ${names(o.expected)}.`,y.unknownEventContextMember));break;case`unknownSubPath`:{let e=o.expected.length===0?`no members to address`:`members ${names(o.expected)}`;n.push(issue(`warning`,r,s,t.length,`Unknown event context path '$eventContext.${a}' - '${o.member?.name}' (${o.member?.type}) has ${e}.`,y.unknownEventContextPath));break}case`belowCollection`:n.push(issue(`error`,r,s,t.length,`'$eventContext.${a}' cannot resolve - '${o.member?.name}' is a collection (${o.member?.type}) and cannot be addressed below.`,y.eventContextPathBelowCollection))}}let a=i.trim().match(C)?.[1],o=a?.match(/\.\$(\w+)/)?.[1];a&&o&&o!==`eventContext`&&n.push(tokenIssue(`warning`,r,i,a,`Dynamic dictionary key '$${o}' in '${a}' is never resolved - only '$eventContext.<path>' is, so the literal text '$${o}' becomes the key.`,y.unresolvedDynamicKeySource))}return n}export{validateEventContextPaths,validateLines};
3
3
  //# sourceMappingURL=validation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"validation.js","names":["startColumn","length","severity","line","text","token","message","code","issues","types","knownTypeNames","symbols","primitiveTypes","application","property","properties","propertyTypeReference","candidate","bare","owner","diagnosticCodes","type","event","query","command","identifiers","extra","lines","declared","declaration","fences","fenceMap","scanned","scanDocument","context","mergeSymbols","input","symbolsForBuffer","analysis","responseAnalysis","source","routeLines","route","production","events","knownEventNames","policies","policy","optionalCodes","DiagnosticCodes","policyCodes","consistencyCodes","timelineCodes","dependencyCodes","authoringCodes","complianceCodes","compilerUnknownEventLines","diagnostic","identityType","detail","identityDuplicate","existing","legacyOptionalTypeLength","name","authorizeIndent","index","trimmed","leading","indentOf","fileImportIssue","slice","sliceTypes","concept","authorize","reactsOn","produces","next","uniqueEvent","uniqueProperty","path","member","knownIdentity","identityProperties","segments","contextRoots","causedByProperties","validateInlineEvents","fenceLines","last","eventAnalysisSource","fileImportOn","indent","enclosingChain","isFileImportLine","mappingTarget","members","match","written","resolveEventContextPath","resolution","column","has","target"],"sources":["../../validation.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes, legacyOptionalTypeLength } from '@cratis/screenplay-compiler';\nimport { AnalysisDiagnostic, responseAnalysis } from './response-analysis';\nimport { validateInlineEvents } from './inline-event-validation';\nimport { causedByProperties, contextRoots, identityProperties, primitiveTypes, sliceTypes } from './language';\nimport { DiagnosticCode, diagnosticCodes } from './diagnostic-codes';\nimport { enclosingChain, fenceMap, indentOf } from './document-context';\nimport { eventAnalysisSource } from './event-analysis-source';\nimport { resolveEventContextPath } from './event-context';\nimport {\n DocumentSymbols,\n PropertySymbol,\n propertyTypeReference,\n knownEventNames,\n knownTypeNames,\n mergeSymbols,\n scanDocument,\n symbolsForBuffer,\n} from './symbols';\nimport { fileImportOn, isFileImportLine } from './file-imports';\n\nexport type ValidationSeverity = 'error' | 'warning' | 'information';\n\nexport interface ValidationIssue {\n line: number;\n startColumn: number;\n endColumn: number;\n message: string;\n severity: ValidationSeverity;\n\n // The compiler code for this condition, absent on the structural checks the editor makes and the\n // compiler does not. See ./diagnostic-codes.ts.\n code?: DiagnosticCode;\n}\n\n// What a document is validated against beyond itself.\nexport interface ValidationContext {\n // What the rest of the application declares - the other .play files of a folder, or the files an import\n // brings in - so a name declared in another file is not reported unknown. Merge the scanned symbols of\n // those files with mergeSymbols. The document's own declarations are always known.\n application?: DocumentSymbols;\n placement?: readonly string[];\n path?: string;\n compilerDiagnostics?: readonly AnalysisDiagnostic[];\n}\n\nfunction issue(\n severity: ValidationSeverity,\n line: number,\n startColumn: number,\n length: number,\n message: string,\n code: DiagnosticCode,\n): ValidationIssue {\n return { severity, message, line, startColumn, endColumn: startColumn + length, code };\n}\n\nfunction tokenIssue(\n severity: ValidationSeverity,\n line: number,\n text: string,\n token: string,\n message: string,\n code: DiagnosticCode,\n): ValidationIssue {\n const column = text.indexOf(token) + 1;\n return issue(severity, line, column, token.length, message, code);\n}\n\n// Reports every property whose type reference names nothing the document declares, and\n// every command that marks more than one property as its identifier.\nfunction validateDeclarations(lines: string[], symbols: DocumentSymbols, application: DocumentSymbols): ValidationIssue[] {\n const issues: ValidationIssue[] = [];\n const types = new Set([...knownTypeNames(symbols, primitiveTypes), ...knownTypeNames(application, [])]);\n\n const checkProperties = (properties: PropertySymbol[], owner: string) => {\n for (const property of properties.filter(\n (candidate) => !types.has(propertyTypeReference(candidate).name),\n )) {\n const bare = propertyTypeReference(property).name;\n issues.push(\n issue(\n 'warning',\n property.line,\n property.sourceType!.startColumn,\n property.sourceType!.text.length,\n bare === 'optional'\n ? `Unknown type 'optional' on '${property.name}' of ${owner} — did you forget the type before 'optional'?`\n : `Unknown type '${bare}' on '${property.name}' of ${owner} — declare it with 'concept ${bare} : <Primitive>' or 'type ${bare}'.`,\n diagnosticCodes.unknownType,\n ),\n );\n }\n };\n\n for (const type of symbols.types) checkProperties(type.properties, `type '${type.name}'`);\n for (const event of symbols.events) checkProperties(event.properties, `event '${event.name}'`);\n for (const query of symbols.queries) checkProperties(query.parameters, `query '${query.name}'`);\n for (const command of symbols.commands) {\n checkProperties(command.properties, `command '${command.name}'`);\n const identifiers = command.properties.filter((property) => property.isIdentifier);\n for (const extra of identifiers.slice(1)) {\n issues.push(\n tokenIssue(\n 'error',\n extra.line,\n lines[extra.line],\n 'identifier',\n `Command '${command.name}' already marks '${identifiers[0].name}' as identifier — only one property can be the identifier.`,\n diagnosticCodes.duplicateCommandIdentifier,\n ),\n );\n }\n }\n\n const declared = new Map<string, number>();\n for (const declaration of [...symbols.concepts, ...symbols.types]) {\n const first = declared.get(declaration.name);\n if (first === undefined) {\n declared.set(declaration.name, declaration.line);\n continue;\n }\n issues.push(\n tokenIssue(\n 'error',\n declaration.line,\n lines[declaration.line],\n declaration.name,\n `Duplicate declaration of '${declaration.name}' — concept and type names must be unique.`,\n diagnosticCodes.duplicateDeclaration,\n ),\n );\n }\n\n return issues;\n}\n\n// Validates a Screenplay document without any editor dependency — both the Monaco\n// service and the VSCode extension adapt these issues to their marker/diagnostic APIs.\n//\n// The checks read the document line by line, never as a whole document's top level, so a file an import\n// places in a module or feature - holding slices or features at its top level - validates as it is written.\n// Where it is placed, and whether its imports resolve, is the compiler's to say.\nexport function validateLines(lines: string[], context: ValidationContext = {}): ValidationIssue[] {\n const fences = fenceMap(lines);\n const scanned = scanDocument(lines);\n const application = context.application ?? mergeSymbols();\n const input = symbolsForBuffer(lines, { ...application, authoringPath: context.path ?? application.authoringPath, authoringPlacement: context.placement ?? application.authoringPlacement });\n const analysis = responseAnalysis(lines, input.authoringDocuments ?? input.authoringSources?.filter(source => source !== lines.join('\\n')), input.authoringPlacement, input.authoringPath, input.authoringPlacementResolved);\n const routeLines = new Set(analysis.eventSources.routes.map(route => route.location.line - 1));\n const symbols = { ...scanned, commands: scanned.commands.map(command => ({ ...command,\n properties: command.properties.filter(property => !routeLines.has(property.line)),\n produces: command.produces?.filter(production => !analysis.operationProductionLines?.has(production.line)),\n productionHeaders: command.productionHeaders?.filter(line => !analysis.operationProductionLines?.has(line)),\n })) };\n const events = new Set([...knownEventNames(symbols), ...knownEventNames(application)]);\n const policies = new Set([...symbols.policies, ...application.policies].map((policy) => policy.name));\n const issues: ValidationIssue[] = validateDeclarations(lines, symbols, application);\n issues.push(...validateProductionDestinations(lines, symbols));\n // One parser pass covers committed types, including query results and trigger data, without\n // speculative property scans mistaking tags, paths, strings or code for optionality.\n const optionalCodes = new Set<string>([DiagnosticCodes.LegacyOptionalSuffix, DiagnosticCodes.InvalidOptionalModifierOrder, DiagnosticCodes.OptionalReadsNotSupported]);\n const policyCodes = new Set<string>([DiagnosticCodes.UnexpectedTokenInPolicyCondition, DiagnosticCodes.ExpectedPolicyCondition, DiagnosticCodes.UnclosedPolicyConditionGroup, DiagnosticCodes.ExpectedRoleName, DiagnosticCodes.ExpectedClaimName, DiagnosticCodes.ExpectedClaimMatches, DiagnosticCodes.ExpectedClaimMatchTarget]);\n const consistencyCodes = new Set<string>([DiagnosticCodes.UnknownEvent, DiagnosticCodes.UnknownReadModelProperty, DiagnosticCodes.PiiNotSupportedOnIdentifier]);\n const timelineCodes = new Set<string>([DiagnosticCodes.EventFromLaterSlice, DiagnosticCodes.TimelineCycleGroup]);\n const dependencyCodes = new Set<string>([DiagnosticCodes.UndeclaredDependency, DiagnosticCodes.UnusedDependencyDeclaration, DiagnosticCodes.InvalidDependencyTarget, DiagnosticCodes.RepeatedDependencyDeclaration, DiagnosticCodes.MutualDependencyDeclarations, DiagnosticCodes.AmbiguousReference]);\n // These parser diagnostics must reach the marker adapter. C#-only completeness and reference\n // checks are not synthesized here, but are preserved when a caller supplies compiler diagnostics.\n const authoringCodes = new Set<string>([DiagnosticCodes.InvalidEventDeclaration, DiagnosticCodes.InvalidImportDeclaration, DiagnosticCodes.InvalidSliceDeclaration, DiagnosticCodes.InvalidDescription, DiagnosticCodes.DuplicateDescription, DiagnosticCodes.EmptyDescription,DiagnosticCodes.DuplicateEventSubject, DiagnosticCodes.InvalidSubjectType, DiagnosticCodes.ProtectedSubjectType, DiagnosticCodes.InvalidSubjectOwner, DiagnosticCodes.ReadModelSubjectNotSupported, DiagnosticCodes.InvalidSubjectModifierOrder, DiagnosticCodes.UnsupportedInteractionAlternatives, DiagnosticCodes.MixedInteractionAlternatives, DiagnosticCodes.InteractionAlternativeWithoutActions, DiagnosticCodes.InlineInteractionAlternative, DiagnosticCodes.LegacyInteractionWhere, DiagnosticCodes.InvalidSpecificationParameter, DiagnosticCodes.InvalidSpecificationCase, DiagnosticCodes.DuplicateSpecificationParameter, DiagnosticCodes.DuplicateSpecificationCase, DiagnosticCodes.IncompleteSpecificationTable, DiagnosticCodes.InvalidSpecificationCaseAssignment, DiagnosticCodes.InvalidSpecificationCaseValue, DiagnosticCodes.InvalidSpecificationCaseReference, DiagnosticCodes.OptionalSpecificationParameterTarget, DiagnosticCodes.SpecificationCaseNameCollision, DiagnosticCodes.IncompatibleSpecificationParameterType, DiagnosticCodes.UnusedSpecificationParameter, DiagnosticCodes.SingularSpecificationTableExpansion, DiagnosticCodes.InvalidSpecificationCallerPersona, DiagnosticCodes.UnsynthesizablePersonaCaller, DiagnosticCodes.PersonaWithoutGate, DiagnosticCodes.GateWithoutPersona, DiagnosticCodes.AmbiguousPersonaCaller, DiagnosticCodes.InvalidDocumentation, DiagnosticCodes.ConflictingDocumentationAcrossFiles, DiagnosticCodes.InvalidAbsentReadModelStep, DiagnosticCodes.UnknownConstraintProperty, DiagnosticCodes.OmittedProductionDestination, DiagnosticCodes.InvalidSpecificationExample, DiagnosticCodes.DuplicateSpecificationAssignment]);\n const complianceCodes = new Set<string>([DiagnosticCodes.InvalidPurposeDeclaration, DiagnosticCodes.InvalidPurposeVocabulary, DiagnosticCodes.DuplicatePurposeField, DiagnosticCodes.DuplicatePurposeDeclaration, DiagnosticCodes.UnknownPurpose, DiagnosticCodes.PurposeInterestMismatch, DiagnosticCodes.PersonalDataWithoutPurpose, DiagnosticCodes.SpecialDataWithoutCondition, DiagnosticCodes.CriminalDataWithoutAuthorization, DiagnosticCodes.PurposeWithoutBasis, DiagnosticCodes.UnusedPurpose, DiagnosticCodes.UnknownConceptDirective, DiagnosticCodes.AttributeReasonWithoutAttribute, DiagnosticCodes.DuplicateAttributeReason, DiagnosticCodes.LegacyComplianceMarker, DiagnosticCodes.UnknownComplianceMarker, DiagnosticCodes.InvalidSecretScope, DiagnosticCodes.DuplicateSecretScope, DiagnosticCodes.SecretScopeIgnoredForPii, DiagnosticCodes.InvalidPersonalDataQualifier, DiagnosticCodes.DuplicateSpecialCategory]);\n const compilerUnknownEventLines = new Set<number>();\n for (const diagnostic of context.compilerDiagnostics ?? analysis.diagnostics) {\n const identityType = diagnostic.code === DiagnosticCodes.UnknownType && (analysis.identityDetails ?? []).some(detail => detail.line === diagnostic.location.line - 1);\n const identityDuplicate = diagnostic.code === DiagnosticCodes.RepeatedSingularDeclarationAcrossFiles && diagnostic.message.includes('identity block');\n if (!identityType && !identityDuplicate && !complianceCodes.has(diagnostic.code) && !optionalCodes.has(diagnostic.code) && !policyCodes.has(diagnostic.code) && !consistencyCodes.has(diagnostic.code) && !timelineCodes.has(diagnostic.code) && !dependencyCodes.has(diagnostic.code) && !authoringCodes.has(diagnostic.code) && diagnostic.code !== DiagnosticCodes.InvalidSpecificationExampleBody && diagnostic.code !== DiagnosticCodes.UnknownRuleImplementationDirective && diagnostic.code !== DiagnosticCodes.InvalidValidationRule && diagnostic.code !== DiagnosticCodes.RepeatedDeclarationAcrossFiles && !/^PLAY049[0-9]$|^PLAY050[0-7]$|^PLAY054[7-9]$|^PLAY055[01]$|^PLAY048[2-9]$|^PLAY004[56]$|^PLAY053[0-9]$|^PLAY054[0-6]$|^PLAY034[1-8]$|^PLAY0557$|^PLAY060[7-9]$|^PLAY061[0-9]$|^PLAY0620$|^PLAY063[3-9]$|^PLAY064[0-9]$|^PLAY065[0-2]$/.test(diagnostic.code)) continue;\n const line = diagnostic.location.line - 1;\n if (diagnostic.code === DiagnosticCodes.OmittedProductionDestination && issues.some(existing => existing.code === diagnostic.code && existing.line === line)) continue;\n if (diagnostic.code === DiagnosticCodes.UnknownEvent) {\n if (compilerUnknownEventLines.has(line)) continue;\n compilerUnknownEventLines.add(line);\n }\n const length = legacyOptionalTypeLength(lines[line], diagnostic) || lines[line].length - diagnostic.location.column + 1;\n issues.push(issue(diagnostic.severity, line, diagnostic.location.column, length, diagnostic.message, diagnostic.code as DiagnosticCode));\n }\n\n const checkEvent = (line: number, text: string, name: string) => {\n if (!events.has(name) && !compilerUnknownEventLines.has(line)) {\n issues.push(\n tokenIssue(\n 'warning',\n line,\n text,\n name,\n `Unknown event type '${name}' — declare it in a slice or import it.`,\n diagnosticCodes.unknownEvent,\n ),\n );\n }\n };\n\n let authorizeIndent = -1;\n\n for (let index = 0; index < lines.length; index++) {\n const line = lines[index];\n const trimmed = line.trim();\n\n if (fences[index] || trimmed.length === 0) continue;\n\n const leading = line.match(/^[ ]*(\\t+)/);\n if (leading) {\n issues.push(\n issue(\n 'warning',\n index,\n leading[0].length - leading[1].length + 1,\n leading[1].length,\n 'Screenplay is indentation-based — use spaces, not tabs.',\n diagnosticCodes.tabIndentation,\n ),\n );\n }\n\n // Policy references continue on indented lines below an authorize clause.\n if (authorizeIndent >= 0) {\n if (\n indentOf(line) > authorizeIndent &&\n /^(?:or\\s+)?[A-Z]\\w*(?:\\s+or\\s+[A-Z]\\w*)*$/.test(trimmed)\n ) {\n for (const name of trimmed.split(/\\s+/).filter((token) => token !== 'or')) {\n if (!policies.has(name)) {\n issues.push(\n tokenIssue(\n 'warning',\n index,\n line,\n name,\n `Unknown policy '${name}' — declare it with 'policy ${name}'.`,\n diagnosticCodes.unknownPolicy,\n ),\n );\n }\n }\n continue;\n }\n authorizeIndent = -1;\n }\n\n const fileImportIssue = validateImport(lines, fences, index);\n if (fileImportIssue) issues.push(fileImportIssue);\n\n const slice = trimmed.match(/^slice\\s+(\\w+)/);\n if (slice && !sliceTypes.includes(slice[1])) {\n issues.push(\n tokenIssue(\n 'error',\n index,\n line,\n slice[1],\n `Unknown slice type '${slice[1]}' — expected ${sliceTypes.join(', ')}.`,\n diagnosticCodes.unknownSliceType,\n ),\n );\n }\n\n const concept = trimmed.match(/^concept\\s+\\w+\\s*:\\s*(\\w+)/);\n if (concept && concept[1] !== 'Enum' && !primitiveTypes.includes(concept[1])) {\n issues.push(\n tokenIssue(\n 'error',\n index,\n line,\n concept[1],\n `Unknown primitive type '${concept[1]}' — expected ${primitiveTypes.join(', ')} or Enum.`,\n diagnosticCodes.unknownPrimitiveType,\n ),\n );\n }\n\n const authorize = trimmed.match(/^authorize\\s+(.*)$/);\n if (authorize) {\n authorizeIndent = indentOf(line);\n for (const name of authorize[1].split(/\\s+/).filter((token) => token !== 'or' && token.length > 0)) {\n if (!policies.has(name)) {\n issues.push(\n tokenIssue(\n 'warning',\n index,\n line,\n name,\n `Unknown policy '${name}' — declare it with 'policy ${name}'.`,\n diagnosticCodes.unknownPolicy,\n ),\n );\n }\n }\n }\n\n const reactsOn = trimmed.match(/^on\\s+([A-Z]\\w*)\\s*$/);\n if (reactsOn) checkEvent(index, line, reactsOn[1]);\n\n const produces = trimmed.match(/^produces\\s+([A-Z]\\w*)\\s*$/);\n if (produces && !analysis.operationProductionLines?.has(index)) checkEvent(index, line, produces[1]);\n\n if (/^produces\\s+when\\b/.test(trimmed) && !analysis.operationProductionLines?.has(index)) {\n for (let next = index + 1; next < lines.length; next++) {\n const candidate = lines[next];\n if (fences[next] || candidate.trim().length === 0) continue;\n if (indentOf(candidate) > indentOf(line)) {\n const name = candidate.trim().match(/^([A-Z]\\w*)\\s*$/);\n if (name) checkEvent(next, candidate, name[1]);\n }\n break;\n }\n }\n\n const uniqueEvent = trimmed.match(/^unique\\s+event\\s+([A-Z]\\w*)/);\n if (uniqueEvent) checkEvent(index, line, uniqueEvent[1]);\n\n const uniqueProperty = trimmed.match(/^unique\\s+[a-z_]\\w*\\s+on\\s+([A-Z]\\w*)/);\n if (uniqueProperty) checkEvent(index, line, uniqueProperty[1]);\n\n // Every $identity. path must name a member of the caller; anything after 'claims.' is a claim name.\n // A bare $identity is left to the compilers, which see it only where an expression is expected.\n for (const path of line.match(/\\$identity\\.[\\w.]+/g) ?? []) {\n const member = path.substring('$identity.'.length).split('.')[0];\n const knownIdentity = [...identityProperties, ...(analysis.identityDetails ?? []).map(detail => detail.name)];\n if (!knownIdentity.includes(member)) {\n issues.push(tokenIssue('warning', index, line, path,\n `Unknown $identity property '${member}' — expected ${knownIdentity.join(', ')}.`,\n diagnosticCodes.unknownContextIdentityProperty));\n }\n }\n\n // Every $context. path must name something CommandContext or QueryContext carries.\n for (const path of line.match(/\\$context\\.[\\w.]+/g) ?? []) {\n const segments = path.substring('$context.'.length).split('.');\n if (!contextRoots.includes(segments[0])) {\n issues.push(\n tokenIssue(\n 'warning',\n index,\n line,\n path,\n `Unknown $context path '${segments.join('.')}' — expected one of ${contextRoots.join(', ')}.`,\n diagnosticCodes.unknownContextPath,\n ),\n );\n } else if (\n segments[0] === 'causedBy' &&\n segments.length > 1 &&\n !causedByProperties.includes(segments[1])\n ) {\n issues.push(\n tokenIssue(\n 'warning',\n index,\n line,\n path,\n `Unknown $context.causedBy property '${segments[1]}' — expected ${causedByProperties.join(', ')}.`,\n diagnosticCodes.unknownContextCausedByProperty,\n ),\n );\n } else if (\n segments[0] === 'identity' &&\n segments.length > 1 &&\n !identityProperties.includes(segments[1])\n ) {\n issues.push(\n tokenIssue(\n 'warning',\n index,\n line,\n path,\n `Unknown $context.identity property '${segments[1]}' — expected ${identityProperties.join(', ')}.`,\n diagnosticCodes.unknownContextIdentityProperty,\n ),\n );\n }\n }\n }\n\n issues.push(...validateEventContextPaths(lines, fences));\n issues.push(...validateInlineEvents(lines, symbols, application, analysis.operationProductionLines));\n\n const fenceLines = lines\n .map((line, index) => ({ line, index }))\n .filter(({ line }) => /^\\s*```(?:[a-z]+)?\\s*$/.test(line));\n if (fenceLines.length % 2 === 1) {\n const last = fenceLines[fenceLines.length - 1];\n issues.push(\n issue(\n 'error',\n last.index,\n 1,\n last.line.length + 1,\n 'Unclosed inline code block — expected a closing ``` line.',\n diagnosticCodes.unclosedCodeBlock,\n ),\n );\n }\n\n return issues;\n}\n\n// This is advice, not a semantic default: accepting the typed workspace repair changes routing.\nfunction validateProductionDestinations(lines: string[], symbols: DocumentSymbols): ValidationIssue[] {\n const issues: ValidationIssue[] = [];\n lines = eventAnalysisSource(lines);\n for (const command of symbols.commands) {\n const identifiers = command.properties.filter(property => property.isIdentifier && !propertyTypeReference(property).isOptional && !propertyTypeReference(property).isCollection);\n if (identifiers.length !== 1) continue;\n for (const production of command.produces ?? []) {\n if (production.inline || production.conditional || production.target !== undefined) continue;\n const line = production.line;\n issues.push(issue('information', line, indentOf(lines[line]) + 1, lines[line].trim().length,\n `Plain 'produces ${production.name}' omits its destination — use 'for ${identifiers[0].name}' to explicitly select the command's identifier.`,\n diagnosticCodes.omittedProductionDestination));\n }\n }\n return issues;\n}\n\n// Inside a module or feature an import names files, and a quoted import anywhere has the compiler's shape.\nfunction validateImport(lines: string[], fences: boolean[], index: number): ValidationIssue | undefined {\n const line = lines[index];\n const trimmed = line.trim().replace(/\\s*\\/\\/.*$/, '');\n if (!/^import\\b/.test(trimmed) || fileImportOn(line, index)) return undefined;\n const indent = indentOf(line);\n const inBody = indent > 0 && ['module', 'feature'].includes(enclosingChain(lines, fences, index, indent)[0]);\n if (!inBody && !isFileImportLine(line)) return undefined;\n return issue(\n 'error',\n index,\n indent + 1,\n trimmed.length,\n `Invalid import '${trimmed}' — inside a module or feature, import names files: 'import \"<path or glob>\"'.`,\n diagnosticCodes.invalidFileImport,\n );\n}\n\n// A mapping target: the first word of a mapping line, after the keyword that opens it if there is one.\nconst mappingTarget = /^(?:(?:increment|decrement|count|clear|add|subtract|set)\\s+)?@?([$\\w.]+)(?=\\s|=|$)/;\n\n// Every $eventContext.<path> - in an expression or as the dynamic key of a mapping target - checked against the\n// event-context catalog the way the compiler checks it (Parsing/EventContextPathValidator.cs).\nexport function validateEventContextPaths(lines: string[], fences: boolean[]): ValidationIssue[] {\n const issues: ValidationIssue[] = [];\n const names = (members: readonly { name: string }[]) => members.map((member) => member.name).join(', ');\n\n for (let index = 0; index < lines.length; index++) {\n const line = lines[index];\n if (fences[index]) continue;\n\n for (const match of line.matchAll(/(\\.)?\\$eventContext((?:\\.(?:\\w+(?:\\(\\))?)?)*)/g)) {\n const token = match[0].substring(match[1]?.length ?? 0);\n const written = match[2];\n if (written.length === 0) {\n // A bare $eventContext names nothing only as a dynamic key; in an expression the compiler rejects it as invalid.\n if (match[1]) {\n issues.push(issue('error', index, (match.index ?? 0) + 2, token.length, `'$eventContext' names no member - expected one of ${names(resolveEventContextPath('').expected)}.`, diagnosticCodes.missingEventContextPath));\n }\n continue;\n }\n\n const path = written.substring(1);\n const resolution = resolveEventContextPath(path);\n const column = (match.index ?? 0) + (match[1]?.length ?? 0) + 1;\n switch (resolution.status) {\n case 'missing':\n issues.push(issue('error', index, column, token.length, `'$eventContext.${path}' names no member - expected one of ${names(resolution.expected)}.`, diagnosticCodes.missingEventContextPath));\n break;\n case 'unknownMember':\n issues.push(issue('warning', index, column, token.length, `Unknown event context member '${resolution.segment}' in '$eventContext.${path}' - expected one of ${names(resolution.expected)}.`, diagnosticCodes.unknownEventContextMember));\n break;\n case 'unknownSubPath': {\n const has = resolution.expected.length === 0 ? 'no members to address' : `members ${names(resolution.expected)}`;\n issues.push(issue('warning', index, column, token.length, `Unknown event context path '$eventContext.${path}' - '${resolution.member?.name}' (${resolution.member?.type}) has ${has}.`, diagnosticCodes.unknownEventContextPath));\n break;\n }\n case 'belowCollection':\n issues.push(issue('error', index, column, token.length, `'$eventContext.${path}' cannot resolve - '${resolution.member?.name}' is a collection (${resolution.member?.type}) and cannot be addressed below.`, diagnosticCodes.eventContextPathBelowCollection));\n break;\n }\n }\n\n // Only $eventContext resolves in a dynamic key; any other $ source is kept as the literal key text.\n const target = line.trim().match(mappingTarget)?.[1];\n const source = target?.match(/\\.\\$(\\w+)/)?.[1];\n if (target && source && source !== 'eventContext') {\n issues.push(tokenIssue('warning', index, line, target, `Dynamic dictionary key '$${source}' in '${target}' is never resolved - only '$eventContext.<path>' is, so the literal text '$${source}' becomes the key.`, diagnosticCodes.unresolvedDynamicKeySource));\n }\n }\n\n return issues;\n}\n"],"mappings":"88BAgDA,SAAS,MACL,EACA,EACA,EACA,EACA,EACA,EACe,CACf,MAAO,CAAE,WAAU,UAAS,OAAM,cAAa,UAAWA,EAAcC,EAAQ,MAAK,CACzF,CAEA,SAAS,WACL,EACA,EACA,EACA,EACA,EACA,EACe,CA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gB,uBAAuB,CAAC,EAC5L,MACJ,IAAK,gBACDZ,EAAO,KAAK,MAAM,UAAWyD,EAAOmC,EAAQ/F,EAAM,OAAQ,iCAAiC8F,EAAW,QAAQ,sBAAsBpB,EAAK,sBAAsB,MAAMoB,EAAW,QAAQ,EAAE,GAAI/E,EAAgB,yBAAyB,CAAC,EACxO,MACJ,IAAK,iBAAkB,CACnB,IAAMiF,EAAMF,EAAW,SAAS,SAAW,EAAI,wBAA0B,WAAW,MAAMA,EAAW,QAAQ,IAC7G3F,EAAO,KAAK,MAAM,UAAWyD,EAAOmC,EAAQ/F,EAAM,OAAQ,6CAA6C0E,EAAK,OAAOoB,EAAW,QAAQ,KAAK,KAAKA,EAAW,QAAQ,KAAK,QAAQE,EAAI,GAAIjF,EAAgB,uBAAuB,CAAC,EAChO,KACJ,CACA,IAAK,kBACDZ,EAAO,KAAK,MAAM,QAASyD,EAAOmC,EAAQ/F,EAAM,OAAQ,kBAAkB0E,EAAK,sBAAsBoB,EAAW,QAAQ,KAAK,qBAAqBA,EAAW,QAAQ,KAAK,kCAAmC/E,EAAgB,+BAA+B,CAAC,CAErQ,CACJ,CAGA,IAAMkF,EAASnG,EAAK,KAAK,CAAC,CAAC,MAAM2F,CAAa,CAAC,GAAG,GAC5CtD,EAAS8D,GAAQ,MAAM,WAAW,CAAC,GAAG,GACxCA,GAAU9D,GAAUA,IAAW,gBAC/BhC,EAAO,KAAK,WAAW,UAAWyD,EAAO9D,EAAMmG,EAAQ,4BAA4B9D,EAAO,QAAQ8D,EAAO,8EAA8E9D,EAAO,oBAAqBpB,EAAgB,0BAA0B,CAAC,CAEtQ,CAEA,OAAOZ,CACX"}
1
+ {"version":3,"file":"validation.js","names":["startColumn","length","severity","line","text","token","message","code","issues","types","knownTypeNames","symbols","primitiveTypes","application","property","properties","propertyTypeReference","candidate","bare","owner","diagnosticCodes","type","event","query","command","identifiers","extra","lines","declared","declaration","fences","fenceMap","scanned","scanDocument","context","mergeSymbols","input","symbolsForBuffer","analysis","responseAnalysis","source","routeLines","route","production","events","knownEventNames","policies","policy","optionalCodes","DiagnosticCodes","policyCodes","consistencyCodes","timelineCodes","dependencyCodes","authoringCodes","complianceCodes","compilerUnknownEventLines","diagnostic","identityType","detail","identityDuplicate","existing","legacyOptionalTypeLength","name","authorizeIndent","index","trimmed","leading","indentOf","fileImportIssue","slice","sliceTypes","concept","authorize","reactsOn","produces","next","uniqueEvent","uniqueProperty","path","member","knownIdentity","identityProperties","segments","contextRoots","causedByProperties","validateInlineEvents","fenceLines","last","eventAnalysisSource","fileImportOn","indent","enclosingChain","isFileImportLine","mappingTarget","members","match","written","resolveEventContextPath","resolution","column","has","target"],"sources":["../../validation.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes, legacyOptionalTypeLength } from '@cratis/screenplay-compiler';\nimport { AnalysisDiagnostic, responseAnalysis } from './response-analysis';\nimport { validateInlineEvents } from './inline-event-validation';\nimport { causedByProperties, contextRoots, identityProperties, primitiveTypes, sliceTypes } from './language';\nimport { DiagnosticCode, diagnosticCodes } from './diagnostic-codes';\nimport { enclosingChain, fenceMap, indentOf } from './document-context';\nimport { eventAnalysisSource } from './event-analysis-source';\nimport { resolveEventContextPath } from './event-context';\nimport {\n DocumentSymbols,\n PropertySymbol,\n propertyTypeReference,\n knownEventNames,\n knownTypeNames,\n mergeSymbols,\n scanDocument,\n symbolsForBuffer,\n} from './symbols';\nimport { fileImportOn, isFileImportLine } from './file-imports';\n\nexport type ValidationSeverity = 'error' | 'warning' | 'information';\n\nexport interface ValidationIssue {\n line: number;\n startColumn: number;\n endColumn: number;\n message: string;\n severity: ValidationSeverity;\n\n // The compiler code for this condition, absent on the structural checks the editor makes and the\n // compiler does not. See ./diagnostic-codes.ts.\n code?: DiagnosticCode;\n}\n\n// What a document is validated against beyond itself.\nexport interface ValidationContext {\n // What the rest of the application declares - the other .play files of a folder, or the files an import\n // brings in - so a name declared in another file is not reported unknown. Merge the scanned symbols of\n // those files with mergeSymbols. The document's own declarations are always known.\n application?: DocumentSymbols;\n placement?: readonly string[];\n path?: string;\n compilerDiagnostics?: readonly AnalysisDiagnostic[];\n}\n\nfunction issue(\n severity: ValidationSeverity,\n line: number,\n startColumn: number,\n length: number,\n message: string,\n code: DiagnosticCode,\n): ValidationIssue {\n return { severity, message, line, startColumn, endColumn: startColumn + length, code };\n}\n\nfunction tokenIssue(\n severity: ValidationSeverity,\n line: number,\n text: string,\n token: string,\n message: string,\n code: DiagnosticCode,\n): ValidationIssue {\n const column = text.indexOf(token) + 1;\n return issue(severity, line, column, token.length, message, code);\n}\n\n// Reports every property whose type reference names nothing the document declares, and\n// every command that marks more than one property as its identifier.\nfunction validateDeclarations(lines: string[], symbols: DocumentSymbols, application: DocumentSymbols): ValidationIssue[] {\n const issues: ValidationIssue[] = [];\n const types = new Set([...knownTypeNames(symbols, primitiveTypes), ...knownTypeNames(application, [])]);\n\n const checkProperties = (properties: PropertySymbol[], owner: string) => {\n for (const property of properties.filter(\n (candidate) => !types.has(propertyTypeReference(candidate).name),\n )) {\n const bare = propertyTypeReference(property).name;\n issues.push(\n issue(\n 'warning',\n property.line,\n property.sourceType!.startColumn,\n property.sourceType!.text.length,\n bare === 'optional'\n ? `Unknown type 'optional' on '${property.name}' of ${owner} — did you forget the type before 'optional'?`\n : `Unknown type '${bare}' on '${property.name}' of ${owner} — declare it with 'concept ${bare} : <Primitive>' or 'type ${bare}'.`,\n diagnosticCodes.unknownType,\n ),\n );\n }\n };\n\n for (const type of symbols.types) checkProperties(type.properties, `type '${type.name}'`);\n for (const event of symbols.events) checkProperties(event.properties, `event '${event.name}'`);\n for (const query of symbols.queries) checkProperties(query.parameters, `query '${query.name}'`);\n for (const command of symbols.commands) {\n checkProperties(command.properties, `command '${command.name}'`);\n const identifiers = command.properties.filter((property) => property.isIdentifier);\n for (const extra of identifiers.slice(1)) {\n issues.push(\n tokenIssue(\n 'error',\n extra.line,\n lines[extra.line],\n 'identifier',\n `Command '${command.name}' already marks '${identifiers[0].name}' as identifier — only one property can be the identifier.`,\n diagnosticCodes.duplicateCommandIdentifier,\n ),\n );\n }\n }\n\n const declared = new Map<string, number>();\n for (const declaration of [...symbols.concepts, ...symbols.types]) {\n const first = declared.get(declaration.name);\n if (first === undefined) {\n declared.set(declaration.name, declaration.line);\n continue;\n }\n issues.push(\n tokenIssue(\n 'error',\n declaration.line,\n lines[declaration.line],\n declaration.name,\n `Duplicate declaration of '${declaration.name}' — concept and type names must be unique.`,\n diagnosticCodes.duplicateDeclaration,\n ),\n );\n }\n\n return issues;\n}\n\n// Validates a Screenplay document without any editor dependency — both the Monaco\n// service and the VSCode extension adapt these issues to their marker/diagnostic APIs.\n//\n// The checks read the document line by line, never as a whole document's top level, so a file an import\n// places in a module or feature - holding slices or features at its top level - validates as it is written.\n// Where it is placed, and whether its imports resolve, is the compiler's to say.\nexport function validateLines(lines: string[], context: ValidationContext = {}): ValidationIssue[] {\n const fences = fenceMap(lines);\n const scanned = scanDocument(lines);\n const application = context.application ?? mergeSymbols();\n const input = symbolsForBuffer(lines, { ...application, authoringPath: context.path ?? application.authoringPath, authoringPlacement: context.placement ?? application.authoringPlacement });\n const analysis = responseAnalysis(lines, input.authoringDocuments ?? input.authoringSources?.filter(source => source !== lines.join('\\n')), input.authoringPlacement, input.authoringPath, input.authoringPlacementResolved);\n const routeLines = new Set(analysis.eventSources.routes.map(route => route.location.line - 1));\n const symbols = { ...scanned, commands: scanned.commands.map(command => ({ ...command,\n properties: command.properties.filter(property => !routeLines.has(property.line)),\n produces: command.produces?.filter(production => !analysis.operationProductionLines?.has(production.line)),\n productionHeaders: command.productionHeaders?.filter(line => !analysis.operationProductionLines?.has(line)),\n })) };\n const events = new Set([...knownEventNames(symbols), ...knownEventNames(application)]);\n const policies = new Set([...symbols.policies, ...application.policies].map((policy) => policy.name));\n const issues: ValidationIssue[] = validateDeclarations(lines, symbols, application);\n issues.push(...validateProductionDestinations(lines, symbols));\n // One parser pass covers committed types, including query results and trigger data, without\n // speculative property scans mistaking tags, paths, strings or code for optionality.\n const optionalCodes = new Set<string>([DiagnosticCodes.LegacyOptionalSuffix, DiagnosticCodes.InvalidOptionalModifierOrder, DiagnosticCodes.OptionalReadsNotSupported]);\n const policyCodes = new Set<string>([DiagnosticCodes.UnexpectedTokenInPolicyCondition, DiagnosticCodes.ExpectedPolicyCondition, DiagnosticCodes.UnclosedPolicyConditionGroup, DiagnosticCodes.ExpectedRoleName, DiagnosticCodes.ExpectedClaimName, DiagnosticCodes.ExpectedClaimMatches, DiagnosticCodes.ExpectedClaimMatchTarget]);\n const consistencyCodes = new Set<string>([DiagnosticCodes.UnknownEvent, DiagnosticCodes.UnknownReadModelProperty, DiagnosticCodes.PiiNotSupportedOnIdentifier]);\n const timelineCodes = new Set<string>([DiagnosticCodes.EventFromLaterSlice, DiagnosticCodes.TimelineCycleGroup]);\n const dependencyCodes = new Set<string>([DiagnosticCodes.UndeclaredDependency, DiagnosticCodes.UnusedDependencyDeclaration, DiagnosticCodes.InvalidDependencyTarget, DiagnosticCodes.RepeatedDependencyDeclaration, DiagnosticCodes.MutualDependencyDeclarations, DiagnosticCodes.AmbiguousReference]);\n // These parser diagnostics must reach the marker adapter. C#-only completeness and reference\n // checks are not synthesized here, but are preserved when a caller supplies compiler diagnostics.\n const authoringCodes = new Set<string>([DiagnosticCodes.InvalidEventDeclaration, DiagnosticCodes.InvalidImportDeclaration, DiagnosticCodes.InvalidSliceDeclaration, DiagnosticCodes.InvalidDescription, DiagnosticCodes.DuplicateDescription, DiagnosticCodes.EmptyDescription,DiagnosticCodes.DuplicateEventSubject, DiagnosticCodes.InvalidSubjectType, DiagnosticCodes.ProtectedSubjectType, DiagnosticCodes.InvalidSubjectOwner, DiagnosticCodes.ReadModelSubjectNotSupported, DiagnosticCodes.InvalidSubjectModifierOrder, DiagnosticCodes.UnsupportedInteractionAlternatives, DiagnosticCodes.MixedInteractionAlternatives, DiagnosticCodes.InteractionAlternativeWithoutActions, DiagnosticCodes.InlineInteractionAlternative, DiagnosticCodes.LegacyInteractionWhere, DiagnosticCodes.InvalidSpecificationParameter, DiagnosticCodes.InvalidSpecificationCase, DiagnosticCodes.DuplicateSpecificationParameter, DiagnosticCodes.DuplicateSpecificationCase, DiagnosticCodes.IncompleteSpecificationTable, DiagnosticCodes.InvalidSpecificationCaseAssignment, DiagnosticCodes.InvalidSpecificationCaseValue, DiagnosticCodes.InvalidSpecificationCaseReference, DiagnosticCodes.OptionalSpecificationParameterTarget, DiagnosticCodes.SpecificationCaseNameCollision, DiagnosticCodes.IncompatibleSpecificationParameterType, DiagnosticCodes.UnusedSpecificationParameter, DiagnosticCodes.SingularSpecificationTableExpansion, DiagnosticCodes.InvalidSpecificationCallerPersona, DiagnosticCodes.UnsynthesizablePersonaCaller, DiagnosticCodes.PersonaWithoutGate, DiagnosticCodes.GateWithoutPersona, DiagnosticCodes.AmbiguousPersonaCaller, DiagnosticCodes.InvalidDocumentation, DiagnosticCodes.ConflictingDocumentationAcrossFiles, DiagnosticCodes.InvalidAbsentReadModelStep, DiagnosticCodes.UnknownConstraintProperty, DiagnosticCodes.OmittedProductionDestination, DiagnosticCodes.InvalidSpecificationExample, DiagnosticCodes.DuplicateSpecificationAssignment]);\n const complianceCodes = new Set<string>([DiagnosticCodes.InvalidPurposeDeclaration, DiagnosticCodes.InvalidPurposeVocabulary, DiagnosticCodes.DuplicatePurposeField, DiagnosticCodes.DuplicatePurposeDeclaration, DiagnosticCodes.UnknownPurpose, DiagnosticCodes.PurposeInterestMismatch, DiagnosticCodes.PersonalDataWithoutPurpose, DiagnosticCodes.SpecialDataWithoutCondition, DiagnosticCodes.CriminalDataWithoutAuthorization, DiagnosticCodes.PurposeWithoutBasis, DiagnosticCodes.UnusedPurpose, DiagnosticCodes.UnknownConceptDirective, DiagnosticCodes.AttributeReasonWithoutAttribute, DiagnosticCodes.DuplicateAttributeReason, DiagnosticCodes.LegacyComplianceMarker, DiagnosticCodes.DuplicateComplianceMarker, DiagnosticCodes.UnknownComplianceMarker, DiagnosticCodes.InvalidSecretScope, DiagnosticCodes.DuplicateSecretScope, DiagnosticCodes.SecretScopeIgnoredForPii, DiagnosticCodes.InvalidPersonalDataQualifier, DiagnosticCodes.DuplicateSpecialCategory]);\n const compilerUnknownEventLines = new Set<number>();\n for (const diagnostic of context.compilerDiagnostics ?? analysis.diagnostics) {\n const identityType = diagnostic.code === DiagnosticCodes.UnknownType && (analysis.identityDetails ?? []).some(detail => detail.line === diagnostic.location.line - 1);\n const identityDuplicate = diagnostic.code === DiagnosticCodes.RepeatedSingularDeclarationAcrossFiles && diagnostic.message.includes('identity block');\n if (!identityType && !identityDuplicate && !complianceCodes.has(diagnostic.code) && !optionalCodes.has(diagnostic.code) && !policyCodes.has(diagnostic.code) && !consistencyCodes.has(diagnostic.code) && !timelineCodes.has(diagnostic.code) && !dependencyCodes.has(diagnostic.code) && !authoringCodes.has(diagnostic.code) && diagnostic.code !== DiagnosticCodes.InvalidSpecificationExampleBody && diagnostic.code !== DiagnosticCodes.UnknownRuleImplementationDirective && diagnostic.code !== DiagnosticCodes.InvalidValidationRule && diagnostic.code !== DiagnosticCodes.RepeatedDeclarationAcrossFiles && !/^PLAY049[0-9]$|^PLAY050[0-7]$|^PLAY054[7-9]$|^PLAY055[01]$|^PLAY048[2-9]$|^PLAY004[56]$|^PLAY053[0-9]$|^PLAY054[0-6]$|^PLAY034[1-8]$|^PLAY0557$|^PLAY060[7-9]$|^PLAY061[0-9]$|^PLAY0620$|^PLAY063[3-9]$|^PLAY064[0-9]$|^PLAY065[0-2]$/.test(diagnostic.code)) continue;\n const line = diagnostic.location.line - 1;\n if (diagnostic.code === DiagnosticCodes.OmittedProductionDestination && issues.some(existing => existing.code === diagnostic.code && existing.line === line)) continue;\n if (diagnostic.code === DiagnosticCodes.UnknownEvent) {\n if (compilerUnknownEventLines.has(line)) continue;\n compilerUnknownEventLines.add(line);\n }\n const length = legacyOptionalTypeLength(lines[line], diagnostic) || lines[line].length - diagnostic.location.column + 1;\n issues.push(issue(diagnostic.severity, line, diagnostic.location.column, length, diagnostic.message, diagnostic.code as DiagnosticCode));\n }\n\n const checkEvent = (line: number, text: string, name: string) => {\n if (!events.has(name) && !compilerUnknownEventLines.has(line)) {\n issues.push(\n tokenIssue(\n 'warning',\n line,\n text,\n name,\n `Unknown event type '${name}' — declare it in a slice or import it.`,\n diagnosticCodes.unknownEvent,\n ),\n );\n }\n };\n\n let authorizeIndent = -1;\n\n for (let index = 0; index < lines.length; index++) {\n const line = lines[index];\n const trimmed = line.trim();\n\n if (fences[index] || trimmed.length === 0) continue;\n\n const leading = line.match(/^[ ]*(\\t+)/);\n if (leading) {\n issues.push(\n issue(\n 'warning',\n index,\n leading[0].length - leading[1].length + 1,\n leading[1].length,\n 'Screenplay is indentation-based — use spaces, not tabs.',\n diagnosticCodes.tabIndentation,\n ),\n );\n }\n\n // Policy references continue on indented lines below an authorize clause.\n if (authorizeIndent >= 0) {\n if (\n indentOf(line) > authorizeIndent &&\n /^(?:or\\s+)?[A-Z]\\w*(?:\\s+or\\s+[A-Z]\\w*)*$/.test(trimmed)\n ) {\n for (const name of trimmed.split(/\\s+/).filter((token) => token !== 'or')) {\n if (!policies.has(name)) {\n issues.push(\n tokenIssue(\n 'warning',\n index,\n line,\n name,\n `Unknown policy '${name}' — declare it with 'policy ${name}'.`,\n diagnosticCodes.unknownPolicy,\n ),\n );\n }\n }\n continue;\n }\n authorizeIndent = -1;\n }\n\n const fileImportIssue = validateImport(lines, fences, index);\n if (fileImportIssue) issues.push(fileImportIssue);\n\n const slice = trimmed.match(/^slice\\s+(\\w+)/);\n if (slice && !sliceTypes.includes(slice[1])) {\n issues.push(\n tokenIssue(\n 'error',\n index,\n line,\n slice[1],\n `Unknown slice type '${slice[1]}' — expected ${sliceTypes.join(', ')}.`,\n diagnosticCodes.unknownSliceType,\n ),\n );\n }\n\n const concept = trimmed.match(/^concept\\s+\\w+\\s*:\\s*(\\w+)/);\n if (concept && concept[1] !== 'Enum' && !primitiveTypes.includes(concept[1])) {\n issues.push(\n tokenIssue(\n 'error',\n index,\n line,\n concept[1],\n `Unknown primitive type '${concept[1]}' — expected ${primitiveTypes.join(', ')} or Enum.`,\n diagnosticCodes.unknownPrimitiveType,\n ),\n );\n }\n\n const authorize = trimmed.match(/^authorize\\s+(.*)$/);\n if (authorize) {\n authorizeIndent = indentOf(line);\n for (const name of authorize[1].split(/\\s+/).filter((token) => token !== 'or' && token.length > 0)) {\n if (!policies.has(name)) {\n issues.push(\n tokenIssue(\n 'warning',\n index,\n line,\n name,\n `Unknown policy '${name}' — declare it with 'policy ${name}'.`,\n diagnosticCodes.unknownPolicy,\n ),\n );\n }\n }\n }\n\n const reactsOn = trimmed.match(/^on\\s+([A-Z]\\w*)\\s*$/);\n if (reactsOn) checkEvent(index, line, reactsOn[1]);\n\n const produces = trimmed.match(/^produces\\s+([A-Z]\\w*)\\s*$/);\n if (produces && !analysis.operationProductionLines?.has(index)) checkEvent(index, line, produces[1]);\n\n if (/^produces\\s+when\\b/.test(trimmed) && !analysis.operationProductionLines?.has(index)) {\n for (let next = index + 1; next < lines.length; next++) {\n const candidate = lines[next];\n if (fences[next] || candidate.trim().length === 0) continue;\n if (indentOf(candidate) > indentOf(line)) {\n const name = candidate.trim().match(/^([A-Z]\\w*)\\s*$/);\n if (name) checkEvent(next, candidate, name[1]);\n }\n break;\n }\n }\n\n const uniqueEvent = trimmed.match(/^unique\\s+event\\s+([A-Z]\\w*)/);\n if (uniqueEvent) checkEvent(index, line, uniqueEvent[1]);\n\n const uniqueProperty = trimmed.match(/^unique\\s+[a-z_]\\w*\\s+on\\s+([A-Z]\\w*)/);\n if (uniqueProperty) checkEvent(index, line, uniqueProperty[1]);\n\n // Every $identity. path must name a member of the caller; anything after 'claims.' is a claim name.\n // A bare $identity is left to the compilers, which see it only where an expression is expected.\n for (const path of line.match(/\\$identity\\.[\\w.]+/g) ?? []) {\n const member = path.substring('$identity.'.length).split('.')[0];\n const knownIdentity = [...identityProperties, ...(analysis.identityDetails ?? []).map(detail => detail.name)];\n if (!knownIdentity.includes(member)) {\n issues.push(tokenIssue('warning', index, line, path,\n `Unknown $identity property '${member}' — expected ${knownIdentity.join(', ')}.`,\n diagnosticCodes.unknownContextIdentityProperty));\n }\n }\n\n // Every $context. path must name something CommandContext or QueryContext carries.\n for (const path of line.match(/\\$context\\.[\\w.]+/g) ?? []) {\n const segments = path.substring('$context.'.length).split('.');\n if (!contextRoots.includes(segments[0])) {\n issues.push(\n tokenIssue(\n 'warning',\n index,\n line,\n path,\n `Unknown $context path '${segments.join('.')}' — expected one of ${contextRoots.join(', ')}.`,\n diagnosticCodes.unknownContextPath,\n ),\n );\n } else if (\n segments[0] === 'causedBy' &&\n segments.length > 1 &&\n !causedByProperties.includes(segments[1])\n ) {\n issues.push(\n tokenIssue(\n 'warning',\n index,\n line,\n path,\n `Unknown $context.causedBy property '${segments[1]}' — expected ${causedByProperties.join(', ')}.`,\n diagnosticCodes.unknownContextCausedByProperty,\n ),\n );\n } else if (\n segments[0] === 'identity' &&\n segments.length > 1 &&\n !identityProperties.includes(segments[1])\n ) {\n issues.push(\n tokenIssue(\n 'warning',\n index,\n line,\n path,\n `Unknown $context.identity property '${segments[1]}' — expected ${identityProperties.join(', ')}.`,\n diagnosticCodes.unknownContextIdentityProperty,\n ),\n );\n }\n }\n }\n\n issues.push(...validateEventContextPaths(lines, fences));\n issues.push(...validateInlineEvents(lines, symbols, application, analysis.operationProductionLines));\n\n const fenceLines = lines\n .map((line, index) => ({ line, index }))\n .filter(({ line }) => /^\\s*```(?:[a-z]+)?\\s*$/.test(line));\n if (fenceLines.length % 2 === 1) {\n const last = fenceLines[fenceLines.length - 1];\n issues.push(\n issue(\n 'error',\n last.index,\n 1,\n last.line.length + 1,\n 'Unclosed inline code block — expected a closing ``` line.',\n diagnosticCodes.unclosedCodeBlock,\n ),\n );\n }\n\n return issues;\n}\n\n// This is advice, not a semantic default: accepting the typed workspace repair changes routing.\nfunction validateProductionDestinations(lines: string[], symbols: DocumentSymbols): ValidationIssue[] {\n const issues: ValidationIssue[] = [];\n lines = eventAnalysisSource(lines);\n for (const command of symbols.commands) {\n const identifiers = command.properties.filter(property => property.isIdentifier && !propertyTypeReference(property).isOptional && !propertyTypeReference(property).isCollection);\n if (identifiers.length !== 1) continue;\n for (const production of command.produces ?? []) {\n if (production.inline || production.conditional || production.target !== undefined) continue;\n const line = production.line;\n issues.push(issue('information', line, indentOf(lines[line]) + 1, lines[line].trim().length,\n `Plain 'produces ${production.name}' omits its destination — use 'for ${identifiers[0].name}' to explicitly select the command's identifier.`,\n diagnosticCodes.omittedProductionDestination));\n }\n }\n return issues;\n}\n\n// Inside a module or feature an import names files, and a quoted import anywhere has the compiler's shape.\nfunction validateImport(lines: string[], fences: boolean[], index: number): ValidationIssue | undefined {\n const line = lines[index];\n const trimmed = line.trim().replace(/\\s*\\/\\/.*$/, '');\n if (!/^import\\b/.test(trimmed) || fileImportOn(line, index)) return undefined;\n const indent = indentOf(line);\n const inBody = indent > 0 && ['module', 'feature'].includes(enclosingChain(lines, fences, index, indent)[0]);\n if (!inBody && !isFileImportLine(line)) return undefined;\n return issue(\n 'error',\n index,\n indent + 1,\n trimmed.length,\n `Invalid import '${trimmed}' — inside a module or feature, import names files: 'import \"<path or glob>\"'.`,\n diagnosticCodes.invalidFileImport,\n );\n}\n\n// A mapping target: the first word of a mapping line, after the keyword that opens it if there is one.\nconst mappingTarget = /^(?:(?:increment|decrement|count|clear|add|subtract|set)\\s+)?@?([$\\w.]+)(?=\\s|=|$)/;\n\n// Every $eventContext.<path> - in an expression or as the dynamic key of a mapping target - checked against the\n// event-context catalog the way the compiler checks it (Parsing/EventContextPathValidator.cs).\nexport function validateEventContextPaths(lines: string[], fences: boolean[]): ValidationIssue[] {\n const issues: ValidationIssue[] = [];\n const names = (members: readonly { name: string }[]) => members.map((member) => member.name).join(', ');\n\n for (let index = 0; index < lines.length; index++) {\n const line = lines[index];\n if (fences[index]) continue;\n\n for (const match of line.matchAll(/(\\.)?\\$eventContext((?:\\.(?:\\w+(?:\\(\\))?)?)*)/g)) {\n const token = match[0].substring(match[1]?.length ?? 0);\n const written = match[2];\n if (written.length === 0) {\n // A bare $eventContext names nothing only as a dynamic key; in an expression the compiler rejects it as invalid.\n if (match[1]) {\n issues.push(issue('error', index, (match.index ?? 0) + 2, token.length, `'$eventContext' names no member - expected one of ${names(resolveEventContextPath('').expected)}.`, diagnosticCodes.missingEventContextPath));\n }\n continue;\n }\n\n const path = written.substring(1);\n const resolution = resolveEventContextPath(path);\n const column = (match.index ?? 0) + (match[1]?.length ?? 0) + 1;\n switch (resolution.status) {\n case 'missing':\n issues.push(issue('error', index, column, token.length, `'$eventContext.${path}' names no member - expected one of ${names(resolution.expected)}.`, diagnosticCodes.missingEventContextPath));\n break;\n case 'unknownMember':\n issues.push(issue('warning', index, column, token.length, `Unknown event context member '${resolution.segment}' in '$eventContext.${path}' - expected one of ${names(resolution.expected)}.`, diagnosticCodes.unknownEventContextMember));\n break;\n case 'unknownSubPath': {\n const has = resolution.expected.length === 0 ? 'no members to address' : `members ${names(resolution.expected)}`;\n issues.push(issue('warning', index, column, token.length, `Unknown event context path '$eventContext.${path}' - '${resolution.member?.name}' (${resolution.member?.type}) has ${has}.`, diagnosticCodes.unknownEventContextPath));\n break;\n }\n case 'belowCollection':\n issues.push(issue('error', index, column, token.length, `'$eventContext.${path}' cannot resolve - '${resolution.member?.name}' is a collection (${resolution.member?.type}) and cannot be addressed below.`, diagnosticCodes.eventContextPathBelowCollection));\n break;\n }\n }\n\n // Only $eventContext resolves in a dynamic key; any other $ source is kept as the literal key text.\n const target = line.trim().match(mappingTarget)?.[1];\n const source = target?.match(/\\.\\$(\\w+)/)?.[1];\n if (target && source && source !== 'eventContext') {\n issues.push(tokenIssue('warning', index, line, target, `Dynamic dictionary key '$${source}' in '${target}' is never resolved - only '$eventContext.<path>' is, so the literal text '$${source}' becomes the key.`, diagnosticCodes.unresolv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AC,CAEtQ,CAEA,OAAOZ,CACX"}
@@ -40,6 +40,7 @@ export declare const diagnosticCodes: {
40
40
  readonly unknownConceptDirective: "PLAY0010";
41
41
  readonly attributeReasonWithoutAttribute: "PLAY0012";
42
42
  readonly duplicateAttributeReason: "PLAY0013";
43
+ readonly duplicateComplianceMarker: "PLAY0653";
43
44
  readonly legacyComplianceMarker: "PLAY0565";
44
45
  readonly unknownComplianceMarker: "PLAY0566";
45
46
  readonly invalidSecretScope: "PLAY0567";
@@ -1 +1 @@
1
- {"version":3,"file":"diagnostic-codes.d.ts","sourceRoot":"","sources":["../diagnostic-codes.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8LlB,CAAC;AAEX,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,OAAO,eAAe,CAAC,CAAC"}
1
+ {"version":3,"file":"diagnostic-codes.d.ts","sourceRoot":"","sources":["../diagnostic-codes.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+LlB,CAAC;AAEX,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,OAAO,eAAe,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cratis/screenplay-language",
3
- "version": "4.125.0",
3
+ "version": "4.127.0",
4
4
  "description": "Monaco language service for the Cratis Screenplay DSL — syntax highlighting, IntelliSense, hover and diagnostics for .play files",
5
5
  "keywords": [
6
6
  "cratis",