@cratis/screenplay-language 4.128.0 → 4.130.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 (85) hide show
  1. package/dist/AuthoredReadModelKeys.d.ts +13 -0
  2. package/dist/AuthoredReadModelKeys.d.ts.map +1 -0
  3. package/dist/EventSourceAnalysis.d.ts +11 -0
  4. package/dist/EventSourceAnalysis.d.ts.map +1 -1
  5. package/dist/bundles/compiler/Diagnostics/DiagnosticCodes.js +1 -1
  6. package/dist/bundles/compiler/Diagnostics/DiagnosticCodes.js.map +1 -1
  7. package/dist/bundles/compiler/Files/PlayApplicationAssembly.js +1 -1
  8. package/dist/bundles/compiler/Files/PlayApplicationAssembly.js.map +1 -1
  9. package/dist/bundles/compiler/Parsing/CommandParser.js +1 -1
  10. package/dist/bundles/compiler/Parsing/CommandParser.js.map +1 -1
  11. package/dist/bundles/compiler/Parsing/DeclarationParsers.js +1 -1
  12. package/dist/bundles/compiler/Parsing/DeclarationParsers.js.map +1 -1
  13. package/dist/bundles/compiler/Parsing/DependencySourceParser.js +1 -1
  14. package/dist/bundles/compiler/Parsing/DependencySourceParser.js.map +1 -1
  15. package/dist/bundles/compiler/Parsing/EventSourceValidator.js +1 -1
  16. package/dist/bundles/compiler/Parsing/EventSourceValidator.js.map +1 -1
  17. package/dist/bundles/compiler/Parsing/IdentifierComplianceValidator.js +1 -1
  18. package/dist/bundles/compiler/Parsing/IdentifierComplianceValidator.js.map +1 -1
  19. package/dist/bundles/compiler/Parsing/ObserverFilterParser.js +2 -0
  20. package/dist/bundles/compiler/Parsing/ObserverFilterParser.js.map +1 -0
  21. package/dist/bundles/compiler/Parsing/ObserverFilterValidator.js +2 -0
  22. package/dist/bundles/compiler/Parsing/ObserverFilterValidator.js.map +1 -0
  23. package/dist/bundles/compiler/Parsing/ProducesParser.js +1 -1
  24. package/dist/bundles/compiler/Parsing/ProducesParser.js.map +1 -1
  25. package/dist/bundles/compiler/Parsing/PropertyLineParser.js +1 -1
  26. package/dist/bundles/compiler/Parsing/PropertyLineParser.js.map +1 -1
  27. package/dist/bundles/compiler/Parsing/QueryParser.js +1 -1
  28. package/dist/bundles/compiler/Parsing/QueryParser.js.map +1 -1
  29. package/dist/bundles/compiler/Parsing/ReactionParser.js +1 -1
  30. package/dist/bundles/compiler/Parsing/ReactionParser.js.map +1 -1
  31. package/dist/bundles/compiler/Parsing/ReadModelKeyValidator.js +2 -0
  32. package/dist/bundles/compiler/Parsing/ReadModelKeyValidator.js.map +1 -0
  33. package/dist/bundles/compiler/Parsing/ReadsParser.js +2 -0
  34. package/dist/bundles/compiler/Parsing/ReadsParser.js.map +1 -0
  35. package/dist/bundles/compiler/Parsing/SpecificationStreamValidator.js +1 -1
  36. package/dist/bundles/compiler/Parsing/SpecificationStreamValidator.js.map +1 -1
  37. package/dist/bundles/compiler/Parsing/TriggerDataParser.js +1 -1
  38. package/dist/bundles/compiler/Parsing/TriggerDataParser.js.map +1 -1
  39. package/dist/bundles/compiler/ScreenplayCompiler.js +1 -1
  40. package/dist/bundles/compiler/ScreenplayCompiler.js.map +1 -1
  41. package/dist/bundles/compiler/Syntax/EventSourceCatalog.js +1 -1
  42. package/dist/bundles/compiler/Syntax/EventSourceCatalog.js.map +1 -1
  43. package/dist/bundles/compiler/Syntax/ScreenplaySyntaxWalker.js +1 -1
  44. package/dist/bundles/compiler/Syntax/ScreenplaySyntaxWalker.js.map +1 -1
  45. package/dist/bundles/compiler/Syntax/SyntaxCollections.js +1 -1
  46. package/dist/bundles/compiler/Syntax/SyntaxCollections.js.map +1 -1
  47. package/dist/bundles/compiler/Syntax/SyntaxInvariants.js +1 -1
  48. package/dist/bundles/compiler/Syntax/SyntaxInvariants.js.map +1 -1
  49. package/dist/bundles/compiler/Syntax/SyntaxJson.js +1 -1
  50. package/dist/bundles/compiler/Syntax/SyntaxJson.js.map +1 -1
  51. package/dist/bundles/compiler/Syntax/index.js +1 -1
  52. package/dist/bundles/compiler/index.js +1 -1
  53. package/dist/bundles/completion-items.js +2 -2
  54. package/dist/bundles/completion-items.js.map +1 -1
  55. package/dist/bundles/completion-planner.js +2 -2
  56. package/dist/bundles/completion-planner.js.map +1 -1
  57. package/dist/bundles/diagnostic-codes.js +1 -1
  58. package/dist/bundles/diagnostic-codes.js.map +1 -1
  59. package/dist/bundles/event-source-authoring.js +10 -10
  60. package/dist/bundles/event-source-authoring.js.map +1 -1
  61. package/dist/bundles/keyword-docs.js +1 -1
  62. package/dist/bundles/keyword-docs.js.map +1 -1
  63. package/dist/bundles/read-model-key-completions.js +2 -0
  64. package/dist/bundles/read-model-key-completions.js.map +1 -0
  65. package/dist/bundles/response-analysis.js +6 -6
  66. package/dist/bundles/response-analysis.js.map +1 -1
  67. package/dist/bundles/scope-items.js +1 -1
  68. package/dist/bundles/scope-items.js.map +1 -1
  69. package/dist/bundles/tokens.js +1 -1
  70. package/dist/bundles/tokens.js.map +1 -1
  71. package/dist/bundles/validation.js +1 -1
  72. package/dist/bundles/validation.js.map +1 -1
  73. package/dist/completion-items.d.ts.map +1 -1
  74. package/dist/completion-planner.d.ts.map +1 -1
  75. package/dist/diagnostic-codes.d.ts +7 -0
  76. package/dist/diagnostic-codes.d.ts.map +1 -1
  77. package/dist/event-source-authoring.d.ts.map +1 -1
  78. package/dist/keyword-docs.d.ts.map +1 -1
  79. package/dist/read-model-key-completions.d.ts +4 -0
  80. package/dist/read-model-key-completions.d.ts.map +1 -0
  81. package/dist/response-analysis.d.ts +2 -0
  82. package/dist/response-analysis.d.ts.map +1 -1
  83. package/dist/scope-items.d.ts.map +1 -1
  84. package/dist/tokens.d.ts.map +1 -1
  85. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"SyntaxInvariants.js","names":["ruleNamePattern","sourceStreamPattern","value","kind","InvalidSyntaxJson","message","position","metadataError","publicEventMetadataError","node","concept","validation","rule","production","operation","phase","handler","implementation","hint","isBlankImplementationHint","isSourceStreamName","parts","scalar","part","sources","declaration","type","isSourceStreamTypeName","command","candidates","rejected","index","occurrence","route","candidate"],"sources":["../../../../../../Compiler/Syntax/SyntaxInvariants.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 { CommandSyntax, ValidationRuleSyntax } from './Commands';\nimport { ConceptSyntax } from './Declarations';\nimport { CommandStreamSyntax, EventSourceSyntax, EventStreamSyntax, EventStreamIdPartSyntax } from './EventSources';\nimport { PropertyMappingSyntax } from './Expressions';\nimport { HandlerSyntax, ImplementationSyntax, ImplementationHintSyntax } from './Implementations';\nimport { InvalidSyntaxJson } from './InvalidSyntaxJson';\nimport { publicEventMetadataError } from './PublicEventInvariants';\nimport { OperationPhaseSyntax } from './Operations';\nimport { ProducesSyntax } from './Reactions';\nimport { SyntaxNode } from './SyntaxNode';\nimport { SpecificationEventSyntax, SpecificationStreamSyntax } from './Specifications';\nimport { isBlankImplementationHint } from '../Text/ImplementationHintText';\nimport { isSourceStreamName, isSourceStreamTypeName, sourceStreamPattern } from '../Text/SourceStreamNames';\n\n// .NET \\w is evaluated per UTF-16 code unit, so a supplementary-plane letter is not a name character.\nconst ruleNamePattern = sourceStreamPattern('^[A-Za-z_]\\\\w*$');\n\nconst hasKind = (value: unknown, kind: string): boolean => typeof value === 'object' && value !== null && !Array.isArray(value) && (value as SyntaxNode).kind === kind;\nconst refuse = (message: string): never => { throw new InvalidSyntaxJson(message); };\nconst collection = (value: unknown, kind: string, message: string): void => {\n if (!Array.isArray(value)) return refuse(message);\n // Indexed, so no caller-overridable iteration method or iterator is consulted.\n for (let position = 0; position < value.length; position++) if (!hasKind(value[position], kind)) refuse(message);\n};\n\n// The native ImplementationInvariants / OperationInvariants / EventSourceInvariants contracts.\n// Shared by the isolated strict reader and the writer, without pulling the transport schema into Monaco.\nexport function validateSyntaxInvariants(node: SyntaxNode): void {\n const metadataError = publicEventMetadataError(node);\n if (metadataError !== undefined) refuse(metadataError);\n if (node.kind === 'ConceptSyntax') {\n const concept = node as ConceptSyntax;\n for (const validation of concept.validations ?? []) {\n if (validation.kind === 'DeclarativeValidateSyntax' && validation.rules.some(rule => rule.implementation != null)) refuse('Implementation wrappers on named rules are supported only on commands.');\n }\n }\n if (node.kind === 'ValidationRuleSyntax') {\n const rule = node as ValidationRuleSyntax;\n if (rule.implementation != null) {\n if (!hasKind(rule.implementation, 'ImplementationSyntax')) refuse('A named rule requires an ImplementationSyntax wrapper.');\n if (rule.rule !== 'Rule' || rule.value?.kind !== 'PathExpressionSyntax' || !hasKind(rule.value, 'PathExpressionSyntax') || typeof rule.value.path !== 'string' || ruleNamePattern.exec(rule.value.path)?.[0] !== rule.value.path) refuse('An implementation wrapper requires a valid named rule.');\n if (rule.file != null && rule.code != null) refuse('A named rule has at most one file or inline payload.');\n // Native typed transport enforces these payload members in both numeric modes.\n if (rule.file != null && (!hasKind(rule.file, 'FileReferenceSyntax') || typeof rule.file.path !== 'string')) refuse('A named rule file requires a FileReferenceSyntax payload with a string path.');\n if (rule.code != null && (!hasKind(rule.code, 'CodeBlockSyntax') || typeof rule.code.language !== 'string' || typeof rule.code.code !== 'string')) refuse('A named rule inline payload requires a CodeBlockSyntax with string language and code.');\n validateSyntaxInvariants(rule.implementation);\n }\n }\n if (node.kind === 'ProducesSyntax') {\n const production = node as ProducesSyntax;\n const operation = production.inlineOperation;\n if (operation != null) {\n if (production.inlineEvent != null) refuse('A production cannot declare both an event and an operation.');\n if (production.when != null || production.event !== operation.name || production.for != null || (production.tags ?? []).length > 0) refuse('An inline operation requires a matching unconditional target without event metadata.');\n collection(operation.inputs, 'PropertySyntax', 'Operation inputs must be a collection of properties.');\n collection(production.mappings, 'PropertyMappingSyntax', 'Production mappings must be a collection of mappings.');\n if (operation.inputs.length !== production.mappings.length) refuse('Inline operation inputs and mappings must correspond in order.');\n for (let position = 0; position < operation.inputs.length; position++) if (operation.inputs[position].name !== production.mappings[position].property) refuse('Inline operation inputs and mappings must correspond in order.');\n }\n }\n if (node.kind === 'OperationPhaseSyntax') {\n const phase = node as OperationPhaseSyntax;\n if (phase.file != null && phase.code != null) refuse('An operation phase has at most one file or inline payload.');\n if (phase.implementation != null) validateSyntaxInvariants(phase.implementation);\n }\n if (node.kind === 'HandlerSyntax') {\n const handler = node as HandlerSyntax;\n // Native transport keeps old unwrapped structural handlers; only the new wrapper is admitted here.\n if (handler.implementation != null && handler.file != null && handler.code != null) refuse('A handler has at most one file or inline payload.');\n }\n if (node.kind === 'ImplementationSyntax') {\n const implementation = node as ImplementationSyntax;\n collection(implementation.hints, 'ImplementationHintSyntax', 'Implementation hints must be a collection of nonblank hints.');\n for (let position = 0; position < implementation.hints.length; position++) validateSyntaxInvariants(implementation.hints[position]);\n }\n if (node.kind === 'ImplementationHintSyntax') {\n const hint = node as ImplementationHintSyntax;\n if (typeof hint.text !== 'string' || isBlankImplementationHint(hint.text)) refuse('An implementation hint must be nonblank.');\n }\n validateSourceStream(node);\n}\n\nfunction validateSourceStream(node: SyntaxNode): void {\n const name = (value: string): void => { if (!isSourceStreamName(value)) refuse('Event source and stream names must be identifiers.'); };\n const mappings = (scalar: PropertyMappingSyntax | null, parts: PropertyMappingSyntax[]): void => {\n collection(parts, 'PropertyMappingSyntax', 'Stream id part mappings must be a collection.');\n if (scalar !== null && parts.length > 0) refuse('A route cannot map both scalar and composite stream ids.');\n parts.forEach(part => name(part.property));\n };\n if (node.kind === 'ApplicationSyntax') {\n const sources = (node as unknown as { eventSources?: unknown }).eventSources;\n if (sources !== undefined) collection(sources, 'EventSourceSyntax', 'Event sources must be a collection of event source nodes without null elements.');\n }\n if (node.kind === 'EventSourceSyntax' || node.kind === 'EventStreamSyntax') {\n const declaration = node as EventSourceSyntax | EventStreamSyntax;\n name(declaration.name);\n if (declaration.id !== null && (typeof declaration.id !== 'string' || declaration.id.trim() === '')) refuse('A rename pin must be nonempty.');\n const type = declaration.kind === 'EventSourceSyntax' ? declaration.identifier : declaration.streamId;\n if (type !== null && !hasKind(type, 'TypeRefSyntax')) refuse('Source identifiers and stream ids require type reference nodes.');\n if (type !== null && (type.isCollection || type.isOptional)) refuse('Source identifiers and stream ids require nonoptional scalar type references.');\n if (type !== null && !isSourceStreamTypeName(type.name)) refuse('Source identifiers and stream ids require an exact type reference name.');\n if (declaration.kind === 'EventSourceSyntax') collection(declaration.streams, 'EventStreamSyntax', 'Event streams must contain event stream nodes without null elements.');\n else {\n collection(declaration.streamIdParts, 'EventStreamIdPartSyntax', 'Stream id parts must be a collection.');\n if (declaration.streamId !== null && declaration.streamIdParts.length > 0) refuse('A stream cannot declare both scalar and composite stream ids.');\n declaration.streamIdParts.forEach(part => validateSourceStream(part));\n }\n }\n if (node.kind === 'EventStreamIdPartSyntax') {\n const part = node as EventStreamIdPartSyntax;\n name(part.name);\n if (!hasKind(part.type, 'TypeRefSyntax')) refuse('A stream id part requires a type.');\n if (part.type.isOptional || part.type.isCollection) refuse('Source identifiers and stream ids require nonoptional scalar type references.');\n if (!isSourceStreamTypeName(part.type.name)) refuse('Source identifiers and stream ids require an exact type reference name.');\n }\n if (node.kind === 'CommandSyntax') {\n const command = node as CommandSyntax;\n if (command.stream?.propertyCandidate != null) refuse('The authoritative command stream cannot contain an ambiguous property candidate.');\n if (command.stream != null && !hasKind(command.stream, 'CommandStreamSyntax')) refuse('The authoritative command stream must be a command stream node.');\n if (command.streamCandidates !== undefined) collection(command.streamCandidates, 'CommandStreamSyntax', 'Command stream candidates must be a collection without null elements.');\n const candidates = command.streamCandidates ?? [];\n for (let position = 0; position < candidates.length; position++) {\n const rejected = candidates[position];\n validateSourceStream(rejected);\n if (rejected.propertyCandidate === null && command.stream == null) refuse('A duplicate route candidate requires an authoritative route.');\n if (rejected.propertyCandidate !== null) for (let index = 0; index < command.properties.length; index++) if (command.properties[index] === rejected.propertyCandidate) refuse('An ambiguous property is owned only by its stream candidate.');\n }\n }\n if (node.kind === 'SpecificationEventSyntax' || node.kind === 'SpecificationExampleSyntax' || node.kind === 'SpecificationRedeliverySyntax') {\n const occurrence = node as SpecificationEventSyntax;\n if (occurrence.stream != null && occurrence.noStream != null) refuse('An event occurrence cannot declare both stream and no stream.');\n if (occurrence.stream != null && !hasKind(occurrence.stream, 'SpecificationStreamSyntax')) refuse('A specification stream requires a specification stream node.');\n if (occurrence.noStream != null && !hasKind(occurrence.noStream, 'SpecificationNoStreamSyntax')) refuse('An unrouted expectation requires a specification no stream node.');\n }\n if (node.kind === 'SpecificationStreamSyntax') {\n const route = node as SpecificationStreamSyntax;\n name(route.eventSource);\n name(route.stream);\n if (route.streamId !== null && route.streamId.property !== 'streamId') refuse('A specification stream maps only streamId.');\n mappings(route.streamId, route.streamIdParts);\n }\n if (node.kind === 'CommandStreamSyntax') {\n const route = node as CommandStreamSyntax;\n name(route.eventSource);\n name(route.stream);\n if (route.streamId !== null && route.streamId.property !== 'streamId') refuse('A command stream maps only streamId.');\n mappings(route.streamId, route.streamIdParts);\n const candidate = route.propertyCandidate;\n if (candidate !== null && (candidate.name !== 'stream' || candidate.type.name !== `${route.eventSource}.${route.stream}` || candidate.type.isCollection || candidate.type.isOptional || candidate.isGenerated || candidate.isIdentifier || route.streamId !== null || route.streamIdParts.length > 0)) refuse('An ambiguous route must retain its exact unmodified property candidate, without selecting nested routing.');\n }\n}\n"],"mappings":"2XAkBA,MAAMA,EAAkBC,EAAoB,iBAAiB,EAEvD,SAAW,EAAgB,IAA0B,OAAOC,GAAU,YAAYA,GAAkB,CAAC,MAAM,QAAQA,CAAK,GAAMA,EAAqB,OAASC,EAC5J,OAAU,GAA2B,CAAE,MAAM,IAAIC,EAAkBC,CAAO,CAAG,EAC7E,YAAc,EAAgB,EAAc,IAA0B,CACxE,GAAI,CAAC,MAAM,QAAQH,CAAK,EAAG,OAAO,OAAOG,CAAO,EAEhD,IAAK,IAAIC,EAAW,EAAGA,EAAWJ,EAAM,OAAQ,IAAiB,QAAQA,EAAMI,GAAWH,CAAI,GAAG,OAAOE,CAAO,CACnH,EAIA,SAAgB,yBAAyB,EAAwB,CAC7D,IAAME,E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AUA,EAAM,aAAa,EAC5C,IAAMC,EAAYD,EAAM,kBACpBC,IAAc,OAASA,EAAU,OAAS,UAAYA,EAAU,KAAK,OAAS,GAAGD,EAAM,YAAY,GAAGA,EAAM,UAAYC,EAAU,KAAK,cAAgBA,EAAU,KAAK,YAAcA,EAAU,aAAeA,EAAU,cAAgBD,EAAM,WAAa,MAAQA,EAAM,cAAc,OAAS,IAAI,OAAO,2GAA2G,CAC7Z,CACJ"}
