@cratis/screenplay-language 4.254.0 → 4.256.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 (38) hide show
  1. package/dist/bundles/compiler/Diagnostics/DiagnosticCodes.js +1 -1
  2. package/dist/bundles/compiler/Diagnostics/DiagnosticCodes.js.map +1 -1
  3. package/dist/bundles/compiler/Files/PlayApplicationAssembly.js +1 -1
  4. package/dist/bundles/compiler/Files/PlayApplicationAssembly.js.map +1 -1
  5. package/dist/bundles/compiler/Parsing/CaptureParser.js +1 -1
  6. package/dist/bundles/compiler/Parsing/CommandHandlerValidator.js +1 -1
  7. package/dist/bundles/compiler/Parsing/CommandHandlerValidator.js.map +1 -1
  8. package/dist/bundles/compiler/Parsing/CommandParser.js +1 -1
  9. package/dist/bundles/compiler/Parsing/CommandParser.js.map +1 -1
  10. package/dist/bundles/compiler/Parsing/ImplementationParser.js +2 -2
  11. package/dist/bundles/compiler/Parsing/ImplementationParser.js.map +1 -1
  12. package/dist/bundles/compiler/Parsing/PossibleEventsParser.js +2 -0
  13. package/dist/bundles/compiler/Parsing/PossibleEventsParser.js.map +1 -0
  14. package/dist/bundles/compiler/Parsing/ProducesParser.js +1 -1
  15. package/dist/bundles/compiler/Parsing/ReadModelMemberTypeValidator.js +2 -0
  16. package/dist/bundles/compiler/Parsing/ReadModelMemberTypeValidator.js.map +1 -0
  17. package/dist/bundles/compiler/Parsing/ScreenplayParser.js +1 -1
  18. package/dist/bundles/compiler/Parsing/ScreenplayParser.js.map +1 -1
  19. package/dist/bundles/compiler/Parsing/SliceParser.js +1 -1
  20. package/dist/bundles/compiler/ScreenplayCompiler.js +1 -1
  21. package/dist/bundles/compiler/ScreenplayCompiler.js.map +1 -1
  22. package/dist/bundles/compiler/Syntax/ScreenplaySyntaxWalker.js +1 -1
  23. package/dist/bundles/compiler/Syntax/ScreenplaySyntaxWalker.js.map +1 -1
  24. package/dist/bundles/compiler/Syntax/SyntaxCollections.js +1 -1
  25. package/dist/bundles/compiler/Syntax/SyntaxCollections.js.map +1 -1
  26. package/dist/bundles/compiler/Syntax/SyntaxJson.js +1 -1
  27. package/dist/bundles/compiler/Syntax/SyntaxJson.js.map +1 -1
  28. package/dist/bundles/compiler/index.js +1 -1
  29. package/dist/bundles/diagnostic-codes.js +1 -1
  30. package/dist/bundles/diagnostic-codes.js.map +1 -1
  31. package/dist/bundles/keyword-docs.js +1 -1
  32. package/dist/bundles/keyword-docs.js.map +1 -1
  33. package/dist/bundles/validation.js +1 -1
  34. package/dist/bundles/validation.js.map +1 -1
  35. package/dist/diagnostic-codes.d.ts +1 -0
  36. package/dist/diagnostic-codes.d.ts.map +1 -1
  37. package/dist/validation.d.ts.map +1 -1
  38. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"keyword-docs.js","names":["handlerIntentDocs","keywordDocs","specificationKeywordDocs","attributeDocs","contextVariableDocs","\"$identity\"","\"$env\"","\"$secrets\"","\"$strings\"","eventContextPaths","path","specialCategoryDocs"],"sources":["../../keyword-docs.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 { eventContextPaths } from './event-context';\n\n// These words are contextual beneath a handler, never global property keywords.\nexport const handlerIntentDocs = {\n implementation: 'Handler-only intent with ordered hints and at most one file or tagged fence. No payload means pending. Handler execution is unsupported; this is not confirmation.',\n hint: 'One nonblank quoted implementation hint. Order and decoded text are retained; hints do not execute or confirm code.',\n};\n\nexport const keywordDocs: Record<string, string> = {\n parameter: 'A typed value declared by a specification table, or an argument of a named behavior. Table types are required; every case supplies each parameter exactly once.',\n case: 'One named concrete row of a specification table, expanded as <Specification>_<Case>. Use case.<parameter> for a whole step value.',\n example: 'One typed, possibly partial fixture: `example <Name> : <EventOrCommandOrReadModel>`. Use its name in a matching specification step; assignments override example values without changing matching or supplying defaults. Event examples may carry stream or no stream; a step replaces that route as a whole.',\n domain: 'The domain the file belongs to — optional, at most one per file, before everything else.',\n import: 'Imports a type from another module by its qualified name — `import Module.Type` — making it available by its short name; or, quoted, other `.play` files by path or glob — `import \"Orders/**/*.play\"`, relative to this file\\'s folder. Written inside a module or feature, a file import places the imported files there: their top level is that module\\'s or feature\\'s body. `import Module.Event from \"origin\"` is instead public contract metadata with an opaque origin; executable binding refuses it with PLAY0268.',\n concept: 'A formalized value type wrapping a primitive. Bare pii and secret markers travel with every usage, with optional concept notes and qualifiers.',\n type: 'A composite value type — a named shape built from several properties, referenced by events, commands and other types the same way a concept is.',\n reason: 'A free-text concept note, not a lawful basis. Written as pii reason \"...\" or secret reason \"...\"; migration preserves it verbatim.',\n optional: 'Allows a value to be absent. Write it after the type: `note String optional` or `lines InvoiceLine[] optional`. The collection itself may be absent; its items keep their declared type.',\n identifier: 'Marks the command property a runtime resolves the event source id from. At most one per command; without it a new Uuid is generated.',\n policy: 'A named authorization rule referenced by commands and queries. Multiple policies AND together.',\n purpose: 'A report-only processing declaration (GDPR Art. 30), referenced on modules, features and slices. Coverage is their union, not an authorization gate. Generated declarations are not legal advice.',\n basis: 'One declared Art. 6(1) basis: consent, contract, legalObligation, vitalInterests, publicTask or legitimateInterests; an optional quoted reference may follow.',\n interest: 'The legitimate-interest statement for basis legitimateInterests (Art. 13(1)(d)).',\n condition: 'One Art. 9(2) processing condition, optionally followed by a quoted reference.',\n subjects: 'Comma-separated categories of data subjects, as open identifiers.',\n retention: 'Declared retention period or criteria, not enforced by the model or Chronicle.',\n recipient: 'A quoted recipient category; repeatable on a purpose.',\n transfer: 'A declared destination followed by safeguard and quoted safeguards; repeatable.',\n safeguard: 'The declared safeguard accompanying a third-country transfer.',\n erasure: 'An erasure exception under Art. 17(3); Chronicle crypto-shredding remains per subject, not per purpose.',\n exception: 'One declared Art. 17(3) exception: expression, legalObligation, publicTask, publicHealth, archiving or legalClaims.',\n persona: 'A named role interacting with the application, with an optional description, goals, its associated policies and, on the personas canvas, a position and size.',\n sticky: '`sticky note on personas|eventsources|givencontexts|seeddata` places a free-standing note (description, optional colour yellow/pink/green/blue, position, size) on that domain canvas. Authoring metadata only; never part of the executable model.',\n goal: 'What a persona is trying to achieve, as a quoted line; repeatable. Authoring metadata only.',\n colour: 'The colour of a sticky note: yellow, pink, green or blue.',\n size: 'How big a persona or sticky note is on its canvas: `size <width> <height>` in whole canvas units.',\n position: 'Where a persona, event source or sticky note sits on its canvas: `position <x> <y>` in whole canvas units.',\n identity: 'Declares typed additional caller details from a claim, a keyed single-result query, inline code or a file. Authoring metadata only; executable use of `$identity.<detail>` reports PLAY0268 until admitted (#600).',\n authentication: 'Declares the identity providers of the application — at most one block per file.',\n provider: 'A named identity provider within `authentication`, with free-form `name value` settings.',\n description: 'A human-readable description, including the rule or case a specification witnesses, as a quoted single line or a fenced ```text block for multiple lines.',\n depends: 'Declares `depends on <Name>` on a module or feature. This opts only that container into checking counted explicit references against its own declarations; it does not change executable bytes.',\n module: 'The top-level namespace — maps to a bounded context.',\n layout: 'A reusable screen template with named slots.',\n template: 'Names a template to fill or assign: `template <Name>` for an own template, `template blueprint <Blueprint> <Name> [version \"<range>\"]` for a template a blueprint package ships.',\n blueprint: 'In `template blueprint <Blueprint> <Name>`, the blueprint package the template comes from. A `ui profile` should list it under `packages`. In `ui profile` `sample data`, `active blueprint <id>` selects a sample data pack a blueprint ships, resolved by the build against its packages.',\n version: 'In `template blueprint ... version \"<range>\"`, the semver range of the blueprint the reference accepts, such as `^1.4`.',\n scopes: 'Where a template may be used: `application`, `module`, `feature`, `subfeature` or `slice`. `slice` can be followed by the kinds `statechange` and `stateview`, such as `scopes slice statechange|stateview`.',\n category: 'The group a template picker lists a layout or template under. Every layout and template needs one.',\n feature: 'A vertical slice grouping. Features nest arbitrarily deep.',\n slice: 'The atomic unit of behavior, aligned with Event Modeling. Has a type and a name.',\n public: 'Marks an event as a public contract. An event with from \"origin\" is also public. Origin is opaque, not a path or declaration reference. Public events and origins are admitted by executable semantic model (ESM) v9.',\n direction: 'Declare direction inbound or direction outbound once inside a Translate slice. Admitted by executable semantic model (ESM) v9; a Translate slice that uses public events must declare it (PLAY0614).',\n inbound: 'Inbound Translate direction metadata. No transport or delivery guarantee is implied.',\n outbound: 'Outbound Translate direction metadata. No transport or delivery guarantee is implied.',\n event: 'An immutable, past-tense fact. Declare it in a slice or inline with `produces event <Name>` in a command. Inline properties are typed mappings; inline tags belong to the event type.',\n documentation: 'Authoring-only reasoning on a module, feature, slice, command, event, read model or reaction in one nonempty fenced ```markdown block. It does not change executable model bytes.',\n id: 'Preserves the previous persisted event name after a rename. Leave absent on new events; repeating the current name is redundant.',\n command: 'An imperative intent. Declares authorization, validation, and what events it produces — declaratively, or via a full handler.',\n query: 'A read-side entry point mapping to a return type, with an optional description, parameters and performer. The by key and every supplied filter value satisfy their concept rules after authorization; violations reject with Validation, not an empty result.',\n observable: 'Qualifies a query return type as a live read — `query <Name> => observable <ReadModel>` keeps pushing as the read model changes, instead of answering once.',\n performer: 'The code that performs a query — a `file <Path>` reference or an inline `csharp`/`sql` block. The query\\'s counterpart to a command handler.',\n from: 'On a reaction or reducer, `from Source[.Stream]` observes only matching routed facts. It does not filter stream ids. Admitted by ESM v10. On a query parameter, fills it from the query context instead of the caller, as in `filter tenantId TenantId from $context.tenant`.',\n projection: 'Declares how events project into a read model, using the embedded Projection Declaration Language (PDL).',\n capture: 'Converts external data into events, using the embedded Change Data Capture Language (CDL).',\n protected: 'Application-root `command reads protected` admits eligible command reads (ESM v25). Required absence rejects with Validation before derive/provide and requirements; a matching intervening fact yields Conflict/DecisionStateChanged without facts. Without the preamble, legacy reads retain their existing refusals. Targets must separately admit the version.',\n batches: 'Application-root `reaction batches atomic` opts into ESM v22 atomic direct and refusal-branch batches. Invoked commands remain separate transactions.',\n atomic: 'All productions in one reaction trigger occurrence or selected refusal branch are adopted together or not at all. Absence retains legacy per-fact semantics.',\n reaction: 'Behavior that runs when something happens. Lives inside Automation slices. A trigger with no body states intent on its own — `file`/code is optional realization metadata.',\n runs: '`runs as system [role \"Role\" and role \"Role\"]` declares the identity for every returned or invoked command of a reaction, not imperative pipeline calls. Admitted by released ESM v10; claims are unknown for this identity. Clock and application triggers have no Stage realization yet.',\n trigger: 'Declares a kind of occurrence a reaction can respond to, and the values it hands the reaction. What makes one occur belongs to whoever provides it, never to the compiler.',\n where: 'Narrows which occurrences actually run the reaction.',\n contains: 'Ordinal UTF-16 text comparison: the value holds the literal operand anywhere. In validation, `not contains` negates it; absent optional values pass. An empty operand always occurs.',\n starts: 'Use `starts with \"text\"` for an ordinal UTF-16 literal prefix validation rule or condition.',\n ends: 'Use `ends with \"text\"` for an ordinal UTF-16 literal suffix validation rule. An absent optional value passes.',\n every: 'Runs a reaction on an interval — `every 15 minutes`, `every 1 day`.',\n refused: 'Ordered invocation refusal branch, executable from ESM v19: first match wins and stops remaining invocations of this trigger. Bare `on refused` covers validation and constraints, not authorization. Other reactions and cascades continue; contract errors, concurrency and Unsupported never match.',\n acknowledge: 'A refusal branch acknowledges alone without facts, or produces events instead. Executable from ESM v19; handling stops remaining invocations of this trigger.',\n validation: 'In `on refused by validation`, selects error-severity property, concept and require refusals. Executable from ESM v19.',\n authorization: 'In `on refused by authorization`, explicitly selects unauthorized results, never Unsupported. Executable from ESM v19; bare refusal excludes authorization.',\n redelivered: '`when redelivered <Event> to <Reaction>` selects exactly one effective given occurrence by optional for, stated values and stream or no stream, delivering that event again to one named reaction without appending it again. Executable from ESM v17.',\n invokes: 'A command a reaction hands on. A command is asked for, not produced — it may still be rejected.',\n screen: 'A UI declaration. Supports intent, structure, and layout-with-code levels, or a full file reference.',\n constraint: 'A server-side rule enforced in the Chronicle kernel before events are committed.',\n authorize: 'References the policies that must all pass for the construct to execute.',\n validate: 'Declarative validation rules, or `validate` followed by a ```csharp fence or `file <path>` for imperative rules — on commands and concepts.',\n checksum: 'String-concept validation: exact trailing luhn/mod11 digit or two mod97 digits over preceding ASCII digits. Also applies to supplied and stored values; generation does not silently add validation.',\n luhn: 'Luhn check digit, with standard parity from the right. Generation appends it; validate checksum luhn checks the arithmetic.',\n mod11: 'Check digit (11 - weighted sum modulo 11) modulo 11, weights 2..7 cycling from the right. Output 10 is excluded from generation support.',\n mod97: 'ISO 7064 MOD 97-10, two zero-padded trailing digits. Validation checks the exact computed suffix, not only congruence.',\n produces: 'References a declared event with `produces <Name>`, or declares one inline with `produces event <Name>`. An inline omitted `for` uses the command identifier only when all destinations are the same source; legacy plain omission allocates an identity.',\n reads: 'Declares a view consulted by a command or reaction trigger: `reads <View> [as <alias>] [by <value>]`. A reaction `by` names a value taken by its trigger; clock triggers cannot use `by`. A child by block supplies composite key parts by name, using part = source, but is refused for protected command reads (PLAY0781 ByParts). Repeated views require unique aliases. With `command reads protected`, command reads bind only over finite event-log projections keyed by event-source identity with removal handlers and required scalar non-generated input keys. Omitted `by` uses the command identifier. Single-level read/alias.property paths are admitted in validate require operands and produces mappings only. Reaction reads remain unadmitted.',\n as: 'Names an instance of a view in a command or reaction trigger reads declaration, for example `reads Account as source by sourceId`.',\n handler: 'A fully imperative command implementation — a `file <Path>` reference or an inline `csharp` block, instead of `produces`.',\n when: 'Guards a produced event or a capture append with a condition. In a labeled screen action, `when item.<field> == <literal> execute <Command>` selects the first matching command. Inside on click, double click, select or change, block-form `when <condition>` selects one whole action list at gesture time.',\n rule: 'Names a predicate. Bare, it states that a constraint exists without expressing what it computes — nothing resolves the name. Optionally followed by an indented `file <Path>` reference or inline `csharp` block giving it a body.',\n require: 'A policy condition: `authenticated`, `anonymous`, `role \"...\"`, or `claim \"...\" matches ...`. Unary `not` negates a condition or group; precedence is not, and, or.',\n authenticated: 'Requires an authenticated caller.',\n anonymous: 'Admits every caller, including one without an identity (ESM v31). Stands alone in `require` and is the whole authorization of what it gates; its specifications may omit `given caller`.',\n role: 'Requires the caller to have the given role.',\n claim: 'Requires a claim on the caller to match a subject or value.',\n subject: 'In policy `matches subject`, the identifier of the thing acted on, not the caller. The caller is `$context.causedBy.subject`.',\n data: 'Binds a read model to a screen through a query.',\n action: 'Makes a command available on a screen. `action \"Label\"` declares one button with ordered `when … execute` alternatives over the nearest data item or selected row. No subject hides it; commands still enforce authorization and validation.',\n otherwise: 'The final fallback of a guarded action: `otherwise hidden` or `otherwise execute <Command>`. In an item interaction, bare `otherwise` opens a fallback action list. No subject runs nothing, including fallback; authorization never falls through.',\n hidden: 'Hides a guarded action when no condition matches. Without a subject the action is always hidden, even with an execute fallback.',\n execute: 'Executes a command. A guarded screen action selects it by the first matching condition; explicit `with … from` bindings precede same-name item fields, its declared form and renderer input.',\n navigate: 'Navigates to a screen, optionally passing a parameter with `by`.',\n section: 'A named structural section of a screen.',\n table: 'A table widget over a read model or child collection.',\n summary: 'A summary widget showing labeled fields.',\n column: 'A table column bound to a property.',\n field: 'A summary field bound to a property.',\n title: 'The display title of a screen or section.',\n label: 'The display label of an action, column, or field.',\n unique: 'A uniqueness constraint — `unique <property> on <EventType>` or `unique event <EventType>`.',\n concurrency: 'The concurrency scope enforced when the command appends events — dimensions: `eventSource`, `sourceType`, `streamType`, `streamId`, `events`.',\n eventSource: 'Concurrency dimension — scope the check to the event source id of the command.',\n sourceType: 'Concurrency dimension — scope the check to an event source type.',\n streamType: 'Concurrency dimension — scope the check to an event stream type.',\n streamId: 'Concurrency dimension — scope the check to an event stream id.',\n tag: 'Attaches a tag to appended events — a static identifier or string, or a `$context.` expression resolved at append time.',\n seed: 'Declares events to seed into the event store per event source id — multiple blocks accumulate.',\n for: 'Names the event source of a production or seed group. Inside `produces event`, omission uses the command identifier unless another production targets a different source.',\n readmodel: 'Declares a read model — its name and properties — in a slice, or, in a specification, read model state: `given readmodel` establishes it, `then readmodel` asserts it, `then no readmodel <View> for <key>` asserts keyed absence.',\n reducer: 'Builds a read model from events with imperative code — `reducer <Name> => <ReadModel>` with an `on <EventType>` rule per event. Use it when a projection cannot express the transition.',\n specification: 'Given/when/then acceptance criteria for a slice: prior events and state, the command, query or appended event under test, and the events, state, results, errors or denials that follow.',\n dialog: 'A dialog opened over the shell, or with `dialog template` a reusable dialog shape.',\n form: 'A form bound to a command — `form <Name> for <Command>` with a `field` per input.',\n contribute: 'Contributes entries to a slot of the shell — `contribute to Navigation` with `navigate to`, `label` and `order`.',\n button: 'A toolbar button that invokes a State Change slice — `button <id> title \"…\" slice <Module>.<Feature>.<Slice> [emphasis primary|secondary|quiet] [icon <name>]`. The slice names the command and the dialog it opens.',\n navigation: 'A navigation region of the shell — `navigation topbar` or `navigation sidebar`. A layout declares the application\\'s regions with a `logo` and `item` lines; a module adds `inherits`, `extends` or `overrides` to change what it shows.',\n theme: 'A named theme and the component packages it is compatible with.',\n sample: 'Sample data — `sample data <Name>` declares a pack of demo rows per `shape` that a design surface or preview shows instead of a backend. Design and preview time only; it never reaches backend or production output. The application picks its active pack once, in the `ui profile`.',\n active: 'The active sample data pack of the whole application, chosen once in the `ui profile` `sample data` block — one declared in the document, or `blueprint <id>` for one a blueprint ships.',\n bind: 'Binds one read model to a sample data pack — `bind <ReadModel> to <pack>` — a rare override of the active pack for that read model only.',\n maps: 'Maps a sample data shape to the read model it supplies rows for — `shape <Shape> maps to <ReadModel>` — where the names differ.',\n row: 'One row of a sample data shape: `<field> = <literal>` lines, each field a property of the read model.',\n locale: 'The BCP 47 locale tag of a sample data pack, such as `nb-NO`.',\n shape: 'In sample data, the shape a set of rows is for; it matches the read model of the same name or the one a `ui profile` maps it to.',\n root: 'In a `ui profile`, `root template [blueprint <Blueprint>] <Name> [version \"<range>\"]` names the template the whole application is drawn in, with `option <name> <value>` lines for what the shell exposes.',\n appearance: 'In a `ui profile`, the `appearance` block holds `color scheme light|dark|system`, `accent \"<#hex>\"`, `corners sharp|default|round` and `font <font id>`.',\n corners: 'In a `ui profile` `appearance` block, `corners sharp|default|round` is how rounded the application\\'s corners are.',\n font: 'In a `ui profile` `appearance` block, `font <font id>` is the application\\'s font, an id from Scene\\'s font catalog (`inter`, `ibm-plex-sans`, `source-serif-4`, `system-ui`).',\n logo: 'In a `ui profile` `identity` block, `logo initials \"<AB>\"`, `logo icon <icon>` or `logo image \"<data URI>\"` is the mark the application wears.',\n accent: 'In a `ui profile` `appearance` block, `accent \"<#hex>\"` is the accent colour of the application.',\n scheme: 'In a `ui profile` `appearance` block, `color scheme light|dark|system` is the colour scheme of the application.',\n screens: 'In a `ui profile`, `new screens use template [blueprint <Blueprint>] <Name>` is the template a new screen starts from.',\n ui: 'A UI profile — `ui profile <Name>` binds a target platform and size to a layout, theme and packages.',\n behavior: 'A named interaction wiring of `on <interaction>` handlers, attached to a screen, form or dialog with `uses`.',\n system: 'An application-scoped external system that operations use.',\n eventsource: 'An application-owned event source with nested streams.',\n operation: 'A reusable operation intent that uses one external system.',\n no: 'A keyed absence assertion: `then no readmodel <View> for <key>`.',\n arguments: 'The values supplied to a query asserted by `then query`.',\n result: 'One expected result - `then result [exactly]` after `when query`, or a `result` block inside `then query`. Repeat it to assert several results in authored order.',\n clock: 'The instant a specification happens at - `given clock \"2026-10-05T08:00:00Z\"` fixes when everything occurs, including every generated pattern date segment at that same UTC instant. Without given clock, generation fixtures check date digit widths only, never the wall clock. `when clock \"<instant>\"` is the clock reaching it, as the action.',\n exactly: 'Requires every property to match, rather than only the ones asserted - on `then readmodel`, `then query` and `then result`.',\n file: 'Delegates the implementation to an external file; the Screenplay contract stays visible.',\n key: 'Trailing modifier on a required top-level read-model property. Explicit keys replace inference. Several scalar key properties identify one instance by named parts. Supply every part in a single-instance query by block and in projection key blocks; list queries can use equality filters.',\n stream: 'On a command event production, replaces the whole command route for that event. Other productions keep the command route. Admitted by ESM v10.',\n by: 'Introduces one identifying parameter or a block of at least two named key parts. Reads use part = source; queries use part Type.',\n via: 'Connects screen data to the query that supplies it.',\n filter: 'An optional query filter parameter.',\n on: 'The event a constraint applies to, the day a schedule narrows to, or a widget interaction such as `on row-click`.',\n message: 'The validation message reported when the rule fails.',\n matches: 'Searches text using the portable flagless JavaScript match dialect, or `email`. Use ^ and $ for the whole input. Exact Studio text-rule lookarounds warn with PLAY0787 and lower to ordinal rules; other lookarounds, backreferences and refused constructs report PLAY0699; patterns have at most 1000 source code units and 3000 expanded nodes, including optional, loop and alternative choice points.',\n all: 'Applies a comparison to every element of a collection.',\n max: 'Maximum length or value.',\n min: 'Minimum length or value.',\n length: 'Constrains the exact length of a value.',\n today: 'The application-calendar date (decision 0106). A bare name remains a path, so a property named today is not reserved. Clock offsets such as today - 7 days are syntax-only; binding reports PLAY0268 until admitted.',\n now: 'The current instant (decisions 0106/0107). Offsets such as now + 2 hours and date of now are syntax-only; binding reports PLAY0268 until admitted.',\n calendar: 'Command calendar: calendar \"<id>\" or calendar from $context.<member>. Syntax-only (decisions 0106/0107); binding reports PLAY0268. A property named calendar remains a property.',\n zone: 'Application time zone \"<id>\" or time zone configurable default \"<id>\"; a specification may state given time zone \"<id>\". Syntax-only (decisions 0106/0107); binding reports PLAY0268.',\n empty: 'Used with `not empty` — text needs a non-whitespace character; null, empty and whitespace-only text fail. Unicode White_Space is U+0009–U+000D, U+0020, U+0085, U+00A0, U+1680, U+2000–U+200A, U+2028, U+2029, U+202F, U+205F and U+3000 (not U+FEFF). Collections need at least one element. Applies to concept and command rules in every ESM version; no trimming. Identity text is unchanged: whitespace is a value.',\n not: 'Negates a validation condition, as in `not empty`.',\n and: 'Both conditions must hold.',\n or: 'Either condition may hold.',\n csharp: 'An inline C# block whose opening fence is ```csharp.',\n java: 'An opaque inline Java block whose opening fence is ```java. For Java-capable targets such as Axon; the Cratis target refuses Java bodies.',\n sql: 'An inline SQL block between triple backticks — a query performer written against a relational store.',\n typescript: 'An inline TypeScript block between triple backticks.',\n react: 'An inline React/TSX block; receives the surrounding data contract as `Props`.',\n html: 'An inline static HTML block.',\n StateChange: 'Slice type — a command → events flow; something that changes the system.',\n StateView: 'Slice type — a query + projection + screen; something that reads the system.',\n Automation: 'Slice type — a reaction or reducer; something that runs when something happens.',\n Translate: 'Slice type — a capture; converts external data into events.',\n Uuid: 'Primitive type — a universally unique identifier. ESM v28 admits == and != between Uuid values (or concepts over Uuid) in command require and produces when; two concepts must be the same concept, and a literal must be canonical lowercase hyphenated. Ordering, optional operands, validation rules, concept rules and reaction where stay refused.',\n String: 'Primitive type — a string of characters.',\n Int: 'Primitive type — an integer number.',\n Decimal: 'Primitive type — a decimal number.',\n Bool: 'Primitive type — true or false.',\n Date: 'Primitive type — a calendar date without a time zone. ESM v26 admits all six comparisons in command require, produces when and command/property rules. Conditions use required same-primitive command properties or a literal; rules use literals only. Canonical literals use yyyy-MM-dd. Concept rules, reaction where, read paths, context and today stay refused.',\n DateTime: 'Primitive type — a date and time. ESM v26 command comparisons order UTC instants at tick precision, including equality across offsets. Compared input requires an explicit offset or Z before any rule runs; literals canonicalize to UTC with seven fractional digits and Z. Targets without tick precision refuse comparisons; client validators omit date ordering. Other equality stays ordinal.',\n Enum: 'An enumeration concept with named members. Members may all declare unique int32 numbers (draft = 1) or all omit them (zero-based positions). Never renumber or reuse a published number. Non-positional numbers select executable model (ESM) v12; consumers must explicitly admit v12. Specifications still name members.',\n};\n\n// What the words of a specification's steps mean there - where 'trigger', 'capture' and 'query' name what the\n// scenario exercises rather than declare one.\nexport const specificationKeywordDocs: Record<string, string> = {\n parameter: 'Declares a required typed case value: `parameter <name> <Type>`. Every case assigns it once. `optional` permits literal null but supplies no default.',\n case: 'One named complete row of a specification table. `case.<parameter>` substitutes a whole value after example overrides; each row runs as `<Specification>_<Case>`.',\n caller: '`given caller` states an explicit identity; `given caller as <Persona>` synthesizes an authenticated deterministic witness of the persona, with no body. Leftmost buildable policy alternatives are significant.',\n clock: keywordDocs.clock,\n redelivered: keywordDocs.redelivered,\n trigger: '`when trigger <Trigger>` - an application trigger fires, as the action, with the values on the lines beneath it.',\n capture: '`given capture <Capture>` - a record the capture\\'s source held before; `when capture <Capture>` - the record it sees now, as the action. The fields go on the lines beneath.',\n query: '`when query <Query>` performs the query with arguments beneath it; assert returned rows with `then result` or genuine absence with `then no result`. From ESM v18, one actionless query with `then error` asserts exactly Validation and no other outcome. This also works with `then query` and an arguments block, without a result block.',\n events: '`then no events` - asserts the action appended no events, also after `when append`, where it means no reaction appended anything. Executable from ESM v17. Cannot accompany event, event-order, error or denial expectations.',\n result: '`then result [exactly]` - one result the query performed by `when query` returns, in order; `then no result` - it returns nothing.',\n};\n\nexport const attributeDocs: Record<string, string> = {\n pii: 'personal data (GDPR Art. 4(1)); renders Chronicle [PII]. Bare suffix marker; @pii is deprecated (PLAY0565). Selects executable model (ESM) v13; consumers must explicitly admit it. Cannot classify identity or enum concepts. An event with personal values and an explicit subject mark refuses binding (PLAY0268) until lineage is admitted.',\n personal: 'Alias of pii: personal data (GDPR Art. 4(1)); renders Chronicle [PII]. No diagnostic; canonical printing writes pii. Selects executable model (ESM) v13, like pii.',\n secret: 'Operational secret, not personal data: encrypted at rest without erasure and withheld from causation. Provider mapping: [Encrypted] + [NotAudited], or [PII] only with pii. Selects executable model (ESM) v13; reference outcomes are unchanged. Cannot classify identity (PLAY0515) or enum concepts. Explicit scope is omitted next to pii. An event combining secret scope subject with an explicit subject mark refuses binding (PLAY0268).',\n sensitive: 'Deprecated spelling of secret (PLAY0565); repair to bare secret. Operational secret, not GDPR Art. 9 special-category data.',\n};\n\nexport const contextVariableDocs: Record<string, string> = {\n '$context.occurred': 'When the command or query was received.',\n '$context.tenant': 'The tenant the command or query is executing for.',\n '$context.command': 'The command being handled, shaped by its `command` declaration.',\n '$context.arguments': 'The arguments of the query being performed.',\n '$context.causedBy': 'The identity that caused the command or query — `subject`, `name`, `userName`.',\n '$context.causedBy.subject': 'The subject of the identity that caused the command or query.',\n '$context.causedBy.name': 'The display name of the identity that caused the command or query.',\n '$context.causedBy.userName': 'The user name of the identity that caused the command or query.',\n '$context.causation': 'What caused the command or query — `type`, `occurred`, `properties`.',\n '$context.causation.type': 'What caused the command or query — a command, a reactor, a schedule.',\n '$identity': 'The caller — token built-ins `id`, `name`, `userName`, `isAuthenticated`, `roles`, `claims`, plus declared identity details. Built-ins are equivalent to `$context.identity`; details are authoring-only until admitted (#600).',\n '$identity.id': 'The identifier of the caller from the auth token; equivalent to `$context.identity.id`.',\n '$identity.name': 'The display name of the caller; equivalent to `$context.identity.name`.',\n '$identity.userName': 'The user name of the caller; equivalent to `$context.identity.userName`.',\n '$identity.isAuthenticated': 'Whether the caller is authenticated.',\n '$identity.roles': 'The roles the caller holds.',\n '$identity.claims': 'The claims the caller carries — `$identity.claims.<name>` reads one.',\n '$context.identity': 'The caller a decision is made about — `id`, `name`, `userName`, `isAuthenticated`, `roles`, `claims`.',\n '$context.identity.id': 'The identifier of the caller from the auth token.',\n '$context.identity.name': 'The display name of the caller.',\n '$context.identity.userName': 'The user name of the caller.',\n '$context.identity.isAuthenticated': 'Whether the caller is authenticated.',\n '$context.identity.roles': 'The roles the caller holds.',\n '$context.identity.claims': 'The claims the caller carries — `$context.identity.claims.<name>` reads one.',\n '$env': 'An environment variable, e.g. `$env.SERVICE_NAME`.',\n '$secrets': 'An encrypted secret resolved at runtime, e.g. `$secrets.azureAdClientId` — stays symbolic in the compiled tree.',\n '$strings': 'A localized string resolved from the `.strings` file of the active locale, e.g. `$strings.invoices.title`.',\n // Every $eventContext path the event-context catalog lists, for projections.\n ...Object.fromEntries(eventContextPaths.map((path) => [`$eventContext.${path.path}`, path.description])),\n};\n\n// One-sentence descriptions of the `pii special` categories (GDPR Art. 9(1)) and `pii criminal` (Art. 10).\n// The same sentences appear in Documentation/screenplay/concepts.md.\nexport const specialCategoryDocs: Record<string, string> = {\n racialOrEthnicOrigin: 'Data revealing a person\\'s racial or ethnic origin (GDPR Art. 9(1)).',\n politicalOpinions: 'Data revealing a person\\'s political opinions (GDPR Art. 9(1)).',\n religiousOrPhilosophicalBeliefs: 'Data revealing a person\\'s religious or philosophical beliefs (GDPR Art. 9(1)).',\n tradeUnionMembership: 'Data revealing whether a person belongs to a trade union (GDPR Art. 9(1)).',\n genetic: 'Data about inherited or acquired genetic characteristics that gives unique information about a person\\'s physiology or health (GDPR Art. 9(1), Art. 4(13)).',\n biometric: 'Data from technical processing of physical, physiological or behavioral characteristics, special only when processed to uniquely identify a person (GDPR Art. 9(1), Art. 4(14)).',\n health: 'Data about a person\\'s physical or mental health, including health care services, that reveals their health status (GDPR Art. 9(1), Art. 4(15)).',\n sexLifeOrSexualOrientation: 'Data concerning a person\\'s sex life or sexual orientation (GDPR Art. 9(1)).'\n};\n"],"mappings":"2IAMA,MAAaA,EAAoB,CAC7B,eAAgB,qKAChB,KAAM,qHACV,EAEaC,EAAsC,CAC/C,UAAW,kKACX,KAAM,oIACN,QAAS,gTACT,OAAQ,2FACR,OAAQ,ggBACR,QAAS,iJACT,KAAM,kJACN,OAAQ,qIACR,SAAU,2LACV,WAAY,uIACZ,OAAQ,iGACR,QAAS,oMACT,MAAO,gKACP,SAAU,mFACV,UAAW,iFACX,SAAU,oEACV,UAAW,iFACX,UAAW,wDACX,SAAU,kFACV,UAAW,gEACX,QAAS,0GACT,UAAW,sHACX,QAAS,gKACT,OAAQ,sPACR,KAAM,8FACN,OAAQ,4DACR,KAAM,oGACN,SAAU,6GACV,SAAU,qNACV,eAAgB,mFAChB,SAAU,2FACV,YAAa,4JACb,QAAS,kMACT,OAAQ,uDACR,OAAQ,+CACR,SAAU,mLACV,UAAW,8RACX,QAAS,0HACT,OAAQ,+MACR,SAAU,qGACV,QAAS,6DACT,MAAO,mFACP,OAAQ,wNACR,UAAW,uMACX,QAAS,uFACT,SAAU,wFACV,MAAO,wLACP,cAAe,oLACf,GAAI,mIACJ,QAAS,gIACT,MAAO,gQACP,WAAY,8JACZ,UAAW,8IACX,KAAM,gRACN,WAAY,2GACZ,QAAS,6FACT,UAAW,qWACX,QAAS,wJACT,OAAQ,+JACR,SAAU,6KACV,KAAM,6RACN,QAAS,6KACT,MAAO,uDACP,SAAU,uLACV,OAAQ,8FACR,KAAM,gHACN,MAAO,sEACP,QAAS,ySACT,YAAa,gKACb,WAAY,yHACZ,cAAe,8JACf,YAAa,yPACb,QAAS,kGACT,OAAQ,uGACR,WAAY,mFACZ,UAAW,2EACX,SAAU,8IACV,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a,2EACb,UAAW,+EACX,WAAY,kFACZ,UAAW,8DACX,KAAM,0VACN,OAAQ,2CACR,IAAK,sCACL,QAAS,qCACT,KAAM,kCACN,KAAM,wWACN,SAAU,uYACV,KAAM,4TACV,EAIaC,EAAmD,CAC5D,UAAW,wJACX,KAAM,oKACN,OAAQ,mNACR,MAAOD,EAAY,MACnB,YAAaA,EAAY,YACzB,QAAS,mHACT,QAAS,+KACT,MAAO,+UACP,OAAQ,gOACR,OAAQ,oIACZ,EAEaE,EAAwC,CACjD,IAAK,kVACL,SAAU,qKACV,OAAQ,mbACR,UAAW,6HACf,EAEaC,EAA8C,CACvD,oBAAqB,0CACrB,kBAAmB,oDACnB,mBAAoB,kEACpB,qBAAsB,8CACtB,oBAAqB,iFACrB,4BAA6B,gEAC7B,yBAA0B,qEAC1B,6BAA8B,kEAC9B,qBAAsB,uEACtB,0BAA2B,uEAC3BC,UAAa,kOACb,eAAgB,0FAChB,iBAAkB,0EAClB,qBAAsB,2EACtB,4BAA6B,uCAC7B,kBAAmB,8BACnB,mBAAoB,uEACpB,oBAAqB,wGACrB,uBAAwB,oDACxB,yBAA0B,kCAC1B,6BAA8B,+BAC9B,oCAAqC,uCACrC,0BAA2B,8BAC3B,2BAA4B,+EAC5BC,KAAQ,qDACRC,SAAY,kHACZC,SAAY,6GAEZ,GAAG,OAAO,YAAYC,EAAkB,IAAK,GAAS,CAAC,iBAAiBC,EAAK,OAAQA,EAAK,WAAW,CAAC,CAAC,CAC3G,EAIaC,EAA8C,CACvD,qBAAsB,sEACtB,kBAAmB,iEACnB,gCAAiC,iFACjC,qBAAsB,6EACtB,QAAS,6JACT,UAAW,mLACX,OAAQ,kJACR,2BAA4B,6EAChC"}
