@elyx-code/project-logic-tree 0.0.6014 → 0.0.6015
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
|
@@ -26327,6 +26327,13 @@ You shouldn't have to manually update a 'parent' property. The equivalent result
|
|
|
26327
26327
|
subscribeInstance(e) {
|
|
26328
26328
|
return this.variableInstances.includes(e) ? this : (this.variableInstances.push(e), this);
|
|
26329
26329
|
}
|
|
26330
|
+
// On dynamically typed variable declarations, where any new property can be written to any of the instances,
|
|
26331
|
+
// we need to sync all the instances with the new data
|
|
26332
|
+
// This means, collecting all "properties" that are written to the variables as inputs
|
|
26333
|
+
// Then updating the data type entity, then updating all the instances so all of them have all the input-maps
|
|
26334
|
+
syncInputsAndOutputs() {
|
|
26335
|
+
return this;
|
|
26336
|
+
}
|
|
26330
26337
|
removeInstance(e) {
|
|
26331
26338
|
return this.variableInstances = this.variableInstances.filter(
|
|
26332
26339
|
(t) => t.id !== e.id
|
|
@@ -33946,6 +33953,10 @@ ${Xt(
|
|
|
33946
33953
|
setDataType(e) {
|
|
33947
33954
|
return this.dataType = e, this;
|
|
33948
33955
|
}
|
|
33956
|
+
getDefaultValue() {
|
|
33957
|
+
var e;
|
|
33958
|
+
return ((e = this.dataType) == null ? void 0 : e.defaultValue) || null;
|
|
33959
|
+
}
|
|
33949
33960
|
};
|
|
33950
33961
|
l(de, "MUTABLE_BASE_PROPERTIES", ["name", "description", "required"]), l(de, "INMUTABLE_BASE_PROPERTIES", [
|
|
33951
33962
|
"id",
|
package/dist/index.umd.cjs
CHANGED
|
@@ -57,7 +57,7 @@ ${oo(t)}`,issue:null})),{errors:a,modifiedData:i}}validateGeneratedUpdate(e){con
|
|
|
57
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=I9(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 hr=me;class cv{constructor(){l(this,"initialData")}}class P9{}class D9 extends cv{}class A9{}class S9{}class O9{}class fd{}class C9 extends fd{}class B9 extends fd{}class w9{}class ca{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(Ge.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 da{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),Ge.includes(d.type)&&(d.setParent(t),d.initChildren()),[...s,d]},[]),a=[...e.writesValues];return e.writesValues=S([...a,...i]),e.writesValues}}class _9{}function M9(n){var d;const e=dx(),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=Dd(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,"variableInstances",[]);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=Fe(i,{parent:{list:!1,types:[...st,r.Project],optional:!0}},t);i=s.modifiedData;const o=dd(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=pa(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
|
-
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()),da.initWritesValues(this,this.parent),ca.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.dataType&&this.inputs.length&&(this.dataType=si(this)),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}subscribeInstance(e){return this.variableInstances.includes(e)?this:(this.variableInstances.push(e),this)}removeInstance(e){return this.variableInstances=this.variableInstances.filter(t=>t.id!==e.id),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),fa(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=M9(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 fr=re;function N9(n){const e=fx(),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=Dd(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=Fe(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=pa(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.
|
|
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()),da.initWritesValues(this,this.parent),ca.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.dataType&&this.inputs.length&&(this.dataType=si(this)),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}subscribeInstance(e){return this.variableInstances.includes(e)?this:(this.variableInstances.push(e),this)}syncInputsAndOutputs(){return this}removeInstance(e){return this.variableInstances=this.variableInstances.filter(t=>t.id!==e.id),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),fa(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=M9(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 fr=re;function N9(n){const e=fx(),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=Dd(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=Fe(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=pa(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.
|
|
61
61
|
If an entity is called by another, they must be in the same scope, which means they have the same parent.
|
|
62
62
|
Specifically for variables, their scope is also calculated from their value readers and value writters.
|
|
63
63
|
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.addVariableInstance(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(){const e=this.usedInternalCalls;return this.internalCalls.filter(i=>!(e.find(o=>o.id===i.id)||e.find(o=>o.declaration===i.declaration)))}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)}setParent(e){return this.parent=e,this}initChildren(){if(this.initialized)return this;if(this.initialized=!0,this.initialData.declaration.type===r.GenericReference){const e=this.project.findSubscribedInstanceFromReference(this.initialData.declaration);if(!e)return this;this.declaration=e}else this.declaration=R(this.initialData.declaration,this.project),this.declaration.setParent(this.parent),this.declaration.initChildren();return da.initWritesValues(this,this.parent),ca.initReadsValue(this),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.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.internalCalls=this.initialData.internalCalls.reduce((e,t)=>{if(t.type===r.GenericReference){const i=this.project.findSubscribedInstanceFromReference(t);if(!i)return e;const a=i;return a.setParent(this),[...e,a]}else{const i=R(t,this.project);return i.setParent(this),i.initChildren(),[...e,i]}},[]),this.inputs.push(...this.generateUnusedInputs()),this.outputs.push(...this.generateUnusedOutputs()),this.internalCalls.push(...this.generateUnusedInternalCalls()),this.declaration.subscribeInstance(this),this}setValueWriter(e){return this.readsValue=e,this}removeValueWriter(){return this.readsValue=null,this}removeValueReader(e){return this.writesValues=this.writesValues.filter(t=>t.id!==e.id),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.sync(e),fa(e,this),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.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)}),e||this.calledBy.forEach(s=>{i.push(s),s.removeCall(this)}),this.declaration.removeInstance(this),{affected:S(i),removed:S(a)})}restore({seenEntities:e}={seenEntities:new Set}){this.subscribe();const t=[];return 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.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)}),this.declaration.subscribeInstance(this),{affected:S(t),self:this}}toFlat(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this,...this.writesValues.flatMap(i=>i.toFlat(e)),...this.successCalls.flatMap(i=>i.toFlat(e)),...this.errorCalls.flatMap(i=>i.toFlat(e)),...this.inputs.flatMap(i=>i.toFlat(e)),...this.outputs.flatMap(i=>i.toFlat(e)),...this.internalCalls.flatMap(i=>i.toFlat(e))])}toFlatIds(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.id,...this.writesValues.flatMap(i=>i.toFlatIds(e)),...this.successCalls.flatMap(i=>i.toFlatIds(e)),...this.errorCalls.flatMap(i=>i.toFlatIds(e)),...this.inputs.flatMap(i=>i.toFlatIds(e)),...this.outputs.flatMap(i=>i.toFlatIds(e)),...this.internalCalls.flatMap(i=>i.toFlatIds(e))])}toJSON(){var e;return{id:this.id,version:this.version,type:this.type,declaration:this.declaration.toReference(),readsValue:((e=this.readsValue)==null?void 0:e.toReference())||null,writesValues:this.writesValues.map(t=>t.toJSON()),inputs:this.inputs.map(t=>t.toJSON()),outputs:this.outputs.map(t=>t.toJSON()),successCalls:this.successCalls.map(t=>t.toJSON()),errorCalls:this.errorCalls.map(t=>t.toJSON()),internalCalls:this.internalCalls.map(t=>t.toJSON()),calledBySuccess:this.calledBySuccess.map(t=>t.toReference()),calledByError:this.calledByError.map(t=>t.toReference()),calledByEntry:this.calledByEntry.map(t=>t.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,x:this.x,y:this.y,declaration:((e=this.declaration)==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.declaration)==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)),...this.calledBy.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,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){var i,a;return e.has(this.id)?[]:(e.add(this.id),[this.toGenerationTarget(),...((i=this.declaration)==null?void 0:i.toFlatGenerationTarget(e))||[],...((a=this.readsValue)==null?void 0:a.toFlatGenerationTarget(e))||[],...this.writesValues.flatMap(s=>s.toFlatGenerationTarget(e)),...this.successCalls.flatMap(s=>s.toFlatGenerationTarget(e)),...this.errorCalls.flatMap(s=>s.toFlatGenerationTarget(e)),...this.inputs.flatMap(s=>s.toFlatGenerationTarget(e)),...this.outputs.flatMap(s=>s.toFlatGenerationTarget(e)),...this.internalCalls.flatMap(s=>s.toFlatGenerationTarget(e))])}clearErrors(){return this.errors=[],this.inputs.forEach(e=>e.clearErrors()),this.outputs.forEach(e=>e.clearErrors()),this.successCalls.forEach(e=>e.clearErrors()),this.errorCalls.forEach(e=>e.clearErrors()),this.internalCalls.forEach(e=>e.clearErrors()),this}validate(){const e=N9(this);return this.errors=e,{success:!0,error:null,data:this.toJSON()}}getErrors(){var t;return[...this.errors,...this.inputs.flatMap(i=>i.getErrors()),...this.internalCalls.flatMap(i=>i.getErrors()),...this.outputs.flatMap(i=>i.getErrors()),...((t=this.readsValue)==null?void 0:t.getErrors())||[]]}getShallowErrors(){return this.errors}getDefaultValue(){var e,t;return((t=(e=this.declaration)==null?void 0:e.dataType)==null?void 0:t.defaultValue)||null}clone(e){return new ie(this.toJSON(),this.project)}addInternalCall(e){return this.internalCalls.find(t=>t===e)||this.internalCalls.push(e),this}setDeclaration(e){return this.declaration!==e&&(this.declaration=e),this}generateUnusedInputs(){if(this.declaration.dataType)if(this.declaration.dataType.entity){if([r.CustomEntity,r.PrimitiveEntity,r.BuiltInBaseEntity].includes(this.declaration.dataType.entity.type))return[...this.declaration.dataType.entity.properties,...this.declaration.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.declaration.dataType)if(this.declaration.dataType.entity){if([r.CustomEntity,r.PrimitiveEntity,r.BuiltInBaseEntity].includes(this.declaration.dataType.entity.type))return[...this.declaration.dataType.entity.properties,...this.declaration.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.declaration.dataType)if(this.declaration.dataType.entity){if([r.CustomEntity,r.PrimitiveEntity,r.BuiltInBaseEntity].includes(this.declaration.dataType.entity.type))return[...this.declaration.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[]}getDataType(){var e;return((e=this.declaration)==null?void 0:e.getDataType())||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(ie,"MUTABLE_BASE_PROPERTIES",[]),l(ie,"INMUTABLE_BASE_PROPERTIES",["id","type","version"]),l(ie,"BASE_PROPERTIES",[...ie.MUTABLE_BASE_PROPERTIES,...ie.INMUTABLE_BASE_PROPERTIES]),l(ie,"MUTABLE_META_PROPERTIES",[...ie.MUTABLE_BASE_PROPERTIES,"x","y"]),l(ie,"INMUTABLE_META_PROPERTIES",[...ie.INMUTABLE_BASE_PROPERTIES]),l(ie,"META_PROPERTIES",[...ie.MUTABLE_META_PROPERTIES,...ie.INMUTABLE_META_PROPERTIES]),l(ie,"MUTABLE_UPSTREAM_PROPERTIES",["calledBySuccess","calledByError","calledByEntry","readsValue"]),l(ie,"INMUTABLE_UPSTREAM_PROPERTIES",["declaration","parent"]),l(ie,"UPSTREAM_PROPERTIES",[...ie.MUTABLE_UPSTREAM_PROPERTIES,...ie.INMUTABLE_UPSTREAM_PROPERTIES]),l(ie,"MUTABLE_DOWNSTREAM_PROPERTIES",["writesValues","inputs","outputs","successCalls","errorCalls","internalCalls"]),l(ie,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),l(ie,"DOWNSTREAM_PROPERTIES",[...ie.MUTABLE_DOWNSTREAM_PROPERTIES,...ie.INMUTABLE_DOWNSTREAM_PROPERTIES]),l(ie,"PROPERTIES",[...ie.META_PROPERTIES,...ie.UPSTREAM_PROPERTIES,...ie.DOWNSTREAM_PROPERTIES]);let mr=ie;function $9(n){var s;const e=uU(),t=n.toJSON();e.safeParse(t).success,(s=n.dataType)==null||s.validate();const a=[];if(n.id==="iterate-over-employee-list-continue-statement-employee-dto-output-decl-id"){const o=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});a.push(o.error)}return X(n.errors,a)}const ae=class ae{constructor(e,t){l(this,"initialData");l(this,"id");l(this,"version");l(this,"name");l(this,"description",null);l(this,"index");l(this,"required");l(this,"isError");l(this,"type",r.ReturnDeclaration);l(this,"dataType",null);l(this,"readsValue",null);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.index=e.index,this.name=e.name,this.description=e.description,this.required=e.required,this.isError=e.isError}static fromGenerationTarget(e,t){const i=D(e.parent),a=t.get(i);let s=null;if(e.readsValue){const p=D(e.readsValue);s=t.get(p)}const o={id:e.id,version:1,name:e.name,type:r.ReturnDeclaration,index:a.outputs.length,isError:!1,description:e.description,required:e.required,readsValue:s,dataType:null,parent:a},d=R(o,t);return d.setParent(a),d.initChildren(),d}static validateGenerationTarget(e,t){var d,p;let i=JSON.parse(JSON.stringify(e));const a=[],s=Fe(i,{parent:{list:!1,types:[r.ReturnStatement,r.Search,r.BreakStatement,r.ContinueStatement]}},t),o=yd(i,t);if(i=s.modifiedData,i.parent){const h=t.get(D(i.parent));if(h&&[r.BreakStatement,r.ContinueStatement].includes(h.type)){const T=h,f=T.parent,b=[...f.breakStatements.filter(B=>B.id!==h.id),...f.continueStatements.filter(B=>B.id!==h.id)];if(T.outputs.length)a.push(new E({id:`${i.id}--${g.NoOverlapWithImplementedSignature}`,code:g.NoOverlapWithImplementedSignature,severity:m.Error,message:`Entity of type '${r.ReturnDeclaration}' with id '${i.id}' cannot be added to the parent entity of type '${T.type}' with id '${T.id}'. This '${T.type}' already has return declarations.
|
|
@@ -169,7 +169,7 @@ You can't modify system entities that are built-in.`,issue:null})),o&&o.type===r
|
|
|
169
169
|
An action descriptor can only have one error value descriptor child.
|
|
170
170
|
Either remove the existing error value descriptor or update it with the 'update' action.
|
|
171
171
|
You can use the 'describe_entity' action to get more information about the existing error value descriptor like so:
|
|
172
|
-
${Qt({describe_entity:o.error.id})}`,issue:null}))),{errors:a,modifiedData:i}}validateGeneratedUpdate(e){return{errors:[],modifiedData:e}}addSelfToProject(){var e,t;return this.parentRelationType===C.FixedArguments?(e=this.parent)==null||e.addFixedArgument(this):this.parentRelationType===C.FixedReturns?(t=this.parent)==null||t.addFixedReturn(this):this.parentRelationType===C.ReturnedError&&this.parent&&(this.parent.error=this),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()),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.index=e.index||this.index,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=[];if(t.has(this.id))return{affected:[],removed:[]};if(t.add(this.id),a.push(this),this.unsubscribe(),this.dataType){const{affected:s,removed:o}=this.dataType.remove({ignoreUpstream:!0,seenEntities:t});i.push(...s),a.push(...o)}return{affected:S(i),removed:S(a)}}restore({seenEntities:e}={seenEntities:new Set}){const t=[];if(e.has(this.id))return{affected:[],self:this};if(e.add(this.id),this.subscribe(),this.dataType){const{affected:i}=this.dataType.restore({seenEntities:e});t.push(...i)}return{affected:S(t),self:this}}toFlat(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this,...this.dataType?this.dataType.toFlat(e):[]])}toFlatIds(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.id,...this.dataType?this.dataType.toFlatIds(e):[]])}toJSON(){var e,t;return{id:this.id,version:this.version,type:this.type,name:this.name,description:this.description,index:this.index,required:this.required,parentRelationType:this.parentRelationType,dataType:((e=this.dataType)==null?void 0:e.toJSON())||null,parent:((t=this.parent)==null?void 0:t.toReference())||null}}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,index:this.index,required:this.required,parentRelationType:this.parentRelationType,dataType:((e=this.dataType)==null?void 0:e.toReference())||null,parent:((t=this.parent)==null?void 0:t.toReference())||null}}toFlatJSON(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toShallowJSON(),...this.dataType?this.dataType.toFlatJSON(e):[]])}toGenerationTarget(){var e;return{id:this.id,name:this.name,description:this.description,type:this.type,required:this.required,parentRelationType:this.parentRelationType,parent:(e=this.parent)==null?void 0:e.id}}toFlatGenerationTarget(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toGenerationTarget(),...this.dataType?this.dataType.toFlatGenerationTarget(e):[]])}clearErrors(){var e;return this.errors=[],(e=this.dataType)==null||e.clearErrors(),this}validate(){const e=K9(this);return this.errors=e,{success:!0,error:null,data:this.toJSON()}}getErrors(){return[...this.errors,...this.dataType?this.dataType.getErrors():[]]}getShallowErrors(){return this.errors}clone(){return new ue(this.toJSON(),this.project)}getDataType(){return this.dataType||null}setDataType(e){return this.dataType=e,this}};l(ue,"MUTABLE_BASE_PROPERTIES",["name","description","required"]),l(ue,"INMUTABLE_BASE_PROPERTIES",["id","version","type","parentRelationType"]),l(ue,"BASE_PROPERTIES",[...ue.MUTABLE_BASE_PROPERTIES,...ue.INMUTABLE_BASE_PROPERTIES]),l(ue,"MUTABLE_META_PROPERTIES",[...ue.MUTABLE_BASE_PROPERTIES,"index"]),l(ue,"INMUTABLE_META_PROPERTIES",[...ue.INMUTABLE_BASE_PROPERTIES]),l(ue,"META_PROPERTIES",[...ue.MUTABLE_META_PROPERTIES,...ue.INMUTABLE_META_PROPERTIES]),l(ue,"MUTABLE_UPSTREAM_PROPERTIES",[]),l(ue,"INMUTABLE_UPSTREAM_PROPERTIES",["parent"]),l(ue,"UPSTREAM_PROPERTIES",[...ue.MUTABLE_UPSTREAM_PROPERTIES,...ue.INMUTABLE_UPSTREAM_PROPERTIES]),l(ue,"MUTABLE_DOWNSTREAM_PROPERTIES",["dataType"]),l(ue,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),l(ue,"DOWNSTREAM_PROPERTIES",[...ue.MUTABLE_DOWNSTREAM_PROPERTIES,...ue.INMUTABLE_DOWNSTREAM_PROPERTIES]),l(ue,"PROPERTIES",[...ue.META_PROPERTIES,...ue.UPSTREAM_PROPERTIES,...ue.DOWNSTREAM_PROPERTIES]);let gr=ue;function e3(n,e){if(!n.type&&!n.id)return{errors:[new E({id:`last-generated-entity-payload--${y.MissingTypeProperty}`,message:"Last generated entity payload is missing a 'type' property.",severity:m.Error,code:y.MissingTypeProperty,issue:null}),new E({id:`last-generated-entity-payload--${y.MissingIdProperty}`,message:"Last generated entity payload is missing an 'id' property.",severity:m.Error,code:y.MissingIdProperty,issue:null})],modifiedData:null};if(n.type){if(!n.id)return{errors:[new E({id:`last-generated-entity-payload--${y.MissingIdProperty}`,message:`Last generated entity, with type "${n.type}" is missing an 'id' property.`,severity:m.Error,code:y.MissingIdProperty,issue:null})],modifiedData:null}}else return{errors:[new E({id:`${n.id}--${y.MissingTypeProperty}`,message:`Entity with id "${n.id}" is missing a 'type' property.`,severity:m.Error,code:y.MissingTypeProperty,issue:null})],modifiedData:null};if(n.type===r.GenericReference)return{errors:[new E({id:`${n.id}--${y.RootReference}`,message:`Generic reference entity with id "${n.id}". A generic reference cannot be generated as a standalone entity. Only in the body of another entity.`,severity:m.Error,code:y.RootReference,issue:null})],modifiedData:null};const t=n,i=e.instances[t.id],a=e.builtInInstances[t.id];if(i&&!a&&t.type!==r.GenericReference){let s=`A previously generated entity with id "${t.id}" already exists in the project state.
|
|
172
|
+
${Qt({describe_entity:o.error.id})}`,issue:null}))),{errors:a,modifiedData:i}}validateGeneratedUpdate(e){return{errors:[],modifiedData:e}}addSelfToProject(){var e,t;return this.parentRelationType===C.FixedArguments?(e=this.parent)==null||e.addFixedArgument(this):this.parentRelationType===C.FixedReturns?(t=this.parent)==null||t.addFixedReturn(this):this.parentRelationType===C.ReturnedError&&this.parent&&(this.parent.error=this),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()),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.index=e.index||this.index,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=[];if(t.has(this.id))return{affected:[],removed:[]};if(t.add(this.id),a.push(this),this.unsubscribe(),this.dataType){const{affected:s,removed:o}=this.dataType.remove({ignoreUpstream:!0,seenEntities:t});i.push(...s),a.push(...o)}return{affected:S(i),removed:S(a)}}restore({seenEntities:e}={seenEntities:new Set}){const t=[];if(e.has(this.id))return{affected:[],self:this};if(e.add(this.id),this.subscribe(),this.dataType){const{affected:i}=this.dataType.restore({seenEntities:e});t.push(...i)}return{affected:S(t),self:this}}toFlat(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this,...this.dataType?this.dataType.toFlat(e):[]])}toFlatIds(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.id,...this.dataType?this.dataType.toFlatIds(e):[]])}toJSON(){var e,t;return{id:this.id,version:this.version,type:this.type,name:this.name,description:this.description,index:this.index,required:this.required,parentRelationType:this.parentRelationType,dataType:((e=this.dataType)==null?void 0:e.toJSON())||null,parent:((t=this.parent)==null?void 0:t.toReference())||null}}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,index:this.index,required:this.required,parentRelationType:this.parentRelationType,dataType:((e=this.dataType)==null?void 0:e.toReference())||null,parent:((t=this.parent)==null?void 0:t.toReference())||null}}toFlatJSON(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toShallowJSON(),...this.dataType?this.dataType.toFlatJSON(e):[]])}toGenerationTarget(){var e;return{id:this.id,name:this.name,description:this.description,type:this.type,required:this.required,parentRelationType:this.parentRelationType,parent:(e=this.parent)==null?void 0:e.id}}toFlatGenerationTarget(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toGenerationTarget(),...this.dataType?this.dataType.toFlatGenerationTarget(e):[]])}clearErrors(){var e;return this.errors=[],(e=this.dataType)==null||e.clearErrors(),this}validate(){const e=K9(this);return this.errors=e,{success:!0,error:null,data:this.toJSON()}}getErrors(){return[...this.errors,...this.dataType?this.dataType.getErrors():[]]}getShallowErrors(){return this.errors}clone(){return new ue(this.toJSON(),this.project)}getDataType(){return this.dataType||null}setDataType(e){return this.dataType=e,this}getDefaultValue(){var e;return((e=this.dataType)==null?void 0:e.defaultValue)||null}};l(ue,"MUTABLE_BASE_PROPERTIES",["name","description","required"]),l(ue,"INMUTABLE_BASE_PROPERTIES",["id","version","type","parentRelationType"]),l(ue,"BASE_PROPERTIES",[...ue.MUTABLE_BASE_PROPERTIES,...ue.INMUTABLE_BASE_PROPERTIES]),l(ue,"MUTABLE_META_PROPERTIES",[...ue.MUTABLE_BASE_PROPERTIES,"index"]),l(ue,"INMUTABLE_META_PROPERTIES",[...ue.INMUTABLE_BASE_PROPERTIES]),l(ue,"META_PROPERTIES",[...ue.MUTABLE_META_PROPERTIES,...ue.INMUTABLE_META_PROPERTIES]),l(ue,"MUTABLE_UPSTREAM_PROPERTIES",[]),l(ue,"INMUTABLE_UPSTREAM_PROPERTIES",["parent"]),l(ue,"UPSTREAM_PROPERTIES",[...ue.MUTABLE_UPSTREAM_PROPERTIES,...ue.INMUTABLE_UPSTREAM_PROPERTIES]),l(ue,"MUTABLE_DOWNSTREAM_PROPERTIES",["dataType"]),l(ue,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),l(ue,"DOWNSTREAM_PROPERTIES",[...ue.MUTABLE_DOWNSTREAM_PROPERTIES,...ue.INMUTABLE_DOWNSTREAM_PROPERTIES]),l(ue,"PROPERTIES",[...ue.META_PROPERTIES,...ue.UPSTREAM_PROPERTIES,...ue.DOWNSTREAM_PROPERTIES]);let gr=ue;function e3(n,e){if(!n.type&&!n.id)return{errors:[new E({id:`last-generated-entity-payload--${y.MissingTypeProperty}`,message:"Last generated entity payload is missing a 'type' property.",severity:m.Error,code:y.MissingTypeProperty,issue:null}),new E({id:`last-generated-entity-payload--${y.MissingIdProperty}`,message:"Last generated entity payload is missing an 'id' property.",severity:m.Error,code:y.MissingIdProperty,issue:null})],modifiedData:null};if(n.type){if(!n.id)return{errors:[new E({id:`last-generated-entity-payload--${y.MissingIdProperty}`,message:`Last generated entity, with type "${n.type}" is missing an 'id' property.`,severity:m.Error,code:y.MissingIdProperty,issue:null})],modifiedData:null}}else return{errors:[new E({id:`${n.id}--${y.MissingTypeProperty}`,message:`Entity with id "${n.id}" is missing a 'type' property.`,severity:m.Error,code:y.MissingTypeProperty,issue:null})],modifiedData:null};if(n.type===r.GenericReference)return{errors:[new E({id:`${n.id}--${y.RootReference}`,message:`Generic reference entity with id "${n.id}". A generic reference cannot be generated as a standalone entity. Only in the body of another entity.`,severity:m.Error,code:y.RootReference,issue:null})],modifiedData:null};const t=n,i=e.instances[t.id],a=e.builtInInstances[t.id];if(i&&!a&&t.type!==r.GenericReference){let s=`A previously generated entity with id "${t.id}" already exists in the project state.
|
|
173
173
|
Are you trying to update that entity?
|
|
174
174
|
If so, you should use the 'update' action for core mutable metadata properties, or 'delete' and then 'post' again to replace it.
|
|
175
175
|
If you are trying to create a new entity, please use a different id, for example: "${hd(t,e)}".`;return{errors:[new E({id:`duplicate--${t.id}--${y.EntityIdNotUnique}`,message:s,severity:m.Error,code:y.EntityIdNotUnique,issue:null})],modifiedData:n}}else if(i&&t.type!==r.GenericReference)return{errors:[new E({id:`${t.id}--${y.EntityIdNotUnique}`,message:`A built in entity with id "${t.id}" already exists. You cannot modify built in entities. If you are trying to create a new entity, please use a different id, for example: "${hd(t,e)}".`,severity:m.Error,code:y.EntityIdNotUnique,issue:null})],modifiedData:n};switch(t.type){case r.Project:return $.validateGenerationTarget(t,e);case r.CustomEntity:return Dr.validateGenerationTarget(t,e);case r.Property:return dr.validateGenerationTarget(t,e);case r.FunctionDeclaration:return ur.validateGenerationTarget(t,e);case r.DataType:return oi.validateGenerationTarget(t,e);case r.Operation:return pr.validateGenerationTarget(t,e);case r.FunctionCall:return vr.validateGenerationTarget(t,e);case r.VariableDeclaration:return fr.validateGenerationTarget(t,e);case r.VariableInstance:return mr.validateGenerationTarget(t,e);case r.GlobalEvent:return li.validateGenerationTarget(t,e);case r.InputMap:return mn.validateGenerationTarget(t,e);case r.OutputMap:return Tn.validateGenerationTarget(t,e);case r.ArgumentDeclaration:return Rr.validateGenerationTarget(t,e);case r.ReturnDeclaration:return Ct.validateGenerationTarget(t,e);case r.Loop:return yr.validateGenerationTarget(t,e);case r.Condition:return hr.validateGenerationTarget(t,e);case r.Search:return Tr.validateGenerationTarget(t,e);case r.InstalledProject:return Er.validateGenerationTarget(t,e);case r.InternalCall:return ci.validateGenerationTarget(t,e);case r.PrimitiveValue:return di.validateGenerationTarget(t,e);case r.ReturnStatement:return br.validateGenerationTarget(t,e);case r.BreakStatement:return ui.validateGenerationTarget(t,e);case r.ContinueStatement:return yt.validateGenerationTarget(t,e);case r.ActionDescriptor:return $e.validateGenerationTarget(t,e);case r.ValueDescriptor:return gr.validateGenerationTarget(t,e);case r.BuiltInBaseEntity:case r.PrimitiveEntity:{const s="Did you mean to generate a",d={[r.BuiltInBaseEntity]:`${s} '${r.CustomEntity}' instead?`,[r.PrimitiveEntity]:`${s} '${r.CustomEntity}' instead?`}[t.type]||"";return{errors:[new E({id:`${t.id}--${y.BuiltInEntityGenerated}`,message:`Entity with id "${t.id} is of "${t.type}" type and should not be generated. Built in entities can only be referenced by user created entities.
|
|
@@ -6,6 +6,7 @@ import { ProjectState } from '../project/project';
|
|
|
6
6
|
import { ActionDescriptorState } from '../action-descriptor';
|
|
7
7
|
import { EntityError, EntityGenerationError } from '../error';
|
|
8
8
|
import { EntityState } from '../types';
|
|
9
|
+
import { PrimitiveValueState } from '../primitive-value';
|
|
9
10
|
|
|
10
11
|
export declare class ValueDescriptorState implements IValueDescriptor, UserManagedEntityStateFunctionality, BaseState, ChildEntityState {
|
|
11
12
|
initialData: IValueDescriptor | IValueDescriptorTransfer;
|
|
@@ -87,5 +88,6 @@ export declare class ValueDescriptorState implements IValueDescriptor, UserManag
|
|
|
87
88
|
clone(): ValueDescriptorState;
|
|
88
89
|
getDataType(): DataTypeState | null;
|
|
89
90
|
setDataType(dataType: DataTypeState): ValueDescriptorState;
|
|
91
|
+
getDefaultValue(): PrimitiveValueState | null;
|
|
90
92
|
}
|
|
91
93
|
export type ValueDescriptorPayloadUnion = ValueDescriptorState | ValueDescriptorTypesUnion;
|
|
@@ -88,6 +88,7 @@ export declare class VariableDeclarationState implements IVariableDeclaration, B
|
|
|
88
88
|
subscribe(): VariableDeclarationState;
|
|
89
89
|
unsubscribe(): VariableDeclarationState;
|
|
90
90
|
subscribeInstance(instance: VariableInstanceState): VariableDeclarationState;
|
|
91
|
+
syncInputsAndOutputs(): VariableDeclarationState;
|
|
91
92
|
removeInstance(instance: VariableInstanceState): VariableDeclarationState;
|
|
92
93
|
sync(data: Partial<IVariableDeclaration>): VariableDeclarationState;
|
|
93
94
|
load(): Promise<VariableDeclarationState>;
|
|
@@ -94,7 +94,7 @@ export declare function getHeadIfPartOfDetachedBranch(entity: CanvasEntityState,
|
|
|
94
94
|
export declare function flattenDetachedBranch(entity: CanvasEntityState): CanvasEntityState[];
|
|
95
95
|
export declare function checkIsMethod(entity: EntityState): boolean;
|
|
96
96
|
export declare function mergeListOfEntities(oldErrors: EntityState[], newErrors: EntityState[]): EntityState[];
|
|
97
|
-
export declare function getPrototypeByType(type: EntityType): typeof
|
|
97
|
+
export declare function getPrototypeByType(type: EntityType): typeof InputMapState | typeof OutputMapState | typeof ProjectState | typeof ConditionState | typeof OperationState | typeof InstalledProjectState | typeof SearchState | typeof ReturnDeclarationState | typeof CustomEntityState | typeof PropertyState | typeof FunctionDeclarationState | typeof FunctionCallState | typeof VariableDeclarationState | typeof VariableInstanceState | typeof ArgumentDeclarationState | typeof LoopState | typeof ReturnStatementState | typeof BuiltInBaseEntityState | null;
|
|
98
98
|
export declare function getScopeOwner(entity: EntityState | Element | ElementTransfer | ElementGenerationTarget | ElementShallowTransfer, project: ProjectState): EntityWithLogicScopeState | ProjectState | null;
|
|
99
99
|
export declare function getRootEntryPointScopeOwner(entity: EntityState | Element | ElementTransfer | ElementGenerationTarget | ElementShallowTransfer, project: ProjectState): EntityWithLogicScopeState | null;
|
|
100
100
|
export declare function checkIsNestedScope(parent: EntityWithLogicScopeState | ProjectState, child: EntityWithLogicScopeState | ProjectState, project: ProjectState): boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elyx-code/project-logic-tree",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6015",
|
|
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",
|