@cratis/screenplay-language 4.247.3 → 4.249.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/dist/action-subject-authoring.d.ts +2 -0
  2. package/dist/action-subject-authoring.d.ts.map +1 -0
  3. package/dist/bundles/action-subject-authoring.js +2 -0
  4. package/dist/bundles/action-subject-authoring.js.map +1 -0
  5. package/dist/bundles/compiler/Authoring/ActionSubjectQuickFixes.js +6 -0
  6. package/dist/bundles/compiler/Authoring/ActionSubjectQuickFixes.js.map +1 -0
  7. package/dist/bundles/compiler/Authoring/QuickFixes.js +1 -1
  8. package/dist/bundles/compiler/Authoring/QuickFixes.js.map +1 -1
  9. package/dist/bundles/compiler/Diagnostics/DiagnosticCodes.js +1 -1
  10. package/dist/bundles/compiler/Diagnostics/DiagnosticCodes.js.map +1 -1
  11. package/dist/bundles/compiler/Parsing/ActionSubjectClause.js +2 -0
  12. package/dist/bundles/compiler/Parsing/ActionSubjectClause.js.map +1 -0
  13. package/dist/bundles/compiler/Parsing/ActionSubjectInputs.js +2 -0
  14. package/dist/bundles/compiler/Parsing/ActionSubjectInputs.js.map +1 -0
  15. package/dist/bundles/compiler/Parsing/ActionSubjectResolution.js +2 -0
  16. package/dist/bundles/compiler/Parsing/ActionSubjectResolution.js.map +1 -0
  17. package/dist/bundles/compiler/Parsing/GuardedActionValidator.js +1 -1
  18. package/dist/bundles/compiler/Parsing/GuardedActionValidator.js.map +1 -1
  19. package/dist/bundles/compiler/Parsing/ScreenParser.js +1 -1
  20. package/dist/bundles/compiler/Parsing/ScreenParser.js.map +1 -1
  21. package/dist/bundles/compiler/ScreenActionSubjects.js +2 -0
  22. package/dist/bundles/compiler/ScreenActionSubjects.js.map +1 -0
  23. package/dist/bundles/compiler/Syntax/ActionSubjectInvariants.js +2 -0
  24. package/dist/bundles/compiler/Syntax/ActionSubjectInvariants.js.map +1 -0
  25. package/dist/bundles/compiler/Syntax/ScreenplaySyntaxWalker.js +1 -1
  26. package/dist/bundles/compiler/Syntax/ScreenplaySyntaxWalker.js.map +1 -1
  27. package/dist/bundles/compiler/Syntax/SyntaxCollections.js +1 -1
  28. package/dist/bundles/compiler/Syntax/SyntaxCollections.js.map +1 -1
  29. package/dist/bundles/compiler/Syntax/SyntaxInvariants.js +1 -1
  30. package/dist/bundles/compiler/Syntax/SyntaxInvariants.js.map +1 -1
  31. package/dist/bundles/compiler/Syntax/SyntaxJson.js +1 -1
  32. package/dist/bundles/compiler/Syntax/SyntaxJson.js.map +1 -1
  33. package/dist/bundles/compiler/index.js +1 -1
  34. package/dist/bundles/completion-items.js +4 -4
  35. package/dist/bundles/completion-items.js.map +1 -1
  36. package/dist/bundles/completion-planner.js +2 -2
  37. package/dist/bundles/completion-planner.js.map +1 -1
  38. package/dist/bundles/diagnostic-codes.js +1 -1
  39. package/dist/bundles/diagnostic-codes.js.map +1 -1
  40. package/dist/bundles/hover-content.js +5 -5
  41. package/dist/bundles/hover-content.js.map +1 -1
  42. package/dist/bundles/tokens.js +1 -1
  43. package/dist/bundles/tokens.js.map +1 -1
  44. package/dist/bundles/validation.js +1 -1
  45. package/dist/bundles/validation.js.map +1 -1
  46. package/dist/completion-items.d.ts +2 -0
  47. package/dist/completion-items.d.ts.map +1 -1
  48. package/dist/completion-planner.d.ts.map +1 -1
  49. package/dist/diagnostic-codes.d.ts +5 -0
  50. package/dist/diagnostic-codes.d.ts.map +1 -1
  51. package/dist/hover-content.d.ts.map +1 -1
  52. package/dist/tokens.d.ts.map +1 -1
  53. 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","numbers","number","validation","rule","generation","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 { GenerationSyntax } from './GenerationSyntax';\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 if (concept.valueNumbers != null) {\n const numbers = concept.valueNumbers;\n if (concept.type !== 'Enum' || !Array.isArray(numbers) || numbers.length !== concept.values.length || numbers.some(number => !Number.isInteger(number) || number < -2147483648 || number > 2147483647) || new Set(numbers).size !== numbers.length) refuse('Explicit enum numbers require an Enum concept, one number per value, and unique int32 numbers.');\n }\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 === 'GenerationSyntax') {\n const generation = node as GenerationSyntax;\n if (generation.file != null || generation.code != null) {\n if (generation.strategy !== 'rule' || typeof generation.rule !== 'string' || !/^[A-Za-z_][A-Za-z0-9_]*$(?![\\s\\S])/.test(generation.rule)) refuse('A generation body requires a named generation rule.');\n if (generation.file != null && generation.code != null) refuse('A generation rule has exactly one file or inline payload.');\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":"2XAoBA,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,GAAIC,EAAQ,cAAgB,KAAM,CAC9B,IAAMC,EAAUD,EAAQ,cACpBA,EAAQ,OAAS,QAAU,CAAC,MAAM,QAAQC,CAAO,GAAKA,EAAQ,SAAWD,EAAQ,OAAO,QAAUC,EAAQ,KAAK,GAAU,CAAC,OAAO,UAAUC,CAAM,GAAKA,EAAS,aAAeA,EAAS,UAAU,GAAK,IAAI,IAAID,CAAO,CAAC,CAAC,OAASA,EAAQ,SAAQ,OAAO,gGAAgG,CAC/V,CACA,IAAK,IAAME,KAAcH,EAAQ,aAAe,CAAC,EACzCG,EAAW,OAAS,6BAA+BA,EAAW,MAAM,KAAK,GAAQC,EAAK,gBAAkB,IAAI,GAAG,OAAO,wEAAwE,CAE1M,CACA,GAAIL,EAAK,OAAS,mBAAoB,CAClC,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S,sBAAuB,CACrC,IAAM2B,EAAQ3B,EACd,KAAK2B,EAAM,WAAW,EACtB,KAAKA,EAAM,MAAM,EACbA,EAAM,WAAa,MAAQA,EAAM,SAAS,WAAa,YAAY,OAAO,sCAAsC,EACpH,SAASA,EAAM,SAAUA,EAAM,aAAa,EAC5C,IAAME,EAAYF,EAAM,kBACpBE,IAAc,OAASA,EAAU,OAAS,UAAYA,EAAU,KAAK,OAAS,GAAGF,EAAM,YAAY,GAAGA,EAAM,UAAYE,EAAU,KAAK,cAAgBA,EAAU,KAAK,YAAcA,EAAU,aAAeA,EAAU,cAAgBF,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","validateActionSubject","node","metadataError","publicEventMetadataError","concept","numbers","number","validation","rule","generation","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 { GenerationSyntax } from './GenerationSyntax';\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 { validateActionSubject } from './ActionSubjectInvariants';\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 validateActionSubject(node, collection);\n const metadataError = publicEventMetadataError(node);\n if (metadataError !== undefined) refuse(metadataError);\n if (node.kind === 'ConceptSyntax') {\n const concept = node as ConceptSyntax;\n if (concept.valueNumbers != null) {\n const numbers = concept.valueNumbers;\n if (concept.type !== 'Enum' || !Array.isArray(numbers) || numbers.length !== concept.values.length || numbers.some(number => !Number.isInteger(number) || number < -2147483648 || number > 2147483647) || new Set(numbers).size !== numbers.length) refuse('Explicit enum numbers require an Enum concept, one number per value, and unique int32 numbers.');\n }\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 === 'GenerationSyntax') {\n const generation = node as GenerationSyntax;\n if (generation.file != null || generation.code != null) {\n if (generation.strategy !== 'rule' || typeof generation.rule !== 'string' || !/^[A-Za-z_][A-Za-z0-9_]*$(?![\\s\\S])/.test(generation.rule)) refuse('A generation body requires a named generation rule.');\n if (generation.file != null && generation.code != null) refuse('A generation rule has exactly one file or inline payload.');\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":"gcAqBA,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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"}
@@ -1,2 +1,2 @@
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`,isObject=e=>typeof e==`object`&&!!e,u=/* @__PURE__ */ new Set([`kind`,`location`,`targetLocation`,`referenceLocation`,`referenceLength`,`nameWasEscaped`,`declaredTriggers`,`directiveLocations`]),d=/* @__PURE__ */ new Set([`location`,`targetLocation`,`usesLocation`]),f=/* @__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){return isObject(e)?t.has(e)?t.get(e):Array.isArray(e)?detachArray(e):detachObject(e):e}function detachArray(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}function detachObject(e){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(()=>preserveRejectedSourceOptions(r,a,o)),r[a]=detach(o)});return r}let r=detach(e);for(;n.length>0;)n.pop()();return r}function preserveRejectedSourceOptions(e,t,n){isObject(n)&&hasExoticShape(n)&&(e[t]=Object.assign(Object.create(null),{numericMode:`invalid`}))}function hasExoticShape(e){return Object.getPrototypeOf(e)!==Object.prototype&&Object.getPrototypeOf(e)!==null||Reflect.ownKeys(e).length!==Object.keys(e).length}function dataArray(){let e=[];return Object.defineProperty(e,"toJSON",{value:void 0}),e}const p={ApplicationSyntax:[`identity`,`reactionProductionMode`,`commandReadMode`,`timeZone`],CommandSyntax:[`calendar`],ComparisonConditionSyntax:[`leftExpression`],EventSyntax:[`origin`],ImportSyntax:[`origin`],SliceSyntax:[`direction`],ReactionSyntax:[`from`],ReducerSyntax:[`from`],RemoveWithSyntax:[`partsKey`],ProducesSyntax:[`stream`],ConceptAttributeSyntax:[`scope`,`specialCategory`],ConceptSyntax:[`description`,`valueNumbers`,`generation`],GenerationSyntax:[`file`,`code`],PolicySyntax:[`description`],FileConstraintSyntax:[`description`],UniqueEventConstraintSyntax:[`description`],UniquePropertyConstraintSyntax:[`description`],ProjectionSyntax:[`description`],ScreenSyntax:[`description`],FormSyntax:[`description`],SpecificationSyntax:[`description`,`whenRedelivered`,`givenTimeZone`],SpecificationErrorSyntax:[`caseValue`],SpecificationExampleSyntax:[`stream`,`noStream`],SpecificationRedeliverySyntax:[`stream`,`noStream`]},m={ModuleSyntax:[`dependsOn`],FeatureSyntax:[`dependsOn`],SpecificationSyntax:[`parameters`,`cases`],InvokesSyntax:[`onRefused`]},h={EventSyntax:{visibility:`Private`},ImportSyntax:{visibility:`Private`},ConceptAttributeSyntax:{criminal:!1},PropertySyntax:{isSubject:!1},SpecificationSyntax:{thenNoEvents:!1}},ownEntry=(e,t)=>Object.hasOwn(e,t)?e[t]:void 0,isEmptyArray=e=>Array.isArray(e)&&e.length===0;function isNullOmitted(e,t,n){return n==null?ownEntry(p,e)?.includes(t)===!0||t===`inlineProperty`||t===`documentation`&&e!==`EventSyntax`:!1}function isEmptyOmitted(e,t,n){return isEmptyArray(n)?ownEntry(m,e)?.includes(t)===!0||t===`examples`||t===`purposes`:!1}function isDefaultOmitted(e,t,n){if(t===`sourceOptions`)return n?.numericMode===`legacy`;let r=ownEntry(h,e);return r!==void 0&&Object.hasOwn(r,t)&&n===r[t]}function isOmittedByDefault(e,t,n){return isNullOmitted(e,t,n)||isEmptyOmitted(e,t,n)||isDefaultOmitted(e,t,n)}function write(e,t=`legacy`,n=!1){return Array.isArray(e)?writeArray(e,t,n):isNode(e)?writeNode(e,t,n):e===void 0?null:isObject(e)?writeRecord(e,t,n):e}function writeArray(e,t,n){let r=dataArray();for(let i=0;i<e.length;i++)r.push(write(e[i],t,n));return r}function validateClosedImplementationShapes(e){if((e.kind===`ImplementationSyntax`||e.kind===`ImplementationHintSyntax`)&&s(e,u),e.kind!==`ValidationRuleSyntax`)return;let t=e;t.implementation!=null&&(t.file!=null&&s(t.file,u),t.code!=null&&s(t.code,u))}function structuralMembers(e){let t={...e};return e.kind===`ApplicationSyntax`&&t.eventSources===void 0&&(t.eventSources=[]),e.kind===`CommandSyntax`&&t.stream===void 0&&(t.stream=null),e.kind===`CommandSyntax`&&t.streamCandidates===void 0&&(t.streamCandidates=[]),t}function projectedMemberNames(e,t,n,r){let i=n===`exact`?o(e.kind):void 0,isProjected=t=>(i===void 0||i.has(t))&&!isHiddenByLegacy(e,t,n,r)&&!isAlwaysOmitted(e,t);return Object.keys(t).filter(isProjected).sort(ordinal)}function isHiddenByLegacy(e,t,n,r){return n===`legacy`&&!r&&l(e,t)}function isAlwaysOmitted(e,t){return u.has(t)||e.kind===`OperationSyntax`&&t===`usesLocation`}function writeNode(e,t,n){f.has(e.kind)&&(t=i(e.sourceOptions??r).numericMode),a(e),validateClosedImplementationShapes(e);let o=Object.create(null);o.kind=e.kind;let s=structuralMembers(e);for(let r of projectedMemberNames(e,s,t,n)){let i=s[r];isOmittedByDefault(e.kind,r,i)||(o[r]=write(i,t,n))}return o}function writeRecord(e,t,n){let r=Object.create(null);if(e.literalType===`ExactNumber`)return r.literalType=`ExactNumber`,r.value=e.value,r;for(let i of Object.keys(e))i!==`toJSON`&&e[i]!==void 0&&(r[i]=write(e[i],t,n));return r}function validateNumbers(e,t,n){if(assertSupportedDepth(t,n),Array.isArray(e))for(let r=0;r<e.length;r++)validateNumbers(e[r],t,n+1);else isObject(e)&&validateNodeNumbers(e,t,n)}function validateNodeNumbers(e,t,n){t=resolveNumericMode(e,t,n),assertCompleteSourceRoot(e,t,n),t===`exact`&&isNode(e)&&c(e),validateRawNumericText(e,t),e.kind===`LiteralExpressionSyntax`&&Object.hasOwn(e,`value`)&&validateLiteralValue(e.value,t),validateNumberMembers(e,t,n)}function assertSupportedDepth(e,t){if(t>96&&e===`exact`)throw new n(`Syntax nesting exceeds the supported depth of 96.`)}function assertCompleteSourceRoot(e,t,r){if(isIncompleteExactRoot(e,t,r))throw new n(`Exact syntax requires a complete source root.`)}function isIncompleteExactRoot(e,t,n){return n===0&&t===`exact`&&!f.has(e.kind)}function resolveNumericMode(e,t,a){if(!f.has(e.kind)&&!Object.hasOwn(e,`sourceOptions`))return t;let o=Object.hasOwn(e,`sourceOptions`)?i(e.sourceOptions):r;if(a>0&&t!==o.numericMode)throw new n(`Conflicting source numeric options.`);return o.numericMode}function validateRawNumericText(t,r){if(t.kind===`RawExpressionSyntax`&&r===`exact`&&typeof t.text==`string`&&e(t.text))throw new n(`An exact numeric operand must be an explicit ExactNumber, not opaque numeric text.`)}function isUnsupportedExactPrimitive(e){return typeof e==`number`||e!==null&&![`string`,`boolean`,`object`].includes(typeof e)}function validateLiteralValue(e,t){if(t===`exact`&&isUnsupportedExactPrimitive(e))throw new n(`Exact source requires supported primitive values or an explicit ExactNumber literal.`);isObject(e)&&validateObjectLiteral(e,t)}function validateObjectLiteral(e,t){if(e.literalType===`ExactNumber`)validateExactNumberLiteral(e,t);else if(t===`exact`)throw new n(`Exact source refuses old or plain object literal insertion.`)}function isWellFormedExactNumber(e){return typeof e.value==`string`&&t(e.value)?.value===e.value&&Object.keys(e).length===2}function validateExactNumberLiteral(e,t){if(t!==`exact`||!isWellFormedExactNumber(e))throw new n(`Malformed or incompatible ExactNumber literal.`)}function validateNumberMembers(e,t,n){let r=t===`exact`&&isNode(e)?o(e.kind):void 0;for(let[i,a]of Object.entries(e))isTraversedMember(r,i,a)&&validateNumbers(a,t,n+1)}function isTraversedMember(e,t,n){return(e===void 0||e.has(t)||isNode(n)&&f.has(n.kind))&&!d.has(t)}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`,isObject=e=>typeof e==`object`&&!!e,u=/* @__PURE__ */ new Set([`kind`,`location`,`targetLocation`,`referenceLocation`,`referenceLength`,`nameWasEscaped`,`declaredTriggers`,`directiveLocations`]),d=/* @__PURE__ */ new Set([`location`,`targetLocation`,`usesLocation`]),f=/* @__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){return isObject(e)?t.has(e)?t.get(e):Array.isArray(e)?detachArray(e):detachObject(e):e}function detachArray(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}function detachObject(e){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(()=>preserveRejectedSourceOptions(r,a,o)),r[a]=detach(o)});return r}let r=detach(e);for(;n.length>0;)n.pop()();return r}function preserveRejectedSourceOptions(e,t,n){isObject(n)&&hasExoticShape(n)&&(e[t]=Object.assign(Object.create(null),{numericMode:`invalid`}))}function hasExoticShape(e){return Object.getPrototypeOf(e)!==Object.prototype&&Object.getPrototypeOf(e)!==null||Reflect.ownKeys(e).length!==Object.keys(e).length}function dataArray(){let e=[];return Object.defineProperty(e,"toJSON",{value:void 0}),e}const p={ApplicationSyntax:[`identity`,`reactionProductionMode`,`commandReadMode`,`timeZone`],CommandSyntax:[`calendar`],ComparisonConditionSyntax:[`leftExpression`],EventSyntax:[`origin`],ImportSyntax:[`origin`],SliceSyntax:[`direction`],ReactionSyntax:[`from`],ReducerSyntax:[`from`],RemoveWithSyntax:[`partsKey`],ProducesSyntax:[`stream`],ConceptAttributeSyntax:[`scope`,`specialCategory`],ConceptSyntax:[`description`,`valueNumbers`,`generation`],GenerationSyntax:[`file`,`code`],PolicySyntax:[`description`],FileConstraintSyntax:[`description`],UniqueEventConstraintSyntax:[`description`],UniquePropertyConstraintSyntax:[`description`],ProjectionSyntax:[`description`],ScreenSyntax:[`description`],ScreenActionSyntax:[`subject`],ScreenGuardedActionSyntax:[`subject`],ToolbarItemSyntax:[`subject`],FormSyntax:[`description`],SpecificationSyntax:[`description`,`whenRedelivered`,`givenTimeZone`],SpecificationErrorSyntax:[`caseValue`],SpecificationExampleSyntax:[`stream`,`noStream`],SpecificationRedeliverySyntax:[`stream`,`noStream`]},m={ScreenActionSyntax:[`inputs`],ModuleSyntax:[`dependsOn`],FeatureSyntax:[`dependsOn`],SpecificationSyntax:[`parameters`,`cases`],InvokesSyntax:[`onRefused`]},h={EventSyntax:{visibility:`Private`},ImportSyntax:{visibility:`Private`},ConceptAttributeSyntax:{criminal:!1},PropertySyntax:{isSubject:!1},SpecificationSyntax:{thenNoEvents:!1}},ownEntry=(e,t)=>Object.hasOwn(e,t)?e[t]:void 0,isEmptyArray=e=>Array.isArray(e)&&e.length===0;function isNullOmitted(e,t,n){return n==null?ownEntry(p,e)?.includes(t)===!0||t===`inlineProperty`||t===`documentation`&&e!==`EventSyntax`:!1}function isEmptyOmitted(e,t,n){return isEmptyArray(n)?ownEntry(m,e)?.includes(t)===!0||t===`examples`||t===`purposes`:!1}function isDefaultOmitted(e,t,n){if(t===`sourceOptions`)return n?.numericMode===`legacy`;let r=ownEntry(h,e);return r!==void 0&&Object.hasOwn(r,t)&&n===r[t]}function isOmittedByDefault(e,t,n){return isNullOmitted(e,t,n)||isEmptyOmitted(e,t,n)||isDefaultOmitted(e,t,n)}function write(e,t=`legacy`,n=!1){return Array.isArray(e)?writeArray(e,t,n):isNode(e)?writeNode(e,t,n):e===void 0?null:isObject(e)?writeRecord(e,t,n):e}function writeArray(e,t,n){let r=dataArray();for(let i=0;i<e.length;i++)r.push(write(e[i],t,n));return r}function validateClosedImplementationShapes(e){if((e.kind===`ImplementationSyntax`||e.kind===`ImplementationHintSyntax`)&&s(e,u),e.kind!==`ValidationRuleSyntax`)return;let t=e;t.implementation!=null&&(t.file!=null&&s(t.file,u),t.code!=null&&s(t.code,u))}function structuralMembers(e){let t={...e};return e.kind===`ApplicationSyntax`&&t.eventSources===void 0&&(t.eventSources=[]),e.kind===`CommandSyntax`&&t.stream===void 0&&(t.stream=null),e.kind===`CommandSyntax`&&t.streamCandidates===void 0&&(t.streamCandidates=[]),t}function projectedMemberNames(e,t,n,r){let i=n===`exact`?o(e.kind):void 0,isProjected=t=>(i===void 0||i.has(t))&&!isHiddenByLegacy(e,t,n,r)&&!isAlwaysOmitted(e,t);return Object.keys(t).filter(isProjected).sort(ordinal)}function isHiddenByLegacy(e,t,n,r){return n===`legacy`&&!r&&l(e,t)}function isAlwaysOmitted(e,t){return u.has(t)||e.kind===`OperationSyntax`&&t===`usesLocation`}function writeNode(e,t,n){f.has(e.kind)&&(t=i(e.sourceOptions??r).numericMode),a(e),validateClosedImplementationShapes(e);let o=Object.create(null);o.kind=e.kind;let s=structuralMembers(e);for(let r of projectedMemberNames(e,s,t,n)){let i=s[r];isOmittedByDefault(e.kind,r,i)||(o[r]=write(i,t,n))}return o}function writeRecord(e,t,n){let r=Object.create(null);if(e.literalType===`ExactNumber`)return r.literalType=`ExactNumber`,r.value=e.value,r;for(let i of Object.keys(e))i!==`toJSON`&&e[i]!==void 0&&(r[i]=write(e[i],t,n));return r}function validateNumbers(e,t,n){if(assertSupportedDepth(t,n),Array.isArray(e))for(let r=0;r<e.length;r++)validateNumbers(e[r],t,n+1);else isObject(e)&&validateNodeNumbers(e,t,n)}function validateNodeNumbers(e,t,n){t=resolveNumericMode(e,t,n),assertCompleteSourceRoot(e,t,n),t===`exact`&&isNode(e)&&c(e),validateRawNumericText(e,t),e.kind===`LiteralExpressionSyntax`&&Object.hasOwn(e,`value`)&&validateLiteralValue(e.value,t),validateNumberMembers(e,t,n)}function assertSupportedDepth(e,t){if(t>96&&e===`exact`)throw new n(`Syntax nesting exceeds the supported depth of 96.`)}function assertCompleteSourceRoot(e,t,r){if(isIncompleteExactRoot(e,t,r))throw new n(`Exact syntax requires a complete source root.`)}function isIncompleteExactRoot(e,t,n){return n===0&&t===`exact`&&!f.has(e.kind)}function resolveNumericMode(e,t,a){if(!f.has(e.kind)&&!Object.hasOwn(e,`sourceOptions`))return t;let o=Object.hasOwn(e,`sourceOptions`)?i(e.sourceOptions):r;if(a>0&&t!==o.numericMode)throw new n(`Conflicting source numeric options.`);return o.numericMode}function validateRawNumericText(t,r){if(t.kind===`RawExpressionSyntax`&&r===`exact`&&typeof t.text==`string`&&e(t.text))throw new n(`An exact numeric operand must be an explicit ExactNumber, not opaque numeric text.`)}function isUnsupportedExactPrimitive(e){return typeof e==`number`||e!==null&&![`string`,`boolean`,`object`].includes(typeof e)}function validateLiteralValue(e,t){if(t===`exact`&&isUnsupportedExactPrimitive(e))throw new n(`Exact source requires supported primitive values or an explicit ExactNumber literal.`);isObject(e)&&validateObjectLiteral(e,t)}function validateObjectLiteral(e,t){if(e.literalType===`ExactNumber`)validateExactNumberLiteral(e,t);else if(t===`exact`)throw new n(`Exact source refuses old or plain object literal insertion.`)}function isWellFormedExactNumber(e){return typeof e.value==`string`&&t(e.value)?.value===e.value&&Object.keys(e).length===2}function validateExactNumberLiteral(e,t){if(t!==`exact`||!isWellFormedExactNumber(e))throw new n(`Malformed or incompatible ExactNumber literal.`)}function validateNumberMembers(e,t,n){let r=t===`exact`&&isNode(e)?o(e.kind):void 0;for(let[i,a]of Object.entries(e))isTraversedMember(r,i,a)&&validateNumbers(a,t,n+1)}function isTraversedMember(e,t,n){return(e===void 0||e.has(t)||isNode(n)&&f.has(n.kind))&&!d.has(t)}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","skippedNumberMembers","sourceRoots","detached","node","copies","pending","items","length","index","copy","names","name","member","omittedWhenNull","omittedWhenEmpty","omittedWhenDefault","table","kind","defaults","owningMode","complete","validateClosedSyntaxMembers","rule","structural","known","syntaxMemberNames","isLegacyOmittedMember","validatedSourceOptions","legacySourceOptions","validateSyntaxInvariants","result","memberValue","record","depth","validateSyntaxMembers","InvalidSyntaxJson","options","isExactNumberToken","literal","parseExactNumber","left","right"],"sources":["../../../../../../Compiler/Syntax/SyntaxJson.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { SyntaxNode } from './SyntaxNode';\nimport { InvalidSyntaxJson } from './InvalidSyntaxJson';\nimport { isExactNumberToken, parseExactNumber } from './ExactNumber';\nimport { validateSyntaxInvariants } from './SyntaxInvariants';\nimport { syntaxMemberNames, validateClosedSyntaxMembers, validateSyntaxMembers } from './SyntaxMemberContracts';\nimport { ValidationRuleSyntax } from './Commands';\nimport { isLegacyOmittedMember } from './LegacyWireProjection';\nimport { legacySourceOptions, validatedSourceOptions } from './SourceOptions';\n\n// Returned record objects have null prototypes.\nexport type SyntaxJsonValue = string | number | boolean | null | SyntaxJsonValue[] | { [member: string]: SyntaxJsonValue };\n\nconst isNode = (value: unknown): value is SyntaxNode =>\n typeof value === 'object' && value !== null && typeof (value as { kind?: unknown }).kind === 'string';\nconst isObject = (value: unknown): value is object => typeof value === 'object' && value !== null;\nconst omitted = new Set(['kind', 'location', 'targetLocation', 'referenceLocation', 'referenceLength', 'nameWasEscaped', 'declaredTriggers', 'directiveLocations']);\nconst skippedNumberMembers = new Set(['location', 'targetLocation', 'usesLocation']);\nconst sourceRoots = new Set(['ApplicationSyntax', 'ProjectionSyntax', 'CaptureSyntax', 'SpecificationSyntax']);\n\n// The canonical JSON form of a syntax tree, the same form the C# SyntaxJson writes: 'kind' first, then the\n// members in ordinal order, with source locations left out. Because a node only carries the members this\n// compiler models, the result is the C# form narrowed to those members.\nexport function toSyntaxJson(node: SyntaxNode): SyntaxJsonValue {\n const detached = snapshot(node);\n validateNumbers(detached, 'legacy', 0);\n return write(detached);\n}\n\n// The enriched internal tree written completely, Legacy members included. Not a wire form: it exists so the\n// walker and other tree consumers can be held to every node the parser builds.\nexport function toCompleteSyntaxJson(node: SyntaxNode): SyntaxJsonValue {\n const detached = snapshot(node);\n validateNumbers(detached, 'legacy', 0);\n return write(detached, 'legacy', true);\n}\n\n// Read caller-owned properties only once, before validation. Both validation and projection see the same\n// detached data; accessors, proxies and shared references cannot change it between passes.\nfunction snapshot(value: unknown): unknown {\n const copies = new WeakMap<object, unknown>();\n const pending: (() => void)[] = [];\n // Schedule depth-first reads without consuming the call stack, including for ignored metadata.\n function detach(value: unknown): unknown {\n if (!isObject(value)) return value;\n if (copies.has(value)) return copies.get(value);\n return Array.isArray(value) ? detachArray(value) : detachObject(value);\n }\n function detachArray(value: unknown[]): unknown {\n const items = dataArray<unknown>();\n copies.set(value, items);\n const length = value.length;\n for (let index = length - 1; index >= 0; index--) pending.push(() => {\n items[index] = detach(Object.hasOwn(value, index) ? value[index] : undefined);\n });\n return items;\n }\n function detachObject(value: object): unknown {\n const copy = Object.create(null) as Record<string, unknown>;\n copies.set(value, copy);\n const names = Object.keys(value);\n // Node identity also accepts inherited, hidden and class-getter kinds; read it just once.\n if (!names.includes('kind') && 'kind' in value) names.unshift('kind');\n for (let index = names.length - 1; index >= 0; index--) pending.push(() => {\n const name = names[index];\n const member = (value as Record<string, unknown>)[name];\n if (name === 'sourceOptions') pending.push(() => preserveRejectedSourceOptions(copy, name, member));\n copy[name] = detach(member);\n });\n return copy;\n }\n const detached = detach(value);\n while (pending.length > 0) pending.pop()!();\n return detached;\n}\n\n// Source option contracts also reject exotic prototypes and hidden/symbol members. Preserve\n// that rejected shape as data rather than sanitizing it into an apparently valid option record.\nfunction preserveRejectedSourceOptions(copy: Record<string, unknown>, name: string, member: unknown): void {\n if (isObject(member) && hasExoticShape(member)) {\n copy[name] = Object.assign(Object.create(null), { numericMode: 'invalid' });\n }\n}\n\nfunction hasExoticShape(member: object): boolean {\n return (Object.getPrototypeOf(member) !== Object.prototype && Object.getPrototypeOf(member) !== null) || Reflect.ownKeys(member).length !== Object.keys(member).length;\n}\n\nfunction dataArray<T>(): T[] {\n const items: T[] = [];\n // JSON.stringify consults inherited toJSON even on plain arrays. Shadow that hook without changing\n // their indexed JSON bytes or normal Array prototype (including for existing tree consumers).\n Object.defineProperty(items, 'toJSON', { value: undefined });\n return items;\n}\n\n// Members omitted from the wire form when null (or undefined), by node kind.\nconst omittedWhenNull: Record<string, readonly string[]> = {\n ApplicationSyntax: ['identity', 'reactionProductionMode', 'commandReadMode', 'timeZone'],\n CommandSyntax: ['calendar'],\n ComparisonConditionSyntax: ['leftExpression'],\n EventSyntax: ['origin'],\n ImportSyntax: ['origin'],\n SliceSyntax: ['direction'],\n ReactionSyntax: ['from'],\n ReducerSyntax: ['from'],\n RemoveWithSyntax: ['partsKey'],\n ProducesSyntax: ['stream'],\n ConceptAttributeSyntax: ['scope', 'specialCategory'],\n ConceptSyntax: ['description', 'valueNumbers', 'generation'],\n GenerationSyntax: ['file', 'code'],\n PolicySyntax: ['description'],\n FileConstraintSyntax: ['description'],\n UniqueEventConstraintSyntax: ['description'],\n UniquePropertyConstraintSyntax: ['description'],\n ProjectionSyntax: ['description'],\n ScreenSyntax: ['description'],\n FormSyntax: ['description'],\n SpecificationSyntax: ['description', 'whenRedelivered', 'givenTimeZone'],\n SpecificationErrorSyntax: ['caseValue'],\n SpecificationExampleSyntax: ['stream', 'noStream'],\n SpecificationRedeliverySyntax: ['stream', 'noStream']\n};\n\n// Members omitted from the wire form when empty arrays, by node kind.\nconst omittedWhenEmpty: Record<string, readonly string[]> = {\n ModuleSyntax: ['dependsOn'],\n FeatureSyntax: ['dependsOn'],\n SpecificationSyntax: ['parameters', 'cases'],\n InvokesSyntax: ['onRefused']\n};\n\n// Members omitted when they hold their default value, by node kind.\nconst omittedWhenDefault: Record<string, Record<string, unknown>> = {\n EventSyntax: { visibility: 'Private' },\n ImportSyntax: { visibility: 'Private' },\n ConceptAttributeSyntax: { criminal: false },\n PropertySyntax: { isSubject: false },\n SpecificationSyntax: { thenNoEvents: false }\n};\n\nconst ownEntry = <T>(table: Record<string, T>, kind: string): T | undefined => Object.hasOwn(table, kind) ? table[kind] : undefined;\nconst isEmptyArray = (value: unknown): boolean => Array.isArray(value) && value.length === 0;\n\nfunction isNullOmitted(kind: string, member: string, value: unknown): boolean {\n if (value != null) return false;\n return ownEntry(omittedWhenNull, kind)?.includes(member) === true\n || member === 'inlineProperty'\n || (member === 'documentation' && kind !== 'EventSyntax');\n}\n\nfunction isEmptyOmitted(kind: string, member: string, value: unknown): boolean {\n if (!isEmptyArray(value)) return false;\n return ownEntry(omittedWhenEmpty, kind)?.includes(member) === true || member === 'examples' || member === 'purposes';\n}\n\nfunction isDefaultOmitted(kind: string, member: string, value: unknown): boolean {\n if (member === 'sourceOptions') return (value as { numericMode?: string } | undefined)?.numericMode === 'legacy';\n const defaults = ownEntry(omittedWhenDefault, kind);\n return defaults !== undefined && Object.hasOwn(defaults, member) && value === defaults[member];\n}\n\nfunction isOmittedByDefault(kind: string, member: string, value: unknown): boolean {\n return isNullOmitted(kind, member, value) || isEmptyOmitted(kind, member, value) || isDefaultOmitted(kind, member, value);\n}\n\nfunction write(value: unknown, owningMode = 'legacy', complete = false): SyntaxJsonValue {\n if (Array.isArray(value)) return writeArray(value, owningMode, complete);\n if (isNode(value)) return writeNode(value, owningMode, complete);\n if (value === undefined) return null;\n if (!isObject(value)) return value as SyntaxJsonValue;\n return writeRecord(value as Record<string, unknown>, owningMode, complete);\n}\n\nfunction writeArray(value: unknown[], owningMode: string, complete: boolean): SyntaxJsonValue {\n // A fresh plain array: never map (Symbol.species) or serialize through a caller-supplied hook.\n const items = dataArray<SyntaxJsonValue>();\n for (let index = 0; index < value.length; index++) items.push(write(value[index], owningMode, complete));\n return items;\n}\n\nfunction validateClosedImplementationShapes(value: SyntaxNode): void {\n // #307 shapes are closed in both modes, before any projection can hide unknown members.\n if (value.kind === 'ImplementationSyntax' || value.kind === 'ImplementationHintSyntax') validateClosedSyntaxMembers(value, omitted);\n if (value.kind !== 'ValidationRuleSyntax') return;\n const rule = value as ValidationRuleSyntax;\n if (rule.implementation == null) return;\n if (rule.file != null) validateClosedSyntaxMembers(rule.file, omitted);\n if (rule.code != null) validateClosedSyntaxMembers(rule.code, omitted);\n}\n\nfunction structuralMembers(value: SyntaxNode): Record<string, unknown> {\n const structural = { ...value } as unknown as Record<string, unknown>;\n if (value.kind === 'ApplicationSyntax' && structural.eventSources === undefined) structural.eventSources = [];\n if (value.kind === 'CommandSyntax' && structural.stream === undefined) structural.stream = null;\n if (value.kind === 'CommandSyntax' && structural.streamCandidates === undefined) structural.streamCandidates = [];\n return structural;\n}\n\nfunction projectedMemberNames(value: SyntaxNode, structural: Record<string, unknown>, owningMode: string, complete: boolean): string[] {\n const known = owningMode === 'exact' ? syntaxMemberNames(value.kind) : undefined;\n const isProjected = (member: string) =>\n (known === undefined || known.has(member)) && !isHiddenByLegacy(value, member, owningMode, complete) && !isAlwaysOmitted(value, member);\n return Object.keys(structural).filter(isProjected).sort(ordinal);\n}\n\nfunction isHiddenByLegacy(value: SyntaxNode, member: string, owningMode: string, complete: boolean): boolean {\n return owningMode === 'legacy' && !complete && isLegacyOmittedMember(value, member);\n}\n\nfunction isAlwaysOmitted(value: SyntaxNode, member: string): boolean {\n return omitted.has(member) || (value.kind === 'OperationSyntax' && member === 'usesLocation');\n}\n\nfunction writeNode(value: SyntaxNode, owningMode: string, complete: boolean): SyntaxJsonValue {\n if (sourceRoots.has(value.kind)) owningMode = validatedSourceOptions((value as unknown as { sourceOptions?: unknown }).sourceOptions ?? legacySourceOptions).numericMode;\n validateSyntaxInvariants(value);\n validateClosedImplementationShapes(value);\n const result = Object.create(null) as Record<string, SyntaxJsonValue>;\n result.kind = value.kind;\n const structural = structuralMembers(value);\n for (const member of projectedMemberNames(value, structural, owningMode, complete)) {\n const memberValue = structural[member];\n if (isOmittedByDefault(value.kind, member, memberValue)) continue;\n result[member] = write(memberValue, owningMode, complete);\n }\n return result;\n}\n\nfunction writeRecord(record: Record<string, unknown>, owningMode: string, complete: boolean): SyntaxJsonValue {\n // The ordered ExactNumber form, whatever the input key order; other objects are copied without any toJSON hook.\n const copy = Object.create(null) as Record<string, SyntaxJsonValue>;\n if (record.literalType === 'ExactNumber') {\n copy.literalType = 'ExactNumber';\n copy.value = record.value as string;\n return copy;\n }\n for (const name of Object.keys(record)) if (name !== 'toJSON' && record[name] !== undefined) copy[name] = write(record[name], owningMode, complete);\n return copy;\n}\n\nfunction validateNumbers(value: unknown, owningMode: string, depth: number): void {\n assertSupportedDepth(owningMode, depth);\n if (Array.isArray(value)) {\n for (let index = 0; index < value.length; index++) validateNumbers(value[index], owningMode, depth + 1);\n return;\n }\n if (!isObject(value)) return;\n validateNodeNumbers(value as Record<string, unknown>, owningMode, depth);\n}\n\nfunction validateNodeNumbers(node: Record<string, unknown>, owningMode: string, depth: number): void {\n owningMode = resolveNumericMode(node, owningMode, depth);\n assertCompleteSourceRoot(node, owningMode, depth);\n if (owningMode === 'exact' && isNode(node)) validateSyntaxMembers(node);\n validateRawNumericText(node, owningMode);\n if (node.kind === 'LiteralExpressionSyntax' && Object.hasOwn(node, 'value')) validateLiteralValue(node.value, owningMode);\n validateNumberMembers(node, owningMode, depth);\n}\n\nfunction assertSupportedDepth(owningMode: string, depth: number): void {\n if (depth > 96 && owningMode === 'exact') throw new InvalidSyntaxJson('Syntax nesting exceeds the supported depth of 96.');\n}\n\nfunction assertCompleteSourceRoot(node: Record<string, unknown>, owningMode: string, depth: number): void {\n if (isIncompleteExactRoot(node, owningMode, depth)) throw new InvalidSyntaxJson('Exact syntax requires a complete source root.');\n}\n\nfunction isIncompleteExactRoot(node: Record<string, unknown>, owningMode: string, depth: number): boolean {\n return depth === 0 && owningMode === 'exact' && !sourceRoots.has(node.kind as string);\n}\n\nfunction resolveNumericMode(node: Record<string, unknown>, owningMode: string, depth: number): string {\n if (!sourceRoots.has(node.kind as string) && !Object.hasOwn(node, 'sourceOptions')) return owningMode;\n // Omission is Legacy on every complete source root, never inheritance from its container.\n const options = Object.hasOwn(node, 'sourceOptions') ? validatedSourceOptions(node.sourceOptions) : legacySourceOptions;\n if (depth > 0 && owningMode !== options.numericMode) throw new InvalidSyntaxJson('Conflicting source numeric options.');\n return options.numericMode;\n}\n\nfunction validateRawNumericText(node: Record<string, unknown>, owningMode: string): void {\n if (node.kind !== 'RawExpressionSyntax' || owningMode !== 'exact') return;\n if (typeof node.text === 'string' && isExactNumberToken(node.text)) throw new InvalidSyntaxJson('An exact numeric operand must be an explicit ExactNumber, not opaque numeric text.');\n}\n\nfunction isUnsupportedExactPrimitive(value: unknown): boolean {\n return typeof value === 'number' || (value !== null && !['string', 'boolean', 'object'].includes(typeof value));\n}\n\nfunction validateLiteralValue(value: unknown, owningMode: string): void {\n if (owningMode === 'exact' && isUnsupportedExactPrimitive(value)) throw new InvalidSyntaxJson('Exact source requires supported primitive values or an explicit ExactNumber literal.');\n if (!isObject(value)) return;\n validateObjectLiteral(value as { literalType?: unknown; value?: unknown }, owningMode);\n}\n\nfunction validateObjectLiteral(literal: { literalType?: unknown; value?: unknown }, owningMode: string): void {\n if (literal.literalType === 'ExactNumber') validateExactNumberLiteral(literal, owningMode);\n else if (owningMode === 'exact') throw new InvalidSyntaxJson('Exact source refuses old or plain object literal insertion.');\n}\n\nfunction isWellFormedExactNumber(literal: { value?: unknown }): boolean {\n return typeof literal.value === 'string' && parseExactNumber(literal.value)?.value === literal.value && Object.keys(literal).length === 2;\n}\n\nfunction validateExactNumberLiteral(literal: { value?: unknown }, owningMode: string): void {\n if (owningMode !== 'exact' || !isWellFormedExactNumber(literal)) throw new InvalidSyntaxJson('Malformed or incompatible ExactNumber literal.');\n}\n\nfunction validateNumberMembers(node: Record<string, unknown>, owningMode: string, depth: number): void {\n const known = owningMode === 'exact' && isNode(node) ? syntaxMemberNames(node.kind) : undefined;\n for (const [name, member] of Object.entries(node)) if (isTraversedMember(known, name, member)) validateNumbers(member, owningMode, depth + 1);\n}\n\nfunction isTraversedMember(known: ReadonlySet<string> | undefined, name: string, member: unknown): boolean {\n return (known === undefined || known.has(name) || (isNode(member) && sourceRoots.has(member.kind))) && !skippedNumberMembers.has(name);\n}\n\nfunction ordinal(left: string, right: string): number {\n return left < right ? -1 : left > right ? 1 : 0;\n}\n"],"mappings":"+gBAeA,MAAM,OAAU,GACZ,OAAOA,GAAU,YAAYA,GAAkB,OAAQA,EAA6B,MAAS,SAC3F,SAAY,GAAoC,OAAOA,GAAU,YAAYA,EAC7EC,kBAAU,IAAI,IAAI,CAAC,OAAQ,WAAY,iBAAkB,oBAAqB,kBAAmB,iBAAkB,mBAAoB,oBAAoB,CAAC,EAC5JC,kBAAuB,IAAI,IAAI,CAAC,WAAY,iBAAkB,cAAc,CAAC,EAC7EC,kBAAc,IAAI,IAAI,CAAC,oBAAqB,mBAAoB,gBAAiB,qBAAqB,CAAC,EAK7G,SAAgB,aAAa,EAAmC,C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AEA,SAAS,kBAAkB,EAAwC,EAAc,EAA0B,CACvG,OAAQT,IAAU,IAAA,IAAaA,EAAM,IAAIb,CAAI,GAAM,OAAOC,CAAM,GAAKX,EAAY,IAAIW,EAAO,IAAI,IAAO,CAACZ,EAAqB,IAAIW,CAAI,CACzI,CAEA,SAAS,QAAQ,EAAc,EAAuB,CAClD,OAAO6B,EAAOC,EAAQ,GAAK,IAAOA,EACtC"}
1
+ {"version":3,"file":"SyntaxJson.js","names":["value","omitted","skippedNumberMembers","sourceRoots","detached","node","copies","pending","items","length","index","copy","names","name","member","omittedWhenNull","omittedWhenEmpty","omittedWhenDefault","table","kind","defaults","owningMode","complete","validateClosedSyntaxMembers","rule","structural","known","syntaxMemberNames","isLegacyOmittedMember","validatedSourceOptions","legacySourceOptions","validateSyntaxInvariants","result","memberValue","record","depth","validateSyntaxMembers","InvalidSyntaxJson","options","isExactNumberToken","literal","parseExactNumber","left","right"],"sources":["../../../../../../Compiler/Syntax/SyntaxJson.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { SyntaxNode } from './SyntaxNode';\nimport { InvalidSyntaxJson } from './InvalidSyntaxJson';\nimport { isExactNumberToken, parseExactNumber } from './ExactNumber';\nimport { validateSyntaxInvariants } from './SyntaxInvariants';\nimport { syntaxMemberNames, validateClosedSyntaxMembers, validateSyntaxMembers } from './SyntaxMemberContracts';\nimport { ValidationRuleSyntax } from './Commands';\nimport { isLegacyOmittedMember } from './LegacyWireProjection';\nimport { legacySourceOptions, validatedSourceOptions } from './SourceOptions';\n\n// Returned record objects have null prototypes.\nexport type SyntaxJsonValue = string | number | boolean | null | SyntaxJsonValue[] | { [member: string]: SyntaxJsonValue };\n\nconst isNode = (value: unknown): value is SyntaxNode =>\n typeof value === 'object' && value !== null && typeof (value as { kind?: unknown }).kind === 'string';\nconst isObject = (value: unknown): value is object => typeof value === 'object' && value !== null;\nconst omitted = new Set(['kind', 'location', 'targetLocation', 'referenceLocation', 'referenceLength', 'nameWasEscaped', 'declaredTriggers', 'directiveLocations']);\nconst skippedNumberMembers = new Set(['location', 'targetLocation', 'usesLocation']);\nconst sourceRoots = new Set(['ApplicationSyntax', 'ProjectionSyntax', 'CaptureSyntax', 'SpecificationSyntax']);\n\n// The canonical JSON form of a syntax tree, the same form the C# SyntaxJson writes: 'kind' first, then the\n// members in ordinal order, with source locations left out. Because a node only carries the members this\n// compiler models, the result is the C# form narrowed to those members.\nexport function toSyntaxJson(node: SyntaxNode): SyntaxJsonValue {\n const detached = snapshot(node);\n validateNumbers(detached, 'legacy', 0);\n return write(detached);\n}\n\n// The enriched internal tree written completely, Legacy members included. Not a wire form: it exists so the\n// walker and other tree consumers can be held to every node the parser builds.\nexport function toCompleteSyntaxJson(node: SyntaxNode): SyntaxJsonValue {\n const detached = snapshot(node);\n validateNumbers(detached, 'legacy', 0);\n return write(detached, 'legacy', true);\n}\n\n// Read caller-owned properties only once, before validation. Both validation and projection see the same\n// detached data; accessors, proxies and shared references cannot change it between passes.\nfunction snapshot(value: unknown): unknown {\n const copies = new WeakMap<object, unknown>();\n const pending: (() => void)[] = [];\n // Schedule depth-first reads without consuming the call stack, including for ignored metadata.\n function detach(value: unknown): unknown {\n if (!isObject(value)) return value;\n if (copies.has(value)) return copies.get(value);\n return Array.isArray(value) ? detachArray(value) : detachObject(value);\n }\n function detachArray(value: unknown[]): unknown {\n const items = dataArray<unknown>();\n copies.set(value, items);\n const length = value.length;\n for (let index = length - 1; index >= 0; index--) pending.push(() => {\n items[index] = detach(Object.hasOwn(value, index) ? value[index] : undefined);\n });\n return items;\n }\n function detachObject(value: object): unknown {\n const copy = Object.create(null) as Record<string, unknown>;\n copies.set(value, copy);\n const names = Object.keys(value);\n // Node identity also accepts inherited, hidden and class-getter kinds; read it just once.\n if (!names.includes('kind') && 'kind' in value) names.unshift('kind');\n for (let index = names.length - 1; index >= 0; index--) pending.push(() => {\n const name = names[index];\n const member = (value as Record<string, unknown>)[name];\n if (name === 'sourceOptions') pending.push(() => preserveRejectedSourceOptions(copy, name, member));\n copy[name] = detach(member);\n });\n return copy;\n }\n const detached = detach(value);\n while (pending.length > 0) pending.pop()!();\n return detached;\n}\n\n// Source option contracts also reject exotic prototypes and hidden/symbol members. Preserve\n// that rejected shape as data rather than sanitizing it into an apparently valid option record.\nfunction preserveRejectedSourceOptions(copy: Record<string, unknown>, name: string, member: unknown): void {\n if (isObject(member) && hasExoticShape(member)) {\n copy[name] = Object.assign(Object.create(null), { numericMode: 'invalid' });\n }\n}\n\nfunction hasExoticShape(member: object): boolean {\n return (Object.getPrototypeOf(member) !== Object.prototype && Object.getPrototypeOf(member) !== null) || Reflect.ownKeys(member).length !== Object.keys(member).length;\n}\n\nfunction dataArray<T>(): T[] {\n const items: T[] = [];\n // JSON.stringify consults inherited toJSON even on plain arrays. Shadow that hook without changing\n // their indexed JSON bytes or normal Array prototype (including for existing tree consumers).\n Object.defineProperty(items, 'toJSON', { value: undefined });\n return items;\n}\n\n// Members omitted from the wire form when null (or undefined), by node kind.\nconst omittedWhenNull: Record<string, readonly string[]> = {\n ApplicationSyntax: ['identity', 'reactionProductionMode', 'commandReadMode', 'timeZone'],\n CommandSyntax: ['calendar'],\n ComparisonConditionSyntax: ['leftExpression'],\n EventSyntax: ['origin'],\n ImportSyntax: ['origin'],\n SliceSyntax: ['direction'],\n ReactionSyntax: ['from'],\n ReducerSyntax: ['from'],\n RemoveWithSyntax: ['partsKey'],\n ProducesSyntax: ['stream'],\n ConceptAttributeSyntax: ['scope', 'specialCategory'],\n ConceptSyntax: ['description', 'valueNumbers', 'generation'],\n GenerationSyntax: ['file', 'code'],\n PolicySyntax: ['description'],\n FileConstraintSyntax: ['description'],\n UniqueEventConstraintSyntax: ['description'],\n UniquePropertyConstraintSyntax: ['description'],\n ProjectionSyntax: ['description'],\n ScreenSyntax: ['description'],\n ScreenActionSyntax: ['subject'],\n ScreenGuardedActionSyntax: ['subject'],\n ToolbarItemSyntax: ['subject'],\n FormSyntax: ['description'],\n SpecificationSyntax: ['description', 'whenRedelivered', 'givenTimeZone'],\n SpecificationErrorSyntax: ['caseValue'],\n SpecificationExampleSyntax: ['stream', 'noStream'],\n SpecificationRedeliverySyntax: ['stream', 'noStream']\n};\n\n// Members omitted from the wire form when empty arrays, by node kind.\nconst omittedWhenEmpty: Record<string, readonly string[]> = {\n ScreenActionSyntax: ['inputs'],\n ModuleSyntax: ['dependsOn'],\n FeatureSyntax: ['dependsOn'],\n SpecificationSyntax: ['parameters', 'cases'],\n InvokesSyntax: ['onRefused']\n};\n\n// Members omitted when they hold their default value, by node kind.\nconst omittedWhenDefault: Record<string, Record<string, unknown>> = {\n EventSyntax: { visibility: 'Private' },\n ImportSyntax: { visibility: 'Private' },\n ConceptAttributeSyntax: { criminal: false },\n PropertySyntax: { isSubject: false },\n SpecificationSyntax: { thenNoEvents: false }\n};\n\nconst ownEntry = <T>(table: Record<string, T>, kind: string): T | undefined => Object.hasOwn(table, kind) ? table[kind] : undefined;\nconst isEmptyArray = (value: unknown): boolean => Array.isArray(value) && value.length === 0;\n\nfunction isNullOmitted(kind: string, member: string, value: unknown): boolean {\n if (value != null) return false;\n return ownEntry(omittedWhenNull, kind)?.includes(member) === true\n || member === 'inlineProperty'\n || (member === 'documentation' && kind !== 'EventSyntax');\n}\n\nfunction isEmptyOmitted(kind: string, member: string, value: unknown): boolean {\n if (!isEmptyArray(value)) return false;\n return ownEntry(omittedWhenEmpty, kind)?.includes(member) === true || member === 'examples' || member === 'purposes';\n}\n\nfunction isDefaultOmitted(kind: string, member: string, value: unknown): boolean {\n if (member === 'sourceOptions') return (value as { numericMode?: string } | undefined)?.numericMode === 'legacy';\n const defaults = ownEntry(omittedWhenDefault, kind);\n return defaults !== undefined && Object.hasOwn(defaults, member) && value === defaults[member];\n}\n\nfunction isOmittedByDefault(kind: string, member: string, value: unknown): boolean {\n return isNullOmitted(kind, member, value) || isEmptyOmitted(kind, member, value) || isDefaultOmitted(kind, member, value);\n}\n\nfunction write(value: unknown, owningMode = 'legacy', complete = false): SyntaxJsonValue {\n if (Array.isArray(value)) return writeArray(value, owningMode, complete);\n if (isNode(value)) return writeNode(value, owningMode, complete);\n if (value === undefined) return null;\n if (!isObject(value)) return value as SyntaxJsonValue;\n return writeRecord(value as Record<string, unknown>, owningMode, complete);\n}\n\nfunction writeArray(value: unknown[], owningMode: string, complete: boolean): SyntaxJsonValue {\n // A fresh plain array: never map (Symbol.species) or serialize through a caller-supplied hook.\n const items = dataArray<SyntaxJsonValue>();\n for (let index = 0; index < value.length; index++) items.push(write(value[index], owningMode, complete));\n return items;\n}\n\nfunction validateClosedImplementationShapes(value: SyntaxNode): void {\n // #307 shapes are closed in both modes, before any projection can hide unknown members.\n if (value.kind === 'ImplementationSyntax' || value.kind === 'ImplementationHintSyntax') validateClosedSyntaxMembers(value, omitted);\n if (value.kind !== 'ValidationRuleSyntax') return;\n const rule = value as ValidationRuleSyntax;\n if (rule.implementation == null) return;\n if (rule.file != null) validateClosedSyntaxMembers(rule.file, omitted);\n if (rule.code != null) validateClosedSyntaxMembers(rule.code, omitted);\n}\n\nfunction structuralMembers(value: SyntaxNode): Record<string, unknown> {\n const structural = { ...value } as unknown as Record<string, unknown>;\n if (value.kind === 'ApplicationSyntax' && structural.eventSources === undefined) structural.eventSources = [];\n if (value.kind === 'CommandSyntax' && structural.stream === undefined) structural.stream = null;\n if (value.kind === 'CommandSyntax' && structural.streamCandidates === undefined) structural.streamCandidates = [];\n return structural;\n}\n\nfunction projectedMemberNames(value: SyntaxNode, structural: Record<string, unknown>, owningMode: string, complete: boolean): string[] {\n const known = owningMode === 'exact' ? syntaxMemberNames(value.kind) : undefined;\n const isProjected = (member: string) =>\n (known === undefined || known.has(member)) && !isHiddenByLegacy(value, member, owningMode, complete) && !isAlwaysOmitted(value, member);\n return Object.keys(structural).filter(isProjected).sort(ordinal);\n}\n\nfunction isHiddenByLegacy(value: SyntaxNode, member: string, owningMode: string, complete: boolean): boolean {\n return owningMode === 'legacy' && !complete && isLegacyOmittedMember(value, member);\n}\n\nfunction isAlwaysOmitted(value: SyntaxNode, member: string): boolean {\n return omitted.has(member) || (value.kind === 'OperationSyntax' && member === 'usesLocation');\n}\n\nfunction writeNode(value: SyntaxNode, owningMode: string, complete: boolean): SyntaxJsonValue {\n if (sourceRoots.has(value.kind)) owningMode = validatedSourceOptions((value as unknown as { sourceOptions?: unknown }).sourceOptions ?? legacySourceOptions).numericMode;\n validateSyntaxInvariants(value);\n validateClosedImplementationShapes(value);\n const result = Object.create(null) as Record<string, SyntaxJsonValue>;\n result.kind = value.kind;\n const structural = structuralMembers(value);\n for (const member of projectedMemberNames(value, structural, owningMode, complete)) {\n const memberValue = structural[member];\n if (isOmittedByDefault(value.kind, member, memberValue)) continue;\n result[member] = write(memberValue, owningMode, complete);\n }\n return result;\n}\n\nfunction writeRecord(record: Record<string, unknown>, owningMode: string, complete: boolean): SyntaxJsonValue {\n // The ordered ExactNumber form, whatever the input key order; other objects are copied without any toJSON hook.\n const copy = Object.create(null) as Record<string, SyntaxJsonValue>;\n if (record.literalType === 'ExactNumber') {\n copy.literalType = 'ExactNumber';\n copy.value = record.value as string;\n return copy;\n }\n for (const name of Object.keys(record)) if (name !== 'toJSON' && record[name] !== undefined) copy[name] = write(record[name], owningMode, complete);\n return copy;\n}\n\nfunction validateNumbers(value: unknown, owningMode: string, depth: number): void {\n assertSupportedDepth(owningMode, depth);\n if (Array.isArray(value)) {\n for (let index = 0; index < value.length; index++) validateNumbers(value[index], owningMode, depth + 1);\n return;\n }\n if (!isObject(value)) return;\n validateNodeNumbers(value as Record<string, unknown>, owningMode, depth);\n}\n\nfunction validateNodeNumbers(node: Record<string, unknown>, owningMode: string, depth: number): void {\n owningMode = resolveNumericMode(node, owningMode, depth);\n assertCompleteSourceRoot(node, owningMode, depth);\n if (owningMode === 'exact' && isNode(node)) validateSyntaxMembers(node);\n validateRawNumericText(node, owningMode);\n if (node.kind === 'LiteralExpressionSyntax' && Object.hasOwn(node, 'value')) validateLiteralValue(node.value, owningMode);\n validateNumberMembers(node, owningMode, depth);\n}\n\nfunction assertSupportedDepth(owningMode: string, depth: number): void {\n if (depth > 96 && owningMode === 'exact') throw new InvalidSyntaxJson('Syntax nesting exceeds the supported depth of 96.');\n}\n\nfunction assertCompleteSourceRoot(node: Record<string, unknown>, owningMode: string, depth: number): void {\n if (isIncompleteExactRoot(node, owningMode, depth)) throw new InvalidSyntaxJson('Exact syntax requires a complete source root.');\n}\n\nfunction isIncompleteExactRoot(node: Record<string, unknown>, owningMode: string, depth: number): boolean {\n return depth === 0 && owningMode === 'exact' && !sourceRoots.has(node.kind as string);\n}\n\nfunction resolveNumericMode(node: Record<string, unknown>, owningMode: string, depth: number): string {\n if (!sourceRoots.has(node.kind as string) && !Object.hasOwn(node, 'sourceOptions')) return owningMode;\n // Omission is Legacy on every complete source root, never inheritance from its container.\n const options = Object.hasOwn(node, 'sourceOptions') ? validatedSourceOptions(node.sourceOptions) : legacySourceOptions;\n if (depth > 0 && owningMode !== options.numericMode) throw new InvalidSyntaxJson('Conflicting source numeric options.');\n return options.numericMode;\n}\n\nfunction validateRawNumericText(node: Record<string, unknown>, owningMode: string): void {\n if (node.kind !== 'RawExpressionSyntax' || owningMode !== 'exact') return;\n if (typeof node.text === 'string' && isExactNumberToken(node.text)) throw new InvalidSyntaxJson('An exact numeric operand must be an explicit ExactNumber, not opaque numeric text.');\n}\n\nfunction isUnsupportedExactPrimitive(value: unknown): boolean {\n return typeof value === 'number' || (value !== null && !['string', 'boolean', 'object'].includes(typeof value));\n}\n\nfunction validateLiteralValue(value: unknown, owningMode: string): void {\n if (owningMode === 'exact' && isUnsupportedExactPrimitive(value)) throw new InvalidSyntaxJson('Exact source requires supported primitive values or an explicit ExactNumber literal.');\n if (!isObject(value)) return;\n validateObjectLiteral(value as { literalType?: unknown; value?: unknown }, owningMode);\n}\n\nfunction validateObjectLiteral(literal: { literalType?: unknown; value?: unknown }, owningMode: string): void {\n if (literal.literalType === 'ExactNumber') validateExactNumberLiteral(literal, owningMode);\n else if (owningMode === 'exact') throw new InvalidSyntaxJson('Exact source refuses old or plain object literal insertion.');\n}\n\nfunction isWellFormedExactNumber(literal: { value?: unknown }): boolean {\n return typeof literal.value === 'string' && parseExactNumber(literal.value)?.value === literal.value && Object.keys(literal).length === 2;\n}\n\nfunction validateExactNumberLiteral(literal: { value?: unknown }, owningMode: string): void {\n if (owningMode !== 'exact' || !isWellFormedExactNumber(literal)) throw new InvalidSyntaxJson('Malformed or incompatible ExactNumber literal.');\n}\n\nfunction validateNumberMembers(node: Record<string, unknown>, owningMode: string, depth: number): void {\n const known = owningMode === 'exact' && isNode(node) ? syntaxMemberNames(node.kind) : undefined;\n for (const [name, member] of Object.entries(node)) if (isTraversedMember(known, name, member)) validateNumbers(member, owningMode, depth + 1);\n}\n\nfunction isTraversedMember(known: ReadonlySet<string> | undefined, name: string, member: unknown): boolean {\n return (known === undefined || known.has(name) || (isNode(member) && sourceRoots.has(member.kind))) && !skippedNumberMembers.has(name);\n}\n\nfunction ordinal(left: string, right: string): number {\n return left < right ? -1 : left > right ? 1 : 0;\n}\n"],"mappings":"+gBAeA,MAAM,OAAU,GACZ,OAAOA,GAAU,YAAYA,GAAkB,OAAQA,EAA6B,MAAS,SAC3F,SAAY,GAAoC,OAAOA,GAAU,YAAYA,EAC7EC,kBAAU,IAAI,IAAI,CAAC,OAAQ,WAAY,iBAAkB,oBAAqB,kBAAmB,iBAAkB,mBAAoB,oBAAoB,CAAC,EAC5JC,kBAAuB,IAAI,IAAI,CAAC,WAAY,iBAAkB,cAAc,CAAC,EAC7EC,kBAAc,IAAI,IAAI,CAAC,oBAAqB,mBAAoB,gBAAiB,qBAAqB,CAAC,EAK7G,SAAgB,aAAa,EAAmC,CAC5D,IAAMC,EAAW,SAASC,CAAI,EAE9B,OADA,gBAAgBD,EAAU,SAAU,CAAC,EAC9B,MAAMA,CAAQ,CACzB,CAYA,SAAS,SAAS,EAAyB,CACvC,IAAME,k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EAAc,EAA0B,CACvG,OAAQT,IAAU,IAAA,IAAaA,EAAM,IAAIb,CAAI,GAAM,OAAOC,CAAM,GAAKX,EAAY,IAAIW,EAAO,IAAI,IAAO,CAACZ,EAAqB,IAAIW,CAAI,CACzI,CAEA,SAAS,QAAQ,EAAc,EAAuB,CAClD,OAAO6B,EAAOC,EAAQ,GAAK,IAAOA,EACtC"}
@@ -1 +1 @@
1
- import{DiagnosticCodes as e}from"./Diagnostics/DiagnosticCodes.js";import"./Parsing/checkPortableMatchPattern.js";import{unescapeString as t}from"./Text/StringLiteral.js";import{pattern as n}from"./Text/patterns.js";import{sourceLocation as r}from"./Diagnostics/SourceLocation.js";import{eventDeclarations as i}from"./Syntax/EventDeclarations.js";import{operationDeclarations as a}from"./Syntax/Operations.js";import{AuthoringProductionResolver as o}from"./Syntax/AuthoringProductionResolver.js";import{dependencySourcesOf as s}from"./Syntax/DependencySources.js";import{ScreenplaySyntaxWalker as c}from"./Syntax/ScreenplaySyntaxWalker.js";import{isExactNumberToken as l,parseExactNumber as u}from"./Syntax/ExactNumber.js";import{diagnosticKeyword as d,diagnosticText as f}from"./Diagnostics/DiagnosticArgument.js";import{EventSourceCatalog as p}from"./Syntax/EventSourceCatalog.js";import{implicitDestination as m,requiresExplicitDestinations as h}from"./Syntax/ProductionDestinations.js";import{InvalidExactNumber as g,canonicalExactText as _,exactIsIntegral as v}from"./Syntax/ExactMathFacts.js";import{responseCommandResolver as y}from"./Parsing/ResponseCommandResolver.js";import{synthesizePersonaCaller as b}from"./Syntax/PersonaCallers.js";import"./Syntax/SpecificationCaseOrigin.js";import"./Parsing/SpecificationCommandExamples.js";import{DeclaredDependencyTargets as x}from"./Dependencies/DeclaredDependencyTargets.js";import{describePlacement as S,documentPlacement as C,isDocumentPlacement as w,isWithinOrSame as T,samePlacement as E}from"./Files/PlayPlacement.js";import"./Syntax/InvalidSyntaxJson.js";import"./Syntax/SourceOptions.js";import{isSourceStreamName as D,isSourceStreamTypeName as O,sourceStreamPattern as k}from"./Text/SourceStreamNames.js";import{sliceTypes as A}from"./Syntax/Structure.js";import{consumedEvents as j,eventsSourceKind as M,fromSetting as N,isEventsSource as P}from"./Syntax/CaptureEventsSource.js";import{eventBodyReservedWords as F}from"./Text/ReservedWords.js";import{hasWildcard as I,matchesPlayPattern as L,normalizePlayPath as R,resolvePlayPattern as z,staticFolderOf as B}from"./Files/PlayGlob.js";import"./Files/AuthoredOrder.js";import{dependencyKinds as V}from"./Dependencies/DependencyKind.js";import{InvalidDependencyQuery as H}from"./Dependencies/InvalidDependencyQuery.js";import{SliceReferenceCollector as U,buildingReadModelReferences as W,referenceClassifications as G,sliceReferences as K}from"./Dependencies/SliceReferences.js";import{stronglyConnectedGroups as q}from"./Dependencies/StronglyConnectedGroups.js";import{DependencyGraph as J}from"./Dependencies/DependencyGraph.js";import{streamIdFailureMessage as Y,tryFormatInteger as X,tryFormatText as Z,tryFormatUuidText as Q}from"./Syntax/StreamIdFormatter.js";import{discoverImports as $,parseForAuthoring as ee}from"./ScreenplayCompiler.js";import{EventSourceReadConfidence as te}from"./Syntax/EventSourceReadConfidence.js";import"./Syntax/SyntaxJson.js";import{mergeDocuments as ne}from"./Files/PlayFolderMerge.js";import{inMemoryDocumentSource as re}from"./Files/PlayDocumentSource.js";import{resolveImports as ie}from"./Files/PlayImports.js";import"./Files/OrderingRoot.js";import{assembleApplication as ae,compileApplication as oe,parsePlacedDocuments as se}from"./Files/PlayApplicationAssembly.js";import{applyQuickFixEdits as ce,isQuickFixDiagnostic as le,legacyOptionalTypeLength as ue,prepareQuickFixes as de}from"./Authoring/QuickFixes.js";import"./Completeness/ModelCompleteness.js";import"./Dependencies/index.js";import"./Syntax/index.js";export{o as AuthoringProductionResolver,x as DeclaredDependencyTargets,J as DependencyGraph,e as DiagnosticCodes,p as EventSourceCatalog,te as EventSourceReadConfidence,H as InvalidDependencyQuery,g as InvalidExactNumber,c as ScreenplaySyntaxWalker,U as SliceReferenceCollector,ce as applyQuickFixEdits,ae as assembleApplication,W as buildingReadModelReferences,_ as canonicalExactText,oe as compileApplication,j as consumedEvents,V as dependencyKinds,s as dependencySourcesOf,S as describePlacement,d as diagnosticKeyword,f as diagnosticText,$ as discoverImports,C as documentPlacement,F as eventBodyReservedWords,i as eventDeclarations,M as eventsSourceKind,v as exactIsIntegral,N as fromSetting,I as hasWildcard,m as implicitDestination,re as inMemoryDocumentSource,w as isDocumentPlacement,P as isEventsSource,l as isExactNumberToken,le as isQuickFixDiagnostic,D as isSourceStreamName,O as isSourceStreamTypeName,T as isWithinOrSame,ue as legacyOptionalTypeLength,L as matchesPlayPattern,ne as mergeDocuments,R as normalizePlayPath,a as operationDeclarations,u as parseExactNumber,ee as parseForAuthoring,se as parsePlacedDocuments,n as pattern,de as prepareQuickFixes,G as referenceClassifications,h as requiresExplicitDestinations,ie as resolveImports,z as resolvePlayPattern,y as responseCommandResolver,E as samePlacement,K as sliceReferences,A as sliceTypes,r as sourceLocation,k as sourceStreamPattern,B as staticFolderOf,Y as streamIdFailureMessage,q as stronglyConnectedGroups,b as synthesizePersonaCaller,X as tryFormatInteger,Z as tryFormatText,Q as tryFormatUuidText,t as unescapeString};
1
+ import{DiagnosticCodes as e}from"./Diagnostics/DiagnosticCodes.js";import"./Parsing/checkPortableMatchPattern.js";import{unescapeString as t}from"./Text/StringLiteral.js";import{pattern as n}from"./Text/patterns.js";import{sourceLocation as r}from"./Diagnostics/SourceLocation.js";import{eventDeclarations as i}from"./Syntax/EventDeclarations.js";import{operationDeclarations as a}from"./Syntax/Operations.js";import{AuthoringProductionResolver as o}from"./Syntax/AuthoringProductionResolver.js";import{dependencySourcesOf as s}from"./Syntax/DependencySources.js";import{ScreenplaySyntaxWalker as c}from"./Syntax/ScreenplaySyntaxWalker.js";import{isExactNumberToken as l,parseExactNumber as u}from"./Syntax/ExactNumber.js";import{diagnosticKeyword as d,diagnosticText as f}from"./Diagnostics/DiagnosticArgument.js";import{EventSourceCatalog as p}from"./Syntax/EventSourceCatalog.js";import{implicitDestination as m,requiresExplicitDestinations as h}from"./Syntax/ProductionDestinations.js";import{InvalidExactNumber as g,canonicalExactText as _,exactIsIntegral as v}from"./Syntax/ExactMathFacts.js";import{responseCommandResolver as y}from"./Parsing/ResponseCommandResolver.js";import{synthesizePersonaCaller as b}from"./Syntax/PersonaCallers.js";import"./Syntax/SpecificationCaseOrigin.js";import"./Parsing/SpecificationCommandExamples.js";import{DeclaredDependencyTargets as x}from"./Dependencies/DeclaredDependencyTargets.js";import{describePlacement as S,documentPlacement as C,isDocumentPlacement as w,isWithinOrSame as T,samePlacement as E}from"./Files/PlayPlacement.js";import"./Syntax/InvalidSyntaxJson.js";import"./Syntax/SourceOptions.js";import{isSourceStreamName as D,isSourceStreamTypeName as O,sourceStreamPattern as k}from"./Text/SourceStreamNames.js";import{sliceTypes as A}from"./Syntax/Structure.js";import{consumedEvents as j,eventsSourceKind as M,fromSetting as N,isEventsSource as P}from"./Syntax/CaptureEventsSource.js";import{eventBodyReservedWords as F}from"./Text/ReservedWords.js";import{hasWildcard as I,matchesPlayPattern as L,normalizePlayPath as R,resolvePlayPattern as z,staticFolderOf as B}from"./Files/PlayGlob.js";import"./Files/AuthoredOrder.js";import{dependencyKinds as V}from"./Dependencies/DependencyKind.js";import{InvalidDependencyQuery as H}from"./Dependencies/InvalidDependencyQuery.js";import{SliceReferenceCollector as U,buildingReadModelReferences as W,referenceClassifications as G,sliceReferences as K}from"./Dependencies/SliceReferences.js";import{stronglyConnectedGroups as q}from"./Dependencies/StronglyConnectedGroups.js";import{DependencyGraph as J}from"./Dependencies/DependencyGraph.js";import{streamIdFailureMessage as Y,tryFormatInteger as X,tryFormatText as Z,tryFormatUuidText as Q}from"./Syntax/StreamIdFormatter.js";import"./ScreenActionSubjects.js";import{discoverImports as $,parseForAuthoring as ee}from"./ScreenplayCompiler.js";import{EventSourceReadConfidence as te}from"./Syntax/EventSourceReadConfidence.js";import"./Syntax/SyntaxJson.js";import{mergeDocuments as ne}from"./Files/PlayFolderMerge.js";import{inMemoryDocumentSource as re}from"./Files/PlayDocumentSource.js";import{resolveImports as ie}from"./Files/PlayImports.js";import"./Files/OrderingRoot.js";import{assembleApplication as ae,compileApplication as oe,parsePlacedDocuments as se}from"./Files/PlayApplicationAssembly.js";import{applyQuickFixEdits as ce,isQuickFixDiagnostic as le,legacyOptionalTypeLength as ue,prepareQuickFixes as de}from"./Authoring/QuickFixes.js";import"./Completeness/ModelCompleteness.js";import"./Dependencies/index.js";import"./Syntax/index.js";export{o as AuthoringProductionResolver,x as DeclaredDependencyTargets,J as DependencyGraph,e as DiagnosticCodes,p as EventSourceCatalog,te as EventSourceReadConfidence,H as InvalidDependencyQuery,g as InvalidExactNumber,c as ScreenplaySyntaxWalker,U as SliceReferenceCollector,ce as applyQuickFixEdits,ae as assembleApplication,W as buildingReadModelReferences,_ as canonicalExactText,oe as compileApplication,j as consumedEvents,V as dependencyKinds,s as dependencySourcesOf,S as describePlacement,d as diagnosticKeyword,f as diagnosticText,$ as discoverImports,C as documentPlacement,F as eventBodyReservedWords,i as eventDeclarations,M as eventsSourceKind,v as exactIsIntegral,N as fromSetting,I as hasWildcard,m as implicitDestination,re as inMemoryDocumentSource,w as isDocumentPlacement,P as isEventsSource,l as isExactNumberToken,le as isQuickFixDiagnostic,D as isSourceStreamName,O as isSourceStreamTypeName,T as isWithinOrSame,ue as legacyOptionalTypeLength,L as matchesPlayPattern,ne as mergeDocuments,R as normalizePlayPath,a as operationDeclarations,u as parseExactNumber,ee as parseForAuthoring,se as parsePlacedDocuments,n as pattern,de as prepareQuickFixes,G as referenceClassifications,h as requiresExplicitDestinations,ie as resolveImports,z as resolvePlayPattern,y as responseCommandResolver,E as samePlacement,K as sliceReferences,A as sliceTypes,r as sourceLocation,k as sourceStreamPattern,B as staticFolderOf,Y as streamIdFailureMessage,q as stronglyConnectedGroups,b as synthesizePersonaCaller,X as tryFormatInteger,Z as tryFormatText,Q as tryFormatUuidText,t as unescapeString};
@@ -1,4 +1,4 @@
1
- import"./_virtual/_virtual/_rolldown/runtime.js";import{identityProperties as e}from"./language.js";import{documentationItem as t}from"./documentation-item.js";import{purposeReferenceItem as n}from"./purpose-items.js";import{eventContextPaths as r}from"./event-context-catalog.js";import"./event-context.js";import{exampleDeclarationItems as i}from"./example-declaration-items.js";import"./scope-items.js";const a=[{label:`optional`,insertText:`optional`,documentation:`Allows the complete value, including a collection, to be absent.`}],fenced=e=>`\`\`\`${e}\n\${1}\n\`\`\``,o=[{label:`description`,insertText:'description "${1:caller details}"',documentation:`Describes the caller metadata.`},{label:`detail from claim`,insertText:'${1:detail} ${2:Type} from claim "${3:claim}"',documentation:`One typed detail sourced from a token claim.`},{label:`detail from query`,insertText:"${1:detail} ${2:Type} from query ${3:Query} by \\$identity.id",documentation:`A keyed, single-result query authorized without additional caller details.`},{label:`detail from code`,insertText:"${1:detail} ${2:Type}\n ```csharp\n ${3:return value;}\n ```",documentation:`An opaque inline source; authoring metadata, not executable.`},{label:`detail from file`,insertText:"${1:detail} ${2:Type}\n file ${3:Path}",documentation:`One file source; no refresh or cache directives.`}];function contextVariableEntries(t){let n=[...new Map((t.identityDetails??[]).map(e=>[e.name,e])).values()];return[...U,...n.filter(t=>!e.includes(t.name)).map(e=>({label:`$identity.${e.name}`,insertText:`\\$identity.${e.name}`,detail:e.type,documentation:`Declared caller detail. Authoring metadata only; executable reads report PLAY0268 until admitted (#600).`}))]}const s=[{label:`time zone`,insertText:'time zone "${1:Europe/Oslo}"',documentation:`Application calendar (decisions 0106/0107). Syntax-only; binding reports PLAY0268. Never falls back to the machine zone.`},{label:`time zone configurable default`,insertText:'time zone configurable default "${1:Europe/Oslo}"',documentation:`Configurable application calendar default. Syntax-only; binding reports PLAY0268.`},{label:`command reads protected`,insertText:`command reads protected`,documentation:`Opts the application into protected command reads (ESM v25). Required absence rejects with Validation; matching intervening facts conflict. Each view and input key must pass admission; targets require separate version support.`},{label:`reaction batches atomic`,insertText:`reaction batches atomic`,documentation:`Opts the composed application into atomic direct and refusal-branch reaction batches (ESM v22). Omit only to retain legacy per-fact behavior.`},{label:`identity`,insertText:'identity\n ${1:detail} ${2:Type} from claim "${3:claim}"',documentation:`Typed additional caller details; authoring metadata only, at most one block per application.`},{label:`purpose`,insertText:'purpose ${1:Name}\n description "${2:processing intent}"\n basis ${3|consent,contract,legalObligation,vitalInterests,publicTask,legitimateInterests|}',documentation:`Report-only processing metadata. Not legal advice; referenced by module, feature and slice.`},...i,{label:`eventsource`,insertText:"eventsource ${1:Name}\n identifier ${2:Type}\n stream ${3:Name}",documentation:`Application-owned source with nested streams, admitted by ESM v8. Pin the stored name before renaming a source with stored events; Default is reserved.`},{label:`system`,insertText:'system ${1:Name}\n description "${2:external system}"',documentation:`Application-scoped external system; not admitted by any supported executable model (ESM) version yet.`},{label:`import`,insertText:"import ${1:Module}.${2:Type}",documentation:`Imports a type from another module by its qualified name.`},{label:`import from`,insertText:'import ${1:Module}.${2:Event} from "${3:origin}"',documentation:`Imports a public event contract with a nonblank opaque origin, not a file path. An import has no local shape, so executable binding still refuses it with PLAY0268.`},{label:`import "…"`,insertText:'import "${1:**/*.play}"',documentation:"Imports other `.play` files by path or glob, relative to this file's folder, as whole documents of the application."},{label:`concept`,insertText:"concept ${1:Name} : ${2|Uuid,String,Int,Decimal,Bool,Date,DateTime|}",documentation:`Declares a formalized value type wrapping a primitive.`},{label:`concept (enum)`,insertText:"concept ${1:Name} : Enum\n ${2:value}",documentation:`Declares a positional enumeration. Reordering or inserting members changes their stored numbers.`},{label:`concept (pii with reason)`,insertText:'concept ${1:Name} : ${2|String,Uuid,Int,Decimal,Bool,Date,DateTime|} pii\n pii reason "${3:why this value is personal data}"',documentation:`Declares a personal-data concept together with the reason it is personal data.`},{label:`type`,insertText:"type ${1:Name}\n ${2:property} ${3:Type}",documentation:`Declares a composite value type — a named shape built from several properties.`},{label:`policy`,insertText:"policy ${1:Name}\n require ${2:authenticated}",documentation:`Declares a named authorization rule for commands and queries.`},{label:`module`,insertText:`module \${1:Name}
1
+ import"./_virtual/_virtual/_rolldown/runtime.js";import{identityProperties as e}from"./language.js";import{documentationItem as t}from"./documentation-item.js";import{purposeReferenceItem as n}from"./purpose-items.js";import{eventContextPaths as r}from"./event-context-catalog.js";import"./event-context.js";import{exampleDeclarationItems as i}from"./example-declaration-items.js";import"./scope-items.js";const a=[{label:`optional`,insertText:`optional`,documentation:`Allows the complete value, including a collection, to be absent.`}],fenced=e=>`\`\`\`${e}\n\${1}\n\`\`\``,o=[{label:`description`,insertText:'description "${1:caller details}"',documentation:`Describes the caller metadata.`},{label:`detail from claim`,insertText:'${1:detail} ${2:Type} from claim "${3:claim}"',documentation:`One typed detail sourced from a token claim.`},{label:`detail from query`,insertText:"${1:detail} ${2:Type} from query ${3:Query} by \\$identity.id",documentation:`A keyed, single-result query authorized without additional caller details.`},{label:`detail from code`,insertText:"${1:detail} ${2:Type}\n ```csharp\n ${3:return value;}\n ```",documentation:`An opaque inline source; authoring metadata, not executable.`},{label:`detail from file`,insertText:"${1:detail} ${2:Type}\n file ${3:Path}",documentation:`One file source; no refresh or cache directives.`}];function contextVariableEntries(t){let n=[...new Map((t.identityDetails??[]).map(e=>[e.name,e])).values()];return[...G,...n.filter(t=>!e.includes(t.name)).map(e=>({label:`$identity.${e.name}`,insertText:`\\$identity.${e.name}`,detail:e.type,documentation:`Declared caller detail. Authoring metadata only; executable reads report PLAY0268 until admitted (#600).`}))]}const s=[{label:`time zone`,insertText:'time zone "${1:Europe/Oslo}"',documentation:`Application calendar (decisions 0106/0107). Syntax-only; binding reports PLAY0268. Never falls back to the machine zone.`},{label:`time zone configurable default`,insertText:'time zone configurable default "${1:Europe/Oslo}"',documentation:`Configurable application calendar default. Syntax-only; binding reports PLAY0268.`},{label:`command reads protected`,insertText:`command reads protected`,documentation:`Opts the application into protected command reads (ESM v25). Required absence rejects with Validation; matching intervening facts conflict. Each view and input key must pass admission; targets require separate version support.`},{label:`reaction batches atomic`,insertText:`reaction batches atomic`,documentation:`Opts the composed application into atomic direct and refusal-branch reaction batches (ESM v22). Omit only to retain legacy per-fact behavior.`},{label:`identity`,insertText:'identity\n ${1:detail} ${2:Type} from claim "${3:claim}"',documentation:`Typed additional caller details; authoring metadata only, at most one block per application.`},{label:`purpose`,insertText:'purpose ${1:Name}\n description "${2:processing intent}"\n basis ${3|consent,contract,legalObligation,vitalInterests,publicTask,legitimateInterests|}',documentation:`Report-only processing metadata. Not legal advice; referenced by module, feature and slice.`},...i,{label:`eventsource`,insertText:"eventsource ${1:Name}\n identifier ${2:Type}\n stream ${3:Name}",documentation:`Application-owned source with nested streams, admitted by ESM v8. Pin the stored name before renaming a source with stored events; Default is reserved.`},{label:`system`,insertText:'system ${1:Name}\n description "${2:external system}"',documentation:`Application-scoped external system; not admitted by any supported executable model (ESM) version yet.`},{label:`import`,insertText:"import ${1:Module}.${2:Type}",documentation:`Imports a type from another module by its qualified name.`},{label:`import from`,insertText:'import ${1:Module}.${2:Event} from "${3:origin}"',documentation:`Imports a public event contract with a nonblank opaque origin, not a file path. An import has no local shape, so executable binding still refuses it with PLAY0268.`},{label:`import "…"`,insertText:'import "${1:**/*.play}"',documentation:"Imports other `.play` files by path or glob, relative to this file's folder, as whole documents of the application."},{label:`concept`,insertText:"concept ${1:Name} : ${2|Uuid,String,Int,Decimal,Bool,Date,DateTime|}",documentation:`Declares a formalized value type wrapping a primitive.`},{label:`concept (enum)`,insertText:"concept ${1:Name} : Enum\n ${2:value}",documentation:`Declares a positional enumeration. Reordering or inserting members changes their stored numbers.`},{label:`concept (pii with reason)`,insertText:'concept ${1:Name} : ${2|String,Uuid,Int,Decimal,Bool,Date,DateTime|} pii\n pii reason "${3:why this value is personal data}"',documentation:`Declares a personal-data concept together with the reason it is personal data.`},{label:`type`,insertText:"type ${1:Name}\n ${2:property} ${3:Type}",documentation:`Declares a composite value type — a named shape built from several properties.`},{label:`policy`,insertText:"policy ${1:Name}\n require ${2:authenticated}",documentation:`Declares a named authorization rule for commands and queries.`},{label:`module`,insertText:`module \${1:Name}
2
2
  `,documentation:`Declares the top-level namespace — maps to a bounded context.`},{label:`domain`,insertText:"domain ${1:Name}",documentation:`The domain the file belongs to — optional, at most one per file, before everything else.`},{label:`sticky`,insertText:'sticky note on ${4|personas,eventsources,givencontexts,seeddata|}\n description "${1:what the note says}"\n position ${2:0} ${3:0}',documentation:`A sticky note on a domain canvas: personas, eventsources, givencontexts or seeddata.`},{label:`persona`,insertText:'persona ${1:Name}\n description "${2:who they are}"',documentation:`A named role interacting with the application, with the policies it holds.`},{label:`authentication`,insertText:"authentication\n provider ${1:Name}\n ${2:setting} ${3:value}",documentation:`Declares the identity providers of the application — at most one block per file.`},{label:`seed`,insertText:`seed
3
3
  for \${1:EventSourceId}
4
4
  \${2:EventType}`,documentation:`Declares events to seed into the event store per event source id.`},{label:`layout`,insertText:"layout ${1:Name}\n ${2:slot}",documentation:`Declares the application shell with named slots.`},{label:`theme`,insertText:"theme ${1:Name}\n compatible with ${2:Package}",documentation:`Declares a theme and the component packages it is compatible with.`},{label:`sample data`,insertText:'sample data ${1:Name}\n title "${2:Title}"\n locale ${3:en-GB}\n shape ${4:ReadModel}\n row\n ${5:field} = ${6:"value"}',documentation:`Declares a pack of demo rows a design surface or preview shows instead of a backend. Design and preview time only.`},{label:`ui profile`,insertText:"ui profile ${1:Name}\n target platform ${2:web}\n layout ${3:Layout}\n theme ${4:Theme}",documentation:`Binds a target platform and size to a layout, theme and component packages.`},{label:`behavior`,insertText:"behavior ${1:Name}\n on ${2:click}\n ${3:execute command}",documentation:"A named interaction wiring, attached to a screen, form or dialog with `uses`."},{label:`trigger`,insertText:"trigger ${1:Name}\n ${2:property} ${3:Type}",documentation:`Declares an integration signal a reaction can run on.`}],c=[{label:`uses`,insertText:"uses ${1:System}",documentation:`Exactly one application-scoped external system.`},{label:`description`,insertText:'description "${1:intent}"',documentation:`Describes operation intent, without requiring code.`},{label:`input`,insertText:"${1:input} ${2:Type}",documentation:`Typed operation input; no identifier or generated modifier.`},{label:`execute`,insertText:`execute
@@ -17,8 +17,8 @@ import"./_virtual/_virtual/_rolldown/runtime.js";import{identityProperties as e}
17
17
  \${2:argument} = \${3:value}
18
18
  then error`,documentation:`Asserts a Validation rejection of one query, with no action or other outcomes. Executable from ESM v18.`},{label:`then error`,insertText:`then error`,documentation:`A rejection, for a reason this specification does not name. After one actionless query, asserts exactly Validation (ESM v18), not a shape error or denial.`},{label:`then error "..."`,insertText:'then error "${1:reason}"',documentation:`A rejection, for the named reason. After one actionless query, asserts exactly Validation (ESM v18); cannot accompany results, no result, denial or another outcome.`},{label:`given clock`,insertText:'given clock "${1:2026-10-05T08:00:00Z}"',documentation:`The instant the scenario happens at - the occurrence time of everything it does. At most once.`},{label:`given capture`,insertText:"given capture ${1:Capture}\n ${2:field} = ${3:value}",documentation:`A record the capture's source held before.`},{label:`when clock`,insertText:'when clock "${1:2026-10-05T09:00:00Z}"',documentation:`The clock reaches an instant, as the action.`},{label:`when trigger`,insertText:"when trigger ${1:Trigger}\n ${2:value} = ${3:value}",documentation:`An application trigger fires, as the action.`},{label:`when capture`,insertText:"when capture ${1:Capture}\n ${2:field} = ${3:value}",documentation:`The record a capture's source holds now, as the action.`},{label:`when query`,insertText:"when query ${1:Query}\n ${2:argument} = ${3:value}",documentation:`Performs a query. Assert results or genuine absence; a concept-rule violation is rejected and can be asserted with then error from ESM v18.`},{label:`then result`,insertText:"then result\n ${1:property} = ${2:value}",documentation:"One result the query performed by `when query` returns, in order."},{label:`then no result`,insertText:`then no result`,documentation:"The query performed by `when query` returns nothing."},{label:`then no events`,insertText:`then no events`,documentation:`Asserts the action appended no events, including after when append, where no reaction appended anything. Executable from ESM v17; cannot accompany event, error or denial expectations.`},{label:`then invokes`,insertText:"then invokes ${1:Command}\n ${2:property} = ${3:value}",documentation:`An invocation the slice's own reactions make, with the values it passes; unstated values are not compared. Once stated, every invocation must match in count and order. Executable from ESM v34.`}],A={given:[{label:`operation`,insertText:"operation ${1:Name} fails",documentation:`Syntax-only failure fixture; no children.`},{label:`clock`,insertText:'clock "${1:2026-10-05T08:00:00Z}"',documentation:`The instant the scenario happens at - the occurrence time of everything it does.`},{label:`capture`,insertText:"capture ${1:Capture}\n ${2:field} = ${3:value}",documentation:`A record the capture's source held before. Repeat it for several records.`},{label:`readmodel`,insertText:"readmodel ${1:ReadModelType}\n ${2:property} = ${3:value}",documentation:`Establishes prior read model state directly.`},{label:`caller`,insertText:`caller
19
19
  \${1:authenticated}`,documentation:`The identity the scenario runs as.`}],when:[{label:`redelivered`,insertText:"redelivered ${1:Event} to ${2:Reaction}\n for ${3:value}",documentation:`Selects exactly one given event occurrence and delivers it again to one named reaction; the event is not appended again. Executable from ESM v17.`},{label:`clock`,insertText:'clock "${1:2026-10-05T09:00:00Z}"',documentation:`The clock reaches an instant - what a scheduled reaction responds to.`},{label:`trigger`,insertText:"trigger ${1:Trigger}\n ${2:value} = ${3:value}",documentation:`An application trigger fires, with the values it carries.`},{label:`capture`,insertText:"capture ${1:Capture}\n ${2:field} = ${3:value}",documentation:`The record a capture's source holds now.`},{label:`query`,insertText:"query ${1:Query}\n ${2:argument} = ${3:value}",documentation:"Performs a query; assert returned rows with `then result`, genuine absence with `then no result`, or a Validation rejection with `then error` (ESM v18)."},{label:`append`,insertText:"append ${1:EventType}\n ${2:property} = ${3:value}",documentation:`An event occurs, instead of a command being executed.`}],then:[{label:`operation`,insertText:"operation ${1:Name}\n ${2:input} = ${3:value}",documentation:`Syntax-only partial operation assertion; not admitted by any supported executable model (ESM) version yet.`},{label:`compensated`,insertText:"compensated ${1:Name}",documentation:`Syntax-only compensation assertion; no children.`},{label:`returns value`,insertText:"returns ${1:value}",documentation:`Scalar response expectation, compared by semantic value equality. Executable as ESM v7.`},{label:`returns block`,insertText:"returns\n ${1:field} = ${2:value}",documentation:`Nonempty subset of response fields asserted by name. Executable as ESM v7.`},{label:`result`,insertText:"result\n ${1:property} = ${2:value}",documentation:"One result the query performed by `when query` returns, in order."},{label:`result exactly`,insertText:"result exactly\n ${1:property} = ${2:value}",documentation:`One result, with every property asserted.`},{label:`no result`,insertText:`no result`,documentation:"The query performed by `when query` returns nothing."},{label:`no events`,insertText:`no events`,documentation:`Asserts the action appended no events, including after when append. Executable from ESM v17.`},{label:`readmodel`,insertText:"readmodel ${1:ReadModelType}\n ${2:property} = ${3:value}",documentation:`The read model state expected afterwards.`},{label:`error`,insertText:'error "${1:reason}"',documentation:`A rejection, for the named reason.`},{label:`denied`,insertText:`denied`,documentation:`The action is denied to the caller.`},{label:`invokes`,insertText:"invokes ${1:Command}\n ${2:property} = ${3:value}",documentation:`An invocation the slice's own reactions make, with the values it passes. Executable from ESM v34.`}]},j=[{label:`hint`,insertText:'hint "${1:predicate guidance}"',documentation:`Ordered nonblank authoring guidance. Does not execute or confirm the predicate.`},{label:`file`,insertText:"file ${1:Path}",documentation:`The sole named-rule predicate attachment.`},{label:`csharp`,insertText:fenced(`csharp`),documentation:`Opaque named-rule predicate returning a bool. Requires an admitting target.`}],M=[{label:`implementation`,insertText:`implementation
20
- hint "\${1:predicate guidance}"`,documentation:`Command named-rule intent with optional file or tagged fence. Pending intent cannot bind.`},...j.filter(e=>e.label!==`hint`)],N=[{label:`file`,insertText:"file ${1:Path}",documentation:`Gives the named predicate its implementation in an external C# file.`},{label:`csharp`,insertText:fenced(`csharp`),documentation:`Gives the named predicate its implementation as inline C# returning a bool.`}],P=[{label:`description`,insertText:'description "${1:authorization intent}"',documentation:`Report-only description; does not supply an implementation.`},{label:`require authenticated`,insertText:`require authenticated`,documentation:`Requires an authenticated caller.`},{label:`require anonymous`,insertText:`require anonymous`,documentation:`Admits every caller, including one without an identity. Stands alone, and must be the only gate on the commands and queries it authorizes.`},{label:`require role`,insertText:'require role "${1:role}"',documentation:`Requires the caller to have a role.`},{label:`require not role`,insertText:'require not role "${1:role}"',documentation:`Excludes callers with a role. Add authenticated to require a signed-in caller.`},{label:`require not claim`,insertText:'require not claim "${1:claim}" matches ${2:subject}',documentation:`Requires that no claim value matches the subject or a value.`},{label:`require claim`,insertText:'require claim "${1:claim}" matches ${2:subject}',documentation:`Requires a claim to match the subject or a value.`},{label:`csharp`,insertText:fenced(`csharp`),documentation:`Fully custom policy logic in C#, returning a bool.`}],F=[{label:`not empty`,insertText:'${1:property} not empty message "${2:message}"',documentation:`Text needs a non-whitespace character; null, empty and whitespace-only text fail. Uses Unicode White_Space (.NET char.IsWhiteSpace), including U+0085 but not U+FEFF, not JavaScript trim(). Collections need at least one element. Applies to concept and command rules in every ESM version; no trimming. Identity text is unchanged.`},{label:`max`,insertText:'${1:property} max ${2:500} message "${3:message}"',documentation:`Maximum length or value.`},{label:`min`,insertText:'${1:property} min ${2:1} message "${3:message}"',documentation:`Minimum length or value.`},{label:`contains`,insertText:'${1:property} contains "${2:text}"',documentation:`Literal ordinal UTF-16 substring comparison on scalar text.`},{label:`not contains`,insertText:'${1:property} not contains "${2:text}"',documentation:`Rejects text containing the literal operand, compared ordinally.`},{label:`decimals <=`,insertText:'${1:property} decimals <= ${2:2} message "${3:message}"',documentation:`At most this many decimal places (0 to 28) on a Decimal value; trailing zeros do not count.`},{label:`starts with`,insertText:'${1:property} starts with "${2:text}"',documentation:`Literal ordinal UTF-16 prefix comparison on scalar text.`},{label:`ends with`,insertText:'${1:property} ends with "${2:text}"',documentation:`Literal ordinal UTF-16 suffix comparison on scalar text.`},{label:`matches`,insertText:'${1:property} matches "${2:pattern}" message "${3:message}"',documentation:`Searches text using the portable flagless JavaScript match dialect. Use ^ and $ for the whole input. Exact legacy Studio text-rule lookarounds warn with PLAY0787 and lower to ordinal rules; other lookarounds and backreferences report PLAY0699. Named email rejects JavaScript whitespace, including U+00A0.`},{label:`rule`,insertText:'${1:property} rule ${2:PredicateName} message "${3:message}"',documentation:"Names a predicate — optionally followed by an indented `file` reference or inline `csharp` block giving it a body; bare, it just states that a constraint exists."},{label:`==`,insertText:'${1:property} == ${2:value} message "${3:message}"',documentation:`The property must equal the value.`},{label:`!=`,insertText:'${1:property} != ${2:value} message "${3:message}"',documentation:`The property must not equal the value.`},{label:`length ==`,insertText:'${1:property} length == ${2:3} message "${3:message}"',documentation:`The property must have an exact length.`},{label:`all >`,insertText:'${1:collection}.${2:property} all > ${3:0} message "${4:message}"',documentation:`Every element of a collection must satisfy the comparison.`}],I=[{label:`description`,insertText:'description "${1:screen intent}"',documentation:`Report-only description, not a localizable screen title.`},{label:`data`,insertText:"data ${1:ReadModel} via query ${2:QueryName}",documentation:`Binds a read model to the screen through a query.`},{label:`action`,insertText:"action ${1:CommandName}",documentation:`Makes a command available as an action on the screen.`},{label:`action "…"`,insertText:'action "${1:Label}"\n when item.${2:status} == "${3:open}" execute ${4:CommandName}\n otherwise hidden',documentation:`One labeled button selecting the first matching command; hidden without a subject or match.`},{label:`layout`,insertText:"layout ${1:LayoutName}",documentation:`Uses a layout template and fills its slots.`},{label:`section`,insertText:"section ${1:name}",documentation:`A named structural section of the screen.`},{label:`table`,insertText:'table ${1:name}\n column ${2:property} label "${3:text}"',documentation:`A table widget over a read model or collection.`},{label:`summary`,insertText:'summary ${1:ReadModel}\n field ${2:property} label "${3:text}"',documentation:`A summary widget showing labeled fields.`},{label:`title`,insertText:'title "${1:text}"',documentation:`The title of the screen or section.`},{label:`file`,insertText:"file ${1:Path}",documentation:`Full external implementation — Stage uses the referenced file.`},{label:`react`,insertText:fenced(`react`),documentation:`Inline React/TSX component receiving the data contract as Props.`},{label:`typescript`,insertText:fenced(`typescript`),documentation:`Inline plain TypeScript.`},{label:`html`,insertText:fenced(`html`),documentation:`Inline static HTML.`}],L=[{label:`navigate to`,insertText:"navigate to ${1:ScreenName}",documentation:`Navigates to a screen after the action completes.`},{label:`label`,insertText:'label "${1:text}"',documentation:`The display label of the action.`}],R=[{label:`when … execute`,insertText:'when item.${1:status} == "${2:open}" execute ${3:CommandName}',documentation:`First matching alternative selects the command; authorization never falls through.`},{label:`otherwise hidden`,insertText:`otherwise hidden`,documentation:`Hides the action when no alternative matches; also the default.`},{label:`otherwise execute`,insertText:"otherwise execute ${1:CommandName}",documentation:`Selects a fallback command when no alternative matches and a subject exists.`},...L.filter(e=>e.label!==`label`)],z=[{label:`execute`,insertText:"execute ${1:CommandName}",documentation:`Executes a command; denial never selects another alternative.`},{label:`navigate to`,insertText:"navigate to ${1:ScreenName}",documentation:`Navigates to the named screen.`},{label:`open dialog`,insertText:"open dialog ${1:DialogTemplate}",documentation:`Opens a dialog.`},{label:`notify`,insertText:'notify info "${1:Message}"',documentation:`Displays a message.`},{label:`confirm`,insertText:`confirm "\${1:Message}"
20
+ hint "\${1:predicate guidance}"`,documentation:`Command named-rule intent with optional file or tagged fence. Pending intent cannot bind.`},...j.filter(e=>e.label!==`hint`)],N=[{label:`file`,insertText:"file ${1:Path}",documentation:`Gives the named predicate its implementation in an external C# file.`},{label:`csharp`,insertText:fenced(`csharp`),documentation:`Gives the named predicate its implementation as inline C# returning a bool.`}],P=[{label:`description`,insertText:'description "${1:authorization intent}"',documentation:`Report-only description; does not supply an implementation.`},{label:`require authenticated`,insertText:`require authenticated`,documentation:`Requires an authenticated caller.`},{label:`require anonymous`,insertText:`require anonymous`,documentation:`Admits every caller, including one without an identity. Stands alone, and must be the only gate on the commands and queries it authorizes.`},{label:`require role`,insertText:'require role "${1:role}"',documentation:`Requires the caller to have a role.`},{label:`require not role`,insertText:'require not role "${1:role}"',documentation:`Excludes callers with a role. Add authenticated to require a signed-in caller.`},{label:`require not claim`,insertText:'require not claim "${1:claim}" matches ${2:subject}',documentation:`Requires that no claim value matches the subject or a value.`},{label:`require claim`,insertText:'require claim "${1:claim}" matches ${2:subject}',documentation:`Requires a claim to match the subject or a value.`},{label:`csharp`,insertText:fenced(`csharp`),documentation:`Fully custom policy logic in C#, returning a bool.`}],F=[{label:`not empty`,insertText:'${1:property} not empty message "${2:message}"',documentation:`Text needs a non-whitespace character; null, empty and whitespace-only text fail. Uses Unicode White_Space (.NET char.IsWhiteSpace), including U+0085 but not U+FEFF, not JavaScript trim(). Collections need at least one element. Applies to concept and command rules in every ESM version; no trimming. Identity text is unchanged.`},{label:`max`,insertText:'${1:property} max ${2:500} message "${3:message}"',documentation:`Maximum length or value.`},{label:`min`,insertText:'${1:property} min ${2:1} message "${3:message}"',documentation:`Minimum length or value.`},{label:`contains`,insertText:'${1:property} contains "${2:text}"',documentation:`Literal ordinal UTF-16 substring comparison on scalar text.`},{label:`not contains`,insertText:'${1:property} not contains "${2:text}"',documentation:`Rejects text containing the literal operand, compared ordinally.`},{label:`decimals <=`,insertText:'${1:property} decimals <= ${2:2} message "${3:message}"',documentation:`At most this many decimal places (0 to 28) on a Decimal value; trailing zeros do not count.`},{label:`starts with`,insertText:'${1:property} starts with "${2:text}"',documentation:`Literal ordinal UTF-16 prefix comparison on scalar text.`},{label:`ends with`,insertText:'${1:property} ends with "${2:text}"',documentation:`Literal ordinal UTF-16 suffix comparison on scalar text.`},{label:`matches`,insertText:'${1:property} matches "${2:pattern}" message "${3:message}"',documentation:`Searches text using the portable flagless JavaScript match dialect. Use ^ and $ for the whole input. Exact legacy Studio text-rule lookarounds warn with PLAY0787 and lower to ordinal rules; other lookarounds and backreferences report PLAY0699. Named email rejects JavaScript whitespace, including U+00A0.`},{label:`rule`,insertText:'${1:property} rule ${2:PredicateName} message "${3:message}"',documentation:"Names a predicate — optionally followed by an indented `file` reference or inline `csharp` block giving it a body; bare, it just states that a constraint exists."},{label:`==`,insertText:'${1:property} == ${2:value} message "${3:message}"',documentation:`The property must equal the value.`},{label:`!=`,insertText:'${1:property} != ${2:value} message "${3:message}"',documentation:`The property must not equal the value.`},{label:`length ==`,insertText:'${1:property} length == ${2:3} message "${3:message}"',documentation:`The property must have an exact length.`},{label:`all >`,insertText:'${1:collection}.${2:property} all > ${3:0} message "${4:message}"',documentation:`Every element of a collection must satisfy the comparison.`}],I=[{label:`description`,insertText:'description "${1:screen intent}"',documentation:`Report-only description, not a localizable screen title.`},{label:`data`,insertText:"data ${1:ReadModel} via query ${2:QueryName}",documentation:`Binds a read model to the screen through a query.`},{label:`action`,insertText:"action ${1:CommandName} for ${2|item,screen|}",documentation:`Makes a command available for the selected item or for the screen as a whole.`},{label:`action "…"`,insertText:'action "${1:Label}" for item\n when item.${2:status} == "${3:open}" execute ${4:CommandName}\n otherwise hidden',documentation:`One labeled button selecting the first matching command; hidden without a subject or match.`},{label:`layout`,insertText:"layout ${1:LayoutName}",documentation:`Uses a layout template and fills its slots.`},{label:`section`,insertText:"section ${1:name}",documentation:`A named structural section of the screen.`},{label:`table`,insertText:'table ${1:name}\n column ${2:property} label "${3:text}"',documentation:`A table widget over a read model or collection.`},{label:`summary`,insertText:'summary ${1:ReadModel}\n field ${2:property} label "${3:text}"',documentation:`A summary widget showing labeled fields.`},{label:`title`,insertText:'title "${1:text}"',documentation:`The title of the screen or section.`},{label:`file`,insertText:"file ${1:Path}",documentation:`Full external implementation — Stage uses the referenced file.`},{label:`react`,insertText:fenced(`react`),documentation:`Inline React/TSX component receiving the data contract as Props.`},{label:`typescript`,insertText:fenced(`typescript`),documentation:`Inline plain TypeScript.`},{label:`html`,insertText:fenced(`html`),documentation:`Inline static HTML.`}],L=[{label:`for item`,insertText:`for item`,documentation:`Requires one nearest data subject (a record or selected collection item). Binds compatible same-name inputs, then a unique nominal identifier/key match.`},{label:`for screen`,insertText:`for screen`,documentation:`The action is screen-scoped; plain and toolbar actions do not fill inputs from selected rows.`}],R=L.map(e=>({...e,label:e.label.slice(4),insertText:e.insertText.slice(4)})),z=[{label:`with … from`,insertText:"with ${1:property} from item.${2:property}",documentation:`Explicit input binding, before compatible same-name and declared identifier/key bindings.`},{label:`navigate to`,insertText:"navigate to ${1:ScreenName}",documentation:`Navigates to a screen after the action completes.`},{label:`label`,insertText:'label "${1:text}"',documentation:`The display label of the action.`}],B=[{label:`when … execute`,insertText:'when item.${1:status} == "${2:open}" execute ${3:CommandName}',documentation:`First matching alternative selects the command; authorization never falls through.`},{label:`otherwise hidden`,insertText:`otherwise hidden`,documentation:`Hides the action when no alternative matches; also the default.`},{label:`otherwise execute`,insertText:"otherwise execute ${1:CommandName}",documentation:`Selects a fallback command when no alternative matches and a subject exists.`},...z.filter(e=>e.label!==`label`&&e.label!==`with … from`)],V=[{label:`execute`,insertText:"execute ${1:CommandName}",documentation:`Executes a command; denial never selects another alternative.`},{label:`navigate to`,insertText:"navigate to ${1:ScreenName}",documentation:`Navigates to the named screen.`},{label:`open dialog`,insertText:"open dialog ${1:DialogTemplate}",documentation:`Opens a dialog.`},{label:`notify`,insertText:'notify info "${1:Message}"',documentation:`Displays a message.`},{label:`confirm`,insertText:`confirm "\${1:Message}"
21
21
  on success
22
- execute \${2:CommandName}`,documentation:`Asks before continuing.`},{label:`refresh`,insertText:"refresh ${1:QueryName}",documentation:`Refreshes a query-backed element.`}],B=[{label:`when …`,insertText:'when item.${1:status} == "${2:open}"\n execute ${3:CommandName}',documentation:`Selects a whole action list once against the rendered subject at gesture time.`},{label:`otherwise`,insertText:`otherwise
23
- notify info "\${1:Message}"`,documentation:`Final fallback list; without a subject nothing runs, including fallback.`},...z],V=[{label:`with … from`,insertText:"with ${1:property} from item.${2:property}",documentation:`Explicit input binding for this command alternative, before same-name item fields or its form.`}],H=[{label:`column`,insertText:'column ${1:property} label "${2:text}"',documentation:`A column bound to a property.`},{label:`on row-click`,insertText:"on row-click navigate to ${1:ScreenName} by ${2:param}",documentation:`Navigates when a row is clicked.`}],U=[...e.map(e=>({label:`$identity.${e}${e===`claims`?`.`:``}`,insertText:`$identity.${e}${e===`claims`?".${1:name}":``}`,documentation:`The caller's ${e}, equivalent to $context.identity.${e}.`})),{label:`$context.occurred`,insertText:`$context.occurred`,documentation:`When the command or query was received.`},{label:`$context.tenant`,insertText:`$context.tenant`,documentation:`The tenant the command or query is executing for.`},{label:`$context.command.`,insertText:"$context.command.${1:property}",documentation:`A property of the command being handled.`},{label:`$context.arguments.`,insertText:"$context.arguments.${1:name}",documentation:`An argument of the query being performed.`},{label:`$context.causedBy.subject`,insertText:`$context.causedBy.subject`,documentation:`Subject of the identity that caused the command or query.`},{label:`$context.causedBy.name`,insertText:`$context.causedBy.name`,documentation:`Display name of the identity that caused the command or query.`},{label:`$context.causedBy.userName`,insertText:`$context.causedBy.userName`,documentation:`User name of the identity that caused the command or query.`},{label:`$context.causation.type`,insertText:`$context.causation.type`,documentation:`What caused this — a command, a reactor, a schedule.`},{label:`$context.identity.id`,insertText:`$context.identity.id`,documentation:`The identifier of the caller from the auth token.`},{label:`$context.identity.name`,insertText:`$context.identity.name`,documentation:`The display name of the caller.`},{label:`$context.identity.userName`,insertText:`$context.identity.userName`,documentation:`The user name of the caller.`},{label:`$context.identity.isAuthenticated`,insertText:`$context.identity.isAuthenticated`,documentation:`Whether the caller is authenticated.`},{label:`$context.identity.roles`,insertText:`$context.identity.roles`,documentation:`The roles the caller holds.`},{label:`$context.identity.claims.`,insertText:"$context.identity.claims.${1:name}",documentation:`The value of a claim the caller carries.`},{label:`$env.`,insertText:"$env.${1:VAR_NAME}",documentation:`An environment variable.`},...r.filter(e=>e.name!==`value`).map(e=>({label:`$eventContext.${e.path}`,insertText:`$eventContext.${e.path}`,documentation:`${e.description} (PDL)`}))],W={StateChange:[`operation`,`file`,`description`,`event`,`event generation`,`command`,`constraint`,`screen`,`specification`],StateView:[`file`,`description`,`readmodel`,`query`,`query observable`,`projection`,`reducer`,`screen`,`specification`,`event`,`event generation`],Automation:[`operation`,`file`,`description`,`reaction`,`reducer`,`command`,`event`,`event generation`,`readmodel`,`specification`],Translate:[`file`,`description`,`capture`,`event`,`event generation`,`specification`]};function sliceItemsFor(e){let t=e?W[e]:void 0;return t?p.filter(n=>n.label===`purpose`||n.label===`example`||n.label===`documentation`||n.label===`public event`||n.label===`event from`||n.label===`direction`&&e===`Translate`||t.includes(n.label)):p}export{V as actionArgumentItems,L as actionItems,m as commandItems,M as commandRuleItems,d as conceptItems,S as constraintItems,contextVariableEntries,U as contextVariableItems,h as eventItems,R as guardedActionItems,y as handlerItems,o as identityItems,v as implementationItems,g as inlineEventItems,z as interactionActionItems,B as interactionChoiceItems,E as invocationItems,j as namedRuleImplementationItems,l as operationImplementationItems,c as operationItems,u as operationPhaseItems,a as optionalTypeItems,x as performerItems,P as policyItems,_ as producesItems,b as queryItems,C as reactionItems,w as reactionTriggerItems,D as refusalItems,N as ruleItems,I as screenItems,p as sliceItems,sliceItemsFor,k as specificationItems,A as specificationStepItems,H as tableItems,s as topLevelItems,O as triggerItems,f as typeItems,F as validateItems};
22
+ execute \${2:CommandName}`,documentation:`Asks before continuing.`},{label:`refresh`,insertText:"refresh ${1:QueryName}",documentation:`Refreshes a query-backed element.`}],H=[{label:`when …`,insertText:'when item.${1:status} == "${2:open}"\n execute ${3:CommandName}',documentation:`Selects a whole action list once against the rendered subject at gesture time.`},{label:`otherwise`,insertText:`otherwise
23
+ notify info "\${1:Message}"`,documentation:`Final fallback list; without a subject nothing runs, including fallback.`},...V],U=[{label:`with … from`,insertText:"with ${1:property} from item.${2:property}",documentation:`Explicit input binding for this command alternative, before compatible same-name fields, a unique nominal identifier/key match, or its form.`}],W=[{label:`column`,insertText:'column ${1:property} label "${2:text}"',documentation:`A column bound to a property.`},{label:`on row-click`,insertText:"on row-click navigate to ${1:ScreenName} by ${2:param}",documentation:`Navigates when a row is clicked.`}],G=[...e.map(e=>({label:`$identity.${e}${e===`claims`?`.`:``}`,insertText:`$identity.${e}${e===`claims`?".${1:name}":``}`,documentation:`The caller's ${e}, equivalent to $context.identity.${e}.`})),{label:`$context.occurred`,insertText:`$context.occurred`,documentation:`When the command or query was received.`},{label:`$context.tenant`,insertText:`$context.tenant`,documentation:`The tenant the command or query is executing for.`},{label:`$context.command.`,insertText:"$context.command.${1:property}",documentation:`A property of the command being handled.`},{label:`$context.arguments.`,insertText:"$context.arguments.${1:name}",documentation:`An argument of the query being performed.`},{label:`$context.causedBy.subject`,insertText:`$context.causedBy.subject`,documentation:`Subject of the identity that caused the command or query.`},{label:`$context.causedBy.name`,insertText:`$context.causedBy.name`,documentation:`Display name of the identity that caused the command or query.`},{label:`$context.causedBy.userName`,insertText:`$context.causedBy.userName`,documentation:`User name of the identity that caused the command or query.`},{label:`$context.causation.type`,insertText:`$context.causation.type`,documentation:`What caused this — a command, a reactor, a schedule.`},{label:`$context.identity.id`,insertText:`$context.identity.id`,documentation:`The identifier of the caller from the auth token.`},{label:`$context.identity.name`,insertText:`$context.identity.name`,documentation:`The display name of the caller.`},{label:`$context.identity.userName`,insertText:`$context.identity.userName`,documentation:`The user name of the caller.`},{label:`$context.identity.isAuthenticated`,insertText:`$context.identity.isAuthenticated`,documentation:`Whether the caller is authenticated.`},{label:`$context.identity.roles`,insertText:`$context.identity.roles`,documentation:`The roles the caller holds.`},{label:`$context.identity.claims.`,insertText:"$context.identity.claims.${1:name}",documentation:`The value of a claim the caller carries.`},{label:`$env.`,insertText:"$env.${1:VAR_NAME}",documentation:`An environment variable.`},...r.filter(e=>e.name!==`value`).map(e=>({label:`$eventContext.${e.path}`,insertText:`$eventContext.${e.path}`,documentation:`${e.description} (PDL)`}))],K={StateChange:[`operation`,`file`,`description`,`event`,`event generation`,`command`,`constraint`,`screen`,`specification`],StateView:[`file`,`description`,`readmodel`,`query`,`query observable`,`projection`,`reducer`,`screen`,`specification`,`event`,`event generation`],Automation:[`operation`,`file`,`description`,`reaction`,`reducer`,`command`,`event`,`event generation`,`readmodel`,`specification`],Translate:[`file`,`description`,`capture`,`event`,`event generation`,`specification`]};function sliceItemsFor(e){let t=e?K[e]:void 0;return t?p.filter(n=>n.label===`purpose`||n.label===`example`||n.label===`documentation`||n.label===`public event`||n.label===`event from`||n.label===`direction`&&e===`Translate`||t.includes(n.label)):p}export{U as actionArgumentItems,z as actionItems,L as actionSubjectItems,R as actionSubjectValueItems,m as commandItems,M as commandRuleItems,d as conceptItems,S as constraintItems,contextVariableEntries,G as contextVariableItems,h as eventItems,B as guardedActionItems,y as handlerItems,o as identityItems,v as implementationItems,g as inlineEventItems,V as interactionActionItems,H as interactionChoiceItems,E as invocationItems,j as namedRuleImplementationItems,l as operationImplementationItems,c as operationItems,u as operationPhaseItems,a as optionalTypeItems,x as performerItems,P as policyItems,_ as producesItems,b as queryItems,C as reactionItems,w as reactionTriggerItems,D as refusalItems,N as ruleItems,I as screenItems,p as sliceItems,sliceItemsFor,k as specificationItems,A as specificationStepItems,W as tableItems,s as topLevelItems,O as triggerItems,f as typeItems,F as validateItems};
24
24
  //# sourceMappingURL=completion-items.js.map