@cratis/screenplay-language 4.241.0 → 4.243.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundles/compiler/Diagnostics/DiagnosticCodes.js +1 -1
- package/dist/bundles/compiler/Diagnostics/DiagnosticCodes.js.map +1 -1
- package/dist/bundles/compiler/Files/PlayFolderMerge.js +1 -1
- package/dist/bundles/compiler/Files/PlayFolderMerge.js.map +1 -1
- package/dist/bundles/compiler/Parsing/CaptureEventFixturesValidator.js +1 -1
- package/dist/bundles/compiler/Parsing/CaptureEventFixturesValidator.js.map +1 -1
- package/dist/bundles/compiler/Parsing/CaptureParser.js +1 -1
- package/dist/bundles/compiler/Parsing/CaptureParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/ClockOperandParser.js +2 -0
- package/dist/bundles/compiler/Parsing/ClockOperandParser.js.map +1 -0
- package/dist/bundles/compiler/Parsing/CommandParser.js +1 -1
- package/dist/bundles/compiler/Parsing/CommandParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/ConditionParser.js +1 -1
- package/dist/bundles/compiler/Parsing/ConditionParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/PublicEventUsageValidator.js +1 -1
- package/dist/bundles/compiler/Parsing/PublicEventUsageValidator.js.map +1 -1
- package/dist/bundles/compiler/Parsing/ScreenplayParser.js +1 -1
- package/dist/bundles/compiler/Parsing/ScreenplayParser.js.map +1 -1
- package/dist/bundles/compiler/Parsing/SpecificationParser.js +1 -1
- package/dist/bundles/compiler/Parsing/SpecificationParser.js.map +1 -1
- package/dist/bundles/compiler/Syntax/ScreenplaySyntaxWalker.js +1 -1
- package/dist/bundles/compiler/Syntax/ScreenplaySyntaxWalker.js.map +1 -1
- package/dist/bundles/compiler/Syntax/Structure.js.map +1 -1
- package/dist/bundles/compiler/Syntax/SyntaxCollections.js +1 -1
- package/dist/bundles/compiler/Syntax/SyntaxCollections.js.map +1 -1
- package/dist/bundles/compiler/Syntax/SyntaxJson.js +1 -1
- package/dist/bundles/compiler/Syntax/SyntaxJson.js.map +1 -1
- package/dist/bundles/completion-items.js +3 -3
- package/dist/bundles/completion-items.js.map +1 -1
- package/dist/bundles/diagnostic-codes.js +1 -1
- package/dist/bundles/diagnostic-codes.js.map +1 -1
- package/dist/bundles/example-analysis.js +1 -1
- package/dist/bundles/example-analysis.js.map +1 -1
- package/dist/bundles/keyword-docs.js +1 -1
- package/dist/bundles/keyword-docs.js.map +1 -1
- package/dist/bundles/language.js +1 -1
- package/dist/bundles/language.js.map +1 -1
- package/dist/bundles/response-analysis.js +2 -2
- package/dist/bundles/response-analysis.js.map +1 -1
- package/dist/bundles/sub-languages/cdl.js +1 -1
- package/dist/bundles/sub-languages/cdl.js.map +1 -1
- package/dist/bundles/tokens.js +1 -1
- package/dist/bundles/tokens.js.map +1 -1
- package/dist/bundles/validation.js +1 -1
- package/dist/bundles/validation.js.map +1 -1
- package/dist/completion-items.d.ts.map +1 -1
- package/dist/diagnostic-codes.d.ts +4 -0
- package/dist/diagnostic-codes.d.ts.map +1 -1
- package/dist/keyword-docs.d.ts.map +1 -1
- package/dist/language.d.ts.map +1 -1
- package/dist/sub-languages/cdl.d.ts.map +1 -1
- package/dist/tokens.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import"./_virtual/_virtual/_rolldown/runtime.js";import{AuthoringProductionResolver as e}from"./compiler/Syntax/AuthoringProductionResolver.js";import{dependencySourcesOf as t}from"./compiler/Syntax/DependencySources.js";import{responseCommandResolver as n}from"./compiler/Parsing/ResponseCommandResolver.js";import{parseForAuthoring as r}from"./compiler/ScreenplayCompiler.js";import{EventSourceReadConfidence as i}from"./compiler/Syntax/EventSourceReadConfidence.js";import{parsePlacedDocuments as a}from"./compiler/Files/PlayApplicationAssembly.js";import"./compiler/index.js";import{fenceMap as o,indentOf as s,withoutComment as c}from"./document-context.js";import{exampleAnalysis as l}from"./example-analysis.js";import{personaAnalysis as u}from"./persona-analysis.js";import{dependencyTargetAnalysis as d}from"./dependency-target-analysis.js";const f=`Executable as ESM v7. Generated values require fixtures in reference execution; other unadmitted constructs still prevent binding.`,p=/* @__PURE__ */ new Map;function authoringSource(e,t){let n=o(e),r=e.flatMap((e,t)=>!n[t]&&s(e)===0&&/^\w/.test(e)&&!/^(?:reaction\s+batches\b|command\s+reads\s+(?!\/\/)\S+)/.test(e)?[e.split(/\s+/)[0]]:[]);if(r.includes(`module`)||!r.some(e=>[`feature`,`slice`,`command`,`event`,`operation`,`reaction`,`specification`].includes(e)))return{source:e.join(`
|
|
2
|
-
`),locations:e.map((e,t)=>({line:t+1,column:0}))};let i=[],a=[],c=!1;e.forEach((e,t)=>{!n[t]&&s(e)===0&&/^\w/.test(e)&&(c=/^(?:concept|type|import|domain|system|eventsource|policy|persona|identity|reaction\s+batches|command\s+reads(?=\s+(?!\/\/)\S))\b/.test(e)),(c?i:a).push(t)});let l=r.includes(`feature`)?1:r.includes(`slice`)?2:3,u=t.slice(0,l);return{source:[...i.map(t=>e[t]),...u,...a.map(t=>` `.repeat(l*2)+e[t])].join(`
|
|
1
|
+
import"./_virtual/_virtual/_rolldown/runtime.js";import{AuthoringProductionResolver as e}from"./compiler/Syntax/AuthoringProductionResolver.js";import{dependencySourcesOf as t}from"./compiler/Syntax/DependencySources.js";import{responseCommandResolver as n}from"./compiler/Parsing/ResponseCommandResolver.js";import{parseForAuthoring as r}from"./compiler/ScreenplayCompiler.js";import{EventSourceReadConfidence as i}from"./compiler/Syntax/EventSourceReadConfidence.js";import{parsePlacedDocuments as a}from"./compiler/Files/PlayApplicationAssembly.js";import"./compiler/index.js";import{fenceMap as o,indentOf as s,withoutComment as c}from"./document-context.js";import{exampleAnalysis as l}from"./example-analysis.js";import{personaAnalysis as u}from"./persona-analysis.js";import{dependencyTargetAnalysis as d}from"./dependency-target-analysis.js";const f=`Executable as ESM v7. Generated values require fixtures in reference execution; other unadmitted constructs still prevent binding.`,p=/* @__PURE__ */ new Map;function authoringSource(e,t){let n=o(e),r=e.flatMap((e,t)=>!n[t]&&s(e)===0&&/^\w/.test(e)&&!/^(?:time\s+zone\b|reaction\s+batches\b|command\s+reads\s+(?!\/\/)\S+)/.test(e)?[e.split(/\s+/)[0]]:[]);if(r.includes(`module`)||!r.some(e=>[`feature`,`slice`,`command`,`event`,`operation`,`reaction`,`specification`].includes(e)))return{source:e.join(`
|
|
2
|
+
`),locations:e.map((e,t)=>({line:t+1,column:0}))};let i=[],a=[],c=!1;e.forEach((e,t)=>{!n[t]&&s(e)===0&&/^\w/.test(e)&&(c=/^(?:concept|type|import|domain|system|eventsource|policy|persona|identity|time\s+zone|reaction\s+batches|command\s+reads(?=\s+(?!\/\/)\S))\b/.test(e)),(c?i:a).push(t)});let l=r.includes(`feature`)?1:r.includes(`slice`)?2:3,u=t.slice(0,l);return{source:[...i.map(t=>e[t]),...u,...a.map(t=>` `.repeat(l*2)+e[t])].join(`
|
|
3
3
|
`),locations:[...i.map(e=>({line:e+1,column:0})),...u.map(()=>({line:0,column:0})),...a.map(e=>({line:e+1,column:l*2}))]}}function analyze(f,p,m,h=`current.play`,g=!0){let _=p.map((e,t)=>typeof e==`string`?{path:`other-${t}.play`,source:e}:e).filter(e=>e.path!==h),v=[{path:h,source:f.join(`
|
|
4
4
|
`),placement:m,isPlacementResolved:g},..._],y=new Set(v.flatMap(e=>[...e.source.matchAll(/\w+/g)].map(e=>e[0]).concat(e.placement??[]))),fresh=e=>{let t=e;for(let n=1;y.has(t);n++)t=`${e}${n}`;return y.add(t),t},b=fresh(`EditorAuthoring`),x=fresh(`FragmentFeature`),S=/* @__PURE__ */ new Set([b,x]),C=v.map((e,t)=>{let n=t===0?f:e.source.split(`
|
|
5
5
|
`),r=fresh(`Fragment${t}`);S.add(r);let i=e.placement?.length?{source:e.source,locations:n.map((e,t)=>({line:t+1,column:0}))}:authoringSource(n,[`module ${b}`,` feature ${x}`,` slice StateChange ${r}`]);return{...e,...i,placement:e.placement??[]}}),w=C[0],ee=new Map(C.map(e=>[e.path,e.locations])),T=a([...C.slice(1),w],void 0,!0),E=/* @__PURE__ */ new Map,D=/* @__PURE__ */ new Map,O=/* @__PURE__ */ new WeakSet,walk=e=>{if(typeof e!=`object`||!e||O.has(e))return;if(O.add(e),Array.isArray(e)){e.forEach(walk);return}let t=e;if(typeof t.path==`string`&&typeof t.line==`number`&&typeof t.column==`number`){let e=ee.get(t.path)?.[t.line-1];e&&(t.line=e.line,t.column=Math.max(1,t.column-e.column))}else{for(let e of Object.values(t))walk(e);t.location?.path===h&&(t.kind===`CommandSyntax`&&E.set(t.location.line-1,e),t.kind===`SpecificationSyntax`&&D.set(t.location.line-1,e))}};walk(T.value),walk(T.physicalEventSources),walk(T.continuationValues);for(let e of T.diagnostics)walk(e.location);let k=T.diagnostics.some(e=>{if(![`PLAY0022`,`PLAY0024`,`PLAY0029`].includes(e.code))return!1;let t=C.find(t=>t.path===e.location.path),n=v.find(t=>t.path===e.location.path)?.source.split(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"response-analysis.js","names":["responseAvailability","revisions","fences","fenceMap","lines","roots","index","indentOf","line","root","globals","body","global","depth","wrappers","headers","others","otherSources","document","path","documents","names","match","name","prefix","suffix","module","feature","syntheticScopes","preparedDocuments","sourceLines","fragment","prepared","locations","parsed","parsePlacedDocuments","commands","specifications","visited","value","node","original","child","diagnostic","unknownFragmentExtent","location","diagnostics","productions","AuthoringProductionResolver","reducer","dependencySourcesOf","slice","operationProductionLines","command","reaction","trigger","production","declarations","declaration","segment","contexts","result","indent","start","withoutComment","specification","declarationScopes","operation","scope","declarationsByLocation","source","references","resolved","reference","context","step","operations","entry","part","sourceDeclarations","sourceCatalog","EventSourceReadConfidence","resolutions","key","stream","importedTypeReferences","imported","targets","sourceContexts","routes","member","commandSlices","observer","examples","exampleAnalysis","routeOwners","event","eventSources","candidate","dependencyAnalysis","dependencies","localDependencies","parseForAuthoring","dependencyTargetAnalysis","qualifier","placement","resolveCommand","responseCommandResolver","continuationResponses","use","fields","properties","property","response","returned","field","type","detail","personaAnalysis","isPlacementResolved","analysis"],"sources":["../../response-analysis.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 { AuthoringProductionKind, AuthoringProductionResolver, CommandSyntax, dependencySourcesOf, Diagnostic, EventSourceReadConfidence, FeatureSyntax, OperationSyntax, parseForAuthoring, parsePlacedDocuments, responseCommandResolver, SpecificationSyntax } from '@cratis/screenplay-compiler';\nimport { fenceMap, indentOf, withoutComment } from './document-context';\nimport { ResponseAnalysis } from './ResponseAnalysis';\nimport { ContinuationResponseField } from './ContinuationResponseField';\nimport { ExampleAnalysis } from './ExampleAnalysis';\nimport { exampleAnalysis } from './example-analysis';\nimport { personaAnalysis } from './persona-analysis';\nimport { dependencyTargetAnalysis } from './dependency-target-analysis';\nimport { EventSourceAnalysis } from './EventSourceAnalysis';\nimport { AuthoredCommandRoute } from './AuthoredCommandRoute';\nimport { AuthoredReadModelKeys } from './AuthoredReadModelKeys';\nimport { AuthoringDocument } from './AuthoringDocument';\nimport { OperationAnalysis, OperationDeclaration, OperationReference } from './OperationAnalysis';\n\n// Public editor shapes are structural: packed declarations never expose the private compiler.\nexport type { AuthoringDocument } from './AuthoringDocument';\nexport type { AnalysisLocation } from './AnalysisLocation';\nexport type { AnalysisDiagnostic } from './AnalysisDiagnostic';\nexport type { AnalysisType } from './AnalysisType';\nexport type { AnalysisCommand } from './AnalysisCommand';\nexport type { AnalysisSpecification } from './AnalysisSpecification';\nexport type { CommandResponseSymbol } from './CommandResponseSymbol';\nexport type { ResponseFieldSymbol } from './ResponseFieldSymbol';\nexport type { ResponseSourceSymbol } from './ResponseSourceSymbol';\nexport type { ResponseAnalysis } from './ResponseAnalysis';\n\nexport const responseAvailability = 'Executable as ESM v7. Generated values require fixtures in reference execution; other unadmitted constructs still prevent binding.';\n\n// A bounded revision cache shared by symbols, validation, completion and hover. Index typed nodes\n// once, not by reparsing the document for each command or response field.\nconst revisions = new Map<string, ReturnType<typeof analyze>>();\n\nfunction authoringSource(lines: string[], headers: readonly string[]) {\n const fences = fenceMap(lines);\n const roots = lines.flatMap((line, index) => !fences[index] && indentOf(line) === 0 && /^\\w/.test(line) && !/^(?:reaction\\s+batches\\b|command\\s+reads\\s+(?!\\/\\/)\\S+)/.test(line) ? [line.split(/\\s+/)[0]] : []);\n if (roots.includes('module') || !roots.some(root => ['feature', 'slice', 'command', 'event', 'operation', 'reaction', 'specification'].includes(root))) {\n return { source: lines.join('\\n'), locations: lines.map((_, index) => ({ line: index + 1, column: 0 })) };\n }\n // Isolated slice/command fragments are a supported editor input. Global declarations stay global.\n const globals: number[] = [];\n const body: number[] = [];\n let global = false;\n lines.forEach((line, index) => {\n if (!fences[index] && indentOf(line) === 0 && /^\\w/.test(line)) global = /^(?:concept|type|import|domain|system|eventsource|policy|persona|identity|reaction\\s+batches|command\\s+reads(?=\\s+(?!\\/\\/)\\S))\\b/.test(line);\n (global ? globals : body).push(index);\n });\n const depth = roots.includes('feature') ? 1 : roots.includes('slice') ? 2 : 3;\n const wrappers = headers.slice(0, depth);\n const source = [...globals.map(index => lines[index]), ...wrappers, ...body.map(index => ' '.repeat(depth * 2) + lines[index])].join('\\n');\n const locations = [...globals.map(index => ({ line: index + 1, column: 0 })), ...wrappers.map(() => ({ line: 0, column: 0 })), ...body.map(index => ({ line: index + 1, column: depth * 2 }))];\n return { source, locations };\n}\n\nfunction analyze(lines: string[], otherSources: readonly (string | AuthoringDocument)[], placement?: readonly string[], path = 'current.play', isPlacementResolved = true): ResponseAnalysis & { readonly operations: OperationAnalysis; readonly eventSources: EventSourceAnalysis; readonly readModels: readonly AuthoredReadModelKeys[]; readonly examples: ExampleAnalysis; readonly personas: ReturnType<typeof personaAnalysis>; readonly dependencies: ReturnType<typeof dependencyTargetAnalysis> } {\n const others = otherSources.map((document, index) => typeof document === 'string' ? { path: `other-${index}.play`, source: document } : document).filter(document => document.path !== path);\n const documents: AuthoringDocument[] = [{ path, source: lines.join('\\n'), placement, isPlacementResolved }, ...others];\n // Modules/features merge, but slices are real declarations: equal slice names discard later\n // documents. Share only fresh synthetic module/feature names, with a distinct synthetic slice\n // per fragment. This retains all commands for normal (including ambiguous) scope resolution,\n // without combining source texts or renaming real declarations/explicit placements. Reserve\n // source/placement names once so even a real Editor.Authoring.Fragment cannot collide.\n const names = new Set(documents.flatMap(document => [...document.source.matchAll(/\\w+/g)].map(match => match[0]).concat(document.placement ?? [])));\n const fresh = (prefix: string): string => {\n let name = prefix;\n for (let suffix = 1; names.has(name); suffix++) name = `${prefix}${suffix}`;\n names.add(name);\n return name;\n };\n const module = fresh('EditorAuthoring');\n const feature = fresh('FragmentFeature');\n const syntheticScopes = new Set([module, feature]);\n const preparedDocuments = documents.map((document, index) => {\n const sourceLines = index === 0 ? lines : document.source.split('\\n');\n const fragment = fresh(`Fragment${index}`);\n syntheticScopes.add(fragment);\n const prepared = document.placement?.length ? { source: document.source, locations: sourceLines.map((_, line) => ({ line: line + 1, column: 0 })) }\n : authoringSource(sourceLines, [`module ${module}`, ` feature ${feature}`, ` slice StateChange ${fragment}`]);\n return { ...document, ...prepared, placement: document.placement ?? [] };\n });\n const prepared = preparedDocuments[0];\n const locations = new Map(preparedDocuments.map(document => [document.path, document.locations]));\n // Put the buffer after its supplied context so duplicate real declarations are reported at\n // the current source, not silently dropped from its source-local diagnostic view.\n // Editor context can omit imported declarations. Defer only those missing types; imports whose\n // targets are present in the merged inventory still receive declaration-dependent validation.\n const parsed = parsePlacedDocuments([...preparedDocuments.slice(1), prepared], undefined, true);\n const commands = new Map<number, CommandSyntax>();\n const specifications = new Map<number, SpecificationSyntax>();\n const visited = new WeakSet<object>();\n const walk = (value: unknown): void => {\n if (value === null || typeof value !== 'object' || visited.has(value)) return;\n visited.add(value);\n if (Array.isArray(value)) { value.forEach(walk); return; }\n const node = value as Record<string, unknown>;\n // Source locations also occur as standalone members (usesLocation, targetLocation).\n // Mutate each original identity once: shared locations must not be shifted twice.\n if (typeof node.path === 'string' && typeof node.line === 'number' && typeof node.column === 'number') {\n const original = locations.get(node.path)?.[node.line - 1];\n if (original) { node.line = original.line; node.column = Math.max(1, node.column - original.column); }\n return;\n }\n for (const child of Object.values(node)) walk(child);\n if ((node.location as { path?: string; line: number } | undefined)?.path === path) {\n if (node.kind === 'CommandSyntax') commands.set((node.location as { line: number }).line - 1, value as CommandSyntax);\n if (node.kind === 'SpecificationSyntax') specifications.set((node.location as { line: number }).line - 1, value as SpecificationSyntax);\n }\n };\n walk(parsed.value);\n walk(parsed.physicalEventSources);\n walk(parsed.continuationValues);\n // Fragment wrappers must not turn an unread original root into confidence evidence.\n // Retain the parser's unknown-owner diagnostic at its original physical root location.\n for (const diagnostic of parsed.diagnostics) walk(diagnostic.location);\n const unknownFragmentExtent = parsed.diagnostics.some(diagnostic => {\n if (!['PLAY0022', 'PLAY0024', 'PLAY0029'].includes(diagnostic.code)) return false;\n const document = preparedDocuments.find(document => document.path === diagnostic.location.path);\n const original = documents.find(document => document.path === diagnostic.location.path)?.source.split('\\n')[diagnostic.location.line - 1];\n return document?.locations.some(location => location.line === 0) && original !== undefined && indentOf(original) === 0;\n });\n const diagnostics: Diagnostic[] = parsed.diagnostics.filter(diagnostic => diagnostic.location.path === path).flatMap(diagnostic => {\n walk(diagnostic.location);\n return diagnostic.location.line > 0 ? [diagnostic] : [];\n });\n const productions = new AuthoringProductionResolver(parsed.value);\n for (const { slice } of productions.slices) for (const reducer of dependencySourcesOf(slice).reducers ?? []) walk(reducer);\n const operationProductionLines = new Set(productions.slices.flatMap(({ slice }) => [...slice.commands.flatMap(command => command.produces), ...slice.reactions.flatMap(reaction => reaction.triggers).flatMap(trigger => trigger.produces)]\n .filter(production => production.location.path === path && !productions.isEventProduction(production, slice))\n .map(production => production.location.line - 1)));\n // Rejected inline operation declarations have no syntax node, but the core parser still owns\n // the command-only kind fact. Retain it rather than suggesting an event declaration repair.\n for (const diagnostic of diagnostics) if (diagnostic.code === 'PLAY0499') operationProductionLines.add(diagnostic.location.line - 1);\n const declarations: OperationDeclaration[] = productions.declarations.filter(declaration => declaration.kind === AuthoringProductionKind.Operation)\n .map(declaration => ({ ...declaration.node as OperationSyntax, scope: declaration.scope.filter(segment => !syntheticScopes.has(segment)) }));\n const contexts = new Map<number, { scope: readonly string[]; commandLine?: number; operation?: OperationDeclaration; production?: OperationReference }>();\n // Index source ownership once per revision. Typed headers, not keyword-shaped properties,\n // define the ranges; greater-indented legacy properties remain leaves.\n const fences = fenceMap(lines);\n const range = (start: number): number[] => {\n const result: number[] = [];\n const indent = indentOf(lines[start]);\n for (let line = start; line < lines.length; line++) {\n if (line > start && !fences[line] && withoutComment(lines[line]).trim() && indentOf(lines[line]) <= indent) break;\n result.push(line);\n }\n return result;\n };\n for (const { slice, scope } of productions.slices) {\n if (slice.location.path === path && slice.location.line > 0) for (const line of range(slice.location.line - 1)) contexts.set(line, { scope });\n for (const specification of slice.specifications.filter(specification => specification.location.path === path && specification.location.line > 0)) {\n for (const line of range(specification.location.line - 1)) contexts.set(line, { scope });\n }\n for (const command of slice.commands.filter(command => command.location.path === path && command.location.line > 0)) {\n for (const line of range(command.location.line - 1)) contexts.set(line, { scope, commandLine: command.location.line - 1 });\n }\n }\n const declarationScopes = new Map(productions.declarations.map(declaration => [declaration.node.location, declaration.scope]));\n for (const operation of declarations.filter(operation => operation.location.path === path)) {\n const scope = declarationScopes.get(operation.location)!;\n for (const line of range(operation.location.line - 1)) contexts.set(line, { ...contexts.get(line), scope, operation });\n }\n const declarationsByLocation = new Map(declarations.map(declaration => [declaration.location, declaration]));\n const referenceLocation = (location: { path?: string; line: number; column: number }, name: string) => {\n const source = withoutComment(lines[location.line - 1] ?? '');\n const prefix = source.slice(location.column - 1).match(/^(?:given\\s+operation|then\\s+(?:operation|compensated))\\s+/)?.[0];\n return prefix && source.slice(location.column - 1 + prefix.length, location.column - 1 + prefix.length + name.length) === name\n ? { ...location, column: location.column + prefix.length } : location;\n };\n const references: OperationReference[] = [];\n for (const { slice } of productions.slices) {\n for (const command of slice.commands) for (const production of command.produces) {\n if (production.location.path !== path) continue;\n const resolved = productions.resolve(production.event, slice);\n const declaration = resolved.declaration ? declarationsByLocation.get(resolved.declaration.node.location) ?? null : null;\n const reference = { name: production.event, location: production.location, targetLocation: production.targetLocation ?? production.location, kind: resolved.kind, declaration, mappings: production.mappings };\n references.push(reference);\n if (resolved.kind === AuthoringProductionKind.Operation) {\n for (const line of range(production.location.line - 1)) {\n const context = contexts.get(line);\n if (context) contexts.set(line, { ...context, production: reference });\n }\n }\n }\n for (const specification of slice.specifications) {\n for (const step of [...specification.givenOperationFailures ?? [], ...specification.thenOperations ?? [], ...specification.thenCompensated ?? []]) {\n if (step.location.path !== path) continue;\n const resolved = productions.resolve(step.operation, slice);\n references.push({ name: step.operation, location: step.location, targetLocation: referenceLocation(step.location, step.operation), kind: resolved.kind,\n declaration: resolved.declaration ? declarationsByLocation.get(resolved.declaration.node.location) ?? null : null,\n mappings: [] });\n }\n }\n }\n const operations: OperationAnalysis = { declarations, systems: parsed.value.systems ?? [], references, contexts, types: parsed.value.types, concepts: parsed.value.concepts,\n targets: scope => {\n const slice = productions.slices.find(entry => entry.scope.length === scope.length && entry.scope.every((part, index) => part === scope[index]))?.slice;\n if (!slice) return [];\n return declarations.flatMap(declaration => {\n const name = productions.resolve(declaration.name, slice).declaration?.node.location === declaration.location\n ? declaration.name : [...declaration.scope, declaration.name].join('.');\n return productions.resolve(name, slice).kind === AuthoringProductionKind.Operation &&\n productions.resolve(name, slice).declaration?.node.location === declaration.location ? [{ name, declaration }] : [];\n });\n }\n };\n const sourceDeclarations = parsed.physicalEventSources.map(entry => entry.source);\n const sourceCatalog = new EventSourceReadConfidence(parsed.physicalEventSources, parsed.sourceInventoryComplete && !unknownFragmentExtent);\n const resolutions = new Map<string, ReturnType<EventSourceReadConfidence['resolve']>>();\n const resolve = (source: string, stream?: string) => {\n const key = JSON.stringify([source, stream]);\n let result = resolutions.get(key);\n if (!result) { result = sourceCatalog.resolve(source, stream); resolutions.set(key, result); }\n return { ...result, source: result.state === 'unique' ? result.sources[0] : undefined, stream: result.state === 'unique' ? result.streams[0] : undefined };\n };\n const importedTypeReferences = new Set(parsed.value.imports.map(imported => imported.qualifiedName));\n const targets = sourceDeclarations.flatMap(source => {\n return source.streams.filter(stream => resolve(source.name, stream.name).state === 'unique' && !importedTypeReferences.has(`${source.name}.${stream.name}`)).map(stream => ({ name: `${source.name}.${stream.name}`, source, stream }));\n });\n const sourceContexts = new Map<number, EventSourceAnalysis['contexts'] extends ReadonlyMap<number, infer Context> ? Context : never>();\n const routes: AuthoredCommandRoute[] = [];\n for (const command of commands.values()) {\n for (const line of range(command.location.line - 1)) sourceContexts.set(line, { command });\n for (const member of [...command.produces, ...command.validations, ...(command.handler ? [command.handler] : [])])\n for (const line of range(member.location.line - 1)) sourceContexts.delete(line);\n // Retained ambiguity candidates are not selected authored routes.\n if (command.stream) {\n routes.push(command.stream);\n for (const line of range(command.stream.location.line - 1)) sourceContexts.set(line, { command, route: command.stream });\n }\n }\n const commandSlices = new Map(productions.slices.flatMap(({ slice }) => slice.commands.map(command => [command, slice] as const)));\n for (const command of commands.values()) {\n const slice = commandSlices.get(command);\n if (!slice) continue;\n for (const production of command.produces) {\n if (!productions.isEventProduction(production, slice)) continue;\n for (const line of range(production.location.line - 1)) sourceContexts.set(line, { command, production: true });\n if (production.stream) {\n routes.push(production.stream);\n for (const line of range(production.stream.location.line - 1)) sourceContexts.set(line, { command, production: true, route: production.stream });\n }\n }\n }\n for (const { slice } of productions.slices) {\n for (const observer of [...slice.reactions, ...dependencySourcesOf(slice).reducers ?? []].filter(observer => observer.location.path === path && observer.location.line > 0)) {\n for (const line of range(observer.location.line - 1)) sourceContexts.set(line, { observer });\n }\n }\n const examples = exampleAnalysis(parsed.value, path, lines, range, syntheticScopes, parsed.diagnostics);\n const routeOwners = [\n ...[...specifications.values()].flatMap(specification => [\n ...specification.given.map(event => ({ event, expectation: false })),\n ...(specification.whenAppended ? [{ event: specification.whenAppended, expectation: false }] : []),\n ...specification.thenEvents.map(event => ({ event, expectation: true })),\n ...(specification.whenRedelivered ? [{ event: specification.whenRedelivered, expectation: true }] : [])\n ]),\n ...(examples.eventExamples ?? []).map(event => ({ event, expectation: true }))\n ];\n for (const context of routeOwners) {\n const event = context.event;\n for (const line of range(event.location.line - 1)) sourceContexts.set(line, context);\n if (event.stream) {\n routes.push(event.stream);\n for (const line of range(event.stream.location.line - 1)) sourceContexts.set(line, { ...context, route: event.stream });\n }\n }\n for (const source of sourceDeclarations.filter(source => source.location.path === path)) {\n for (const line of range(source.location.line - 1)) sourceContexts.set(line, { source });\n for (const stream of source.streams) for (const line of range(stream.location.line - 1)) sourceContexts.set(line, { source, stream });\n }\n const ambiguousCandidates = [...commands.values()].flatMap(command => command.streamCandidates ?? []).filter(candidate => candidate.propertyCandidate !== null);\n const eventSources: EventSourceAnalysis = { declarations: sourceDeclarations, routes, ambiguousCandidates, contexts: sourceContexts, targets, resolve };\n let dependencyAnalysis: ReturnType<typeof dependencyTargetAnalysis> | undefined;\n const dependencies: ReturnType<typeof dependencyTargetAnalysis> = {\n completions(line, qualifier, placement) {\n if (dependencyAnalysis === undefined) {\n // Merging restated headers retains the first header's location. Index physical typed\n // headers only when needed, so later fragments still own their incomplete lines.\n const localDependencies = parseForAuthoring(prepared.source, path, prepared.placement, false).value;\n const remapDependencyHeaders = (node: typeof localDependencies.modules[number] | FeatureSyntax): void => {\n walk(node.location);\n node.features.forEach(remapDependencyHeaders);\n };\n localDependencies.modules.forEach(remapDependencyHeaders);\n dependencyAnalysis = dependencyTargetAnalysis(parsed.value, localDependencies, path, range, syntheticScopes);\n }\n return dependencyAnalysis.completions(line, qualifier, placement);\n },\n };\n const resolveCommand = responseCommandResolver(productions.slices.flatMap(({ slice, scope }) => slice.commands.map(command => ({ command, scope }))), parsed.value.imports);\n const continuationResponses = new Map<number, readonly ContinuationResponseField[]>();\n for (const use of parsed.continuationValues.filter(use => use.location.path === path)) {\n const fields = new Map<string, ContinuationResponseField>();\n for (const name of [...use.success].reverse().filter(name => !use.parameters.includes(name))) {\n const command = resolveCommand(name, use.scope);\n if (!command?.response) continue;\n const properties = new Map(command.properties.map(property => [property.name, property.type]));\n const response = command.response;\n const returned = response.kind === 'ScalarCommandResponseSyntax' ? [{ name: response.source.property, source: response.source, type: null }] : response.fields;\n for (const field of returned) {\n const type = field.type ?? properties.get(field.source.property);\n if (type && !use.locals.includes(field.name) && !fields.has(field.name)) fields.set(field.name, { name: field.name, type, command: command.name });\n }\n }\n continuationResponses.set(use.location.line - 1, [...fields.values()]);\n }\n const identityDetails = (parsed.value.identity?.details ?? []).map(detail => ({ name: detail.name, type: `${detail.type.name}${detail.type.isCollection ? '[]' : ''}${detail.type.isOptional ? ' optional' : ''}`, line: detail.location.line - 1 }));\n return { identityDetails, continuationResponses, commands, specifications, diagnostics, operationProductionLines, operations, eventSources, readModels: productions.slices.flatMap(({ slice, scope }) => (slice.readModels ?? []).map(model => ({ model, scope: scope.filter(segment => !syntheticScopes.has(segment)) }))), examples, personas: personaAnalysis(parsed.value, lines), dependencies };\n}\n\nexport function responseAnalysis(lines: string[], otherSources: readonly (string | AuthoringDocument)[] = [], placement?: readonly string[], path = 'current.play', isPlacementResolved = true): ResponseAnalysis & { readonly operations: OperationAnalysis; readonly eventSources: EventSourceAnalysis; readonly readModels: readonly AuthoredReadModelKeys[]; readonly examples: ExampleAnalysis; readonly personas: ReturnType<typeof personaAnalysis>; readonly dependencies: ReturnType<typeof dependencyTargetAnalysis> } {\n const key = JSON.stringify([lines, otherSources, placement, path, isPlacementResolved]);\n let analysis = revisions.get(key);\n if (analysis === undefined) {\n analysis = analyze(lines, otherSources, placement, path, isPlacementResolved);\n if (revisions.size >= 16) revisions.delete(revisions.keys().next().value!);\n revisions.set(key, analysis);\n }\n return analysis;\n}\n"],"mappings":"k1BA6BA,MAAaA,EAAuB,qIAI9BC,kBAAY,IAAI,IA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AAO,KAAM,KAAM,GAAGA,EAAO,KAAK,OAAOA,EAAO,KAAK,aAAe,KAAO,KAAKA,EAAO,KAAK,WAAa,YAAc,KAAM,KAAMA,EAAO,SAAS,KAAO,CAAE,EAC3N,EAAG,wBAAuB,WAAU,iBAAgB,cAAa,2BAA0B,aAAY,eAAc,WAAYtE,EAAY,OAAO,SAAS,CAAE,QAAO,YAAaI,EAAM,YAAc,CAAC,EAAA,CAAG,IAAI,IAAU,CAAE,QAAO,MAAOiB,EAAM,OAAO,GAAW,CAACxC,EAAgB,IAAI+B,CAAO,CAAC,CAAE,EAAE,CAAC,EAAG,WAAU,SAAU2D,EAAgBpF,EAAO,MAAO9B,CAAK,EAAG,cAAa,CACxY,CAEA,SAAgB,iBAAiB,EAAiB,EAAwD,CAAC,EAAG,EAA+B,EAAO,eAAgB,EAAsB,GAAuU,CAC7f,IAAM+E,EAAM,KAAK,UAAU,CAAC/E,EAAOa,EAAcwF,EAAWtF,EAAMoG,CAAmB,CAAC,EAClFC,EAAWvH,EAAU,IAAIkF,CAAG,EAMhC,OALIqC,IAAa,IAAA,KACb,EAAW,QAAQpH,EAAOa,EAAcwF,EAAWtF,EAAMoG,CAAmB,EACxEtH,EAAU,MAAQ,IAAIA,EAAU,OAAOA,EAAU,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,KAAM,EACzEA,EAAU,IAAIkF,EAAKqC,CAAQ,GAExBA,CACX"}
|
|
1
|
+
{"version":3,"file":"response-analysis.js","names":["responseAvailability","revisions","fences","fenceMap","lines","roots","index","indentOf","line","root","globals","body","global","depth","wrappers","headers","others","otherSources","document","path","documents","names","match","name","prefix","suffix","module","feature","syntheticScopes","preparedDocuments","sourceLines","fragment","prepared","locations","parsed","parsePlacedDocuments","commands","specifications","visited","value","node","original","child","diagnostic","unknownFragmentExtent","location","diagnostics","productions","AuthoringProductionResolver","reducer","dependencySourcesOf","slice","operationProductionLines","command","reaction","trigger","production","declarations","declaration","segment","contexts","result","indent","start","withoutComment","specification","declarationScopes","operation","scope","declarationsByLocation","source","references","resolved","reference","context","step","operations","entry","part","sourceDeclarations","sourceCatalog","EventSourceReadConfidence","resolutions","key","stream","importedTypeReferences","imported","targets","sourceContexts","routes","member","commandSlices","observer","examples","exampleAnalysis","routeOwners","event","eventSources","candidate","dependencyAnalysis","dependencies","localDependencies","parseForAuthoring","dependencyTargetAnalysis","qualifier","placement","resolveCommand","responseCommandResolver","continuationResponses","use","fields","properties","property","response","returned","field","type","detail","personaAnalysis","isPlacementResolved","analysis"],"sources":["../../response-analysis.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 { AuthoringProductionKind, AuthoringProductionResolver, CommandSyntax, dependencySourcesOf, Diagnostic, EventSourceReadConfidence, FeatureSyntax, OperationSyntax, parseForAuthoring, parsePlacedDocuments, responseCommandResolver, SpecificationSyntax } from '@cratis/screenplay-compiler';\nimport { fenceMap, indentOf, withoutComment } from './document-context';\nimport { ResponseAnalysis } from './ResponseAnalysis';\nimport { ContinuationResponseField } from './ContinuationResponseField';\nimport { ExampleAnalysis } from './ExampleAnalysis';\nimport { exampleAnalysis } from './example-analysis';\nimport { personaAnalysis } from './persona-analysis';\nimport { dependencyTargetAnalysis } from './dependency-target-analysis';\nimport { EventSourceAnalysis } from './EventSourceAnalysis';\nimport { AuthoredCommandRoute } from './AuthoredCommandRoute';\nimport { AuthoredReadModelKeys } from './AuthoredReadModelKeys';\nimport { AuthoringDocument } from './AuthoringDocument';\nimport { OperationAnalysis, OperationDeclaration, OperationReference } from './OperationAnalysis';\n\n// Public editor shapes are structural: packed declarations never expose the private compiler.\nexport type { AuthoringDocument } from './AuthoringDocument';\nexport type { AnalysisLocation } from './AnalysisLocation';\nexport type { AnalysisDiagnostic } from './AnalysisDiagnostic';\nexport type { AnalysisType } from './AnalysisType';\nexport type { AnalysisCommand } from './AnalysisCommand';\nexport type { AnalysisSpecification } from './AnalysisSpecification';\nexport type { CommandResponseSymbol } from './CommandResponseSymbol';\nexport type { ResponseFieldSymbol } from './ResponseFieldSymbol';\nexport type { ResponseSourceSymbol } from './ResponseSourceSymbol';\nexport type { ResponseAnalysis } from './ResponseAnalysis';\n\nexport const responseAvailability = 'Executable as ESM v7. Generated values require fixtures in reference execution; other unadmitted constructs still prevent binding.';\n\n// A bounded revision cache shared by symbols, validation, completion and hover. Index typed nodes\n// once, not by reparsing the document for each command or response field.\nconst revisions = new Map<string, ReturnType<typeof analyze>>();\n\nfunction authoringSource(lines: string[], headers: readonly string[]) {\n const fences = fenceMap(lines);\n const roots = lines.flatMap((line, index) => !fences[index] && indentOf(line) === 0 && /^\\w/.test(line) && !/^(?:time\\s+zone\\b|reaction\\s+batches\\b|command\\s+reads\\s+(?!\\/\\/)\\S+)/.test(line) ? [line.split(/\\s+/)[0]] : []);\n if (roots.includes('module') || !roots.some(root => ['feature', 'slice', 'command', 'event', 'operation', 'reaction', 'specification'].includes(root))) {\n return { source: lines.join('\\n'), locations: lines.map((_, index) => ({ line: index + 1, column: 0 })) };\n }\n // Isolated slice/command fragments are a supported editor input. Global declarations stay global.\n const globals: number[] = [];\n const body: number[] = [];\n let global = false;\n lines.forEach((line, index) => {\n if (!fences[index] && indentOf(line) === 0 && /^\\w/.test(line)) global = /^(?:concept|type|import|domain|system|eventsource|policy|persona|identity|time\\s+zone|reaction\\s+batches|command\\s+reads(?=\\s+(?!\\/\\/)\\S))\\b/.test(line);\n (global ? globals : body).push(index);\n });\n const depth = roots.includes('feature') ? 1 : roots.includes('slice') ? 2 : 3;\n const wrappers = headers.slice(0, depth);\n const source = [...globals.map(index => lines[index]), ...wrappers, ...body.map(index => ' '.repeat(depth * 2) + lines[index])].join('\\n');\n const locations = [...globals.map(index => ({ line: index + 1, column: 0 })), ...wrappers.map(() => ({ line: 0, column: 0 })), ...body.map(index => ({ line: index + 1, column: depth * 2 }))];\n return { source, locations };\n}\n\nfunction analyze(lines: string[], otherSources: readonly (string | AuthoringDocument)[], placement?: readonly string[], path = 'current.play', isPlacementResolved = true): ResponseAnalysis & { readonly operations: OperationAnalysis; readonly eventSources: EventSourceAnalysis; readonly readModels: readonly AuthoredReadModelKeys[]; readonly examples: ExampleAnalysis; readonly personas: ReturnType<typeof personaAnalysis>; readonly dependencies: ReturnType<typeof dependencyTargetAnalysis> } {\n const others = otherSources.map((document, index) => typeof document === 'string' ? { path: `other-${index}.play`, source: document } : document).filter(document => document.path !== path);\n const documents: AuthoringDocument[] = [{ path, source: lines.join('\\n'), placement, isPlacementResolved }, ...others];\n // Modules/features merge, but slices are real declarations: equal slice names discard later\n // documents. Share only fresh synthetic module/feature names, with a distinct synthetic slice\n // per fragment. This retains all commands for normal (including ambiguous) scope resolution,\n // without combining source texts or renaming real declarations/explicit placements. Reserve\n // source/placement names once so even a real Editor.Authoring.Fragment cannot collide.\n const names = new Set(documents.flatMap(document => [...document.source.matchAll(/\\w+/g)].map(match => match[0]).concat(document.placement ?? [])));\n const fresh = (prefix: string): string => {\n let name = prefix;\n for (let suffix = 1; names.has(name); suffix++) name = `${prefix}${suffix}`;\n names.add(name);\n return name;\n };\n const module = fresh('EditorAuthoring');\n const feature = fresh('FragmentFeature');\n const syntheticScopes = new Set([module, feature]);\n const preparedDocuments = documents.map((document, index) => {\n const sourceLines = index === 0 ? lines : document.source.split('\\n');\n const fragment = fresh(`Fragment${index}`);\n syntheticScopes.add(fragment);\n const prepared = document.placement?.length ? { source: document.source, locations: sourceLines.map((_, line) => ({ line: line + 1, column: 0 })) }\n : authoringSource(sourceLines, [`module ${module}`, ` feature ${feature}`, ` slice StateChange ${fragment}`]);\n return { ...document, ...prepared, placement: document.placement ?? [] };\n });\n const prepared = preparedDocuments[0];\n const locations = new Map(preparedDocuments.map(document => [document.path, document.locations]));\n // Put the buffer after its supplied context so duplicate real declarations are reported at\n // the current source, not silently dropped from its source-local diagnostic view.\n // Editor context can omit imported declarations. Defer only those missing types; imports whose\n // targets are present in the merged inventory still receive declaration-dependent validation.\n const parsed = parsePlacedDocuments([...preparedDocuments.slice(1), prepared], undefined, true);\n const commands = new Map<number, CommandSyntax>();\n const specifications = new Map<number, SpecificationSyntax>();\n const visited = new WeakSet<object>();\n const walk = (value: unknown): void => {\n if (value === null || typeof value !== 'object' || visited.has(value)) return;\n visited.add(value);\n if (Array.isArray(value)) { value.forEach(walk); return; }\n const node = value as Record<string, unknown>;\n // Source locations also occur as standalone members (usesLocation, targetLocation).\n // Mutate each original identity once: shared locations must not be shifted twice.\n if (typeof node.path === 'string' && typeof node.line === 'number' && typeof node.column === 'number') {\n const original = locations.get(node.path)?.[node.line - 1];\n if (original) { node.line = original.line; node.column = Math.max(1, node.column - original.column); }\n return;\n }\n for (const child of Object.values(node)) walk(child);\n if ((node.location as { path?: string; line: number } | undefined)?.path === path) {\n if (node.kind === 'CommandSyntax') commands.set((node.location as { line: number }).line - 1, value as CommandSyntax);\n if (node.kind === 'SpecificationSyntax') specifications.set((node.location as { line: number }).line - 1, value as SpecificationSyntax);\n }\n };\n walk(parsed.value);\n walk(parsed.physicalEventSources);\n walk(parsed.continuationValues);\n // Fragment wrappers must not turn an unread original root into confidence evidence.\n // Retain the parser's unknown-owner diagnostic at its original physical root location.\n for (const diagnostic of parsed.diagnostics) walk(diagnostic.location);\n const unknownFragmentExtent = parsed.diagnostics.some(diagnostic => {\n if (!['PLAY0022', 'PLAY0024', 'PLAY0029'].includes(diagnostic.code)) return false;\n const document = preparedDocuments.find(document => document.path === diagnostic.location.path);\n const original = documents.find(document => document.path === diagnostic.location.path)?.source.split('\\n')[diagnostic.location.line - 1];\n return document?.locations.some(location => location.line === 0) && original !== undefined && indentOf(original) === 0;\n });\n const diagnostics: Diagnostic[] = parsed.diagnostics.filter(diagnostic => diagnostic.location.path === path).flatMap(diagnostic => {\n walk(diagnostic.location);\n return diagnostic.location.line > 0 ? [diagnostic] : [];\n });\n const productions = new AuthoringProductionResolver(parsed.value);\n for (const { slice } of productions.slices) for (const reducer of dependencySourcesOf(slice).reducers ?? []) walk(reducer);\n const operationProductionLines = new Set(productions.slices.flatMap(({ slice }) => [...slice.commands.flatMap(command => command.produces), ...slice.reactions.flatMap(reaction => reaction.triggers).flatMap(trigger => trigger.produces)]\n .filter(production => production.location.path === path && !productions.isEventProduction(production, slice))\n .map(production => production.location.line - 1)));\n // Rejected inline operation declarations have no syntax node, but the core parser still owns\n // the command-only kind fact. Retain it rather than suggesting an event declaration repair.\n for (const diagnostic of diagnostics) if (diagnostic.code === 'PLAY0499') operationProductionLines.add(diagnostic.location.line - 1);\n const declarations: OperationDeclaration[] = productions.declarations.filter(declaration => declaration.kind === AuthoringProductionKind.Operation)\n .map(declaration => ({ ...declaration.node as OperationSyntax, scope: declaration.scope.filter(segment => !syntheticScopes.has(segment)) }));\n const contexts = new Map<number, { scope: readonly string[]; commandLine?: number; operation?: OperationDeclaration; production?: OperationReference }>();\n // Index source ownership once per revision. Typed headers, not keyword-shaped properties,\n // define the ranges; greater-indented legacy properties remain leaves.\n const fences = fenceMap(lines);\n const range = (start: number): number[] => {\n const result: number[] = [];\n const indent = indentOf(lines[start]);\n for (let line = start; line < lines.length; line++) {\n if (line > start && !fences[line] && withoutComment(lines[line]).trim() && indentOf(lines[line]) <= indent) break;\n result.push(line);\n }\n return result;\n };\n for (const { slice, scope } of productions.slices) {\n if (slice.location.path === path && slice.location.line > 0) for (const line of range(slice.location.line - 1)) contexts.set(line, { scope });\n for (const specification of slice.specifications.filter(specification => specification.location.path === path && specification.location.line > 0)) {\n for (const line of range(specification.location.line - 1)) contexts.set(line, { scope });\n }\n for (const command of slice.commands.filter(command => command.location.path === path && command.location.line > 0)) {\n for (const line of range(command.location.line - 1)) contexts.set(line, { scope, commandLine: command.location.line - 1 });\n }\n }\n const declarationScopes = new Map(productions.declarations.map(declaration => [declaration.node.location, declaration.scope]));\n for (const operation of declarations.filter(operation => operation.location.path === path)) {\n const scope = declarationScopes.get(operation.location)!;\n for (const line of range(operation.location.line - 1)) contexts.set(line, { ...contexts.get(line), scope, operation });\n }\n const declarationsByLocation = new Map(declarations.map(declaration => [declaration.location, declaration]));\n const referenceLocation = (location: { path?: string; line: number; column: number }, name: string) => {\n const source = withoutComment(lines[location.line - 1] ?? '');\n const prefix = source.slice(location.column - 1).match(/^(?:given\\s+operation|then\\s+(?:operation|compensated))\\s+/)?.[0];\n return prefix && source.slice(location.column - 1 + prefix.length, location.column - 1 + prefix.length + name.length) === name\n ? { ...location, column: location.column + prefix.length } : location;\n };\n const references: OperationReference[] = [];\n for (const { slice } of productions.slices) {\n for (const command of slice.commands) for (const production of command.produces) {\n if (production.location.path !== path) continue;\n const resolved = productions.resolve(production.event, slice);\n const declaration = resolved.declaration ? declarationsByLocation.get(resolved.declaration.node.location) ?? null : null;\n const reference = { name: production.event, location: production.location, targetLocation: production.targetLocation ?? production.location, kind: resolved.kind, declaration, mappings: production.mappings };\n references.push(reference);\n if (resolved.kind === AuthoringProductionKind.Operation) {\n for (const line of range(production.location.line - 1)) {\n const context = contexts.get(line);\n if (context) contexts.set(line, { ...context, production: reference });\n }\n }\n }\n for (const specification of slice.specifications) {\n for (const step of [...specification.givenOperationFailures ?? [], ...specification.thenOperations ?? [], ...specification.thenCompensated ?? []]) {\n if (step.location.path !== path) continue;\n const resolved = productions.resolve(step.operation, slice);\n references.push({ name: step.operation, location: step.location, targetLocation: referenceLocation(step.location, step.operation), kind: resolved.kind,\n declaration: resolved.declaration ? declarationsByLocation.get(resolved.declaration.node.location) ?? null : null,\n mappings: [] });\n }\n }\n }\n const operations: OperationAnalysis = { declarations, systems: parsed.value.systems ?? [], references, contexts, types: parsed.value.types, concepts: parsed.value.concepts,\n targets: scope => {\n const slice = productions.slices.find(entry => entry.scope.length === scope.length && entry.scope.every((part, index) => part === scope[index]))?.slice;\n if (!slice) return [];\n return declarations.flatMap(declaration => {\n const name = productions.resolve(declaration.name, slice).declaration?.node.location === declaration.location\n ? declaration.name : [...declaration.scope, declaration.name].join('.');\n return productions.resolve(name, slice).kind === AuthoringProductionKind.Operation &&\n productions.resolve(name, slice).declaration?.node.location === declaration.location ? [{ name, declaration }] : [];\n });\n }\n };\n const sourceDeclarations = parsed.physicalEventSources.map(entry => entry.source);\n const sourceCatalog = new EventSourceReadConfidence(parsed.physicalEventSources, parsed.sourceInventoryComplete && !unknownFragmentExtent);\n const resolutions = new Map<string, ReturnType<EventSourceReadConfidence['resolve']>>();\n const resolve = (source: string, stream?: string) => {\n const key = JSON.stringify([source, stream]);\n let result = resolutions.get(key);\n if (!result) { result = sourceCatalog.resolve(source, stream); resolutions.set(key, result); }\n return { ...result, source: result.state === 'unique' ? result.sources[0] : undefined, stream: result.state === 'unique' ? result.streams[0] : undefined };\n };\n const importedTypeReferences = new Set(parsed.value.imports.map(imported => imported.qualifiedName));\n const targets = sourceDeclarations.flatMap(source => {\n return source.streams.filter(stream => resolve(source.name, stream.name).state === 'unique' && !importedTypeReferences.has(`${source.name}.${stream.name}`)).map(stream => ({ name: `${source.name}.${stream.name}`, source, stream }));\n });\n const sourceContexts = new Map<number, EventSourceAnalysis['contexts'] extends ReadonlyMap<number, infer Context> ? Context : never>();\n const routes: AuthoredCommandRoute[] = [];\n for (const command of commands.values()) {\n for (const line of range(command.location.line - 1)) sourceContexts.set(line, { command });\n for (const member of [...command.produces, ...command.validations, ...(command.handler ? [command.handler] : [])])\n for (const line of range(member.location.line - 1)) sourceContexts.delete(line);\n // Retained ambiguity candidates are not selected authored routes.\n if (command.stream) {\n routes.push(command.stream);\n for (const line of range(command.stream.location.line - 1)) sourceContexts.set(line, { command, route: command.stream });\n }\n }\n const commandSlices = new Map(productions.slices.flatMap(({ slice }) => slice.commands.map(command => [command, slice] as const)));\n for (const command of commands.values()) {\n const slice = commandSlices.get(command);\n if (!slice) continue;\n for (const production of command.produces) {\n if (!productions.isEventProduction(production, slice)) continue;\n for (const line of range(production.location.line - 1)) sourceContexts.set(line, { command, production: true });\n if (production.stream) {\n routes.push(production.stream);\n for (const line of range(production.stream.location.line - 1)) sourceContexts.set(line, { command, production: true, route: production.stream });\n }\n }\n }\n for (const { slice } of productions.slices) {\n for (const observer of [...slice.reactions, ...dependencySourcesOf(slice).reducers ?? []].filter(observer => observer.location.path === path && observer.location.line > 0)) {\n for (const line of range(observer.location.line - 1)) sourceContexts.set(line, { observer });\n }\n }\n const examples = exampleAnalysis(parsed.value, path, lines, range, syntheticScopes, parsed.diagnostics);\n const routeOwners = [\n ...[...specifications.values()].flatMap(specification => [\n ...specification.given.map(event => ({ event, expectation: false })),\n ...(specification.whenAppended ? [{ event: specification.whenAppended, expectation: false }] : []),\n ...specification.thenEvents.map(event => ({ event, expectation: true })),\n ...(specification.whenRedelivered ? [{ event: specification.whenRedelivered, expectation: true }] : [])\n ]),\n ...(examples.eventExamples ?? []).map(event => ({ event, expectation: true }))\n ];\n for (const context of routeOwners) {\n const event = context.event;\n for (const line of range(event.location.line - 1)) sourceContexts.set(line, context);\n if (event.stream) {\n routes.push(event.stream);\n for (const line of range(event.stream.location.line - 1)) sourceContexts.set(line, { ...context, route: event.stream });\n }\n }\n for (const source of sourceDeclarations.filter(source => source.location.path === path)) {\n for (const line of range(source.location.line - 1)) sourceContexts.set(line, { source });\n for (const stream of source.streams) for (const line of range(stream.location.line - 1)) sourceContexts.set(line, { source, stream });\n }\n const ambiguousCandidates = [...commands.values()].flatMap(command => command.streamCandidates ?? []).filter(candidate => candidate.propertyCandidate !== null);\n const eventSources: EventSourceAnalysis = { declarations: sourceDeclarations, routes, ambiguousCandidates, contexts: sourceContexts, targets, resolve };\n let dependencyAnalysis: ReturnType<typeof dependencyTargetAnalysis> | undefined;\n const dependencies: ReturnType<typeof dependencyTargetAnalysis> = {\n completions(line, qualifier, placement) {\n if (dependencyAnalysis === undefined) {\n // Merging restated headers retains the first header's location. Index physical typed\n // headers only when needed, so later fragments still own their incomplete lines.\n const localDependencies = parseForAuthoring(prepared.source, path, prepared.placement, false).value;\n const remapDependencyHeaders = (node: typeof localDependencies.modules[number] | FeatureSyntax): void => {\n walk(node.location);\n node.features.forEach(remapDependencyHeaders);\n };\n localDependencies.modules.forEach(remapDependencyHeaders);\n dependencyAnalysis = dependencyTargetAnalysis(parsed.value, localDependencies, path, range, syntheticScopes);\n }\n return dependencyAnalysis.completions(line, qualifier, placement);\n },\n };\n const resolveCommand = responseCommandResolver(productions.slices.flatMap(({ slice, scope }) => slice.commands.map(command => ({ command, scope }))), parsed.value.imports);\n const continuationResponses = new Map<number, readonly ContinuationResponseField[]>();\n for (const use of parsed.continuationValues.filter(use => use.location.path === path)) {\n const fields = new Map<string, ContinuationResponseField>();\n for (const name of [...use.success].reverse().filter(name => !use.parameters.includes(name))) {\n const command = resolveCommand(name, use.scope);\n if (!command?.response) continue;\n const properties = new Map(command.properties.map(property => [property.name, property.type]));\n const response = command.response;\n const returned = response.kind === 'ScalarCommandResponseSyntax' ? [{ name: response.source.property, source: response.source, type: null }] : response.fields;\n for (const field of returned) {\n const type = field.type ?? properties.get(field.source.property);\n if (type && !use.locals.includes(field.name) && !fields.has(field.name)) fields.set(field.name, { name: field.name, type, command: command.name });\n }\n }\n continuationResponses.set(use.location.line - 1, [...fields.values()]);\n }\n const identityDetails = (parsed.value.identity?.details ?? []).map(detail => ({ name: detail.name, type: `${detail.type.name}${detail.type.isCollection ? '[]' : ''}${detail.type.isOptional ? ' optional' : ''}`, line: detail.location.line - 1 }));\n return { identityDetails, continuationResponses, commands, specifications, diagnostics, operationProductionLines, operations, eventSources, readModels: productions.slices.flatMap(({ slice, scope }) => (slice.readModels ?? []).map(model => ({ model, scope: scope.filter(segment => !syntheticScopes.has(segment)) }))), examples, personas: personaAnalysis(parsed.value, lines), dependencies };\n}\n\nexport function responseAnalysis(lines: string[], otherSources: readonly (string | AuthoringDocument)[] = [], placement?: readonly string[], path = 'current.play', isPlacementResolved = true): ResponseAnalysis & { readonly operations: OperationAnalysis; readonly eventSources: EventSourceAnalysis; readonly readModels: readonly AuthoredReadModelKeys[]; readonly examples: ExampleAnalysis; readonly personas: ReturnType<typeof personaAnalysis>; readonly dependencies: ReturnType<typeof dependencyTargetAnalysis> } {\n const key = JSON.stringify([lines, otherSources, placement, path, isPlacementResolved]);\n let analysis = revisions.get(key);\n if (analysis === undefined) {\n analysis = analyze(lines, otherSources, placement, path, isPlacementResolved);\n if (revisions.size >= 16) revisions.delete(revisions.keys().next().value!);\n revisions.set(key, analysis);\n }\n return analysis;\n}\n"],"mappings":"k1BA6BA,MAAaA,EAAuB,qIAI9BC,kBAAY,IAAI,IAEtB,SAAS,gBAAgB,EAAiB,EAA4B,CAClE,IAAMC,EAASC,EAASC,CAAK,EACvBC,EAAQD,EAAM,SAAS,EAAM,IAAU,CAACF,EAAOI,IAAUC,EAASC,CAAI,IAAM,GAAK,MAAM,KAAKA,CAAI,GAAK,CAAC,wEAAwE,KAAKA,CAAI,EAAI,CAACA,EAAK,MAAM,KAAK,CAAC,CAAC,EAAE,EAAI,CAAC,CAAC,EAC5N,GAAIH,EAAM,SAAS,QAAQ,GAAK,CAACA,EAAM,KAAK,GAAQ,CAAC,UAAW,QAAS,UAAW,QAAS,YAAa,WAAY,eAAe,CAAC,CAAC,SAASI,CAAI,CAAC,EACjJ,MAAO,CAAE,OAAQL,EAAM,KAAK;CAAI,EAAG,UAAWA,EAAM,KAAK,EAAG,KAAW,CAAE,KAAME,EAAQ,EAAG,OAAQ,CAAE,EAAE,CAAE,EAG5G,IAAMI,EAAoB,CAAC,EACrBC,EAAiB,CAAC,EACpBC,EAAS,GACbR,EAAM,SAAS,EAAM,IAAU,CACvB,CAACF,EAAOI,IAAUC,EAASC,CAAI,IAAM,GAAK,MAAM,KAAKA,CAAI,IAAG,EAAS,+IAA+I,KAAKA,CAAI,IAChOI,EAASF,EAAUC,EAAA,CAAM,KAAKL,CAAK,CACxC,CAAC,EACD,IAAMO,EAAQR,EAAM,SAAS,SAAS,EAAI,EAAIA,EAAM,SAAS,OAAO,EAAI,EAAI,EACtES,EAAWC,EAAQ,MAAM,EAAGF,CAAK,EAGvC,MAAO,CAAE,OAFM,CAAC,GAAGH,EAAQ,I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split|append|tag|when|children|nested|identified|by|from|to|and|or|added|removed)\b/,`keyword`]],completions:[{label:`source`,insertText:"source ${1:api}",documentation:`Declares where the captured data comes from.`},{label:`key`,insertText:"key ${1:property}",documentation:`Declares which source property identifies an instance.`},{label:`map`,insertText:"map\n ${1:property} = ${2:source}",documentation:`Maps and translates source values before events are appended.`},{label:`append`,insertText:"append ${1:EventType}\n when ${2:property}",documentation:`Appends an event when the source data changes.`},{label:`translate`,insertText:'translate\n "${1:source}" => ${2:target}',documentation:`Translates source values into Screenplay values.`},{label:`children`,insertText:"children ${1:collection} identified by ${2:key}",documentation:`Captures changes in a child collection of the source data.`},{label:`when added`,insertText:`when added`,documentation:`Appends the event when a new item appears in the source.`},{label:`when removed`,insertText:`when removed`,documentation:`Appends the event when an item disappears from the source.`}],hovers:{source:`CDL — declares where the captured data comes from.`,api:"CDL — as a source type, polls an HTTP API; as a source property (`api <ServiceName>`), references a named External Service for the base URL and authentication.",route:`CDL — optional path appended to an API source's External Service base URL.`,poll:`CDL — the polling interval for an API source, e.g. 5m.`,path:`CDL — the inbound path a webhook source listens on.`,topic:`CDL — the topic a message source subscribes to.`,key
|
|
1
|
+
const e={tokens:[[/\b(?:source|api|route|poll|path|topic|key|map|translate|split|append|tag|when|children|nested|identified|by|from|to|and|or|added|removed|is|event)\b/,`keyword`]],completions:[{label:`source`,insertText:"source ${1:api}",documentation:`Declares where the captured data comes from.`},{label:`key`,insertText:"key ${1:property}",documentation:`Declares which source property identifies an instance.`},{label:`map`,insertText:"map\n ${1:property} = ${2:source}",documentation:`Maps and translates source values before events are appended.`},{label:`append`,insertText:"append ${1:EventType}\n when ${2:property}",documentation:`Appends an event when the source data changes.`},{label:`translate`,insertText:'translate\n "${1:source}" => ${2:target}',documentation:`Translates source values into Screenplay values.`},{label:`children`,insertText:"children ${1:collection} identified by ${2:key}",documentation:`Captures changes in a child collection of the source data.`},{label:`when added`,insertText:`when added`,documentation:`Appends the event when a new item appears in the source.`},{label:`when removed`,insertText:`when removed`,documentation:`Appends the event when an item disappears from the source.`}],hovers:{source:`CDL — declares where the captured data comes from.`,api:"CDL — as a source type, polls an HTTP API; as a source property (`api <ServiceName>`), references a named External Service for the base URL and authentication.",route:`CDL — optional path appended to an API source's External Service base URL.`,poll:`CDL — the polling interval for an API source, e.g. 5m.`,path:`CDL — the inbound path a webhook source listens on.`,topic:`CDL — the topic a message source subscribes to.`,key:"CDL — declares which source property identifies an instance. On a `source events` capture, `key <property> is event source` promises each captured event is sourced by that key.",is:"CDL — in `key <property> is event source`, marks the key as the event source of every captured event.",map:`CDL — maps and translates source values before events are appended.`,translate:`CDL — translates source values into Screenplay values.`,append:`CDL — appends an event when the source data changes.`,when:`CDL — the change condition: a property change, added, or removed.`,added:`CDL — matches items that appear in the source.`,removed:`CDL — matches items that disappear from the source.`,children:`CDL — captures changes in a child collection of the source data.`,identified:`CDL — introduces the identifying key of a child collection.`}};export{e as cdl};
|
|
2
2
|
//# sourceMappingURL=cdl.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cdl.js","names":["cdl"],"sources":["../../../sub-languages/cdl.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 { SubLanguageDefinition } from '../sub-language-registry';\n\n// Change Data Capture Language (CDL) — embedded inside `capture` blocks. This is the\n// lightweight definition mixed into the composite `.play` tokenizer; the full standalone\n// CDL language (its own tokenizer, context-aware completions, hover, and validation) lives\n// in `./capture` and is what `@cratis/screenplay-language/capture` exposes to consumers.\nexport const cdl: SubLanguageDefinition = {\n tokens: [\n [\n /\\b(?:source|api|route|poll|path|topic|key|map|translate|split|append|tag|when|children|nested|identified|by|from|to|and|or|added|removed)\\b/,\n 'keyword',\n ],\n ],\n completions: [\n {\n label: 'source',\n insertText: 'source ${1:api}',\n documentation: 'Declares where the captured data comes from.',\n },\n {\n label: 'key',\n insertText: 'key ${1:property}',\n documentation: 'Declares which source property identifies an instance.',\n },\n {\n label: 'map',\n insertText: 'map\\n ${1:property} = ${2:source}',\n documentation: 'Maps and translates source values before events are appended.',\n },\n {\n label: 'append',\n insertText: 'append ${1:EventType}\\n when ${2:property}',\n documentation: 'Appends an event when the source data changes.',\n },\n {\n label: 'translate',\n insertText: 'translate\\n \"${1:source}\" => ${2:target}',\n documentation: 'Translates source values into Screenplay values.',\n },\n {\n label: 'children',\n insertText: 'children ${1:collection} identified by ${2:key}',\n documentation: 'Captures changes in a child collection of the source data.',\n },\n {\n label: 'when added',\n insertText: 'when added',\n documentation: 'Appends the event when a new item appears in the source.',\n },\n {\n label: 'when removed',\n insertText: 'when removed',\n documentation: 'Appends the event when an item disappears from the source.',\n },\n ],\n hovers: {\n source: 'CDL — declares where the captured data comes from.',\n api: 'CDL — as a source type, polls an HTTP API; as a source property (`api <ServiceName>`), references a named External Service for the base URL and authentication.',\n route: 'CDL — optional path appended to an API source\\'s External Service base URL.',\n poll: 'CDL — the polling interval for an API source, e.g. 5m.',\n path: 'CDL — the inbound path a webhook source listens on.',\n topic: 'CDL — the topic a message source subscribes to.',\n key: 'CDL — declares which source property identifies an instance.',\n map: 'CDL — maps and translates source values before events are appended.',\n translate: 'CDL — translates source values into Screenplay values.',\n append: 'CDL — appends an event when the source data changes.',\n when: 'CDL — the change condition: a property change, added, or removed.',\n added: 'CDL — matches items that appear in the source.',\n removed: 'CDL — matches items that disappear from the source.',\n children: 'CDL — captures changes in a child collection of the source data.',\n identified: 'CDL — introduces the identifying key of a child collection.',\n },\n};\n"],"mappings":"AASA,MAAaA,EAA6B,CACtC,OAAQ,CACJ,CACI,
|
|
1
|
+
{"version":3,"file":"cdl.js","names":["cdl"],"sources":["../../../sub-languages/cdl.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 { SubLanguageDefinition } from '../sub-language-registry';\n\n// Change Data Capture Language (CDL) — embedded inside `capture` blocks. This is the\n// lightweight definition mixed into the composite `.play` tokenizer; the full standalone\n// CDL language (its own tokenizer, context-aware completions, hover, and validation) lives\n// in `./capture` and is what `@cratis/screenplay-language/capture` exposes to consumers.\nexport const cdl: SubLanguageDefinition = {\n tokens: [\n [\n /\\b(?:source|api|route|poll|path|topic|key|map|translate|split|append|tag|when|children|nested|identified|by|from|to|and|or|added|removed|is|event)\\b/,\n 'keyword',\n ],\n ],\n completions: [\n {\n label: 'source',\n insertText: 'source ${1:api}',\n documentation: 'Declares where the captured data comes from.',\n },\n {\n label: 'key',\n insertText: 'key ${1:property}',\n documentation: 'Declares which source property identifies an instance.',\n },\n {\n label: 'map',\n insertText: 'map\\n ${1:property} = ${2:source}',\n documentation: 'Maps and translates source values before events are appended.',\n },\n {\n label: 'append',\n insertText: 'append ${1:EventType}\\n when ${2:property}',\n documentation: 'Appends an event when the source data changes.',\n },\n {\n label: 'translate',\n insertText: 'translate\\n \"${1:source}\" => ${2:target}',\n documentation: 'Translates source values into Screenplay values.',\n },\n {\n label: 'children',\n insertText: 'children ${1:collection} identified by ${2:key}',\n documentation: 'Captures changes in a child collection of the source data.',\n },\n {\n label: 'when added',\n insertText: 'when added',\n documentation: 'Appends the event when a new item appears in the source.',\n },\n {\n label: 'when removed',\n insertText: 'when removed',\n documentation: 'Appends the event when an item disappears from the source.',\n },\n ],\n hovers: {\n source: 'CDL — declares where the captured data comes from.',\n api: 'CDL — as a source type, polls an HTTP API; as a source property (`api <ServiceName>`), references a named External Service for the base URL and authentication.',\n route: 'CDL — optional path appended to an API source\\'s External Service base URL.',\n poll: 'CDL — the polling interval for an API source, e.g. 5m.',\n path: 'CDL — the inbound path a webhook source listens on.',\n topic: 'CDL — the topic a message source subscribes to.',\n key: 'CDL — declares which source property identifies an instance. On a `source events` capture, `key <property> is event source` promises each captured event is sourced by that key.',\n is: 'CDL — in `key <property> is event source`, marks the key as the event source of every captured event.',\n map: 'CDL — maps and translates source values before events are appended.',\n translate: 'CDL — translates source values into Screenplay values.',\n append: 'CDL — appends an event when the source data changes.',\n when: 'CDL — the change condition: a property change, added, or removed.',\n added: 'CDL — matches items that appear in the source.',\n removed: 'CDL — matches items that disappear from the source.',\n children: 'CDL — captures changes in a child collection of the source data.',\n identified: 'CDL — introduces the identifying key of a child collection.',\n },\n};\n"],"mappings":"AASA,MAAaA,EAA6B,CACtC,OAAQ,CACJ,CACI,uJACA,SACJ,CACJ,EACA,YAAa,CACT,CACI,MAAO,SACP,WAAY,kBACZ,cAAe,8CACnB,EACA,CACI,MAAO,MACP,WAAY,oBACZ,cAAe,wDACnB,EACA,CACI,MAAO,MACP,WAAY,uCACZ,cAAe,+DACnB,EACA,CACI,MAAO,SACP,WAAY,gDACZ,cAAe,gDACnB,EACA,CACI,MAAO,YACP,WAAY,8CACZ,cAAe,kDACnB,EACA,CACI,MAAO,WACP,WAAY,kDACZ,cAAe,4DACnB,EACA,CACI,MAAO,aACP,WAAY,aACZ,cAAe,0DACnB,EACA,CACI,MAAO,eACP,WAAY,eACZ,cAAe,4DACnB,CACJ,EACA,OAAQ,CACJ,OAAQ,qDACR,IAAK,kKACL,MAAO,6EACP,KAAM,yDACN,KAAM,sDACN,MAAO,kDACP,IAAK,mLACL,GAAI,wGACJ,IAAK,sEACL,UAAW,yDACX,OAAQ,uDACR,KAAM,oEACN,MAAO,iDACP,QAAS,sDACT,SAAU,mEACV,WAAY,6DAChB,CACJ"}
|
package/dist/bundles/tokens.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"./_virtual/_virtual/_rolldown/runtime.js";import{clauseKeywords as e,codeBlockTags as t,constructKeywords as n,primitiveTypes as r,sliceTypes as i}from"./language.js";import{bmpWordCharacters as a}from"./bmp-word-characters.js";const o=/* @__PURE__ */ new Set([`operation`,`system`,`eventsource`,`purpose`,`runs`]),s={csharp:`csharp`,typescript:`typescript`,react:`typescript`,html:`html`,sql:`sql`};function subLanguageState(e){return`subLanguage_${e}`}function subLanguageExitRule(e){let t=[...n.filter(e=>!o.has(e)),...e.map(e=>e.keyword)];return[RegExp(`^\\s*(?:${t.join(`|`)})\\b`),{token:`@rematch`,next:`@pop`}]}const c=[[/\/\/.*$/,`comment`],[/\$(?:context|identity|eventContext|eventSourceId|causedBy|refusal)(?:\.\w+)*/,`variable.predefined`],[/\$(?:env|secrets|strings)\.[\w.]+/,`variable.predefined`],[/\$\.[\w.]*/,`variable.predefined`],[/"(?:[^"\\]|\\.)*"/,`string`],[/"(?:[^"\\]|\\.)*$/,`string.invalid`],[/\d+(?:ms|s|m|h|d)\b/,`number`],[/-?\d+\.\d+/,`number.float`],[/-?\d+/,`number`],[/=>|==|!=|>=|<=|[><=:?]/,`operator`],[/[[\](),.]/,`delimiter`],[/\s+/,`white`]];function createTokensProvider(l){let u={root:[[RegExp(`^(\\s*)(example)(\\s+)([A-Z][${a}]*)(\\s*)(:)(\\s*)([A-Z][${a}.]*)(?=\\s*(?://.*)?$)`),[`white`,`keyword`,`white`,`type.identifier`,`white`,`operator`,`white`,`type.identifier`]],[/^(\s*)(direction)(\s+)(inbound|outbound)(?=\s*(?:\/\/.*)?$)/,[`white`,`keyword`,`white`,`keyword`]],[RegExp(`^()(purpose)(\\s+)([A-Za-z_][${a}]*)(?=\\s*(?://.*)?$)`),[`white`,`keyword`,`white`,{token:`type.identifier`,next:`@purposeBody.$1`}]],[/^(\s*)(parameter)(\s+)([a-z_]\w*)(\s+)([\w.]+(?:\[\])?(?:\s+optional)?)(?=\s*(?:\/\/.*)?$)/,[`white`,`keyword`,`white`,`identifier`,`white`,`type.identifier`]],[/^(\s*)(case)(\s+)([A-Za-z_]\w*)(?=\s*(?:[a-z_]\w*\s*=|\/\/|$))/,[`white`,`keyword`,`white`,`type.identifier`]],[/\b(case)(\.)([a-z_]\w*)\b/,[`keyword`,`delimiter`,`identifier`]],[/^(\s*)(concept)(\s+)([^\s:]+)(\s*:\s*)(\w+)((?:\s+(?:@?pii|personal|@?sensitive|secret))*)(?=\s*(?:\/\/.*)?$)/,[`white`,`keyword`,`white`,`type.identifier`,`operator`,{token:`type.identifier`,next:`@conceptBody.$1`},`keyword`]],[/^(command)(\s+)(reads)(\s+)(protected)(?=\s*(?:\/\/.*)?$)/,[`keyword`,`white`,`keyword`,`white`,`keyword`]],[/^(reaction)(\s+)(batches)(\s+)(atomic)(?=\s*(?:\/\/.*)?$)/,[`keyword`,`white`,`keyword`,`white`,`keyword`]],[/^(numbers)([ \t]+)(exact)(?=[ \t]*(?:(?:\/\/|#).*)?$)/,[`keyword`,`white`,`keyword`]],[/^(eventsource)(\s+)([A-Za-z_]\w*)(?=\s*(?:\/\/.*)?$)/,[`keyword`,`white`,`type.identifier`]],[/^(system)(\s+)([A-Z]\w*)(?=\s*(?:\/\/.*)?$)/,[`keyword`,`white`,`type.identifier`]],[/^(\s*)(runs)(\s+)(as)(\s+)(system)\b/,[`white`,`keyword`,`white`,`keyword`,`white`,`keyword`]],[/^(\s*)(produces\s+operation)(\s+)([A-Z]\w*)(?=\s*(?:\/\/.*)?$)/,[`white`,`keyword`,`white`,{token:`type.identifier`,next:`@operationBody.$1`}]],[/^(\s*)(given\s+operation)(\s+)([\w.]+)(\s+)(fails)(?=\s*(?:\/\/.*)?$)/,[`white`,`keyword`,`white`,`type.identifier`,`white`,`keyword`]],[/^(\s*)(then\s+(?:operation|compensated))(\s+)([\w.]+)(?=\s*(?:\/\/.*)?$)/,[`white`,`keyword`,`white`,`type.identifier`]],[RegExp(`^(\\s*)(command)(\\s+)([A-Za-z_][${a}]*)(?=\\s*(?://.*)?$)`),[`white`,`keyword`,`white`,{token:`type.identifier`,next:`@commandBody.$1`}]],[/^(\s*)(handler)(?=\s*(?:\/\/.*)?$)/,[`white`,{token:`keyword`,next:`@handlerBody.$1`}]],[/^(\s*@?[a-z_]\w*\s+)([\w.]+(?:\[\])?(?:\?|\s+optional)?)(\s+)(generated)(\s+identifier|)(?=\s*(?:\/\/.*)?$)/,[`identifier`,`type.identifier`,`white`,`keyword`,`keyword`]],[/^(\s*)(generated)(\s+)([a-z_]\w*)(\s*=(?!=|>))/,[`white`,`keyword`,`white`,`identifier`,`operator`]],[/^(\s*)(then)(\s+)(returns)\b/,[`white`,`keyword`,`white`,`keyword`]],[/^(\s*)(returns)(?=\s*(?:\/\/.*)?$|\s+@\w+\s*(?:\/\/.*)?$)/,[`white`,`keyword`]],[/^(\s*@?[a-z_]\w*\s+)([\w.]+)(\s+)(key)(?=\s*(?:\/\/.*)?$)/,[`identifier`,`type.identifier`,`white`,`keyword`]],[/^(\s*(?:by|filter)\s+[a-z_]\w*\s+)([\w.]+(?:\[\])?)(\s+)(optional)\b(?=\s*(?:from\b|\/\/|$))/,[`identifier`,`type.identifier`,`white`,`keyword`]],[/^(?!\s*(?:by|filter)\s+)(\s*@?[a-z_]\w*\s+)([\w.]+(?:\[\])?)(\s+)(optional)\b(?=\s*(?:identifier\b|from\b|=(?!=|>)|\/\/|$))/,[`identifier`,`type.identifier`,`white`,`keyword`]],[/^(\s*query\s+[A-Za-z_]\w*\s*=>\s*(?!observable\s+optional\s*(?:\/\/.*)?$)(?:observable\s+)?)([\w.]+(?:\[\])?)(\s+)(optional)\b(?=\s*(?:\/\/.*)?$)/,[`keyword`,`type.identifier`,`white`,`keyword`]],[RegExp(`^(\\s*)(given)(\\s+)(caller)(\\s+)(as)(\\s+)([A-Za-z_][${a}]*)(?=\\s*(?://.*)?$)`),[`white`,`keyword`,`white`,`keyword`,`white`,`keyword`,`white`,`type.identifier`]],[/^(\s*)(given|when)(\s+)(clock|capture|trigger|query)\b/,[`white`,`keyword`,`white`,`keyword`]],[/^(\s*)(then)(\s+)(result|no\s+(?:result|events))\b/,[`white`,`keyword`,`white`,`keyword`]],[/^(\s*)(then)(\s+)(events)(\s+)(in any order)(?=\s*(?:\/\/.*)?$)/,[`white`,`keyword`,`white`,`keyword`,`white`,`keyword`]],[/^(\s*)(when)(\s+)(redelivered)(\s+)([\w.]+)(\s+)(to)(\s+)([\w.]+)(?=\s*(?:\/\/.*)?$)/,[`white`,`keyword`,`white`,`keyword`,`white`,`type.identifier`,`white`,`keyword`,`white`,`type.identifier`]],[/^(\s*)(otherwise)(\s+)(hidden)(?=\s*(?:\/\/.*)?$)/,[`white`,`keyword`,`white`,`keyword`]],[/^(\s*)(otherwise)(\s+)(execute)(\s+)([\w.]+)(?=\s*(?:\/\/.*)?$)/,[`white`,`keyword`,`white`,`keyword`,`white`,`type.identifier`]],[/^(\s*)(when)(\s+)(?=.+\s+execute\s+[\w.]+\s*(?:\/\/.*)?$)/,[`white`,`keyword`,{token:`white`,next:`@guardedActionCondition`}]],[/^(\s*)(behavior)(\s+)([A-Za-z_]\w*)(?=\s*(?:\/\/.*)?$)/,[`white`,`keyword`,`white`,{token:`type.identifier`,next:`@behaviorBody.$1`}]],[/^(\s*)(on)(\s+)(refused)(\s+)(by)(\s+)(validation|constraint|authorization)\b/,[`white`,`keyword`,`white`,`keyword`,`white`,`keyword`,`white`,`keyword`]],[/^(\s*)(on)(\s+)(refused)(?=\s*(?:\/\/.*)?$)/,[`white`,`keyword`,`white`,`keyword`]],[/^(\s*)(on)(\s+)([\w-]+)\b/,[`white`,`keyword`,`white`,{token:`keyword`,next:`@interactionBody.$1`}]],[/^(\s*)(acknowledge)(?=\s*(?:\/\/.*)?$)/,[`white`,`keyword`]],[/^(\s*)(import)(\s+)("[^"\\]*")/,[`white`,`keyword`,`white`,`string.link`]],[/^(\s*)((?:(?:produces|public)\s+)?event)(\s+)([A-Za-z_]\w*)(\s+)(generation)(\s+)(\d+)(?=\s*(?:from\s+"(?:[^"\\]|\\.)*"\s*)?(?:\/\/.*)?$)/,[`white`,`keyword`,`white`,`type.identifier`,`white`,`keyword`,`white`,{token:`number`,next:`@eventBody.$1`}]],[/^(\s*)((?:(?:produces|public)\s+)?event)(\s+)([A-Za-z_]\w*)(?=\s*(?:from\s+"(?:[^"\\]|\\.)*"\s*)?(?:\/\/.*)?$)/,[`white`,`keyword`,`white`,{token:`type.identifier`,next:`@eventBody.$1`}]],...t.map(e=>[RegExp(`^\\s*\\x60\\x60\\x60${e}\\s*$`),{token:`string.quote`,next:`@codeBlock.${s[e]}`,nextEmbedded:s[e]}]),...t.map(e=>[RegExp(`\\b${e}\\b(?=\\s*$)`),{token:`keyword.tag`,next:`@codeBlockPending.${s[e]}`}]),...l.map(e=>[RegExp(`\\b${e.keyword}\\b`),{token:`keyword`,next:`@${subLanguageState(e.keyword)}`}]),[/^(\s*)(documentation)(?=\s+[\w.]+(?:\[\])?(?:\?|\s+optional)?\s*(?:identifier\b|generated\b|=(?!=|>)|\/\/|$))/,[`white`,`identifier`]],[/\b(?:description|documentation)\b(?=\s*(?:\/\/.*)?$)/,{token:`keyword`,next:`@descriptionBlockPending`}],[/\brow-click\b/,`keyword`],[/^\s*@[a-z_]\w*/,`identifier`],[/@\w+/,`annotation`],[/[A-Z]\w*/,{cases:{"@sliceTypes":`keyword.type`,"@primitiveTypes":`type`,"@default":`type.identifier`}}],[/[a-z_]\w*/,{cases:{"@keywords":`keyword`,"@default":`identifier`}}],{include:`@common`}],guardedActionCondition:[[/(execute)(\s+)([\w.]+)(?=\s*(?:\/\/.*)?$)/,[`keyword`,`white`,{token:`type.identifier`,next:`@pop`}]],{include:`@root`}],behaviorBody:[[/^(?!$S2[ \t]+|\s*$)/,{token:`@rematch`,next:`@pop`}],{include:`@root`}],interactionBody:[[/^(?!$S2[ \t]+|\s*$)/,{token:`@rematch`,next:`@pop`}],[/^(\s*)(otherwise)(?=\s*(?:\/\/.*)?$)/,[`white`,`keyword`]],[/^(\s*)(when)(\s+)(?=item\.|\()/,[`white`,`keyword`,`white`]],[/^(\s*)(execute)(\s+)([\w.]+)(?=\s*(?:\/\/.*)?$)/,[`white`,`keyword`,`white`,`type.identifier`]],{include:`@root`}],purposeBody:[[/^(?!$S2[ \t]+|\s*$)/,{token:`@rematch`,next:`@pop`}],[/^(\s*)(basis|interest|condition|authorization|subjects|retention|recipient|transfer|erasure)(\s+)/,[`white`,`keyword`,`white`]],[/\b(safeguard|exception)\b/,`keyword`],{include:`@root`}],generationLine:[[/^/,{token:`@rematch`,next:`@pop`}],[/\b(prefix|case|alphabet|checksum|base64url|hex|base32|lower|upper|luhn|mod11|mod97)\b/,`keyword`],{include:`@common`}],conceptBody:[[/^(?!$S2[ \t]+|\s*$)/,{token:`@rematch`,next:`@pop`}],[/^(\s*)(validate)(\s+)(checksum)(\s+)(luhn|mod11|mod97)\b/,[`white`,`keyword`,`white`,`keyword`,`white`,`keyword`]],[/^(\s*)(checksum)(\s+)(luhn|mod11|mod97)\b/,[`white`,`keyword`,`white`,`keyword`]],[RegExp(`^(\\s*)(@?[a-z_][${a}]*)(\\s*)(=)(\\s*)(-?(?:0|[1-9][0-9]*))(?=\\s*(?://.*)?$)`),[`white`,`identifier`,`white`,`operator`,`white`,`number`]],[/^(\s*)(@?pii|personal|@?sensitive|secret)(\s+)(reason|scope|special|criminal)\b/,[`white`,`keyword`,`white`,`keyword`]],[/^(\s*)(generate)(\s+)(uuidv7|uuid|ulid|typeid|nanoid|bytes|pattern|random|rule|sequence)\b/,[`white`,`keyword`,`white`,{token:`keyword`,next:`@generationLine`}]],{include:`@root`}],commandBody:[[/^(?!$S2[ \t]+|\s*$)/,{token:`@rematch`,next:`@pop`}],[/^(\s*)(validate)(?=\s*(?:\/\/.*)?$)/,[`white`,{token:`keyword`,next:`@commandValidation.$1`}]],{include:`@root`}],commandValidation:[[/^(?!$S2[ \t]+|\s*$)/,{token:`@rematch`,next:`@pop`}],[RegExp(`^(\\s*)([${a}.]+)(\\s+)(rule)(\\s+)([A-Za-z_][${a}]*)(?=\\s*(?:severity\\s+\\w+|message\\s+.*|//.*|$))`),[`white`,`identifier`,`white`,`keyword`,`white`,{token:`type.identifier`,next:`@namedRuleBody.$1`}]],{include:`@root`}],namedRuleBody:[[/^(?!$S2[ \t]+|\s*$)/,{token:`@rematch`,next:`@pop`}],[/^(\s*)(implementation)(?=\s*(?:\/\/.*)?$)/,[`white`,{token:`keyword`,next:`@implementationBody.$1`}]],{include:`@root`}],operationBody:[[/^(?!$S2[ \t]+|\s*$)/,{token:`@rematch`,next:`@pop`}],[/^(\s*)(execute|compensate)(?=\s*(?:\/\/.*)?$)/,[`white`,{token:`keyword`,next:`@operationPhase.$1`}]],[/^(\s*)(uses)(\s+)([A-Z]\w*)(?=\s*(?:\/\/.*)?$)/,[`white`,`keyword`,`white`,`type.identifier`]],[/^(\s*)(@?[a-z_]\w*)(\s+)([\w.]+(?:\[\])?(?:\?|\s+optional)?)(?=\s*(?:=(?!=|>)|\/\/|$))/,[`white`,`identifier`,`white`,`type.identifier`]],{include:`@root`}],operationPhase:[[/^(?!$S2[ \t]+|\s*$)/,{token:`@rematch`,next:`@pop`}],[/^(\s*)(implementation)(?=\s*(?:\/\/.*)?$)/,[`white`,{token:`keyword`,next:`@implementationBody.$1`}]],{include:`@root`}],handlerBody:[[/^(?!$S2[ \t]+|\s*$)/,{token:`@rematch`,next:`@pop`}],[/^(\s*)(implementation)(?=\s*(?:\/\/.*)?$)/,[`white`,{token:`keyword`,next:`@implementationBody.$1`}]],{include:`@root`}],implementationBody:[[/^(?!$S2[ \t]+|\s*$)/,{token:`@rematch`,next:`@pop`}],[/^(\s*)(hint)(?=\s+")/,[`white`,`keyword`]],{include:`@root`}],eventBody:[[/^(?!$S2[ \t]+|\s*$)/,{token:`@rematch`,next:`@pop`}],[/^(\s*)(id)(?=\s+")/,[`white`,`keyword`]],[/^(\s*)(documentation)(?=\s*(?:\/\/.*)?$)/,[`white`,{token:`keyword`,next:`@descriptionBlockPending`}]],{include:`@root`}],common:c,codeBlockPending:[[/^\s*```\s*$/,{token:`string.quote`,switchTo:`@codeBlock.$S2`,nextEmbedded:`$S2`}],[/^\s*[^\s`].*$/,{token:`@rematch`,next:`@pop`}],[/\s+/,`white`]],codeBlock:[[/^\s*```\s*$/,{token:`string.quote`,next:`@pop`,nextEmbedded:`@pop`}],[/[^`]+/,``],[/`/,``]],descriptionBlockPending:[[/\/\/.*$/,`comment`],[/^\s*```(?:text|markdown)?\s*$/,{token:`string.quote`,switchTo:`@descriptionBlock`}],[/^\s*[^\s`].*$/,{token:`@rematch`,next:`@pop`}],[/\s+/,`white`]],descriptionBlock:[[/^\s*```\s*$/,{token:`string.quote`,next:`@pop`}],[/.+/,`string`]]};for(let e of l)u[subLanguageState(e.keyword)]=[subLanguageExitRule(l),...e.tokens,{include:`@common`},[/[A-Z]\w*/,`type.identifier`],[/[a-z_]\w*/,`identifier`]];return{defaultToken:``,tokenPostfix:`.play`,ignoreCase:!1,keywords:[...n.filter(e=>!o.has(e)),...e,...t],sliceTypes:i,primitiveTypes:r,tokenizer:u}}export{c as commonTokenRules,createTokensProvider};
|
|
1
|
+
import"./_virtual/_virtual/_rolldown/runtime.js";import{clauseKeywords as e,codeBlockTags as t,constructKeywords as n,primitiveTypes as r,sliceTypes as i}from"./language.js";import{bmpWordCharacters as a}from"./bmp-word-characters.js";const o=/* @__PURE__ */ new Set([`operation`,`system`,`eventsource`,`purpose`,`runs`,`time`]),s={csharp:`csharp`,typescript:`typescript`,react:`typescript`,html:`html`,sql:`sql`};function subLanguageState(e){return`subLanguage_${e}`}function subLanguageExitRule(e){let t=[...n.filter(e=>!o.has(e)),...e.map(e=>e.keyword)];return[RegExp(`^\\s*(?:${t.join(`|`)})\\b`),{token:`@rematch`,next:`@pop`}]}const c=[[/\/\/.*$/,`comment`],[/\$(?:context|identity|eventContext|eventSourceId|causedBy|refusal)(?:\.\w+)*/,`variable.predefined`],[/\$(?:env|secrets|strings)\.[\w.]+/,`variable.predefined`],[/\$\.[\w.]*/,`variable.predefined`],[/"(?:[^"\\]|\\.)*"/,`string`],[/"(?:[^"\\]|\\.)*$/,`string.invalid`],[/\d+(?:ms|s|m|h|d)\b/,`number`],[/-?\d+\.\d+/,`number.float`],[/-?\d+/,`number`],[/=>|==|!=|>=|<=|[><=:?]/,`operator`],[/[[\](),.]/,`delimiter`],[/\s+/,`white`]];function createTokensProvider(l){let u={root:[[RegExp(`^(\\s*)(example)(\\s+)([A-Z][${a}]*)(\\s*)(:)(\\s*)([A-Z][${a}.]*)(?=\\s*(?://.*)?$)`),[`white`,`keyword`,`white`,`type.identifier`,`white`,`operator`,`white`,`type.identifier`]],[/^(time)(\s+)(zone)(\s+)(configurable\s+default\s+)?(?=")/,[`keyword`,`white`,`keyword`,`white`,`keyword`]],[/^(\s*)(calendar)(\s+)(?="|from\s+\$context\.)/,[`white`,`keyword`,`white`]],[/^(\s*)(given)(\s+)(time)(\s+)(zone)(?=\s+")/,[`white`,`keyword`,`white`,`keyword`,`white`,`keyword`]],[/^(\s*)(direction)(\s+)(inbound|outbound)(?=\s*(?:\/\/.*)?$)/,[`white`,`keyword`,`white`,`keyword`]],[RegExp(`^()(purpose)(\\s+)([A-Za-z_][${a}]*)(?=\\s*(?://.*)?$)`),[`white`,`keyword`,`white`,{token:`type.identifier`,next:`@purposeBody.$1`}]],[/^(\s*)(parameter)(\s+)([a-z_]\w*)(\s+)([\w.]+(?:\[\])?(?:\s+optional)?)(?=\s*(?:\/\/.*)?$)/,[`white`,`keyword`,`white`,`identifier`,`white`,`type.identifier`]],[/^(\s*)(case)(\s+)([A-Za-z_]\w*)(?=\s*(?:[a-z_]\w*\s*=|\/\/|$))/,[`white`,`keyword`,`white`,`type.identifier`]],[/\b(case)(\.)([a-z_]\w*)\b/,[`keyword`,`delimiter`,`identifier`]],[/^(\s*)(concept)(\s+)([^\s:]+)(\s*:\s*)(\w+)((?:\s+(?:@?pii|personal|@?sensitive|secret))*)(?=\s*(?:\/\/.*)?$)/,[`white`,`keyword`,`white`,`type.identifier`,`operator`,{token:`type.identifier`,next:`@conceptBody.$1`},`keyword`]],[/^(command)(\s+)(reads)(\s+)(protected)(?=\s*(?:\/\/.*)?$)/,[`keyword`,`white`,`keyword`,`white`,`keyword`]],[/^(reaction)(\s+)(batches)(\s+)(atomic)(?=\s*(?:\/\/.*)?$)/,[`keyword`,`white`,`keyword`,`white`,`keyword`]],[/^(numbers)([ \t]+)(exact)(?=[ \t]*(?:(?:\/\/|#).*)?$)/,[`keyword`,`white`,`keyword`]],[/^(eventsource)(\s+)([A-Za-z_]\w*)(?=\s*(?:\/\/.*)?$)/,[`keyword`,`white`,`type.identifier`]],[/^(system)(\s+)([A-Z]\w*)(?=\s*(?:\/\/.*)?$)/,[`keyword`,`white`,`type.identifier`]],[/^(\s*)(runs)(\s+)(as)(\s+)(system)\b/,[`white`,`keyword`,`white`,`keyword`,`white`,`keyword`]],[/^(\s*)(produces\s+operation)(\s+)([A-Z]\w*)(?=\s*(?:\/\/.*)?$)/,[`white`,`keyword`,`white`,{token:`type.identifier`,next:`@operationBody.$1`}]],[/^(\s*)(given\s+operation)(\s+)([\w.]+)(\s+)(fails)(?=\s*(?:\/\/.*)?$)/,[`white`,`keyword`,`white`,`type.identifier`,`white`,`keyword`]],[/^(\s*)(then\s+(?:operation|compensated))(\s+)([\w.]+)(?=\s*(?:\/\/.*)?$)/,[`white`,`keyword`,`white`,`type.identifier`]],[RegExp(`^(\\s*)(command)(\\s+)([A-Za-z_][${a}]*)(?=\\s*(?://.*)?$)`),[`white`,`keyword`,`white`,{token:`type.identifier`,next:`@commandBody.$1`}]],[/^(\s*)(handler)(?=\s*(?:\/\/.*)?$)/,[`white`,{token:`keyword`,next:`@handlerBody.$1`}]],[/^(\s*@?[a-z_]\w*\s+)([\w.]+(?:\[\])?(?:\?|\s+optional)?)(\s+)(generated)(\s+identifier|)(?=\s*(?:\/\/.*)?$)/,[`identifier`,`type.identifier`,`white`,`keyword`,`keyword`]],[/^(\s*)(generated)(\s+)([a-z_]\w*)(\s*=(?!=|>))/,[`white`,`keyword`,`white`,`identifier`,`operator`]],[/^(\s*)(then)(\s+)(returns)\b/,[`white`,`keyword`,`white`,`keyword`]],[/^(\s*)(returns)(?=\s*(?:\/\/.*)?$|\s+@\w+\s*(?:\/\/.*)?$)/,[`white`,`keyword`]],[/^(\s*@?[a-z_]\w*\s+)([\w.]+)(\s+)(key)(?=\s*(?:\/\/.*)?$)/,[`identifier`,`type.identifier`,`white`,`keyword`]],[/^(\s*(?:by|filter)\s+[a-z_]\w*\s+)([\w.]+(?:\[\])?)(\s+)(optional)\b(?=\s*(?:from\b|\/\/|$))/,[`identifier`,`type.identifier`,`white`,`keyword`]],[/^(?!\s*(?:by|filter)\s+)(\s*@?[a-z_]\w*\s+)([\w.]+(?:\[\])?)(\s+)(optional)\b(?=\s*(?:identifier\b|from\b|=(?!=|>)|\/\/|$))/,[`identifier`,`type.identifier`,`white`,`keyword`]],[/^(\s*query\s+[A-Za-z_]\w*\s*=>\s*(?!observable\s+optional\s*(?:\/\/.*)?$)(?:observable\s+)?)([\w.]+(?:\[\])?)(\s+)(optional)\b(?=\s*(?:\/\/.*)?$)/,[`keyword`,`type.identifier`,`white`,`keyword`]],[RegExp(`^(\\s*)(given)(\\s+)(caller)(\\s+)(as)(\\s+)([A-Za-z_][${a}]*)(?=\\s*(?://.*)?$)`),[`white`,`keyword`,`white`,`keyword`,`white`,`keyword`,`white`,`type.identifier`]],[/^(\s*)(given|when)(\s+)(clock|capture|trigger|query)\b/,[`white`,`keyword`,`white`,`keyword`]],[/^(\s*)(then)(\s+)(result|no\s+(?:result|events))\b/,[`white`,`keyword`,`white`,`keyword`]],[/^(\s*)(then)(\s+)(events)(\s+)(in any order)(?=\s*(?:\/\/.*)?$)/,[`white`,`keyword`,`white`,`keyword`,`white`,`keyword`]],[/^(\s*)(when)(\s+)(redelivered)(\s+)([\w.]+)(\s+)(to)(\s+)([\w.]+)(?=\s*(?:\/\/.*)?$)/,[`white`,`keyword`,`white`,`keyword`,`white`,`type.identifier`,`white`,`keyword`,`white`,`type.identifier`]],[/^(\s*)(otherwise)(\s+)(hidden)(?=\s*(?:\/\/.*)?$)/,[`white`,`keyword`,`white`,`keyword`]],[/^(\s*)(otherwise)(\s+)(execute)(\s+)([\w.]+)(?=\s*(?:\/\/.*)?$)/,[`white`,`keyword`,`white`,`keyword`,`white`,`type.identifier`]],[/^(\s*)(when)(\s+)(?=.+\s+execute\s+[\w.]+\s*(?:\/\/.*)?$)/,[`white`,`keyword`,{token:`white`,next:`@guardedActionCondition`}]],[/^(\s*)(behavior)(\s+)([A-Za-z_]\w*)(?=\s*(?:\/\/.*)?$)/,[`white`,`keyword`,`white`,{token:`type.identifier`,next:`@behaviorBody.$1`}]],[/^(\s*)(on)(\s+)(refused)(\s+)(by)(\s+)(validation|constraint|authorization)\b/,[`white`,`keyword`,`white`,`keyword`,`white`,`keyword`,`white`,`keyword`]],[/^(\s*)(on)(\s+)(refused)(?=\s*(?:\/\/.*)?$)/,[`white`,`keyword`,`white`,`keyword`]],[/^(\s*)(on)(\s+)([\w-]+)\b/,[`white`,`keyword`,`white`,{token:`keyword`,next:`@interactionBody.$1`}]],[/^(\s*)(acknowledge)(?=\s*(?:\/\/.*)?$)/,[`white`,`keyword`]],[/^(\s*)(import)(\s+)("[^"\\]*")/,[`white`,`keyword`,`white`,`string.link`]],[/^(\s*)((?:(?:produces|public)\s+)?event)(\s+)([A-Za-z_]\w*)(\s+)(generation)(\s+)(\d+)(?=\s*(?:from\s+"(?:[^"\\]|\\.)*"\s*)?(?:\/\/.*)?$)/,[`white`,`keyword`,`white`,`type.identifier`,`white`,`keyword`,`white`,{token:`number`,next:`@eventBody.$1`}]],[/^(\s*)((?:(?:produces|public)\s+)?event)(\s+)([A-Za-z_]\w*)(?=\s*(?:from\s+"(?:[^"\\]|\\.)*"\s*)?(?:\/\/.*)?$)/,[`white`,`keyword`,`white`,{token:`type.identifier`,next:`@eventBody.$1`}]],...t.map(e=>[RegExp(`^\\s*\\x60\\x60\\x60${e}\\s*$`),{token:`string.quote`,next:`@codeBlock.${s[e]}`,nextEmbedded:s[e]}]),...t.map(e=>[RegExp(`\\b${e}\\b(?=\\s*$)`),{token:`keyword.tag`,next:`@codeBlockPending.${s[e]}`}]),...l.map(e=>[RegExp(`\\b${e.keyword}\\b`),{token:`keyword`,next:`@${subLanguageState(e.keyword)}`}]),[/^(\s*)(documentation)(?=\s+[\w.]+(?:\[\])?(?:\?|\s+optional)?\s*(?:identifier\b|generated\b|=(?!=|>)|\/\/|$))/,[`white`,`identifier`]],[/\b(?:description|documentation)\b(?=\s*(?:\/\/.*)?$)/,{token:`keyword`,next:`@descriptionBlockPending`}],[/\brow-click\b/,`keyword`],[/^\s*@[a-z_]\w*/,`identifier`],[/@\w+/,`annotation`],[/[A-Z]\w*/,{cases:{"@sliceTypes":`keyword.type`,"@primitiveTypes":`type`,"@default":`type.identifier`}}],[/[a-z_]\w*/,{cases:{"@keywords":`keyword`,"@default":`identifier`}}],{include:`@common`}],guardedActionCondition:[[/(execute)(\s+)([\w.]+)(?=\s*(?:\/\/.*)?$)/,[`keyword`,`white`,{token:`type.identifier`,next:`@pop`}]],{include:`@root`}],behaviorBody:[[/^(?!$S2[ \t]+|\s*$)/,{token:`@rematch`,next:`@pop`}],{include:`@root`}],interactionBody:[[/^(?!$S2[ \t]+|\s*$)/,{token:`@rematch`,next:`@pop`}],[/^(\s*)(otherwise)(?=\s*(?:\/\/.*)?$)/,[`white`,`keyword`]],[/^(\s*)(when)(\s+)(?=item\.|\()/,[`white`,`keyword`,`white`]],[/^(\s*)(execute)(\s+)([\w.]+)(?=\s*(?:\/\/.*)?$)/,[`white`,`keyword`,`white`,`type.identifier`]],{include:`@root`}],purposeBody:[[/^(?!$S2[ \t]+|\s*$)/,{token:`@rematch`,next:`@pop`}],[/^(\s*)(basis|interest|condition|authorization|subjects|retention|recipient|transfer|erasure)(\s+)/,[`white`,`keyword`,`white`]],[/\b(safeguard|exception)\b/,`keyword`],{include:`@root`}],generationLine:[[/^/,{token:`@rematch`,next:`@pop`}],[/\b(prefix|case|alphabet|checksum|base64url|hex|base32|lower|upper|luhn|mod11|mod97)\b/,`keyword`],{include:`@common`}],conceptBody:[[/^(?!$S2[ \t]+|\s*$)/,{token:`@rematch`,next:`@pop`}],[/^(\s*)(validate)(\s+)(checksum)(\s+)(luhn|mod11|mod97)\b/,[`white`,`keyword`,`white`,`keyword`,`white`,`keyword`]],[/^(\s*)(checksum)(\s+)(luhn|mod11|mod97)\b/,[`white`,`keyword`,`white`,`keyword`]],[RegExp(`^(\\s*)(@?[a-z_][${a}]*)(\\s*)(=)(\\s*)(-?(?:0|[1-9][0-9]*))(?=\\s*(?://.*)?$)`),[`white`,`identifier`,`white`,`operator`,`white`,`number`]],[/^(\s*)(@?pii|personal|@?sensitive|secret)(\s+)(reason|scope|special|criminal)\b/,[`white`,`keyword`,`white`,`keyword`]],[/^(\s*)(generate)(\s+)(uuidv7|uuid|ulid|typeid|nanoid|bytes|pattern|random|rule|sequence)\b/,[`white`,`keyword`,`white`,{token:`keyword`,next:`@generationLine`}]],{include:`@root`}],commandBody:[[/^(?!$S2[ \t]+|\s*$)/,{token:`@rematch`,next:`@pop`}],[/^(\s*)(validate)(?=\s*(?:\/\/.*)?$)/,[`white`,{token:`keyword`,next:`@commandValidation.$1`}]],{include:`@root`}],commandValidation:[[/^(?!$S2[ \t]+|\s*$)/,{token:`@rematch`,next:`@pop`}],[RegExp(`^(\\s*)([${a}.]+)(\\s+)(rule)(\\s+)([A-Za-z_][${a}]*)(?=\\s*(?:severity\\s+\\w+|message\\s+.*|//.*|$))`),[`white`,`identifier`,`white`,`keyword`,`white`,{token:`type.identifier`,next:`@namedRuleBody.$1`}]],{include:`@root`}],namedRuleBody:[[/^(?!$S2[ \t]+|\s*$)/,{token:`@rematch`,next:`@pop`}],[/^(\s*)(implementation)(?=\s*(?:\/\/.*)?$)/,[`white`,{token:`keyword`,next:`@implementationBody.$1`}]],{include:`@root`}],operationBody:[[/^(?!$S2[ \t]+|\s*$)/,{token:`@rematch`,next:`@pop`}],[/^(\s*)(execute|compensate)(?=\s*(?:\/\/.*)?$)/,[`white`,{token:`keyword`,next:`@operationPhase.$1`}]],[/^(\s*)(uses)(\s+)([A-Z]\w*)(?=\s*(?:\/\/.*)?$)/,[`white`,`keyword`,`white`,`type.identifier`]],[/^(\s*)(@?[a-z_]\w*)(\s+)([\w.]+(?:\[\])?(?:\?|\s+optional)?)(?=\s*(?:=(?!=|>)|\/\/|$))/,[`white`,`identifier`,`white`,`type.identifier`]],{include:`@root`}],operationPhase:[[/^(?!$S2[ \t]+|\s*$)/,{token:`@rematch`,next:`@pop`}],[/^(\s*)(implementation)(?=\s*(?:\/\/.*)?$)/,[`white`,{token:`keyword`,next:`@implementationBody.$1`}]],{include:`@root`}],handlerBody:[[/^(?!$S2[ \t]+|\s*$)/,{token:`@rematch`,next:`@pop`}],[/^(\s*)(implementation)(?=\s*(?:\/\/.*)?$)/,[`white`,{token:`keyword`,next:`@implementationBody.$1`}]],{include:`@root`}],implementationBody:[[/^(?!$S2[ \t]+|\s*$)/,{token:`@rematch`,next:`@pop`}],[/^(\s*)(hint)(?=\s+")/,[`white`,`keyword`]],{include:`@root`}],eventBody:[[/^(?!$S2[ \t]+|\s*$)/,{token:`@rematch`,next:`@pop`}],[/^(\s*)(id)(?=\s+")/,[`white`,`keyword`]],[/^(\s*)(documentation)(?=\s*(?:\/\/.*)?$)/,[`white`,{token:`keyword`,next:`@descriptionBlockPending`}]],{include:`@root`}],common:c,codeBlockPending:[[/^\s*```\s*$/,{token:`string.quote`,switchTo:`@codeBlock.$S2`,nextEmbedded:`$S2`}],[/^\s*[^\s`].*$/,{token:`@rematch`,next:`@pop`}],[/\s+/,`white`]],codeBlock:[[/^\s*```\s*$/,{token:`string.quote`,next:`@pop`,nextEmbedded:`@pop`}],[/[^`]+/,``],[/`/,``]],descriptionBlockPending:[[/\/\/.*$/,`comment`],[/^\s*```(?:text|markdown)?\s*$/,{token:`string.quote`,switchTo:`@descriptionBlock`}],[/^\s*[^\s`].*$/,{token:`@rematch`,next:`@pop`}],[/\s+/,`white`]],descriptionBlock:[[/^\s*```\s*$/,{token:`string.quote`,next:`@pop`}],[/.+/,`string`]]};for(let e of l)u[subLanguageState(e.keyword)]=[subLanguageExitRule(l),...e.tokens,{include:`@common`},[/[A-Z]\w*/,`type.identifier`],[/[a-z_]\w*/,`identifier`]];return{defaultToken:``,tokenPostfix:`.play`,ignoreCase:!1,keywords:[...n.filter(e=>!o.has(e)),...e,...t],sliceTypes:i,primitiveTypes:r,tokenizer:u}}export{c as commonTokenRules,createTokensProvider};
|
|
2
2
|
//# sourceMappingURL=tokens.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokens.js","names":["contextualConstructs","embeddedLanguages","keyword","exitKeywords","constructKeywords","subLanguages","subLanguage","commonTokenRules","tokenizer","bmpWordCharacters","codeBlockTags","tag","clauseKeywords"],"sources":["../../tokens.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 type { languages } from 'monaco-editor';\nimport {\n clauseKeywords,\n codeBlockTags,\n constructKeywords,\n primitiveTypes,\n sliceTypes,\n} from './language';\nimport { MonarchTokenRules, SubLanguage } from './sub-language-registry';\nimport { bmpWordCharacters } from './bmp-word-characters';\n\n// Maps a Screenplay inline code tag to the Monaco language id used for embedded highlighting.\n// Declaration registration must not globally reserve existing property names.\n// Ambiguous standalone operation headers are supplied by typed semantic tokens.\nconst contextualConstructs = new Set(['operation', 'system', 'eventsource', 'purpose', 'runs']);\n\nconst embeddedLanguages: Record<string, string> = {\n csharp: 'csharp',\n typescript: 'typescript',\n react: 'typescript',\n html: 'html',\n sql: 'sql',\n};\n\nfunction subLanguageState(keyword: string): string {\n return `subLanguage_${keyword}`;\n}\n\n// A construct keyword at the start of a line ends any indented sub-language block.\nfunction subLanguageExitRule(subLanguages: SubLanguage[]): MonarchTokenRules[number] {\n const exitKeywords = [...constructKeywords.filter(keyword => !contextualConstructs.has(keyword)), ...subLanguages.map((subLanguage) => subLanguage.keyword)];\n return [\n new RegExp(`^\\\\s*(?:${exitKeywords.join('|')})\\\\b`),\n { token: '@rematch', next: '@pop' },\n ];\n}\n\n// Shared across the composite `.play` tokenizer and every standalone sub-language tokenizer\n// (comments, `$`-prefixed context variables, strings, numbers, operators, delimiters, whitespace).\nexport const commonTokenRules: MonarchTokenRules = [\n [/\\/\\/.*$/, 'comment'],\n [/\\$(?:context|identity|eventContext|eventSourceId|causedBy|refusal)(?:\\.\\w+)*/, 'variable.predefined'],\n [/\\$(?:env|secrets|strings)\\.[\\w.]+/, 'variable.predefined'],\n [/\\$\\.[\\w.]*/, 'variable.predefined'],\n [/\"(?:[^\"\\\\]|\\\\.)*\"/, 'string'],\n [/\"(?:[^\"\\\\]|\\\\.)*$/, 'string.invalid'],\n [/\\d+(?:ms|s|m|h|d)\\b/, 'number'],\n [/-?\\d+\\.\\d+/, 'number.float'],\n [/-?\\d+/, 'number'],\n [/=>|==|!=|>=|<=|[><=:?]/, 'operator'],\n [/[[\\](),.]/, 'delimiter'],\n [/\\s+/, 'white'],\n];\n\nexport function createTokensProvider(subLanguages: SubLanguage[]): languages.IMonarchLanguage {\n const tokenizer: Record<string, MonarchTokenRules> = {\n root: [\n [new RegExp(`^(\\\\s*)(example)(\\\\s+)([A-Z][${bmpWordCharacters}]*)(\\\\s*)(:)(\\\\s*)([A-Z][${bmpWordCharacters}.]*)(?=\\\\s*(?://.*)?$)`),\n ['white', 'keyword', 'white', 'type.identifier', 'white', 'operator', 'white', 'type.identifier']],\n [/^(\\s*)(direction)(\\s+)(inbound|outbound)(?=\\s*(?:\\/\\/.*)?$)/, ['white', 'keyword', 'white', 'keyword']],\n [new RegExp(`^()(purpose)(\\\\s+)([A-Za-z_][${bmpWordCharacters}]*)(?=\\\\s*(?://.*)?$)`), ['white', 'keyword', 'white', { token: 'type.identifier', next: '@purposeBody.$1' }]],\n [/^(\\s*)(parameter)(\\s+)([a-z_]\\w*)(\\s+)([\\w.]+(?:\\[\\])?(?:\\s+optional)?)(?=\\s*(?:\\/\\/.*)?$)/, ['white', 'keyword', 'white', 'identifier', 'white', 'type.identifier']],\n [/^(\\s*)(case)(\\s+)([A-Za-z_]\\w*)(?=\\s*(?:[a-z_]\\w*\\s*=|\\/\\/|$))/, ['white', 'keyword', 'white', 'type.identifier']],\n [/\\b(case)(\\.)([a-z_]\\w*)\\b/, ['keyword', 'delimiter', 'identifier']],\n [/^(\\s*)(concept)(\\s+)([^\\s:]+)(\\s*:\\s*)(\\w+)((?:\\s+(?:@?pii|personal|@?sensitive|secret))*)(?=\\s*(?:\\/\\/.*)?$)/, ['white', 'keyword', 'white', 'type.identifier', 'operator', { token: 'type.identifier', next: '@conceptBody.$1' }, 'keyword']],\n [/^(command)(\\s+)(reads)(\\s+)(protected)(?=\\s*(?:\\/\\/.*)?$)/, ['keyword', 'white', 'keyword', 'white', 'keyword']],\n [/^(reaction)(\\s+)(batches)(\\s+)(atomic)(?=\\s*(?:\\/\\/.*)?$)/, ['keyword', 'white', 'keyword', 'white', 'keyword']],\n [/^(numbers)([ \\t]+)(exact)(?=[ \\t]*(?:(?:\\/\\/|#).*)?$)/, ['keyword', 'white', 'keyword']],\n [/^(eventsource)(\\s+)([A-Za-z_]\\w*)(?=\\s*(?:\\/\\/.*)?$)/, ['keyword', 'white', 'type.identifier']],\n [/^(system)(\\s+)([A-Z]\\w*)(?=\\s*(?:\\/\\/.*)?$)/, ['keyword', 'white', 'type.identifier']],\n // 'runs' is contextual: only a reaction's identity line is a keyword; a property called runs keeps its name.\n [/^(\\s*)(runs)(\\s+)(as)(\\s+)(system)\\b/, ['white', 'keyword', 'white', 'keyword', 'white', 'keyword']],\n [/^(\\s*)(produces\\s+operation)(\\s+)([A-Z]\\w*)(?=\\s*(?:\\/\\/.*)?$)/,\n ['white', 'keyword', 'white', { token: 'type.identifier', next: '@operationBody.$1' }]],\n [/^(\\s*)(given\\s+operation)(\\s+)([\\w.]+)(\\s+)(fails)(?=\\s*(?:\\/\\/.*)?$)/,\n ['white', 'keyword', 'white', 'type.identifier', 'white', 'keyword']],\n [/^(\\s*)(then\\s+(?:operation|compensated))(\\s+)([\\w.]+)(?=\\s*(?:\\/\\/.*)?$)/,\n ['white', 'keyword', 'white', 'type.identifier']],\n [new RegExp(`^(\\\\s*)(command)(\\\\s+)([A-Za-z_][${bmpWordCharacters}]*)(?=\\\\s*(?://.*)?$)`), ['white', 'keyword', 'white', { token: 'type.identifier', next: '@commandBody.$1' }]],\n [/^(\\s*)(handler)(?=\\s*(?:\\/\\/.*)?$)/, ['white', { token: 'keyword', next: '@handlerBody.$1' }]],\n [/^(\\s*@?[a-z_]\\w*\\s+)([\\w.]+(?:\\[\\])?(?:\\?|\\s+optional)?)(\\s+)(generated)(\\s+identifier|)(?=\\s*(?:\\/\\/.*)?$)/,\n ['identifier', 'type.identifier', 'white', 'keyword', 'keyword']],\n [/^(\\s*)(generated)(\\s+)([a-z_]\\w*)(\\s*=(?!=|>))/, ['white', 'keyword', 'white', 'identifier', 'operator']],\n [/^(\\s*)(then)(\\s+)(returns)\\b/, ['white', 'keyword', 'white', 'keyword']],\n // Only unambiguous response headers: two-token property declarations keep their names.\n [/^(\\s*)(returns)(?=\\s*(?:\\/\\/.*)?$|\\s+@\\w+\\s*(?:\\/\\/.*)?$)/, ['white', 'keyword']],\n [/^(\\s*@?[a-z_]\\w*\\s+)([\\w.]+)(\\s+)(key)(?=\\s*(?:\\/\\/.*)?$)/, ['identifier', 'type.identifier', 'white', 'keyword']],\n // A modifier only after a complete type; names called optional remain ordinary names.\n [/^(\\s*(?:by|filter)\\s+[a-z_]\\w*\\s+)([\\w.]+(?:\\[\\])?)(\\s+)(optional)\\b(?=\\s*(?:from\\b|\\/\\/|$))/,\n ['identifier', 'type.identifier', 'white', 'keyword']],\n // Query prefixes cannot fall back to being property names.\n [/^(?!\\s*(?:by|filter)\\s+)(\\s*@?[a-z_]\\w*\\s+)([\\w.]+(?:\\[\\])?)(\\s+)(optional)\\b(?=\\s*(?:identifier\\b|from\\b|=(?!=|>)|\\/\\/|$))/,\n ['identifier', 'type.identifier', 'white', 'keyword']],\n [/^(\\s*query\\s+[A-Za-z_]\\w*\\s*=>\\s*(?!observable\\s+optional\\s*(?:\\/\\/.*)?$)(?:observable\\s+)?)([\\w.]+(?:\\[\\])?)(\\s+)(optional)\\b(?=\\s*(?:\\/\\/.*)?$)/,\n ['keyword', 'type.identifier', 'white', 'keyword']],\n [new RegExp(`^(\\\\s*)(given)(\\\\s+)(caller)(\\\\s+)(as)(\\\\s+)([A-Za-z_][${bmpWordCharacters}]*)(?=\\\\s*(?://.*)?$)`),\n ['white', 'keyword', 'white', 'keyword', 'white', 'keyword', 'white', 'type.identifier']],\n // A specification's clock, trigger, capture and query steps - matched before a sub-language keyword\n // can claim 'capture' and read the rest of the specification as change data capture.\n [/^(\\s*)(given|when)(\\s+)(clock|capture|trigger|query)\\b/, ['white', 'keyword', 'white', 'keyword']],\n [/^(\\s*)(then)(\\s+)(result|no\\s+(?:result|events))\\b/, ['white', 'keyword', 'white', 'keyword']],\n [/^(\\s*)(then)(\\s+)(events)(\\s+)(in any order)(?=\\s*(?:\\/\\/.*)?$)/, ['white', 'keyword', 'white', 'keyword', 'white', 'keyword']],\n [/^(\\s*)(when)(\\s+)(redelivered)(\\s+)([\\w.]+)(\\s+)(to)(\\s+)([\\w.]+)(?=\\s*(?:\\/\\/.*)?$)/,\n ['white', 'keyword', 'white', 'keyword', 'white', 'type.identifier', 'white', 'keyword', 'white', 'type.identifier']],\n // Guarded-action words are contextual; property names keep their ordinary meaning.\n [/^(\\s*)(otherwise)(\\s+)(hidden)(?=\\s*(?:\\/\\/.*)?$)/, ['white', 'keyword', 'white', 'keyword']],\n [/^(\\s*)(otherwise)(\\s+)(execute)(\\s+)([\\w.]+)(?=\\s*(?:\\/\\/.*)?$)/,\n ['white', 'keyword', 'white', 'keyword', 'white', 'type.identifier']],\n [/^(\\s*)(when)(\\s+)(?=.+\\s+execute\\s+[\\w.]+\\s*(?:\\/\\/.*)?$)/,\n ['white', 'keyword', { token: 'white', next: '@guardedActionCondition' }]],\n [/^(\\s*)(behavior)(\\s+)([A-Za-z_]\\w*)(?=\\s*(?:\\/\\/.*)?$)/,\n ['white', 'keyword', 'white', { token: 'type.identifier', next: '@behaviorBody.$1' }]],\n [/^(\\s*)(on)(\\s+)(refused)(\\s+)(by)(\\s+)(validation|constraint|authorization)\\b/,\n ['white', 'keyword', 'white', 'keyword', 'white', 'keyword', 'white', 'keyword']],\n [/^(\\s*)(on)(\\s+)(refused)(?=\\s*(?:\\/\\/.*)?$)/, ['white', 'keyword', 'white', 'keyword']],\n [/^(\\s*)(on)(\\s+)([\\w-]+)\\b/, ['white', 'keyword', 'white', { token: 'keyword', next: '@interactionBody.$1' }]],\n [/^(\\s*)(acknowledge)(?=\\s*(?:\\/\\/.*)?$)/, ['white', 'keyword']],\n // A quoted import names .play files rather than a qualified name - the path reads as a link.\n [/^(\\s*)(import)(\\s+)(\"[^\"\\\\]*\")/, ['white', 'keyword', 'white', 'string.link']],\n // Retain the header indent so event metadata stops at the enclosing block boundary.\n [/^(\\s*)((?:(?:produces|public)\\s+)?event)(\\s+)([A-Za-z_]\\w*)(\\s+)(generation)(\\s+)(\\d+)(?=\\s*(?:from\\s+\"(?:[^\"\\\\]|\\\\.)*\"\\s*)?(?:\\/\\/.*)?$)/,\n ['white', 'keyword', 'white', 'type.identifier', 'white', 'keyword', 'white', { token: 'number', next: '@eventBody.$1' }]],\n [/^(\\s*)((?:(?:produces|public)\\s+)?event)(\\s+)([A-Za-z_]\\w*)(?=\\s*(?:from\\s+\"(?:[^\"\\\\]|\\\\.)*\"\\s*)?(?:\\/\\/.*)?$)/,\n ['white', 'keyword', 'white', { token: 'type.identifier', next: '@eventBody.$1' }]],\n // A tagged opening fence carries the embedded language; legacy tag lines still highlight.\n ...codeBlockTags.map(\n (tag): MonarchTokenRules[number] => [\n new RegExp(`^\\\\s*\\\\x60\\\\x60\\\\x60${tag}\\\\s*$`),\n { token: 'string.quote', next: `@codeBlock.${embeddedLanguages[tag]}`, nextEmbedded: embeddedLanguages[tag] },\n ],\n ),\n // Inline code block tags at end of line open an embedded code block.\n ...codeBlockTags.map(\n (tag): MonarchTokenRules[number] => [\n new RegExp(`\\\\b${tag}\\\\b(?=\\\\s*$)`),\n { token: 'keyword.tag', next: `@codeBlockPending.${embeddedLanguages[tag]}` },\n ],\n ),\n // Sub-language constructs switch to the registered sub-language's token rules.\n ...subLanguages.map(\n (subLanguage): MonarchTokenRules[number] => [\n new RegExp(`\\\\b${subLanguage.keyword}\\\\b`),\n { token: 'keyword', next: `@${subLanguageState(subLanguage.keyword)}` },\n ],\n ),\n // Typed documentation names are properties, not metadata directives.\n [/^(\\s*)(documentation)(?=\\s+[\\w.]+(?:\\[\\])?(?:\\?|\\s+optional)?\\s*(?:identifier\\b|generated\\b|=(?!=|>)|\\/\\/|$))/,\n ['white', 'identifier']],\n // A bare description or documentation keyword opens a fenced prose block.\n [/\\b(?:description|documentation)\\b(?=\\s*(?:\\/\\/.*)?$)/, { token: 'keyword', next: '@descriptionBlockPending' }],\n [/\\brow-click\\b/, 'keyword'],\n // A leading @ escapes a name that collides with a directive keyword - it is a name, not an attribute.\n [/^\\s*@[a-z_]\\w*/, 'identifier'],\n [/@\\w+/, 'annotation'],\n [\n /[A-Z]\\w*/,\n {\n cases: {\n '@sliceTypes': 'keyword.type',\n '@primitiveTypes': 'type',\n '@default': 'type.identifier',\n },\n },\n ],\n [\n /[a-z_]\\w*/,\n {\n cases: {\n '@keywords': 'keyword',\n '@default': 'identifier',\n },\n },\n ],\n { include: '@common' },\n ],\n\n guardedActionCondition: [\n [/(execute)(\\s+)([\\w.]+)(?=\\s*(?:\\/\\/.*)?$)/, ['keyword', 'white', { token: 'type.identifier', next: '@pop' }]],\n { include: '@root' },\n ],\n\n behaviorBody: [\n [/^(?!$S2[ \\t]+|\\s*$)/, { token: '@rematch', next: '@pop' }],\n { include: '@root' },\n ],\n\n interactionBody: [\n [/^(?!$S2[ \\t]+|\\s*$)/, { token: '@rematch', next: '@pop' }],\n [/^(\\s*)(otherwise)(?=\\s*(?:\\/\\/.*)?$)/, ['white', 'keyword']],\n [/^(\\s*)(when)(\\s+)(?=item\\.|\\()/, ['white', 'keyword', 'white']],\n [/^(\\s*)(execute)(\\s+)([\\w.]+)(?=\\s*(?:\\/\\/.*)?$)/, ['white', 'keyword', 'white', 'type.identifier']],\n { include: '@root' },\n ],\n\n purposeBody: [\n [/^(?!$S2[ \\t]+|\\s*$)/, { token: '@rematch', next: '@pop' }],\n [/^(\\s*)(basis|interest|condition|authorization|subjects|retention|recipient|transfer|erasure)(\\s+)/, ['white', 'keyword', 'white']],\n [/\\b(safeguard|exception)\\b/, 'keyword'],\n { include: '@root' },\n ],\n\n generationLine: [\n [/^/, { token: '@rematch', next: '@pop' }],\n [/\\b(prefix|case|alphabet|checksum|base64url|hex|base32|lower|upper|luhn|mod11|mod97)\\b/, 'keyword'],\n { include: '@common' },\n ],\n\n conceptBody: [\n [/^(?!$S2[ \\t]+|\\s*$)/, { token: '@rematch', next: '@pop' }],\n [/^(\\s*)(validate)(\\s+)(checksum)(\\s+)(luhn|mod11|mod97)\\b/, ['white', 'keyword', 'white', 'keyword', 'white', 'keyword']],\n [/^(\\s*)(checksum)(\\s+)(luhn|mod11|mod97)\\b/, ['white', 'keyword', 'white', 'keyword']],\n [new RegExp(`^(\\\\s*)(@?[a-z_][${bmpWordCharacters}]*)(\\\\s*)(=)(\\\\s*)(-?(?:0|[1-9][0-9]*))(?=\\\\s*(?://.*)?$)`), ['white', 'identifier', 'white', 'operator', 'white', 'number']],\n [/^(\\s*)(@?pii|personal|@?sensitive|secret)(\\s+)(reason|scope|special|criminal)\\b/, ['white', 'keyword', 'white', 'keyword']],\n [/^(\\s*)(generate)(\\s+)(uuidv7|uuid|ulid|typeid|nanoid|bytes|pattern|random|rule|sequence)\\b/, ['white', 'keyword', 'white', { token: 'keyword', next: '@generationLine' }]],\n { include: '@root' },\n ],\n\n commandBody: [\n [/^(?!$S2[ \\t]+|\\s*$)/, { token: '@rematch', next: '@pop' }],\n [/^(\\s*)(validate)(?=\\s*(?:\\/\\/.*)?$)/, ['white', { token: 'keyword', next: '@commandValidation.$1' }]],\n { include: '@root' },\n ],\n\n commandValidation: [\n [/^(?!$S2[ \\t]+|\\s*$)/, { token: '@rematch', next: '@pop' }],\n [new RegExp(`^(\\\\s*)([${bmpWordCharacters}.]+)(\\\\s+)(rule)(\\\\s+)([A-Za-z_][${bmpWordCharacters}]*)(?=\\\\s*(?:severity\\\\s+\\\\w+|message\\\\s+.*|//.*|$))`),\n ['white', 'identifier', 'white', 'keyword', 'white', { token: 'type.identifier', next: '@namedRuleBody.$1' }]],\n { include: '@root' },\n ],\n\n namedRuleBody: [\n [/^(?!$S2[ \\t]+|\\s*$)/, { token: '@rematch', next: '@pop' }],\n [/^(\\s*)(implementation)(?=\\s*(?:\\/\\/.*)?$)/, ['white', { token: 'keyword', next: '@implementationBody.$1' }]],\n { include: '@root' },\n ],\n\n operationBody: [\n [/^(?!$S2[ \\t]+|\\s*$)/, { token: '@rematch', next: '@pop' }],\n [/^(\\s*)(execute|compensate)(?=\\s*(?:\\/\\/.*)?$)/, ['white', { token: 'keyword', next: '@operationPhase.$1' }]],\n [/^(\\s*)(uses)(\\s+)([A-Z]\\w*)(?=\\s*(?:\\/\\/.*)?$)/, ['white', 'keyword', 'white', 'type.identifier']],\n [/^(\\s*)(@?[a-z_]\\w*)(\\s+)([\\w.]+(?:\\[\\])?(?:\\?|\\s+optional)?)(?=\\s*(?:=(?!=|>)|\\/\\/|$))/,\n ['white', 'identifier', 'white', 'type.identifier']],\n { include: '@root' },\n ],\n\n operationPhase: [\n [/^(?!$S2[ \\t]+|\\s*$)/, { token: '@rematch', next: '@pop' }],\n [/^(\\s*)(implementation)(?=\\s*(?:\\/\\/.*)?$)/, ['white', { token: 'keyword', next: '@implementationBody.$1' }]],\n { include: '@root' },\n ],\n\n handlerBody: [\n [/^(?!$S2[ \\t]+|\\s*$)/, { token: '@rematch', next: '@pop' }],\n [/^(\\s*)(implementation)(?=\\s*(?:\\/\\/.*)?$)/, ['white', { token: 'keyword', next: '@implementationBody.$1' }]],\n { include: '@root' },\n ],\n\n implementationBody: [\n [/^(?!$S2[ \\t]+|\\s*$)/, { token: '@rematch', next: '@pop' }],\n [/^(\\s*)(hint)(?=\\s+\")/, ['white', 'keyword']],\n { include: '@root' },\n ],\n\n eventBody: [\n [/^(?!$S2[ \\t]+|\\s*$)/, { token: '@rematch', next: '@pop' }],\n [/^(\\s*)(id)(?=\\s+\")/, ['white', 'keyword']],\n [/^(\\s*)(documentation)(?=\\s*(?:\\/\\/.*)?$)/, ['white', { token: 'keyword', next: '@descriptionBlockPending' }]],\n { include: '@root' },\n ],\n\n common: commonTokenRules,\n\n // After a code tag, the only thing allowed before the opening fence is whitespace.\n codeBlockPending: [\n [\n /^\\s*```\\s*$/,\n { token: 'string.quote', switchTo: '@codeBlock.$S2', nextEmbedded: '$S2' },\n ],\n [/^\\s*[^\\s`].*$/, { token: '@rematch', next: '@pop' }],\n [/\\s+/, 'white'],\n ],\n\n codeBlock: [\n [/^\\s*```\\s*$/, { token: 'string.quote', next: '@pop', nextEmbedded: '@pop' }],\n [/[^`]+/, ''],\n [/`/, ''],\n ],\n\n // After a bare description, the only thing allowed before the opening fence is whitespace.\n descriptionBlockPending: [\n [/\\/\\/.*$/, 'comment'],\n [/^\\s*```(?:text|markdown)?\\s*$/, { token: 'string.quote', switchTo: '@descriptionBlock' }],\n [/^\\s*[^\\s`].*$/, { token: '@rematch', next: '@pop' }],\n [/\\s+/, 'white'],\n ],\n\n descriptionBlock: [\n [/^\\s*```\\s*$/, { token: 'string.quote', next: '@pop' }],\n [/.+/, 'string'],\n ],\n };\n\n for (const subLanguage of subLanguages) {\n tokenizer[subLanguageState(subLanguage.keyword)] = [\n subLanguageExitRule(subLanguages),\n ...subLanguage.tokens,\n { include: '@common' },\n [/[A-Z]\\w*/, 'type.identifier'],\n [/[a-z_]\\w*/, 'identifier'],\n ];\n }\n\n return {\n defaultToken: '',\n tokenPostfix: '.play',\n ignoreCase: false,\n keywords: [...constructKeywords.filter(keyword => !contextualConstructs.has(keyword)), ...clauseKeywords, ...codeBlockTags],\n sliceTypes,\n primitiveTypes,\n tokenizer,\n } as languages.IMonarchLanguage;\n}\n"],"mappings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1
|
+
{"version":3,"file":"tokens.js","names":["contextualConstructs","embeddedLanguages","keyword","exitKeywords","constructKeywords","subLanguages","subLanguage","commonTokenRules","tokenizer","bmpWordCharacters","codeBlockTags","tag","clauseKeywords"],"sources":["../../tokens.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 type { languages } from 'monaco-editor';\nimport {\n clauseKeywords,\n codeBlockTags,\n constructKeywords,\n primitiveTypes,\n sliceTypes,\n} from './language';\nimport { MonarchTokenRules, SubLanguage } from './sub-language-registry';\nimport { bmpWordCharacters } from './bmp-word-characters';\n\n// Maps a Screenplay inline code tag to the Monaco language id used for embedded highlighting.\n// Declaration registration must not globally reserve existing property names.\n// Ambiguous standalone operation headers are supplied by typed semantic tokens.\nconst contextualConstructs = new Set(['operation', 'system', 'eventsource', 'purpose', 'runs', 'time']);\n\nconst embeddedLanguages: Record<string, string> = {\n csharp: 'csharp',\n typescript: 'typescript',\n react: 'typescript',\n html: 'html',\n sql: 'sql',\n};\n\nfunction subLanguageState(keyword: string): string {\n return `subLanguage_${keyword}`;\n}\n\n// A construct keyword at the start of a line ends any indented sub-language block.\nfunction subLanguageExitRule(subLanguages: SubLanguage[]): MonarchTokenRules[number] {\n const exitKeywords = [...constructKeywords.filter(keyword => !contextualConstructs.has(keyword)), ...subLanguages.map((subLanguage) => subLanguage.keyword)];\n return [\n new RegExp(`^\\\\s*(?:${exitKeywords.join('|')})\\\\b`),\n { token: '@rematch', next: '@pop' },\n ];\n}\n\n// Shared across the composite `.play` tokenizer and every standalone sub-language tokenizer\n// (comments, `$`-prefixed context variables, strings, numbers, operators, delimiters, whitespace).\nexport const commonTokenRules: MonarchTokenRules = [\n [/\\/\\/.*$/, 'comment'],\n [/\\$(?:context|identity|eventContext|eventSourceId|causedBy|refusal)(?:\\.\\w+)*/, 'variable.predefined'],\n [/\\$(?:env|secrets|strings)\\.[\\w.]+/, 'variable.predefined'],\n [/\\$\\.[\\w.]*/, 'variable.predefined'],\n [/\"(?:[^\"\\\\]|\\\\.)*\"/, 'string'],\n [/\"(?:[^\"\\\\]|\\\\.)*$/, 'string.invalid'],\n [/\\d+(?:ms|s|m|h|d)\\b/, 'number'],\n [/-?\\d+\\.\\d+/, 'number.float'],\n [/-?\\d+/, 'number'],\n [/=>|==|!=|>=|<=|[><=:?]/, 'operator'],\n [/[[\\](),.]/, 'delimiter'],\n [/\\s+/, 'white'],\n];\n\nexport function createTokensProvider(subLanguages: SubLanguage[]): languages.IMonarchLanguage {\n const tokenizer: Record<string, MonarchTokenRules> = {\n root: [\n [new RegExp(`^(\\\\s*)(example)(\\\\s+)([A-Z][${bmpWordCharacters}]*)(\\\\s*)(:)(\\\\s*)([A-Z][${bmpWordCharacters}.]*)(?=\\\\s*(?://.*)?$)`),\n ['white', 'keyword', 'white', 'type.identifier', 'white', 'operator', 'white', 'type.identifier']],\n [/^(time)(\\s+)(zone)(\\s+)(configurable\\s+default\\s+)?(?=\")/, ['keyword', 'white', 'keyword', 'white', 'keyword']],\n [/^(\\s*)(calendar)(\\s+)(?=\"|from\\s+\\$context\\.)/, ['white', 'keyword', 'white']],\n [/^(\\s*)(given)(\\s+)(time)(\\s+)(zone)(?=\\s+\")/, ['white', 'keyword', 'white', 'keyword', 'white', 'keyword']],\n [/^(\\s*)(direction)(\\s+)(inbound|outbound)(?=\\s*(?:\\/\\/.*)?$)/, ['white', 'keyword', 'white', 'keyword']],\n [new RegExp(`^()(purpose)(\\\\s+)([A-Za-z_][${bmpWordCharacters}]*)(?=\\\\s*(?://.*)?$)`), ['white', 'keyword', 'white', { token: 'type.identifier', next: '@purposeBody.$1' }]],\n [/^(\\s*)(parameter)(\\s+)([a-z_]\\w*)(\\s+)([\\w.]+(?:\\[\\])?(?:\\s+optional)?)(?=\\s*(?:\\/\\/.*)?$)/, ['white', 'keyword', 'white', 'identifier', 'white', 'type.identifier']],\n [/^(\\s*)(case)(\\s+)([A-Za-z_]\\w*)(?=\\s*(?:[a-z_]\\w*\\s*=|\\/\\/|$))/, ['white', 'keyword', 'white', 'type.identifier']],\n [/\\b(case)(\\.)([a-z_]\\w*)\\b/, ['keyword', 'delimiter', 'identifier']],\n [/^(\\s*)(concept)(\\s+)([^\\s:]+)(\\s*:\\s*)(\\w+)((?:\\s+(?:@?pii|personal|@?sensitive|secret))*)(?=\\s*(?:\\/\\/.*)?$)/, ['white', 'keyword', 'white', 'type.identifier', 'operator', { token: 'type.identifier', next: '@conceptBody.$1' }, 'keyword']],\n [/^(command)(\\s+)(reads)(\\s+)(protected)(?=\\s*(?:\\/\\/.*)?$)/, ['keyword', 'white', 'keyword', 'white', 'keyword']],\n [/^(reaction)(\\s+)(batches)(\\s+)(atomic)(?=\\s*(?:\\/\\/.*)?$)/, ['keyword', 'white', 'keyword', 'white', 'keyword']],\n [/^(numbers)([ \\t]+)(exact)(?=[ \\t]*(?:(?:\\/\\/|#).*)?$)/, ['keyword', 'white', 'keyword']],\n [/^(eventsource)(\\s+)([A-Za-z_]\\w*)(?=\\s*(?:\\/\\/.*)?$)/, ['keyword', 'white', 'type.identifier']],\n [/^(system)(\\s+)([A-Z]\\w*)(?=\\s*(?:\\/\\/.*)?$)/, ['keyword', 'white', 'type.identifier']],\n // 'runs' is contextual: only a reaction's identity line is a keyword; a property called runs keeps its name.\n [/^(\\s*)(runs)(\\s+)(as)(\\s+)(system)\\b/, ['white', 'keyword', 'white', 'keyword', 'white', 'keyword']],\n [/^(\\s*)(produces\\s+operation)(\\s+)([A-Z]\\w*)(?=\\s*(?:\\/\\/.*)?$)/,\n ['white', 'keyword', 'white', { token: 'type.identifier', next: '@operationBody.$1' }]],\n [/^(\\s*)(given\\s+operation)(\\s+)([\\w.]+)(\\s+)(fails)(?=\\s*(?:\\/\\/.*)?$)/,\n ['white', 'keyword', 'white', 'type.identifier', 'white', 'keyword']],\n [/^(\\s*)(then\\s+(?:operation|compensated))(\\s+)([\\w.]+)(?=\\s*(?:\\/\\/.*)?$)/,\n ['white', 'keyword', 'white', 'type.identifier']],\n [new RegExp(`^(\\\\s*)(command)(\\\\s+)([A-Za-z_][${bmpWordCharacters}]*)(?=\\\\s*(?://.*)?$)`), ['white', 'keyword', 'white', { token: 'type.identifier', next: '@commandBody.$1' }]],\n [/^(\\s*)(handler)(?=\\s*(?:\\/\\/.*)?$)/, ['white', { token: 'keyword', next: '@handlerBody.$1' }]],\n [/^(\\s*@?[a-z_]\\w*\\s+)([\\w.]+(?:\\[\\])?(?:\\?|\\s+optional)?)(\\s+)(generated)(\\s+identifier|)(?=\\s*(?:\\/\\/.*)?$)/,\n ['identifier', 'type.identifier', 'white', 'keyword', 'keyword']],\n [/^(\\s*)(generated)(\\s+)([a-z_]\\w*)(\\s*=(?!=|>))/, ['white', 'keyword', 'white', 'identifier', 'operator']],\n [/^(\\s*)(then)(\\s+)(returns)\\b/, ['white', 'keyword', 'white', 'keyword']],\n // Only unambiguous response headers: two-token property declarations keep their names.\n [/^(\\s*)(returns)(?=\\s*(?:\\/\\/.*)?$|\\s+@\\w+\\s*(?:\\/\\/.*)?$)/, ['white', 'keyword']],\n [/^(\\s*@?[a-z_]\\w*\\s+)([\\w.]+)(\\s+)(key)(?=\\s*(?:\\/\\/.*)?$)/, ['identifier', 'type.identifier', 'white', 'keyword']],\n // A modifier only after a complete type; names called optional remain ordinary names.\n [/^(\\s*(?:by|filter)\\s+[a-z_]\\w*\\s+)([\\w.]+(?:\\[\\])?)(\\s+)(optional)\\b(?=\\s*(?:from\\b|\\/\\/|$))/,\n ['identifier', 'type.identifier', 'white', 'keyword']],\n // Query prefixes cannot fall back to being property names.\n [/^(?!\\s*(?:by|filter)\\s+)(\\s*@?[a-z_]\\w*\\s+)([\\w.]+(?:\\[\\])?)(\\s+)(optional)\\b(?=\\s*(?:identifier\\b|from\\b|=(?!=|>)|\\/\\/|$))/,\n ['identifier', 'type.identifier', 'white', 'keyword']],\n [/^(\\s*query\\s+[A-Za-z_]\\w*\\s*=>\\s*(?!observable\\s+optional\\s*(?:\\/\\/.*)?$)(?:observable\\s+)?)([\\w.]+(?:\\[\\])?)(\\s+)(optional)\\b(?=\\s*(?:\\/\\/.*)?$)/,\n ['keyword', 'type.identifier', 'white', 'keyword']],\n [new RegExp(`^(\\\\s*)(given)(\\\\s+)(caller)(\\\\s+)(as)(\\\\s+)([A-Za-z_][${bmpWordCharacters}]*)(?=\\\\s*(?://.*)?$)`),\n ['white', 'keyword', 'white', 'keyword', 'white', 'keyword', 'white', 'type.identifier']],\n // A specification's clock, trigger, capture and query steps - matched before a sub-language keyword\n // can claim 'capture' and read the rest of the specification as change data capture.\n [/^(\\s*)(given|when)(\\s+)(clock|capture|trigger|query)\\b/, ['white', 'keyword', 'white', 'keyword']],\n [/^(\\s*)(then)(\\s+)(result|no\\s+(?:result|events))\\b/, ['white', 'keyword', 'white', 'keyword']],\n [/^(\\s*)(then)(\\s+)(events)(\\s+)(in any order)(?=\\s*(?:\\/\\/.*)?$)/, ['white', 'keyword', 'white', 'keyword', 'white', 'keyword']],\n [/^(\\s*)(when)(\\s+)(redelivered)(\\s+)([\\w.]+)(\\s+)(to)(\\s+)([\\w.]+)(?=\\s*(?:\\/\\/.*)?$)/,\n ['white', 'keyword', 'white', 'keyword', 'white', 'type.identifier', 'white', 'keyword', 'white', 'type.identifier']],\n // Guarded-action words are contextual; property names keep their ordinary meaning.\n [/^(\\s*)(otherwise)(\\s+)(hidden)(?=\\s*(?:\\/\\/.*)?$)/, ['white', 'keyword', 'white', 'keyword']],\n [/^(\\s*)(otherwise)(\\s+)(execute)(\\s+)([\\w.]+)(?=\\s*(?:\\/\\/.*)?$)/,\n ['white', 'keyword', 'white', 'keyword', 'white', 'type.identifier']],\n [/^(\\s*)(when)(\\s+)(?=.+\\s+execute\\s+[\\w.]+\\s*(?:\\/\\/.*)?$)/,\n ['white', 'keyword', { token: 'white', next: '@guardedActionCondition' }]],\n [/^(\\s*)(behavior)(\\s+)([A-Za-z_]\\w*)(?=\\s*(?:\\/\\/.*)?$)/,\n ['white', 'keyword', 'white', { token: 'type.identifier', next: '@behaviorBody.$1' }]],\n [/^(\\s*)(on)(\\s+)(refused)(\\s+)(by)(\\s+)(validation|constraint|authorization)\\b/,\n ['white', 'keyword', 'white', 'keyword', 'white', 'keyword', 'white', 'keyword']],\n [/^(\\s*)(on)(\\s+)(refused)(?=\\s*(?:\\/\\/.*)?$)/, ['white', 'keyword', 'white', 'keyword']],\n [/^(\\s*)(on)(\\s+)([\\w-]+)\\b/, ['white', 'keyword', 'white', { token: 'keyword', next: '@interactionBody.$1' }]],\n [/^(\\s*)(acknowledge)(?=\\s*(?:\\/\\/.*)?$)/, ['white', 'keyword']],\n // A quoted import names .play files rather than a qualified name - the path reads as a link.\n [/^(\\s*)(import)(\\s+)(\"[^\"\\\\]*\")/, ['white', 'keyword', 'white', 'string.link']],\n // Retain the header indent so event metadata stops at the enclosing block boundary.\n [/^(\\s*)((?:(?:produces|public)\\s+)?event)(\\s+)([A-Za-z_]\\w*)(\\s+)(generation)(\\s+)(\\d+)(?=\\s*(?:from\\s+\"(?:[^\"\\\\]|\\\\.)*\"\\s*)?(?:\\/\\/.*)?$)/,\n ['white', 'keyword', 'white', 'type.identifier', 'white', 'keyword', 'white', { token: 'number', next: '@eventBody.$1' }]],\n [/^(\\s*)((?:(?:produces|public)\\s+)?event)(\\s+)([A-Za-z_]\\w*)(?=\\s*(?:from\\s+\"(?:[^\"\\\\]|\\\\.)*\"\\s*)?(?:\\/\\/.*)?$)/,\n ['white', 'keyword', 'white', { token: 'type.identifier', next: '@eventBody.$1' }]],\n // A tagged opening fence carries the embedded language; legacy tag lines still highlight.\n ...codeBlockTags.map(\n (tag): MonarchTokenRules[number] => [\n new RegExp(`^\\\\s*\\\\x60\\\\x60\\\\x60${tag}\\\\s*$`),\n { token: 'string.quote', next: `@codeBlock.${embeddedLanguages[tag]}`, nextEmbedded: embeddedLanguages[tag] },\n ],\n ),\n // Inline code block tags at end of line open an embedded code block.\n ...codeBlockTags.map(\n (tag): MonarchTokenRules[number] => [\n new RegExp(`\\\\b${tag}\\\\b(?=\\\\s*$)`),\n { token: 'keyword.tag', next: `@codeBlockPending.${embeddedLanguages[tag]}` },\n ],\n ),\n // Sub-language constructs switch to the registered sub-language's token rules.\n ...subLanguages.map(\n (subLanguage): MonarchTokenRules[number] => [\n new RegExp(`\\\\b${subLanguage.keyword}\\\\b`),\n { token: 'keyword', next: `@${subLanguageState(subLanguage.keyword)}` },\n ],\n ),\n // Typed documentation names are properties, not metadata directives.\n [/^(\\s*)(documentation)(?=\\s+[\\w.]+(?:\\[\\])?(?:\\?|\\s+optional)?\\s*(?:identifier\\b|generated\\b|=(?!=|>)|\\/\\/|$))/,\n ['white', 'identifier']],\n // A bare description or documentation keyword opens a fenced prose block.\n [/\\b(?:description|documentation)\\b(?=\\s*(?:\\/\\/.*)?$)/, { token: 'keyword', next: '@descriptionBlockPending' }],\n [/\\brow-click\\b/, 'keyword'],\n // A leading @ escapes a name that collides with a directive keyword - it is a name, not an attribute.\n [/^\\s*@[a-z_]\\w*/, 'identifier'],\n [/@\\w+/, 'annotation'],\n [\n /[A-Z]\\w*/,\n {\n cases: {\n '@sliceTypes': 'keyword.type',\n '@primitiveTypes': 'type',\n '@default': 'type.identifier',\n },\n },\n ],\n [\n /[a-z_]\\w*/,\n {\n cases: {\n '@keywords': 'keyword',\n '@default': 'identifier',\n },\n },\n ],\n { include: '@common' },\n ],\n\n guardedActionCondition: [\n [/(execute)(\\s+)([\\w.]+)(?=\\s*(?:\\/\\/.*)?$)/, ['keyword', 'white', { token: 'type.identifier', next: '@pop' }]],\n { include: '@root' },\n ],\n\n behaviorBody: [\n [/^(?!$S2[ \\t]+|\\s*$)/, { token: '@rematch', next: '@pop' }],\n { include: '@root' },\n ],\n\n interactionBody: [\n [/^(?!$S2[ \\t]+|\\s*$)/, { token: '@rematch', next: '@pop' }],\n [/^(\\s*)(otherwise)(?=\\s*(?:\\/\\/.*)?$)/, ['white', 'keyword']],\n [/^(\\s*)(when)(\\s+)(?=item\\.|\\()/, ['white', 'keyword', 'white']],\n [/^(\\s*)(execute)(\\s+)([\\w.]+)(?=\\s*(?:\\/\\/.*)?$)/, ['white', 'keyword', 'white', 'type.identifier']],\n { include: '@root' },\n ],\n\n purposeBody: [\n [/^(?!$S2[ \\t]+|\\s*$)/, { token: '@rematch', next: '@pop' }],\n [/^(\\s*)(basis|interest|condition|authorization|subjects|retention|recipient|transfer|erasure)(\\s+)/, ['white', 'keyword', 'white']],\n [/\\b(safeguard|exception)\\b/, 'keyword'],\n { include: '@root' },\n ],\n\n generationLine: [\n [/^/, { token: '@rematch', next: '@pop' }],\n [/\\b(prefix|case|alphabet|checksum|base64url|hex|base32|lower|upper|luhn|mod11|mod97)\\b/, 'keyword'],\n { include: '@common' },\n ],\n\n conceptBody: [\n [/^(?!$S2[ \\t]+|\\s*$)/, { token: '@rematch', next: '@pop' }],\n [/^(\\s*)(validate)(\\s+)(checksum)(\\s+)(luhn|mod11|mod97)\\b/, ['white', 'keyword', 'white', 'keyword', 'white', 'keyword']],\n [/^(\\s*)(checksum)(\\s+)(luhn|mod11|mod97)\\b/, ['white', 'keyword', 'white', 'keyword']],\n [new RegExp(`^(\\\\s*)(@?[a-z_][${bmpWordCharacters}]*)(\\\\s*)(=)(\\\\s*)(-?(?:0|[1-9][0-9]*))(?=\\\\s*(?://.*)?$)`), ['white', 'identifier', 'white', 'operator', 'white', 'number']],\n [/^(\\s*)(@?pii|personal|@?sensitive|secret)(\\s+)(reason|scope|special|criminal)\\b/, ['white', 'keyword', 'white', 'keyword']],\n [/^(\\s*)(generate)(\\s+)(uuidv7|uuid|ulid|typeid|nanoid|bytes|pattern|random|rule|sequence)\\b/, ['white', 'keyword', 'white', { token: 'keyword', next: '@generationLine' }]],\n { include: '@root' },\n ],\n\n commandBody: [\n [/^(?!$S2[ \\t]+|\\s*$)/, { token: '@rematch', next: '@pop' }],\n [/^(\\s*)(validate)(?=\\s*(?:\\/\\/.*)?$)/, ['white', { token: 'keyword', next: '@commandValidation.$1' }]],\n { include: '@root' },\n ],\n\n commandValidation: [\n [/^(?!$S2[ \\t]+|\\s*$)/, { token: '@rematch', next: '@pop' }],\n [new RegExp(`^(\\\\s*)([${bmpWordCharacters}.]+)(\\\\s+)(rule)(\\\\s+)([A-Za-z_][${bmpWordCharacters}]*)(?=\\\\s*(?:severity\\\\s+\\\\w+|message\\\\s+.*|//.*|$))`),\n ['white', 'identifier', 'white', 'keyword', 'white', { token: 'type.identifier', next: '@namedRuleBody.$1' }]],\n { include: '@root' },\n ],\n\n namedRuleBody: [\n [/^(?!$S2[ \\t]+|\\s*$)/, { token: '@rematch', next: '@pop' }],\n [/^(\\s*)(implementation)(?=\\s*(?:\\/\\/.*)?$)/, ['white', { token: 'keyword', next: '@implementationBody.$1' }]],\n { include: '@root' },\n ],\n\n operationBody: [\n [/^(?!$S2[ \\t]+|\\s*$)/, { token: '@rematch', next: '@pop' }],\n [/^(\\s*)(execute|compensate)(?=\\s*(?:\\/\\/.*)?$)/, ['white', { token: 'keyword', next: '@operationPhase.$1' }]],\n [/^(\\s*)(uses)(\\s+)([A-Z]\\w*)(?=\\s*(?:\\/\\/.*)?$)/, ['white', 'keyword', 'white', 'type.identifier']],\n [/^(\\s*)(@?[a-z_]\\w*)(\\s+)([\\w.]+(?:\\[\\])?(?:\\?|\\s+optional)?)(?=\\s*(?:=(?!=|>)|\\/\\/|$))/,\n ['white', 'identifier', 'white', 'type.identifier']],\n { include: '@root' },\n ],\n\n operationPhase: [\n [/^(?!$S2[ \\t]+|\\s*$)/, { token: '@rematch', next: '@pop' }],\n [/^(\\s*)(implementation)(?=\\s*(?:\\/\\/.*)?$)/, ['white', { token: 'keyword', next: '@implementationBody.$1' }]],\n { include: '@root' },\n ],\n\n handlerBody: [\n [/^(?!$S2[ \\t]+|\\s*$)/, { token: '@rematch', next: '@pop' }],\n [/^(\\s*)(implementation)(?=\\s*(?:\\/\\/.*)?$)/, ['white', { token: 'keyword', next: '@implementationBody.$1' }]],\n { include: '@root' },\n ],\n\n implementationBody: [\n [/^(?!$S2[ \\t]+|\\s*$)/, { token: '@rematch', next: '@pop' }],\n [/^(\\s*)(hint)(?=\\s+\")/, ['white', 'keyword']],\n { include: '@root' },\n ],\n\n eventBody: [\n [/^(?!$S2[ \\t]+|\\s*$)/, { token: '@rematch', next: '@pop' }],\n [/^(\\s*)(id)(?=\\s+\")/, ['white', 'keyword']],\n [/^(\\s*)(documentation)(?=\\s*(?:\\/\\/.*)?$)/, ['white', { token: 'keyword', next: '@descriptionBlockPending' }]],\n { include: '@root' },\n ],\n\n common: commonTokenRules,\n\n // After a code tag, the only thing allowed before the opening fence is whitespace.\n codeBlockPending: [\n [\n /^\\s*```\\s*$/,\n { token: 'string.quote', switchTo: '@codeBlock.$S2', nextEmbedded: '$S2' },\n ],\n [/^\\s*[^\\s`].*$/, { token: '@rematch', next: '@pop' }],\n [/\\s+/, 'white'],\n ],\n\n codeBlock: [\n [/^\\s*```\\s*$/, { token: 'string.quote', next: '@pop', nextEmbedded: '@pop' }],\n [/[^`]+/, ''],\n [/`/, ''],\n ],\n\n // After a bare description, the only thing allowed before the opening fence is whitespace.\n descriptionBlockPending: [\n [/\\/\\/.*$/, 'comment'],\n [/^\\s*```(?:text|markdown)?\\s*$/, { token: 'string.quote', switchTo: '@descriptionBlock' }],\n [/^\\s*[^\\s`].*$/, { token: '@rematch', next: '@pop' }],\n [/\\s+/, 'white'],\n ],\n\n descriptionBlock: [\n [/^\\s*```\\s*$/, { token: 'string.quote', next: '@pop' }],\n [/.+/, 'string'],\n ],\n };\n\n for (const subLanguage of subLanguages) {\n tokenizer[subLanguageState(subLanguage.keyword)] = [\n subLanguageExitRule(subLanguages),\n ...subLanguage.tokens,\n { include: '@common' },\n [/[A-Z]\\w*/, 'type.identifier'],\n [/[a-z_]\\w*/, 'identifier'],\n ];\n }\n\n return {\n defaultToken: '',\n tokenPostfix: '.play',\n ignoreCase: false,\n keywords: [...constructKeywords.filter(keyword => !contextualConstructs.has(keyword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C,EAAY,OACf,CAAE,QAAS,SAAU,EACrB,CAAC,WAAY,iBAAiB,EAC9B,CAAC,YAAa,YAAY,CAC9B,EAGJ,MAAO,CACH,aAAc,GACd,aAAc,QACd,WAAY,GACZ,SAAU,CAAC,GAAGF,EAAkB,OAAO,GAAW,CAACJ,EAAqB,IAAIE,CAAO,CAAC,EAAG,GAAGU,EAAgB,GAAGF,CAAa,EAC1H,aACA,iBACA,WACJ,CACJ"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import"./_virtual/_virtual/_rolldown/runtime.js";import{causedByProperties as e,contextRoots as t,identityProperties as n,primitiveTypes as r,sliceTypes as i}from"./language.js";import{DiagnosticCodes as a}from"./compiler/Diagnostics/DiagnosticCodes.js";import{legacyOptionalTypeLength as o}from"./compiler/Authoring/QuickFixes.js";import"./compiler/index.js";import{enclosingChain as s,fenceMap as c,indentOf as l}from"./document-context.js";import{eventAnalysisSource as u}from"./event-analysis-source.js";import{resolveEventContextPath as d}from"./event-context.js";import{responseAnalysis as f}from"./response-analysis.js";import{knownEventNames as p,knownTypeNames as m,mergeSymbols as h,propertyTypeReference as g,scanDocument as _,symbolsForBuffer as v}from"./symbols.js";import{diagnosticCodes as y}from"./diagnostic-codes.js";import{validateInlineEvents as b}from"./inline-event-validation.js";import{fileImportOn as x,isFileImportLine as S}from"./file-imports.js";function issue(e,t,n,r,i,a){return{severity:e,message:i,line:t,startColumn:n,endColumn:n+r,code:a}}function tokenIssue(e,t,n,r,i,a){return issue(e,t,n.indexOf(r)+1,r.length,i,a)}function validateDeclarations(e,t,n){let i=[],a=/* @__PURE__ */ new Set([...m(t,r),...m(n,[])]),checkProperties=(e,t)=>{for(let n of e.filter(e=>!a.has(g(e).name))){let e=g(n).name;i.push(issue(`warning`,n.line,n.sourceType.startColumn,n.sourceType.text.length,e===`optional`?`Unknown type 'optional' on '${n.name}' of ${t} — did you forget the type before 'optional'?`:`Unknown type '${e}' on '${n.name}' of ${t} — declare it with 'concept ${e} : <Primitive>' or 'type ${e}'.`,y.unknownType))}};for(let e of t.types)checkProperties(e.properties,`type '${e.name}'`);for(let e of t.events)checkProperties(e.properties,`event '${e.name}'`);for(let e of t.queries)checkProperties(e.parameters,`query '${e.name}'`);for(let n of t.commands){checkProperties(n.properties,`command '${n.name}'`);let t=n.properties.filter(e=>e.isIdentifier);for(let r of t.slice(1))i.push(tokenIssue(`error`,r.line,e[r.line],`identifier`,`Command '${n.name}' already marks '${t[0].name}' as identifier — only one property can be the identifier.`,y.duplicateCommandIdentifier))}let o=/* @__PURE__ */ new Map;for(let n of[...t.concepts,...t.types])o.get(n.name)===void 0?o.set(n.name,n.line):i.push(tokenIssue(`error`,n.line,e[n.line],n.name,`Duplicate declaration of '${n.name}' — concept and type names must be unique.`,y.duplicateDeclaration));return i}function validateLines(s,u={}){let d=c(s),m=_(s),g=u.application??h(),x=v(s,{...g,authoringPath:u.path??g.authoringPath,authoringPlacement:u.placement??g.authoringPlacement}),S=f(s,x.authoringDocuments??x.authoringSources?.filter(e=>e!==s.join(`
|
|
2
|
-
`)),x.authoringPlacement,x.authoringPath,x.authoringPlacementResolved),C=new Set(S.eventSources.routes.map(e=>e.location.line-1)),w={...m,commands:m.commands.map(e=>({...e,properties:e.properties.filter(e=>!C.has(e.line)),produces:e.produces?.filter(e=>!S.operationProductionLines?.has(e.line)),productionHeaders:e.productionHeaders?.filter(e=>!S.operationProductionLines?.has(e))}))},T=/* @__PURE__ */ new Set([...p(w),...p(g)]),E=new Set([...w.policies,...g.policies].map(e=>e.name)),D=validateDeclarations(s,w,g);D.push(...validateProductionDestinations(s,w));let O=/* @__PURE__ */ new Set([a.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]),k=/* @__PURE__ */ new Set([a.MixedEnumerationNumbering,a.DuplicateEnumerationNumber,a.EnumerationNumberOutsideInt32,a.MalformedEnumerationNumber,a.UnpinnedStoredEnumeration]),A=/* @__PURE__ */ new Set([a.LegacyOptionalSuffix,a.InvalidOptionalModifierOrder,a.OptionalReadsNotSupported]),j=/* @__PURE__ */ new Set([a.UnexpectedTokenInPolicyCondition,a.ExpectedPolicyCondition,a.UnclosedPolicyConditionGroup,a.ExpectedRoleName,a.ExpectedClaimName,a.ExpectedClaimMatches,a.ExpectedClaimMatchTarget,a.AnonymousPolicyCombined,a.NegatedAnonymousPolicy]),M=/* @__PURE__ */ new Set([a.UnknownEvent,a.UnknownReadModelProperty,a.PiiNotSupportedOnIdentifier]),N=/* @__PURE__ */ new Set([a.EventFromLaterSlice,a.TimelineCycleGroup]),P=/* @__PURE__ */ new Set([a.UndeclaredDependency,a.UnusedDependencyDeclaration,a.InvalidDependencyTarget,a.RepeatedDependencyDeclaration,a.MutualDependencyDeclarations,a.AmbiguousReference]),F=/* @__PURE__ */ new Set([a.InvalidCommandReadsDeclaration,a.UnknownMatchPattern,a.InvalidMatchPattern,a.PatternOutsidePortableMatchDialect,a.AmbiguousMatchPattern,a.DeprecatedStudioTextRulePattern,a.MismatchedSpecificationQueryResult,a.DirectionlessTranslationReactsToOwnCapture,a.CaptureEventsFromSeveralOrigins,a.CaptureEventsKeyNotRequired,a.CaptureEventsRecordFixture,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]),I=/* @__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]),L=/* @__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&&!O.has(e.code)&&!k.has(e.code)&&!I.has(e.code)&&!A.has(e.code)&&!j.has(e.code)&&!M.has(e.code)&&!N.has(e.code)&&!P.has(e.code)&&!F.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&&D.some(t=>t.code===e.code&&t.line===r))continue;if(e.code===a.UnknownEvent){if(L.has(r))continue;L.add(r)}let i=o(s[r],e)||s[r].length-e.location.column+1;D.push(issue(e.severity,r,e.location.column,i,e.message,e.code))}let checkEvent=(e,t,n)=>{!T.has(n)&&!L.has(e)&&D.push(tokenIssue(`warning`,e,t,n,`Unknown event type '${n}' — declare it in a slice or import it.`,y.unknownEvent))},R=-1;for(let a=0;a<s.length;a++){let o=s[a],c=o.trim();if(d[a]||c.length===0)continue;let u=o.match(/^[ ]*(\t+)/);if(u&&D.push(issue(`warning`,a,u[0].length-u[1].length+1,u[1].length,`Screenplay is indentation-based — use spaces, not tabs.`,y.tabIndentation)),R>=0){if(l(o)>R&&/^(?:or\s+)?[A-Z]\w*(?:\s+or\s+[A-Z]\w*)*$/.test(c)){for(let e of c.split(/\s+/).filter(e=>e!==`or`))E.has(e)||D.push(tokenIssue(`warning`,a,o,e,`Unknown policy '${e}' — declare it with 'policy ${e}'.`,y.unknownPolicy));continue}R=-1}let f=validateImport(s,d,a);f&&D.push(f);let p=c.match(/^slice\s+(\w+)/);p&&!i.includes(p[1])&&D.push(tokenIssue(`error`,a,o,p[1],`Unknown slice type '${p[1]}' — expected ${i.join(`, `)}.`,y.unknownSliceType));let m=c.match(/^concept\s+\w+\s*:\s*(\w+)/);m&&m[1]!==`Enum`&&!r.includes(m[1])&&D.push(tokenIssue(`error`,a,o,m[1],`Unknown primitive type '${m[1]}' — expected ${r.join(`, `)} or Enum.`,y.unknownPrimitiveType));let h=c.match(/^authorize\s+(.*)$/);if(h){R=l(o);for(let e of h[1].split(/\s+/).filter(e=>e!==`or`&&e.length>0))E.has(e)||D.push(tokenIssue(`warning`,a,o,e,`Unknown policy '${e}' — declare it with 'policy ${e}'.`,y.unknownPolicy))}let g=c.match(/^on\s+([A-Z]\w*)\s*$/);g&&checkEvent(a,o,g[1]);let _=c.match(/^produces\s+([A-Z]\w*)\s*$/);if(_&&!S.operationProductionLines?.has(a)&&checkEvent(a,o,_[1]),/^produces\s+when\b/.test(c)&&!S.operationProductionLines?.has(a))for(let e=a+1;e<s.length;e++){let t=s[e];if(!(d[e]||t.trim().length===0)){if(l(t)>l(o)){let n=t.trim().match(/^([A-Z]\w*)\s*$/);n&&checkEvent(e,t,n[1])}break}}let v=c.match(/^unique\s+event\s+([A-Z]\w*)/);v&&checkEvent(a,o,v[1]);let b=c.match(/^unique\s+[a-z_]\w*\s+on\s+([A-Z]\w*)/);b&&checkEvent(a,o,b[1]);for(let e of o.match(/\$identity\.[\w.]+/g)??[]){let t=e.substring(10).split(`.`)[0],r=[...n,...(S.identityDetails??[]).map(e=>e.name)];r.includes(t)||D.push(tokenIssue(`warning`,a,o,e,`Unknown $identity property '${t}' — expected ${r.join(`, `)}.`,y.unknownContextIdentityProperty))}for(let r of o.match(/\$context\.[\w.]+/g)??[]){let i=r.substring(9).split(`.`);t.includes(i[0])?i[0]===`causedBy`&&i.length>1&&!e.includes(i[1])?D.push(tokenIssue(`warning`,a,o,r,`Unknown $context.causedBy property '${i[1]}' — expected ${e.join(`, `)}.`,y.unknownContextCausedByProperty)):i[0]===`identity`&&i.length>1&&!n.includes(i[1])&&D.push(tokenIssue(`warning`,a,o,r,`Unknown $context.identity property '${i[1]}' — expected ${n.join(`, `)}.`,y.unknownContextIdentityProperty)):D.push(tokenIssue(`warning`,a,o,r,`Unknown $context path '${i.join(`.`)}' — expected one of ${t.join(`, `)}.`,y.unknownContextPath))}}D.push(...validateEventContextPaths(s,d)),D.push(...b(s,w,g,S.operationProductionLines));let z=s.map((e,t)=>({line:e,index:t})).filter(({line:e})=>/^\s*```(?:[a-z]+)?\s*$/.test(e));if(z.length%2==1){let e=z[z.length-1];D.push(issue(`error`,e.index,1,e.line.length+1,"Unclosed inline code block — expected a closing ``` line.",y.unclosedCodeBlock))}return D}function validateProductionDestinations(e,t){let n=[];e=u(e);for(let r of t.commands){let t=r.properties.filter(e=>e.isIdentifier&&!g(e).isOptional&&!g(e).isCollection);if(t.length===1)for(let i of r.produces??[]){if(i.inline||i.conditional||i.target!==void 0)continue;let r=i.line;n.push(issue(`information`,r,l(e[r])+1,e[r].trim().length,`Plain 'produces ${i.name}' omits its destination — use 'for ${t[0].name}' to explicitly select the command's identifier.`,y.omittedProductionDestination))}}return n}function validateImport(e,t,n){let r=e[n],i=r.trim().replace(/\s*\/\/.*$/,``);if(!/^import\b/.test(i)||x(r,n))return;let a=l(r);if(a>0&&[`module`,`feature`].includes(s(e,t,n,a)[0])||S(r))return issue(`error`,n,a+1,i.length,`Invalid import '${i}' — inside a module or feature, import names files: 'import "<path or glob>"'.`,y.invalidFileImport)}const C=/^(?:(?:increment|decrement|count|clear|add|subtract|set)\s+)?@?([$\w.]+)(?=\s|=|$)/;function validateEventContextPaths(e,t){let n=[],names=e=>e.map(e=>e.name).join(`, `);for(let r=0;r<e.length;r++){let i=e[r];if(t[r])continue;for(let e of i.matchAll(/(\.)?\$eventContext((?:\.(?:\w+(?:\(\))?)?)*)/g)){let t=e[0].substring(e[1]?.length??0),i=e[2];if(i.length===0){e[1]&&n.push(issue(`error`,r,(e.index??0)+2,t.length,`'$eventContext' names no member - expected one of ${names(d(``).expected)}.`,y.missingEventContextPath));continue}let a=i.substring(1),o=d(a),s=(e.index??0)+(e[1]?.length??0)+1;switch(o.status){case`missing`:n.push(issue(`error`,r,s,t.length,`'$eventContext.${a}' names no member - expected one of ${names(o.expected)}.`,y.missingEventContextPath));break;case`unknownMember`:n.push(issue(`warning`,r,s,t.length,`Unknown event context member '${o.segment}' in '$eventContext.${a}' - expected one of ${names(o.expected)}.`,y.unknownEventContextMember));break;case`unknownSubPath`:{let e=o.expected.length===0?`no members to address`:`members ${names(o.expected)}`;n.push(issue(`warning`,r,s,t.length,`Unknown event context path '$eventContext.${a}' - '${o.member?.name}' (${o.member?.type}) has ${e}.`,y.unknownEventContextPath));break}case`belowCollection`:n.push(issue(`error`,r,s,t.length,`'$eventContext.${a}' cannot resolve - '${o.member?.name}' is a collection (${o.member?.type}) and cannot be addressed below.`,y.eventContextPathBelowCollection))}}let a=i.trim().match(C)?.[1],o=a?.match(/\.\$(\w+)/)?.[1];a&&o&&o!==`eventContext`&&n.push(tokenIssue(`warning`,r,i,a,`Dynamic dictionary key '$${o}' in '${a}' is never resolved - only '$eventContext.<path>' is, so the literal text '$${o}' becomes the key.`,y.unresolvedDynamicKeySource))}return n}export{validateEventContextPaths,validateLines};
|
|
2
|
+
`)),x.authoringPlacement,x.authoringPath,x.authoringPlacementResolved),C=new Set(S.eventSources.routes.map(e=>e.location.line-1)),w={...m,commands:m.commands.map(e=>({...e,properties:e.properties.filter(e=>!C.has(e.line)),produces:e.produces?.filter(e=>!S.operationProductionLines?.has(e.line)),productionHeaders:e.productionHeaders?.filter(e=>!S.operationProductionLines?.has(e))}))},T=/* @__PURE__ */ new Set([...p(w),...p(g)]),E=new Set([...w.policies,...g.policies].map(e=>e.name)),D=validateDeclarations(s,w,g);D.push(...validateProductionDestinations(s,w));let O=/* @__PURE__ */ new Set([a.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]),k=/* @__PURE__ */ new Set([a.MixedEnumerationNumbering,a.DuplicateEnumerationNumber,a.EnumerationNumberOutsideInt32,a.MalformedEnumerationNumber,a.UnpinnedStoredEnumeration]),A=/* @__PURE__ */ new Set([a.LegacyOptionalSuffix,a.InvalidOptionalModifierOrder,a.OptionalReadsNotSupported]),j=/* @__PURE__ */ new Set([a.UnexpectedTokenInPolicyCondition,a.ExpectedPolicyCondition,a.UnclosedPolicyConditionGroup,a.ExpectedRoleName,a.ExpectedClaimName,a.ExpectedClaimMatches,a.ExpectedClaimMatchTarget,a.AnonymousPolicyCombined,a.NegatedAnonymousPolicy]),M=/* @__PURE__ */ new Set([a.UnknownEvent,a.UnknownReadModelProperty,a.PiiNotSupportedOnIdentifier]),N=/* @__PURE__ */ new Set([a.EventFromLaterSlice,a.TimelineCycleGroup]),P=/* @__PURE__ */ new Set([a.UndeclaredDependency,a.UnusedDependencyDeclaration,a.InvalidDependencyTarget,a.RepeatedDependencyDeclaration,a.MutualDependencyDeclarations,a.AmbiguousReference]),F=/* @__PURE__ */ new Set([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]),I=/* @__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]),L=/* @__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&&!O.has(e.code)&&!k.has(e.code)&&!I.has(e.code)&&!A.has(e.code)&&!j.has(e.code)&&!M.has(e.code)&&!N.has(e.code)&&!P.has(e.code)&&!F.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&&D.some(t=>t.code===e.code&&t.line===r))continue;if(e.code===a.UnknownEvent){if(L.has(r))continue;L.add(r)}let i=o(s[r],e)||s[r].length-e.location.column+1;D.push(issue(e.severity,r,e.location.column,i,e.message,e.code))}let checkEvent=(e,t,n)=>{!T.has(n)&&!L.has(e)&&D.push(tokenIssue(`warning`,e,t,n,`Unknown event type '${n}' — declare it in a slice or import it.`,y.unknownEvent))},R=-1;for(let a=0;a<s.length;a++){let o=s[a],c=o.trim();if(d[a]||c.length===0)continue;let u=o.match(/^[ ]*(\t+)/);if(u&&D.push(issue(`warning`,a,u[0].length-u[1].length+1,u[1].length,`Screenplay is indentation-based — use spaces, not tabs.`,y.tabIndentation)),R>=0){if(l(o)>R&&/^(?:or\s+)?[A-Z]\w*(?:\s+or\s+[A-Z]\w*)*$/.test(c)){for(let e of c.split(/\s+/).filter(e=>e!==`or`))E.has(e)||D.push(tokenIssue(`warning`,a,o,e,`Unknown policy '${e}' — declare it with 'policy ${e}'.`,y.unknownPolicy));continue}R=-1}let f=validateImport(s,d,a);f&&D.push(f);let p=c.match(/^slice\s+(\w+)/);p&&!i.includes(p[1])&&D.push(tokenIssue(`error`,a,o,p[1],`Unknown slice type '${p[1]}' — expected ${i.join(`, `)}.`,y.unknownSliceType));let m=c.match(/^concept\s+\w+\s*:\s*(\w+)/);m&&m[1]!==`Enum`&&!r.includes(m[1])&&D.push(tokenIssue(`error`,a,o,m[1],`Unknown primitive type '${m[1]}' — expected ${r.join(`, `)} or Enum.`,y.unknownPrimitiveType));let h=c.match(/^authorize\s+(.*)$/);if(h){R=l(o);for(let e of h[1].split(/\s+/).filter(e=>e!==`or`&&e.length>0))E.has(e)||D.push(tokenIssue(`warning`,a,o,e,`Unknown policy '${e}' — declare it with 'policy ${e}'.`,y.unknownPolicy))}let g=c.match(/^on\s+([A-Z]\w*)\s*$/);g&&checkEvent(a,o,g[1]);let _=c.match(/^produces\s+([A-Z]\w*)\s*$/);if(_&&!S.operationProductionLines?.has(a)&&checkEvent(a,o,_[1]),/^produces\s+when\b/.test(c)&&!S.operationProductionLines?.has(a))for(let e=a+1;e<s.length;e++){let t=s[e];if(!(d[e]||t.trim().length===0)){if(l(t)>l(o)){let n=t.trim().match(/^([A-Z]\w*)\s*$/);n&&checkEvent(e,t,n[1])}break}}let v=c.match(/^unique\s+event\s+([A-Z]\w*)/);v&&checkEvent(a,o,v[1]);let b=c.match(/^unique\s+[a-z_]\w*\s+on\s+([A-Z]\w*)/);b&&checkEvent(a,o,b[1]);for(let e of o.match(/\$identity\.[\w.]+/g)??[]){let t=e.substring(10).split(`.`)[0],r=[...n,...(S.identityDetails??[]).map(e=>e.name)];r.includes(t)||D.push(tokenIssue(`warning`,a,o,e,`Unknown $identity property '${t}' — expected ${r.join(`, `)}.`,y.unknownContextIdentityProperty))}for(let r of o.match(/\$context\.[\w.]+/g)??[]){let i=r.substring(9).split(`.`);t.includes(i[0])?i[0]===`causedBy`&&i.length>1&&!e.includes(i[1])?D.push(tokenIssue(`warning`,a,o,r,`Unknown $context.causedBy property '${i[1]}' — expected ${e.join(`, `)}.`,y.unknownContextCausedByProperty)):i[0]===`identity`&&i.length>1&&!n.includes(i[1])&&D.push(tokenIssue(`warning`,a,o,r,`Unknown $context.identity property '${i[1]}' — expected ${n.join(`, `)}.`,y.unknownContextIdentityProperty)):D.push(tokenIssue(`warning`,a,o,r,`Unknown $context path '${i.join(`.`)}' — expected one of ${t.join(`, `)}.`,y.unknownContextPath))}}D.push(...validateEventContextPaths(s,d)),D.push(...b(s,w,g,S.operationProductionLines));let z=s.map((e,t)=>({line:e,index:t})).filter(({line:e})=>/^\s*```(?:[a-z]+)?\s*$/.test(e));if(z.length%2==1){let e=z[z.length-1];D.push(issue(`error`,e.index,1,e.line.length+1,"Unclosed inline code block — expected a closing ``` line.",y.unclosedCodeBlock))}return D}function validateProductionDestinations(e,t){let n=[];e=u(e);for(let r of t.commands){let t=r.properties.filter(e=>e.isIdentifier&&!g(e).isOptional&&!g(e).isCollection);if(t.length===1)for(let i of r.produces??[]){if(i.inline||i.conditional||i.target!==void 0)continue;let r=i.line;n.push(issue(`information`,r,l(e[r])+1,e[r].trim().length,`Plain 'produces ${i.name}' omits its destination — use 'for ${t[0].name}' to explicitly select the command's identifier.`,y.omittedProductionDestination))}}return n}function validateImport(e,t,n){let r=e[n],i=r.trim().replace(/\s*\/\/.*$/,``);if(!/^import\b/.test(i)||x(r,n))return;let a=l(r);if(a>0&&[`module`,`feature`].includes(s(e,t,n,a)[0])||S(r))return issue(`error`,n,a+1,i.length,`Invalid import '${i}' — inside a module or feature, import names files: 'import "<path or glob>"'.`,y.invalidFileImport)}const C=/^(?:(?:increment|decrement|count|clear|add|subtract|set)\s+)?@?([$\w.]+)(?=\s|=|$)/;function validateEventContextPaths(e,t){let n=[],names=e=>e.map(e=>e.name).join(`, `);for(let r=0;r<e.length;r++){let i=e[r];if(t[r])continue;for(let e of i.matchAll(/(\.)?\$eventContext((?:\.(?:\w+(?:\(\))?)?)*)/g)){let t=e[0].substring(e[1]?.length??0),i=e[2];if(i.length===0){e[1]&&n.push(issue(`error`,r,(e.index??0)+2,t.length,`'$eventContext' names no member - expected one of ${names(d(``).expected)}.`,y.missingEventContextPath));continue}let a=i.substring(1),o=d(a),s=(e.index??0)+(e[1]?.length??0)+1;switch(o.status){case`missing`:n.push(issue(`error`,r,s,t.length,`'$eventContext.${a}' names no member - expected one of ${names(o.expected)}.`,y.missingEventContextPath));break;case`unknownMember`:n.push(issue(`warning`,r,s,t.length,`Unknown event context member '${o.segment}' in '$eventContext.${a}' - expected one of ${names(o.expected)}.`,y.unknownEventContextMember));break;case`unknownSubPath`:{let e=o.expected.length===0?`no members to address`:`members ${names(o.expected)}`;n.push(issue(`warning`,r,s,t.length,`Unknown event context path '$eventContext.${a}' - '${o.member?.name}' (${o.member?.type}) has ${e}.`,y.unknownEventContextPath));break}case`belowCollection`:n.push(issue(`error`,r,s,t.length,`'$eventContext.${a}' cannot resolve - '${o.member?.name}' is a collection (${o.member?.type}) and cannot be addressed below.`,y.eventContextPathBelowCollection))}}let a=i.trim().match(C)?.[1],o=a?.match(/\.\$(\w+)/)?.[1];a&&o&&o!==`eventContext`&&n.push(tokenIssue(`warning`,r,i,a,`Dynamic dictionary key '$${o}' in '${a}' is never resolved - only '$eventContext.<path>' is, so the literal text '$${o}' becomes the key.`,y.unresolvedDynamicKeySource))}return n}export{validateEventContextPaths,validateLines};
|
|
3
3
|
//# sourceMappingURL=validation.js.map
|