@cratis/screenplay-language 4.240.6 → 4.242.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/dist/bundles/compiler/Diagnostics/DiagnosticCodes.js +1 -1
  2. package/dist/bundles/compiler/Diagnostics/DiagnosticCodes.js.map +1 -1
  3. package/dist/bundles/compiler/Files/PlayFolderMerge.js +1 -1
  4. package/dist/bundles/compiler/Files/PlayFolderMerge.js.map +1 -1
  5. package/dist/bundles/compiler/Parsing/CaptureEventFixturesValidator.js +1 -1
  6. package/dist/bundles/compiler/Parsing/CaptureEventFixturesValidator.js.map +1 -1
  7. package/dist/bundles/compiler/Parsing/CaptureParser.js +1 -1
  8. package/dist/bundles/compiler/Parsing/CaptureParser.js.map +1 -1
  9. package/dist/bundles/compiler/Parsing/ClockOperandParser.js +2 -0
  10. package/dist/bundles/compiler/Parsing/ClockOperandParser.js.map +1 -0
  11. package/dist/bundles/compiler/Parsing/CommandParser.js +1 -1
  12. package/dist/bundles/compiler/Parsing/CommandParser.js.map +1 -1
  13. package/dist/bundles/compiler/Parsing/ConditionParser.js +1 -1
  14. package/dist/bundles/compiler/Parsing/ConditionParser.js.map +1 -1
  15. package/dist/bundles/compiler/Parsing/PublicEventUsageValidator.js +1 -1
  16. package/dist/bundles/compiler/Parsing/PublicEventUsageValidator.js.map +1 -1
  17. package/dist/bundles/compiler/Parsing/ScreenplayParser.js +1 -1
  18. package/dist/bundles/compiler/Parsing/ScreenplayParser.js.map +1 -1
  19. package/dist/bundles/compiler/Parsing/SpecificationParser.js +1 -1
  20. package/dist/bundles/compiler/Parsing/SpecificationParser.js.map +1 -1
  21. package/dist/bundles/compiler/Syntax/ScreenplaySyntaxWalker.js +1 -1
  22. package/dist/bundles/compiler/Syntax/ScreenplaySyntaxWalker.js.map +1 -1
  23. package/dist/bundles/compiler/Syntax/Structure.js.map +1 -1
  24. package/dist/bundles/compiler/Syntax/SyntaxCollections.js +1 -1
  25. package/dist/bundles/compiler/Syntax/SyntaxCollections.js.map +1 -1
  26. package/dist/bundles/compiler/Syntax/SyntaxJson.js +1 -1
  27. package/dist/bundles/compiler/Syntax/SyntaxJson.js.map +1 -1
  28. package/dist/bundles/completion-items.js +3 -3
  29. package/dist/bundles/completion-items.js.map +1 -1
  30. package/dist/bundles/diagnostic-codes.js +1 -1
  31. package/dist/bundles/diagnostic-codes.js.map +1 -1
  32. package/dist/bundles/example-analysis.js +1 -1
  33. package/dist/bundles/example-analysis.js.map +1 -1
  34. package/dist/bundles/keyword-docs.js +1 -1
  35. package/dist/bundles/keyword-docs.js.map +1 -1
  36. package/dist/bundles/language.js +1 -1
  37. package/dist/bundles/language.js.map +1 -1
  38. package/dist/bundles/response-analysis.js +2 -2
  39. package/dist/bundles/response-analysis.js.map +1 -1
  40. package/dist/bundles/sub-languages/cdl.js +1 -1
  41. package/dist/bundles/sub-languages/cdl.js.map +1 -1
  42. package/dist/bundles/tokens.js +1 -1
  43. package/dist/bundles/tokens.js.map +1 -1
  44. package/dist/bundles/validation.js +1 -1
  45. package/dist/bundles/validation.js.map +1 -1
  46. package/dist/completion-items.d.ts.map +1 -1
  47. package/dist/diagnostic-codes.d.ts +4 -0
  48. package/dist/diagnostic-codes.d.ts.map +1 -1
  49. package/dist/keyword-docs.d.ts.map +1 -1
  50. package/dist/language.d.ts.map +1 -1
  51. package/dist/sub-languages/cdl.d.ts.map +1 -1
  52. package/dist/tokens.d.ts.map +1 -1
  53. package/package.json +3 -1