1
+ {"version":3,"file":"SyntaxInvariants.js","names":["ruleNamePattern","sourceStreamPattern","value","kind","InvalidSyntaxJson","message","position","metadataError","publicEventMetadataError","node","concept","validation","rule","production","operation","phase","handler","implementation","hint","isBlankImplementationHint","isSourceStreamName","parts","scalar","part","sources","declaration","type","isSourceStreamTypeName","command","candidates","rejected","index","occurrence","route","filter","candidate"],"sources":["../../../../../../Compiler/Syntax/SyntaxInvariants.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 { CommandSyntax, ValidationRuleSyntax } from './Commands';\nimport { ConceptSyntax } from './Declarations';\nimport { CommandStreamSyntax, EventSourceSyntax, EventStreamSyntax, EventStreamIdPartSyntax } from './EventSources';\nimport { PropertyMappingSyntax } from './Expressions';\nimport { HandlerSyntax, ImplementationSyntax, ImplementationHintSyntax } from './Implementations';\nimport { InvalidSyntaxJson } from './InvalidSyntaxJson';\nimport { publicEventMetadataError } from './PublicEventInvariants';\nimport { OperationPhaseSyntax } from './Operations';\nimport { ProducesSyntax } from './Reactions';\nimport { ObserverFilterSyntax } from './ObserverFilterSyntax';\nimport { SyntaxNode } from './SyntaxNode';\nimport { SpecificationEventSyntax, SpecificationStreamSyntax } from './Specifications';\nimport { isBlankImplementationHint } from '../Text/ImplementationHintText';\nimport { isSourceStreamName, isSourceStreamTypeName, sourceStreamPattern } from '../Text/SourceStreamNames';\n\n// .NET \\w is evaluated per UTF-16 code unit, so a supplementary-plane letter is not a name character.\nconst ruleNamePattern = sourceStreamPattern('^[A-Za-z_]\\\\w*$');\n\nconst hasKind = (value: unknown, kind: string): boolean => typeof value === 'object' && value !== null && !Array.isArray(value) && (value as SyntaxNode).kind === kind;\nconst refuse = (message: string): never => { throw new InvalidSyntaxJson(message); };\nconst collection = (value: unknown, kind: string, message: string): void => {\n if (!Array.isArray(value)) return refuse(message);\n // Indexed, so no caller-overridable iteration method or iterator is consulted.\n for (let position = 0; position < value.length; position++) if (!hasKind(value[position], kind)) refuse(message);\n};\n\n// The native ImplementationInvariants / OperationInvariants / EventSourceInvariants contracts.\n// Shared by the isolated strict reader and the writer, without pulling the transport schema into Monaco.\nexport function validateSyntaxInvariants(node: SyntaxNode): void {\n const metadataError = publicEventMetadataError(node);\n if (metadataError !== undefined) refuse(metadataError);\n if (node.kind === 'ConceptSyntax') {\n const concept = node as ConceptSyntax;\n for (const validation of concept.validations ?? []) {\n if (validation.kind === 'DeclarativeValidateSyntax' && validation.rules.some(rule => rule.implementation != null)) refuse('Implementation wrappers on named rules are supported only on commands.');\n }\n }\n if (node.kind === 'ValidationRuleSyntax') {\n const rule = node as ValidationRuleSyntax;\n if (rule.implementation != null) {\n if (!hasKind(rule.implementation, 'ImplementationSyntax')) refuse('A named rule requires an ImplementationSyntax wrapper.');\n if (rule.rule !== 'Rule' || rule.value?.kind !== 'PathExpressionSyntax' || !hasKind(rule.value, 'PathExpressionSyntax') || typeof rule.value.path !== 'string' || ruleNamePattern.exec(rule.value.path)?.[0] !== rule.value.path) refuse('An implementation wrapper requires a valid named rule.');\n if (rule.file != null && rule.code != null) refuse('A named rule has at most one file or inline payload.');\n // Native typed transport enforces these payload members in both numeric modes.\n if (rule.file != null && (!hasKind(rule.file, 'FileReferenceSyntax') || typeof rule.file.path !== 'string')) refuse('A named rule file requires a FileReferenceSyntax payload with a string path.');\n if (rule.code != null && (!hasKind(rule.code, 'CodeBlockSyntax') || typeof rule.code.language !== 'string' || typeof rule.code.code !== 'string')) refuse('A named rule inline payload requires a CodeBlockSyntax with string language and code.');\n validateSyntaxInvariants(rule.implementation);\n }\n }\n if (node.kind === 'ProducesSyntax') {\n const production = node as ProducesSyntax;\n if (production.stream?.propertyCandidate != null) refuse('A production route cannot contain a property candidate.');\n const operation = production.inlineOperation;\n if (operation != null) {\n if (production.inlineEvent != null) refuse('A production cannot declare both an event and an operation.');\n if (production.when != null || production.event !== operation.name || production.for != null || (production.tags ?? []).length > 0) refuse('An inline operation requires a matching unconditional target without event metadata.');\n collection(operation.inputs, 'PropertySyntax', 'Operation inputs must be a collection of properties.');\n collection(production.mappings, 'PropertyMappingSyntax', 'Production mappings must be a collection of mappings.');\n if (operation.inputs.length !== production.mappings.length) refuse('Inline operation inputs and mappings must correspond in order.');\n for (let position = 0; position < operation.inputs.length; position++) if (operation.inputs[position].name !== production.mappings[position].property) refuse('Inline operation inputs and mappings must correspond in order.');\n }\n }\n if (node.kind === 'OperationPhaseSyntax') {\n const phase = node as OperationPhaseSyntax;\n if (phase.file != null && phase.code != null) refuse('An operation phase has at most one file or inline payload.');\n if (phase.implementation != null) validateSyntaxInvariants(phase.implementation);\n }\n if (node.kind === 'HandlerSyntax') {\n const handler = node as HandlerSyntax;\n // Native transport keeps old unwrapped structural handlers; only the new wrapper is admitted here.\n if (handler.implementation != null && handler.file != null && handler.code != null) refuse('A handler has at most one file or inline payload.');\n }\n if (node.kind === 'ImplementationSyntax') {\n const implementation = node as ImplementationSyntax;\n collection(implementation.hints, 'ImplementationHintSyntax', 'Implementation hints must be a collection of nonblank hints.');\n for (let position = 0; position < implementation.hints.length; position++) validateSyntaxInvariants(implementation.hints[position]);\n }\n if (node.kind === 'ImplementationHintSyntax') {\n const hint = node as ImplementationHintSyntax;\n if (typeof hint.text !== 'string' || isBlankImplementationHint(hint.text)) refuse('An implementation hint must be nonblank.');\n }\n validateSourceStream(node);\n}\n\nfunction validateSourceStream(node: SyntaxNode): void {\n const name = (value: string): void => { if (!isSourceStreamName(value)) refuse('Event source and stream names must be identifiers.'); };\n const mappings = (scalar: PropertyMappingSyntax | null, parts: PropertyMappingSyntax[]): void => {\n collection(parts, 'PropertyMappingSyntax', 'Stream id part mappings must be a collection.');\n if (scalar !== null && parts.length > 0) refuse('A route cannot map both scalar and composite stream ids.');\n parts.forEach(part => name(part.property));\n };\n if (node.kind === 'ApplicationSyntax') {\n const sources = (node as unknown as { eventSources?: unknown }).eventSources;\n if (sources !== undefined) collection(sources, 'EventSourceSyntax', 'Event sources must be a collection of event source nodes without null elements.');\n }\n if (node.kind === 'EventSourceSyntax' || node.kind === 'EventStreamSyntax') {\n const declaration = node as EventSourceSyntax | EventStreamSyntax;\n name(declaration.name);\n if (declaration.id !== null && (typeof declaration.id !== 'string' || declaration.id.trim() === '')) refuse('A rename pin must be nonempty.');\n const type = declaration.kind === 'EventSourceSyntax' ? declaration.identifier : declaration.streamId;\n if (type !== null && !hasKind(type, 'TypeRefSyntax')) refuse('Source identifiers and stream ids require type reference nodes.');\n if (type !== null && (type.isCollection || type.isOptional)) refuse('Source identifiers and stream ids require nonoptional scalar type references.');\n if (type !== null && !isSourceStreamTypeName(type.name)) refuse('Source identifiers and stream ids require an exact type reference name.');\n if (declaration.kind === 'EventSourceSyntax') collection(declaration.streams, 'EventStreamSyntax', 'Event streams must contain event stream nodes without null elements.');\n else {\n collection(declaration.streamIdParts, 'EventStreamIdPartSyntax', 'Stream id parts must be a collection.');\n if (declaration.streamId !== null && declaration.streamIdParts.length > 0) refuse('A stream cannot declare both scalar and composite stream ids.');\n declaration.streamIdParts.forEach(part => validateSourceStream(part));\n }\n }\n if (node.kind === 'EventStreamIdPartSyntax') {\n const part = node as EventStreamIdPartSyntax;\n name(part.name);\n if (!hasKind(part.type, 'TypeRefSyntax')) refuse('A stream id part requires a type.');\n if (part.type.isOptional || part.type.isCollection) refuse('Source identifiers and stream ids require nonoptional scalar type references.');\n if (!isSourceStreamTypeName(part.type.name)) refuse('Source identifiers and stream ids require an exact type reference name.');\n }\n if (node.kind === 'CommandSyntax') {\n const command = node as CommandSyntax;\n if (command.stream?.propertyCandidate != null) refuse('The authoritative command stream cannot contain an ambiguous property candidate.');\n if (command.stream != null && !hasKind(command.stream, 'CommandStreamSyntax')) refuse('The authoritative command stream must be a command stream node.');\n if (command.streamCandidates !== undefined) collection(command.streamCandidates, 'CommandStreamSyntax', 'Command stream candidates must be a collection without null elements.');\n const candidates = command.streamCandidates ?? [];\n for (let position = 0; position < candidates.length; position++) {\n const rejected = candidates[position];\n validateSourceStream(rejected);\n if (rejected.propertyCandidate === null && command.stream == null) refuse('A duplicate route candidate requires an authoritative route.');\n if (rejected.propertyCandidate !== null) for (let index = 0; index < command.properties.length; index++) if (command.properties[index] === rejected.propertyCandidate) refuse('An ambiguous property is owned only by its stream candidate.');\n }\n }\n if (node.kind === 'SpecificationEventSyntax' || node.kind === 'SpecificationExampleSyntax' || node.kind === 'SpecificationRedeliverySyntax') {\n const occurrence = node as SpecificationEventSyntax;\n if (occurrence.stream != null && occurrence.noStream != null) refuse('An event occurrence cannot declare both stream and no stream.');\n if (occurrence.stream != null && !hasKind(occurrence.stream, 'SpecificationStreamSyntax')) refuse('A specification stream requires a specification stream node.');\n if (occurrence.noStream != null && !hasKind(occurrence.noStream, 'SpecificationNoStreamSyntax')) refuse('An unrouted expectation requires a specification no stream node.');\n }\n if (node.kind === 'SpecificationStreamSyntax') {\n const route = node as SpecificationStreamSyntax;\n name(route.eventSource);\n name(route.stream);\n if (route.streamId !== null && route.streamId.property !== 'streamId') refuse('A specification stream maps only streamId.');\n mappings(route.streamId, route.streamIdParts);\n }\n if (node.kind === 'ObserverFilterSyntax') {\n const filter = node as ObserverFilterSyntax;\n name(filter.eventSource);\n if (filter.stream != null) name(filter.stream);\n }\n if (node.kind === 'CommandStreamSyntax') {\n const route = node as CommandStreamSyntax;\n name(route.eventSource);\n name(route.stream);\n if (route.streamId !== null && route.streamId.property !== 'streamId') refuse('A command stream maps only streamId.');\n mappings(route.streamId, route.streamIdParts);\n const candidate = route.propertyCandidate;\n if (candidate !== null && (candidate.name !== 'stream' || candidate.type.name !== `${route.eventSource}.${route.stream}` || candidate.type.isCollection || candidate.type.isOptional || candidate.isGenerated || candidate.isIdentifier || route.streamId !== null || route.streamIdParts.length > 0)) refuse('An ambiguous route must retain its exact unmodified property candidate, without selecting nested routing.');\n }\n}\n"],"mappings":"2XAmBA,MAAMA,EAAkBC,EAAoB,iBAAiB,EAEvD,SAAW,EAAgB,IAA0B,OAAOC,GAAU,YAAYA,GAAkB,CAAC,MAAM,QAAQA,CAAK,GAAMA,EAAqB,OAASC,EAC5J,OAAU,GAA2B,CAAE,MAAM,IAAIC,EAAkBC,CAAO,CAAG,EAC7E,YAAc,EAAgB,EAAc,IAA0B,CACxE,GAAI,CAAC,MAAM,QAAQH,CAAK,EAAG,OAAO,OAAOG,CAAO,EAEhD,IAAK,IAAIC,EAAW,EAAGA,EAAWJ,EAAM,OAAQ,IAAiB,QAAQA,EAAMI,GAAWH,CAAI,GAAG,OAAOE,CAAO,CACnH,EAIA,SAAgB,yBAAyB,EAAwB,CAC7D,IAAME,EAAgBC,EAAyBC,CAAI,EAEnD,GADIF,IAAkB,IAAA,IAAW,OAAOA,CAAa,EACjDE,EAAK,OAAS,gBAAiB,CAC/B,IAAMC,EAAUD,EAChB,IAAK,IAAME,KAAcD,EAAQ,aAAe,CAAC,EACzCC,EAAW,OAAS,6BAA+BA,EAAW,MAAM,KAAK,GAAQC,EAAK,gBAAkB,IAAI,GAAG,OAAO,wEAAwE,CAE1M,CACA,GAAIH,EAAK,OAAS,uBAAwB,CACtC,IAAMG,EAAOH,EACTG,EAAK,gBAAkB,OAClB,QAAQA,EAAK,eAAgB,sBAAsB,GAAG,OAAO,wDAAwD,GACtHA,EAAK,OAAS,QAAUA,EAAK,OAAO,OAAS,wBAA0B,CAAC,QAAQA,EAAK,MAAO,sBAAsB,GAAK,OAAOA,EAAK,MAAM,MAAS,UAAYZ,EAAgB,KAAKY,EAAK,MAAM,IAAI,CAAC,GAAG,KAAOA,EAAK,MA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Json as n}from"./InvalidSyntaxJson.js";import{legacySourceOptions as r,validatedSourceOptions as i}from"./SourceOptions.js";import{validateSyntaxInvariants as a}from"./SyntaxInvariants.js";import{syntaxMemberNames as o,validateClosedSyntaxMembers as s,validateSyntaxMembers as c}from"./SyntaxMemberContracts.js";import{isLegacyOmittedMember as l}from"./LegacyWireProjection.js";const isNode=e=>typeof e==`object`&&!!e&&typeof e.kind==`string`,u=/* @__PURE__ */ new Set([`kind`,`location`,`targetLocation`,`referenceLocation`,`referenceLength`,`nameWasEscaped`,`declaredTriggers`,`directiveLocations`]),d=/* @__PURE__ */ new Set([`ApplicationSyntax`,`ProjectionSyntax`,`CaptureSyntax`,`SpecificationSyntax`]);function toSyntaxJson(e){let t=snapshot(e);return validateNumbers(t,`legacy`,0),write(t)}function snapshot(e){let t=/* @__PURE__ */ new WeakMap,n=[];function detach(e){if(typeof e!=`object`||!e)return e;if(t.has(e))return t.get(e);if(Array.isArray(e)){let r=dataArray();t.set(e,r);let i=e.length;for(let t=i-1;t>=0;t--)n.push(()=>{r[t]=detach(Object.hasOwn(e,t)?e[t]:void 0)});return r}let r=Object.create(null);t.set(e,r);let i=Object.keys(e);!i.includes(`kind`)&&`kind`in e&&i.unshift(`kind`);for(let t=i.length-1;t>=0;t--)n.push(()=>{let a=i[t],o=e[a];a===`sourceOptions`&&n.push(()=>{typeof o==`object`&&o&&(Object.getPrototypeOf(o)!==Object.prototype&&Object.getPrototypeOf(o)!==null||Reflect.ownKeys(o).length!==Object.keys(o).length)&&(r[a]=Object.assign(Object.create(null),{numericMode:`invalid`}))}),r[a]=detach(o)});return r}let r=detach(e);for(;n.length>0;)n.pop()();return r}function dataArray(){let e=[];return Object.defineProperty(e,"toJSON",{value:void 0}),e}function write(e,t=`legacy`,n=!1){if(Array.isArray(e)){let r=dataArray();for(let i=0;i<e.length;i++)r.push(write(e[i],t,n));return r}if(isNode(e)){if(d.has(e.kind)&&(t=i(e.sourceOptions??r).numericMode),a(e),(e.kind===`ImplementationSyntax`||e.kind===`ImplementationHintSyntax`)&&s(e,u),e.kind===`ValidationRuleSyntax`){let t=e;t.implementation!=null&&(t.file!=null&&s(t.file,u),t.code!=null&&s(t.code,u))}let c=Object.create(null);c.kind=e.kind;let f={...e};e.kind===`ApplicationSyntax`&&f.eventSources===void 0&&(f.eventSources=[]),e.kind===`CommandSyntax`&&f.stream===void 0&&(f.stream=null),e.kind===`CommandSyntax`&&f.streamCandidates===void 0&&(f.streamCandidates=[]);let p=t===`exact`?o(e.kind):void 0,m=Object.keys(f).filter(r=>(p===void 0||p.has(r))&&!(t===`legacy`&&!n&&l(e,r))&&!u.has(r)&&(e.kind!==`OperationSyntax`||r!==`usesLocation`)).sort(ordinal);for(let r of m){let i=f[r];(e.kind!==`ApplicationSyntax`||r!==`identity`||i!=null)&&(e.kind!==`EventSyntax`&&e.kind!==`ImportSyntax`||(r!==`visibility`||i!==`Private`)&&(r!==`origin`||i!=null))&&(e.kind!==`SliceSyntax`||r!==`direction`||i!=null)&&(e.kind!==`ConceptAttributeSyntax`||r!==`scope`&&r!==`specialCategory`||i!=null)&&(e.kind!==`ConceptAttributeSyntax`||r!==`criminal`||i!==!1)&&(e.kind!==`PropertySyntax`||r!==`isSubject`||i!==!1)&&(r===`description`&&i==null&&[`ConceptSyntax`,`PolicySyntax`,`FileConstraintSyntax`,`UniqueEventConstraintSyntax`,`UniquePropertyConstraintSyntax`,`ProjectionSyntax`,`ScreenSyntax`,`FormSyntax`].includes(e.kind)||(r!==`documentation`||e.kind===`EventSyntax`||i!=null)&&(e.kind!==`SpecificationSyntax`||r!==`description`||i!=null)&&(r!==`dependsOn`||e.kind!==`ModuleSyntax`&&e.kind!==`FeatureSyntax`||!Array.isArray(i)||i.length!==0)&&(r!==`sourceOptions`||i?.numericMode!==`legacy`)&&(r!==`examples`&&(e.kind!==`SpecificationSyntax`||r!==`parameters`&&r!==`cases`)||!Array.isArray(i)||i.length!==0)&&(e.kind!==`SpecificationErrorSyntax`||r!==`caseValue`||i!=null)&&(r===`purposes`&&Array.isArray(i)&&i.length===0||(r!==`inlineProperty`||i!=null)&&(e.kind!==`SpecificationExampleSyntax`&&e.kind!==`SpecificationRedeliverySyntax`||r!==`stream`&&r!==`noStream`||i!=null)&&(e.kind!==`SpecificationSyntax`||r!==`thenNoEvents`||i!==!1)&&(e.kind!==`SpecificationSyntax`||r!==`whenRedelivered`||i!=null)&&(e.kind===`InvokesSyntax`&&r===`onRefused`&&Array.isArray(i)&&i.length===0||(c[r]=write(i,t,n)))))}return c}if(e===void 0)return null;if(typeof e!=`object`||!e)return e;let c=e,f=Object.create(null);if(c.literalType===`ExactNumber`)return f.literalType=`ExactNumber`,f.value=c.value,f;for(let e of Object.keys(c))e!==`toJSON`&&c[e]!==void 0&&(f[e]=write(c[e],t,n));return f}function validateNumbers(a,s,l){if(l>96&&s===`exact`)throw new n(`Syntax nesting exceeds the supported depth of 96.`);if(Array.isArray(a)){for(let e=0;e<a.length;e++)validateNumbers(a[e],s,l+1);return}if(typeof a!=`object`||!a)return;let u=a;if(d.has(u.kind)||Object.hasOwn(u,`sourceOptions`)){let e=Object.hasOwn(u,`sourceOptions`)?i(u.sourceOptions):r;if(l>0&&s!==e.numericMode)throw new n(`Conflicting source numeric options.`);s=e.numericMode}if(l===0&&s===`exact`&&!d.has(u.kind))throw new n(`Exact syntax requires a complete source root.`);if(s===`exact`&&isNode(u)&&c(u),u.kind===`RawExpressionSyntax`&&s===`exact`&&typeof u.text==`string`&&e(u.text))throw new n(`An exact numeric operand must be an explicit ExactNumber, not opaque numeric text.`);if(u.kind===`LiteralExpressionSyntax`&&Object.hasOwn(u,`value`)){if(s===`exact`&&(typeof u.value==`number`||u.value!==null&&![`string`,`boolean`,`object`].includes(typeof u.value)))throw new n(`Exact source requires supported primitive values or an explicit ExactNumber literal.`);if(typeof u.value==`object`&&u.value!==null){let e=u.value;if(e.literalType===`ExactNumber`){if(s!==`exact`||typeof e.value!=`string`||t(e.value)?.value!==e.value||Object.keys(e).length!==2)throw new n(`Malformed or incompatible ExactNumber literal.`)}else if(s===`exact`)throw new n(`Exact source refuses old or plain object literal insertion.`)}}let f=s===`exact`&&isNode(u)?o(u.kind):void 0;for(let[e,t]of Object.entries(u))(f===void 0||f.has(e)||isNode(t)&&d.has(t.kind))&&e!==`location`&&e!==`targetLocation`&&e!==`usesLocation`&&validateNumbers(t,s,l+1)}function ordinal(e,t){return e<t?-1:+(e>t)}export{toSyntaxJson};
1
+ import"../../_virtual/_virtual/_rolldown/runtime.js";import{isExactNumberToken as e,parseExactNumber as t}from"./ExactNumber.js";import{InvalidSyntaxJson as n}from"./InvalidSyntaxJson.js";import{legacySourceOptions as r,validatedSourceOptions as i}from"./SourceOptions.js";import{validateSyntaxInvariants as a}from"./SyntaxInvariants.js";import{syntaxMemberNames as o,validateClosedSyntaxMembers as s,validateSyntaxMembers as c}from"./SyntaxMemberContracts.js";import{isLegacyOmittedMember as l}from"./LegacyWireProjection.js";const isNode=e=>typeof e==`object`&&!!e&&typeof e.kind==`string`,u=/* @__PURE__ */ new Set([`kind`,`location`,`targetLocation`,`referenceLocation`,`referenceLength`,`nameWasEscaped`,`declaredTriggers`,`directiveLocations`]),d=/* @__PURE__ */ new Set([`ApplicationSyntax`,`ProjectionSyntax`,`CaptureSyntax`,`SpecificationSyntax`]);function toSyntaxJson(e){let t=snapshot(e);return validateNumbers(t,`legacy`,0),write(t)}function snapshot(e){let t=/* @__PURE__ */ new WeakMap,n=[];function detach(e){if(typeof e!=`object`||!e)return e;if(t.has(e))return t.get(e);if(Array.isArray(e)){let r=dataArray();t.set(e,r);let i=e.length;for(let t=i-1;t>=0;t--)n.push(()=>{r[t]=detach(Object.hasOwn(e,t)?e[t]:void 0)});return r}let r=Object.create(null);t.set(e,r);let i=Object.keys(e);!i.includes(`kind`)&&`kind`in e&&i.unshift(`kind`);for(let t=i.length-1;t>=0;t--)n.push(()=>{let a=i[t],o=e[a];a===`sourceOptions`&&n.push(()=>{typeof o==`object`&&o&&(Object.getPrototypeOf(o)!==Object.prototype&&Object.getPrototypeOf(o)!==null||Reflect.ownKeys(o).length!==Object.keys(o).length)&&(r[a]=Object.assign(Object.create(null),{numericMode:`invalid`}))}),r[a]=detach(o)});return r}let r=detach(e);for(;n.length>0;)n.pop()();return r}function dataArray(){let e=[];return Object.defineProperty(e,"toJSON",{value:void 0}),e}function write(e,t=`legacy`,n=!1){if(Array.isArray(e)){let r=dataArray();for(let i=0;i<e.length;i++)r.push(write(e[i],t,n));return r}if(isNode(e)){if(d.has(e.kind)&&(t=i(e.sourceOptions??r).numericMode),a(e),(e.kind===`ImplementationSyntax`||e.kind===`ImplementationHintSyntax`)&&s(e,u),e.kind===`ValidationRuleSyntax`){let t=e;t.implementation!=null&&(t.file!=null&&s(t.file,u),t.code!=null&&s(t.code,u))}let c=Object.create(null);c.kind=e.kind;let f={...e};e.kind===`ApplicationSyntax`&&f.eventSources===void 0&&(f.eventSources=[]),e.kind===`CommandSyntax`&&f.stream===void 0&&(f.stream=null),e.kind===`CommandSyntax`&&f.streamCandidates===void 0&&(f.streamCandidates=[]);let p=t===`exact`?o(e.kind):void 0,m=Object.keys(f).filter(r=>(p===void 0||p.has(r))&&!(t===`legacy`&&!n&&l(e,r))&&!u.has(r)&&(e.kind!==`OperationSyntax`||r!==`usesLocation`)).sort(ordinal);for(let r of m){let i=f[r];(e.kind!==`ApplicationSyntax`||r!==`identity`||i!=null)&&(e.kind!==`EventSyntax`&&e.kind!==`ImportSyntax`||(r!==`visibility`||i!==`Private`)&&(r!==`origin`||i!=null))&&(e.kind!==`SliceSyntax`||r!==`direction`||i!=null)&&(e.kind!==`ReactionSyntax`&&e.kind!==`ReducerSyntax`||r!==`from`||i!=null)&&(e.kind!==`ProducesSyntax`||r!==`stream`||i!=null)&&(e.kind!==`ConceptAttributeSyntax`||r!==`scope`&&r!==`specialCategory`||i!=null)&&(e.kind!==`ConceptAttributeSyntax`||r!==`criminal`||i!==!1)&&(e.kind!==`PropertySyntax`||r!==`isSubject`||i!==!1)&&(r===`description`&&i==null&&[`ConceptSyntax`,`PolicySyntax`,`FileConstraintSyntax`,`UniqueEventConstraintSyntax`,`UniquePropertyConstraintSyntax`,`ProjectionSyntax`,`ScreenSyntax`,`FormSyntax`].includes(e.kind)||(r!==`documentation`||e.kind===`EventSyntax`||i!=null)&&(e.kind!==`SpecificationSyntax`||r!==`description`||i!=null)&&(r!==`dependsOn`||e.kind!==`ModuleSyntax`&&e.kind!==`FeatureSyntax`||!Array.isArray(i)||i.length!==0)&&(r!==`sourceOptions`||i?.numericMode!==`legacy`)&&(r!==`examples`&&(e.kind!==`SpecificationSyntax`||r!==`parameters`&&r!==`cases`)||!Array.isArray(i)||i.length!==0)&&(e.kind!==`SpecificationErrorSyntax`||r!==`caseValue`||i!=null)&&(r===`purposes`&&Array.isArray(i)&&i.length===0||(r!==`inlineProperty`||i!=null)&&(e.kind!==`SpecificationExampleSyntax`&&e.kind!==`SpecificationRedeliverySyntax`||r!==`stream`&&r!==`noStream`||i!=null)&&(e.kind!==`SpecificationSyntax`||r!==`thenNoEvents`||i!==!1)&&(e.kind!==`SpecificationSyntax`||r!==`whenRedelivered`||i!=null)&&(e.kind===`InvokesSyntax`&&r===`onRefused`&&Array.isArray(i)&&i.length===0||(c[r]=write(i,t,n)))))}return c}if(e===void 0)return null;if(typeof e!=`object`||!e)return e;let c=e,f=Object.create(null);if(c.literalType===`ExactNumber`)return f.literalType=`ExactNumber`,f.value=c.value,f;for(let e of Object.keys(c))e!==`toJSON`&&c[e]!==void 0&&(f[e]=write(c[e],t,n));return f}function validateNumbers(a,s,l){if(l>96&&s===`exact`)throw new n(`Syntax nesting exceeds the supported depth of 96.`);if(Array.isArray(a)){for(let e=0;e<a.length;e++)validateNumbers(a[e],s,l+1);return}if(typeof a!=`object`||!a)return;let u=a;if(d.has(u.kind)||Object.hasOwn(u,`sourceOptions`)){let e=Object.hasOwn(u,`sourceOptions`)?i(u.sourceOptions):r;if(l>0&&s!==e.numericMode)throw new n(`Conflicting source numeric options.`);s=e.numericMode}if(l===0&&s===`exact`&&!d.has(u.kind))throw new n(`Exact syntax requires a complete source root.`);if(s===`exact`&&isNode(u)&&c(u),u.kind===`RawExpressionSyntax`&&s===`exact`&&typeof u.text==`string`&&e(u.text))throw new n(`An exact numeric operand must be an explicit ExactNumber, not opaque numeric text.`);if(u.kind===`LiteralExpressionSyntax`&&Object.hasOwn(u,`value`)){if(s===`exact`&&(typeof u.value==`number`||u.value!==null&&![`string`,`boolean`,`object`].includes(typeof u.value)))throw new n(`Exact source requires supported primitive values or an explicit ExactNumber literal.`);if(typeof u.value==`object`&&u.value!==null){let e=u.value;if(e.literalType===`ExactNumber`){if(s!==`exact`||typeof e.value!=`string`||t(e.value)?.value!==e.value||Object.keys(e).length!==2)throw new n(`Malformed or incompatible ExactNumber literal.`)}else if(s===`exact`)throw new n(`Exact source refuses old or plain object literal insertion.`)}}let f=s===`exact`&&isNode(u)?o(u.kind):void 0;for(let[e,t]of Object.entries(u))(f===void 0||f.has(e)||isNode(t)&&d.has(t.kind))&&e!==`location`&&e!==`targetLocation`&&e!==`usesLocation`&&validateNumbers(t,s,l+1)}function ordinal(e,t){return e<t?-1:+(e>t)}export{toSyntaxJson};
2
2
  //# sourceMappingURL=SyntaxJson.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SyntaxJson.js","names":["value","omitted","sourceRoots","detached","node","copies","pending","items","length","index","copy","names","name","member","owningMode","complete","validatedSourceOptions","legacySourceOptions","validateSyntaxInvariants","validateClosedSyntaxMembers","rule","result","structural","known","syntaxMemberNames","members","isLegacyOmittedMember","memberValue","record","depth","InvalidSyntaxJson","options","validateSyntaxMembers","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 omitted = new Set(['kind', 'location', 'targetLocation', 'referenceLocation', 'referenceLength', 'nameWasEscaped', 'declaredTriggers', 'directiveLocations']);\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 (typeof value !== 'object' || value === null) return value;\n if (copies.has(value)) return copies.get(value);\n if (Array.isArray(value)) {\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 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(() => {\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.\n if (typeof member === 'object' && member !== null &&\n ((Object.getPrototypeOf(member) !== Object.prototype && Object.getPrototypeOf(member) !== null) || Reflect.ownKeys(member).length !== Object.keys(member).length)) {\n copy[name] = Object.assign(Object.create(null), { numericMode: 'invalid' });\n }\n });\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\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\nfunction write(value: unknown, owningMode = 'legacy', complete = false): SyntaxJsonValue {\n if (Array.isArray(value)) {\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 if (isNode(value)) {\n if (sourceRoots.has(value.kind)) owningMode = validatedSourceOptions((value as unknown as { sourceOptions?: unknown }).sourceOptions ?? legacySourceOptions).numericMode;\n validateSyntaxInvariants(value);\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') {\n const rule = value as ValidationRuleSyntax;\n if (rule.implementation != null) {\n if (rule.file != null) validateClosedSyntaxMembers(rule.file, omitted);\n if (rule.code != null) validateClosedSyntaxMembers(rule.code, omitted);\n }\n }\n const result = Object.create(null) as { [member: string]: SyntaxJsonValue };\n result.kind = value.kind;\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 const known = owningMode === 'exact' ? syntaxMemberNames(value.kind) : undefined;\n const members = Object.keys(structural).filter(member => (known === undefined || known.has(member)) && !(owningMode === 'legacy' && !complete && isLegacyOmittedMember(value, member)) && !omitted.has(member) && !(value.kind === 'OperationSyntax' && member === 'usesLocation')).sort(ordinal);\n for (const member of members) {\n const memberValue = structural[member];\n if (value.kind === 'ApplicationSyntax' && member === 'identity' && memberValue == null) continue;\n if ((value.kind === 'EventSyntax' || value.kind === 'ImportSyntax') && ((member === 'visibility' && memberValue === 'Private') || (member === 'origin' && memberValue == null))) continue;\n if (value.kind === 'SliceSyntax' && member === 'direction' && memberValue == null) continue;\n if (value.kind === 'ConceptAttributeSyntax' && (member === 'scope' || member === 'specialCategory') && memberValue == null) continue;\n if (value.kind === 'ConceptAttributeSyntax' && member === 'criminal' && memberValue === false) continue;\n if (value.kind === 'PropertySyntax' && member === 'isSubject' && memberValue === false) continue;\n if (member === 'description' && memberValue == null && ['ConceptSyntax', 'PolicySyntax', 'FileConstraintSyntax', 'UniqueEventConstraintSyntax', 'UniquePropertyConstraintSyntax', 'ProjectionSyntax', 'ScreenSyntax', 'FormSyntax'].includes(value.kind)) continue;\n if (member === 'documentation' && value.kind !== 'EventSyntax' && memberValue == null) continue;\n if (value.kind === 'SpecificationSyntax' && member === 'description' && memberValue == null) continue;\n if (member === 'dependsOn' && (value.kind === 'ModuleSyntax' || value.kind === 'FeatureSyntax') && Array.isArray(memberValue) && memberValue.length === 0) continue;\n if (member === 'sourceOptions' && (memberValue as { numericMode?: string } | undefined)?.numericMode === 'legacy') continue;\n if ((member === 'examples' || value.kind === 'SpecificationSyntax' && (member === 'parameters' || member === 'cases')) && Array.isArray(memberValue) && memberValue.length === 0) continue;\n if (value.kind === 'SpecificationErrorSyntax' && member === 'caseValue' && memberValue == null) continue;\n if (member === 'purposes' && Array.isArray(memberValue) && memberValue.length === 0) continue;\n if (member === 'inlineProperty' && memberValue == null) continue;\n if ((value.kind === 'SpecificationExampleSyntax' || value.kind === 'SpecificationRedeliverySyntax') && (member === 'stream' || member === 'noStream') && memberValue == null) continue;\n if (value.kind === 'SpecificationSyntax' && member === 'thenNoEvents' && memberValue === false) continue;\n if (value.kind === 'SpecificationSyntax' && member === 'whenRedelivered' && memberValue == null) continue;\n if (value.kind === 'InvokesSyntax' && member === 'onRefused' && Array.isArray(memberValue) && memberValue.length === 0) continue;\n result[member] = write(memberValue, owningMode, complete);\n }\n return result;\n }\n if (value === undefined) return null;\n if (typeof value !== 'object' || value === null) return value as SyntaxJsonValue;\n const record = value as Record<string, unknown>;\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 { [member: 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 if (depth > 96 && owningMode === 'exact') throw new InvalidSyntaxJson('Syntax nesting exceeds the supported depth of 96.');\n if (Array.isArray(value)) { for (let index = 0; index < value.length; index++) validateNumbers(value[index], owningMode, depth + 1); return; }\n if (typeof value !== 'object' || value === null) return;\n const node = value as Record<string, unknown>;\n if (sourceRoots.has(node.kind as string) || Object.hasOwn(node, 'sourceOptions')) {\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 owningMode = options.numericMode;\n }\n if (depth === 0 && owningMode === 'exact' && !sourceRoots.has(node.kind as string)) throw new InvalidSyntaxJson('Exact syntax requires a complete source root.');\n if (owningMode === 'exact' && isNode(node)) validateSyntaxMembers(node);\n if (node.kind === 'RawExpressionSyntax' && owningMode === 'exact' && typeof node.text === 'string' && isExactNumberToken(node.text)) throw new InvalidSyntaxJson('An exact numeric operand must be an explicit ExactNumber, not opaque numeric text.');\n if (node.kind === 'LiteralExpressionSyntax' && Object.hasOwn(node, 'value')) {\n if (owningMode === 'exact' && (typeof node.value === 'number' || (node.value !== null && !['string', 'boolean', 'object'].includes(typeof node.value)))) throw new InvalidSyntaxJson('Exact source requires supported primitive values or an explicit ExactNumber literal.');\n if (typeof node.value === 'object' && node.value !== null) {\n const literal = node.value as { literalType?: unknown; value?: unknown };\n if (literal.literalType === 'ExactNumber') {\n if (owningMode !== 'exact' || typeof literal.value !== 'string' || parseExactNumber(literal.value)?.value !== literal.value || Object.keys(literal).length !== 2) throw new InvalidSyntaxJson('Malformed or incompatible ExactNumber literal.');\n } else if (owningMode === 'exact') throw new InvalidSyntaxJson('Exact source refuses old or plain object literal insertion.');\n }\n }\n const known = owningMode === 'exact' && isNode(node) ? syntaxMemberNames(node.kind) : undefined;\n for (const [name, member] of Object.entries(node)) if ((known === undefined || known.has(name) || (isNode(member) && sourceRoots.has(member.kind))) && name !== 'location' && name !== 'targetLocation' && name !== 'usesLocation') validateNumbers(member, owningMode, depth + 1);\n}\n\nfunction ordinal(left: string, right: string): number {\n return left < right ? -1 : left > right ? 1 : 0;\n}\n"],"mappings":"+gBAeA,MAAM,O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AAe,SAAW,OAAOoB,EAAQ,OAAU,UAAYC,EAAiBD,EAAQ,KAAK,CAAC,EAAE,QAAUA,EAAQ,OAAS,OAAO,KAAKA,CAAO,CAAC,CAAC,SAAW,EAAG,MAAM,IAAIJ,EAAkB,gDAAgD,CAAA,MAC3O,GAAIhB,IAAe,QAAS,MAAM,IAAIgB,EAAkB,6DAA6D,CAChI,CACJ,CACA,IAAMP,EAAQT,IAAe,SAAW,OAAOV,CAAI,EAAIoB,EAAkBpB,EAAK,IAAI,EAAI,IAAA,GACtF,IAAK,GAAM,CAACQ,EAAMC,KAAW,OAAO,QAAQT,CAAI,GAAQmB,IAAU,IAAA,IAAaA,EAAM,IAAIX,CAAI,GAAM,OAAOC,CAAM,GAAKX,EAAY,IAAIW,EAAO,IAAI,IAAOD,IAAS,YAAcA,IAAS,kBAAoBA,IAAS,gBAAgB,gBAAgBC,EAAQC,EAAYe,EAAQ,CAAC,CACrR,CAEA,SAAS,QAAQ,EAAc,EAAuB,CAClD,OAAOO,EAAOC,EAAQ,GAAK,IAAOA,EACtC"}
1
+ {"version":3,"file":"SyntaxJson.js","names":["value","omitted","sourceRoots","detached","node","copies","pending","items","length","index","copy","names","name","member","owningMode","complete","validatedSourceOptions","legacySourceOptions","validateSyntaxInvariants","validateClosedSyntaxMembers","rule","result","structural","known","syntaxMemberNames","members","isLegacyOmittedMember","memberValue","record","depth","InvalidSyntaxJson","options","validateSyntaxMembers","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 omitted = new Set(['kind', 'location', 'targetLocation', 'referenceLocation', 'referenceLength', 'nameWasEscaped', 'declaredTriggers', 'directiveLocations']);\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 (typeof value !== 'object' || value === null) return value;\n if (copies.has(value)) return copies.get(value);\n if (Array.isArray(value)) {\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 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(() => {\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.\n if (typeof member === 'object' && member !== null &&\n ((Object.getPrototypeOf(member) !== Object.prototype && Object.getPrototypeOf(member) !== null) || Reflect.ownKeys(member).length !== Object.keys(member).length)) {\n copy[name] = Object.assign(Object.create(null), { numericMode: 'invalid' });\n }\n });\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\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\nfunction write(value: unknown, owningMode = 'legacy', complete = false): SyntaxJsonValue {\n if (Array.isArray(value)) {\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 if (isNode(value)) {\n if (sourceRoots.has(value.kind)) owningMode = validatedSourceOptions((value as unknown as { sourceOptions?: unknown }).sourceOptions ?? legacySourceOptions).numericMode;\n validateSyntaxInvariants(value);\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') {\n const rule = value as ValidationRuleSyntax;\n if (rule.implementation != null) {\n if (rule.file != null) validateClosedSyntaxMembers(rule.file, omitted);\n if (rule.code != null) validateClosedSyntaxMembers(rule.code, omitted);\n }\n }\n const result = Object.create(null) as { [member: string]: SyntaxJsonValue };\n result.kind = value.kind;\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 const known = owningMode === 'exact' ? syntaxMemberNames(value.kind) : undefined;\n const members = Object.keys(structural).filter(member => (known === undefined || known.has(member)) && !(owningMode === 'legacy' && !complete && isLegacyOmittedMember(value, member)) && !omitted.has(member) && !(value.kind === 'OperationSyntax' && member === 'usesLocation')).sort(ordinal);\n for (const member of members) {\n const memberValue = structural[member];\n if (value.kind === 'ApplicationSyntax' && member === 'identity' && memberValue == null) continue;\n if ((value.kind === 'EventSyntax' || value.kind === 'ImportSyntax') && ((member === 'visibility' && memberValue === 'Private') || (member === 'origin' && memberValue == null))) continue;\n if (value.kind === 'SliceSyntax' && member === 'direction' && memberValue == null) continue;\n if ((value.kind === 'ReactionSyntax' || value.kind === 'ReducerSyntax') && member === 'from' && memberValue == null) continue;\n if (value.kind === 'ProducesSyntax' && member === 'stream' && memberValue == null) continue;\n if (value.kind === 'ConceptAttributeSyntax' && (member === 'scope' || member === 'specialCategory') && memberValue == null) continue;\n if (value.kind === 'ConceptAttributeSyntax' && member === 'criminal' && memberValue === false) continue;\n if (value.kind === 'PropertySyntax' && member === 'isSubject' && memberValue === false) continue;\n if (member === 'description' && memberValue == null && ['ConceptSyntax', 'PolicySyntax', 'FileConstraintSyntax', 'UniqueEventConstraintSyntax', 'UniquePropertyConstraintSyntax', 'ProjectionSyntax', 'ScreenSyntax', 'FormSyntax'].includes(value.kind)) continue;\n if (member === 'documentation' && value.kind !== 'EventSyntax' && memberValue == null) continue;\n if (value.kind === 'SpecificationSyntax' && member === 'description' && memberValue == null) continue;\n if (member === 'dependsOn' && (value.kind === 'ModuleSyntax' || value.kind === 'FeatureSyntax') && Array.isArray(memberValue) && memberValue.length === 0) continue;\n if (member === 'sourceOptions' && (memberValue as { numericMode?: string } | undefined)?.numericMode === 'legacy') continue;\n if ((member === 'examples' || value.kind === 'SpecificationSyntax' && (member === 'parameters' || member === 'cases')) && Array.isArray(memberValue) && memberValue.length === 0) continue;\n if (value.kind === 'SpecificationErrorSyntax' && member === 'caseValue' && memberValue == null) continue;\n if (member === 'purposes' && Array.isArray(memberValue) && memberValue.length === 0) continue;\n if (member === 'inlineProperty' && memberValue == null) continue;\n if ((value.kind === 'SpecificationExampleSyntax' || value.kind === 'SpecificationRedeliverySyntax') && (member === 'stream' || member === 'noStream') && memberValue == null) continue;\n if (value.kind === 'SpecificationSyntax' && member === 'thenNoEvents' && memberValue === false) continue;\n if (value.kind === 'SpecificationSyntax' && member === 'whenRedelivered' && memberValue == null) continue;\n if (value.kind === 'InvokesSyntax' && member === 'onRefused' && Array.isArray(memberValue) && memberValue.length === 0) continue;\n result[member] = write(memberValue, owningMode, complete);\n }\n return result;\n }\n if (value === undefined) return null;\n if (typeof value !== 'object' || value === null) return value as SyntaxJsonValue;\n const record = value as Record<string, unknown>;\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 { [member: 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 if (depth > 96 && owningMode === 'exact') throw new InvalidSyntaxJson('Syntax nesting exceeds the supported depth of 96.');\n if (Array.isArray(value)) { for (let index = 0; index < value.length; index++) validateNumbers(value[index], owningMode, depth + 1); return; }\n if (typeof value !== 'object' || value === null) return;\n const node = value as Record<string, unknown>;\n if (sourceRoots.has(node.kind as string) || Object.hasOwn(node, 'sourceOptions')) {\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 owningMode = options.numericMode;\n }\n if (depth === 0 && owningMode === 'exact' && !sourceRoots.has(node.kind as string)) throw new InvalidSyntaxJson('Exact syntax requires a complete source root.');\n if (owningMode === 'exact' && isNode(node)) validateSyntaxMembers(node);\n if (node.kind === 'RawExpressionSyntax' && owningMode === 'exact' && typeof node.text === 'string' && isExactNumberToken(node.text)) throw new InvalidSyntaxJson('An exact numeric operand must be an explicit ExactNumber, not opaque numeric text.');\n if (node.kind === 'LiteralExpressionSyntax' && Object.hasOwn(node, 'value')) {\n if (owningMode === 'exact' && (typeof node.value === 'number' || (node.value !== null && !['string', 'boolean', 'object'].includes(typeof node.value)))) throw new InvalidSyntaxJson('Exact source requires supported primitive values or an explicit ExactNumber literal.');\n if (typeof node.value === 'object' && node.value !== null) {\n const literal = node.value as { literalType?: unknown; value?: unknown };\n if (literal.literalType === 'ExactNumber') {\n if (owningMode !== 'exact' || typeof literal.value !== 'string' || parseExactNumber(literal.value)?.value !== literal.value || Object.keys(literal).length !== 2) throw new InvalidSyntaxJson('Malformed or incompatible ExactNumber literal.');\n } else if (owningMode === 'exact') throw new InvalidSyntaxJson('Exact source refuses old or plain object literal insertion.');\n }\n }\n const known = owningMode === 'exact' && isNode(node) ? syntaxMemberNames(node.kind) : undefined;\n for (const [name, member] of Object.entries(node)) if ((known === undefined || known.has(name) || (isNode(member) && sourceRoots.has(member.kind))) && name !== 'location' && name !== 'targetLocation' && name !== 'usesLocation') validateNumbers(member, owningMode, depth + 1);\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,OAAO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K,OAAU,UAAYA,EAAK,QAAU,KAAM,CACvD,IAAM8B,EAAU9B,EAAK,MACrB,GAAI8B,EAAQ,cAAgB,cACpB,IAAApB,IAAe,SAAW,OAAOoB,EAAQ,OAAU,UAAYC,EAAiBD,EAAQ,KAAK,CAAC,EAAE,QAAUA,EAAQ,OAAS,OAAO,KAAKA,CAAO,CAAC,CAAC,SAAW,EAAG,MAAM,IAAIJ,EAAkB,gDAAgD,CAAA,MAC3O,GAAIhB,IAAe,QAAS,MAAM,IAAIgB,EAAkB,6DAA6D,CAChI,CACJ,CACA,IAAMP,EAAQT,IAAe,SAAW,OAAOV,CAAI,EAAIoB,EAAkBpB,EAAK,IAAI,EAAI,IAAA,GACtF,IAAK,GAAM,CAACQ,EAAMC,KAAW,OAAO,QAAQT,CAAI,GAAQmB,IAAU,IAAA,IAAaA,EAAM,IAAIX,CAAI,GAAM,OAAOC,CAAM,GAAKX,EAAY,IAAIW,EAAO,IAAI,IAAOD,IAAS,YAAcA,IAAS,kBAAoBA,IAAS,gBAAgB,gBAAgBC,EAAQC,EAAYe,EAAQ,CAAC,CACrR,CAEA,SAAS,QAAQ,EAAc,EAAuB,CAClD,OAAOO,EAAOC,EAAQ,GAAK,IAAOA,EACtC"}
@@ -1 +1 @@
1
- import{eventDeclarations as e}from"./EventDeclarations.js";import{operationDeclarations as t}from"./Operations.js";import{AuthoringProductionResolver as n}from"./AuthoringProductionResolver.js";import"./DependencySources.js";import{ScreenplaySyntaxWalker as r}from"./ScreenplaySyntaxWalker.js";import{isExactNumberToken as i,parseExactNumber as a}from"./ExactNumber.js";import{EventSourceCatalog as o}from"./EventSourceCatalog.js";import{implicitDestination as s,requiresExplicitDestinations as c}from"./ProductionDestinations.js";import{InvalidExactNumber as l,canonicalExactText as u,exactIsIntegral as d}from"./ExactMathFacts.js";import"./InvalidSyntaxJson.js";import"./SourceOptions.js";import{sliceTypes as f}from"./Structure.js";import{consumedEvents as p,eventsSourceKind as m,fromSetting as h,isEventsSource as g}from"./CaptureEventsSource.js";import{streamIdFailureMessage as _,tryFormatInteger as v,tryFormatText as y,tryFormatUuidText as b}from"./StreamIdFormatter.js";import{EventSourceReadConfidence as x}from"./EventSourceReadConfidence.js";import"./SyntaxJson.js";import"./StrictSyntaxJson.js";export{n as AuthoringProductionResolver,o as EventSourceCatalog,x as EventSourceReadConfidence,l as InvalidExactNumber,r as ScreenplaySyntaxWalker,u as canonicalExactText,p as consumedEvents,e as eventDeclarations,m as eventsSourceKind,d as exactIsIntegral,h as fromSetting,s as implicitDestination,g as isEventsSource,i as isExactNumberToken,t as operationDeclarations,a as parseExactNumber,c as requiresExplicitDestinations,f as sliceTypes,_ as streamIdFailureMessage,v as tryFormatInteger,y as tryFormatText,b as tryFormatUuidText};
1
+ import{eventDeclarations as e}from"./EventDeclarations.js";import{operationDeclarations as t}from"./Operations.js";import{AuthoringProductionResolver as n}from"./AuthoringProductionResolver.js";import{dependencySourcesOf as r}from"./DependencySources.js";import{ScreenplaySyntaxWalker as i}from"./ScreenplaySyntaxWalker.js";import{isExactNumberToken as a,parseExactNumber as o}from"./ExactNumber.js";import{EventSourceCatalog as s}from"./EventSourceCatalog.js";import{implicitDestination as c,requiresExplicitDestinations as l}from"./ProductionDestinations.js";import{InvalidExactNumber as u,canonicalExactText as d,exactIsIntegral as f}from"./ExactMathFacts.js";import"./InvalidSyntaxJson.js";import"./SourceOptions.js";import{sliceTypes as p}from"./Structure.js";import{consumedEvents as m,eventsSourceKind as h,fromSetting as g,isEventsSource as _}from"./CaptureEventsSource.js";import{streamIdFailureMessage as v,tryFormatInteger as y,tryFormatText as b,tryFormatUuidText as x}from"./StreamIdFormatter.js";import{EventSourceReadConfidence as S}from"./EventSourceReadConfidence.js";import"./SyntaxJson.js";import"./StrictSyntaxJson.js";export{n as AuthoringProductionResolver,s as EventSourceCatalog,S as EventSourceReadConfidence,u as InvalidExactNumber,i as ScreenplaySyntaxWalker,d as canonicalExactText,m as consumedEvents,r as dependencySourcesOf,e as eventDeclarations,h as eventsSourceKind,f as exactIsIntegral,g as fromSetting,c as implicitDestination,_ as isEventsSource,a as isExactNumberToken,t as operationDeclarations,o as parseExactNumber,l as requiresExplicitDestinations,p as sliceTypes,v as streamIdFailureMessage,y as tryFormatInteger,b as tryFormatText,x as tryFormatUuidText};
@@ -1 +1 @@
1
- import{DiagnosticCodes as e}from"./Diagnostics/DiagnosticCodes.js";import{unescapeString as t}from"./Text/StringLiteral.js";import"./Text/patterns.js";import{sourceLocation as n}from"./Diagnostics/SourceLocation.js";import{eventDeclarations as r}from"./Syntax/EventDeclarations.js";import{operationDeclarations as i}from"./Syntax/Operations.js";import{AuthoringProductionResolver as a}from"./Syntax/AuthoringProductionResolver.js";import"./Syntax/DependencySources.js";import{ScreenplaySyntaxWalker as o}from"./Syntax/ScreenplaySyntaxWalker.js";import{isExactNumberToken as s,parseExactNumber as c}from"./Syntax/ExactNumber.js";import{EventSourceCatalog as l}from"./Syntax/EventSourceCatalog.js";import{implicitDestination as u,requiresExplicitDestinations as d}from"./Syntax/ProductionDestinations.js";import{InvalidExactNumber as f,canonicalExactText as p,exactIsIntegral as m}from"./Syntax/ExactMathFacts.js";import{synthesizePersonaCaller as h}from"./Syntax/PersonaCallers.js";import"./Syntax/SpecificationCaseOrigin.js";import"./Parsing/SpecificationCommandExamples.js";import{DeclaredDependencyTargets as g}from"./Dependencies/DeclaredDependencyTargets.js";import{describePlacement as _,documentPlacement as v,isDocumentPlacement as y}from"./Files/PlayPlacement.js";import"./Syntax/InvalidSyntaxJson.js";import"./Syntax/SourceOptions.js";import{isSourceStreamName as b,isSourceStreamTypeName as x,sourceStreamPattern as S}from"./Text/SourceStreamNames.js";import{sliceTypes as C}from"./Syntax/Structure.js";import{consumedEvents as w,eventsSourceKind as T,fromSetting as E,isEventsSource as D}from"./Syntax/CaptureEventsSource.js";import{eventBodyReservedWords as O}from"./Text/ReservedWords.js";import"./Files/AuthoredOrder.js";import{dependencyKinds as k}from"./Dependencies/DependencyKind.js";import{InvalidDependencyQuery as A}from"./Dependencies/InvalidDependencyQuery.js";import{SliceReferenceCollector as j,buildingReadModelReferences as M,referenceClassifications as N,sliceReferences as P}from"./Dependencies/SliceReferences.js";import{stronglyConnectedGroups as F}from"./Dependencies/StronglyConnectedGroups.js";import{DependencyGraph as I}from"./Dependencies/DependencyGraph.js";import{streamIdFailureMessage as L,tryFormatInteger as R,tryFormatText as z,tryFormatUuidText as B}from"./Syntax/StreamIdFormatter.js";import{parseForAuthoring as V}from"./ScreenplayCompiler.js";import{applyQuickFixEdits as H,isQuickFixDiagnostic as U,legacyOptionalTypeLength as W,prepareQuickFixes as G}from"./Authoring/QuickFixes.js";import"./Dependencies/index.js";import{EventSourceReadConfidence as K}from"./Syntax/EventSourceReadConfidence.js";import"./Syntax/SyntaxJson.js";import"./Syntax/index.js";import"./Files/OrderingRoot.js";import{mergeDocuments as q}from"./Files/PlayFolderMerge.js";import"./Files/PlayImports.js";import{parsePlacedDocuments as J}from"./Files/PlayApplicationAssembly.js";export{a as AuthoringProductionResolver,g as DeclaredDependencyTargets,I as DependencyGraph,e as DiagnosticCodes,l as EventSourceCatalog,K as EventSourceReadConfidence,A as InvalidDependencyQuery,f as InvalidExactNumber,o as ScreenplaySyntaxWalker,j as SliceReferenceCollector,H as applyQuickFixEdits,M as buildingReadModelReferences,p as canonicalExactText,w as consumedEvents,k as dependencyKinds,_ as describePlacement,v as documentPlacement,O as eventBodyReservedWords,r as eventDeclarations,T as eventsSourceKind,m as exactIsIntegral,E as fromSetting,u as implicitDestination,y as isDocumentPlacement,D as isEventsSource,s as isExactNumberToken,U as isQuickFixDiagnostic,b as isSourceStreamName,x as isSourceStreamTypeName,W as legacyOptionalTypeLength,q as mergeDocuments,i as operationDeclarations,c as parseExactNumber,V as parseForAuthoring,J as parsePlacedDocuments,G as prepareQuickFixes,N as referenceClassifications,d as requiresExplicitDestinations,P as sliceReferences,C as sliceTypes,n as sourceLocation,S as sourceStreamPattern,L as streamIdFailureMessage,F as stronglyConnectedGroups,h as synthesizePersonaCaller,R as tryFormatInteger,z as tryFormatText,B as tryFormatUuidText,t as unescapeString};
1
+ import{DiagnosticCodes as e}from"./Diagnostics/DiagnosticCodes.js";import{unescapeString as t}from"./Text/StringLiteral.js";import"./Text/patterns.js";import{sourceLocation as n}from"./Diagnostics/SourceLocation.js";import{eventDeclarations as r}from"./Syntax/EventDeclarations.js";import{operationDeclarations as i}from"./Syntax/Operations.js";import{AuthoringProductionResolver as a}from"./Syntax/AuthoringProductionResolver.js";import{dependencySourcesOf as o}from"./Syntax/DependencySources.js";import{ScreenplaySyntaxWalker as s}from"./Syntax/ScreenplaySyntaxWalker.js";import{isExactNumberToken as c,parseExactNumber as l}from"./Syntax/ExactNumber.js";import{EventSourceCatalog as u}from"./Syntax/EventSourceCatalog.js";import{implicitDestination as d,requiresExplicitDestinations as f}from"./Syntax/ProductionDestinations.js";import{InvalidExactNumber as p,canonicalExactText as m,exactIsIntegral as h}from"./Syntax/ExactMathFacts.js";import{synthesizePersonaCaller as g}from"./Syntax/PersonaCallers.js";import"./Syntax/SpecificationCaseOrigin.js";import"./Parsing/SpecificationCommandExamples.js";import{DeclaredDependencyTargets as _}from"./Dependencies/DeclaredDependencyTargets.js";import{describePlacement as v,documentPlacement as y,isDocumentPlacement as b}from"./Files/PlayPlacement.js";import"./Syntax/InvalidSyntaxJson.js";import"./Syntax/SourceOptions.js";import{isSourceStreamName as x,isSourceStreamTypeName as S,sourceStreamPattern as C}from"./Text/SourceStreamNames.js";import{sliceTypes as w}from"./Syntax/Structure.js";import{consumedEvents as T,eventsSourceKind as E,fromSetting as D,isEventsSource as O}from"./Syntax/CaptureEventsSource.js";import{eventBodyReservedWords as k}from"./Text/ReservedWords.js";import"./Files/AuthoredOrder.js";import{dependencyKinds as A}from"./Dependencies/DependencyKind.js";import{InvalidDependencyQuery as j}from"./Dependencies/InvalidDependencyQuery.js";import{SliceReferenceCollector as M,buildingReadModelReferences as N,referenceClassifications as P,sliceReferences as F}from"./Dependencies/SliceReferences.js";import{stronglyConnectedGroups as I}from"./Dependencies/StronglyConnectedGroups.js";import{DependencyGraph as L}from"./Dependencies/DependencyGraph.js";import{streamIdFailureMessage as R,tryFormatInteger as z,tryFormatText as B,tryFormatUuidText as V}from"./Syntax/StreamIdFormatter.js";import{parseForAuthoring as H}from"./ScreenplayCompiler.js";import{applyQuickFixEdits as U,isQuickFixDiagnostic as W,legacyOptionalTypeLength as G,prepareQuickFixes as K}from"./Authoring/QuickFixes.js";import"./Dependencies/index.js";import{EventSourceReadConfidence as q}from"./Syntax/EventSourceReadConfidence.js";import"./Syntax/SyntaxJson.js";import"./Syntax/index.js";import"./Files/OrderingRoot.js";import{mergeDocuments as J}from"./Files/PlayFolderMerge.js";import"./Files/PlayImports.js";import{parsePlacedDocuments as Y}from"./Files/PlayApplicationAssembly.js";export{a as AuthoringProductionResolver,_ as DeclaredDependencyTargets,L as DependencyGraph,e as DiagnosticCodes,u as EventSourceCatalog,q as EventSourceReadConfidence,j as InvalidDependencyQuery,p as InvalidExactNumber,s as ScreenplaySyntaxWalker,M as SliceReferenceCollector,U as applyQuickFixEdits,N as buildingReadModelReferences,m as canonicalExactText,T as consumedEvents,A as dependencyKinds,o as dependencySourcesOf,v as describePlacement,y as documentPlacement,k as eventBodyReservedWords,r as eventDeclarations,E as eventsSourceKind,h as exactIsIntegral,D as fromSetting,d as implicitDestination,b as isDocumentPlacement,O as isEventsSource,c as isExactNumberToken,W as isQuickFixDiagnostic,x as isSourceStreamName,S as isSourceStreamTypeName,G as legacyOptionalTypeLength,J as mergeDocuments,i as operationDeclarations,l as parseExactNumber,H as parseForAuthoring,Y as parsePlacedDocuments,K as prepareQuickFixes,P as referenceClassifications,f as requiresExplicitDestinations,F as sliceReferences,w as sliceTypes,n as sourceLocation,C as sourceStreamPattern,R as streamIdFailureMessage,I as stronglyConnectedGroups,g as synthesizePersonaCaller,z as tryFormatInteger,B as tryFormatText,V as tryFormatUuidText,t as unescapeString};
@@ -7,8 +7,8 @@ import"./_virtual/_virtual/_rolldown/runtime.js";import{identityProperties as e}
7
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:`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
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
- 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:`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
11
- `,documentation:`The code that performs the query — a file reference or an inline csharp/sql block.`}],x=[{label:`file`,insertText:"file ${1:Path}",documentation:`Delegates the query implementation to an external file.`},{label:`csharp`,insertText:fenced(`csharp`),documentation:`Inline C# returning the query result, with the QueryContext in scope as context.`},{label:`sql`,insertText:fenced(`sql`),documentation:`Inline SQL returning the query result.`}],S=[{label:`description`,insertText:'description "${1:invariant intent}"',documentation:`Report-only description, distinct from the violation message.`},{label:`unique`,insertText:"unique ${1:property} on ${2:EventType}",documentation:`Enforces a unique property value across an event type.`},{label:`unique event`,insertText:"unique event ${1:EventType}",documentation:`Enforces that the event type occurs at most once per event source.`},{label:`file`,insertText:"file ${1:Path}",documentation:`Delegates the constraint to a custom C# implementation.`}],C=[t,{label:`runs as system`,insertText:`runs as system`,documentation:`Authenticated system identity with no roles for returned commands. Admitted by ESM v10 (claimed, unreleased); claims are unknown.`},{label:`runs as system role`,insertText:'runs as system role "${1:Role}"',documentation:`Exact system roles for every returned or invoked command, not imperative pipeline calls. Admitted by ESM v10 (claimed, unreleased); claims are unknown.`},{label:`description`,insertText:'description "${1:what this reaction does}"',documentation:`What the reaction does — a complete statement of intent before any code exists.`},{label:`when`,insertText:"when ${1:Trigger}",documentation:`An event, a declared trigger or a host signal that sets the reaction off. A trigger needs no body.`},{label:`every`,insertText:"every ${1:15} ${2|seconds,minutes,hours,days|}",documentation:`Runs the reaction on an interval.`},{label:`at`,insertText:"at ${1:08:00}",documentation:"Runs the reaction at a time of day — every day unless narrowed with `on <Weekday>` or `on day <n>`."},{label:`where`,insertText:"where ${1:condition}",documentation:`Narrows which occurrences actually run the reaction.`}],w=[{label:`reads`,insertText:"reads ${1:View}",documentation:"The view this trigger consults. Optionally use `as <alias> by <trigger value>`; clock triggers take no values and cannot use `by`."},{label:`description`,insertText:'description "${1:what this reaction does}"',documentation:`What this particular reaction does — enough on its own, with no file to point at.`},{label:`produces`,insertText:"produces ${1:EventType}",documentation:`An event the reaction appends.`},{label:`invokes`,insertText:"invokes ${1:Command}",documentation:`A command the reaction hands on. A command is asked for, not produced — it may still be rejected.`},{label:`file`,insertText:"file ${1:Path}",documentation:`Delegates the reaction to an external C# file.`},{label:`csharp`,insertText:fenced(`csharp`),documentation:`Inline C# returning event side effects.`}],T=`Syntax-only; reaction refusal handling and redelivery are not yet executable (PLAY0268).`,E=[{label:`on refused`,insertText:`on refused
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
11
+ `,documentation:`The code that performs the query — a file reference or an inline csharp/sql block.`}],x=[{label:`file`,insertText:"file ${1:Path}",documentation:`Delegates the query implementation to an external file.`},{label:`csharp`,insertText:fenced(`csharp`),documentation:`Inline C# returning the query result, with the QueryContext in scope as context.`},{label:`sql`,insertText:fenced(`sql`),documentation:`Inline SQL returning the query result.`}],S=[{label:`description`,insertText:'description "${1:invariant intent}"',documentation:`Report-only description, distinct from the violation message.`},{label:`unique`,insertText:"unique ${1:property} on ${2:EventType}",documentation:`Enforces a unique property value across an event type.`},{label:`unique event`,insertText:"unique event ${1:EventType}",documentation:`Enforces that the event type occurs at most once per event source.`},{label:`file`,insertText:"file ${1:Path}",documentation:`Delegates the constraint to a custom C# implementation.`}],C=[t,{label:`from`,insertText:"from ${1:Source.Stream}",documentation:`Observe matching routed facts only, without filtering stream ids. ESM v10.`},{label:`runs as system`,insertText:`runs as system`,documentation:`Authenticated system identity with no roles for returned commands. Admitted by ESM v10 (claimed, unreleased); claims are unknown.`},{label:`runs as system role`,insertText:'runs as system role "${1:Role}"',documentation:`Exact system roles for every returned or invoked command, not imperative pipeline calls. Admitted by ESM v10 (claimed, unreleased); claims are unknown.`},{label:`description`,insertText:'description "${1:what this reaction does}"',documentation:`What the reaction does — a complete statement of intent before any code exists.`},{label:`when`,insertText:"when ${1:Trigger}",documentation:`An event, a declared trigger or a host signal that sets the reaction off. A trigger needs no body.`},{label:`every`,insertText:"every ${1:15} ${2|seconds,minutes,hours,days|}",documentation:`Runs the reaction on an interval.`},{label:`at`,insertText:"at ${1:08:00}",documentation:"Runs the reaction at a time of day — every day unless narrowed with `on <Weekday>` or `on day <n>`."},{label:`where`,insertText:"where ${1:condition}",documentation:`Narrows which occurrences actually run the reaction.`}],w=[{label:`reads`,insertText:"reads ${1:View}",documentation:"The view this trigger consults. Optionally use `as <alias> by <trigger value>`; clock triggers take no values and cannot use `by`."},{label:`description`,insertText:'description "${1:what this reaction does}"',documentation:`What this particular reaction does — enough on its own, with no file to point at.`},{label:`produces`,insertText:"produces ${1:EventType}",documentation:`An event the reaction appends.`},{label:`invokes`,insertText:"invokes ${1:Command}",documentation:`A command the reaction hands on. A command is asked for, not produced — it may still be rejected.`},{label:`file`,insertText:"file ${1:Path}",documentation:`Delegates the reaction to an external C# file.`},{label:`csharp`,insertText:fenced(`csharp`),documentation:`Inline C# returning event side effects.`}],T=`Syntax-only; reaction refusal handling and redelivery are not yet executable (PLAY0268).`,E=[{label:`on refused`,insertText:`on refused
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 validation 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