@cratis/screenplay-language 4.202.0 → 4.204.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundles/compiler/Parsing/ProjectionParser.js +1 -1
- package/dist/bundles/compiler/Parsing/ProjectionParser.js.map +1 -1
- package/dist/bundles/compiler/Syntax/ScreenplaySyntaxWalker.js +1 -1
- package/dist/bundles/compiler/Syntax/ScreenplaySyntaxWalker.js.map +1 -1
- package/dist/bundles/compiler/Syntax/SyntaxCollections.js +1 -1
- package/dist/bundles/compiler/Syntax/SyntaxCollections.js.map +1 -1
- package/dist/bundles/compiler/Syntax/SyntaxJson.js +1 -1
- package/dist/bundles/compiler/Syntax/SyntaxJson.js.map +1 -1
- package/dist/bundles/completion-planner.js +1 -1
- package/dist/bundles/completion-planner.js.map +1 -1
- package/dist/bundles/keyword-docs.js +1 -1
- package/dist/bundles/keyword-docs.js.map +1 -1
- package/dist/bundles/read-model-key-completions.js +1 -1
- package/dist/bundles/read-model-key-completions.js.map +1 -1
- package/dist/bundles/sub-languages/pdl.js +1 -1
- package/dist/bundles/sub-languages/pdl.js.map +1 -1
- package/dist/bundles/sub-languages/projection/HoverProvider.js +1 -1
- package/dist/bundles/sub-languages/projection/HoverProvider.js.map +1 -1
- package/dist/sub-languages/pdl.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../../_virtual/_virtual/_rolldown/runtime.js";import{DiagnosticCodes as e}from"../Diagnostics/DiagnosticCodes.js";import{pattern as t}from"../Text/patterns.js";import{locationOf as n}from"./SourceLine.js";import{diagnosticText as r}from"../Diagnostics/DiagnosticArgument.js";import{firstWord as i,splitTopLevel as a,unescapeIdentifier as o}from"./LineText.js";import{parseDescription as s}from"./DescriptionParser.js";import{isFileDirective as c}from"./FileReferences.js";import{parseProjectionExpression as l}from"./ProjectionExpressionParser.js";const u=t(`^projection\\s+(@?[\\w.]+)\\s*(?:=>\\s*([\\w.]+))?$`),d=t(`^(@?[\\w.]+)(?:\\s+key\\s+(.+))?$`),f=t(`^join\\s+(@?[\\w.]+)\\s+on\\s+(@?[\\w.]+)$`),p=t(`^with\\s+(@?[\\w.]+)$`),m=t(`^children\\s+(@?[\\w.]+)\\s+identified\\s+by\\s+(.+)$`),h=t(`^nested\\s+(@?[\\w.]+)$`),g=t(`^remove\\s+with\\s+(@?[\\w.]+)(?:\\s+key\\s+(.+))?$`),_=t(`^remove\\s+via\\s+join\\s+on\\s+(@?[\\w.]+)(?:\\s+key\\s+(.+))?$`),v=t(`^clear\\s+with\\s+(@?[\\w.]+)$`),y=t(`^variant\\s+(@?[\\w.]+)\\s*$`),b=t(`^enters\\s+on\\s+(@?[\\w.]+)(?:\\s+key\\s+(.+))?$`),x=t(`^(increment|decrement|count|clear)\\s+(@?[$\\w.]+)$`),S=t(`^(add|subtract)\\s+(@?[$\\w.]+)\\s+by\\s+(.+)$`),C=t(`^set\\s+(@?[$\\w.]+)\\s+(?:=|to)\\s+(.+)$`),w=t(`^(@?[$\\w.@]+)\\s*=(?!=|>)\\s*(.+)$`),T={increment:`IncrementMappingSyntax`,decrement:`DecrementMappingSyntax`,clear:`ClearMappingSyntax`,count:`CountMappingSyntax`};function parseProjection(t,r){let a=u.exec(r.content);if(a===null)return t.error(e.InvalidProjectionDeclaration,`Invalid projection declaration '${r.content}' - expected 'projection <Name> [=> <ReadModel>]'`,n(r)),t.skipBlock(r.indent),{kind:`ProjectionSyntax`,sourceOptions:t.sourceOptions,name:i(r.content),readModel:null,sequence:null,autoMap:`Inherit`,blocks:[],location:n(r)};let o=a[1],l=null,d=null,f=`Inherit`,p=null,m=[];for(let e=t.peekChild(r.indent);e!==void 0;e=t.peekChild(r.indent)){if(t.reader.takeSignificant(),c(e))continue;let n=i(e.content);if(n===`description`)d=s(t,e,d,`Projection '${o}'`);else if(n===`sequence`)l=e.content.substring(8).trim();else if(n===`automap`)f=`Enabled`;else if(e.content===`no automap`)f=`Disabled`;else if(n===`key`)p=parseKey(t,e);else if(n===`variant`)m.push(parseVariant(t,e));else{let n=parseBlock(t,e,!1);n!==void 0&&m.push(n)}}return reportVariantConflicts(t,m,o),m.length===0&&t.error(e.EmptyProjection,`Projection '${o}' must contain at least one directive`,n(r)),{kind:`ProjectionSyntax`,sourceOptions:t.sourceOptions,name:o,readModel:a[2]??null,sequence:l,autoMap:f,key:p,blocks:m,description:d,location:n(r)}}function reportVariantConflicts(t,n,r){let i=n.filter(e=>e.kind===`ProjectionVariantSyntax`),a=/* @__PURE__ */ new Map;i.forEach(e=>a.set(e.name,[...a.get(e.name)??[],e]));for(let n of[...a.values()].flatMap(e=>e.slice(1)))t.error(e.DuplicateProjectionVariant,`Duplicate variant '${n.name}' - a variant name is declared once`,n.location);let o=/* @__PURE__ */ new Set;for(let i of n.flatMap(e=>e.kind===`ProjectionVariantSyntax`?e.entersOn:[]))i.event.length>0&&o.has(i.event)&&t.error(e.DuplicateVariantEnteringEvent,`Entering event '${i.event}' is claimed more than once in projection '${r}'`,i.location),o.add(i.event)}function parseBlock(t,r,a){let o=n(r);switch(i(r.content)){case`from`:return parseFrom(t,r);case`every`:{let e=!0,{autoMap:n,mappings:i}=parseMappingBlock(t,r,t=>t.content===`exclude children`&&(e=!1,!0));return{kind:`EverySyntax`,includeChildren:e,autoMap:n,mappings:i,location:o}}case`all`:{let{autoMap:e,mappings:n}=parseMappingBlock(t,r);return{kind:`AllSyntax`,autoMap:e,mappings:n,location:o}}case`join`:return parseJoin(t,r);case`children`:return parseChildren(t,r);case`nested`:return parseNested(t,r);case`remove`:return parseRemove(t,r);case`clear`:return a||t.error(e.ClearWithOutsideNestedBlock,`'clear with' is only valid inside a nested block`,o),parseClearWith(t,r);default:t.error(e.UnknownProjectionDirective,`Unexpected '${i(r.content)}' in projection body`,o),t.skipBlock(r.indent);return}}function parseFrom(t,r){let s=[];for(let i of a(r.content.substring(4),`,`)){let a=i.trim();if(a.length===0){t.error(e.FromWithoutEvent,`Expected an event type after 'from'`,n(r));continue}let c=d.exec(a);c===null?t.error(e.InvalidEventReference,`Invalid event reference '${a}'`,n(r)):s.push({kind:`EventSpecSyntax`,event:o(c[1]),key:c[2]===void 0?null:l(c[2],n(r),t),location:n(r)})}let c=[],u=null,f=null;for(let e=t.peekChild(r.indent);e!==void 0;e=t.peekChild(r.indent)){t.reader.takeSignificant();let r=i(e.content);r===`key`?u=parseKey(t,e):r===`parent`?f=l(e.content.substring(6),n(e),t):pushMapping(t,e,c)}return{kind:`FromSyntax`,events:s,key:u,parentKey:f,mappings:c,location:n(r)}}function parseJoin(t,r){let i=f.exec(r.content);if(i===null)return t.error(e.InvalidJoinDeclaration,`Invalid join declaration '${r.content}' - expected 'join <property> on <key>'`,n(r)),t.skipBlock(r.indent),{kind:`JoinSyntax`,property:``,on:``,events:[],location:n(r)};let a=[];for(let i=t.peekChild(r.indent);i!==void 0;i=t.peekChild(r.indent)){t.reader.takeSignificant();let r=p.exec(i.content);if(r===null){t.error(e.JoinWithoutEvent,`Expected 'with <EventType>' in join block, got '${i.content}'`,n(i)),t.skipBlock(i.indent);continue}let{autoMap:s,mappings:c}=parseMappingBlock(t,i);a.push({kind:`JoinEventSyntax`,event:o(r[1]),autoMap:s,mappings:c,location:n(i)})}return{kind:`JoinSyntax`,property:o(i[1]),on:o(i[2]),events:a,location:n(r)}}function parseChildren(t,r){let i=m.exec(r.content);if(i===null)return t.error(e.InvalidChildrenDeclaration,`Invalid children declaration '${r.content}' - expected 'children <collection> identified by <key>'`,n(r)),t.skipBlock(r.indent),{kind:`ChildrenSyntax`,property:``,autoMap:`Inherit`,blocks:[],location:n(r)};let{autoMap:a,blocks:s}=parseChildBlocks(t,r);return{kind:`ChildrenSyntax`,property:o(i[1]),identifiedBy:l(i[2],n(r),t),autoMap:a,blocks:s,location:n(r)}}function parseNested(t,r){let i=h.exec(r.content);if(i===null)return t.error(e.InvalidNestedDeclaration,`Invalid nested declaration '${r.content}' - expected 'nested <property>'`,n(r)),t.skipBlock(r.indent),{kind:`NestedSyntax`,property:``,autoMap:`Inherit`,blocks:[],location:n(r)};let a=o(i[1]),{autoMap:s,blocks:c}=parseChildBlocks(t,r);return c.some(e=>e.kind===`FromSyntax`)||t.error(e.NestedBlockWithoutFrom,`Nested block '${a}' must contain at least one 'from' directive`,n(r)),{kind:`NestedSyntax`,property:a,autoMap:s,blocks:c,location:n(r)}}function parseChildBlocks(e,t){let n=[],r=`Inherit`;for(let i=e.peekChild(t.indent);i!==void 0;i=e.peekChild(t.indent)){if(e.reader.takeSignificant(),i.content===`automap`){r=`Enabled`;continue}if(i.content===`no automap`){r=`Disabled`;continue}let t=parseBlock(e,i,!0);t!==void 0&&n.push(t)}return{autoMap:r,blocks:n}}function parseRemove(t,r){let a=_.exec(r.content);if(a!==null)return{kind:`RemoveViaJoinSyntax`,event:o(a[1]),key:a[2]===void 0?null:l(a[2],n(r),t),location:n(r)};let s=g.exec(r.content);if(s===null){t.error(e.InvalidRemoveDeclaration,`Invalid remove declaration '${r.content}' - expected 'remove with <EventType>' or 'remove via join on <EventType>'`,n(r)),t.skipBlock(r.indent);return}let c=null;for(let a=t.peekChild(r.indent);a!==void 0;a=t.peekChild(r.indent))t.reader.takeSignificant(),i(a.content)===`parent`?c=l(a.content.substring(6),n(a),t):t.error(e.UnknownRemoveDirective,`Unexpected '${a.content}' in remove block - only 'parent' is allowed`,n(a));return{kind:`RemoveWithSyntax`,event:o(s[1]),key:s[2]===void 0?null:l(s[2],n(r),t),parentKey:c,location:n(r)}}function parseClearWith(t,r){let i=v.exec(r.content);return i===null?(t.error(e.InvalidClearDeclaration,`Invalid clear declaration '${r.content}' - expected 'clear with <EventType>'`,n(r)),{kind:`ClearWithSyntax`,event:``,location:n(r)}):{kind:`ClearWithSyntax`,event:o(i[1]),location:n(r)}}function parseVariant(t,r){let a=y.exec(r.content);if(a===null)return t.error(e.InvalidProjectionVariantDeclaration,`Invalid variant declaration '${r.content}' - expected 'variant <Name>'`,n(r)),t.skipBlock(r.indent),{kind:`ProjectionVariantSyntax`,name:i(r.content),entersOn:[],blocks:[],location:n(r)};let s=o(a[1]),c=[],l=[];for(let a=t.peekChild(r.indent);a!==void 0;a=t.peekChild(r.indent)){t.reader.takeSignificant();let r=i(a.content);if(r===`enters`)c.push(parseEntersOn(t,a));else if(r===`variant`)t.error(e.NestedProjectionVariantNotAllowed,`A variant cannot be declared inside another variant`,n(a)),t.skipBlock(a.indent);else{let e=parseBlock(t,a,!1);e!==void 0&&l.push(e)}}return c.length===0&&t.error(e.VariantRequiresEnteringEvent,`Variant '${s}' must declare at least one 'enters on' event`,n(r)),{kind:`ProjectionVariantSyntax`,name:s,entersOn:c,blocks:l,location:n(r)}}function parseEntersOn(t,r){let i=b.exec(r.content);return i===null?(t.error(e.InvalidEntersOnDeclaration,`Invalid 'enters on' declaration '${r.content}' - expected 'enters on <EventType> [key <expression>]'`,n(r)),t.skipBlock(r.indent),{kind:`ProjectionEntersOnSyntax`,event:``,key:null,location:n(r)}):{kind:`ProjectionEntersOnSyntax`,event:o(i[1]),key:i[2]===void 0?null:l(i[2],n(r),t),location:n(r)}}function parseKey(t,r){let i=r.content.substring(3).trim();if(t.peekChild(r.indent)===void 0)return{kind:`ExpressionKeySyntax`,expression:l(i,n(r),t),location:n(r)};let a=[];for(let i=t.peekChild(r.indent);i!==void 0;i=t.peekChild(r.indent)){if(t.reader.takeSignificant(),i.content===`}`)continue;let r=w.exec(i.content);if(r===null){t.sourceOptions.numericMode===`exact`&&t.error(e.InvalidCompositeKeyPart,`Invalid composite key part '${i.content}' - expected '<property> = <expression>'`,n(i));continue}let s=l(r[2],n(i),t);t.sourceOptions.numericMode===`exact`&&s.kind===`TemplateExpressionSyntax`&&t.error(e.TemplateInCompositeKey,`Template expressions are not allowed in composite keys`,n(i)),a.push({kind:`KeyPartSyntax`,property:o(r[1]),expression:s,location:n(i)})}let s=t.reader.peekSignificant();return s!==void 0&&s.indent===r.indent&&s.content===`}`&&t.reader.takeSignificant(),t.sourceOptions.numericMode===`exact`&&a.length===0&&t.error(e.EmptyCompositeKey,`Composite keys must contain at least one part`,n(r)),{kind:`CompositeKeySyntax`,type:i.replace(/\{$/,``).trim(),parts:a,location:n(r)}}function parseMappingBlock(e,t,n=()=>!1){let r=`Inherit`,i=[];for(let a=e.peekChild(t.indent);a!==void 0;a=e.peekChild(t.indent))e.reader.takeSignificant(),a.content===`automap`?r=`Enabled`:a.content===`no automap`?r=`Disabled`:n(a)||pushMapping(e,a,i);return{autoMap:r,mappings:i}}function pushMapping(t,i,a){let s=n(i),c=x.exec(i.content);if(c!==null){c[1]!==`clear`||c[2]!==`with`?a.push({kind:T[c[1]],property:o(c[2]),location:s}):t.sourceOptions.numericMode===`exact`&&t.error(e.InvalidProjectionMapping,`Invalid mapping '${i.content}' - 'clear with' is a block directive and needs an event type; to clear a property named 'with', write 'clear @with'`,s,r(`text`,i.content));return}let u=S.exec(i.content);if(u!==null){a.push({kind:u[1]===`add`?`AddMappingSyntax`:`SubtractMappingSyntax`,property:o(u[2]),value:l(u[3],s,t),location:s});return}let d=C.exec(i.content)??w.exec(i.content);d===null?t.sourceOptions.numericMode===`exact`&&t.error(e.InvalidProjectionMapping,`Invalid mapping '${i.content}'`,s,r(`text`,i.content)):a.push({kind:`SetMappingSyntax`,property:o(d[1]),source:l(d[2],s,t),location:s})}export{parseProjection};
|
|
1
|
+
import"../../_virtual/_virtual/_rolldown/runtime.js";import{DiagnosticCodes as e}from"../Diagnostics/DiagnosticCodes.js";import{pattern as t}from"../Text/patterns.js";import{locationOf as n}from"./SourceLine.js";import{diagnosticText as r}from"../Diagnostics/DiagnosticArgument.js";import{firstWord as i,splitTopLevel as a,unescapeIdentifier as o}from"./LineText.js";import{parseDescription as s}from"./DescriptionParser.js";import{isFileDirective as c}from"./FileReferences.js";import{parseProjectionExpression as l}from"./ProjectionExpressionParser.js";const u=t(`^projection\\s+(@?[\\w.]+)\\s*(?:=>\\s*([\\w.]+))?$`),d=t(`^(@?[\\w.]+)(?:\\s+key\\s+(.+))?$`),f=t(`^join\\s+(@?[\\w.]+)\\s+on\\s+(@?[\\w.]+)$`),p=t(`^with\\s+(@?[\\w.]+)$`),m=t(`^children\\s+(@?[\\w.]+)\\s+identified\\s+by\\s+(.+)$`),h=t(`^nested\\s+(@?[\\w.]+)$`),g=t(`^remove\\s+with\\s+(@?[\\w.]+)(?:\\s+key\\s+(.+))?$`),_=t(`^remove\\s+via\\s+join\\s+on\\s+(@?[\\w.]+)(?:\\s+key\\s+(.+))?$`),v=t(`^clear\\s+with\\s+(@?[\\w.]+)$`),y=t(`^variant\\s+(@?[\\w.]+)\\s*$`),b=t(`^enters\\s+on\\s+(@?[\\w.]+)(?:\\s+key\\s+(.+))?$`),x=t(`^(increment|decrement|count|clear)\\s+(@?[$\\w.]+)$`),S=t(`^(add|subtract)\\s+(@?[$\\w.]+)\\s+by\\s+(.+)$`),C=t(`^set\\s+(@?[$\\w.]+)\\s+(?:=|to)\\s+(.+)$`),w=t(`^(@?[$\\w.@]+)\\s*=(?!=|>)\\s*(.+)$`),T={increment:`IncrementMappingSyntax`,decrement:`DecrementMappingSyntax`,clear:`ClearMappingSyntax`,count:`CountMappingSyntax`};function parseProjection(t,r){let a=u.exec(r.content);if(a===null)return t.error(e.InvalidProjectionDeclaration,`Invalid projection declaration '${r.content}' - expected 'projection <Name> [=> <ReadModel>]'`,n(r)),t.skipBlock(r.indent),{kind:`ProjectionSyntax`,sourceOptions:t.sourceOptions,name:i(r.content),readModel:null,sequence:null,autoMap:`Inherit`,blocks:[],location:n(r)};let o=a[1],l=null,d=null,f=`Inherit`,p=null,m=[];for(let e=t.peekChild(r.indent);e!==void 0;e=t.peekChild(r.indent)){if(t.reader.takeSignificant(),c(e))continue;let n=i(e.content);if(n===`description`)d=s(t,e,d,`Projection '${o}'`);else if(n===`sequence`)l=e.content.substring(8).trim();else if(n===`automap`)f=`Enabled`;else if(e.content===`no automap`)f=`Disabled`;else if(n===`key`)p=parseKey(t,e);else if(n===`variant`)m.push(parseVariant(t,e));else{let n=parseBlock(t,e,!1);n!==void 0&&m.push(n)}}return reportVariantConflicts(t,m,o),m.length===0&&t.error(e.EmptyProjection,`Projection '${o}' must contain at least one directive`,n(r)),{kind:`ProjectionSyntax`,sourceOptions:t.sourceOptions,name:o,readModel:a[2]??null,sequence:l,autoMap:f,key:p,blocks:m,description:d,location:n(r)}}function reportVariantConflicts(t,n,r){let i=n.filter(e=>e.kind===`ProjectionVariantSyntax`),a=/* @__PURE__ */ new Map;i.forEach(e=>a.set(e.name,[...a.get(e.name)??[],e]));for(let n of[...a.values()].flatMap(e=>e.slice(1)))t.error(e.DuplicateProjectionVariant,`Duplicate variant '${n.name}' - a variant name is declared once`,n.location);let o=/* @__PURE__ */ new Set;for(let i of n.flatMap(e=>e.kind===`ProjectionVariantSyntax`?e.entersOn:[]))i.event.length>0&&o.has(i.event)&&t.error(e.DuplicateVariantEnteringEvent,`Entering event '${i.event}' is claimed more than once in projection '${r}'`,i.location),o.add(i.event)}function parseBlock(t,r,a){let o=n(r);switch(i(r.content)){case`from`:return parseFrom(t,r);case`every`:{let e=!0,{autoMap:n,mappings:i}=parseMappingBlock(t,r,t=>t.content===`exclude children`&&(e=!1,!0));return{kind:`EverySyntax`,includeChildren:e,autoMap:n,mappings:i,location:o}}case`all`:{let{autoMap:e,mappings:n}=parseMappingBlock(t,r);return{kind:`AllSyntax`,autoMap:e,mappings:n,location:o}}case`join`:return parseJoin(t,r);case`children`:return parseChildren(t,r);case`nested`:return parseNested(t,r);case`remove`:return parseRemove(t,r);case`clear`:return a||t.error(e.ClearWithOutsideNestedBlock,`'clear with' is only valid inside a nested block`,o),parseClearWith(t,r);default:t.error(e.UnknownProjectionDirective,`Unexpected '${i(r.content)}' in projection body`,o),t.skipBlock(r.indent);return}}function parseFrom(t,r){let s=[];for(let i of a(r.content.substring(4),`,`)){let a=i.trim();if(a.length===0){t.error(e.FromWithoutEvent,`Expected an event type after 'from'`,n(r));continue}let c=d.exec(a);c===null?t.error(e.InvalidEventReference,`Invalid event reference '${a}'`,n(r)):s.push({kind:`EventSpecSyntax`,event:o(c[1]),key:c[2]===void 0?null:l(c[2],n(r),t),location:n(r)})}let c=[],u=null,f=null;for(let e=t.peekChild(r.indent);e!==void 0;e=t.peekChild(r.indent)){t.reader.takeSignificant();let r=i(e.content);r===`key`?u=parseKey(t,e):r===`parent`?f=l(e.content.substring(6),n(e),t):pushMapping(t,e,c)}return{kind:`FromSyntax`,events:s,key:u,parentKey:f,mappings:c,location:n(r)}}function parseJoin(t,r){let i=f.exec(r.content);if(i===null)return t.error(e.InvalidJoinDeclaration,`Invalid join declaration '${r.content}' - expected 'join <property> on <key>'`,n(r)),t.skipBlock(r.indent),{kind:`JoinSyntax`,property:``,on:``,events:[],location:n(r)};let a=[];for(let i=t.peekChild(r.indent);i!==void 0;i=t.peekChild(r.indent)){t.reader.takeSignificant();let r=p.exec(i.content);if(r===null){t.error(e.JoinWithoutEvent,`Expected 'with <EventType>' in join block, got '${i.content}'`,n(i)),t.skipBlock(i.indent);continue}let{autoMap:s,mappings:c}=parseMappingBlock(t,i);a.push({kind:`JoinEventSyntax`,event:o(r[1]),autoMap:s,mappings:c,location:n(i)})}return{kind:`JoinSyntax`,property:o(i[1]),on:o(i[2]),events:a,location:n(r)}}function parseChildren(t,r){let i=m.exec(r.content);if(i===null)return t.error(e.InvalidChildrenDeclaration,`Invalid children declaration '${r.content}' - expected 'children <collection> identified by <key>'`,n(r)),t.skipBlock(r.indent),{kind:`ChildrenSyntax`,property:``,autoMap:`Inherit`,blocks:[],location:n(r)};let{autoMap:a,blocks:s}=parseChildBlocks(t,r);return{kind:`ChildrenSyntax`,property:o(i[1]),identifiedBy:l(i[2],n(r),t),autoMap:a,blocks:s,location:n(r)}}function parseNested(t,r){let i=h.exec(r.content);if(i===null)return t.error(e.InvalidNestedDeclaration,`Invalid nested declaration '${r.content}' - expected 'nested <property>'`,n(r)),t.skipBlock(r.indent),{kind:`NestedSyntax`,property:``,autoMap:`Inherit`,blocks:[],location:n(r)};let a=o(i[1]),{autoMap:s,blocks:c}=parseChildBlocks(t,r);return c.some(e=>e.kind===`FromSyntax`)||t.error(e.NestedBlockWithoutFrom,`Nested block '${a}' must contain at least one 'from' directive`,n(r)),{kind:`NestedSyntax`,property:a,autoMap:s,blocks:c,location:n(r)}}function parseChildBlocks(e,t){let n=[],r=`Inherit`;for(let i=e.peekChild(t.indent);i!==void 0;i=e.peekChild(t.indent)){if(e.reader.takeSignificant(),i.content===`automap`){r=`Enabled`;continue}if(i.content===`no automap`){r=`Disabled`;continue}let t=parseBlock(e,i,!0);t!==void 0&&n.push(t)}return{autoMap:r,blocks:n}}function parseRemove(t,r){let a=_.exec(r.content);if(a!==null)return{kind:`RemoveViaJoinSyntax`,event:o(a[1]),key:a[2]===void 0?null:l(a[2],n(r),t),location:n(r)};let s=g.exec(r.content);if(s===null){t.error(e.InvalidRemoveDeclaration,`Invalid remove declaration '${r.content}' - expected 'remove with <EventType>' or 'remove via join on <EventType>'`,n(r)),t.skipBlock(r.indent);return}let c=s[2]===void 0?null:l(s[2],n(r),t),u=null,d=null;for(let a=t.peekChild(r.indent);a!==void 0;a=t.peekChild(r.indent))if(t.reader.takeSignificant(),i(a.content)===`parent`)d=l(a.content.substring(6),n(a),t);else if(i(a.content)===`key`){(c!==null||u!==null)&&t.error(e.InvalidReadModelKeyLookup,`A removal can only declare one key.`,n(a));let r=parseKey(t,a);r.kind===`CompositeKeySyntax`?u=r:c=r.expression}else t.error(e.UnknownRemoveDirective,`Unexpected '${a.content}' in remove block - only 'parent' or 'key' is allowed`,n(a));return{kind:`RemoveWithSyntax`,event:o(s[1]),key:c,...u===null?{}:{partsKey:u},parentKey:d,location:n(r)}}function parseClearWith(t,r){let i=v.exec(r.content);return i===null?(t.error(e.InvalidClearDeclaration,`Invalid clear declaration '${r.content}' - expected 'clear with <EventType>'`,n(r)),{kind:`ClearWithSyntax`,event:``,location:n(r)}):{kind:`ClearWithSyntax`,event:o(i[1]),location:n(r)}}function parseVariant(t,r){let a=y.exec(r.content);if(a===null)return t.error(e.InvalidProjectionVariantDeclaration,`Invalid variant declaration '${r.content}' - expected 'variant <Name>'`,n(r)),t.skipBlock(r.indent),{kind:`ProjectionVariantSyntax`,name:i(r.content),entersOn:[],blocks:[],location:n(r)};let s=o(a[1]),c=[],l=[];for(let a=t.peekChild(r.indent);a!==void 0;a=t.peekChild(r.indent)){t.reader.takeSignificant();let r=i(a.content);if(r===`enters`)c.push(parseEntersOn(t,a));else if(r===`variant`)t.error(e.NestedProjectionVariantNotAllowed,`A variant cannot be declared inside another variant`,n(a)),t.skipBlock(a.indent);else{let e=parseBlock(t,a,!1);e!==void 0&&l.push(e)}}return c.length===0&&t.error(e.VariantRequiresEnteringEvent,`Variant '${s}' must declare at least one 'enters on' event`,n(r)),{kind:`ProjectionVariantSyntax`,name:s,entersOn:c,blocks:l,location:n(r)}}function parseEntersOn(t,r){let i=b.exec(r.content);return i===null?(t.error(e.InvalidEntersOnDeclaration,`Invalid 'enters on' declaration '${r.content}' - expected 'enters on <EventType> [key <expression>]'`,n(r)),t.skipBlock(r.indent),{kind:`ProjectionEntersOnSyntax`,event:``,key:null,location:n(r)}):{kind:`ProjectionEntersOnSyntax`,event:o(i[1]),key:i[2]===void 0?null:l(i[2],n(r),t),location:n(r)}}function parseKey(t,r){let i=r.content.substring(3).trim();if(t.peekChild(r.indent)===void 0)return{kind:`ExpressionKeySyntax`,expression:l(i,n(r),t),location:n(r)};let a=[];for(let s=t.peekChild(r.indent);s!==void 0;s=t.peekChild(r.indent)){if(t.reader.takeSignificant(),s.content===`}`)continue;let r=w.exec(s.content);if(r===null){t.sourceOptions.numericMode===`exact`&&t.error(e.InvalidCompositeKeyPart,`Invalid composite key part '${s.content}' - expected '<property> = <expression>'`,n(s));continue}let c=l(r[2],n(s),t);t.sourceOptions.numericMode===`exact`&&i.replace(/\{$/,``).trim().length>0&&c.kind===`TemplateExpressionSyntax`&&t.error(e.TemplateInCompositeKey,`Template expressions are not allowed in composite keys`,n(s)),a.push({kind:`KeyPartSyntax`,property:o(r[1]),expression:c,location:n(s)})}let s=t.reader.peekSignificant();return s!==void 0&&s.indent===r.indent&&s.content===`}`&&t.reader.takeSignificant(),t.sourceOptions.numericMode===`exact`&&a.length===0&&t.error(e.EmptyCompositeKey,`Composite keys must contain at least one part`,n(r)),{kind:`CompositeKeySyntax`,type:i.replace(/\{$/,``).trim(),parts:a,location:n(r)}}function parseMappingBlock(e,t,n=()=>!1){let r=`Inherit`,i=[];for(let a=e.peekChild(t.indent);a!==void 0;a=e.peekChild(t.indent))e.reader.takeSignificant(),a.content===`automap`?r=`Enabled`:a.content===`no automap`?r=`Disabled`:n(a)||pushMapping(e,a,i);return{autoMap:r,mappings:i}}function pushMapping(t,i,a){let s=n(i),c=x.exec(i.content);if(c!==null){c[1]!==`clear`||c[2]!==`with`?a.push({kind:T[c[1]],property:o(c[2]),location:s}):t.sourceOptions.numericMode===`exact`&&t.error(e.InvalidProjectionMapping,`Invalid mapping '${i.content}' - 'clear with' is a block directive and needs an event type; to clear a property named 'with', write 'clear @with'`,s,r(`text`,i.content));return}let u=S.exec(i.content);if(u!==null){a.push({kind:u[1]===`add`?`AddMappingSyntax`:`SubtractMappingSyntax`,property:o(u[2]),value:l(u[3],s,t),location:s});return}let d=C.exec(i.content)??w.exec(i.content);d===null?t.sourceOptions.numericMode===`exact`&&t.error(e.InvalidProjectionMapping,`Invalid mapping '${i.content}'`,s,r(`text`,i.content)):a.push({kind:`SetMappingSyntax`,property:o(d[1]),source:l(d[2],s,t),location:s})}export{parseProjection};
|
|
2
2
|
//# sourceMappingURL=ProjectionParser.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProjectionParser.js","names":["header","pattern","eventSpecPattern","joinPattern","withPattern","childrenPattern","nestedPattern","removeWithPattern","removeViaJoinPattern","clearWithPattern","variantPattern","entersOnPattern","keywordMappingPattern","arithmeticPattern","setPattern","assignmentPattern","keywordMappings","match","line","context","DiagnosticCodes","locationOf","firstWord","name","sequence","description","autoMap","key","blocks","child","isFileDirective","keyword","parseDescription","block","variants","byName","variant","duplicate","group","entering","entry","location","includeChildren","nestedScope","events","spec","splitTopLevel","text","unescapeIdentifier","parseProjectionExpression","mappings","parentKey","withMatch","property","viaJoin","entersOn","parts","expression","closing","extra","diagnosticText","arithmetic","assigned"],"sources":["../../../../../../Compiler/Parsing/ProjectionParser.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 { diagnosticText } from '../Diagnostics/DiagnosticArgument';\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport {\n AutoMapMode, ChildrenSyntax, ClearWithSyntax, EventSpecSyntax, FromSyntax, JoinEventSyntax, JoinSyntax, MappingKind, MappingSyntax, NestedSyntax,\n KeyPartSyntax, KeySyntax, ProjectionBlockSyntax, ProjectionEntersOnSyntax, ProjectionSyntax, ProjectionVariantSyntax,\n} from '../Syntax/Projections';\nimport { ExpressionSyntax } from '../Syntax/Expressions';\nimport { pattern } from '../Text/patterns';\nimport { parseProjectionExpression } from './ProjectionExpressionParser';\nimport { isFileDirective } from './FileReferences';\nimport { parseDescription } from './DescriptionParser';\nimport { firstWord, splitTopLevel, unescapeIdentifier } from './LineText';\nimport { ParserContext } from './ParserContext';\nimport { locationOf, SourceLine } from './SourceLine';\n\nconst header = pattern('^projection\\\\s+(@?[\\\\w.]+)\\\\s*(?:=>\\\\s*([\\\\w.]+))?$');\nconst eventSpecPattern = pattern('^(@?[\\\\w.]+)(?:\\\\s+key\\\\s+(.+))?$');\nconst joinPattern = pattern('^join\\\\s+(@?[\\\\w.]+)\\\\s+on\\\\s+(@?[\\\\w.]+)$');\nconst withPattern = pattern('^with\\\\s+(@?[\\\\w.]+)$');\nconst childrenPattern = pattern('^children\\\\s+(@?[\\\\w.]+)\\\\s+identified\\\\s+by\\\\s+(.+)$');\nconst nestedPattern = pattern('^nested\\\\s+(@?[\\\\w.]+)$');\nconst removeWithPattern = pattern('^remove\\\\s+with\\\\s+(@?[\\\\w.]+)(?:\\\\s+key\\\\s+(.+))?$');\nconst removeViaJoinPattern = pattern('^remove\\\\s+via\\\\s+join\\\\s+on\\\\s+(@?[\\\\w.]+)(?:\\\\s+key\\\\s+(.+))?$');\nconst clearWithPattern = pattern('^clear\\\\s+with\\\\s+(@?[\\\\w.]+)$');\nconst variantPattern = pattern('^variant\\\\s+(@?[\\\\w.]+)\\\\s*$');\nconst entersOnPattern = pattern('^enters\\\\s+on\\\\s+(@?[\\\\w.]+)(?:\\\\s+key\\\\s+(.+))?$');\nconst keywordMappingPattern = pattern('^(increment|decrement|count|clear)\\\\s+(@?[$\\\\w.]+)$');\nconst arithmeticPattern = pattern('^(add|subtract)\\\\s+(@?[$\\\\w.]+)\\\\s+by\\\\s+(.+)$');\nconst setPattern = pattern('^set\\\\s+(@?[$\\\\w.]+)\\\\s+(?:=|to)\\\\s+(.+)$');\nconst assignmentPattern = pattern('^(@?[$\\\\w.@]+)\\\\s*=(?!=|>)\\\\s*(.+)$');\nconst keywordMappings: Record<string, MappingKind> = {\n increment: 'IncrementMappingSyntax',\n decrement: 'DecrementMappingSyntax',\n clear: 'ClearMappingSyntax',\n count: 'CountMappingSyntax',\n};\n\n// Reads a projection's structure: its name, the read model it builds, the events each block consumes, the\n// properties each mapping sets and where automap is turned on or off. Keys, and where a mapping takes its\n// value from, are recognized and skipped.\nexport function parseProjection(context: ParserContext, line: SourceLine): ProjectionSyntax {\n const match = header.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidProjectionDeclaration, `Invalid projection declaration '${line.content}' - expected 'projection <Name> [=> <ReadModel>]'`, locationOf(line));\n context.skipBlock(line.indent);\n return { kind: 'ProjectionSyntax', sourceOptions: context.sourceOptions, name: firstWord(line.content), readModel: null, sequence: null, autoMap: 'Inherit', blocks: [], location: locationOf(line) };\n }\n const name = match[1];\n let sequence: string | null = null;\n let description: string | null = null;\n let autoMap: AutoMapMode = 'Inherit';\n let key: KeySyntax | null = null;\n const blocks: ProjectionBlockSyntax[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n if (isFileDirective(child)) {\n continue;\n }\n const keyword = firstWord(child.content);\n if (keyword === 'description') {\n description = parseDescription(context, child, description, `Projection '${name}'`);\n } else if (keyword === 'sequence') {\n sequence = child.content.substring('sequence'.length).trim();\n } else if (keyword === 'automap') {\n autoMap = 'Enabled';\n } else if (child.content === 'no automap') {\n autoMap = 'Disabled';\n } else if (keyword === 'key') {\n key = parseKey(context, child);\n } else if (keyword === 'variant') {\n blocks.push(parseVariant(context, child));\n } else {\n const block = parseBlock(context, child, false);\n if (block !== undefined) {\n blocks.push(block);\n }\n }\n }\n reportVariantConflicts(context, blocks, name);\n if (blocks.length === 0) {\n context.error(DiagnosticCodes.EmptyProjection, `Projection '${name}' must contain at least one directive`, locationOf(line));\n }\n return { kind: 'ProjectionSyntax', sourceOptions: context.sourceOptions, name, readModel: match[2] ?? null, sequence, autoMap, key, blocks, description, location: locationOf(line) };\n}\n\nfunction reportVariantConflicts(context: ParserContext, blocks: readonly ProjectionBlockSyntax[], name: string): void {\n // Grouped by name in the order each name first appears, as the C# parser reports them.\n const variants = blocks.filter((block): block is ProjectionVariantSyntax => block.kind === 'ProjectionVariantSyntax');\n const byName = new Map<string, ProjectionVariantSyntax[]>();\n variants.forEach(variant => byName.set(variant.name, [...(byName.get(variant.name) ?? []), variant]));\n for (const duplicate of [...byName.values()].flatMap(group => group.slice(1))) {\n context.error(DiagnosticCodes.DuplicateProjectionVariant, `Duplicate variant '${duplicate.name}' - a variant name is declared once`, duplicate.location);\n }\n const entering = new Set<string>();\n for (const entry of blocks.flatMap(block => block.kind === 'ProjectionVariantSyntax' ? block.entersOn : [])) {\n if (entry.event.length > 0 && entering.has(entry.event)) {\n context.error(DiagnosticCodes.DuplicateVariantEnteringEvent, `Entering event '${entry.event}' is claimed more than once in projection '${name}'`, entry.location);\n }\n entering.add(entry.event);\n }\n}\n\nfunction parseBlock(context: ParserContext, line: SourceLine, nestedScope: boolean): ProjectionBlockSyntax | undefined {\n const location = locationOf(line);\n switch (firstWord(line.content)) {\n case 'from':\n return parseFrom(context, line);\n case 'every': {\n let includeChildren = true;\n const { autoMap, mappings } = parseMappingBlock(context, line, child => {\n if (child.content !== 'exclude children') {\n return false;\n }\n includeChildren = false;\n return true;\n });\n return { kind: 'EverySyntax', includeChildren, autoMap, mappings, location };\n }\n case 'all': {\n const { autoMap, mappings } = parseMappingBlock(context, line);\n return { kind: 'AllSyntax', autoMap, mappings, location };\n }\n case 'join':\n return parseJoin(context, line);\n case 'children':\n return parseChildren(context, line);\n case 'nested':\n return parseNested(context, line);\n case 'remove':\n return parseRemove(context, line);\n case 'clear':\n if (!nestedScope) {\n context.error(DiagnosticCodes.ClearWithOutsideNestedBlock, '\\'clear with\\' is only valid inside a nested block', location);\n }\n return parseClearWith(context, line);\n default:\n context.error(DiagnosticCodes.UnknownProjectionDirective, `Unexpected '${firstWord(line.content)}' in projection body`, location);\n context.skipBlock(line.indent);\n return undefined;\n }\n}\n\nfunction parseFrom(context: ParserContext, line: SourceLine): FromSyntax {\n const events: EventSpecSyntax[] = [];\n for (const spec of splitTopLevel(line.content.substring('from'.length), ',')) {\n const text = spec.trim();\n if (text.length === 0) {\n context.error(DiagnosticCodes.FromWithoutEvent, 'Expected an event type after \\'from\\'', locationOf(line));\n continue;\n }\n const match = eventSpecPattern.exec(text);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidEventReference, `Invalid event reference '${text}'`, locationOf(line));\n continue;\n }\n events.push({ kind: 'EventSpecSyntax', event: unescapeIdentifier(match[1]), key: match[2] === undefined ? null : parseProjectionExpression(match[2], locationOf(line), context), location: locationOf(line) });\n }\n const mappings: MappingSyntax[] = [];\n let key: KeySyntax | null = null;\n let parentKey: ExpressionSyntax | null = null;\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n const keyword = firstWord(child.content);\n if (keyword === 'key') key = parseKey(context, child);\n else if (keyword === 'parent') parentKey = parseProjectionExpression(child.content.substring('parent'.length), locationOf(child), context);\n else pushMapping(context, child, mappings);\n }\n return { kind: 'FromSyntax', events, key, parentKey, mappings, location: locationOf(line) };\n}\n\nfunction parseJoin(context: ParserContext, line: SourceLine): JoinSyntax {\n const match = joinPattern.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidJoinDeclaration, `Invalid join declaration '${line.content}' - expected 'join <property> on <key>'`, locationOf(line));\n context.skipBlock(line.indent);\n return { kind: 'JoinSyntax', property: '', on: '', events: [], location: locationOf(line) };\n }\n const events: JoinEventSyntax[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n const withMatch = withPattern.exec(child.content);\n if (withMatch === null) {\n context.error(DiagnosticCodes.JoinWithoutEvent, `Expected 'with <EventType>' in join block, got '${child.content}'`, locationOf(child));\n context.skipBlock(child.indent);\n continue;\n }\n const { autoMap, mappings } = parseMappingBlock(context, child);\n events.push({ kind: 'JoinEventSyntax', event: unescapeIdentifier(withMatch[1]), autoMap, mappings, location: locationOf(child) });\n }\n return { kind: 'JoinSyntax', property: unescapeIdentifier(match[1]), on: unescapeIdentifier(match[2]), events, location: locationOf(line) };\n}\n\nfunction parseChildren(context: ParserContext, line: SourceLine): ChildrenSyntax {\n const match = childrenPattern.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidChildrenDeclaration, `Invalid children declaration '${line.content}' - expected 'children <collection> identified by <key>'`, locationOf(line));\n context.skipBlock(line.indent);\n return { kind: 'ChildrenSyntax', property: '', autoMap: 'Inherit', blocks: [], location: locationOf(line) };\n }\n const { autoMap, blocks } = parseChildBlocks(context, line);\n return { kind: 'ChildrenSyntax', property: unescapeIdentifier(match[1]), identifiedBy: parseProjectionExpression(match[2], locationOf(line), context), autoMap, blocks, location: locationOf(line) };\n}\n\nfunction parseNested(context: ParserContext, line: SourceLine): NestedSyntax {\n const match = nestedPattern.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidNestedDeclaration, `Invalid nested declaration '${line.content}' - expected 'nested <property>'`, locationOf(line));\n context.skipBlock(line.indent);\n return { kind: 'NestedSyntax', property: '', autoMap: 'Inherit', blocks: [], location: locationOf(line) };\n }\n const property = unescapeIdentifier(match[1]);\n const { autoMap, blocks } = parseChildBlocks(context, line);\n if (!blocks.some(block => block.kind === 'FromSyntax')) {\n context.error(DiagnosticCodes.NestedBlockWithoutFrom, `Nested block '${property}' must contain at least one 'from' directive`, locationOf(line));\n }\n return { kind: 'NestedSyntax', property, autoMap, blocks, location: locationOf(line) };\n}\n\nfunction parseChildBlocks(context: ParserContext, line: SourceLine): { autoMap: AutoMapMode; blocks: ProjectionBlockSyntax[] } {\n const blocks: ProjectionBlockSyntax[] = [];\n let autoMap: AutoMapMode = 'Inherit';\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n if (child.content === 'automap') {\n autoMap = 'Enabled';\n continue;\n }\n if (child.content === 'no automap') {\n autoMap = 'Disabled';\n continue;\n }\n const block = parseBlock(context, child, true);\n if (block !== undefined) {\n blocks.push(block);\n }\n }\n return { autoMap, blocks };\n}\n\nfunction parseRemove(context: ParserContext, line: SourceLine): ProjectionBlockSyntax | undefined {\n const viaJoin = removeViaJoinPattern.exec(line.content);\n if (viaJoin !== null) {\n return { kind: 'RemoveViaJoinSyntax', event: unescapeIdentifier(viaJoin[1]), key: viaJoin[2] === undefined ? null : parseProjectionExpression(viaJoin[2], locationOf(line), context), location: locationOf(line) };\n }\n const match = removeWithPattern.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidRemoveDeclaration, `Invalid remove declaration '${line.content}' - expected 'remove with <EventType>' or 'remove via join on <EventType>'`, locationOf(line));\n context.skipBlock(line.indent);\n return undefined;\n }\n let parentKey: ExpressionSyntax | null = null;\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n if (firstWord(child.content) === 'parent') {\n parentKey = parseProjectionExpression(child.content.substring('parent'.length), locationOf(child), context);\n } else {\n context.error(DiagnosticCodes.UnknownRemoveDirective, `Unexpected '${child.content}' in remove block - only 'parent' is allowed`, locationOf(child));\n }\n }\n return { kind: 'RemoveWithSyntax', event: unescapeIdentifier(match[1]), key: match[2] === undefined ? null : parseProjectionExpression(match[2], locationOf(line), context), parentKey, location: locationOf(line) };\n}\n\nfunction parseClearWith(context: ParserContext, line: SourceLine): ClearWithSyntax {\n const match = clearWithPattern.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidClearDeclaration, `Invalid clear declaration '${line.content}' - expected 'clear with <EventType>'`, locationOf(line));\n return { kind: 'ClearWithSyntax', event: '', location: locationOf(line) };\n }\n return { kind: 'ClearWithSyntax', event: unescapeIdentifier(match[1]), location: locationOf(line) };\n}\n\nfunction parseVariant(context: ParserContext, line: SourceLine): ProjectionVariantSyntax {\n const match = variantPattern.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidProjectionVariantDeclaration, `Invalid variant declaration '${line.content}' - expected 'variant <Name>'`, locationOf(line));\n context.skipBlock(line.indent);\n return { kind: 'ProjectionVariantSyntax', name: firstWord(line.content), entersOn: [], blocks: [], location: locationOf(line) };\n }\n const name = unescapeIdentifier(match[1]);\n const entersOn: ProjectionEntersOnSyntax[] = [];\n const blocks: ProjectionBlockSyntax[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n const keyword = firstWord(child.content);\n if (keyword === 'enters') {\n entersOn.push(parseEntersOn(context, child));\n } else if (keyword === 'variant') {\n context.error(DiagnosticCodes.NestedProjectionVariantNotAllowed, 'A variant cannot be declared inside another variant', locationOf(child));\n context.skipBlock(child.indent);\n } else {\n const block = parseBlock(context, child, false);\n if (block !== undefined) {\n blocks.push(block);\n }\n }\n }\n if (entersOn.length === 0) {\n context.error(DiagnosticCodes.VariantRequiresEnteringEvent, `Variant '${name}' must declare at least one 'enters on' event`, locationOf(line));\n }\n return { kind: 'ProjectionVariantSyntax', name, entersOn, blocks, location: locationOf(line) };\n}\n\nfunction parseEntersOn(context: ParserContext, line: SourceLine): ProjectionEntersOnSyntax {\n const match = entersOnPattern.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidEntersOnDeclaration, `Invalid 'enters on' declaration '${line.content}' - expected 'enters on <EventType> [key <expression>]'`, locationOf(line));\n context.skipBlock(line.indent);\n return { kind: 'ProjectionEntersOnSyntax', event: '', key: null, location: locationOf(line) };\n }\n return { kind: 'ProjectionEntersOnSyntax', event: unescapeIdentifier(match[1]), key: match[2] === undefined ? null : parseProjectionExpression(match[2], locationOf(line), context), location: locationOf(line) };\n}\n\n// A key with a body is a composite key: its parts, then a closing '}' at the key's own indent.\nfunction parseKey(context: ParserContext, line: SourceLine): KeySyntax {\n const text = line.content.substring('key'.length).trim();\n if (context.peekChild(line.indent) === undefined) return { kind: 'ExpressionKeySyntax', expression: parseProjectionExpression(text, locationOf(line), context), location: locationOf(line) };\n const parts: KeyPartSyntax[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n if (child.content === '}') continue;\n const match = assignmentPattern.exec(child.content);\n if (match === null) {\n if (context.sourceOptions.numericMode === 'exact') context.error(DiagnosticCodes.InvalidCompositeKeyPart, `Invalid composite key part '${child.content}' - expected '<property> = <expression>'`, locationOf(child));\n continue;\n }\n const expression = parseProjectionExpression(match[2], locationOf(child), context);\n if (context.sourceOptions.numericMode === 'exact' && expression.kind === 'TemplateExpressionSyntax') context.error(DiagnosticCodes.TemplateInCompositeKey, 'Template expressions are not allowed in composite keys', locationOf(child));\n parts.push({ kind: 'KeyPartSyntax', property: unescapeIdentifier(match[1]), expression, location: locationOf(child) });\n }\n const closing = context.reader.peekSignificant();\n if (closing !== undefined && closing.indent === line.indent && closing.content === '}') context.reader.takeSignificant();\n if (context.sourceOptions.numericMode === 'exact' && parts.length === 0) context.error(DiagnosticCodes.EmptyCompositeKey, 'Composite keys must contain at least one part', locationOf(line));\n return { kind: 'CompositeKeySyntax', type: text.replace(/\\{$/, '').trim(), parts, location: locationOf(line) };\n}\n\n// Mapping lines carry no body, so a mapping block is its direct children. The last automap setting wins;\n// a line 'extra' claims is not a mapping.\nfunction parseMappingBlock(context: ParserContext, line: SourceLine, extra: (child: SourceLine) => boolean = () => false): { autoMap: AutoMapMode; mappings: MappingSyntax[] } {\n let autoMap: AutoMapMode = 'Inherit';\n const mappings: MappingSyntax[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n if (child.content === 'automap') {\n autoMap = 'Enabled';\n } else if (child.content === 'no automap') {\n autoMap = 'Disabled';\n } else if (!extra(child)) {\n pushMapping(context, child, mappings);\n }\n }\n return { autoMap, mappings };\n}\n\n// The property one mapping line sets, and how - the port of the C# ParseMappingLine. Exact reports\n// malformed mappings; Legacy keeps the existing skip behavior.\nfunction pushMapping(context: ParserContext, line: SourceLine, mappings: MappingSyntax[]): void {\n const location = locationOf(line);\n const keyword = keywordMappingPattern.exec(line.content);\n if (keyword !== null) {\n if (keyword[1] !== 'clear' || keyword[2] !== 'with') {\n mappings.push({ kind: keywordMappings[keyword[1]], property: unescapeIdentifier(keyword[2]), location });\n } else if (context.sourceOptions.numericMode === 'exact') {\n context.error(DiagnosticCodes.InvalidProjectionMapping, `Invalid mapping '${line.content}' - 'clear with' is a block directive and needs an event type; to clear a property named 'with', write 'clear @with'`, location, diagnosticText('text', line.content));\n }\n return;\n }\n const arithmetic = arithmeticPattern.exec(line.content);\n if (arithmetic !== null) {\n mappings.push({ kind: arithmetic[1] === 'add' ? 'AddMappingSyntax' : 'SubtractMappingSyntax', property: unescapeIdentifier(arithmetic[2]), value: parseProjectionExpression(arithmetic[3], location, context), location });\n return;\n }\n const assigned = setPattern.exec(line.content) ?? assignmentPattern.exec(line.content);\n if (assigned !== null) {\n mappings.push({ kind: 'SetMappingSyntax', property: unescapeIdentifier(assigned[1]), source: parseProjectionExpression(assigned[2], location, context), location });\n } else if (context.sourceOptions.numericMode === 'exact') {\n context.error(DiagnosticCodes.InvalidProjectionMapping, `Invalid mapping '${line.content}'`, location, diagnosticText('text', line.content));\n }\n}\n"],"mappings":"2iBAkBA,MAAMA,EAASC,EAAQ,qDAAqD,EACtEC,EAAmBD,EAAQ,mCAAmC,EAC9DE,EAAcF,EAAQ,4CAA4C,EAClEG,EAAcH,EAAQ,uBAAuB,EAC7CI,EAAkBJ,EAAQ,uDAAuD,EACjFK,EAAgBL,EAAQ,yBAAyB,EACjDM,EAAoBN,EAAQ,qDAAqD,EACjFO,EAAuBP,EAAQ,kEAAkE,EACjGQ,EAAmBR,EAAQ,gCAAgC,EAC3DS,EAAiBT,EAAQ,8BAA8B,EACvDU,EAAkBV,EAAQ,mDAAmD,EAC7EW,EAAwBX,EAAQ,qDAAqD,EACrFY,EAAoBZ,EAAQ,gDAAgD,EAC5Ea,EAAab,EAAQ,2CAA2C,EAChEc,EAAoBd,EAAQ,qCAAqC,EACjEe,EAA+C,CACjD,UAAW,yBACX,UAAW,yBACX,MAAO,qBACP,MAAO,oBACX,EAKA,SAAgB,gBAAgB,EAAwB,EAAoC,CACxF,IAAMC,EAAQjB,EAAO,KAAKkB,EAAK,OAAO,EACtC,GAAID,IAAU,KAGV,OAFAE,EAAQ,MAAMC,EAAgB,6BAA8B,mCAAmCF,EAAK,QAAQ,mDAAoDG,EAAWH,CAAI,CAAC,EAChLC,EAAQ,UAAUD,EAAK,MAAM,EACtB,CAAE,KAAM,mBAAoB,cAAeC,EAAQ,cAAe,KAAMG,EAAUJ,EAAK,OAAO,EAAG,UAAW,KAAM,SAAU,KAAM,QAAS,UAAW,OAAQ,CAAC,EAAG,SAAUG,EAAWH,CAAI,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,SAAUF,EAAmBc,EAAS,EAAE,EAAG,OAAQb,EAA0Ba,EAAS,GAAIrB,EAAUtB,CAAO,EAAG,UAAS,CAAC,CAI1K"}
|
|
1
|
+
{"version":3,"file":"ProjectionParser.js","names":["header","pattern","eventSpecPattern","joinPattern","withPattern","childrenPattern","nestedPattern","removeWithPattern","removeViaJoinPattern","clearWithPattern","variantPattern","entersOnPattern","keywordMappingPattern","arithmeticPattern","setPattern","assignmentPattern","keywordMappings","match","line","context","DiagnosticCodes","locationOf","firstWord","name","sequence","description","autoMap","key","blocks","child","isFileDirective","keyword","parseDescription","block","variants","byName","variant","duplicate","group","entering","entry","location","includeChildren","nestedScope","events","spec","splitTopLevel","text","unescapeIdentifier","parseProjectionExpression","mappings","parentKey","withMatch","property","viaJoin","partsKey","parsed","entersOn","parts","expression","closing","extra","diagnosticText","arithmetic","assigned"],"sources":["../../../../../../Compiler/Parsing/ProjectionParser.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 { diagnosticText } from '../Diagnostics/DiagnosticArgument';\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport {\n AutoMapMode, ChildrenSyntax, ClearWithSyntax, CompositeKeySyntax, EventSpecSyntax, FromSyntax, JoinEventSyntax, JoinSyntax, MappingKind, MappingSyntax, NestedSyntax,\n KeyPartSyntax, KeySyntax, ProjectionBlockSyntax, ProjectionEntersOnSyntax, ProjectionSyntax, ProjectionVariantSyntax,\n} from '../Syntax/Projections';\nimport { ExpressionSyntax } from '../Syntax/Expressions';\nimport { pattern } from '../Text/patterns';\nimport { parseProjectionExpression } from './ProjectionExpressionParser';\nimport { isFileDirective } from './FileReferences';\nimport { parseDescription } from './DescriptionParser';\nimport { firstWord, splitTopLevel, unescapeIdentifier } from './LineText';\nimport { ParserContext } from './ParserContext';\nimport { locationOf, SourceLine } from './SourceLine';\n\nconst header = pattern('^projection\\\\s+(@?[\\\\w.]+)\\\\s*(?:=>\\\\s*([\\\\w.]+))?$');\nconst eventSpecPattern = pattern('^(@?[\\\\w.]+)(?:\\\\s+key\\\\s+(.+))?$');\nconst joinPattern = pattern('^join\\\\s+(@?[\\\\w.]+)\\\\s+on\\\\s+(@?[\\\\w.]+)$');\nconst withPattern = pattern('^with\\\\s+(@?[\\\\w.]+)$');\nconst childrenPattern = pattern('^children\\\\s+(@?[\\\\w.]+)\\\\s+identified\\\\s+by\\\\s+(.+)$');\nconst nestedPattern = pattern('^nested\\\\s+(@?[\\\\w.]+)$');\nconst removeWithPattern = pattern('^remove\\\\s+with\\\\s+(@?[\\\\w.]+)(?:\\\\s+key\\\\s+(.+))?$');\nconst removeViaJoinPattern = pattern('^remove\\\\s+via\\\\s+join\\\\s+on\\\\s+(@?[\\\\w.]+)(?:\\\\s+key\\\\s+(.+))?$');\nconst clearWithPattern = pattern('^clear\\\\s+with\\\\s+(@?[\\\\w.]+)$');\nconst variantPattern = pattern('^variant\\\\s+(@?[\\\\w.]+)\\\\s*$');\nconst entersOnPattern = pattern('^enters\\\\s+on\\\\s+(@?[\\\\w.]+)(?:\\\\s+key\\\\s+(.+))?$');\nconst keywordMappingPattern = pattern('^(increment|decrement|count|clear)\\\\s+(@?[$\\\\w.]+)$');\nconst arithmeticPattern = pattern('^(add|subtract)\\\\s+(@?[$\\\\w.]+)\\\\s+by\\\\s+(.+)$');\nconst setPattern = pattern('^set\\\\s+(@?[$\\\\w.]+)\\\\s+(?:=|to)\\\\s+(.+)$');\nconst assignmentPattern = pattern('^(@?[$\\\\w.@]+)\\\\s*=(?!=|>)\\\\s*(.+)$');\nconst keywordMappings: Record<string, MappingKind> = {\n increment: 'IncrementMappingSyntax',\n decrement: 'DecrementMappingSyntax',\n clear: 'ClearMappingSyntax',\n count: 'CountMappingSyntax',\n};\n\n// Reads a projection's structure: its name, the read model it builds, the events each block consumes, the\n// properties each mapping sets and where automap is turned on or off. Keys, and where a mapping takes its\n// value from, are recognized and skipped.\nexport function parseProjection(context: ParserContext, line: SourceLine): ProjectionSyntax {\n const match = header.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidProjectionDeclaration, `Invalid projection declaration '${line.content}' - expected 'projection <Name> [=> <ReadModel>]'`, locationOf(line));\n context.skipBlock(line.indent);\n return { kind: 'ProjectionSyntax', sourceOptions: context.sourceOptions, name: firstWord(line.content), readModel: null, sequence: null, autoMap: 'Inherit', blocks: [], location: locationOf(line) };\n }\n const name = match[1];\n let sequence: string | null = null;\n let description: string | null = null;\n let autoMap: AutoMapMode = 'Inherit';\n let key: KeySyntax | null = null;\n const blocks: ProjectionBlockSyntax[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n if (isFileDirective(child)) {\n continue;\n }\n const keyword = firstWord(child.content);\n if (keyword === 'description') {\n description = parseDescription(context, child, description, `Projection '${name}'`);\n } else if (keyword === 'sequence') {\n sequence = child.content.substring('sequence'.length).trim();\n } else if (keyword === 'automap') {\n autoMap = 'Enabled';\n } else if (child.content === 'no automap') {\n autoMap = 'Disabled';\n } else if (keyword === 'key') {\n key = parseKey(context, child);\n } else if (keyword === 'variant') {\n blocks.push(parseVariant(context, child));\n } else {\n const block = parseBlock(context, child, false);\n if (block !== undefined) {\n blocks.push(block);\n }\n }\n }\n reportVariantConflicts(context, blocks, name);\n if (blocks.length === 0) {\n context.error(DiagnosticCodes.EmptyProjection, `Projection '${name}' must contain at least one directive`, locationOf(line));\n }\n return { kind: 'ProjectionSyntax', sourceOptions: context.sourceOptions, name, readModel: match[2] ?? null, sequence, autoMap, key, blocks, description, location: locationOf(line) };\n}\n\nfunction reportVariantConflicts(context: ParserContext, blocks: readonly ProjectionBlockSyntax[], name: string): void {\n // Grouped by name in the order each name first appears, as the C# parser reports them.\n const variants = blocks.filter((block): block is ProjectionVariantSyntax => block.kind === 'ProjectionVariantSyntax');\n const byName = new Map<string, ProjectionVariantSyntax[]>();\n variants.forEach(variant => byName.set(variant.name, [...(byName.get(variant.name) ?? []), variant]));\n for (const duplicate of [...byName.values()].flatMap(group => group.slice(1))) {\n context.error(DiagnosticCodes.DuplicateProjectionVariant, `Duplicate variant '${duplicate.name}' - a variant name is declared once`, duplicate.location);\n }\n const entering = new Set<string>();\n for (const entry of blocks.flatMap(block => block.kind === 'ProjectionVariantSyntax' ? block.entersOn : [])) {\n if (entry.event.length > 0 && entering.has(entry.event)) {\n context.error(DiagnosticCodes.DuplicateVariantEnteringEvent, `Entering event '${entry.event}' is claimed more than once in projection '${name}'`, entry.location);\n }\n entering.add(entry.event);\n }\n}\n\nfunction parseBlock(context: ParserContext, line: SourceLine, nestedScope: boolean): ProjectionBlockSyntax | undefined {\n const location = locationOf(line);\n switch (firstWord(line.content)) {\n case 'from':\n return parseFrom(context, line);\n case 'every': {\n let includeChildren = true;\n const { autoMap, mappings } = parseMappingBlock(context, line, child => {\n if (child.content !== 'exclude children') {\n return false;\n }\n includeChildren = false;\n return true;\n });\n return { kind: 'EverySyntax', includeChildren, autoMap, mappings, location };\n }\n case 'all': {\n const { autoMap, mappings } = parseMappingBlock(context, line);\n return { kind: 'AllSyntax', autoMap, mappings, location };\n }\n case 'join':\n return parseJoin(context, line);\n case 'children':\n return parseChildren(context, line);\n case 'nested':\n return parseNested(context, line);\n case 'remove':\n return parseRemove(context, line);\n case 'clear':\n if (!nestedScope) {\n context.error(DiagnosticCodes.ClearWithOutsideNestedBlock, '\\'clear with\\' is only valid inside a nested block', location);\n }\n return parseClearWith(context, line);\n default:\n context.error(DiagnosticCodes.UnknownProjectionDirective, `Unexpected '${firstWord(line.content)}' in projection body`, location);\n context.skipBlock(line.indent);\n return undefined;\n }\n}\n\nfunction parseFrom(context: ParserContext, line: SourceLine): FromSyntax {\n const events: EventSpecSyntax[] = [];\n for (const spec of splitTopLevel(line.content.substring('from'.length), ',')) {\n const text = spec.trim();\n if (text.length === 0) {\n context.error(DiagnosticCodes.FromWithoutEvent, 'Expected an event type after \\'from\\'', locationOf(line));\n continue;\n }\n const match = eventSpecPattern.exec(text);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidEventReference, `Invalid event reference '${text}'`, locationOf(line));\n continue;\n }\n events.push({ kind: 'EventSpecSyntax', event: unescapeIdentifier(match[1]), key: match[2] === undefined ? null : parseProjectionExpression(match[2], locationOf(line), context), location: locationOf(line) });\n }\n const mappings: MappingSyntax[] = [];\n let key: KeySyntax | null = null;\n let parentKey: ExpressionSyntax | null = null;\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n const keyword = firstWord(child.content);\n if (keyword === 'key') key = parseKey(context, child);\n else if (keyword === 'parent') parentKey = parseProjectionExpression(child.content.substring('parent'.length), locationOf(child), context);\n else pushMapping(context, child, mappings);\n }\n return { kind: 'FromSyntax', events, key, parentKey, mappings, location: locationOf(line) };\n}\n\nfunction parseJoin(context: ParserContext, line: SourceLine): JoinSyntax {\n const match = joinPattern.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidJoinDeclaration, `Invalid join declaration '${line.content}' - expected 'join <property> on <key>'`, locationOf(line));\n context.skipBlock(line.indent);\n return { kind: 'JoinSyntax', property: '', on: '', events: [], location: locationOf(line) };\n }\n const events: JoinEventSyntax[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n const withMatch = withPattern.exec(child.content);\n if (withMatch === null) {\n context.error(DiagnosticCodes.JoinWithoutEvent, `Expected 'with <EventType>' in join block, got '${child.content}'`, locationOf(child));\n context.skipBlock(child.indent);\n continue;\n }\n const { autoMap, mappings } = parseMappingBlock(context, child);\n events.push({ kind: 'JoinEventSyntax', event: unescapeIdentifier(withMatch[1]), autoMap, mappings, location: locationOf(child) });\n }\n return { kind: 'JoinSyntax', property: unescapeIdentifier(match[1]), on: unescapeIdentifier(match[2]), events, location: locationOf(line) };\n}\n\nfunction parseChildren(context: ParserContext, line: SourceLine): ChildrenSyntax {\n const match = childrenPattern.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidChildrenDeclaration, `Invalid children declaration '${line.content}' - expected 'children <collection> identified by <key>'`, locationOf(line));\n context.skipBlock(line.indent);\n return { kind: 'ChildrenSyntax', property: '', autoMap: 'Inherit', blocks: [], location: locationOf(line) };\n }\n const { autoMap, blocks } = parseChildBlocks(context, line);\n return { kind: 'ChildrenSyntax', property: unescapeIdentifier(match[1]), identifiedBy: parseProjectionExpression(match[2], locationOf(line), context), autoMap, blocks, location: locationOf(line) };\n}\n\nfunction parseNested(context: ParserContext, line: SourceLine): NestedSyntax {\n const match = nestedPattern.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidNestedDeclaration, `Invalid nested declaration '${line.content}' - expected 'nested <property>'`, locationOf(line));\n context.skipBlock(line.indent);\n return { kind: 'NestedSyntax', property: '', autoMap: 'Inherit', blocks: [], location: locationOf(line) };\n }\n const property = unescapeIdentifier(match[1]);\n const { autoMap, blocks } = parseChildBlocks(context, line);\n if (!blocks.some(block => block.kind === 'FromSyntax')) {\n context.error(DiagnosticCodes.NestedBlockWithoutFrom, `Nested block '${property}' must contain at least one 'from' directive`, locationOf(line));\n }\n return { kind: 'NestedSyntax', property, autoMap, blocks, location: locationOf(line) };\n}\n\nfunction parseChildBlocks(context: ParserContext, line: SourceLine): { autoMap: AutoMapMode; blocks: ProjectionBlockSyntax[] } {\n const blocks: ProjectionBlockSyntax[] = [];\n let autoMap: AutoMapMode = 'Inherit';\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n if (child.content === 'automap') {\n autoMap = 'Enabled';\n continue;\n }\n if (child.content === 'no automap') {\n autoMap = 'Disabled';\n continue;\n }\n const block = parseBlock(context, child, true);\n if (block !== undefined) {\n blocks.push(block);\n }\n }\n return { autoMap, blocks };\n}\n\nfunction parseRemove(context: ParserContext, line: SourceLine): ProjectionBlockSyntax | undefined {\n const viaJoin = removeViaJoinPattern.exec(line.content);\n if (viaJoin !== null) {\n return { kind: 'RemoveViaJoinSyntax', event: unescapeIdentifier(viaJoin[1]), key: viaJoin[2] === undefined ? null : parseProjectionExpression(viaJoin[2], locationOf(line), context), location: locationOf(line) };\n }\n const match = removeWithPattern.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidRemoveDeclaration, `Invalid remove declaration '${line.content}' - expected 'remove with <EventType>' or 'remove via join on <EventType>'`, locationOf(line));\n context.skipBlock(line.indent);\n return undefined;\n }\n let key = match[2] === undefined ? null : parseProjectionExpression(match[2], locationOf(line), context);\n let partsKey: CompositeKeySyntax | null = null;\n let parentKey: ExpressionSyntax | null = null;\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n if (firstWord(child.content) === 'parent') {\n parentKey = parseProjectionExpression(child.content.substring('parent'.length), locationOf(child), context);\n } else if (firstWord(child.content) === 'key') {\n if (key !== null || partsKey !== null) context.error(DiagnosticCodes.InvalidReadModelKeyLookup, 'A removal can only declare one key.', locationOf(child));\n const parsed = parseKey(context, child);\n if (parsed.kind === 'CompositeKeySyntax') partsKey = parsed;\n else key = parsed.expression;\n } else {\n context.error(DiagnosticCodes.UnknownRemoveDirective, `Unexpected '${child.content}' in remove block - only 'parent' or 'key' is allowed`, locationOf(child));\n }\n }\n return { kind: 'RemoveWithSyntax', event: unescapeIdentifier(match[1]), key, ...(partsKey === null ? {} : { partsKey }), parentKey, location: locationOf(line) };\n}\n\nfunction parseClearWith(context: ParserContext, line: SourceLine): ClearWithSyntax {\n const match = clearWithPattern.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidClearDeclaration, `Invalid clear declaration '${line.content}' - expected 'clear with <EventType>'`, locationOf(line));\n return { kind: 'ClearWithSyntax', event: '', location: locationOf(line) };\n }\n return { kind: 'ClearWithSyntax', event: unescapeIdentifier(match[1]), location: locationOf(line) };\n}\n\nfunction parseVariant(context: ParserContext, line: SourceLine): ProjectionVariantSyntax {\n const match = variantPattern.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidProjectionVariantDeclaration, `Invalid variant declaration '${line.content}' - expected 'variant <Name>'`, locationOf(line));\n context.skipBlock(line.indent);\n return { kind: 'ProjectionVariantSyntax', name: firstWord(line.content), entersOn: [], blocks: [], location: locationOf(line) };\n }\n const name = unescapeIdentifier(match[1]);\n const entersOn: ProjectionEntersOnSyntax[] = [];\n const blocks: ProjectionBlockSyntax[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n const keyword = firstWord(child.content);\n if (keyword === 'enters') {\n entersOn.push(parseEntersOn(context, child));\n } else if (keyword === 'variant') {\n context.error(DiagnosticCodes.NestedProjectionVariantNotAllowed, 'A variant cannot be declared inside another variant', locationOf(child));\n context.skipBlock(child.indent);\n } else {\n const block = parseBlock(context, child, false);\n if (block !== undefined) {\n blocks.push(block);\n }\n }\n }\n if (entersOn.length === 0) {\n context.error(DiagnosticCodes.VariantRequiresEnteringEvent, `Variant '${name}' must declare at least one 'enters on' event`, locationOf(line));\n }\n return { kind: 'ProjectionVariantSyntax', name, entersOn, blocks, location: locationOf(line) };\n}\n\nfunction parseEntersOn(context: ParserContext, line: SourceLine): ProjectionEntersOnSyntax {\n const match = entersOnPattern.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidEntersOnDeclaration, `Invalid 'enters on' declaration '${line.content}' - expected 'enters on <EventType> [key <expression>]'`, locationOf(line));\n context.skipBlock(line.indent);\n return { kind: 'ProjectionEntersOnSyntax', event: '', key: null, location: locationOf(line) };\n }\n return { kind: 'ProjectionEntersOnSyntax', event: unescapeIdentifier(match[1]), key: match[2] === undefined ? null : parseProjectionExpression(match[2], locationOf(line), context), location: locationOf(line) };\n}\n\n// A key with a body is a composite key: its parts, then a closing '}' at the key's own indent.\nfunction parseKey(context: ParserContext, line: SourceLine): KeySyntax {\n const text = line.content.substring('key'.length).trim();\n if (context.peekChild(line.indent) === undefined) return { kind: 'ExpressionKeySyntax', expression: parseProjectionExpression(text, locationOf(line), context), location: locationOf(line) };\n const parts: KeyPartSyntax[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n if (child.content === '}') continue;\n const match = assignmentPattern.exec(child.content);\n if (match === null) {\n if (context.sourceOptions.numericMode === 'exact') context.error(DiagnosticCodes.InvalidCompositeKeyPart, `Invalid composite key part '${child.content}' - expected '<property> = <expression>'`, locationOf(child));\n continue;\n }\n const expression = parseProjectionExpression(match[2], locationOf(child), context);\n if (context.sourceOptions.numericMode === 'exact' && text.replace(/\\{$/, '').trim().length > 0 && expression.kind === 'TemplateExpressionSyntax') context.error(DiagnosticCodes.TemplateInCompositeKey, 'Template expressions are not allowed in composite keys', locationOf(child));\n parts.push({ kind: 'KeyPartSyntax', property: unescapeIdentifier(match[1]), expression, location: locationOf(child) });\n }\n const closing = context.reader.peekSignificant();\n if (closing !== undefined && closing.indent === line.indent && closing.content === '}') context.reader.takeSignificant();\n if (context.sourceOptions.numericMode === 'exact' && parts.length === 0) context.error(DiagnosticCodes.EmptyCompositeKey, 'Composite keys must contain at least one part', locationOf(line));\n return { kind: 'CompositeKeySyntax', type: text.replace(/\\{$/, '').trim(), parts, location: locationOf(line) };\n}\n\n// Mapping lines carry no body, so a mapping block is its direct children. The last automap setting wins;\n// a line 'extra' claims is not a mapping.\nfunction parseMappingBlock(context: ParserContext, line: SourceLine, extra: (child: SourceLine) => boolean = () => false): { autoMap: AutoMapMode; mappings: MappingSyntax[] } {\n let autoMap: AutoMapMode = 'Inherit';\n const mappings: MappingSyntax[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n if (child.content === 'automap') {\n autoMap = 'Enabled';\n } else if (child.content === 'no automap') {\n autoMap = 'Disabled';\n } else if (!extra(child)) {\n pushMapping(context, child, mappings);\n }\n }\n return { autoMap, mappings };\n}\n\n// The property one mapping line sets, and how - the port of the C# ParseMappingLine. Exact reports\n// malformed mappings; Legacy keeps the existing skip behavior.\nfunction pushMapping(context: ParserContext, line: SourceLine, mappings: MappingSyntax[]): void {\n const location = locationOf(line);\n const keyword = keywordMappingPattern.exec(line.content);\n if (keyword !== null) {\n if (keyword[1] !== 'clear' || keyword[2] !== 'with') {\n mappings.push({ kind: keywordMappings[keyword[1]], property: unescapeIdentifier(keyword[2]), location });\n } else if (context.sourceOptions.numericMode === 'exact') {\n context.error(DiagnosticCodes.InvalidProjectionMapping, `Invalid mapping '${line.content}' - 'clear with' is a block directive and needs an event type; to clear a property named 'with', write 'clear @with'`, location, diagnosticText('text', line.content));\n }\n return;\n }\n const arithmetic = arithmeticPattern.exec(line.content);\n if (arithmetic !== null) {\n mappings.push({ kind: arithmetic[1] === 'add' ? 'AddMappingSyntax' : 'SubtractMappingSyntax', property: unescapeIdentifier(arithmetic[2]), value: parseProjectionExpression(arithmetic[3], location, context), location });\n return;\n }\n const assigned = setPattern.exec(line.content) ?? assignmentPattern.exec(line.content);\n if (assigned !== null) {\n mappings.push({ kind: 'SetMappingSyntax', property: unescapeIdentifier(assigned[1]), source: parseProjectionExpression(assigned[2], location, context), location });\n } else if (context.sourceOptions.numericMode === 'exact') {\n context.error(DiagnosticCodes.InvalidProjectionMapping, `Invalid mapping '${line.content}'`, location, diagnosticText('text', line.content));\n }\n}\n"],"mappings":"2iBAkBA,MAAMA,EAASC,EAAQ,qDAAqD,EACtEC,EAAmBD,EAAQ,mCAAmC,EAC9DE,EAAcF,EAAQ,4CAA4C,EAClEG,EAAcH,EAAQ,uBAAuB,EAC7CI,EAAkBJ,EAAQ,uDAAuD,EACjFK,EAAgBL,EAAQ,yBAAyB,EACjDM,EAAoBN,EAAQ,qDAAqD,EACjFO,EAAuBP,EAAQ,kEAAkE,EACjGQ,EAAmBR,EAAQ,gCAAgC,EAC3DS,EAAiBT,EAAQ,8BAA8B,EACvDU,EAA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null&&this.visitDomain(e.domain),e.imports.forEach(e=>this.visitImport(e)),e.fileImports.forEach(e=>this.visitFileImport(e)),e.systems?.forEach(e=>this.visitSystem(e)),e.eventSources?.forEach(e=>this.visitEventSource(e)),e.concepts.forEach(e=>this.visitConcept(e)),e.types.forEach(e=>this.visitType(e)),e.personas.forEach(e=>this.visitPersona(e)),e.policies?.forEach(e=>this.visitPolicy(e)),e.exposures?.forEach(e=>{this.visitNode(e),e.properties.forEach(e=>this.visitNode(e))}),e.instanceContributions?.forEach(e=>{this.visitNode(e),e.contributions.forEach(e=>{this.visitNode(e),e.value!==null&&this.visitExpression(e.value),e.items.forEach(e=>{this.visitNode(e),e.values.forEach(e=>{this.visitNode(e),this.visitExpression(e.value)})})})}),e.identity!=null&&this.visitIdentity(e.identity),e.purposes?.forEach(e=>this.visitPurpose(e)),e.seeds?.forEach(e=>this.visitSeed(e)),e.modules.forEach(e=>this.visitModule(e)),e.examples?.forEach(e=>this.visitSpecificationExample(e))}visitIdentity(e){this.visitNode(e),e.details.forEach(e=>this.visitIdentityDetail(e))}visitIdentityDetail(e){this.visitNode(e),this.visitTypeRef(e.type),this.visitIdentitySource(e.source)}visitIdentitySource(e){switch(e.kind){case`ClaimIdentitySourceSyntax`:this.visitClaimIdentitySource(e);break;case`QueryIdentitySourceSyntax`:this.visitQueryIdentitySource(e);break;case`CodeIdentitySourceSyntax`:this.visitCodeIdentitySource(e);break;case`FileIdentitySourceSyntax`:this.visitFileIdentitySource(e);break;default:this.visitNode(e)}}visitClaimIdentitySource(e){this.visitNode(e)}visitQueryIdentitySource(e){this.visitNode(e),this.visitExpression(e.by)}visitCodeIdentitySource(e){this.visitNode(e),this.visitCodeBlock(e.code)}visitFileIdentitySource(e){this.visitNode(e),this.visitFileReference(e.file)}visitPurpose(e){this.visitNode(e),e.transfers.forEach(e=>this.visitPurposeTransfer(e))}visitPurposeReference(e){this.visitNode(e)}visitPurposeTransfer(e){this.visitNode(e)}visitPolicy(e){this.visitNode(e),e.condition!==null&&this.visitPolicyCondition(e.condition),e.code!==null&&this.visitCodeBlock(e.code),e.file!==null&&this.visitFileReference(e.file)}visitPolicyCondition(e){this.visitNode(e),e.kind===`ClaimConditionSyntax`&&e.matches!==null&&this.visitExpression(e.matches),e.kind===`NotPolicyConditionSyntax`&&this.visitPolicyCondition(e.operand),e.kind===`LogicalPolicyConditionSyntax`&&(this.visitPolicyCondition(e.left),this.visitPolicyCondition(e.right))}visitSeed(e){this.visitNode(e),e.groups.forEach(e=>{this.visitNode(e),e.events.forEach(e=>{this.visitNode(e),e.properties.forEach(e=>this.visitPropertyMapping(e))})})}visitPersona(e){this.visitNode(e)}visitAuthorize(e){this.visitNode(e),this.visitPolicyRequirement(e.requirement)}visitPolicyRequirement(e){this.visitNode(e),e.kind===`LogicalPolicyRequirementSyntax`&&(this.visitPolicyRequirement(e.left),this.visitPolicyRequirement(e.right))}visitDomain(e){this.visitNode(e)}visitImport(e){this.visitNode(e)}visitFileImport(e){this.visitNode(e)}visitGeneration(e){this.visitNode(e),e.file&&this.visitFileReference(e.file),e.code&&this.visitCodeBlock(e.code)}visitConcept(e){this.visitNode(e),e.attributes.forEach(e=>this.visitNode(e)),e.generation&&this.visitGeneration(e.generation),e.validations?.forEach(e=>this.visitValidate(e))}visitType(e){this.visitNode(e),e.properties.forEach(e=>this.visitProperty(e))}visitDependsOn(e){this.visitNode(e)}visitModule(e){this.visitNode(e),e.purposes?.forEach(e=>this.visitPurposeReference(e)),e.examples?.forEach(e=>this.visitSpecificationExample(e)),e.dependsOn?.forEach(e=>this.visitDependsOn(e)),e.fileImports.forEach(e=>this.visitFileImport(e)),e.authorize!==null&&this.visitAuthorize(e.authorize),e.features.forEach(e=>this.visitFeature(e))}visitFeature(e){this.visitNode(e),e.purposes?.forEach(e=>this.visitPurposeReference(e)),e.examples?.forEach(e=>this.visitSpecificationExample(e)),e.dependsOn?.forEach(e=>this.visitDependsOn(e)),e.fileImports.forEach(e=>this.visitFileImport(e)),e.authorize!==null&&this.visitAuthorize(e.authorize),e.features.forEach(e=>this.visitFeature(e)),e.slices.forEach(e=>this.visitSlice(e))}visitSlice(e){this.visitNode(e),e.purposes?.forEach(e=>this.visitPurposeReference(e)),e.examples?.forEach(e=>this.visitSpecificationExample(e)),e.commands.forEach(e=>this.visitCommand(e)),e.operations?.forEach(e=>this.visitOperation(e)),e.events.forEach(e=>this.visitEvent(e)),e.constraints.forEach(e=>this.visitConstraint(e)),e.queries.forEach(e=>this.visitQuery(e)),e.projections.forEach(e=>this.visitProjection(e)),e.readModels.forEach(e=>this.visitReadModel(e)),e.captures.forEach(e=>this.visitCapture(e)),e.reactions.forEach(e=>this.visitReaction(e)),e.screens.forEach(e=>this.visitScreen(e)),e.specifications.forEach(e=>this.visitSpecification(e))}visitTriggerData(e){this.visitNode(e),e.type!==null&&this.visitTypeRef(e.type)}visitReads(e){this.visitNode(e),e.byParts?.forEach(e=>this.visitPropertyMapping(e))}visitConcurrency(e){this.visitNode(e)}visitReducer(e){this.visitNode(e),e.from!=null&&this.visitObserverFilter(e.from),e.rules.forEach(e=>this.visitReducerRule(e))}visitReducerRule(e){this.visitNode(e),e.file!==null&&this.visitFileReference(e.file),e.code!==null&&this.visitCodeBlock(e.code)}visitForm(e){this.visitNode(e),e.populate!==null&&this.visitNode(e.populate),e.fields.forEach(e=>this.visitNode(e)),e.columns?.forEach(e=>this.visitNode(e)),e.layout!==null&&e.layout!==void 0&&(this.visitNode(e.layout),e.layout.columns.forEach(e=>{this.visitNode(e),e.width!==null&&this.visitNode(e.width),e.minWidth!==null&&this.visitNode(e.minWidth),e.maxWidth!==null&&this.visitNode(e.maxWidth)}),e.layout.columnGap!==null&&this.visitNode(e.layout.columnGap),e.layout.rowGap!==null&&this.visitNode(e.layout.rowGap),e.layout.placements.forEach(e=>{this.visitNode(e),e.width!==null&&this.visitNode(e.width)})),e.onSubmit!==null&&this.visitScreenDirective(e.onSubmit)}visitCommand(e){this.visitNode(e),e.properties.forEach(e=>this.visitProperty(e)),e.authorize!==null&&this.visitAuthorize(e.authorize),e.stream!=null&&this.visitCommandStream(e.stream),e.streamCandidates?.forEach(e=>this.visitCommandStream(e)),e.validations.forEach(e=>this.visitValidate(e)),e.produces.forEach(e=>this.visitProduces(e)),e.handler!=null&&this.visitHandler(e.handler),e.response!=null&&this.visitCommandResponse(e.response)}visitEventSource(e){this.visitNode(e),e.identifier!==null&&this.visitTypeRef(e.identifier),e.streams.forEach(e=>this.visitEventStream(e))}visitEventStream(e){this.visitNode(e),e.streamId!==null&&this.visitTypeRef(e.streamId),e.streamIdParts.forEach(e=>this.visitEventStreamIdPart(e))}visitEventStreamIdPart(e){this.visitNode(e),this.visitTypeRef(e.type)}visitObserverFilter(e){this.visitNode(e)}visitCommandStream(e){this.visitNode(e),e.streamId!==null&&this.visitPropertyMapping(e.streamId),e.streamIdParts.forEach(e=>this.visitPropertyMapping(e)),e.propertyCandidate!==null&&this.visitProperty(e.propertyCandidate)}visitSystem(e){this.visitNode(e)}visitOperation(e){this.visitNode(e),e.inputs.forEach(e=>this.visitProperty(e)),e.execute!==null&&this.visitOperationPhase(e.execute),e.compensate!==null&&this.visitOperationPhase(e.compensate)}visitOperationPhase(e){this.visitNode(e),e.implementation!==null&&this.visitImplementation(e.implementation),e.file!==null&&this.visitFileReference(e.file),e.code!==null&&this.visitCodeBlock(e.code)}visitSpecificationOperationFailure(e){this.visitNode(e)}visitSpecificationCompensated(e){this.visitNode(e)}visitSpecificationOperation(e){this.visitNode(e),e.values.forEach(e=>this.visitPropertyMapping(e))}visitHandler(e){this.visitNode(e),e.implementation!=null&&this.visitImplementation(e.implementation),e.file!==null&&this.visitFileReference(e.file),e.code!==null&&this.visitCodeBlock(e.code)}visitImplementation(e){this.visitNode(e),e.hints.forEach(e=>this.visitImplementationHint(e))}visitImplementationHint(e){this.visitNode(e)}visitFileReference(e){this.visitNode(e)}visitCodeBlock(e){this.visitNode(e)}visitCommandResponse(e){e.kind===`ScalarCommandResponseSyntax`?this.visitScalarCommandResponse(e):this.visitRecordCommandResponse(e)}visitScalarCommandResponse(e){this.visitNode(e),this.visitPropertyResponseSource(e.source)}visitRecordCommandResponse(e){this.visitNode(e),e.fields.forEach(e=>this.visitResponseField(e))}visitResponseField(e){this.visitNode(e),e.type!==null&&this.visitTypeRef(e.type),this.visitPropertyResponseSource(e.source)}visitPropertyResponseSource(e){this.visitNode(e)}visitSpecificationReturn(e){e.kind===`ScalarSpecificationReturnSyntax`?this.visitScalarSpecificationReturn(e):this.visitRecordSpecificationReturn(e)}visitScalarSpecificationReturn(e){this.visitNode(e),this.visitExpression(e.value)}visitRecordSpecificationReturn(e){this.visitNode(e),e.fields.forEach(e=>this.visitPropertyMapping(e))}visitValidate(e){this.visitNode(e),e.kind===`DeclarativeValidateSyntax`?(e.rules.forEach(e=>this.visitValidationRule(e)),e.requirements?.forEach(e=>{this.visitNode(e),this.visitCondition(e.condition)})):e.code!=null&&this.visitCodeBlock(e.code)}visitValidationRule(e){this.visitNode(e),e.implementation!=null&&this.visitImplementation(e.implementation),e.value!==null&&this.visitExpression(e.value),e.file!==null&&this.visitFileReference(e.file),e.code!==null&&this.visitCodeBlock(e.code)}visitEvent(e){this.visitNode(e),e.properties.forEach(e=>this.visitProperty(e)),e.tags.forEach(e=>this.visitTag(e))}visitTag(e){this.visitNode(e),this.visitExpression(e.value)}visitReadModel(e){this.visitNode(e),e.properties.forEach(e=>this.visitProperty(e))}visitConstraint(e){this.visitNode(e),e.kind===`FileConstraintSyntax`&&this.visitNode(e.file),e.additionalRules.forEach(e=>this.visitConstraint(e))}visitQuery(e){this.visitNode(e),this.visitTypeRef(e.returnType),e.by!==null&&this.visitQueryParameter(e.by),e.byParts?.forEach(e=>this.visitQueryParameter(e)),e.filters.forEach(e=>this.visitQueryParameter(e)),e.authorize!==null&&this.visitAuthorize(e.authorize)}visitQueryParameter(e){this.visitNode(e),this.visitTypeRef(e.type),e.source!=null&&this.visitExpression(e.source)}visitKey(e){this.visitNode(e),e.kind===`ExpressionKeySyntax`?this.visitExpression(e.expression):e.parts.forEach(e=>{this.visitNode(e),this.visitExpression(e.expression)})}visitProjection(e){this.visitNode(e),e.key!=null&&this.visitKey(e.key),e.blocks.forEach(e=>this.visitProjectionBlock(e))}visitProjectionBlock(e){switch(this.visitNode(e),e.kind){case`FromSyntax`:e.events.forEach(e=>{this.visitNode(e),e.key!=null&&this.visitExpression(e.key)}),e.key!=null&&this.visitKey(e.key),e.parentKey!=null&&this.visitExpression(e.parentKey),e.mappings.forEach(e=>this.visitMapping(e));break;case`EverySyntax`:case`AllSyntax`:e.mappings.forEach(e=>this.visitMapping(e));break;case`JoinSyntax`:e.events.forEach(e=>this.visitJoinEvent(e));break;case`ProjectionVariantSyntax`:e.entersOn.forEach(e=>{this.visitNode(e),e.key!=null&&this.visitExpression(e.key)}),e.blocks.forEach(e=>this.visitProjectionBlock(e));break;case`ChildrenSyntax`:e.identifiedBy!==void 0&&this.visitExpression(e.identifiedBy),e.blocks.forEach(e=>this.visitProjectionBlock(e));break;case`NestedSyntax`:e.blocks.forEach(e=>this.visitProjectionBlock(e));break;case`RemoveWithSyntax`:e.parentKey!=null&&this.visitExpression(e.parentKey),e.key!=null&&this.visitExpression(e.key);break;case`RemoveViaJoinSyntax`:e.key!=null&&this.visitExpression(e.key)}}visitJoinEvent(e){this.visitNode(e),e.mappings.forEach(e=>this.visitMapping(e))}visitMapping(e){this.visitNode(e),e.source!==void 0&&this.visitExpression(e.source),e.value!==void 0&&this.visitExpression(e.value)}visitCondition(e){this.visitNode(e),e.kind===`ComparisonConditionSyntax`?this.visitExpression(e.right):(this.visitCondition(e.left),this.visitCondition(e.right))}visitReaction(e){this.visitNode(e),e.from!=null&&this.visitObserverFilter(e.from),e.runsAs!=null&&this.visitReactionIdentity(e.runsAs),e.where!=null&&this.visitCondition(e.where),e.triggers.forEach(e=>this.visitReactionTrigger(e))}visitReactionIdentity(e){this.visitNode(e)}visitReactionTrigger(e){this.visitNode(e),this.visitTriggerSource(e.source),e.produces.forEach(e=>this.visitProduces(e)),e.invokes.forEach(e=>this.visitInvokes(e))}visitProduces(e){this.visitNode(e),e.stream!=null&&this.visitCommandStream(e.stream),e.when!=null&&this.visitCondition(e.when),e.inlineEvent!==null&&this.visitEvent(e.inlineEvent),e.inlineOperation!=null&&this.visitOperation(e.inlineOperation),e.for!==null&&this.visitExpression(e.for),e.mappings.forEach(e=>this.visitPropertyMapping(e)),e.tags.forEach(e=>this.visitTag(e))}visitInvokes(e){this.visitNode(e),e.mappings?.forEach(e=>this.visitPropertyMapping(e)),e.onRefused?.forEach(e=>this.visitInvocationRefusal(e))}visitInvocationRefusal(e){this.visitNode(e),e.produces.forEach(e=>this.visitProduces(e))}visitCapture(e){this.visitNode(e),e.source!==null&&this.visitCaptureSource(e.source),e.map?.forEach(e=>this.visitCaptureMap(e)),e.appends.forEach(e=>this.visitCaptureAppend(e)),e.children.forEach(e=>this.visitCaptureChildren(e)),e.nested.forEach(e=>this.visitCaptureNested(e))}visitCaptureSource(e){this.visitNode(e),e.settings.forEach(e=>this.visitCaptureSourceSetting(e))}visitCaptureSourceSetting(e){this.visitNode(e)}visitCaptureMap(e){this.visitNode(e),this.visitExpression(e.source),e.kind===`CaptureMapEntrySyntax`&&e.translations.forEach(e=>this.visitNode(e))}visitCaptureAppend(e){this.visitNode(e),e.when!=null&&this.visitNode(e.when),e.mappings?.forEach(e=>this.visitPropertyMapping(e)),e.tags?.forEach(e=>this.visitTag(e))}visitCaptureChildren(e){this.visitNode(e),e.map?.forEach(e=>this.visitCaptureMap(e)),e.appends.forEach(e=>this.visitCaptureAppend(e))}visitCaptureNested(e){this.visitNode(e),e.map?.forEach(e=>this.visitCaptureMap(e)),e.appends.forEach(e=>this.visitCaptureAppend(e))}visitTriggerSource(e){this.visitNode(e)}visitScreen(e){this.visitNode(e),e.directives.forEach(e=>this.visitScreenDirective(e)),e.contributions?.forEach(e=>{this.visitNode(e),e.directives.forEach(e=>this.visitScreenDirective(e))})}visitScreenDirective(e){if(e.kind===`ScreenGuardedActionSyntax`)this.visitScreenGuardedAction(e);else switch(this.visitNode(e),e.kind){case`ScreenDataSyntax`:this.visitTypeRef(e.type);break;case`ScreenActionSyntax`:e.navigate!==null&&this.visitScreenDirective(e.navigate);break;case`ScreenNavigateSyntax`:e.parameters.forEach(e=>{this.visitNode(e),this.visitUiBinding(e.binding)});break;case`ScreenTemplateReferenceSyntax`:e.slots.forEach(e=>{this.visitNode(e),e.directives.forEach(e=>this.visitScreenDirective(e))});break;case`ScreenSectionSyntax`:e.directives.forEach(e=>this.visitScreenDirective(e));break;case`ScreenTableSyntax`:e.columns.forEach(e=>this.visitNode(e)),e.rowClick!==null&&this.visitScreenDirective(e.rowClick);break;case`ScreenSummarySyntax`:e.fields.forEach(e=>this.visitNode(e));break;case`ScreenComponentSyntax`:e.context!==null&&this.visitUiBinding(e.context),e.properties.forEach(e=>{this.visitNode(e),e.binding!==null&&this.visitUiBinding(e.binding),e.value!==null&&this.visitExpression(e.value)}),e.exposes.forEach(e=>{this.visitNode(e),this.visitUiBinding(e.binding)}),e.presentation.forEach(e=>this.visitNode(e)),e.outlets.forEach(e=>{this.visitNode(e),e.directives.forEach(e=>this.visitScreenDirective(e))});break;case`ScreenToolbarSyntax`:e.items.forEach(e=>{this.visitNode(e),e.parameters.forEach(e=>{this.visitNode(e),this.visitUiBinding(e.binding)}),e.presentation.forEach(e=>this.visitNode(e))}),(e.buttons??[]).forEach(e=>this.visitNode(e));break;case`ScreenCodeSyntax`:this.visitNode(e.code)}}visitScreenGuardedAction(e){this.visitNode(e),e.alternatives.forEach(e=>this.visitScreenActionAlternative(e)),e.otherwise!==null&&this.visitScreenActionOtherwise(e.otherwise),e.navigate!==null&&this.visitScreenDirective(e.navigate)}visitScreenActionAlternative(e){this.visitNode(e),this.visitCondition(e.condition),e.arguments.forEach(e=>this.visitInteractionArgument(e))}visitScreenActionOtherwise(e){this.visitNode(e),e.arguments.forEach(e=>this.visitInteractionArgument(e))}visitInteractionArgument(e){this.visitNode(e)}visitSpecification(e){this.visitNode(e),e.examples?.forEach(e=>this.visitSpecificationExample(e)),e.parameters?.forEach(e=>{this.visitNode(e),this.visitTypeRef(e.type)}),e.cases?.forEach(e=>{this.visitNode(e),e.values.forEach(e=>this.visitPropertyMapping(e))}),e.givenClock!==null&&this.visitSpecificationClock(e.givenClock),e.givenOperationFailures?.forEach(e=>this.visitSpecificationOperationFailure(e)),e.thenOperations?.forEach(e=>this.visitSpecificationOperation(e)),e.thenCompensated?.forEach(e=>this.visitSpecificationCompensated(e)),e.givenCallerPersona!=null&&this.visitNode(e.givenCallerPersona),e.givenCaller!=null&&(this.visitNode(e.givenCaller),e.givenCaller.claims.forEach(e=>this.visitNode(e))),e.given.forEach(e=>this.visitSpecificationEvent(e)),e.givenReadModels.forEach(e=>this.visitSpecificationReadModel(e)),e.when!==null&&this.visitSpecificationCommand(e.when),e.givenCaptures.forEach(e=>this.visitSpecificationCapture(e)),e.whenAppended!==null&&this.visitSpecificationEvent(e.whenAppended),e.whenRedelivered!=null&&this.visitSpecificationRedelivery(e.whenRedelivered),e.whenClock!==null&&this.visitSpecificationClock(e.whenClock),e.whenTrigger!==null&&this.visitSpecificationTrigger(e.whenTrigger),e.whenCapture!==null&&this.visitSpecificationCapture(e.whenCapture),e.whenQuery!==null&&this.visitSpecificationWhenQuery(e.whenQuery),e.thenEvents.forEach(e=>this.visitSpecificationEvent(e)),e.thenReadModels.forEach(e=>this.visitSpecificationReadModel(e)),e.thenAbsentReadModels?.forEach(e=>{this.visitNode(e),this.visitExpression(e.key)}),e.thenQueries?.forEach(e=>{this.visitNode(e),e.arguments.forEach(e=>this.visitPropertyMapping(e)),e.results.forEach(e=>this.visitSpecificationQueryResult(e))}),e.thenResults.forEach(e=>this.visitSpecificationQueryResult(e)),e.thenNoResult!==null&&this.visitNode(e.thenNoResult),e.thenDenied!=null&&this.visitNode(e.thenDenied),e.thenReturns!=null&&this.visitSpecificationReturn(e.thenReturns),e.thenErrors.forEach(e=>{this.visitNode(e),e.caseValue!=null&&this.visitExpression(e.caseValue)})}visitSpecificationRedelivery(e){this.visitNode(e),e.for!==null&&this.visitExpression(e.for),e.stream!=null&&this.visitSpecificationStream(e.stream),e.noStream!=null&&this.visitSpecificationNoStream(e.noStream),e.values.forEach(e=>this.visitPropertyMapping(e))}visitSpecificationClock(e){this.visitNode(e)}visitSpecificationTrigger(e){this.visitNode(e),e.values.forEach(e=>this.visitPropertyMapping(e))}visitSpecificationCapture(e){this.visitNode(e),e.record.forEach(e=>this.visitPropertyMapping(e))}visitSpecificationWhenQuery(e){this.visitNode(e),e.arguments.forEach(e=>this.visitPropertyMapping(e))}visitSpecificationQueryResult(e){this.visitNode(e),e.properties.forEach(e=>this.visitPropertyMapping(e))}visitSpecificationExample(e){this.visitNode(e),e.for!==null&&this.visitExpression(e.for),e.stream!=null&&this.visitSpecificationStream(e.stream),e.noStream!=null&&this.visitSpecificationNoStream(e.noStream),e.values.forEach(e=>this.visitPropertyMapping(e)),e.generatedValues.forEach(e=>this.visitPropertyMapping(e))}visitSpecificationEvent(e){this.visitNode(e),e.stream!=null&&this.visitSpecificationStream(e.stream),e.noStream!=null&&this.visitSpecificationNoStream(e.noStream),e.values.forEach(e=>this.visitPropertyMapping(e)),e.for!==null&&this.visitExpression(e.for)}visitSpecificationStream(e){this.visitNode(e),e.streamId!==null&&this.visitPropertyMapping(e.streamId),e.streamIdParts.forEach(e=>this.visitPropertyMapping(e))}visitSpecificationNoStream(e){this.visitNode(e)}visitSpecificationCommand(e){this.visitNode(e),(e.generatedValues??[]).forEach(e=>this.visitPropertyMapping(e)),e.values.forEach(e=>this.visitPropertyMapping(e)),e.for!==null&&this.visitExpression(e.for)}visitSpecificationReadModel(e){this.visitNode(e),e.properties.forEach(e=>this.visitPropertyMapping(e))}visitPropertyMapping(e){this.visitNode(e),this.visitExpression(e.source)}visitProperty(e){this.visitNode(e),this.visitTypeRef(e.type)}visitTypeRef(e){this.visitNode(e)}visitUiBinding(e){this.visitNode(e),e.literal!==null&&this.visitExpression(e.literal)}visitIdentityExpression(e){this.visitNode(e)}visitExpression(e){e.kind===`IdentityExpressionSyntax`?this.visitIdentityExpression(e):(this.visitNode(e),e.kind===`ListExpressionSyntax`?e.items.forEach(e=>this.visitExpression(e)):e.kind===`ObjectExpressionSyntax`?e.members.forEach(e=>this.visitObjectMember(e)):e.kind===`TemplateExpressionSyntax`&&e.parts.forEach(e=>{this.visitNode(e),e.kind===`TemplateInterpolationSyntax`&&this.visitExpression(e.expression)}))}visitObjectMember(e){this.visitNode(e),this.visitExpression(e.value)}};export{ScreenplaySyntaxWalker};
|
|
1
|
+
import"../../_virtual/_virtual/_rolldown/runtime.js";var ScreenplaySyntaxWalker=class{visitNode(e){}visitApplication(e){this.visitNode(e),e.domain!==null&&this.visitDomain(e.domain),e.imports.forEach(e=>this.visitImport(e)),e.fileImports.forEach(e=>this.visitFileImport(e)),e.systems?.forEach(e=>this.visitSystem(e)),e.eventSources?.forEach(e=>this.visitEventSource(e)),e.concepts.forEach(e=>this.visitConcept(e)),e.types.forEach(e=>this.visitType(e)),e.personas.forEach(e=>this.visitPersona(e)),e.policies?.forEach(e=>this.visitPolicy(e)),e.exposures?.forEach(e=>{this.visitNode(e),e.properties.forEach(e=>this.visitNode(e))}),e.instanceContributions?.forEach(e=>{this.visitNode(e),e.contributions.forEach(e=>{this.visitNode(e),e.value!==null&&this.visitExpression(e.value),e.items.forEach(e=>{this.visitNode(e),e.values.forEach(e=>{this.visitNode(e),this.visitExpression(e.value)})})})}),e.identity!=null&&this.visitIdentity(e.identity),e.purposes?.forEach(e=>this.visitPurpose(e)),e.seeds?.forEach(e=>this.visitSeed(e)),e.modules.forEach(e=>this.visitModule(e)),e.examples?.forEach(e=>this.visitSpecificationExample(e))}visitIdentity(e){this.visitNode(e),e.details.forEach(e=>this.visitIdentityDetail(e))}visitIdentityDetail(e){this.visitNode(e),this.visitTypeRef(e.type),this.visitIdentitySource(e.source)}visitIdentitySource(e){switch(e.kind){case`ClaimIdentitySourceSyntax`:this.visitClaimIdentitySource(e);break;case`QueryIdentitySourceSyntax`:this.visitQueryIdentitySource(e);break;case`CodeIdentitySourceSyntax`:this.visitCodeIdentitySource(e);break;case`FileIdentitySourceSyntax`:this.visitFileIdentitySource(e);break;default:this.visitNode(e)}}visitClaimIdentitySource(e){this.visitNode(e)}visitQueryIdentitySource(e){this.visitNode(e),this.visitExpression(e.by)}visitCodeIdentitySource(e){this.visitNode(e),this.visitCodeBlock(e.code)}visitFileIdentitySource(e){this.visitNode(e),this.visitFileReference(e.file)}visitPurpose(e){this.visitNode(e),e.transfers.forEach(e=>this.visitPurposeTransfer(e))}visitPurposeReference(e){this.visitNode(e)}visitPurposeTransfer(e){this.visitNode(e)}visitPolicy(e){this.visitNode(e),e.condition!==null&&this.visitPolicyCondition(e.condition),e.code!==null&&this.visitCodeBlock(e.code),e.file!==null&&this.visitFileReference(e.file)}visitPolicyCondition(e){this.visitNode(e),e.kind===`ClaimConditionSyntax`&&e.matches!==null&&this.visitExpression(e.matches),e.kind===`NotPolicyConditionSyntax`&&this.visitPolicyCondition(e.operand),e.kind===`LogicalPolicyConditionSyntax`&&(this.visitPolicyCondition(e.left),this.visitPolicyCondition(e.right))}visitSeed(e){this.visitNode(e),e.groups.forEach(e=>{this.visitNode(e),e.events.forEach(e=>{this.visitNode(e),e.properties.forEach(e=>this.visitPropertyMapping(e))})})}visitPersona(e){this.visitNode(e)}visitAuthorize(e){this.visitNode(e),this.visitPolicyRequirement(e.requirement)}visitPolicyRequirement(e){this.visitNode(e),e.kind===`LogicalPolicyRequirementSyntax`&&(this.visitPolicyRequirement(e.left),this.visitPolicyRequirement(e.right))}visitDomain(e){this.visitNode(e)}visitImport(e){this.visitNode(e)}visitFileImport(e){this.visitNode(e)}visitGeneration(e){this.visitNode(e),e.file&&this.visitFileReference(e.file),e.code&&this.visitCodeBlock(e.code)}visitConcept(e){this.visitNode(e),e.attributes.forEach(e=>this.visitNode(e)),e.generation&&this.visitGeneration(e.generation),e.validations?.forEach(e=>this.visitValidate(e))}visitType(e){this.visitNode(e),e.properties.forEach(e=>this.visitProperty(e))}visitDependsOn(e){this.visitNode(e)}visitModule(e){this.visitNode(e),e.purposes?.forEach(e=>this.visitPurposeReference(e)),e.examples?.forEach(e=>this.visitSpecificationExample(e)),e.dependsOn?.forEach(e=>this.visitDependsOn(e)),e.fileImports.forEach(e=>this.visitFileImport(e)),e.authorize!==null&&this.visitAuthorize(e.authorize),e.features.forEach(e=>this.visitFeature(e))}visitFeature(e){this.visitNode(e),e.purposes?.forEach(e=>this.visitPurposeReference(e)),e.examples?.forEach(e=>this.visitSpecificationExample(e)),e.dependsOn?.forEach(e=>this.visitDependsOn(e)),e.fileImports.forEach(e=>this.visitFileImport(e)),e.authorize!==null&&this.visitAuthorize(e.authorize),e.features.forEach(e=>this.visitFeature(e)),e.slices.forEach(e=>this.visitSlice(e))}visitSlice(e){this.visitNode(e),e.purposes?.forEach(e=>this.visitPurposeReference(e)),e.examples?.forEach(e=>this.visitSpecificationExample(e)),e.commands.forEach(e=>this.visitCommand(e)),e.operations?.forEach(e=>this.visitOperation(e)),e.events.forEach(e=>this.visitEvent(e)),e.constraints.forEach(e=>this.visitConstraint(e)),e.queries.forEach(e=>this.visitQuery(e)),e.projections.forEach(e=>this.visitProjection(e)),e.readModels.forEach(e=>this.visitReadModel(e)),e.captures.forEach(e=>this.visitCapture(e)),e.reactions.forEach(e=>this.visitReaction(e)),e.screens.forEach(e=>this.visitScreen(e)),e.specifications.forEach(e=>this.visitSpecification(e))}visitTriggerData(e){this.visitNode(e),e.type!==null&&this.visitTypeRef(e.type)}visitReads(e){this.visitNode(e),e.byParts?.forEach(e=>this.visitPropertyMapping(e))}visitConcurrency(e){this.visitNode(e)}visitReducer(e){this.visitNode(e),e.from!=null&&this.visitObserverFilter(e.from),e.rules.forEach(e=>this.visitReducerRule(e))}visitReducerRule(e){this.visitNode(e),e.file!==null&&this.visitFileReference(e.file),e.code!==null&&this.visitCodeBlock(e.code)}visitForm(e){this.visitNode(e),e.populate!==null&&this.visitNode(e.populate),e.fields.forEach(e=>this.visitNode(e)),e.columns?.forEach(e=>this.visitNode(e)),e.layout!==null&&e.layout!==void 0&&(this.visitNode(e.layout),e.layout.columns.forEach(e=>{this.visitNode(e),e.width!==null&&this.visitNode(e.width),e.minWidth!==null&&this.visitNode(e.minWidth),e.maxWidth!==null&&this.visitNode(e.maxWidth)}),e.layout.columnGap!==null&&this.visitNode(e.layout.columnGap),e.layout.rowGap!==null&&this.visitNode(e.layout.rowGap),e.layout.placements.forEach(e=>{this.visitNode(e),e.width!==null&&this.visitNode(e.width)})),e.onSubmit!==null&&this.visitScreenDirective(e.onSubmit)}visitCommand(e){this.visitNode(e),e.properties.forEach(e=>this.visitProperty(e)),e.authorize!==null&&this.visitAuthorize(e.authorize),e.stream!=null&&this.visitCommandStream(e.stream),e.streamCandidates?.forEach(e=>this.visitCommandStream(e)),e.validations.forEach(e=>this.visitValidate(e)),e.produces.forEach(e=>this.visitProduces(e)),e.handler!=null&&this.visitHandler(e.handler),e.response!=null&&this.visitCommandResponse(e.response)}visitEventSource(e){this.visitNode(e),e.identifier!==null&&this.visitTypeRef(e.identifier),e.streams.forEach(e=>this.visitEventStream(e))}visitEventStream(e){this.visitNode(e),e.streamId!==null&&this.visitTypeRef(e.streamId),e.streamIdParts.forEach(e=>this.visitEventStreamIdPart(e))}visitEventStreamIdPart(e){this.visitNode(e),this.visitTypeRef(e.type)}visitObserverFilter(e){this.visitNode(e)}visitCommandStream(e){this.visitNode(e),e.streamId!==null&&this.visitPropertyMapping(e.streamId),e.streamIdParts.forEach(e=>this.visitPropertyMapping(e)),e.propertyCandidate!==null&&this.visitProperty(e.propertyCandidate)}visitSystem(e){this.visitNode(e)}visitOperation(e){this.visitNode(e),e.inputs.forEach(e=>this.visitProperty(e)),e.execute!==null&&this.visitOperationPhase(e.execute),e.compensate!==null&&this.visitOperationPhase(e.compensate)}visitOperationPhase(e){this.visitNode(e),e.implementation!==null&&this.visitImplementation(e.implementation),e.file!==null&&this.visitFileReference(e.file),e.code!==null&&this.visitCodeBlock(e.code)}visitSpecificationOperationFailure(e){this.visitNode(e)}visitSpecificationCompensated(e){this.visitNode(e)}visitSpecificationOperation(e){this.visitNode(e),e.values.forEach(e=>this.visitPropertyMapping(e))}visitHandler(e){this.visitNode(e),e.implementation!=null&&this.visitImplementation(e.implementation),e.file!==null&&this.visitFileReference(e.file),e.code!==null&&this.visitCodeBlock(e.code)}visitImplementation(e){this.visitNode(e),e.hints.forEach(e=>this.visitImplementationHint(e))}visitImplementationHint(e){this.visitNode(e)}visitFileReference(e){this.visitNode(e)}visitCodeBlock(e){this.visitNode(e)}visitCommandResponse(e){e.kind===`ScalarCommandResponseSyntax`?this.visitScalarCommandResponse(e):this.visitRecordCommandResponse(e)}visitScalarCommandResponse(e){this.visitNode(e),this.visitPropertyResponseSource(e.source)}visitRecordCommandResponse(e){this.visitNode(e),e.fields.forEach(e=>this.visitResponseField(e))}visitResponseField(e){this.visitNode(e),e.type!==null&&this.visitTypeRef(e.type),this.visitPropertyResponseSource(e.source)}visitPropertyResponseSource(e){this.visitNode(e)}visitSpecificationReturn(e){e.kind===`ScalarSpecificationReturnSyntax`?this.visitScalarSpecificationReturn(e):this.visitRecordSpecificationReturn(e)}visitScalarSpecificationReturn(e){this.visitNode(e),this.visitExpression(e.value)}visitRecordSpecificationReturn(e){this.visitNode(e),e.fields.forEach(e=>this.visitPropertyMapping(e))}visitValidate(e){this.visitNode(e),e.kind===`DeclarativeValidateSyntax`?(e.rules.forEach(e=>this.visitValidationRule(e)),e.requirements?.forEach(e=>{this.visitNode(e),this.visitCondition(e.condition)})):e.code!=null&&this.visitCodeBlock(e.code)}visitValidationRule(e){this.visitNode(e),e.implementation!=null&&this.visitImplementation(e.implementation),e.value!==null&&this.visitExpression(e.value),e.file!==null&&this.visitFileReference(e.file),e.code!==null&&this.visitCodeBlock(e.code)}visitEvent(e){this.visitNode(e),e.properties.forEach(e=>this.visitProperty(e)),e.tags.forEach(e=>this.visitTag(e))}visitTag(e){this.visitNode(e),this.visitExpression(e.value)}visitReadModel(e){this.visitNode(e),e.properties.forEach(e=>this.visitProperty(e))}visitConstraint(e){this.visitNode(e),e.kind===`FileConstraintSyntax`&&this.visitNode(e.file),e.additionalRules.forEach(e=>this.visitConstraint(e))}visitQuery(e){this.visitNode(e),this.visitTypeRef(e.returnType),e.by!==null&&this.visitQueryParameter(e.by),e.byParts?.forEach(e=>this.visitQueryParameter(e)),e.filters.forEach(e=>this.visitQueryParameter(e)),e.authorize!==null&&this.visitAuthorize(e.authorize)}visitQueryParameter(e){this.visitNode(e),this.visitTypeRef(e.type),e.source!=null&&this.visitExpression(e.source)}visitKey(e){this.visitNode(e),e.kind===`ExpressionKeySyntax`?this.visitExpression(e.expression):e.parts.forEach(e=>{this.visitNode(e),this.visitExpression(e.expression)})}visitProjection(e){this.visitNode(e),e.key!=null&&this.visitKey(e.key),e.blocks.forEach(e=>this.visitProjectionBlock(e))}visitProjectionBlock(e){switch(this.visitNode(e),e.kind){case`FromSyntax`:e.events.forEach(e=>{this.visitNode(e),e.key!=null&&this.visitExpression(e.key)}),e.key!=null&&this.visitKey(e.key),e.parentKey!=null&&this.visitExpression(e.parentKey),e.mappings.forEach(e=>this.visitMapping(e));break;case`EverySyntax`:case`AllSyntax`:e.mappings.forEach(e=>this.visitMapping(e));break;case`JoinSyntax`:e.events.forEach(e=>this.visitJoinEvent(e));break;case`ProjectionVariantSyntax`:e.entersOn.forEach(e=>{this.visitNode(e),e.key!=null&&this.visitExpression(e.key)}),e.blocks.forEach(e=>this.visitProjectionBlock(e));break;case`ChildrenSyntax`:e.identifiedBy!==void 0&&this.visitExpression(e.identifiedBy),e.blocks.forEach(e=>this.visitProjectionBlock(e));break;case`NestedSyntax`:e.blocks.forEach(e=>this.visitProjectionBlock(e));break;case`RemoveWithSyntax`:e.partsKey!=null&&this.visitKey(e.partsKey),e.parentKey!=null&&this.visitExpression(e.parentKey),e.key!=null&&this.visitExpression(e.key);break;case`RemoveViaJoinSyntax`:e.key!=null&&this.visitExpression(e.key)}}visitJoinEvent(e){this.visitNode(e),e.mappings.forEach(e=>this.visitMapping(e))}visitMapping(e){this.visitNode(e),e.source!==void 0&&this.visitExpression(e.source),e.value!==void 0&&this.visitExpression(e.value)}visitCondition(e){this.visitNode(e),e.kind===`ComparisonConditionSyntax`?this.visitExpression(e.right):(this.visitCondition(e.left),this.visitCondition(e.right))}visitReaction(e){this.visitNode(e),e.from!=null&&this.visitObserverFilter(e.from),e.runsAs!=null&&this.visitReactionIdentity(e.runsAs),e.where!=null&&this.visitCondition(e.where),e.triggers.forEach(e=>this.visitReactionTrigger(e))}visitReactionIdentity(e){this.visitNode(e)}visitReactionTrigger(e){this.visitNode(e),this.visitTriggerSource(e.source),e.produces.forEach(e=>this.visitProduces(e)),e.invokes.forEach(e=>this.visitInvokes(e))}visitProduces(e){this.visitNode(e),e.stream!=null&&this.visitCommandStream(e.stream),e.when!=null&&this.visitCondition(e.when),e.inlineEvent!==null&&this.visitEvent(e.inlineEvent),e.inlineOperation!=null&&this.visitOperation(e.inlineOperation),e.for!==null&&this.visitExpression(e.for),e.mappings.forEach(e=>this.visitPropertyMapping(e)),e.tags.forEach(e=>this.visitTag(e))}visitInvokes(e){this.visitNode(e),e.mappings?.forEach(e=>this.visitPropertyMapping(e)),e.onRefused?.forEach(e=>this.visitInvocationRefusal(e))}visitInvocationRefusal(e){this.visitNode(e),e.produces.forEach(e=>this.visitProduces(e))}visitCapture(e){this.visitNode(e),e.source!==null&&this.visitCaptureSource(e.source),e.map?.forEach(e=>this.visitCaptureMap(e)),e.appends.forEach(e=>this.visitCaptureAppend(e)),e.children.forEach(e=>this.visitCaptureChildren(e)),e.nested.forEach(e=>this.visitCaptureNested(e))}visitCaptureSource(e){this.visitNode(e),e.settings.forEach(e=>this.visitCaptureSourceSetting(e))}visitCaptureSourceSetting(e){this.visitNode(e)}visitCaptureMap(e){this.visitNode(e),this.visitExpression(e.source),e.kind===`CaptureMapEntrySyntax`&&e.translations.forEach(e=>this.visitNode(e))}visitCaptureAppend(e){this.visitNode(e),e.when!=null&&this.visitNode(e.when),e.mappings?.forEach(e=>this.visitPropertyMapping(e)),e.tags?.forEach(e=>this.visitTag(e))}visitCaptureChildren(e){this.visitNode(e),e.map?.forEach(e=>this.visitCaptureMap(e)),e.appends.forEach(e=>this.visitCaptureAppend(e))}visitCaptureNested(e){this.visitNode(e),e.map?.forEach(e=>this.visitCaptureMap(e)),e.appends.forEach(e=>this.visitCaptureAppend(e))}visitTriggerSource(e){this.visitNode(e)}visitScreen(e){this.visitNode(e),e.directives.forEach(e=>this.visitScreenDirective(e)),e.contributions?.forEach(e=>{this.visitNode(e),e.directives.forEach(e=>this.visitScreenDirective(e))})}visitScreenDirective(e){if(e.kind===`ScreenGuardedActionSyntax`)this.visitScreenGuardedAction(e);else switch(this.visitNode(e),e.kind){case`ScreenDataSyntax`:this.visitTypeRef(e.type);break;case`ScreenActionSyntax`:e.navigate!==null&&this.visitScreenDirective(e.navigate);break;case`ScreenNavigateSyntax`:e.parameters.forEach(e=>{this.visitNode(e),this.visitUiBinding(e.binding)});break;case`ScreenTemplateReferenceSyntax`:e.slots.forEach(e=>{this.visitNode(e),e.directives.forEach(e=>this.visitScreenDirective(e))});break;case`ScreenSectionSyntax`:e.directives.forEach(e=>this.visitScreenDirective(e));break;case`ScreenTableSyntax`:e.columns.forEach(e=>this.visitNode(e)),e.rowClick!==null&&this.visitScreenDirective(e.rowClick);break;case`ScreenSummarySyntax`:e.fields.forEach(e=>this.visitNode(e));break;case`ScreenComponentSyntax`:e.context!==null&&this.visitUiBinding(e.context),e.properties.forEach(e=>{this.visitNode(e),e.binding!==null&&this.visitUiBinding(e.binding),e.value!==null&&this.visitExpression(e.value)}),e.exposes.forEach(e=>{this.visitNode(e),this.visitUiBinding(e.binding)}),e.presentation.forEach(e=>this.visitNode(e)),e.outlets.forEach(e=>{this.visitNode(e),e.directives.forEach(e=>this.visitScreenDirective(e))});break;case`ScreenToolbarSyntax`:e.items.forEach(e=>{this.visitNode(e),e.parameters.forEach(e=>{this.visitNode(e),this.visitUiBinding(e.binding)}),e.presentation.forEach(e=>this.visitNode(e))}),(e.buttons??[]).forEach(e=>this.visitNode(e));break;case`ScreenCodeSyntax`:this.visitNode(e.code)}}visitScreenGuardedAction(e){this.visitNode(e),e.alternatives.forEach(e=>this.visitScreenActionAlternative(e)),e.otherwise!==null&&this.visitScreenActionOtherwise(e.otherwise),e.navigate!==null&&this.visitScreenDirective(e.navigate)}visitScreenActionAlternative(e){this.visitNode(e),this.visitCondition(e.condition),e.arguments.forEach(e=>this.visitInteractionArgument(e))}visitScreenActionOtherwise(e){this.visitNode(e),e.arguments.forEach(e=>this.visitInteractionArgument(e))}visitInteractionArgument(e){this.visitNode(e)}visitSpecification(e){this.visitNode(e),e.examples?.forEach(e=>this.visitSpecificationExample(e)),e.parameters?.forEach(e=>{this.visitNode(e),this.visitTypeRef(e.type)}),e.cases?.forEach(e=>{this.visitNode(e),e.values.forEach(e=>this.visitPropertyMapping(e))}),e.givenClock!==null&&this.visitSpecificationClock(e.givenClock),e.givenOperationFailures?.forEach(e=>this.visitSpecificationOperationFailure(e)),e.thenOperations?.forEach(e=>this.visitSpecificationOperation(e)),e.thenCompensated?.forEach(e=>this.visitSpecificationCompensated(e)),e.givenCallerPersona!=null&&this.visitNode(e.givenCallerPersona),e.givenCaller!=null&&(this.visitNode(e.givenCaller),e.givenCaller.claims.forEach(e=>this.visitNode(e))),e.given.forEach(e=>this.visitSpecificationEvent(e)),e.givenReadModels.forEach(e=>this.visitSpecificationReadModel(e)),e.when!==null&&this.visitSpecificationCommand(e.when),e.givenCaptures.forEach(e=>this.visitSpecificationCapture(e)),e.whenAppended!==null&&this.visitSpecificationEvent(e.whenAppended),e.whenRedelivered!=null&&this.visitSpecificationRedelivery(e.whenRedelivered),e.whenClock!==null&&this.visitSpecificationClock(e.whenClock),e.whenTrigger!==null&&this.visitSpecificationTrigger(e.whenTrigger),e.whenCapture!==null&&this.visitSpecificationCapture(e.whenCapture),e.whenQuery!==null&&this.visitSpecificationWhenQuery(e.whenQuery),e.thenEvents.forEach(e=>this.visitSpecificationEvent(e)),e.thenReadModels.forEach(e=>this.visitSpecificationReadModel(e)),e.thenAbsentReadModels?.forEach(e=>{this.visitNode(e),this.visitExpression(e.key)}),e.thenQueries?.forEach(e=>{this.visitNode(e),e.arguments.forEach(e=>this.visitPropertyMapping(e)),e.results.forEach(e=>this.visitSpecificationQueryResult(e))}),e.thenResults.forEach(e=>this.visitSpecificationQueryResult(e)),e.thenNoResult!==null&&this.visitNode(e.thenNoResult),e.thenDenied!=null&&this.visitNode(e.thenDenied),e.thenReturns!=null&&this.visitSpecificationReturn(e.thenReturns),e.thenErrors.forEach(e=>{this.visitNode(e),e.caseValue!=null&&this.visitExpression(e.caseValue)})}visitSpecificationRedelivery(e){this.visitNode(e),e.for!==null&&this.visitExpression(e.for),e.stream!=null&&this.visitSpecificationStream(e.stream),e.noStream!=null&&this.visitSpecificationNoStream(e.noStream),e.values.forEach(e=>this.visitPropertyMapping(e))}visitSpecificationClock(e){this.visitNode(e)}visitSpecificationTrigger(e){this.visitNode(e),e.values.forEach(e=>this.visitPropertyMapping(e))}visitSpecificationCapture(e){this.visitNode(e),e.record.forEach(e=>this.visitPropertyMapping(e))}visitSpecificationWhenQuery(e){this.visitNode(e),e.arguments.forEach(e=>this.visitPropertyMapping(e))}visitSpecificationQueryResult(e){this.visitNode(e),e.properties.forEach(e=>this.visitPropertyMapping(e))}visitSpecificationExample(e){this.visitNode(e),e.for!==null&&this.visitExpression(e.for),e.stream!=null&&this.visitSpecificationStream(e.stream),e.noStream!=null&&this.visitSpecificationNoStream(e.noStream),e.values.forEach(e=>this.visitPropertyMapping(e)),e.generatedValues.forEach(e=>this.visitPropertyMapping(e))}visitSpecificationEvent(e){this.visitNode(e),e.stream!=null&&this.visitSpecificationStream(e.stream),e.noStream!=null&&this.visitSpecificationNoStream(e.noStream),e.values.forEach(e=>this.visitPropertyMapping(e)),e.for!==null&&this.visitExpression(e.for)}visitSpecificationStream(e){this.visitNode(e),e.streamId!==null&&this.visitPropertyMapping(e.streamId),e.streamIdParts.forEach(e=>this.visitPropertyMapping(e))}visitSpecificationNoStream(e){this.visitNode(e)}visitSpecificationCommand(e){this.visitNode(e),(e.generatedValues??[]).forEach(e=>this.visitPropertyMapping(e)),e.values.forEach(e=>this.visitPropertyMapping(e)),e.for!==null&&this.visitExpression(e.for)}visitSpecificationReadModel(e){this.visitNode(e),e.properties.forEach(e=>this.visitPropertyMapping(e))}visitPropertyMapping(e){this.visitNode(e),this.visitExpression(e.source)}visitProperty(e){this.visitNode(e),this.visitTypeRef(e.type)}visitTypeRef(e){this.visitNode(e)}visitUiBinding(e){this.visitNode(e),e.literal!==null&&this.visitExpression(e.literal)}visitIdentityExpression(e){this.visitNode(e)}visitExpression(e){e.kind===`IdentityExpressionSyntax`?this.visitIdentityExpression(e):(this.visitNode(e),e.kind===`ListExpressionSyntax`?e.items.forEach(e=>this.visitExpression(e)):e.kind===`ObjectExpressionSyntax`?e.members.forEach(e=>this.visitObjectMember(e)):e.kind===`TemplateExpressionSyntax`&&e.parts.forEach(e=>{this.visitNode(e),e.kind===`TemplateInterpolationSyntax`&&this.visitExpression(e.expression)}))}visitObjectMember(e){this.visitNode(e),this.visitExpression(e.value)}};export{ScreenplaySyntaxWalker};
|
|
2
2
|
//# sourceMappingURL=ScreenplaySyntaxWalker.js.map
|