@@ -1 +1 @@
1
- {"version":3,"file":"SyntaxJson.js","names":["value","omitted","skippedNumberMembers","sourceRoots","detached","node","copies","pending","items","length","index","copy","names","name","member","omittedWhenNull","omittedWhenEmpty","omittedWhenDefault","table","kind","defaults","owningMode","complete","validateClosedSyntaxMembers","rule","structural","known","syntaxMemberNames","isLegacyOmittedMember","validatedSourceOptions","legacySourceOptions","validateSyntaxInvariants","result","memberValue","record","depth","validateSyntaxMembers","InvalidSyntaxJson","options","isExactNumberToken","literal","parseExactNumber","left","right"],"sources":["../../../../../../Compiler/Syntax/SyntaxJson.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 { SyntaxNode } from './SyntaxNode';\nimport { InvalidSyntaxJson } from './InvalidSyntaxJson';\nimport { isExactNumberToken, parseExactNumber } from './ExactNumber';\nimport { validateSyntaxInvariants } from './SyntaxInvariants';\nimport { syntaxMemberNames, validateClosedSyntaxMembers, validateSyntaxMembers } from './SyntaxMemberContracts';\nimport { ValidationRuleSyntax } from './Commands';\nimport { isLegacyOmittedMember } from './LegacyWireProjection';\nimport { legacySourceOptions, validatedSourceOptions } from './SourceOptions';\n\n// Returned record objects have null prototypes.\nexport type SyntaxJsonValue = string | number | boolean | null | SyntaxJsonValue[] | { [member: string]: SyntaxJsonValue };\n\nconst isNode = (value: unknown): value is SyntaxNode =>\n typeof value === 'object' && value !== null && typeof (value as { kind?: unknown }).kind === 'string';\nconst isObject = (value: unknown): value is object => typeof value === 'object' && value !== null;\nconst omitted = new Set(['kind', 'location', 'targetLocation', 'referenceLocation', 'referenceLength', 'nameWasEscaped', 'declaredTriggers', 'directiveLocations']);\nconst skippedNumberMembers = new Set(['location', 'targetLocation', 'usesLocation']);\nconst sourceRoots = new Set(['ApplicationSyntax', 'ProjectionSyntax', 'CaptureSyntax', 'SpecificationSyntax']);\n\n// The canonical JSON form of a syntax tree, the same form the C# SyntaxJson writes: 'kind' first, then the\n// members in ordinal order, with source locations left out. Because a node only carries the members this\n// compiler models, the result is the C# form narrowed to those members.\nexport function toSyntaxJson(node: SyntaxNode): SyntaxJsonValue {\n const detached = snapshot(node);\n validateNumbers(detached, 'legacy', 0);\n return write(detached);\n}\n\n// The enriched internal tree written completely, Legacy members included. Not a wire form: it exists so the\n// walker and other tree consumers can be held to every node the parser builds.\nexport function toCompleteSyntaxJson(node: SyntaxNode): SyntaxJsonValue {\n const detached = snapshot(node);\n validateNumbers(detached, 'legacy', 0);\n return write(detached, 'legacy', true);\n}\n\n// Read caller-owned properties only once, before validation. Both validation and projection see the same\n// detached data; accessors, proxies and shared references cannot change it between passes.\nfunction snapshot(value: unknown): unknown {\n const copies = new WeakMap<object, unknown>();\n const pending: (() => void)[] = [];\n // Schedule depth-first reads without consuming the call stack, including for ignored metadata.\n function detach(value: unknown): unknown {\n if (!isObject(value)) return value;\n if (copies.has(value)) return copies.get(value);\n return Array.isArray(value) ? detachArray(value) : detachObject(value);\n }\n function detachArray(value: unknown[]): unknown {\n const items = dataArray<unknown>();\n copies.set(value, items);\n const length = value.length;\n for (let index = length - 1; index >= 0; index--) pending.push(() => {\n items[index] = detach(Object.hasOwn(value, index) ? value[index] : undefined);\n });\n return items;\n }\n function detachObject(value: object): unknown {\n const copy = Object.create(null) as Record<string, unknown>;\n copies.set(value, copy);\n const names = Object.keys(value);\n // Node identity also accepts inherited, hidden and class-getter kinds; read it just once.\n if (!names.includes('kind') && 'kind' in value) names.unshift('kind');\n for (let index = names.length - 1; index >= 0; index--) pending.push(() => {\n const name = names[index];\n const member = (value as Record<string, unknown>)[name];\n if (name === 'sourceOptions') pending.push(() => preserveRejectedSourceOptions(copy, name, member));\n copy[name] = detach(member);\n });\n return copy;\n }\n const detached = detach(value);\n while (pending.length > 0) pending.pop()!();\n return detached;\n}\n\n// Source option contracts also reject exotic prototypes and hidden/symbol members. Preserve\n// that rejected shape as data rather than sanitizing it into an apparently valid option record.\nfunction preserveRejectedSourceOptions(copy: Record<string, unknown>, name: string, member: unknown): void {\n if (isObject(member) && hasExoticShape(member)) {\n copy[name] = Object.assign(Object.create(null), { numericMode: 'invalid' });\n }\n}\n\nfunction hasExoticShape(member: object): boolean {\n return (Object.getPrototypeOf(member) !== Object.prototype && Object.getPrototypeOf(member) !== null) || Reflect.ownKeys(member).length !== Object.keys(member).length;\n}\n\nfunction dataArray<T>(): T[] {\n const items: T[] = [];\n // JSON.stringify consults inherited toJSON even on plain arrays. Shadow that hook without changing\n // their indexed JSON bytes or normal Array prototype (including for existing tree consumers).\n Object.defineProperty(items, 'toJSON', { value: undefined });\n return items;\n}\n\n// Members omitted from the wire form when null (or undefined), by node kind.\nconst omittedWhenNull: Record<string, readonly string[]> = {\n ApplicationSyntax: ['identity', 'reactionProductionMode', 'commandReadMode'],\n EventSyntax: ['origin'],\n ImportSyntax: ['origin'],\n SliceSyntax: ['direction'],\n ReactionSyntax: ['from'],\n ReducerSyntax: ['from'],\n RemoveWithSyntax: ['partsKey'],\n ProducesSyntax: ['stream'],\n ConceptAttributeSyntax: ['scope', 'specialCategory'],\n ConceptSyntax: ['description', 'valueNumbers', 'generation'],\n GenerationSyntax: ['file', 'code'],\n PolicySyntax: ['description'],\n FileConstraintSyntax: ['description'],\n UniqueEventConstraintSyntax: ['description'],\n UniquePropertyConstraintSyntax: ['description'],\n ProjectionSyntax: ['description'],\n ScreenSyntax: ['description'],\n FormSyntax: ['description'],\n SpecificationSyntax: ['description', 'whenRedelivered'],\n SpecificationErrorSyntax: ['caseValue'],\n SpecificationExampleSyntax: ['stream', 'noStream'],\n SpecificationRedeliverySyntax: ['stream', 'noStream']\n};\n\n// Members omitted from the wire form when empty arrays, by node kind.\nconst omittedWhenEmpty: Record<string, readonly string[]> = {\n ModuleSyntax: ['dependsOn'],\n FeatureSyntax: ['dependsOn'],\n SpecificationSyntax: ['parameters', 'cases'],\n InvokesSyntax: ['onRefused']\n};\n\n// Members omitted when they hold their default value, by node kind.\nconst omittedWhenDefault: Record<string, Record<string, unknown>> = {\n EventSyntax: { visibility: 'Private' },\n ImportSyntax: { visibility: 'Private' },\n ConceptAttributeSyntax: { criminal: false },\n PropertySyntax: { isSubject: false },\n SpecificationSyntax: { thenNoEvents: false }\n};\n\nconst ownEntry = <T>(table: Record<string, T>, kind: string): T | undefined => Object.hasOwn(table, kind) ? table[kind] : undefined;\nconst isEmptyArray = (value: unknown): boolean => Array.isArray(value) && value.length === 0;\n\nfunction isNullOmitted(kind: string, member: string, value: unknown): boolean {\n if (value != null) return false;\n return ownEntry(omittedWhenNull, kind)?.includes(member) === true\n || member === 'inlineProperty'\n || (member === 'documentation' && kind !== 'EventSyntax');\n}\n\nfunction isEmptyOmitted(kind: string, member: string, value: unknown): boolean {\n if (!isEmptyArray(value)) return false;\n return ownEntry(omittedWhenEmpty, kind)?.includes(member) === true || member === 'examples' || member === 'purposes';\n}\n\nfunction isDefaultOmitted(kind: string, member: string, value: unknown): boolean {\n if (member === 'sourceOptions') return (value as { numericMode?: string } | undefined)?.numericMode === 'legacy';\n const defaults = ownEntry(omittedWhenDefault, kind);\n return defaults !== undefined && Object.hasOwn(defaults, member) && value === defaults[member];\n}\n\nfunction isOmittedByDefault(kind: string, member: string, value: unknown): boolean {\n return isNullOmitted(kind, member, value) || isEmptyOmitted(kind, member, value) || isDefaultOmitted(kind, member, value);\n}\n\nfunction write(value: unknown, owningMode = 'legacy', complete = false): SyntaxJsonValue {\n if (Array.isArray(value)) return writeArray(value, owningMode, complete);\n if (isNode(value)) return writeNode(value, owningMode, complete);\n if (value === undefined) return null;\n if (!isObject(value)) return value as SyntaxJsonValue;\n return writeRecord(value as Record<string, unknown>, owningMode, complete);\n}\n\nfunction writeArray(value: unknown[], owningMode: string, complete: boolean): SyntaxJsonValue {\n // A fresh plain array: never map (Symbol.species) or serialize through a caller-supplied hook.\n const items = dataArray<SyntaxJsonValue>();\n for (let index = 0; index < value.length; index++) items.push(write(value[index], owningMode, complete));\n return items;\n}\n\nfunction validateClosedImplementationShapes(value: SyntaxNode): void {\n // #307 shapes are closed in both modes, before any projection can hide unknown members.\n if (value.kind === 'ImplementationSyntax' || value.kind === 'ImplementationHintSyntax') validateClosedSyntaxMembers(value, omitted);\n if (value.kind !== 'ValidationRuleSyntax') return;\n const rule = value as ValidationRuleSyntax;\n if (rule.implementation == null) return;\n if (rule.file != null) validateClosedSyntaxMembers(rule.file, omitted);\n if (rule.code != null) validateClosedSyntaxMembers(rule.code, omitted);\n}\n\nfunction structuralMembers(value: SyntaxNode): Record<string, unknown> {\n const structural = { ...value } as unknown as Record<string, unknown>;\n if (value.kind === 'ApplicationSyntax' && structural.eventSources === undefined) structural.eventSources = [];\n if (value.kind === 'CommandSyntax' && structural.stream === undefined) structural.stream = null;\n if (value.kind === 'CommandSyntax' && structural.streamCandidates === undefined) structural.streamCandidates = [];\n return structural;\n}\n\nfunction projectedMemberNames(value: SyntaxNode, structural: Record<string, unknown>, owningMode: string, complete: boolean): string[] {\n const known = owningMode === 'exact' ? syntaxMemberNames(value.kind) : undefined;\n const isProjected = (member: string) =>\n (known === undefined || known.has(member)) && !isHiddenByLegacy(value, member, owningMode, complete) && !isAlwaysOmitted(value, member);\n return Object.keys(structural).filter(isProjected).sort(ordinal);\n}\n\nfunction isHiddenByLegacy(value: SyntaxNode, member: string, owningMode: string, complete: boolean): boolean {\n return owningMode === 'legacy' && !complete && isLegacyOmittedMember(value, member);\n}\n\nfunction isAlwaysOmitted(value: SyntaxNode, member: string): boolean {\n return omitted.has(member) || (value.kind === 'OperationSyntax' && member === 'usesLocation');\n}\n\nfunction writeNode(value: SyntaxNode, owningMode: string, complete: boolean): SyntaxJsonValue {\n if (sourceRoots.has(value.kind)) owningMode = validatedSourceOptions((value as unknown as { sourceOptions?: unknown }).sourceOptions ?? legacySourceOptions).numericMode;\n validateSyntaxInvariants(value);\n validateClosedImplementationShapes(value);\n const result = Object.create(null) as Record<string, SyntaxJsonValue>;\n result.kind = value.kind;\n const structural = structuralMembers(value);\n for (const member of projectedMemberNames(value, structural, owningMode, complete)) {\n const memberValue = structural[member];\n if (isOmittedByDefault(value.kind, member, memberValue)) continue;\n result[member] = write(memberValue, owningMode, complete);\n }\n return result;\n}\n\nfunction writeRecord(record: Record<string, unknown>, owningMode: string, complete: boolean): SyntaxJsonValue {\n // The ordered ExactNumber form, whatever the input key order; other objects are copied without any toJSON hook.\n const copy = Object.create(null) as Record<string, SyntaxJsonValue>;\n if (record.literalType === 'ExactNumber') {\n copy.literalType = 'ExactNumber';\n copy.value = record.value as string;\n return copy;\n }\n for (const name of Object.keys(record)) if (name !== 'toJSON' && record[name] !== undefined) copy[name] = write(record[name], owningMode, complete);\n return copy;\n}\n\nfunction validateNumbers(value: unknown, owningMode: string, depth: number): void {\n assertSupportedDepth(owningMode, depth);\n if (Array.isArray(value)) {\n for (let index = 0; index < value.length; index++) validateNumbers(value[index], owningMode, depth + 1);\n return;\n }\n if (!isObject(value)) return;\n validateNodeNumbers(value as Record<string, unknown>, owningMode, depth);\n}\n\nfunction validateNodeNumbers(node: Record<string, unknown>, owningMode: string, depth: number): void {\n owningMode = resolveNumericMode(node, owningMode, depth);\n assertCompleteSourceRoot(node, owningMode, depth);\n if (owningMode === 'exact' && isNode(node)) validateSyntaxMembers(node);\n validateRawNumericText(node, owningMode);\n if (node.kind === 'LiteralExpressionSyntax' && Object.hasOwn(node, 'value')) validateLiteralValue(node.value, owningMode);\n validateNumberMembers(node, owningMode, depth);\n}\n\nfunction assertSupportedDepth(owningMode: string, depth: number): void {\n if (depth > 96 && owningMode === 'exact') throw new InvalidSyntaxJson('Syntax nesting exceeds the supported depth of 96.');\n}\n\nfunction assertCompleteSourceRoot(node: Record<string, unknown>, owningMode: string, depth: number): void {\n if (isIncompleteExactRoot(node, owningMode, depth)) throw new InvalidSyntaxJson('Exact syntax requires a complete source root.');\n}\n\nfunction isIncompleteExactRoot(node: Record<string, unknown>, owningMode: string, depth: number): boolean {\n return depth === 0 && owningMode === 'exact' && !sourceRoots.has(node.kind as string);\n}\n\nfunction resolveNumericMode(node: Record<string, unknown>, owningMode: string, depth: number): string {\n if (!sourceRoots.has(node.kind as string) && !Object.hasOwn(node, 'sourceOptions')) return owningMode;\n // Omission is Legacy on every complete source root, never inheritance from its container.\n const options = Object.hasOwn(node, 'sourceOptions') ? validatedSourceOptions(node.sourceOptions) : legacySourceOptions;\n if (depth > 0 && owningMode !== options.numericMode) throw new InvalidSyntaxJson('Conflicting source numeric options.');\n return options.numericMode;\n}\n\nfunction validateRawNumericText(node: Record<string, unknown>, owningMode: string): void {\n if (node.kind !== 'RawExpressionSyntax' || owningMode !== 'exact') return;\n if (typeof node.text === 'string' && isExactNumberToken(node.text)) throw new InvalidSyntaxJson('An exact numeric operand must be an explicit ExactNumber, not opaque numeric text.');\n}\n\nfunction isUnsupportedExactPrimitive(value: unknown): boolean {\n return typeof value === 'number' || (value !== null && !['string', 'boolean', 'object'].includes(typeof value));\n}\n\nfunction validateLiteralValue(value: unknown, owningMode: string): void {\n if (owningMode === 'exact' && isUnsupportedExactPrimitive(value)) throw new InvalidSyntaxJson('Exact source requires supported primitive values or an explicit ExactNumber literal.');\n if (!isObject(value)) return;\n validateObjectLiteral(value as { literalType?: unknown; value?: unknown }, owningMode);\n}\n\nfunction validateObjectLiteral(literal: { literalType?: unknown; value?: unknown }, owningMode: string): void {\n if (literal.literalType === 'ExactNumber') validateExactNumberLiteral(literal, owningMode);\n else if (owningMode === 'exact') throw new InvalidSyntaxJson('Exact source refuses old or plain object literal insertion.');\n}\n\nfunction isWellFormedExactNumber(literal: { value?: unknown }): boolean {\n return typeof literal.value === 'string' && parseExactNumber(literal.value)?.value === literal.value && Object.keys(literal).length === 2;\n}\n\nfunction validateExactNumberLiteral(literal: { value?: unknown }, owningMode: string): void {\n if (owningMode !== 'exact' || !isWellFormedExactNumber(literal)) throw new InvalidSyntaxJson('Malformed or incompatible ExactNumber literal.');\n}\n\nfunction validateNumberMembers(node: Record<string, unknown>, owningMode: string, depth: number): void {\n const known = owningMode === 'exact' && isNode(node) ? syntaxMemberNames(node.kind) : undefined;\n for (const [name, member] of Object.entries(node)) if (isTraversedMember(known, name, member)) validateNumbers(member, owningMode, depth + 1);\n}\n\nfunction isTraversedMember(known: ReadonlySet<string> | undefined, name: string, member: unknown): boolean {\n return (known === undefined || known.has(name) || (isNode(member) && sourceRoots.has(member.kind))) && !skippedNumberMembers.has(name);\n}\n\nfunction ordinal(left: string, right: string): number {\n return left < right ? -1 : left > right ? 1 : 0;\n}\n"],"mappings":"+g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MAAM,IAAIH,EAAkB,gDAAgD,CACjJ,CAEA,SAAS,sBAAsB,EAA+B,EAAoB,EAAqB,CACnG,IAAMX,EAAQL,IAAe,SAAW,OAAOhB,CAAI,EAAIsB,EAAkBtB,EAAK,IAAI,EAAI,IAAA,GACtF,IAAK,GAAM,CAACQ,EAAMC,KAAW,OAAO,QAAQT,CAAI,EAAO,kBAAkBqB,EAAOb,EAAMC,CAAM,GAAG,gBAAgBA,EAAQO,EAAYc,EAAQ,CAAC,CAChJ,CAEA,SAAS,kBAAkB,EAAwC,EAAc,EAA0B,CACvG,OAAQT,IAAU,IAAA,IAAaA,EAAM,IAAIb,CAAI,GAAM,OAAOC,CAAM,GAAKX,EAAY,IAAIW,EAAO,IAAI,IAAO,CAACZ,EAAqB,IAAIW,CAAI,CACzI,CAEA,SAAS,QAAQ,EAAc,EAAuB,CAClD,OAAO6B,EAAOC,EAAQ,GAAK,IAAOA,EACtC"}
1
+ {"version":3,"file":"SyntaxJson.js","names":["value","omitted","skippedNumberMembers","sourceRoots","detached","node","copies","pending","items","length","index","copy","names","name","member","omittedWhenNull","omittedWhenEmpty","omittedWhenDefault","table","kind","defaults","owningMode","complete","validateClosedSyntaxMembers","rule","structural","known","syntaxMemberNames","isLegacyOmittedMember","validatedSourceOptions","legacySourceOptions","validateSyntaxInvariants","result","memberValue","record","depth","validateSyntaxMembers","InvalidSyntaxJson","options","isExactNumberToken","literal","parseExactNumber","left","right"],"sources":["../../../../../../Compiler/Syntax/SyntaxJson.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 { SyntaxNode } from './SyntaxNode';\nimport { InvalidSyntaxJson } from './InvalidSyntaxJson';\nimport { isExactNumberToken, parseExactNumber } from './ExactNumber';\nimport { validateSyntaxInvariants } from './SyntaxInvariants';\nimport { syntaxMemberNames, validateClosedSyntaxMembers, validateSyntaxMembers } from './SyntaxMemberContracts';\nimport { ValidationRuleSyntax } from './Commands';\nimport { isLegacyOmittedMember } from './LegacyWireProjection';\nimport { legacySourceOptions, validatedSourceOptions } from './SourceOptions';\n\n// Returned record objects have null prototypes.\nexport type SyntaxJsonValue = string | number | boolean | null | SyntaxJsonValue[] | { [member: string]: SyntaxJsonValue };\n\nconst isNode = (value: unknown): value is SyntaxNode =>\n typeof value === 'object' && value !== null && typeof (value as { kind?: unknown }).kind === 'string';\nconst isObject = (value: unknown): value is object => typeof value === 'object' && value !== null;\nconst omitted = new Set(['kind', 'location', 'targetLocation', 'referenceLocation', 'referenceLength', 'nameWasEscaped', 'declaredTriggers', 'directiveLocations']);\nconst skippedNumberMembers = new Set(['location', 'targetLocation', 'usesLocation']);\nconst sourceRoots = new Set(['ApplicationSyntax', 'ProjectionSyntax', 'CaptureSyntax', 'SpecificationSyntax']);\n\n// The canonical JSON form of a syntax tree, the same form the C# SyntaxJson writes: 'kind' first, then the\n// members in ordinal order, with source locations left out. Because a node only carries the members this\n// compiler models, the result is the C# form narrowed to those members.\nexport function toSyntaxJson(node: SyntaxNode): SyntaxJsonValue {\n const detached = snapshot(node);\n validateNumbers(detached, 'legacy', 0);\n return write(detached);\n}\n\n// The enriched internal tree written completely, Legacy members included. Not a wire form: it exists so the\n// walker and other tree consumers can be held to every node the parser builds.\nexport function toCompleteSyntaxJson(node: SyntaxNode): SyntaxJsonValue {\n const detached = snapshot(node);\n validateNumbers(detached, 'legacy', 0);\n return write(detached, 'legacy', true);\n}\n\n// Read caller-owned properties only once, before validation. Both validation and projection see the same\n// detached data; accessors, proxies and shared references cannot change it between passes.\nfunction snapshot(value: unknown): unknown {\n const copies = new WeakMap<object, unknown>();\n const pending: (() => void)[] = [];\n // Schedule depth-first reads without consuming the call stack, including for ignored metadata.\n function detach(value: unknown): unknown {\n if (!isObject(value)) return value;\n if (copies.has(value)) return copies.get(value);\n return Array.isArray(value) ? detachArray(value) : detachObject(value);\n }\n function detachArray(value: unknown[]): unknown {\n const items = dataArray<unknown>();\n copies.set(value, items);\n const length = value.length;\n for (let index = length - 1; index >= 0; index--) pending.push(() => {\n items[index] = detach(Object.hasOwn(value, index) ? value[index] : undefined);\n });\n return items;\n }\n function detachObject(value: object): unknown {\n const copy = Object.create(null) as Record<string, unknown>;\n copies.set(value, copy);\n const names = Object.keys(value);\n // Node identity also accepts inherited, hidden and class-getter kinds; read it just once.\n if (!names.includes('kind') && 'kind' in value) names.unshift('kind');\n for (let index = names.length - 1; index >= 0; index--) pending.push(() => {\n const name = names[index];\n const member = (value as Record<string, unknown>)[name];\n if (name === 'sourceOptions') pending.push(() => preserveRejectedSourceOptions(copy, name, member));\n copy[name] = detach(member);\n });\n return copy;\n }\n const detached = detach(value);\n while (pending.length > 0) pending.pop()!();\n return detached;\n}\n\n// Source option contracts also reject exotic prototypes and hidden/symbol members. Preserve\n// that rejected shape as data rather than sanitizing it into an apparently valid option record.\nfunction preserveRejectedSourceOptions(copy: Record<string, unknown>, name: string, member: unknown): void {\n if (isObject(member) && hasExoticShape(member)) {\n copy[name] = Object.assign(Object.create(null), { numericMode: 'invalid' });\n }\n}\n\nfunction hasExoticShape(member: object): boolean {\n return (Object.getPrototypeOf(member) !== Object.prototype && Object.getPrototypeOf(member) !== null) || Reflect.ownKeys(member).length !== Object.keys(member).length;\n}\n\nfunction dataArray<T>(): T[] {\n const items: T[] = [];\n // JSON.stringify consults inherited toJSON even on plain arrays. Shadow that hook without changing\n // their indexed JSON bytes or normal Array prototype (including for existing tree consumers).\n Object.defineProperty(items, 'toJSON', { value: undefined });\n return items;\n}\n\n// Members omitted from the wire form when null (or undefined), by node kind.\nconst omittedWhenNull: Record<string, readonly string[]> = {\n ApplicationSyntax: ['identity', 'reactionProductionMode', 'commandReadMode', 'timeZone'],\n CommandSyntax: ['calendar'],\n ComparisonConditionSyntax: ['leftExpression'],\n EventSyntax: ['origin'],\n ImportSyntax: ['origin'],\n SliceSyntax: ['direction'],\n ReactionSyntax: ['from'],\n ReducerSyntax: ['from'],\n RemoveWithSyntax: ['partsKey'],\n ProducesSyntax: ['stream'],\n ConceptAttributeSyntax: ['scope', 'specialCategory'],\n ConceptSyntax: ['description', 'valueNumbers', 'generation'],\n GenerationSyntax: ['file', 'code'],\n PolicySyntax: ['description'],\n FileConstraintSyntax: ['description'],\n UniqueEventConstraintSyntax: ['description'],\n UniquePropertyConstraintSyntax: ['description'],\n ProjectionSyntax: ['description'],\n ScreenSyntax: ['description'],\n FormSyntax: ['description'],\n SpecificationSyntax: ['description', 'whenRedelivered', 'givenTimeZone'],\n SpecificationErrorSyntax: ['caseValue'],\n SpecificationExampleSyntax: ['stream', 'noStream'],\n SpecificationRedeliverySyntax: ['stream', 'noStream']\n};\n\n// Members omitted from the wire form when empty arrays, by node kind.\nconst omittedWhenEmpty: Record<string, readonly string[]> = {\n ModuleSyntax: ['dependsOn'],\n FeatureSyntax: ['dependsOn'],\n SpecificationSyntax: ['parameters', 'cases'],\n InvokesSyntax: ['onRefused']\n};\n\n// Members omitted when they hold their default value, by node kind.\nconst omittedWhenDefault: Record<string, Record<string, unknown>> = {\n EventSyntax: { visibility: 'Private' },\n ImportSyntax: { visibility: 'Private' },\n ConceptAttributeSyntax: { criminal: false },\n PropertySyntax: { isSubject: false },\n SpecificationSyntax: { thenNoEvents: false }\n};\n\nconst ownEntry = <T>(table: Record<string, T>, kind: string): T | undefined => Object.hasOwn(table, kind) ? table[kind] : undefined;\nconst isEmptyArray = (value: unknown): boolean => Array.isArray(value) && value.length === 0;\n\nfunction isNullOmitted(kind: string, member: string, value: unknown): boolean {\n if (value != null) return false;\n return ownEntry(omittedWhenNull, kind)?.includes(member) === true\n || member === 'inlineProperty'\n || (member === 'documentation' && kind !== 'EventSyntax');\n}\n\nfunction isEmptyOmitted(kind: string, member: string, value: unknown): boolean {\n if (!isEmptyArray(value)) return false;\n return ownEntry(omittedWhenEmpty, kind)?.includes(member) === true || member === 'examples' || member === 'purposes';\n}\n\nfunction isDefaultOmitted(kind: string, member: string, value: unknown): boolean {\n if (member === 'sourceOptions') return (value as { numericMode?: string } | undefined)?.numericMode === 'legacy';\n const defaults = ownEntry(omittedWhenDefault, kind);\n return defaults !== undefined && Object.hasOwn(defaults, member) && value === defaults[member];\n}\n\nfunction isOmittedByDefault(kind: string, member: string, value: unknown): boolean {\n return isNullOmitted(kind, member, value) || isEmptyOmitted(kind, member, value) || isDefaultOmitted(kind, member, value);\n}\n\nfunction write(value: unknown, owningMode = 'legacy', complete = false): SyntaxJsonValue {\n if (Array.isArray(value)) return writeArray(value, owningMode, complete);\n if (isNode(value)) return writeNode(value, owningMode, complete);\n if (value === undefined) return null;\n if (!isObject(value)) return value as SyntaxJsonValue;\n return writeRecord(value as Record<string, unknown>, owningMode, complete);\n}\n\nfunction writeArray(value: unknown[], owningMode: string, complete: boolean): SyntaxJsonValue {\n // A fresh plain array: never map (Symbol.species) or serialize through a caller-supplied hook.\n const items = dataArray<SyntaxJsonValue>();\n for (let index = 0; index < value.length; index++) items.push(write(value[index], owningMode, complete));\n return items;\n}\n\nfunction validateClosedImplementationShapes(value: SyntaxNode): void {\n // #307 shapes are closed in both modes, before any projection can hide unknown members.\n if (value.kind === 'ImplementationSyntax' || value.kind === 'ImplementationHintSyntax') validateClosedSyntaxMembers(value, omitted);\n if (value.kind !== 'ValidationRuleSyntax') return;\n const rule = value as ValidationRuleSyntax;\n if (rule.implementation == null) return;\n if (rule.file != null) validateClosedSyntaxMembers(rule.file, omitted);\n if (rule.code != null) validateClosedSyntaxMembers(rule.code, omitted);\n}\n\nfunction structuralMembers(value: SyntaxNode): Record<string, unknown> {\n const structural = { ...value } as unknown as Record<string, unknown>;\n if (value.kind === 'ApplicationSyntax' && structural.eventSources === undefined) structural.eventSources = [];\n if (value.kind === 'CommandSyntax' && structural.stream === undefined) structural.stream = null;\n if (value.kind === 'CommandSyntax' && structural.streamCandidates === undefined) structural.streamCandidates = [];\n return structural;\n}\n\nfunction projectedMemberNames(value: SyntaxNode, structural: Record<string, unknown>, owningMode: string, complete: boolean): string[] {\n const known = owningMode === 'exact' ? syntaxMemberNames(value.kind) : undefined;\n const isProjected = (member: string) =>\n (known === undefined || known.has(member)) && !isHiddenByLegacy(value, member, owningMode, complete) && !isAlwaysOmitted(value, member);\n return Object.keys(structural).filter(isProjected).sort(ordinal);\n}\n\nfunction isHiddenByLegacy(value: SyntaxNode, member: string, owningMode: string, complete: boolean): boolean {\n return owningMode === 'legacy' && !complete && isLegacyOmittedMember(value, member);\n}\n\nfunction isAlwaysOmitted(value: SyntaxNode, member: string): boolean {\n return omitted.has(member) || (value.kind === 'OperationSyntax' && member === 'usesLocation');\n}\n\nfunction writeNode(value: SyntaxNode, owningMode: string, complete: boolean): SyntaxJsonValue {\n if (sourceRoots.has(value.kind)) owningMode = validatedSourceOptions((value as unknown as { sourceOptions?: unknown }).sourceOptions ?? legacySourceOptions).numericMode;\n validateSyntaxInvariants(value);\n validateClosedImplementationShapes(value);\n const result = Object.create(null) as Record<string, SyntaxJsonValue>;\n result.kind = value.kind;\n const structural = structuralMembers(value);\n for (const member of projectedMemberNames(value, structural, owningMode, complete)) {\n const memberValue = structural[member];\n if (isOmittedByDefault(value.kind, member, memberValue)) continue;\n result[member] = write(memberValue, owningMode, complete);\n }\n return result;\n}\n\nfunction writeRecord(record: Record<string, unknown>, owningMode: string, complete: boolean): SyntaxJsonValue {\n // The ordered ExactNumber form, whatever the input key order; other objects are copied without any toJSON hook.\n const copy = Object.create(null) as Record<string, SyntaxJsonValue>;\n if (record.literalType === 'ExactNumber') {\n copy.literalType = 'ExactNumber';\n copy.value = record.value as string;\n return copy;\n }\n for (const name of Object.keys(record)) if (name !== 'toJSON' && record[name] !== undefined) copy[name] = write(record[name], owningMode, complete);\n return copy;\n}\n\nfunction validateNumbers(value: unknown, owningMode: string, depth: number): void {\n assertSupportedDepth(owningMode, depth);\n if (Array.isArray(value)) {\n for (let index = 0; index < value.length; index++) validateNumbers(value[index], owningMode, depth + 1);\n return;\n }\n if (!isObject(value)) return;\n validateNodeNumbers(value as Record<string, unknown>, owningMode, depth);\n}\n\nfunction validateNodeNumbers(node: Record<string, unknown>, owningMode: string, depth: number): void {\n owningMode = resolveNumericMode(node, owningMode, depth);\n assertCompleteSourceRoot(node, owningMode, depth);\n if (owningMode === 'exact' && isNode(node)) validateSyntaxMembers(node);\n validateRawNumericText(node, owningMode);\n if (node.kind === 'LiteralExpressionSyntax' && Object.hasOwn(node, 'value')) validateLiteralValue(node.value, owningMode);\n validateNumberMembers(node, owningMode, depth);\n}\n\nfunction assertSupportedDepth(owningMode: string, depth: number): void {\n if (depth > 96 && owningMode === 'exact') throw new InvalidSyntaxJson('Syntax nesting exceeds the supported depth of 96.');\n}\n\nfunction assertCompleteSourceRoot(node: Record<string, unknown>, owningMode: string, depth: number): void {\n if (isIncompleteExactRoot(node, owningMode, depth)) throw new InvalidSyntaxJson('Exact syntax requires a complete source root.');\n}\n\nfunction isIncompleteExactRoot(node: Record<string, unknown>, owningMode: string, depth: number): boolean {\n return depth === 0 && owningMode === 'exact' && !sourceRoots.has(node.kind as string);\n}\n\nfunction resolveNumericMode(node: Record<string, unknown>, owningMode: string, depth: number): string {\n if (!sourceRoots.has(node.kind as string) && !Object.hasOwn(node, 'sourceOptions')) return owningMode;\n // Omission is Legacy on every complete source root, never inheritance from its container.\n const options = Object.hasOwn(node, 'sourceOptions') ? validatedSourceOptions(node.sourceOptions) : legacySourceOptions;\n if (depth > 0 && owningMode !== options.numericMode) throw new InvalidSyntaxJson('Conflicting source numeric options.');\n return options.numericMode;\n}\n\nfunction validateRawNumericText(node: Record<string, unknown>, owningMode: string): void {\n if (node.kind !== 'RawExpressionSyntax' || owningMode !== 'exact') return;\n if (typeof node.text === 'string' && isExactNumberToken(node.text)) throw new InvalidSyntaxJson('An exact numeric operand must be an explicit ExactNumber, not opaque numeric text.');\n}\n\nfunction isUnsupportedExactPrimitive(value: unknown): boolean {\n return typeof value === 'number' || (value !== null && !['string', 'boolean', 'object'].includes(typeof value));\n}\n\nfunction validateLiteralValue(value: unknown, owningMode: string): void {\n if (owningMode === 'exact' && isUnsupportedExactPrimitive(value)) throw new InvalidSyntaxJson('Exact source requires supported primitive values or an explicit ExactNumber literal.');\n if (!isObject(value)) return;\n validateObjectLiteral(value as { literalType?: unknown; value?: unknown }, owningMode);\n}\n\nfunction validateObjectLiteral(literal: { literalType?: unknown; value?: unknown }, owningMode: string): void {\n if (literal.literalType === 'ExactNumber') validateExactNumberLiteral(literal, owningMode);\n else if (owningMode === 'exact') throw new InvalidSyntaxJson('Exact source refuses old or plain object literal insertion.');\n}\n\nfunction isWellFormedExactNumber(literal: { value?: unknown }): boolean {\n return typeof literal.value === 'string' && parseExactNumber(literal.value)?.value === literal.value && Object.keys(literal).length === 2;\n}\n\nfunction validateExactNumberLiteral(literal: { value?: unknown }, owningMode: string): void {\n if (owningMode !== 'exact' || !isWellFormedExactNumber(literal)) throw new InvalidSyntaxJson('Malformed or incompatible ExactNumber literal.');\n}\n\nfunction validateNumberMembers(node: Record<string, unknown>, owningMode: string, depth: number): void {\n const known = owningMode === 'exact' && isNode(node) ? syntaxMemberNames(node.kind) : undefined;\n for (const [name, member] of Object.entries(node)) if (isTraversedMember(known, name, member)) validateNumbers(member, owningMode, depth + 1);\n}\n\nfunction isTraversedMember(known: ReadonlySet<string> | undefined, name: string, member: unknown): boolean {\n return (known === undefined || known.has(name) || (isNode(member) && sourceRoots.has(member.kind))) && !skippedNumberMembers.has(name);\n}\n\nfunction ordinal(left: string, right: string): number {\n return left < right ? -1 : left > right ? 1 : 0;\n}\n"],"mappings":"+gBAeA,MAAM,OAAU,GACZ,OAAOA,GAAU,YAAYA,GAAkB,OAAQA,EAA6B,MAAS,SAC3F,SAAY,GAAoC,OAAOA,GAAU,YAAYA,EAC7EC,kBAAU,IAAI,IAAI,CAAC,OAAQ,WAAY,iBAAkB,oBAAqB,kBAAmB,iBAAkB,mBAAoB,oBAAoB,CAAC,EAC5JC,kBAAuB,IAAI,IAAI,CAAC,WAAY,iBAAkB,cAAc,CAAC,EAC7EC,kBAAc,IAAI,IA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kBqB,EAAOb,EAAMC,CAAM,GAAG,gBAAgBA,EAAQO,EAAYc,EAAQ,CAAC,CAChJ,CAEA,SAAS,kBAAkB,EAAwC,EAAc,EAA0B,CACvG,OAAQT,IAAU,IAAA,IAAaA,EAAM,IAAIb,CAAI,GAAM,OAAOC,CAAM,GAAKX,EAAY,IAAIW,EAAO,IAAI,IAAO,CAACZ,EAAqB,IAAIW,CAAI,CACzI,CAEA,SAAS,QAAQ,EAAc,EAAuB,CAClD,OAAO6B,EAAOC,EAAQ,GAAK,IAAOA,EACtC"}
@@ -1,10 +1,10 @@
1
- import"./_virtual/_virtual/_rolldown/runtime.js";import{identityProperties as e}from"./language.js";import{documentationItem as t}from"./documentation-item.js";import{purposeReferenceItem as n}from"./purpose-items.js";import{eventContextPaths as r}from"./event-context-catalog.js";import"./event-context.js";import{exampleDeclarationItems as i}from"./example-declaration-items.js";import"./scope-items.js";const a=[{label:`optional`,insertText:`optional`,documentation:`Allows the complete value, including a collection, to be absent.`}],fenced=e=>`\`\`\`${e}\n\${1}\n\`\`\``,o=[{label:`description`,insertText:'description "${1:caller details}"',documentation:`Describes the caller metadata.`},{label:`detail from claim`,insertText:'${1:detail} ${2:Type} from claim "${3:claim}"',documentation:`One typed detail sourced from a token claim.`},{label:`detail from query`,insertText:"${1:detail} ${2:Type} from query ${3:Query} by \\$identity.id",documentation:`A keyed, single-result query authorized without additional caller details.`},{label:`detail from code`,insertText:"${1:detail} ${2:Type}\n ```csharp\n ${3:return value;}\n ```",documentation:`An opaque inline source; authoring metadata, not executable.`},{label:`detail from file`,insertText:"${1:detail} ${2:Type}\n file ${3:Path}",documentation:`One file source; no refresh or cache directives.`}];function contextVariableEntries(t){let n=[...new Map((t.identityDetails??[]).map(e=>[e.name,e])).values()];return[...U,...n.filter(t=>!e.includes(t.name)).map(e=>({label:`$identity.${e.name}`,insertText:`\\$identity.${e.name}`,detail:e.type,documentation:`Declared caller detail. Authoring metadata only; executable reads report PLAY0268 until admitted (#600).`}))]}const s=[{label:`command reads protected`,insertText:`command reads protected`,documentation:`Opts the application into protected command reads (ESM v25). Required absence rejects with Validation; matching intervening facts conflict. Each view and input key must pass admission; targets require separate version support.`},{label:`reaction batches atomic`,insertText:`reaction batches atomic`,documentation:`Opts the composed application into atomic direct and refusal-branch reaction batches (ESM v22). Omit only to retain legacy per-fact behavior.`},{label:`identity`,insertText:'identity\n ${1:detail} ${2:Type} from claim "${3:claim}"',documentation:`Typed additional caller details; authoring metadata only, at most one block per application.`},{label:`purpose`,insertText:'purpose ${1:Name}\n description "${2:processing intent}"\n basis ${3|consent,contract,legalObligation,vitalInterests,publicTask,legitimateInterests|}',documentation:`Report-only processing metadata. Not legal advice; referenced by module, feature and slice.`},...i,{label:`eventsource`,insertText:"eventsource ${1:Name}\n identifier ${2:Type}\n stream ${3:Name}",documentation:`Application-owned source with nested streams, admitted by ESM v8. Pin the stored name before renaming a source with stored events; Default is reserved.`},{label:`system`,insertText:'system ${1:Name}\n description "${2:external system}"',documentation:`Application-scoped external system; not admitted by any supported executable model (ESM) version yet.`},{label:`import`,insertText:"import ${1:Module}.${2:Type}",documentation:`Imports a type from another module by its qualified name.`},{label:`import from`,insertText:'import ${1:Module}.${2:Event} from "${3:origin}"',documentation:`Imports a public event contract with a nonblank opaque origin, not a file path. An import has no local shape, so executable binding still refuses it with PLAY0268.`},{label:`import "…"`,insertText:'import "${1:**/*.play}"',documentation:"Imports other `.play` files by path or glob, relative to this file's folder, as whole documents of the application."},{label:`concept`,insertText:"concept ${1:Name} : ${2|Uuid,String,Int,Decimal,Bool,Date,DateTime|}",documentation:`Declares a formalized value type wrapping a primitive.`},{label:`concept (enum)`,insertText:"concept ${1:Name} : Enum\n ${2:value}",documentation:`Declares a positional enumeration. Reordering or inserting members changes their stored numbers.`},{label:`concept (pii with reason)`,insertText:'concept ${1:Name} : ${2|String,Uuid,Int,Decimal,Bool,Date,DateTime|} pii\n pii reason "${3:why this value is personal data}"',documentation:`Declares a personal-data concept together with the reason it is personal data.`},{label:`type`,insertText:"type ${1:Name}\n ${2:property} ${3:Type}",documentation:`Declares a composite value type — a named shape built from several properties.`},{label:`policy`,insertText:"policy ${1:Name}\n require ${2:authenticated}",documentation:`Declares a named authorization rule for commands and queries.`},{label:`module`,insertText:`module \${1:Name}
1
+ import"./_virtual/_virtual/_rolldown/runtime.js";import{identityProperties as e}from"./language.js";import{documentationItem as t}from"./documentation-item.js";import{purposeReferenceItem as n}from"./purpose-items.js";import{eventContextPaths as r}from"./event-context-catalog.js";import"./event-context.js";import{exampleDeclarationItems as i}from"./example-declaration-items.js";import"./scope-items.js";const a=[{label:`optional`,insertText:`optional`,documentation:`Allows the complete value, including a collection, to be absent.`}],fenced=e=>`\`\`\`${e}\n\${1}\n\`\`\``,o=[{label:`description`,insertText:'description "${1:caller details}"',documentation:`Describes the caller metadata.`},{label:`detail from claim`,insertText:'${1:detail} ${2:Type} from claim "${3:claim}"',documentation:`One typed detail sourced from a token claim.`},{label:`detail from query`,insertText:"${1:detail} ${2:Type} from query ${3:Query} by \\$identity.id",documentation:`A keyed, single-result query authorized without additional caller details.`},{label:`detail from code`,insertText:"${1:detail} ${2:Type}\n ```csharp\n ${3:return value;}\n ```",documentation:`An opaque inline source; authoring metadata, not executable.`},{label:`detail from file`,insertText:"${1:detail} ${2:Type}\n file ${3:Path}",documentation:`One file source; no refresh or cache directives.`}];function contextVariableEntries(t){let n=[...new Map((t.identityDetails??[]).map(e=>[e.name,e])).values()];return[...U,...n.filter(t=>!e.includes(t.name)).map(e=>({label:`$identity.${e.name}`,insertText:`\\$identity.${e.name}`,detail:e.type,documentation:`Declared caller detail. Authoring metadata only; executable reads report PLAY0268 until admitted (#600).`}))]}const s=[{label:`time zone`,insertText:'time zone "${1:Europe/Oslo}"',documentation:`Application calendar (decisions 0106/0107). Syntax-only; binding reports PLAY0268. Never falls back to the machine zone.`},{label:`time zone configurable default`,insertText:'time zone configurable default "${1:Europe/Oslo}"',documentation:`Configurable application calendar default. Syntax-only; binding reports PLAY0268.`},{label:`command reads protected`,insertText:`command reads protected`,documentation:`Opts the application into protected command reads (ESM v25). Required absence rejects with Validation; matching intervening facts conflict. Each view and input key must pass admission; targets require separate version support.`},{label:`reaction batches atomic`,insertText:`reaction batches atomic`,documentation:`Opts the composed application into atomic direct and refusal-branch reaction batches (ESM v22). Omit only to retain legacy per-fact behavior.`},{label:`identity`,insertText:'identity\n ${1:detail} ${2:Type} from claim "${3:claim}"',documentation:`Typed additional caller details; authoring metadata only, at most one block per application.`},{label:`purpose`,insertText:'purpose ${1:Name}\n description "${2:processing intent}"\n basis ${3|consent,contract,legalObligation,vitalInterests,publicTask,legitimateInterests|}',documentation:`Report-only processing metadata. Not legal advice; referenced by module, feature and slice.`},...i,{label:`eventsource`,insertText:"eventsource ${1:Name}\n identifier ${2:Type}\n stream ${3:Name}",documentation:`Application-owned source with nested streams, admitted by ESM v8. Pin the stored name before renaming a source with stored events; Default is reserved.`},{label:`system`,insertText:'system ${1:Name}\n description "${2:external system}"',documentation:`Application-scoped external system; not admitted by any supported executable model (ESM) version yet.`},{label:`import`,insertText:"import ${1:Module}.${2:Type}",documentation:`Imports a type from another module by its qualified name.`},{label:`import from`,insertText:'import ${1:Module}.${2:Event} from "${3:origin}"',documentation:`Imports a public event contract with a nonblank opaque origin, not a file path. An import has no local shape, so executable binding still refuses it with PLAY0268.`},{label:`import "…"`,insertText:'import "${1:**/*.play}"',documentation:"Imports other `.play` files by path or glob, relative to this file's folder, as whole documents of the application."},{label:`concept`,insertText:"concept ${1:Name} : ${2|Uuid,String,Int,Decimal,Bool,Date,DateTime|}",documentation:`Declares a formalized value type wrapping a primitive.`},{label:`concept (enum)`,insertText:"concept ${1:Name} : Enum\n ${2:value}",documentation:`Declares a positional enumeration. Reordering or inserting members changes their stored numbers.`},{label:`concept (pii with reason)`,insertText:'concept ${1:Name} : ${2|String,Uuid,Int,Decimal,Bool,Date,DateTime|} pii\n pii reason "${3:why this value is personal data}"',documentation:`Declares a personal-data concept together with the reason it is personal data.`},{label:`type`,insertText:"type ${1:Name}\n ${2:property} ${3:Type}",documentation:`Declares a composite value type — a named shape built from several properties.`},{label:`policy`,insertText:"policy ${1:Name}\n require ${2:authenticated}",documentation:`Declares a named authorization rule for commands and queries.`},{label:`module`,insertText:`module \${1:Name}
2
2
  `,documentation:`Declares the top-level namespace — maps to a bounded context.`},{label:`domain`,insertText:"domain ${1:Name}",documentation:`The domain the file belongs to — optional, at most one per file, before everything else.`},{label:`sticky`,insertText:'sticky note on ${4|personas,eventsources,givencontexts,seeddata|}\n description "${1:what the note says}"\n position ${2:0} ${3:0}',documentation:`A sticky note on a domain canvas: personas, eventsources, givencontexts or seeddata.`},{label:`persona`,insertText:'persona ${1:Name}\n description "${2:who they are}"',documentation:`A named role interacting with the application, with the policies it holds.`},{label:`authentication`,insertText:"authentication\n provider ${1:Name}\n ${2:setting} ${3:value}",documentation:`Declares the identity providers of the application — at most one block per file.`},{label:`seed`,insertText:`seed
3
3
  for \${1:EventSourceId}
4
4
  \${2:EventType}`,documentation:`Declares events to seed into the event store per event source id.`},{label:`layout`,insertText:"layout ${1:Name}\n ${2:slot}",documentation:`Declares the application shell with named slots.`},{label:`theme`,insertText:"theme ${1:Name}\n compatible with ${2:Package}",documentation:`Declares a theme and the component packages it is compatible with.`},{label:`sample data`,insertText:'sample data ${1:Name}\n title "${2:Title}"\n locale ${3:en-GB}\n shape ${4:ReadModel}\n row\n ${5:field} = ${6:"value"}',documentation:`Declares a pack of demo rows a design surface or preview shows instead of a backend. Design and preview time only.`},{label:`ui profile`,insertText:"ui profile ${1:Name}\n target platform ${2:web}\n layout ${3:Layout}\n theme ${4:Theme}",documentation:`Binds a target platform and size to a layout, theme and component packages.`},{label:`behavior`,insertText:"behavior ${1:Name}\n on ${2:click}\n ${3:execute command}",documentation:"A named interaction wiring, attached to a screen, form or dialog with `uses`."},{label:`trigger`,insertText:"trigger ${1:Name}\n ${2:property} ${3:Type}",documentation:`Declares an integration signal a reaction can run on.`}],c=[{label:`uses`,insertText:"uses ${1:System}",documentation:`Exactly one application-scoped external system.`},{label:`description`,insertText:'description "${1:intent}"',documentation:`Describes operation intent, without requiring code.`},{label:`input`,insertText:"${1:input} ${2:Type}",documentation:`Typed operation input; no identifier or generated modifier.`},{label:`execute`,insertText:`execute
5
5
  description "\${1:effect}"`,documentation:`Optional execution intent; not admitted by any supported executable model (ESM) version yet.`},{label:`compensate`,insertText:`compensate
6
6
  description "\${1:undo intent}"`,documentation:`Optional compensation intent; not admitted by any supported executable model (ESM) version yet.`}],l=[{label:`hint`,insertText:'hint "${1:implementation guidance}"',documentation:`Ordered authoring guidance; not an executable implementation role.`},{label:`file`,insertText:"file ${1:Path}",documentation:`Selects the phase’s sole source attachment.`},...[`csharp`,`typescript`,`react`,`html`,`sql`].map(e=>({label:e,insertText:fenced(e),documentation:`Selects the phase’s sole inline source; not admitted by any supported executable model (ESM) version yet.`}))],u=[{label:`description`,insertText:'description "${1:phase intent}"',documentation:`A description-only phase is valid, pending intent.`},{label:`implementation`,insertText:`implementation
7
- hint "\${1:guidance}"`,documentation:`Hints with optional source; phase owns File/Code, wrapper owns hints only.`},...l.filter(e=>e.label!==`hint`)],d=[{label:`generate uuid`,insertText:`generate uuid`,documentation:`Random UUID v4; 122 random bits. Implicit on Uuid concepts; String UUIDs are lowercase by default.`},{label:`generate uuidv7`,insertText:`generate uuidv7`,documentation:`Time-ordered UUID v7; 74 random bits. Exposes time, not monotonic within a millisecond.`},{label:`generate ulid`,insertText:`generate ulid`,documentation:`26 uppercase Crockford base32 characters; 80 random bits. String concepts only.`},{label:`generate typeid`,insertText:'generate typeid "${1:user}"',documentation:`TypeID 0.3, lowercase UUIDv7 base32; 74 random bits. Empty prefix has no separator.`},{label:`generate nanoid`,insertText:"generate nanoid ${1:21}",documentation:`String from a distinct printable ASCII alphabet; size × log2(alphabet size) random bits. Default: 21 × 6 = 126 bits.`},{label:`generate bytes`,insertText:"generate bytes ${1:32} ${2|base64url,hex,base32|}",documentation:`Cryptographic random bytes, RFC 4648 without padding; 8 × count bits. Case applies only to hex/base32.`},{label:`generate pattern`,insertText:'generate pattern "${1:INV-{yyyy}{MM}-#{7}}"',documentation:`ESM v21 finite ASCII pattern with bounded repeats and UTC date segments. Distinct-support entropy excludes dates and check digits; generated fixtures use given clock when present.`},{label:`generate random`,insertText:"generate random ${1:1}..${2:9}",documentation:`ESM v21 inclusive signed Int64 range; exact integral fixtures, not strings. A generated value, never an Int identifier.`},{label:`generate rule`,insertText:"generate rule ${1:Name}\n file ${2:Generator.cs}",documentation:`ESM v21 ValueGeneration attachment: exactly one direct file or tagged fence. Closed context Now and Tenant; entropy is unknown. The reference runner requires a fixture and never executes the body.`},{label:`validate checksum`,insertText:"validate checksum ${1|luhn,mod11,mod97|}",documentation:`String concepts only: validates the exact trailing check digits over preceding ASCII digits, including supplied and stored values. Generation alone does not add this rule.`},{label:`description`,insertText:'description "${1:what this value represents}"',documentation:`Report-only authoring description; not a validation or compliance note.`},{label:`file`,insertText:"file ${1:Path}",documentation:`Names the repository relative file this declaration is realized by, so the document can be navigated back to the code.`},{label:`pii reason`,insertText:'pii reason "${1:why this value is personal data}"',documentation:`A free-text concept note, not a lawful basis.`},{label:`secret reason`,insertText:'secret reason "${1:why this value is an operational secret}"',documentation:`Records why the secret marker applies.`},{label:`secret scope`,insertText:"secret scope ${1|subject,namespace,global|}",documentation:`Explicit encryption scope; omitted scope keeps Chronicle’s Subject default.`},{label:`pii special`,insertText:"pii special ${1|racialOrEthnicOrigin,politicalOpinions,religiousOrPhilosophicalBeliefs,tradeUnionMembership,genetic,biometric,health,sexLifeOrSexualOrientation|}",documentation:`GDPR Art. 9(1) special category of personal data.`},{label:`pii criminal`,insertText:`pii criminal`,documentation:`Personal data relating to criminal convictions and offenses (GDPR Art. 10).`},{label:`validate`,insertText:'validate\n ${1:not empty} message "${2:message}"',documentation:`Validation rules that travel with the value everywhere it appears.`}],f=[{label:`file`,insertText:"file ${1:Path}",documentation:`Names the repository relative file this declaration is realized by, so the document can be navigated back to the code.`},{label:`description`,insertText:'description "${1:what this shape represents}"',documentation:`A human-readable description of the type.`},{label:`property`,insertText:"${1:property} ${2:Type}",documentation:`A property of the type — a name and a type reference.`}],p=[n,t,...i,{label:`operation`,insertText:"operation ${1:Name}\n uses ${2:System}\n ${3:input} ${4:Type}",documentation:`Reusable slice-owned operation intent; not admitted by any supported executable model (ESM) version yet.`},{label:`file`,insertText:"file ${1:Path}",documentation:`Names the repository relative file this declaration is realized by, so the document can be navigated back to the code.`},{label:`public event`,insertText:"public event ${1:Name}\n ${2:property} ${3:Type}",documentation:`Declares a public event: a contract this application publishes. Admitted by ESM v9; an outbound Translate slice produces it through a projection that targets it.`},{label:`event from`,insertText:'event ${1:Name} from "${2:origin}"\n ${3:property} ${4:Type}',documentation:`An event with an opaque origin naming the application that owns it, not a path or declaration reference. It is a public event admitted by ESM v9; consume it with a capture over source events.`},{label:`direction`,insertText:"direction ${1|inbound,outbound|}",documentation:`Translate direction, inbound or outbound, admitted by ESM v9. No transport or delivery guarantee is implied.`},{label:`event`,insertText:"event ${1:Name}\n ${2:property} ${3:Type}",documentation:`Declares an event type — an immutable, past-tense fact.`},{label:`event generation`,insertText:"event ${1:Name} generation ${2:2}\n ${3:property} ${4:Type}",documentation:`Declares a complete numbered event generation; start at 1 and do not skip a number.`},{label:`command`,insertText:"command ${1:Name}\n ${2:property} ${3:Type}",documentation:`Declares a command — an imperative intent that produces events.`},{label:`query`,insertText:"query ${1:Name} => ${2:ReadModel}",documentation:`Declares a read-side entry point mapping to a return type.`},{label:`query observable`,insertText:"query ${1:Name} => observable ${2:ReadModel}",documentation:`Declares a live read — the query keeps pushing as the read model changes, instead of answering once.`},{label:`readmodel`,insertText:"readmodel ${1:Name}\n ${2:property} ${3:Type}",documentation:`Declares the shape of a read model — its properties — that a projection, reducer or query fills and returns.`},{label:`reducer`,insertText:"reducer ${1:Name} => ${2:ReadModel}\n on ${3:EventType}\n ```csharp\n ${4}\n ```",documentation:`Declares a reducer building a read model from events with imperative code, for what a projection cannot express.`},{label:`specification`,insertText:"specification ${1:Name}\n given ${2:EventType}\n when ${3:Command}\n then ${4:EventType}",documentation:`Given/when/then acceptance criteria for the slice.`},{label:`projection`,insertText:"projection ${1:Name} => ${2:ReadModel}\n from ${3:EventType}",documentation:`Declares how events project into a read model (PDL).`},{label:`capture`,insertText:"capture ${1:Name}\n source ${2:api}",documentation:`Declares a change data capture converting external data into events (CDL).`},{label:`reaction`,insertText:"reaction ${1:Name}\n when ${2:Trigger}",documentation:`Declares behavior that runs when something happens.`},{label:`screen`,insertText:"screen ${1:Name}\n data ${2:ReadModel} via query ${3:QueryName}",documentation:`Declares a UI screen.`},{label:`constraint`,insertText:"constraint ${1:Name}\n unique ${2:property} on ${3:EventType}",documentation:`Declares a server-side rule enforced before events are committed.`}],m=[t,{label:`property`,insertText:"${1:property} ${2:Type}",documentation:`An input of the command — a name and a type reference.`},{label:`produces operation`,insertText:"produces operation ${1:Name}\n uses ${2:System}\n ${3:input} ${4:Type} = ${5:source}",documentation:`Declares ordered operation intent; not admitted by any supported executable model (ESM) version yet (PLAY0268).`},{label:`returns property`,insertText:"returns @${1:property}",documentation:`Scalar response from a direct command property, only on acceptance. Executable as ESM v7.`},{label:`returns block`,insertText:"returns\n ${1:field} = ${2:property}",documentation:`Unnamed record response with inferred or explicit field types, only on acceptance. Executable as ESM v7.`},{label:`produces event`,insertText:"produces event ${1:Name}\n ${2:property} ${3:Type} = ${4:source}",documentation:`Declares a slice-owned generation-1 event and maps its properties. An omitted for uses the command identifier.`},{label:`identifier property`,insertText:"${1:property} ${2:Type} identifier",documentation:`Marks the property a runtime resolves the event source id from. At most one per command.`},{label:`authorize`,insertText:"authorize ${1:PolicyName}",documentation:`References the policies that must pass for the command to execute.`},{label:`reads`,insertText:"reads ${1:View} by ${2:property}",documentation:`Declares a view the command consults. Executable binding is not yet supported.`},{label:`reads as`,insertText:"reads ${1:View} as ${2:alias} by ${3:property}",documentation:`Names one instance of a view; every instance needs a unique alias when reading the same view more than once.`},{label:`validate`,insertText:'validate\n ${1:property} not empty message "${2:message}"',documentation:`Declarative validation rules with messages.`},{label:`validate csharp`,insertText:`validate\n ${fenced(`csharp`)}`,documentation:`Imperative validation in C#, yielding the message of every rule the artifact breaks.`},{label:`produces`,insertText:"produces ${1:EventType}\n ${2:property} = ${3:source}",documentation:`Declares the event the command emits, with property mappings.`},{label:`produces when`,insertText:"produces when ${1:condition}\n ${2:EventType}\n ${3:property} = ${4:source}",documentation:`Conditionally emits an event when the condition holds.`},{label:`description`,insertText:'description "${1:what the command asks for}"',documentation:`A human-readable description.`},{label:`concurrency`,insertText:`concurrency
7
+ hint "\${1:guidance}"`,documentation:`Hints with optional source; phase owns File/Code, wrapper owns hints only.`},...l.filter(e=>e.label!==`hint`)],d=[{label:`generate uuid`,insertText:`generate uuid`,documentation:`Random UUID v4; 122 random bits. Implicit on Uuid concepts; String UUIDs are lowercase by default.`},{label:`generate uuidv7`,insertText:`generate uuidv7`,documentation:`Time-ordered UUID v7; 74 random bits. Exposes time, not monotonic within a millisecond.`},{label:`generate ulid`,insertText:`generate ulid`,documentation:`26 uppercase Crockford base32 characters; 80 random bits. String concepts only.`},{label:`generate typeid`,insertText:'generate typeid "${1:user}"',documentation:`TypeID 0.3, lowercase UUIDv7 base32; 74 random bits. Empty prefix has no separator.`},{label:`generate nanoid`,insertText:"generate nanoid ${1:21}",documentation:`String from a distinct printable ASCII alphabet; size × log2(alphabet size) random bits. Default: 21 × 6 = 126 bits.`},{label:`generate bytes`,insertText:"generate bytes ${1:32} ${2|base64url,hex,base32|}",documentation:`Cryptographic random bytes, RFC 4648 without padding; 8 × count bits. Case applies only to hex/base32.`},{label:`generate pattern`,insertText:'generate pattern "${1:INV-{yyyy}{MM}-#{7}}"',documentation:`ESM v21 finite ASCII pattern with bounded repeats and UTC date segments. Distinct-support entropy excludes dates and check digits; generated fixtures use given clock when present.`},{label:`generate random`,insertText:"generate random ${1:1}..${2:9}",documentation:`ESM v21 inclusive signed Int64 range; exact integral fixtures, not strings. A generated value, never an Int identifier.`},{label:`generate rule`,insertText:"generate rule ${1:Name}\n file ${2:Generator.cs}",documentation:`ESM v21 ValueGeneration attachment: exactly one direct file or tagged fence. Closed context Now and Tenant; entropy is unknown. The reference runner requires a fixture and never executes the body.`},{label:`validate checksum`,insertText:"validate checksum ${1|luhn,mod11,mod97|}",documentation:`String concepts only: validates the exact trailing check digits over preceding ASCII digits, including supplied and stored values. Generation alone does not add this rule.`},{label:`description`,insertText:'description "${1:what this value represents}"',documentation:`Report-only authoring description; not a validation or compliance note.`},{label:`file`,insertText:"file ${1:Path}",documentation:`Names the repository relative file this declaration is realized by, so the document can be navigated back to the code.`},{label:`pii reason`,insertText:'pii reason "${1:why this value is personal data}"',documentation:`A free-text concept note, not a lawful basis.`},{label:`secret reason`,insertText:'secret reason "${1:why this value is an operational secret}"',documentation:`Records why the secret marker applies.`},{label:`secret scope`,insertText:"secret scope ${1|subject,namespace,global|}",documentation:`Explicit encryption scope; omitted scope keeps Chronicle’s Subject default.`},{label:`pii special`,insertText:"pii special ${1|racialOrEthnicOrigin,politicalOpinions,religiousOrPhilosophicalBeliefs,tradeUnionMembership,genetic,biometric,health,sexLifeOrSexualOrientation|}",documentation:`GDPR Art. 9(1) special category of personal data.`},{label:`pii criminal`,insertText:`pii criminal`,documentation:`Personal data relating to criminal convictions and offenses (GDPR Art. 10).`},{label:`validate`,insertText:'validate\n ${1:not empty} message "${2:message}"',documentation:`Validation rules that travel with the value everywhere it appears.`}],f=[{label:`file`,insertText:"file ${1:Path}",documentation:`Names the repository relative file this declaration is realized by, so the document can be navigated back to the code.`},{label:`description`,insertText:'description "${1:what this shape represents}"',documentation:`A human-readable description of the type.`},{label:`property`,insertText:"${1:property} ${2:Type}",documentation:`A property of the type — a name and a type reference.`}],p=[n,t,...i,{label:`operation`,insertText:"operation ${1:Name}\n uses ${2:System}\n ${3:input} ${4:Type}",documentation:`Reusable slice-owned operation intent; not admitted by any supported executable model (ESM) version yet.`},{label:`file`,insertText:"file ${1:Path}",documentation:`Names the repository relative file this declaration is realized by, so the document can be navigated back to the code.`},{label:`public event`,insertText:"public event ${1:Name}\n ${2:property} ${3:Type}",documentation:`Declares a public event: a contract this application publishes. Admitted by ESM v9; an outbound Translate slice produces it through a projection that targets it.`},{label:`event from`,insertText:'event ${1:Name} from "${2:origin}"\n ${3:property} ${4:Type}',documentation:`An event with an opaque origin naming the application that owns it, not a path or declaration reference. It is a public event admitted by ESM v9; consume it with a capture over source events.`},{label:`direction`,insertText:"direction ${1|inbound,outbound|}",documentation:`Translate direction, inbound or outbound, admitted by ESM v9. No transport or delivery guarantee is implied.`},{label:`event`,insertText:"event ${1:Name}\n ${2:property} ${3:Type}",documentation:`Declares an event type — an immutable, past-tense fact.`},{label:`event generation`,insertText:"event ${1:Name} generation ${2:2}\n ${3:property} ${4:Type}",documentation:`Declares a complete numbered event generation; start at 1 and do not skip a number.`},{label:`command`,insertText:"command ${1:Name}\n ${2:property} ${3:Type}",documentation:`Declares a command — an imperative intent that produces events.`},{label:`query`,insertText:"query ${1:Name} => ${2:ReadModel}",documentation:`Declares a read-side entry point mapping to a return type.`},{label:`query observable`,insertText:"query ${1:Name} => observable ${2:ReadModel}",documentation:`Declares a live read — the query keeps pushing as the read model changes, instead of answering once.`},{label:`readmodel`,insertText:"readmodel ${1:Name}\n ${2:property} ${3:Type}",documentation:`Declares the shape of a read model — its properties — that a projection, reducer or query fills and returns.`},{label:`reducer`,insertText:"reducer ${1:Name} => ${2:ReadModel}\n on ${3:EventType}\n ```csharp\n ${4}\n ```",documentation:`Declares a reducer building a read model from events with imperative code, for what a projection cannot express.`},{label:`specification`,insertText:"specification ${1:Name}\n given ${2:EventType}\n when ${3:Command}\n then ${4:EventType}",documentation:`Given/when/then acceptance criteria for the slice.`},{label:`projection`,insertText:"projection ${1:Name} => ${2:ReadModel}\n from ${3:EventType}",documentation:`Declares how events project into a read model (PDL).`},{label:`capture`,insertText:"capture ${1:Name}\n source ${2:api}",documentation:`Declares a change data capture converting external data into events (CDL).`},{label:`reaction`,insertText:"reaction ${1:Name}\n when ${2:Trigger}",documentation:`Declares behavior that runs when something happens.`},{label:`screen`,insertText:"screen ${1:Name}\n data ${2:ReadModel} via query ${3:QueryName}",documentation:`Declares a UI screen.`},{label:`constraint`,insertText:"constraint ${1:Name}\n unique ${2:property} on ${3:EventType}",documentation:`Declares a server-side rule enforced before events are committed.`}],m=[{label:`calendar`,insertText:'calendar "${1:Europe/Oslo}"',documentation:`Command calendar. Syntax-only (decisions 0106/0107); binding reports PLAY0268. The contextual calendar from $context.<member> form is also syntax-only.`},t,{label:`property`,insertText:"${1:property} ${2:Type}",documentation:`An input of the command — a name and a type reference.`},{label:`produces operation`,insertText:"produces operation ${1:Name}\n uses ${2:System}\n ${3:input} ${4:Type} = ${5:source}",documentation:`Declares ordered operation intent; not admitted by any supported executable model (ESM) version yet (PLAY0268).`},{label:`returns property`,insertText:"returns @${1:property}",documentation:`Scalar response from a direct command property, only on acceptance. Executable as ESM v7.`},{label:`returns block`,insertText:"returns\n ${1:field} = ${2:property}",documentation:`Unnamed record response with inferred or explicit field types, only on acceptance. Executable as ESM v7.`},{label:`produces event`,insertText:"produces event ${1:Name}\n ${2:property} ${3:Type} = ${4:source}",documentation:`Declares a slice-owned generation-1 event and maps its properties. An omitted for uses the command identifier.`},{label:`identifier property`,insertText:"${1:property} ${2:Type} identifier",documentation:`Marks the property a runtime resolves the event source id from. At most one per command.`},{label:`authorize`,insertText:"authorize ${1:PolicyName}",documentation:`References the policies that must pass for the command to execute.`},{label:`reads`,insertText:"reads ${1:View} by ${2:property}",documentation:`Declares a view the command consults. Executable binding is not yet supported.`},{label:`reads as`,insertText:"reads ${1:View} as ${2:alias} by ${3:property}",documentation:`Names one instance of a view; every instance needs a unique alias when reading the same view more than once.`},{label:`validate`,insertText:'validate\n ${1:property} not empty message "${2:message}"',documentation:`Declarative validation rules with messages.`},{label:`validate csharp`,insertText:`validate\n ${fenced(`csharp`)}`,documentation:`Imperative validation in C#, yielding the message of every rule the artifact breaks.`},{label:`produces`,insertText:"produces ${1:EventType}\n ${2:property} = ${3:source}",documentation:`Declares the event the command emits, with property mappings.`},{label:`produces when`,insertText:"produces when ${1:condition}\n ${2:EventType}\n ${3:property} = ${4:source}",documentation:`Conditionally emits an event when the condition holds.`},{label:`description`,insertText:'description "${1:what the command asks for}"',documentation:`A human-readable description.`},{label:`concurrency`,insertText:`concurrency
8
8
  \${1|eventSource,sourceType,streamType,streamId,events|}`,documentation:`The scope of the concurrency check made when the command appends events.`},{label:`handler`,insertText:`handler
9
9
  `,documentation:`Fully imperative command implementation — file reference or inline C#, instead of produces.`}],h=[{label:`property`,insertText:"${1:property} ${2:Type}",documentation:`A property of the event — a name and a type reference.`},{label:`description`,insertText:'description "${1:what happened}"',documentation:`Authoring metadata, as one line or a text/markdown fence.`},{label:`documentation`,insertText:"documentation\n ```markdown\n ${1:Details}\n ```",documentation:`Authoring-only Markdown documentation.`},{label:`id`,insertText:'id "${1:OldName}"',documentation:`Preserves a previous persisted event name after a rename. Leave absent for new events.`},{label:`tag`,insertText:"tag ${1:audit}",documentation:`An event-type tag stamped on every occurrence.`}],g=[...h,{label:`for`,insertText:"for ${1:identifier}",documentation:`Explicitly names the command identifier used as the event source.`},{label:`property mapping`,insertText:"${1:property} ${2:Type} = ${3:source}",documentation:`Declares and maps an event property on one line.`}],_=[{label:`when`,insertText:"when ${1:condition}",documentation:`Guards the produced event with a condition.`}],v=[{label:`hint`,insertText:'hint "${1:implementation guidance}"',documentation:`Ordered nonblank guidance for a handler implementation. Not an execution guarantee.`},{label:`file`,insertText:"file ${1:Path}",documentation:`Selects one existing model-relative attachment.`},...[`csharp`,`typescript`,`react`,`html`,`sql`].map(e=>({label:e,insertText:fenced(e),documentation:`Selects one inline payload. Handler execution remains unsupported.`}))],y=[{label:`implementation`,insertText:`implementation
10
10
  hint "\${1:implementation guidance}"`,documentation:`Handler-only implementation intent with optional file or tagged fence. With no payload it is pending.`},{label:`file`,insertText:"file ${1:Path}",documentation:`Delegates the command implementation to an external C# file.`},{label:`csharp`,insertText:fenced(`csharp`),documentation:`Inline C# returning the events to append.`}],b=[{label:`description`,insertText:'description "${1:what this query is trying to accomplish}"',documentation:`What the query is for, in prose — what a generator or reviewer works from.`},{label:`by`,insertText:"by ${1:param} ${2:Type}",documentation:`Declares the identifying parameter of the query.`},{label:`by parts`,insertText:"by\n ${1:part} ${2:Type}\n ${3:part} ${4:Type}",documentation:`Declares a composite lookup. Supply every key part for a single instance.`},{label:`filter`,insertText:"filter ${1:param} ${2:Type} optional",documentation:`Declares an optional filter parameter supplied by the caller.`},{label:`filter from context`,insertText:"filter ${1:param} ${2:Type} from $context.${3|tenant,causedBy.subject,occurred|}",documentation:`Declares a parameter filled from the query context instead of the caller.`},{label:`authorize`,insertText:"authorize ${1:PolicyName}",documentation:`References the policies that must pass for the query to execute.`},{label:`performer`,insertText:`performer
@@ -12,7 +12,7 @@ import"./_virtual/_virtual/_rolldown/runtime.js";import{identityProperties as e}
12
12
  acknowledge`,documentation:`Handles validation and constraint refusals, not authorization. ${T}`},{label:`on refused by validation`,insertText:`on refused by validation
13
13
  acknowledge`,documentation:`Handles error-severity property, concept and require refusals. ${T}`},{label:`on refused by constraint`,insertText:`on refused by constraint \${1:Name}
14
14
  acknowledge`,documentation:`Handles a named constraint refusal; omit the name for any constraint. ${T}`},{label:`on refused by authorization`,insertText:`on refused by authorization
15
- acknowledge`,documentation:`Explicitly handles unauthorized results, never Unsupported. ${T}`}],D=[{label:`acknowledge`,insertText:`acknowledge`,documentation:`Acknowledges alone, without productions. ${T}`},{label:`produces`,insertText:"produces ${1:Event}\n ${2:reason} = \\$refusal.reason",documentation:`Records the refusal with ordinary event productions. ${T}`}],O=[{label:`file`,insertText:"file ${1:Path}",documentation:`Names the repository relative file this declaration is realized by, so the document can be navigated back to the code.`},{label:`description`,insertText:'description "${1:when this occurs}"',documentation:`What makes an occurrence of this trigger happen.`},{label:`value`,insertText:"${1:name} ${2:Type}",documentation:`A value an occurrence hands the reaction. The type is optional.`}],k=[{label:`parameter`,insertText:"parameter ${1:name} ${2:Type}",documentation:`One typed value, supplied exactly once by every case.`},{label:`case`,insertText:"case ${1:Name}\n ${2:parameter} = ${3:value}",documentation:`One named complete set of concrete parameter values.`},{label:`given caller as`,insertText:"given caller as ${1:Persona}",documentation:`An authenticated deterministic witness of a top-level persona; no body. Use explicit callers for negation, ownership claims and implementations.`},{label:`description`,insertText:'description "${1:rule or case witnessed}"',documentation:`Authoring-only description of what this scenario demonstrates.`},{label:`when redelivered`,insertText:"when redelivered ${1:Event} to ${2:Reaction}\n for ${3:value}",documentation:`Selects exactly one given event occurrence and delivers it again to one named event-trigger reaction; the event is not appended again. Executable from ESM v17.`},{label:`given operation fails`,insertText:"given operation ${1:Name} fails",documentation:`Failure fixture leaf; not admitted by any supported executable model (ESM) version yet (PLAY0268).`},{label:`then operation`,insertText:"then operation ${1:Name}\n ${2:input} = ${3:value}",documentation:`Partial requested-operation assertion; not admitted by any supported executable model (ESM) version yet (PLAY0268).`},{label:`then compensated`,insertText:"then compensated ${1:Name}",documentation:`Compensation assertion leaf; not admitted by any supported executable model (ESM) version yet (PLAY0268).`},{label:`file`,insertText:"file ${1:Path}",documentation:`Names the repository relative file this declaration is realized by, so the document can be navigated back to the code.`},{label:`given`,insertText:"given ${1:EventType}\n ${2:property} = ${3:value}",documentation:`Establishes prior state by replaying an event before the command runs.`},{label:`given readmodel`,insertText:"given readmodel ${1:ReadModelType}\n ${2:property} = ${3:value}",documentation:`Establishes prior read model state directly.`},{label:`when`,insertText:"when ${1:CommandType}\n ${2:property} = ${3:value}",documentation:`The command being exercised.`},{label:`then`,insertText:"then ${1:EventType}\n ${2:property} = ${3:value}",documentation:`An event expected to be produced by the command.`},{label:`then readmodel`,insertText:"then readmodel ${1:ReadModelType}\n ${2:property} = ${3:value}",documentation:`The read model state expected after the command.`},{label:`then no readmodel`,insertText:"then no readmodel ${1:ReadModelType} for ${2:key}",documentation:`Asserts that precisely one keyed read-model instance does not exist; another key may still be present.`},{label:`then query`,insertText:"then query ${1:QueryName}\n arguments\n ${2:argument} = ${3:value}\n result\n ${4:property} = ${5:value}",documentation:`The ordered query results expected for explicit arguments. Remove the result block to assert an empty result.`},{label:`then query rejected`,insertText:`then query \${1:Query}
15
+ acknowledge`,documentation:`Explicitly handles unauthorized results, never Unsupported. ${T}`}],D=[{label:`acknowledge`,insertText:`acknowledge`,documentation:`Acknowledges alone, without productions. ${T}`},{label:`produces`,insertText:"produces ${1:Event}\n ${2:reason} = \\$refusal.reason",documentation:`Records the refusal with ordinary event productions. ${T}`}],O=[{label:`file`,insertText:"file ${1:Path}",documentation:`Names the repository relative file this declaration is realized by, so the document can be navigated back to the code.`},{label:`description`,insertText:'description "${1:when this occurs}"',documentation:`What makes an occurrence of this trigger happen.`},{label:`value`,insertText:"${1:name} ${2:Type}",documentation:`A value an occurrence hands the reaction. The type is optional.`}],k=[{label:`given time zone`,insertText:'given time zone "${1:Europe/Oslo}"',documentation:`Specification calendar. Syntax-only (decisions 0106/0107); binding reports PLAY0268.`},{label:`parameter`,insertText:"parameter ${1:name} ${2:Type}",documentation:`One typed value, supplied exactly once by every case.`},{label:`case`,insertText:"case ${1:Name}\n ${2:parameter} = ${3:value}",documentation:`One named complete set of concrete parameter values.`},{label:`given caller as`,insertText:"given caller as ${1:Persona}",documentation:`An authenticated deterministic witness of a top-level persona; no body. Use explicit callers for negation, ownership claims and implementations.`},{label:`description`,insertText:'description "${1:rule or case witnessed}"',documentation:`Authoring-only description of what this scenario demonstrates.`},{label:`when redelivered`,insertText:"when redelivered ${1:Event} to ${2:Reaction}\n for ${3:value}",documentation:`Selects exactly one given event occurrence and delivers it again to one named event-trigger reaction; the event is not appended again. Executable from ESM v17.`},{label:`given operation fails`,insertText:"given operation ${1:Name} fails",documentation:`Failure fixture leaf; not admitted by any supported executable model (ESM) version yet (PLAY0268).`},{label:`then operation`,insertText:"then operation ${1:Name}\n ${2:input} = ${3:value}",documentation:`Partial requested-operation assertion; not admitted by any supported executable model (ESM) version yet (PLAY0268).`},{label:`then compensated`,insertText:"then compensated ${1:Name}",documentation:`Compensation assertion leaf; not admitted by any supported executable model (ESM) version yet (PLAY0268).`},{label:`file`,insertText:"file ${1:Path}",documentation:`Names the repository relative file this declaration is realized by, so the document can be navigated back to the code.`},{label:`given`,insertText:"given ${1:EventType}\n ${2:property} = ${3:value}",documentation:`Establishes prior state by replaying an event before the command runs.`},{label:`given readmodel`,insertText:"given readmodel ${1:ReadModelType}\n ${2:property} = ${3:value}",documentation:`Establishes prior read model state directly.`},{label:`when`,insertText:"when ${1:CommandType}\n ${2:property} = ${3:value}",documentation:`The command being exercised.`},{label:`then`,insertText:"then ${1:EventType}\n ${2:property} = ${3:value}",documentation:`An event expected to be produced by the command.`},{label:`then readmodel`,insertText:"then readmodel ${1:ReadModelType}\n ${2:property} = ${3:value}",documentation:`The read model state expected after the command.`},{label:`then no readmodel`,insertText:"then no readmodel ${1:ReadModelType} for ${2:key}",documentation:`Asserts that precisely one keyed read-model instance does not exist; another key may still be present.`},{label:`then query`,insertText:"then query ${1:QueryName}\n arguments\n ${2:argument} = ${3:value}\n result\n ${4:property} = ${5:value}",documentation:`The ordered query results expected for explicit arguments. Remove the result block to assert an empty result.`},{label:`then query rejected`,insertText:`then query \${1:Query}
16
16
  arguments
17
17
  \${2:argument} = \${3:value}
18
18
  then error`,documentation:`Asserts a Validation rejection of one query, with no action or other outcomes. Executable from ESM v18.`},{label:`then error`,insertText:`then error`,documentation:`A rejection, for a reason this specification does not name. After one actionless query, asserts exactly Validation (ESM v18), not a shape error or denial.`},{label:`then error "..."`,insertText:'then error "${1:reason}"',documentation:`A rejection, for the named reason. After one actionless query, asserts exactly Validation (ESM v18); cannot accompany results, no result, denial or another outcome.`},{label:`given clock`,insertText:'given clock "${1:2026-10-05T08:00:00Z}"',documentation:`The instant the scenario happens at - the occurrence time of everything it does. At most once.`},{label:`given capture`,insertText:"given capture ${1:Capture}\n ${2:field} = ${3:value}",documentation:`A record the capture's source held before.`},{label:`when clock`,insertText:'when clock "${1:2026-10-05T09:00:00Z}"',documentation:`The clock reaches an instant, as the action.`},{label:`when trigger`,insertText:"when trigger ${1:Trigger}\n ${2:value} = ${3:value}",documentation:`An application trigger fires, as the action.`},{label:`when capture`,insertText:"when capture ${1:Capture}\n ${2:field} = ${3:value}",documentation:`The record a capture's source holds now, as the action.`},{label:`when query`,insertText:"when query ${1:Query}\n ${2:argument} = ${3:value}",documentation:`Performs a query. Assert results or genuine absence; a concept-rule violation is rejected and can be asserted with then error from ESM v18.`},{label:`then result`,insertText:"then result\n ${1:property} = ${2:value}",documentation:"One result the query performed by `when query` returns, in order."},{label:`then no result`,insertText:`then no result`,documentation:"The query performed by `when query` returns nothing."},{label:`then no events`,insertText:`then no events`,documentation:`Asserts the action appended no events, including after when append, where no reaction appended anything. Executable from ESM v17; cannot accompany event, error or denial expectations.`}],A={given:[{label:`operation`,insertText:"operation ${1:Name} fails",documentation:`Syntax-only failure fixture; no children.`},{label:`clock`,insertText:'clock "${1:2026-10-05T08:00:00Z}"',documentation:`The instant the scenario happens at - the occurrence time of everything it does.`},{label:`capture`,insertText:"capture ${1:Capture}\n ${2:field} = ${3:value}",documentation:`A record the capture's source held before. Repeat it for several records.`},{label:`readmodel`,insertText:"readmodel ${1:ReadModelType}\n ${2:property} = ${3:value}",documentation:`Establishes prior read model state directly.`},{label:`caller`,insertText:`caller