@elyx-code/project-logic-tree 0.0.6009 → 0.0.6010

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/index.js CHANGED
@@ -25821,15 +25821,20 @@ class fs {
25821
25821
  );
25822
25822
  t && (e.readsValue = t);
25823
25823
  }
25824
- if (e.readsValue && Ge.includes(e.readsValue.type)) {
25825
- let t = e.parent;
25826
- Et.includes(t.type) || (t = t.parent), e.readsValue.setParent(
25827
- t
25828
- ), e.readsValue.addValueReader(e), e.readsValue.initChildren(), t.detachedChildren.includes(e) ? t.replaceDetachedChild(
25829
- e,
25830
- e.readsValue
25831
- ) : t.subscribeDetachedChild(
25832
- e.readsValue
25824
+ if (e.readsValue) {
25825
+ if (Ge.includes(e.readsValue.type)) {
25826
+ let t = e.parent;
25827
+ Et.includes(t.type) || (t = t.parent), e.readsValue.setParent(
25828
+ t
25829
+ ), e.readsValue.initChildren(), t.detachedChildren.includes(e) ? t.replaceDetachedChild(
25830
+ e,
25831
+ e.readsValue
25832
+ ) : t.subscribeDetachedChild(
25833
+ e.readsValue
25834
+ );
25835
+ }
25836
+ e.readsValue.addValueReader(
25837
+ e
25833
25838
  );
25834
25839
  }
25835
25840
  return e.readsValue;
@@ -54,7 +54,7 @@ You shouldn't have to manually update a 'parent' property. The equivalent result
54
54
  ${oo(t)}`,issue:null})):a.push(new E({id:`${e.id}--${y.ReferencedEntityNotFound}`,code:y.ReferencedEntityNotFound,severity:m.Error,message:`Entity of type '${e.type}' with id '${e.id}' has an 'declaration' property that isn't found in the project. The 'declaration' property must point to one of the built-in action descriptors reserved for '${r.Condition}' entities.
55
55
  ${oo(t)}`,issue:null})):a.push(new E({id:`${e.id}--${g.InvalidObjectStructure}`,code:g.InvalidObjectStructure,severity:m.Error,message:`Entity of type '${e.type}' with id '${e.id}' is missing the 'declaration' property. This property is required for a '${e.type}' entity and must point to one of the built-in action descriptors reserved for '${r.Condition}' entities.
56
56
  ${oo(t)}`,issue:null})),{errors:a,modifiedData:i}}validateGeneratedUpdate(e){const t=[];return e.parent&&t.push(new E({id:`${this.id}--${y.InvalidParentUpdate}`,code:y.InvalidParentUpdate,severity:m.Error,message:`Entity of type '${this.type}' with id '${this.id}' cannot have the 'parent' property updated. The 'parent' on a callable entity, is its scope. It scope is auto-calculated implicitly by the its caller.
57
- If an entity is called by another, they must be in the same scope, which means they have the same parent.`,issue:null})),{errors:t,modifiedData:e}}addSelfToProject(){return this.parent===this.project&&this.project.addCondition(this),this.successCalls.forEach(e=>{e.addSuccessCaller(this)}),this.errorCalls.forEach(e=>{e.addErrorCaller(this)}),this.calledByEntry.forEach(e=>{e.addCall(this)}),this.calledBySuccess.forEach(e=>{e.addSuccessCall(this)}),this.calledByError.forEach(e=>{e.addErrorCall(this)}),this}get calledBy(){return[...this.calledByEntry,...this.calledBySuccess,...this.calledByError]}removeInput(e){const t=this.inputs.findIndex(i=>i.id===e.id);return t>-1&&this.inputs.splice(t,1),this}addInput(e){return this.inputs.includes(e)?this:(this.inputs.push(e),this)}addOutput(e){return this}removeOutput(e){return this}addSuccessCaller(e){return this.calledBySuccess.find(t=>t.id===e.id)||this.calledBySuccess.push(e),this}addErrorCaller(e){return this.calledByError.find(t=>t.id===e.id)||this.calledByError.push(e),this}addEntryCaller(e){return this.calledByEntry.find(t=>t.id===e.id)||this.calledByEntry.push(e),this}addErrorCall(e){return this.errorCalls.push(e),this}addSuccessCall(e){return this.successCalls.push(e),this}removeCall(e){const t=this.successCalls.findIndex(a=>a.id===e.id);t>-1&&this.successCalls.splice(t,1);const i=this.errorCalls.findIndex(a=>a.id===e.id);return i>-1&&this.errorCalls.splice(i,1),this}removeCaller(e){return this.calledBySuccess=this.calledBySuccess.filter(t=>t.id!==e.id),this.calledByError=this.calledByError.filter(t=>t.id!==e.id),this.calledByEntry=this.calledByEntry.filter(t=>t.id!==e.id),this}setParent(e){return this.parent=e,this}initChildren(){return this.initialized?this:(this.initialized=!0,this.declaration=R(this.initialData.declaration,this.project),this.successCalls=this.initialData.successCalls.map(e=>{const t=R(e,this.project);return t.addSuccessCaller(this),[r.BreakStatement,r.ContinueStatement].includes(t.type)?(t.setParent(this.parent.parent),t.initChildren()):t.type!==r.InternalCall&&(t.setParent(this.parent),t.initChildren()),t}),this.errorCalls=this.initialData.errorCalls.map(e=>{const t=R(e,this.project);return t.addErrorCaller(this),[r.BreakStatement,r.ContinueStatement].includes(t.type)?(t.setParent(this.parent.parent),t.initChildren()):t.type!==r.InternalCall&&(t.setParent(this.parent),t.initChildren()),t}),this.inputs=this.initialData.inputs.map(e=>{const t=R(e,this.project);return t.setParent(this),t.initChildren(),t}),this)}subscribe(){return this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}sync(e){return this.version=e.version||this.version,this.x=e.x||this.x,this.y=e.y||this.y,this}async load(){return this}async create(){return this}async update(e){return this}async delete(){return this}remove({ignoreUpstream:e,seenEntities:t}={ignoreUpstream:!1,seenEntities:new Set}){const i=[],a=[];return t.has(this.id)?{affected:[],removed:[]}:(t.add(this.id),a.push(this),this.unsubscribe(),this.inputs.forEach(s=>{const{affected:o,removed:d}=s.remove({ignoreUpstream:!0,seenEntities:t});i.push(...o),a.push(...d)}),this.successCalls.forEach(s=>{i.push(s),s.removeCaller(this)}),this.errorCalls.forEach(s=>{i.push(s),s.removeCaller(this)}),e||this.calledBy.forEach(s=>{i.push(s),s.removeCall(this)}),{affected:S(i),removed:S(a)})}restore({seenEntities:e}={seenEntities:new Set}){const t=[];return e.has(this.id)?{affected:[],self:this}:(e.add(this.id),this.subscribe(),this.inputs.forEach(i=>{const{affected:a}=i.restore({seenEntities:e});t.push(...a)}),this.successCalls.forEach(i=>{t.push(i),i.addSuccessCaller(this)}),this.errorCalls.forEach(i=>{t.push(i),i.addErrorCaller(this)}),this.calledBySuccess.forEach(i=>{t.push(i),i.addSuccessCall(this)}),this.calledByError.forEach(i=>{t.push(i),i.addErrorCall(this)}),this.calledByEntry.forEach(i=>{t.push(i),i.addCall(this)}),{affected:t,self:this})}toFlat(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this,...this.inputs.flatMap(i=>i.toFlat(e)),...this.successCalls.flatMap(i=>i.toFlat(e)),...this.errorCalls.flatMap(i=>i.toFlat(e)),...this.calledBy.flatMap(i=>i.toFlat(e))])}toFlatIds(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.id,...this.inputs.flatMap(i=>i.toFlatIds(e)),...this.successCalls.flatMap(i=>i.toFlatIds(e)),...this.errorCalls.flatMap(i=>i.toFlatIds(e)),...this.calledBy.flatMap(i=>i.toFlatIds(e))])}toJSON(){return{id:this.id,version:this.version,type:this.type,x:this.x,y:this.y,declaration:this.declaration.toJSON(),successCalls:this.successCalls.map(e=>e.toJSON()),errorCalls:this.errorCalls.map(e=>e.toJSON()),calledBySuccess:this.calledBySuccess.map(e=>e.toReference()),calledByError:this.calledByError.map(e=>e.toReference()),calledByEntry:this.calledByEntry.map(e=>e.toReference()),inputs:this.inputs.map(e=>e.toJSON()),parent:this.parent.toReference()}}toReference(){return{id:this.id+"--"+$.UUID.uuid()+"--ref",type:r.GenericReference,entityId:this.id,entityType:this.type}}toShallowJSON(){return{id:this.id,version:this.version,type:this.type,x:this.x,y:this.y,declaration:this.declaration.toReference(),inputs:this.inputs.map(e=>e.toReference()),successCalls:this.successCalls.map(e=>e.toReference()),errorCalls:this.errorCalls.map(e=>e.toReference()),calledBySuccess:this.calledBySuccess.map(e=>e.toReference()),calledByError:this.calledByError.map(e=>e.toReference()),calledByEntry:this.calledByEntry.map(e=>e.toReference()),parent:this.parent.toReference()}}toFlatJSON(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toShallowJSON(),...this.inputs.flatMap(i=>i.toFlatJSON(e)),...this.successCalls.flatMap(i=>i.toFlatJSON(e)),...this.errorCalls.flatMap(i=>i.toFlatJSON(e)),...this.calledBy.flatMap(i=>i.toFlatJSON(e))])}toGenerationTarget(){const e=this.parent.type===r.Project?void 0:this.parent.id;return{id:this.id,type:this.type,declaration:this.declaration.id,calledByEntry:this.calledByEntry.map(t=>t.id),calledBySuccess:this.calledBySuccess.map(t=>t.id),calledByError:this.calledByError.map(t=>t.id),parent:e}}toFlatGenerationTarget(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toGenerationTarget(),...this.inputs.flatMap(i=>i.toFlatGenerationTarget(e)),...this.successCalls.flatMap(i=>i.toFlatGenerationTarget(e)),...this.errorCalls.flatMap(i=>i.toFlatGenerationTarget(e))])}clearErrors(){return this.errors=[],this.inputs.forEach(e=>e.clearErrors()),this.successCalls.forEach(e=>e.clearErrors()),this.errorCalls.forEach(e=>e.clearErrors()),this}validate(){const e=y9(this);return this.errors=e,{success:!0,error:null,data:this.toJSON()}}getErrors(){return[...this.errors,...this.inputs.flatMap(t=>t.getErrors())]}getShallowErrors(){return this.errors}clone(e){return new me(this.toJSON(),this.project)}};l(me,"MUTABLE_BASE_PROPERTIES",["operator"]),l(me,"INMUTABLE_BASE_PROPERTIES",["id","version","type"]),l(me,"BASE_PROPERTIES",[...me.MUTABLE_BASE_PROPERTIES,...me.INMUTABLE_BASE_PROPERTIES]),l(me,"MUTABLE_META_PROPERTIES",["x","y"]),l(me,"INMUTABLE_META_PROPERTIES",[...me.INMUTABLE_BASE_PROPERTIES]),l(me,"META_PROPERTIES",[...me.MUTABLE_META_PROPERTIES,...me.INMUTABLE_META_PROPERTIES]),l(me,"MUTABLE_UPSTREAM_PROPERTIES",["calledBySuccess","calledByError","calledByEntry","parent"]),l(me,"INMUTABLE_UPSTREAM_PROPERTIES",[]),l(me,"UPSTREAM_PROPERTIES",[...me.MUTABLE_UPSTREAM_PROPERTIES,...me.INMUTABLE_UPSTREAM_PROPERTIES]),l(me,"MUTABLE_DOWNSTREAM_PROPERTIES",["successCalls","errorCalls","inputsDeclarations","inputs"]),l(me,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),l(me,"DOWNSTREAM_PROPERTIES",[...me.MUTABLE_DOWNSTREAM_PROPERTIES,...me.INMUTABLE_DOWNSTREAM_PROPERTIES]),l(me,"PROPERTIES",[...me.META_PROPERTIES,...me.UPSTREAM_PROPERTIES,...me.DOWNSTREAM_PROPERTIES]);let yr=me;class sv{constructor(){l(this,"initialData")}}class h9{}class f9 extends sv{}class m9{}class T9{}class E9{}class yd{}class R9 extends yd{}class b9 extends yd{}class g9{}class la{static initReadsValue(e){if(e.initialData.readsValue&&e.initialData.readsValue.type!==r.GenericReference)e.readsValue=R(e.initialData.readsValue,e.project);else if(e.initialData.readsValue&&e.initialData.readsValue.type===r.GenericReference){const t=Bt(e.initialData.readsValue,e.project);t&&(e.readsValue=t)}if(e.readsValue&&Fe.includes(e.readsValue.type)){let t=e.parent;st.includes(t.type)||(t=t.parent),e.readsValue.setParent(t),e.readsValue.addValueReader(e),e.readsValue.initChildren(),t.detachedChildren.includes(e)?t.replaceDetachedChild(e,e.readsValue):t.subscribeDetachedChild(e.readsValue)}return e.readsValue}}class ca{static initWritesValues(e,t){const i=e.initialData.writesValues.reduce((s,o)=>{if(o.type===r.GenericReference||e.writesValues.some(p=>p.id===o.id))return s;const d=R(o,e.project);return d.setValueWriter(e),Fe.includes(d.type)&&(d.setParent(t),d.initChildren()),[...s,d]},[]),a=[...e.writesValues];return e.writesValues=S([...a,...i]),e.writesValues}}class v9{}function I9(n){var d;const e=ex(),t=n.toJSON();e.safeParse(t).success,(d=n.dataType)==null||d.validate(),n.inputs.forEach(p=>p.validate()),n.outputs.forEach(p=>p.validate()),n.internalCalls.forEach(p=>p.validate());const s=[...En(n)];if(n.id==="random-company-employee-test-variable-id"){const p=j({id:`${n.id}--${O.PropertyImplementsNonAbstact}`,message:`Property "${A(n,n.project)}" with id "${n.id}" implements a non-abstract property "${A(n,n.project)}" with id "${n.id}".`,issue:null,severity:m.Error,code:O.PropertyImplementsNonAbstact,entity:n});s.push(p.error)}if(n.id==="company-dto-variable-one-id"){const p=j({id:`${n.id}--${O.PropertyImplementsNonAbstact}`,message:`Property "${A(n,n.project)}" with id "${n.id}" implements a non-abstract property "${A(n,n.project)}" with id "${n.id}".`,issue:null,severity:m.Error,code:O.PropertyImplementsNonAbstact,entity:n});s.push(p.error)}const o=Id(n);return s.push(...o),X(n.errors,s)}const re=class re{constructor(e,t){l(this,"initialData");l(this,"id");l(this,"version");l(this,"name");l(this,"description",null);l(this,"dataType",null);l(this,"x");l(this,"y");l(this,"type",r.VariableDeclaration);l(this,"writesValues",[]);l(this,"readsValue",null);l(this,"inputs",[]);l(this,"outputs",[]);l(this,"calledBySuccess",[]);l(this,"calledByError",[]);l(this,"calledByEntry",[]);l(this,"successCalls",[]);l(this,"errorCalls",[]);l(this,"internalCalls",[]);l(this,"parent");l(this,"errors",[]);l(this,"project");l(this,"initialized",!1);l(this,"suggestion",!1);this.initialData=e,this.project=t,this.id=e.id,this.version=e.version,this.name=e.name,this.description=e.description,this.x=e.x,this.y=e.y}static fromGenerationTarget(e,t){let i=t;if(e.parent){const T=D(e.parent);i=t.get(T)}const a=e.calledByEntry.map(T=>{const f=D(T);return t.get(f)}),s=e.calledBySuccess.map(T=>{const f=D(T);return t.get(f)}),o=e.calledByError.map(T=>{const f=D(T);return t.get(f)});let d=null;if(e.readsValue){const T=D(e.readsValue);d=t.get(T)}const p={id:e.id,version:1,type:r.VariableDeclaration,name:e.name,description:e.description,calledByEntry:a,calledBySuccess:s,calledByError:o,dataType:null,errorCalls:[],successCalls:[],internalCalls:[],readsValue:d,inputs:[],outputs:[],writesValues:[],x:0,y:0,parent:i},h=R(p,t);return h.setParent(i),h.initChildren(),h}static validateGenerationTarget(e,t){let i=JSON.parse(JSON.stringify(e));const a=[],s=Ge(i,{parent:{list:!1,types:[...st,r.Project],optional:!0}},t);i=s.modifiedData;const o=ld(i,t);return a.push(...s.errors,...o,...Ae(i)),{errors:a,modifiedData:i}}validateGeneratedUpdate(e){const t=[];let i=JSON.parse(JSON.stringify(e));const a=ua(i,this);return i=a.modifiedData,t.push(...a.errors),e.parent&&t.push(new E({id:`${this.id}--${y.InvalidParentUpdate}`,code:y.InvalidParentUpdate,severity:m.Error,message:`Entity of type '${this.type}' with id '${this.id}' cannot have the 'parent' property updated. The 'parent' on a callable entity, is its scope. It scope is auto-calculated implicitly by the its caller.
57
+ If an entity is called by another, they must be in the same scope, which means they have the same parent.`,issue:null})),{errors:t,modifiedData:e}}addSelfToProject(){return this.parent===this.project&&this.project.addCondition(this),this.successCalls.forEach(e=>{e.addSuccessCaller(this)}),this.errorCalls.forEach(e=>{e.addErrorCaller(this)}),this.calledByEntry.forEach(e=>{e.addCall(this)}),this.calledBySuccess.forEach(e=>{e.addSuccessCall(this)}),this.calledByError.forEach(e=>{e.addErrorCall(this)}),this}get calledBy(){return[...this.calledByEntry,...this.calledBySuccess,...this.calledByError]}removeInput(e){const t=this.inputs.findIndex(i=>i.id===e.id);return t>-1&&this.inputs.splice(t,1),this}addInput(e){return this.inputs.includes(e)?this:(this.inputs.push(e),this)}addOutput(e){return this}removeOutput(e){return this}addSuccessCaller(e){return this.calledBySuccess.find(t=>t.id===e.id)||this.calledBySuccess.push(e),this}addErrorCaller(e){return this.calledByError.find(t=>t.id===e.id)||this.calledByError.push(e),this}addEntryCaller(e){return this.calledByEntry.find(t=>t.id===e.id)||this.calledByEntry.push(e),this}addErrorCall(e){return this.errorCalls.push(e),this}addSuccessCall(e){return this.successCalls.push(e),this}removeCall(e){const t=this.successCalls.findIndex(a=>a.id===e.id);t>-1&&this.successCalls.splice(t,1);const i=this.errorCalls.findIndex(a=>a.id===e.id);return i>-1&&this.errorCalls.splice(i,1),this}removeCaller(e){return this.calledBySuccess=this.calledBySuccess.filter(t=>t.id!==e.id),this.calledByError=this.calledByError.filter(t=>t.id!==e.id),this.calledByEntry=this.calledByEntry.filter(t=>t.id!==e.id),this}setParent(e){return this.parent=e,this}initChildren(){return this.initialized?this:(this.initialized=!0,this.declaration=R(this.initialData.declaration,this.project),this.successCalls=this.initialData.successCalls.map(e=>{const t=R(e,this.project);return t.addSuccessCaller(this),[r.BreakStatement,r.ContinueStatement].includes(t.type)?(t.setParent(this.parent.parent),t.initChildren()):t.type!==r.InternalCall&&(t.setParent(this.parent),t.initChildren()),t}),this.errorCalls=this.initialData.errorCalls.map(e=>{const t=R(e,this.project);return t.addErrorCaller(this),[r.BreakStatement,r.ContinueStatement].includes(t.type)?(t.setParent(this.parent.parent),t.initChildren()):t.type!==r.InternalCall&&(t.setParent(this.parent),t.initChildren()),t}),this.inputs=this.initialData.inputs.map(e=>{const t=R(e,this.project);return t.setParent(this),t.initChildren(),t}),this)}subscribe(){return this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}sync(e){return this.version=e.version||this.version,this.x=e.x||this.x,this.y=e.y||this.y,this}async load(){return this}async create(){return this}async update(e){return this}async delete(){return this}remove({ignoreUpstream:e,seenEntities:t}={ignoreUpstream:!1,seenEntities:new Set}){const i=[],a=[];return t.has(this.id)?{affected:[],removed:[]}:(t.add(this.id),a.push(this),this.unsubscribe(),this.inputs.forEach(s=>{const{affected:o,removed:d}=s.remove({ignoreUpstream:!0,seenEntities:t});i.push(...o),a.push(...d)}),this.successCalls.forEach(s=>{i.push(s),s.removeCaller(this)}),this.errorCalls.forEach(s=>{i.push(s),s.removeCaller(this)}),e||this.calledBy.forEach(s=>{i.push(s),s.removeCall(this)}),{affected:S(i),removed:S(a)})}restore({seenEntities:e}={seenEntities:new Set}){const t=[];return e.has(this.id)?{affected:[],self:this}:(e.add(this.id),this.subscribe(),this.inputs.forEach(i=>{const{affected:a}=i.restore({seenEntities:e});t.push(...a)}),this.successCalls.forEach(i=>{t.push(i),i.addSuccessCaller(this)}),this.errorCalls.forEach(i=>{t.push(i),i.addErrorCaller(this)}),this.calledBySuccess.forEach(i=>{t.push(i),i.addSuccessCall(this)}),this.calledByError.forEach(i=>{t.push(i),i.addErrorCall(this)}),this.calledByEntry.forEach(i=>{t.push(i),i.addCall(this)}),{affected:t,self:this})}toFlat(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this,...this.inputs.flatMap(i=>i.toFlat(e)),...this.successCalls.flatMap(i=>i.toFlat(e)),...this.errorCalls.flatMap(i=>i.toFlat(e)),...this.calledBy.flatMap(i=>i.toFlat(e))])}toFlatIds(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.id,...this.inputs.flatMap(i=>i.toFlatIds(e)),...this.successCalls.flatMap(i=>i.toFlatIds(e)),...this.errorCalls.flatMap(i=>i.toFlatIds(e)),...this.calledBy.flatMap(i=>i.toFlatIds(e))])}toJSON(){return{id:this.id,version:this.version,type:this.type,x:this.x,y:this.y,declaration:this.declaration.toJSON(),successCalls:this.successCalls.map(e=>e.toJSON()),errorCalls:this.errorCalls.map(e=>e.toJSON()),calledBySuccess:this.calledBySuccess.map(e=>e.toReference()),calledByError:this.calledByError.map(e=>e.toReference()),calledByEntry:this.calledByEntry.map(e=>e.toReference()),inputs:this.inputs.map(e=>e.toJSON()),parent:this.parent.toReference()}}toReference(){return{id:this.id+"--"+$.UUID.uuid()+"--ref",type:r.GenericReference,entityId:this.id,entityType:this.type}}toShallowJSON(){return{id:this.id,version:this.version,type:this.type,x:this.x,y:this.y,declaration:this.declaration.toReference(),inputs:this.inputs.map(e=>e.toReference()),successCalls:this.successCalls.map(e=>e.toReference()),errorCalls:this.errorCalls.map(e=>e.toReference()),calledBySuccess:this.calledBySuccess.map(e=>e.toReference()),calledByError:this.calledByError.map(e=>e.toReference()),calledByEntry:this.calledByEntry.map(e=>e.toReference()),parent:this.parent.toReference()}}toFlatJSON(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toShallowJSON(),...this.inputs.flatMap(i=>i.toFlatJSON(e)),...this.successCalls.flatMap(i=>i.toFlatJSON(e)),...this.errorCalls.flatMap(i=>i.toFlatJSON(e)),...this.calledBy.flatMap(i=>i.toFlatJSON(e))])}toGenerationTarget(){const e=this.parent.type===r.Project?void 0:this.parent.id;return{id:this.id,type:this.type,declaration:this.declaration.id,calledByEntry:this.calledByEntry.map(t=>t.id),calledBySuccess:this.calledBySuccess.map(t=>t.id),calledByError:this.calledByError.map(t=>t.id),parent:e}}toFlatGenerationTarget(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toGenerationTarget(),...this.inputs.flatMap(i=>i.toFlatGenerationTarget(e)),...this.successCalls.flatMap(i=>i.toFlatGenerationTarget(e)),...this.errorCalls.flatMap(i=>i.toFlatGenerationTarget(e))])}clearErrors(){return this.errors=[],this.inputs.forEach(e=>e.clearErrors()),this.successCalls.forEach(e=>e.clearErrors()),this.errorCalls.forEach(e=>e.clearErrors()),this}validate(){const e=y9(this);return this.errors=e,{success:!0,error:null,data:this.toJSON()}}getErrors(){return[...this.errors,...this.inputs.flatMap(t=>t.getErrors())]}getShallowErrors(){return this.errors}clone(e){return new me(this.toJSON(),this.project)}};l(me,"MUTABLE_BASE_PROPERTIES",["operator"]),l(me,"INMUTABLE_BASE_PROPERTIES",["id","version","type"]),l(me,"BASE_PROPERTIES",[...me.MUTABLE_BASE_PROPERTIES,...me.INMUTABLE_BASE_PROPERTIES]),l(me,"MUTABLE_META_PROPERTIES",["x","y"]),l(me,"INMUTABLE_META_PROPERTIES",[...me.INMUTABLE_BASE_PROPERTIES]),l(me,"META_PROPERTIES",[...me.MUTABLE_META_PROPERTIES,...me.INMUTABLE_META_PROPERTIES]),l(me,"MUTABLE_UPSTREAM_PROPERTIES",["calledBySuccess","calledByError","calledByEntry","parent"]),l(me,"INMUTABLE_UPSTREAM_PROPERTIES",[]),l(me,"UPSTREAM_PROPERTIES",[...me.MUTABLE_UPSTREAM_PROPERTIES,...me.INMUTABLE_UPSTREAM_PROPERTIES]),l(me,"MUTABLE_DOWNSTREAM_PROPERTIES",["successCalls","errorCalls","inputsDeclarations","inputs"]),l(me,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),l(me,"DOWNSTREAM_PROPERTIES",[...me.MUTABLE_DOWNSTREAM_PROPERTIES,...me.INMUTABLE_DOWNSTREAM_PROPERTIES]),l(me,"PROPERTIES",[...me.META_PROPERTIES,...me.UPSTREAM_PROPERTIES,...me.DOWNSTREAM_PROPERTIES]);let yr=me;class sv{constructor(){l(this,"initialData")}}class h9{}class f9 extends sv{}class m9{}class T9{}class E9{}class yd{}class R9 extends yd{}class b9 extends yd{}class g9{}class la{static initReadsValue(e){if(e.initialData.readsValue&&e.initialData.readsValue.type!==r.GenericReference)e.readsValue=R(e.initialData.readsValue,e.project);else if(e.initialData.readsValue&&e.initialData.readsValue.type===r.GenericReference){const t=Bt(e.initialData.readsValue,e.project);t&&(e.readsValue=t)}if(e.readsValue){if(Fe.includes(e.readsValue.type)){let t=e.parent;st.includes(t.type)||(t=t.parent),e.readsValue.setParent(t),e.readsValue.initChildren(),t.detachedChildren.includes(e)?t.replaceDetachedChild(e,e.readsValue):t.subscribeDetachedChild(e.readsValue)}e.readsValue.addValueReader(e)}return e.readsValue}}class ca{static initWritesValues(e,t){const i=e.initialData.writesValues.reduce((s,o)=>{if(o.type===r.GenericReference||e.writesValues.some(p=>p.id===o.id))return s;const d=R(o,e.project);return d.setValueWriter(e),Fe.includes(d.type)&&(d.setParent(t),d.initChildren()),[...s,d]},[]),a=[...e.writesValues];return e.writesValues=S([...a,...i]),e.writesValues}}class v9{}function I9(n){var d;const e=ex(),t=n.toJSON();e.safeParse(t).success,(d=n.dataType)==null||d.validate(),n.inputs.forEach(p=>p.validate()),n.outputs.forEach(p=>p.validate()),n.internalCalls.forEach(p=>p.validate());const s=[...En(n)];if(n.id==="random-company-employee-test-variable-id"){const p=j({id:`${n.id}--${O.PropertyImplementsNonAbstact}`,message:`Property "${A(n,n.project)}" with id "${n.id}" implements a non-abstract property "${A(n,n.project)}" with id "${n.id}".`,issue:null,severity:m.Error,code:O.PropertyImplementsNonAbstact,entity:n});s.push(p.error)}if(n.id==="company-dto-variable-one-id"){const p=j({id:`${n.id}--${O.PropertyImplementsNonAbstact}`,message:`Property "${A(n,n.project)}" with id "${n.id}" implements a non-abstract property "${A(n,n.project)}" with id "${n.id}".`,issue:null,severity:m.Error,code:O.PropertyImplementsNonAbstact,entity:n});s.push(p.error)}const o=Id(n);return s.push(...o),X(n.errors,s)}const re=class re{constructor(e,t){l(this,"initialData");l(this,"id");l(this,"version");l(this,"name");l(this,"description",null);l(this,"dataType",null);l(this,"x");l(this,"y");l(this,"type",r.VariableDeclaration);l(this,"writesValues",[]);l(this,"readsValue",null);l(this,"inputs",[]);l(this,"outputs",[]);l(this,"calledBySuccess",[]);l(this,"calledByError",[]);l(this,"calledByEntry",[]);l(this,"successCalls",[]);l(this,"errorCalls",[]);l(this,"internalCalls",[]);l(this,"parent");l(this,"errors",[]);l(this,"project");l(this,"initialized",!1);l(this,"suggestion",!1);this.initialData=e,this.project=t,this.id=e.id,this.version=e.version,this.name=e.name,this.description=e.description,this.x=e.x,this.y=e.y}static fromGenerationTarget(e,t){let i=t;if(e.parent){const T=D(e.parent);i=t.get(T)}const a=e.calledByEntry.map(T=>{const f=D(T);return t.get(f)}),s=e.calledBySuccess.map(T=>{const f=D(T);return t.get(f)}),o=e.calledByError.map(T=>{const f=D(T);return t.get(f)});let d=null;if(e.readsValue){const T=D(e.readsValue);d=t.get(T)}const p={id:e.id,version:1,type:r.VariableDeclaration,name:e.name,description:e.description,calledByEntry:a,calledBySuccess:s,calledByError:o,dataType:null,errorCalls:[],successCalls:[],internalCalls:[],readsValue:d,inputs:[],outputs:[],writesValues:[],x:0,y:0,parent:i},h=R(p,t);return h.setParent(i),h.initChildren(),h}static validateGenerationTarget(e,t){let i=JSON.parse(JSON.stringify(e));const a=[],s=Ge(i,{parent:{list:!1,types:[...st,r.Project],optional:!0}},t);i=s.modifiedData;const o=ld(i,t);return a.push(...s.errors,...o,...Ae(i)),{errors:a,modifiedData:i}}validateGeneratedUpdate(e){const t=[];let i=JSON.parse(JSON.stringify(e));const a=ua(i,this);return i=a.modifiedData,t.push(...a.errors),e.parent&&t.push(new E({id:`${this.id}--${y.InvalidParentUpdate}`,code:y.InvalidParentUpdate,severity:m.Error,message:`Entity of type '${this.type}' with id '${this.id}' cannot have the 'parent' property updated. The 'parent' on a callable entity, is its scope. It scope is auto-calculated implicitly by the its caller.
58
58
  If an entity is called by another, they must be in the same scope, which means they have the same parent.
59
59
  Specifically for variables, their scope is also calculated from their value readers and value writters.
60
60
  You shouldn't have to manually update a 'parent' property. The equivalent result is to change its value readers, value writters, or callers.`,issue:null})),{errors:t,modifiedData:i}}addSelfToProject(){return this.parent===this.project&&this.project.addVariableDeclaration(this),this.readsValue&&this.readsValue.addValueReader(this),this.writesValues.forEach(e=>{e.setValueWriter(this)}),this.successCalls.forEach(e=>{e.addSuccessCaller(this)}),this.errorCalls.forEach(e=>{e.addErrorCaller(this)}),this.calledBySuccess.forEach(e=>{e.addSuccessCall(this)}),this.calledByError.forEach(e=>{e.addErrorCall(this)}),this.calledByEntry.forEach(e=>{e.addCall(this)}),this}get calledBy(){return[...this.calledByEntry,...this.calledBySuccess,...this.calledByError]}get usedInputs(){return this.inputs.filter(e=>e.readsValue||e.dynamicArguments.length||e.defaultValue)}get unusedInputs(){return this.inputs.filter(e=>!e.readsValue&&!e.dynamicArguments.length&&!e.defaultValue)}get usedOutputs(){return this.outputs.filter(e=>e.writesValues.length)}get unusedOutputs(){return this.outputs.filter(e=>!e.writesValues.length)}get usedInternalCalls(){return this.internalCalls.filter(e=>!!e.calledBy.length)}get unusedInternalCalls(){return this.internalCalls.filter(e=>!e.calledBy.length)}removeInput(e){const t=this.inputs.findIndex(i=>i.id===e.id);return t>-1&&this.inputs.splice(t,1),this}addInput(e){return this.inputs.includes(e)?this:(this.inputs.push(e),this)}addOutput(e){return this.outputs.includes(e)?this:(this.outputs.push(e),this)}removeOutput(e){const t=this.outputs.findIndex(i=>i.id===e.id);return t>-1&&this.outputs.splice(t,1),this}addSuccessCaller(e){return this.calledBySuccess.find(t=>t.id===e.id)||this.calledBySuccess.push(e),this}addErrorCaller(e){return this.calledByError.find(t=>t.id===e.id)||this.calledByError.push(e),this}addEntryCaller(e){return this.calledByEntry.find(t=>t.id===e.id)||this.calledByEntry.push(e),this}addErrorCall(e){return this.errorCalls.push(e),this}addSuccessCall(e){return this.successCalls.push(e),this}removeCall(e){const t=this.successCalls.findIndex(a=>a.id===e.id);t>-1&&this.successCalls.splice(t,1);const i=this.errorCalls.findIndex(a=>a.id===e.id);return i>-1&&this.errorCalls.splice(i,1),this}removeCaller(e){return this.calledBySuccess=this.calledBySuccess.filter(t=>t.id!==e.id),this.calledByError=this.calledByError.filter(t=>t.id!==e.id),this.calledByEntry=this.calledByEntry.filter(t=>t.id!==e.id),this}addValueReader(e){return this.writesValues.includes(e)?this:(this.writesValues.push(e),this)}removeValueReader(e){return this.writesValues=this.writesValues.filter(t=>t.id!==e.id),this}setParent(e){return this.parent=e,this}initChildren(){return this.initialized?this:(this.initialized=!0,this.initialData.dataType&&(this.dataType=R(this.initialData.dataType,this.project),this.dataType.setParent(this),this.dataType.initChildren()),ca.initWritesValues(this,this.parent),la.initReadsValue(this),this.successCalls=this.initialData.successCalls.map(e=>{const t=R(e,this.project);return t.addSuccessCaller(this),[r.BreakStatement,r.ContinueStatement].includes(t.type)?(t.setParent(this.parent.parent),t.initChildren()):t.type!==r.InternalCall&&(t.setParent(this.parent),t.initChildren()),t}),this.errorCalls=this.initialData.errorCalls.map(e=>{const t=R(e,this.project);return t.addErrorCaller(this),[r.BreakStatement,r.ContinueStatement].includes(t.type)?(t.setParent(this.parent.parent),t.initChildren()):t.type!==r.InternalCall&&(t.setParent(this.parent),t.initChildren()),t}),this.inputs=this.initialData.inputs.map(e=>{const t=R(e,this.project);return t.setParent(this),t.initChildren(),t}),this.outputs=this.initialData.outputs.map(e=>{const t=R(e,this.project);return t.setParent(this),t.initChildren(),t}),this.internalCalls=this.initialData.internalCalls.map(e=>{const t=R(e,this.project);return t.setParent(this),t.initChildren(),t}),this.inputs.push(...this.generateUnusedInputs()),this.outputs.push(...this.generateUnusedOutputs()),this)}setValueWriter(e){return this.readsValue=e,this}removeValueWriter(){return this.readsValue=null,this}subscribe(){return this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}sync(e){return this.version=e.version||this.version,this.name=e.name||this.name,this.description=e.description||this.description,this.x=e.x||this.x,this.y=e.y||this.y,this}async load(){return this}async create(){return this}async update(e){return this.sync(e),ha(e,this),this}async delete(){return this}remove({ignoreUpstream:e,seenEntities:t}={ignoreUpstream:!1,seenEntities:new Set}){const i=[],a=[];if(t.has(this.id))return{affected:[],removed:[]};if(t.add(this.id),a.push(this),this.unsubscribe(),this.readsValue&&(i.push(this.readsValue),this.readsValue.removeValueReader(this)),this.writesValues.forEach(s=>{i.push(s),s.readsValue=null}),this.inputs.forEach(s=>{const{affected:o,removed:d}=s.remove({ignoreUpstream:!0,seenEntities:t});i.push(...o),a.push(...d)}),this.outputs.forEach(s=>{const{affected:o,removed:d}=s.remove({ignoreUpstream:!0,seenEntities:t});i.push(...o),a.push(...d)}),this.successCalls.forEach(s=>{i.push(s),s.removeCaller(this)}),this.errorCalls.forEach(s=>{i.push(s),s.removeCaller(this)}),this.internalCalls.forEach(s=>{const{affected:o,removed:d}=s.remove({ignoreUpstream:!0,seenEntities:t});i.push(...o),a.push(...d)}),this.dataType){const{affected:s,removed:o}=this.dataType.remove({ignoreUpstream:!0,seenEntities:t});i.push(...s),a.push(...o)}return e||this.calledBy.forEach(s=>{i.push(s),s.removeCall(this)}),{affected:S(i),removed:S(a)}}restore({seenEntities:e}={seenEntities:new Set}){this.subscribe();const t=[];if(this.readsValue&&(t.push(this.readsValue),this.readsValue.addValueReader(this)),this.writesValues.forEach(i=>{t.push(i),i.setValueWriter(this)}),this.inputs.forEach(i=>{const{affected:a}=i.restore({seenEntities:e});t.push(...a)}),this.outputs.forEach(i=>{const{affected:a}=i.restore({seenEntities:e});t.push(...a)}),this.successCalls.forEach(i=>{t.push(i),i.addSuccessCaller(this)}),this.errorCalls.forEach(i=>{t.push(i),i.addErrorCaller(this)}),this.internalCalls.forEach(i=>{const{affected:a}=i.restore({seenEntities:e});t.push(...a)}),this.dataType){const{affected:i}=this.dataType.restore({seenEntities:e});t.push(...i)}return this.calledBySuccess.forEach(i=>{t.push(i),i.addSuccessCall(this)}),this.calledByError.forEach(i=>{t.push(i),i.addErrorCall(this)}),this.calledByEntry.forEach(i=>{t.push(i),i.addCall(this)}),{affected:S(t),self:this}}toFlat(e=new Set){var i;return e.has(this.id)?[]:(e.add(this.id),[this,...((i=this.dataType)==null?void 0:i.toFlat(e))||[],...this.writesValues.flatMap(a=>a.toFlat(e)),...this.successCalls.flatMap(a=>a.toFlat(e)),...this.errorCalls.flatMap(a=>a.toFlat(e)),...this.inputs.flatMap(a=>a.toFlat(e)),...this.outputs.flatMap(a=>a.toFlat(e)),...this.internalCalls.flatMap(a=>a.toFlat(e))])}toFlatIds(e=new Set){var i;return e.has(this.id)?[]:(e.add(this.id),[this.id,...((i=this.dataType)==null?void 0:i.toFlatIds(e))||[],...this.writesValues.flatMap(a=>a.toFlatIds(e)),...this.successCalls.flatMap(a=>a.toFlatIds(e)),...this.errorCalls.flatMap(a=>a.toFlatIds(e)),...this.inputs.flatMap(a=>a.toFlatIds(e)),...this.outputs.flatMap(a=>a.toFlatIds(e)),...this.internalCalls.flatMap(a=>a.toFlatIds(e))])}toJSON(){var e,t;return{id:this.id,version:this.version,type:this.type,name:this.name,description:this.description,dataType:((e=this.dataType)==null?void 0:e.toJSON())||null,readsValue:((t=this.readsValue)==null?void 0:t.toReference())||null,writesValues:this.writesValues.map(i=>i.toJSON()),inputs:this.inputs.map(i=>i.toJSON()),outputs:this.outputs.map(i=>i.toJSON()),successCalls:this.successCalls.map(i=>i.toJSON()),errorCalls:this.errorCalls.map(i=>i.toJSON()),internalCalls:this.internalCalls.map(i=>i.toJSON()),calledBySuccess:this.calledBySuccess.map(i=>i.toReference()),calledByError:this.calledByError.map(i=>i.toReference()),calledByEntry:this.calledByEntry.map(i=>i.toReference()),parent:this.parent.toReference(),x:this.x,y:this.y}}toReference(){return{id:this.id+"--"+$.UUID.uuid()+"--ref",type:r.GenericReference,entityId:this.id,entityType:this.type}}toShallowJSON(){var e,t;return{id:this.id,version:this.version,type:this.type,name:this.name,description:this.description,x:this.x,y:this.y,dataType:((e=this.dataType)==null?void 0:e.toReference())||null,readsValue:((t=this.readsValue)==null?void 0:t.toReference())||null,writesValues:this.writesValues.map(i=>i.toReference()),inputs:this.inputs.map(i=>i.toReference()),outputs:this.outputs.map(i=>i.toReference()),successCalls:this.successCalls.map(i=>i.toReference()),errorCalls:this.errorCalls.map(i=>i.toReference()),calledBySuccess:this.calledBySuccess.map(i=>i.toReference()),calledByError:this.calledByError.map(i=>i.toReference()),calledByEntry:this.calledByEntry.map(i=>i.toReference()),internalCalls:this.internalCalls.map(i=>i.toReference()),parent:this.parent.toReference()}}toFlatJSON(e=new Set){var i;return e.has(this.id)?[]:(e.add(this.id),[this.toShallowJSON(),...((i=this.dataType)==null?void 0:i.toFlatJSON(e))||[],...this.writesValues.flatMap(a=>a.toFlatJSON(e)),...this.successCalls.flatMap(a=>a.toFlatJSON(e)),...this.errorCalls.flatMap(a=>a.toFlatJSON(e)),...this.inputs.flatMap(a=>a.toFlatJSON(e)),...this.outputs.flatMap(a=>a.toFlatJSON(e)),...this.internalCalls.flatMap(a=>a.toFlatJSON(e))])}toGenerationTarget(){const e=this.parent.type===r.Project?void 0:this.parent.id;return{id:this.id,type:this.type,name:this.name,description:this.description,calledByEntry:this.calledByEntry.map(t=>t.id),calledBySuccess:this.calledBySuccess.map(t=>t.id),calledByError:this.calledByError.map(t=>t.id),parent:e}}toFlatGenerationTarget(e=new Set){var i;return e.has(this.id)?[]:(e.add(this.id),[this.toGenerationTarget(),...((i=this.dataType)==null?void 0:i.toFlatGenerationTarget(e))||[],...this.writesValues.flatMap(a=>a.toFlatGenerationTarget(e)),...this.successCalls.flatMap(a=>a.toFlatGenerationTarget(e)),...this.errorCalls.flatMap(a=>a.toFlatGenerationTarget(e)),...this.inputs.flatMap(a=>a.toFlatGenerationTarget(e)),...this.outputs.flatMap(a=>a.toFlatGenerationTarget(e)),...this.internalCalls.flatMap(a=>a.toFlatGenerationTarget(e))])}clearErrors(){var e;return this.errors=[],this.inputs.forEach(t=>t.clearErrors()),this.outputs.forEach(t=>t.clearErrors()),this.successCalls.forEach(t=>t.clearErrors()),this.errorCalls.forEach(t=>t.clearErrors()),this.internalCalls.forEach(t=>t.clearErrors()),(e=this.dataType)==null||e.clearErrors(),this}validate(){const e=I9(this);return this.errors=e,{success:!0,error:null,data:this.toJSON()}}getErrors(){var t,i;return[...this.errors,...((t=this.dataType)==null?void 0:t.getErrors())||[],...this.inputs.flatMap(a=>a.getErrors()),...this.internalCalls.flatMap(a=>a.getErrors()),...this.outputs.flatMap(a=>a.getErrors()),...((i=this.readsValue)==null?void 0:i.getErrors())||[]]}getShallowErrors(){return this.errors}getDefaultValue(){var e;return((e=this.dataType)==null?void 0:e.defaultValue)||null}clone(e){return new re(this.toJSON(),this.project)}addInternalCall(e){return this.internalCalls.find(t=>t===e)||this.internalCalls.push(e),this}createInstance(e=this.project,t={}){const i={id:t.id||$.UUID.uuid(),version:t.version||1,type:r.VariableInstance,parent:e.toReference(),successCalls:t.successCalls||[],errorCalls:t.errorCalls||[],inputs:t.inputs||[],outputs:t.outputs||[],writesValues:t.writesValues||[],internalCalls:t.internalCalls||[],readsValue:t.readsValue||null,calledByEntry:t.calledByEntry||[],calledBySuccess:t.calledBySuccess||[],calledByError:t.calledByError||[],declaration:this.toJSON(),x:0,y:0},a=R(i,this.project);return a.setParent(e),a.initChildren(),e===this.project&&this.project.addVariableInstance(a),a}generateUnusedInputs(){if(this.dataType)if(this.dataType.entity){if([r.CustomEntity,r.PrimitiveEntity,r.BuiltInBaseEntity].includes(this.dataType.entity.type))return[...this.dataType.entity.properties,...this.dataType.entity.extendedProperties].filter(i=>!this.inputs.find(a=>a.declaration===i)).map(i=>{const a={id:$.UUID.uuid(),version:1,type:r.InputMap,parent:this.toReference(),name:null,description:null,dynamicArguments:[],declaration:i,defaultValue:null,index:i.index,readsValue:null},s=R(a,this.project);return s.setParent(this),s.initChildren(),s.suggestion=!0,s})}else return[];else return[];return[]}generateUnusedOutputs(){if(this.dataType)if(this.dataType.entity){if([r.CustomEntity,r.PrimitiveEntity,r.BuiltInBaseEntity].includes(this.dataType.entity.type))return[...this.dataType.entity.properties,...this.dataType.entity.extendedProperties].filter(i=>!this.outputs.find(a=>a.declaration===i)).map(i=>{const a={id:$.UUID.uuid(),version:1,type:r.OutputMap,parent:this.toReference(),declaration:i,index:i.index,writesValues:[]},s=R(a,this.project);return s.setParent(this),s.initChildren(),s.suggestion=!0,s})}else return[];else return[];return[]}generateUnusedInternalCalls(){if(this.dataType)if(this.dataType.entity){if([r.CustomEntity,r.PrimitiveEntity,r.BuiltInBaseEntity].includes(this.dataType.entity.type))return[...this.dataType.entity.getAllInteractiveMethods()].filter(i=>!this.internalCalls.find(s=>{var d,p,h,T,f;return(((d=s.declaration)==null?void 0:d.id)||((h=(p=s.initialData)==null?void 0:p.declaration)==null?void 0:h.entityId)||((f=(T=s.initialData)==null?void 0:T.declaration)==null?void 0:f.id))===i.id})).map(i=>{const a=i.createInternalCall(this);return a.suggestion=!0,a})}else return[];else return[];return[]}setDataType(e){return this.dataType=e,this}removeDataType(){return this.dataType=null,this}getDataType(){return this.dataType||null}getUnusedInputs(){return this.inputs.filter(e=>e.suggestion||!e.readsValue&&!e.defaultValue)}getUnusedOutputs(){return this.outputs.filter(e=>e.suggestion||!e.writesValues.length)}getUsedInputs(){return this.inputs.filter(e=>!e.suggestion&&(e.readsValue||e.defaultValue))}getUsedOutputs(){return this.outputs.filter(e=>!e.suggestion&&e.writesValues.length)}};l(re,"MUTABLE_BASE_PROPERTIES",["name","description"]),l(re,"INMUTABLE_BASE_PROPERTIES",["id","type","version"]),l(re,"BASE_PROPERTIES",[...re.MUTABLE_BASE_PROPERTIES,...re.INMUTABLE_BASE_PROPERTIES]),l(re,"MUTABLE_META_PROPERTIES",[...re.MUTABLE_BASE_PROPERTIES,"x","y"]),l(re,"INMUTABLE_META_PROPERTIES",[...re.INMUTABLE_BASE_PROPERTIES]),l(re,"META_PROPERTIES",[...re.MUTABLE_META_PROPERTIES,...re.INMUTABLE_META_PROPERTIES]),l(re,"MUTABLE_UPSTREAM_PROPERTIES",["calledBySuccess","calledByError","calledByEntry","readsValue"]),l(re,"INMUTABLE_UPSTREAM_PROPERTIES",["parent","dataType"]),l(re,"UPSTREAM_PROPERTIES",[...re.MUTABLE_UPSTREAM_PROPERTIES,...re.INMUTABLE_UPSTREAM_PROPERTIES]),l(re,"MUTABLE_DOWNSTREAM_PROPERTIES",["writesValues","inputs","outputs","successCalls","errorCalls","internalCalls"]),l(re,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),l(re,"DOWNSTREAM_PROPERTIES",[...re.MUTABLE_DOWNSTREAM_PROPERTIES,...re.INMUTABLE_DOWNSTREAM_PROPERTIES]),l(re,"PROPERTIES",[...re.META_PROPERTIES,...re.UPSTREAM_PROPERTIES,...re.DOWNSTREAM_PROPERTIES]);let hr=re;function P9(n){const e=ax(),t=n.toJSON();e.safeParse(t).success,n.inputs.forEach(d=>d.validate()),n.outputs.forEach(d=>d.validate()),n.internalCalls.forEach(d=>d.validate());const s=[...En(n)];if(n.id==="exec-sequentially-result-variable-id"){const d=j({id:`${n.id}--${O.PropertyImplementsNonAbstact}`,message:`Property "${A(n,n.project)}" with id "${n.id}" implements a non-abstract property "${A(n,n.project)}" with id "${n.id}".`,issue:null,severity:m.Error,code:O.PropertyImplementsNonAbstact,entity:n});s.push(d.error)}const o=Id(n);return s.push(...o),X(n.errors,s)}const ie=class ie{constructor(e,t){l(this,"initialData");l(this,"id");l(this,"version");l(this,"x");l(this,"y");l(this,"type",r.VariableInstance);l(this,"writesValues",[]);l(this,"readsValue",null);l(this,"declaration");l(this,"inputs",[]);l(this,"outputs",[]);l(this,"calledBySuccess",[]);l(this,"calledByError",[]);l(this,"calledByEntry",[]);l(this,"successCalls",[]);l(this,"errorCalls",[]);l(this,"internalCalls",[]);l(this,"project");l(this,"errors",[]);l(this,"parent");l(this,"initialized",!1);l(this,"suggestion",!1);this.initialData=e,this.project=t,this.id=e.id,this.version=e.version,this.x=e.x,this.y=e.y}static fromGenerationTarget(e,t){let i=t;if(e.parent){const b=D(e.parent);i=t.get(b)}const a=D(e.declaration),s=t.get(a),o=e.calledByEntry.map(b=>{const I=D(b);return t.get(I)}),d=e.calledBySuccess.map(b=>{const I=D(b);return t.get(I)}),p=e.calledByError.map(b=>{const I=D(b);return t.get(I)});let h=null;if(e.readsValue){const b=D(e.readsValue);h=t.get(b)}const T={id:e.id,version:1,type:r.VariableInstance,declaration:s.toReference(),calledByEntry:o,calledBySuccess:d,calledByError:p,errorCalls:[],successCalls:[],internalCalls:[],readsValue:h,inputs:[],outputs:[],writesValues:[],x:0,y:0,parent:i},f=R(T,t);return f.setParent(i),f.initChildren(),f}static validateGenerationTarget(e,t){let i=JSON.parse(JSON.stringify(e));const a=[],s=Ge(i,{parent:{list:!1,types:[...st,r.Project],optional:!0},declaration:{list:!1,types:[r.VariableDeclaration]}},t);return i=s.modifiedData,a.push(...s.errors,...Ae(i)),{errors:a,modifiedData:i}}validateGeneratedUpdate(e){const t=[];let i=JSON.parse(JSON.stringify(e));const a=ua(i,this);return i=a.modifiedData,t.push(...a.errors),e.parent&&t.push(new E({id:`${this.id}--${y.InvalidParentUpdate}`,code:y.InvalidParentUpdate,severity:m.Error,message:`Entity of type '${this.type}' with id '${this.id}' cannot have the 'parent' property updated. The 'parent' on a callable entity, is its scope. It scope is auto-calculated implicitly by the its caller.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elyx-code/project-logic-tree",
3
- "version": "0.0.6009",
3
+ "version": "0.0.6010",
4
4
  "author": "Sergio Herrero",
5
5
  "license": "UNLICENSED",
6
6
  "description": "An installable module which contains the type definitions and ephemeral state management for a projects' logic tree data structure",