1
+ {"version":3,"file":"keyword-docs.js","names":["handlerIntentDocs","keywordDocs","specificationKeywordDocs","attributeDocs","contextVariableDocs","\"$identity\"","\"$env\"","\"$secrets\"","\"$strings\"","eventContextPaths","path","specialCategoryDocs"],"sources":["../../keyword-docs.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 { eventContextPaths } from './event-context';\n\n// These words are contextual beneath a handler, never global property keywords.\nexport const handlerIntentDocs = {\n implementation: 'Handler-only intent with ordered hints and at most one file or tagged fence. No payload means pending. Handler execution is unsupported; this is not confirmation.',\n hint: 'One nonblank quoted implementation hint. Order and decoded text are retained; hints do not execute or confirm code.',\n};\n\nexport const keywordDocs: Record<string, string> = {\n parameter: 'A typed value declared by a specification table, or an argument of a named behavior. Table types are required; every case supplies each parameter exactly once.',\n case: 'One named concrete row of a specification table, expanded as <Specification>_<Case>. Use case.<parameter> for a whole step value.',\n example: 'One typed, possibly partial fixture: `example <Name> : <EventOrCommandOrReadModel>`. Use its name in a matching specification step; assignments override example values without changing matching or supplying defaults. Event examples may carry stream or no stream; a step replaces that route as a whole.',\n domain: 'The domain the file belongs to — optional, at most one per file, before everything else.',\n import: 'Imports a type from another module by its qualified name — `import Module.Type` — making it available by its short name; or, quoted, other `.play` files by path or glob — `import \"Orders/**/*.play\"`, relative to this file\\'s folder. Written inside a module or feature, a file import places the imported files there: their top level is that module\\'s or feature\\'s body. `import Module.Event from \"origin\"` is instead public contract metadata with an opaque origin; executable binding refuses it with PLAY0268.',\n concept: 'A formalized value type wrapping a primitive. Bare pii and secret markers travel with every usage, with optional concept notes and qualifiers.',\n type: 'A top-level composite value type — a named shape built from several properties, referenced by events, commands, read-model members and other types the same way a concept is. A slice-local type is skipped with PLAY0029; an unsupported read-model member type is Error PLAY0273. Use a top-level type for reusable child shapes, not another read-model identity.',\n reason: 'A free-text concept note, not a lawful basis. Written as pii reason \"...\" or secret reason \"...\"; migration preserves it verbatim.',\n optional: 'Allows a value to be absent. Write it after the type: `note String optional` or `lines InvoiceLine[] optional`. The collection itself may be absent; its items keep their declared type.',\n identifier: 'Marks the command property a runtime resolves the event source id from. At most one per command; without it a new Uuid is generated.',\n policy: 'A named authorization rule referenced by commands and queries. Multiple policies AND together.',\n purpose: 'A report-only processing declaration (GDPR Art. 30), referenced on modules, features and slices. Coverage is their union, not an authorization gate. Generated declarations are not legal advice.',\n basis: 'One declared Art. 6(1) basis: consent, contract, legalObligation, vitalInterests, publicTask or legitimateInterests; an optional quoted reference may follow.',\n interest: 'The legitimate-interest statement for basis legitimateInterests (Art. 13(1)(d)).',\n condition: 'One Art. 9(2) processing condition, optionally followed by a quoted reference.',\n subjects: 'Comma-separated categories of data subjects, as open identifiers.',\n retention: 'Declared retention period or criteria, not enforced by the model or Chronicle.',\n recipient: 'A quoted recipient category; repeatable on a purpose.',\n transfer: 'A declared destination followed by safeguard and quoted safeguards; repeatable.',\n safeguard: 'The declared safeguard accompanying a third-country transfer.',\n erasure: 'An erasure exception under Art. 17(3); Chronicle crypto-shredding remains per subject, not per purpose.',\n exception: 'One declared Art. 17(3) exception: expression, legalObligation, publicTask, publicHealth, archiving or legalClaims.',\n persona: 'A named role interacting with the application, with an optional description, goals, its associated policies and, on the personas canvas, a position and size.',\n sticky: '`sticky note on personas|eventsources|givencontexts|seeddata` places a free-standing note (description, optional colour yellow/pink/green/blue, position, size) on that domain canvas. Authoring metadata only; never part of the executable model.',\n goal: 'What a persona is trying to achieve, as a quoted line; repeatable. Authoring metadata only.',\n colour: 'The colour of a sticky note: yellow, pink, green or blue.',\n size: 'How big a persona or sticky note is on its canvas: `size <width> <height>` in whole canvas units.',\n position: 'Where a persona, event source or sticky note sits on its canvas: `position <x> <y>` in whole canvas units.',\n identity: 'Declares typed additional caller details from a claim, a keyed single-result query, inline code or a file. Authoring metadata only; executable use of `$identity.<detail>` reports PLAY0268 until admitted (#600).',\n authentication: 'Declares the identity providers of the application — at most one block per file.',\n provider: 'A named identity provider within `authentication`, with free-form `name value` settings.',\n description: 'A human-readable description, including the rule or case a specification witnesses, as a quoted single line or a fenced ```text block for multiple lines.',\n depends: 'Declares `depends on <Name>` on a module or feature. This opts only that container into checking counted explicit references against its own declarations; it does not change executable bytes.',\n module: 'The top-level namespace — maps to a bounded context.',\n layout: 'A reusable screen template with named slots.',\n template: 'Names a template to fill or assign: `template <Name>` for an own template, `template blueprint <Blueprint> <Name> [version \"<range>\"]` for a template a blueprint package ships.',\n blueprint: 'In `template blueprint <Blueprint> <Name>`, the blueprint package the template comes from. A `ui profile` should list it under `packages`. In `ui profile` `sample data`, `active blueprint <id>` selects a sample data pack a blueprint ships, resolved by the build against its packages.',\n version: 'In `template blueprint ... version \"<range>\"`, the semver range of the blueprint the reference accepts, such as `^1.4`.',\n scopes: 'Where a template may be used: `application`, `module`, `feature`, `subfeature` or `slice`. `slice` can be followed by the kinds `statechange` and `stateview`, such as `scopes slice statechange|stateview`.',\n category: 'The group a template picker lists a layout or template under. Every layout and template needs one.',\n feature: 'A vertical slice grouping. Features nest arbitrarily deep.',\n slice: 'The atomic unit of behavior, aligned with Event Modeling. Has a type and a name.',\n public: 'Marks an event as a public contract. An event with from \"origin\" is also public. Origin is opaque, not a path or declaration reference. Public events and origins are admitted by executable semantic model (ESM) v9.',\n direction: 'Declare direction inbound or direction outbound once inside a Translate slice. Admitted by executable semantic model (ESM) v9; a Translate slice that uses public events must declare it (PLAY0614).',\n inbound: 'Inbound Translate direction metadata. No transport or delivery guarantee is implied.',\n outbound: 'Outbound Translate direction metadata. No transport or delivery guarantee is implied.',\n event: 'An immutable, past-tense fact. Declare it in a slice or inline with `produces event <Name>` in a command. Inline properties are typed mappings; inline tags belong to the event type.',\n documentation: 'Authoring-only reasoning on a module, feature, slice, command, event, read model or reaction in one nonempty fenced ```markdown block. It does not change executable model bytes.',\n id: 'Preserves the previous persisted event name after a rename. Leave absent on new events; repeating the current name is redundant.',\n command: 'An imperative intent. Declares authorization, validation, and what events it produces — declaratively, or via a full handler.',\n query: 'A read-side entry point mapping to a return type, with an optional description, parameters and performer. The by key and every supplied filter value satisfy their concept rules after authorization; violations reject with Validation, not an empty result.',\n observable: 'Qualifies a query return type as a live read — `query <Name> => observable <ReadModel>` keeps pushing as the read model changes, instead of answering once.',\n performer: 'The code that performs a query — a `file <Path>` reference or an inline `csharp`/`sql` block. The query\\'s counterpart to a command handler.',\n from: 'On a reaction or reducer, `from Source[.Stream]` observes only matching routed facts. It does not filter stream ids. Admitted by ESM v10. On a query parameter, fills it from the query context instead of the caller, as in `filter tenantId TenantId from $context.tenant`.',\n projection: 'Declares how events project into a read model, using the embedded Projection Declaration Language (PDL).',\n capture: 'Converts external data into events, using the embedded Change Data Capture Language (CDL).',\n protected: 'Application-root `command reads protected` admits eligible command reads (ESM v25). Required absence rejects with Validation before derive/provide and requirements; a matching intervening fact yields Conflict/DecisionStateChanged without facts. Without the preamble, legacy reads retain their existing refusals. Targets must separately admit the version.',\n batches: 'Application-root `reaction batches atomic` opts into ESM v22 atomic direct and refusal-branch batches. Invoked commands remain separate transactions.',\n atomic: 'All productions in one reaction trigger occurrence or selected refusal branch are adopted together or not at all. Absence retains legacy per-fact semantics.',\n reaction: 'Behavior that runs when something happens. Lives inside Automation slices. A trigger with no body states intent on its own — `file`/code is optional realization metadata.',\n runs: '`runs as system [role \"Role\" and role \"Role\"]` declares the identity for every returned or invoked command of a reaction, not imperative pipeline calls. Admitted by released ESM v10; claims are unknown for this identity. Clock and application triggers have no Stage realization yet.',\n trigger: 'Declares a kind of occurrence a reaction can respond to, and the values it hands the reaction. What makes one occur belongs to whoever provides it, never to the compiler.',\n where: 'Narrows which occurrences actually run the reaction.',\n contains: 'Ordinal UTF-16 text comparison: the value holds the literal operand anywhere. In validation, `not contains` negates it; absent optional values pass. An empty operand always occurs.',\n starts: 'Use `starts with \"text\"` for an ordinal UTF-16 literal prefix validation rule or condition.',\n ends: 'Use `ends with \"text\"` for an ordinal UTF-16 literal suffix validation rule. An absent optional value passes.',\n every: 'Runs a reaction on an interval — `every 15 minutes`, `every 1 day`.',\n refused: 'Ordered invocation refusal branch, executable from ESM v19: first match wins and stops remaining invocations of this trigger. Bare `on refused` covers validation and constraints, not authorization. Other reactions and cascades continue; contract errors, concurrency and Unsupported never match.',\n acknowledge: 'A refusal branch acknowledges alone without facts, or produces events instead. Executable from ESM v19; handling stops remaining invocations of this trigger.',\n validation: 'In `on refused by validation`, selects error-severity property, concept and require refusals. Executable from ESM v19.',\n authorization: 'In `on refused by authorization`, explicitly selects unauthorized results, never Unsupported. Executable from ESM v19; bare refusal excludes authorization.',\n redelivered: '`when redelivered <Event> to <Reaction>` selects exactly one effective given occurrence by optional for, stated values and stream or no stream, delivering that event again to one named reaction without appending it again. Executable from ESM v17.',\n invokes: 'A command a reaction hands on. A command is asked for, not produced — it may still be rejected.',\n screen: 'A UI declaration. Supports intent, structure, and layout-with-code levels, or a full file reference.',\n constraint: 'A server-side rule enforced in the Chronicle kernel before events are committed.',\n authorize: 'References the policies that must all pass for the construct to execute.',\n validate: 'Declarative validation rules, or `validate` followed by a ```csharp fence or `file <path>` for imperative rules — on commands and concepts.',\n checksum: 'String-concept validation: exact trailing luhn/mod11 digit or two mod97 digits over preceding ASCII digits. Also applies to supplied and stored values; generation does not silently add validation.',\n luhn: 'Luhn check digit, with standard parity from the right. Generation appends it; validate checksum luhn checks the arithmetic.',\n mod11: 'Check digit (11 - weighted sum modulo 11) modulo 11, weights 2..7 cycling from the right. Output 10 is excluded from generation support.',\n mod97: 'ISO 7064 MOD 97-10, two zero-padded trailing digits. Validation checks the exact computed suffix, not only congruence.',\n produces: 'References a declared event with `produces <Name>`, or declares one inline with `produces event <Name>`. An inline omitted `for` uses the command identifier only when all destinations are the same source; legacy plain omission allocates an identity.',\n reads: 'Declares a view consulted by a command or reaction trigger: `reads <View> [as <alias>] [by <value>]`. A reaction `by` names a value taken by its trigger; clock triggers cannot use `by`. A child by block supplies composite key parts by name, using part = source, but is refused for protected command reads (PLAY0781 ByParts). Repeated views require unique aliases. With `command reads protected`, command reads bind only over finite event-log projections keyed by event-source identity with removal handlers and required scalar non-generated input keys. Omitted `by` uses the command identifier. Single-level read/alias.property paths are admitted in validate require operands and produces mappings only. Reaction reads remain unadmitted.',\n as: 'Names an instance of a view in a command or reaction trigger reads declaration, for example `reads Account as source by sourceId`.',\n handler: 'A fully imperative command implementation — a `file <Path>` reference or an inline `csharp` block, instead of `produces`.',\n when: 'Guards a produced event or a capture append with a condition. In a labeled screen action, `when item.<field> == <literal> execute <Command>` selects the first matching command. Inside on click, double click, select or change, block-form `when <condition>` selects one whole action list at gesture time.',\n rule: 'Names a predicate. Bare, it states that a constraint exists without expressing what it computes — nothing resolves the name. Optionally followed by an indented `file <Path>` reference or inline `csharp` block giving it a body.',\n require: 'A policy condition: `authenticated`, `anonymous`, `role \"...\"`, or `claim \"...\" matches ...`. Unary `not` negates a condition or group; precedence is not, and, or.',\n authenticated: 'Requires an authenticated caller.',\n anonymous: 'Admits every caller, including one without an identity (ESM v31). Stands alone in `require` and is the whole authorization of what it gates; its specifications may omit `given caller`.',\n role: 'Requires the caller to have the given role.',\n claim: 'Requires a claim on the caller to match a subject or value.',\n subject: 'In policy `matches subject`, the identifier of the thing acted on, not the caller. The caller is `$context.causedBy.subject`.',\n data: 'Binds a read model to a screen through a query.',\n action: 'Makes a command available on a screen. `action \"Label\"` declares one button with ordered `when … execute` alternatives over the nearest data item or selected row. No subject hides it; commands still enforce authorization and validation.',\n otherwise: 'The final fallback of a guarded action: `otherwise hidden` or `otherwise execute <Command>`. In an item interaction, bare `otherwise` opens a fallback action list. No subject runs nothing, including fallback; authorization never falls through.',\n hidden: 'Hides a guarded action when no condition matches. Without a subject the action is always hidden, even with an execute fallback.',\n execute: 'Executes a command. A guarded screen action selects it by the first matching condition; explicit `with … from` bindings precede same-name item fields, its declared form and renderer input.',\n navigate: 'Navigates to a screen, optionally passing a parameter with `by`.',\n section: 'A named structural section of a screen.',\n table: 'A table widget over a read model or child collection.',\n summary: 'A summary widget showing labeled fields.',\n column: 'A table column bound to a property.',\n field: 'A summary field bound to a property.',\n title: 'The display title of a screen or section.',\n label: 'The display label of an action, column, or field.',\n unique: 'A uniqueness constraint — `unique <property> on <EventType>` or `unique event <EventType>`.',\n concurrency: 'The concurrency scope enforced when the command appends events — dimensions: `eventSource`, `sourceType`, `streamType`, `streamId`, `events`.',\n eventSource: 'Concurrency dimension — scope the check to the event source id of the command.',\n sourceType: 'Concurrency dimension — scope the check to an event source type.',\n streamType: 'Concurrency dimension — scope the check to an event stream type.',\n streamId: 'Concurrency dimension — scope the check to an event stream id.',\n tag: 'Attaches a tag to appended events — a static identifier or string, or a `$context.` expression resolved at append time.',\n seed: 'Declares events to seed into the event store per event source id — multiple blocks accumulate.',\n for: 'Names the event source of a production or seed group. Inside `produces event`, omission uses the command identifier unless another production targets a different source.',\n readmodel: 'Declares a read model — its name and properties — in a slice, or, in a specification, read model state: `given readmodel` establishes it, `then readmodel` asserts it, `then no readmodel <View> for <key>` asserts keyed absence. Members use primitives, concepts, top-level composite types or imported value-type names; another read model is an identity, not a reusable member type (PLAY0273).',\n reducer: 'Builds a read model from events with imperative code — `reducer <Name> => <ReadModel>` with an `on <EventType>` rule per event. Use it when a projection cannot express the transition.',\n specification: 'Given/when/then acceptance criteria for a slice: prior events and state, the command, query or appended event under test, and the events, state, results, errors or denials that follow.',\n dialog: 'A dialog opened over the shell, or with `dialog template` a reusable dialog shape.',\n form: 'A form bound to a command — `form <Name> for <Command>` with a `field` per input.',\n contribute: 'Contributes entries to a slot of the shell — `contribute to Navigation` with `navigate to`, `label` and `order`.',\n button: 'A toolbar button that invokes a State Change slice — `button <id> title \"…\" slice <Module>.<Feature>.<Slice> [emphasis primary|secondary|quiet] [icon <name>]`. The slice names the command and the dialog it opens.',\n navigation: 'A navigation region of the shell — `navigation topbar` or `navigation sidebar`. A layout declares the application\\'s regions with a `logo` and `item` lines; a module adds `inherits`, `extends` or `overrides` to change what it shows.',\n theme: 'A named theme and the component packages it is compatible with.',\n sample: 'Sample data — `sample data <Name>` declares a pack of demo rows per `shape` that a design surface or preview shows instead of a backend. Design and preview time only; it never reaches backend or production output. The application picks its active pack once, in the `ui profile`.',\n active: 'The active sample data pack of the whole application, chosen once in the `ui profile` `sample data` block — one declared in the document, or `blueprint <id>` for one a blueprint ships.',\n bind: 'Binds one read model to a sample data pack — `bind <ReadModel> to <pack>` — a rare override of the active pack for that read model only.',\n maps: 'Maps a sample data shape to the read model it supplies rows for — `shape <Shape> maps to <ReadModel>` — where the names differ.',\n row: 'One row of a sample data shape: `<field> = <literal>` lines, each field a property of the read model.',\n locale: 'The BCP 47 locale tag of a sample data pack, such as `nb-NO`.',\n shape: 'In sample data, the shape a set of rows is for; it matches the read model of the same name or the one a `ui profile` maps it to.',\n root: 'In a `ui profile`, `root template [blueprint <Blueprint>] <Name> [version \"<range>\"]` names the template the whole application is drawn in, with `option <name> <value>` lines for what the shell exposes.',\n appearance: 'In a `ui profile`, the `appearance` block holds `color scheme light|dark|system`, `accent \"<#hex>\"`, `corners sharp|default|round` and `font <font id>`.',\n corners: 'In a `ui profile` `appearance` block, `corners sharp|default|round` is how rounded the application\\'s corners are.',\n font: 'In a `ui profile` `appearance` block, `font <font id>` is the application\\'s font, an id from Scene\\'s font catalog (`inter`, `ibm-plex-sans`, `source-serif-4`, `system-ui`).',\n logo: 'In a `ui profile` `identity` block, `logo initials \"<AB>\"`, `logo icon <icon>` or `logo image \"<data URI>\"` is the mark the application wears.',\n accent: 'In a `ui profile` `appearance` block, `accent \"<#hex>\"` is the accent colour of the application.',\n scheme: 'In a `ui profile` `appearance` block, `color scheme light|dark|system` is the colour scheme of the application.',\n screens: 'In a `ui profile`, `new screens use template [blueprint <Blueprint>] <Name>` is the template a new screen starts from.',\n ui: 'A UI profile — `ui profile <Name>` binds a target platform and size to a layout, theme and packages.',\n behavior: 'A named interaction wiring of `on <interaction>` handlers, attached to a screen, form or dialog with `uses`.',\n system: 'An application-scoped external system that operations use.',\n eventsource: 'An application-owned event source with nested streams.',\n operation: 'A reusable operation intent that uses one external system.',\n no: 'A keyed absence assertion: `then no readmodel <View> for <key>`.',\n arguments: 'The values supplied to a query asserted by `then query`.',\n result: 'One expected result - `then result [exactly]` after `when query`, or a `result` block inside `then query`. Repeat it to assert several results in authored order.',\n clock: 'The instant a specification happens at - `given clock \"2026-10-05T08:00:00Z\"` fixes when everything occurs, including every generated pattern date segment at that same UTC instant. Without given clock, generation fixtures check date digit widths only, never the wall clock. `when clock \"<instant>\"` is the clock reaching it, as the action.',\n exactly: 'Requires every property to match, rather than only the ones asserted - on `then readmodel`, `then query` and `then result`.',\n file: 'Delegates the implementation to an external file; the Screenplay contract stays visible.',\n key: 'Trailing modifier on a required top-level read-model property. Explicit keys replace inference. Several scalar key properties identify one instance by named parts. Supply every part in a single-instance query by block and in projection key blocks; list queries can use equality filters.',\n stream: 'On a command event production, replaces the whole command route for that event. Other productions keep the command route. Admitted by ESM v10.',\n by: 'Introduces one identifying parameter or a block of at least two named key parts. Reads use part = source; queries use part Type.',\n via: 'Connects screen data to the query that supplies it.',\n filter: 'An optional query filter parameter.',\n on: 'The event a constraint applies to, the day a schedule narrows to, or a widget interaction such as `on row-click`.',\n message: 'The validation message reported when the rule fails.',\n matches: 'Searches text using the portable flagless JavaScript match dialect, or `email`. Use ^ and $ for the whole input. Exact Studio text-rule lookarounds warn with PLAY0787 and lower to ordinal rules; other lookarounds, backreferences and refused constructs report PLAY0699; patterns have at most 1000 source code units and 3000 expanded nodes, including optional, loop and alternative choice points.',\n all: 'Applies a comparison to every element of a collection.',\n max: 'Maximum length or value.',\n min: 'Minimum length or value.',\n length: 'Constrains the exact length of a value.',\n today: 'The application-calendar date (decision 0106). A bare name remains a path, so a property named today is not reserved. Clock offsets such as today - 7 days are syntax-only; binding reports PLAY0268 until admitted.',\n now: 'The current instant (decisions 0106/0107). Offsets such as now + 2 hours and date of now are syntax-only; binding reports PLAY0268 until admitted.',\n calendar: 'Command calendar: calendar \"<id>\" or calendar from $context.<member>. Syntax-only (decisions 0106/0107); binding reports PLAY0268. A property named calendar remains a property.',\n zone: 'Application time zone \"<id>\" or time zone configurable default \"<id>\"; a specification may state given time zone \"<id>\". Syntax-only (decisions 0106/0107); binding reports PLAY0268.',\n empty: 'Used with `not empty` — text needs a non-whitespace character; null, empty and whitespace-only text fail. Unicode White_Space is U+0009–U+000D, U+0020, U+0085, U+00A0, U+1680, U+2000–U+200A, U+2028, U+2029, U+202F, U+205F and U+3000 (not U+FEFF). Collections need at least one element. Applies to concept and command rules in every ESM version; no trimming. Identity text is unchanged: whitespace is a value.',\n not: 'Negates a validation condition, as in `not empty`.',\n and: 'Both conditions must hold.',\n or: 'Either condition may hold.',\n csharp: 'An inline C# block whose opening fence is ```csharp.',\n java: 'An opaque inline Java block whose opening fence is ```java. For Java-capable targets such as Axon; the Cratis target refuses Java bodies.',\n sql: 'An inline SQL block between triple backticks — a query performer written against a relational store.',\n typescript: 'An inline TypeScript block between triple backticks.',\n react: 'An inline React/TSX block; receives the surrounding data contract as `Props`.',\n html: 'An inline static HTML block.',\n StateChange: 'Slice type — a command → events flow; something that changes the system.',\n StateView: 'Slice type — a query + projection + screen; something that reads the system.',\n Automation: 'Slice type — a reaction or reducer; something that runs when something happens.',\n Translate: 'Slice type — a capture; converts external data into events.',\n Uuid: 'Primitive type — a universally unique identifier. ESM v28 admits == and != between Uuid values (or concepts over Uuid) in command require and produces when; two concepts must be the same concept, and a literal must be canonical lowercase hyphenated. Ordering, optional operands, validation rules, concept rules and reaction where stay refused.',\n String: 'Primitive type — a string of characters.',\n Int: 'Primitive type — an integer number.',\n Decimal: 'Primitive type — a decimal number.',\n Bool: 'Primitive type — true or false.',\n Date: 'Primitive type — a calendar date without a time zone. ESM v26 admits all six comparisons in command require, produces when and command/property rules. Conditions use required same-primitive command properties or a literal; rules use literals only. Canonical literals use yyyy-MM-dd. Concept rules, reaction where, read paths, context and today stay refused.',\n DateTime: 'Primitive type — a date and time. ESM v26 command comparisons order UTC instants at tick precision, including equality across offsets. Compared input requires an explicit offset or Z before any rule runs; literals canonicalize to UTC with seven fractional digits and Z. Targets without tick precision refuse comparisons; client validators omit date ordering. Other equality stays ordinal.',\n Enum: 'An enumeration concept with named members. Members may all declare unique int32 numbers (draft = 1) or all omit them (zero-based positions). Never renumber or reuse a published number. Non-positional numbers select executable model (ESM) v12; consumers must explicitly admit v12. Specifications still name members.',\n};\n\n// What the words of a specification's steps mean there - where 'trigger', 'capture' and 'query' name what the\n// scenario exercises rather than declare one.\nexport const specificationKeywordDocs: Record<string, string> = {\n parameter: 'Declares a required typed case value: `parameter <name> <Type>`. Every case assigns it once. `optional` permits literal null but supplies no default.',\n case: 'One named complete row of a specification table. `case.<parameter>` substitutes a whole value after example overrides; each row runs as `<Specification>_<Case>`.',\n caller: '`given caller` states an explicit identity; `given caller as <Persona>` synthesizes an authenticated deterministic witness of the persona, with no body. Leftmost buildable policy alternatives are significant.',\n clock: keywordDocs.clock,\n redelivered: keywordDocs.redelivered,\n trigger: '`when trigger <Trigger>` - an application trigger fires, as the action, with the values on the lines beneath it.',\n capture: '`given capture <Capture>` - a record the capture\\'s source held before; `when capture <Capture>` - the record it sees now, as the action. The fields go on the lines beneath.',\n query: '`when query <Query>` performs the query with arguments beneath it; assert returned rows with `then result` or genuine absence with `then no result`. From ESM v18, one actionless query with `then error` asserts exactly Validation and no other outcome. This also works with `then query` and an arguments block, without a result block.',\n events: '`then no events` - asserts the action appended no events, also after `when append`, where it means no reaction appended anything. Executable from ESM v17. Cannot accompany event, event-order, error or denial expectations.',\n result: '`then result [exactly]` - one result the query performed by `when query` returns, in order; `then no result` - it returns nothing.',\n};\n\nexport const attributeDocs: Record<string, string> = {\n pii: 'personal data (GDPR Art. 4(1)); renders Chronicle [PII]. Bare suffix marker; @pii is deprecated (PLAY0565). Selects executable model (ESM) v13; consumers must explicitly admit it. Cannot classify identity or enum concepts. An event with personal values and an explicit subject mark refuses binding (PLAY0268) until lineage is admitted.',\n personal: 'Alias of pii: personal data (GDPR Art. 4(1)); renders Chronicle [PII]. No diagnostic; canonical printing writes pii. Selects executable model (ESM) v13, like pii.',\n secret: 'Operational secret, not personal data: encrypted at rest without erasure and withheld from causation. Provider mapping: [Encrypted] + [NotAudited], or [PII] only with pii. Selects executable model (ESM) v13; reference outcomes are unchanged. Cannot classify identity (PLAY0515) or enum concepts. Explicit scope is omitted next to pii. An event combining secret scope subject with an explicit subject mark refuses binding (PLAY0268).',\n sensitive: 'Deprecated spelling of secret (PLAY0565); repair to bare secret. Operational secret, not GDPR Art. 9 special-category data.',\n};\n\nexport const contextVariableDocs: Record<string, string> = {\n '$context.occurred': 'When the command or query was received.',\n '$context.tenant': 'The tenant the command or query is executing for.',\n '$context.command': 'The command being handled, shaped by its `command` declaration.',\n '$context.arguments': 'The arguments of the query being performed.',\n '$context.causedBy': 'The identity that caused the command or query — `subject`, `name`, `userName`.',\n '$context.causedBy.subject': 'The subject of the identity that caused the command or query.',\n '$context.causedBy.name': 'The display name of the identity that caused the command or query.',\n '$context.causedBy.userName': 'The user name of the identity that caused the command or query.',\n '$context.causation': 'What caused the command or query — `type`, `occurred`, `properties`.',\n '$context.causation.type': 'What caused the command or query — a command, a reactor, a schedule.',\n '$identity': 'The caller — token built-ins `id`, `name`, `userName`, `isAuthenticated`, `roles`, `claims`, plus declared identity details. Built-ins are equivalent to `$context.identity`; details are authoring-only until admitted (#600).',\n '$identity.id': 'The identifier of the caller from the auth token; equivalent to `$context.identity.id`.',\n '$identity.name': 'The display name of the caller; equivalent to `$context.identity.name`.',\n '$identity.userName': 'The user name of the caller; equivalent to `$context.identity.userName`.',\n '$identity.isAuthenticated': 'Whether the caller is authenticated.',\n '$identity.roles': 'The roles the caller holds.',\n '$identity.claims': 'The claims the caller carries — `$identity.claims.<name>` reads one.',\n '$context.identity': 'The caller a decision is made about — `id`, `name`, `userName`, `isAuthenticated`, `roles`, `claims`.',\n '$context.identity.id': 'The identifier of the caller from the auth token.',\n '$context.identity.name': 'The display name of the caller.',\n '$context.identity.userName': 'The user name of the caller.',\n '$context.identity.isAuthenticated': 'Whether the caller is authenticated.',\n '$context.identity.roles': 'The roles the caller holds.',\n '$context.identity.claims': 'The claims the caller carries — `$context.identity.claims.<name>` reads one.',\n '$env': 'An environment variable, e.g. `$env.SERVICE_NAME`.',\n '$secrets': 'An encrypted secret resolved at runtime, e.g. `$secrets.azureAdClientId` — stays symbolic in the compiled tree.',\n '$strings': 'A localized string resolved from the `.strings` file of the active locale, e.g. `$strings.invoices.title`.',\n // Every $eventContext path the event-context catalog lists, for projections.\n ...Object.fromEntries(eventContextPaths.map((path) => [`$eventContext.${path.path}`, path.description])),\n};\n\n// One-sentence descriptions of the `pii special` categories (GDPR Art. 9(1)) and `pii criminal` (Art. 10).\n// The same sentences appear in Documentation/screenplay/concepts.md.\nexport const specialCategoryDocs: Record<string, string> = {\n racialOrEthnicOrigin: 'Data revealing a person\\'s racial or ethnic origin (GDPR Art. 9(1)).',\n politicalOpinions: 'Data revealing a person\\'s political opinions (GDPR Art. 9(1)).',\n religiousOrPhilosophicalBeliefs: 'Data revealing a person\\'s religious or philosophical beliefs (GDPR Art. 9(1)).',\n tradeUnionMembership: 'Data revealing whether a person belongs to a trade union (GDPR Art. 9(1)).',\n genetic: 'Data about inherited or acquired genetic characteristics that gives unique information about a person\\'s physiology or health (GDPR Art. 9(1), Art. 4(13)).',\n biometric: 'Data from technical processing of physical, physiological or behavioral characteristics, special only when processed to uniquely identify a person (GDPR Art. 9(1), Art. 4(14)).',\n health: 'Data about a person\\'s physical or mental health, including health care services, that reveals their health status (GDPR Art. 9(1), Art. 4(15)).',\n sexLifeOrSexualOrientation: 'Data concerning a person\\'s sex life or sexual orientation (GDPR Art. 9(1)).'\n};\n"],"mappings":"2IAMA,MAAaA,EAAoB,CAC7B,eAAgB,qKAChB,KAAM,qHACV,EAEaC,EAAsC,CAC/C,UAAW,kKACX,KAAM,oIACN,QAAS,gTACT,OAAQ,2FACR,OAAQ,ggBACR,QAAS,iJACT,KAAM,uWACN,OAAQ,qIACR,SAAU,2LACV,WAAY,uIACZ,OAAQ,iGACR,QAAS,oMACT,MAAO,gKACP,SAAU,mFACV,UAAW,iFACX,SAAU,oEACV,UAAW,iFACX,UAAW,wDACX,SAAU,kFACV,UAAW,g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,qBAAsB,uEACtB,0BAA2B,uEAC3BC,UAAa,kOACb,eAAgB,0FAChB,iBAAkB,0EAClB,qBAAsB,2EACtB,4BAA6B,uCAC7B,kBAAmB,8BACnB,mBAAoB,uEACpB,oBAAqB,wGACrB,uBAAwB,oDACxB,yBAA0B,kCAC1B,6BAA8B,+BAC9B,oCAAqC,uCACrC,0BAA2B,8BAC3B,2BAA4B,+EAC5BC,KAAQ,qDACRC,SAAY,kHACZC,SAAY,6GAEZ,GAAG,OAAO,YAAYC,EAAkB,IAAK,GAAS,CAAC,iBAAiBC,EAAK,OAAQA,EAAK,WAAW,CAAC,CAAC,CAC3G,EAIaC,EAA8C,CACvD,qBAAsB,sEACtB,kBAAmB,iEACnB,gCAAiC,iFACjC,qBAAsB,6EACtB,QAAS,6JACT,UAAW,mLACX,OAAQ,kJACR,2BAA4B,6EAChC"}
@@ -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}const C=/* @__PURE__ */ new Set([`and`,`or`,`not`]),w=/^(?:(?:and|or|not)\s+|\()*[A-Z]\w*\)*(?:\s+(?:(?:and|or|not)\s+|\()*[A-Z]\w*\)*)*$/;function policyNames(e){return(e.match(/[A-Za-z_]\w*/g)??[]).filter(e=>!C.has(e))}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)),T={...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))}))},E=/* @__PURE__ */ new Set([...p(T),...p(g)]),D=new Set([...T.policies,...g.policies].map(e=>e.name)),O=validateDeclarations(s,T,g);O.push(...validateProductionDestinations(s,T));let k=/* @__PURE__ */ new Set([a.UnknownGenerationStrategy,a.InvalidGenerationArgument,a.InvalidGenerationModifier,a.DuplicateGenerationModifier,a.DuplicateGeneration,a.InvalidGenerationPrimitive,a.InvalidGenerationPrefix,a.InvalidGenerationAlphabet,a.InvalidTypeIdPrefix,a.GenerationSizeOutsideRange,a.ReservedSequenceGeneration,a.LowGenerationEntropy,a.LowGeneratedIdentifierEntropy,a.RefutedGeneratedConceptRule,a.UnprovenGeneratedConceptRule,a.GenerationSupportBudgetExceeded,a.EmptyGenerationSupport]),A=/* @__PURE__ */ new Set([a.MixedEnumerationNumbering,a.DuplicateEnumerationNumber,a.EnumerationNumberOutsideInt32,a.MalformedEnumerationNumber,a.UnpinnedStoredEnumeration]),j=/* @__PURE__ */ new Set([a.LegacyOptionalSuffix,a.InvalidOptionalModifierOrder,a.OptionalReadsNotSupported]),M=/* @__PURE__ */ new Set([a.UnexpectedTokenInPolicyCondition,a.ExpectedPolicyCondition,a.UnclosedPolicyConditionGroup,a.ExpectedRoleName,a.ExpectedClaimName,a.ExpectedClaimMatches,a.ExpectedClaimMatchTarget,a.AnonymousPolicyCombined,a.NegatedAnonymousPolicy]),N=/* @__PURE__ */ new Set([a.UnknownEvent,a.UnknownReadModelProperty,a.PiiNotSupportedOnIdentifier]),P=/* @__PURE__ */ new Set([a.EventFromLaterSlice,a.TimelineCycleGroup]),F=/* @__PURE__ */ new Set([a.UndeclaredDependency,a.UnusedDependencyDeclaration,a.InvalidDependencyTarget,a.RepeatedDependencyDeclaration,a.MutualDependencyDeclarations,a.AmbiguousReference]),I=/* @__PURE__ */ new Set([a.InvalidSpecificationInvocation,a.InvalidActionSubjectClause,a.InferredActionSubject,a.ChangedActionSubject,a.AmbiguousActionInputBinding,a.UnsupportedActionSubjectContext,a.InvalidTimeZoneDeclaration,a.InvalidCommandCalendar,a.InvalidSpecificationTimeZone,a.InvalidCommandReadsDeclaration,a.UnknownMatchPattern,a.InvalidMatchPattern,a.PatternOutsidePortableMatchDialect,a.AmbiguousMatchPattern,a.DeprecatedStudioTextRulePattern,a.MismatchedSpecificationQueryResult,a.DirectionlessTranslationReactsToOwnCapture,a.CaptureEventsFromSeveralOrigins,a.CaptureEventsKeyNotRequired,a.CaptureEventsRecordFixture,a.CaptureEventSourceKeyOutsideEvents,a.EventIdPinNotCarriedToRenderers,a.ResponseNameUsedOnFailure,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,a.InvalidReactionBatchesDeclaration,a.DescribedCommandNotImplemented,a.DescribedCommandWithoutProductions,a.DescribedCommandCardinalityNotAdmitted,a.CommandHandlerRequiresAttachment,a.PendingIntentWithOtherHandler,a.DuplicateEventInProjectionScope,a.ReservedStoredName,a.ContextSourcedPerformedQueryArgument]),L=/* @__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]),R=/* @__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(!(e.code===a.DuplicateDeclaration&&e.message.startsWith(`Duplicate declaration of policy `))&&!t&&!n&&!k.has(e.code)&&!A.has(e.code)&&!L.has(e.code)&&!j.has(e.code)&&!M.has(e.code)&&!N.has(e.code)&&!P.has(e.code)&&!F.has(e.code)&&!I.has(e.code)&&e.code!==a.ReducerIdentityMismatch&&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$|^PLAY062[1-9]$|^PLAY063[0-9]$|^PLAY064[0-9]$|^PLAY065[0-2]$|^PLAY065[4-6]$|^PLAY066[0-6]$|^PLAY072[0-2]$/.test(e.code))continue;let r=e.location.line-1;if(e.code===a.OmittedProductionDestination&&O.some(t=>t.code===e.code&&t.line===r))continue;if(e.code===a.UnknownEvent){if(R.has(r))continue;R.add(r)}let i=o(s[r],e)||s[r].length-e.location.column+1;O.push(issue(e.severity,r,e.location.column,i,e.message,e.code))}let checkEvent=(e,t,n)=>{!E.has(n)&&!R.has(e)&&O.push(tokenIssue(`warning`,e,t,n,`Unknown event type '${n}' — declare it in a slice or import it.`,y.unknownEvent))},z=-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&&O.push(issue(`warning`,a,u[0].length-u[1].length+1,u[1].length,`Screenplay is indentation-based — use spaces, not tabs.`,y.tabIndentation)),z>=0){if(l(o)>z&&w.test(c)){for(let e of policyNames(c))D.has(e)||O.push(tokenIssue(`warning`,a,o,e,`Unknown policy '${e}' — declare it with 'policy ${e}'.`,y.unknownPolicy));continue}z=-1}let f=validateImport(s,d,a);f&&O.push(f);let p=c.match(/^slice\s+(\w+)/);p&&!i.includes(p[1])&&O.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])&&O.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){z=l(o);for(let e of policyNames(h[1]))D.has(e)||O.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)||O.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])?O.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])&&O.push(tokenIssue(`warning`,a,o,r,`Unknown $context.identity property '${i[1]}' — expected ${n.join(`, `)}.`,y.unknownContextIdentityProperty)):O.push(tokenIssue(`warning`,a,o,r,`Unknown $context path '${i.join(`.`)}' — expected one of ${t.join(`, `)}.`,y.unknownContextPath))}}O.push(...validateEventContextPaths(s,d)),O.push(...b(s,T,g,S.operationProductionLines));let B=s.map((e,t)=>({line:e,index:t})).filter(({line:e})=>/^\s*```(?:[a-z]+)?\s*$/.test(e));if(B.length%2==1){let e=B[B.length-1];O.push(issue(`error`,e.index,1,e.line.length+1,"Unclosed inline code block — expected a closing ``` line.",y.unclosedCodeBlock))}return O}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 T=/^(?:(?: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(T)?.[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)),T={...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))}))},E=/* @__PURE__ */ new Set([...p(T),...p(g)]),D=new Set([...T.policies,...g.policies].map(e=>e.name)),O=validateDeclarations(s,T,g);O.push(...validateProductionDestinations(s,T));let k=/* @__PURE__ */ new Set([a.UnknownGenerationStrategy,a.InvalidGenerationArgument,a.InvalidGenerationModifier,a.DuplicateGenerationModifier,a.DuplicateGeneration,a.InvalidGenerationPrimitive,a.InvalidGenerationPrefix,a.InvalidGenerationAlphabet,a.InvalidTypeIdPrefix,a.GenerationSizeOutsideRange,a.ReservedSequenceGeneration,a.LowGenerationEntropy,a.LowGeneratedIdentifierEntropy,a.RefutedGeneratedConceptRule,a.UnprovenGeneratedConceptRule,a.GenerationSupportBudgetExceeded,a.EmptyGenerationSupport]),A=/* @__PURE__ */ new Set([a.MixedEnumerationNumbering,a.DuplicateEnumerationNumber,a.EnumerationNumberOutsideInt32,a.MalformedEnumerationNumber,a.UnpinnedStoredEnumeration]),j=/* @__PURE__ */ new Set([a.LegacyOptionalSuffix,a.InvalidOptionalModifierOrder,a.OptionalReadsNotSupported]),M=/* @__PURE__ */ new Set([a.UnexpectedTokenInPolicyCondition,a.ExpectedPolicyCondition,a.UnclosedPolicyConditionGroup,a.ExpectedRoleName,a.ExpectedClaimName,a.ExpectedClaimMatches,a.ExpectedClaimMatchTarget,a.AnonymousPolicyCombined,a.NegatedAnonymousPolicy]),N=/* @__PURE__ */ new Set([a.UnknownEvent,a.UnknownReadModelProperty,a.PiiNotSupportedOnIdentifier]),P=/* @__PURE__ */ new Set([a.EventFromLaterSlice,a.TimelineCycleGroup]),F=/* @__PURE__ */ new Set([a.UndeclaredDependency,a.UnusedDependencyDeclaration,a.InvalidDependencyTarget,a.RepeatedDependencyDeclaration,a.MutualDependencyDeclarations,a.AmbiguousReference]),I=/* @__PURE__ */ new Set([a.InvalidSpecificationInvocation,a.InvalidActionSubjectClause,a.InferredActionSubject,a.ChangedActionSubject,a.AmbiguousActionInputBinding,a.UnsupportedActionSubjectContext,a.InvalidTimeZoneDeclaration,a.InvalidCommandCalendar,a.InvalidSpecificationTimeZone,a.InvalidCommandReadsDeclaration,a.UnknownMatchPattern,a.InvalidMatchPattern,a.PatternOutsidePortableMatchDialect,a.AmbiguousMatchPattern,a.DeprecatedStudioTextRulePattern,a.MismatchedSpecificationQueryResult,a.DirectionlessTranslationReactsToOwnCapture,a.CaptureEventsFromSeveralOrigins,a.CaptureEventsKeyNotRequired,a.CaptureEventsRecordFixture,a.CaptureEventSourceKeyOutsideEvents,a.EventIdPinNotCarriedToRenderers,a.ResponseNameUsedOnFailure,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,a.InvalidReactionBatchesDeclaration,a.DescribedCommandNotImplemented,a.DescribedCommandWithoutProductions,a.DescribedCommandCardinalityNotAdmitted,a.CommandHandlerRequiresAttachment,a.PendingIntentWithOtherHandler,a.DuplicateEventInProjectionScope,a.ReservedStoredName,a.ContextSourcedPerformedQueryArgument]),L=/* @__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]),R=/* @__PURE__ */ new Set,z=/* @__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.InvalidSemanticBinding&&e.message.startsWith(`Read model '`)&&e.message.includes(`' references unsupported type '`);n&&z.add(e.location.line-1);let r=e.code===a.RepeatedSingularDeclarationAcrossFiles&&e.message.includes(`identity block`);if(!(e.code===a.DuplicateDeclaration&&e.message.startsWith(`Duplicate declaration of policy `))&&!t&&!n&&!r&&!k.has(e.code)&&!A.has(e.code)&&!L.has(e.code)&&!j.has(e.code)&&!M.has(e.code)&&!N.has(e.code)&&!P.has(e.code)&&!F.has(e.code)&&!I.has(e.code)&&e.code!==a.ReducerIdentityMismatch&&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$|^PLAY062[1-9]$|^PLAY063[0-9]$|^PLAY064[0-9]$|^PLAY065[0-2]$|^PLAY065[4-6]$|^PLAY066[0-6]$|^PLAY072[0-2]$/.test(e.code))continue;let i=e.location.line-1;if(e.code===a.OmittedProductionDestination&&O.some(t=>t.code===e.code&&t.line===i))continue;if(e.code===a.UnknownEvent){if(R.has(i))continue;R.add(i)}let c=o(s[i],e)||s[i].length-e.location.column+1;O.push(issue(e.severity,i,e.location.column,c,e.message,e.code))}let checkEvent=(e,t,n)=>{!E.has(n)&&!R.has(e)&&O.push(tokenIssue(`warning`,e,t,n,`Unknown event type '${n}' — declare it in a slice or import it.`,y.unknownEvent))},B=-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&&O.push(issue(`warning`,a,u[0].length-u[1].length+1,u[1].length,`Screenplay is indentation-based — use spaces, not tabs.`,y.tabIndentation)),B>=0){if(l(o)>B&&w.test(c)){for(let e of policyNames(c))D.has(e)||O.push(tokenIssue(`warning`,a,o,e,`Unknown policy '${e}' — declare it with 'policy ${e}'.`,y.unknownPolicy));continue}B=-1}let f=validateImport(s,d,a);f&&O.push(f);let p=c.match(/^slice\s+(\w+)/);p&&!i.includes(p[1])&&O.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])&&O.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){B=l(o);for(let e of policyNames(h[1]))D.has(e)||O.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)||O.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])?O.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])&&O.push(tokenIssue(`warning`,a,o,r,`Unknown $context.identity property '${i[1]}' — expected ${n.join(`, `)}.`,y.unknownContextIdentityProperty)):O.push(tokenIssue(`warning`,a,o,r,`Unknown $context path '${i.join(`.`)}' — expected one of ${t.join(`, `)}.`,y.unknownContextPath))}}O.push(...validateEventContextPaths(s,d)),O.push(...b(s,T,g,S.operationProductionLines));let V=s.map((e,t)=>({line:e,index:t})).filter(({line:e})=>/^\s*```(?:[a-z]+)?\s*$/.test(e));if(V.length%2==1){let e=V[V.length-1];O.push(issue(`error`,e.index,1,e.line.length+1,"Unclosed inline code block — expected a closing ``` line.",y.unclosedCodeBlock))}return O.filter(e=>e.code!==y.unknownType||!z.has(e.line))}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 T=/^(?:(?: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(T)?.[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","policyOperators","policyContinuation","expression","fences","fenceMap","scanned","scanDocument","context","mergeSymbols","input","symbolsForBuffer","analysis","responseAnalysis","source","routeLines","route","production","events","knownEventNames","policies","policy","generationCodes","DiagnosticCodes","enumerationCodes","optionalCodes","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.\n// A policy expression joins policy names with `and` and `or`, groups them with parentheses, and may put `not` before a\n// name. Only the names are policies: the operators and the parentheses are not.\nconst policyOperators = new Set(['and', 'or', 'not']);\n\n// A line that continues an `authorize` expression: names, operators and parentheses, and nothing else.\nconst policyContinuation = /^(?:(?:and|or|not)\\s+|\\()*[A-Z]\\w*\\)*(?:\\s+(?:(?:and|or|not)\\s+|\\()*[A-Z]\\w*\\)*)*$/;\n\nfunction policyNames(expression: string): string[] {\n return (expression.match(/[A-Za-z_]\\w*/g) ?? []).filter((token) => !policyOperators.has(token));\n}\n\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 generationCodes = new Set<string>([DiagnosticCodes.UnknownGenerationStrategy, DiagnosticCodes.InvalidGenerationArgument, DiagnosticCodes.InvalidGenerationModifier, DiagnosticCodes.DuplicateGenerationModifier, DiagnosticCodes.DuplicateGeneration, DiagnosticCodes.InvalidGenerationPrimitive, DiagnosticCodes.InvalidGenerationPrefix, DiagnosticCodes.InvalidGenerationAlphabet, DiagnosticCodes.InvalidTypeIdPrefix, DiagnosticCodes.GenerationSizeOutsideRange, DiagnosticCodes.ReservedSequenceGeneration, DiagnosticCodes.LowGenerationEntropy, DiagnosticCodes.LowGeneratedIdentifierEntropy, DiagnosticCodes.RefutedGeneratedConceptRule, DiagnosticCodes.UnprovenGeneratedConceptRule, DiagnosticCodes.GenerationSupportBudgetExceeded, DiagnosticCodes.EmptyGenerationSupport]);\n const enumerationCodes = new Set<string>([DiagnosticCodes.MixedEnumerationNumbering, DiagnosticCodes.DuplicateEnumerationNumber, DiagnosticCodes.EnumerationNumberOutsideInt32, DiagnosticCodes.MalformedEnumerationNumber, DiagnosticCodes.UnpinnedStoredEnumeration]);\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, DiagnosticCodes.AnonymousPolicyCombined, DiagnosticCodes.NegatedAnonymousPolicy]);\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.InvalidSpecificationInvocation, DiagnosticCodes.InvalidActionSubjectClause, DiagnosticCodes.InferredActionSubject, DiagnosticCodes.ChangedActionSubject, DiagnosticCodes.AmbiguousActionInputBinding, DiagnosticCodes.UnsupportedActionSubjectContext, DiagnosticCodes.InvalidTimeZoneDeclaration, DiagnosticCodes.InvalidCommandCalendar, DiagnosticCodes.InvalidSpecificationTimeZone, DiagnosticCodes.InvalidCommandReadsDeclaration, DiagnosticCodes.UnknownMatchPattern, DiagnosticCodes.InvalidMatchPattern, DiagnosticCodes.PatternOutsidePortableMatchDialect, DiagnosticCodes.AmbiguousMatchPattern, DiagnosticCodes.DeprecatedStudioTextRulePattern, DiagnosticCodes.MismatchedSpecificationQueryResult, DiagnosticCodes.DirectionlessTranslationReactsToOwnCapture, DiagnosticCodes.CaptureEventsFromSeveralOrigins, DiagnosticCodes.CaptureEventsKeyNotRequired, DiagnosticCodes.CaptureEventsRecordFixture, DiagnosticCodes.CaptureEventSourceKeyOutsideEvents, DiagnosticCodes.EventIdPinNotCarriedToRenderers, DiagnosticCodes.ResponseNameUsedOnFailure, 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, DiagnosticCodes.InvalidReactionBatchesDeclaration, DiagnosticCodes.DescribedCommandNotImplemented, DiagnosticCodes.DescribedCommandWithoutProductions, DiagnosticCodes.DescribedCommandCardinalityNotAdmitted, DiagnosticCodes.CommandHandlerRequiresAttachment, DiagnosticCodes.PendingIntentWithOtherHandler, DiagnosticCodes.DuplicateEventInProjectionScope, DiagnosticCodes.ReservedStoredName, DiagnosticCodes.ContextSourcedPerformedQueryArgument]);\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 const policyDuplicate = diagnostic.code === DiagnosticCodes.DuplicateDeclaration && diagnostic.message.startsWith('Duplicate declaration of policy ');\n if (!policyDuplicate && !identityType && !identityDuplicate && !generationCodes.has(diagnostic.code) && !enumerationCodes.has(diagnostic.code) && !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.ReducerIdentityMismatch && 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$|^PLAY062[1-9]$|^PLAY063[0-9]$|^PLAY064[0-9]$|^PLAY065[0-2]$|^PLAY065[4-6]$|^PLAY066[0-6]$|^PLAY072[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 policyContinuation.test(trimmed)\n ) {\n for (const name of policyNames(trimmed)) {\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 policyNames(authorize[1])) {\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,CAEf,OAAO,MAAMC,EAAUC,EADRC,EAAK,QAAQC,CAAK,EAAI,EACAA,EAAM,OAAQC,EAASC,CAAI,CACpE,CAIA,SAAS,qBAAqB,EAAiB,EAA0B,EAAiD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O,KAAK,MAAM,UAAW8D,EAAOmC,EAAQpG,EAAM,OAAQ,iCAAiCmG,EAAW,QAAQ,sBAAsBpB,EAAK,sBAAsB,MAAMoB,EAAW,QAAQ,EAAE,GAAIpF,EAAgB,yBAAyB,CAAC,EACxO,MACJ,IAAK,iBAAkB,CACnB,IAAMsF,EAAMF,EAAW,SAAS,SAAW,EAAI,wBAA0B,WAAW,MAAMA,EAAW,QAAQ,IAC7GhG,EAAO,KAAK,MAAM,UAAW8D,EAAOmC,EAAQpG,EAAM,OAAQ,6CAA6C+E,EAAK,OAAOoB,EAAW,QAAQ,KAAK,KAAKA,EAAW,QAAQ,KAAK,QAAQE,EAAI,GAAItF,EAAgB,uBAAuB,CAAC,EAChO,KACJ,CACA,IAAK,kBACDZ,EAAO,KAAK,MAAM,QAAS8D,EAAOmC,EAAQpG,EAAM,OAAQ,kBAAkB+E,EAAK,sBAAsBoB,EAAW,QAAQ,KAAK,qBAAqBA,EAAW,QAAQ,KAAK,kCAAmCpF,EAAgB,+BAA+B,CAAC,CAErQ,CACJ,CAGA,IAAMuF,EAASxG,EAAK,KAAK,CAAC,CAAC,MAAMgG,CAAa,CAAC,GAAG,GAC5CxD,EAASgE,GAAQ,MAAM,WAAW,CAAC,GAAG,GACxCA,GAAUhE,GAAUA,IAAW,gBAC/BnC,EAAO,KAAK,WAAW,UAAW8D,EAAOnE,EAAMwG,EAAQ,4BAA4BhE,EAAO,QAAQgE,EAAO,8EAA8EhE,EAAO,oBAAqBvB,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","policyOperators","policyContinuation","expression","fences","fenceMap","scanned","scanDocument","context","mergeSymbols","input","symbolsForBuffer","analysis","responseAnalysis","source","routeLines","route","production","events","knownEventNames","policies","policy","generationCodes","DiagnosticCodes","enumerationCodes","optionalCodes","policyCodes","consistencyCodes","timelineCodes","dependencyCodes","authoringCodes","complianceCodes","compilerUnknownEventLines","compilerMemberTypeLines","diagnostic","identityType","detail","memberType","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","issue","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.\n// A policy expression joins policy names with `and` and `or`, groups them with parentheses, and may put `not` before a\n// name. Only the names are policies: the operators and the parentheses are not.\nconst policyOperators = new Set(['and', 'or', 'not']);\n\n// A line that continues an `authorize` expression: names, operators and parentheses, and nothing else.\nconst policyContinuation = /^(?:(?:and|or|not)\\s+|\\()*[A-Z]\\w*\\)*(?:\\s+(?:(?:and|or|not)\\s+|\\()*[A-Z]\\w*\\)*)*$/;\n\nfunction policyNames(expression: string): string[] {\n return (expression.match(/[A-Za-z_]\\w*/g) ?? []).filter((token) => !policyOperators.has(token));\n}\n\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 generationCodes = new Set<string>([DiagnosticCodes.UnknownGenerationStrategy, DiagnosticCodes.InvalidGenerationArgument, DiagnosticCodes.InvalidGenerationModifier, DiagnosticCodes.DuplicateGenerationModifier, DiagnosticCodes.DuplicateGeneration, DiagnosticCodes.InvalidGenerationPrimitive, DiagnosticCodes.InvalidGenerationPrefix, DiagnosticCodes.InvalidGenerationAlphabet, DiagnosticCodes.InvalidTypeIdPrefix, DiagnosticCodes.GenerationSizeOutsideRange, DiagnosticCodes.ReservedSequenceGeneration, DiagnosticCodes.LowGenerationEntropy, DiagnosticCodes.LowGeneratedIdentifierEntropy, DiagnosticCodes.RefutedGeneratedConceptRule, DiagnosticCodes.UnprovenGeneratedConceptRule, DiagnosticCodes.GenerationSupportBudgetExceeded, DiagnosticCodes.EmptyGenerationSupport]);\n const enumerationCodes = new Set<string>([DiagnosticCodes.MixedEnumerationNumbering, DiagnosticCodes.DuplicateEnumerationNumber, DiagnosticCodes.EnumerationNumberOutsideInt32, DiagnosticCodes.MalformedEnumerationNumber, DiagnosticCodes.UnpinnedStoredEnumeration]);\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, DiagnosticCodes.AnonymousPolicyCombined, DiagnosticCodes.NegatedAnonymousPolicy]);\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.InvalidSpecificationInvocation, DiagnosticCodes.InvalidActionSubjectClause, DiagnosticCodes.InferredActionSubject, DiagnosticCodes.ChangedActionSubject, DiagnosticCodes.AmbiguousActionInputBinding, DiagnosticCodes.UnsupportedActionSubjectContext, DiagnosticCodes.InvalidTimeZoneDeclaration, DiagnosticCodes.InvalidCommandCalendar, DiagnosticCodes.InvalidSpecificationTimeZone, DiagnosticCodes.InvalidCommandReadsDeclaration, DiagnosticCodes.UnknownMatchPattern, DiagnosticCodes.InvalidMatchPattern, DiagnosticCodes.PatternOutsidePortableMatchDialect, DiagnosticCodes.AmbiguousMatchPattern, DiagnosticCodes.DeprecatedStudioTextRulePattern, DiagnosticCodes.MismatchedSpecificationQueryResult, DiagnosticCodes.DirectionlessTranslationReactsToOwnCapture, DiagnosticCodes.CaptureEventsFromSeveralOrigins, DiagnosticCodes.CaptureEventsKeyNotRequired, DiagnosticCodes.CaptureEventsRecordFixture, DiagnosticCodes.CaptureEventSourceKeyOutsideEvents, DiagnosticCodes.EventIdPinNotCarriedToRenderers, DiagnosticCodes.ResponseNameUsedOnFailure, 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, DiagnosticCodes.InvalidReactionBatchesDeclaration, DiagnosticCodes.DescribedCommandNotImplemented, DiagnosticCodes.DescribedCommandWithoutProductions, DiagnosticCodes.DescribedCommandCardinalityNotAdmitted, DiagnosticCodes.CommandHandlerRequiresAttachment, DiagnosticCodes.PendingIntentWithOtherHandler, DiagnosticCodes.DuplicateEventInProjectionScope, DiagnosticCodes.ReservedStoredName, DiagnosticCodes.ContextSourcedPerformedQueryArgument]);\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 const compilerMemberTypeLines = 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 memberType = diagnostic.code === DiagnosticCodes.InvalidSemanticBinding && diagnostic.message.startsWith(\"Read model '\") && diagnostic.message.includes(\"' references unsupported type '\");\n if (memberType) compilerMemberTypeLines.add(diagnostic.location.line - 1);\n const identityDuplicate = diagnostic.code === DiagnosticCodes.RepeatedSingularDeclarationAcrossFiles && diagnostic.message.includes('identity block');\n const policyDuplicate = diagnostic.code === DiagnosticCodes.DuplicateDeclaration && diagnostic.message.startsWith('Duplicate declaration of policy ');\n if (!policyDuplicate && !identityType && !memberType && !identityDuplicate && !generationCodes.has(diagnostic.code) && !enumerationCodes.has(diagnostic.code) && !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.ReducerIdentityMismatch && 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$|^PLAY062[1-9]$|^PLAY063[0-9]$|^PLAY064[0-9]$|^PLAY065[0-2]$|^PLAY065[4-6]$|^PLAY066[0-6]$|^PLAY072[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 policyContinuation.test(trimmed)\n ) {\n for (const name of policyNames(trimmed)) {\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 policyNames(authorize[1])) {\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.filter(issue => issue.code !== diagnosticCodes.unknownType || !compilerMemberTypeLines.has(issue.line));\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,S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,CAGA,IAAM0F,EAAS3G,EAAK,KAAK,CAAC,CAAC,MAAMmG,CAAa,CAAC,GAAG,GAC5C3D,EAASmE,GAAQ,MAAM,WAAW,CAAC,GAAG,GACxCA,GAAUnE,GAAUA,IAAW,gBAC/BnC,EAAO,KAAK,WAAW,UAAWgE,EAAOrE,EAAM2G,EAAQ,4BAA4BnE,EAAO,QAAQmE,EAAO,8EAA8EnE,EAAO,oBAAqBvB,EAAgB,0BAA0B,CAAC,CAEtQ,CAEA,OAAOZ,CACX"}
@@ -1,4 +1,5 @@
1
1
  export declare const diagnosticCodes: {
2
+ readonly invalidSemanticBinding: "PLAY0273";
2
3
  readonly unknownMatchPattern: "PLAY0366";
3
4
  readonly invalidMatchPattern: "PLAY0367";
4
5
  readonly patternOutsidePortableMatchDialect: "PLAY0699";
@@ -1 +1 @@
1
- {"version":3,"file":"diagnostic-codes.d.ts","sourceRoot":"","sources":["../diagnostic-codes.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgRlB,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAM,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,eAAe,EAAE,CAiD/F"}
1
+ {"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../validation.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,kBAAkB,EAAoB,MAAM,qBAAqB,CAAC;AAG3E,OAAO,EAAE,cAAc,EAAmB,MAAM,oBAAoB,CAAC;AAIrE,OAAO,EACH,eAAe,EAQlB,MAAM,WAAW,CAAC;AAGnB,MAAM,MAAM,kBAAkB,GAAG,OAAO,GAAG,SAAS,GAAG,aAAa,CAAC;AAErE,MAAM,WAAW,eAAe;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,kBAAkB,CAAC;IAI7B,IAAI,CAAC,EAAE,cAAc,CAAC;CACzB;AAGD,MAAM,WAAW,iBAAiB;IAI9B,WAAW,CAAC,EAAE,eAAe,CAAC;IAC9B,SAAS,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,mBAAmB,CAAC,EAAE,SAAS,kBAAkB,EAAE,CAAC;CACvD;AA8GD,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,OAAO,GAAE,iBAAsB,GAAG,eAAe,EAAE,CAyQjG;AA2CD,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,eAAe,EAAE,CAiD/F"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cratis/screenplay-language",
3
- "version": "4.254.0",
3
+ "version": "4.256.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",