@elyx-code/project-logic-tree 0.0.6063 → 0.0.6064
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 +152 -130
- package/dist/index.umd.cjs +55 -55
- package/package.json +1 -1
package/dist/index.umd.cjs
CHANGED
|
@@ -16,11 +16,11 @@ Please provide a unique 'name' string.`,severity:T.Error,code:S.NameNotUniqueInS
|
|
|
16
16
|
Please provide a unique 'name' string.`,severity:T.Error,code:S.NameNotUniqueInScope,issue:null}))}return t}function uu(r,e){const t=[];r.name||t.push(new E({id:`${r.id}--${S.EmptyName}`,message:`Entity with id "${r.id}" and type "${r.type}" has an empty name. Please provide a 'name' string.`,severity:T.Error,code:S.EmptyName,issue:null}));const i=_(r.parent);if(!i)t.push(new E({id:`${r.id}--parent-reference--${f.InvalidReferenceObjectStructure}`,message:`Reference object at 'parent' property for entity with id "${r.id}" and type "${r.type}" is not a valid reference. A reference needs to be a 'id' string of an existing entity in the project.`,severity:T.Error,code:f.InvalidReferenceObjectStructure,issue:null}));else{const a=e.get(i);if(!a)t.push(new E({id:`${r.id}--parent-reference--${f.ReferencedEntityNotFound}`,message:`The entity with id '${i}' that isn't yet found in the project. Perhaps it should be created first. Or perhaps the ID is incorrect.`,severity:T.Error,code:f.ReferencedEntityNotFound,issue:null}));else{const o=a.properties.filter(l=>l.name===r.name);o.length&&t.push(new E({id:`${r.id}--${S.NameNotUniqueInScope}`,message:`Entity with id "${r.id}" and type "${r.type}" has a name "${r.name}" that is not unique among all properties in the parent entity. Entity with id "${o[0].id}" has the same name.
|
|
17
17
|
Please provide a unique 'name' string.`,severity:T.Error,code:S.NameNotUniqueInScope,issue:null}))}}return t}function pu(r,e){const t=[];r.name||t.push(new E({id:`${r.id}--${S.EmptyName}`,message:`Entity with id "${r.id}" and type "${r.type}" has an empty name. Please provide a 'name' string.`,severity:T.Error,code:S.EmptyName,issue:null}));const i=_(r.parent);if(!i)t.push(new E({id:`${r.id}--parent-reference--${f.InvalidReferenceObjectStructure}`,message:`Reference object at 'parent' property for entity with id "${r.id}" and type "${r.type}" is not a valid reference. A reference needs to be a 'id' string of an existing entity in the project.`,severity:T.Error,code:f.InvalidReferenceObjectStructure,issue:null}));else{const a=e.get(i);if(!a)t.push(new E({id:`${r.id}--parent-reference--${f.ReferencedEntityNotFound}`,message:`The entity with id '${i}' that isn't yet found in the project. Perhaps it should be created first. Or perhaps the ID is incorrect.`,severity:T.Error,code:f.ReferencedEntityNotFound,issue:null}));else{const o=wu(a).filter(l=>l.name===r.name);o.length&&t.push(new E({id:`${r.id}--${S.NameNotUniqueInScope}`,message:`Entity with id "${r.id}" and type "${r.type}" has a name "${r.name}" that is not unique among all inputs declared in the parent entity. Entity with id "${o[0].id}" has the same name.
|
|
18
18
|
Please provide a unique 'name' string.`,severity:T.Error,code:S.NameNotUniqueInScope,issue:null}))}}return t}function yu(r,e){const t=[];r.name||t.push(new E({id:`${r.id}--${S.EmptyName}`,message:`Entity with id "${r.id}" and type "${r.type}" has an empty name. Please provide a 'name' string.`,severity:T.Error,code:S.EmptyName,issue:null}));const i=_(r.parent);if(!i)t.push(new E({id:`${r.id}--parent-reference--${f.InvalidReferenceObjectStructure}`,message:`Reference object at 'parent' property for entity with id "${r.id}" and type "${r.type}" is not a valid reference. A reference needs to be a 'id' string of an existing entity in the project.`,severity:T.Error,code:f.InvalidReferenceObjectStructure,issue:null}));else{const a=e.get(i);if(!a)t.push(new E({id:`${r.id}--parent-reference--${f.ReferencedEntityNotFound}`,message:`The entity with id '${i}' that isn't yet found in the project. Perhaps it should be created first. Or perhaps the ID is incorrect.`,severity:T.Error,code:f.ReferencedEntityNotFound,issue:null}));else{const o=_u(a).filter(l=>l.name===r.name);o.length&&t.push(new E({id:`${r.id}--${S.NameNotUniqueInScope}`,message:`Entity with id "${r.id}" and type "${r.type}" has a name "${r.name}" that is not unique among all outputs declared in the parent entity. Entity with id "${o[0].id}" has the same name.
|
|
19
|
-
Please provide a unique 'name' string.`,severity:T.Error,code:S.NameNotUniqueInScope,issue:null}))}}return t}function Yk(r,e){switch(r.type){case n.CustomEntity:return Oo(r,e);case n.FunctionDeclaration:return cu(r,e);case n.VariableDeclaration:return du(r,e);case n.Property:return uu(r,e);case n.ArgumentDeclaration:return pu(r,e);case n.ReturnDeclaration:return yu(r,e);default:return[]}}function He(r,e,t){const a=`${Po(r)}-${e}-id`;return t.instances[a]?N.UUID.uuid():a}function fu(r,e){let t="",i=null;if(r.parent){const s=e.get(r.parent);s&&(i=s)}let a="";return i&&(a=`${Po(C(i,e))}-`),t=`${a}${Po(C(r,e))}-id`,e.instances[t]?N.UUID.uuid():t}function Hk(r){var o;const e=m9(),t=r.toJSON();e.safeParse(t).success;const a=zk(r);(o=r.dataType)==null||o.validate();const s=[...a];if(r.id==="80c86e1b-caca-4ba5-9b1f-38f72d10e4a3"){const l=z({id:`${r.id}--${M.PropertyImplementsNonAbstact}`,message:`Property "${C(r,r.project)}" with id "${r.id}" implements a non-abstract property "${C(r,r.project)}" with id "${r.id}".`,issue:null,severity:T.Error,code:M.PropertyImplementsNonAbstact,entity:r});s.push(l.error)}return s}function zk(r){const e=[];if(!r.implements)return e;const t=r.implements;if(!t.abstract){const a=z({id:`${r.id}--${M.PropertyImplementsNonAbstact}`,message:`Property "${C(r,r.project)}" with id "${r.id}" implements a non-abstract property "${C(t,r.project)}" with id "${t.id}".`,issue:null,severity:T.Error,code:M.PropertyImplementsNonAbstact,entity:r});e.push(a.error)}if(r.static&&!t.static){const a=z({id:`${r.id}--${M.NonStaticPropertyImplementsStatic}`,message:`Static property "${C(r,r.project)}" with id "${r.id}" implements a non-static property "${C(t,r.project)}" with id "${t.id}".`,issue:null,severity:T.Error,code:M.NonStaticPropertyImplementsStatic,entity:r});e.push(a.error)}if(!r.static&&t.static){const a=z({id:`${r.id}--${M.StaticPropertyImplementsNonStatic}`,message:`Non-static property "${C(r,r.project)}" with id "${r.id}" implements a static property "${C(t,r.project)}" with id "${t.id}".`,issue:null,severity:T.Error,code:M.StaticPropertyImplementsNonStatic,entity:r});e.push(a.error)}if(!Zt(r.dataType,t.dataType)){const a=z({id:`${r.id}--${M.PropertyImplementsIncompatibleType}`,message:`Property "${C(r,r.project)}" with id "${r.id}" implements a property "${C(t,r.project)}" with id "${t.id}" that has an incompatible data type.`,issue:null,severity:T.Error,code:M.PropertyImplementsIncompatibleType,entity:r});e.push(a.error)}return ae(r.errors,e)}function Zk(r,e){const t=[];if(r.parent){const a=e.get(r.parent);if(!a)t.push(new E({id:`${r.id}--${r.parent}--${f.ReferencedEntityNotFound}`,code:f.ReferencedEntityNotFound,severity:T.Error,message:`Entity of type "${r.type}" with id "${r.id}", is referencing an entity with id "${r.parent}" that isn't yet found in the project. Perhaps it should be created first. Or perhaps the ID is incorrect.`,issue:null}));else{const s=Qn(a);if(s){const o=a!==s?`The entity of type '${r.type}' with id '${r.id}' have 'parent' with id '${r.parent}' because the entity belongs to a built-in '${s.type}' entity with id '${s.id}' (${C(s,a.project)}) higher up in the tree.`:`The entity of type '${r.type}' with id '${r.id}' have 'parent' with id '${r.parent}' because it is a built-in entity of type ${s.type}.`;t.push(new E({id:`${r.id}--${f.InvalidBuiltInEntityReference}`,code:f.InvalidBuiltInEntityReference,severity:T.Error,message:o,issue:null}))}else if(![n.CustomEntity].includes(a.type))t.push(new E({id:`${r.id}--${r.parent}--${f.InvalidParentReference}`,code:f.InvalidParentReference,severity:T.Error,message:`Entity of type "${r.type}" with id "${r.id}", has a parent reference that isn't pointing to an entity of type 'custom-entity'.`,issue:null}));else{const l=Xn(a).filter(p=>!p.interactive);if(l.length){let p=l.length>1?`The entity of type '${r.type}' with id '${r.id}' can't be added to the 'parent' entity with id '${a.id}' because it extends or implements multiple '${n.BuiltInBaseEntity}' entities that are non-interactive ("${
|
|
19
|
+
Please provide a unique 'name' string.`,severity:T.Error,code:S.NameNotUniqueInScope,issue:null}))}}return t}function Yk(r,e){switch(r.type){case n.CustomEntity:return Oo(r,e);case n.FunctionDeclaration:return cu(r,e);case n.VariableDeclaration:return du(r,e);case n.Property:return uu(r,e);case n.ArgumentDeclaration:return pu(r,e);case n.ReturnDeclaration:return yu(r,e);default:return[]}}function He(r,e,t){const a=`${Po(r)}-${e}-id`;return t.instances[a]?N.UUID.uuid():a}function fu(r,e){let t="",i=null;if(r.parent){const s=e.get(r.parent);s&&(i=s)}let a="";return i&&(a=`${Po(C(i,e))}-`),t=`${a}${Po(C(r,e))}-id`,e.instances[t]?N.UUID.uuid():t}function Hk(r){var o;const e=m9(),t=r.toJSON();e.safeParse(t).success;const a=zk(r);(o=r.dataType)==null||o.validate();const s=[...a];if(r.id==="80c86e1b-caca-4ba5-9b1f-38f72d10e4a3"){const l=z({id:`${r.id}--${M.PropertyImplementsNonAbstact}`,message:`Property "${C(r,r.project)}" with id "${r.id}" implements a non-abstract property "${C(r,r.project)}" with id "${r.id}".`,issue:null,severity:T.Error,code:M.PropertyImplementsNonAbstact,entity:r});s.push(l.error)}return s}function zk(r){const e=[];if(!r.implements)return e;const t=r.implements;if(!t.abstract){const a=z({id:`${r.id}--${M.PropertyImplementsNonAbstact}`,message:`Property "${C(r,r.project)}" with id "${r.id}" implements a non-abstract property "${C(t,r.project)}" with id "${t.id}".`,issue:null,severity:T.Error,code:M.PropertyImplementsNonAbstact,entity:r});e.push(a.error)}if(r.static&&!t.static){const a=z({id:`${r.id}--${M.NonStaticPropertyImplementsStatic}`,message:`Static property "${C(r,r.project)}" with id "${r.id}" implements a non-static property "${C(t,r.project)}" with id "${t.id}".`,issue:null,severity:T.Error,code:M.NonStaticPropertyImplementsStatic,entity:r});e.push(a.error)}if(!r.static&&t.static){const a=z({id:`${r.id}--${M.StaticPropertyImplementsNonStatic}`,message:`Non-static property "${C(r,r.project)}" with id "${r.id}" implements a static property "${C(t,r.project)}" with id "${t.id}".`,issue:null,severity:T.Error,code:M.StaticPropertyImplementsNonStatic,entity:r});e.push(a.error)}if(!Zt(r.dataType,t.dataType)){const a=z({id:`${r.id}--${M.PropertyImplementsIncompatibleType}`,message:`Property "${C(r,r.project)}" with id "${r.id}" implements a property "${C(t,r.project)}" with id "${t.id}" that has an incompatible data type.`,issue:null,severity:T.Error,code:M.PropertyImplementsIncompatibleType,entity:r});e.push(a.error)}return ae(r.errors,e)}function Zk(r,e){const t=[];if(r.parent){const a=e.get(r.parent);if(!a)t.push(new E({id:`${r.id}--${r.parent}--${f.ReferencedEntityNotFound}`,code:f.ReferencedEntityNotFound,severity:T.Error,message:`Entity of type "${r.type}" with id "${r.id}", is referencing an entity with id "${r.parent}" that isn't yet found in the project. Perhaps it should be created first. Or perhaps the ID is incorrect.`,issue:null}));else{const s=Qn(a);if(s){const o=a!==s?`The entity of type '${r.type}' with id '${r.id}' have 'parent' with id '${r.parent}' because the entity belongs to a built-in '${s.type}' entity with id '${s.id}' (${C(s,a.project)}) higher up in the tree.`:`The entity of type '${r.type}' with id '${r.id}' have 'parent' with id '${r.parent}' because it is a built-in entity of type ${s.type}.`;t.push(new E({id:`${r.id}--${f.InvalidBuiltInEntityReference}`,code:f.InvalidBuiltInEntityReference,severity:T.Error,message:o,issue:null}))}else if(![n.CustomEntity].includes(a.type))t.push(new E({id:`${r.id}--${r.parent}--${f.InvalidParentReference}`,code:f.InvalidParentReference,severity:T.Error,message:`Entity of type "${r.type}" with id "${r.id}", has a parent reference that isn't pointing to an entity of type 'custom-entity'.`,issue:null}));else{const l=Xn(a).filter(p=>!p.interactive);if(l.length){let p=l.length>1?`The entity of type '${r.type}' with id '${r.id}' can't be added to the 'parent' entity with id '${a.id}' because it extends or implements multiple '${n.BuiltInBaseEntity}' entities that are non-interactive ("${U(l.map(y=>C(y,y.project)),'", "','" and "')}").`:`The entity of type '${r.type}' with id '${r.id}' can't be added to the 'parent' entity with id '${a.id}' because it extends or implements a '${n.BuiltInBaseEntity}' entity that is non-interactive ("${C(l[0],l[0].project)}").`;p+=`
|
|
20
20
|
${Zn}`,t.push(new E({id:`${r.id}--${f.NonInteractiveEntityReferenced}`,code:f.NonInteractiveEntityReferenced,severity:T.Error,message:p,issue:null}))}else if(r.implements){const p=e.get(r.implements);if(r.id===r.implements)return t.push(new E({id:`${r.id}--${r.implements}--${f.SelfReference}`,code:f.SelfReference,severity:T.Error,message:`Entity of type "${r.type}" with id "${r.id}", has a reference to itself at 'implements'. This is not allowed. Change the reference string or the 'entityId' property of the reference object.`,issue:null})),t;if(!p)t.push(new E({id:`${r.id}--${r.implements}--${f.ReferencedEntityNotFound}`,code:f.ReferencedEntityNotFound,severity:T.Error,message:`Entity of type "${r.type}" with id "${r.id}", is referencing an entity with id "${r.implements}" that isn't yet found in the project. Perhaps it should be created first. Or perhaps the ID is incorrect.`,issue:null}));else{const y=a.properties.find(h=>{var m;return((m=h.implements)==null?void 0:m.id)===r.implements});y?t.push(new E({id:`${r.id}--${S.PropertyOverwrite}`,code:S.PropertyOverwrite,severity:T.Error,message:`The property with id "${r.id}" is trying to implement the property with id "${r.implements}", but the parent entity already has a property with id '${y.id}' that implements the same base property.`,issue:null})):[n.Property].includes(p.type)?p.abstract||t.push(new E({id:`${r.id}--${r.implements}--${f.InvalidImplementsReference}`,code:f.InvalidImplementsReference,severity:T.Error,message:`Entity of type "${r.type}" with id "${r.id}", has an 'implements' reference that isn't pointing to an abstract entity.`,issue:null})):t.push(new E({id:`${r.id}--${r.implements}--${f.InvalidImplementsReference}`,code:f.InvalidImplementsReference,severity:T.Error,message:`Entity of type "${r.type}" with id "${r.id}", has an 'implements' reference that isn't pointing to an entity of type 'property'.`,issue:null}))}}}}}const i=Je(r,{},e);return t.push(...i.errors),t}const me=class me{constructor(e,t){c(this,"initialData");c(this,"id");c(this,"version");c(this,"name");c(this,"description",null);c(this,"private");c(this,"abstract");c(this,"index");c(this,"static");c(this,"required");c(this,"type",n.Property);c(this,"hidden",!1);c(this,"dataType",null);c(this,"implements",null);c(this,"project");c(this,"errors",[]);c(this,"parent");c(this,"initialized",!1);c(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.private=e.private,this.abstract=e.abstract,this.index=e.index,this.static=e.static,this.required=e.required||!1,this.hidden=e.hidden||!1}static fromGenerationTarget(e,t){const i=_(e.parent),a=t.get(i);let s=null;if(e.implements){const p=_(e.implements);s=t.get(p)}const o={id:e.id,version:1,name:e.name,type:n.Property,index:a.properties.length,private:e.private,abstract:e.abstract,static:e.static,required:e.required||!1,hidden:!1,description:e.description,implements:s,dataType:null,parent:a},l=R(o,t);return l.setParent(a),l.initChildren(),l}static validateGenerationTarget(e,t){let i=JSON.parse(JSON.stringify(e));const a=[],s=Zk(i,t),o=uu(i,t);return a.push(...s,...o,...Ne(i)),{errors:a,modifiedData:i}}validateGeneratedUpdate(e){const t=[];return e.parent&&t.push(new E({id:`${this.id}--${f.InvalidParentUpdate}`,code:f.InvalidParentUpdate,severity:T.Error,message:`Entity of type '${this.type}' with id '${this.id}' cannot have the 'parent' property updated, as it would mean moving the '${this.type}' entity to another parent entity.
|
|
21
21
|
This is likely an incorrect strategy, either the '${this.type}' entity doesn't need to be updated or it should be deleted and a new one created in the desired parent.`,issue:null})),(e.readsValue||e.writesValue)&&t.push(new E({id:`${this.id}--${S.InvalidObjectStructure}`,code:S.InvalidObjectStructure,severity:T.Error,message:`Entity of type '${this.type}' with id '${this.id}' is not a value reading or writing entity.
|
|
22
|
-
${wo}`,issue:null})),{errors:t,modifiedData:e}}addSelfToProject(){const e=[this],t=[],i=[];return this.parent.addProperty(this),e.push(this.parent),{updated:g(e),added:g(t),removed:g(i),self:this}}setParent(e){return this.parent=e,this}initChildren(){if(this.initialized)return this;if(this.initialized=!0,this.initialData.dataType){const e=R(this.initialData.dataType,this.project);e.setParent(this),e.initChildren(),this.dataType=e}if(this.initialData.implements){const e=R(this.initialData.implements,this.project);this.implements=e}return 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.abstract=e.abstract||this.abstract,this.private=e.private||this.private,this.index=e.index||(e.index!==0?this.index:0),this.static=e.static||this.static,this.required=e.required||this.required,this.hidden=e.hidden||this.hidden,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 e||this.parent.type===n.CustomEntity&&(this.parent.removeProperty(this),i.push(this.parent)),{affected:g(i),removed:g(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 this.parent.type===n.CustomEntity&&(this.parent.addProperty(this),t.push(this.parent)),{affected: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))||[]])}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))||[]])}toJSON(){var e,t;return{id:this.id,version:this.version,type:this.type,name:this.name,description:this.description,index:this.index,private:this.private,required:this.required,static:this.static,abstract:this.abstract,hidden:this.hidden,dataType:((e=this.dataType)==null?void 0:e.toJSON())||null,implements:((t=this.implements)==null?void 0:t.toJSON())||null,parent:this.parent.toReference()}}toReference(){return{id:this.id+"--"+N.UUID.uuid()+"--ref",type:n.GenericReference,entityId:this.id,entityType:this.type}}toShallowJSON(){var e,t;return{id:this.id,version:this.version,name:this.name,description:this.description,type:this.type,index:this.index,private:this.private,required:this.required,abstract:this.abstract,static:this.static,hidden:this.hidden,dataType:((e=this.dataType)==null?void 0:e.toReference())||null,implements:((t=this.implements)==null?void 0:t.toReference())||null,parent:this.parent.toReference()}}toFlatJSON(e=new Set){var i,a;return e.has(this.id)?[]:(e.add(this.id),[this.toShallowJSON(),...((i=this.dataType)==null?void 0:i.toFlatJSON(e))||[],...((a=this.implements)==null?void 0:a.toFlatJSON(e))||[]])}toGenerationTarget(){var e;return{id:this.id,name:this.name,description:this.description,type:this.type,private:this.private,required:this.required,abstract:this.abstract,static:this.static,implements:((e=this.implements)==null?void 0:e.id)||null,parent:this.parent.id}}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))||[]])}clearErrors(){var e;return this.errors=[],(e=this.dataType)==null||e.clearErrors(),this}validate(){return this.errors=Hk(this),this.errors.length,{success:!0,error:null,data:null}}getErrors(){var t;return[...this.errors,...((t=this.dataType)==null?void 0:t.getErrors())||[]]}getShallowErrors(){return this.errors}getDefaultValue(){var e;return((e=this.dataType)==null?void 0:e.defaultValue)||null}clone(e=null,t=null,i=!0){var
|
|
23
|
-
${Zn}`,a.push(new E({id:`${e.id}--${f.NonInteractiveEntityReferenced}`,code:f.NonInteractiveEntityReferenced,severity:T.Error,message:P,issue:null}))}else{const P=m.methods.find($=>{var
|
|
22
|
+
${wo}`,issue:null})),{errors:t,modifiedData:e}}addSelfToProject(){const e=[this],t=[],i=[];return this.parent.addProperty(this),e.push(this.parent),{updated:g(e),added:g(t),removed:g(i),self:this}}setParent(e){return this.parent=e,this}initChildren(){if(this.initialized)return this;if(this.initialized=!0,this.initialData.dataType){const e=R(this.initialData.dataType,this.project);e.setParent(this),e.initChildren(),this.dataType=e}if(this.initialData.implements){const e=R(this.initialData.implements,this.project);this.implements=e}return 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.abstract=e.abstract||this.abstract,this.private=e.private||this.private,this.index=e.index||(e.index!==0?this.index:0),this.static=e.static||this.static,this.required=e.required||this.required,this.hidden=e.hidden||this.hidden,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 e||this.parent.type===n.CustomEntity&&(this.parent.removeProperty(this),i.push(this.parent)),{affected:g(i),removed:g(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 this.parent.type===n.CustomEntity&&(this.parent.addProperty(this),t.push(this.parent)),{affected: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))||[]])}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))||[]])}toJSON(){var e,t;return{id:this.id,version:this.version,type:this.type,name:this.name,description:this.description,index:this.index,private:this.private,required:this.required,static:this.static,abstract:this.abstract,hidden:this.hidden,dataType:((e=this.dataType)==null?void 0:e.toJSON())||null,implements:((t=this.implements)==null?void 0:t.toJSON())||null,parent:this.parent.toReference()}}toReference(){return{id:this.id+"--"+N.UUID.uuid()+"--ref",type:n.GenericReference,entityId:this.id,entityType:this.type}}toShallowJSON(){var e,t;return{id:this.id,version:this.version,name:this.name,description:this.description,type:this.type,index:this.index,private:this.private,required:this.required,abstract:this.abstract,static:this.static,hidden:this.hidden,dataType:((e=this.dataType)==null?void 0:e.toReference())||null,implements:((t=this.implements)==null?void 0:t.toReference())||null,parent:this.parent.toReference()}}toFlatJSON(e=new Set){var i,a;return e.has(this.id)?[]:(e.add(this.id),[this.toShallowJSON(),...((i=this.dataType)==null?void 0:i.toFlatJSON(e))||[],...((a=this.implements)==null?void 0:a.toFlatJSON(e))||[]])}toGenerationTarget(){var e;return{id:this.id,name:this.name,description:this.description,type:this.type,private:this.private,required:this.required,abstract:this.abstract,static:this.static,implements:((e=this.implements)==null?void 0:e.id)||null,parent:this.parent.id}}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))||[]])}clearErrors(){var e;return this.errors=[],(e=this.dataType)==null||e.clearErrors(),this}validate(){return this.errors=Hk(this),this.errors.length,{success:!0,error:null,data:null}}getErrors(){var t;return[...this.errors,...((t=this.dataType)==null?void 0:t.getErrors())||[]]}getShallowErrors(){return this.errors}getDefaultValue(){var e;return((e=this.dataType)==null?void 0:e.defaultValue)||null}clone(e=null,t=null,i=!0){var m;const a=t||He(C(this,this.project),n.Property,this.project),s=a.split("-id"),o=s[s.length-1||0]||a;let l=e||this.parent;const p={hidden:!1,id:a,version:this.version,type:this.type,name:this.name,description:this.description,index:this.index,private:this.private,required:this.required,abstract:this.abstract,static:this.static,dataType:null,implements:null,parent:l},y=xt(p,this.project);i&&y.subscribe(),y.setParent(l);const h=((m=this.dataType)==null?void 0:m.clone(y,o+"-data-type-id",i))||null;return h&&y.setDataType(h),y}setDataType(e){return this.dataType=e,this}removeDataType(){return this.dataType=null,this}getDataType(){return this.dataType}};c(me,"MUTABLE_BASE_PROPERTIES",["name","description","private","abstract","static","required"]),c(me,"INMUTABLE_BASE_PROPERTIES",["id","type","version"]),c(me,"BASE_PROPERTIES",[...me.MUTABLE_BASE_PROPERTIES,...me.INMUTABLE_BASE_PROPERTIES]),c(me,"MUTABLE_META_PROPERTIES",[...me.MUTABLE_BASE_PROPERTIES,"index"]),c(me,"INMUTABLE_META_PROPERTIES",[...me.INMUTABLE_BASE_PROPERTIES]),c(me,"META_PROPERTIES",[...me.MUTABLE_META_PROPERTIES,...me.INMUTABLE_META_PROPERTIES]),c(me,"MUTABLE_UPSTREAM_PROPERTIES",[]),c(me,"INMUTABLE_UPSTREAM_PROPERTIES",["parent","implements"]),c(me,"UPSTREAM_PROPERTIES",[...me.MUTABLE_UPSTREAM_PROPERTIES,...me.INMUTABLE_UPSTREAM_PROPERTIES]),c(me,"MUTABLE_DOWNSTREAM_PROPERTIES",["dataType"]),c(me,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),c(me,"DOWNSTREAM_PROPERTIES",[...me.MUTABLE_DOWNSTREAM_PROPERTIES,...me.INMUTABLE_DOWNSTREAM_PROPERTIES]),c(me,"PROPERTIES",[...me.META_PROPERTIES,...me.UPSTREAM_PROPERTIES,...me.DOWNSTREAM_PROPERTIES]);let Sr=me;function Kk(r){const e=N3(),t=r.toJSON();e.safeParse(t).success;const a=Xk(r),s=Qk(r),o=Pt(r);r.inputs.forEach(p=>p.validate()),o.forEach(p=>p.validate());const l=[...a,...s];if(r.id==="getCompanyByIdEndpointReachedEntityEvent"){const p=z({id:`${r.id}--${M.PropertyImplementsNonAbstact}`,message:`Property "${C(r,r.project)}" with id "${r.id}" implements a non-abstract property "${C(r,r.project)}" with id "${r.id}".`,issue:null,severity:T.Error,code:M.PropertyImplementsNonAbstact,entity:r});l.push(p.error)}return ae(r.errors,l)}function Xk(r){const e=[];if(!r.calls.length){const t=z({id:`${r.id}--${M.ScopeWithoutLogic}`,message:`Action "${C(r,r.project)}" with id "${r.id}" does not have any logic defined. So it doesn't do anything.`,issue:null,severity:T.Error,code:M.ScopeWithoutLogic,entity:r});e.push(t.error)}return ae(r.errors,e)}function Qk(r){const e=[];return r.implements,ae(r.errors,e)}const Te=class Te{constructor(e,t){c(this,"initialData");c(this,"id");c(this,"version");c(this,"name");c(this,"description",null);c(this,"x");c(this,"y");c(this,"collapsed");c(this,"private");c(this,"index",null);c(this,"type",n.FunctionDeclaration);c(this,"implements",null);c(this,"inputs",[]);c(this,"returnStatements",[]);c(this,"calls",[]);c(this,"parent");c(this,"detachedChildren",[]);c(this,"errors",[]);c(this,"project");c(this,"initialized",!1);c(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.private=e.private,this.collapsed=e.collapsed,this.x=e.x,this.y=e.y,this.index=e.index}static fromGenerationTarget(e,t){let i=t;if(e.parent){const l=_(e.parent);i=t.get(l)}let a=null;if(e.implements){const l=_(e.implements);a=t.get(l)}const s={id:e.id,version:1,name:e.name,type:n.FunctionDeclaration,index:i.type===n.CustomEntity?i.methods.length:null,description:e.description,collapsed:!1,private:!1,returnStatements:[],calls:[],inputs:[],implements:a,x:0,y:0,parent:i},o=R(s,t);return o.setParent(i),o.initChildren(),o}static validateGenerationTarget(e,t){var h;let i=JSON.parse(JSON.stringify(e));const a=[],s=Je(i,{parent:{list:!1,types:[n.Project,n.InstalledProject,n.CustomEntity,n.Loop],optional:!0},implements:{list:!1,types:[n.ActionDescriptor],optional:!0}},t);i=s.modifiedData;const o=cu(i,t),l=i.parent?t.get(i.parent):null;if(l&&l.type===n.CustomEntity){const m=l,v=Xn(m).filter(P=>!P.interactive);if(v.length){let P=v.length>1?`The entity of type '${e.type}' with id '${e.id}' can't be added to the 'parent' entity with id '${m.id}' because it extends or implements multiple '${n.BuiltInBaseEntity}' entities that are non-interactive ("${U(v.map(A=>C(A,A.project)),'", "','" and "')}").`:`The entity of type '${e.type}' with id '${e.id}' can't be added to the 'parent' entity with id '${m.id}' because it extends or implements a '${n.BuiltInBaseEntity}' entity that is non-interactive ("${C(v[0],v[0].project)}").`;P+=`
|
|
23
|
+
${Zn}`,a.push(new E({id:`${e.id}--${f.NonInteractiveEntityReferenced}`,code:f.NonInteractiveEntityReferenced,severity:T.Error,message:P,issue:null}))}else{const P=m.methods.find($=>{var F;return((F=$.implements)==null?void 0:F.id)===i.implements});P&&a.push(new E({id:`${i.id}--${S.MethodOverwrite}`,code:S.MethodOverwrite,severity:T.Error,message:`The '${n.FunctionDeclaration}' with id "${i.id}" is trying to implement the '${n.ActionDescriptor}' with id "${i.implements}", but the parent custom-entity already has a ${n.FunctionDeclaration} with id '${P.id}' that implements the same base method.
|
|
24
24
|
A ${n.FunctionDeclaration} that has a parent of type '${n.CustomEntity}' is considered a method of that entity, and cannot implement the same '${n.ActionDescriptor}' more than once.
|
|
25
25
|
${n.ActionDescriptor} entities inside a ${n.CustomEntity} are considered abstract methods that can be implemented by ${n.FunctionDeclaration} entities inside the same parent.
|
|
26
26
|
If you want to modify the existing implementation, you can update the existing method instead, but it will have to match the same base ${n.ActionDescriptor} signature, otherwise the implementation will have a validation error.`,issue:null}));const A=i.implements;m.abstractMethods.find($=>$.id===A)||a.push(new E({id:`${i.id}--${f.InvalidImplementsReference}`,code:f.InvalidImplementsReference,severity:T.Error,message:`The '${n.FunctionDeclaration}' with id "${i.id}" is trying to implement the '${n.ActionDescriptor}' with id "${i.implements}", but the parent custom-entity with id "${m.id}" does not have a action descriptor (abstract method) with that id.
|
|
@@ -29,12 +29,12 @@ If you want to implement a new method, you can create a new 'function-declaratio
|
|
|
29
29
|
If you want to modify the existing implementation, you can update the existing method instead, but it will have to match the same base ${n.ActionDescriptor} signature, otherwise the implementation will have a validation error.`,issue:null}))}}else if(l&&l.type===n.Loop){const m=l.body;m&&((h=m.implements)==null?void 0:h.id)===i.implements&&a.push(new E({id:`${i.id}--${S.MethodOverwrite}`,code:S.MethodOverwrite,severity:T.Error,message:`The '${n.FunctionDeclaration}' with id "${i.id}" is being added as the 'body' of the ${n.Loop} with id "${l.id}", but the loop already has a function-declaration body. A loop can only have one function-declaration body at a time. You can edit the existing body instead, but it will have to match the same base signature, otherwise the implementation will have a validation error.`,issue:null}))}const p=i.parent&&t.get(i.parent)||t.getBuiltIn(i.parent),y=p?Qn(p):null;return y&&a.push(new E({id:`${e.id}--${f.BuiltInEntityParent}`,code:f.BuiltInEntityParent,severity:T.Error,message:`The entity with id '${e.id}' and type '${e.type}', belongs to a built-in system entity "${C(y,t)}" with id '${y.id}', and therefore it cannot be created as it would affect a built in entity, which are inmutable.`,issue:null})),a.push(...s.errors,...o,...Ne(i)),{errors:a,modifiedData:i}}validateGeneratedUpdate(e){const t=[];return e.parent&&(this.parent.type===n.Project?t.push(new E({id:`${this.id}--${f.InvalidParentUpdate}`,code:f.InvalidParentUpdate,severity:T.Error,message:`Entity of type '${this.type}' with id '${this.id}' cannot have the 'parent' property updated, as it would mean moving the '${this.type}' entity to another parent entity.
|
|
30
30
|
This is likely an incorrect strategy because this is a globally declared '${this.type}' entity which can only have the root project as its parent.`,issue:null})):t.push(new E({id:`${this.id}--${f.InvalidParentUpdate}`,code:f.InvalidParentUpdate,severity:T.Error,message:`Entity of type '${this.type}' with id '${this.id}' cannot have the 'parent' property updated, as it would mean moving the '${this.type}' entity to another parent entity.
|
|
31
31
|
This is likely an incorrect strategy because this function declaration is a method, since it belongs to a '${this.parent.type}' entity, either the '${this.type}' entity doesn't need to be updated or it should be deleted and a new one created in the desired parent.
|
|
32
|
-
Please consider that any updates might affect the overlap with the signature of the parent entity's action descriptors.`,issue:null}))),{errors:t,modifiedData:e}}addSelfToProject(){const e=[this],t=[],i=[];return this.parent===this.project?this.project.addFunctionDeclaration(this):this.parent.type===n.CustomEntity?(this.parent.addMethod(this),e.push(this.parent)):this.parent.type===n.Loop&&(this.parent.setBody(this),e.push(this.parent)),{updated:g(e),added:g(t),removed:g(i),self:this}}replaceDetachedChild(e,t){const i=this.detachedChildren.indexOf(e);return i!==-1&&(this.detachedChildren[i]=t),this}subscribeDetachedChild(e){return this.detachedChildren.includes(e)||this.detachedChildren.push(e),this}addInputDeclaration(e){return this.inputs.includes(e)||this.inputs.push(e),this}removeInputDeclaration(e){const t=this.inputs.indexOf(e);return t!==-1&&this.inputs.splice(t,1),this}setParent(e){return this.parent=e,this}setImplements(e){return this.implements=e,this}addCall(e){return this.calls.includes(e)||this.calls.push(e),this}removeCall(e){const t=this.calls.indexOf(e);return t!==-1&&this.calls.splice(t,1),this}initChildren(){return this.initialized?this:(this.initialized=!0,this.inputs=this.initialData.inputs.map(e=>{const t=R(e,this.project);return t.setParent(this),t.initChildren(),t}),this.calls=this.initialData.calls.map(e=>{const t=R(e,this.project);return t.addEntryCaller(this),[n.BreakStatement,n.ContinueStatement].includes(t.type)?(t.setParent(this.parent),t.initChildren()):t.type!==n.InternalCall&&(t.setParent(this),t.initChildren()),t}),this.returnStatements=this.initialData.returnStatements.map(e=>{const t=R(e,this.project);return t.setParent(this),t.initChildren(),t}),this.initialData.implements&&(this.implements=R(this.initialData.implements,this.project)),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.private=e.private||this.private,this.index=e.index||(e.index!==0?this.index:0),this.collapsed=e.collapsed!==void 0?e.collapsed:this.collapsed,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(o=>{const{affected:l,removed:p}=o.remove({ignoreUpstream:!0,seenEntities:t});i.push(...l),a.push(...p)}),Pt(this).forEach(o=>{const{affected:l,removed:p}=o.remove({ignoreUpstream:!0,seenEntities:t});i.push(...l),a.push(...p)}),{affected:g(i),removed:g(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(a=>{const{affected:s}=a.restore({seenEntities:e});t.push(...s)}),Pt(this).forEach(a=>{const{affected:s}=a.restore({seenEntities:e});t.push(...s)}),{affected:g(t),self:this})}toFlat(e=new Set){if(e.has(this.id))return[];e.add(this.id);const t=Pt(this);return[this,...this.inputs.flatMap(a=>a.toFlat(e)),...this.calls.flatMap(a=>a.toFlat(e)),...this.returnStatements.flatMap(a=>a.toFlat(e)),...this.implements?this.implements.toFlat(e):[],...t.flatMap(a=>a.toFlat(e))]}toFlatIds(e=new Set){if(e.has(this.id))return[];e.add(this.id);const t=Pt(this);return[this.id,...this.inputs.flatMap(a=>a.toFlatIds(e)),...this.calls.flatMap(a=>a.toFlatIds(e)),...this.returnStatements.flatMap(a=>a.toFlatIds(e)),...this.implements?this.implements.toFlatIds(e):[],...t.flatMap(a=>a.toFlatIds(e))]}toJSON(){var e;return{id:this.id,version:this.version,type:this.type,name:this.name,description:this.description,index:this.index,x:this.x,y:this.y,collapsed:this.collapsed,private:this.private,parent:this.parent.toReference(),calls:this.calls.map(t=>t.toJSON()),inputs:this.inputs.map(t=>t.toJSON()),implements:((e=this.implements)==null?void 0:e.toJSON())||null,returnStatements:this.returnStatements.map(t=>t.toJSON())}}toReference(){return{id:this.id+"--"+N.UUID.uuid()+"--ref",type:n.GenericReference,entityId:this.id,entityType:this.type}}toShallowJSON(){var e;return{id:this.id,version:this.version,type:this.type,name:this.name,description:this.description,index:this.index,collapsed:this.collapsed,private:this.private,x:this.x,y:this.y,inputs:this.inputs.map(t=>t.toReference()),calls:this.calls.map(t=>t.toReference()),returnStatements:this.returnStatements.map(t=>t.toReference()),implements:((e=this.implements)==null?void 0:e.toReference())||null,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.calls.flatMap(i=>i.toFlatJSON(e)),...this.returnStatements.flatMap(i=>i.toFlatJSON(e)),...this.implements?this.implements.toFlatJSON(e):[]])}toGenerationTarget(){var t;const e=this.parent.type===n.Project?void 0:this.parent.id;return{id:this.id,name:this.name,description:this.description,type:this.type,private:this.private,implements:((t=this.implements)==null?void 0:t.id)||null,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.calls.flatMap(i=>i.toFlatGenerationTarget(e)),...this.returnStatements.flatMap(i=>i.toFlatGenerationTarget(e))])}clearErrors(){return this.errors=[],this.inputs.forEach(e=>e.clearErrors()),this.calls.forEach(e=>e.clearErrors()),this.returnStatements.forEach(e=>e.clearErrors()),this}validate(){const e=Kk(this);return this.errors=[...e],{success:!0,error:null,data:this.toJSON()}}getErrors(){const e=Pt(this);return[...this.errors,...this.inputs.flatMap(i=>i.getErrors()),...e.flatMap(i=>i.getErrors())]}getShallowErrors(){return this.errors}clone(e=null,t=null,i=!0,a=!1){var m;const s=this.toJSON(),o=t||He(C(this,this.project),n.FunctionDeclaration,this.project);s.inputs=[];const l=o.split("-id"),p=l[l.length-1||0]||o;s.id=o;const y=xt(s,this.project);e?y.setParent(e):y.setParent(this.parent),i&&y.subscribe(),y.initChildren();const h=(m=this.inputs)==null?void 0:m.map((b,v)=>b.clone(this,p+"-argument-declaration-"+v+"-id",i));return y.inputs=h,y}getVariableInstances(){return ie(this).filter(i=>i.type===n.VariableInstance)}getArgument(e){return this.inputs.find(t=>t.id===e)||null}createCall(e=this.project,t={}){const i={id:t.id||N.UUID.uuid(),version:t.version||1,type:n.FunctionCall,parent:e.toReference(),successCalls:t.successCalls||[],errorCalls:t.errorCalls||[],inputs:t.inputs||[],outputs:t.outputs||[],error:t.error||null,process:t.process||null,calledBySuccess:t.calledBySuccess||[],calledByError:t.calledByError||[],calledByEntry:t.calledByEntry||[],declaration:this.toJSON(),x:0,y:0},a=R(i,this.project);return a.setParent(e),a.initChildren(),e===this.project&&this.project.addFunctionCall(a),a}createInternalCall(e,t={}){const i={id:t.id||N.UUID.uuid(),version:t.version||1,type:n.InternalCall,parent:e.toReference(),successCalls:t.successCalls||[],errorCalls:t.errorCalls||[],inputs:t.inputs||[],outputs:t.outputs||[],error:t.error||null,process:t.process||null,calledBySuccess:t.calledBySuccess||[],calledByError:t.calledByError||[],calledByEntry:t.calledByEntry||[],declaration:this.toShallowJSON(),index:e.internalCalls.length},a=R(i,this.project);return a.setParent(e),a.initChildren(),a}addReturnStatement(e){return this.returnStatements.includes(e)||this.returnStatements.push(e),this}removeReturnStatement(e){const t=this.returnStatements.indexOf(e);return t!==-1&&this.returnStatements.splice(t,1),this}};c(Te,"MUTABLE_BASE_PROPERTIES",["name","description","private"]),c(Te,"INMUTABLE_BASE_PROPERTIES",["id","version","type"]),c(Te,"BASE_PROPERTIES",[...Te.MUTABLE_BASE_PROPERTIES,...Te.INMUTABLE_BASE_PROPERTIES]),c(Te,"MUTABLE_META_PROPERTIES",[...Te.MUTABLE_BASE_PROPERTIES,"x","y","index","collapsed"]),c(Te,"INMUTABLE_META_PROPERTIES",[...Te.INMUTABLE_BASE_PROPERTIES]),c(Te,"META_PROPERTIES",[...Te.MUTABLE_META_PROPERTIES,...Te.INMUTABLE_META_PROPERTIES]),c(Te,"MUTABLE_UPSTREAM_PROPERTIES",[]),c(Te,"INMUATABLE_UPSTREAM_PROPERTIES",["parent","implements"]),c(Te,"UPSTREAM_PROPERTIES",[...Te.MUTABLE_UPSTREAM_PROPERTIES,...Te.INMUATABLE_UPSTREAM_PROPERTIES]),c(Te,"MUTABLE_DOWNSTREAM_PROPERTIES",["inputs","calls","returnStatements"]),c(Te,"INMUATABLE_DOWNSTREAM_PROPERTIES",[]),c(Te,"DOWNSTREAM_PROPERTIES",[...Te.MUTABLE_DOWNSTREAM_PROPERTIES,...Te.INMUATABLE_DOWNSTREAM_PROPERTIES]),c(Te,"PROPERTIES",[...Te.META_PROPERTIES,...Te.UPSTREAM_PROPERTIES,...Te.DOWNSTREAM_PROPERTIES]);let Cr=Te;function e2(r){const e=$6(),t=r.toJSON();e.safeParse(t).success;const a=[];if(r.entity&&r.andChildrenGroup||r.entity&&r.orChildrenGroup||r.andChildrenGroup&&r.orChildrenGroup){const s=z({id:r.id+"--"+M.InvalidPropertiesCombination,message:`Data type with id "${r.id}" has invalid properties combination. Only one of the following properties can be present at the time: 'entity', 'andChildrenGroup' or 'orChildrenGroup'`,issue:null,severity:T.Error,code:M.InvalidPropertiesCombination,entity:r});a.push(s.error)}return ae(r.errors,a)}function t2(r,e){const t=[],i=[n.CustomEntity,n.ActionDescriptor,n.Property,n.ArgumentDeclaration,n.ReturnDeclaration,n.VariableDeclaration,n.ValueDescriptor,n.DataType],a=`'${F(i,"', '","' or '")}'`;if(r.parent)if(r.id===r.parent)t.push(new E({id:`${r.id}--${r.parent}--${f.SelfReference}`,code:f.SelfReference,severity:T.Error,message:`Entity of type "${r.type}" with id "${r.id}", has a reference to itself at 'parent'. This is not allowed. Change the reference string or the 'entityId' property of the reference object.`,issue:null}));else{const s=e.get(r.parent);s?i.includes(s.type)||t.push(new E({id:`${r.id}--${r.parent}--${f.InvalidParentReference}`,code:f.InvalidParentReference,severity:T.Error,message:`Entity of type "${r.type}" with id "${r.id}", has a parent reference that isn't pointing to an entity of type ${a}.`,issue:null})):t.push(new E({id:`${r.id}--${r.parent}--${f.ReferencedEntityNotFound}`,code:f.ReferencedEntityNotFound,severity:T.Error,message:`Entity of type "${r.type}" with id "${r.id}", is referencing an entity with id "${r.parent}" that isn't yet found in the project. Perhaps it should be created first. Or perhaps the ID is incorrect.`,issue:null}))}else t.push(new E({id:`${r.id}--${S.InvalidObjectStructure}`,code:S.InvalidObjectStructure,severity:T.Error,message:`Entity of type "${r.type}" with id "${r.id}" is missing a 'parent' reference. The 'parent' of a 'data-type' entity must be a reference to an entity of type ${a}.`,issue:null}));if(r.entity){if(r.id===r.entity)return t.push(new E({id:`${r.id}--${r.entity}--${f.SelfReference}`,code:f.SelfReference,severity:T.Error,message:`Entity of type "${r.type}" with id "${r.id}", has a reference to itself at 'entity'. This is not allowed. Change the reference string or the 'entityId' property of the reference object.`,issue:null})),t;const s=e.get(r.entity);s?[n.CustomEntity,n.PrimitiveEntity,n.ActionDescriptor,n.BuiltInBaseEntity].includes(s.type)||t.push(new E({id:`${r.id}--${r.entity}--${f.InvalidImplementsReference}`,code:f.InvalidImplementsReference,severity:T.Error,message:`Entity of type "${r.type}" with id "${r.id}", has an 'entity' reference that isn't pointing to an entity of type 'custom-entity', 'primitive-entity', 'action-descriptor' or 'built-in-base-entity'.`,issue:null})):t.push(new E({id:`${r.id}--${r.entity}--${f.ReferencedEntityNotFound}`,code:f.ReferencedEntityNotFound,severity:T.Error,message:`Entity of type "${r.type}" with id "${r.id}", is referencing an entity with id "${r.entity}" that isn't yet found in the project. Perhaps it should be created first. Or perhaps the ID is incorrect.`,issue:null}))}return t}const Ee=class Ee{constructor(e,t){c(this,"initialData");c(this,"id");c(this,"version");c(this,"isNullable");c(this,"isList",null);c(this,"constant");c(this,"asType",null);c(this,"type",n.DataType);c(this,"options");c(this,"parentRelationType");c(this,"like");c(this,"defaultValue",null);c(this,"entity",null);c(this,"andChildrenGroup",null);c(this,"orChildrenGroup",null);c(this,"project");c(this,"errors",[]);c(this,"parent");c(this,"initialized",!1);c(this,"inferred",!1);this.initialData=e,this.project=t,this.id=e.id,this.version=e.version,this.isNullable=e.isNullable,this.isList=e.isList,this.constant=e.constant,this.asType=e.asType,this.options=e.options,this.parentRelationType=e.parentRelationType,this.inferred=e.inferred||!1,this.like=e.like||!1}static fromGenerationTarget(e,t){const i=_(e.parent),a=t.get(i);let s=null;e.entity&&(s=t.get(e.entity));const o={id:e.id,version:1,type:n.DataType,andChildrenGroup:null,orChildrenGroup:null,parentRelationType:e.parentRelationType,isList:e.isList,isNullable:e.isNullable,constant:e.constant,like:e.like||!1,inferred:!1,defaultValue:null,entity:s,asType:e.asType,parent:a},l=R(o,t);return l.setParent(a),l.initChildren(),l}static validateGenerationTarget(e,t){var p;let i=JSON.parse(JSON.stringify(e));const a=[],s=t2(i,t);if(a.push(...s,...Ne(i)),i.entity){const y=t.get(i.entity);if(y.type===n.CustomEntity){const m=Xn(y).filter(b=>!b.interactive);if(m.length){const b=m.length>1?`entities with ids '${F(m.map(v=>v.id),"', '","' and '")}'`:`entity with id '${m[0].id}'`;a.push(new E({id:`${e.id}--${f.NonInteractiveEntityReferenced}`,code:f.NonInteractiveEntityReferenced,severity:T.Error,message:`The entity with id '${e.id}' and type '${e.type}', cannot reference 'custom-entity' with id '${i.entity}' at 'entity'. The entity extends or implements non-interactive built-in-base-entity ${b}.
|
|
32
|
+
Please consider that any updates might affect the overlap with the signature of the parent entity's action descriptors.`,issue:null}))),{errors:t,modifiedData:e}}addSelfToProject(){const e=[this],t=[],i=[];return this.parent===this.project?this.project.addFunctionDeclaration(this):this.parent.type===n.CustomEntity?(this.parent.addMethod(this),e.push(this.parent)):this.parent.type===n.Loop&&(this.parent.setBody(this),e.push(this.parent)),{updated:g(e),added:g(t),removed:g(i),self:this}}replaceDetachedChild(e,t){const i=this.detachedChildren.indexOf(e);return i!==-1&&(this.detachedChildren[i]=t),this}subscribeDetachedChild(e){return this.detachedChildren.includes(e)||this.detachedChildren.push(e),this}addInputDeclaration(e){return this.inputs.includes(e)||this.inputs.push(e),this}removeInputDeclaration(e){const t=this.inputs.indexOf(e);return t!==-1&&this.inputs.splice(t,1),this}setParent(e){return this.parent=e,this}setImplements(e){return this.implements=e,this}addCall(e){return this.calls.includes(e)||this.calls.push(e),this}removeCall(e){const t=this.calls.indexOf(e);return t!==-1&&this.calls.splice(t,1),this}initChildren(){return this.initialized?this:(this.initialized=!0,this.inputs=this.initialData.inputs.map(e=>{const t=R(e,this.project);return t.setParent(this),t.initChildren(),t}),this.calls=this.initialData.calls.map(e=>{const t=R(e,this.project);return t.addEntryCaller(this),[n.BreakStatement,n.ContinueStatement].includes(t.type)?(t.setParent(this.parent),t.initChildren()):t.type!==n.InternalCall&&(t.setParent(this),t.initChildren()),t}),this.returnStatements=this.initialData.returnStatements.map(e=>{const t=R(e,this.project);return t.setParent(this),t.initChildren(),t}),this.initialData.implements&&(this.implements=R(this.initialData.implements,this.project)),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.private=e.private||this.private,this.index=e.index||(e.index!==0?this.index:0),this.collapsed=e.collapsed!==void 0?e.collapsed:this.collapsed,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(o=>{const{affected:l,removed:p}=o.remove({ignoreUpstream:!0,seenEntities:t});i.push(...l),a.push(...p)}),Pt(this).forEach(o=>{const{affected:l,removed:p}=o.remove({ignoreUpstream:!0,seenEntities:t});i.push(...l),a.push(...p)}),{affected:g(i),removed:g(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(a=>{const{affected:s}=a.restore({seenEntities:e});t.push(...s)}),Pt(this).forEach(a=>{const{affected:s}=a.restore({seenEntities:e});t.push(...s)}),{affected:g(t),self:this})}toFlat(e=new Set){if(e.has(this.id))return[];e.add(this.id);const t=Pt(this);return[this,...this.inputs.flatMap(a=>a.toFlat(e)),...this.calls.flatMap(a=>a.toFlat(e)),...this.returnStatements.flatMap(a=>a.toFlat(e)),...this.implements?this.implements.toFlat(e):[],...t.flatMap(a=>a.toFlat(e))]}toFlatIds(e=new Set){if(e.has(this.id))return[];e.add(this.id);const t=Pt(this);return[this.id,...this.inputs.flatMap(a=>a.toFlatIds(e)),...this.calls.flatMap(a=>a.toFlatIds(e)),...this.returnStatements.flatMap(a=>a.toFlatIds(e)),...this.implements?this.implements.toFlatIds(e):[],...t.flatMap(a=>a.toFlatIds(e))]}toJSON(){var e;return{id:this.id,version:this.version,type:this.type,name:this.name,description:this.description,index:this.index,x:this.x,y:this.y,collapsed:this.collapsed,private:this.private,parent:this.parent.toReference(),calls:this.calls.map(t=>t.toJSON()),inputs:this.inputs.map(t=>t.toJSON()),implements:((e=this.implements)==null?void 0:e.toJSON())||null,returnStatements:this.returnStatements.map(t=>t.toJSON())}}toReference(){return{id:this.id+"--"+N.UUID.uuid()+"--ref",type:n.GenericReference,entityId:this.id,entityType:this.type}}toShallowJSON(){var e;return{id:this.id,version:this.version,type:this.type,name:this.name,description:this.description,index:this.index,collapsed:this.collapsed,private:this.private,x:this.x,y:this.y,inputs:this.inputs.map(t=>t.toReference()),calls:this.calls.map(t=>t.toReference()),returnStatements:this.returnStatements.map(t=>t.toReference()),implements:((e=this.implements)==null?void 0:e.toReference())||null,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.calls.flatMap(i=>i.toFlatJSON(e)),...this.returnStatements.flatMap(i=>i.toFlatJSON(e)),...this.implements?this.implements.toFlatJSON(e):[]])}toGenerationTarget(){var t;const e=this.parent.type===n.Project?void 0:this.parent.id;return{id:this.id,name:this.name,description:this.description,type:this.type,private:this.private,implements:((t=this.implements)==null?void 0:t.id)||null,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.calls.flatMap(i=>i.toFlatGenerationTarget(e)),...this.returnStatements.flatMap(i=>i.toFlatGenerationTarget(e))])}clearErrors(){return this.errors=[],this.inputs.forEach(e=>e.clearErrors()),this.calls.forEach(e=>e.clearErrors()),this.returnStatements.forEach(e=>e.clearErrors()),this}validate(){const e=Kk(this);return this.errors=[...e],{success:!0,error:null,data:this.toJSON()}}getErrors(){const e=Pt(this);return[...this.errors,...this.inputs.flatMap(i=>i.getErrors()),...e.flatMap(i=>i.getErrors())]}getShallowErrors(){return this.errors}clone(e=null,t=null,i=!0,a=!1){var m;const s=this.toJSON(),o=t||He(C(this,this.project),n.FunctionDeclaration,this.project);s.inputs=[];const l=o.split("-id"),p=l[l.length-1||0]||o;s.id=o;const y=xt(s,this.project);e?y.setParent(e):y.setParent(this.parent),i&&y.subscribe(),y.initChildren();const h=(m=this.inputs)==null?void 0:m.map((b,v)=>b.clone(this,p+"-argument-declaration-"+v+"-id",i));return y.inputs=h,y}getVariableInstances(){return ie(this).filter(i=>i.type===n.VariableInstance)}getArgument(e){return this.inputs.find(t=>t.id===e)||null}createCall(e=this.project,t={}){const i={id:t.id||N.UUID.uuid(),version:t.version||1,type:n.FunctionCall,parent:e.toReference(),successCalls:t.successCalls||[],errorCalls:t.errorCalls||[],inputs:t.inputs||[],outputs:t.outputs||[],error:t.error||null,process:t.process||null,calledBySuccess:t.calledBySuccess||[],calledByError:t.calledByError||[],calledByEntry:t.calledByEntry||[],declaration:this.toJSON(),x:0,y:0},a=R(i,this.project);return a.setParent(e),a.initChildren(),e===this.project&&this.project.addFunctionCall(a),a}createInternalCall(e,t={}){const i={id:t.id||N.UUID.uuid(),version:t.version||1,type:n.InternalCall,parent:e.toReference(),successCalls:t.successCalls||[],errorCalls:t.errorCalls||[],inputs:t.inputs||[],outputs:t.outputs||[],error:t.error||null,process:t.process||null,calledBySuccess:t.calledBySuccess||[],calledByError:t.calledByError||[],calledByEntry:t.calledByEntry||[],declaration:this.toShallowJSON(),index:e.internalCalls.length},a=R(i,this.project);return a.setParent(e),a.initChildren(),a}addReturnStatement(e){return this.returnStatements.includes(e)||this.returnStatements.push(e),this}removeReturnStatement(e){const t=this.returnStatements.indexOf(e);return t!==-1&&this.returnStatements.splice(t,1),this}};c(Te,"MUTABLE_BASE_PROPERTIES",["name","description","private"]),c(Te,"INMUTABLE_BASE_PROPERTIES",["id","version","type"]),c(Te,"BASE_PROPERTIES",[...Te.MUTABLE_BASE_PROPERTIES,...Te.INMUTABLE_BASE_PROPERTIES]),c(Te,"MUTABLE_META_PROPERTIES",[...Te.MUTABLE_BASE_PROPERTIES,"x","y","index","collapsed"]),c(Te,"INMUTABLE_META_PROPERTIES",[...Te.INMUTABLE_BASE_PROPERTIES]),c(Te,"META_PROPERTIES",[...Te.MUTABLE_META_PROPERTIES,...Te.INMUTABLE_META_PROPERTIES]),c(Te,"MUTABLE_UPSTREAM_PROPERTIES",[]),c(Te,"INMUATABLE_UPSTREAM_PROPERTIES",["parent","implements"]),c(Te,"UPSTREAM_PROPERTIES",[...Te.MUTABLE_UPSTREAM_PROPERTIES,...Te.INMUATABLE_UPSTREAM_PROPERTIES]),c(Te,"MUTABLE_DOWNSTREAM_PROPERTIES",["inputs","calls","returnStatements"]),c(Te,"INMUATABLE_DOWNSTREAM_PROPERTIES",[]),c(Te,"DOWNSTREAM_PROPERTIES",[...Te.MUTABLE_DOWNSTREAM_PROPERTIES,...Te.INMUATABLE_DOWNSTREAM_PROPERTIES]),c(Te,"PROPERTIES",[...Te.META_PROPERTIES,...Te.UPSTREAM_PROPERTIES,...Te.DOWNSTREAM_PROPERTIES]);let Cr=Te;function e2(r){const e=$6(),t=r.toJSON();e.safeParse(t).success;const a=[];if(r.entity&&r.andChildrenGroup||r.entity&&r.orChildrenGroup||r.andChildrenGroup&&r.orChildrenGroup){const s=z({id:r.id+"--"+M.InvalidPropertiesCombination,message:`Data type with id "${r.id}" has invalid properties combination. Only one of the following properties can be present at the time: 'entity', 'andChildrenGroup' or 'orChildrenGroup'`,issue:null,severity:T.Error,code:M.InvalidPropertiesCombination,entity:r});a.push(s.error)}return ae(r.errors,a)}function t2(r,e){const t=[],i=[n.CustomEntity,n.ActionDescriptor,n.Property,n.ArgumentDeclaration,n.ReturnDeclaration,n.VariableDeclaration,n.ValueDescriptor,n.DataType],a=`'${U(i,"', '","' or '")}'`;if(r.parent)if(r.id===r.parent)t.push(new E({id:`${r.id}--${r.parent}--${f.SelfReference}`,code:f.SelfReference,severity:T.Error,message:`Entity of type "${r.type}" with id "${r.id}", has a reference to itself at 'parent'. This is not allowed. Change the reference string or the 'entityId' property of the reference object.`,issue:null}));else{const s=e.get(r.parent);s?i.includes(s.type)||t.push(new E({id:`${r.id}--${r.parent}--${f.InvalidParentReference}`,code:f.InvalidParentReference,severity:T.Error,message:`Entity of type "${r.type}" with id "${r.id}", has a parent reference that isn't pointing to an entity of type ${a}.`,issue:null})):t.push(new E({id:`${r.id}--${r.parent}--${f.ReferencedEntityNotFound}`,code:f.ReferencedEntityNotFound,severity:T.Error,message:`Entity of type "${r.type}" with id "${r.id}", is referencing an entity with id "${r.parent}" that isn't yet found in the project. Perhaps it should be created first. Or perhaps the ID is incorrect.`,issue:null}))}else t.push(new E({id:`${r.id}--${S.InvalidObjectStructure}`,code:S.InvalidObjectStructure,severity:T.Error,message:`Entity of type "${r.type}" with id "${r.id}" is missing a 'parent' reference. The 'parent' of a 'data-type' entity must be a reference to an entity of type ${a}.`,issue:null}));if(r.entity){if(r.id===r.entity)return t.push(new E({id:`${r.id}--${r.entity}--${f.SelfReference}`,code:f.SelfReference,severity:T.Error,message:`Entity of type "${r.type}" with id "${r.id}", has a reference to itself at 'entity'. This is not allowed. Change the reference string or the 'entityId' property of the reference object.`,issue:null})),t;const s=e.get(r.entity);s?[n.CustomEntity,n.PrimitiveEntity,n.ActionDescriptor,n.BuiltInBaseEntity].includes(s.type)||t.push(new E({id:`${r.id}--${r.entity}--${f.InvalidImplementsReference}`,code:f.InvalidImplementsReference,severity:T.Error,message:`Entity of type "${r.type}" with id "${r.id}", has an 'entity' reference that isn't pointing to an entity of type 'custom-entity', 'primitive-entity', 'action-descriptor' or 'built-in-base-entity'.`,issue:null})):t.push(new E({id:`${r.id}--${r.entity}--${f.ReferencedEntityNotFound}`,code:f.ReferencedEntityNotFound,severity:T.Error,message:`Entity of type "${r.type}" with id "${r.id}", is referencing an entity with id "${r.entity}" that isn't yet found in the project. Perhaps it should be created first. Or perhaps the ID is incorrect.`,issue:null}))}return t}const Ee=class Ee{constructor(e,t){c(this,"initialData");c(this,"id");c(this,"version");c(this,"isNullable");c(this,"isList",null);c(this,"constant");c(this,"asType",null);c(this,"type",n.DataType);c(this,"options");c(this,"parentRelationType");c(this,"like");c(this,"defaultValue",null);c(this,"entity",null);c(this,"andChildrenGroup",null);c(this,"orChildrenGroup",null);c(this,"project");c(this,"errors",[]);c(this,"parent");c(this,"initialized",!1);c(this,"inferred",!1);this.initialData=e,this.project=t,this.id=e.id,this.version=e.version,this.isNullable=e.isNullable,this.isList=e.isList,this.constant=e.constant,this.asType=e.asType,this.options=e.options,this.parentRelationType=e.parentRelationType,this.inferred=e.inferred||!1,this.like=e.like||!1}static fromGenerationTarget(e,t){const i=_(e.parent),a=t.get(i);let s=null;e.entity&&(s=t.get(e.entity));const o={id:e.id,version:1,type:n.DataType,andChildrenGroup:null,orChildrenGroup:null,parentRelationType:e.parentRelationType,isList:e.isList,isNullable:e.isNullable,constant:e.constant,like:e.like||!1,inferred:!1,defaultValue:null,entity:s,asType:e.asType,parent:a},l=R(o,t);return l.setParent(a),l.initChildren(),l}static validateGenerationTarget(e,t){var p;let i=JSON.parse(JSON.stringify(e));const a=[],s=t2(i,t);if(a.push(...s,...Ne(i)),i.entity){const y=t.get(i.entity);if(y.type===n.CustomEntity){const m=Xn(y).filter(b=>!b.interactive);if(m.length){const b=m.length>1?`entities with ids '${U(m.map(v=>v.id),"', '","' and '")}'`:`entity with id '${m[0].id}'`;a.push(new E({id:`${e.id}--${f.NonInteractiveEntityReferenced}`,code:f.NonInteractiveEntityReferenced,severity:T.Error,message:`The entity with id '${e.id}' and type '${e.type}', cannot reference 'custom-entity' with id '${i.entity}' at 'entity'. The entity extends or implements non-interactive built-in-base-entity ${b}.
|
|
33
33
|
${Zn}`,issue:null}))}}}const o=i.parent&&t.get(i.parent)||t.getBuiltIn(i.parent),l=o?Qn(o):null;if(l)a.push(new E({id:`${e.id}--${f.BuiltInEntityParent}`,code:f.BuiltInEntityParent,severity:T.Error,message:`The entity with id '${e.id}' and type '${e.type}', belongs to a built-in system entity "${C(l,t)}" with id '${l.id}', and therefore it cannot be created as it would affect a built in entity, which are inmutable.`,issue:null}));else if(o){const y=o.type,h=[n.Property,n.VariableDeclaration,n.ArgumentDeclaration,n.ReturnDeclaration,n.ValueDescriptor];if(h.includes(y)&&(i.parentRelationType&&a.push(new E({id:`${e.id}--${f.InvalidParentRelationType}`,code:f.InvalidParentRelationType,severity:T.Error,message:`The entity with id '${e.id}' and type '${e.type}', cannot have a 'parentRelationType' property set of type '${y}'.
|
|
34
|
-
The entitities of type '${
|
|
35
|
-
The entitities of type '${
|
|
34
|
+
The entitities of type '${U(h,"', '","' and '")}' can only have one 'data-type' child under the 'dataType' property so no 'parentRelationType' is needed.`,issue:null})),o.dataType)){const m=(p=o.dataType)==null?void 0:p.id;a.push(new E({id:`${e.id}--${f.NewEntityWouldOverriteExisting}`,code:f.NewEntityWouldOverriteExisting,severity:T.Error,message:`The entity with id '${e.id}' and type '${e.type}', cannot be added as a child to the entity with id '${i.parent}' and type '${y}', because it already has a 'data-type' child with id '${m}'.
|
|
35
|
+
The entitities of type '${U(h,"', '","' and '")}' can only have one 'data-type' child under the 'dataType' property. You can inspect the existing data-type entity with the 'describe_entity' action. Like so:
|
|
36
36
|
${on({describe_entity:m})}
|
|
37
|
-
Alternatively you can update the entity with 'update' action. Or replace it by first removing it and then creating a new one.`,issue:null}))}y===n.DataType&&(!i.parentRelationType||!(i.parentRelationType===ze.AndDataTypeGroup||i.parentRelationType===ze.OrDataTypeGroup))&&a.push(new E({id:`${e.id}--${f.InvalidParentRelationType}`,code:f.InvalidParentRelationType,severity:T.Error,message:`The entity with id '${e.id}' and type '${e.type}', must have a 'parentRelationType' property set to either 'or-data-type-group' or 'and-data-type-group' when being added as a child to an entity of type 'data-type'.`,issue:null}))}return{errors:a,modifiedData:i}}validateGeneratedUpdate(e){return{errors:[],modifiedData:e}}addSelfToProject(){const e=[this],t=[],i=[];return this.parent.type===n.DataType?this.parentRelationType===ze.AndDataTypeGroup?this.parent.addToAndGroup(this):this.parentRelationType===ze.OrDataTypeGroup&&this.parent.addToOrGroup(this):this.parent.setDataType(this),e.push(this.parent),{updated:g(e),added:g(t),removed:g(i),self:this}}setParent(e){return this.parent=e,this}removeChildGroup(e){if(this.andChildrenGroup){const t=this.andChildrenGroup.findIndex(i=>i.id===e.id);t!==-1&&this.andChildrenGroup.splice(t,1)}if(this.orChildrenGroup){const t=this.orChildrenGroup.findIndex(i=>i.id===e.id);t!==-1&&this.orChildrenGroup.splice(t,1)}return this}initChildren(){if(this.initialized)return this;if(this.initialized=!0,this.initialData.defaultValue&&(this.defaultValue=R(this.initialData.defaultValue,this.project),this.defaultValue.setParent(this),this.defaultValue.initChildren()),this.initialData.entity)if(this.initialData.entity.type===n.GenericReference){const e=this.project.findSubscribedInstanceFromReference(this.initialData.entity);this.entity=e}else this.entity=R(this.initialData.entity,this.project);return this.initialData.andChildrenGroup&&(this.andChildrenGroup=this.initialData.andChildrenGroup.map(e=>R(e,this.project))),this.initialData.orChildrenGroup&&(this.orChildrenGroup=this.initialData.orChildrenGroup.map(e=>R(e,this.project))),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.isNullable=e.isNullable||this.isNullable,this.isList=e.isList||this.isList,this.constant=e.constant||this.constant,this.asType=e.asType||this.asType,this.options=e.options||this.options,this.parentRelationType=e.parentRelationType||this.parentRelationType,this.like=e.like||this.like,this.inferred=e.inferred||this.inferred,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.defaultValue){const{affected:s,removed:o}=this.defaultValue.remove({ignoreUpstream:!0,seenEntities:t});i.push(...s),a.push(...o)}if(this.entity&&this.entity.type===n.CustomEntity&&this.entity.parent===this){const{affected:s,removed:o}=this.entity.remove({ignoreUpstream:!0,seenEntities:t});i.push(...s),a.push(...o)}if(!e){this.parent.type===n.DataType&&this.parent.removeChildGroup(this);const s=this.parent;if(s.type===n.DataType){if(this.parentRelationType===ze.AndDataTypeGroup){if(Array.isArray(s.andChildrenGroup)){const o=s.andChildrenGroup.findIndex(l=>l.id===this.id);o!==-1&&s.andChildrenGroup.splice(o,1)}}else if(this.parentRelationType===ze.OrDataTypeGroup&&Array.isArray(s.orChildrenGroup)){const o=s.orChildrenGroup.findIndex(l=>l.id===this.id);o!==-1&&s.orChildrenGroup.splice(o,1)}}else this.parent.removeDataType();i.push(s)}return{affected:g(i),removed:g(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.defaultValue){const{affected:i}=this.defaultValue.restore({seenEntities:e});t.push(...i)}if(this.entity&&this.entity.type===n.CustomEntity&&this.entity.parent===this){const{affected:i}=this.entity.restore({seenEntities:e});t.push(...i)}if(this.parent.type===n.DataType){const i=this.parent;Array.isArray(i.andChildrenGroup)&&i.andChildrenGroup.push(this)}if(this.parent.type===n.DataType){const i=this.parent;this.parentRelationType===ze.AndDataTypeGroup?Array.isArray(i.andChildrenGroup)&&i.andChildrenGroup.push(this):this.parentRelationType===ze.OrDataTypeGroup&&Array.isArray(i.orChildrenGroup)&&i.orChildrenGroup.push(this)}else{const i=this.parent;i.setDataType(this),t.push(i)}return{affected:t,self:this}}toFlat(e=new Set){var i,a,s;return e.has(this.id)?[]:(e.add(this.id),[this,...((i=this.andChildrenGroup)==null?void 0:i.flatMap(o=>o.toFlat(e)))||[],...((a=this.orChildrenGroup)==null?void 0:a.flatMap(o=>o.toFlat(e)))||[],...((s=this.entity)==null?void 0:s.toFlat(e))||[]])}toFlatIds(e=new Set){var i,a,s;return e.has(this.id)?[]:(e.add(this.id),[this.id,...((i=this.andChildrenGroup)==null?void 0:i.flatMap(o=>o.toFlatIds(e)))||[],...((a=this.orChildrenGroup)==null?void 0:a.flatMap(o=>o.toFlatIds(e)))||[],...((s=this.entity)==null?void 0:s.toFlatIds(e))||[]])}toJSON(){var e,t,i,a;return{id:this.id,version:this.version,type:this.type,isNullable:this.isNullable,options:this.options,isList:this.isList,constant:this.constant,asType:this.asType,defaultValue:((e=this.defaultValue)==null?void 0:e.toJSON())||null,like:this.like,parentRelationType:this.parentRelationType,andChildrenGroup:((t=this.andChildrenGroup)==null?void 0:t.map(s=>s.toJSON()))||null,orChildrenGroup:((i=this.orChildrenGroup)==null?void 0:i.map(s=>s.toJSON()))||null,entity:((a=this.entity)==null?void 0:a.toReference())||null,parent:this.parent.toReference()}}toReference(){return{id:this.id+"--"+N.UUID.uuid()+"--ref",type:n.GenericReference,entityId:this.id,entityType:this.type}}toShallowJSON(){var e,t,i,a;return{id:this.id,version:this.version,type:this.type,isList:this.isList,isNullable:this.isNullable,options:this.options,constant:this.constant,asType:this.asType,parentRelationType:this.parentRelationType,like:this.like,inferred:this.inferred,defaultValue:((e=this.defaultValue)==null?void 0:e.toReference())||null,andChildrenGroup:((t=this.andChildrenGroup)==null?void 0:t.map(s=>s.toReference()))||null,orChildrenGroup:((i=this.orChildrenGroup)==null?void 0:i.map(s=>s.toReference()))||null,entity:((a=this.entity)==null?void 0:a.toReference())||null,parent:this.parent.toReference()}}toFlatJSON(e=new Set){var i,a,s,o;return e.has(this.id)?[]:(e.add(this.id),[this.toShallowJSON(),...((i=this.defaultValue)==null?void 0:i.toFlatJSON(e))||[],...((a=this.andChildrenGroup)==null?void 0:a.flatMap(l=>l.toFlatJSON(e)))||[],...((s=this.orChildrenGroup)==null?void 0:s.flatMap(l=>l.toFlatJSON(e)))||[],...((o=this.entity)==null?void 0:o.toFlatJSON(e))||[]])}toGenerationTarget(){var e;return{id:this.id,type:this.type,isNullable:this.isNullable,options:this.options,isList:this.isList,constant:this.constant,like:this.like,parentRelationType:this.parentRelationType,asType:this.asType,entity:((e=this.entity)==null?void 0:e.id)||null,parent:this.parent.id}}toFlatGenerationTarget(e=new Set){var i,a,s;return e.has(this.id)?[]:(e.add(this.id),[this.toGenerationTarget(),...((i=this.defaultValue)==null?void 0:i.toFlatGenerationTarget(e))||[],...((a=this.andChildrenGroup)==null?void 0:a.flatMap(o=>o.toFlatGenerationTarget(e)))||[],...((s=this.orChildrenGroup)==null?void 0:s.flatMap(o=>o.toFlatGenerationTarget(e)))||[],...this.entity&&this.entity.type==n.CustomEntity&&this.entity.parent===this&&this.entity.toFlatGenerationTarget(e)||[]])}clearErrors(){var e,t,i,a;return this.errors=[],(e=this.defaultValue)==null||e.clearErrors(),(t=this.andChildrenGroup)==null||t.forEach(s=>s.clearErrors()),(i=this.orChildrenGroup)==null||i.forEach(s=>s.clearErrors()),this.inferred&&((a=this.entity)==null||a.clearErrors()),this}validate(){const e=e2(this);return this.errors=e,{success:!0,error:null,data:this.toJSON()}}getErrors(){return[...this.errors]}getShallowErrors(){return this.errors}clone(e=null,t=null,i=!0){var b,v,P,A;const a=this.toJSON(),s=t||He(lu(this),n.DataType,this.project),o=s.split("-id"),l=o[o.length-1||0]||s;a.id=s;const p=xt(a,this.project);e&&p.setParent(e),i&&p.subscribe(),p.initChildren();const y=(b=this.defaultValue)==null?void 0:b.clone(p,l+"-default-value-id",i);p.defaultValue=y||null;const h=(v=this.andChildrenGroup)==null?void 0:v.map((I,$)=>I.clone(this,l+"-and-group-data-type-"+$+"-id",i)),m=(P=this.orChildrenGroup)==null?void 0:P.map((I,$)=>I.clone(this,l+"-or-group-data-type-"+$+"-id",i));if(p.andChildrenGroup=h||null,p.orChildrenGroup=m||null,this.entity&&this.entity.type===n.CustomEntity&&((A=this.entity)==null?void 0:A.parent)===this){const I=this.entity.clone(p,l+"-inferred-entity-id",i);p.setEntity(I)}else this.entity&&p.setEntity(this.entity);return p}merge(e){const t=[],i=[],a=[];if(this.asType!==(e==null?void 0:e.asType)&&(this.sync({asType:e==null?void 0:e.asType}),t.push(this)),this.isNullable!==(e==null?void 0:e.isNullable)&&(this.sync({isNullable:e==null?void 0:e.isNullable}),t.push(this)),this.isList!==!(e!=null&&e.isList)&&(this.sync({isList:e==null?void 0:e.isList}),t.push(this)),this.constant!==(e==null?void 0:e.constant)&&(this.sync({constant:e==null?void 0:e.constant}),t.push(this)),this.like!==(e==null?void 0:e.like)&&(this.sync({like:e==null?void 0:e.like}),t.push(this)),e!=null&&e.inferred){if(e.entity&&e.entity.type===n.CustomEntity&&e.entity.parent===e){const s=e.entity.clone(this,this.id+"--inferred-entity-id",!0);this.setEntity(s),i.push(s)}else e.entity&&(this.setEntity(e.entity),t.push(this));this.inferred||(this.sync({inferred:!0}),t.push(this))}else if(this.inferred){if(this.sync({inferred:!1}),t.push(this),this.entity&&this.entity.type===n.CustomEntity&&this.entity.parent===this){const{affected:s,removed:o}=this.entity.remove({ignoreUpstream:!0,seenEntities:new Set});a.push(...o),s.push(...s)}e.entity!==this.entity&&(this.setEntity(e.entity),t.push(this))}else e.entity!==this.entity&&(this.setEntity(e.entity),t.push(this));if(e.defaultValue)if(this.defaultValue){const{updated:s,added:o,removed:l}=this.defaultValue.merge(e.defaultValue);t.push(...s),i.push(...o),a.push(...l)}else{const s=e.defaultValue.clone(this,this.id+"--default-value-id",!0);this.setDefaultValue(s),i.push(s)}else if(this.defaultValue){const{affected:s,removed:o}=this.defaultValue.remove({ignoreUpstream:!0,seenEntities:new Set});a.push(...o),s.push(...s)}return{updated:g(t),added:g(i),removed:g(a),self:this}}addToAndGroup(e){return this.andChildrenGroup||(this.andChildrenGroup=[]),this.andChildrenGroup.includes(e)||this.andChildrenGroup.push(e),this}addToOrGroup(e){return this.orChildrenGroup||(this.orChildrenGroup=[]),this.orChildrenGroup.includes(e)||this.orChildrenGroup.push(e),this}getDefaultValue(){return this.defaultValue}setDefaultValue(e){return this.defaultValue=e,this}setEntity(e){return this.entity=e,this}isResolved(){return[n.BuiltInBaseEntity,n.ActionDescriptor].includes(this.parent.type)||Qn(this.parent)?!0:!(!this.entity&&(!this.andChildrenGroup||!this.andChildrenGroup.length)&&(!this.orChildrenGroup||!this.orChildrenGroup.length))}isObject(){return!!this.entity&&(this.entity.type===n.CustomEntity||this.entity.name===D.JSON)}hasStrictObjectStructure(){var e;return this.isObject()&&((e=this.entity)==null?void 0:e.type)===n.CustomEntity}inferFromInputs(e){var t;if(!this.inferred)return this;if(!this.entity&&e.length){const i={id:this.id+"--infered-entity",type:n.CustomEntity,version:1,name:C(this,this.project),description:((t=this.parent)==null?void 0:t.description)||null,static:!0,abstract:!1,properties:[],methods:[],extends:[],implements:[],abstractMethods:[],x:0,y:0,parent:this.toReference()},a=R(i,this.project);a.sync(i),a.setParent(this),a.initChildren(),this.setEntity(a)}return this.entity&&this.entity.inferFromInputs(e),this.like||this.sync({like:!0}),this}};c(Ee,"MUTABLE_BASE_PROPERTIES",["isNullable","isList","constant","asType","options","parentRelationType","like"]),c(Ee,"INMUTABLE_BASE_PROPERTIES",["id","version","type"]),c(Ee,"BASE_PROPERTIES",[...Ee.MUTABLE_BASE_PROPERTIES,...Ee.INMUTABLE_BASE_PROPERTIES]),c(Ee,"MUTABLE_META_PROPERTIES",[...Ee.MUTABLE_BASE_PROPERTIES,"inferred"]),c(Ee,"INMUTABLE_META_PROPERTIES",[...Ee.INMUTABLE_BASE_PROPERTIES]),c(Ee,"META_PROPERTIES",[...Ee.MUTABLE_META_PROPERTIES,...Ee.INMUTABLE_META_PROPERTIES]),c(Ee,"MUTABLE_UPSTREAM_PROPERTIES",["entity","andChildrenGroup","orChildrenGroup","parent"]),c(Ee,"INMUTABLE_UPSTREAM_PROPERTIES",[]),c(Ee,"UPSTREAM_PROPERTIES",[...Ee.MUTABLE_UPSTREAM_PROPERTIES,...Ee.INMUTABLE_UPSTREAM_PROPERTIES]),c(Ee,"MUTABLE_DOWNSTREAM_PROPERTIES",["defaultValue"]),c(Ee,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),c(Ee,"DOWNSTREAM_PROPERTIES",[...Ee.MUTABLE_DOWNSTREAM_PROPERTIES,...Ee.INMUTABLE_DOWNSTREAM_PROPERTIES]),c(Ee,"PROPERTIES",[...Ee.META_PROPERTIES,...Ee.UPSTREAM_PROPERTIES,...Ee.DOWNSTREAM_PROPERTIES]);let Ii=Ee;function n2(r){var l;const e=b6(),t=r.toJSON();e.safeParse(t).success;const a=r2(r),s=Sn(r),o=[...a,...s];if(r.id==="exec-sequentially-operation-call-id"){const p=z({id:`${r.id}--${M.PropertyImplementsNonAbstact}`,message:`Property "${C(r,r.project)}" with id "${r.id}" implements a non-abstract property "${C(r,r.project)}" with id "${r.id}".`,issue:null,severity:T.Error,code:M.PropertyImplementsNonAbstact,entity:r});o.push(p.error)}return r.outputs.forEach(p=>p.validate()),(l=r.error)==null||l.validate(),ae(r.errors,o)}function r2(r){const e=[];return r.inputs.forEach(t=>{t.validate()}),ae(r.errors,e)}const le=class le{constructor(e,t){c(this,"initialData");c(this,"id");c(this,"version");c(this,"x");c(this,"y");c(this,"type",n.Operation);c(this,"declaration");c(this,"inputs",[]);c(this,"outputs",[]);c(this,"process",null);c(this,"successCalls",[]);c(this,"errorCalls",[]);c(this,"error",null);c(this,"calledBySuccess",[]);c(this,"calledByError",[]);c(this,"calledByEntry",[]);c(this,"parent");c(this,"errors",[]);c(this,"project");c(this,"initialized",!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 m=_(e.parent);i=t.get(m)}const a=_(e.declaration),s=t.get(a),o=e.calledByEntry.map(m=>{const b=_(m);return t.get(b)}),l=e.calledBySuccess.map(m=>{const b=_(m);return t.get(b)}),p=e.calledByError.map(m=>{const b=_(m);return t.get(b)}),y={id:e.id,version:1,type:n.Operation,declaration:s,calledByEntry:o,calledBySuccess:l,calledByError:p,errorCalls:[],successCalls:[],inputs:[],outputs:[],process:null,error:null,x:0,y:0,parent:i},h=R(y,t);return h.setParent(i),h.initChildren(),h}static validateGenerationTarget(e,t){let i=JSON.parse(JSON.stringify(e));const a=[],s=Je(i,{parent:{list:!1,types:[...ct,n.Project],optional:!0}},t);i=s.modifiedData,a.push(...s.errors,...Ne(i));const o=_(i.declaration);if(o){const l=ZP(o,t);a.push(...l)}else{const l=`
|
|
37
|
+
Alternatively you can update the entity with 'update' action. Or replace it by first removing it and then creating a new one.`,issue:null}))}y===n.DataType&&(!i.parentRelationType||!(i.parentRelationType===ze.AndDataTypeGroup||i.parentRelationType===ze.OrDataTypeGroup))&&a.push(new E({id:`${e.id}--${f.InvalidParentRelationType}`,code:f.InvalidParentRelationType,severity:T.Error,message:`The entity with id '${e.id}' and type '${e.type}', must have a 'parentRelationType' property set to either 'or-data-type-group' or 'and-data-type-group' when being added as a child to an entity of type 'data-type'.`,issue:null}))}return{errors:a,modifiedData:i}}validateGeneratedUpdate(e){return{errors:[],modifiedData:e}}addSelfToProject(){const e=[this],t=[],i=[];return this.parent.type===n.DataType?this.parentRelationType===ze.AndDataTypeGroup?this.parent.addToAndGroup(this):this.parentRelationType===ze.OrDataTypeGroup&&this.parent.addToOrGroup(this):this.parent.setDataType(this),e.push(this.parent),{updated:g(e),added:g(t),removed:g(i),self:this}}setParent(e){return this.parent=e,this}removeChildGroup(e){if(this.andChildrenGroup){const t=this.andChildrenGroup.findIndex(i=>i.id===e.id);t!==-1&&this.andChildrenGroup.splice(t,1)}if(this.orChildrenGroup){const t=this.orChildrenGroup.findIndex(i=>i.id===e.id);t!==-1&&this.orChildrenGroup.splice(t,1)}return this}initChildren(){if(this.initialized)return this;if(this.initialized=!0,this.initialData.defaultValue&&(this.defaultValue=R(this.initialData.defaultValue,this.project),this.defaultValue.setParent(this),this.defaultValue.initChildren()),this.initialData.entity)if(this.initialData.entity.type===n.GenericReference){const e=this.project.findSubscribedInstanceFromReference(this.initialData.entity);this.entity=e}else this.entity=R(this.initialData.entity,this.project);return this.initialData.andChildrenGroup&&(this.andChildrenGroup=this.initialData.andChildrenGroup.map(e=>R(e,this.project))),this.initialData.orChildrenGroup&&(this.orChildrenGroup=this.initialData.orChildrenGroup.map(e=>R(e,this.project))),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.isNullable=e.isNullable||this.isNullable,this.isList=e.isList||this.isList,this.constant=e.constant||this.constant,this.asType=e.asType||this.asType,this.options=e.options||this.options,this.parentRelationType=e.parentRelationType||this.parentRelationType,this.like=e.like||this.like,this.inferred=e.inferred||this.inferred,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.defaultValue){const{affected:s,removed:o}=this.defaultValue.remove({ignoreUpstream:!0,seenEntities:t});i.push(...s),a.push(...o)}if(this.entity&&this.entity.type===n.CustomEntity&&this.entity.parent===this){const{affected:s,removed:o}=this.entity.remove({ignoreUpstream:!0,seenEntities:t});i.push(...s),a.push(...o)}if(!e){this.parent.type===n.DataType&&this.parent.removeChildGroup(this);const s=this.parent;if(s.type===n.DataType){if(this.parentRelationType===ze.AndDataTypeGroup){if(Array.isArray(s.andChildrenGroup)){const o=s.andChildrenGroup.findIndex(l=>l.id===this.id);o!==-1&&s.andChildrenGroup.splice(o,1)}}else if(this.parentRelationType===ze.OrDataTypeGroup&&Array.isArray(s.orChildrenGroup)){const o=s.orChildrenGroup.findIndex(l=>l.id===this.id);o!==-1&&s.orChildrenGroup.splice(o,1)}}else this.parent.removeDataType();i.push(s)}return{affected:g(i),removed:g(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.defaultValue){const{affected:i}=this.defaultValue.restore({seenEntities:e});t.push(...i)}if(this.entity&&this.entity.type===n.CustomEntity&&this.entity.parent===this){const{affected:i}=this.entity.restore({seenEntities:e});t.push(...i)}if(this.parent.type===n.DataType){const i=this.parent;Array.isArray(i.andChildrenGroup)&&i.andChildrenGroup.push(this)}if(this.parent.type===n.DataType){const i=this.parent;this.parentRelationType===ze.AndDataTypeGroup?Array.isArray(i.andChildrenGroup)&&i.andChildrenGroup.push(this):this.parentRelationType===ze.OrDataTypeGroup&&Array.isArray(i.orChildrenGroup)&&i.orChildrenGroup.push(this)}else{const i=this.parent;i.setDataType(this),t.push(i)}return{affected:t,self:this}}toFlat(e=new Set){var i,a,s;return e.has(this.id)?[]:(e.add(this.id),[this,...((i=this.andChildrenGroup)==null?void 0:i.flatMap(o=>o.toFlat(e)))||[],...((a=this.orChildrenGroup)==null?void 0:a.flatMap(o=>o.toFlat(e)))||[],...((s=this.entity)==null?void 0:s.toFlat(e))||[]])}toFlatIds(e=new Set){var i,a,s;return e.has(this.id)?[]:(e.add(this.id),[this.id,...((i=this.andChildrenGroup)==null?void 0:i.flatMap(o=>o.toFlatIds(e)))||[],...((a=this.orChildrenGroup)==null?void 0:a.flatMap(o=>o.toFlatIds(e)))||[],...((s=this.entity)==null?void 0:s.toFlatIds(e))||[]])}toJSON(){var e,t,i,a;return{id:this.id,version:this.version,type:this.type,isNullable:this.isNullable,options:this.options,isList:this.isList,constant:this.constant,asType:this.asType,defaultValue:((e=this.defaultValue)==null?void 0:e.toJSON())||null,like:this.like,parentRelationType:this.parentRelationType,andChildrenGroup:((t=this.andChildrenGroup)==null?void 0:t.map(s=>s.toJSON()))||null,orChildrenGroup:((i=this.orChildrenGroup)==null?void 0:i.map(s=>s.toJSON()))||null,entity:((a=this.entity)==null?void 0:a.toReference())||null,parent:this.parent.toReference()}}toReference(){return{id:this.id+"--"+N.UUID.uuid()+"--ref",type:n.GenericReference,entityId:this.id,entityType:this.type}}toShallowJSON(){var e,t,i,a;return{id:this.id,version:this.version,type:this.type,isList:this.isList,isNullable:this.isNullable,options:this.options,constant:this.constant,asType:this.asType,parentRelationType:this.parentRelationType,like:this.like,inferred:this.inferred,defaultValue:((e=this.defaultValue)==null?void 0:e.toReference())||null,andChildrenGroup:((t=this.andChildrenGroup)==null?void 0:t.map(s=>s.toReference()))||null,orChildrenGroup:((i=this.orChildrenGroup)==null?void 0:i.map(s=>s.toReference()))||null,entity:((a=this.entity)==null?void 0:a.toReference())||null,parent:this.parent.toReference()}}toFlatJSON(e=new Set){var i,a,s,o;return e.has(this.id)?[]:(e.add(this.id),[this.toShallowJSON(),...((i=this.defaultValue)==null?void 0:i.toFlatJSON(e))||[],...((a=this.andChildrenGroup)==null?void 0:a.flatMap(l=>l.toFlatJSON(e)))||[],...((s=this.orChildrenGroup)==null?void 0:s.flatMap(l=>l.toFlatJSON(e)))||[],...((o=this.entity)==null?void 0:o.toFlatJSON(e))||[]])}toGenerationTarget(){var e;return{id:this.id,type:this.type,isNullable:this.isNullable,options:this.options,isList:this.isList,constant:this.constant,like:this.like,parentRelationType:this.parentRelationType,asType:this.asType,entity:((e=this.entity)==null?void 0:e.id)||null,parent:this.parent.id}}toFlatGenerationTarget(e=new Set){var i,a,s;return e.has(this.id)?[]:(e.add(this.id),[this.toGenerationTarget(),...((i=this.defaultValue)==null?void 0:i.toFlatGenerationTarget(e))||[],...((a=this.andChildrenGroup)==null?void 0:a.flatMap(o=>o.toFlatGenerationTarget(e)))||[],...((s=this.orChildrenGroup)==null?void 0:s.flatMap(o=>o.toFlatGenerationTarget(e)))||[],...this.entity&&this.entity.type==n.CustomEntity&&this.entity.parent===this&&this.entity.toFlatGenerationTarget(e)||[]])}clearErrors(){var e,t,i,a;return this.errors=[],(e=this.defaultValue)==null||e.clearErrors(),(t=this.andChildrenGroup)==null||t.forEach(s=>s.clearErrors()),(i=this.orChildrenGroup)==null||i.forEach(s=>s.clearErrors()),this.inferred&&((a=this.entity)==null||a.clearErrors()),this}validate(){const e=e2(this);return this.errors=e,{success:!0,error:null,data:this.toJSON()}}getErrors(){return[...this.errors]}getShallowErrors(){return this.errors}clone(e=null,t=null,i=!0){var v,P,A,I;let a=e||this.parent;const s=t||He(lu(this),n.DataType,this.project),o=s.split("-id"),l=o[o.length-1||0]||s,p={id:s,version:1,type:n.DataType,isNullable:this.isNullable,isList:this.isList,constant:this.constant,asType:this.asType,options:this.options,parentRelationType:this.parentRelationType,like:this.like,inferred:this.inferred,defaultValue:null,andChildrenGroup:null,orChildrenGroup:null,entity:null,parent:a.toReference()},y=xt(p,this.project);e&&y.setParent(e),i&&y.subscribe(),y.initChildren();const h=(v=this.defaultValue)==null?void 0:v.clone(y,l+"-default-value-id",i);y.defaultValue=h||null;const m=(P=this.andChildrenGroup)==null?void 0:P.map(($,F)=>$.clone(this,l+"-and-group-data-type-"+F+"-id",i)),b=(A=this.orChildrenGroup)==null?void 0:A.map(($,F)=>$.clone(this,l+"-or-group-data-type-"+F+"-id",i));if(y.andChildrenGroup=m||null,y.orChildrenGroup=b||null,this.entity&&this.entity.type===n.CustomEntity&&((I=this.entity)==null?void 0:I.parent)===this){const $=this.entity.clone(y,l+"-inferred-entity-id",i);y.setEntity($)}else this.entity&&y.setEntity(this.entity);return y}merge(e){const t=[],i=[],a=[];if(this.asType!==(e==null?void 0:e.asType)&&(this.sync({asType:e==null?void 0:e.asType}),t.push(this)),this.isNullable!==(e==null?void 0:e.isNullable)&&(this.sync({isNullable:e==null?void 0:e.isNullable}),t.push(this)),this.isList!==!(e!=null&&e.isList)&&(this.sync({isList:e==null?void 0:e.isList}),t.push(this)),this.constant!==(e==null?void 0:e.constant)&&(this.sync({constant:e==null?void 0:e.constant}),t.push(this)),this.like!==(e==null?void 0:e.like)&&(this.sync({like:e==null?void 0:e.like}),t.push(this)),e!=null&&e.inferred){if(e.entity&&e.entity.type===n.CustomEntity&&e.entity.parent===e){const s=e.entity.clone(this,this.id+"--inferred-entity-id",!0);this.setEntity(s),i.push(s)}else e.entity&&(this.setEntity(e.entity),t.push(this));this.inferred||(this.sync({inferred:!0}),t.push(this))}else if(this.inferred){if(this.sync({inferred:!1}),t.push(this),this.entity&&this.entity.type===n.CustomEntity&&this.entity.parent===this){const{affected:s,removed:o}=this.entity.remove({ignoreUpstream:!0,seenEntities:new Set});a.push(...o),s.push(...s)}e.entity!==this.entity&&(this.setEntity(e.entity),t.push(this))}else e.entity!==this.entity&&(this.setEntity(e.entity),t.push(this));if(e.defaultValue)if(this.defaultValue){const{updated:s,added:o,removed:l}=this.defaultValue.merge(e.defaultValue);t.push(...s),i.push(...o),a.push(...l)}else{const s=e.defaultValue.clone(this,this.id+"--default-value-id",!0);this.setDefaultValue(s),i.push(s)}else if(this.defaultValue){const{affected:s,removed:o}=this.defaultValue.remove({ignoreUpstream:!0,seenEntities:new Set});a.push(...o),s.push(...s)}return{updated:g(t),added:g(i),removed:g(a),self:this}}addToAndGroup(e){return this.andChildrenGroup||(this.andChildrenGroup=[]),this.andChildrenGroup.includes(e)||this.andChildrenGroup.push(e),this}addToOrGroup(e){return this.orChildrenGroup||(this.orChildrenGroup=[]),this.orChildrenGroup.includes(e)||this.orChildrenGroup.push(e),this}getDefaultValue(){return this.defaultValue}setDefaultValue(e){return this.defaultValue=e,this}setEntity(e){return this.entity=e,this}isResolved(){return[n.BuiltInBaseEntity,n.ActionDescriptor].includes(this.parent.type)||Qn(this.parent)?!0:!(!this.entity&&(!this.andChildrenGroup||!this.andChildrenGroup.length)&&(!this.orChildrenGroup||!this.orChildrenGroup.length))}isObject(){return!!this.entity&&(this.entity.type===n.CustomEntity||this.entity.name===D.JSON)}hasStrictObjectStructure(){var e;return this.isObject()&&((e=this.entity)==null?void 0:e.type)===n.CustomEntity}inferFromInputs(e){var t;if(!this.inferred)return this;if(!this.entity&&e.length){const i={id:this.id+"--infered-entity",type:n.CustomEntity,version:1,name:C(this,this.project),description:((t=this.parent)==null?void 0:t.description)||null,static:!0,abstract:!1,properties:[],methods:[],extends:[],implements:[],abstractMethods:[],x:0,y:0,parent:this.toReference()},a=R(i,this.project);a.sync(i),a.setParent(this),a.initChildren(),this.setEntity(a)}return this.entity&&this.entity.inferFromInputs(e),this.like||this.sync({like:!0}),this}};c(Ee,"MUTABLE_BASE_PROPERTIES",["isNullable","isList","constant","asType","options","parentRelationType","like"]),c(Ee,"INMUTABLE_BASE_PROPERTIES",["id","version","type"]),c(Ee,"BASE_PROPERTIES",[...Ee.MUTABLE_BASE_PROPERTIES,...Ee.INMUTABLE_BASE_PROPERTIES]),c(Ee,"MUTABLE_META_PROPERTIES",[...Ee.MUTABLE_BASE_PROPERTIES,"inferred"]),c(Ee,"INMUTABLE_META_PROPERTIES",[...Ee.INMUTABLE_BASE_PROPERTIES]),c(Ee,"META_PROPERTIES",[...Ee.MUTABLE_META_PROPERTIES,...Ee.INMUTABLE_META_PROPERTIES]),c(Ee,"MUTABLE_UPSTREAM_PROPERTIES",["entity","andChildrenGroup","orChildrenGroup","parent"]),c(Ee,"INMUTABLE_UPSTREAM_PROPERTIES",[]),c(Ee,"UPSTREAM_PROPERTIES",[...Ee.MUTABLE_UPSTREAM_PROPERTIES,...Ee.INMUTABLE_UPSTREAM_PROPERTIES]),c(Ee,"MUTABLE_DOWNSTREAM_PROPERTIES",["defaultValue"]),c(Ee,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),c(Ee,"DOWNSTREAM_PROPERTIES",[...Ee.MUTABLE_DOWNSTREAM_PROPERTIES,...Ee.INMUTABLE_DOWNSTREAM_PROPERTIES]),c(Ee,"PROPERTIES",[...Ee.META_PROPERTIES,...Ee.UPSTREAM_PROPERTIES,...Ee.DOWNSTREAM_PROPERTIES]);let Ii=Ee;function n2(r){var l;const e=b6(),t=r.toJSON();e.safeParse(t).success;const a=r2(r),s=Sn(r),o=[...a,...s];if(r.id==="exec-sequentially-operation-call-id"){const p=z({id:`${r.id}--${M.PropertyImplementsNonAbstact}`,message:`Property "${C(r,r.project)}" with id "${r.id}" implements a non-abstract property "${C(r,r.project)}" with id "${r.id}".`,issue:null,severity:T.Error,code:M.PropertyImplementsNonAbstact,entity:r});o.push(p.error)}return r.outputs.forEach(p=>p.validate()),(l=r.error)==null||l.validate(),ae(r.errors,o)}function r2(r){const e=[];return r.inputs.forEach(t=>{t.validate()}),ae(r.errors,e)}const le=class le{constructor(e,t){c(this,"initialData");c(this,"id");c(this,"version");c(this,"x");c(this,"y");c(this,"type",n.Operation);c(this,"declaration");c(this,"inputs",[]);c(this,"outputs",[]);c(this,"process",null);c(this,"successCalls",[]);c(this,"errorCalls",[]);c(this,"error",null);c(this,"calledBySuccess",[]);c(this,"calledByError",[]);c(this,"calledByEntry",[]);c(this,"parent");c(this,"errors",[]);c(this,"project");c(this,"initialized",!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 m=_(e.parent);i=t.get(m)}const a=_(e.declaration),s=t.get(a),o=e.calledByEntry.map(m=>{const b=_(m);return t.get(b)}),l=e.calledBySuccess.map(m=>{const b=_(m);return t.get(b)}),p=e.calledByError.map(m=>{const b=_(m);return t.get(b)}),y={id:e.id,version:1,type:n.Operation,declaration:s,calledByEntry:o,calledBySuccess:l,calledByError:p,errorCalls:[],successCalls:[],inputs:[],outputs:[],process:null,error:null,x:0,y:0,parent:i},h=R(y,t);return h.setParent(i),h.initChildren(),h}static validateGenerationTarget(e,t){let i=JSON.parse(JSON.stringify(e));const a=[],s=Je(i,{parent:{list:!1,types:[...ct,n.Project],optional:!0}},t);i=s.modifiedData,a.push(...s.errors,...Ne(i));const o=_(i.declaration);if(o){const l=ZP(o,t);a.push(...l)}else{const l=`
|
|
38
38
|
All built-in 'action-descriptor' entity ids are:
|
|
39
39
|
- ${t.operationDeclarations.map(p=>`${p.id} (${C(p,t)})`).join(`
|
|
40
40
|
- `)}.
|
|
@@ -50,7 +50,7 @@ ${Mo(t)}`,issue:null})):a.push(new E({id:`${e.id}--${f.ReferencedEntityNotFound}
|
|
|
50
50
|
${Mo(t)}`,issue:null})):a.push(new E({id:`${e.id}--${S.InvalidObjectStructure}`,code:S.InvalidObjectStructure,severity:T.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 '${n.Condition}' entities.
|
|
51
51
|
${Mo(t)}`,issue:null})),{errors:a,modifiedData:i}}static fromReturnDeclarationToBodyArgumentDeclarationName(e){return`Previous iteration results of '${C(e,e.project)}'`}static fromBodyArgumentDeclarationToReturnDeclarationName(e){const t=e.name.replace("Previous iteration results of '","");return t.slice(0,t.length-1)}static fromReturnDeclarationToLoopOutputDeclarationName(e){return`Result list of '${C(e,e.project)}'`}static fromLoopOutputDeclarationToReturnDeclarationName(e){const t=e.name.replace("Result list of '","");return t.slice(0,t.length-1)}validateGeneratedUpdate(e){const t=[];return e.parent&&t.push(new E({id:`${this.id}--${f.InvalidParentUpdate}`,code:f.InvalidParentUpdate,severity:T.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.
|
|
52
52
|
If an entity is called by another, they must be in the same scope, which means they have the same parent.
|
|
53
|
-
You shouldn't have to manually update a 'parent' property. The equivalent result is to change its callers, the value writters of its inputs, or the value readers of its outputs.`,issue:null})),{errors:t,modifiedData:e}}addSelfToProject(){const e=[this],t=[],i=[];return this.parent===this.project&&this.project.addLoop(this),this.successCalls.forEach(a=>{a.addSuccessCaller(this),e.push(a)}),this.errorCalls.forEach(a=>{a.addErrorCaller(this),e.push(a)}),this.calledByEntry.forEach(a=>{a.addCall(this),e.push(a)}),this.calledBySuccess.forEach(a=>{a.addSuccessCall(this),e.push(a)}),this.calledByError.forEach(a=>{a.addErrorCall(this),e.push(a)}),{updated:g(e),added:g(t),removed:g(i),self: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)}addOutputDeclaration(e){return this.outputsDeclarations.includes(e)?this:(this.outputsDeclarations.push(e),this)}removeOutputDeclaration(e){const t=this.outputsDeclarations.findIndex(i=>i.id===e.id);return t>-1&&this.outputsDeclarations.splice(t,1),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}setBody(e){return this.body=e,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}replaceDetachedChild(e,t){const i=this.detachedChildren.indexOf(e);return i!==-1&&(this.detachedChildren[i]=t),this}subscribeDetachedChild(e){return this.detachedChildren.includes(e)||this.detachedChildren.push(e),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),[n.BreakStatement,n.ContinueStatement].includes(t.type)?(t.setParent(this.parent.parent),t.initChildren()):t.type!==n.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),[n.BreakStatement,n.ContinueStatement].includes(t.type)?(t.setParent(this.parent.parent),t.initChildren()):t.type!==n.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.initialData.process&&(this.process=R(this.initialData.process,this.project),this.process.setParent(this),this.process.initChildren()),this.initialData.body&&(this.body=R(this.initialData.body,this.project),this.body.setParent(this),this.body.initChildren()),this.initialData.error&&(this.error=R(this.initialData.error,this.project),this.error.setParent(this),this.error.initChildren()),this.syncChildren(),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=[];if(t.has(this.id))return{affected:[],removed:[]};if(t.add(this.id),a.push(this),this.unsubscribe(),this.inputs.forEach(s=>{const{affected:o,removed:l}=s.remove({ignoreUpstream:!0,seenEntities:t});i.push(...o),a.push(...l)}),this.outputs.forEach(s=>{const{affected:o,removed:l}=s.remove({ignoreUpstream:!0,seenEntities:t});i.push(...o),a.push(...l)}),this.body.remove({ignoreUpstream:!0,seenEntities:t}),this.error){const{affected:s,removed:o}=this.error.remove({ignoreUpstream:!0,seenEntities:t});i.push(...s),a.push(...o)}return 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:g(i),removed:g(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.outputs.forEach(i=>{const{affected:a}=i.restore({seenEntities:e});t.push(...a)}),this.body.restore({seenEntities:e}),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:g(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.outputs.flatMap(i=>i.toFlat(e)),...this.process?this.process.toFlat(e):[],...this.successCalls.flatMap(i=>i.toFlat(e)),...this.errorCalls.flatMap(i=>i.toFlat(e)),...this.error?this.error.toFlat(e):[],...this.body?this.body.toFlat(e):[],...this.continueStatements.flatMap(i=>i.toFlat(e)),...this.breakStatements.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.outputs.flatMap(i=>i.toFlatIds(e)),...this.process?this.process.toFlatIds(e):[],...this.successCalls.flatMap(i=>i.toFlatIds(e)),...this.errorCalls.flatMap(i=>i.toFlatIds(e)),...this.error?this.error.toFlatIds(e):[],...this.body?this.body.toFlatIds(e):[],...this.continueStatements.flatMap(i=>i.toFlatIds(e)),...this.breakStatements.flatMap(i=>i.toFlatIds(e))])}toJSON(){var e,t;return{id:this.id,version:this.version,type:this.type,x:this.x,y:this.y,calledBySuccess:this.calledBySuccess.map(i=>i.toReference()),calledByError:this.calledByError.map(i=>i.toReference()),calledByEntry:this.calledByEntry.map(i=>i.toReference()),process:((e=this.process)==null?void 0:e.toJSON())||null,declaration:this.declaration.toJSON(),inputs:this.inputs.map(i=>i.toJSON()),outputs:this.outputs.map(i=>i.toJSON()),outputsDeclarations:this.outputsDeclarations.map(i=>i.toJSON()),successCalls:this.successCalls.map(i=>i.toJSON()),errorCalls:this.errorCalls.map(i=>i.toJSON()),error:((t=this.error)==null?void 0:t.toJSON())||null,body:this.body.toJSON(),parent:this.parent.toReference(),breakStatements:this.breakStatements.map(i=>i.toJSON()),continueStatements:this.continueStatements.map(i=>i.toJSON())}}toReference(){return{id:this.id+"--"+N.UUID.uuid()+"--ref",type:n.GenericReference,entityId:this.id,entityType:this.type}}toShallowJSON(){var e,t,i,a;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,body:((t=this.body)==null?void 0:t.toReference())||null,inputs:this.inputs.map(s=>s.toReference()),outputs:this.outputs.map(s=>s.toReference()),outputsDeclarations:this.outputsDeclarations.map(s=>s.toReference()),successCalls:this.successCalls.map(s=>s.toReference()),errorCalls:this.errorCalls.map(s=>s.toReference()),process:((i=this.process)==null?void 0:i.toReference())||null,calledBySuccess:this.calledBySuccess.map(s=>s.toReference()),calledByError:this.calledByError.map(s=>s.toReference()),calledByEntry:this.calledByEntry.map(s=>s.toReference()),continueStatements:this.continueStatements.map(s=>s.toReference()),breakStatements:this.breakStatements.map(s=>s.toReference()),error:((a=this.error)==null?void 0:a.toReference())||null,parent:this.parent.toReference()}}toFlatJSON(e=new Set){var i;return e.has(this.id)?[]:(e.add(this.id),[this.toShallowJSON(),...((i=this.body)==null?void 0:i.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.continueStatements.flatMap(a=>a.toFlatJSON(e)),...this.breakStatements.flatMap(a=>a.toFlatJSON(e)),...this.error?this.error.toFlatJSON(e):[],...this.process?this.process.toFlatJSON(e):[]])}toGenerationTarget(){const e=this.parent.type===n.Project?void 0:this.parent.id;return{id:this.id,type:this.type,calledByEntry:this.calledByEntry.map(t=>t.id),calledBySuccess:this.calledBySuccess.map(t=>t.id),calledByError:this.calledByError.map(t=>t.id),declaration:this.declaration.id,parent:e}}toFlatGenerationTarget(e=new Set){var i;return e.has(this.id)?[]:(e.add(this.id),[this.toGenerationTarget(),...((i=this.body)==null?void 0:i.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.continueStatements.flatMap(a=>a.toFlatGenerationTarget(e)),...this.breakStatements.flatMap(a=>a.toFlatGenerationTarget(e)),...this.error?this.error.toFlatGenerationTarget(e):[],...this.process?this.process.toFlatGenerationTarget(e):[]])}clearErrors(){var e,t;return this.errors=[],this.inputs.forEach(i=>i.clearErrors()),this.outputs.forEach(i=>i.clearErrors()),this.successCalls.forEach(i=>i.clearErrors()),this.errorCalls.forEach(i=>i.clearErrors()),this.continueStatements.forEach(i=>i.clearErrors()),this.breakStatements.forEach(i=>i.clearErrors()),(e=this.process)==null||e.clearErrors(),(t=this.error)==null||t.clearErrors(),this}validate(){const e=a2(this);return this.errors=e,{success:!0,error:null,data:this.toJSON()}}getErrors(){return[...this.errors,...this.inputs.flatMap(t=>t.getErrors()),...this.outputs.flatMap(t=>t.getErrors()),...this.body?this.body.getErrors():[],...this.error?this.error.getErrors():[],...this.process?this.process.getErrors():[]]}getShallowErrors(){return this.errors}clone(e){return new W(this.toJSON(),this.project)}getVariableInstances(){return this.body?ie(this.body).filter(i=>i.type===n.VariableInstance):[]}addReturnStatement(e){return Ge.includes(this.parent.type)&&this.parent.addReturnStatement(e),this}removeReturnStatement(e){return Ge.includes(this.parent.type)&&this.parent.removeReturnStatement(e),this}addBreakStatement(e){return this.breakStatements.includes(e)||this.breakStatements.push(e),this}removeBreakStatement(e){const t=this.breakStatements.indexOf(e);return t!==-1&&this.breakStatements.splice(t,1),this}addContinueStatement(e){return this.continueStatements.includes(e)||this.continueStatements.push(e),this}removeContinueStatement(e){const t=this.continueStatements.indexOf(e);return t!==-1&&this.continueStatements.splice(t,1),this}getUniqueReturnDeclarations(){const e=[];return[...this.breakStatements,...this.continueStatements].forEach(i=>{i.outputs.forEach(s=>{e.find(l=>l===s||C(l,this.project)===C(s,this.project)&&Zt(l.dataType,s.dataType))||e.push(s)})}),g(e)}syncTerminationStatements(){const e=[],t=[],i=[],a=this.getUniqueReturnDeclarations(),s=[...this.breakStatements,...this.continueStatements];return a.forEach((o,l)=>{o.index!==l&&(o.sync({index:l}),e.push(o))}),s.forEach(o=>{const l=o.outputs,p=a.filter(y=>!l.find(h=>C(y,this.project)===C(h,this.project)&&Zt(y.dataType,h.dataType)));p.length&&e.push(o),p.forEach(y=>{const h=y.clone(o);h.addSelfToProject(),t.push(h)})}),{updated:g(e),added:g(t),removed:g(i),self:this}}syncBodyArgumentsDeclarations(){const e=[],t=[],i=[],{updated:a,added:s,removed:o}=this.syncFixedBodyArgumentDeclarations();e.push(...a),t.push(...s),i.push(...o);const l=this.getUniqueReturnDeclarations(),p=this.body.inputs;l.forEach((b,v)=>{b.index!==v&&(b.sync({index:v}),e.push(b))}),l.forEach(b=>{const v=b.getDataType();let A=p.find(U=>C(U,this.project)===W.fromReturnDeclarationToBodyArgumentDeclarationName(b)&&Zt(U.dataType,b.dataType));if(!A){const U=W.fromReturnDeclarationToBodyArgumentDeclarationName(b),re={id:N.UUID.uuid(),version:1,type:n.ArgumentDeclaration,name:U,description:`Aggretated list of all previously outputted values from each iteration by the output '${C(b,this.project)}'`,dataType:null,implements:null,index:b.index,required:b.required,parent:this.body.toReference(),writesValues:[]},Ve=R(re,this.project);Ve.setParent(this.body),Ve.initChildren(),Ve.addSelfToProject(),t.push(Ve),A=Ve}A.index!==b.index&&(A.sync({index:b.index}),e.push(A));const I=A.getDataType();let $=I;if(v)if(!I||!Zt(I,v)){if(!$){const U=v.clone(A);U.addSelfToProject(),$=U,t.push(U),e.push(A)}$.merge(v),$.sync({isList:!0})}else $.isList||($.sync({isList:!0}),e.push($));if(!v&&!$){const U={id:N.UUID.uuid(),version:1,type:n.DataType,isList:!0,entity:null,isNullable:!1,constant:!1,defaultValue:null,asType:!1,like:!1,inferred:!1,andChildrenGroup:[],orChildrenGroup:[],parent:A.toReference()},re=R(U,this.project);re.sync({isList:!0}),re.setParent(A),re.initChildren(),re.addSelfToProject(),t.push(re)}});const{updated:y,added:h,removed:m}=this.removeExtraBodyArgumentDeclarations();return e.push(...y),t.push(...h),i.push(...m),{updated:g(e),added:g(t),removed:g(i),self:this}}syncOutputsDeclarations(){const e=[],t=[],i=[],a=this.getUniqueReturnDeclarations(),s=this.outputsDeclarations;return a.forEach((l,p)=>{l.index!==p&&(l.sync({index:p}),e.push(l))}),a.forEach(l=>{const p=l.getDataType();let h=s.find(v=>C(v,this.project)===W.fromReturnDeclarationToLoopOutputDeclarationName(l)&&Zt(v.dataType,l.dataType));if(!h){const v=W.fromReturnDeclarationToLoopOutputDeclarationName(l),P={id:N.UUID.uuid(),version:1,type:n.ValueDescriptor,name:v,description:`Aggretated list of all previously outputted values from each iteration by the output '${C(l,this.project)}'`,dataType:null,index:l.index,required:l.required,parent:this.toReference()},A=R(P,this.project);A.setParent(this),A.initChildren(),A.addSelfToProject(),t.push(A),h=A}h.index!==l.index&&(h.sync({index:l.index}),e.push(h));let b=h.getDataType();if(p)if(!b||!Zt(b,p)){if(!b){const v=p.clone(h);v.addSelfToProject(),b=v,t.push(v),e.push(h)}b.merge(p),b.sync({isList:!0})}else b.isList||(b.sync({isList:!0}),e.push(b));if(!p&&!b){const v={id:N.UUID.uuid(),version:1,type:n.DataType,isList:!0,entity:null,isNullable:!1,constant:!1,defaultValue:null,asType:!1,like:!1,inferred:!1,andChildrenGroup:[],orChildrenGroup:[],parent:h.toReference()},P=R(v,this.project);P.sync({isList:!0}),P.setParent(h),P.initChildren(),P.addSelfToProject(),t.push(P)}}),s.filter(l=>!a.find(y=>C(l,this.project)===W.fromReturnDeclarationToLoopOutputDeclarationName(y))).forEach(l=>{const{affected:p,removed:y}=l.remove({ignoreUpstream:!1,seenEntities:new Set});e.push(...p),i.push(...y)}),{updated:g(e),added:g(t),removed:g(i),self:this}}syncOutputMaps(){const e=[],t=[],i=[],a=this.outputsDeclarations,s=this.outputs;return a.forEach(l=>{var h;let y=s.find(m=>{var b,v;return((b=m.declaration)==null?void 0:b.id)===l.id&&Zt((v=m.declaration)==null?void 0:v.dataType,l.dataType)});if(y)((h=y.declaration)==null?void 0:h.id)!==l.id&&(y.setDeclaration(l),e.push(y));else{const m={id:N.UUID.uuid(),version:1,type:n.OutputMap,index:l.index,declaration:l.toJSON(),writesValues:[],parent:this.toReference()},b=R(m,this.project);b.setParent(this),b.initChildren(),b.addSelfToProject(),t.push(b),y=b}y.index!==l.index&&(y.sync({index:l.index}),e.push(y))}),s.filter(l=>!a.find(y=>{var h;return((h=l.declaration)==null?void 0:h.id)===y.id})).forEach(l=>{const{affected:p,removed:y}=l.remove({ignoreUpstream:!1,seenEntities:new Set});e.push(...p),i.push(...y)}),{updated:g(e),added:g(t),removed:g(i),self:this}}createCurrentIterationNumberArgumentDeclaration(){const e=[],t=[],i=[];let s=this.body.inputs.find(y=>{var h;return y.name===W.CURRENT_ITERATION_NUMBER_ARG_NAME||y.id===((h=this.currentIterationNumberArgumentDeclaration)==null?void 0:h.id)});const o=this.getCurrentIterationNumberBuiltInValueDescriptor();if(!s){const y={id:N.UUID.uuid(),version:1,type:n.ArgumentDeclaration,name:W.CURRENT_ITERATION_NUMBER_ARG_NAME,description:"The number of the current iteration",dataType:null,implements:o==null?void 0:o.toJSON(),index:0,required:!0,parent:this.body.toReference(),writesValues:[]},h=R(y,this.project);h.setParent(this.body),h.initChildren(),h.addSelfToProject(),t.push(h),s=h}s.index!==0&&(s.sync({index:0}),e.push(s)),(!s.implements||s.implements.id!==o.id)&&(s.setImplements(o),e.push(s));let p=s.getDataType();if(!p){const y={id:N.UUID.uuid(),version:1,type:n.DataType,isList:!1,entity:null,isNullable:!1,constant:!1,defaultValue:null,asType:!1,like:!1,inferred:!1,andChildrenGroup:[],orChildrenGroup:[],parent:s.toReference()},h=R(y,this.project);h.setParent(s),h.initChildren(),h.addSelfToProject(),t.push(h),p=h}if(!p.entity||p.entity.type!==n.PrimitiveEntity||p.entity.name!==D.Number||p.entity.id!==B["primitive-entity"].number.id){const y=this.project.getBuiltIn(B["primitive-entity"].number.id);p.setEntity(y),e.push(p)}return this.currentIterationNumberArgumentDeclaration=s,{updated:g(e),added:g(t),removed:g(i),self:this}}removeExtraBodyArgumentDeclarations(){const e=[],t=[],i=[],a=this.body.inputs,s=this.getUniqueReturnDeclarations();return a.filter(l=>l===this.currentIterationNumberArgumentDeclaration||l===this.currentValueArgumentDeclaration?!1:!s.find(y=>C(l,this.project)===W.fromReturnDeclarationToBodyArgumentDeclarationName(y))).forEach(l=>{const{affected:p,removed:y}=l.remove({ignoreUpstream:!1,seenEntities:new Set});e.push(...p),i.push(...y)}),{updated:g(e),added:g(t),removed:g(i),self:this}}createCurrentValueInputBasedOnInputMap(){var l,p,y,h,m;const e=[],t=[],i=[];switch(this.declaration.id){case k.List:{const b=this.body.inputs.find(A=>{var I;return A.name===W.CURRENT_VALUE_ARG_NAME||A.id===((I=this.currentValueArgumentDeclaration)==null?void 0:I.id)}),v=this.inputs.find(A=>{var I;return((I=A.declaration)==null?void 0:I.id)===B[n.Loop]["list-loop"].inputs.list.id});if(!v)break;const P=this.getCurrentValueBuiltInValueDescriptor();if(b){const A=this.project.get(B[n.Loop]["list-loop"].inputs.list.id);P&&(!b.implements||b.implements.id!==P.id)&&(b.setImplements(P),e.push(b));let $=b.getDataType();if(!$){const re={id:N.UUID.uuid(),version:1,type:n.DataType,isList:!1,entity:null,isNullable:!1,constant:!1,defaultValue:null,asType:!1,like:!1,inferred:!1,andChildrenGroup:[],orChildrenGroup:[],parent:A.toReference()},Ve=R(re,this.project);Ve.setParent(A),Ve.initChildren(),Ve.addSelfToProject(),t.push(Ve),$=Ve}const U=v.getDataType();$.merge(U),$.sync({isList:!1})}else{const A={id:N.UUID.uuid(),version:1,type:n.ArgumentDeclaration,name:W.CURRENT_VALUE_ARG_NAME,description:null,index:0,required:!0,implements:P,writesValues:[],dataType:null,parent:this.body.toReference()},I=R(A,this.project);I.initChildren(),I.setParent(this.body),I.addSelfToProject(),P&&(!I.implements||I.implements.id!==P.id)&&(I.setImplements(P),e.push(I)),t.push(I)}break}case k.ManualFlow:break;case k.Counted:break;case k.ObjectKeys:{const b=this.body.inputs.find(A=>{var I;return A.name===W.CURRENT_VALUE_ARG_NAME||A.id===((I=this.currentValueArgumentDeclaration)==null?void 0:I.id)});if(!this.inputs.find(A=>{var I;return((I=A.declaration)==null?void 0:I.id)===B[n.Loop]["object-keys-loop"].inputs.object.id}))break;const P=this.getCurrentValueBuiltInValueDescriptor();if(b){const A=this.project.get(B[n.Loop]["object-keys-loop"].inputs.object.id);P&&(!b.implements||b.implements.id!==P.id)&&(b.setImplements(P),e.push(b));let $=b.getDataType();if($){const U=this.project.getBuiltIn(B["primitive-entity"].string.id);((l=$.entity)==null?void 0:l.id)!==U.id&&($.setEntity(U),e.push($))}else{const U={id:N.UUID.uuid(),version:1,type:n.DataType,isList:!1,entity:null,isNullable:!1,constant:!1,defaultValue:null,asType:!1,like:!1,inferred:!1,andChildrenGroup:[],orChildrenGroup:[],parent:A.toReference()},re=R(U,this.project);re.setParent(A),re.initChildren(),re.addSelfToProject(),$=re}}else{const A={id:N.UUID.uuid(),version:1,type:n.ArgumentDeclaration,name:W.CURRENT_VALUE_ARG_NAME,description:null,index:0,required:!0,implements:P,writesValues:[],dataType:null,parent:this.body.toReference()},I=R(A,this.project);I.initChildren(),I.setParent(this.body),I.addSelfToProject(),P&&(!I.implements||I.implements.id!==P.id)&&(I.setImplements(P),e.push(I)),t.push(I)}break}case k.ObjectValues:{const b=this.body.inputs.find(A=>{var I;return A.name===W.CURRENT_VALUE_ARG_NAME||A.id===((I=this.currentValueArgumentDeclaration)==null?void 0:I.id)}),v=this.inputs.find(A=>{var I;return((I=A.declaration)==null?void 0:I.id)===B[n.Loop]["object-values-loop"].inputs.object.id});if(!v)break;const P=this.getCurrentValueBuiltInValueDescriptor();if(b){const A=this.project.get(B[n.Loop]["object-values-loop"].inputs.object.id);P&&(!b.implements||b.implements.id!==P.id)&&(b.setImplements(P),e.push(b));let $=b.getDataType();if($){const U=v.getDataType(),re=((y=U==null?void 0:U.entity)==null?void 0:y.properties)||[];(h=$.orChildrenGroup)==null||h.forEach(Ve=>{const{affected:_t,removed:Nt}=Ve.remove({ignoreUpstream:!1,seenEntities:new Set});e.push(..._t),i.push(...Nt)}),re.forEach(Ve=>{const _t=Ve.getDataType();if(_t){const Nt=_t.clone($);Nt.sync({parentRelationType:ze.OrDataTypeGroup}),Nt.addSelfToProject(),t.push(Nt)}else{const Nt={id:N.UUID.uuid(),version:1,type:n.DataType,isList:!1,entity:null,isNullable:!1,constant:!1,defaultValue:null,asType:!1,like:!1,inferred:!1,andChildrenGroup:[],orChildrenGroup:[],parentRelationType:ze.OrDataTypeGroup,parent:$.toReference()},qr=R(Nt,this.project);qr.setParent($),qr.initChildren(),qr.addSelfToProject(),t.push(qr)}})}else{const U={id:N.UUID.uuid(),version:1,type:n.DataType,isList:!1,entity:null,isNullable:!1,constant:!1,defaultValue:null,asType:!1,like:!1,inferred:!1,andChildrenGroup:[],orChildrenGroup:[],parent:A.toReference()},re=R(U,this.project);re.setParent(A),re.initChildren(),re.addSelfToProject(),$=re;const Ve=v.getDataType();(((p=Ve==null?void 0:Ve.entity)==null?void 0:p.properties)||[]).forEach(Nt=>{const qr=Nt.getDataType();if(qr){const ja=qr.clone(re);ja.sync({parentRelationType:ze.OrDataTypeGroup}),ja.addSelfToProject(),t.push(ja)}else{const ja={id:N.UUID.uuid(),version:1,type:n.DataType,isList:!1,entity:null,isNullable:!1,constant:!1,defaultValue:null,asType:!1,like:!1,inferred:!1,andChildrenGroup:[],orChildrenGroup:[],parentRelationType:ze.OrDataTypeGroup,parent:re.toReference()},Wo=R(ja,this.project);Wo.setParent(re),Wo.initChildren(),Wo.addSelfToProject(),t.push(Wo)}})}}else{const A={id:N.UUID.uuid(),version:1,type:n.ArgumentDeclaration,name:W.CURRENT_VALUE_ARG_NAME,description:null,index:0,required:!0,implements:P,writesValues:[],dataType:null,parent:this.body.toReference()},I=R(A,this.project);I.initChildren(),I.setParent(this.body),I.addSelfToProject(),P&&(!I.implements||I.implements.id!==P.id)&&(I.setImplements(P),e.push(I)),t.push(I)}break}case k.String:{const b=this.body.inputs.find(A=>{var I;return A.name===W.CURRENT_VALUE_ARG_NAME||A.id===((I=this.currentValueArgumentDeclaration)==null?void 0:I.id)});if(!this.inputs.find(A=>{var I;return((I=A.declaration)==null?void 0:I.id)===B[n.Loop]["string-loop"].inputs.string.id}))break;const P=this.getCurrentValueBuiltInValueDescriptor();if(b){const A=this.project.get(B[n.Loop]["string-loop"].inputs.string.id);P&&(!b.implements||b.implements.id!==P.id)&&(b.setImplements(P),e.push(b));let $=b.getDataType();if($){const U=this.project.getBuiltIn(B["primitive-entity"].string.id);((m=$.entity)==null?void 0:m.id)!==U.id&&($.setEntity(U),e.push($))}else{const U={id:N.UUID.uuid(),version:1,type:n.DataType,isList:!1,entity:null,isNullable:!1,constant:!1,defaultValue:null,asType:!1,like:!1,inferred:!1,andChildrenGroup:[],orChildrenGroup:[],parent:A.toReference()},re=R(U,this.project);re.setParent(A),re.initChildren(),re.addSelfToProject(),t.push(re),$=re}}else{const A={id:N.UUID.uuid(),version:1,type:n.ArgumentDeclaration,name:W.CURRENT_VALUE_ARG_NAME,description:null,index:0,required:!0,implements:P,writesValues:[],dataType:null,parent:this.body.toReference()},I=R(A,this.project);I.initChildren(),I.setParent(this.body),I.addSelfToProject(),P&&(!I.implements||I.implements.id!==P.id)&&(I.setImplements(P),e.push(I)),t.push(I)}break}}const{updated:a,added:s,removed:o}=this.removeExtraBodyArgumentDeclarations();return e.push(...a),t.push(...s),i.push(...o),{updated:g(e),added:g(t),removed:g(i),self:this}}syncFixedBodyArgumentDeclarations(){const e=[],t=[],i=[],{updated:a,added:s,removed:o}=this.createCurrentIterationNumberArgumentDeclaration();e.push(...a),t.push(...s),i.push(...o);const{updated:l,added:p,removed:y}=this.createCurrentValueInputBasedOnInputMap();return e.push(...l),t.push(...p),i.push(...y),{updated:g(e),added:g(t),removed:g(i),self:this}}syncInputMaps(){const e=[],t=[],i=[];switch(this.declaration.id){case k.List:{let a=null;if(this.inputs.forEach(s=>{var o;((o=s.declaration)==null?void 0:o.id)===B[n.Loop]["list-loop"].inputs.list.id?a=s:(s.remove(),i.push(s))}),a){if(a.declaration.id!==B[n.Loop]["list-loop"].inputs.list.id){const s=this.project.get(B[n.Loop]["list-loop"].inputs.list.id);a.setDeclaration(s),e.push(a)}}else{const s=this.project.get(B[n.Loop]["list-loop"].inputs.list.id),o={id:N.UUID.uuid(),version:1,type:n.InputMap,name:null,description:null,index:0,declaration:s.toJSON(),readsValue:null,defaultValue:null,parent:this.toReference()},l=R(o,this.project);l.initChildren(),l.setParent(this),l.addSelfToProject(),t.push(l)}break}case k.ManualFlow:{this.inputs.forEach(a=>{a.remove(),i.push(a)});break}case k.Counted:{let a=null;if(this.inputs.forEach(s=>{var o;((o=s.declaration)==null?void 0:o.id)===B[n.Loop]["counted-loop"].inputs.number.id?a=s:(s.remove(),i.push(s))}),a){if(a.declaration.id!==B[n.Loop]["counted-loop"].inputs.number.id){const s=this.project.get(B[n.Loop]["counted-loop"].inputs.number.id);a.setDeclaration(s),e.push(a)}}else{const s=this.project.get(B[n.Loop]["counted-loop"].inputs.number.id),o={id:N.UUID.uuid(),version:1,type:n.InputMap,name:null,description:null,index:0,declaration:s.toJSON(),readsValue:null,defaultValue:null,parent:this.toReference()},l=R(o,this.project);l.initChildren(),l.setParent(this),l.addSelfToProject(),t.push(l)}break}case k.ObjectKeys:{let a=null;if(this.inputs.forEach(s=>{var o;((o=s.declaration)==null?void 0:o.id)===B[n.Loop]["object-keys-loop"].inputs.object.id?a=s:(s.remove(),i.push(s))}),a){if(a.declaration.id!==B[n.Loop]["object-keys-loop"].inputs.object.id){const s=this.project.get(B[n.Loop]["object-keys-loop"].inputs.object.id);a.setDeclaration(s),e.push(a)}}else{const s=this.project.get(B[n.Loop]["object-keys-loop"].inputs.object.id),o={id:N.UUID.uuid(),version:1,type:n.InputMap,name:null,description:null,index:0,declaration:s.toJSON(),readsValue:null,defaultValue:null,parent:this.toReference()},l=R(o,this.project);l.initChildren(),l.setParent(this),l.addSelfToProject(),t.push(l)}break}case k.ObjectValues:{let a=null;if(this.inputs.forEach(s=>{var o;((o=s.declaration)==null?void 0:o.id)===B[n.Loop]["object-values-loop"].inputs.object.id?a=s:(s.remove(),i.push(s))}),a){if(a.declaration.id!==B[n.Loop]["object-values-loop"].inputs.object.id){const s=this.project.get(B[n.Loop]["object-values-loop"].inputs.object.id);a.setDeclaration(s),e.push(a)}}else{const s=this.project.get(B[n.Loop]["object-values-loop"].inputs.object.id),o={id:N.UUID.uuid(),version:1,type:n.InputMap,name:null,description:null,index:0,declaration:s.toJSON(),readsValue:null,defaultValue:null,parent:this.toReference()},l=R(o,this.project);l.initChildren(),l.setParent(this),l.addSelfToProject(),t.push(l)}break}case k.String:{let a=null;if(this.inputs.forEach(s=>{var o;((o=s.declaration)==null?void 0:o.id)===B[n.Loop]["string-loop"].inputs.string.id?a=s:(s.remove(),i.push(s))}),a){if(a.declaration.id!==B[n.Loop]["string-loop"].inputs.string.id){const s=this.project.get(B[n.Loop]["string-loop"].inputs.string.id);a.setDeclaration(s),e.push(a)}}else{const s=this.project.get(B[n.Loop]["string-loop"].inputs.string.id),o={id:N.UUID.uuid(),version:1,type:n.InputMap,name:null,description:null,index:0,declaration:s.toJSON(),readsValue:null,defaultValue:null,parent:this.toReference()},l=R(o,this.project);l.initChildren(),l.setParent(this),l.addSelfToProject(),t.push(l)}break}}return{updated:g(e),added:g(t),removed:g(i),self:this}}getCurrentValueBuiltInValueDescriptor(){var t;const e=(t=B[n.Loop][this.declaration.id].body.inputs.currentValue)==null?void 0:t.id;return e?this.project.get(e):null}getCurrentIterationNumberBuiltInValueDescriptor(){const e=B[n.Loop][this.declaration.id].body.inputs.iterationNumber.id;return this.project.get(e)}syncBody(){var o;const e=[],t=[],i=[],a=B[n.Loop][this.declaration.id].body.id,s=this.project.getBuiltIn(a);if(this.body)((o=this.body.implements)==null?void 0:o.id)!==s.id&&(this.body.setImplements(s),this.body.setParent(this),e.push(this.body));else{const l={id:N.UUID.uuid(),version:1,type:n.FunctionDeclaration,name:s.name,description:null,inputs:[],index:null,returnStatements:[],calls:[],collapsed:!1,private:!1,implements:s.toJSON(),x:0,y:0,parent:this.toReference()},p=R(l,this.project);p.initChildren(),p.setParent(this),p.addSelfToProject(),t.push(p)}return{self:this,updated:g(e),added:g(t),removed:g(i)}}syncChildren(){const e=[],t=[],i=[],{updated:a,added:s,removed:o}=this.syncBody();e.push(...a),t.push(...s),i.push(...o);const{updated:l,added:p,removed:y}=this.syncInputMaps();e.push(...l),t.push(...p),i.push(...y);const{updated:h,added:m,removed:b}=this.syncTerminationStatements();e.push(...h),t.push(...m),i.push(...b);const{updated:v,added:P,removed:A}=this.syncBodyArgumentsDeclarations();e.push(...v),t.push(...P),i.push(...A);const{updated:I,added:$,removed:U}=this.syncOutputsDeclarations();e.push(...I),t.push(...$),i.push(...U);const{updated:re,added:Ve,removed:_t}=this.syncOutputMaps();return e.push(...re),t.push(...Ve),i.push(..._t),{self:this,updated:g(e),added:g(t),removed:g(i)}}};c(W,"CURRENT_ITERATION_NUMBER_ARG_NAME","Current iteration number"),c(W,"CURRENT_VALUE_ARG_NAME","Current value"),c(W,"MUTABLE_BASE_PROPERTIES",[]),c(W,"INMUTABLE_BASE_PROPERTIES",["id","type","version"]),c(W,"BASE_PROPERTIES",[...W.MUTABLE_BASE_PROPERTIES,...W.INMUTABLE_BASE_PROPERTIES]),c(W,"MUTABLE_META_PROPERTIES",[...W.MUTABLE_BASE_PROPERTIES,"x","y"]),c(W,"INMUTABLE_META_PROPERTIES",[...W.INMUTABLE_BASE_PROPERTIES]),c(W,"META_PROPERTIES",[...W.MUTABLE_META_PROPERTIES,...W.INMUTABLE_META_PROPERTIES]),c(W,"MUTABLE_UPSTREAM_PROPERTIES",["calledBySuccess","calledByError","calledByEntry"]),c(W,"INMUTABLE_UPSTREAM_PROPERTIES",["parent","declaration"]),c(W,"UPSTREAM_PROPERTIES",[...W.MUTABLE_UPSTREAM_PROPERTIES,...W.INMUTABLE_UPSTREAM_PROPERTIES]),c(W,"MUTABLE_DOWNSTREAM_PROPERTIES",["body","inputs","outputs","outputsDeclarations","successCalls","errorCalls","error","breakStatements","continueStatements"]),c(W,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),c(W,"DOWNSTREAM_PROPERTIES",[...W.MUTABLE_DOWNSTREAM_PROPERTIES,...W.INMUTABLE_DOWNSTREAM_PROPERTIES]),c(W,"PROPERTIES",[...W.META_PROPERTIES,...W.UPSTREAM_PROPERTIES,...W.DOWNSTREAM_PROPERTIES]);let wr=W;function s2(r){const e=r6(),t=r.toJSON();e.safeParse(t).success,r.inputs.forEach(o=>o.validate());const s=[...Sn(r)];return ae(r.errors,s)}const be=class be{constructor(e,t){c(this,"initialData");c(this,"id");c(this,"version");c(this,"x");c(this,"y");c(this,"type",n.Condition);c(this,"successCalls",[]);c(this,"errorCalls",[]);c(this,"declaration");c(this,"inputs",[]);c(this,"calledBySuccess",[]);c(this,"calledByError",[]);c(this,"calledByEntry",[]);c(this,"project");c(this,"errors",[]);c(this,"parent");c(this,"initialized",!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 h=_(e.parent);i=t.get(h)}const a=e.calledByEntry.map(h=>{const m=_(h);return t.get(m)}),s=e.calledBySuccess.map(h=>{const m=_(h);return t.get(m)}),o=e.calledByError.map(h=>{const m=_(h);return t.get(m)});let l;if(e.declaration){const h=_(e.declaration);l=t.get(h)}const p={id:e.id,version:1,type:n.Condition,declaration:l,calledByEntry:a,calledBySuccess:s,calledByError:o,errorCalls:[],successCalls:[],inputs:[],x:0,y:0,parent:i},y=R(p,t);return y.setParent(i),y.initChildren(),y}static validateGenerationTarget(e,t){let i=JSON.parse(JSON.stringify(e));const a=[],s=Je(i,{parent:{list:!1,types:[...ct,n.Project],optional:!0}},t);return i=s.modifiedData,a.push(...s.errors,...Ne(i)),e.declaration?t.get(e.declaration)?t.conditionDeclarations.find(p=>p.id===e.declaration)||a.push(new E({id:`${e.id}--${f.InvalidImplementsReference}`,code:f.InvalidImplementsReference,severity:T.Error,message:`Entity of type '${e.type}' with id '${e.id}' has an 'declaration' property that isn't pointing to an action descriptor reserved for '${n.Condition}' entities.
|
|
53
|
+
You shouldn't have to manually update a 'parent' property. The equivalent result is to change its callers, the value writters of its inputs, or the value readers of its outputs.`,issue:null})),{errors:t,modifiedData:e}}addSelfToProject(){const e=[this],t=[],i=[];return this.parent===this.project&&this.project.addLoop(this),this.successCalls.forEach(a=>{a.addSuccessCaller(this),e.push(a)}),this.errorCalls.forEach(a=>{a.addErrorCaller(this),e.push(a)}),this.calledByEntry.forEach(a=>{a.addCall(this),e.push(a)}),this.calledBySuccess.forEach(a=>{a.addSuccessCall(this),e.push(a)}),this.calledByError.forEach(a=>{a.addErrorCall(this),e.push(a)}),{updated:g(e),added:g(t),removed:g(i),self: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)}addOutputDeclaration(e){return this.outputsDeclarations.includes(e)?this:(this.outputsDeclarations.push(e),this)}removeOutputDeclaration(e){const t=this.outputsDeclarations.findIndex(i=>i.id===e.id);return t>-1&&this.outputsDeclarations.splice(t,1),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}setBody(e){return this.body=e,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}replaceDetachedChild(e,t){const i=this.detachedChildren.indexOf(e);return i!==-1&&(this.detachedChildren[i]=t),this}subscribeDetachedChild(e){return this.detachedChildren.includes(e)||this.detachedChildren.push(e),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),[n.BreakStatement,n.ContinueStatement].includes(t.type)?(t.setParent(this.parent.parent),t.initChildren()):t.type!==n.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),[n.BreakStatement,n.ContinueStatement].includes(t.type)?(t.setParent(this.parent.parent),t.initChildren()):t.type!==n.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.initialData.process&&(this.process=R(this.initialData.process,this.project),this.process.setParent(this),this.process.initChildren()),this.initialData.body&&(this.body=R(this.initialData.body,this.project),this.body.setParent(this),this.body.initChildren()),this.initialData.error&&(this.error=R(this.initialData.error,this.project),this.error.setParent(this),this.error.initChildren()),this.syncChildren(),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=[];if(t.has(this.id))return{affected:[],removed:[]};if(t.add(this.id),a.push(this),this.unsubscribe(),this.inputs.forEach(s=>{const{affected:o,removed:l}=s.remove({ignoreUpstream:!0,seenEntities:t});i.push(...o),a.push(...l)}),this.outputs.forEach(s=>{const{affected:o,removed:l}=s.remove({ignoreUpstream:!0,seenEntities:t});i.push(...o),a.push(...l)}),this.body.remove({ignoreUpstream:!0,seenEntities:t}),this.error){const{affected:s,removed:o}=this.error.remove({ignoreUpstream:!0,seenEntities:t});i.push(...s),a.push(...o)}return 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:g(i),removed:g(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.outputs.forEach(i=>{const{affected:a}=i.restore({seenEntities:e});t.push(...a)}),this.body.restore({seenEntities:e}),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:g(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.outputs.flatMap(i=>i.toFlat(e)),...this.process?this.process.toFlat(e):[],...this.successCalls.flatMap(i=>i.toFlat(e)),...this.errorCalls.flatMap(i=>i.toFlat(e)),...this.error?this.error.toFlat(e):[],...this.body?this.body.toFlat(e):[],...this.continueStatements.flatMap(i=>i.toFlat(e)),...this.breakStatements.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.outputs.flatMap(i=>i.toFlatIds(e)),...this.process?this.process.toFlatIds(e):[],...this.successCalls.flatMap(i=>i.toFlatIds(e)),...this.errorCalls.flatMap(i=>i.toFlatIds(e)),...this.error?this.error.toFlatIds(e):[],...this.body?this.body.toFlatIds(e):[],...this.continueStatements.flatMap(i=>i.toFlatIds(e)),...this.breakStatements.flatMap(i=>i.toFlatIds(e))])}toJSON(){var e,t;return{id:this.id,version:this.version,type:this.type,x:this.x,y:this.y,calledBySuccess:this.calledBySuccess.map(i=>i.toReference()),calledByError:this.calledByError.map(i=>i.toReference()),calledByEntry:this.calledByEntry.map(i=>i.toReference()),process:((e=this.process)==null?void 0:e.toJSON())||null,declaration:this.declaration.toJSON(),inputs:this.inputs.map(i=>i.toJSON()),outputs:this.outputs.map(i=>i.toJSON()),outputsDeclarations:this.outputsDeclarations.map(i=>i.toJSON()),successCalls:this.successCalls.map(i=>i.toJSON()),errorCalls:this.errorCalls.map(i=>i.toJSON()),error:((t=this.error)==null?void 0:t.toJSON())||null,body:this.body.toJSON(),parent:this.parent.toReference(),breakStatements:this.breakStatements.map(i=>i.toJSON()),continueStatements:this.continueStatements.map(i=>i.toJSON())}}toReference(){return{id:this.id+"--"+N.UUID.uuid()+"--ref",type:n.GenericReference,entityId:this.id,entityType:this.type}}toShallowJSON(){var e,t,i,a;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,body:((t=this.body)==null?void 0:t.toReference())||null,inputs:this.inputs.map(s=>s.toReference()),outputs:this.outputs.map(s=>s.toReference()),outputsDeclarations:this.outputsDeclarations.map(s=>s.toReference()),successCalls:this.successCalls.map(s=>s.toReference()),errorCalls:this.errorCalls.map(s=>s.toReference()),process:((i=this.process)==null?void 0:i.toReference())||null,calledBySuccess:this.calledBySuccess.map(s=>s.toReference()),calledByError:this.calledByError.map(s=>s.toReference()),calledByEntry:this.calledByEntry.map(s=>s.toReference()),continueStatements:this.continueStatements.map(s=>s.toReference()),breakStatements:this.breakStatements.map(s=>s.toReference()),error:((a=this.error)==null?void 0:a.toReference())||null,parent:this.parent.toReference()}}toFlatJSON(e=new Set){var i;return e.has(this.id)?[]:(e.add(this.id),[this.toShallowJSON(),...((i=this.body)==null?void 0:i.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.continueStatements.flatMap(a=>a.toFlatJSON(e)),...this.breakStatements.flatMap(a=>a.toFlatJSON(e)),...this.error?this.error.toFlatJSON(e):[],...this.process?this.process.toFlatJSON(e):[]])}toGenerationTarget(){const e=this.parent.type===n.Project?void 0:this.parent.id;return{id:this.id,type:this.type,calledByEntry:this.calledByEntry.map(t=>t.id),calledBySuccess:this.calledBySuccess.map(t=>t.id),calledByError:this.calledByError.map(t=>t.id),declaration:this.declaration.id,parent:e}}toFlatGenerationTarget(e=new Set){var i;return e.has(this.id)?[]:(e.add(this.id),[this.toGenerationTarget(),...((i=this.body)==null?void 0:i.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.continueStatements.flatMap(a=>a.toFlatGenerationTarget(e)),...this.breakStatements.flatMap(a=>a.toFlatGenerationTarget(e)),...this.error?this.error.toFlatGenerationTarget(e):[],...this.process?this.process.toFlatGenerationTarget(e):[]])}clearErrors(){var e,t;return this.errors=[],this.inputs.forEach(i=>i.clearErrors()),this.outputs.forEach(i=>i.clearErrors()),this.successCalls.forEach(i=>i.clearErrors()),this.errorCalls.forEach(i=>i.clearErrors()),this.continueStatements.forEach(i=>i.clearErrors()),this.breakStatements.forEach(i=>i.clearErrors()),(e=this.process)==null||e.clearErrors(),(t=this.error)==null||t.clearErrors(),this}validate(){const e=a2(this);return this.errors=e,{success:!0,error:null,data:this.toJSON()}}getErrors(){return[...this.errors,...this.inputs.flatMap(t=>t.getErrors()),...this.outputs.flatMap(t=>t.getErrors()),...this.body?this.body.getErrors():[],...this.error?this.error.getErrors():[],...this.process?this.process.getErrors():[]]}getShallowErrors(){return this.errors}clone(e){return new W(this.toJSON(),this.project)}getVariableInstances(){return this.body?ie(this.body).filter(i=>i.type===n.VariableInstance):[]}addReturnStatement(e){return Ge.includes(this.parent.type)&&this.parent.addReturnStatement(e),this}removeReturnStatement(e){return Ge.includes(this.parent.type)&&this.parent.removeReturnStatement(e),this}addBreakStatement(e){return this.breakStatements.includes(e)||this.breakStatements.push(e),this}removeBreakStatement(e){const t=this.breakStatements.indexOf(e);return t!==-1&&this.breakStatements.splice(t,1),this}addContinueStatement(e){return this.continueStatements.includes(e)||this.continueStatements.push(e),this}removeContinueStatement(e){const t=this.continueStatements.indexOf(e);return t!==-1&&this.continueStatements.splice(t,1),this}getUniqueReturnDeclarations(){const e=[];return[...this.breakStatements,...this.continueStatements].forEach(i=>{i.outputs.forEach(s=>{e.find(l=>l===s||C(l,this.project)===C(s,this.project)&&Zt(l.dataType,s.dataType))||e.push(s)})}),g(e)}syncTerminationStatements(){const e=[],t=[],i=[],a=this.getUniqueReturnDeclarations(),s=[...this.breakStatements,...this.continueStatements];return a.forEach((o,l)=>{o.index!==l&&(o.sync({index:l}),e.push(o))}),s.forEach(o=>{const l=o.outputs,p=a.filter(y=>!l.find(h=>C(y,this.project)===C(h,this.project)&&Zt(y.dataType,h.dataType)));p.length&&e.push(o),p.forEach(y=>{const h=y.clone(o);h.addSelfToProject(),t.push(h)})}),{updated:g(e),added:g(t),removed:g(i),self:this}}syncBodyArgumentsDeclarations(){const e=[],t=[],i=[],{updated:a,added:s,removed:o}=this.syncFixedBodyArgumentDeclarations();e.push(...a),t.push(...s),i.push(...o);const l=this.getUniqueReturnDeclarations(),p=this.body.inputs;l.forEach((b,v)=>{b.index!==v&&(b.sync({index:v}),e.push(b))}),l.forEach(b=>{const v=b.getDataType();let A=p.find(F=>C(F,this.project)===W.fromReturnDeclarationToBodyArgumentDeclarationName(b)&&Zt(F.dataType,b.dataType));if(!A){const F=W.fromReturnDeclarationToBodyArgumentDeclarationName(b),re={id:N.UUID.uuid(),version:1,type:n.ArgumentDeclaration,name:F,description:`Aggretated list of all previously outputted values from each iteration by the output '${C(b,this.project)}'`,dataType:null,implements:null,index:b.index,required:b.required,parent:this.body.toReference(),writesValues:[]},Ve=R(re,this.project);Ve.setParent(this.body),Ve.initChildren(),Ve.addSelfToProject(),t.push(Ve),A=Ve}A.index!==b.index&&(A.sync({index:b.index}),e.push(A));const I=A.getDataType();let $=I;if(v)if(!I||!Zt(I,v)){if(!$){const F=v.clone(A);F.addSelfToProject(),$=F,t.push(F),e.push(A)}$.merge(v),$.sync({isList:!0})}else $.isList||($.sync({isList:!0}),e.push($));if(!v&&!$){const F={id:N.UUID.uuid(),version:1,type:n.DataType,isList:!0,entity:null,isNullable:!1,constant:!1,defaultValue:null,asType:!1,like:!1,inferred:!1,andChildrenGroup:[],orChildrenGroup:[],parent:A.toReference()},re=R(F,this.project);re.sync({isList:!0}),re.setParent(A),re.initChildren(),re.addSelfToProject(),t.push(re)}});const{updated:y,added:h,removed:m}=this.removeExtraBodyArgumentDeclarations();return e.push(...y),t.push(...h),i.push(...m),{updated:g(e),added:g(t),removed:g(i),self:this}}syncOutputsDeclarations(){const e=[],t=[],i=[],a=this.getUniqueReturnDeclarations(),s=this.outputsDeclarations;return a.forEach((l,p)=>{l.index!==p&&(l.sync({index:p}),e.push(l))}),a.forEach(l=>{const p=l.getDataType();let h=s.find(v=>C(v,this.project)===W.fromReturnDeclarationToLoopOutputDeclarationName(l)&&Zt(v.dataType,l.dataType));if(!h){const v=W.fromReturnDeclarationToLoopOutputDeclarationName(l),P={id:N.UUID.uuid(),version:1,type:n.ValueDescriptor,name:v,description:`Aggretated list of all previously outputted values from each iteration by the output '${C(l,this.project)}'`,dataType:null,index:l.index,required:l.required,parent:this.toReference()},A=R(P,this.project);A.setParent(this),A.initChildren(),A.addSelfToProject(),t.push(A),h=A}h.index!==l.index&&(h.sync({index:l.index}),e.push(h));let b=h.getDataType();if(p)if(!b||!Zt(b,p)){if(!b){const v=p.clone(h);v.addSelfToProject(),b=v,t.push(v),e.push(h)}b.merge(p),b.sync({isList:!0})}else b.isList||(b.sync({isList:!0}),e.push(b));if(!p&&!b){const v={id:N.UUID.uuid(),version:1,type:n.DataType,isList:!0,entity:null,isNullable:!1,constant:!1,defaultValue:null,asType:!1,like:!1,inferred:!1,andChildrenGroup:[],orChildrenGroup:[],parent:h.toReference()},P=R(v,this.project);P.sync({isList:!0}),P.setParent(h),P.initChildren(),P.addSelfToProject(),t.push(P)}}),s.filter(l=>!a.find(y=>C(l,this.project)===W.fromReturnDeclarationToLoopOutputDeclarationName(y))).forEach(l=>{const{affected:p,removed:y}=l.remove({ignoreUpstream:!1,seenEntities:new Set});e.push(...p),i.push(...y)}),{updated:g(e),added:g(t),removed:g(i),self:this}}syncOutputMaps(){const e=[],t=[],i=[],a=this.outputsDeclarations,s=this.outputs;return a.forEach(l=>{var h;let y=s.find(m=>{var b,v;return((b=m.declaration)==null?void 0:b.id)===l.id&&Zt((v=m.declaration)==null?void 0:v.dataType,l.dataType)});if(y)((h=y.declaration)==null?void 0:h.id)!==l.id&&(y.setDeclaration(l),e.push(y));else{const m={id:N.UUID.uuid(),version:1,type:n.OutputMap,index:l.index,declaration:l.toJSON(),writesValues:[],parent:this.toReference()},b=R(m,this.project);b.setParent(this),b.initChildren(),b.addSelfToProject(),t.push(b),y=b}y.index!==l.index&&(y.sync({index:l.index}),e.push(y))}),s.filter(l=>!a.find(y=>{var h;return((h=l.declaration)==null?void 0:h.id)===y.id})).forEach(l=>{const{affected:p,removed:y}=l.remove({ignoreUpstream:!1,seenEntities:new Set});e.push(...p),i.push(...y)}),{updated:g(e),added:g(t),removed:g(i),self:this}}createCurrentIterationNumberArgumentDeclaration(){const e=[],t=[],i=[];let s=this.body.inputs.find(y=>{var h;return y.name===W.CURRENT_ITERATION_NUMBER_ARG_NAME||y.id===((h=this.currentIterationNumberArgumentDeclaration)==null?void 0:h.id)});const o=this.getCurrentIterationNumberBuiltInValueDescriptor();if(!s){const y={id:N.UUID.uuid(),version:1,type:n.ArgumentDeclaration,name:W.CURRENT_ITERATION_NUMBER_ARG_NAME,description:"The number of the current iteration",dataType:null,implements:o==null?void 0:o.toJSON(),index:0,required:!0,parent:this.body.toReference(),writesValues:[]},h=R(y,this.project);h.setParent(this.body),h.initChildren(),h.addSelfToProject(),t.push(h),s=h}s.index!==0&&(s.sync({index:0}),e.push(s)),(!s.implements||s.implements.id!==o.id)&&(s.setImplements(o),e.push(s));let p=s.getDataType();if(!p){const y={id:N.UUID.uuid(),version:1,type:n.DataType,isList:!1,entity:null,isNullable:!1,constant:!1,defaultValue:null,asType:!1,like:!1,inferred:!1,andChildrenGroup:[],orChildrenGroup:[],parent:s.toReference()},h=R(y,this.project);h.setParent(s),h.initChildren(),h.addSelfToProject(),t.push(h),p=h}if(!p.entity||p.entity.type!==n.PrimitiveEntity||p.entity.name!==D.Number||p.entity.id!==B["primitive-entity"].number.id){const y=this.project.getBuiltIn(B["primitive-entity"].number.id);p.setEntity(y),e.push(p)}return this.currentIterationNumberArgumentDeclaration=s,{updated:g(e),added:g(t),removed:g(i),self:this}}removeExtraBodyArgumentDeclarations(){const e=[],t=[],i=[],a=this.body.inputs,s=this.getUniqueReturnDeclarations();return a.filter(l=>l===this.currentIterationNumberArgumentDeclaration||l===this.currentValueArgumentDeclaration?!1:!s.find(y=>C(l,this.project)===W.fromReturnDeclarationToBodyArgumentDeclarationName(y))).forEach(l=>{const{affected:p,removed:y}=l.remove({ignoreUpstream:!1,seenEntities:new Set});e.push(...p),i.push(...y)}),{updated:g(e),added:g(t),removed:g(i),self:this}}createCurrentValueInputBasedOnInputMap(){var l,p,y,h,m;const e=[],t=[],i=[];switch(this.declaration.id){case k.List:{const b=this.body.inputs.find(A=>{var I;return A.name===W.CURRENT_VALUE_ARG_NAME||A.id===((I=this.currentValueArgumentDeclaration)==null?void 0:I.id)}),v=this.inputs.find(A=>{var I;return((I=A.declaration)==null?void 0:I.id)===B[n.Loop]["list-loop"].inputs.list.id});if(!v)break;const P=this.getCurrentValueBuiltInValueDescriptor();if(b){const A=this.project.get(B[n.Loop]["list-loop"].inputs.list.id);P&&(!b.implements||b.implements.id!==P.id)&&(b.setImplements(P),e.push(b));let $=b.getDataType();if(!$){const re={id:N.UUID.uuid(),version:1,type:n.DataType,isList:!1,entity:null,isNullable:!1,constant:!1,defaultValue:null,asType:!1,like:!1,inferred:!1,andChildrenGroup:[],orChildrenGroup:[],parent:A.toReference()},Ve=R(re,this.project);Ve.setParent(A),Ve.initChildren(),Ve.addSelfToProject(),t.push(Ve),$=Ve}const F=v.getDataType();$.merge(F),$.sync({isList:!1})}else{const A={id:N.UUID.uuid(),version:1,type:n.ArgumentDeclaration,name:W.CURRENT_VALUE_ARG_NAME,description:null,index:0,required:!0,implements:P,writesValues:[],dataType:null,parent:this.body.toReference()},I=R(A,this.project);I.initChildren(),I.setParent(this.body),I.addSelfToProject(),P&&(!I.implements||I.implements.id!==P.id)&&(I.setImplements(P),e.push(I)),t.push(I)}break}case k.ManualFlow:break;case k.Counted:break;case k.ObjectKeys:{const b=this.body.inputs.find(A=>{var I;return A.name===W.CURRENT_VALUE_ARG_NAME||A.id===((I=this.currentValueArgumentDeclaration)==null?void 0:I.id)});if(!this.inputs.find(A=>{var I;return((I=A.declaration)==null?void 0:I.id)===B[n.Loop]["object-keys-loop"].inputs.object.id}))break;const P=this.getCurrentValueBuiltInValueDescriptor();if(b){const A=this.project.get(B[n.Loop]["object-keys-loop"].inputs.object.id);P&&(!b.implements||b.implements.id!==P.id)&&(b.setImplements(P),e.push(b));let $=b.getDataType();if($){const F=this.project.getBuiltIn(B["primitive-entity"].string.id);((l=$.entity)==null?void 0:l.id)!==F.id&&($.setEntity(F),e.push($))}else{const F={id:N.UUID.uuid(),version:1,type:n.DataType,isList:!1,entity:null,isNullable:!1,constant:!1,defaultValue:null,asType:!1,like:!1,inferred:!1,andChildrenGroup:[],orChildrenGroup:[],parent:A.toReference()},re=R(F,this.project);re.setParent(A),re.initChildren(),re.addSelfToProject(),$=re}}else{const A={id:N.UUID.uuid(),version:1,type:n.ArgumentDeclaration,name:W.CURRENT_VALUE_ARG_NAME,description:null,index:0,required:!0,implements:P,writesValues:[],dataType:null,parent:this.body.toReference()},I=R(A,this.project);I.initChildren(),I.setParent(this.body),I.addSelfToProject(),P&&(!I.implements||I.implements.id!==P.id)&&(I.setImplements(P),e.push(I)),t.push(I)}break}case k.ObjectValues:{const b=this.body.inputs.find(A=>{var I;return A.name===W.CURRENT_VALUE_ARG_NAME||A.id===((I=this.currentValueArgumentDeclaration)==null?void 0:I.id)}),v=this.inputs.find(A=>{var I;return((I=A.declaration)==null?void 0:I.id)===B[n.Loop]["object-values-loop"].inputs.object.id});if(!v)break;const P=this.getCurrentValueBuiltInValueDescriptor();if(b){const A=this.project.get(B[n.Loop]["object-values-loop"].inputs.object.id);P&&(!b.implements||b.implements.id!==P.id)&&(b.setImplements(P),e.push(b));let $=b.getDataType();if($){const F=v.getDataType(),re=((y=F==null?void 0:F.entity)==null?void 0:y.properties)||[];(h=$.orChildrenGroup)==null||h.forEach(Ve=>{const{affected:_t,removed:Nt}=Ve.remove({ignoreUpstream:!1,seenEntities:new Set});e.push(..._t),i.push(...Nt)}),re.forEach(Ve=>{const _t=Ve.getDataType();if(_t){const Nt=_t.clone($);Nt.sync({parentRelationType:ze.OrDataTypeGroup}),Nt.addSelfToProject(),t.push(Nt)}else{const Nt={id:N.UUID.uuid(),version:1,type:n.DataType,isList:!1,entity:null,isNullable:!1,constant:!1,defaultValue:null,asType:!1,like:!1,inferred:!1,andChildrenGroup:[],orChildrenGroup:[],parentRelationType:ze.OrDataTypeGroup,parent:$.toReference()},qr=R(Nt,this.project);qr.setParent($),qr.initChildren(),qr.addSelfToProject(),t.push(qr)}})}else{const F={id:N.UUID.uuid(),version:1,type:n.DataType,isList:!1,entity:null,isNullable:!1,constant:!1,defaultValue:null,asType:!1,like:!1,inferred:!1,andChildrenGroup:[],orChildrenGroup:[],parent:A.toReference()},re=R(F,this.project);re.setParent(A),re.initChildren(),re.addSelfToProject(),$=re;const Ve=v.getDataType();(((p=Ve==null?void 0:Ve.entity)==null?void 0:p.properties)||[]).forEach(Nt=>{const qr=Nt.getDataType();if(qr){const ja=qr.clone(re);ja.sync({parentRelationType:ze.OrDataTypeGroup}),ja.addSelfToProject(),t.push(ja)}else{const ja={id:N.UUID.uuid(),version:1,type:n.DataType,isList:!1,entity:null,isNullable:!1,constant:!1,defaultValue:null,asType:!1,like:!1,inferred:!1,andChildrenGroup:[],orChildrenGroup:[],parentRelationType:ze.OrDataTypeGroup,parent:re.toReference()},Wo=R(ja,this.project);Wo.setParent(re),Wo.initChildren(),Wo.addSelfToProject(),t.push(Wo)}})}}else{const A={id:N.UUID.uuid(),version:1,type:n.ArgumentDeclaration,name:W.CURRENT_VALUE_ARG_NAME,description:null,index:0,required:!0,implements:P,writesValues:[],dataType:null,parent:this.body.toReference()},I=R(A,this.project);I.initChildren(),I.setParent(this.body),I.addSelfToProject(),P&&(!I.implements||I.implements.id!==P.id)&&(I.setImplements(P),e.push(I)),t.push(I)}break}case k.String:{const b=this.body.inputs.find(A=>{var I;return A.name===W.CURRENT_VALUE_ARG_NAME||A.id===((I=this.currentValueArgumentDeclaration)==null?void 0:I.id)});if(!this.inputs.find(A=>{var I;return((I=A.declaration)==null?void 0:I.id)===B[n.Loop]["string-loop"].inputs.string.id}))break;const P=this.getCurrentValueBuiltInValueDescriptor();if(b){const A=this.project.get(B[n.Loop]["string-loop"].inputs.string.id);P&&(!b.implements||b.implements.id!==P.id)&&(b.setImplements(P),e.push(b));let $=b.getDataType();if($){const F=this.project.getBuiltIn(B["primitive-entity"].string.id);((m=$.entity)==null?void 0:m.id)!==F.id&&($.setEntity(F),e.push($))}else{const F={id:N.UUID.uuid(),version:1,type:n.DataType,isList:!1,entity:null,isNullable:!1,constant:!1,defaultValue:null,asType:!1,like:!1,inferred:!1,andChildrenGroup:[],orChildrenGroup:[],parent:A.toReference()},re=R(F,this.project);re.setParent(A),re.initChildren(),re.addSelfToProject(),t.push(re),$=re}}else{const A={id:N.UUID.uuid(),version:1,type:n.ArgumentDeclaration,name:W.CURRENT_VALUE_ARG_NAME,description:null,index:0,required:!0,implements:P,writesValues:[],dataType:null,parent:this.body.toReference()},I=R(A,this.project);I.initChildren(),I.setParent(this.body),I.addSelfToProject(),P&&(!I.implements||I.implements.id!==P.id)&&(I.setImplements(P),e.push(I)),t.push(I)}break}}const{updated:a,added:s,removed:o}=this.removeExtraBodyArgumentDeclarations();return e.push(...a),t.push(...s),i.push(...o),{updated:g(e),added:g(t),removed:g(i),self:this}}syncFixedBodyArgumentDeclarations(){const e=[],t=[],i=[],{updated:a,added:s,removed:o}=this.createCurrentIterationNumberArgumentDeclaration();e.push(...a),t.push(...s),i.push(...o);const{updated:l,added:p,removed:y}=this.createCurrentValueInputBasedOnInputMap();return e.push(...l),t.push(...p),i.push(...y),{updated:g(e),added:g(t),removed:g(i),self:this}}syncInputMaps(){const e=[],t=[],i=[];switch(this.declaration.id){case k.List:{let a=null;if(this.inputs.forEach(s=>{var o;((o=s.declaration)==null?void 0:o.id)===B[n.Loop]["list-loop"].inputs.list.id?a=s:(s.remove(),i.push(s))}),a){if(a.declaration.id!==B[n.Loop]["list-loop"].inputs.list.id){const s=this.project.get(B[n.Loop]["list-loop"].inputs.list.id);a.setDeclaration(s),e.push(a)}}else{const s=this.project.get(B[n.Loop]["list-loop"].inputs.list.id),o={id:N.UUID.uuid(),version:1,type:n.InputMap,name:null,description:null,index:0,declaration:s.toJSON(),readsValue:null,defaultValue:null,parent:this.toReference()},l=R(o,this.project);l.initChildren(),l.setParent(this),l.addSelfToProject(),t.push(l)}break}case k.ManualFlow:{this.inputs.forEach(a=>{a.remove(),i.push(a)});break}case k.Counted:{let a=null;if(this.inputs.forEach(s=>{var o;((o=s.declaration)==null?void 0:o.id)===B[n.Loop]["counted-loop"].inputs.number.id?a=s:(s.remove(),i.push(s))}),a){if(a.declaration.id!==B[n.Loop]["counted-loop"].inputs.number.id){const s=this.project.get(B[n.Loop]["counted-loop"].inputs.number.id);a.setDeclaration(s),e.push(a)}}else{const s=this.project.get(B[n.Loop]["counted-loop"].inputs.number.id),o={id:N.UUID.uuid(),version:1,type:n.InputMap,name:null,description:null,index:0,declaration:s.toJSON(),readsValue:null,defaultValue:null,parent:this.toReference()},l=R(o,this.project);l.initChildren(),l.setParent(this),l.addSelfToProject(),t.push(l)}break}case k.ObjectKeys:{let a=null;if(this.inputs.forEach(s=>{var o;((o=s.declaration)==null?void 0:o.id)===B[n.Loop]["object-keys-loop"].inputs.object.id?a=s:(s.remove(),i.push(s))}),a){if(a.declaration.id!==B[n.Loop]["object-keys-loop"].inputs.object.id){const s=this.project.get(B[n.Loop]["object-keys-loop"].inputs.object.id);a.setDeclaration(s),e.push(a)}}else{const s=this.project.get(B[n.Loop]["object-keys-loop"].inputs.object.id),o={id:N.UUID.uuid(),version:1,type:n.InputMap,name:null,description:null,index:0,declaration:s.toJSON(),readsValue:null,defaultValue:null,parent:this.toReference()},l=R(o,this.project);l.initChildren(),l.setParent(this),l.addSelfToProject(),t.push(l)}break}case k.ObjectValues:{let a=null;if(this.inputs.forEach(s=>{var o;((o=s.declaration)==null?void 0:o.id)===B[n.Loop]["object-values-loop"].inputs.object.id?a=s:(s.remove(),i.push(s))}),a){if(a.declaration.id!==B[n.Loop]["object-values-loop"].inputs.object.id){const s=this.project.get(B[n.Loop]["object-values-loop"].inputs.object.id);a.setDeclaration(s),e.push(a)}}else{const s=this.project.get(B[n.Loop]["object-values-loop"].inputs.object.id),o={id:N.UUID.uuid(),version:1,type:n.InputMap,name:null,description:null,index:0,declaration:s.toJSON(),readsValue:null,defaultValue:null,parent:this.toReference()},l=R(o,this.project);l.initChildren(),l.setParent(this),l.addSelfToProject(),t.push(l)}break}case k.String:{let a=null;if(this.inputs.forEach(s=>{var o;((o=s.declaration)==null?void 0:o.id)===B[n.Loop]["string-loop"].inputs.string.id?a=s:(s.remove(),i.push(s))}),a){if(a.declaration.id!==B[n.Loop]["string-loop"].inputs.string.id){const s=this.project.get(B[n.Loop]["string-loop"].inputs.string.id);a.setDeclaration(s),e.push(a)}}else{const s=this.project.get(B[n.Loop]["string-loop"].inputs.string.id),o={id:N.UUID.uuid(),version:1,type:n.InputMap,name:null,description:null,index:0,declaration:s.toJSON(),readsValue:null,defaultValue:null,parent:this.toReference()},l=R(o,this.project);l.initChildren(),l.setParent(this),l.addSelfToProject(),t.push(l)}break}}return{updated:g(e),added:g(t),removed:g(i),self:this}}getCurrentValueBuiltInValueDescriptor(){var t;const e=(t=B[n.Loop][this.declaration.id].body.inputs.currentValue)==null?void 0:t.id;return e?this.project.get(e):null}getCurrentIterationNumberBuiltInValueDescriptor(){const e=B[n.Loop][this.declaration.id].body.inputs.iterationNumber.id;return this.project.get(e)}syncBody(){var o;const e=[],t=[],i=[],a=B[n.Loop][this.declaration.id].body.id,s=this.project.getBuiltIn(a);if(this.body)((o=this.body.implements)==null?void 0:o.id)!==s.id&&(this.body.setImplements(s),this.body.setParent(this),e.push(this.body));else{const l={id:N.UUID.uuid(),version:1,type:n.FunctionDeclaration,name:s.name,description:null,inputs:[],index:null,returnStatements:[],calls:[],collapsed:!1,private:!1,implements:s.toJSON(),x:0,y:0,parent:this.toReference()},p=R(l,this.project);p.initChildren(),p.setParent(this),p.addSelfToProject(),t.push(p)}return{self:this,updated:g(e),added:g(t),removed:g(i)}}syncChildren(){const e=[],t=[],i=[],{updated:a,added:s,removed:o}=this.syncBody();e.push(...a),t.push(...s),i.push(...o);const{updated:l,added:p,removed:y}=this.syncInputMaps();e.push(...l),t.push(...p),i.push(...y);const{updated:h,added:m,removed:b}=this.syncTerminationStatements();e.push(...h),t.push(...m),i.push(...b);const{updated:v,added:P,removed:A}=this.syncBodyArgumentsDeclarations();e.push(...v),t.push(...P),i.push(...A);const{updated:I,added:$,removed:F}=this.syncOutputsDeclarations();e.push(...I),t.push(...$),i.push(...F);const{updated:re,added:Ve,removed:_t}=this.syncOutputMaps();return e.push(...re),t.push(...Ve),i.push(..._t),{self:this,updated:g(e),added:g(t),removed:g(i)}}};c(W,"CURRENT_ITERATION_NUMBER_ARG_NAME","Current iteration number"),c(W,"CURRENT_VALUE_ARG_NAME","Current value"),c(W,"MUTABLE_BASE_PROPERTIES",[]),c(W,"INMUTABLE_BASE_PROPERTIES",["id","type","version"]),c(W,"BASE_PROPERTIES",[...W.MUTABLE_BASE_PROPERTIES,...W.INMUTABLE_BASE_PROPERTIES]),c(W,"MUTABLE_META_PROPERTIES",[...W.MUTABLE_BASE_PROPERTIES,"x","y"]),c(W,"INMUTABLE_META_PROPERTIES",[...W.INMUTABLE_BASE_PROPERTIES]),c(W,"META_PROPERTIES",[...W.MUTABLE_META_PROPERTIES,...W.INMUTABLE_META_PROPERTIES]),c(W,"MUTABLE_UPSTREAM_PROPERTIES",["calledBySuccess","calledByError","calledByEntry"]),c(W,"INMUTABLE_UPSTREAM_PROPERTIES",["parent","declaration"]),c(W,"UPSTREAM_PROPERTIES",[...W.MUTABLE_UPSTREAM_PROPERTIES,...W.INMUTABLE_UPSTREAM_PROPERTIES]),c(W,"MUTABLE_DOWNSTREAM_PROPERTIES",["body","inputs","outputs","outputsDeclarations","successCalls","errorCalls","error","breakStatements","continueStatements"]),c(W,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),c(W,"DOWNSTREAM_PROPERTIES",[...W.MUTABLE_DOWNSTREAM_PROPERTIES,...W.INMUTABLE_DOWNSTREAM_PROPERTIES]),c(W,"PROPERTIES",[...W.META_PROPERTIES,...W.UPSTREAM_PROPERTIES,...W.DOWNSTREAM_PROPERTIES]);let wr=W;function s2(r){const e=r6(),t=r.toJSON();e.safeParse(t).success,r.inputs.forEach(o=>o.validate());const s=[...Sn(r)];return ae(r.errors,s)}const be=class be{constructor(e,t){c(this,"initialData");c(this,"id");c(this,"version");c(this,"x");c(this,"y");c(this,"type",n.Condition);c(this,"successCalls",[]);c(this,"errorCalls",[]);c(this,"declaration");c(this,"inputs",[]);c(this,"calledBySuccess",[]);c(this,"calledByError",[]);c(this,"calledByEntry",[]);c(this,"project");c(this,"errors",[]);c(this,"parent");c(this,"initialized",!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 h=_(e.parent);i=t.get(h)}const a=e.calledByEntry.map(h=>{const m=_(h);return t.get(m)}),s=e.calledBySuccess.map(h=>{const m=_(h);return t.get(m)}),o=e.calledByError.map(h=>{const m=_(h);return t.get(m)});let l;if(e.declaration){const h=_(e.declaration);l=t.get(h)}const p={id:e.id,version:1,type:n.Condition,declaration:l,calledByEntry:a,calledBySuccess:s,calledByError:o,errorCalls:[],successCalls:[],inputs:[],x:0,y:0,parent:i},y=R(p,t);return y.setParent(i),y.initChildren(),y}static validateGenerationTarget(e,t){let i=JSON.parse(JSON.stringify(e));const a=[],s=Je(i,{parent:{list:!1,types:[...ct,n.Project],optional:!0}},t);return i=s.modifiedData,a.push(...s.errors,...Ne(i)),e.declaration?t.get(e.declaration)?t.conditionDeclarations.find(p=>p.id===e.declaration)||a.push(new E({id:`${e.id}--${f.InvalidImplementsReference}`,code:f.InvalidImplementsReference,severity:T.Error,message:`Entity of type '${e.type}' with id '${e.id}' has an 'declaration' property that isn't pointing to an action descriptor reserved for '${n.Condition}' entities.
|
|
54
54
|
${Vo(t)}`,issue:null})):a.push(new E({id:`${e.id}--${f.ReferencedEntityNotFound}`,code:f.ReferencedEntityNotFound,severity:T.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 '${n.Condition}' entities.
|
|
55
55
|
${Vo(t)}`,issue:null})):a.push(new E({id:`${e.id}--${S.InvalidObjectStructure}`,code:S.InvalidObjectStructure,severity:T.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 '${n.Condition}' entities.
|
|
56
56
|
${Vo(t)}`,issue:null})),{errors:a,modifiedData:i}}validateGeneratedUpdate(e){const t=[];return e.parent&&t.push(new E({id:`${this.id}--${f.InvalidParentUpdate}`,code:f.InvalidParentUpdate,severity:T.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.
|
|
@@ -62,7 +62,7 @@ If an entity is called by another, they must be in the same scope, which means t
|
|
|
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(){const e=[this],t=[],i=[];return this.parent===this.project&&this.project.addVariableInstance(this),this.readsValue&&(this.readsValue.addValueReader(this),e.push(this.readsValue)),this.writesValues.forEach(a=>{a.setValueWriter(this),e.push(a)}),this.successCalls.forEach(a=>{a.addSuccessCaller(this),e.push(a)}),this.errorCalls.forEach(a=>{a.addErrorCaller(this),e.push(a)}),this.calledBySuccess.forEach(a=>{a.addSuccessCall(this),e.push(a)}),this.calledByError.forEach(a=>{a.addErrorCall(this),e.push(a)}),this.calledByEntry.forEach(a=>{a.addCall(this),e.push(a)}),{updated:g(e),added:g(t),removed:g(i),self:this}}get calledBy(){return[...this.calledByEntry,...this.calledBySuccess,...this.calledByError]}get usedInputs(){return this.inputs.filter(e=>e.readsValue||e.defaultValue)}get unusedInputs(){return this.inputs.filter(e=>!e.readsValue&&!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(){var e;if(this.initialized)return this;if(this.initialized=!0,this.initialData.declaration.type===n.GenericReference){const t=this.project.findSubscribedInstanceFromReference(this.initialData.declaration);if(!t)return this;this.declaration=t}else this.declaration=R(this.initialData.declaration,this.project),this.declaration.setParent(this.parent),this.declaration.initChildren();return Va.initWritesValues(this,this.parent),Ma.initReadsValue(this),this.initialData.inputs.forEach(t=>{const i=R(t,this.project);return i.setParent(this),i.initChildren(),this.addInput(i),i}),this.initialData.outputs.forEach(t=>{const i=R(t,this.project);return i.setParent(this),i.initChildren(),this.addOutput(i),i}),this.successCalls=this.initialData.successCalls.map(t=>{const i=R(t,this.project);return i.addSuccessCaller(this),[n.BreakStatement,n.ContinueStatement].includes(i.type)?(i.setParent(this.parent.parent),i.initChildren()):i.type!==n.InternalCall&&(i.setParent(this.parent),i.initChildren()),i}),this.errorCalls=this.initialData.errorCalls.map(t=>{const i=R(t,this.project);return i.addErrorCaller(this),[n.BreakStatement,n.ContinueStatement].includes(i.type)?(i.setParent(this.parent.parent),i.initChildren()):i.type!==n.InternalCall&&(i.setParent(this.parent),i.initChildren()),i}),this.internalCalls=this.initialData.internalCalls.reduce((t,i)=>{if(i.type===n.GenericReference){const a=this.project.findSubscribedInstanceFromReference(i);if(!a)return t;const s=a;return s.setParent(this),[...t,s]}else{const a=R(i,this.project);return a.setParent(this),a.initChildren(),[...t,a]}},[]),this.generateUnusedInputs(),this.generateUnusedOutputs(),this.generateUnusedInternalCalls(),this.declaration.subscribeInstance(this),(!this.declaration.dataType||(e=this.declaration.dataType)!=null&&e.inferred)&&this.declaration.inferDataTypeAndSyncInstancesInputsAndOutputs(),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),Ua(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:l}=s.remove({ignoreUpstream:!0,seenEntities:t});i.push(...o),a.push(...l)}),this.outputs.forEach(s=>{const{affected:o,removed:l}=s.remove({ignoreUpstream:!0,seenEntities:t});i.push(...o),a.push(...l)}),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:l}=s.remove({ignoreUpstream:!0,seenEntities:t});i.push(...o),a.push(...l)}),e||this.calledBy.forEach(s=>{i.push(s),s.removeCall(this)}),this.declaration.removeInstance(this),{affected:g(i),removed:g(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:g(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+"--"+N.UUID.uuid()+"--ref",type:n.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===n.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=T2(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 ue(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([n.CustomEntity,n.PrimitiveEntity,n.BuiltInBaseEntity].includes(this.declaration.dataType.entity.type)){const e=[...this.declaration.dataType.entity.properties,...this.declaration.dataType.entity.extendedProperties];e.filter(s=>!s.getDataType()).forEach(s=>{const o=this.inputs.find(y=>C(y,this.project)===C(s,this.project));if(!o)return;const l=this.declaration.getMasterInputWithValueWritterFromAllInstances(o);if(!l)return;const p=sn(l);s.setDataType(p),o.setDeclaration(s)}),e.filter(s=>!this.inputs.find(o=>{var l;return((l=o.declaration)==null?void 0:l.id)===s.id})).forEach(s=>{const o={id:N.UUID.uuid(),version:1,type:n.InputMap,parent:this.toReference(),name:null,description:null,declaration:s,defaultValue:null,index:s.index,readsValue:null},l=R(o,this.project);return l.setParent(this),l.initChildren(),l.suggestion=!0,this.addInput(l),l}),this.inputs.filter(s=>!s.declaration).forEach(s=>{const o=e.find(l=>C(l,this.project)===C(s,this.project));o&&s.setDeclaration(o)})}}else return[];else return[];return[]}generateUnusedOutputs(){if(this.declaration.dataType)if(this.declaration.dataType.entity){if([n.CustomEntity,n.PrimitiveEntity,n.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:N.UUID.uuid(),version:1,type:n.OutputMap,parent:this.toReference(),declaration:i,index:i.index,writesValues:[]},s=R(a,this.project);return s.setParent(this),s.initChildren(),s.suggestion=!0,this.addOutput(s),s})}else return[];else return[];return[]}generateUnusedInternalCalls(){if(this.declaration.dataType)if(this.declaration.dataType.entity){if([n.CustomEntity,n.PrimitiveEntity,n.BuiltInBaseEntity].includes(this.declaration.dataType.entity.type))return[...this.declaration.dataType.entity.getAllInteractiveMethods()].filter(i=>!this.internalCalls.find(s=>{var l,p,y,h,m;return(((l=s.declaration)==null?void 0:l.id)||((y=(p=s.initialData)==null?void 0:p.declaration)==null?void 0:y.entityId)||((m=(h=s.initialData)==null?void 0:h.declaration)==null?void 0:m.id))===i.id})).map(i=>{const a=i.createInternalCall(this);return a.suggestion=!0,this.addInternalCall(a),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)}};c(ue,"MUTABLE_BASE_PROPERTIES",[]),c(ue,"INMUTABLE_BASE_PROPERTIES",["id","type","version"]),c(ue,"BASE_PROPERTIES",[...ue.MUTABLE_BASE_PROPERTIES,...ue.INMUTABLE_BASE_PROPERTIES]),c(ue,"MUTABLE_META_PROPERTIES",[...ue.MUTABLE_BASE_PROPERTIES,"x","y"]),c(ue,"INMUTABLE_META_PROPERTIES",[...ue.INMUTABLE_BASE_PROPERTIES]),c(ue,"META_PROPERTIES",[...ue.MUTABLE_META_PROPERTIES,...ue.INMUTABLE_META_PROPERTIES]),c(ue,"MUTABLE_UPSTREAM_PROPERTIES",["calledBySuccess","calledByError","calledByEntry","readsValue"]),c(ue,"INMUTABLE_UPSTREAM_PROPERTIES",["declaration","parent"]),c(ue,"UPSTREAM_PROPERTIES",[...ue.MUTABLE_UPSTREAM_PROPERTIES,...ue.INMUTABLE_UPSTREAM_PROPERTIES]),c(ue,"MUTABLE_DOWNSTREAM_PROPERTIES",["writesValues","inputs","outputs","successCalls","errorCalls","internalCalls"]),c(ue,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),c(ue,"DOWNSTREAM_PROPERTIES",[...ue.MUTABLE_DOWNSTREAM_PROPERTIES,...ue.INMUTABLE_DOWNSTREAM_PROPERTIES]),c(ue,"PROPERTIES",[...ue.META_PROPERTIES,...ue.UPSTREAM_PROPERTIES,...ue.DOWNSTREAM_PROPERTIES]);let Mr=ue;function E2(r){var s;const e=U9(),t=r.toJSON();e.safeParse(t).success,(s=r.dataType)==null||s.validate();const a=[];if(r.id==="iterate-over-employee-list-continue-statement-employee-dto-output-decl-id"){const o=z({id:`${r.id}--${M.PropertyImplementsNonAbstact}`,message:`Property "${C(r,r.project)}" with id "${r.id}" implements a non-abstract property "${C(r,r.project)}" with id "${r.id}".`,issue:null,severity:T.Error,code:M.PropertyImplementsNonAbstact,entity:r});a.push(o.error)}return ae(r.errors,a)}const Re=class Re{constructor(e,t){c(this,"initialData");c(this,"id");c(this,"version");c(this,"name");c(this,"description",null);c(this,"index");c(this,"required");c(this,"isError");c(this,"type",n.ReturnDeclaration);c(this,"dataType",null);c(this,"readsValue",null);c(this,"implements",null);c(this,"project");c(this,"errors",[]);c(this,"parent");c(this,"initialized",!1);c(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=_(e.parent),a=t.get(i);let s=null;if(e.readsValue){const p=_(e.readsValue);s=t.get(p)}const o={id:e.id,version:1,name:e.name,type:n.ReturnDeclaration,index:a.outputs.length,isError:!1,description:e.description,implements:null,required:e.required,readsValue:s,dataType:null,parent:a},l=R(o,t);return l.setParent(a),l.initChildren(),l}static validateGenerationTarget(e,t){var l,p;let i=JSON.parse(JSON.stringify(e));const a=[],s=Je(i,{parent:{list:!1,types:[n.ReturnStatement,n.Search,n.BreakStatement,n.ContinueStatement]}},t),o=yu(i,t);if(i=s.modifiedData,i.parent){const y=t.get(_(i.parent));if(y&&[n.BreakStatement,n.ContinueStatement].includes(y.type)){const h=y,m=h.parent,b=[...m.breakStatements.filter(P=>P.id!==y.id),...m.continueStatements.filter(P=>P.id!==y.id)];if(h.outputs.length)a.push(new E({id:`${i.id}--${S.NoOverlapWithImplementedSignature}`,code:S.NoOverlapWithImplementedSignature,severity:T.Error,message:`Entity of type '${n.ReturnDeclaration}' with id '${i.id}' cannot be added to the parent entity of type '${h.type}' with id '${h.id}'. This '${h.type}' already has return declarations.
|
|
64
64
|
${bu}`,issue:null}));else{const P=(p=(l=b[0])==null?void 0:l.outputs[0])==null?void 0:p.name;P!==i.name&&a.push(new E({id:`${i.id}--${S.NoOverlapWithImplementedSignature}`,code:S.NoOverlapWithImplementedSignature,severity:T.Error,message:`Entity of type '${n.ReturnDeclaration}' with id '${i.id}' cannot be added to the parent entity of type '${h.type}' with id '${h.id}'. This new 'return-declaration' doesn't have the same name "${P}" as the return declarations on the other statements in the same scope.
|
|
65
|
-
${bu}`,issue:null}))}}else if(y&&y.type===n.ReturnStatement){const h=y.parent;if(h&&Ge.includes(h.type)){const m=h.implements;if(m){const b=m.outputs.find(
|
|
65
|
+
${bu}`,issue:null}))}}else if(y&&y.type===n.ReturnStatement){const h=y.parent;if(h&&Ge.includes(h.type)){const m=h.implements;if(m){const b=m.outputs.find(F=>F.name===i.name),v=m.outputs.filter(F=>!y.outputs.find(Ve=>Ve.type===n.ReturnDeclaration&&Ve.name===F.name)),P=y.outputs.filter(F=>F.type===n.ReturnDeclaration),A=P.find(F=>F.name===i.name),I=P.length?`The parent entity already implements the following return declarations: ${U(P.map(F=>`'${F.id}' (${F.name})`),", "," and ")}.`:"The parent entity does not yet have any implemented return declarations.",$=v.length?`The parent entity is still missing the following returns in the implementation: ${U(v.map(F=>`'${F.id}' (${F.name})`),", "," and ")}.`:"The parent entity has all the returns it needs implemented.";b?A&&a.push(new E({id:`${i.id}--${S.NoOverlapWithImplementedSignature}`,code:S.NoOverlapWithImplementedSignature,severity:T.Error,message:`Entity of type '${n.ReturnDeclaration}' with id '${i.id}' should not exist in a parent entity of type '${y.type}' with id '${y.id}' that implements a ${n.ActionDescriptor} with fixed outputs.
|
|
66
66
|
Adding a new return would make the implementation invalid. An return with the same name already exists in the parent entity.
|
|
67
67
|
${I}
|
|
68
68
|
${$}`,issue:null})):a.push(new E({id:`${i.id}--${S.NoOverlapWithImplementedSignature}`,code:S.NoOverlapWithImplementedSignature,severity:T.Error,message:`Entity of type '${n.ReturnDeclaration}' with id '${i.id}' should not exist in a parent entity of type '${y.type}' with id '${y.id}' that implements a ${n.ActionDescriptor} with fixed outputs.
|
|
@@ -106,7 +106,7 @@ Only 'function-call', 'search' and 'internal-call' entities can have input-maps
|
|
|
106
106
|
The parent entity of type '${o.type}' with id '${o.id}' is not compatible with this type of declaration.
|
|
107
107
|
Only variables can have input-maps whose 'declaration' points to 'property' entities.`,issue:null})):o&&l.type===n.ValueDescriptor&&![n.Condition,n.Operation,n.Loop].includes(o.type)&&a.push(new E({id:`${i.id}--${f.InvalidInputMapDeclaration}`,code:f.InvalidInputMapDeclaration,severity:T.Error,message:`Entity of type '${n.InputMap}' with id '${i.id}' has a 'declaration' property pointing to an entity with type '${n.ValueDescriptor}' with id '${i.declaration}'.
|
|
108
108
|
The parent entity of type '${o.type}' with id '${o.id}' is not compatible with this type of declaration.
|
|
109
|
-
Only 'condition', 'operation' and 'loop' entities can have input-maps whose 'declaration' points to 'value-descriptor' entities.`,issue:null})):a.push(new E({id:`${i.id}--${f.InvalidInputMapDeclaration}`,code:f.InvalidInputMapDeclaration,severity:T.Error,message:`Entity of type '${n.InputMap}' with id '${i.id}' must have a 'declaration' property pointing to a '${
|
|
109
|
+
Only 'condition', 'operation' and 'loop' entities can have input-maps whose 'declaration' points to 'value-descriptor' entities.`,issue:null})):a.push(new E({id:`${i.id}--${f.InvalidInputMapDeclaration}`,code:f.InvalidInputMapDeclaration,severity:T.Error,message:`Entity of type '${n.InputMap}' with id '${i.id}' must have a 'declaration' property pointing to a '${U([n.Property,n.ArgumentDeclaration,n.ValueDescriptor],"', '","' or '")}' entity.
|
|
110
110
|
Only input-map entities for variables with an inferred data type are allowed to not have a declaration.
|
|
111
111
|
This is because a dynamically assembled object can have new properties added to it as input-maps. Otherwise all input maps need to point to a declaration`,issue:null})):a.push(new E({id:`${i.id}--${f.ReferencedEntityNotFound}`,code:f.ReferencedEntityNotFound,severity:T.Error,message:`Entity of type '${n.InputMap}' with id '${i.id}' has a 'declaration' property that points to an entity with id '${i.declaration}' that isn't yet found in the project. Perhaps it should be created first. Or perhaps the ID is incorrect.`,issue:null})):(!ke.includes(o.type)||ke.includes(o.type)&&!((y=o.getDataType())!=null&&y.inferred))&&a.push(new E({id:`${i.id}--${f.InvalidInputMapDeclaration}`,code:f.InvalidInputMapDeclaration,severity:T.Error,message:`Entity of type '${n.InputMap}' with id '${i.id}' must have a 'declaration' property pointing to a 'argument-declaration' or 'property' entity.
|
|
112
112
|
Only input-map entities for variables with an inferred data type are allowed to not have a declaration.
|
|
@@ -115,7 +115,7 @@ Any value reads can be done with that input-map instead.
|
|
|
115
115
|
You can't edit input-map entities as they need to match their argument declarations, so you can only modify the 'readsValue' property so it reads the value from an external entity, or the 'defaultValue' so it has a hard-coded one.`,issue:null}));else if(ke.includes(o.type)){const b=Or(o).dataType,v=b==null?void 0:b.entity;v&&v.type===n.ActionDescriptor?a.push(new E({id:`${i.id}--${S.NoOverlapWithImplementedSignature}`,code:S.NoOverlapWithImplementedSignature,severity:T.Error,message:`Entity of type '${n.InputMap}' with id '${i.id}' cannot be added to the parent entity of type '${o.type}' with id '${o.id}'. The data type of the 'variable-declaration' is a 'action-descriptor' entity.
|
|
116
116
|
This means it can hold a function-call or operation as its value, to be executed programatically.
|
|
117
117
|
Input maps can only be added to variables which hold an entity with properties.`,issue:null})):v&&!(b!=null&&b.inferred)&&(v.properties.find(A=>A.id===l.id)||a.push(new E({id:`${i.id}--${S.NoOverlapWithImplementedSignature}`,code:S.NoOverlapWithImplementedSignature,severity:T.Error,message:`Entity of type '${n.InputMap}' with id '${i.id}' cannot be added to the parent entity of type '${o.type}' with id '${o.id}'. The 'declaration' with '${l.id}' of the 'input-map' does not exist in the entity of the 'data-type'.
|
|
118
|
-
The entity of the data-type has the following properties that can be reads as input maps, ids: '${
|
|
118
|
+
The entity of the data-type has the following properties that can be reads as input maps, ids: '${U(v.properties.map(A=>A.id),"', '","' and '")}'`,issue:null})))}else if(Ue.filter(h=>ke.includes(h)).includes(o.type)){const m=wu(o),b=m.find(P=>P.id===i.declaration),v=`The parent entity has the following argument declarations that can be referenced by input-maps, ids: '${U(m.map(P=>P.id),"', '","' and '")}'`;b||a.push(new E({id:`${i.id}--${S.NoOverlapWithImplementedSignature}`,code:S.NoOverlapWithImplementedSignature,severity:T.Error,message:`Entity of type '${n.InputMap}' with id '${i.id}' cannot be added to the parent entity of type '${o.type}' with id '${o.id}'. The parent entity does not have an 'argument-declaration' with id '${i.declaration}'.
|
|
119
119
|
You can't add an input-map to an entity that doesn't have a matching 'argument-declaration'.
|
|
120
120
|
${v}`,issue:null}))}}return a.push(...s.errors,...Ne(i)),{errors:a,modifiedData:i}}validateGeneratedUpdate(e){const t=[];let i=JSON.parse(JSON.stringify(e));const a=Ga(i,this);return i=a.modifiedData,t.push(...a.errors),i.parent&&t.push(new E({id:`${this.id}--${f.InvalidParentUpdate}`,code:f.InvalidParentUpdate,severity:T.Error,message:`Entity of type '${this.type}' with id '${this.id}' cannot have the 'parent' property updated, as it would mean moving the '${this.type}' entity to another parent entity.
|
|
121
121
|
This is likely an incorrect strategy, either the '${this.type}' entity doesn't need to be updated or it should be deleted and a new one created in the desired parent.`,issue:null})),{errors:t,modifiedData:i}}addSelfToProject(){var a,s;const e=[this],t=[],i=[];if(this.parent.addInput(this),e.push(this.parent),(a=this.readsValue)==null||a.addValueReader(this),this.readsValue&&e.push(this.readsValue),ke.includes(this.parent.type)&&((s=this.parent.getDataType())!=null&&s.inferred)){const o=this.parent.type===n.VariableDeclaration?this.parent:this.parent.declaration;o.inferDataTypeAndSyncInstancesInputsAndOutputs(),e.push(o,...o.variableInstances)}return{updated:g(e),added:g(t),removed:g(i),self:this}}setParent(e){return this.parent=e,this}setDataType(e){return this.dataType=e,this}removeDataType(){return this.dataType=null,this}setDeclaration(e){return this.declaration=e,this}initChildren(){return this.initialized?this:(this.initialized=!0,this.initialData.defaultValue&&(this.defaultValue=R(this.initialData.defaultValue,this.project),this.defaultValue.setParent(this),this.defaultValue.initChildren()),this.initialData.declaration&&(this.declaration=R(this.initialData.declaration,this.project)),Ma.initReadsValue(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}sync(e){return this.version=e.version||this.version,this.index=e.index||(e.index!==0?this.index:0),this.name=e.name||this.name,this.description=e.description||this.description,this}async load(){return this}async create(){return this}async update(e){return this.sync(e),Ua(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.defaultValue&&(i.push(this.defaultValue),this.defaultValue.remove({ignoreUpstream:!0,seenEntities:t})),e||(i.push(this.parent),this.parent.removeInput(this)),{affected:i,removed:a})}restore({seenEntities:e}={seenEntities:new Set}){const t=[];return e.has(this.id)?{affected:[],self:this}:(e.add(this.id),this.subscribe(),this.readsValue&&(t.push(this.readsValue),this.readsValue.addValueReader(this)),this.defaultValue&&(t.push(this.defaultValue),this.defaultValue.restore({seenEntities:e})),t.push(this.parent),this.parent.addInput(this),{affected:t,self:this})}toFlat(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this,...this.defaultValue?this.defaultValue.toFlat(e):[]])}toFlatIds(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.id,...this.defaultValue?this.defaultValue.toFlatIds(e):[]])}toJSON(){var e,t,i;return{id:this.id,version:this.version,type:this.type,index:this.index,name:this.name,description:this.description,defaultValue:((e=this.defaultValue)==null?void 0:e.toJSON())||null,declaration:((t=this.declaration)==null?void 0:t.toJSON())||null,readsValue:((i=this.readsValue)==null?void 0:i.toReference())||null,parent:this.parent.toReference()}}toReference(){return{id:this.id+"--"+N.UUID.uuid()+"--ref",type:n.GenericReference,entityId:this.id,entityType:this.type}}toShallowJSON(){var e,t,i;return{id:this.id,version:this.version,type:this.type,name:this.name,description:this.description,index:this.index,defaultValue:((e=this.defaultValue)==null?void 0:e.toReference())||null,declaration:((t=this.declaration)==null?void 0:t.toReference())||null,readsValue:((i=this.readsValue)==null?void 0:i.toReference())||null,parent:this.parent.toReference()}}toFlatJSON(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toShallowJSON(),...this.defaultValue?this.defaultValue.toFlatJSON(e):[]])}toGenerationTarget(){var e;return{id:this.id,name:this.name||void 0,description:this.description||void 0,type:this.type,declaration:((e=this.declaration)==null?void 0:e.id)||null,parent:this.parent.id}}toFlatGenerationTarget(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toGenerationTarget(),...this.defaultValue?this.defaultValue.toFlatGenerationTarget(e):[]])}clearErrors(){var e;return this.errors=[],(e=this.defaultValue)==null||e.clearErrors(),this}validate(){const e=I2(this);return this.errors=e,{success:!0,error:null,data:this.toJSON()}}getErrors(){return[...this.errors]}getShallowErrors(){return this.errors}getDefaultValue(){var e,t;return this.defaultValue||((t=(e=this.declaration)==null?void 0:e.dataType)==null?void 0:t.defaultValue)||null}setDefaultValue(e){return this.defaultValue=e,this}clone(e=null,t=null,i=!0){var h;const a=this.toJSON(),s=t||He(C(this,this.project),n.InputMap,this.project);a.defaultValue=null;const o=s.split("-id"),l=o[o.length-1||0]||s;a.id=s;const p=xt(a,this.project);e?p.setParent(e):p.setParent(this.parent),i&&p.subscribe(),p.initChildren();const y=(h=this.defaultValue)==null?void 0:h.clone(p,l+"--default-value-id",i);return p.defaultValue=y||null,p}getDataType(){var t;if(this.parent.type===n.Operation)return this.parent.declaration.inferInputMapDataType(this);if(ke.includes(this.parent.type)){const i=Or(this.parent),a=i.getDataType();(!a||a.inferred)&&i.inferDataTypeAndSyncInstancesInputsAndOutputs()}const e=(t=this.declaration)==null?void 0:t.getDataType();if(!e){const i=sn(this);if(i)return i}return e||null}};c(ve,"MUTABLE_BASE_PROPERTIES",["name","description"]),c(ve,"INMUTABLE_BASE_PROPERTIES",["id","version","type"]),c(ve,"BASE_PROPERTIES",[...ve.MUTABLE_BASE_PROPERTIES,...ve.INMUTABLE_BASE_PROPERTIES]),c(ve,"MUTABLE_META_PROPERTIES",[...ve.MUTABLE_BASE_PROPERTIES,"index"]),c(ve,"INMUTABLE_META_PROPERTIES",[...ve.INMUTABLE_BASE_PROPERTIES]),c(ve,"META_PROPERTIES",[...ve.MUTABLE_META_PROPERTIES,...ve.INMUTABLE_META_PROPERTIES]),c(ve,"MUTABLE_UPSTREAM_PROPERTIES",["readsValue"]),c(ve,"INMUTABLE_UPSTREAM_PROPERTIES",["parent","declaration"]),c(ve,"UPSTREAM_PROPERTIES",[...ve.MUTABLE_UPSTREAM_PROPERTIES,...ve.INMUTABLE_UPSTREAM_PROPERTIES]),c(ve,"MUTABLE_DOWNSTREAM_PROPERTIES",["defaultValue"]),c(ve,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),c(ve,"DOWNSTREAM_PROPERTIES",[...ve.MUTABLE_DOWNSTREAM_PROPERTIES,...ve.INMUTABLE_DOWNSTREAM_PROPERTIES]),c(ve,"PROPERTIES",[...ve.META_PROPERTIES,...ve.UPSTREAM_PROPERTIES,...ve.DOWNSTREAM_PROPERTIES]);let An=ve;class D2 extends An{constructor(t,i){super(t,i);c(this,"declaration",null);c(this,"parent");c(this,"errors",[])}toJSON(){return super.toJSON()}}class P2 extends An{constructor(t,i){super(t,i);c(this,"name",null);c(this,"description",null);c(this,"declaration");c(this,"parent");c(this,"errors",[])}toJSON(){return super.toJSON()}}function A2(r){const e=H9(),t=r.toJSON();e.safeParse(t).success;const a=[];if(r.id==="exec-sequentially-return-map-id"){const s=z({id:`${r.id}--${M.PropertyImplementsNonAbstact}`,message:`Property "${C(r,r.project)}" with id "${r.id}" implements a non-abstract property "${C(r,r.project)}" with id "${r.id}".`,issue:null,severity:T.Error,code:M.PropertyImplementsNonAbstact,entity:r});a.push(s.error)}return ae(r.errors,a)}const ye=class ye{constructor(e,t){c(this,"initialData");c(this,"id");c(this,"version");c(this,"index");c(this,"type",n.OutputMap);c(this,"parentRelationType");c(this,"declaration");c(this,"writesValues",[]);c(this,"dataType");c(this,"project");c(this,"errors",[]);c(this,"parent");c(this,"initialized",!1);c(this,"suggestion",!1);this.initialData=e,this.project=t,this.id=e.id,this.version=e.version,this.index=e.index,this.parentRelationType=e.parentRelationType}static fromGenerationTarget(e,t){const i=_(e.parent),a=t.get(i);let s;if(e.declaration){const p=_(e.declaration);s=t.get(p)}const o={id:e.id,version:1,type:n.OutputMap,index:(a.outputs||[]).length,declaration:s,writesValues:[],parent:a},l=R(o,t);return l.setParent(a),l.initChildren(),l}static validateGenerationTarget(e,t){var l;let i=JSON.parse(JSON.stringify(e));const a=[],s=Je(i,{parent:{list:!1,types:Ue.filter(p=>p!==n.Condition)},declaration:{list:!1,types:[n.ReturnDeclaration,n.Property]}},t);i=s.modifiedData;const o=t.get(i.parent);if(o&&Ue.filter(p=>p!==n.Condition).includes(o.type)){const p=o.outputs.find(y=>y.declaration.id===_(i.declaration));if(p)a.push(new E({id:`${i.id}--${f.OutputOverwrite}`,code:f.OutputOverwrite,severity:T.Error,message:`Entity of type '${n.OutputMap}' with id '${i.id}' cannot be added to the parent entity of type '${o.type}' with id '${o.id}'. The parent already has an output-map with id '${p.id}' that points to the same base 'return-declaration'.
|
|
@@ -123,12 +123,12 @@ Any value reads can be done with that output-map instead.
|
|
|
123
123
|
You can't edit output-map entities as they need to match their return declarations, so you can only choose to read their outputted value if you need it.`,issue:null}));else{const y=t.get(i.declaration);if(y&&ke.includes(o.type)){const h=Or(o),m=h.dataType,b=(l=h.dataType)==null?void 0:l.entity;m?b?b.type===n.ActionDescriptor?a.push(new E({id:`${i.id}--${S.NoOverlapWithImplementedSignature}`,code:S.NoOverlapWithImplementedSignature,severity:T.Error,message:`Entity of type '${n.OutputMap}' with id '${i.id}' cannot be added to the parent entity of type '${o.type}' with id '${o.id}'. The data type of the 'variable-declaration' is a 'action-descriptor' entity.
|
|
124
124
|
This means it can hold a function-call or operation as its value, to be executed programatically.
|
|
125
125
|
Output maps can only be added to variables which hold an entity with properties.`,issue:null})):b.properties.find(P=>P.id===y.id)||a.push(new E({id:`${i.id}--${S.NoOverlapWithImplementedSignature}`,code:S.NoOverlapWithImplementedSignature,severity:T.Error,message:`Entity of type '${n.OutputMap}' with id '${i.id}' cannot be added to the parent entity of type '${o.type}' with id '${o.id}'. The 'declaration' with '${y.id}' of the 'output-map' does not exist in the entity of the 'data-type'.
|
|
126
|
-
The entity of the data-type has the following properties that can be reads as output maps, ids: '${
|
|
126
|
+
The entity of the data-type has the following properties that can be reads as output maps, ids: '${U(b.properties.map(P=>P.id),"', '","' and '")}'`,issue:null})):a.push(new E({id:`${i.id}--${S.NoOverlapWithImplementedSignature}`,code:S.NoOverlapWithImplementedSignature,severity:T.Error,message:`Entity of type '${n.OutputMap}' with id '${i.id}' cannot be added to the parent entity of type '${o.type}' with id '${o.id}'. The data type of the 'variable-declaration' doesn't have an 'entity' set, so it cannot be determined if the output-map is reading a valid property of the data type entity.
|
|
127
127
|
${Ru}`,issue:null})):a.push(new E({id:`${i.id}--${S.NoOverlapWithImplementedSignature}`,code:S.NoOverlapWithImplementedSignature,severity:T.Error,message:`Entity of type '${n.OutputMap}' with id '${i.id}' cannot be added to the parent entity of type '${o.type}' with id '${o.id}'. The data type of the 'variable-declaration' is not set, so it cannot be determined if the output-map is reading a valid property of the data type entity.
|
|
128
128
|
${Ru}`,issue:null}))}else if(y){const h=o.outputs.find(m=>m.declaration.id===i.declaration);h&&a.push(new E({id:`${i.id}--${f.OutputOverwrite}`,code:f.OutputOverwrite,severity:T.Error,message:`Entity of type '${n.OutputMap}' with id '${i.id}' cannot be added to the parent entity of type '${o.type}' with id '${o.id}'. The parent already has an output-map with id '${h.id}' that points to the same declaration.
|
|
129
129
|
Any value reads can be done with that output-map instead.
|
|
130
130
|
You can't edit output-map entities as they need to match their return declarations, so you can only choose to read their outputted value if you need it.`,issue:null}))}}}return a.push(...s.errors,...Ne(i)),{errors:a,modifiedData:i}}validateGeneratedUpdate(e){const t=[];return e.parent&&t.push(new E({id:`${this.id}--${f.InvalidParentUpdate}`,code:f.InvalidParentUpdate,severity:T.Error,message:`Entity of type '${this.type}' with id '${this.id}' cannot have the 'parent' property updated, as it would mean moving the '${this.type}' entity to another parent entity.
|
|
131
|
-
This is likely an incorrect strategy, either the '${this.type}' entity doesn't need to be updated or it should be deleted and a new one created in the desired parent.`,issue:null})),{errors:t,modifiedData:e}}addSelfToProject(){const e=[this],t=[],i=[];return this.parent.addOutput(this),this.writesValues.forEach(a=>{a.setValueWriter(this),e.push(a)}),{updated:g(e),added:g(t),removed:g(i),self: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}setDataType(e){return this.dataType=e,this}removeDataType(){return this.dataType=null,this}setDeclaration(e){return this.declaration=e,this}initChildren(){return this.initialized?this:(this.initialized=!0,Va.initWritesValues(this,this.parent.parent),this.initialData.declaration&&(this.declaration=R(this.initialData.declaration,this.project)),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.index=e.index||(e.index!==0?this.index:0),this.parentRelationType=e.parentRelationType||this.parentRelationType,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.writesValues.forEach(s=>{i.push(s),s.readsValue=null}),e||(i.push(this.parent),this.parent.removeOutput(this)),{affected:i,removed:a})}restore({seenEntities:e}={seenEntities:new Set}){const t=[];return e.has(this.id)?{affected:[],self:this}:(e.add(this.id),this.subscribe(),this.writesValues.forEach(i=>{t.push(i),i.setValueWriter(this)}),t.push(this.parent),this.parent.addOutput(this),{affected:t,self:this})}toFlat(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this,...this.writesValues.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))])}toJSON(){return{id:this.id,version:this.version,type:this.type,index:this.index,parentRelationType:this.parentRelationType,writesValues:this.writesValues.map(e=>e.toJSON()),declaration:this.declaration.toJSON(),parent:this.parent.toReference()}}toReference(){return{id:this.id+"--"+N.UUID.uuid()+"--ref",type:n.GenericReference,entityId:this.id,entityType:this.type}}toShallowJSON(){return{id:this.id,version:this.version,type:this.type,index:this.index,parentRelationType:this.parentRelationType,declaration:this.declaration.toReference(),writesValues:this.writesValues.map(e=>e.toReference()),parent:this.parent.toReference()}}toFlatJSON(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toShallowJSON(),...this.writesValues.flatMap(i=>i.toFlatJSON(e))])}toGenerationTarget(){return{id:this.id,type:this.type,declaration:this.declaration.id,parent:this.parent.id}}toFlatGenerationTarget(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toGenerationTarget(),...this.writesValues.flatMap(i=>i.toFlatGenerationTarget(e))])}clearErrors(){return this.errors=[],this}validate(){const e=A2(this);return this.errors=e,{success:!0,error:null,data:this.toJSON()}}getErrors(){return[...this.errors]}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 ye(this.toJSON(),this.project)}getDataType(){var t;return this.parent.type===n.Operation?this.parent.declaration.inferOutputMapDataType(this):((t=this.declaration)==null?void 0:t.getDataType())||null}};c(ye,"MUTABLE_BASE_PROPERTIES",[]),c(ye,"INMUTABLE_BASE_PROPERTIES",["id","type","version"]),c(ye,"BASE_PROPERTIES",[...ye.MUTABLE_BASE_PROPERTIES,...ye.INMUTABLE_BASE_PROPERTIES]),c(ye,"MUTABLE_META_PROPERTIES",[...ye.MUTABLE_BASE_PROPERTIES,"index"]),c(ye,"INMUTABLE_META_PROPERTIES",[...ye.INMUTABLE_BASE_PROPERTIES]),c(ye,"META_PROPERTIES",[...ye.MUTABLE_META_PROPERTIES,...ye.INMUTABLE_META_PROPERTIES]),c(ye,"MUTABLE_UPSTREAM_PROPERTIES",[]),c(ye,"INMUTABLE_UPSTREAM_PROPERTIES",["parent","declaration"]),c(ye,"UPSTREAM_PROPERTIES",[...ye.MUTABLE_UPSTREAM_PROPERTIES,...ye.INMUTABLE_UPSTREAM_PROPERTIES]),c(ye,"MUTABLE_DOWNSTREAM_PROPERTIES",["writesValues"]),c(ye,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),c(ye,"DOWNSTREAM_PROPERTIES",[...ye.MUTABLE_DOWNSTREAM_PROPERTIES,...ye.INMUTABLE_DOWNSTREAM_PROPERTIES]),c(ye,"PROPERTIES",[...ye.META_PROPERTIES,...ye.UPSTREAM_PROPERTIES,...ye.DOWNSTREAM_PROPERTIES]);let On=ye;class O2 extends On{constructor(t,i){super(t,i);c(this,"declaration");c(this,"parent");c(this,"errors",[])}toJSON(){return super.toJSON()}}class S2 extends On{constructor(t,i){super(t,i);c(this,"declaration");c(this,"parent");c(this,"errors",[])}toJSON(){return super.toJSON()}}function C2(r){var s;const e=C3(),t=r.toJSON();e.safeParse(t).success,(s=r.dataType)==null||s.validate();const a=[];if(r.id==="company-dto-func-declaration-argument-dcl-id"){const o=z({id:`${r.id}--${M.PropertyImplementsNonAbstact}`,message:`Property "${C(r,r.project)}" with id "${r.id}" implements a non-abstract property "${C(r,r.project)}" with id "${r.id}".`,issue:null,severity:T.Error,code:M.PropertyImplementsNonAbstact,entity:r});a.push(o.error)}if(r.id==="manual-hello-world-loop-current-iteration-number-output-map-id"){const o=z({id:`${r.id}--${M.PropertyImplementsNonAbstact}`,message:`Property "${C(r,r.project)}" with id "${r.id}" implements a non-abstract property "${C(r,r.project)}" with id "${r.id}".`,issue:null,severity:T.Error,code:M.PropertyImplementsNonAbstact,entity:r});a.push(o.error)}return ae(r.errors,a)}const Ie=class Ie{constructor(e,t){c(this,"initialData");c(this,"id");c(this,"version");c(this,"name");c(this,"description",null);c(this,"index");c(this,"required");c(this,"type",n.ArgumentDeclaration);c(this,"dataType",null);c(this,"writesValues",[]);c(this,"implements",null);c(this,"project");c(this,"errors",[]);c(this,"parent");c(this,"initialized",!1);c(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}static fromGenerationTarget(e,t){const i=_(e.parent),a=t.get(i),s={id:e.id,version:1,name:e.name,type:n.ArgumentDeclaration,index:a.inputs.length,description:e.description,required:e.required,implements:null,dataType:null,writesValues:[],parent:a},o=R(s,t);return o.setParent(a),o.initChildren(),o}static validateGenerationTarget(e,t){let i=JSON.parse(JSON.stringify(e));const a=[],s=Je(i,{parent:{list:!1,types:[n.FunctionDeclaration,n.Search,n.Condition]}},t);i=s.modifiedData;const o=pu(i,t);if(i.parent){const l=t.get(_(i.parent));if(l&&Ge.includes(l.type)){const p=l.implements;if(p){const y=p.inputs.find(A=>A.name===i.name),h=p.inputs.filter(A=>!l.inputs.find($=>$.type===n.ArgumentDeclaration&&$.name===A.name)),m=l.inputs.filter(A=>A.type===n.ArgumentDeclaration),b=m.find(A=>A.name===i.name),v=m.length?`The parent entity already implements the following arguments: ${
|
|
131
|
+
This is likely an incorrect strategy, either the '${this.type}' entity doesn't need to be updated or it should be deleted and a new one created in the desired parent.`,issue:null})),{errors:t,modifiedData:e}}addSelfToProject(){const e=[this],t=[],i=[];return this.parent.addOutput(this),this.writesValues.forEach(a=>{a.setValueWriter(this),e.push(a)}),{updated:g(e),added:g(t),removed:g(i),self: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}setDataType(e){return this.dataType=e,this}removeDataType(){return this.dataType=null,this}setDeclaration(e){return this.declaration=e,this}initChildren(){return this.initialized?this:(this.initialized=!0,Va.initWritesValues(this,this.parent.parent),this.initialData.declaration&&(this.declaration=R(this.initialData.declaration,this.project)),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.index=e.index||(e.index!==0?this.index:0),this.parentRelationType=e.parentRelationType||this.parentRelationType,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.writesValues.forEach(s=>{i.push(s),s.readsValue=null}),e||(i.push(this.parent),this.parent.removeOutput(this)),{affected:i,removed:a})}restore({seenEntities:e}={seenEntities:new Set}){const t=[];return e.has(this.id)?{affected:[],self:this}:(e.add(this.id),this.subscribe(),this.writesValues.forEach(i=>{t.push(i),i.setValueWriter(this)}),t.push(this.parent),this.parent.addOutput(this),{affected:t,self:this})}toFlat(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this,...this.writesValues.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))])}toJSON(){return{id:this.id,version:this.version,type:this.type,index:this.index,parentRelationType:this.parentRelationType,writesValues:this.writesValues.map(e=>e.toJSON()),declaration:this.declaration.toJSON(),parent:this.parent.toReference()}}toReference(){return{id:this.id+"--"+N.UUID.uuid()+"--ref",type:n.GenericReference,entityId:this.id,entityType:this.type}}toShallowJSON(){return{id:this.id,version:this.version,type:this.type,index:this.index,parentRelationType:this.parentRelationType,declaration:this.declaration.toReference(),writesValues:this.writesValues.map(e=>e.toReference()),parent:this.parent.toReference()}}toFlatJSON(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toShallowJSON(),...this.writesValues.flatMap(i=>i.toFlatJSON(e))])}toGenerationTarget(){return{id:this.id,type:this.type,declaration:this.declaration.id,parent:this.parent.id}}toFlatGenerationTarget(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toGenerationTarget(),...this.writesValues.flatMap(i=>i.toFlatGenerationTarget(e))])}clearErrors(){return this.errors=[],this}validate(){const e=A2(this);return this.errors=e,{success:!0,error:null,data:this.toJSON()}}getErrors(){return[...this.errors]}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 ye(this.toJSON(),this.project)}getDataType(){var t;return this.parent.type===n.Operation?this.parent.declaration.inferOutputMapDataType(this):((t=this.declaration)==null?void 0:t.getDataType())||null}};c(ye,"MUTABLE_BASE_PROPERTIES",[]),c(ye,"INMUTABLE_BASE_PROPERTIES",["id","type","version"]),c(ye,"BASE_PROPERTIES",[...ye.MUTABLE_BASE_PROPERTIES,...ye.INMUTABLE_BASE_PROPERTIES]),c(ye,"MUTABLE_META_PROPERTIES",[...ye.MUTABLE_BASE_PROPERTIES,"index"]),c(ye,"INMUTABLE_META_PROPERTIES",[...ye.INMUTABLE_BASE_PROPERTIES]),c(ye,"META_PROPERTIES",[...ye.MUTABLE_META_PROPERTIES,...ye.INMUTABLE_META_PROPERTIES]),c(ye,"MUTABLE_UPSTREAM_PROPERTIES",[]),c(ye,"INMUTABLE_UPSTREAM_PROPERTIES",["parent","declaration"]),c(ye,"UPSTREAM_PROPERTIES",[...ye.MUTABLE_UPSTREAM_PROPERTIES,...ye.INMUTABLE_UPSTREAM_PROPERTIES]),c(ye,"MUTABLE_DOWNSTREAM_PROPERTIES",["writesValues"]),c(ye,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),c(ye,"DOWNSTREAM_PROPERTIES",[...ye.MUTABLE_DOWNSTREAM_PROPERTIES,...ye.INMUTABLE_DOWNSTREAM_PROPERTIES]),c(ye,"PROPERTIES",[...ye.META_PROPERTIES,...ye.UPSTREAM_PROPERTIES,...ye.DOWNSTREAM_PROPERTIES]);let On=ye;class O2 extends On{constructor(t,i){super(t,i);c(this,"declaration");c(this,"parent");c(this,"errors",[])}toJSON(){return super.toJSON()}}class S2 extends On{constructor(t,i){super(t,i);c(this,"declaration");c(this,"parent");c(this,"errors",[])}toJSON(){return super.toJSON()}}function C2(r){var s;const e=C3(),t=r.toJSON();e.safeParse(t).success,(s=r.dataType)==null||s.validate();const a=[];if(r.id==="company-dto-func-declaration-argument-dcl-id"){const o=z({id:`${r.id}--${M.PropertyImplementsNonAbstact}`,message:`Property "${C(r,r.project)}" with id "${r.id}" implements a non-abstract property "${C(r,r.project)}" with id "${r.id}".`,issue:null,severity:T.Error,code:M.PropertyImplementsNonAbstact,entity:r});a.push(o.error)}if(r.id==="manual-hello-world-loop-current-iteration-number-output-map-id"){const o=z({id:`${r.id}--${M.PropertyImplementsNonAbstact}`,message:`Property "${C(r,r.project)}" with id "${r.id}" implements a non-abstract property "${C(r,r.project)}" with id "${r.id}".`,issue:null,severity:T.Error,code:M.PropertyImplementsNonAbstact,entity:r});a.push(o.error)}return ae(r.errors,a)}const Ie=class Ie{constructor(e,t){c(this,"initialData");c(this,"id");c(this,"version");c(this,"name");c(this,"description",null);c(this,"index");c(this,"required");c(this,"type",n.ArgumentDeclaration);c(this,"dataType",null);c(this,"writesValues",[]);c(this,"implements",null);c(this,"project");c(this,"errors",[]);c(this,"parent");c(this,"initialized",!1);c(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}static fromGenerationTarget(e,t){const i=_(e.parent),a=t.get(i),s={id:e.id,version:1,name:e.name,type:n.ArgumentDeclaration,index:a.inputs.length,description:e.description,required:e.required,implements:null,dataType:null,writesValues:[],parent:a},o=R(s,t);return o.setParent(a),o.initChildren(),o}static validateGenerationTarget(e,t){let i=JSON.parse(JSON.stringify(e));const a=[],s=Je(i,{parent:{list:!1,types:[n.FunctionDeclaration,n.Search,n.Condition]}},t);i=s.modifiedData;const o=pu(i,t);if(i.parent){const l=t.get(_(i.parent));if(l&&Ge.includes(l.type)){const p=l.implements;if(p){const y=p.inputs.find(A=>A.name===i.name),h=p.inputs.filter(A=>!l.inputs.find($=>$.type===n.ArgumentDeclaration&&$.name===A.name)),m=l.inputs.filter(A=>A.type===n.ArgumentDeclaration),b=m.find(A=>A.name===i.name),v=m.length?`The parent entity already implements the following arguments: ${U(m.map(A=>`'${A.id}' (${A.name})`),", "," and ")}.`:"The parent entity does not yet have any implemented arguments.",P=h.length?`The parent entity is still missing the following arguments in the implementation: ${U(h.map(A=>`'${A.id}' (${A.name})`),", "," and ")}.`:"The parent entity has all the arguments it needs implemented.";y?b&&a.push(new E({id:`${i.id}--${S.NoOverlapWithImplementedSignature}`,code:S.NoOverlapWithImplementedSignature,severity:T.Error,message:`Entity of type '${n.ArgumentDeclaration}' with id '${i.id}' should not exist in a parent entity of type '${l.type}' with id '${l.id}' that implements a ${n.ActionDescriptor} with fixed arguments.
|
|
132
132
|
Adding a new argument would make the implementation invalid. An argument with the same name already exists in the parent entity.
|
|
133
133
|
${v}
|
|
134
134
|
${P}`,issue:null})):a.push(new E({id:`${i.id}--${S.NoOverlapWithImplementedSignature}`,code:S.NoOverlapWithImplementedSignature,severity:T.Error,message:`Entity of type '${n.ArgumentDeclaration}' with id '${i.id}' should not exist in a parent entity of type '${l.type}' with id '${l.id}' that implements a ${n.ActionDescriptor} with fixed arguments.
|
|
@@ -157,7 +157,7 @@ You shouldn't have to manually update a 'parent' property.
|
|
|
157
157
|
Specifically for return statements the parent needs to always be the 'function-declaration' or 'global-event' that contains it.`,issue:null})),{errors:t,modifiedData:e}}addSelfToProject(){const e=[this],t=[],i=[];return this.calledByEntry.forEach(a=>{a.addCall(this),e.push(a)}),this.calledBySuccess.forEach(a=>{a.addSuccessCall(this),e.push(a)}),this.calledByError.forEach(a=>{a.addErrorCall(this),e.push(a)}),this.parent.addReturnStatement(this),e.push(this.parent),{updated:g(e),added:g(t),removed:g(i),self:this}}get calledBy(){return[...this.calledByEntry,...this.calledBySuccess,...this.calledByError]}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}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}addOutputDeclaration(e){return this.outputs.find(t=>t.id===e.id)||this.outputs.push(e),this}removeOutputDeclaration(e){return this.outputs=this.outputs.filter(t=>t.id!==e.id),this}setParent(e){return this.parent=e,this}initChildren(){return this.initialized?this:(this.initialized=!0,this.outputs=this.initialData.outputs.map(e=>{const t=R(e,this.project);return t.setParent(this),t.initChildren(),t}),this.initialData.throws&&(this.throws=R(this.initialData.throws,this.project),this.throws.setParent(this),this.throws.initChildren()),this.parent.addReturnStatement(this),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=[];if(t.has(this.id))return{affected:[],removed:[]};if(t.add(this.id),a.push(this),this.unsubscribe(),this.outputs.forEach(s=>{const{affected:o,removed:l}=s.remove({ignoreUpstream:!0,seenEntities:t});i.push(...o),a.push(...l)}),this.throws){const{affected:s,removed:o}=this.throws.remove({ignoreUpstream:!0,seenEntities:t});i.push(...s),a.push(...o)}return this.parent.removeReturnStatement(this),e||this.calledBy.forEach(s=>{i.push(s),s.removeCall(this)}),{affected:g(i),removed:g(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.outputs.forEach(i=>{const{affected:a}=i.restore({seenEntities:e});t.push(...a)}),this.throws){const{affected:i}=this.throws.restore({seenEntities:e});t.push(...i)}return this.parent.addReturnStatement(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:g(t),self:this}}toFlat(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this,...this.outputs.flatMap(i=>i.toFlat(e)),...this.throws?this.throws.toFlat(e):[]])}toFlatIds(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.id,...this.outputs.flatMap(i=>i.toFlatIds(e)),...this.throws?this.throws.toFlatIds(e):[]])}toJSON(){var e,t;return{id:this.id,version:this.version,type:this.type,x:this.x,y:this.y,calledBySuccess:this.calledBySuccess.map(i=>i.toReference()),calledByError:this.calledByError.map(i=>i.toReference()),calledByEntry:this.calledByEntry.map(i=>i.toReference()),outputs:this.outputs.map(i=>i.toJSON()),parent:((e=this.parent)==null?void 0:e.toReference())||null,throws:((t=this.throws)==null?void 0:t.toJSON())||null}}toReference(){return{id:this.id+"--"+N.UUID.uuid()+"--ref",type:n.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,outputs:this.outputs.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()),throws:((e=this.throws)==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.outputs.flatMap(i=>i.toFlatJSON(e)),...this.throws?this.throws.toFlatJSON(e):[]])}toGenerationTarget(){return{id:this.id,type:this.type,calledByEntry:this.calledByEntry.map(e=>e.id),calledByError:this.calledByError.map(e=>e.id),calledBySuccess:this.calledBySuccess.map(e=>e.id),parent:this.parent.id}}toFlatGenerationTarget(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toGenerationTarget(),...this.outputs.flatMap(i=>i.toFlatGenerationTarget(e)),...this.throws?this.throws.toFlatGenerationTarget(e):[]])}clearErrors(){var e;return this.errors=[],this.outputs.forEach(t=>t.clearErrors()),(e=this.throws)==null||e.clearErrors(),this}validate(){const e=_2(this);return this.errors=e,{success:!0,error:null,data:this.toJSON()}}getErrors(){return[...this.errors,...this.outputs.flatMap(t=>t.getErrors())]}getShallowErrors(){return this.errors}clone(e){return new lt(this.toJSON(),this.project)}};c(lt,"MUTABLE_BASE_PROPERTIES",[]),c(lt,"INMUTABLE_BASE_PROPERTIES",["id","version","type"]),c(lt,"BASE_PROPERTIES",[...Tt.MUTABLE_BASE_PROPERTIES,...Tt.INMUTABLE_BASE_PROPERTIES]),c(lt,"MUTABLE_META_PROPERTIES",["x","y"]),c(lt,"INMUTABLE_META_PROPERTIES",[...Tt.INMUTABLE_BASE_PROPERTIES]),c(lt,"META_PROPERTIES",[...Tt.MUTABLE_META_PROPERTIES,...Tt.INMUTABLE_META_PROPERTIES]),c(lt,"MUTABLE_UPSTREAM_PROPERTIES",["calledBySuccess","calledByError","calledByEntry","parent"]),c(lt,"INMUTABLE_UPSTREAM_PROPERTIES",[]),c(lt,"UPSTREAM_PROPERTIES",[...Tt.MUTABLE_UPSTREAM_PROPERTIES,...Tt.INMUTABLE_UPSTREAM_PROPERTIES]),c(lt,"MUTABLE_DOWNSTREAM_PROPERTIES",["outputs","throws"]),c(lt,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),c(lt,"DOWNSTREAM_PROPERTIES",[...Tt.MUTABLE_DOWNSTREAM_PROPERTIES,...Tt.INMUTABLE_DOWNSTREAM_PROPERTIES]),c(lt,"PROPERTIES",[...Bt.META_PROPERTIES,...Bt.UPSTREAM_PROPERTIES,...Bt.DOWNSTREAM_PROPERTIES]);let $r=lt;function M2(r){var s;const e=q9(),t=r.toJSON();e.safeParse(t).success,r.outputs.forEach(o=>o.validate()),(s=r.throws)==null||s.validate();const a=[];return ae(r.errors,a)}const Ae=class Ae{constructor(e,t){c(this,"initialData");c(this,"id");c(this,"version");c(this,"x");c(this,"y");c(this,"type",n.BreakStatement);c(this,"outputs",[]);c(this,"calledBySuccess",[]);c(this,"calledByError",[]);c(this,"calledByEntry",[]);c(this,"throws",null);c(this,"project");c(this,"errors",[]);c(this,"parent");c(this,"initialized",!1);c(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){const i=_(e.parent),a=t.get(i),s=e.calledByEntry.map(h=>{const m=_(h);return t.get(m)}),o=e.calledBySuccess.map(h=>{const m=_(h);return t.get(m)}),l=e.calledByError.map(h=>{const m=_(h);return t.get(m)}),p={id:e.id,version:1,type:n.BreakStatement,x:0,y:0,outputs:[],calledBySuccess:o,calledByError:l,calledByEntry:s,throws:null,parent:a},y=R(p,t);return y.setParent(a),y.initChildren(),y}static validateGenerationTarget(e,t){let i=JSON.parse(JSON.stringify(e));const a=[],s=Je(i,{parent:{list:!1,types:[n.Loop]}},t);return i=s.modifiedData,a.push(...s.errors,...Ne(i)),{errors:a,modifiedData:i}}validateGeneratedUpdate(e){const t=[];return e.parent&&t.push(new E({id:`${this.id}--${f.InvalidParentUpdate}`,code:f.InvalidParentUpdate,severity:T.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.
|
|
158
158
|
If an entity is called by another, they must be in the same scope, which means they have the same parent.
|
|
159
159
|
You shouldn't have to manually update a 'parent' property.
|
|
160
|
-
Specifically for break statements the parent needs to always be the 'loop' entity that contains it.`,issue:null})),{errors:t,modifiedData:e}}addSelfToProject(){const e=[this],t=[],i=[];return this.calledByEntry.forEach(a=>{a.addCall(this),e.push(a)}),this.calledBySuccess.forEach(a=>{a.addSuccessCall(this),e.push(a)}),this.calledByError.forEach(a=>{a.addErrorCall(this),e.push(a)}),this.parent.addBreakStatement(this),e.push(this.parent),{updated:g(e),added:g(t),removed:g(i),self:this}}get calledBy(){return[...this.calledByEntry,...this.calledBySuccess,...this.calledByError]}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}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}addOutputDeclaration(e){return this.outputs.find(t=>t.id===e.id)||this.outputs.push(e),this}removeOutputDeclaration(e){return this.outputs=this.outputs.filter(t=>t.id!==e.id),this}setParent(e){return this.parent=e,this}initChildren(){return this.initialized?this:(this.initialized=!0,this.outputs=this.initialData.outputs.map(e=>{const t=R(e,this.project);return t.setParent(this),t.initChildren(),t}),this.initialData.throws&&(this.throws=R(this.initialData.throws,this.project),this.throws.setParent(this),this.throws.initChildren()),this.parent.addBreakStatement(this),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=[];if(t.has(this.id))return{affected:[],removed:[]};if(t.add(this.id),a.push(this),this.unsubscribe(),this.outputs.forEach(s=>{const{affected:o,removed:l}=s.remove({ignoreUpstream:!0,seenEntities:t});i.push(...o),a.push(...l)}),this.throws){const{affected:s,removed:o}=this.throws.remove({ignoreUpstream:!0,seenEntities:t});i.push(...s),a.push(...o)}return this.parent.removeBreakStatement(this),e||this.calledBy.forEach(s=>{i.push(s),s.removeCall(this)}),{affected:g(i),removed:g(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.outputs.forEach(i=>{const{affected:a}=i.restore({seenEntities:e});t.push(...a)}),this.throws){const{affected:i}=this.throws.restore({seenEntities:e});t.push(...i)}return this.parent.addBreakStatement(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:g(t),self:this}}toFlat(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this,...this.outputs.flatMap(i=>i.toFlat(e)),...this.throws?this.throws.toFlat(e):[]])}toFlatIds(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.id,...this.outputs.flatMap(i=>i.toFlatIds(e)),...this.throws?this.throws.toFlatIds(e):[]])}toJSON(){var e,t;return{id:this.id,version:this.version,type:this.type,x:this.x,y:this.y,outputs:this.outputs.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:((e=this.parent)==null?void 0:e.toReference())||null,throws:((t=this.throws)==null?void 0:t.toJSON())||null}}toReference(){return{id:this.id+"--"+N.UUID.uuid()+"--ref",type:n.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,outputs:this.outputs.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()),throws:((e=this.throws)==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.outputs.flatMap(i=>i.toFlatJSON(e)),...this.throws?this.throws.toFlatJSON(e):[]])}toGenerationTarget(){return{id:this.id,type:this.type,calledByEntry:this.calledByEntry.map(e=>e.id),calledByError:this.calledByError.map(e=>e.id),calledBySuccess:this.calledBySuccess.map(e=>e.id),parent:this.parent.id}}toFlatGenerationTarget(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toGenerationTarget(),...this.outputs.flatMap(i=>i.toFlatGenerationTarget(e)),...this.throws?this.throws.toFlatGenerationTarget(e):[]])}clearErrors(){var e;return this.errors=[],this.outputs.forEach(t=>t.clearErrors()),(e=this.throws)==null||e.clearErrors(),this}validate(){const e=M2(this);return this.errors=e,{success:!0,error:null,data:this.toJSON()}}getErrors(){return[...this.errors,...this.outputs.flatMap(t=>t.getErrors()),...this.throws?this.throws.getErrors():[]]}getShallowErrors(){return this.errors}clone(e){return new Ae(this.toJSON(),this.project)}};c(Ae,"MUTABLE_BASE_PROPERTIES",[]),c(Ae,"INMUTABLE_BASE_PROPERTIES",["id","version","type"]),c(Ae,"BASE_PROPERTIES",[...Ae.MUTABLE_BASE_PROPERTIES,...Ae.INMUTABLE_BASE_PROPERTIES]),c(Ae,"MUTABLE_META_PROPERTIES",["x","y"]),c(Ae,"INMUTABLE_META_PROPERTIES",[...Ae.INMUTABLE_BASE_PROPERTIES]),c(Ae,"META_PROPERTIES",[...Ae.MUTABLE_META_PROPERTIES,...Ae.INMUTABLE_META_PROPERTIES]),c(Ae,"MUTABLE_UPSTREAM_PROPERTIES",["calledBySuccess","calledByError","calledByEntry","parent"]),c(Ae,"INMUTABLE_UPSTREAM_PROPERTIES",[]),c(Ae,"UPSTREAM_PROPERTIES",[...Ae.MUTABLE_UPSTREAM_PROPERTIES,...Ae.INMUTABLE_UPSTREAM_PROPERTIES]),c(Ae,"MUTABLE_DOWNSTREAM_PROPERTIES",["outputs","throws"]),c(Ae,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),c(Ae,"DOWNSTREAM_PROPERTIES",[...Ae.MUTABLE_DOWNSTREAM_PROPERTIES,...Ae.INMUTABLE_DOWNSTREAM_PROPERTIES]),c(Ae,"PROPERTIES",[...Ae.META_PROPERTIES,...Ae.UPSTREAM_PROPERTIES,...Ae.DOWNSTREAM_PROPERTIES]);let Oi=Ae;function V2(r){const e=nD(),t=r.toJSON();e.safeParse(t).success,r.inputs.flatMap(s=>s.validate()),r.outputs.flatMap(s=>s.validate());const a=[];return ae(r.errors,a)}const Oe=class Oe{constructor(e,t){c(this,"initialData");c(this,"id");c(this,"version");c(this,"name");c(this,"description",null);c(this,"type",n.ActionDescriptor);c(this,"inputs",[]);c(this,"outputs",[]);c(this,"error",null);c(this,"implementation",null);c(this,"parent",null);c(this,"errors",[]);c(this,"project");c(this,"initialized",!1);c(this,"autoexecutable",!1);this.initialData=e,this.project=t,this.id=e.id,this.version=e.version,this.name=e.name,this.description=e.description}static fromGenerationTarget(e,t){let i=null;if(e.parent){const o=_(e.parent);i=t.get(o)}const a={id:e.id,version:1,name:e.name,type:n.ActionDescriptor,description:e.description,inputs:[],outputs:[],error:null,parent:i},s=R(a,t);return i&&s.setParent(i),s.initChildren(),s}static validateGenerationTarget(e,t){let i=JSON.parse(JSON.stringify(e));const a=[],s=Je(i,{parent:{list:!1,types:[n.CustomEntity,n.DataType]}},t);i=s.modifiedData;const o=i.parent?t.get(i.parent):null;if(o&&o.type===n.CustomEntity){const l=o,y=Xn(l).filter(h=>!h.interactive);if(y.length){let h=y.length>1?`The entity of type '${e.type}' with id '${e.id}' can't be added to the 'parent' entity with id '${l.id}' because it extends or implements multiple '${n.BuiltInBaseEntity}' entities that are non-interactive ("${
|
|
160
|
+
Specifically for break statements the parent needs to always be the 'loop' entity that contains it.`,issue:null})),{errors:t,modifiedData:e}}addSelfToProject(){const e=[this],t=[],i=[];return this.calledByEntry.forEach(a=>{a.addCall(this),e.push(a)}),this.calledBySuccess.forEach(a=>{a.addSuccessCall(this),e.push(a)}),this.calledByError.forEach(a=>{a.addErrorCall(this),e.push(a)}),this.parent.addBreakStatement(this),e.push(this.parent),{updated:g(e),added:g(t),removed:g(i),self:this}}get calledBy(){return[...this.calledByEntry,...this.calledBySuccess,...this.calledByError]}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}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}addOutputDeclaration(e){return this.outputs.find(t=>t.id===e.id)||this.outputs.push(e),this}removeOutputDeclaration(e){return this.outputs=this.outputs.filter(t=>t.id!==e.id),this}setParent(e){return this.parent=e,this}initChildren(){return this.initialized?this:(this.initialized=!0,this.outputs=this.initialData.outputs.map(e=>{const t=R(e,this.project);return t.setParent(this),t.initChildren(),t}),this.initialData.throws&&(this.throws=R(this.initialData.throws,this.project),this.throws.setParent(this),this.throws.initChildren()),this.parent.addBreakStatement(this),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=[];if(t.has(this.id))return{affected:[],removed:[]};if(t.add(this.id),a.push(this),this.unsubscribe(),this.outputs.forEach(s=>{const{affected:o,removed:l}=s.remove({ignoreUpstream:!0,seenEntities:t});i.push(...o),a.push(...l)}),this.throws){const{affected:s,removed:o}=this.throws.remove({ignoreUpstream:!0,seenEntities:t});i.push(...s),a.push(...o)}return this.parent.removeBreakStatement(this),e||this.calledBy.forEach(s=>{i.push(s),s.removeCall(this)}),{affected:g(i),removed:g(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.outputs.forEach(i=>{const{affected:a}=i.restore({seenEntities:e});t.push(...a)}),this.throws){const{affected:i}=this.throws.restore({seenEntities:e});t.push(...i)}return this.parent.addBreakStatement(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:g(t),self:this}}toFlat(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this,...this.outputs.flatMap(i=>i.toFlat(e)),...this.throws?this.throws.toFlat(e):[]])}toFlatIds(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.id,...this.outputs.flatMap(i=>i.toFlatIds(e)),...this.throws?this.throws.toFlatIds(e):[]])}toJSON(){var e,t;return{id:this.id,version:this.version,type:this.type,x:this.x,y:this.y,outputs:this.outputs.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:((e=this.parent)==null?void 0:e.toReference())||null,throws:((t=this.throws)==null?void 0:t.toJSON())||null}}toReference(){return{id:this.id+"--"+N.UUID.uuid()+"--ref",type:n.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,outputs:this.outputs.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()),throws:((e=this.throws)==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.outputs.flatMap(i=>i.toFlatJSON(e)),...this.throws?this.throws.toFlatJSON(e):[]])}toGenerationTarget(){return{id:this.id,type:this.type,calledByEntry:this.calledByEntry.map(e=>e.id),calledByError:this.calledByError.map(e=>e.id),calledBySuccess:this.calledBySuccess.map(e=>e.id),parent:this.parent.id}}toFlatGenerationTarget(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toGenerationTarget(),...this.outputs.flatMap(i=>i.toFlatGenerationTarget(e)),...this.throws?this.throws.toFlatGenerationTarget(e):[]])}clearErrors(){var e;return this.errors=[],this.outputs.forEach(t=>t.clearErrors()),(e=this.throws)==null||e.clearErrors(),this}validate(){const e=M2(this);return this.errors=e,{success:!0,error:null,data:this.toJSON()}}getErrors(){return[...this.errors,...this.outputs.flatMap(t=>t.getErrors()),...this.throws?this.throws.getErrors():[]]}getShallowErrors(){return this.errors}clone(e){return new Ae(this.toJSON(),this.project)}};c(Ae,"MUTABLE_BASE_PROPERTIES",[]),c(Ae,"INMUTABLE_BASE_PROPERTIES",["id","version","type"]),c(Ae,"BASE_PROPERTIES",[...Ae.MUTABLE_BASE_PROPERTIES,...Ae.INMUTABLE_BASE_PROPERTIES]),c(Ae,"MUTABLE_META_PROPERTIES",["x","y"]),c(Ae,"INMUTABLE_META_PROPERTIES",[...Ae.INMUTABLE_BASE_PROPERTIES]),c(Ae,"META_PROPERTIES",[...Ae.MUTABLE_META_PROPERTIES,...Ae.INMUTABLE_META_PROPERTIES]),c(Ae,"MUTABLE_UPSTREAM_PROPERTIES",["calledBySuccess","calledByError","calledByEntry","parent"]),c(Ae,"INMUTABLE_UPSTREAM_PROPERTIES",[]),c(Ae,"UPSTREAM_PROPERTIES",[...Ae.MUTABLE_UPSTREAM_PROPERTIES,...Ae.INMUTABLE_UPSTREAM_PROPERTIES]),c(Ae,"MUTABLE_DOWNSTREAM_PROPERTIES",["outputs","throws"]),c(Ae,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),c(Ae,"DOWNSTREAM_PROPERTIES",[...Ae.MUTABLE_DOWNSTREAM_PROPERTIES,...Ae.INMUTABLE_DOWNSTREAM_PROPERTIES]),c(Ae,"PROPERTIES",[...Ae.META_PROPERTIES,...Ae.UPSTREAM_PROPERTIES,...Ae.DOWNSTREAM_PROPERTIES]);let Oi=Ae;function V2(r){const e=nD(),t=r.toJSON();e.safeParse(t).success,r.inputs.flatMap(s=>s.validate()),r.outputs.flatMap(s=>s.validate());const a=[];return ae(r.errors,a)}const Oe=class Oe{constructor(e,t){c(this,"initialData");c(this,"id");c(this,"version");c(this,"name");c(this,"description",null);c(this,"type",n.ActionDescriptor);c(this,"inputs",[]);c(this,"outputs",[]);c(this,"error",null);c(this,"implementation",null);c(this,"parent",null);c(this,"errors",[]);c(this,"project");c(this,"initialized",!1);c(this,"autoexecutable",!1);this.initialData=e,this.project=t,this.id=e.id,this.version=e.version,this.name=e.name,this.description=e.description}static fromGenerationTarget(e,t){let i=null;if(e.parent){const o=_(e.parent);i=t.get(o)}const a={id:e.id,version:1,name:e.name,type:n.ActionDescriptor,description:e.description,inputs:[],outputs:[],error:null,parent:i},s=R(a,t);return i&&s.setParent(i),s.initChildren(),s}static validateGenerationTarget(e,t){let i=JSON.parse(JSON.stringify(e));const a=[],s=Je(i,{parent:{list:!1,types:[n.CustomEntity,n.DataType]}},t);i=s.modifiedData;const o=i.parent?t.get(i.parent):null;if(o&&o.type===n.CustomEntity){const l=o,y=Xn(l).filter(h=>!h.interactive);if(y.length){let h=y.length>1?`The entity of type '${e.type}' with id '${e.id}' can't be added to the 'parent' entity with id '${l.id}' because it extends or implements multiple '${n.BuiltInBaseEntity}' entities that are non-interactive ("${U(y.map(m=>C(m,m.project)),'", "','" and "')}").`:`The entity of type '${e.type}' with id '${e.id}' can't be added to the 'parent' entity with id '${l.id}' because it extends or implements a '${n.BuiltInBaseEntity}' entity that is non-interactive ("${C(y[0],y[0].project)}").`;h+=`
|
|
161
161
|
${Zn}`,a.push(new E({id:`${e.id}--${f.NonInteractiveEntityReferenced}`,code:f.NonInteractiveEntityReferenced,severity:T.Error,message:h,issue:null}))}}else if(o&&o.type===n.DataType){const l=o;l.entity&&a.push(new E({id:`${e.id}--${f.NewEntityWouldOverriteExisting}`,code:f.NewEntityWouldOverriteExisting,severity:T.Error,message:`The entity of type '${e.type}' with id '${e.id}' can't be added to the 'parent' entity with id '${l.id}' because it already has an 'entity' child. Data type entities can only have one 'entity' as children.
|
|
162
162
|
You can inspect the existing 'entity' field with the 'describe_entity' action. Like so:
|
|
163
163
|
${on({describe_entity:l.entity.id})}
|
|
@@ -172,9 +172,9 @@ Are you trying to update that entity?
|
|
|
172
172
|
If so, you should use the 'update' action for core mutable metadata properties, or 'delete' and then 'post' again to replace it.
|
|
173
173
|
If you are trying to create a new entity, please use a different id, for example: "${fu(t,e)}".`;return{errors:[new E({id:`duplicate--${t.id}--${f.EntityIdNotUnique}`,message:s,severity:T.Error,code:f.EntityIdNotUnique,issue:null})],modifiedData:r}}else if(i&&t.type!==n.GenericReference)return{errors:[new E({id:`${t.id}--${f.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: "${fu(t,e)}".`,severity:T.Error,code:f.EntityIdNotUnique,issue:null})],modifiedData:r};switch(t.type){case n.Project:return N.validateGenerationTarget(t,e);case n.CustomEntity:return jr.validateGenerationTarget(t,e);case n.Property:return Sr.validateGenerationTarget(t,e);case n.FunctionDeclaration:return Cr.validateGenerationTarget(t,e);case n.DataType:return Ii.validateGenerationTarget(t,e);case n.Operation:return Br.validateGenerationTarget(t,e);case n.FunctionCall:return Ur.validateGenerationTarget(t,e);case n.VariableDeclaration:return Nr.validateGenerationTarget(t,e);case n.VariableInstance:return Mr.validateGenerationTarget(t,e);case n.GlobalEvent:return Di.validateGenerationTarget(t,e);case n.InputMap:return An.validateGenerationTarget(t,e);case n.OutputMap:return On.validateGenerationTarget(t,e);case n.ArgumentDeclaration:return Gr.validateGenerationTarget(t,e);case n.ReturnDeclaration:return Bt.validateGenerationTarget(t,e);case n.Loop:return wr.validateGenerationTarget(t,e);case n.Condition:return _r.validateGenerationTarget(t,e);case n.Search:return Vr.validateGenerationTarget(t,e);case n.InstalledProject:return Lr.validateGenerationTarget(t,e);case n.InternalCall:return Pi.validateGenerationTarget(t,e);case n.PrimitiveValue:return Ai.validateGenerationTarget(t,e);case n.ReturnStatement:return $r.validateGenerationTarget(t,e);case n.BreakStatement:return Oi.validateGenerationTarget(t,e);case n.ContinueStatement:return Tt.validateGenerationTarget(t,e);case n.ActionDescriptor:return te.validateGenerationTarget(t,e);case n.ValueDescriptor:return Fr.validateGenerationTarget(t,e);case n.BuiltInBaseEntity:case n.PrimitiveEntity:{const s="Did you mean to generate a",l={[n.BuiltInBaseEntity]:`${s} '${n.CustomEntity}' instead?`,[n.PrimitiveEntity]:`${s} '${n.CustomEntity}' instead?`}[t.type]||"";return{errors:[new E({id:`${t.id}--${f.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.
|
|
174
174
|
${l}`,severity:T.Error,code:f.BuiltInEntityGenerated,issue:null})],modifiedData:r}}default:{const s=t;return{errors:[new E({id:`${s.id}--${f.UnknownEntityType}`,message:`Incorrect entity implementation for entity with id "${s.id}". Entity type "${s.type}" is not supported.`,severity:T.Error,code:f.UnknownEntityType,issue:null})],modifiedData:null}}}}function So(r){const e=jo(r.type),t=e.MUTABLE_BASE_PROPERTIES,i=e.MUTABLE_UPSTREAM_PROPERTIES;let a=`Only mutable core metadata properties can be updated, no nested entities or references. You can alternatively delete the entity and create a new one with the updated values.
|
|
175
|
-
For entities of type "${r.type}", `;if(t.length>0?a+=`you can update the following metadata properties: '${
|
|
175
|
+
For entities of type "${r.type}", `;if(t.length>0?a+=`you can update the following metadata properties: '${U(t,"', '","' and '")}'. `:a+="there are no mutable metadata properties.",i.length>0){const s=t.length>0?`
|
|
176
176
|
You can also update the following upstream references: `:`
|
|
177
|
-
But can update the following upstream entity references: `;a+=`${s}'${
|
|
177
|
+
But can update the following upstream entity references: `;a+=`${s}'${U(i,"', '","' and '")}'.`}else a+=t.length>0?`
|
|
178
178
|
And there are no upstream references that can be updated.`:`
|
|
179
179
|
There are no upstream references that can be updated.`;return a}function $2(r,e){const t=[];let i=!1;if(Wr.includes(e.type)&&t.push(new E({id:`${e.id}--${f.BuiltInEntityGenerated}`,message:`Entity with id "${e.id} is of "${e.type}" type and should not be updated. Built in entities can only be referenced by user created entities.`,severity:T.Error,code:f.BuiltInEntityGenerated,issue:null})),r.id&&(t.push(new E({id:`last-action--${f.InvalidUpdateEntityOperation}`,code:f.InvalidUpdateEntityOperation,severity:T.Error,message:`The 'id' property cannot be updated in the 'update' action payload. The id of the entity is '${r.id}'. Only mutable core metadata properties can be updated, no nested entities or references. You can alternatively delete the entity and create a new one with the updated 'id'.`,issue:null})),i=!0),r.type&&(t.push(new E({id:`last-action--${f.InvalidUpdateEntityOperation}`,code:f.InvalidUpdateEntityOperation,severity:T.Error,message:`The 'type' property cannot be updated in the 'update' action payload. The type of the entity is '${e.type}'. Only mutable core metadata properties can be updated, no nested entities or references. You can alternatively delete the entity and create a new one with the updated 'type'.`,issue:null})),i=!0),t.length)return{errors:t,modifiedData:null,messageAddition:""};if(Ge.includes(e.type)?r.calls&&t.push(new E({id:`${e.id}--${f.InvalidInmutablePropertyOverride}`,message:`Entity of type "${e.type}" with id "${e.id}" cannot have the property "calls" updated.
|
|
180
180
|
${zn}`,severity:T.Error,code:f.InvalidInmutablePropertyOverride,issue:null})):Ue.includes(e.type)&&(r.successCalls&&t.push(new E({id:`${e.id}--${f.InvalidInmutablePropertyOverride}`,message:`Entity of type "${e.type}" with id "${e.id}" cannot have the property "successCalls" updated.
|
|
@@ -189,16 +189,16 @@ All downstream references are managed by the downstream entity. Entities only ma
|
|
|
189
189
|
To modify '${I}', target the entity that it points to and its equivalent property.`,severity:T.Error,code:f.InvalidDownstreamPropertyOverride,issue:null})),i=!0)}),(a.INMUTABLE_UPSTREAM_PROPERTIES||[]).forEach(I=>{r[I]&&!Sa(r[I])&&(t.push(new E({id:`${e.id}--${f.InvalidInmutablePropertyOverride}`,message:`Entity of type "${e.type}" with id "${e.id}" cannot have the property "${I}" updated. It is an inmutable property that is set only when the entity is created.
|
|
190
190
|
If you need to update this property, you should delete the entity and create a new one with the updated value.`,severity:T.Error,code:f.InvalidInmutablePropertyOverride,issue:null})),i=!0)});const A=a.PROPERTIES||[];A.length>0&&Object.keys(r).forEach(I=>{A.includes(I)||t.push(new E({id:`${e.id}--${f.UnrecognizedProperty}`,message:`Entity of type "${e.type}" with id "${e.id}" has an unrecognized property "${I}" that will be ignored.`,severity:T.Warning,code:f.UnrecognizedProperty,issue:null}))})}if(t.length)return{errors:t,modifiedData:null,messageAddition:i?So(e):""};const s=UP(e),o=s==null?void 0:s.partial(),l=o==null?void 0:o.safeParse(r),p={...r,id:e.id,type:e.type},y=mu(p,l);if(t.push(...y),t.length)return{errors:t,modifiedData:null,messageAddition:i?So(e):""};const m=e.validateGeneratedUpdate(r);return{errors:[...t,...m.errors],modifiedData:m.modifiedData,messageAddition:i?So(e):""}}function UP(r){switch(r.type){case n.PrimitiveValue:return to();case n.CustomEntity:return wd();case n.PrimitiveEntity:return to();case n.FunctionDeclaration:return Cd();case n.GlobalEvent:return co();case n.DataType:return gd();case n.Property:return ad();case n.FunctionCall:return yd();case n.Condition:return fd();case n.Operation:return so();case n.VariableDeclaration:return Id();case n.VariableInstance:return Dd();case n.OutputMap:return pd();case n.ReturnDeclaration:return cd();case n.ArgumentDeclaration:return Sd();case n.InputMap:return Ed();case n.Project:return Bd();case n.InstalledProject:return z6();case n.ActionDescriptor:return ro();case n.ReturnStatement:return ld();case n.Loop:return ro();case n.Search:return hd();case n.ValueDescriptor:return id();case n.BuiltInBaseEntity:return sd();case n.InternalCall:return Td();case n.ContinueStatement:return od();case n.BreakStatement:return dd();default:return null}}function xP(r){switch(r.type){case n.PrimitiveValue:return I6();case n.CustomEntity:return U3();case n.PrimitiveEntity:return d9();case n.FunctionDeclaration:return w3();case n.GlobalEvent:return n3();case n.DataType:return L6();case n.Property:return f9();case n.FunctionCall:return Z9();case n.Condition:return t6();case n.Operation:return T6();case n.VariableDeclaration:return x6();case n.VariableInstance:return W6();case n.OutputMap:return W9();case n.ReturnDeclaration:return $9();case n.ArgumentDeclaration:return O3();case n.InputMap:return y6();case n.Project:return L3();case n.InstalledProject:return K6();case n.ActionDescriptor:return I9();case n.ReturnStatement:return M9();case n.Loop:return A9();case n.Search:return a6();case n.ValueDescriptor:return s9();case n.BuiltInBaseEntity:return b9();case n.InternalCall:return c6();case n.ContinueStatement:return B9();case n.BreakStatement:return j9();default:return null}}function Co(r){const e=[];Wn(r)||e.push(new E({id:`${r}--${f.InvalidReferenceObjectStructure}`,message:`Reference object with id "${r}" is not an object. References should be objects with exactly 4 properties: 'entityId', 'entityType', 'id', and 'type'.`,severity:T.Error,code:f.InvalidReferenceObjectStructure,issue:null}));const t=r.id||"reference-to--"+(r.entityId||"unknown"),i=`Reference object ${r.id?`with id "${r.id}"`:`to entity with id "${r.entityId}" and type "${r.entityType}"`}`;return r.entityId||e.push(new E({id:`${t}--${f.InvalidReferenceObjectStructure}`,message:`${i} is missing an 'entityId' property.`,severity:T.Error,code:f.InvalidReferenceObjectStructure,issue:null})),r.entityType||e.push(new E({id:`${t}--${f.InvalidReferenceObjectStructure}`,message:`${i} is missing an 'entityType' property.`,severity:T.Error,code:f.InvalidReferenceObjectStructure,issue:null})),r.id||e.push(new E({id:`${t}--${f.MissingIdProperty}`,message:`${i} is missing an 'id' property.`,severity:T.Error,code:f.MissingIdProperty,issue:null})),r.type||e.push(new E({id:`${t}--${f.MissingTypeProperty}`,message:`${i} is missing a 'type' property.`,severity:T.Error,code:f.MissingTypeProperty,issue:null})),e}function mu(r,e){return e.success?[]:e.error.issues.map(t=>new E({id:`${r.id}--${S.InvalidObjectStructure}`,message:`Entity of type "${r.type}" and with id "${r.id}", has an invalid structure: ${d5(t).toString().replace("Validation error: ","")}`,severity:T.Error,code:S.InvalidObjectStructure,issue:t}))}function Ne(r,e){const t=[],i=xP(r);if(i){const s=i.safeParse(r);t.push(...mu(r,s))}const a=jo(r.type);if(a){(a.DOWNSTREAM_PROPERTIES||[]).forEach(l=>{r[l]&&!Sa(r[l])&&t.push(new E({id:`${r.id}--${f.InvalidDownstreamPropertyOverride}`,message:`Entity of type "${r.type}" with id "${r.id}" cannot have the property "${l}" set directly. It is a downstream property that points to a downstream nested entity.
|
|
191
191
|
All downstream references are managed by the downstream entity. Entities only manage their own upstream references.
|
|
192
|
-
To modify '${l}', target the entity that it points to and its equivalent property.`,severity:T.Error,code:f.InvalidDownstreamPropertyOverride,issue:null}))});const o=a.PROPERTIES||[];o.length>0&&Object.keys(r).forEach(l=>{o.includes(l)||t.push(new E({id:`${r.id}--${f.UnrecognizedProperty}`,message:`Entity of type "${r.type}" with id "${r.id}" has an unrecognized property "${l}" that will be ignored.`,severity:T.Warning,code:f.UnrecognizedProperty,issue:null}))})}return t}function F2(r,e){const t=[];if(!r.parent)return t;const i=e.get(r.parent);return i?(Wr.includes(i==null?void 0:i.type)?t.push(new E({id:`${r.id}--${f.BuiltInEntityParent}`,message:`Entity of type "${r.type}" with id "${r.id}" cannot have the parent with id "${i.id}", because it is a built in entity. Built in entities cannot be modified.`,severity:T.Error,code:f.BuiltInEntityParent,issue:null})):i.type===n.ActionDescriptor&&e.get(r.parent)&&t.push(new E({id:`${r.id}--${f.BuiltInEntityParent}`,message:`Entity of type "${r.type}" with id "${r.id}" cannot have the parent with id "${i.id}", because it is a built in entity. Built in entities cannot be modified. Action descriptors are only sometimes built in, other times they are managed by the user.`,severity:T.Error,code:f.BuiltInEntityParent,issue:null})),t):[]}function Tu(r,e,t){const i=[],a=r[e.key];if(!a)return i.push(new E({id:`${r.id}--${e.key}--${S.InvalidObjectStructure}`,message:`Entity of type "${r.type}" with id "${r.id}" is missing a reference to a "${e.key}" entity. The '${e.key}' property of a "${r.type}" entity can be ${
|
|
193
|
-
All pass-through callable entities are: ${
|
|
194
|
-
All callable entity types are: ${
|
|
192
|
+
To modify '${l}', target the entity that it points to and its equivalent property.`,severity:T.Error,code:f.InvalidDownstreamPropertyOverride,issue:null}))});const o=a.PROPERTIES||[];o.length>0&&Object.keys(r).forEach(l=>{o.includes(l)||t.push(new E({id:`${r.id}--${f.UnrecognizedProperty}`,message:`Entity of type "${r.type}" with id "${r.id}" has an unrecognized property "${l}" that will be ignored.`,severity:T.Warning,code:f.UnrecognizedProperty,issue:null}))})}return t}function F2(r,e){const t=[];if(!r.parent)return t;const i=e.get(r.parent);return i?(Wr.includes(i==null?void 0:i.type)?t.push(new E({id:`${r.id}--${f.BuiltInEntityParent}`,message:`Entity of type "${r.type}" with id "${r.id}" cannot have the parent with id "${i.id}", because it is a built in entity. Built in entities cannot be modified.`,severity:T.Error,code:f.BuiltInEntityParent,issue:null})):i.type===n.ActionDescriptor&&e.get(r.parent)&&t.push(new E({id:`${r.id}--${f.BuiltInEntityParent}`,message:`Entity of type "${r.type}" with id "${r.id}" cannot have the parent with id "${i.id}", because it is a built in entity. Built in entities cannot be modified. Action descriptors are only sometimes built in, other times they are managed by the user.`,severity:T.Error,code:f.BuiltInEntityParent,issue:null})),t):[]}function Tu(r,e,t){const i=[],a=r[e.key];if(!a)return i.push(new E({id:`${r.id}--${e.key}--${S.InvalidObjectStructure}`,message:`Entity of type "${r.type}" with id "${r.id}" is missing a reference to a "${e.key}" entity. The '${e.key}' property of a "${r.type}" entity can be ${U(e.types,", "," or ")}.`,severity:T.Error,code:S.InvalidObjectStructure,issue:null})),{entityState:null,errors:i};let s=null;if(typeof a=="string")s=a;else{const l=Co(a);i.push(...l),l.length===0&&(s=a.entityId)}if(!s)return{entityState:null,errors:i};if(r.id===s)return i.push(new E({id:`${r.id}--${s}--${f.SelfReference}`,message:`Entity of type "${r.type}" with id "${r.id}", has a reference to itself at '${e.key}'. This is not allowed. Change the reference string or the 'entityId' property of the reference object.`,severity:T.Error,code:f.SelfReference,issue:null})),{entityState:null,errors:i};const o=t.get(s)||t.getBuiltIn(s);return o?e.types.includes(o.type)||i.push(new E({id:`${r.id}--${s}--${f.InvalidReference}`,message:`Entity of type "${r.type}" with id "${r.id}", has a reference to "${s}" at '${e.key}' that isn't pointing to an entity of type '${U(e.types,"', '","' or '")}'.`,severity:T.Error,code:f.InvalidReference,issue:null})):i.push(new E({id:`${r.id}--${s}--${f.ReferencedEntityNotFound}`,message:`Entity of type "${r.type}" with id "${r.id}", is referencing an entity with id "${s}" at '${e.key}' that isn't yet found in the project. Perhaps it should be created first. Or perhaps the ID is incorrect.`,severity:T.Error,code:f.ReferencedEntityNotFound,issue:null})),{entityState:o,errors:i}}function Bo(r,e,t){const i=[],a=r[e];return a?Array.isArray(a)?{entities:a.map(o=>{let l=null;if(typeof o=="string")l=o;else{const y=Co(o);i.push(...y),y.length===0&&(l=o.entityId)}if(!l)return{entityState:null,errors:[new E({id:`${r.id}--${e}--${f.InvalidReference}`,message:`Entity of type "${r.type}" with id "${r.id}", has a missing reference at '${e}'. A reference needs to be a 'id' string of an existing entity in the project.`,severity:T.Error,code:f.InvalidReference,issue:null})]};const p=t.get(l)||t.getBuiltIn(l);return p?{entityState:p,errors:[]}:(i.push(new E({id:`${r.id}--${l}--${f.ReferencedEntityNotFound}`,message:`Entity of type "${r.type}" with id "${r.id}", is referencing an entity with id "${l}" at '${e}' that isn't yet found in the project. Perhaps it should be created first. Or perhaps the ID is incorrect.`,severity:T.Error,code:f.ReferencedEntityNotFound,issue:null})),{entityState:null,errors:i})}),errors:[]}:(i.push(new E({id:`${r.id}--${e}--${S.InvalidObjectStructure}`,message:`Entity of type "${r.type}" with id "${r.id}" has an invalid structure for the "${e}" property. It should be an array of references.`,severity:T.Error,code:S.InvalidObjectStructure,issue:null})),{entities:[],errors:i}):(i.push(new E({id:`${r.id}--${e}--${S.InvalidObjectStructure}`,message:`Entity of type "${r.type}" with id "${r.id}" is missing a list of references to "${e}" entities.`,severity:T.Error,code:S.InvalidObjectStructure,issue:null})),{entities:[],errors:i})}function Eu(r,e,t){const i=[],a=Tu(r,e,t);if(a.errors.length>0)return a.errors;if(a.entityState){const s=a.entityState;e.types.includes(s.type)||i.push(new E({id:`${r.id}--${s.id}--${f.InvalidReference}`,code:f.InvalidReference,severity:T.Error,message:`Entity of type "${r.type}" with id "${r.id}", has a reference to "${e.key}" that isn't pointing to an entity of type '${U(e.types,"', '","' or '")}'.`,issue:null})),r.id===s.id&&i.push(new E({id:`${r.id}--${s.id}--${f.SelfReference}`,code:f.SelfReference,severity:T.Error,message:`Entity of type "${r.type}" with id "${r.id}", has a reference to itself at '${e.key}'. This is not allowed. Change the reference string or the 'entityId' property of the reference object.`,issue:null}))}return i}function U(r,e,t){const i=[...r||[]].filter(a=>!!a);if(i.length===1)return i[0];if(i.length===2)return i.join(t);{const a=i.pop();return`${i.join(e)}${t}${a}`}}const Hn=`Pass-through callable entities are entities that need to be called by another caller, then they execute some internal logic and when finished, it can call other callable entities with the "calledBySuccess" property or "calledByError" property based on whether their internal execution was successful or an error ocurred respectively.
|
|
193
|
+
All pass-through callable entities are: ${U(Ue,", "," and ")}.`,La=`Entry point entities are the entities which start the execution of a logic chain. They are ${U(Ge,", "," and ")}. They aren't explicitly called by any entities. Rather, they can be called implicitly by the system, or as a function-call somewhere else in the case of a function-declaration. `,jP=`Caller entities are entities that can call other entities. Regarless of whether they are entry-point entities or pass-through callable entities. All caller entity types are: ${U(dn,", "," and ")}.`,U2=`Callable entities are entities that can be called by other entities. They can be called by an entry-point, a success caller, or an error caller.
|
|
194
|
+
All callable entity types are: ${U(Bn,", "," and ")}.`,zn=`Caller to callee relationships can be updated with the 'add_caller' and 'remove_caller' generation action with the properties: 'callerEntityId', a 'calleeEntityId'. For adding a caller, you can optionally add a boolean property 'fromError' (if the caller calls when an error occured in its execution).
|
|
195
195
|
Either of these two actions will only affect the one relationship between the given caller and callee and ignore any others present in either entity.`,bu=`Break and continue statements need to have exactly one 'return-declaration' entity each. It represents the result of the current iteration of the loop. It can have any name and have any 'data-type' but it needs to be identical among all statements in the same loop.
|
|
196
196
|
Meaning, if the return declaration in one 'break-statement' is named 'result' and has a 'data-type' of 'number', all other 'break-statements' and 'continue-statements' in the same loop need to have a 'return-declaration' with the same name and 'data-type'.`,x2=`Return statements need to be identical inside the same scope. For example if a 'return-statement' belongs to a function, with multiple branches of logic, leading to multiple 'return-statement' entities, all of them need to have the exact same amount of 'return-declaration' entities, sharing the same name and an equivalent 'data-type' entity.
|
|
197
197
|
Furthermore, some 'function-declarations' and all 'global-events' might be implementing a base 'action-descriptor' entity, which defines exactly the shape and number of the return declarations.`,Ru=`A variable without a data type which reads an-untyped object value, or has object properties written into it as input-map writes, will infere its data-type. This means that a 'data-type' will be created, with an implicitly declared 'custom-entity' as its 'entity' property, defining the structure of the object.
|
|
198
|
-
This data type entity is what will define which properties are available to be read from the variable or any of its instances as 'output-map' entities.`,Zn=`Entities of type '${n.BuiltInBaseEntity}' that have the 'interactive' property set to false cannot be used programmatically during runtime. They can't be used as data types or instanciated in variables. Their methods can't be called by the code, and are only called by the system in the background. Their properties' values are constant and set only once when declared. They also can't be extended with unrecognized properties or methods that aren't part of the base out-of-the-box entity.`,gu=`Entities that read values from other entities, can be connected with entities that write values to them. Value reading entity types are: '${
|
|
198
|
+
This data type entity is what will define which properties are available to be read from the variable or any of its instances as 'output-map' entities.`,Zn=`Entities of type '${n.BuiltInBaseEntity}' that have the 'interactive' property set to false cannot be used programmatically during runtime. They can't be used as data types or instanciated in variables. Their methods can't be called by the code, and are only called by the system in the background. Their properties' values are constant and set only once when declared. They also can't be extended with unrecognized properties or methods that aren't part of the base out-of-the-box entity.`,gu=`Entities that read values from other entities, can be connected with entities that write values to them. Value reading entity types are: '${U(Cn,"', '","' and '")}'.`,kP=`Entities that write values to other entities, can be connected with entities that read values from them. Value writing entity types are: '${U(Fe,"', '","' and '")}'.`,vu=`A property entity, is neither a value reading, or a value writting entity, but they are often confused with one.
|
|
199
199
|
A 'property' can have a default value through its nested 'data-type' entity.
|
|
200
200
|
The 'property' entity only represents the data field in the declaration, and it can't write or read values.
|
|
201
|
-
When a 'custom-entity' is instantiated as a variable, any writes or reads to its properties are done through 'input-map's and 'output-map's.`,wo=`Some entities can hold values during runtime, they often can be given a hardcoded "default value" either directly or on their declarations, and can be connected to other entities that write or read values to and from them. Entities that can hold values are: '${
|
|
201
|
+
When a 'custom-entity' is instantiated as a variable, any writes or reads to its properties are done through 'input-map's and 'output-map's.`,wo=`Some entities can hold values during runtime, they often can be given a hardcoded "default value" either directly or on their declarations, and can be connected to other entities that write or read values to and from them. Entities that can hold values are: '${U(xu,"', '","' and '")}'.
|
|
202
202
|
Some entities with values can both write and read values, while others can only do one of the two.
|
|
203
203
|
${gu}
|
|
204
204
|
${kP}.
|
|
@@ -226,34 +226,34 @@ Entry-point entities can only be referenced as 'calledByEntry'.
|
|
|
226
226
|
${La}
|
|
227
227
|
We have moved the reference to 'calledByEntry' for you.`,issue:null})),t.calledByEntry.push(e.id),t.calledBySuccess=t.calledBySuccess.filter(a=>a!==e.id);else if($e.includes(e.type)){const a=e.calledBy||[],s=a.length?`
|
|
228
228
|
|
|
229
|
-
This ${e.type} is called by ${
|
|
229
|
+
This ${e.type} is called by ${U(a.map(o=>`${o.type} with id "${o.id}"`),", "," and ")} entities. You can reference ${a.length>1?"one of them":"it"} instead to execute this entity before the end of the logic.`:"";i.push(new E({id:`${r.id}--${e.id}--${f.InvalidReference}`,code:f.InvalidReference,severity:T.Error,message:`Entity of type "${r.type}" with id "${r.id}", has a reference to a '${e.type}' entity at 'calledBySuccess' with id "${e.id}".
|
|
230
230
|
${e.type} entities are the last entity to be executed in a logic chain, and they don't call any other entities.
|
|
231
|
-
Termination entities are ${
|
|
231
|
+
Termination entities are ${U($e,", "," and ")}.${s}`,issue:null}))}else if(!Ue.includes(e.type))i.push(new E({id:`${r.id}--${e.id}--${f.InvalidReference}`,code:f.InvalidReference,severity:T.Error,message:`Entity of type "${r.type}" with id "${r.id}", has a reference to a caller entity at 'calledBySuccess' with id "${e.id}" that isn't a pass-through callable entity.
|
|
232
232
|
${Hn}`,issue:null}));else if(!dn.includes(e.type))return i.push(new E({id:`${r.id}--${e.id}--${f.InvalidReference}`,code:f.InvalidReference,severity:T.Error,message:`Entity of type "${r.type}" with id "${r.id}", has a reference to a caller entity at 'calledBySuccess' with id "${e.id}" that isn't a caller entity.
|
|
233
|
-
All caller entity types are: ${
|
|
233
|
+
All caller entity types are: ${U(dn,", "," and ")}.
|
|
234
234
|
For the 'calledBySuccess' property, you specifically need to reference a pass-through callable entity.
|
|
235
235
|
${Hn}`,issue:null})),{errors:i,modifiedData:t};return{errors:i,modifiedData:t}}function JP(r,e){const t=[];if(Ge.includes(e.type))t.push(new E({id:`${r.id}--${e.id}--${f.InvalidReference}`,code:f.InvalidReference,severity:T.Error,message:`Entity of type "${r.type}" with id "${r.id}", has a reference to an entry-point entity at 'calledByError' with id "${e.id}".
|
|
236
236
|
Entry-point entities can only be referenced as 'calledByEntry'.
|
|
237
237
|
${La}`,issue:null}));else if($e.includes(e.type)){const i=e.calledBy||[],a=i.length?`
|
|
238
238
|
|
|
239
|
-
This ${e.type} is called by ${
|
|
239
|
+
This ${e.type} is called by ${U(i.map(s=>`${s.type} with id "${s.id}"`),", "," and ")} entities. You can reference ${i.length>1?"one of them":"it"} instead to execute this entity before the end of the logic.`:"";t.push(new E({id:`${r.id}--${e.id}--${f.InvalidReference}`,code:f.InvalidReference,severity:T.Error,message:`Entity of type "${r.type}" with id "${r.id}", has a reference to a '${e.type}' entity at 'calledByError' with id "${e.id}".
|
|
240
240
|
${e.type} entities are the last entity to be executed in a logic chain, and they don't call any other entities.
|
|
241
|
-
Termination entities are ${
|
|
241
|
+
Termination entities are ${U($e,", "," and ")}.${a}`,issue:null}))}else if(!Ue.includes(e.type))t.push(new E({id:`${r.id}--${e.id}--${f.InvalidReference}`,code:f.InvalidReference,severity:T.Error,message:`Entity of type "${r.type}" with id "${r.id}", has a reference to a caller entity at 'calledByError' with id "${e.id}" that isn't a pass-through callable entity.
|
|
242
242
|
${Hn}`,issue:null}));else if(!dn.includes(e.type))return t.push(new E({id:`${r.id}--${e.id}--${f.InvalidReference}`,code:f.InvalidReference,severity:T.Error,message:`Entity of type "${r.type}" with id "${r.id}", has a reference to a caller entity at 'calledByError' with id "${e.id}" that isn't a caller entity.
|
|
243
|
-
All caller entity types are: ${
|
|
243
|
+
All caller entity types are: ${U(dn,", "," and ")}.
|
|
244
244
|
For the 'calledByError' property, you specifically need to reference a pass-through callable entity.
|
|
245
245
|
${Hn}`,issue:null})),t;return t}function WP(r,e){const t=[];if($e.includes(e.type)){const i=e.calledBy||[],a=i.length?`
|
|
246
246
|
|
|
247
|
-
This ${e.type} is called by ${
|
|
247
|
+
This ${e.type} is called by ${U(i.map(s=>`${s.type} with id "${s.id}"`),", "," and ")} entities. You can reference ${i.length>1?"one of them":"it"} instead to execute this entity before the end of the logic.`:"";t.push(new E({id:`${r.id}--${e.id}--${f.InvalidReference}`,code:f.InvalidReference,severity:T.Error,message:`Entity of type "${r.type}" with id "${r.id}", has a reference to a '${e.type}' entity at 'calledByEntry' with id "${e.id}".
|
|
248
248
|
${e.type} entities are the last entity to be executed in a logic chain, and they don't call any other entities.
|
|
249
|
-
Termination entities are ${
|
|
249
|
+
Termination entities are ${U($e,", "," and ")}.${a}`,issue:null}))}else if(Ue.includes(e.type))t.push(new E({id:`${r.id}--${e.id}--${f.InvalidReference}`,code:f.InvalidReference,severity:T.Warning,message:`Entity of type "${r.type}" with id "${r.id}", has a reference to a caller entity at 'calledByEntry' with id "${e.id}" that is a pass-through callable entity, not an entry-point entity.
|
|
250
250
|
${Hn}.
|
|
251
251
|
${La}.
|
|
252
252
|
|
|
253
253
|
We have moved the reference to 'calledBySuccess' for you.`,issue:null}));else if(!dn.includes(e.type))return t.push(new E({id:`${r.id}--${e.id}--${f.InvalidReference}`,code:f.InvalidReference,severity:T.Error,message:`Entity of type "${r.type}" with id "${r.id}", has a reference to a caller entity at 'calledByEntry' with id "${e.id}" that isn't a caller entity.
|
|
254
|
-
All caller entity types are: ${
|
|
254
|
+
All caller entity types are: ${U(dn,", "," and ")}.
|
|
255
255
|
For the 'calledByEntry' property, you specifically need to reference a pass-through callable entity.
|
|
256
|
-
${Hn}`,issue:null})),t;return t}function YP(r,e){const t=[];let i=JSON.parse(JSON.stringify(r));if(Bn.includes(i.type)){if(i.calledBySuccess){const s=Bo(i,"calledBySuccess",e);s.errors.length===0?s.entities.forEach(o=>{if(o.errors.length){t.push(...o.errors);return}const l=qP(i,o.entityState);i=l.modifiedData,t.push(...l.errors)}):t.push(...s.errors)}if(i.calledByError){const s=Bo(i,"calledByError",e);s.errors.length===0?s.entities.forEach(o=>{if(o.errors.length){t.push(...o.errors);return}const l=JP(i,o.entityState);t.push(...l)}):t.push(...s.errors)}if(i.calledByEntry){const s=Bo(i,"calledByEntry",e);s.errors.length===0?(s.entities.forEach(o=>{if(o.errors.length){t.push(...o.errors);return}const l=WP(i,o.entityState);t.push(...l)}),t.push(...t)):t.push(...s.errors)}const a=[...i.calledBySuccess||[],...i.calledByError||[],...i.calledByEntry||[]];if(a.length){const s=[...new Set(a)];a.length!==s.length&&t.push(new E({id:`${i.id}--${f.DuplicateReference}`,code:f.DuplicateReference,severity:T.Warning,message:`Entity of type "${i.type}" with id "${i.id}" has duplicate caller references. Each caller reference should be unique. Duplicate caller reference will be ignored.`,issue:null}));const o=bt(i,e);i.type===n.ReturnStatement&&o&&!Ge.includes(o.type)?t.push(new E({id:`${i.id}--${f.IncompatibleScope}`,code:f.IncompatibleScope,severity:T.Error,message:`Entity of type "${i.type}" with id "${i.id}" has an explicitly set parent, but it isn't a '${
|
|
256
|
+
${Hn}`,issue:null})),t;return t}function YP(r,e){const t=[];let i=JSON.parse(JSON.stringify(r));if(Bn.includes(i.type)){if(i.calledBySuccess){const s=Bo(i,"calledBySuccess",e);s.errors.length===0?s.entities.forEach(o=>{if(o.errors.length){t.push(...o.errors);return}const l=qP(i,o.entityState);i=l.modifiedData,t.push(...l.errors)}):t.push(...s.errors)}if(i.calledByError){const s=Bo(i,"calledByError",e);s.errors.length===0?s.entities.forEach(o=>{if(o.errors.length){t.push(...o.errors);return}const l=JP(i,o.entityState);t.push(...l)}):t.push(...s.errors)}if(i.calledByEntry){const s=Bo(i,"calledByEntry",e);s.errors.length===0?(s.entities.forEach(o=>{if(o.errors.length){t.push(...o.errors);return}const l=WP(i,o.entityState);t.push(...l)}),t.push(...t)):t.push(...s.errors)}const a=[...i.calledBySuccess||[],...i.calledByError||[],...i.calledByEntry||[]];if(a.length){const s=[...new Set(a)];a.length!==s.length&&t.push(new E({id:`${i.id}--${f.DuplicateReference}`,code:f.DuplicateReference,severity:T.Warning,message:`Entity of type "${i.type}" with id "${i.id}" has duplicate caller references. Each caller reference should be unique. Duplicate caller reference will be ignored.`,issue:null}));const o=bt(i,e);i.type===n.ReturnStatement&&o&&!Ge.includes(o.type)?t.push(new E({id:`${i.id}--${f.IncompatibleScope}`,code:f.IncompatibleScope,severity:T.Error,message:`Entity of type "${i.type}" with id "${i.id}" has an explicitly set parent, but it isn't a '${U(Ge,"', '","' or '")}' entity. A return statement's parent should always be resolved to a function declaration or global event.${_o}`,issue:null})):i.type===n.ContinueStatement&&o&&o.type!==n.Loop?t.push(new E({id:`${i.id}--${f.IncompatibleScope}`,code:f.IncompatibleScope,severity:T.Error,message:`Entity of type "${i.type}" with id "${i.id}" has an explicitly set parent, but it isn't a '${n.Loop}' entity. A continue statement's parent should always be resolved to a loop entity.${_o}`,issue:null})):i.type===n.BreakStatement&&o&&o.type!==n.Loop&&t.push(new E({id:`${i.id}--${f.IncompatibleScope}`,code:f.IncompatibleScope,severity:T.Error,message:`Entity of type "${i.type}" with id "${i.id}" has an explicitly set parent, but it isn't a '${n.Loop}' entity. A break statement's parent should always be resolved to a loop entity.${_o}`,issue:null}));const l=[],p=[];let y=null;if(s.forEach(h=>{const m=e.get(h);if(!m){t.push(new E({id:`${i.id}--${h}--${f.ReferencedEntityNotFound}`,code:f.ReferencedEntityNotFound,severity:T.Error,message:`Entity of type "${r.type}" with id "${r.id}", has a reference to a caller entity with id "${h}" that doesn't exist in the project.`,issue:null}));return}const b=bt(m,e);if(o)Fa(o,b,e)?($e.includes(i.type)&&((i.calledBySuccess||[]).find(P=>P===m.id)?(m.successCalls||[]).find(I=>$e.includes(I.type))&&t.push(new E({id:`${i.id}--${m.id}--${S.UnreachableEntity}`,code:S.UnreachableEntity,severity:T.Error,message:`Entity of type "${i.type}" with id "${i.id}" is being called by an entity of type "${m.type}" with id "${m.id}" that already calls a termination statement.
|
|
257
257
|
The new termination statement is redundant because both entities would be called from the same parent caller branch "successCalls", at the same time.`,issue:null})):(i.calledByError||[]).find(P=>P===m.id)?(m.errorCalls||[]).find(I=>$e.includes(I.type))&&t.push(new E({id:`${i.id}--${m.id}--${S.UnreachableEntity}`,code:S.UnreachableEntity,severity:T.Error,message:`Entity of type "${i.type}" with id "${i.id}" is being called by an entity of type "${m.type}" with id "${m.id}" that already calls a termination statement.
|
|
258
258
|
The new termination statement is redundant because both entities would be called from the same parent caller branch "errorCalls", at the same time.`,issue:null})):(i.calledByEntry||[]).find(P=>P===m.id)&&(m.calls||[]).find(I=>$e.includes(I.type))&&t.push(new E({id:`${i.id}--${m.id}--${S.UnreachableEntity}`,code:S.UnreachableEntity,severity:T.Error,message:`Entity of type "${i.type}" with id "${i.id}" is being called by an entity of type "${m.type}" with id "${m.id}" that already calls a termination statement.
|
|
259
259
|
The new termination statement is redundant because both entities would be called from the same parent caller branch (entry-point), at the same time.`,issue:null}))),l.push({caller:m,scope:b})):p.push({caller:m,scope:b,errors:[new E({id:`${i.id}--${m.id}--${f.CallerWithIncompatibleScope}`,code:f.CallerWithIncompatibleScope,severity:T.Warning,message:`Entity of type "${i.type}" with id "${i.id}" is being called by an entity of type "${m.type}" with id "${m.id}" that is in a different scope. The caller entity should be in the same scope or a higher valid scope. Or all callers should share the global project scope with the entity they call.`,issue:null})]});else if(!y)y=b;else{const{compatible:v}=Fa(y,b,e);v?($e.includes(i.type)&&((i.calledBySuccess||[]).find(P=>P===m.id)?(m.successCalls||[]).find(I=>$e.includes(I.type))&&t.push(new E({id:`${i.id}--${m.id}--${S.UnreachableEntity}`,code:S.UnreachableEntity,severity:T.Error,message:`Entity of type "${i.type}" with id "${i.id}" is being called by an entity of type "${m.type}" with id "${m.id}" that already calls a termination statement.
|
|
@@ -266,52 +266,52 @@ Continue statements need to have a caller when created, since they are used to s
|
|
|
266
266
|
Break statements need to have a caller when created, since they are used to exit a loop and can't be detached from a call chain.`),s+=`
|
|
267
267
|
${jP}`,$e.includes(i.type)||(s+=`
|
|
268
268
|
It is recommended to have a caller reference already at the moment of creation in the payload of the generation action.`),t.push(new E({id:`${i.id}--${S.MissingCaller}`,code:S.MissingCaller,severity:$e.includes(i.type)?T.Error:T.Warning,message:s,issue:null}))}}return{errors:t,modifiedData:i}}function Du(r,e){const t=[];if(e.type===n.PrimitiveValue){const o=e.parent;let l=!1;if(o.type===n.InputMap)t.push(new E({id:`${r.id}--${e.id}--${f.InvalidReference}`,code:f.InvalidReference,severity:T.Error,message:`Entity of type "${r.type}" with id "${r.id}", has a reference to a value writting entity at 'readsValue' with id "${e.id}" that is a primitive value entity. Primitive value entities aren't value writting entities.
|
|
269
|
-
All value writting entity types are: ${
|
|
269
|
+
All value writting entity types are: ${U(Fe,", "," and ")}.
|
|
270
270
|
|
|
271
271
|
This primitive-value entity belongs to an input map entity with id "${o.id}". Input map entities are value writting entities. Is that what you meant to reference?`,issue:null}));else if(o.type===n.DataType){const p=o,y=p.parent;Fe.includes(y.type)?t.push(new E({id:`${r.id}--${e.id}--${f.InvalidReference}`,code:f.InvalidReference,severity:T.Error,message:`Entity of type "${r.type}" with id "${r.id}", has a reference to a value writting entity at 'readsValue' with id "${e.id}" that is a primitive value entity. Primitive value entities can't be referenced as value writting entities.
|
|
272
|
-
All value writting entity types are: ${
|
|
272
|
+
All value writting entity types are: ${U(Fe,", "," and ")}.
|
|
273
273
|
|
|
274
274
|
This primitive-value entity belongs to a data type entity with id "${p.id}", which itself belongs to a ${y.type} entity with id "${y.id}". ${y.type} entities are value writting entities. Is that what you meant to reference?`,issue:null})):l=!0}l&&t.push(new E({id:`${r.id}--${e.id}--${f.InvalidReference}`,code:f.InvalidReference,severity:T.Error,message:`Entity of type "${r.type}" with id "${r.id}", has a reference to a value writting entity at 'readsValue' with id "${e.id}" that is a primitive value entity. Primitive value entities can't be referenced as value writting entities.
|
|
275
|
-
All value writting entity types are: ${
|
|
276
|
-
All value writting entity types are: ${
|
|
275
|
+
All value writting entity types are: ${U(Fe,", "," and ")}.`,issue:null}))}else if(e.type===n.DataType){const o=e.parent;Fe.includes(o.type)?t.push(new E({id:`${r.id}--${e.id}--${f.InvalidReference}`,code:f.InvalidReference,severity:T.Error,message:`Entity of type "${r.type}" with id "${r.id}", has a reference to a value writting entity at 'readsValue' with id "${e.id}" that is a primitive value entity. Primitive value entities can't be referenced as value writting entities.
|
|
276
|
+
All value writting entity types are: ${U(Fe,", "," and ")}.
|
|
277
277
|
|
|
278
278
|
This data type entity belongs to a ${o.type} entity with id "${o.id}". ${o.type} entities are value writting entities. Is that what you meant to reference?`,issue:null})):t.push(new E({id:`${r.id}--${e.id}--${f.InvalidReference}`,code:f.InvalidReference,severity:T.Error,message:`Entity of type "${r.type}" with id "${r.id}", has a reference to a value writting entity at 'readsValue' with id "${e.id}" that is a primitive value entity. Primitive value entities can't be referenced as value writting entities.
|
|
279
|
-
All value writting entity types are: ${
|
|
280
|
-
All value writting entity types are: ${
|
|
279
|
+
All value writting entity types are: ${U(Fe,", "," and ")}.`,issue:null}))}else Fe.includes(e.type)||t.push(new E({id:`${r.id}--${e.id}--${f.InvalidReference}`,code:f.InvalidReference,severity:T.Error,message:`Entity of type "${r.type}" with id "${r.id}", has a reference to a value writting entity at 'readsValue' with id "${e.id}" that isn't a value writting entity.
|
|
280
|
+
All value writting entity types are: ${U(Fe,", "," and ")}.`,issue:null}));const i=bt(r,e.project),a=bt(e,e.project);if(i){const s=Fa(i,e,e.project);if(!s.compatible){const{type:o}=s;let l="";const p=`But they are nested under different subscopes. The reader is in the scope of the '${i.type}' (${C(i,e.project)}) with id '${i.id}', and the writter is in the scope of the '${a.type}' (${C(a,e.project)}) with id '${a.id}'.`;o===qo.ParallelInCommonParent?(l=`The reader and the writter entities are both in the scope of the '${s.commonAncestorScope.type}' (${C(s.commonAncestorScope,e.project)}) with id '${s.commonAncestorScope.id}'.`,l+=`
|
|
281
281
|
${p}`):o===qo.ParallelInProject&&(l="The reader and the writter entities are both in separate scopes in the project that have no common ancestor.",l+=`
|
|
282
282
|
${p}`),l+=`
|
|
283
283
|
Two value holding entities need to be in the same scope or in scopes nested inside of eachother to be able to read and write to each other.`,t.push(new E({id:`${r.id}--${e.id}--${f.IncompatibleScope}`,code:f.IncompatibleScope,severity:T.Error,message:`Entity of type "${r.type}" with id "${r.id}", has a reference to a value writting entity at 'readsValue' with id "${e.id}" with an incompatible scope.
|
|
284
|
-
${l}`,issue:null}))}}return t}function Je(r,e,t,i=!1){const a=[],s={...e};let o=JSON.parse(JSON.stringify(r));if(!i){if(Cn.includes(o.type)){if(o.readsValue){const y=Tu(o,{key:"readsValue",types:Fe},t);if(y.errors.length===0){const h=Du(o,y.entityState);a.push(...h)}else a.push(...y.errors);delete s.readsValue}}else o.readsValue&&(Fe.includes(o.type)?a.push(new E({id:`${o.id}--${f.InvalidReference}`,code:f.InvalidReference,severity:T.Error,message:`Entity of type "${o.type}" with id "${o.id}" has a 'readsValue' property that is only valid for entities of type: ${
|
|
285
|
-
${wo}`,issue:null})):n.Property===o.type?a.push(new E({id:`${o.id}--${f.InvalidReference}`,code:f.InvalidReference,severity:T.Error,message:`Entity of type "${o.type}" with id "${o.id}" has a 'readsValue' property that is only valid for entities of type: ${
|
|
286
|
-
${vu}`,issue:null})):a.push(new E({id:`${o.id}--${f.InvalidReference}`,code:f.InvalidReference,severity:T.Error,message:`Entity of type "${o.type}" with id "${o.id}" has a 'readsValue' property that is only valid for entities of type: ${
|
|
284
|
+
${l}`,issue:null}))}}return t}function Je(r,e,t,i=!1){const a=[],s={...e};let o=JSON.parse(JSON.stringify(r));if(!i){if(Cn.includes(o.type)){if(o.readsValue){const y=Tu(o,{key:"readsValue",types:Fe},t);if(y.errors.length===0){const h=Du(o,y.entityState);a.push(...h)}else a.push(...y.errors);delete s.readsValue}}else o.readsValue&&(Fe.includes(o.type)?a.push(new E({id:`${o.id}--${f.InvalidReference}`,code:f.InvalidReference,severity:T.Error,message:`Entity of type "${o.type}" with id "${o.id}" has a 'readsValue' property that is only valid for entities of type: ${U(Cn,", "," and ")}.
|
|
285
|
+
${wo}`,issue:null})):n.Property===o.type?a.push(new E({id:`${o.id}--${f.InvalidReference}`,code:f.InvalidReference,severity:T.Error,message:`Entity of type "${o.type}" with id "${o.id}" has a 'readsValue' property that is only valid for entities of type: ${U(Cn,", "," and ")}.
|
|
286
|
+
${vu}`,issue:null})):a.push(new E({id:`${o.id}--${f.InvalidReference}`,code:f.InvalidReference,severity:T.Error,message:`Entity of type "${o.type}" with id "${o.id}" has a 'readsValue' property that is only valid for entities of type: ${U(Cn,", "," and ")}.
|
|
287
287
|
${gu}`,issue:null})),delete s.readsValue);o.writesValues&&(Fe.includes(o.type)?a.push(new E({id:`${o.id}--${f.InvalidReference}`,code:f.InvalidReference,severity:T.Warning,message:`Entity of type "${o.type}" with id "${o.id}" has a 'writesValues' property. This property is managed by the downstream entity, the value reader, and should not be present in the payload of the generation action.
|
|
288
288
|
${Iu}`,issue:null})):a.push(new E({id:`${o.id}--${f.InvalidReference}`,code:f.InvalidReference,severity:T.Warning,message:`Entity of type "${o.type}" with id "${o.id}" has a 'writesValues' property. This property is managed by the downstream entity, the value reader, and should not be present in the payload of the generation action.
|
|
289
289
|
${wo}
|
|
290
|
-
${Iu}`,issue:null})),delete s.writesValues);const p=YP(o,t);delete s.calledByError,delete s.calledBySuccess,delete s.calledByEntry,a.push(...p.errors),o=p.modifiedData}const l=Object.entries(s);for(const[p,y]of l){const h=y.types,m=y.optional,b=o[p];if(!b){m||a.push(new E({id:`${o.id}--${p}--${S.InvalidObjectStructure}`,code:S.InvalidObjectStructure,severity:T.Error,message:`Entity of type "${o.type}" with id "${o.id}" is missing a reference to a "${p}" entity. The '${p}' property of a "${o.type}" entity can be ${
|
|
290
|
+
${Iu}`,issue:null})),delete s.writesValues);const p=YP(o,t);delete s.calledByError,delete s.calledBySuccess,delete s.calledByEntry,a.push(...p.errors),o=p.modifiedData}const l=Object.entries(s);for(const[p,y]of l){const h=y.types,m=y.optional,b=o[p];if(!b){m||a.push(new E({id:`${o.id}--${p}--${S.InvalidObjectStructure}`,code:S.InvalidObjectStructure,severity:T.Error,message:`Entity of type "${o.type}" with id "${o.id}" is missing a reference to a "${p}" entity. The '${p}' property of a "${o.type}" entity can be ${U(h,", "," or ")}`,issue:null}));continue}if(y.list)if(Array.isArray(b))for(const v of b){const P=Eu(o,{key:p,types:h,optional:m},t);a.push(...P)}else{a.push(new E({id:`${o.id}--${p}--${f.ContainsSingleButShouldBeReferenceList}`,code:f.ContainsSingleButShouldBeReferenceList,severity:T.Error,message:`Entity of type "${o.type}" with id "${o.id}", should have a property "${p}" which is a list, but it isn't.`,issue:null}));continue}else if(Array.isArray(b)){a.push(new E({id:`${o.id}--${p}--${f.ContainsListButShouldReferenceSingle}`,code:f.ContainsListButShouldReferenceSingle,severity:T.Error,message:`Entity of type "${o.type}" with id "${o.id}", should have a property "${p}" which holds a single reference, but it is a list.`,issue:null}));continue}else{const v=Eu(o,{key:p,types:h,optional:m},t);a.push(...v)}}return{errors:a,modifiedData:o}}function k2(r,e,t="calledBy"){const i=[];if(!r)return[];const a=e.get(r);if(!a)return i.push(new E({id:`${r}--${f.ReferencedEntityNotFound}`,code:f.ReferencedEntityNotFound,severity:T.Error,message:`Entity with id "${r}" referenced in '${t}' property not found in the project. Perhaps it should be created first? Perhaps it is the wrong ID?`,issue:null})),i;if([...Ue,...Ge].includes(a.type))return[];if($e.includes(a.type)){const s=a.calledBy||[],o=s.length?`
|
|
291
291
|
|
|
292
|
-
This ${a.type} is called by ${
|
|
292
|
+
This ${a.type} is called by ${U(s.map(l=>`${l.type} with id "${l.id}"`),", "," and ")} entities. You can reference ${s.length>1?"one of them":"it"} instead to execute this entity before the end of the logic.`:"";i.push(new E({id:`last-action--${a.id}--${f.InvalidReference}`,code:f.InvalidReference,severity:T.Error,message:`Entity with id '${a.id}' referenced in '${t}' property is of type '${a.type}'.
|
|
293
293
|
${a.type} entities are the last entity to be executed in a logic chain, and they don't call any other entities.
|
|
294
|
-
Termination entities are ${
|
|
295
|
-
All caller entity types are: ${
|
|
294
|
+
Termination entities are ${U($e,", "," and ")}.${o}`,issue:null}))}else i.push(new E({id:`last-action--${a.id}--${f.InvalidReference}`,code:f.InvalidReference,severity:T.Error,message:`Entity with id '${a.id}' referenced in '${t}' property is of type '${a.type}' which is not a valid caller entity type.
|
|
295
|
+
All caller entity types are: ${U(dn,", "," and ")}.`,issue:null}));return i}function q2(r,e,t="calledByError"){const i=[];if(!r)return[];const a=e.get(r);if(!a)return i.push(new E({id:`${r}--${f.ReferencedEntityNotFound}`,code:f.ReferencedEntityNotFound,severity:T.Error,message:`Entity with id "${r}" referenced in '${t}' property not found in the project. Perhaps it should be created first? Perhaps it is the wrong ID?`,issue:null})),i;if(Ue.includes(a.type))return[];if($e.includes(a.type)){const s=a.calledBy||[],o=s.length?`
|
|
296
296
|
|
|
297
|
-
This ${a.type} is called by ${
|
|
297
|
+
This ${a.type} is called by ${U(s.map(l=>`${l.type} with id "${l.id}"`),", "," and ")} entities. You can reference ${s.length>1?"one of them":"it"} instead to execute this entity before the end of the logic.`:"";i.push(new E({id:`last-action--${a.id}--${f.InvalidReference}`,code:f.InvalidReference,severity:T.Error,message:`Entity with id '${a.id}' referenced in '${t}' property is of type '${a.type}'.
|
|
298
298
|
${a.type} entities are the last entity to be executed in a logic chain, and they don't call any other entities.
|
|
299
|
-
Termination entities are ${
|
|
299
|
+
Termination entities are ${U($e,", "," and ")}.${o}`,issue:null}))}else Ge.includes(a.type)?i.push(new E({id:`last-action--${a.id}--${f.InvalidReference}`,code:f.InvalidReference,severity:T.Error,message:`Entity with id '${a.id}' referenced in '${t}' property is of type '${a.type}' which is an entry-point entity and doesn't thrown errors.
|
|
300
300
|
${La}`,issue:null})):i.push(new E({id:`last-action--${a.id}--${f.InvalidReference}`,code:f.InvalidReference,severity:T.Error,message:`Entity with id '${a.id}' referenced in '${t}' property is of type '${a.type}' which is not a valid caller entity type.
|
|
301
301
|
For any error branch caller, for the 'calledByError' property of an entity, you specifically need to reference a pass-through callable entity.
|
|
302
302
|
${Hn}`,issue:null}));return i}function J2(r,e){const t=[],i=e.get(r);if(!i)t.push(new E({id:`last-action--${f.ReferencedEntityNotFound}`,code:f.ReferencedEntityNotFound,severity:T.Error,message:`The 'readsValue' property references an entity with id '${r}' that was not found in the project. Perhaps it should be created? Perhaps the ID is incorrect?`,issue:null}));else if(i.type===n.PrimitiveValue){const s=i.parent;let o=!1;if(s.type===n.InputMap)t.push(new E({id:`last-action--${i.id}--${f.InvalidReference}`,code:f.InvalidReference,severity:T.Error,message:`The 'readsValue' property references an entity with id "${i.id}" that is a primitive value entity. Primitive value entities aren't value writting entities.
|
|
303
|
-
All value writting entity types are: ${
|
|
303
|
+
All value writting entity types are: ${U(Fe,", "," and ")}.
|
|
304
304
|
|
|
305
305
|
This primitive-value entity belongs to an input map entity with id "${s.id}". Input map entities are value writting entities. Is that what you meant to reference?`,issue:null}));else if(s.type===n.DataType){const l=s,p=l.parent;Fe.includes(p.type)?t.push(new E({id:`last-action--${i.id}--${f.InvalidReference}`,code:f.InvalidReference,severity:T.Error,message:`The 'readsValue' property references an entity with id "${i.id}" that is a primitive value entity. Primitive value entities can't be referenced as value writting entities.
|
|
306
|
-
All value writting entity types are: ${
|
|
306
|
+
All value writting entity types are: ${U(Fe,", "," and ")}.
|
|
307
307
|
|
|
308
308
|
This primitive-value entity belongs to a data type entity with id "${l.id}", which itself belongs to a ${p.type} entity with id "${p.id}". ${p.type} entities are value writting entities. Is that what you meant to reference?`,issue:null})):o=!0}o&&t.push(new E({id:`last-action--${i.id}--${f.InvalidReference}`,code:f.InvalidReference,severity:T.Error,message:`The 'readsValue' property references an entity with id "${i.id}" that is a primitive value entity. Primitive value entities can't be referenced as value writting entities.
|
|
309
|
-
All value writting entity types are: ${
|
|
310
|
-
All value writting entity types are: ${
|
|
309
|
+
All value writting entity types are: ${U(Fe,", "," and ")}.`,issue:null}))}else if(i.type===n.DataType){const s=i.parent;Fe.includes(s.type)?t.push(new E({id:`last-action--${i.id}--${f.InvalidReference}`,code:f.InvalidReference,severity:T.Error,message:`The 'readsValue' property references an entity with id "${i.id}" that is a primitive value entity. Primitive value entities can't be referenced as value writting entities.
|
|
310
|
+
All value writting entity types are: ${U(Fe,", "," and ")}.
|
|
311
311
|
|
|
312
312
|
This data type entity belongs to a ${s.type} entity with id "${s.id}". ${s.type} entities are value writting entities. Is that what you meant to reference?`,issue:null})):t.push(new E({id:`last-action--${i.id}--${f.InvalidReference}`,code:f.InvalidReference,severity:T.Error,message:`The 'readsValue' property references an entity with id "${i.id}" that is a primitive value entity. Primitive value entities can't be referenced as value writting entities.
|
|
313
|
-
All value writting entity types are: ${
|
|
314
|
-
All value writting entity types are: ${
|
|
313
|
+
All value writting entity types are: ${U(Fe,", "," and ")}.`,issue:null}))}else Fe.includes(i.type)||t.push(new E({id:`last-action--${i.id}--${f.InvalidReference}`,code:f.InvalidReference,severity:T.Error,message:`The 'readsValue' property references an entity with id "${i.id}" that isn't a value writting entity.
|
|
314
|
+
All value writting entity types are: ${U(Fe,", "," and ")}.`,issue:null}));return t}function HP(r){return r.functions.length?`All global 'function-declaration' entity ids are:
|
|
315
315
|
- ${r.functions.map(t=>`${t.id} (${C(t,r)})`).join(`
|
|
316
316
|
- `)}.`:"The project currently has no global 'function-declaration' entities that can be called as 'function-call' entities."}function No(r){return`All reserved action decriptor ids for '${n.GlobalEvent}' entities are:
|
|
317
317
|
- ${r.globalEventActionDescriptors.map(e=>`${e.id} (${C(e,r)})`).join(`
|
|
@@ -325,7 +325,7 @@ All value writting entity types are: ${F(Fe,", "," and ")}.`,issue:null}));retur
|
|
|
325
325
|
Otherwise, if you were trying to implement a 'function-call' from a globally declarated 'function-declaration':
|
|
326
326
|
${a}`,issue:null}));else if(i.type!==n.FunctionDeclaration)t.push(new E({id:`last-action--${f.InvalidFunctionDeclarationForFunctionCall}`,code:f.InvalidFunctionDeclarationForFunctionCall,severity:T.Error,message:`The 'functionDeclarationId' reference is pointing to entity with id '${r}' which is of type '${i.type}' entity. Only 'function-declaration' entities can be implemented as function calls.
|
|
327
327
|
${a}`,issue:null}));else if(i.parent.type===n.CustomEntity){const o=Xn(i.parent).filter(p=>!p.interactive);let l="";o.length&&(l=`
|
|
328
|
-
Furthermore, the specific 'custom-entity' extends or implements non-interactive built-in-base-entities ${o.length>1?`entities with ids '${
|
|
328
|
+
Furthermore, the specific 'custom-entity' extends or implements non-interactive built-in-base-entities ${o.length>1?`entities with ids '${U(o.map(y=>y.id),"', '","' and '")}'`:`entity with id '${o[0].id}'`}.
|
|
329
329
|
${Zn}`),t.push(new E({id:`last-action--${f.InvalidFunctionDeclarationForFunctionCall}`,code:f.InvalidFunctionDeclarationForFunctionCall,severity:T.Error,message:`The function declaration entity with id '${r}' is a method of the 'custom-entity' with id '${i.parent.id}'. Only globally declared, standalone functions can be implemented as function calls.
|
|
330
330
|
If you want to call a method of a custom entity, use a '${n.InternalCall}' entity on any variable which is an instance of that custom entity.
|
|
331
331
|
${a}${l}`,issue:null}))}else i.parent.type===n.Loop?t.push(new E({id:`last-action--${f.InvalidFunctionDeclarationForFunctionCall}`,code:f.InvalidFunctionDeclarationForFunctionCall,severity:T.Error,message:`The function declaration entity with id '${r}' is the body of the 'loop' with id '${i.parent.id}'. Only globally declared, standalone functions can be implemented as function calls.
|
|
@@ -365,7 +365,7 @@ All global 'function-declaration' entity ids are:
|
|
|
365
365
|
The project currently has no global 'function-declaration' entities that can be called as 'function-call' entities.`;a.push(new E({id:`${i.id}--${f.InvalidReference}`,code:f.InvalidReference,severity:T.Error,message:`Entity of type "${n.FunctionCall}" with id "${i.id}", has an invalid reference at the 'declaration' property. The 'declaration' property must be a valid reference to an 'function-declaration' entity.
|
|
366
366
|
References can either be an ID string or an object with exacly four properties: 'id', 'entityId', 'entityType', 'type'.${l}`,issue:null}))}return{errors:a,modifiedData:i}}validateGeneratedUpdate(e){const t=[];return e.parent&&t.push(new E({id:`${this.id}--${f.InvalidParentUpdate}`,code:f.InvalidParentUpdate,severity:T.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.
|
|
367
367
|
If an entity is called by another, they must be in the same scope, which means they have the same parent.
|
|
368
|
-
You shouldn't have to manually update a 'parent' property. The equivalent result is to change its callers, the value writters of its inputs, or the value readers of its outputs.`,issue:null})),{errors:t,modifiedData:e}}addSelfToProject(){var a;const e=[this],t=[],i=[];return this.parent===this.project&&this.project.addFunctionCall(this),(a=this.process)==null||a.writesValues.forEach(s=>{s.setValueWriter(this.process),e.push(s)}),this.successCalls.forEach(s=>{s.addSuccessCaller(this),e.push(s)}),this.errorCalls.forEach(s=>{s.addErrorCaller(this),e.push(s)}),this.calledBySuccess.forEach(s=>{s.addSuccessCall(this),e.push(s)}),this.calledByError.forEach(s=>{s.addErrorCall(this),e.push(s)}),this.calledByEntry.forEach(s=>{s.addCall(this),e.push(s)}),{updated:g(e),added:g(t),removed:g(i),self: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.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}addValueReader(e){var t;return(t=this.process)==null||t.addValueReader(e),this}removeValueReader(e){var t;return(t=this.process)==null||t.removeValueReader(e),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(){if(this.initialized)return this;if(this.initialized=!0,this.initialData.declaration.type===n.FunctionDeclaration){const e=R(this.initialData.declaration,this.project);this.declaration=e}else{const e=_(this.initialData.declaration),t=this.project.get(e);this.declaration=t}return this.successCalls=this.initialData.successCalls.map(e=>{const t=R(e,this.project);return t.addSuccessCaller(this),[n.BreakStatement,n.ContinueStatement].includes(t.type)?(t.setParent(this.parent.parent),t.initChildren()):t.type!==n.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),[n.BreakStatement,n.ContinueStatement].includes(t.type)?(t.setParent(this.parent.parent),t.initChildren()):t.type!==n.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.initOutputs(),this.initialData.process&&(this.process=R(this.initialData.process,this.project),this.process.setParent(this),this.process.initChildren()),this.initialData.error&&(this.error=R(this.initialData.error,this.project),this.error.setParent(this),this.error.initChildren()),this}initOutputs(){const e=[];this.outputs=this.initialData.outputs.map(s=>{const o=R(s,this.project);return e.push(o.index),o.setParent(this),o.initChildren(),o});const i=_u(this).filter(s=>!this.outputs.find(o=>o.declaration.id===s.id));i.sort((s,o)=>s.index-o.index);const a=i.map((s,o)=>{const l=e.includes(s.index)?this.outputs.length-1+o:s.index,p={id:N.UUID.uuid(),type:n.OutputMap,version:1,declaration:s,index:l,parent:this,writesValues:[]},y=R(p,this.project);return y.setParent(this),y.initChildren(),y});return this.outputs.push(...a),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}){var s;const i=[],a=[];if(t.has(this.id))return{affected:[],removed:[]};if(t.add(this.id),a.push(this),this.unsubscribe(),this.process){const{affected:o,removed:l}=(s=this.process)==null?void 0:s.remove({ignoreUpstream:!0,seenEntities:t});i.push(...o),a.push(...l)}if(this.inputs.forEach(o=>{const{affected:l,removed:p}=o.remove({ignoreUpstream:!0,seenEntities:t});i.push(...l),a.push(...p)}),this.outputs.forEach(o=>{const{affected:l,removed:p}=o.remove({ignoreUpstream:!0,seenEntities:t});i.push(...l),a.push(...p)}),this.error){const{affected:o,removed:l}=this.error.remove({ignoreUpstream:!0,seenEntities:t});i.push(...o),a.push(...l)}return this.successCalls.forEach(o=>{i.push(o),o.removeCaller(this)}),this.errorCalls.forEach(o=>{i.push(o),o.removeCaller(this)}),e||this.calledBy.forEach(o=>{i.push(o),o.removeCall(this)}),{affected:g(i),removed:g(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.process){const{affected:i}=this.process.restore({seenEntities:e});t.push(...i)}return 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.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:g(t),self:this}}toFlat(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this,...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.process?this.process.toFlat(e):[],...this.error?this.error.toFlat(e):[]])}toFlatIds(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.id,...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))])}toJSON(){var e,t;return{id:this.id,version:this.version,type:this.type,x:this.x,y:this.y,successCalls:this.successCalls.map(i=>i.toJSON()),errorCalls:this.errorCalls.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()),process:(e=this.process)==null?void 0:e.toJSON(),declaration:this.declaration.toJSON(),inputs:this.inputs.map(i=>i.toJSON()),outputs:this.outputs.map(i=>i.toJSON()),parent:this.parent.toReference(),error:(t=this.error)==null?void 0:t.toJSON()}}toReference(){return{id:this.id+"--"+N.UUID.uuid()+"--ref",type:n.GenericReference,entityId:this.id,entityType:this.type}}toShallowJSON(){return{id:this.id,version:this.version,type:this.type,x:this.x,y:this.y,process:this.process?this.process.toReference():null,inputs:this.inputs.map(e=>e.toReference()),outputs:this.outputs.map(e=>e.toReference()),declaration:this.declaration.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()),error:this.error?this.error.toReference():null,parent:this.parent.toReference()}}toFlatJSON(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toShallowJSON(),...this.successCalls.flatMap(i=>i.toFlatJSON(e)),...this.errorCalls.flatMap(i=>i.toFlatJSON(e)),...this.inputs.flatMap(i=>i.toFlatJSON(e)),...this.outputs.flatMap(i=>i.toFlatJSON(e)),...this.process?this.process.toFlatJSON(e):[],...this.error?this.error.toFlatJSON(e):[]])}toGenerationTarget(){const e=this.parent.type===n.Project?void 0:this.parent.id;return{id:this.id,version:this.version,type:this.type,calledByEntry:this.calledByEntry.map(t=>t.id),calledBySuccess:this.calledBySuccess.map(t=>t.id),calledByError:this.calledByError.map(t=>t.id),declaration:this.declaration.id,parent:e}}toFlatGenerationTarget(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toGenerationTarget(),...this.successCalls.flatMap(i=>i.toFlatGenerationTarget(e)),...this.errorCalls.flatMap(i=>i.toFlatGenerationTarget(e)),...this.inputs.flatMap(i=>i.toFlatGenerationTarget(e)),...this.outputs.flatMap(i=>i.toFlatGenerationTarget(e)),...this.process?this.process.toFlatGenerationTarget(e):[],...this.error?this.error.toFlatGenerationTarget(e):[]])}clearErrors(){var e,t;return this.errors=[],this.inputs.forEach(i=>i.clearErrors()),this.outputs.forEach(i=>i.clearErrors()),this.successCalls.forEach(i=>i.clearErrors()),this.errorCalls.forEach(i=>i.clearErrors()),(e=this.process)==null||e.clearErrors(),(t=this.error)==null||t.clearErrors(),this}validate(){const e=z2(this);return this.errors=e,{success:!0,error:null,data:this.toJSON()}}getErrors(){return[...this.errors,...this.inputs.flatMap(t=>t.getErrors()),...this.outputs.flatMap(t=>t.getErrors()),...this.error?this.error.getErrors():[],...this.process?this.process.getErrors():[]]}getShallowErrors(){return this.errors}clone(e){return new Ce(this.toJSON(),this.project)}};c(Ce,"MUTABLE_BASE_PROPERTIES",[]),c(Ce,"INMUTABLE_BASE_PROPERTIES",["id","version","type"]),c(Ce,"BASE_PROPERTIES",[...Ce.MUTABLE_BASE_PROPERTIES,...Ce.INMUTABLE_BASE_PROPERTIES]),c(Ce,"MUTABLE_META_PROPERTIES",["x","y"]),c(Ce,"INMUTABLE_META_PROPERTIES",[...Ce.INMUTABLE_BASE_PROPERTIES]),c(Ce,"META_PROPERTIES",[...Ce.MUTABLE_META_PROPERTIES,...Ce.INMUTABLE_META_PROPERTIES]),c(Ce,"MUTABLE_UPSTREAM_PROPERTIES",["calledBySuccess","calledByError","calledByEntry"]),c(Ce,"INMUTABLE_UPSTREAM_PROPERTIES",["declaration","parent"]),c(Ce,"UPSTREAM_PROPERTIES",[...Ce.MUTABLE_UPSTREAM_PROPERTIES,...Ce.INMUTABLE_UPSTREAM_PROPERTIES]),c(Ce,"MUTABLE_DOWNSTREAM_PROPERTIES",["successCalls","errorCalls","writesValues","inputs","outputs","error"]),c(Ce,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),c(Ce,"DOWNSTREAM_PROPERTIES",[...Ce.MUTABLE_DOWNSTREAM_PROPERTIES,...Ce.INMUTABLE_DOWNSTREAM_PROPERTIES]),c(Ce,"PROPERTIES",[...Ce.META_PROPERTIES,...Ce.UPSTREAM_PROPERTIES,...Ce.DOWNSTREAM_PROPERTIES]);let Ur=Ce;function XP(r){var e,t,i;switch(r.id){case B["built-in-base-entity"].BUILT_IN_PERSISTED_ENTITY_ENTITY.id:{const a=r.project.entities.filter(h=>!!h.implements.find(m=>m.id===B["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.id));if(a.find(h=>!!h.properties.find(m=>{var b;return m.implements&&m.implements.id===B["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.default.id&&((b=m.getDefaultValue())==null?void 0:b.value)===!0}))){const m=a[0].properties.find(v=>v.implements&&v.implements.id===B["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.default.id),b=(e=m==null?void 0:m.dataType)==null?void 0:e.defaultValue;if(b)b.value=!0;else if(m!=null&&m.dataType){const v=(t=m==null?void 0:m.dataType)==null?void 0:t.id.split("-id")[0],P=R({id:v+"-default-value-id",version:1,type:n.PrimitiveValue,name:D.EntityTemplate,autogeneration:null,value:!0,valueAsType:null,parent:m==null?void 0:m.dataType.toReference()},r.project);return P.setParent(m==null?void 0:m.dataType),P.initChildren(),P.addSelfToProject(),{newEntities:[P]}}return{newEntities:[]}}const o=r.project.get(B["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.id),l=Lo(o,"Main database");if(l.errors.length>0)return{newEntities:[]};const p=l.implemented.properties.find(h=>h.implements&&h.implements.id===B["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.default.id),y=(i=p==null?void 0:p.dataType)==null?void 0:i.defaultValue;if(y)y.value=!0;else if(p!=null&&p.dataType){const h=p==null?void 0:p.dataType.id.split("-id")[0],m=R({id:h+"-default-value-id",version:1,type:n.PrimitiveValue,name:D.EntityTemplate,autogeneration:null,value:!0,valueAsType:null,parent:p==null?void 0:p.dataType.toReference()},r.project);m.setParent(p==null?void 0:p.dataType),m.initChildren(),m.addSelfToProject()}return{newEntities:[l.implemented]}}}return{newEntities:[]}}function QP(r){return r.implements.filter(t=>t.type===n.BuiltInBaseEntity).map(t=>{var i;switch(t.id){case B["built-in-base-entity"].BUILT_IN_PERSISTED_ENTITY_ENTITY.id:{const s=r.project.entities.filter(p=>p.implements.find(y=>y.id===B["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.id)).find(p=>!!p.properties.find(y=>{var h;return y.implements&&y.implements.id===B["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.default.id&&((h=y.getDefaultValue())==null?void 0:h.value)===!0}));if(!s)return{newEntities:[]};const o=r.properties.find(p=>p.implements&&p.implements.id===B["built-in-base-entity"].BUILT_IN_PERSISTED_ENTITY_ENTITY.properties.database.id),l=(i=o==null?void 0:o.dataType)==null?void 0:i.defaultValue;if(o&&(o!=null&&o.dataType)&&!l){const p=o==null?void 0:o.dataType.id.split("-id")[0],y=R({id:p+"-default-value-id",version:1,type:n.PrimitiveValue,name:D.EntityTemplate,autogeneration:null,value:null,valueAsType:s,parent:o==null?void 0:o.dataType.toReference()},r.project);return y.setParent(o==null?void 0:o.dataType),y.initChildren(),y.addSelfToProject(),{newEntities:[y]}}return{newEntities:[]}}}}),{newEntities:[]}}function Lo(r,e,t){const i=t||He(e,n.CustomEntity,r.project),a=i.split("-id"),s=a[a.length-1||0]||i,o={id:i,version:1,name:e,type:n.CustomEntity,description:null,static:!1,abstract:!1,properties:[],methods:[],abstractMethods:[],extends:[],implements:[r],x:0,y:0,parent:r.project},l=Oo(o,r.project);if(l.length>0)return{errors:l,implemented:null,entitiesChanges:{new:[],updated:[],deleted:[]}};const p=XP(r),y=R(o,r.project);y.setParent(r.project),y.initChildren();const h=r.properties.map(v=>{const P=s+"-"+He(C(v,r.project),n.Property,r.project),A=v.clone(y,P);return A.abstract=!1,A.implements=v,A.setParent(y),y.addProperty(A),A}),m=r.abstractMethods.map(v=>{const P=s+He(v.name,n.FunctionDeclaration,r.project),A=v.implementAsFunctionDeclaration(P),I={id:P+"-parent-ref-id",type:n.GenericReference,entityId:i,entityType:n.CustomEntity},$={...A,implements:v,parent:I},U=R($,r.project);return y.addMethod(U),U.setParent(y),U.initChildren(),U.implements=v,U});o.properties=h,o.methods=m;const b=QP(y);return{implemented:y,errors:[],entitiesChanges:{new:[y,...p.newEntities,...b.newEntities],updated:[y],deleted:[]}}}function Au(r,e){return e.entities.find(a=>{const s=a.properties,o=s.map(m=>m.name),l=r.every(m=>o.includes(m)),p=o.filter(m=>!r.includes(m)),y=s.every(m=>!p.includes(m.name)||!m.required);return l&&y})||null}function eA(r,e,t=ze.OrDataTypeGroup){const i=[],a=[],s=[],l={id:e.id+"--nested-data-type-id-"+r.id,version:1,type:n.DataType,entity:r.toJSON(),isList:!1,isNullable:!1,defaultValue:null,asType:null,andChildrenGroup:null,orChildrenGroup:null,like:!0,inferred:!1,constant:!1,parentRelationType:t,parent:e.toReference()},p=R(l,r.project);return a.push(p),p.setParent(e),p.initChildren(),p.setEntity(r),p.addSelfToProject(),{updated:g(i),added:g(a),removed:g(s),self:p}}function Ou(r,e,t,i){const a=[],s=[],o=[];switch(typeof r){case"string":let l=!1;const p=new Date(r);if(p instanceof Date&&!isNaN(p.valueOf())&&(l=!0),l){const y=e.project.getBuiltIn(B[n.PrimitiveEntity][D.Date].id);e.setEntity(y);break}else{const y=e.project.getBuiltIn(B[n.PrimitiveEntity][D.String].id);e.setEntity(y);break}case"number":e.setEntity(e.project.getBuiltIn(B[n.PrimitiveEntity][D.Number].id));break;case"boolean":e.setEntity(e.project.getBuiltIn(B[n.PrimitiveEntity][D.Boolean].id));break;case"object":if(r===null){e.setEntity(e.project.getBuiltIn(B[n.PrimitiveEntity][D.Null].id));break}else if(Array.isArray(r))if(e.sync({isList:!0}),r.length>0){const y=r.slice(0,5).filter(m=>m!==void 0);if(y.every(m=>typeof m==typeof y[0])&&(typeof y[0]!="object"||y[0]===null))switch(typeof y[0]){case"string":e.setEntity(e.project.getBuiltIn(B[n.PrimitiveEntity][D.String].id));break;case"number":e.setEntity(e.project.getBuiltIn(B[n.PrimitiveEntity][D.Number].id));break;case"boolean":e.setEntity(e.project.getBuiltIn(B[n.PrimitiveEntity][D.Boolean].id));break;case"object":e.setEntity(e.project.getBuiltIn(B[n.PrimitiveEntity][D.Null].id));break}else{const m=[];let b=!1;y.forEach((P,A)=>{if(Array.isArray(P)&&(b=!0),typeof P=="object"&&!Array.isArray(P)&&P!==null){const I=Go(P,e.project,{...t,id:e.id+"--or-child-data-type-entity-id-"+A},i);I.hasCreated&&m.push(I.changeSet.self),a.push(...I.changeSet.updated),s.push(...I.changeSet.added),o.push(...I.changeSet.removed)}});const v=g(m);if(!v.length&&!b){y.forEach(P=>{const A={id:N.UUID.uuid(),version:1,type:n.DataType,entity:null,isList:!1,isNullable:!1,defaultValue:null,asType:null,andChildrenGroup:null,orChildrenGroup:null,like:!0,inferred:!1,constant:!1,parentRelationType:ze.OrDataTypeGroup,parent:e.toReference()},I=R(A,e.project);switch(I.setParent(e),I.initChildren(),I.addSelfToProject(),typeof P){case"string":I.setEntity(I.project.getBuiltIn(B[n.PrimitiveEntity][D.String].id));break;case"number":I.setEntity(I.project.getBuiltIn(B[n.PrimitiveEntity][D.Number].id));break;case"boolean":I.setEntity(I.project.getBuiltIn(B[n.PrimitiveEntity][D.Boolean].id));break;case"object":I.setEntity(I.project.getBuiltIn(B[n.PrimitiveEntity][D.Null].id));break}});break}else v.length===1&&!b?e.setEntity(v[0]):y.forEach((P,A)=>{if(typeof P=="object"&&!Array.isArray(P)&&P!==null){const I=Au(Object.keys(P),e.project);if(I){const $=eA(I||v[0],e,ze.OrDataTypeGroup);a.push(...$.updated),s.push(...$.added),o.push(...$.removed)}}else{const I={id:e.id+"--or-child-data-type-id--"+A,version:1,type:n.DataType,entity:null,isList:Array.isArray(P),isNullable:!1,defaultValue:null,asType:null,andChildrenGroup:null,orChildrenGroup:null,like:!0,inferred:!1,constant:!1,parentRelationType:ze.OrDataTypeGroup,parent:e.toReference()},$=R(I,e.project);$.setParent(e),$.initChildren(),$.addSelfToProject();const U=Ou(P,$,{...t,id:e.id+"--or-child-data-type-entity-id-"+A},i);a.push(...U.updated),s.push(...U.added),o.push(...U.removed)}})}}else{const y=Go(r[0],e.project,{...t},i);e.setEntity(y.changeSet.self),a.push(...y.changeSet.updated),s.push(...y.changeSet.added),o.push(...y.changeSet.removed);break}else{const y=Go(r,e.project,{...t},i);e.setEntity(y.changeSet.self),a.push(...y.changeSet.updated),s.push(...y.changeSet.added),o.push(...y.changeSet.removed);break}}return{updated:g(a),added:g(s),removed:g(o),self:e}}function Go(r,e,t,i){const a=[],s=[],o=[],l=Object.keys(r),p=Au(l,e);if(p)return{hasCreated:!1,changeSet:{updated:[],added:[],removed:[],self:p}};const y=i?t.name+" of "+i.name:t.name,m={id:t.id||He(y,n.CustomEntity,e),version:1,name:y,type:n.CustomEntity,description:t.description||null,static:t.static||!1,abstract:t.abstract||!1,properties:[],methods:[],abstractMethods:[],extends:[],implements:[],x:0,y:0,parent:e.toReference()},b=R(m,e);return b.setParent(e),b.initChildren(),b.addSelfToProject(),s.push(b),l.forEach((v,P)=>{const A=He(y+" "+v,n.Property,e),I={id:A,version:1,name:v,type:n.Property,description:null,static:!1,abstract:!1,dataType:null,implements:null,index:P,hidden:!1,private:!1,required:!0,parent:b.toReference()},$=R(I,e);$.setParent(b),$.initChildren(),$.addSelfToProject(),s.push($);const U=r[v],Ve={id:A+"--data-type-id",version:1,type:n.DataType,entity:null,isList:!1,isNullable:!1,defaultValue:null,asType:null,andChildrenGroup:null,orChildrenGroup:null,like:!0,inferred:!1,constant:!1,parent:$.toReference()},_t=R(Ve,e);_t.setParent($),_t.initChildren(),_t.addSelfToProject(),s.push(_t);const Nt=Ou(U,_t,{...t,name:v,id:A+"--data-type-entity-id"},i||b);a.push(...Nt.updated),s.push(...Nt.added),o.push(...Nt.removed)}),{hasCreated:!0,changeSet:{updated:g(a),added:g(s),removed:g(o),self:b}}}function $o(r,e){const t=xr(r);if(t.length===0)return{list:[],last:null};let i=null;return{list:t.flatMap(s=>{if(s===e)return i=s,[s];const o=$o(s,e);return o.last&&(i=o.last),[s,...o.list]}),last:i}}function tA(r,e,t=new Set){const i=Kn(r),a=Kn(e),s=i.filter(p=>!a.includes(p)),o=i.filter(p=>a.includes(p)),l=s.reduce((p,y)=>t.has(y.id)?p:(t.add(y.id),g([...p,...tA(y,e,t)])),[]);return g([...o,...l])}function $a(r,e){const t=$o(r,e);return t.last===e&&t.list.length>0&&t.list[0]!==e}function Z2(r,e){return!!$o(r,e).last}function K2(r){if(Ge.includes(r.type))return r;if([...Bn,n.VariableDeclaration].includes(r.type)){const e=r.parent;return Ge.includes(e.type)?e:null}return null}function Su(r,e){if(!r||!e)throw new Error("Both entities must be defined to find a common ancestor");if(r===e)return r;const t=r.parent;if(t){if(t===e)return e;if(t.type===n.Project)return null}else return null;const i=e.parent;if(i){if(i===r)return r;if(i.type===n.Project)return null}else return null;return Su(t,i)}function Qe(r){if(zo.includes(r.type)){if(r.type===n.FunctionDeclaration){const e=r.parent;if(e.type===n.CustomEntity)return e;if(e.type===n.Loop)return e}return r}else{const e=r.parent;return e?Qe(e):null}}function X2(r){return r.type===n.VariableDeclaration?[r]:Ue.includes(r.type)?[...r.inputs,...r.outputs||[]]:r.type===n.ReturnStatement?r.outputs:Jr.includes(r.type)||r.type===n.FunctionDeclaration?r.inputs:[]}function Q2(r){const e=Kn(r),t=[],i=[];ju.includes(r.type)&&t.push(...Cu(r));const a=e.filter(s=>{const o=t.includes(s);return o?!1:Bn.includes(s.type)&&!o?(i.push(s),!1):!0});return t.sort((s,o)=>$a(o,s)?-1:0),i.sort((s,o)=>$a(o,s)?-1:0),[...t,...i,...a]}function nA(r){return[...r].sort((e,t)=>$a(t,e)?-1:0)}function e7(r){const e=nA(r),t=[];return e.forEach(i=>{const a=t[t.length-1];if(a){const s=a[a.length-1];$a(i,s)?t.push([i]):a.push(i)}else t.push([i])}),t}function Et(r){const e=r.map(t=>Qe(t));return g(e)}function Cu(r){return Ue.includes(r.type)?[...Et(r.successCalls),...Et(r.errorCalls)]:Ge.includes(r.type)?Et(r.calls):[]}function t7(r,e){return Cu(r).includes(e)}function Bu(r){return r.writesValues||[]}function n7(r,e){return Bu(r).includes(e)}function rA(r){var e;return ke.includes((e=r==null?void 0:r.readsValue)==null?void 0:e.type)?r.readsValue:null}function r7(r){return r.writesValues}function iA(r=[]){return r.map(rA).filter(e=>!!e)}function Fo(r=[]){return r.map(e=>e.writesValues).flat().filter(e=>ke.includes(e.type))}function aA(r=[]){return r.map(e=>e.readsValue).filter(e=>!!e&&ke.includes(e.type))}function sA(r){return ke.includes(r.type)?r:null}function oA(r){return r.writesValues.map(sA).filter(e=>!!e)}function lA(r=[]){return r.reduce((e,t)=>t.type===n.OutputMap?[...e,...oA(t)]:e,[])}function we(r){return Ue.includes(r.type)?[...ln(Et(r.successCalls)),...ln(Et(r.errorCalls))]:Ge.includes(r.type)?ln(Et(r.calls)):[]}function i7(r){return Ue.includes(r.type)?[...ln(Et(r.successCalls)),...ln(Et(r.errorCalls))]:Ge.includes(r.type)?ln(Et(r.calls)):[]}function cA(r,e=new Set){return r.writesValues.filter(i=>ke.includes(i.type)&&!e.has(i.id)).reduce((i,a)=>e.has(a.id)?i:[...i,...ie(a,e)],[])}function dA(r,e=new Set){var i;return(((i=r.readsValue)==null?void 0:i.writesValues)||[]).filter(a=>ke.includes(a.type)&&!e.has(a.id)).reduce((a,s)=>e.has(s.id)?a:[...a,...ie(s,e)],[])}function ie(r,e=new Set){if(e.has(r.id))return[];if(r.type===n.ReturnStatement)return aA(r.outputs).reduce((i,a)=>[...i,...ie(a,e)],[]);if(r.type===n.FunctionCall||r.type===n.Operation||r.type===n.Condition)return[...we(r).reduce((s,o)=>{const l=Qe(o);return[...s,...ie(l||o,e)]},[]),...iA(r.inputs),...lA(r.outputs)].reduce((s,o)=>[...s,...ie(o,e)],[]);if(Jr.includes(r.type)){const t=Fo(r.inputs),a=we(r).reduce((s,o)=>{const l=Qe(o);return[...s,...ie(l||o,e)]},[]);return t.push(...a),t.reduce((s,o)=>[...s,...ie(o,e)],[])}if(r.type===n.FunctionDeclaration){const t=[...Fo(r.inputs)],a=we(r).reduce((s,o)=>{const l=Qe(o);return[...s,...ie(l||o,e)]},[]);return t.push(...a),t.reduce((s,o)=>[...s,...ie(o)],[])}if(ke.includes(r.type)){e.add(r.id);const i=we(r).reduce((a,s)=>{const o=Qe(s);return[...a,...ie(o||s,e)]},[]);return[r,...i,...dA(r,e),...cA(r,e)]}return[]}function Pt(r,e=new Set){return e.has(r.id)?[]:(e.add(r.id),[...Kn(r).reduce((a,s)=>[...a,s,...Pt(s,e)],[])])}function ln(r){return r.reduce((e,t)=>t.type===n.ReturnStatement||t.type===n.ContinueStatement||t.type===n.BreakStatement?[...e,t]:[...e,t,...we(t)],[])}function uA(r){const e=r.entities||[],t=[...e,...r.functions||[],...r.events||[],...r.projects||[]],i=e.reduce((p,y)=>[...p,...y.properties],[]),a=e.reduce((p,y)=>[...p,...y.methods],[]),s=a.reduce((p,y)=>[...p,...Fo(y.inputs),...ln(Et(y.calls)),...y.returnStatements],[]),o=r.functions.reduce((p,y)=>[...p,...ln(Et(y.calls)),...y.returnStatements],[]),l=r.events.reduce((p,y)=>[...p,...ln(Et(y.calls)),...y.returnStatements],[]);return[...t,...i,...a,...s,...o,...l]}function pA(r,e){return e.filter(i=>{if(!i)return!1;switch(i.type){case n.FunctionCall:return i.inputs.find(a=>a.id===r.id)!==void 0||i.outputs.find(a=>a.id===r.id)!==void 0;case n.Condition:return i.successCalls.find(a=>a.id===r.id)!==void 0||i.errorCalls.find(a=>a.id===r.id)!==void 0||i.inputs.find(a=>a.id===r.id)!==void 0;case n.Operation:return i.outputs.find(a=>a.id===r.id)!==void 0;case n.VariableDeclaration:return Ue.includes(r.type)?yA(r).find(s=>{var o;return((o=s.readsValue)==null?void 0:o.id)===i.id})!==void 0:!1;case n.CustomEntity:return i.properties.find(a=>a.id===r.id)!==void 0||i.methods.find(a=>a.id===r.id)!==void 0;case n.FunctionDeclaration:return i.inputs.find(a=>a.id===r.id)!==void 0||(i.returnStatements.map(a=>a.outputs).flat()||[]).find(a=>a.id===r.id)!==void 0;default:return!1}})}function a7(r){const e=uA(r.project);return pA(r,e)}function xr(r){const e=[];if(Bn.includes(r.type)){r.calledBy.forEach(a=>{const s=Qe(a);s&&e.push(s)});const i=[...r.inputs||[],...r.outputs||[]].map(a=>Nu(a)).filter(a=>a!==null);e.push(...g(i))}if(ke.includes(r.type)){const t=Nu(r);t&&e.push(t)}return g(e)}function wu(r){return r.type===n.FunctionCall||r.type===n.InternalCall||[n.Operation,n.Condition,n.Loop].includes(r.type)?r.declaration.inputs:r.type===n.FunctionDeclaration||Jr.includes(r.type)?r.inputs:r.type===n.Search?r.inputsDeclarations:[]}function s7(r,e){return e.type===n.Condition?e.inputs.find(t=>t.declaration.id===r.id):e.type===n.FunctionCall||e.type===n.Operation?e.inputs.find(t=>t.declaration.id===r.id):null}function yA(r){return Ue.includes(r.type)?r.inputs:[]}function _u(r){var e;return r.type===n.FunctionCall?((e=r.declaration.returnStatements[0])==null?void 0:e.outputs)||[]:[n.Operation,n.Condition,n.Loop].includes(r.type)?r.declaration.outputs:r.type===n.Search?r.outputsDeclarations:$e.includes(r.type)?r.outputs:[]}function o7(r,e){return e.type===n.Condition?null:e.type===n.FunctionCall||e.type===n.Operation?e.outputs.find(t=>t.declaration.id===r.id):null}function l7(r){return r.type===n.Condition?[]:Ue.includes(r.type)?r.outputs:[]}function Nu(r){const e=r.readsValue;return e?Qe(e):null}function fA(r){const e=r.internalCalls||[];return g(Et(g(e.flatMap(t=>[...t.successCalls,...t.errorCalls]))))}function Si(r){const e=Bu(r),t=[];return e.forEach(i=>{if(ke.includes(i.type))t.push(i);else if(Cn.includes(i.type)){const a=i.parent;t.push(a)}}),t}function g(r){const e=new Set;return r.filter(t=>!t||e.has(t.id)?!1:(e.add(t.id),!0))}function Kn(r,e=!1){const t=[];if(r.type===n.Project&&t.push(...(r==null?void 0:r.entities)||[],...(r==null?void 0:r.functions)||[],...(r==null?void 0:r.variableDeclarations)||[],...(r==null?void 0:r.variableInstances)||[],...(r==null?void 0:r.searches)||[],...(r==null?void 0:r.loops)||[],...(r==null?void 0:r.operations)||[],...(r==null?void 0:r.conditions)||[],...(r==null?void 0:r.functionCalls)||[],...(r==null?void 0:r.events)||[],...(r==null?void 0:r.projects)||[]),ct.includes(r.type)&&t.push(...(r==null?void 0:r.detachedChildren)||[]),r.type===n.CustomEntity){const i=[...r.suggestedMethods,...r.methods].flatMap(a=>a.collapsed&&e?[]:Kn(a));t.push(...i)}if(r.type===n.Condition){const i=r.successCalls.map(s=>Qe(s)),a=r.errorCalls.map(s=>Qe(s));t.push(...i,...a)}if(Jr.includes(r.type)){if(r.collapsed&&e)return[];const i=r.inputs.map(s=>Si(s)).flat(),a=r.calls.map(s=>Qe(s));t.push(...g(i),...a)}if(Ue.includes(r.type)&&r.type!==n.Condition){const i=r==null?void 0:r.outputs.map(o=>Si(o)).flat(),a=r.successCalls.map(o=>Qe(o)),s=r.errorCalls.map(o=>Qe(o));t.push(...g(i),...a,...s)}if(ke.includes(r.type)){const i=Si(r),a=fA(r);t.push(...i,...a)}if(r.type===n.Loop){const i=r.outputs.map(o=>Si(o)).flat();if(r.body){const o=Kn(r.body,e);t.push(...o)}const a=r.errorCalls.map(o=>Qe(o)),s=r.successCalls.map(o=>Qe(o));t.push(...g(i),...s,...a)}if(r.type===n.FunctionDeclaration){if(r.collapsed&&e)return[];const i=r.inputs.map(s=>Si(s)).flat(),a=r.calls.map(s=>Qe(s));t.push(...g(i),...a)}return g(t)}function hA(r,e=!1){const t=Kn(r,e),i=[...t,...t.reduce((a,s)=>[...a,...hA(s,e)],[])];return g(i)}function mA(r){const e=xr(r),t=[...e,...e.reduce((i,a)=>[...i,...mA(a)],[])];return g(t)}function Uo(r){return r.implements.reduce((e,t)=>t.type===n.CustomEntity?[...e,n.CustomEntity,...Uo(t),...xo(t)]:[...e,t.name],[])}function xo(r){return r.extends.reduce((e,t)=>t.type===n.CustomEntity?[...e,n.CustomEntity,...xo(t),...Uo(t)]:[...e,t.name],[])}function Mu(r){return r.extends.reduce((e,t)=>t.type===n.CustomEntity?[...e,t,...Mu(t),...Vu(t)]:[...e,t],[])}function Vu(r){return r.implements.reduce((e,t)=>t.type===n.CustomEntity?[...e,t,...Vu(t),...Mu(t)]:[...e,t],[])}function TA(r){return[...xo(r),...Uo(r)].filter((t,i,a)=>a.indexOf(t)===i)}function EA(r){return r.implements.length===0&&r.extends.length===0?null:r.implements.find(i=>i.type===n.BuiltInBaseEntity&&i.name===L.PERSISTED_ENTITY)?r:[...r.implements,...r.extends].reduce((i,a)=>{if(a.type===n.CustomEntity){const s=EA(a);if(s)return s}return i},null)}function c7(r){const e=r.extends.find(t=>t.type===n.BuiltInBaseEntity);return e&&e.type===n.BuiltInBaseEntity?e:null}function d7(r){const e=r.implements.find(t=>t.type===n.BuiltInBaseEntity);return e&&e.type===n.BuiltInBaseEntity?e:null}function bA(r){const e=r.extends.find(t=>t.type===n.CustomEntity);return e&&e.type===n.CustomEntity?e:null}function Xn(r){const e=[...r.implements,...r.extends].reduce((t,i)=>i.type===n.BuiltInBaseEntity?[...t,i]:i.type===n.CustomEntity?[...t,...Xn(i)]:t,[]);return g(e)}function Lu(r){return r.type===n.PrimitiveEntity?!0:r.type===n.BuiltInBaseEntity?r.interactive:!Xn(r).find(i=>!i.interactive)}function u7(r){return r.parent===r.project&&r.project.variableDeclarations.includes(r)}function Gu(r){return r.parent!==r.project?!1:n.VariableDeclaration===r.type?r.project.variableDeclarations.includes(r):n.VariableInstance===r.type?r.project.variableInstances.includes(r):n.FunctionCall===r.type?r.project.functionCalls.includes(r):n.Condition===r.type?r.project.conditions.includes(r):n.Operation===r.type?r.project.operations.includes(r):n.Loop===r.type?r.project.loops.includes(r):n.Search===r.type?r.project.searches.includes(r):!1}function RA(r){if([...Ge,n.CustomEntity,n.InstalledProject,n.Project].includes(r.type)||Gu(r))return!1;const e=xr(r);return e.length===0?!0:e.some(t=>RA(t))}function $u(r){return[...Ge,n.CustomEntity,n.InstalledProject,n.Project].includes(r.type)||Gu(r)?!1:xr(r).length===0}function gA(r,e=0){if($u(r)){const t=xr(r);return t.length===0?r:t.map(a=>gA(a,e+1)).reduce((a,s)=>a?s&&s.x<a.x?s:a:s,null)}return null}function vA(r){const e=[];if($u(r))e.push(r);else return[];return xr(r).forEach(i=>{e.push(...vA(i))}),e}function IA(r){return r.type===n.FunctionDeclaration&&r.parent!==r.project&&!![n.CustomEntity,n.Loop,n.InstalledProject].includes(r.parent.type)}function p7(r,e){const t=new Map;return r.forEach(i=>{t.set(i.id,i)}),e.forEach(i=>{t.set(i.id,i)}),Array.from(t.values())}function jo(r){switch(r){case n.CustomEntity:return jr;case n.FunctionDeclaration:return Cr;case n.VariableDeclaration:return Nr;case n.VariableInstance:return Mr;case n.FunctionCall:return Ur;case n.Operation:return Br;case n.Condition:return _r;case n.ReturnStatement:return $r;case n.Loop:return wr;case n.Search:return Vr;case n.InputMap:return An;case n.OutputMap:return On;case n.ArgumentDeclaration:return Gr;case n.ReturnDeclaration:return Bt;case n.Property:return Sr;case n.InstalledProject:return Lr;case n.Project:return N;case n.BuiltInBaseEntity:return Ft;default:return null}}function bt(r,e){if(ct.includes(r.type))return r;if(Wr.includes(r.type))return null;const t=r.parent;if(!t)return null;if(t.type===n.GenericReference){const i=_(t);if(!i)return null;const a=e.get(i);return a?bt(a,e):null}else return t===e?e:bt(t,e)}function Fu(r,e){if(Wr.includes(r.type)||e.getBuiltIn(r.id))return null;const t=wt(r.parent,e);return t?t===e?ct.includes(r.type)?r:null:t.type===n.CustomEntity?r:Fu(t,e):null}function ko(r,e,t){if(r===e||e===t||r===t)return!1;const i=bt(e.parent,t);return i===r?!0:ko(i,e,t)}var qo=(r=>(r.SameBothLocal="same-both-local",r.AInB="a-in-b",r.BInA="b-in-a",r.ParallelInCommonParent="parallel-in-common-parent",r.ParallelInProject="parallel-in-project",r.AIsGlobalBIsNot="a-is-global-b-is-not",r.BIsGlobalAIsNot="b-is-global-a-is-not",r.SameBothGlobal="same-both-global",r))(qo||{});function Fa(r,e,t){const i=bt(r,t),a=bt(e,t);if(!i)throw new Error("Could not find scope owner for the entity: "+r.id);if(!a)throw new Error("Could not find scope owner for the entity: "+e.id);if(i===a&&i.type!==n.Project)return{compatible:!0,type:"same-both-local",commonAncestorScope:i};if(i===a&&i.type===n.Project)return{compatible:!0,type:"same-both-global",commonAncestorScope:i};if(i.type===n.Project&&a.type!==n.Project)return{compatible:!1,type:"a-is-global-b-is-not",commonAncestorScope:i};if(i.type!==n.Project&&a.type===n.Project)return{compatible:!1,type:"b-is-global-a-is-not",commonAncestorScope:a};if(ko(i,a,t))return{compatible:!0,type:"b-in-a",commonAncestorScope:i};if(ko(a,i,t))return{compatible:!0,type:"a-in-b",commonAncestorScope:a};const l=Su(i,a);return l===t?{compatible:!1,type:"parallel-in-project",commonAncestorScope:l}:l?{compatible:!1,type:"parallel-in-common-parent",commonAncestorScope:bt(l,t)}:{compatible:!1,type:"parallel-in-project",commonAncestorScope:t}}function DA(r,e,t){const i=Fa(r,e,t);if(!i.compatible||i.type!=="same-both-local")return null;if(r===e)return r;let a=bt(r.parent,t);if(a){if(a===e)return e;if(a.type===n.Project)return r}else return r;for(;a;){if(a){if(a===e)return e;if(a.type===n.Project)return r}else return r;a=bt(a.parent,t)}let s=bt(e.parent,t);if(s){if(s===r)return r;if(s.type===n.Project)return e}else return e;for(;s;){if(s){if(s===r)return r;if(s.type===n.Project)return e}else return e;s=bt(s.parent,t)}return null}function PA(r){return r.length===0?null:r.length===1?r[0]:r.reduce((t,i)=>{const a=DA(t,i,i.project);return!a||a===i?t:i},r[0])}function wt(r,e){let t;return typeof r=="string"?t=r:r.type===n.GenericReference?t=_(r):t=r.id,t===e.id?e:e.get(t)}function Qn(r){if(!r)return null;if(Wr.includes(r.type))return r;if(r.type===n.Project)return null;if(r.project.getBuiltIn(r.id))return r;const e=r.parent;return!e||e.type===n.Project?null:Qn(e)}function Ua(r,e){var t;if(r.readsValue){const i=wt(r.readsValue,e.project);e.setValueWriter(i),i.addValueReader(e)}else r.readsValue===null&&((t=e.readsValue)==null||t.removeValueReader(e),e.readsValue=null);return e}function xa(r){const e=[];function t(s,o){return e.some(l=>l.blockedByCaller===s&&l.blockedByCalling===o)}function i(s,o){t(s,o)||e.push({blockedByCaller:s,blockedByCalling:o})}const a=Fu(r,r.project);return r.calledBySuccess.forEach(s=>{[...s.successCalls||[]].forEach(p=>{$e.includes(p.type)&&p!==r&&(we(r).find(m=>m===p)||i(s,p))});let l;if(Ue.includes(s.type)&&(l=s),l){const p=xa(l);p.reachable||we(r).find(m=>m===s)||p.blocks.forEach(m=>{i(s,m.blockedByCalling)})}}),r.calledByError.forEach(s=>{[...s.errorCalls||[]].forEach(p=>{$e.includes(p.type)&&p!==r&&(we(r).find(m=>m===p)||i(s,p))});let l;if(Ue.includes(s.type)&&(l=s),l){const p=xa(l);p.reachable||we(r).find(m=>m===s)||p.blocks.forEach(m=>{i(s,m.blockedByCalling)})}}),r.calledByEntry.forEach(s=>{if([...s.calls||[]].forEach(p=>{$e.includes(p.type)&&p!==r&&(we(r).find(m=>m===p)||i(s,p))}),s===a)return;let l;if(s.type===n.FunctionDeclaration){const p=Qe(s);if(p.type===n.CustomEntity)return;p.type===n.Loop&&(l=p)}if(l){const p=xa(l);p.reachable||p.blocks.forEach(y=>{i(s,y.blockedByCalling)})}}),{reachable:e.length===0,entryPoint:a,blocks:e}}function y7(r){return zo.includes(r.type)?r.type===n.FunctionDeclaration?!IA(r):!0:!1}function f7(r){if(n.ActionDescriptor===r.type){if(r.project.operationDeclarations.find(s=>s.id===r.id))return n.Operation;if(r.project.globalEventActionDescriptors.find(s=>s.id===r.id))return n.GlobalEvent;if(r.project.loopDeclarations.find(s=>s.id===r.id))return n.Loop;if(r.project.conditionDeclarations.find(s=>s.id===r.id))return n.Condition}return r.type}function h7(r,e){const t=[];if(r.parent)if(r.id===r.parent)t.push(new E({id:`${r.id}--${r.parent}--${f.SelfReference}`,code:f.SelfReference,severity:T.Error,message:`Entity of type "${r.type}" with id "${r.id}", has a reference to itself at 'parent'. This is not allowed. Change the reference string or the 'entityId' property of the reference object.`,issue:null}));else{const i=e.get(r.parent);i?[n.Project,n.DataType].includes(i.type)||t.push(new E({id:`${r.id}--${r.parent}--${f.InvalidParentReference}`,code:f.InvalidParentReference,severity:T.Error,message:`Entity of type "${r.type}" with id "${r.id}", has a parent reference that isn't pointing to an entity of type 'project' or 'data-type'.`,issue:null})):t.push(new E({id:`${r.id}--${r.parent}--${f.ReferencedEntityNotFound}`,code:f.ReferencedEntityNotFound,severity:T.Error,message:`Entity of type "${r.type}" with id "${r.id}", is referencing an entity with id "${r.parent}" that isn't yet found in the project. Perhaps it should be created first. Or perhaps the ID is incorrect.`,issue:null}))}return r.implements&&Array.isArray(r.implements)?r.implements.forEach(i=>{if(r.id===i){t.push(new E({id:`${r.id}--${i}--${f.SelfReference}`,code:f.SelfReference,severity:T.Error,message:`Entity of type "${r.type}" with id "${r.id}", has a reference to itself at one of the 'implements' references. This is not allowed. Change the reference string or the 'entityId' property of the reference object.`,issue:null}));return}const a=e.get(i);a?[n.CustomEntity,n.BuiltInBaseEntity].includes(a.type)?a.abstract||t.push(new E({id:`${r.id}--${i}--${f.InvalidImplementsReference}`,code:f.InvalidImplementsReference,severity:T.Error,message:`Entity of type "${r.type}" with id "${r.id}", has an 'implements' reference that isn't pointing to an abstract entity.`,issue:null})):t.push(new E({id:`${r.id}--${i}--${f.InvalidImplementsReference}`,code:f.InvalidImplementsReference,severity:T.Error,message:`Entity of type "${r.type}" with id "${r.id}", has an 'implements' reference that isn't pointing to an entity of type 'custom-entity' or 'built-in-base-entity'.`,issue:null})):t.push(new E({id:`${r.id}--${i}--${f.ReferencedEntityNotFound}`,code:f.ReferencedEntityNotFound,severity:T.Error,message:`Entity of type "${r.type}" with id "${r.id}", is referencing an entity with id "${i}" that isn't yet found in the project. Perhaps it should be created first. Or perhaps the ID is incorrect.`,issue:null}))}):t.push(new E({id:`${r.id}--${S.InvalidObjectStructure}`,code:S.InvalidObjectStructure,severity:T.Error,message:`Entity of type "${r.type}" with id "${r.id}", has an 'implements' property that isn't an array.`,issue:null})),r.extends&&Array.isArray(r.extends)&&r.extends.forEach(i=>{const a=e.get(i);a?[n.CustomEntity,n.BuiltInBaseEntity].includes(a.type)?a.abstract&&t.push(new E({id:`${r.id}--${i}--${f.InvalidExtendsReference}`,code:f.InvalidExtendsReference,severity:T.Error,message:`Entity of type "${r.type}" with id "${r.id}", has an 'extends' reference that isn't pointing to a non-abstract entity. Did you want to use the property 'implements', which holds a list of references to absract entities, instead?`,issue:null})):t.push(new E({id:`${r.id}--${i}--${f.InvalidExtendsReference}`,code:f.InvalidExtendsReference,severity:T.Error,message:`Entity of type "${r.type}" with id "${r.id}", has an 'extends' reference that isn't pointing to an entity of type 'custom-entity' or 'built-in-base-entity'.`,issue:null})):t.push(new E({id:`${r.id}--${i}--${f.ReferencedEntityNotFound}`,code:f.ReferencedEntityNotFound,severity:T.Error,message:`Entity of type "${r.type}" with id "${r.id}", is referencing an entity with id "${i}" that isn't yet found in the project. Perhaps it should be created first. Or perhaps the ID is incorrect.`,issue:null}))}),t}const Be=class Be{constructor(e,t){c(this,"initialData");c(this,"id");c(this,"version");c(this,"name");c(this,"description",null);c(this,"x");c(this,"y");c(this,"static");c(this,"abstract");c(this,"type",n.CustomEntity);c(this,"properties",[]);c(this,"methods",[]);c(this,"abstractMethods",[]);c(this,"extends",[]);c(this,"implements",[]);c(this,"project");c(this,"errors",[]);c(this,"parent");c(this,"initialized",!1);c(this,"suggestedProperties",[]);c(this,"suggestedMethods",[]);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,this.static=e.static,this.abstract=e.abstract}static fromGenerationTarget(e,t){let i=t;if(e.parent){const p=_(e.parent);i=t.get(p)}const a=[];e.implements&&e.implements.forEach(p=>{a.push(t.get(p)||t.getBuiltIn(p))});const s=[];e.extends&&e.extends.forEach(p=>{s.push(t.get(p)||t.getBuiltIn(p))});const o={id:e.id,version:1,name:e.name,type:n.CustomEntity,description:e.description,static:e.static,abstract:e.abstract,properties:[],methods:[],abstractMethods:[],extends:s,implements:a,x:0,y:0,parent:i},l=R(o,t);return l.setParent(i),l.initChildren(),l}static validateGenerationTarget(e,t){let i=JSON.parse(JSON.stringify(e));const a=[],s=h7(i,t),o=Oo(i,t);a.push(...s,...o,...Ne(i));const l=i.parent?t.get(i.parent):null;if(l&&l.type===n.DataType){const p=l;p.entity&&a.push(new E({id:`${e.id}--${f.NewEntityWouldOverriteExisting}`,code:f.NewEntityWouldOverriteExisting,severity:T.Error,message:`The entity of type '${e.type}' with id '${e.id}' can't be added to the 'parent' entity with id '${p.id}' because it already has an 'entity' child. Data type entities can only have one 'entity' as children.
|
|
368
|
+
You shouldn't have to manually update a 'parent' property. The equivalent result is to change its callers, the value writters of its inputs, or the value readers of its outputs.`,issue:null})),{errors:t,modifiedData:e}}addSelfToProject(){var a;const e=[this],t=[],i=[];return this.parent===this.project&&this.project.addFunctionCall(this),(a=this.process)==null||a.writesValues.forEach(s=>{s.setValueWriter(this.process),e.push(s)}),this.successCalls.forEach(s=>{s.addSuccessCaller(this),e.push(s)}),this.errorCalls.forEach(s=>{s.addErrorCaller(this),e.push(s)}),this.calledBySuccess.forEach(s=>{s.addSuccessCall(this),e.push(s)}),this.calledByError.forEach(s=>{s.addErrorCall(this),e.push(s)}),this.calledByEntry.forEach(s=>{s.addCall(this),e.push(s)}),{updated:g(e),added:g(t),removed:g(i),self: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.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}addValueReader(e){var t;return(t=this.process)==null||t.addValueReader(e),this}removeValueReader(e){var t;return(t=this.process)==null||t.removeValueReader(e),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(){if(this.initialized)return this;if(this.initialized=!0,this.initialData.declaration.type===n.FunctionDeclaration){const e=R(this.initialData.declaration,this.project);this.declaration=e}else{const e=_(this.initialData.declaration),t=this.project.get(e);this.declaration=t}return this.successCalls=this.initialData.successCalls.map(e=>{const t=R(e,this.project);return t.addSuccessCaller(this),[n.BreakStatement,n.ContinueStatement].includes(t.type)?(t.setParent(this.parent.parent),t.initChildren()):t.type!==n.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),[n.BreakStatement,n.ContinueStatement].includes(t.type)?(t.setParent(this.parent.parent),t.initChildren()):t.type!==n.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.initOutputs(),this.initialData.process&&(this.process=R(this.initialData.process,this.project),this.process.setParent(this),this.process.initChildren()),this.initialData.error&&(this.error=R(this.initialData.error,this.project),this.error.setParent(this),this.error.initChildren()),this}initOutputs(){const e=[];this.outputs=this.initialData.outputs.map(s=>{const o=R(s,this.project);return e.push(o.index),o.setParent(this),o.initChildren(),o});const i=_u(this).filter(s=>!this.outputs.find(o=>o.declaration.id===s.id));i.sort((s,o)=>s.index-o.index);const a=i.map((s,o)=>{const l=e.includes(s.index)?this.outputs.length-1+o:s.index,p={id:N.UUID.uuid(),type:n.OutputMap,version:1,declaration:s,index:l,parent:this,writesValues:[]},y=R(p,this.project);return y.setParent(this),y.initChildren(),y});return this.outputs.push(...a),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}){var s;const i=[],a=[];if(t.has(this.id))return{affected:[],removed:[]};if(t.add(this.id),a.push(this),this.unsubscribe(),this.process){const{affected:o,removed:l}=(s=this.process)==null?void 0:s.remove({ignoreUpstream:!0,seenEntities:t});i.push(...o),a.push(...l)}if(this.inputs.forEach(o=>{const{affected:l,removed:p}=o.remove({ignoreUpstream:!0,seenEntities:t});i.push(...l),a.push(...p)}),this.outputs.forEach(o=>{const{affected:l,removed:p}=o.remove({ignoreUpstream:!0,seenEntities:t});i.push(...l),a.push(...p)}),this.error){const{affected:o,removed:l}=this.error.remove({ignoreUpstream:!0,seenEntities:t});i.push(...o),a.push(...l)}return this.successCalls.forEach(o=>{i.push(o),o.removeCaller(this)}),this.errorCalls.forEach(o=>{i.push(o),o.removeCaller(this)}),e||this.calledBy.forEach(o=>{i.push(o),o.removeCall(this)}),{affected:g(i),removed:g(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.process){const{affected:i}=this.process.restore({seenEntities:e});t.push(...i)}return 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.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:g(t),self:this}}toFlat(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this,...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.process?this.process.toFlat(e):[],...this.error?this.error.toFlat(e):[]])}toFlatIds(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.id,...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))])}toJSON(){var e,t;return{id:this.id,version:this.version,type:this.type,x:this.x,y:this.y,successCalls:this.successCalls.map(i=>i.toJSON()),errorCalls:this.errorCalls.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()),process:(e=this.process)==null?void 0:e.toJSON(),declaration:this.declaration.toJSON(),inputs:this.inputs.map(i=>i.toJSON()),outputs:this.outputs.map(i=>i.toJSON()),parent:this.parent.toReference(),error:(t=this.error)==null?void 0:t.toJSON()}}toReference(){return{id:this.id+"--"+N.UUID.uuid()+"--ref",type:n.GenericReference,entityId:this.id,entityType:this.type}}toShallowJSON(){return{id:this.id,version:this.version,type:this.type,x:this.x,y:this.y,process:this.process?this.process.toReference():null,inputs:this.inputs.map(e=>e.toReference()),outputs:this.outputs.map(e=>e.toReference()),declaration:this.declaration.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()),error:this.error?this.error.toReference():null,parent:this.parent.toReference()}}toFlatJSON(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toShallowJSON(),...this.successCalls.flatMap(i=>i.toFlatJSON(e)),...this.errorCalls.flatMap(i=>i.toFlatJSON(e)),...this.inputs.flatMap(i=>i.toFlatJSON(e)),...this.outputs.flatMap(i=>i.toFlatJSON(e)),...this.process?this.process.toFlatJSON(e):[],...this.error?this.error.toFlatJSON(e):[]])}toGenerationTarget(){const e=this.parent.type===n.Project?void 0:this.parent.id;return{id:this.id,version:this.version,type:this.type,calledByEntry:this.calledByEntry.map(t=>t.id),calledBySuccess:this.calledBySuccess.map(t=>t.id),calledByError:this.calledByError.map(t=>t.id),declaration:this.declaration.id,parent:e}}toFlatGenerationTarget(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toGenerationTarget(),...this.successCalls.flatMap(i=>i.toFlatGenerationTarget(e)),...this.errorCalls.flatMap(i=>i.toFlatGenerationTarget(e)),...this.inputs.flatMap(i=>i.toFlatGenerationTarget(e)),...this.outputs.flatMap(i=>i.toFlatGenerationTarget(e)),...this.process?this.process.toFlatGenerationTarget(e):[],...this.error?this.error.toFlatGenerationTarget(e):[]])}clearErrors(){var e,t;return this.errors=[],this.inputs.forEach(i=>i.clearErrors()),this.outputs.forEach(i=>i.clearErrors()),this.successCalls.forEach(i=>i.clearErrors()),this.errorCalls.forEach(i=>i.clearErrors()),(e=this.process)==null||e.clearErrors(),(t=this.error)==null||t.clearErrors(),this}validate(){const e=z2(this);return this.errors=e,{success:!0,error:null,data:this.toJSON()}}getErrors(){return[...this.errors,...this.inputs.flatMap(t=>t.getErrors()),...this.outputs.flatMap(t=>t.getErrors()),...this.error?this.error.getErrors():[],...this.process?this.process.getErrors():[]]}getShallowErrors(){return this.errors}clone(e){return new Ce(this.toJSON(),this.project)}};c(Ce,"MUTABLE_BASE_PROPERTIES",[]),c(Ce,"INMUTABLE_BASE_PROPERTIES",["id","version","type"]),c(Ce,"BASE_PROPERTIES",[...Ce.MUTABLE_BASE_PROPERTIES,...Ce.INMUTABLE_BASE_PROPERTIES]),c(Ce,"MUTABLE_META_PROPERTIES",["x","y"]),c(Ce,"INMUTABLE_META_PROPERTIES",[...Ce.INMUTABLE_BASE_PROPERTIES]),c(Ce,"META_PROPERTIES",[...Ce.MUTABLE_META_PROPERTIES,...Ce.INMUTABLE_META_PROPERTIES]),c(Ce,"MUTABLE_UPSTREAM_PROPERTIES",["calledBySuccess","calledByError","calledByEntry"]),c(Ce,"INMUTABLE_UPSTREAM_PROPERTIES",["declaration","parent"]),c(Ce,"UPSTREAM_PROPERTIES",[...Ce.MUTABLE_UPSTREAM_PROPERTIES,...Ce.INMUTABLE_UPSTREAM_PROPERTIES]),c(Ce,"MUTABLE_DOWNSTREAM_PROPERTIES",["successCalls","errorCalls","writesValues","inputs","outputs","error"]),c(Ce,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),c(Ce,"DOWNSTREAM_PROPERTIES",[...Ce.MUTABLE_DOWNSTREAM_PROPERTIES,...Ce.INMUTABLE_DOWNSTREAM_PROPERTIES]),c(Ce,"PROPERTIES",[...Ce.META_PROPERTIES,...Ce.UPSTREAM_PROPERTIES,...Ce.DOWNSTREAM_PROPERTIES]);let Ur=Ce;function XP(r){var e,t,i;switch(r.id){case B["built-in-base-entity"].BUILT_IN_PERSISTED_ENTITY_ENTITY.id:{const a=r.project.entities.filter(h=>!!h.implements.find(m=>m.id===B["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.id));if(a.find(h=>!!h.properties.find(m=>{var b;return m.implements&&m.implements.id===B["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.default.id&&((b=m.getDefaultValue())==null?void 0:b.value)===!0}))){const m=a[0].properties.find(v=>v.implements&&v.implements.id===B["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.default.id),b=(e=m==null?void 0:m.dataType)==null?void 0:e.defaultValue;if(b)b.value=!0;else if(m!=null&&m.dataType){const v=(t=m==null?void 0:m.dataType)==null?void 0:t.id.split("-id")[0],P=R({id:v+"-default-value-id",version:1,type:n.PrimitiveValue,name:D.EntityTemplate,autogeneration:null,value:!0,valueAsType:null,parent:m==null?void 0:m.dataType.toReference()},r.project);return P.setParent(m==null?void 0:m.dataType),P.initChildren(),P.addSelfToProject(),{newEntities:[P]}}return{newEntities:[]}}const o=r.project.get(B["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.id),l=Lo(o,"Main database");if(l.errors.length>0)return{newEntities:[]};const p=l.implemented.properties.find(h=>h.implements&&h.implements.id===B["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.default.id),y=(i=p==null?void 0:p.dataType)==null?void 0:i.defaultValue;if(y)y.value=!0;else if(p!=null&&p.dataType){const h=p==null?void 0:p.dataType.id.split("-id")[0],m=R({id:h+"-default-value-id",version:1,type:n.PrimitiveValue,name:D.EntityTemplate,autogeneration:null,value:!0,valueAsType:null,parent:p==null?void 0:p.dataType.toReference()},r.project);m.setParent(p==null?void 0:p.dataType),m.initChildren(),m.addSelfToProject()}return{newEntities:[l.implemented]}}}return{newEntities:[]}}function QP(r){return r.implements.filter(t=>t.type===n.BuiltInBaseEntity).map(t=>{var i;switch(t.id){case B["built-in-base-entity"].BUILT_IN_PERSISTED_ENTITY_ENTITY.id:{const s=r.project.entities.filter(p=>p.implements.find(y=>y.id===B["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.id)).find(p=>!!p.properties.find(y=>{var h;return y.implements&&y.implements.id===B["built-in-base-entity"].BUILT_IN_RELATIONAL_DATABASE_ENTITY.properties.default.id&&((h=y.getDefaultValue())==null?void 0:h.value)===!0}));if(!s)return{newEntities:[]};const o=r.properties.find(p=>p.implements&&p.implements.id===B["built-in-base-entity"].BUILT_IN_PERSISTED_ENTITY_ENTITY.properties.database.id),l=(i=o==null?void 0:o.dataType)==null?void 0:i.defaultValue;if(o&&(o!=null&&o.dataType)&&!l){const p=o==null?void 0:o.dataType.id.split("-id")[0],y=R({id:p+"-default-value-id",version:1,type:n.PrimitiveValue,name:D.EntityTemplate,autogeneration:null,value:null,valueAsType:s,parent:o==null?void 0:o.dataType.toReference()},r.project);return y.setParent(o==null?void 0:o.dataType),y.initChildren(),y.addSelfToProject(),{newEntities:[y]}}return{newEntities:[]}}}}),{newEntities:[]}}function Lo(r,e,t){const i=t||He(e,n.CustomEntity,r.project),a=i.split("-id"),s=a[a.length-1||0]||i,o={id:i,version:1,name:e,type:n.CustomEntity,description:null,static:!1,abstract:!1,properties:[],methods:[],abstractMethods:[],extends:[],implements:[r],x:0,y:0,parent:r.project},l=Oo(o,r.project);if(l.length>0)return{errors:l,implemented:null,entitiesChanges:{new:[],updated:[],deleted:[]}};const p=XP(r),y=R(o,r.project);y.setParent(r.project),y.initChildren();const h=r.properties.map(v=>{const P=s+"-"+He(C(v,r.project),n.Property,r.project),A=v.clone(y,P);return A.abstract=!1,A.implements=v,A.setParent(y),y.addProperty(A),A}),m=r.abstractMethods.map(v=>{const P=s+He(v.name,n.FunctionDeclaration,r.project),A=v.implementAsFunctionDeclaration(P),I={id:P+"-parent-ref-id",type:n.GenericReference,entityId:i,entityType:n.CustomEntity},$={...A,implements:v,parent:I},F=R($,r.project);return y.addMethod(F),F.setParent(y),F.initChildren(),F.implements=v,F});o.properties=h,o.methods=m;const b=QP(y);return{implemented:y,errors:[],entitiesChanges:{new:[y,...p.newEntities,...b.newEntities],updated:[y],deleted:[]}}}function Au(r,e){return e.entities.find(a=>{const s=a.properties,o=s.map(m=>m.name),l=r.every(m=>o.includes(m)),p=o.filter(m=>!r.includes(m)),y=s.every(m=>!p.includes(m.name)||!m.required);return l&&y})||null}function eA(r,e,t=ze.OrDataTypeGroup){const i=[],a=[],s=[],l={id:e.id+"--nested-data-type-id-"+r.id,version:1,type:n.DataType,entity:r.toJSON(),isList:!1,isNullable:!1,defaultValue:null,asType:null,andChildrenGroup:null,orChildrenGroup:null,like:!0,inferred:!1,constant:!1,parentRelationType:t,parent:e.toReference()},p=R(l,r.project);return a.push(p),p.setParent(e),p.initChildren(),p.setEntity(r),p.addSelfToProject(),{updated:g(i),added:g(a),removed:g(s),self:p}}function Ou(r,e,t,i){const a=[],s=[],o=[];switch(typeof r){case"string":let l=!1;const p=new Date(r);if(p instanceof Date&&!isNaN(p.valueOf())&&(l=!0),l){const y=e.project.getBuiltIn(B[n.PrimitiveEntity][D.Date].id);e.setEntity(y);break}else{const y=e.project.getBuiltIn(B[n.PrimitiveEntity][D.String].id);e.setEntity(y);break}case"number":e.setEntity(e.project.getBuiltIn(B[n.PrimitiveEntity][D.Number].id));break;case"boolean":e.setEntity(e.project.getBuiltIn(B[n.PrimitiveEntity][D.Boolean].id));break;case"object":if(r===null){e.setEntity(e.project.getBuiltIn(B[n.PrimitiveEntity][D.Null].id));break}else if(Array.isArray(r))if(e.sync({isList:!0}),r.length>0){const y=r.slice(0,5).filter(m=>m!==void 0);if(y.every(m=>typeof m==typeof y[0])&&(typeof y[0]!="object"||y[0]===null))switch(typeof y[0]){case"string":e.setEntity(e.project.getBuiltIn(B[n.PrimitiveEntity][D.String].id));break;case"number":e.setEntity(e.project.getBuiltIn(B[n.PrimitiveEntity][D.Number].id));break;case"boolean":e.setEntity(e.project.getBuiltIn(B[n.PrimitiveEntity][D.Boolean].id));break;case"object":e.setEntity(e.project.getBuiltIn(B[n.PrimitiveEntity][D.Null].id));break}else{const m=[];let b=!1;y.forEach((P,A)=>{if(Array.isArray(P)&&(b=!0),typeof P=="object"&&!Array.isArray(P)&&P!==null){const I=Go(P,e.project,{...t,id:e.id+"--or-child-data-type-entity-id-"+A},i);I.hasCreated&&m.push(I.changeSet.self),a.push(...I.changeSet.updated),s.push(...I.changeSet.added),o.push(...I.changeSet.removed)}});const v=g(m);if(!v.length&&!b){y.forEach(P=>{const A={id:N.UUID.uuid(),version:1,type:n.DataType,entity:null,isList:!1,isNullable:!1,defaultValue:null,asType:null,andChildrenGroup:null,orChildrenGroup:null,like:!0,inferred:!1,constant:!1,parentRelationType:ze.OrDataTypeGroup,parent:e.toReference()},I=R(A,e.project);switch(I.setParent(e),I.initChildren(),I.addSelfToProject(),typeof P){case"string":I.setEntity(I.project.getBuiltIn(B[n.PrimitiveEntity][D.String].id));break;case"number":I.setEntity(I.project.getBuiltIn(B[n.PrimitiveEntity][D.Number].id));break;case"boolean":I.setEntity(I.project.getBuiltIn(B[n.PrimitiveEntity][D.Boolean].id));break;case"object":I.setEntity(I.project.getBuiltIn(B[n.PrimitiveEntity][D.Null].id));break}});break}else v.length===1&&!b?e.setEntity(v[0]):y.forEach((P,A)=>{if(typeof P=="object"&&!Array.isArray(P)&&P!==null){const I=Au(Object.keys(P),e.project);if(I){const $=eA(I||v[0],e,ze.OrDataTypeGroup);a.push(...$.updated),s.push(...$.added),o.push(...$.removed)}}else{const I={id:e.id+"--or-child-data-type-id--"+A,version:1,type:n.DataType,entity:null,isList:Array.isArray(P),isNullable:!1,defaultValue:null,asType:null,andChildrenGroup:null,orChildrenGroup:null,like:!0,inferred:!1,constant:!1,parentRelationType:ze.OrDataTypeGroup,parent:e.toReference()},$=R(I,e.project);$.setParent(e),$.initChildren(),$.addSelfToProject();const F=Ou(P,$,{...t,id:e.id+"--or-child-data-type-entity-id-"+A},i);a.push(...F.updated),s.push(...F.added),o.push(...F.removed)}})}}else{const y=Go(r[0],e.project,{...t},i);e.setEntity(y.changeSet.self),a.push(...y.changeSet.updated),s.push(...y.changeSet.added),o.push(...y.changeSet.removed);break}else{const y=Go(r,e.project,{...t},i);e.setEntity(y.changeSet.self),a.push(...y.changeSet.updated),s.push(...y.changeSet.added),o.push(...y.changeSet.removed);break}}return{updated:g(a),added:g(s),removed:g(o),self:e}}function Go(r,e,t,i){const a=[],s=[],o=[],l=Object.keys(r),p=Au(l,e);if(p)return{hasCreated:!1,changeSet:{updated:[],added:[],removed:[],self:p}};const y=i?t.name+" of "+i.name:t.name,m={id:t.id||He(y,n.CustomEntity,e),version:1,name:y,type:n.CustomEntity,description:t.description||null,static:t.static||!1,abstract:t.abstract||!1,properties:[],methods:[],abstractMethods:[],extends:[],implements:[],x:0,y:0,parent:e.toReference()},b=R(m,e);return b.setParent(e),b.initChildren(),b.addSelfToProject(),s.push(b),l.forEach((v,P)=>{const A=He(y+" "+v,n.Property,e),I={id:A,version:1,name:v,type:n.Property,description:null,static:!1,abstract:!1,dataType:null,implements:null,index:P,hidden:!1,private:!1,required:!0,parent:b.toReference()},$=R(I,e);$.setParent(b),$.initChildren(),$.addSelfToProject(),s.push($);const F=r[v],Ve={id:A+"--data-type-id",version:1,type:n.DataType,entity:null,isList:!1,isNullable:!1,defaultValue:null,asType:null,andChildrenGroup:null,orChildrenGroup:null,like:!0,inferred:!1,constant:!1,parent:$.toReference()},_t=R(Ve,e);_t.setParent($),_t.initChildren(),_t.addSelfToProject(),s.push(_t);const Nt=Ou(F,_t,{...t,name:v,id:A+"--data-type-entity-id"},i||b);a.push(...Nt.updated),s.push(...Nt.added),o.push(...Nt.removed)}),{hasCreated:!0,changeSet:{updated:g(a),added:g(s),removed:g(o),self:b}}}function $o(r,e){const t=xr(r);if(t.length===0)return{list:[],last:null};let i=null;return{list:t.flatMap(s=>{if(s===e)return i=s,[s];const o=$o(s,e);return o.last&&(i=o.last),[s,...o.list]}),last:i}}function tA(r,e,t=new Set){const i=Kn(r),a=Kn(e),s=i.filter(p=>!a.includes(p)),o=i.filter(p=>a.includes(p)),l=s.reduce((p,y)=>t.has(y.id)?p:(t.add(y.id),g([...p,...tA(y,e,t)])),[]);return g([...o,...l])}function $a(r,e){const t=$o(r,e);return t.last===e&&t.list.length>0&&t.list[0]!==e}function Z2(r,e){return!!$o(r,e).last}function K2(r){if(Ge.includes(r.type))return r;if([...Bn,n.VariableDeclaration].includes(r.type)){const e=r.parent;return Ge.includes(e.type)?e:null}return null}function Su(r,e){if(!r||!e)throw new Error("Both entities must be defined to find a common ancestor");if(r===e)return r;const t=r.parent;if(t){if(t===e)return e;if(t.type===n.Project)return null}else return null;const i=e.parent;if(i){if(i===r)return r;if(i.type===n.Project)return null}else return null;return Su(t,i)}function Qe(r){if(zo.includes(r.type)){if(r.type===n.FunctionDeclaration){const e=r.parent;if(e.type===n.CustomEntity)return e;if(e.type===n.Loop)return e}return r}else{const e=r.parent;return e?Qe(e):null}}function X2(r){return r.type===n.VariableDeclaration?[r]:Ue.includes(r.type)?[...r.inputs,...r.outputs||[]]:r.type===n.ReturnStatement?r.outputs:Jr.includes(r.type)||r.type===n.FunctionDeclaration?r.inputs:[]}function Q2(r){const e=Kn(r),t=[],i=[];ju.includes(r.type)&&t.push(...Cu(r));const a=e.filter(s=>{const o=t.includes(s);return o?!1:Bn.includes(s.type)&&!o?(i.push(s),!1):!0});return t.sort((s,o)=>$a(o,s)?-1:0),i.sort((s,o)=>$a(o,s)?-1:0),[...t,...i,...a]}function nA(r){return[...r].sort((e,t)=>$a(t,e)?-1:0)}function e7(r){const e=nA(r),t=[];return e.forEach(i=>{const a=t[t.length-1];if(a){const s=a[a.length-1];$a(i,s)?t.push([i]):a.push(i)}else t.push([i])}),t}function Et(r){const e=r.map(t=>Qe(t));return g(e)}function Cu(r){return Ue.includes(r.type)?[...Et(r.successCalls),...Et(r.errorCalls)]:Ge.includes(r.type)?Et(r.calls):[]}function t7(r,e){return Cu(r).includes(e)}function Bu(r){return r.writesValues||[]}function n7(r,e){return Bu(r).includes(e)}function rA(r){var e;return ke.includes((e=r==null?void 0:r.readsValue)==null?void 0:e.type)?r.readsValue:null}function r7(r){return r.writesValues}function iA(r=[]){return r.map(rA).filter(e=>!!e)}function Fo(r=[]){return r.map(e=>e.writesValues).flat().filter(e=>ke.includes(e.type))}function aA(r=[]){return r.map(e=>e.readsValue).filter(e=>!!e&&ke.includes(e.type))}function sA(r){return ke.includes(r.type)?r:null}function oA(r){return r.writesValues.map(sA).filter(e=>!!e)}function lA(r=[]){return r.reduce((e,t)=>t.type===n.OutputMap?[...e,...oA(t)]:e,[])}function we(r){return Ue.includes(r.type)?[...ln(Et(r.successCalls)),...ln(Et(r.errorCalls))]:Ge.includes(r.type)?ln(Et(r.calls)):[]}function i7(r){return Ue.includes(r.type)?[...ln(Et(r.successCalls)),...ln(Et(r.errorCalls))]:Ge.includes(r.type)?ln(Et(r.calls)):[]}function cA(r,e=new Set){return r.writesValues.filter(i=>ke.includes(i.type)&&!e.has(i.id)).reduce((i,a)=>e.has(a.id)?i:[...i,...ie(a,e)],[])}function dA(r,e=new Set){var i;return(((i=r.readsValue)==null?void 0:i.writesValues)||[]).filter(a=>ke.includes(a.type)&&!e.has(a.id)).reduce((a,s)=>e.has(s.id)?a:[...a,...ie(s,e)],[])}function ie(r,e=new Set){if(e.has(r.id))return[];if(r.type===n.ReturnStatement)return aA(r.outputs).reduce((i,a)=>[...i,...ie(a,e)],[]);if(r.type===n.FunctionCall||r.type===n.Operation||r.type===n.Condition)return[...we(r).reduce((s,o)=>{const l=Qe(o);return[...s,...ie(l||o,e)]},[]),...iA(r.inputs),...lA(r.outputs)].reduce((s,o)=>[...s,...ie(o,e)],[]);if(Jr.includes(r.type)){const t=Fo(r.inputs),a=we(r).reduce((s,o)=>{const l=Qe(o);return[...s,...ie(l||o,e)]},[]);return t.push(...a),t.reduce((s,o)=>[...s,...ie(o,e)],[])}if(r.type===n.FunctionDeclaration){const t=[...Fo(r.inputs)],a=we(r).reduce((s,o)=>{const l=Qe(o);return[...s,...ie(l||o,e)]},[]);return t.push(...a),t.reduce((s,o)=>[...s,...ie(o)],[])}if(ke.includes(r.type)){e.add(r.id);const i=we(r).reduce((a,s)=>{const o=Qe(s);return[...a,...ie(o||s,e)]},[]);return[r,...i,...dA(r,e),...cA(r,e)]}return[]}function Pt(r,e=new Set){return e.has(r.id)?[]:(e.add(r.id),[...Kn(r).reduce((a,s)=>[...a,s,...Pt(s,e)],[])])}function ln(r){return r.reduce((e,t)=>t.type===n.ReturnStatement||t.type===n.ContinueStatement||t.type===n.BreakStatement?[...e,t]:[...e,t,...we(t)],[])}function uA(r){const e=r.entities||[],t=[...e,...r.functions||[],...r.events||[],...r.projects||[]],i=e.reduce((p,y)=>[...p,...y.properties],[]),a=e.reduce((p,y)=>[...p,...y.methods],[]),s=a.reduce((p,y)=>[...p,...Fo(y.inputs),...ln(Et(y.calls)),...y.returnStatements],[]),o=r.functions.reduce((p,y)=>[...p,...ln(Et(y.calls)),...y.returnStatements],[]),l=r.events.reduce((p,y)=>[...p,...ln(Et(y.calls)),...y.returnStatements],[]);return[...t,...i,...a,...s,...o,...l]}function pA(r,e){return e.filter(i=>{if(!i)return!1;switch(i.type){case n.FunctionCall:return i.inputs.find(a=>a.id===r.id)!==void 0||i.outputs.find(a=>a.id===r.id)!==void 0;case n.Condition:return i.successCalls.find(a=>a.id===r.id)!==void 0||i.errorCalls.find(a=>a.id===r.id)!==void 0||i.inputs.find(a=>a.id===r.id)!==void 0;case n.Operation:return i.outputs.find(a=>a.id===r.id)!==void 0;case n.VariableDeclaration:return Ue.includes(r.type)?yA(r).find(s=>{var o;return((o=s.readsValue)==null?void 0:o.id)===i.id})!==void 0:!1;case n.CustomEntity:return i.properties.find(a=>a.id===r.id)!==void 0||i.methods.find(a=>a.id===r.id)!==void 0;case n.FunctionDeclaration:return i.inputs.find(a=>a.id===r.id)!==void 0||(i.returnStatements.map(a=>a.outputs).flat()||[]).find(a=>a.id===r.id)!==void 0;default:return!1}})}function a7(r){const e=uA(r.project);return pA(r,e)}function xr(r){const e=[];if(Bn.includes(r.type)){r.calledBy.forEach(a=>{const s=Qe(a);s&&e.push(s)});const i=[...r.inputs||[],...r.outputs||[]].map(a=>Nu(a)).filter(a=>a!==null);e.push(...g(i))}if(ke.includes(r.type)){const t=Nu(r);t&&e.push(t)}return g(e)}function wu(r){return r.type===n.FunctionCall||r.type===n.InternalCall||[n.Operation,n.Condition,n.Loop].includes(r.type)?r.declaration.inputs:r.type===n.FunctionDeclaration||Jr.includes(r.type)?r.inputs:r.type===n.Search?r.inputsDeclarations:[]}function s7(r,e){return e.type===n.Condition?e.inputs.find(t=>t.declaration.id===r.id):e.type===n.FunctionCall||e.type===n.Operation?e.inputs.find(t=>t.declaration.id===r.id):null}function yA(r){return Ue.includes(r.type)?r.inputs:[]}function _u(r){var e;return r.type===n.FunctionCall?((e=r.declaration.returnStatements[0])==null?void 0:e.outputs)||[]:[n.Operation,n.Condition,n.Loop].includes(r.type)?r.declaration.outputs:r.type===n.Search?r.outputsDeclarations:$e.includes(r.type)?r.outputs:[]}function o7(r,e){return e.type===n.Condition?null:e.type===n.FunctionCall||e.type===n.Operation?e.outputs.find(t=>t.declaration.id===r.id):null}function l7(r){return r.type===n.Condition?[]:Ue.includes(r.type)?r.outputs:[]}function Nu(r){const e=r.readsValue;return e?Qe(e):null}function fA(r){const e=r.internalCalls||[];return g(Et(g(e.flatMap(t=>[...t.successCalls,...t.errorCalls]))))}function Si(r){const e=Bu(r),t=[];return e.forEach(i=>{if(ke.includes(i.type))t.push(i);else if(Cn.includes(i.type)){const a=i.parent;t.push(a)}}),t}function g(r){const e=new Set;return r.filter(t=>!t||e.has(t.id)?!1:(e.add(t.id),!0))}function Kn(r,e=!1){const t=[];if(r.type===n.Project&&t.push(...(r==null?void 0:r.entities)||[],...(r==null?void 0:r.functions)||[],...(r==null?void 0:r.variableDeclarations)||[],...(r==null?void 0:r.variableInstances)||[],...(r==null?void 0:r.searches)||[],...(r==null?void 0:r.loops)||[],...(r==null?void 0:r.operations)||[],...(r==null?void 0:r.conditions)||[],...(r==null?void 0:r.functionCalls)||[],...(r==null?void 0:r.events)||[],...(r==null?void 0:r.projects)||[]),ct.includes(r.type)&&t.push(...(r==null?void 0:r.detachedChildren)||[]),r.type===n.CustomEntity){const i=[...r.suggestedMethods,...r.methods].flatMap(a=>a.collapsed&&e?[]:Kn(a));t.push(...i)}if(r.type===n.Condition){const i=r.successCalls.map(s=>Qe(s)),a=r.errorCalls.map(s=>Qe(s));t.push(...i,...a)}if(Jr.includes(r.type)){if(r.collapsed&&e)return[];const i=r.inputs.map(s=>Si(s)).flat(),a=r.calls.map(s=>Qe(s));t.push(...g(i),...a)}if(Ue.includes(r.type)&&r.type!==n.Condition){const i=r==null?void 0:r.outputs.map(o=>Si(o)).flat(),a=r.successCalls.map(o=>Qe(o)),s=r.errorCalls.map(o=>Qe(o));t.push(...g(i),...a,...s)}if(ke.includes(r.type)){const i=Si(r),a=fA(r);t.push(...i,...a)}if(r.type===n.Loop){const i=r.outputs.map(o=>Si(o)).flat();if(r.body){const o=Kn(r.body,e);t.push(...o)}const a=r.errorCalls.map(o=>Qe(o)),s=r.successCalls.map(o=>Qe(o));t.push(...g(i),...s,...a)}if(r.type===n.FunctionDeclaration){if(r.collapsed&&e)return[];const i=r.inputs.map(s=>Si(s)).flat(),a=r.calls.map(s=>Qe(s));t.push(...g(i),...a)}return g(t)}function hA(r,e=!1){const t=Kn(r,e),i=[...t,...t.reduce((a,s)=>[...a,...hA(s,e)],[])];return g(i)}function mA(r){const e=xr(r),t=[...e,...e.reduce((i,a)=>[...i,...mA(a)],[])];return g(t)}function Uo(r){return r.implements.reduce((e,t)=>t.type===n.CustomEntity?[...e,n.CustomEntity,...Uo(t),...xo(t)]:[...e,t.name],[])}function xo(r){return r.extends.reduce((e,t)=>t.type===n.CustomEntity?[...e,n.CustomEntity,...xo(t),...Uo(t)]:[...e,t.name],[])}function Mu(r){return r.extends.reduce((e,t)=>t.type===n.CustomEntity?[...e,t,...Mu(t),...Vu(t)]:[...e,t],[])}function Vu(r){return r.implements.reduce((e,t)=>t.type===n.CustomEntity?[...e,t,...Vu(t),...Mu(t)]:[...e,t],[])}function TA(r){return[...xo(r),...Uo(r)].filter((t,i,a)=>a.indexOf(t)===i)}function EA(r){return r.implements.length===0&&r.extends.length===0?null:r.implements.find(i=>i.type===n.BuiltInBaseEntity&&i.name===L.PERSISTED_ENTITY)?r:[...r.implements,...r.extends].reduce((i,a)=>{if(a.type===n.CustomEntity){const s=EA(a);if(s)return s}return i},null)}function c7(r){const e=r.extends.find(t=>t.type===n.BuiltInBaseEntity);return e&&e.type===n.BuiltInBaseEntity?e:null}function d7(r){const e=r.implements.find(t=>t.type===n.BuiltInBaseEntity);return e&&e.type===n.BuiltInBaseEntity?e:null}function bA(r){const e=r.extends.find(t=>t.type===n.CustomEntity);return e&&e.type===n.CustomEntity?e:null}function Xn(r){const e=[...r.implements,...r.extends].reduce((t,i)=>i.type===n.BuiltInBaseEntity?[...t,i]:i.type===n.CustomEntity?[...t,...Xn(i)]:t,[]);return g(e)}function Lu(r){return r.type===n.PrimitiveEntity?!0:r.type===n.BuiltInBaseEntity?r.interactive:!Xn(r).find(i=>!i.interactive)}function u7(r){return r.parent===r.project&&r.project.variableDeclarations.includes(r)}function Gu(r){return r.parent!==r.project?!1:n.VariableDeclaration===r.type?r.project.variableDeclarations.includes(r):n.VariableInstance===r.type?r.project.variableInstances.includes(r):n.FunctionCall===r.type?r.project.functionCalls.includes(r):n.Condition===r.type?r.project.conditions.includes(r):n.Operation===r.type?r.project.operations.includes(r):n.Loop===r.type?r.project.loops.includes(r):n.Search===r.type?r.project.searches.includes(r):!1}function RA(r){if([...Ge,n.CustomEntity,n.InstalledProject,n.Project].includes(r.type)||Gu(r))return!1;const e=xr(r);return e.length===0?!0:e.some(t=>RA(t))}function $u(r){return[...Ge,n.CustomEntity,n.InstalledProject,n.Project].includes(r.type)||Gu(r)?!1:xr(r).length===0}function gA(r,e=0){if($u(r)){const t=xr(r);return t.length===0?r:t.map(a=>gA(a,e+1)).reduce((a,s)=>a?s&&s.x<a.x?s:a:s,null)}return null}function vA(r){const e=[];if($u(r))e.push(r);else return[];return xr(r).forEach(i=>{e.push(...vA(i))}),e}function IA(r){return r.type===n.FunctionDeclaration&&r.parent!==r.project&&!![n.CustomEntity,n.Loop,n.InstalledProject].includes(r.parent.type)}function p7(r,e){const t=new Map;return r.forEach(i=>{t.set(i.id,i)}),e.forEach(i=>{t.set(i.id,i)}),Array.from(t.values())}function jo(r){switch(r){case n.CustomEntity:return jr;case n.FunctionDeclaration:return Cr;case n.VariableDeclaration:return Nr;case n.VariableInstance:return Mr;case n.FunctionCall:return Ur;case n.Operation:return Br;case n.Condition:return _r;case n.ReturnStatement:return $r;case n.Loop:return wr;case n.Search:return Vr;case n.InputMap:return An;case n.OutputMap:return On;case n.ArgumentDeclaration:return Gr;case n.ReturnDeclaration:return Bt;case n.Property:return Sr;case n.InstalledProject:return Lr;case n.Project:return N;case n.BuiltInBaseEntity:return Ft;default:return null}}function bt(r,e){if(ct.includes(r.type))return r;if(Wr.includes(r.type))return null;const t=r.parent;if(!t)return null;if(t.type===n.GenericReference){const i=_(t);if(!i)return null;const a=e.get(i);return a?bt(a,e):null}else return t===e?e:bt(t,e)}function Fu(r,e){if(Wr.includes(r.type)||e.getBuiltIn(r.id))return null;const t=wt(r.parent,e);return t?t===e?ct.includes(r.type)?r:null:t.type===n.CustomEntity?r:Fu(t,e):null}function ko(r,e,t){if(r===e||e===t||r===t)return!1;const i=bt(e.parent,t);return i===r?!0:ko(i,e,t)}var qo=(r=>(r.SameBothLocal="same-both-local",r.AInB="a-in-b",r.BInA="b-in-a",r.ParallelInCommonParent="parallel-in-common-parent",r.ParallelInProject="parallel-in-project",r.AIsGlobalBIsNot="a-is-global-b-is-not",r.BIsGlobalAIsNot="b-is-global-a-is-not",r.SameBothGlobal="same-both-global",r))(qo||{});function Fa(r,e,t){const i=bt(r,t),a=bt(e,t);if(!i)throw new Error("Could not find scope owner for the entity: "+r.id);if(!a)throw new Error("Could not find scope owner for the entity: "+e.id);if(i===a&&i.type!==n.Project)return{compatible:!0,type:"same-both-local",commonAncestorScope:i};if(i===a&&i.type===n.Project)return{compatible:!0,type:"same-both-global",commonAncestorScope:i};if(i.type===n.Project&&a.type!==n.Project)return{compatible:!1,type:"a-is-global-b-is-not",commonAncestorScope:i};if(i.type!==n.Project&&a.type===n.Project)return{compatible:!1,type:"b-is-global-a-is-not",commonAncestorScope:a};if(ko(i,a,t))return{compatible:!0,type:"b-in-a",commonAncestorScope:i};if(ko(a,i,t))return{compatible:!0,type:"a-in-b",commonAncestorScope:a};const l=Su(i,a);return l===t?{compatible:!1,type:"parallel-in-project",commonAncestorScope:l}:l?{compatible:!1,type:"parallel-in-common-parent",commonAncestorScope:bt(l,t)}:{compatible:!1,type:"parallel-in-project",commonAncestorScope:t}}function DA(r,e,t){const i=Fa(r,e,t);if(!i.compatible||i.type!=="same-both-local")return null;if(r===e)return r;let a=bt(r.parent,t);if(a){if(a===e)return e;if(a.type===n.Project)return r}else return r;for(;a;){if(a){if(a===e)return e;if(a.type===n.Project)return r}else return r;a=bt(a.parent,t)}let s=bt(e.parent,t);if(s){if(s===r)return r;if(s.type===n.Project)return e}else return e;for(;s;){if(s){if(s===r)return r;if(s.type===n.Project)return e}else return e;s=bt(s.parent,t)}return null}function PA(r){return r.length===0?null:r.length===1?r[0]:r.reduce((t,i)=>{const a=DA(t,i,i.project);return!a||a===i?t:i},r[0])}function wt(r,e){let t;return typeof r=="string"?t=r:r.type===n.GenericReference?t=_(r):t=r.id,t===e.id?e:e.get(t)}function Qn(r){if(!r)return null;if(Wr.includes(r.type))return r;if(r.type===n.Project)return null;if(r.project.getBuiltIn(r.id))return r;const e=r.parent;return!e||e.type===n.Project?null:Qn(e)}function Ua(r,e){var t;if(r.readsValue){const i=wt(r.readsValue,e.project);e.setValueWriter(i),i.addValueReader(e)}else r.readsValue===null&&((t=e.readsValue)==null||t.removeValueReader(e),e.readsValue=null);return e}function xa(r){const e=[];function t(s,o){return e.some(l=>l.blockedByCaller===s&&l.blockedByCalling===o)}function i(s,o){t(s,o)||e.push({blockedByCaller:s,blockedByCalling:o})}const a=Fu(r,r.project);return r.calledBySuccess.forEach(s=>{[...s.successCalls||[]].forEach(p=>{$e.includes(p.type)&&p!==r&&(we(r).find(m=>m===p)||i(s,p))});let l;if(Ue.includes(s.type)&&(l=s),l){const p=xa(l);p.reachable||we(r).find(m=>m===s)||p.blocks.forEach(m=>{i(s,m.blockedByCalling)})}}),r.calledByError.forEach(s=>{[...s.errorCalls||[]].forEach(p=>{$e.includes(p.type)&&p!==r&&(we(r).find(m=>m===p)||i(s,p))});let l;if(Ue.includes(s.type)&&(l=s),l){const p=xa(l);p.reachable||we(r).find(m=>m===s)||p.blocks.forEach(m=>{i(s,m.blockedByCalling)})}}),r.calledByEntry.forEach(s=>{if([...s.calls||[]].forEach(p=>{$e.includes(p.type)&&p!==r&&(we(r).find(m=>m===p)||i(s,p))}),s===a)return;let l;if(s.type===n.FunctionDeclaration){const p=Qe(s);if(p.type===n.CustomEntity)return;p.type===n.Loop&&(l=p)}if(l){const p=xa(l);p.reachable||p.blocks.forEach(y=>{i(s,y.blockedByCalling)})}}),{reachable:e.length===0,entryPoint:a,blocks:e}}function y7(r){return zo.includes(r.type)?r.type===n.FunctionDeclaration?!IA(r):!0:!1}function f7(r){if(n.ActionDescriptor===r.type){if(r.project.operationDeclarations.find(s=>s.id===r.id))return n.Operation;if(r.project.globalEventActionDescriptors.find(s=>s.id===r.id))return n.GlobalEvent;if(r.project.loopDeclarations.find(s=>s.id===r.id))return n.Loop;if(r.project.conditionDeclarations.find(s=>s.id===r.id))return n.Condition}return r.type}function h7(r,e){const t=[];if(r.parent)if(r.id===r.parent)t.push(new E({id:`${r.id}--${r.parent}--${f.SelfReference}`,code:f.SelfReference,severity:T.Error,message:`Entity of type "${r.type}" with id "${r.id}", has a reference to itself at 'parent'. This is not allowed. Change the reference string or the 'entityId' property of the reference object.`,issue:null}));else{const i=e.get(r.parent);i?[n.Project,n.DataType].includes(i.type)||t.push(new E({id:`${r.id}--${r.parent}--${f.InvalidParentReference}`,code:f.InvalidParentReference,severity:T.Error,message:`Entity of type "${r.type}" with id "${r.id}", has a parent reference that isn't pointing to an entity of type 'project' or 'data-type'.`,issue:null})):t.push(new E({id:`${r.id}--${r.parent}--${f.ReferencedEntityNotFound}`,code:f.ReferencedEntityNotFound,severity:T.Error,message:`Entity of type "${r.type}" with id "${r.id}", is referencing an entity with id "${r.parent}" that isn't yet found in the project. Perhaps it should be created first. Or perhaps the ID is incorrect.`,issue:null}))}return r.implements&&Array.isArray(r.implements)?r.implements.forEach(i=>{if(r.id===i){t.push(new E({id:`${r.id}--${i}--${f.SelfReference}`,code:f.SelfReference,severity:T.Error,message:`Entity of type "${r.type}" with id "${r.id}", has a reference to itself at one of the 'implements' references. This is not allowed. Change the reference string or the 'entityId' property of the reference object.`,issue:null}));return}const a=e.get(i);a?[n.CustomEntity,n.BuiltInBaseEntity].includes(a.type)?a.abstract||t.push(new E({id:`${r.id}--${i}--${f.InvalidImplementsReference}`,code:f.InvalidImplementsReference,severity:T.Error,message:`Entity of type "${r.type}" with id "${r.id}", has an 'implements' reference that isn't pointing to an abstract entity.`,issue:null})):t.push(new E({id:`${r.id}--${i}--${f.InvalidImplementsReference}`,code:f.InvalidImplementsReference,severity:T.Error,message:`Entity of type "${r.type}" with id "${r.id}", has an 'implements' reference that isn't pointing to an entity of type 'custom-entity' or 'built-in-base-entity'.`,issue:null})):t.push(new E({id:`${r.id}--${i}--${f.ReferencedEntityNotFound}`,code:f.ReferencedEntityNotFound,severity:T.Error,message:`Entity of type "${r.type}" with id "${r.id}", is referencing an entity with id "${i}" that isn't yet found in the project. Perhaps it should be created first. Or perhaps the ID is incorrect.`,issue:null}))}):t.push(new E({id:`${r.id}--${S.InvalidObjectStructure}`,code:S.InvalidObjectStructure,severity:T.Error,message:`Entity of type "${r.type}" with id "${r.id}", has an 'implements' property that isn't an array.`,issue:null})),r.extends&&Array.isArray(r.extends)&&r.extends.forEach(i=>{const a=e.get(i);a?[n.CustomEntity,n.BuiltInBaseEntity].includes(a.type)?a.abstract&&t.push(new E({id:`${r.id}--${i}--${f.InvalidExtendsReference}`,code:f.InvalidExtendsReference,severity:T.Error,message:`Entity of type "${r.type}" with id "${r.id}", has an 'extends' reference that isn't pointing to a non-abstract entity. Did you want to use the property 'implements', which holds a list of references to absract entities, instead?`,issue:null})):t.push(new E({id:`${r.id}--${i}--${f.InvalidExtendsReference}`,code:f.InvalidExtendsReference,severity:T.Error,message:`Entity of type "${r.type}" with id "${r.id}", has an 'extends' reference that isn't pointing to an entity of type 'custom-entity' or 'built-in-base-entity'.`,issue:null})):t.push(new E({id:`${r.id}--${i}--${f.ReferencedEntityNotFound}`,code:f.ReferencedEntityNotFound,severity:T.Error,message:`Entity of type "${r.type}" with id "${r.id}", is referencing an entity with id "${i}" that isn't yet found in the project. Perhaps it should be created first. Or perhaps the ID is incorrect.`,issue:null}))}),t}const Be=class Be{constructor(e,t){c(this,"initialData");c(this,"id");c(this,"version");c(this,"name");c(this,"description",null);c(this,"x");c(this,"y");c(this,"static");c(this,"abstract");c(this,"type",n.CustomEntity);c(this,"properties",[]);c(this,"methods",[]);c(this,"abstractMethods",[]);c(this,"extends",[]);c(this,"implements",[]);c(this,"project");c(this,"errors",[]);c(this,"parent");c(this,"initialized",!1);c(this,"suggestedProperties",[]);c(this,"suggestedMethods",[]);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,this.static=e.static,this.abstract=e.abstract}static fromGenerationTarget(e,t){let i=t;if(e.parent){const p=_(e.parent);i=t.get(p)}const a=[];e.implements&&e.implements.forEach(p=>{a.push(t.get(p)||t.getBuiltIn(p))});const s=[];e.extends&&e.extends.forEach(p=>{s.push(t.get(p)||t.getBuiltIn(p))});const o={id:e.id,version:1,name:e.name,type:n.CustomEntity,description:e.description,static:e.static,abstract:e.abstract,properties:[],methods:[],abstractMethods:[],extends:s,implements:a,x:0,y:0,parent:i},l=R(o,t);return l.setParent(i),l.initChildren(),l}static validateGenerationTarget(e,t){let i=JSON.parse(JSON.stringify(e));const a=[],s=h7(i,t),o=Oo(i,t);a.push(...s,...o,...Ne(i));const l=i.parent?t.get(i.parent):null;if(l&&l.type===n.DataType){const p=l;p.entity&&a.push(new E({id:`${e.id}--${f.NewEntityWouldOverriteExisting}`,code:f.NewEntityWouldOverriteExisting,severity:T.Error,message:`The entity of type '${e.type}' with id '${e.id}' can't be added to the 'parent' entity with id '${p.id}' because it already has an 'entity' child. Data type entities can only have one 'entity' as children.
|
|
369
369
|
You can inspect the existing 'entity' field with the 'describe_entity' action. Like so:
|
|
370
370
|
${on({describe_entity:p.entity.id})}
|
|
371
|
-
Alternatively you can update the parent data-type entity with 'update' action to remove the existing value of the field.`,issue:null}))}return{errors:a,modifiedData:i}}get extendedProperties(){return g([...this.extends.reduce((e,t)=>[...[...t.properties,...t.extendedProperties].filter(a=>!a.abstract),...e],[]),...this.implements.reduce((e,t)=>[...[...t.properties,...t.extendedProperties].filter(a=>!a.abstract),...e],[])])}validateGeneratedUpdate(e){const t=[];return e.parent&&t.push(new E({id:`${this.id}--${f.InvalidParentUpdate}`,code:f.InvalidParentUpdate,severity:T.Error,message:`Entity of type '${this.type}' with id '${this.id}' cannot have the 'parent' property updated. The 'parent' on an '${this.type}', must be the root project as it is a globally declared entity.`,issue:null})),{errors:t,modifiedData:e}}addSelfToProject(){const e=[this],t=[],i=[];if(this.parent.type===n.DataType){const a=this.parent;a.entity=this,e.push(a)}else this.project.addCustomEntity(this);return{updated:g(e),added:g(t),removed:g(i),self:this}}setParent(e){return this.parent=e,this}removeProperty(e){return this.properties=this.properties.filter(t=>t.id!==e.id),this}addMethod(e){return this.methods.includes(e)||(this.methods.push(e),this.suggestedMethods=this.suggestedMethods.filter(t=>t.name!==e.name)),this}removeMethod(e){return this.methods=this.methods.filter(t=>t.id!==e.id),this}addProperty(e){return this.properties.includes(e)||(this.properties.push(e),this.suggestedProperties=this.suggestedProperties.filter(t=>t.name!==e.name)),this}addSuggestedProperty(e){return this.suggestedProperties.includes(e)||this.suggestedProperties.push(e),this}addSuggestedMethod(e){return this.suggestedMethods.includes(e)||this.suggestedMethods.push(e),this}removeSuggestedProperty(e){return this.suggestedProperties=this.suggestedProperties.filter(t=>t.id!==e.id),this}removeSuggestedMethod(e){return this.suggestedMethods=this.suggestedMethods.filter(t=>t.id!==e.id),this}addAbstractMethod(e){return this.abstractMethods.includes(e)||this.abstractMethods.push(e),this}removeAbstractMethod(e){return this.abstractMethods=this.abstractMethods.filter(t=>t.id!==e.id),this}initChildren(){return this.initialized?this:(this.initialized=!0,this.properties=this.initialData.properties.map(e=>{const t=R(e,this.project);return t.setParent(this),t.initChildren(),t}),this.methods=this.initialData.methods.map(e=>{const t=R(e,this.project);return t.setParent(this),t.initChildren(),t}),this.abstractMethods=this.initialData.abstractMethods.map(e=>{const t=R(e,this.project);return t.setParent(this),t.initChildren(),t}),this.extends=this.initialData.extends.map(e=>R(e,this.project)),this.implements=this.initialData.implements.map(e=>R(e,this.project)),this.addSuggestions(),this)}addSuggestions(){return this.implements.forEach(e=>{J3(this,e).forEach(a=>{const s=a.toJSON();s.id=`_suggestion--parent--${this.id}--${a.id}`;const o=R(s,this.project);o.suggestion=!0,o.setParent(this),o.initChildren(),this.addSuggestedProperty(o)}),W3(this,e).forEach(a=>{const s=`_suggestion--parent--${this.id}--${a.id}`,o=a.implementAsFunctionDeclaration(s),l=R(o,this.project);if(l.suggestion=!0,l.setParent(this),l.initChildren(),l.inputs.forEach(p=>{p.suggestion=!0}),l.returnStatements.length){const p=l.returnStatements[0];p.suggestion=!0,p.outputs.forEach(y=>{y.suggestion=!0})}this.addSuggestedMethod(l)})}),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.x=e.x||this.x,this.y=e.y||this.y,this.static=e.static||this.static,this.abstract=e.abstract||this.abstract,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.properties.forEach(s=>{const{affected:o,removed:l}=s.remove({ignoreUpstream:!0,seenEntities:t});i.push(...o),a.push(...l)}),this.methods.forEach(s=>{const{affected:o,removed:l}=s.remove({ignoreUpstream:!0,seenEntities:t});i.push(...o),a.push(...l)}),this.abstractMethods.forEach(s=>{const{affected:o,removed:l}=s.remove({ignoreUpstream:!0,seenEntities:t});i.push(...o),a.push(...l)}),this.suggestedProperties.forEach(s=>{const{affected:o,removed:l}=s.remove({ignoreUpstream:!0,seenEntities:t});i.push(...o),a.push(...l)}),this.suggestedMethods.forEach(s=>{const{affected:o,removed:l}=s.remove({ignoreUpstream:!0,seenEntities:t});i.push(...o),a.push(...l)}),{affected:g(i),removed:g(a)})}restore({seenEntities:e}={seenEntities:new Set}){const t=[];return e.has(this.id)?{affected:[],self:this}:(e.add(this.id),this.subscribe(),this.properties.forEach(i=>{const{affected:a}=i.restore({seenEntities:e});t.push(...a)}),this.methods.forEach(i=>{const{affected:a}=i.restore({seenEntities:e});t.push(...a)}),this.abstractMethods.forEach(i=>{const{affected:a}=i.restore({seenEntities:e});t.push(...a)}),this.suggestedProperties.forEach(i=>{const{affected:a}=i.restore({seenEntities:e});t.push(...a)}),this.suggestedMethods.forEach(i=>{const{affected:a}=i.restore({seenEntities:e});t.push(...a)}),{affected:g(t),self:this})}toFlat(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this,...this.extends.flatMap(i=>i.toFlat(e)),...this.implements.flatMap(i=>i.toFlat(e)),...this.properties.flatMap(i=>i.toFlat(e)),...this.methods.flatMap(i=>i.toFlat(e)),...this.abstractMethods.flatMap(i=>i.toFlat(e))])}toFlatIds(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.id,...this.extends.flatMap(i=>i.toFlatIds(e)),...this.implements.flatMap(i=>i.toFlatIds(e)),...this.properties.flatMap(i=>i.toFlatIds(e)),...this.methods.flatMap(i=>i.toFlatIds(e)),...this.abstractMethods.flatMap(i=>i.toFlatIds(e))])}toJSON(){return{id:this.id,version:this.version,type:this.type,name:this.name,description:this.description,x:this.x,y:this.y,static:this.static,abstract:this.abstract,properties:this.properties.map(e=>e.toJSON()),methods:this.methods.map(e=>e.toJSON()),abstractMethods:this.abstractMethods.map(e=>e.toJSON()),implements:this.implements.map(e=>e.toJSON()),extends:this.extends.map(e=>e.toJSON()),parent:this.parent.toReference()}}toReference(){return{id:this.id+"--"+N.UUID.uuid()+"--ref",type:n.GenericReference,entityId:this.id,entityType:this.type}}toShallowJSON(){return{id:this.id,version:this.version,name:this.name,description:this.description,type:this.type,x:this.x,y:this.y,static:this.static,abstract:this.abstract,properties:this.properties.map(e=>e.toReference()),methods:this.methods.map(e=>e.toReference()),abstractMethods:this.abstractMethods.map(e=>e.toReference()),implements:this.implements.map(e=>e.toReference()),extends:this.extends.map(e=>e.toReference()),parent:this.parent.toReference()}}toFlatJSON(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toShallowJSON(),...this.properties.flatMap(i=>i.toFlatJSON(e)),...this.methods.flatMap(i=>i.toFlatJSON(e)),...this.abstractMethods.flatMap(i=>i.toFlatJSON(e)),...this.implements.flatMap(i=>i.toFlatJSON(e)),...this.extends.flatMap(i=>i.toFlatJSON(e))])}toGenerationTarget(){const e=this.parent.type===n.Project?void 0:this.parent.id;return{id:this.id,name:this.name,description:this.description,type:this.type,static:this.static,abstract:this.abstract,extends:this.extends.map(t=>t.id),implements:this.implements.map(t=>t.id),parent:e}}toFlatGenerationTarget(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toGenerationTarget(),...this.properties.flatMap(i=>i.toFlatGenerationTarget(e)),...this.methods.flatMap(i=>i.toFlatGenerationTarget(e)),...this.abstractMethods.flatMap(i=>i.toFlatGenerationTarget(e)),...this.implements.filter(i=>i.type===n.CustomEntity).flatMap(i=>i.toFlatGenerationTarget(e)),...this.implements.filter(i=>i.type===n.CustomEntity).flatMap(i=>i.toFlatGenerationTarget(e))])}clearErrors(){return this.errors=[],this.properties.forEach(e=>e.clearErrors()),this.methods.forEach(e=>e.clearErrors()),this.abstractMethods.forEach(e=>e.clearErrors()),this}validate(){return this.errors=q3(this),{success:!0,error:null,data:null}}getErrors(){return[...this.errors,...this.properties.flatMap(t=>t.getErrors()),...this.methods.flatMap(t=>t.getErrors()),...this.abstractMethods.flatMap(t=>t.getErrors())]}getShallowErrors(){return this.errors}clone(e=null,t=null,i=!0){var b,v,P;const a=this.toJSON(),s=t||He(C(this,this.project),n.CustomEntity,this.project);a.properties=[],a.methods=[],a.abstractMethods=[];const o=s.split("-id"),l=o[o.length-1||0]||s;a.id=s;const p=xt(a,this.project);e&&p.setParent(e),i&&p.subscribe(),p.initChildren();const y=(b=this.properties)==null?void 0:b.map((A,I)=>A.clone(this,l+"-property-"+I+"-id",i));p.properties=y;const h=(v=this.methods)==null?void 0:v.map((A,I)=>A.clone(this,l+"-method-"+I+"-id",i));p.methods=h;const m=(P=this.abstractMethods)==null?void 0:P.map((A,I)=>A.clone(this,l+"-abstract-method-"+I+"-id",i));return p.abstractMethods=m,p}getFunctionDeclaration(e){return this.methods.find(t=>t.id===e)}implement(e,t){return Lo(this,e,t)}getAllInteractiveMethods(){const e=this.implements.filter(i=>i.type===n.CustomEntity||i.type===n.BuiltInBaseEntity&&i.interactive);return g([...this.methods,...this.extends.flatMap(i=>i.getAllInteractiveMethods()),...e.flatMap(i=>i.getAllInteractiveMethods())])}inferFromInputs(e){if(this.parent.type!==n.DataType||!this.parent.inferred)return this;const t=[];e.forEach(s=>{t.find(l=>C(l,this.project)===C(s,this.project))||t.push(s)});const i=this.properties.filter(s=>!s.getDataType());t.forEach(s=>{const o=i.find(m=>C(m,this.project)===C(s,this.project));if(!o)return;const p=Or(s.parent).getMasterInputWithValueWritterFromAllInstances(s),y=sn(p),h=y==null?void 0:y.clone(o,o.id+"--data-type",!0);h&&o.setDataType(h),s.setDeclaration(o)});const a=[];return t.forEach(s=>{if(!s.declaration){a.push(s);return}}),a.length===0?this:(a.forEach(s=>{const o=this.properties.find(v=>C(v,this.project)===C(s,this.project));if(o){if(s.setDeclaration(o),!o.getDataType()){const P=Or(s.parent).getMasterInputWithValueWritterFromAllInstances(s),A=sn(P),I=A==null?void 0:A.clone(o,o.id+"--data-type",!0);I&&o.setDataType(I)}return}const l={id:s.id+"--inferred-property",type:n.Property,version:1,name:C(s,this.project),description:s.description,static:!0,abstract:!1,private:!1,hidden:!1,required:!1,index:s.index,implements:null,dataType:null,parent:this.toReference()},p=R(l,this.project);p.setParent(this),p.initChildren();const h=Or(s.parent).getMasterInputWithValueWritterFromAllInstances(s),m=sn(h),b=m==null?void 0:m.clone(p,l.id+"--data-type",!0);return b&&p.setDataType(b),this.addProperty(p),s.setDeclaration(p),p}),this)}};c(Be,"MUTABLE_BASE_PROPERTIES",["name","description","static","abstract"]),c(Be,"INMUTABLE_BASE_PROPERTIES",["id","version","type"]),c(Be,"BASE_PROPERTIES",[...Be.MUTABLE_BASE_PROPERTIES,...Be.INMUTABLE_BASE_PROPERTIES]),c(Be,"MUTABLE_META_PROPERTIES",[...Be.MUTABLE_BASE_PROPERTIES,"x","y"]),c(Be,"INMUTABLE_META_PROPERTIES",[...Be.INMUTABLE_BASE_PROPERTIES]),c(Be,"META_PROPERTIES",[...Be.MUTABLE_META_PROPERTIES,...Be.INMUTABLE_META_PROPERTIES]),c(Be,"MUTABLE_UPSTREAM_PROPERTIES",["extends","implements"]),c(Be,"INMUTABLE_UPSTREAM_PROPERTIES",["parent"]),c(Be,"UPSTREAM_PROPERTIES",[...Be.MUTABLE_UPSTREAM_PROPERTIES,...Be.INMUTABLE_UPSTREAM_PROPERTIES]),c(Be,"MUTABLE_DOWNSTREAM_PROPERTIES",["properties","methods","abstractMethods"]),c(Be,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),c(Be,"DOWNSTREAM_PROPERTIES",[...Be.MUTABLE_DOWNSTREAM_PROPERTIES,...Be.INMUTABLE_DOWNSTREAM_PROPERTIES]),c(Be,"PROPERTIES",[...Be.META_PROPERTIES,...Be.UPSTREAM_PROPERTIES,...Be.DOWNSTREAM_PROPERTIES]);let jr=Be;function m7(r){const e=g9(),t=r.toJSON();e.safeParse(t).success;const a=[];return ae(r.errors,a)}class Ft{constructor(e,t){c(this,"initialData");c(this,"id");c(this,"version");c(this,"name");c(this,"description",null);c(this,"type",n.BuiltInBaseEntity);c(this,"abstract",!1);c(this,"static");c(this,"properties",[]);c(this,"methods",[]);c(this,"abstractMethods",[]);c(this,"extends",[]);c(this,"interactive",!1);c(this,"errors",[]);c(this,"project");this.initialData=this.initialData||e,this.project=this.project||t,this.id=this.id||e.id,this.version=this.version||e.version,this.name=this.name||e.name,this.static=this.static||e.static,this.interactive=this.interactive||e.interactive,this.abstract=e.abstract,this.properties=this.initialData.properties.map(i=>{const a=R(i,this.project);return a.setParent(this),a.initChildren(),a}),this.methods=this.initialData.methods.map(i=>{const a=R(i,this.project);return a.setParent(this),a.initChildren(),a}),this.abstractMethods=this.initialData.abstractMethods.map(i=>{const a=R(i,this.project);return a.setParent(this),a.initChildren(),a}),this.extends=this.initialData.extends.map(i=>R(i,this.project))}get extendedProperties(){return g(this.extends.reduce((e,t)=>{const i=[...t.properties,...t.extendedProperties].filter(a=>!a.abstract);return[...e,...i]},[]))}subscribe(){return this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}async load(){return this}remove(e={ignoreUpstream:!1,seenEntities:new Set}){return{affected:[],removed:[]}}restore({seenEntities:e}={seenEntities:new Set}){return{affected:[],self:this}}toFlat(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this,...this.properties.flatMap(i=>i.toFlat(e)),...this.methods.flatMap(i=>i.toFlat(e)),...this.abstractMethods.flatMap(i=>i.toFlat(e)),...this.extends.flatMap(i=>i.toFlat(e))])}toFlatIds(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.id,...this.properties.flatMap(i=>i.toFlatIds(e)),...this.methods.flatMap(i=>i.toFlatIds(e)),...this.abstractMethods.flatMap(i=>i.toFlatIds(e)),...this.extends.flatMap(i=>i.toFlatIds(e))])}toJSON(){return{id:this.id,version:this.version,type:this.type,name:this.name,description:this.description,abstract:this.abstract,static:this.static,interactive:this.interactive,properties:this.properties.map(e=>e.toJSON()),methods:this.methods.map(e=>e.toJSON()),abstractMethods:this.abstractMethods.map(e=>e.toJSON()),extends:this.extends.map(e=>e.toJSON())}}toReference(){return{id:this.id+"--"+N.UUID.uuid()+"--ref",type:n.GenericReference,entityId:this.id,entityType:this.type}}toShallowJSON(){return{id:this.id,version:this.version,type:this.type,name:this.name,description:this.description,abstract:this.abstract,static:this.static,interactive:this.interactive,properties:this.properties.map(e=>e.toReference()),methods:this.methods.map(e=>e.toReference()),abstractMethods:this.abstractMethods.map(e=>e.toReference()),extends:this.extends.map(e=>e.toReference())}}toFlatJSON(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toShallowJSON(),...this.properties.flatMap(i=>i.toFlatJSON(e)),...this.methods.flatMap(i=>i.toFlatJSON(e)),...this.abstractMethods.flatMap(i=>i.toFlatJSON(e))])}toGenerationTarget(){return{id:this.id,type:this.type,name:this.name,description:this.description,static:this.static,abstract:this.abstract,interactive:this.interactive,extends:this.extends.map(e=>e.id)}}toFlatGenerationTarget(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toGenerationTarget(),...this.properties.flatMap(i=>i.toFlatGenerationTarget(e)),...this.methods.flatMap(i=>i.toFlatGenerationTarget(e)),...this.abstractMethods.flatMap(i=>i.toFlatGenerationTarget(e))])}clearErrors(){return this.errors=[],this.properties.forEach(e=>e.clearErrors()),this.methods.forEach(e=>e.clearErrors()),this.abstractMethods.forEach(e=>e.clearErrors()),this}validate(){const e=m7(this);return this.errors=e,{success:!0,error:null,data:this.toJSON()}}getErrors(){return[...this.errors,...this.properties.flatMap(t=>t.getErrors()),...this.methods.flatMap(t=>t.getErrors()),...this.abstractMethods.flatMap(t=>t.getErrors())]}getShallowErrors(){return this.errors}clone(){return new Ft(this.toJSON(),this.project)}implement(e,t){return Lo(this,e,t)}getAllInteractiveMethods(){const e=[];return this.interactive&&(e.push(...this.methods),this.extends.filter(i=>i.type===n.BuiltInBaseEntity&&i.interactive||i.type===n.PrimitiveEntity).forEach(i=>{i instanceof Ft&&e.push(...i.getAllInteractiveMethods())})),g(e)}}function T7(r){const e=p9(),t=r.toJSON();e.safeParse(t).success;const a=[];return ae(r.errors,a)}class Ut{constructor(e,t){c(this,"initialData");c(this,"id");c(this,"version");c(this,"name");c(this,"description",null);c(this,"type",n.PrimitiveEntity);c(this,"static");c(this,"abstract");c(this,"properties",[]);c(this,"methods",[]);c(this,"abstractMethods",[]);c(this,"extends",[]);c(this,"errors",[]);c(this,"project");this.initialData=e,this.project=t,this.id=e.id,this.version=e.version,this.name=e.name,this.static=e.static,this.abstract=e.abstract,this.properties=this.initialData.properties.map(i=>{const a=R(i,this.project);return a.setParent(this),a.initChildren(),a}),this.methods=this.initialData.methods.map(i=>{const a=R(i,this.project);return a.parent=this,a}),this.abstractMethods=this.initialData.abstractMethods.map(i=>{const a=R(i,this.project);return a.parent=this,a})}get extendedProperties(){return g(this.extends.reduce((e,t)=>{const i=[...t.properties,...t.extendedProperties].filter(a=>!a.abstract);return[...e,...i]},[]))}subscribe(){return this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}async load(){return this}remove({ignoreUpstream:e,seenEntities:t}={ignoreUpstream:!1,seenEntities:new Set}){return{affected:[],removed:[]}}restore({seenEntities:e}={seenEntities:new Set}){return{affected:[],self:this}}toFlat(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this,...this.properties.flatMap(i=>i.toFlat(e)),...this.methods.flatMap(i=>i.toFlat(e)),...this.abstractMethods.flatMap(i=>i.toFlat(e))])}toFlatIds(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.id,...this.properties.flatMap(i=>i.toFlatIds(e)),...this.methods.flatMap(i=>i.toFlatIds(e)),...this.abstractMethods.flatMap(i=>i.toFlatIds(e))])}toJSON(){return{id:this.id,version:this.version,type:this.type,name:this.name,description:this.description,static:this.static,abstract:this.abstract,properties:this.properties.map(e=>e.toJSON()),methods:this.methods.map(e=>e.toJSON()),abstractMethods:this.abstractMethods.map(e=>e.toJSON()),extends:this.extends.map(e=>e.toJSON())}}toReference(){return{id:this.id+"--"+N.UUID.uuid()+"--ref",type:n.GenericReference,entityId:this.id,entityType:this.type}}toShallowJSON(){return{id:this.id,version:this.version,type:this.type,name:this.name,description:this.description,abstract:this.abstract,static:this.static,properties:this.properties.map(e=>e.toReference()),methods:this.methods.map(e=>e.toReference()),abstractMethods:this.abstractMethods.map(e=>e.toReference()),extends:this.extends.map(e=>e.toReference())}}toFlatJSON(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toShallowJSON(),...this.properties.flatMap(i=>i.toFlatJSON(e)),...this.methods.flatMap(i=>i.toFlatJSON(e)),...this.abstractMethods.flatMap(i=>i.toFlatJSON(e))])}toGenerationTarget(){return{id:this.id,type:this.type,name:this.name,description:this.description,static:this.static,abstract:this.abstract,extends:this.extends.map(e=>e.id)}}toFlatGenerationTarget(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toGenerationTarget(),...this.properties.flatMap(i=>i.toFlatGenerationTarget(e)),...this.methods.flatMap(i=>i.toFlatGenerationTarget(e)),...this.abstractMethods.flatMap(i=>i.toFlatGenerationTarget(e))])}clearErrors(){return this.errors=[],this.properties.forEach(e=>e.clearErrors()),this.methods.forEach(e=>e.clearErrors()),this.abstractMethods.forEach(e=>e.clearErrors()),this}validate(){const e=T7(this);return this.errors=e,{success:!0,error:null,data:this.toJSON()}}getErrors(){return[...this.errors,...this.properties.flatMap(t=>t.getErrors()),...this.methods.flatMap(t=>t.getErrors()),...this.abstractMethods.flatMap(t=>t.getErrors())]}getShallowErrors(){return this.errors}clone(){return new Ut(this.toJSON(),this.project)}getAllInteractiveMethods(){const e=[];return e.push(...this.methods),this.extends.filter(i=>i.type===n.BuiltInBaseEntity&&i.interactive||i.type===n.PrimitiveEntity).forEach(i=>{i instanceof Ft&&e.push(...i.getAllInteractiveMethods())}),g(e)}}function xt(r,e){if(!r)throw new Error("Entity is null");const t=e.get(r.id);switch(r.type){case n.PrimitiveValue:return t||new Ai(r,e);case n.CustomEntity:return t||new jr(r,e);case n.PrimitiveEntity:return t||new Ut(r,e);case n.FunctionDeclaration:return t||new Cr(r,e);case n.GlobalEvent:return t||new Di(r,e);case n.DataType:return t||new Ii(r,e);case n.Property:return t||new Sr(r,e);case n.FunctionCall:return t||new Ur(r,e);case n.Condition:return t||new _r(r,e);case n.Operation:return t||new Br(r,e);case n.VariableDeclaration:return t||new Nr(r,e);case n.VariableInstance:return t||new Mr(r,e);case n.OutputMap:return t||new On(r,e);case n.ReturnDeclaration:return t||new Bt(r,e);case n.ArgumentDeclaration:return t||new Gr(r,e);case n.InputMap:return t||new An(r,e);case n.Project:return t||new N(r);case n.InstalledProject:return t||new Lr(r,e);case n.ActionDescriptor:return t||new te(r,e);case n.ReturnStatement:return t||new $r(r,e);case n.Loop:return t||new wr(r,e);case n.Search:return t||new Vr(r,e);case n.ValueDescriptor:return t||new Fr(r,e);case n.BuiltInBaseEntity:return t||new Ft(r,e);case n.InternalCall:return t||new Pi(r,e);case n.ContinueStatement:return t||new Tt(r,e);case n.BreakStatement:return t||new Oi(r,e);default:throw new Error("Invalid entity type: "+r.type)}}function R(r,e){if(!r)throw new Error("Entity is null");const t=xt(r,e);return t.subscribe(),t}function E7(r,e){if(!r)throw new Error("Entity is null");switch(r.type){case n.PrimitiveValue:return Ai.fromGenerationTarget(r,e);case n.CustomEntity:return jr.fromGenerationTarget(r,e);case n.FunctionDeclaration:return Cr.fromGenerationTarget(r,e);case n.GlobalEvent:return Di.fromGenerationTarget(r,e);case n.DataType:return Ii.fromGenerationTarget(r,e);case n.Property:return Sr.fromGenerationTarget(r,e);case n.FunctionCall:return Ur.fromGenerationTarget(r,e);case n.Condition:return _r.fromGenerationTarget(r,e);case n.Operation:return Br.fromGenerationTarget(r,e);case n.VariableDeclaration:return Nr.fromGenerationTarget(r,e);case n.VariableInstance:return Mr.fromGenerationTarget(r,e);case n.OutputMap:return On.fromGenerationTarget(r,e);case n.ReturnDeclaration:return Bt.fromGenerationTarget(r,e);case n.ArgumentDeclaration:return Gr.fromGenerationTarget(r,e);case n.InputMap:return An.fromGenerationTarget(r,e);case n.InstalledProject:return Lr.fromGenerationTarget(r,e);case n.ReturnStatement:return $r.fromGenerationTarget(r,e);case n.Loop:return wr.fromGenerationTarget(r,e);case n.Search:return Vr.fromGenerationTarget(r,e);case n.ActionDescriptor:return te.fromGenerationTarget(r,e);case n.ValueDescriptor:return Fr.fromGenerationTarget(r,e);case n.InternalCall:return Pi.fromGenerationTarget(r,e);case n.ContinueStatement:return Tt.fromGenerationTarget(r,e);case n.BreakStatement:return Oi.fromGenerationTarget(r,e);default:throw new Error("Invalid entity type: "+r.type)}}const ee=class ee{constructor(e){c(this,"initialData");c(this,"id");c(this,"version");c(this,"type",n.Project);c(this,"name",null);c(this,"description",null);c(this,"x");c(this,"y");c(this,"entities",[]);c(this,"projects",[]);c(this,"functions",[]);c(this,"events",[]);c(this,"variableDeclarations",[]);c(this,"variableInstances",[]);c(this,"conditions",[]);c(this,"operations",[]);c(this,"functionCalls",[]);c(this,"loops",[]);c(this,"searches",[]);c(this,"primitives",[]);c(this,"builtInBaseEntities",[]);c(this,"operationDeclarations",[]);c(this,"globalEventActionDescriptors",[]);c(this,"loopDeclarations",[]);c(this,"loopDeclarationsBodies",[]);c(this,"conditionDeclarations",[]);c(this,"valueDescriptors",[]);c(this,"dataTypes",[]);c(this,"project");c(this,"instances",{});c(this,"builtInInstances",{});c(this,"errors",[]);c(this,"references",[]);this.initialData=e,this.id=e.id,this.version=e.version,this.name=e.name,this.description=e.description,this.x=0,this.y=0;try{(!ee.UUID||ee.UUID.isBackup)&&(ee.UUID=Vs==null?void 0:Vs()),ee.UUID||(ee.UUID={isBackup:!0,uuid:()=>Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15),fromUUID:t=>t})}catch(t){console.error("Error initializing UUID module",t),ee.UUID={isBackup:!0,uuid:()=>Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15),fromUUID:i=>i}}}static injectUUIDModule(e){ee.UUID=e}static validateGenerationTarget(e,t){let i=JSON.parse(JSON.stringify(e));const a=[];return a.push(...Ne(i)),{errors:a,modifiedData:i}}async inject(...e){return await Promise.all(e.map(t=>new Promise(async i=>{await t.init(this),i(null)}))),this}validateGeneratedUpdate(e){return{errors:[],modifiedData:e}}addSelfToProject(){const e=[this],t=[],i=[];return{updated:g(e),added:g(t),removed:g(i),self:this}}get instancesList(){return Object.values(this.instances)}isOperationDeclaration(e){return this.operationDeclarations.includes(e)}isGlobalEventActionDescriptor(e){return this.globalEventActionDescriptors.includes(e)}isLoopDeclaration(e){return this.loopDeclarations.includes(e)}isConditionDeclaration(e){return this.conditionDeclarations.includes(e)}initChildren(){return this.entities=this.initialData.entities.map(e=>{const t=R(e,this);return t.setParent(this),t.initChildren(),t}),this.projects=this.initialData.projects.map(e=>{const t=R(e,this);return t.setParent(this),t.initChildren(),t}),this.functions=this.initialData.functions.map(e=>{const t=R(e,this);return t.setParent(this),t.initChildren(),t}),this.events=this.initialData.events.map(e=>{const t=R(e,this);return t.setParent(this),t.initChildren(),t}),this.variableDeclarations=this.initialData.variableDeclarations.map(e=>{const t=R(e,this);return t.setParent(this),t.initChildren(),t}),this.variableInstances=this.initialData.variableInstances.map(e=>{const t=R(e,this);return t.setParent(this),t.initChildren(),t}),this.conditions=this.initialData.conditions.map(e=>{const t=R(e,this);return t.setParent(this),t.initChildren(),t}),this.operations=this.initialData.operations.map(e=>{const t=R(e,this);return t.setParent(this),t.initChildren(),t}),this.functionCalls=this.initialData.functionCalls.map(e=>{const t=R(e,this);return t.setParent(this),t.initChildren(),t}),this.loops=this.initialData.loops.map(e=>{const t=R(e,this);return t.setParent(this),t.initChildren(),t}),this.searches=this.initialData.searches.map(e=>{const t=R(e,this);return t.setParent(this),t.initChildren(),t}),this.attachOrphanReferences(),this.validate(),this}subscribeInstance(e){return(!this.instances[e.id]||this.instances[e.id]!==e)&&(this.instances[e.id]=e),this}subscribeBuiltInInstance(e){return(!this.builtInInstances[e.id]||this.builtInInstances[e.id]!==e)&&(this.builtInInstances[e.id]=e),this}subscribe(){return this}unsubscribe(){return this}unsubscribeInstance(e){return delete this.instances[e.id],this}findSubscribedInstance(e){return this.instances[e.id]||null}findSubscribedBuiltInInstance(e){return this.builtInInstances[e.id]||null}get(e){return this.instances[e]||this.builtInInstances[e]||null}getManaged(e){return this.instances[e]||null}getBuiltIn(e){return this.builtInInstances[e]||null}findSubscribedInstanceFromReference(e){return this.instances[e.entityId]||null}findSubscribedBuiltInInstanceFromReference(e){return this.builtInInstances[e.entityId]||null}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}async delete(){return this}remove({ignoreUpstream:e}={ignoreUpstream:!1}){return{affected:[],removed:[]}}restore({seenEntities:e}={seenEntities:new Set}){return{affected:[],self:this}}getAllBuiltInIds(){const e=new Set;return[...this.primitives.flatMap(t=>t.toFlatIds(e)),...this.builtInBaseEntities.flatMap(t=>t.toFlatIds(e)),...this.operationDeclarations.flatMap(t=>t.toFlatIds(e)),...this.globalEventActionDescriptors.flatMap(t=>t.toFlatIds(e)),...this.loopDeclarations.flatMap(t=>t.toFlatIds(e)),...this.conditionDeclarations.flatMap(t=>t.toFlatIds(e)),...this.valueDescriptors.flatMap(t=>t.toFlatIds(e)),...this.dataTypes.flatMap(t=>t.toFlatIds(e))]}getAllBuiltIn(){const e=new Set;return[...this.primitives.flatMap(t=>t.toFlat(e)),...this.builtInBaseEntities.flatMap(t=>t.toFlat(e)),...this.operationDeclarations.flatMap(t=>t.toFlat(e)),...this.globalEventActionDescriptors.flatMap(t=>t.toFlat(e)),...this.loopDeclarations.flatMap(t=>t.toFlat(e)),...this.conditionDeclarations.flatMap(t=>t.toFlat(e)),...this.valueDescriptors.flatMap(t=>t.toFlat(e)),...this.dataTypes.flatMap(t=>t.toFlat(e))]}toFlat(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[...this.entities.flatMap(i=>i.toFlat(e)),...this.functions.flatMap(i=>i.toFlat(e)),...this.events.flatMap(i=>i.toFlat(e)),...this.projects.flatMap(i=>i.toFlat(e)),...this.variableDeclarations.flatMap(i=>i.toFlat(e)),...this.variableInstances.flatMap(i=>i.toFlat(e)),...this.conditions.flatMap(i=>i.toFlat(e)),...this.operations.flatMap(i=>i.toFlat(e)),...this.functionCalls.flatMap(i=>i.toFlat(e)),...this.loops.flatMap(i=>i.toFlat(e)),...this.searches.flatMap(i=>i.toFlat(e))])}toFlatIds(e=new Set){return e.has(this.id)?[]:(e.add(this.id),Array.from(e))}toJSON(){return{id:this.id,version:this.version,type:this.type,name:this.name,description:this.description,entities:this.entities.map(e=>e.toJSON()),functions:this.functions.map(e=>e.toJSON()),events:this.events.map(e=>e.toJSON()),projects:this.projects.map(e=>e.toJSON()),variableDeclarations:this.variableDeclarations.map(e=>e.toJSON()),variableInstances:this.variableInstances.map(e=>e.toJSON()),conditions:this.conditions.map(e=>e.toJSON()),operations:this.operations.map(e=>e.toJSON()),functionCalls:this.functionCalls.map(e=>e.toJSON()),loops:this.loops.map(e=>e.toJSON()),searches:this.searches.map(e=>e.toJSON())}}toReference(){return{id:this.id+"--"+ee.UUID.uuid()+"--ref",type:n.GenericReference,entityId:this.id,entityType:this.type}}toShallowJSON(){return{id:this.id,version:this.version,type:this.type,name:this.name,description:this.description,entities:this.entities.map(e=>e.toReference()),functions:this.functions.map(e=>e.toReference()),events:this.events.map(e=>e.toReference()),projects:this.projects.map(e=>e.toReference()),variableDeclarations:this.variableDeclarations.map(e=>e.toReference()),variableInstances:this.variableInstances.map(e=>e.toReference()),conditions:this.conditions.map(e=>e.toReference()),operations:this.operations.map(e=>e.toReference()),functionCalls:this.functionCalls.map(e=>e.toReference()),loops:this.loops.map(e=>e.toReference()),searches:this.searches.map(e=>e.toReference())}}toFlatJSON(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[...this.entities.flatMap(i=>i.toFlatJSON(e)),...this.functions.flatMap(i=>i.toFlatJSON(e)),...this.events.flatMap(i=>i.toFlatJSON(e)),...this.projects.flatMap(i=>i.toFlatJSON(e)),...this.variableDeclarations.flatMap(i=>i.toFlatJSON(e)),...this.variableInstances.flatMap(i=>i.toFlatJSON(e)),...this.conditions.flatMap(i=>i.toFlatJSON(e)),...this.operations.flatMap(i=>i.toFlatJSON(e)),...this.functionCalls.flatMap(i=>i.toFlatJSON(e)),...this.loops.flatMap(i=>i.toFlatJSON(e)),...this.searches.flatMap(i=>i.toFlatJSON(e))])}toGenerationTarget(){return{id:this.id,type:this.type,name:this.name,description:this.description}}toFlatGenerationTarget(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[...this.entities.flatMap(i=>i.toFlatGenerationTarget(e)),...this.functions.flatMap(i=>i.toFlatGenerationTarget(e)),...this.events.flatMap(i=>i.toFlatGenerationTarget(e)),...this.projects.flatMap(i=>i.toFlatGenerationTarget(e)),...this.variableDeclarations.flatMap(i=>i.toFlatGenerationTarget(e)),...this.variableInstances.flatMap(i=>i.toFlatGenerationTarget(e)),...this.conditions.flatMap(i=>i.toFlatGenerationTarget(e)),...this.operations.flatMap(i=>i.toFlatGenerationTarget(e)),...this.functionCalls.flatMap(i=>i.toFlatGenerationTarget(e)),...this.loops.flatMap(i=>i.toFlatGenerationTarget(e)),...this.searches.flatMap(i=>i.toFlatGenerationTarget(e))])}clearErrors(){return this.errors=[],this.entities.forEach(e=>e.clearErrors()),this.projects.forEach(e=>e.clearErrors()),this.functions.forEach(e=>e.clearErrors()),this.events.forEach(e=>e.clearErrors()),this.variableDeclarations.forEach(e=>e.clearErrors()),this.variableInstances.forEach(e=>e.clearErrors()),this.conditions.forEach(e=>e.clearErrors()),this.operations.forEach(e=>e.clearErrors()),this.functionCalls.forEach(e=>e.clearErrors()),this.loops.forEach(e=>e.clearErrors()),this.searches.forEach(e=>e.clearErrors()),this}validate(){const e=$3(),t=this.toJSON();return e.safeParse(t),this.validateChildren(),{success:!0,error:null,data:t}}validateChildren(){this.entities.forEach(e=>e.validate()),this.projects.forEach(e=>e.validate()),this.functions.forEach(e=>e.validate()),this.events.forEach(e=>e.validate()),this.variableDeclarations.forEach(e=>e.validate()),this.variableInstances.forEach(e=>e.validate()),this.conditions.forEach(e=>e.validate()),this.operations.forEach(e=>e.validate()),this.functionCalls.forEach(e=>e.validate()),this.loops.forEach(e=>e.validate()),this.searches.forEach(e=>e.validate())}getErrors(){return[...this.errors,...this.entities.flatMap(t=>t.getErrors()),...this.projects.flatMap(t=>t.getErrors()),...this.functions.flatMap(t=>t.getErrors()),...this.events.flatMap(t=>t.getErrors()),...this.variableDeclarations.flatMap(t=>t.getErrors()),...this.variableInstances.flatMap(t=>t.getErrors()),...this.conditions.flatMap(t=>t.getErrors()),...this.operations.flatMap(t=>t.getErrors()),...this.functionCalls.flatMap(t=>t.getErrors()),...this.loops.flatMap(t=>t.getErrors()),...this.searches.flatMap(t=>t.getErrors())]}getShallowErrors(){return this.errors}clone(){return new ee(this.toJSON())}getCustomEntity(e){return this.entities.find(t=>t.id===e)||null}addCustomEntityFromTransfer(e){const t=R(e,this);return this.addCustomEntity(t),t}addCustomEntity(e){return this.entities.includes(e)||this.entities.push(e),e}addFunctionDeclarationFromTransfer(e){const t=R(e,this);return this.addFunctionDeclaration(t),t}addFunctionDeclaration(e){return this.functions.includes(e)||this.functions.push(e),e}addFunctionCallFromTransfer(e){const t=R(e,this);return this.addFunctionCall(t),t}addFunctionCall(e){return this.functionCalls.includes(e)||this.functionCalls.push(e),e}addVariableDeclarationFromTransfer(e){const t=R(e,this);return this.addVariableDeclaration(t),t}addVariableDeclaration(e){return this.variableDeclarations.includes(e)||this.variableDeclarations.push(e),e}addVariableInstanceFromTransfer(e){const t=R(e,this);return this.addVariableInstance(t),t}addVariableInstance(e){return this.variableInstances.includes(e)||this.variableInstances.push(e),e}addInstalledProjectFromTransfer(e){const t=R(e,this);return this.addInstalledProject(t),this}addInstalledProject(e){return this.projects.includes(e)||this.projects.push(e),this}addGlobalEventFromTransfer(e){const t=R(e,this);return this.addGlobalEvent(t),this}addGlobalEvent(e){return this.events.includes(e)||this.events.push(e),this}addConditionFromTransfer(e){const t=R(e,this);return this.addCondition(t),this}addCondition(e){return this.conditions.includes(e)||this.conditions.push(e),this}addOperationFromTransfer(e){const t=R(e,this);return this.addOperation(t),this}addOperation(e){return this.operations.includes(e)||this.operations.push(e),this}addLoopFromTransfer(e){const t=R(e,this);return this.addLoop(t),this}addLoop(e){return this.loops.includes(e)||this.loops.push(e),this}addSearchFromTransfer(e){const t=R(e,this);return this.addSearch(t),this}addSearch(e){return this.searches.includes(e)||this.searches.push(e),this}removeCustomEntity(e){const t=this.entities.findIndex(i=>i.id===e.id);if(t>-1){const i=this.entities[t];return this.entities.splice(t,1),i}return null}removeFunctionDeclaration(e){const t=this.functions.findIndex(i=>i.id===e.id);if(t>-1){const i=this.functions[t];return this.functions.splice(t,1),i}return null}removeExternalProject(e){const t=this.projects.findIndex(i=>i.id===e.id);if(t>-1){const i=this.projects[t];return this.projects.splice(t,1),i}return null}removeGlobalEvent(e){const t=this.events.findIndex(i=>i.id===e.id);if(t>-1){const i=this.events[t];return this.events.splice(t,1),i}return null}removeTopLevelVariableDeclaration(e){if(e.type!==n.VariableDeclaration)return null;const t=this.variableDeclarations.findIndex(i=>i.id===e.id);if(t>-1){const i=this.variableDeclarations[t];return this.variableDeclarations.splice(t,1),i}return null}getEntryPoints(){return[...this.functions,...this.events,...this.entities.flatMap(t=>t.methods)]}getFunctionDeclaration(e){return this.functions.find(t=>t.id===e)||null}getConditions(){return[...this.conditions,...this.getEntryPoints().reduce((t,i)=>{const a=we(i);return[...t,...a.filter(s=>s.type===n.Condition)]},[]),...this.functionCalls.reduce((t,i)=>{const a=we(i);return[...t,...a.filter(s=>s.type===n.Condition)]},[]),...this.operations.reduce((t,i)=>{const a=we(i);return[...t,...a.filter(s=>s.type===n.Condition)]},[]),...this.loops.reduce((t,i)=>{const a=we(i);return[...t,...a.filter(s=>s.type===n.Condition)]},[]),...this.searches.reduce((t,i)=>{const a=we(i);return[...t,...a.filter(s=>s.type===n.Condition)]},[])]}getOperations(){return[...this.operations,...this.getEntryPoints().reduce((t,i)=>{const a=we(i);return[...t,...a.filter(s=>s.type===n.Operation)]},[]),...this.functionCalls.reduce((t,i)=>{const a=we(i);return[...t,...a.filter(s=>s.type===n.Operation)]},[]),...this.conditions.reduce((t,i)=>{const a=we(i);return[...t,...a.filter(s=>s.type===n.Operation)]},[]),...this.loops.reduce((t,i)=>{const a=we(i);return[...t,...a.filter(s=>s.type===n.Operation)]},[]),...this.searches.reduce((t,i)=>{const a=we(i);return[...t,...a.filter(s=>s.type===n.Operation)]},[])]}getFunctionCalls(){return[...this.functionCalls,...this.getEntryPoints().reduce((t,i)=>{const a=we(i);return[...t,...a.filter(s=>s.type===n.FunctionCall)]},[]),...this.conditions.reduce((t,i)=>{const a=we(i);return[...t,...a.filter(s=>s.type===n.FunctionCall)]},[]),...this.operations.reduce((t,i)=>{const a=we(i);return[...t,...a.filter(s=>s.type===n.FunctionCall)]},[]),...this.loops.reduce((t,i)=>{const a=we(i);return[...t,...a.filter(s=>s.type===n.FunctionCall)]},[]),...this.searches.reduce((t,i)=>{const a=we(i);return[...t,...a.filter(s=>s.type===n.FunctionCall)]},[])]}getVariables(){return[...this.variableDeclarations,...this.getEntryPoints().reduce((t,i)=>{const a=ie(i);return[...t,...a]},[]),...this.functionCalls.reduce((t,i)=>{const a=ie(i);return[...t,...a]},[]),...this.conditions.reduce((t,i)=>{const a=ie(i);return[...t,...a]},[]),...this.operations.reduce((t,i)=>{const a=ie(i);return[...t,...a]},[]),...this.loops.reduce((t,i)=>{const a=ie(i);return[...t,...a]},[]),...this.searches.reduce((t,i)=>{const a=ie(i);return[...t,...a]},[])]}getVariableInstances(){return[...this.variableInstances,...this.getEntryPoints().reduce((t,i)=>{const s=ie(i).filter(o=>o.type===n.VariableInstance);return[...t,...s]},[]),...this.functionCalls.reduce((t,i)=>{const s=ie(i).filter(o=>o.type===n.VariableInstance);return[...t,...s]},[]),...this.conditions.reduce((t,i)=>{const s=ie(i).filter(o=>o.type===n.VariableInstance);return[...t,...s]},[]),...this.operations.reduce((t,i)=>{const s=ie(i).filter(o=>o.type===n.VariableInstance);return[...t,...s]},[]),...this.loops.reduce((t,i)=>{const s=ie(i).filter(o=>o.type===n.VariableInstance);return[...t,...s]},[]),...this.searches.reduce((t,i)=>{const s=ie(i).filter(o=>o.type===n.VariableInstance);return[...t,...s]},[])]}getVariableDeclarations(){return g([...this.variableDeclarations,...this.getEntryPoints().reduce((t,i)=>{const s=ie(i).filter(o=>o.type===n.VariableDeclaration);return[...t,...s]},[]),...this.functionCalls.reduce((t,i)=>{const s=ie(i).filter(o=>o.type===n.VariableDeclaration);return[...t,...s]},[]),...this.conditions.reduce((t,i)=>{const s=ie(i).filter(o=>o.type===n.VariableDeclaration);return[...t,...s]},[]),...this.operations.reduce((t,i)=>{const s=ie(i).filter(o=>o.type===n.VariableDeclaration);return[...t,...s]},[]),...this.loops.reduce((t,i)=>{const s=ie(i).filter(o=>o.type===n.VariableDeclaration);return[...t,...s]},[]),...this.searches.reduce((t,i)=>{const s=ie(i).filter(o=>o.type===n.VariableDeclaration);return[...t,...s]},[])])}attachOrphanReferences(){const e=this.getVariableInstances(),t=this.getVariableDeclarations();return e.forEach(i=>{if(!i.declaration){const a=i.initialData,s=a.declaration.entityId||a.declaration.id,o=t.find(l=>l.id===s);o&&i.setDeclaration(o)}}),this}getBuiltInPersistedEntity(){return this.builtInBaseEntities.find(e=>e.name===L.PERSISTED_ENTITY)||null}};c(ee,"UUID",{isBackup:!0,uuid:()=>Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15),fromUUID:e=>e}),c(ee,"MUTABLE_BASE_PROPERTIES",["name","description"]),c(ee,"INMUTABLE_BASE_PROPERTIES",["id","type","version"]),c(ee,"BASE_PROPERTIES",[...ee.MUTABLE_BASE_PROPERTIES,...ee.INMUTABLE_BASE_PROPERTIES]),c(ee,"MUTABLE_META_PROPERTIES",[...ee.MUTABLE_BASE_PROPERTIES,"x","y"]),c(ee,"INMUTABLE_META_PROPERTIES",[...ee.INMUTABLE_BASE_PROPERTIES]),c(ee,"META_PROPERTIES",[...ee.MUTABLE_META_PROPERTIES,...ee.INMUTABLE_META_PROPERTIES]),c(ee,"MUTABLE_UPSTREAM_PROPERTIES",[]),c(ee,"INMUTABLE_UPSTREAM_PROPERTIES",["primitives","builtInBaseEntities","operationDeclarations","globalEventActionDescriptors","loopDeclarations","builtInInstances"]),c(ee,"UPSTREAM_PROPERTIES",[...ee.MUTABLE_UPSTREAM_PROPERTIES,...ee.INMUTABLE_UPSTREAM_PROPERTIES]),c(ee,"MUTABLE_DOWNSTREAM_PROPERTIES",["entities","projects","functions","events","variableDeclarations","variableInstances","conditions","operations","functionCalls","loops","searches"]),c(ee,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),c(ee,"DOWNSTREAM_PROPERTIES",[...ee.MUTABLE_DOWNSTREAM_PROPERTIES,...ee.INMUTABLE_DOWNSTREAM_PROPERTIES]),c(ee,"PROPERTIES",[...ee.META_PROPERTIES,...ee.UPSTREAM_PROPERTIES,...ee.DOWNSTREAM_PROPERTIES]);let N=ee;class AA extends te{constructor(t){super(qt,t);c(this,"id",_e.Parallel);c(this,"name",_e.Parallel);c(this,"description","Execute a list of actions one after the other");c(this,"version",1);c(this,"autoexecutable",!0);c(this,"initialData",qt);c(this,"type",n.ActionDescriptor);c(this,"inputs",[]);c(this,"outputs",[]);c(this,"error",null);c(this,"project");this.project=t,this.inputs=qt.inputs.map(i=>{const a=R(i,this.project);return a.setParent(this),a.initChildren(),a}),this.outputs=qt.outputs.map(i=>{const a=R(i,this.project);return a.setParent(this),a.initChildren(),a}),this.error=qt.error?R(qt.error,this.project):null}}class OA extends te{constructor(t){super(dt,t);c(this,"id",dt.id);c(this,"name",dt.name);c(this,"description",dt.description);c(this,"version",dt.version);c(this,"autoexecutable",!1);c(this,"initialData",dt);c(this,"type",n.ActionDescriptor);c(this,"inputs",[]);c(this,"outputs",[]);c(this,"error",null);c(this,"project");this.project=t,this.inputs=dt.inputs.map(i=>{const a=R(i,this.project);return a.setParent(this),a.initChildren(),a}),this.outputs=dt.outputs.map(i=>{const a=R(i,this.project);return a.setParent(this),a.initChildren(),a}),this.error=dt.error?R(dt.error,this.project):null}}class SA extends te{constructor(t){super(hn,t);c(this,"id",_e.Sequential);c(this,"name",_e.Sequential);c(this,"description","Execute a list of actions one after the other");c(this,"version",1);c(this,"autoexecutable",!0);c(this,"initialData",hn);c(this,"type",n.ActionDescriptor);c(this,"inputs",[]);c(this,"outputs",[]);c(this,"error",null);c(this,"project");this.project=t,this.inputs=hn.inputs.map(i=>{const a=R(i,this.project);return a.setParent(this),a.initChildren(),a}),this.outputs=hn.outputs.map(i=>{const a=R(i,this.project);return a.setParent(this),a.initChildren(),a}),this.error=hn.error?R(hn.error,this.project):null}}class b7 extends te{constructor(e){super(_i,e)}}class R7 extends te{constructor(e){super(tr,e)}}class g7 extends te{constructor(t){super(nr,t);c(this,"autoexecutable",!0)}getEntityToMatchInputMap(t){return t.inputs.find(i=>{var a;return((a=i.declaration)==null?void 0:a.id)===B.operation[oe.Validate].inputs.entityToMatch.id})||null}getDataToValidateInputMap(t){return t.inputs.find(i=>{var a;return((a=i.declaration)==null?void 0:a.id)===B.operation[oe.Validate].inputs.dataToValidate.id})||null}getOutputDataOutputMap(t){return t.outputs.find(i=>{var a;return((a=i.declaration)==null?void 0:a.id)===B.operation[oe.Validate].outputs.outputEntity.id})||null}getEntityToMatch(t){let i=null;if(t.readsValue){const s=t.readsValue.getDataType();s&&s.entity&&s.entity.type===n.CustomEntity&&(i=s.entity)}const a=t.getDefaultValue();return!i&&a&&a.valueAsType&&!Array.isArray(a.valueAsType)&&a.valueAsType.type===n.CustomEntity&&(i=a.valueAsType),i}syncOperationInstance(t){const i=this.getEntityToMatchInputMap(t);i&&this.syncEntityToMatchInputMapDataType(i);const a=this.getDataToValidateInputMap(t);a&&this.syncDataToValidateInputMapDataType(a);const s=this.getOutputDataOutputMap(t);return s&&this.syncOutputDataOutputMapDataType(s),t}syncEntityToMatchInputMapDataType(t){var a,s,o;if(((a=t.declaration)==null?void 0:a.id)!==B.operation[oe.Validate].inputs.entityToMatch.id)return null;if(!t.dataType){const l={id:t.id+"--infered-data-type",version:1,type:n.DataType,isList:!1,isNullable:!1,andChildrenGroup:null,orChildrenGroup:null,asType:!0,entity:null,constant:!1,like:!0,inferred:!0,defaultValue:null,parent:t.toReference()},p=R(l,t.project);p.setParent(t),p.initChildren(),t.setDataType(p)}(s=t.dataType)==null||s.sync({inferred:!0,like:!1,asType:!0});const i=this.getEntityToMatch(t);return(o=t.dataType)==null||o.setEntity(i),t.dataType}syncDataToValidateInputMapDataType(t){var o,l,p;if(((o=t.declaration)==null?void 0:o.id)!==B.operation[oe.Validate].inputs.dataToValidate.id)return null;const i=this.getEntityToMatchInputMap(t.parent);if(!i||!this.getEntityToMatch(i))return null;if(!t.dataType){const y={id:t.id+"--infered-data-type",version:1,type:n.DataType,isList:!1,isNullable:!1,andChildrenGroup:null,orChildrenGroup:null,asType:!1,entity:null,constant:!1,like:!0,inferred:!0,defaultValue:null,parent:t.toReference()},h=R(y,t.project);h.setParent(t),h.initChildren(),t.setDataType(h)}(l=t.dataType)==null||l.sync({inferred:!0,like:!0,asType:!1});const s=this.getEntityToMatch(i);return(p=t.dataType)==null||p.setEntity(s),t.dataType}syncOutputDataOutputMapDataType(t){var o,l,p;if(((o=t.declaration)==null?void 0:o.id)!==B.operation[oe.Validate].outputs.outputEntity.id)return null;const i=this.getEntityToMatchInputMap(t.parent);if(!i||!this.getEntityToMatch(i))return null;if(!t.dataType){const y={id:t.id+"--infered-data-type",version:1,type:n.DataType,isList:!1,isNullable:!1,andChildrenGroup:null,orChildrenGroup:null,asType:!1,entity:null,constant:!1,like:!0,inferred:!0,defaultValue:null,parent:t.toReference()},h=R(y,t.project);h.setParent(t),h.initChildren(),t.setDataType(h)}(l=t.dataType)==null||l.sync({inferred:!0,like:!0,asType:!1});const s=this.getEntityToMatch(i);return(p=t.dataType)==null||p.setEntity(s),t.dataType}inferInputMapDataType(t){var i,a;return((i=t.declaration)==null?void 0:i.id)===B.operation[oe.Validate].inputs.entityToMatch.id?this.syncEntityToMatchInputMapDataType(t):((a=t.declaration)==null?void 0:a.id)===B.operation[oe.Validate].inputs.dataToValidate.id?this.syncDataToValidateInputMapDataType(t):null}inferOutputMapDataType(t){var i;return((i=t.declaration)==null?void 0:i.id)===B.operation[oe.Validate].outputs.outputEntity.id?this.syncOutputDataOutputMapDataType(t):null}}class v7 extends te{constructor(e){super(al,e)}}class I7 extends te{constructor(e){super(ol,e)}}class D7 extends te{constructor(e){super(ll,e)}}class P7 extends te{constructor(e){super(Ya,e)}}class A7 extends te{constructor(e){super(qa,e)}}class O7 extends te{constructor(e){super(Bi,e)}}function S7(r){const e=[new SA(r),new AA(r),new OA(r),new b7(r),new R7(r),new g7(r),new P7(r),new v7(r),new D7(r),new I7(r),new A7(r),new O7(r),new te(il,r),new te(rl,r)];return e.forEach(t=>{t.initChildren(),r.subscribeBuiltInInstance(t)}),r.operationDeclarations=e,e}class CA extends Ft{constructor(t){super(xe,t);c(this,"initialData");c(this,"id",L.PERSISTED_ENTITY);c(this,"version",1);c(this,"name",L.PERSISTED_ENTITY);c(this,"description",xe.description);c(this,"type",n.BuiltInBaseEntity);c(this,"abstract",xe.abstract);c(this,"static",xe.static);c(this,"properties",[]);c(this,"methods",[]);c(this,"abstractMethods",[]);c(this,"extends",[]);c(this,"errors",[]);c(this,"project");this.initialData=xe,this.project=t,this.id=xe.id,this.version=xe.version,this.name=xe.name,this.static=xe.static,this.abstract=xe.abstract,this.properties=this.initialData.properties.map(i=>{const a=R(i,this.project);return a.setParent(this),a.initChildren(),a}),this.methods=this.initialData.methods.map(i=>{const a=R(i,this.project);return a.parent=this,a}),this.abstractMethods=this.initialData.abstractMethods.map(i=>{const a=R(i,this.project);return a.parent=this,a}),this.extends=this.initialData.extends.map(i=>R(i,this.project))}}function C7(r){const e=[new CA(r),new Ft(as,r),new Ft(Nn,r),new Ft(jl,r),new Ft(is,r)];return e.forEach(t=>{r.subscribeBuiltInInstance(t)}),r.builtInBaseEntities=e,e}function B7(r){const e=[new Ut(x,r),new Ut(wn,r),new Ut(Q,r),new Ut(Ze,r),new Ut(_n,r),new Ut(un,r),new Ut(ka,r),new Ut(Ko,r)];return e.forEach(t=>{r.subscribeBuiltInInstance(t)}),r.primitives=e,e}function w7(r){const e=[new te(ds,r)];return e.forEach(t=>{t.initChildren(),r.subscribeBuiltInInstance(t)}),r.globalEventActionDescriptors=e,e}function _7(r){const e=[new te(ns,r),new te(rr,r),new te(ts,r),new te(Mi,r),new te(Vi,r),new te(El,r)];e.forEach(i=>{i.initChildren(),r.subscribeBuiltInInstance(i)}),r.loopDeclarations=e;const t=[new te(Ol,r),new te(es,r),new te(Il,r),new te(yT,r),new te(_T,r),new te(Rl,r)];return t.forEach(i=>{i.initChildren(),r.subscribeBuiltInInstance(i)}),r.loopDeclarationsBodies=t,e}function N7(r){const e=[new Fr(Wl,r)];return e.forEach(t=>{t.initChildren(),r.subscribeBuiltInInstance(t)}),r.valueDescriptors=e,e}function M7(r){const e=[new te(lr,r),new te(zr,r)];return e.forEach(t=>{t.initChildren()}),r.conditionDeclarations=e,e}const kr={},Jo={};async function V7(r,e={}){const t={...jI};return t.id=r.id,e.empty?{data:{id:r.id,type:n.Project,version:1,name:null,description:null,projects:[],entities:[],operations:[],functions:[],variableDeclarations:[],variableInstances:[],functionCalls:[],conditions:[],loops:[],searches:[],events:[]}}:{data:t}}function BA(r){const e=new N(r);return B7(e),C7(e),S7(e),w7(e),_7(e),N7(e),M7(e),e.getAllBuiltIn().forEach(i=>{e.builtInInstances[i.id]||(e.builtInInstances[i.id]=i,delete e.instances[i.id])}),e.initChildren(),e}async function L7(r,e={}){if(r.id&&kr[r.id])return kr[r.id];if(r.id&&Jo[r.id])return await Jo[r.id],kr[r.id];const t=V7(r,e);r.id&&(Jo[r.id]=t);const i=await t;if(i.data){const a=BA(i.data);return kr[r.id]=a,r.id&&delete Jo[r.id],a}return null}function G7(r){return kr[r.id]&&delete kr[r.id],null}const $7="test_primitive_entities_export";d.AI_VALUE_CONNECTION_GENERATION_ACTION_EXPLANATION=Iu,d.ActionDescriptorState=te,d.ActionInputMapState=P2,d.ActionOutputMapState=S2,d.AppendToListOperationInputIds=nf,d.AppendToListOperationOutputIds=rf,d.ArgumentDeclarationState=Gr,d.BREAK_AND_CONTINUE_STATEMENTS_RETURN_DECLARATIONS_EXPLANATION=bu,d.BUILT_IN_BASE_ENTITY_IDS=B,d.BUILT_IN_ENTITY_TYPES=Wr,d.BaseCanvasDraggableState=c2,d.BaseEntityNames=L,d.BaseState=l2,d.BaseValueDescriptorIds=Zo,d.BreakStatementState=Oi,d.BuiltInBaseEntityState=Ft,d.CACHED_PROJECTS_BY_ID=kr,d.CALLABLE_ENTITIES_EXPLANATION=U2,d.CALLABLE_TYPES=Bn,d.CALLER_ENTITIES_EXPLANATION=jP,d.CALLER_TYPES=dn,d.CALLS_UPDATE_EXPLANATION=zn,d.COMPARISON_CONDITIONS=Nb,d.CONDITIONS=sO,d.CUSTOM_ENTITY_OPERATIONS=Dh,d.CallableEntityClass=u2,d.CallerEntityClass=hu,d.ChildEntityState=d2,d.ComparisonOperatorTypes=Le,d.ConditionState=_r,d.ContinueStatementState=Tt,d.CreateNewInputIds=Xf,d.CreateNewOutputIds=Qf,d.CustomEntityState=jr,d.DRAGGABLE_CALLABLE_TYPES=Ho,d.DRAGGABLE_CALLER_TYPES=ju,d.DRAGGABLE_ELEMENT_TYPES=zo,d.DRAGGABLE_EXECUTABLE_TYPES=_A,d.DRAGGABLE_PASS_THROUGH_CALLABLE_TYPES=Yo,d.DataTypeCompatibilityTypes=$t,d.DataTypeParentChildRelation=ze,d.DataTypeState=Ii,d.ENTITIES_WITH_VALLUES_EXPLANATION=wo,d.ENTITY_TYPES=NA,d.ENTITY_WITH_LOGIC_SCOPE_TYPES=ct,d.ENTITY_WITH_NAMES_TYPES=ku,d.ENTITY_WITH_VALUE_TYPES=xu,d.ENTRY_POINT_ENTITIES_EXPLANATION=La,d.ENTRY_POINT_TYPES=Ge,d.EVENT_TYPES=Jr,d.EXECUTABLE_TYPES=wA,d.EXECUTION_OPERATIONS=Kf,d.EntityError=mr,d.EntityErrorSeverity=T,d.EntityGenerationError=E,d.EntityGenerationErrorCode=f,d.EntityInstanceErrorCode=M,d.EntityOperations=oe,d.EntityType=n,d.EntityWithLogicScopeClass=h2,d.EntityWithValueClass=f2,d.EntryPointEntityClass=p2,d.ExecutionOperations=_e,d.FunctionCallState=Ur,d.FunctionDeclarationState=Cr,d.GLOBAL_EVENT_DECLARATIONS=oO,d.GetLastInListOperationInputIds=qy,d.GetLastInListOperationOutputIds=Jy,d.GlobalEventNames=cn,d.GlobalEventState=Di,d.HTTPOperations=et,d.HTTP_OPERATIONS=im,d.InputMapState=An,d.InstalledProjectState=Lr,d.InternalCallState=Pi,d.JoinListOperationInputIds=dy,d.JoinListOperationOutputIds=uy,d.LIST_OPERATIONS=Tf,d.ListOperations=Y,d.LoopState=wr,d.LoopTypes=k,d.NON_INTERACTIVE_BASE_ENTITIES_EXPLANATION=Zn,d.NUMBER_OPERATIONS=Dp,d.NumberOperations=fe,d.OPERATION_DECLARATIONS=GA,d.OperationState=Br,d.OutputMapParentChildRelation=Uu,d.OutputMapState=On,d.PARENT_AUTO_CALCULATION_FROM_CALLER_EXPLANATION=_o,d.PASS_THROUGH_CALLABLE_ENTITIES_EXPLANATION=Hn,d.PASS_THROUGH_CALLABLE_TYPES=Ue,d.PROPERTY_NOT_VALUE_READER_WRITTER_EXPLANATION=vu,d.ParallelExecutionOperation=AA,d.ParallelExecutionOperationInputIds=Ef,d.ParallelExecutionOperationOutputIds=bf,d.PassThroughCallableEntityClass=y2,d.PersistedEntity=CA,d.PersistedEntityMethods=At,d.PrimitiveEntityState=Ut,d.PrimitiveTypes=D,d.PrimitiveValueState=Ai,d.ProjectState=N,d.PropertyState=Sr,d.RETURN_STATEMENT_RETURN_DECLARATIONS_EXPLANATION=x2,d.ReturnDeclarationState=Bt,d.ReturnStatementState=$r,d.STANDALONE_CONDITIONS=Ob,d.STRING_OPERATIONS=cy,d.ScopeCompatibilityType=qo,d.SearchState=Vr,d.SequentialExecutionOperation=SA,d.SequentialExecutionOperationInputIds=$f,d.SequentialExecutionOperationOutputIds=Ff,d.SharedEntityErrorCode=S,d.SharedStateFunctionality=FP,d.SplitListOperationInputIds=Ay,d.SplitListOperationOutputIds=Oy,d.StandaloneOperatorTypes=Mt,d.StringOperations=K,d.TERMINATION_TYPES=$e,d.USER_MANAGED_ENTITY_TYPES=MA,d.UserManagedEntityStateFunctionality=o2,d.VALUE_READING_ENTITIES_EXPLANATION=gu,d.VALUE_READING_TYPES=Cn,d.VALUE_WRITING_ENTITIES_EXPLANATION=kP,d.VALUE_WRITING_TYPES=Fe,d.VARIABLE_DATA_TYPE_INFERRANCE_EXPLANATION=Ru,d.VARIABLE_TYPES=ke,d.ValueAutogenerationType=qe,d.ValueDescriptorParentChildRelation=O,d.ValueDescriptorState=Fr,d.ValueReadingEntityClass=Ma,d.ValueWritingEntityClass=Va,d.VariableDeclarationState=Nr,d.VariableInputMapState=D2,d.VariableInstanceState=Mr,d.VariableOutputMapState=O2,d.WaitOperation=OA,d.WaitOperationInputIds=wf,d.WaitOperationOutputIds=_f,d.appendToListOperation=Ya,d.appendToListOperationElementToAppendArgument=dl,d.appendToListOperationElementToAppendArgumentParentRef=pf,d.appendToListOperationElementToAppendArgumentRef=of,d.appendToListOperationError=mf,d.appendToListOperationErrorParentRef=hf,d.appendToListOperationListArgument=cl,d.appendToListOperationListArgumentParentRef=uf,d.appendToListOperationListArgumentRef=af,d.appendToListOperationListDataType=sf,d.appendToListOperationResultListDataType=df,d.appendToListOperationResultListReturn=ff,d.appendToListOperationResultListReturnParentRef=yf,d.appendToListOperationResultListReturnRef=cf,d.appendToListOperationSecondListDataType=lf,d.asGenerationActionExample=on,d.booleanPrototype=wn,d.capitalizeFirstLetter=Io,d.checkAreCustomEntitiesCompatibleAsDataType=AP,d.checkAreDataTypesCompatible=Zt,d.checkArePropertiesCompatibleAsDataType=PP,d.checkIsBranchDependentButNotDirectlyOnBranch=$a,d.checkIsBranchDependentOnBranch=Z2,d.checkIsCallableEntityReachable=xa,d.checkIsCanvasEntity=y7,d.checkIsDetachedBranch=RA,d.checkIsDetachedBranchShallow=$u,d.checkIsGlobalVariable=u7,d.checkIsGloballyDeclared=Gu,d.checkIsMethod=IA,d.checkIsNestedScope=ko,d.checkScopeCompatibility=Fa,d.countedLoopActionDescriptor=ns,d.countedLoopActionDescriptorDynamicReturnDeclaration=xT,d.countedLoopActionDescriptorDynamicReturnDeclarationParentRef=UT,d.countedLoopActionDescriptorStringArgumentDeclaration=FT,d.countedLoopActionDescriptorStringArgumentDeclarationDataType=GT,d.countedLoopActionDescriptorStringArgumentDeclarationDataTypeDefaultValue=VT,d.countedLoopActionDescriptorStringArgumentDeclarationDataTypeDefaultValueParentRef=MT,d.countedLoopActionDescriptorStringArgumentDeclarationDataTypeParentRef=LT,d.countedLoopActionDescriptorStringArgumentDeclarationParentRef=$T,d.countedLoopBodyActionDescriptor=Ol,d.countedLoopBodyActionDescriptorAnyDynamicArgument=WT,d.countedLoopBodyActionDescriptorAnyDynamicArgumentParentRef=JT,d.countedLoopBodyActionDescriptorAnyDynamicReturn=HT,d.countedLoopBodyActionDescriptorAnyDynamicReturnParentRef=YT,d.countedLoopBodyActionDescriptorIterationNumberArgumentDeclaration=Al,d.countedLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataType=kT,d.countedLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataTypeParentRef=jT,d.countedLoopBodyActionDescriptorIterationNumberArgumentDeclarationParentRef=qT,d.createCustomEntityFromJSONObject=Go,d.createEntityError=z,d.createNestedDataTypeForEntity=eA,d.createNewInstanceOperation=tr,d.createNewInstanceOperationEntityToInstanciateArgument=oh,d.createNewInstanceOperationEntityToInstanciateArgumentRef=ih,d.createNewInstanceOperationEntityToInstanciateDataType=ah,d.createNewInstanceOperationError=uh,d.createNewInstanceOperationErrorParentRef=dh,d.createNewInstanceOperationNewEntityDataArgument=rh,d.createNewInstanceOperationNewEntityDataArgumentDataType=nh,d.createNewInstanceOperationNewEntityDataArgumentDataTypeParentRef=th,d.createNewInstanceOperationNewEntityDataArgumentParentRef=eh,d.createNewInstanceOperationOutputEntityDeclaration=ch,d.createNewInstanceOperationOutputEntityDeclarationParentRef=lh,d.createNewInstanceOperationRef=sh,d.createSemanticId=He,d.createStateFromGenerationTargetType=E7,d.createStateFromType=xt,d.createStateFromTypeAndSubscribe=R,d.cronJobBuiltInBaseEntity=jl,d.cronJobBuiltInBaseEntityExpressionProperty=Ib,d.cronJobBuiltInBaseEntityExpressionPropertyDataTypeRef=rO,d.cronJobBuiltInBaseEntityExpressionPropertyRef=gb,d.cronJobBuiltInBaseEntityRef=vb,d.cronJobTriggeredFunctionDeclarationBlueprint=xl,d.cronJobTriggeredFunctionDeclarationBlueprintParentRef=bb,d.customEntityToZodSchema=Kb,d.dataTypeCompatibilityToErrorExplanation=KP,d.datePrototype=un,d.dateValueAutogenerationSchema=nd,d.deletePersistedEntityMethod=Ul,d.deletePersistedEntityMethodParentRef=KE,d.deleteRootProject=G7,d.endpointBuiltInBaseEntity=as,d.endpointBuiltInBaseEntityRef=iE,d.endpointBuiltInBaseEntityRefFour=FE,d.endpointBuiltInBaseEntityRefThree=yE,d.endpointBuiltInBaseEntityRefTwo=cE,d.endpointBuiltInCorsProperty=aE,d.endpointBuiltInCorsPropertyDataType=rE,d.endpointBuiltInCorsPropertyDataTypeRef=tE,d.endpointBuiltInCorsPropertyRef=nE,d.endpointBuiltInMethodProperty=Cl,d.endpointBuiltInMethodPropertyDataType=pE,d.endpointBuiltInMethodPropertyDataTypeRef=dE,d.endpointBuiltInMethodPropertyRef=uE,d.endpointBuiltInPathProperty=Sl,d.endpointBuiltInPathPropertyDataType=lE,d.endpointBuiltInPathPropertyDataTypeRef=sE,d.endpointBuiltInPathPropertyRef=oE,d.endpointPathParamsArgumentDeclaration=wl,d.endpointPathParamsArgumentDeclarationRef=IE,d.endpointPathParamsVariableDataType=DE,d.endpointPathParamsVariableDataTypeRef=vE,d.endpointReachedTriggerActionDescriptor=Gl,d.endpointReachedTriggerActionDescriptorRef=PE,d.endpointReachedTriggerActionDescriptorRefFour=SE,d.endpointReachedTriggerActionDescriptorRefThree=OE,d.endpointReachedTriggerActionDescriptorRefTwo=AE,d.endpointRequestBodyArgumentDeclaration=Nl,d.endpointRequestBodyArgumentDeclarationRef=TE,d.endpointRequestBodyVariableDataType=EE,d.endpointRequestHeadersArgumentDeclaration=Bl,d.endpointRequestHeadersArgumentDeclarationRef=hE,d.endpointRequestHeadersVariableDataType=mE,d.endpointRequestHeadersVariableDataTypeRef=fE,d.endpointRequestQueryParamsArgumentDeclaration=_l,d.endpointRequestQueryParamsArgumentDeclarationRef=RE,d.endpointRequestQueryParamsVariableDataType=gE,d.endpointRequestQueryParamsVariableDataTypeRef=bE,d.endpointResponseBodyDataType=GE,d.endpointResponseBodyReturnDeclaration=Ll,d.endpointResponseBodyReturnDeclarationRef=LE,d.endpointResponseCodeDataType=BE,d.endpointResponseCodeReturnDeclaration=Ml,d.endpointResponseCodeReturnDeclarationRef=CE,d.endpointResponseHeadersDataType=ME,d.endpointResponseHeadersDataTypeRef=_E,d.endpointResponseHeadersReturnDeclaration=Vl,d.endpointResponseHeadersReturnDeclarationRef=NE,d.endpointReturnStatementRef=wE,d.endpointReturnStatementRefThree=$E,d.endpointReturnStatementRefTwo=VE,d.enumOptionsProperty=Hu,d.enumOptionsPropertyDataType=Wu,d.enumOptionsPropertyDataTypeRef=qu,d.enumOptionsPropertyRef=Ju,d.enumPrototype=_n,d.enumPrototypeRef=Yu,d.executionBuiltInEntity=ql,d.executionBuiltInEntityAbortMethod=kl,d.executionBuiltInEntityAbortMethodParentRef=Db,d.filterOutDuplicateEntities=g,d.filterOutDuplicateErrors=r9,d.findEntityFromKeys=Au,d.findReferenceToSelfInList=pA,d.findReferencesToSelfInProject=a7,d.flattenCalls=ln,d.flattenCanvasAncestorsUntil=$o,d.flattenCustomEntityExtensionAndImplementationTypes=TA,d.flattenCustomEntityExtensionTypes=xo,d.flattenCustomEntityExtensions=Mu,d.flattenCustomEntityImplementations=Vu,d.flattenCustomEntityImplementionTypes=Uo,d.flattenDerivedCanvasEntities=Pt,d.flattenDetachedBranch=vA,d.flattenElementCalls=we,d.flattenElementCallsOnTheSameScope=i7,d.flattenProjectElements=uA,d.flattenRelatedCanvasElementsOnTheLeft=mA,d.flattenRelatedCanvasElementsOnTheRight=hA,d.flattenVariableReads=dA,d.flattenVariableWrites=cA,d.flattenVariables=ie,d.fromZodParseToEntityGenerationErrors=mu,d.generate=rC,d.generateActionExample=j2,d.generateExecutionDataType=jk,d.generateMutablePropertiesExplanation=So,d.generateRandomBoolean=IR,d.generateRandomDate=tR,d.generateRandomDateAfter=Xb,d.generateRandomDateBefore=Qb,d.generateRandomDateBetweenRange=eR,d.generateRandomNumber=ER,d.generateRandomNumberAfter=hR,d.generateRandomNumberBefore=mR,d.generateRandomNumberBetweenRange=TR,d.generateRandomText=vR,d.generateRandomTextAfter=bR,d.generateRandomTextBefore=RR,d.generateRandomTextBetweenRange=gR,d.generateUniqueUUID=fR,d.getAllActionDescriptorsForConditions=Vo,d.getAllActionDescriptorsForGlobalEvents=No,d.getAllActionDescriptorsForLoops=Mo,d.getAllActionDescriptorsForOperations=W2,d.getAllGloballyDeclaredFunctionDeclarationsExplanation=HP,d.getBaseBuiltInEntities=Xn,d.getBaseSchemaBasedOnType=UP,d.getBuiltInEntityOwner=Qn,d.getCallableEntityReferenceSchema=Ye,d.getCallableEntityTypeSchema=pD,d.getCallerEntityReferenceSchema=l3,d.getCallerEntityTypeSchema=o3,d.getCalls=Cu,d.getCanvasEntitiesDerivedFromInternalCalls=fA,d.getCanvasEntitiesDerivedFromWrites=Si,d.getCanvasEntityDerivedFromValueReadingEntity=Nu,d.getCanvasEntityReferenceSchema=P3,d.getCanvasEntityTypeSchema=D3,d.getChildrenEntityWithValues=X2,d.getCommonAncestor=Su,d.getCommonChildren=tA,d.getDeclaration=Or,d.getDeepestScope=PA,d.getDraggableCallableEntityReferenceSchema=fD,d.getDraggableCallableEntityTypeSchema=yD,d.getDraggableCallerEntityReferenceSchema=d3,d.getDraggableCallerEntityTypeSchema=c3,d.getDraggableExecutableEntityReferenceSchema=f3,d.getDraggableExecutableEntityTypeSchema=y3,d.getDraggablePassThroughCallableEntityReferenceSchema=ho,d.getDraggablePassThroughCallableEntityTypeSchema=fo,d.getDraggablePlayableEntityReferenceSchema=b3,d.getDraggablePlayableEntityTypeSchema=E3,d.getEntityArgumentDeclarations=wu,d.getEntityInputMaps=yA,d.getEntityOutputMaps=l7,d.getEntityReferenceSchema=I3,d.getEntityReturnDeclarations=_u,d.getEntityTypeSchema=v3,d.getEntityWithLogicScopeReferenceSchema=In,d.getEntityWithLogicScopeTypeSchema=h3,d.getEntityWithValueReferenceSchema=uD,d.getEntityWithValueTypeSchema=s3,d.getEntryPointEntityReferenceSchema=We,d.getEntryPointEntityTypeSchema=Jn,d.getEventEntityReferenceSchema=po,d.getEventEntityTypeSchema=uo,d.getExecutableEntityReferenceSchema=p3,d.getExecutableEntityTypeSchema=u3,d.getExtendedBuiltInEntity=c7,d.getExtendedCustomEntity=bA,d.getGenerationTargetSchemaBasedOnType=xP,d.getHeadIfPartOfDetachedBranch=gA,d.getHighestScope=DA,d.getImplementedBuiltInEntity=d7,d.getIsInteractive=Lu,d.getLastInListOperation=ll,d.getLastInListOperationError=tf,d.getLastInListOperationErrorParentRef=ef,d.getLastInListOperationInputListArgument=Ky,d.getLastInListOperationInputListArgumentParentRef=Zy,d.getLastInListOperationInputListArgumentRef=Wy,d.getLastInListOperationInputListDataType=Yy,d.getLastInListOperationOutputElementDataType=zy,d.getLastInListOperationOutputElementReturn=Qy,d.getLastInListOperationOutputElementReturnParentRef=Xy,d.getLastInListOperationOutputElementReturnRef=Hy,d.getLinkedEntitiesFromArgumentDeclaration=r7,d.getLowestPersistedEntityImplementation=EA,d.getParentCanvasEntities=Et,d.getParentCanvasEntity=Qe,d.getParentEntryPoint=K2,d.getPassThroughCallableEntityReferenceSchema=he,d.getPassThroughCallableEntityTypeSchema=yo,d.getPlayableEntityReferenceSchema=T3,d.getPlayableEntityTypeSchema=m3,d.getProject=L7,d.getPrototypeByType=jo,d.getReferenceEntityId=_,d.getReferencedEntitiesStateOrErrors=Bo,d.getReferencedEntityStateOrErrors=Tu,d.getRelatedCanvasElementsOnTheLeft=xr,d.getRelatedCanvasElementsOnTheRight=Kn,d.getRootEntryPointScopeOwner=Fu,d.getScopeOwner=bt,d.getTerminationReferenceSchema=g3,d.getTerminationTypeSchema=R3,d.getUsedArgFromDeclaration=s7,d.getUsedReturnFromDeclaration=o7,d.getValueReadingEntityReferenceSchema=dD,d.getValueReadingEntityTypeSchema=vn,d.getValueWritingEntityReferenceSchema=a3,d.getValueWritingEntityTypeSchema=Da,d.getVariableFromInputMapping=rA,d.getVariableFromReturnVariablePointer=sA,d.getVariableReferenceSchema=qn,d.getVariableTypeSchema=gr,d.getVariablesFromArgumentDeclarations=Fo,d.getVariablesFromInputMaps=iA,d.getVariablesFromOutputMapping=oA,d.getVariablesFromOutputMaps=lA,d.getVariablesFromReturnDeclarations=aA,d.getVariablesInSameOrHigherScope=ou,d.getWrites=Bu,d.groupCallsBasedOnParallelizableExecution=e7,d.handleAfterEntityImplementationSideEffects=QP,d.handleBeforeEntityImplementationSideEffects=XP,d.httpRequestBodyArgument=Ka,d.httpRequestBodyArgumentRef=Gh,d.httpRequestBodyDataType=$h,d.httpRequestHeadersArgument=Za,d.httpRequestHeadersArgumentRef=Vh,d.httpRequestHeadersDataType=Lh,d.httpRequestMethodArgument=Ha,d.httpRequestMethodArgumentRef=Nh,d.httpRequestMethodDataType=Mh,d.httpRequestMethodDataTypeRef=wh,d.httpRequestOperation=_i,d.httpRequestOperationErrorValueDescriptor=Tl,d.httpRequestOperationErrorValueDescriptorDatatype=rm,d.httpRequestOperationErrorValueDescriptorRef=nm,d.httpRequestOperationRef=Xh,d.httpRequestOperationRefEight=em,d.httpRequestOperationRefFive=Zh,d.httpRequestOperationRefFour=zh,d.httpRequestOperationRefNine=tm,d.httpRequestOperationRefSeven=Qh,d.httpRequestOperationRefSix=Kh,d.httpRequestOperationRefThree=Hh,d.httpRequestOperationRefTwo=Yh,d.httpRequestQueryParamsArgument=hl,d.httpRequestQueryParamsArgumentRef=Ch,d.httpRequestQueryParamsDataType=Bh,d.httpRequestVariableURLArgument=za,d.httpRequestVariableURLArgumentRef=Oh,d.httpRequestVariableURLDataType=Sh,d.httpRequestVariableURLDataTypeRef=Ph,d.httpResponseBodyReturnDataType=Wh,d.httpResponseBodyReturnDataTypeRef=qh,d.httpResponseBodyReturnReturn=wi,d.httpResponseBodyReturnReturnRef=Jh,d.httpResponseCodeDataType=Uh,d.httpResponseCodeReturn=ml,d.httpResponseCodeReturnRef=Fh,d.httpResponseHeadersDataType=kh,d.httpResponseHeadersDataTypeRef=xh,d.httpResponseHeadersReturn=Xa,d.httpResponseHeadersReturnRef=jh,d.implement=Lo,d.inferArgumentDeclarationDataType=OP,d.inferDataType=sn,d.inferInputMapDataType=iu,d.inferOutputMapDataType=su,d.inferPropertyDataType=BP,d.inferReturnDeclarationDataType=au,d.inferValueDescriptorDataType=wP,d.inferVariableDeclarationDataType=CP,d.inferVariableInstanceDataType=SP,d.initProject=BA,d.iterateOverListActionDescriptorListArgumentDeclaration=Em,d.iterateOverListActionDescriptorListArgumentDeclarationDataType=mm,d.iterateOverListActionDescriptorListArgumentDeclarationDataTypeParentRef=hm,d.iterateOverListActionDescriptorListArgumentDeclarationParentRef=Tm,d.iterateOverListLoopActionDescriptor=rr,d.iterateOverListLoopActionDescriptorDynamicReturnDeclaration=Rm,d.iterateOverListLoopActionDescriptorDynamicReturnDeclarationParentRef=bm,d.iterateOverListLoopBodyActionDescriptor=es,d.iterateOverListLoopBodyActionDescriptorAnyDynamicArgument=Cm,d.iterateOverListLoopBodyActionDescriptorAnyDynamicArgumentParentRef=Sm,d.iterateOverListLoopBodyActionDescriptorAnyDynamicReturn=wm,d.iterateOverListLoopBodyActionDescriptorAnyDynamicReturnParentRef=Bm,d.iterateOverListLoopBodyActionDescriptorCurrentValueArgumentDeclaration=Qa,d.iterateOverListLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataType=vm,d.iterateOverListLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataTypeParentRef=gm,d.iterateOverListLoopBodyActionDescriptorCurrentValueArgumentDeclarationParentRef=Im,d.iterateOverListLoopBodyActionDescriptorIterationNumberArgumentDeclaration=Om,d.iterateOverListLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataType=Pm,d.iterateOverListLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataTypeParentRef=Dm,d.iterateOverListLoopBodyActionDescriptorIterationNumberArgumentDeclarationParentRef=Am,d.iterateOverObjectKeysActionDescriptorObjectArgumentDeclaration=Qm,d.iterateOverObjectKeysActionDescriptorObjectArgumentDeclarationDataType=Km,d.iterateOverObjectKeysActionDescriptorObjectArgumentDeclarationDataTypeParentRef=Zm,d.iterateOverObjectKeysActionDescriptorObjectArgumentDeclarationParentRef=Xm,d.iterateOverObjectKeysLoopActionDescriptor=Mi,d.iterateOverObjectKeysLoopActionDescriptorDynamicReturnDeclaration=tT,d.iterateOverObjectKeysLoopActionDescriptorDynamicReturnDeclarationParentRef=eT,d.iterateOverObjectKeysLoopBodyActionDescriptor=yT,d.iterateOverObjectKeysLoopBodyActionDescriptorAnyDynamicArgument=dT,d.iterateOverObjectKeysLoopBodyActionDescriptorAnyDynamicArgumentParentRef=cT,d.iterateOverObjectKeysLoopBodyActionDescriptorAnyDynamicReturn=pT,d.iterateOverObjectKeysLoopBodyActionDescriptorAnyDynamicReturnParentRef=uT,d.iterateOverObjectKeysLoopBodyActionDescriptorCurrentValueArgumentDeclaration=Dl,d.iterateOverObjectKeysLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataType=rT,d.iterateOverObjectKeysLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataTypeParentRef=nT,d.iterateOverObjectKeysLoopBodyActionDescriptorCurrentValueArgumentDeclarationParentRef=iT,d.iterateOverObjectKeysLoopBodyActionDescriptorIterationNumberArgumentDeclaration=lT,d.iterateOverObjectKeysLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataType=sT,d.iterateOverObjectKeysLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataTypeParentRef=aT,d.iterateOverObjectKeysLoopBodyActionDescriptorIterationNumberArgumentDeclarationParentRef=oT,d.iterateOverObjectValuesActionDescriptorObjectArgumentDeclaration=ET,d.iterateOverObjectValuesActionDescriptorObjectArgumentDeclarationDataType=mT,d.iterateOverObjectValuesActionDescriptorObjectArgumentDeclarationDataTypeParentRef=hT,d.iterateOverObjectValuesActionDescriptorObjectArgumentDeclarationParentRef=TT,d.iterateOverObjectValuesLoopActionDescriptor=Vi,d.iterateOverObjectValuesLoopActionDescriptorDynamicReturnDeclaration=RT,d.iterateOverObjectValuesLoopActionDescriptorDynamicReturnDeclarationParentRef=bT,d.iterateOverObjectValuesLoopBodyActionDescriptor=_T,d.iterateOverObjectValuesLoopBodyActionDescriptorAnyDynamicArgument=CT,d.iterateOverObjectValuesLoopBodyActionDescriptorAnyDynamicArgumentParentRef=ST,d.iterateOverObjectValuesLoopBodyActionDescriptorAnyDynamicReturn=wT,d.iterateOverObjectValuesLoopBodyActionDescriptorAnyDynamicReturnParentRef=BT,d.iterateOverObjectValuesLoopBodyActionDescriptorCurrentValueArgumentDeclaration=Pl,d.iterateOverObjectValuesLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataType=vT,d.iterateOverObjectValuesLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataTypeParentRef=gT,d.iterateOverObjectValuesLoopBodyActionDescriptorCurrentValueArgumentDeclarationParentRef=IT,d.iterateOverObjectValuesLoopBodyActionDescriptorIterationNumberArgumentDeclaration=OT,d.iterateOverObjectValuesLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataType=PT,d.iterateOverObjectValuesLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataTypeParentRef=DT,d.iterateOverObjectValuesLoopBodyActionDescriptorIterationNumberArgumentDeclarationParentRef=AT,d.iterateOverStringActionDescriptorDynamicReturnDeclaration=$m,d.iterateOverStringActionDescriptorDynamicReturnDeclarationParentRef=Gm,d.iterateOverStringActionDescriptorStringArgumentDeclaration=Lm,d.iterateOverStringActionDescriptorStringArgumentDeclarationDataType=Mm,d.iterateOverStringActionDescriptorStringArgumentDeclarationDataTypeParentRef=Nm,d.iterateOverStringActionDescriptorStringArgumentDeclarationParentRef=Vm,d.iterateOverStringLoopActionDescriptor=ts,d.iterateOverStringLoopBodyActionDescriptor=Il,d.iterateOverStringLoopBodyActionDescriptorAnyDynamicArgument=Wm,d.iterateOverStringLoopBodyActionDescriptorAnyDynamicArgumentParentRef=Jm,d.iterateOverStringLoopBodyActionDescriptorAnyDynamicReturn=Hm,d.iterateOverStringLoopBodyActionDescriptorAnyDynamicReturnParentRef=Ym,d.iterateOverStringLoopBodyActionDescriptorCurrentValueArgumentDeclaration=gl,d.iterateOverStringLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataType=Um,d.iterateOverStringLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataTypeParentRef=Fm,d.iterateOverStringLoopBodyActionDescriptorCurrentValueArgumentDeclarationParentRef=xm,d.iterateOverStringLoopBodyActionDescriptorIterationNumberArgumentDeclaration=vl,d.iterateOverStringLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataType=km,d.iterateOverStringLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataTypeParentRef=jm,d.iterateOverStringLoopBodyActionDescriptorIterationNumberArgumentDeclarationParentRef=qm,d.joinListOperation=al,d.joinListOperationError=Py,d.joinListOperationErrorParentRef=Dy,d.joinListOperationFirstListArgument=by,d.joinListOperationFirstListArgumentParentRef=Ey,d.joinListOperationFirstListArgumentRef=py,d.joinListOperationFirstListDataType=yy,d.joinListOperationResultListDataType=Ty,d.joinListOperationResultListReturn=Iy,d.joinListOperationResultListReturnParentRef=vy,d.joinListOperationResultListReturnRef=my,d.joinListOperationSecondListArgument=gy,d.joinListOperationSecondListArgumentParentRef=Ry,d.joinListOperationSecondListArgumentRef=fy,d.joinListOperationSecondListDataType=hy,d.joinListWithLastSeparator=F,d.joinStringsOperation=Bi,d.joinStringsOperationDynamicStringArgument=Jp,d.joinStringsOperationDynamicStringArgumentParentRef=qp,d.joinStringsOperationDynamicStringArgumentRef=jp,d.joinStringsOperationDynamicStringDataType=kp,d.joinStringsOperationError=xp,d.joinStringsOperationErrorParentRef=Up,d.joinStringsOperationFirstStringArgument=Ja,d.joinStringsOperationFirstStringArgumentParentRef=wp,d.joinStringsOperationFirstStringArgumentRef=Pp,d.joinStringsOperationFirstStringDataType=Ap,d.joinStringsOperationResultStringDataType=Bp,d.joinStringsOperationResultStringReturn=Ci,d.joinStringsOperationResultStringReturnParentRef=Fp,d.joinStringsOperationResultStringReturnRef=Cp,d.joinStringsOperationSecondStringArgument=Wa,d.joinStringsOperationSecondStringArgumentParentRef=$p,d.joinStringsOperationSecondStringArgumentRef=Op,d.joinStringsOperationSecondStringDataType=Sp,d.joinStringsOperationSeparatorStringArgument=Gp,d.joinStringsOperationSeparatorStringArgumentParentRef=Lp,d.joinStringsOperationSeparatorStringArgumentRef=_p,d.joinStringsOperationSeparatorStringDataType=Vp,d.joinStringsOperationSeparatorStringDataTypeDefaultValue=Mp,d.joinStringsOperationSeparatorStringDataTypeDefaultValueParentRef=Np,d.jsonPrototype=Ko,d.keyValueParamBuiltInBaseEntity=is,d.keyValueParamBuiltInBaseEntityNameProperty=KT,d.keyValueParamBuiltInBaseEntityNamePropertyDataTypeRef=FA,d.keyValueParamBuiltInBaseEntityNamePropertyParentRef=ZT,d.keyValueParamBuiltInBaseEntityNamePropertyRef=zT,d.keyValueParamBuiltInBaseEntityValueProperty=eE,d.keyValueParamBuiltInBaseEntityValuePropertyDataTypeRef=xA,d.keyValueParamBuiltInBaseEntityValuePropertyParentRef=QT,d.keyValueParamBuiltInBaseEntityValuePropertyRef=XT,d.lowercaseFirstLetter=DP,d.manualFlowActionDescriptorDeclarationArgumentDeclaration=bl,d.manualFlowActionDescriptorDeclarationArgumentDeclarationDataType=lm,d.manualFlowActionDescriptorDeclarationArgumentDeclarationDataTypeParentRef=om,d.manualFlowActionDescriptorDeclarationArgumentDeclarationParentRef=cm,d.manualFlowLoopActionDescriptor=El,d.manualFlowLoopActionDescriptorDynamicReturnDeclaration=sm,d.manualFlowLoopActionDescriptorDynamicReturnDeclarationParentRef=am,d.manualFlowLoopBodyActionDescriptor=Rl,d.manualFlowLoopBodyActionDescriptorAnyDynamicArgument=um,d.manualFlowLoopBodyActionDescriptorAnyDynamicArgumentParentRef=dm,d.manualFlowLoopBodyActionDescriptorAnyDynamicReturn=ym,d.manualFlowLoopBodyActionDescriptorAnyDynamicReturnParentRef=pm,d.mapActionDescriptorToTypeItRepresents=f7,d.mergeEntityErrorsList=i9,d.mergeListOfEntities=p7,d.methodDefaultValue=_h,d.mockClientProject=jI,d.moreThanOrEqualCondition=zr,d.moreThanOrEqualConditionLeftHandArgument=Bb,d.moreThanOrEqualConditionLeftHandArgumentParentRef=Cb,d.moreThanOrEqualConditionRightHandArgument=_b,d.moreThanOrEqualConditionRightHandArgumentParentRef=wb,d.notEmptyCondition=lr,d.notEmptyConditionArgument=Ab,d.notEmptyConditionRef=Pb,d.nullPrototype=VA,d.numberAdditionOperation=qa,d.numberAdditionOperationDynamicSummandArgument=op,d.numberAdditionOperationDynamicSummandArgumentType=sp,d.numberAdditionOperationDynamicSummandArgumentTypeParentRef=ap,d.numberAdditionOperationError=ip,d.numberAdditionOperationErrorParentRef=rp,d.numberAdditionOperationFirstNumberArgument=Xo,d.numberAdditionOperationFirstNumberArgumentRef=zu,d.numberAdditionOperationFirstNumberDataType=Zu,d.numberAdditionOperationRef=tp,d.numberAdditionOperationRefThree=el,d.numberAdditionOperationRefTwo=np,d.numberAdditionOperationResultNumberDataType=ep,d.numberAdditionOperationResultNumberReturn=tl,d.numberAdditionOperationResultNumberReturnRef=Qu,d.numberAdditionOperationSecondNumberArgument=Qo,d.numberAdditionOperationSecondNumberArgumentRef=Ku,d.numberAdditionOperationSecondNumberDataType=Xu,d.numberPrototype=Q,d.numberSubtractionOperation=rl,d.numberSubtractionOperationDynamicSubtrahendArgument=Ip,d.numberSubtractionOperationDynamicSubtrahendArgumentType=vp,d.numberSubtractionOperationDynamicSubtrahendArgumentTypeParentRef=gp,d.numberSubtractionOperationError=Rp,d.numberSubtractionOperationErrorParentRef=bp,d.numberSubtractionOperationFirstNumberArgument=fp,d.numberSubtractionOperationFirstNumberArgumentRef=lp,d.numberSubtractionOperationFirstNumberDataType=cp,d.numberSubtractionOperationRef=nl,d.numberSubtractionOperationRefThree=Tp,d.numberSubtractionOperationRefTwo=hp,d.numberSubtractionOperationResultNumberDataType=yp,d.numberSubtractionOperationResultNumberReturn=Ep,d.numberSubtractionOperationResultNumberReturnRef=pp,d.numberSubtractionOperationSecondNumberArgument=mp,d.numberSubtractionOperationSecondNumberArgumentRef=dp,d.numberSubtractionOperationSecondNumberDataType=up,d.numberValueAutogenerationSchema=td,d.parallelExecutionOperation=qt,d.parallelExecutionOperationError=Bf,d.parallelExecutionOperationErrorParentRef=Cf,d.parallelExecutionOperationListOfExecutionResultsDataType=Af,d.parallelExecutionOperationListOfExecutionResultsReturn=pl,d.parallelExecutionOperationListOfExecutionResultsReturnRef=Pf,d.parallelExecutionOperationListOfFunctionsArgument=ul,d.parallelExecutionOperationListOfFunctionsArgumentDatatype=Df,d.parallelExecutionOperationListOfFunctionsArgumentRef=If,d.parallelExecutionOperationListOfFunctionsBlueprint=vf,d.parallelExecutionOperationListOfFunctionsBlueprintDynamicInput=gf,d.parallelExecutionOperationListOfFunctionsBlueprintDynamicOutput=Rf,d.parallelExecutionOperationRef=Of,d.parallelExecutionOperationRefThree=Sf,d.persistedBuiltInBaseEntity=xe,d.persistedBuiltInBaseEntityCreatedAtProperty=fb,d.persistedBuiltInBaseEntityCreatedAtPropertyDataType=pb,d.persistedBuiltInBaseEntityCreatedAtPropertyDataTypeRef=tO,d.persistedBuiltInBaseEntityCreatedAtPropertyParentRef=yb,d.persistedBuiltInBaseEntityCreatedAtPropertyRef=ub,d.persistedBuiltInBaseEntityDatabaseProperty=$i,d.persistedBuiltInBaseEntityDatabasePropertyDataTypeRef=KA,d.persistedBuiltInBaseEntityDatabasePropertyParentRef=nb,d.persistedBuiltInBaseEntityDatabasePropertyRef=tb,d.persistedBuiltInBaseEntityDeletedAtProperty=db,d.persistedBuiltInBaseEntityDeletedAtPropertyDataType=lb,d.persistedBuiltInBaseEntityDeletedAtPropertyDataTypeRef=eO,d.persistedBuiltInBaseEntityDeletedAtPropertyParentRef=cb,d.persistedBuiltInBaseEntityDeletedAtPropertyRef=ob,d.persistedBuiltInBaseEntityIdentifierProperty=sb,d.persistedBuiltInBaseEntityIdentifierPropertyDataTypeRef=rb,d.persistedBuiltInBaseEntityIdentifierPropertyParentRef=ab,d.persistedBuiltInBaseEntityIdentifierPropertyRef=ib,d.persistedBuiltInBaseEntityUpdatedAtProperty=Eb,d.persistedBuiltInBaseEntityUpdatedAtPropertyDataType=mb,d.persistedBuiltInBaseEntityUpdatedAtPropertyDataTypeRef=nO,d.persistedBuiltInBaseEntityUpdatedAtPropertyParentRef=Tb,d.persistedBuiltInBaseEntityUpdatedAtPropertyRef=hb,d.processOutputGlobalValueDescriptorDataType=Vb,d.processOutputGlobalValueDescriptorReturn=Wl,d.processOutputGlobalValueDescriptorReturnRef=Mb,d.projectPublicationCompletedGlobalEvent=ds,d.propertyToZodSchema=Zb,d.relationalDatabaseBuiltInBaseEntity=Nn,d.relationalDatabaseBuiltInBaseEntityAutoscalingProperty=Fl,d.relationalDatabaseBuiltInBaseEntityAutoscalingPropertyDataTypeRef=zE,d.relationalDatabaseBuiltInBaseEntityAutoscalingPropertyParentRef=ZE,d.relationalDatabaseBuiltInBaseEntityAutoscalingPropertyRef=HE,d.relationalDatabaseBuiltInBaseEntityDefaultProperty=$l,d.relationalDatabaseBuiltInBaseEntityDefaultPropertyDataTypeRef=WE,d.relationalDatabaseBuiltInBaseEntityDefaultPropertyRef=YE,d.relationalDatabaseBuiltInBaseEntityIdentifierProperty=ss,d.relationalDatabaseBuiltInBaseEntityIdentifierPropertyDataTypeRef=UE,d.relationalDatabaseBuiltInBaseEntityIdentifierPropertyRef=xE,d.relationalDatabaseBuiltInBaseEntityMinSizeProperty=cs,d.relationalDatabaseBuiltInBaseEntityMinSizePropertyDataTypeRef=qE,d.relationalDatabaseBuiltInBaseEntityMinSizePropertyRef=JE,d.relationalDatabaseBuiltInBaseEntityPasswordProperty=ls,d.relationalDatabaseBuiltInBaseEntityPasswordPropertyDataTypeRef=WA,d.relationalDatabaseBuiltInBaseEntityPasswordPropertyRef=kE,d.relationalDatabaseBuiltInBaseEntityRef=Hr,d.relationalDatabaseBuiltInBaseEntityUsernameProperty=os,d.relationalDatabaseBuiltInBaseEntityUsernamePropertyDataTypeRef=qA,d.relationalDatabaseBuiltInBaseEntityUsernamePropertyRef=jE,d.resolveActionDescriptorName=$P,d.resolveBaseEntityName=NP,d.resolveBuiltInBaseEntityDataTypeLabel=MP,d.resolveConditionOperatorLabel=Ao,d.resolveCustomEntityDataTypeLabel=VP,d.resolveDataType=Do,d.resolveDataTypeEntityOrNestedChildrenFromLiteralValue=Ou,d.resolveDataTypeLabel=lu,d.resolveEntityDataTypeLabel=Wk,d.resolveEntityName=C,d.resolveFirstCallsSecond=t7,d.resolveFirstWritesSecond=n7,d.resolvePrimitiveEntityName=GP,d.resolveSearchName=LP,d.resolveVariableScope=kk,d.sequentialExecutionOperation=hn,d.sequentialExecutionOperationError=Zf,d.sequentialExecutionOperationErrorParentRef=zf,d.sequentialExecutionOperationListOfExecutionResultsDataType=Wf,d.sequentialExecutionOperationListOfExecutionResultsReturn=fl,d.sequentialExecutionOperationListOfExecutionResultsReturnParentRef=Hf,d.sequentialExecutionOperationListOfExecutionResultsReturnRef=Jf,d.sequentialExecutionOperationListOfFunctionsArgument=yl,d.sequentialExecutionOperationListOfFunctionsArgumentDatatype=qf,d.sequentialExecutionOperationListOfFunctionsArgumentParentRef=Yf,d.sequentialExecutionOperationListOfFunctionsArgumentRef=kf,d.sequentialExecutionOperationListOfFunctionsBlueprint=jf,d.sequentialExecutionOperationListOfFunctionsBlueprintDynamicInput=xf,d.sequentialExecutionOperationListOfFunctionsBlueprintDynamicOutput=Uf,d.softDeletePersistedEntityMethod=QE,d.softDeletePersistedEntityMethodParentRef=XE,d.sortCallsBasedOnExecutionDependencies=nA,d.sortChildrenEntitiesBasedOnExecutionDependencies=Q2,d.splitListOperation=ol,d.splitListOperationError=ky,d.splitListOperationErrorParentRef=jy,d.splitListOperationFirstOutputListDataType=_y,d.splitListOperationFirstOutputListReturn=$y,d.splitListOperationFirstOutputListReturnParentRef=Gy,d.splitListOperationFirstOutputListReturnRef=sl,d.splitListOperationInputListArgument=My,d.splitListOperationInputListArgumentParentRef=Ny,d.splitListOperationInputListArgumentRef=Sy,d.splitListOperationInputListDataType=Cy,d.splitListOperationSecondOutputListDataType=Fy,d.splitListOperationSecondOutputListReturn=xy,d.splitListOperationSecondOutputListReturnParentRef=Uy,d.splitListOperationSplitIndexArgument=Ly,d.splitListOperationSplitIndexArgumentParentRef=Vy,d.splitListOperationSplitIndexArgumentRef=By,d.splitListOperationSplitIndexDataType=wy,d.splitStringOperation=il,d.splitStringOperationError=ly,d.splitStringOperationErrorParentRef=oy,d.splitStringOperationFirstPartResultStringDataType=Kp,d.splitStringOperationFirstPartResultStringReturn=sy,d.splitStringOperationFirstPartResultStringReturnParentRef=ay,d.splitStringOperationFirstPartResultStringReturnRef=Zp,d.splitStringOperationIndexArgument=ry,d.splitStringOperationIndexArgumentParentRef=ny,d.splitStringOperationIndexArgumentRef=Hp,d.splitStringOperationIndexDataType=zp,d.splitStringOperationSecondPartResultStringDataType=Qp,d.splitStringOperationSecondPartResultStringReturn=LA,d.splitStringOperationSecondPartResultStringReturnParentRef=iy,d.splitStringOperationSecondPartResultStringReturnRef=Xp,d.splitStringOperationStringArgument=ty,d.splitStringOperationStringArgumentParentRef=ey,d.splitStringOperationStringArgumentRef=Wp,d.splitStringOperationStringDataType=Yp,d.stringPrototype=x,d.stringValueAutogenerationSchema=ed,d.suggestNewIdForEntity=fu,d.test_primitive_entities_export=$7,d.toCamelCase=qk,d.toEntityState=wt,d.toKebabCase=_P,d.toLowerCaseKebabCase=Po,d.toPascalCase=Jk,d.untypedObjectPrototype=Ze,d.updateErrorsList=ae,d.updateValueReader=Ua,d.urlDefaultValue=Ah,d.uuidPrototype=ka,d.validateArgumentDeclarationName=pu,d.validateCalledByErrorIdInAction=q2,d.validateCalledByIdInAction=k2,d.validateCallers=YP,d.validateConditionEntityDeclaration=Y2,d.validateCustomEntityName=Oo,d.validateDataOperation=nr,d.validateDataOperationDataToValidateArgument=hh,d.validateDataOperationDataToValidateArgumentParentRef=fh,d.validateDataOperationDataToValidateArgumentRef=ph,d.validateDataOperationDataToValidateDataType=yh,d.validateDataOperationEntityToMatchTypeArgument=bh,d.validateDataOperationEntityToMatchTypeArgumentParentRef=Eh,d.validateDataOperationEntityToMatchTypeArgumentRef=mh,d.validateDataOperationEntityToMatchTypeDataType=Th,d.validateDataOperationError=Ih,d.validateDataOperationErrorParentRef=vh,d.validateDataOperationOutputEntityDeclaration=gh,d.validateDataOperationOutputEntityDeclarationParentRef=Rh,d.validateEntryCaller=WP,d.validateErrorCaller=JP,d.validateFunctionCallDeclaration=zP,d.validateFunctionDeclarationName=cu,d.validateGeneratedEntityParentIsNotBuiltInEntity=F2,d.validateGeneration=G2,d.validateGenerationTarget=Ne,d.validateGenerationUpdate=$2,d.validateLoopEntityDeclaration=H2,d.validateName=Yk,d.validateOperationEntityDeclaration=ZP,d.validatePropertyName=uu,d.validateReachability=Sn,d.validateReadsValueInActionPayload=J2,d.validateReferenceObject=Co,d.validateReferenceToOne=Eu,d.validateReferences=Je,d.validateReturnDeclarationName=yu,d.validateSuccessCaller=qP,d.validateValueReaderGenerationUpdate=Ga,d.validateValueWritter=Du,d.validateVariableDeclarationName=du,d.validateVariableInternalCallUse=Pu,d.valueAutogenerationCurrentDateAndTimeSchema=qI,d.valueAutogenerationGenericSchema=zs,d.valueAutogenerationOptions=rd,d.valueAutogenerationOptionsSchema=kI,d.valueAutogenerationRandomBooleanSchema=Qc,d.valueAutogenerationRandomDateBetweenSchema=QI,d.valueAutogenerationRandomDateFromSchema=KI,d.valueAutogenerationRandomDateSchema=Xs,d.valueAutogenerationRandomDateUntilSchema=XI,d.valueAutogenerationRandomNumberBetweenSchema=YI,d.valueAutogenerationRandomNumberFromSchema=JI,d.valueAutogenerationRandomNumberSchema=Zs,d.valueAutogenerationRandomNumberUntilSchema=WI,d.valueAutogenerationRandomSchema=Ta,d.valueAutogenerationRandomTextBetweenSchema=ZI,d.valueAutogenerationRandomTextFromSchema=HI,d.valueAutogenerationRandomTextSchema=Ks,d.valueAutogenerationRandomTextUntilSchema=zI,d.valueAutogenerationRangeValueTypesSchema=ma,d.valueAutogenerationUniqueSchema=Xc,d.waitOperation=dt,d.waitOperationMillisecondsNumberArgument=er,d.waitOperationMillisecondsNumberArgumentRef=Nf,d.waitOperationMillisecondsNumberDataType=Mf,d.waitOperationOperationError=Gf,d.waitOperationOperationErrorParentRef=Lf,d.waitOperationRef=Vf,Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})});
|
|
371
|
+
Alternatively you can update the parent data-type entity with 'update' action to remove the existing value of the field.`,issue:null}))}return{errors:a,modifiedData:i}}get extendedProperties(){return g([...this.extends.reduce((e,t)=>[...[...t.properties,...t.extendedProperties].filter(a=>!a.abstract),...e],[]),...this.implements.reduce((e,t)=>[...[...t.properties,...t.extendedProperties].filter(a=>!a.abstract),...e],[])])}validateGeneratedUpdate(e){const t=[];return e.parent&&t.push(new E({id:`${this.id}--${f.InvalidParentUpdate}`,code:f.InvalidParentUpdate,severity:T.Error,message:`Entity of type '${this.type}' with id '${this.id}' cannot have the 'parent' property updated. The 'parent' on an '${this.type}', must be the root project as it is a globally declared entity.`,issue:null})),{errors:t,modifiedData:e}}addSelfToProject(){const e=[this],t=[],i=[];if(this.parent.type===n.DataType){const a=this.parent;a.entity=this,e.push(a)}else this.project.addCustomEntity(this);return{updated:g(e),added:g(t),removed:g(i),self:this}}setParent(e){return this.parent=e,this}removeProperty(e){return this.properties=this.properties.filter(t=>t.id!==e.id),this}addMethod(e){return this.methods.includes(e)||(this.methods.push(e),this.suggestedMethods=this.suggestedMethods.filter(t=>t.name!==e.name)),this}removeMethod(e){return this.methods=this.methods.filter(t=>t.id!==e.id),this}addProperty(e){return this.properties.includes(e)||(this.properties.push(e),this.suggestedProperties=this.suggestedProperties.filter(t=>t.name!==e.name)),this}addSuggestedProperty(e){return this.suggestedProperties.includes(e)||this.suggestedProperties.push(e),this}addSuggestedMethod(e){return this.suggestedMethods.includes(e)||this.suggestedMethods.push(e),this}removeSuggestedProperty(e){return this.suggestedProperties=this.suggestedProperties.filter(t=>t.id!==e.id),this}removeSuggestedMethod(e){return this.suggestedMethods=this.suggestedMethods.filter(t=>t.id!==e.id),this}addAbstractMethod(e){return this.abstractMethods.includes(e)||this.abstractMethods.push(e),this}removeAbstractMethod(e){return this.abstractMethods=this.abstractMethods.filter(t=>t.id!==e.id),this}initChildren(){return this.initialized?this:(this.initialized=!0,this.properties=this.initialData.properties.map(e=>{const t=R(e,this.project);return t.setParent(this),t.initChildren(),t}),this.methods=this.initialData.methods.map(e=>{const t=R(e,this.project);return t.setParent(this),t.initChildren(),t}),this.abstractMethods=this.initialData.abstractMethods.map(e=>{const t=R(e,this.project);return t.setParent(this),t.initChildren(),t}),this.extends=this.initialData.extends.map(e=>R(e,this.project)),this.implements=this.initialData.implements.map(e=>R(e,this.project)),this.addSuggestions(),this)}addSuggestions(){return this.implements.forEach(e=>{J3(this,e).forEach(a=>{const s=a.toJSON();s.id=`_suggestion--parent--${this.id}--${a.id}`;const o=R(s,this.project);o.suggestion=!0,o.setParent(this),o.initChildren(),this.addSuggestedProperty(o)}),W3(this,e).forEach(a=>{const s=`_suggestion--parent--${this.id}--${a.id}`,o=a.implementAsFunctionDeclaration(s),l=R(o,this.project);if(l.suggestion=!0,l.setParent(this),l.initChildren(),l.inputs.forEach(p=>{p.suggestion=!0}),l.returnStatements.length){const p=l.returnStatements[0];p.suggestion=!0,p.outputs.forEach(y=>{y.suggestion=!0})}this.addSuggestedMethod(l)})}),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.x=e.x||this.x,this.y=e.y||this.y,this.static=e.static||this.static,this.abstract=e.abstract||this.abstract,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.properties.forEach(s=>{const{affected:o,removed:l}=s.remove({ignoreUpstream:!0,seenEntities:t});i.push(...o),a.push(...l)}),this.methods.forEach(s=>{const{affected:o,removed:l}=s.remove({ignoreUpstream:!0,seenEntities:t});i.push(...o),a.push(...l)}),this.abstractMethods.forEach(s=>{const{affected:o,removed:l}=s.remove({ignoreUpstream:!0,seenEntities:t});i.push(...o),a.push(...l)}),this.suggestedProperties.forEach(s=>{const{affected:o,removed:l}=s.remove({ignoreUpstream:!0,seenEntities:t});i.push(...o),a.push(...l)}),this.suggestedMethods.forEach(s=>{const{affected:o,removed:l}=s.remove({ignoreUpstream:!0,seenEntities:t});i.push(...o),a.push(...l)}),{affected:g(i),removed:g(a)})}restore({seenEntities:e}={seenEntities:new Set}){const t=[];return e.has(this.id)?{affected:[],self:this}:(e.add(this.id),this.subscribe(),this.properties.forEach(i=>{const{affected:a}=i.restore({seenEntities:e});t.push(...a)}),this.methods.forEach(i=>{const{affected:a}=i.restore({seenEntities:e});t.push(...a)}),this.abstractMethods.forEach(i=>{const{affected:a}=i.restore({seenEntities:e});t.push(...a)}),this.suggestedProperties.forEach(i=>{const{affected:a}=i.restore({seenEntities:e});t.push(...a)}),this.suggestedMethods.forEach(i=>{const{affected:a}=i.restore({seenEntities:e});t.push(...a)}),{affected:g(t),self:this})}toFlat(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this,...this.extends.flatMap(i=>i.toFlat(e)),...this.implements.flatMap(i=>i.toFlat(e)),...this.properties.flatMap(i=>i.toFlat(e)),...this.methods.flatMap(i=>i.toFlat(e)),...this.abstractMethods.flatMap(i=>i.toFlat(e))])}toFlatIds(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.id,...this.extends.flatMap(i=>i.toFlatIds(e)),...this.implements.flatMap(i=>i.toFlatIds(e)),...this.properties.flatMap(i=>i.toFlatIds(e)),...this.methods.flatMap(i=>i.toFlatIds(e)),...this.abstractMethods.flatMap(i=>i.toFlatIds(e))])}toJSON(){return{id:this.id,version:this.version,type:this.type,name:this.name,description:this.description,x:this.x,y:this.y,static:this.static,abstract:this.abstract,properties:this.properties.map(e=>e.toJSON()),methods:this.methods.map(e=>e.toJSON()),abstractMethods:this.abstractMethods.map(e=>e.toJSON()),implements:this.implements.map(e=>e.toJSON()),extends:this.extends.map(e=>e.toJSON()),parent:this.parent.toReference()}}toReference(){return{id:this.id+"--"+N.UUID.uuid()+"--ref",type:n.GenericReference,entityId:this.id,entityType:this.type}}toShallowJSON(){return{id:this.id,version:this.version,name:this.name,description:this.description,type:this.type,x:this.x,y:this.y,static:this.static,abstract:this.abstract,properties:this.properties.map(e=>e.toReference()),methods:this.methods.map(e=>e.toReference()),abstractMethods:this.abstractMethods.map(e=>e.toReference()),implements:this.implements.map(e=>e.toReference()),extends:this.extends.map(e=>e.toReference()),parent:this.parent.toReference()}}toFlatJSON(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toShallowJSON(),...this.properties.flatMap(i=>i.toFlatJSON(e)),...this.methods.flatMap(i=>i.toFlatJSON(e)),...this.abstractMethods.flatMap(i=>i.toFlatJSON(e)),...this.implements.flatMap(i=>i.toFlatJSON(e)),...this.extends.flatMap(i=>i.toFlatJSON(e))])}toGenerationTarget(){const e=this.parent.type===n.Project?void 0:this.parent.id;return{id:this.id,name:this.name,description:this.description,type:this.type,static:this.static,abstract:this.abstract,extends:this.extends.map(t=>t.id),implements:this.implements.map(t=>t.id),parent:e}}toFlatGenerationTarget(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toGenerationTarget(),...this.properties.flatMap(i=>i.toFlatGenerationTarget(e)),...this.methods.flatMap(i=>i.toFlatGenerationTarget(e)),...this.abstractMethods.flatMap(i=>i.toFlatGenerationTarget(e)),...this.implements.filter(i=>i.type===n.CustomEntity).flatMap(i=>i.toFlatGenerationTarget(e)),...this.implements.filter(i=>i.type===n.CustomEntity).flatMap(i=>i.toFlatGenerationTarget(e))])}clearErrors(){return this.errors=[],this.properties.forEach(e=>e.clearErrors()),this.methods.forEach(e=>e.clearErrors()),this.abstractMethods.forEach(e=>e.clearErrors()),this}validate(){return this.errors=q3(this),{success:!0,error:null,data:null}}getErrors(){return[...this.errors,...this.properties.flatMap(t=>t.getErrors()),...this.methods.flatMap(t=>t.getErrors()),...this.abstractMethods.flatMap(t=>t.getErrors())]}getShallowErrors(){return this.errors}clone(e=null,t=null,i=!0){var b,v,P;const a=this.toJSON(),s=t||He(C(this,this.project),n.CustomEntity,this.project);a.properties=[],a.methods=[],a.abstractMethods=[];const o=s.split("-id"),l=o[o.length-1||0]||s;a.id=s;const p=xt(a,this.project);e&&p.setParent(e),i&&p.subscribe(),p.initChildren();const y=(b=this.properties)==null?void 0:b.map((A,I)=>A.clone(p,l+"-property-"+I+"-id",i));p.properties=y;const h=(v=this.methods)==null?void 0:v.map((A,I)=>A.clone(p,l+"-method-"+I+"-id",i));p.methods=h;const m=(P=this.abstractMethods)==null?void 0:P.map((A,I)=>A.clone(p,l+"-abstract-method-"+I+"-id",i));return p.abstractMethods=m,p}getFunctionDeclaration(e){return this.methods.find(t=>t.id===e)}implement(e,t){return Lo(this,e,t)}getAllInteractiveMethods(){const e=this.implements.filter(i=>i.type===n.CustomEntity||i.type===n.BuiltInBaseEntity&&i.interactive);return g([...this.methods,...this.extends.flatMap(i=>i.getAllInteractiveMethods()),...e.flatMap(i=>i.getAllInteractiveMethods())])}inferFromInputs(e){if(this.parent.type!==n.DataType||!this.parent.inferred)return this;const t=[];e.forEach(s=>{t.find(l=>C(l,this.project)===C(s,this.project))||t.push(s)});const i=this.properties.filter(s=>!s.getDataType());t.forEach(s=>{const o=i.find(m=>C(m,this.project)===C(s,this.project));if(!o)return;const p=Or(s.parent).getMasterInputWithValueWritterFromAllInstances(s),y=sn(p),h=y==null?void 0:y.clone(o,o.id+"--data-type",!0);h&&o.setDataType(h),s.setDeclaration(o)});const a=[];return t.forEach(s=>{if(!s.declaration){a.push(s);return}}),a.length===0?this:(a.forEach(s=>{const o=this.properties.find(v=>C(v,this.project)===C(s,this.project));if(o){if(s.setDeclaration(o),!o.getDataType()){const P=Or(s.parent).getMasterInputWithValueWritterFromAllInstances(s),A=sn(P),I=A==null?void 0:A.clone(o,o.id+"--data-type",!0);I&&o.setDataType(I)}return}const l={id:s.id+"--inferred-property",type:n.Property,version:1,name:C(s,this.project),description:s.description,static:!0,abstract:!1,private:!1,hidden:!1,required:!1,index:s.index,implements:null,dataType:null,parent:this.toReference()},p=R(l,this.project);p.setParent(this),p.initChildren();const h=Or(s.parent).getMasterInputWithValueWritterFromAllInstances(s),m=sn(h),b=m==null?void 0:m.clone(p,l.id+"--data-type",!0);return b&&p.setDataType(b),this.addProperty(p),s.setDeclaration(p),p}),this)}};c(Be,"MUTABLE_BASE_PROPERTIES",["name","description","static","abstract"]),c(Be,"INMUTABLE_BASE_PROPERTIES",["id","version","type"]),c(Be,"BASE_PROPERTIES",[...Be.MUTABLE_BASE_PROPERTIES,...Be.INMUTABLE_BASE_PROPERTIES]),c(Be,"MUTABLE_META_PROPERTIES",[...Be.MUTABLE_BASE_PROPERTIES,"x","y"]),c(Be,"INMUTABLE_META_PROPERTIES",[...Be.INMUTABLE_BASE_PROPERTIES]),c(Be,"META_PROPERTIES",[...Be.MUTABLE_META_PROPERTIES,...Be.INMUTABLE_META_PROPERTIES]),c(Be,"MUTABLE_UPSTREAM_PROPERTIES",["extends","implements"]),c(Be,"INMUTABLE_UPSTREAM_PROPERTIES",["parent"]),c(Be,"UPSTREAM_PROPERTIES",[...Be.MUTABLE_UPSTREAM_PROPERTIES,...Be.INMUTABLE_UPSTREAM_PROPERTIES]),c(Be,"MUTABLE_DOWNSTREAM_PROPERTIES",["properties","methods","abstractMethods"]),c(Be,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),c(Be,"DOWNSTREAM_PROPERTIES",[...Be.MUTABLE_DOWNSTREAM_PROPERTIES,...Be.INMUTABLE_DOWNSTREAM_PROPERTIES]),c(Be,"PROPERTIES",[...Be.META_PROPERTIES,...Be.UPSTREAM_PROPERTIES,...Be.DOWNSTREAM_PROPERTIES]);let jr=Be;function m7(r){const e=g9(),t=r.toJSON();e.safeParse(t).success;const a=[];return ae(r.errors,a)}class Ft{constructor(e,t){c(this,"initialData");c(this,"id");c(this,"version");c(this,"name");c(this,"description",null);c(this,"type",n.BuiltInBaseEntity);c(this,"abstract",!1);c(this,"static");c(this,"properties",[]);c(this,"methods",[]);c(this,"abstractMethods",[]);c(this,"extends",[]);c(this,"interactive",!1);c(this,"errors",[]);c(this,"project");this.initialData=this.initialData||e,this.project=this.project||t,this.id=this.id||e.id,this.version=this.version||e.version,this.name=this.name||e.name,this.static=this.static||e.static,this.interactive=this.interactive||e.interactive,this.abstract=e.abstract,this.properties=this.initialData.properties.map(i=>{const a=R(i,this.project);return a.setParent(this),a.initChildren(),a}),this.methods=this.initialData.methods.map(i=>{const a=R(i,this.project);return a.setParent(this),a.initChildren(),a}),this.abstractMethods=this.initialData.abstractMethods.map(i=>{const a=R(i,this.project);return a.setParent(this),a.initChildren(),a}),this.extends=this.initialData.extends.map(i=>R(i,this.project))}get extendedProperties(){return g(this.extends.reduce((e,t)=>{const i=[...t.properties,...t.extendedProperties].filter(a=>!a.abstract);return[...e,...i]},[]))}subscribe(){return this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}async load(){return this}remove(e={ignoreUpstream:!1,seenEntities:new Set}){return{affected:[],removed:[]}}restore({seenEntities:e}={seenEntities:new Set}){return{affected:[],self:this}}toFlat(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this,...this.properties.flatMap(i=>i.toFlat(e)),...this.methods.flatMap(i=>i.toFlat(e)),...this.abstractMethods.flatMap(i=>i.toFlat(e)),...this.extends.flatMap(i=>i.toFlat(e))])}toFlatIds(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.id,...this.properties.flatMap(i=>i.toFlatIds(e)),...this.methods.flatMap(i=>i.toFlatIds(e)),...this.abstractMethods.flatMap(i=>i.toFlatIds(e)),...this.extends.flatMap(i=>i.toFlatIds(e))])}toJSON(){return{id:this.id,version:this.version,type:this.type,name:this.name,description:this.description,abstract:this.abstract,static:this.static,interactive:this.interactive,properties:this.properties.map(e=>e.toJSON()),methods:this.methods.map(e=>e.toJSON()),abstractMethods:this.abstractMethods.map(e=>e.toJSON()),extends:this.extends.map(e=>e.toJSON())}}toReference(){return{id:this.id+"--"+N.UUID.uuid()+"--ref",type:n.GenericReference,entityId:this.id,entityType:this.type}}toShallowJSON(){return{id:this.id,version:this.version,type:this.type,name:this.name,description:this.description,abstract:this.abstract,static:this.static,interactive:this.interactive,properties:this.properties.map(e=>e.toReference()),methods:this.methods.map(e=>e.toReference()),abstractMethods:this.abstractMethods.map(e=>e.toReference()),extends:this.extends.map(e=>e.toReference())}}toFlatJSON(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toShallowJSON(),...this.properties.flatMap(i=>i.toFlatJSON(e)),...this.methods.flatMap(i=>i.toFlatJSON(e)),...this.abstractMethods.flatMap(i=>i.toFlatJSON(e))])}toGenerationTarget(){return{id:this.id,type:this.type,name:this.name,description:this.description,static:this.static,abstract:this.abstract,interactive:this.interactive,extends:this.extends.map(e=>e.id)}}toFlatGenerationTarget(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toGenerationTarget(),...this.properties.flatMap(i=>i.toFlatGenerationTarget(e)),...this.methods.flatMap(i=>i.toFlatGenerationTarget(e)),...this.abstractMethods.flatMap(i=>i.toFlatGenerationTarget(e))])}clearErrors(){return this.errors=[],this.properties.forEach(e=>e.clearErrors()),this.methods.forEach(e=>e.clearErrors()),this.abstractMethods.forEach(e=>e.clearErrors()),this}validate(){const e=m7(this);return this.errors=e,{success:!0,error:null,data:this.toJSON()}}getErrors(){return[...this.errors,...this.properties.flatMap(t=>t.getErrors()),...this.methods.flatMap(t=>t.getErrors()),...this.abstractMethods.flatMap(t=>t.getErrors())]}getShallowErrors(){return this.errors}clone(){return new Ft(this.toJSON(),this.project)}implement(e,t){return Lo(this,e,t)}getAllInteractiveMethods(){const e=[];return this.interactive&&(e.push(...this.methods),this.extends.filter(i=>i.type===n.BuiltInBaseEntity&&i.interactive||i.type===n.PrimitiveEntity).forEach(i=>{i instanceof Ft&&e.push(...i.getAllInteractiveMethods())})),g(e)}}function T7(r){const e=p9(),t=r.toJSON();e.safeParse(t).success;const a=[];return ae(r.errors,a)}class Ut{constructor(e,t){c(this,"initialData");c(this,"id");c(this,"version");c(this,"name");c(this,"description",null);c(this,"type",n.PrimitiveEntity);c(this,"static");c(this,"abstract");c(this,"properties",[]);c(this,"methods",[]);c(this,"abstractMethods",[]);c(this,"extends",[]);c(this,"errors",[]);c(this,"project");this.initialData=e,this.project=t,this.id=e.id,this.version=e.version,this.name=e.name,this.static=e.static,this.abstract=e.abstract,this.properties=this.initialData.properties.map(i=>{const a=R(i,this.project);return a.setParent(this),a.initChildren(),a}),this.methods=this.initialData.methods.map(i=>{const a=R(i,this.project);return a.parent=this,a}),this.abstractMethods=this.initialData.abstractMethods.map(i=>{const a=R(i,this.project);return a.parent=this,a})}get extendedProperties(){return g(this.extends.reduce((e,t)=>{const i=[...t.properties,...t.extendedProperties].filter(a=>!a.abstract);return[...e,...i]},[]))}subscribe(){return this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}async load(){return this}remove({ignoreUpstream:e,seenEntities:t}={ignoreUpstream:!1,seenEntities:new Set}){return{affected:[],removed:[]}}restore({seenEntities:e}={seenEntities:new Set}){return{affected:[],self:this}}toFlat(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this,...this.properties.flatMap(i=>i.toFlat(e)),...this.methods.flatMap(i=>i.toFlat(e)),...this.abstractMethods.flatMap(i=>i.toFlat(e))])}toFlatIds(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.id,...this.properties.flatMap(i=>i.toFlatIds(e)),...this.methods.flatMap(i=>i.toFlatIds(e)),...this.abstractMethods.flatMap(i=>i.toFlatIds(e))])}toJSON(){return{id:this.id,version:this.version,type:this.type,name:this.name,description:this.description,static:this.static,abstract:this.abstract,properties:this.properties.map(e=>e.toJSON()),methods:this.methods.map(e=>e.toJSON()),abstractMethods:this.abstractMethods.map(e=>e.toJSON()),extends:this.extends.map(e=>e.toJSON())}}toReference(){return{id:this.id+"--"+N.UUID.uuid()+"--ref",type:n.GenericReference,entityId:this.id,entityType:this.type}}toShallowJSON(){return{id:this.id,version:this.version,type:this.type,name:this.name,description:this.description,abstract:this.abstract,static:this.static,properties:this.properties.map(e=>e.toReference()),methods:this.methods.map(e=>e.toReference()),abstractMethods:this.abstractMethods.map(e=>e.toReference()),extends:this.extends.map(e=>e.toReference())}}toFlatJSON(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toShallowJSON(),...this.properties.flatMap(i=>i.toFlatJSON(e)),...this.methods.flatMap(i=>i.toFlatJSON(e)),...this.abstractMethods.flatMap(i=>i.toFlatJSON(e))])}toGenerationTarget(){return{id:this.id,type:this.type,name:this.name,description:this.description,static:this.static,abstract:this.abstract,extends:this.extends.map(e=>e.id)}}toFlatGenerationTarget(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toGenerationTarget(),...this.properties.flatMap(i=>i.toFlatGenerationTarget(e)),...this.methods.flatMap(i=>i.toFlatGenerationTarget(e)),...this.abstractMethods.flatMap(i=>i.toFlatGenerationTarget(e))])}clearErrors(){return this.errors=[],this.properties.forEach(e=>e.clearErrors()),this.methods.forEach(e=>e.clearErrors()),this.abstractMethods.forEach(e=>e.clearErrors()),this}validate(){const e=T7(this);return this.errors=e,{success:!0,error:null,data:this.toJSON()}}getErrors(){return[...this.errors,...this.properties.flatMap(t=>t.getErrors()),...this.methods.flatMap(t=>t.getErrors()),...this.abstractMethods.flatMap(t=>t.getErrors())]}getShallowErrors(){return this.errors}clone(){return new Ut(this.toJSON(),this.project)}getAllInteractiveMethods(){const e=[];return e.push(...this.methods),this.extends.filter(i=>i.type===n.BuiltInBaseEntity&&i.interactive||i.type===n.PrimitiveEntity).forEach(i=>{i instanceof Ft&&e.push(...i.getAllInteractiveMethods())}),g(e)}}function xt(r,e){if(!r)throw new Error("Entity is null");const t=e.get(r.id);switch(r.type){case n.PrimitiveValue:return t||new Ai(r,e);case n.CustomEntity:return t||new jr(r,e);case n.PrimitiveEntity:return t||new Ut(r,e);case n.FunctionDeclaration:return t||new Cr(r,e);case n.GlobalEvent:return t||new Di(r,e);case n.DataType:return t||new Ii(r,e);case n.Property:return t||new Sr(r,e);case n.FunctionCall:return t||new Ur(r,e);case n.Condition:return t||new _r(r,e);case n.Operation:return t||new Br(r,e);case n.VariableDeclaration:return t||new Nr(r,e);case n.VariableInstance:return t||new Mr(r,e);case n.OutputMap:return t||new On(r,e);case n.ReturnDeclaration:return t||new Bt(r,e);case n.ArgumentDeclaration:return t||new Gr(r,e);case n.InputMap:return t||new An(r,e);case n.Project:return t||new N(r);case n.InstalledProject:return t||new Lr(r,e);case n.ActionDescriptor:return t||new te(r,e);case n.ReturnStatement:return t||new $r(r,e);case n.Loop:return t||new wr(r,e);case n.Search:return t||new Vr(r,e);case n.ValueDescriptor:return t||new Fr(r,e);case n.BuiltInBaseEntity:return t||new Ft(r,e);case n.InternalCall:return t||new Pi(r,e);case n.ContinueStatement:return t||new Tt(r,e);case n.BreakStatement:return t||new Oi(r,e);default:throw new Error("Invalid entity type: "+r.type)}}function R(r,e){if(!r)throw new Error("Entity is null");const t=xt(r,e);return t.subscribe(),t}function E7(r,e){if(!r)throw new Error("Entity is null");switch(r.type){case n.PrimitiveValue:return Ai.fromGenerationTarget(r,e);case n.CustomEntity:return jr.fromGenerationTarget(r,e);case n.FunctionDeclaration:return Cr.fromGenerationTarget(r,e);case n.GlobalEvent:return Di.fromGenerationTarget(r,e);case n.DataType:return Ii.fromGenerationTarget(r,e);case n.Property:return Sr.fromGenerationTarget(r,e);case n.FunctionCall:return Ur.fromGenerationTarget(r,e);case n.Condition:return _r.fromGenerationTarget(r,e);case n.Operation:return Br.fromGenerationTarget(r,e);case n.VariableDeclaration:return Nr.fromGenerationTarget(r,e);case n.VariableInstance:return Mr.fromGenerationTarget(r,e);case n.OutputMap:return On.fromGenerationTarget(r,e);case n.ReturnDeclaration:return Bt.fromGenerationTarget(r,e);case n.ArgumentDeclaration:return Gr.fromGenerationTarget(r,e);case n.InputMap:return An.fromGenerationTarget(r,e);case n.InstalledProject:return Lr.fromGenerationTarget(r,e);case n.ReturnStatement:return $r.fromGenerationTarget(r,e);case n.Loop:return wr.fromGenerationTarget(r,e);case n.Search:return Vr.fromGenerationTarget(r,e);case n.ActionDescriptor:return te.fromGenerationTarget(r,e);case n.ValueDescriptor:return Fr.fromGenerationTarget(r,e);case n.InternalCall:return Pi.fromGenerationTarget(r,e);case n.ContinueStatement:return Tt.fromGenerationTarget(r,e);case n.BreakStatement:return Oi.fromGenerationTarget(r,e);default:throw new Error("Invalid entity type: "+r.type)}}const ee=class ee{constructor(e){c(this,"initialData");c(this,"id");c(this,"version");c(this,"type",n.Project);c(this,"name",null);c(this,"description",null);c(this,"x");c(this,"y");c(this,"entities",[]);c(this,"projects",[]);c(this,"functions",[]);c(this,"events",[]);c(this,"variableDeclarations",[]);c(this,"variableInstances",[]);c(this,"conditions",[]);c(this,"operations",[]);c(this,"functionCalls",[]);c(this,"loops",[]);c(this,"searches",[]);c(this,"primitives",[]);c(this,"builtInBaseEntities",[]);c(this,"operationDeclarations",[]);c(this,"globalEventActionDescriptors",[]);c(this,"loopDeclarations",[]);c(this,"loopDeclarationsBodies",[]);c(this,"conditionDeclarations",[]);c(this,"valueDescriptors",[]);c(this,"dataTypes",[]);c(this,"project");c(this,"instances",{});c(this,"builtInInstances",{});c(this,"errors",[]);c(this,"references",[]);this.initialData=e,this.id=e.id,this.version=e.version,this.name=e.name,this.description=e.description,this.x=0,this.y=0;try{(!ee.UUID||ee.UUID.isBackup)&&(ee.UUID=Vs==null?void 0:Vs()),ee.UUID||(ee.UUID={isBackup:!0,uuid:()=>Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15),fromUUID:t=>t})}catch(t){console.error("Error initializing UUID module",t),ee.UUID={isBackup:!0,uuid:()=>Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15),fromUUID:i=>i}}}static injectUUIDModule(e){ee.UUID=e}static validateGenerationTarget(e,t){let i=JSON.parse(JSON.stringify(e));const a=[];return a.push(...Ne(i)),{errors:a,modifiedData:i}}async inject(...e){return await Promise.all(e.map(t=>new Promise(async i=>{await t.init(this),i(null)}))),this}validateGeneratedUpdate(e){return{errors:[],modifiedData:e}}addSelfToProject(){const e=[this],t=[],i=[];return{updated:g(e),added:g(t),removed:g(i),self:this}}get instancesList(){return Object.values(this.instances)}isOperationDeclaration(e){return this.operationDeclarations.includes(e)}isGlobalEventActionDescriptor(e){return this.globalEventActionDescriptors.includes(e)}isLoopDeclaration(e){return this.loopDeclarations.includes(e)}isConditionDeclaration(e){return this.conditionDeclarations.includes(e)}initChildren(){return this.entities=this.initialData.entities.map(e=>{const t=R(e,this);return t.setParent(this),t.initChildren(),t}),this.projects=this.initialData.projects.map(e=>{const t=R(e,this);return t.setParent(this),t.initChildren(),t}),this.functions=this.initialData.functions.map(e=>{const t=R(e,this);return t.setParent(this),t.initChildren(),t}),this.events=this.initialData.events.map(e=>{const t=R(e,this);return t.setParent(this),t.initChildren(),t}),this.variableDeclarations=this.initialData.variableDeclarations.map(e=>{const t=R(e,this);return t.setParent(this),t.initChildren(),t}),this.variableInstances=this.initialData.variableInstances.map(e=>{const t=R(e,this);return t.setParent(this),t.initChildren(),t}),this.conditions=this.initialData.conditions.map(e=>{const t=R(e,this);return t.setParent(this),t.initChildren(),t}),this.operations=this.initialData.operations.map(e=>{const t=R(e,this);return t.setParent(this),t.initChildren(),t}),this.functionCalls=this.initialData.functionCalls.map(e=>{const t=R(e,this);return t.setParent(this),t.initChildren(),t}),this.loops=this.initialData.loops.map(e=>{const t=R(e,this);return t.setParent(this),t.initChildren(),t}),this.searches=this.initialData.searches.map(e=>{const t=R(e,this);return t.setParent(this),t.initChildren(),t}),this.attachOrphanReferences(),this.validate(),this}subscribeInstance(e){return(!this.instances[e.id]||this.instances[e.id]!==e)&&(this.instances[e.id]=e),this}subscribeBuiltInInstance(e){return(!this.builtInInstances[e.id]||this.builtInInstances[e.id]!==e)&&(this.builtInInstances[e.id]=e),this}subscribe(){return this}unsubscribe(){return this}unsubscribeInstance(e){return delete this.instances[e.id],this}findSubscribedInstance(e){return this.instances[e.id]||null}findSubscribedBuiltInInstance(e){return this.builtInInstances[e.id]||null}get(e){return this.instances[e]||this.builtInInstances[e]||null}getManaged(e){return this.instances[e]||null}getBuiltIn(e){return this.builtInInstances[e]||null}findSubscribedInstanceFromReference(e){return this.instances[e.entityId]||null}findSubscribedBuiltInInstanceFromReference(e){return this.builtInInstances[e.entityId]||null}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}async delete(){return this}remove({ignoreUpstream:e}={ignoreUpstream:!1}){return{affected:[],removed:[]}}restore({seenEntities:e}={seenEntities:new Set}){return{affected:[],self:this}}getAllBuiltInIds(){const e=new Set;return[...this.primitives.flatMap(t=>t.toFlatIds(e)),...this.builtInBaseEntities.flatMap(t=>t.toFlatIds(e)),...this.operationDeclarations.flatMap(t=>t.toFlatIds(e)),...this.globalEventActionDescriptors.flatMap(t=>t.toFlatIds(e)),...this.loopDeclarations.flatMap(t=>t.toFlatIds(e)),...this.conditionDeclarations.flatMap(t=>t.toFlatIds(e)),...this.valueDescriptors.flatMap(t=>t.toFlatIds(e)),...this.dataTypes.flatMap(t=>t.toFlatIds(e))]}getAllBuiltIn(){const e=new Set;return[...this.primitives.flatMap(t=>t.toFlat(e)),...this.builtInBaseEntities.flatMap(t=>t.toFlat(e)),...this.operationDeclarations.flatMap(t=>t.toFlat(e)),...this.globalEventActionDescriptors.flatMap(t=>t.toFlat(e)),...this.loopDeclarations.flatMap(t=>t.toFlat(e)),...this.conditionDeclarations.flatMap(t=>t.toFlat(e)),...this.valueDescriptors.flatMap(t=>t.toFlat(e)),...this.dataTypes.flatMap(t=>t.toFlat(e))]}toFlat(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[...this.entities.flatMap(i=>i.toFlat(e)),...this.functions.flatMap(i=>i.toFlat(e)),...this.events.flatMap(i=>i.toFlat(e)),...this.projects.flatMap(i=>i.toFlat(e)),...this.variableDeclarations.flatMap(i=>i.toFlat(e)),...this.variableInstances.flatMap(i=>i.toFlat(e)),...this.conditions.flatMap(i=>i.toFlat(e)),...this.operations.flatMap(i=>i.toFlat(e)),...this.functionCalls.flatMap(i=>i.toFlat(e)),...this.loops.flatMap(i=>i.toFlat(e)),...this.searches.flatMap(i=>i.toFlat(e))])}toFlatIds(e=new Set){return e.has(this.id)?[]:(e.add(this.id),Array.from(e))}toJSON(){return{id:this.id,version:this.version,type:this.type,name:this.name,description:this.description,entities:this.entities.map(e=>e.toJSON()),functions:this.functions.map(e=>e.toJSON()),events:this.events.map(e=>e.toJSON()),projects:this.projects.map(e=>e.toJSON()),variableDeclarations:this.variableDeclarations.map(e=>e.toJSON()),variableInstances:this.variableInstances.map(e=>e.toJSON()),conditions:this.conditions.map(e=>e.toJSON()),operations:this.operations.map(e=>e.toJSON()),functionCalls:this.functionCalls.map(e=>e.toJSON()),loops:this.loops.map(e=>e.toJSON()),searches:this.searches.map(e=>e.toJSON())}}toReference(){return{id:this.id+"--"+ee.UUID.uuid()+"--ref",type:n.GenericReference,entityId:this.id,entityType:this.type}}toShallowJSON(){return{id:this.id,version:this.version,type:this.type,name:this.name,description:this.description,entities:this.entities.map(e=>e.toReference()),functions:this.functions.map(e=>e.toReference()),events:this.events.map(e=>e.toReference()),projects:this.projects.map(e=>e.toReference()),variableDeclarations:this.variableDeclarations.map(e=>e.toReference()),variableInstances:this.variableInstances.map(e=>e.toReference()),conditions:this.conditions.map(e=>e.toReference()),operations:this.operations.map(e=>e.toReference()),functionCalls:this.functionCalls.map(e=>e.toReference()),loops:this.loops.map(e=>e.toReference()),searches:this.searches.map(e=>e.toReference())}}toFlatJSON(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[...this.entities.flatMap(i=>i.toFlatJSON(e)),...this.functions.flatMap(i=>i.toFlatJSON(e)),...this.events.flatMap(i=>i.toFlatJSON(e)),...this.projects.flatMap(i=>i.toFlatJSON(e)),...this.variableDeclarations.flatMap(i=>i.toFlatJSON(e)),...this.variableInstances.flatMap(i=>i.toFlatJSON(e)),...this.conditions.flatMap(i=>i.toFlatJSON(e)),...this.operations.flatMap(i=>i.toFlatJSON(e)),...this.functionCalls.flatMap(i=>i.toFlatJSON(e)),...this.loops.flatMap(i=>i.toFlatJSON(e)),...this.searches.flatMap(i=>i.toFlatJSON(e))])}toGenerationTarget(){return{id:this.id,type:this.type,name:this.name,description:this.description}}toFlatGenerationTarget(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[...this.entities.flatMap(i=>i.toFlatGenerationTarget(e)),...this.functions.flatMap(i=>i.toFlatGenerationTarget(e)),...this.events.flatMap(i=>i.toFlatGenerationTarget(e)),...this.projects.flatMap(i=>i.toFlatGenerationTarget(e)),...this.variableDeclarations.flatMap(i=>i.toFlatGenerationTarget(e)),...this.variableInstances.flatMap(i=>i.toFlatGenerationTarget(e)),...this.conditions.flatMap(i=>i.toFlatGenerationTarget(e)),...this.operations.flatMap(i=>i.toFlatGenerationTarget(e)),...this.functionCalls.flatMap(i=>i.toFlatGenerationTarget(e)),...this.loops.flatMap(i=>i.toFlatGenerationTarget(e)),...this.searches.flatMap(i=>i.toFlatGenerationTarget(e))])}clearErrors(){return this.errors=[],this.entities.forEach(e=>e.clearErrors()),this.projects.forEach(e=>e.clearErrors()),this.functions.forEach(e=>e.clearErrors()),this.events.forEach(e=>e.clearErrors()),this.variableDeclarations.forEach(e=>e.clearErrors()),this.variableInstances.forEach(e=>e.clearErrors()),this.conditions.forEach(e=>e.clearErrors()),this.operations.forEach(e=>e.clearErrors()),this.functionCalls.forEach(e=>e.clearErrors()),this.loops.forEach(e=>e.clearErrors()),this.searches.forEach(e=>e.clearErrors()),this}validate(){const e=$3(),t=this.toJSON();return e.safeParse(t),this.validateChildren(),{success:!0,error:null,data:t}}validateChildren(){this.entities.forEach(e=>e.validate()),this.projects.forEach(e=>e.validate()),this.functions.forEach(e=>e.validate()),this.events.forEach(e=>e.validate()),this.variableDeclarations.forEach(e=>e.validate()),this.variableInstances.forEach(e=>e.validate()),this.conditions.forEach(e=>e.validate()),this.operations.forEach(e=>e.validate()),this.functionCalls.forEach(e=>e.validate()),this.loops.forEach(e=>e.validate()),this.searches.forEach(e=>e.validate())}getErrors(){return[...this.errors,...this.entities.flatMap(t=>t.getErrors()),...this.projects.flatMap(t=>t.getErrors()),...this.functions.flatMap(t=>t.getErrors()),...this.events.flatMap(t=>t.getErrors()),...this.variableDeclarations.flatMap(t=>t.getErrors()),...this.variableInstances.flatMap(t=>t.getErrors()),...this.conditions.flatMap(t=>t.getErrors()),...this.operations.flatMap(t=>t.getErrors()),...this.functionCalls.flatMap(t=>t.getErrors()),...this.loops.flatMap(t=>t.getErrors()),...this.searches.flatMap(t=>t.getErrors())]}getShallowErrors(){return this.errors}clone(){return new ee(this.toJSON())}getCustomEntity(e){return this.entities.find(t=>t.id===e)||null}addCustomEntityFromTransfer(e){const t=R(e,this);return this.addCustomEntity(t),t}addCustomEntity(e){return this.entities.includes(e)||this.entities.push(e),e}addFunctionDeclarationFromTransfer(e){const t=R(e,this);return this.addFunctionDeclaration(t),t}addFunctionDeclaration(e){return this.functions.includes(e)||this.functions.push(e),e}addFunctionCallFromTransfer(e){const t=R(e,this);return this.addFunctionCall(t),t}addFunctionCall(e){return this.functionCalls.includes(e)||this.functionCalls.push(e),e}addVariableDeclarationFromTransfer(e){const t=R(e,this);return this.addVariableDeclaration(t),t}addVariableDeclaration(e){return this.variableDeclarations.includes(e)||this.variableDeclarations.push(e),e}addVariableInstanceFromTransfer(e){const t=R(e,this);return this.addVariableInstance(t),t}addVariableInstance(e){return this.variableInstances.includes(e)||this.variableInstances.push(e),e}addInstalledProjectFromTransfer(e){const t=R(e,this);return this.addInstalledProject(t),this}addInstalledProject(e){return this.projects.includes(e)||this.projects.push(e),this}addGlobalEventFromTransfer(e){const t=R(e,this);return this.addGlobalEvent(t),this}addGlobalEvent(e){return this.events.includes(e)||this.events.push(e),this}addConditionFromTransfer(e){const t=R(e,this);return this.addCondition(t),this}addCondition(e){return this.conditions.includes(e)||this.conditions.push(e),this}addOperationFromTransfer(e){const t=R(e,this);return this.addOperation(t),this}addOperation(e){return this.operations.includes(e)||this.operations.push(e),this}addLoopFromTransfer(e){const t=R(e,this);return this.addLoop(t),this}addLoop(e){return this.loops.includes(e)||this.loops.push(e),this}addSearchFromTransfer(e){const t=R(e,this);return this.addSearch(t),this}addSearch(e){return this.searches.includes(e)||this.searches.push(e),this}removeCustomEntity(e){const t=this.entities.findIndex(i=>i.id===e.id);if(t>-1){const i=this.entities[t];return this.entities.splice(t,1),i}return null}removeFunctionDeclaration(e){const t=this.functions.findIndex(i=>i.id===e.id);if(t>-1){const i=this.functions[t];return this.functions.splice(t,1),i}return null}removeExternalProject(e){const t=this.projects.findIndex(i=>i.id===e.id);if(t>-1){const i=this.projects[t];return this.projects.splice(t,1),i}return null}removeGlobalEvent(e){const t=this.events.findIndex(i=>i.id===e.id);if(t>-1){const i=this.events[t];return this.events.splice(t,1),i}return null}removeTopLevelVariableDeclaration(e){if(e.type!==n.VariableDeclaration)return null;const t=this.variableDeclarations.findIndex(i=>i.id===e.id);if(t>-1){const i=this.variableDeclarations[t];return this.variableDeclarations.splice(t,1),i}return null}getEntryPoints(){return[...this.functions,...this.events,...this.entities.flatMap(t=>t.methods)]}getFunctionDeclaration(e){return this.functions.find(t=>t.id===e)||null}getConditions(){return[...this.conditions,...this.getEntryPoints().reduce((t,i)=>{const a=we(i);return[...t,...a.filter(s=>s.type===n.Condition)]},[]),...this.functionCalls.reduce((t,i)=>{const a=we(i);return[...t,...a.filter(s=>s.type===n.Condition)]},[]),...this.operations.reduce((t,i)=>{const a=we(i);return[...t,...a.filter(s=>s.type===n.Condition)]},[]),...this.loops.reduce((t,i)=>{const a=we(i);return[...t,...a.filter(s=>s.type===n.Condition)]},[]),...this.searches.reduce((t,i)=>{const a=we(i);return[...t,...a.filter(s=>s.type===n.Condition)]},[])]}getOperations(){return[...this.operations,...this.getEntryPoints().reduce((t,i)=>{const a=we(i);return[...t,...a.filter(s=>s.type===n.Operation)]},[]),...this.functionCalls.reduce((t,i)=>{const a=we(i);return[...t,...a.filter(s=>s.type===n.Operation)]},[]),...this.conditions.reduce((t,i)=>{const a=we(i);return[...t,...a.filter(s=>s.type===n.Operation)]},[]),...this.loops.reduce((t,i)=>{const a=we(i);return[...t,...a.filter(s=>s.type===n.Operation)]},[]),...this.searches.reduce((t,i)=>{const a=we(i);return[...t,...a.filter(s=>s.type===n.Operation)]},[])]}getFunctionCalls(){return[...this.functionCalls,...this.getEntryPoints().reduce((t,i)=>{const a=we(i);return[...t,...a.filter(s=>s.type===n.FunctionCall)]},[]),...this.conditions.reduce((t,i)=>{const a=we(i);return[...t,...a.filter(s=>s.type===n.FunctionCall)]},[]),...this.operations.reduce((t,i)=>{const a=we(i);return[...t,...a.filter(s=>s.type===n.FunctionCall)]},[]),...this.loops.reduce((t,i)=>{const a=we(i);return[...t,...a.filter(s=>s.type===n.FunctionCall)]},[]),...this.searches.reduce((t,i)=>{const a=we(i);return[...t,...a.filter(s=>s.type===n.FunctionCall)]},[])]}getVariables(){return[...this.variableDeclarations,...this.getEntryPoints().reduce((t,i)=>{const a=ie(i);return[...t,...a]},[]),...this.functionCalls.reduce((t,i)=>{const a=ie(i);return[...t,...a]},[]),...this.conditions.reduce((t,i)=>{const a=ie(i);return[...t,...a]},[]),...this.operations.reduce((t,i)=>{const a=ie(i);return[...t,...a]},[]),...this.loops.reduce((t,i)=>{const a=ie(i);return[...t,...a]},[]),...this.searches.reduce((t,i)=>{const a=ie(i);return[...t,...a]},[])]}getVariableInstances(){return[...this.variableInstances,...this.getEntryPoints().reduce((t,i)=>{const s=ie(i).filter(o=>o.type===n.VariableInstance);return[...t,...s]},[]),...this.functionCalls.reduce((t,i)=>{const s=ie(i).filter(o=>o.type===n.VariableInstance);return[...t,...s]},[]),...this.conditions.reduce((t,i)=>{const s=ie(i).filter(o=>o.type===n.VariableInstance);return[...t,...s]},[]),...this.operations.reduce((t,i)=>{const s=ie(i).filter(o=>o.type===n.VariableInstance);return[...t,...s]},[]),...this.loops.reduce((t,i)=>{const s=ie(i).filter(o=>o.type===n.VariableInstance);return[...t,...s]},[]),...this.searches.reduce((t,i)=>{const s=ie(i).filter(o=>o.type===n.VariableInstance);return[...t,...s]},[])]}getVariableDeclarations(){return g([...this.variableDeclarations,...this.getEntryPoints().reduce((t,i)=>{const s=ie(i).filter(o=>o.type===n.VariableDeclaration);return[...t,...s]},[]),...this.functionCalls.reduce((t,i)=>{const s=ie(i).filter(o=>o.type===n.VariableDeclaration);return[...t,...s]},[]),...this.conditions.reduce((t,i)=>{const s=ie(i).filter(o=>o.type===n.VariableDeclaration);return[...t,...s]},[]),...this.operations.reduce((t,i)=>{const s=ie(i).filter(o=>o.type===n.VariableDeclaration);return[...t,...s]},[]),...this.loops.reduce((t,i)=>{const s=ie(i).filter(o=>o.type===n.VariableDeclaration);return[...t,...s]},[]),...this.searches.reduce((t,i)=>{const s=ie(i).filter(o=>o.type===n.VariableDeclaration);return[...t,...s]},[])])}attachOrphanReferences(){const e=this.getVariableInstances(),t=this.getVariableDeclarations();return e.forEach(i=>{if(!i.declaration){const a=i.initialData,s=a.declaration.entityId||a.declaration.id,o=t.find(l=>l.id===s);o&&i.setDeclaration(o)}}),this}getBuiltInPersistedEntity(){return this.builtInBaseEntities.find(e=>e.name===L.PERSISTED_ENTITY)||null}};c(ee,"UUID",{isBackup:!0,uuid:()=>Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15),fromUUID:e=>e}),c(ee,"MUTABLE_BASE_PROPERTIES",["name","description"]),c(ee,"INMUTABLE_BASE_PROPERTIES",["id","type","version"]),c(ee,"BASE_PROPERTIES",[...ee.MUTABLE_BASE_PROPERTIES,...ee.INMUTABLE_BASE_PROPERTIES]),c(ee,"MUTABLE_META_PROPERTIES",[...ee.MUTABLE_BASE_PROPERTIES,"x","y"]),c(ee,"INMUTABLE_META_PROPERTIES",[...ee.INMUTABLE_BASE_PROPERTIES]),c(ee,"META_PROPERTIES",[...ee.MUTABLE_META_PROPERTIES,...ee.INMUTABLE_META_PROPERTIES]),c(ee,"MUTABLE_UPSTREAM_PROPERTIES",[]),c(ee,"INMUTABLE_UPSTREAM_PROPERTIES",["primitives","builtInBaseEntities","operationDeclarations","globalEventActionDescriptors","loopDeclarations","builtInInstances"]),c(ee,"UPSTREAM_PROPERTIES",[...ee.MUTABLE_UPSTREAM_PROPERTIES,...ee.INMUTABLE_UPSTREAM_PROPERTIES]),c(ee,"MUTABLE_DOWNSTREAM_PROPERTIES",["entities","projects","functions","events","variableDeclarations","variableInstances","conditions","operations","functionCalls","loops","searches"]),c(ee,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),c(ee,"DOWNSTREAM_PROPERTIES",[...ee.MUTABLE_DOWNSTREAM_PROPERTIES,...ee.INMUTABLE_DOWNSTREAM_PROPERTIES]),c(ee,"PROPERTIES",[...ee.META_PROPERTIES,...ee.UPSTREAM_PROPERTIES,...ee.DOWNSTREAM_PROPERTIES]);let N=ee;class AA extends te{constructor(t){super(qt,t);c(this,"id",_e.Parallel);c(this,"name",_e.Parallel);c(this,"description","Execute a list of actions one after the other");c(this,"version",1);c(this,"autoexecutable",!0);c(this,"initialData",qt);c(this,"type",n.ActionDescriptor);c(this,"inputs",[]);c(this,"outputs",[]);c(this,"error",null);c(this,"project");this.project=t,this.inputs=qt.inputs.map(i=>{const a=R(i,this.project);return a.setParent(this),a.initChildren(),a}),this.outputs=qt.outputs.map(i=>{const a=R(i,this.project);return a.setParent(this),a.initChildren(),a}),this.error=qt.error?R(qt.error,this.project):null}}class OA extends te{constructor(t){super(dt,t);c(this,"id",dt.id);c(this,"name",dt.name);c(this,"description",dt.description);c(this,"version",dt.version);c(this,"autoexecutable",!1);c(this,"initialData",dt);c(this,"type",n.ActionDescriptor);c(this,"inputs",[]);c(this,"outputs",[]);c(this,"error",null);c(this,"project");this.project=t,this.inputs=dt.inputs.map(i=>{const a=R(i,this.project);return a.setParent(this),a.initChildren(),a}),this.outputs=dt.outputs.map(i=>{const a=R(i,this.project);return a.setParent(this),a.initChildren(),a}),this.error=dt.error?R(dt.error,this.project):null}}class SA extends te{constructor(t){super(hn,t);c(this,"id",_e.Sequential);c(this,"name",_e.Sequential);c(this,"description","Execute a list of actions one after the other");c(this,"version",1);c(this,"autoexecutable",!0);c(this,"initialData",hn);c(this,"type",n.ActionDescriptor);c(this,"inputs",[]);c(this,"outputs",[]);c(this,"error",null);c(this,"project");this.project=t,this.inputs=hn.inputs.map(i=>{const a=R(i,this.project);return a.setParent(this),a.initChildren(),a}),this.outputs=hn.outputs.map(i=>{const a=R(i,this.project);return a.setParent(this),a.initChildren(),a}),this.error=hn.error?R(hn.error,this.project):null}}class b7 extends te{constructor(e){super(_i,e)}}class R7 extends te{constructor(e){super(tr,e)}}class g7 extends te{constructor(t){super(nr,t);c(this,"autoexecutable",!0)}getEntityToMatchInputMap(t){return t.inputs.find(i=>{var a;return((a=i.declaration)==null?void 0:a.id)===B.operation[oe.Validate].inputs.entityToMatch.id})||null}getDataToValidateInputMap(t){return t.inputs.find(i=>{var a;return((a=i.declaration)==null?void 0:a.id)===B.operation[oe.Validate].inputs.dataToValidate.id})||null}getOutputDataOutputMap(t){return t.outputs.find(i=>{var a;return((a=i.declaration)==null?void 0:a.id)===B.operation[oe.Validate].outputs.outputEntity.id})||null}getEntityToMatch(t){let i=null;if(t.readsValue){const s=t.readsValue.getDataType();s&&s.entity&&s.entity.type===n.CustomEntity&&(i=s.entity)}const a=t.getDefaultValue();return!i&&a&&a.valueAsType&&!Array.isArray(a.valueAsType)&&a.valueAsType.type===n.CustomEntity&&(i=a.valueAsType),i}syncOperationInstance(t){const i=this.getEntityToMatchInputMap(t);i&&this.syncEntityToMatchInputMapDataType(i);const a=this.getDataToValidateInputMap(t);a&&this.syncDataToValidateInputMapDataType(a);const s=this.getOutputDataOutputMap(t);return s&&this.syncOutputDataOutputMapDataType(s),t}syncEntityToMatchInputMapDataType(t){var a,s,o;if(((a=t.declaration)==null?void 0:a.id)!==B.operation[oe.Validate].inputs.entityToMatch.id)return null;if(!t.dataType){const l={id:t.id+"--infered-data-type",version:1,type:n.DataType,isList:!1,isNullable:!1,andChildrenGroup:null,orChildrenGroup:null,asType:!0,entity:null,constant:!1,like:!0,inferred:!0,defaultValue:null,parent:t.toReference()},p=R(l,t.project);p.setParent(t),p.initChildren(),t.setDataType(p)}(s=t.dataType)==null||s.sync({inferred:!0,like:!1,asType:!0});const i=this.getEntityToMatch(t);return(o=t.dataType)==null||o.setEntity(i),t.dataType}syncDataToValidateInputMapDataType(t){var o,l,p;if(((o=t.declaration)==null?void 0:o.id)!==B.operation[oe.Validate].inputs.dataToValidate.id)return null;const i=this.getEntityToMatchInputMap(t.parent);if(!i||!this.getEntityToMatch(i))return null;if(!t.dataType){const y={id:t.id+"--infered-data-type",version:1,type:n.DataType,isList:!1,isNullable:!1,andChildrenGroup:null,orChildrenGroup:null,asType:!1,entity:null,constant:!1,like:!0,inferred:!0,defaultValue:null,parent:t.toReference()},h=R(y,t.project);h.setParent(t),h.initChildren(),t.setDataType(h)}(l=t.dataType)==null||l.sync({inferred:!0,like:!0,asType:!1});const s=this.getEntityToMatch(i);return(p=t.dataType)==null||p.setEntity(s),t.dataType}syncOutputDataOutputMapDataType(t){var o,l,p;if(((o=t.declaration)==null?void 0:o.id)!==B.operation[oe.Validate].outputs.outputEntity.id)return null;const i=this.getEntityToMatchInputMap(t.parent);if(!i||!this.getEntityToMatch(i))return null;if(!t.dataType){const y={id:t.id+"--infered-data-type",version:1,type:n.DataType,isList:!1,isNullable:!1,andChildrenGroup:null,orChildrenGroup:null,asType:!1,entity:null,constant:!1,like:!0,inferred:!0,defaultValue:null,parent:t.toReference()},h=R(y,t.project);h.setParent(t),h.initChildren(),t.setDataType(h)}(l=t.dataType)==null||l.sync({inferred:!0,like:!0,asType:!1});const s=this.getEntityToMatch(i);return(p=t.dataType)==null||p.setEntity(s),t.dataType}inferInputMapDataType(t){var i,a;return((i=t.declaration)==null?void 0:i.id)===B.operation[oe.Validate].inputs.entityToMatch.id?this.syncEntityToMatchInputMapDataType(t):((a=t.declaration)==null?void 0:a.id)===B.operation[oe.Validate].inputs.dataToValidate.id?this.syncDataToValidateInputMapDataType(t):null}inferOutputMapDataType(t){var i;return((i=t.declaration)==null?void 0:i.id)===B.operation[oe.Validate].outputs.outputEntity.id?this.syncOutputDataOutputMapDataType(t):null}}class v7 extends te{constructor(e){super(al,e)}}class I7 extends te{constructor(e){super(ol,e)}}class D7 extends te{constructor(e){super(ll,e)}}class P7 extends te{constructor(e){super(Ya,e)}}class A7 extends te{constructor(e){super(qa,e)}}class O7 extends te{constructor(e){super(Bi,e)}}function S7(r){const e=[new SA(r),new AA(r),new OA(r),new b7(r),new R7(r),new g7(r),new P7(r),new v7(r),new D7(r),new I7(r),new A7(r),new O7(r),new te(il,r),new te(rl,r)];return e.forEach(t=>{t.initChildren(),r.subscribeBuiltInInstance(t)}),r.operationDeclarations=e,e}class CA extends Ft{constructor(t){super(xe,t);c(this,"initialData");c(this,"id",L.PERSISTED_ENTITY);c(this,"version",1);c(this,"name",L.PERSISTED_ENTITY);c(this,"description",xe.description);c(this,"type",n.BuiltInBaseEntity);c(this,"abstract",xe.abstract);c(this,"static",xe.static);c(this,"properties",[]);c(this,"methods",[]);c(this,"abstractMethods",[]);c(this,"extends",[]);c(this,"errors",[]);c(this,"project");this.initialData=xe,this.project=t,this.id=xe.id,this.version=xe.version,this.name=xe.name,this.static=xe.static,this.abstract=xe.abstract,this.properties=this.initialData.properties.map(i=>{const a=R(i,this.project);return a.setParent(this),a.initChildren(),a}),this.methods=this.initialData.methods.map(i=>{const a=R(i,this.project);return a.parent=this,a}),this.abstractMethods=this.initialData.abstractMethods.map(i=>{const a=R(i,this.project);return a.parent=this,a}),this.extends=this.initialData.extends.map(i=>R(i,this.project))}}function C7(r){const e=[new CA(r),new Ft(as,r),new Ft(Nn,r),new Ft(jl,r),new Ft(is,r)];return e.forEach(t=>{r.subscribeBuiltInInstance(t)}),r.builtInBaseEntities=e,e}function B7(r){const e=[new Ut(x,r),new Ut(wn,r),new Ut(Q,r),new Ut(Ze,r),new Ut(_n,r),new Ut(un,r),new Ut(ka,r),new Ut(Ko,r)];return e.forEach(t=>{r.subscribeBuiltInInstance(t)}),r.primitives=e,e}function w7(r){const e=[new te(ds,r)];return e.forEach(t=>{t.initChildren(),r.subscribeBuiltInInstance(t)}),r.globalEventActionDescriptors=e,e}function _7(r){const e=[new te(ns,r),new te(rr,r),new te(ts,r),new te(Mi,r),new te(Vi,r),new te(El,r)];e.forEach(i=>{i.initChildren(),r.subscribeBuiltInInstance(i)}),r.loopDeclarations=e;const t=[new te(Ol,r),new te(es,r),new te(Il,r),new te(yT,r),new te(_T,r),new te(Rl,r)];return t.forEach(i=>{i.initChildren(),r.subscribeBuiltInInstance(i)}),r.loopDeclarationsBodies=t,e}function N7(r){const e=[new Fr(Wl,r)];return e.forEach(t=>{t.initChildren(),r.subscribeBuiltInInstance(t)}),r.valueDescriptors=e,e}function M7(r){const e=[new te(lr,r),new te(zr,r)];return e.forEach(t=>{t.initChildren()}),r.conditionDeclarations=e,e}const kr={},Jo={};async function V7(r,e={}){const t={...jI};return t.id=r.id,e.empty?{data:{id:r.id,type:n.Project,version:1,name:null,description:null,projects:[],entities:[],operations:[],functions:[],variableDeclarations:[],variableInstances:[],functionCalls:[],conditions:[],loops:[],searches:[],events:[]}}:{data:t}}function BA(r){const e=new N(r);return B7(e),C7(e),S7(e),w7(e),_7(e),N7(e),M7(e),e.getAllBuiltIn().forEach(i=>{e.builtInInstances[i.id]||(e.builtInInstances[i.id]=i,delete e.instances[i.id])}),e.initChildren(),e}async function L7(r,e={}){if(r.id&&kr[r.id])return kr[r.id];if(r.id&&Jo[r.id])return await Jo[r.id],kr[r.id];const t=V7(r,e);r.id&&(Jo[r.id]=t);const i=await t;if(i.data){const a=BA(i.data);return kr[r.id]=a,r.id&&delete Jo[r.id],a}return null}function G7(r){return kr[r.id]&&delete kr[r.id],null}const $7="test_primitive_entities_export";d.AI_VALUE_CONNECTION_GENERATION_ACTION_EXPLANATION=Iu,d.ActionDescriptorState=te,d.ActionInputMapState=P2,d.ActionOutputMapState=S2,d.AppendToListOperationInputIds=nf,d.AppendToListOperationOutputIds=rf,d.ArgumentDeclarationState=Gr,d.BREAK_AND_CONTINUE_STATEMENTS_RETURN_DECLARATIONS_EXPLANATION=bu,d.BUILT_IN_BASE_ENTITY_IDS=B,d.BUILT_IN_ENTITY_TYPES=Wr,d.BaseCanvasDraggableState=c2,d.BaseEntityNames=L,d.BaseState=l2,d.BaseValueDescriptorIds=Zo,d.BreakStatementState=Oi,d.BuiltInBaseEntityState=Ft,d.CACHED_PROJECTS_BY_ID=kr,d.CALLABLE_ENTITIES_EXPLANATION=U2,d.CALLABLE_TYPES=Bn,d.CALLER_ENTITIES_EXPLANATION=jP,d.CALLER_TYPES=dn,d.CALLS_UPDATE_EXPLANATION=zn,d.COMPARISON_CONDITIONS=Nb,d.CONDITIONS=sO,d.CUSTOM_ENTITY_OPERATIONS=Dh,d.CallableEntityClass=u2,d.CallerEntityClass=hu,d.ChildEntityState=d2,d.ComparisonOperatorTypes=Le,d.ConditionState=_r,d.ContinueStatementState=Tt,d.CreateNewInputIds=Xf,d.CreateNewOutputIds=Qf,d.CustomEntityState=jr,d.DRAGGABLE_CALLABLE_TYPES=Ho,d.DRAGGABLE_CALLER_TYPES=ju,d.DRAGGABLE_ELEMENT_TYPES=zo,d.DRAGGABLE_EXECUTABLE_TYPES=_A,d.DRAGGABLE_PASS_THROUGH_CALLABLE_TYPES=Yo,d.DataTypeCompatibilityTypes=$t,d.DataTypeParentChildRelation=ze,d.DataTypeState=Ii,d.ENTITIES_WITH_VALLUES_EXPLANATION=wo,d.ENTITY_TYPES=NA,d.ENTITY_WITH_LOGIC_SCOPE_TYPES=ct,d.ENTITY_WITH_NAMES_TYPES=ku,d.ENTITY_WITH_VALUE_TYPES=xu,d.ENTRY_POINT_ENTITIES_EXPLANATION=La,d.ENTRY_POINT_TYPES=Ge,d.EVENT_TYPES=Jr,d.EXECUTABLE_TYPES=wA,d.EXECUTION_OPERATIONS=Kf,d.EntityError=mr,d.EntityErrorSeverity=T,d.EntityGenerationError=E,d.EntityGenerationErrorCode=f,d.EntityInstanceErrorCode=M,d.EntityOperations=oe,d.EntityType=n,d.EntityWithLogicScopeClass=h2,d.EntityWithValueClass=f2,d.EntryPointEntityClass=p2,d.ExecutionOperations=_e,d.FunctionCallState=Ur,d.FunctionDeclarationState=Cr,d.GLOBAL_EVENT_DECLARATIONS=oO,d.GetLastInListOperationInputIds=qy,d.GetLastInListOperationOutputIds=Jy,d.GlobalEventNames=cn,d.GlobalEventState=Di,d.HTTPOperations=et,d.HTTP_OPERATIONS=im,d.InputMapState=An,d.InstalledProjectState=Lr,d.InternalCallState=Pi,d.JoinListOperationInputIds=dy,d.JoinListOperationOutputIds=uy,d.LIST_OPERATIONS=Tf,d.ListOperations=Y,d.LoopState=wr,d.LoopTypes=k,d.NON_INTERACTIVE_BASE_ENTITIES_EXPLANATION=Zn,d.NUMBER_OPERATIONS=Dp,d.NumberOperations=fe,d.OPERATION_DECLARATIONS=GA,d.OperationState=Br,d.OutputMapParentChildRelation=Uu,d.OutputMapState=On,d.PARENT_AUTO_CALCULATION_FROM_CALLER_EXPLANATION=_o,d.PASS_THROUGH_CALLABLE_ENTITIES_EXPLANATION=Hn,d.PASS_THROUGH_CALLABLE_TYPES=Ue,d.PROPERTY_NOT_VALUE_READER_WRITTER_EXPLANATION=vu,d.ParallelExecutionOperation=AA,d.ParallelExecutionOperationInputIds=Ef,d.ParallelExecutionOperationOutputIds=bf,d.PassThroughCallableEntityClass=y2,d.PersistedEntity=CA,d.PersistedEntityMethods=At,d.PrimitiveEntityState=Ut,d.PrimitiveTypes=D,d.PrimitiveValueState=Ai,d.ProjectState=N,d.PropertyState=Sr,d.RETURN_STATEMENT_RETURN_DECLARATIONS_EXPLANATION=x2,d.ReturnDeclarationState=Bt,d.ReturnStatementState=$r,d.STANDALONE_CONDITIONS=Ob,d.STRING_OPERATIONS=cy,d.ScopeCompatibilityType=qo,d.SearchState=Vr,d.SequentialExecutionOperation=SA,d.SequentialExecutionOperationInputIds=$f,d.SequentialExecutionOperationOutputIds=Ff,d.SharedEntityErrorCode=S,d.SharedStateFunctionality=FP,d.SplitListOperationInputIds=Ay,d.SplitListOperationOutputIds=Oy,d.StandaloneOperatorTypes=Mt,d.StringOperations=K,d.TERMINATION_TYPES=$e,d.USER_MANAGED_ENTITY_TYPES=MA,d.UserManagedEntityStateFunctionality=o2,d.VALUE_READING_ENTITIES_EXPLANATION=gu,d.VALUE_READING_TYPES=Cn,d.VALUE_WRITING_ENTITIES_EXPLANATION=kP,d.VALUE_WRITING_TYPES=Fe,d.VARIABLE_DATA_TYPE_INFERRANCE_EXPLANATION=Ru,d.VARIABLE_TYPES=ke,d.ValueAutogenerationType=qe,d.ValueDescriptorParentChildRelation=O,d.ValueDescriptorState=Fr,d.ValueReadingEntityClass=Ma,d.ValueWritingEntityClass=Va,d.VariableDeclarationState=Nr,d.VariableInputMapState=D2,d.VariableInstanceState=Mr,d.VariableOutputMapState=O2,d.WaitOperation=OA,d.WaitOperationInputIds=wf,d.WaitOperationOutputIds=_f,d.appendToListOperation=Ya,d.appendToListOperationElementToAppendArgument=dl,d.appendToListOperationElementToAppendArgumentParentRef=pf,d.appendToListOperationElementToAppendArgumentRef=of,d.appendToListOperationError=mf,d.appendToListOperationErrorParentRef=hf,d.appendToListOperationListArgument=cl,d.appendToListOperationListArgumentParentRef=uf,d.appendToListOperationListArgumentRef=af,d.appendToListOperationListDataType=sf,d.appendToListOperationResultListDataType=df,d.appendToListOperationResultListReturn=ff,d.appendToListOperationResultListReturnParentRef=yf,d.appendToListOperationResultListReturnRef=cf,d.appendToListOperationSecondListDataType=lf,d.asGenerationActionExample=on,d.booleanPrototype=wn,d.capitalizeFirstLetter=Io,d.checkAreCustomEntitiesCompatibleAsDataType=AP,d.checkAreDataTypesCompatible=Zt,d.checkArePropertiesCompatibleAsDataType=PP,d.checkIsBranchDependentButNotDirectlyOnBranch=$a,d.checkIsBranchDependentOnBranch=Z2,d.checkIsCallableEntityReachable=xa,d.checkIsCanvasEntity=y7,d.checkIsDetachedBranch=RA,d.checkIsDetachedBranchShallow=$u,d.checkIsGlobalVariable=u7,d.checkIsGloballyDeclared=Gu,d.checkIsMethod=IA,d.checkIsNestedScope=ko,d.checkScopeCompatibility=Fa,d.countedLoopActionDescriptor=ns,d.countedLoopActionDescriptorDynamicReturnDeclaration=xT,d.countedLoopActionDescriptorDynamicReturnDeclarationParentRef=UT,d.countedLoopActionDescriptorStringArgumentDeclaration=FT,d.countedLoopActionDescriptorStringArgumentDeclarationDataType=GT,d.countedLoopActionDescriptorStringArgumentDeclarationDataTypeDefaultValue=VT,d.countedLoopActionDescriptorStringArgumentDeclarationDataTypeDefaultValueParentRef=MT,d.countedLoopActionDescriptorStringArgumentDeclarationDataTypeParentRef=LT,d.countedLoopActionDescriptorStringArgumentDeclarationParentRef=$T,d.countedLoopBodyActionDescriptor=Ol,d.countedLoopBodyActionDescriptorAnyDynamicArgument=WT,d.countedLoopBodyActionDescriptorAnyDynamicArgumentParentRef=JT,d.countedLoopBodyActionDescriptorAnyDynamicReturn=HT,d.countedLoopBodyActionDescriptorAnyDynamicReturnParentRef=YT,d.countedLoopBodyActionDescriptorIterationNumberArgumentDeclaration=Al,d.countedLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataType=kT,d.countedLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataTypeParentRef=jT,d.countedLoopBodyActionDescriptorIterationNumberArgumentDeclarationParentRef=qT,d.createCustomEntityFromJSONObject=Go,d.createEntityError=z,d.createNestedDataTypeForEntity=eA,d.createNewInstanceOperation=tr,d.createNewInstanceOperationEntityToInstanciateArgument=oh,d.createNewInstanceOperationEntityToInstanciateArgumentRef=ih,d.createNewInstanceOperationEntityToInstanciateDataType=ah,d.createNewInstanceOperationError=uh,d.createNewInstanceOperationErrorParentRef=dh,d.createNewInstanceOperationNewEntityDataArgument=rh,d.createNewInstanceOperationNewEntityDataArgumentDataType=nh,d.createNewInstanceOperationNewEntityDataArgumentDataTypeParentRef=th,d.createNewInstanceOperationNewEntityDataArgumentParentRef=eh,d.createNewInstanceOperationOutputEntityDeclaration=ch,d.createNewInstanceOperationOutputEntityDeclarationParentRef=lh,d.createNewInstanceOperationRef=sh,d.createSemanticId=He,d.createStateFromGenerationTargetType=E7,d.createStateFromType=xt,d.createStateFromTypeAndSubscribe=R,d.cronJobBuiltInBaseEntity=jl,d.cronJobBuiltInBaseEntityExpressionProperty=Ib,d.cronJobBuiltInBaseEntityExpressionPropertyDataTypeRef=rO,d.cronJobBuiltInBaseEntityExpressionPropertyRef=gb,d.cronJobBuiltInBaseEntityRef=vb,d.cronJobTriggeredFunctionDeclarationBlueprint=xl,d.cronJobTriggeredFunctionDeclarationBlueprintParentRef=bb,d.customEntityToZodSchema=Kb,d.dataTypeCompatibilityToErrorExplanation=KP,d.datePrototype=un,d.dateValueAutogenerationSchema=nd,d.deletePersistedEntityMethod=Ul,d.deletePersistedEntityMethodParentRef=KE,d.deleteRootProject=G7,d.endpointBuiltInBaseEntity=as,d.endpointBuiltInBaseEntityRef=iE,d.endpointBuiltInBaseEntityRefFour=FE,d.endpointBuiltInBaseEntityRefThree=yE,d.endpointBuiltInBaseEntityRefTwo=cE,d.endpointBuiltInCorsProperty=aE,d.endpointBuiltInCorsPropertyDataType=rE,d.endpointBuiltInCorsPropertyDataTypeRef=tE,d.endpointBuiltInCorsPropertyRef=nE,d.endpointBuiltInMethodProperty=Cl,d.endpointBuiltInMethodPropertyDataType=pE,d.endpointBuiltInMethodPropertyDataTypeRef=dE,d.endpointBuiltInMethodPropertyRef=uE,d.endpointBuiltInPathProperty=Sl,d.endpointBuiltInPathPropertyDataType=lE,d.endpointBuiltInPathPropertyDataTypeRef=sE,d.endpointBuiltInPathPropertyRef=oE,d.endpointPathParamsArgumentDeclaration=wl,d.endpointPathParamsArgumentDeclarationRef=IE,d.endpointPathParamsVariableDataType=DE,d.endpointPathParamsVariableDataTypeRef=vE,d.endpointReachedTriggerActionDescriptor=Gl,d.endpointReachedTriggerActionDescriptorRef=PE,d.endpointReachedTriggerActionDescriptorRefFour=SE,d.endpointReachedTriggerActionDescriptorRefThree=OE,d.endpointReachedTriggerActionDescriptorRefTwo=AE,d.endpointRequestBodyArgumentDeclaration=Nl,d.endpointRequestBodyArgumentDeclarationRef=TE,d.endpointRequestBodyVariableDataType=EE,d.endpointRequestHeadersArgumentDeclaration=Bl,d.endpointRequestHeadersArgumentDeclarationRef=hE,d.endpointRequestHeadersVariableDataType=mE,d.endpointRequestHeadersVariableDataTypeRef=fE,d.endpointRequestQueryParamsArgumentDeclaration=_l,d.endpointRequestQueryParamsArgumentDeclarationRef=RE,d.endpointRequestQueryParamsVariableDataType=gE,d.endpointRequestQueryParamsVariableDataTypeRef=bE,d.endpointResponseBodyDataType=GE,d.endpointResponseBodyReturnDeclaration=Ll,d.endpointResponseBodyReturnDeclarationRef=LE,d.endpointResponseCodeDataType=BE,d.endpointResponseCodeReturnDeclaration=Ml,d.endpointResponseCodeReturnDeclarationRef=CE,d.endpointResponseHeadersDataType=ME,d.endpointResponseHeadersDataTypeRef=_E,d.endpointResponseHeadersReturnDeclaration=Vl,d.endpointResponseHeadersReturnDeclarationRef=NE,d.endpointReturnStatementRef=wE,d.endpointReturnStatementRefThree=$E,d.endpointReturnStatementRefTwo=VE,d.enumOptionsProperty=Hu,d.enumOptionsPropertyDataType=Wu,d.enumOptionsPropertyDataTypeRef=qu,d.enumOptionsPropertyRef=Ju,d.enumPrototype=_n,d.enumPrototypeRef=Yu,d.executionBuiltInEntity=ql,d.executionBuiltInEntityAbortMethod=kl,d.executionBuiltInEntityAbortMethodParentRef=Db,d.filterOutDuplicateEntities=g,d.filterOutDuplicateErrors=r9,d.findEntityFromKeys=Au,d.findReferenceToSelfInList=pA,d.findReferencesToSelfInProject=a7,d.flattenCalls=ln,d.flattenCanvasAncestorsUntil=$o,d.flattenCustomEntityExtensionAndImplementationTypes=TA,d.flattenCustomEntityExtensionTypes=xo,d.flattenCustomEntityExtensions=Mu,d.flattenCustomEntityImplementations=Vu,d.flattenCustomEntityImplementionTypes=Uo,d.flattenDerivedCanvasEntities=Pt,d.flattenDetachedBranch=vA,d.flattenElementCalls=we,d.flattenElementCallsOnTheSameScope=i7,d.flattenProjectElements=uA,d.flattenRelatedCanvasElementsOnTheLeft=mA,d.flattenRelatedCanvasElementsOnTheRight=hA,d.flattenVariableReads=dA,d.flattenVariableWrites=cA,d.flattenVariables=ie,d.fromZodParseToEntityGenerationErrors=mu,d.generate=rC,d.generateActionExample=j2,d.generateExecutionDataType=jk,d.generateMutablePropertiesExplanation=So,d.generateRandomBoolean=IR,d.generateRandomDate=tR,d.generateRandomDateAfter=Xb,d.generateRandomDateBefore=Qb,d.generateRandomDateBetweenRange=eR,d.generateRandomNumber=ER,d.generateRandomNumberAfter=hR,d.generateRandomNumberBefore=mR,d.generateRandomNumberBetweenRange=TR,d.generateRandomText=vR,d.generateRandomTextAfter=bR,d.generateRandomTextBefore=RR,d.generateRandomTextBetweenRange=gR,d.generateUniqueUUID=fR,d.getAllActionDescriptorsForConditions=Vo,d.getAllActionDescriptorsForGlobalEvents=No,d.getAllActionDescriptorsForLoops=Mo,d.getAllActionDescriptorsForOperations=W2,d.getAllGloballyDeclaredFunctionDeclarationsExplanation=HP,d.getBaseBuiltInEntities=Xn,d.getBaseSchemaBasedOnType=UP,d.getBuiltInEntityOwner=Qn,d.getCallableEntityReferenceSchema=Ye,d.getCallableEntityTypeSchema=pD,d.getCallerEntityReferenceSchema=l3,d.getCallerEntityTypeSchema=o3,d.getCalls=Cu,d.getCanvasEntitiesDerivedFromInternalCalls=fA,d.getCanvasEntitiesDerivedFromWrites=Si,d.getCanvasEntityDerivedFromValueReadingEntity=Nu,d.getCanvasEntityReferenceSchema=P3,d.getCanvasEntityTypeSchema=D3,d.getChildrenEntityWithValues=X2,d.getCommonAncestor=Su,d.getCommonChildren=tA,d.getDeclaration=Or,d.getDeepestScope=PA,d.getDraggableCallableEntityReferenceSchema=fD,d.getDraggableCallableEntityTypeSchema=yD,d.getDraggableCallerEntityReferenceSchema=d3,d.getDraggableCallerEntityTypeSchema=c3,d.getDraggableExecutableEntityReferenceSchema=f3,d.getDraggableExecutableEntityTypeSchema=y3,d.getDraggablePassThroughCallableEntityReferenceSchema=ho,d.getDraggablePassThroughCallableEntityTypeSchema=fo,d.getDraggablePlayableEntityReferenceSchema=b3,d.getDraggablePlayableEntityTypeSchema=E3,d.getEntityArgumentDeclarations=wu,d.getEntityInputMaps=yA,d.getEntityOutputMaps=l7,d.getEntityReferenceSchema=I3,d.getEntityReturnDeclarations=_u,d.getEntityTypeSchema=v3,d.getEntityWithLogicScopeReferenceSchema=In,d.getEntityWithLogicScopeTypeSchema=h3,d.getEntityWithValueReferenceSchema=uD,d.getEntityWithValueTypeSchema=s3,d.getEntryPointEntityReferenceSchema=We,d.getEntryPointEntityTypeSchema=Jn,d.getEventEntityReferenceSchema=po,d.getEventEntityTypeSchema=uo,d.getExecutableEntityReferenceSchema=p3,d.getExecutableEntityTypeSchema=u3,d.getExtendedBuiltInEntity=c7,d.getExtendedCustomEntity=bA,d.getGenerationTargetSchemaBasedOnType=xP,d.getHeadIfPartOfDetachedBranch=gA,d.getHighestScope=DA,d.getImplementedBuiltInEntity=d7,d.getIsInteractive=Lu,d.getLastInListOperation=ll,d.getLastInListOperationError=tf,d.getLastInListOperationErrorParentRef=ef,d.getLastInListOperationInputListArgument=Ky,d.getLastInListOperationInputListArgumentParentRef=Zy,d.getLastInListOperationInputListArgumentRef=Wy,d.getLastInListOperationInputListDataType=Yy,d.getLastInListOperationOutputElementDataType=zy,d.getLastInListOperationOutputElementReturn=Qy,d.getLastInListOperationOutputElementReturnParentRef=Xy,d.getLastInListOperationOutputElementReturnRef=Hy,d.getLinkedEntitiesFromArgumentDeclaration=r7,d.getLowestPersistedEntityImplementation=EA,d.getParentCanvasEntities=Et,d.getParentCanvasEntity=Qe,d.getParentEntryPoint=K2,d.getPassThroughCallableEntityReferenceSchema=he,d.getPassThroughCallableEntityTypeSchema=yo,d.getPlayableEntityReferenceSchema=T3,d.getPlayableEntityTypeSchema=m3,d.getProject=L7,d.getPrototypeByType=jo,d.getReferenceEntityId=_,d.getReferencedEntitiesStateOrErrors=Bo,d.getReferencedEntityStateOrErrors=Tu,d.getRelatedCanvasElementsOnTheLeft=xr,d.getRelatedCanvasElementsOnTheRight=Kn,d.getRootEntryPointScopeOwner=Fu,d.getScopeOwner=bt,d.getTerminationReferenceSchema=g3,d.getTerminationTypeSchema=R3,d.getUsedArgFromDeclaration=s7,d.getUsedReturnFromDeclaration=o7,d.getValueReadingEntityReferenceSchema=dD,d.getValueReadingEntityTypeSchema=vn,d.getValueWritingEntityReferenceSchema=a3,d.getValueWritingEntityTypeSchema=Da,d.getVariableFromInputMapping=rA,d.getVariableFromReturnVariablePointer=sA,d.getVariableReferenceSchema=qn,d.getVariableTypeSchema=gr,d.getVariablesFromArgumentDeclarations=Fo,d.getVariablesFromInputMaps=iA,d.getVariablesFromOutputMapping=oA,d.getVariablesFromOutputMaps=lA,d.getVariablesFromReturnDeclarations=aA,d.getVariablesInSameOrHigherScope=ou,d.getWrites=Bu,d.groupCallsBasedOnParallelizableExecution=e7,d.handleAfterEntityImplementationSideEffects=QP,d.handleBeforeEntityImplementationSideEffects=XP,d.httpRequestBodyArgument=Ka,d.httpRequestBodyArgumentRef=Gh,d.httpRequestBodyDataType=$h,d.httpRequestHeadersArgument=Za,d.httpRequestHeadersArgumentRef=Vh,d.httpRequestHeadersDataType=Lh,d.httpRequestMethodArgument=Ha,d.httpRequestMethodArgumentRef=Nh,d.httpRequestMethodDataType=Mh,d.httpRequestMethodDataTypeRef=wh,d.httpRequestOperation=_i,d.httpRequestOperationErrorValueDescriptor=Tl,d.httpRequestOperationErrorValueDescriptorDatatype=rm,d.httpRequestOperationErrorValueDescriptorRef=nm,d.httpRequestOperationRef=Xh,d.httpRequestOperationRefEight=em,d.httpRequestOperationRefFive=Zh,d.httpRequestOperationRefFour=zh,d.httpRequestOperationRefNine=tm,d.httpRequestOperationRefSeven=Qh,d.httpRequestOperationRefSix=Kh,d.httpRequestOperationRefThree=Hh,d.httpRequestOperationRefTwo=Yh,d.httpRequestQueryParamsArgument=hl,d.httpRequestQueryParamsArgumentRef=Ch,d.httpRequestQueryParamsDataType=Bh,d.httpRequestVariableURLArgument=za,d.httpRequestVariableURLArgumentRef=Oh,d.httpRequestVariableURLDataType=Sh,d.httpRequestVariableURLDataTypeRef=Ph,d.httpResponseBodyReturnDataType=Wh,d.httpResponseBodyReturnDataTypeRef=qh,d.httpResponseBodyReturnReturn=wi,d.httpResponseBodyReturnReturnRef=Jh,d.httpResponseCodeDataType=Uh,d.httpResponseCodeReturn=ml,d.httpResponseCodeReturnRef=Fh,d.httpResponseHeadersDataType=kh,d.httpResponseHeadersDataTypeRef=xh,d.httpResponseHeadersReturn=Xa,d.httpResponseHeadersReturnRef=jh,d.implement=Lo,d.inferArgumentDeclarationDataType=OP,d.inferDataType=sn,d.inferInputMapDataType=iu,d.inferOutputMapDataType=su,d.inferPropertyDataType=BP,d.inferReturnDeclarationDataType=au,d.inferValueDescriptorDataType=wP,d.inferVariableDeclarationDataType=CP,d.inferVariableInstanceDataType=SP,d.initProject=BA,d.iterateOverListActionDescriptorListArgumentDeclaration=Em,d.iterateOverListActionDescriptorListArgumentDeclarationDataType=mm,d.iterateOverListActionDescriptorListArgumentDeclarationDataTypeParentRef=hm,d.iterateOverListActionDescriptorListArgumentDeclarationParentRef=Tm,d.iterateOverListLoopActionDescriptor=rr,d.iterateOverListLoopActionDescriptorDynamicReturnDeclaration=Rm,d.iterateOverListLoopActionDescriptorDynamicReturnDeclarationParentRef=bm,d.iterateOverListLoopBodyActionDescriptor=es,d.iterateOverListLoopBodyActionDescriptorAnyDynamicArgument=Cm,d.iterateOverListLoopBodyActionDescriptorAnyDynamicArgumentParentRef=Sm,d.iterateOverListLoopBodyActionDescriptorAnyDynamicReturn=wm,d.iterateOverListLoopBodyActionDescriptorAnyDynamicReturnParentRef=Bm,d.iterateOverListLoopBodyActionDescriptorCurrentValueArgumentDeclaration=Qa,d.iterateOverListLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataType=vm,d.iterateOverListLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataTypeParentRef=gm,d.iterateOverListLoopBodyActionDescriptorCurrentValueArgumentDeclarationParentRef=Im,d.iterateOverListLoopBodyActionDescriptorIterationNumberArgumentDeclaration=Om,d.iterateOverListLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataType=Pm,d.iterateOverListLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataTypeParentRef=Dm,d.iterateOverListLoopBodyActionDescriptorIterationNumberArgumentDeclarationParentRef=Am,d.iterateOverObjectKeysActionDescriptorObjectArgumentDeclaration=Qm,d.iterateOverObjectKeysActionDescriptorObjectArgumentDeclarationDataType=Km,d.iterateOverObjectKeysActionDescriptorObjectArgumentDeclarationDataTypeParentRef=Zm,d.iterateOverObjectKeysActionDescriptorObjectArgumentDeclarationParentRef=Xm,d.iterateOverObjectKeysLoopActionDescriptor=Mi,d.iterateOverObjectKeysLoopActionDescriptorDynamicReturnDeclaration=tT,d.iterateOverObjectKeysLoopActionDescriptorDynamicReturnDeclarationParentRef=eT,d.iterateOverObjectKeysLoopBodyActionDescriptor=yT,d.iterateOverObjectKeysLoopBodyActionDescriptorAnyDynamicArgument=dT,d.iterateOverObjectKeysLoopBodyActionDescriptorAnyDynamicArgumentParentRef=cT,d.iterateOverObjectKeysLoopBodyActionDescriptorAnyDynamicReturn=pT,d.iterateOverObjectKeysLoopBodyActionDescriptorAnyDynamicReturnParentRef=uT,d.iterateOverObjectKeysLoopBodyActionDescriptorCurrentValueArgumentDeclaration=Dl,d.iterateOverObjectKeysLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataType=rT,d.iterateOverObjectKeysLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataTypeParentRef=nT,d.iterateOverObjectKeysLoopBodyActionDescriptorCurrentValueArgumentDeclarationParentRef=iT,d.iterateOverObjectKeysLoopBodyActionDescriptorIterationNumberArgumentDeclaration=lT,d.iterateOverObjectKeysLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataType=sT,d.iterateOverObjectKeysLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataTypeParentRef=aT,d.iterateOverObjectKeysLoopBodyActionDescriptorIterationNumberArgumentDeclarationParentRef=oT,d.iterateOverObjectValuesActionDescriptorObjectArgumentDeclaration=ET,d.iterateOverObjectValuesActionDescriptorObjectArgumentDeclarationDataType=mT,d.iterateOverObjectValuesActionDescriptorObjectArgumentDeclarationDataTypeParentRef=hT,d.iterateOverObjectValuesActionDescriptorObjectArgumentDeclarationParentRef=TT,d.iterateOverObjectValuesLoopActionDescriptor=Vi,d.iterateOverObjectValuesLoopActionDescriptorDynamicReturnDeclaration=RT,d.iterateOverObjectValuesLoopActionDescriptorDynamicReturnDeclarationParentRef=bT,d.iterateOverObjectValuesLoopBodyActionDescriptor=_T,d.iterateOverObjectValuesLoopBodyActionDescriptorAnyDynamicArgument=CT,d.iterateOverObjectValuesLoopBodyActionDescriptorAnyDynamicArgumentParentRef=ST,d.iterateOverObjectValuesLoopBodyActionDescriptorAnyDynamicReturn=wT,d.iterateOverObjectValuesLoopBodyActionDescriptorAnyDynamicReturnParentRef=BT,d.iterateOverObjectValuesLoopBodyActionDescriptorCurrentValueArgumentDeclaration=Pl,d.iterateOverObjectValuesLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataType=vT,d.iterateOverObjectValuesLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataTypeParentRef=gT,d.iterateOverObjectValuesLoopBodyActionDescriptorCurrentValueArgumentDeclarationParentRef=IT,d.iterateOverObjectValuesLoopBodyActionDescriptorIterationNumberArgumentDeclaration=OT,d.iterateOverObjectValuesLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataType=PT,d.iterateOverObjectValuesLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataTypeParentRef=DT,d.iterateOverObjectValuesLoopBodyActionDescriptorIterationNumberArgumentDeclarationParentRef=AT,d.iterateOverStringActionDescriptorDynamicReturnDeclaration=$m,d.iterateOverStringActionDescriptorDynamicReturnDeclarationParentRef=Gm,d.iterateOverStringActionDescriptorStringArgumentDeclaration=Lm,d.iterateOverStringActionDescriptorStringArgumentDeclarationDataType=Mm,d.iterateOverStringActionDescriptorStringArgumentDeclarationDataTypeParentRef=Nm,d.iterateOverStringActionDescriptorStringArgumentDeclarationParentRef=Vm,d.iterateOverStringLoopActionDescriptor=ts,d.iterateOverStringLoopBodyActionDescriptor=Il,d.iterateOverStringLoopBodyActionDescriptorAnyDynamicArgument=Wm,d.iterateOverStringLoopBodyActionDescriptorAnyDynamicArgumentParentRef=Jm,d.iterateOverStringLoopBodyActionDescriptorAnyDynamicReturn=Hm,d.iterateOverStringLoopBodyActionDescriptorAnyDynamicReturnParentRef=Ym,d.iterateOverStringLoopBodyActionDescriptorCurrentValueArgumentDeclaration=gl,d.iterateOverStringLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataType=Um,d.iterateOverStringLoopBodyActionDescriptorCurrentValueArgumentDeclarationDataTypeParentRef=Fm,d.iterateOverStringLoopBodyActionDescriptorCurrentValueArgumentDeclarationParentRef=xm,d.iterateOverStringLoopBodyActionDescriptorIterationNumberArgumentDeclaration=vl,d.iterateOverStringLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataType=km,d.iterateOverStringLoopBodyActionDescriptorIterationNumberArgumentDeclarationDataTypeParentRef=jm,d.iterateOverStringLoopBodyActionDescriptorIterationNumberArgumentDeclarationParentRef=qm,d.joinListOperation=al,d.joinListOperationError=Py,d.joinListOperationErrorParentRef=Dy,d.joinListOperationFirstListArgument=by,d.joinListOperationFirstListArgumentParentRef=Ey,d.joinListOperationFirstListArgumentRef=py,d.joinListOperationFirstListDataType=yy,d.joinListOperationResultListDataType=Ty,d.joinListOperationResultListReturn=Iy,d.joinListOperationResultListReturnParentRef=vy,d.joinListOperationResultListReturnRef=my,d.joinListOperationSecondListArgument=gy,d.joinListOperationSecondListArgumentParentRef=Ry,d.joinListOperationSecondListArgumentRef=fy,d.joinListOperationSecondListDataType=hy,d.joinListWithLastSeparator=U,d.joinStringsOperation=Bi,d.joinStringsOperationDynamicStringArgument=Jp,d.joinStringsOperationDynamicStringArgumentParentRef=qp,d.joinStringsOperationDynamicStringArgumentRef=jp,d.joinStringsOperationDynamicStringDataType=kp,d.joinStringsOperationError=xp,d.joinStringsOperationErrorParentRef=Up,d.joinStringsOperationFirstStringArgument=Ja,d.joinStringsOperationFirstStringArgumentParentRef=wp,d.joinStringsOperationFirstStringArgumentRef=Pp,d.joinStringsOperationFirstStringDataType=Ap,d.joinStringsOperationResultStringDataType=Bp,d.joinStringsOperationResultStringReturn=Ci,d.joinStringsOperationResultStringReturnParentRef=Fp,d.joinStringsOperationResultStringReturnRef=Cp,d.joinStringsOperationSecondStringArgument=Wa,d.joinStringsOperationSecondStringArgumentParentRef=$p,d.joinStringsOperationSecondStringArgumentRef=Op,d.joinStringsOperationSecondStringDataType=Sp,d.joinStringsOperationSeparatorStringArgument=Gp,d.joinStringsOperationSeparatorStringArgumentParentRef=Lp,d.joinStringsOperationSeparatorStringArgumentRef=_p,d.joinStringsOperationSeparatorStringDataType=Vp,d.joinStringsOperationSeparatorStringDataTypeDefaultValue=Mp,d.joinStringsOperationSeparatorStringDataTypeDefaultValueParentRef=Np,d.jsonPrototype=Ko,d.keyValueParamBuiltInBaseEntity=is,d.keyValueParamBuiltInBaseEntityNameProperty=KT,d.keyValueParamBuiltInBaseEntityNamePropertyDataTypeRef=FA,d.keyValueParamBuiltInBaseEntityNamePropertyParentRef=ZT,d.keyValueParamBuiltInBaseEntityNamePropertyRef=zT,d.keyValueParamBuiltInBaseEntityValueProperty=eE,d.keyValueParamBuiltInBaseEntityValuePropertyDataTypeRef=xA,d.keyValueParamBuiltInBaseEntityValuePropertyParentRef=QT,d.keyValueParamBuiltInBaseEntityValuePropertyRef=XT,d.lowercaseFirstLetter=DP,d.manualFlowActionDescriptorDeclarationArgumentDeclaration=bl,d.manualFlowActionDescriptorDeclarationArgumentDeclarationDataType=lm,d.manualFlowActionDescriptorDeclarationArgumentDeclarationDataTypeParentRef=om,d.manualFlowActionDescriptorDeclarationArgumentDeclarationParentRef=cm,d.manualFlowLoopActionDescriptor=El,d.manualFlowLoopActionDescriptorDynamicReturnDeclaration=sm,d.manualFlowLoopActionDescriptorDynamicReturnDeclarationParentRef=am,d.manualFlowLoopBodyActionDescriptor=Rl,d.manualFlowLoopBodyActionDescriptorAnyDynamicArgument=um,d.manualFlowLoopBodyActionDescriptorAnyDynamicArgumentParentRef=dm,d.manualFlowLoopBodyActionDescriptorAnyDynamicReturn=ym,d.manualFlowLoopBodyActionDescriptorAnyDynamicReturnParentRef=pm,d.mapActionDescriptorToTypeItRepresents=f7,d.mergeEntityErrorsList=i9,d.mergeListOfEntities=p7,d.methodDefaultValue=_h,d.mockClientProject=jI,d.moreThanOrEqualCondition=zr,d.moreThanOrEqualConditionLeftHandArgument=Bb,d.moreThanOrEqualConditionLeftHandArgumentParentRef=Cb,d.moreThanOrEqualConditionRightHandArgument=_b,d.moreThanOrEqualConditionRightHandArgumentParentRef=wb,d.notEmptyCondition=lr,d.notEmptyConditionArgument=Ab,d.notEmptyConditionRef=Pb,d.nullPrototype=VA,d.numberAdditionOperation=qa,d.numberAdditionOperationDynamicSummandArgument=op,d.numberAdditionOperationDynamicSummandArgumentType=sp,d.numberAdditionOperationDynamicSummandArgumentTypeParentRef=ap,d.numberAdditionOperationError=ip,d.numberAdditionOperationErrorParentRef=rp,d.numberAdditionOperationFirstNumberArgument=Xo,d.numberAdditionOperationFirstNumberArgumentRef=zu,d.numberAdditionOperationFirstNumberDataType=Zu,d.numberAdditionOperationRef=tp,d.numberAdditionOperationRefThree=el,d.numberAdditionOperationRefTwo=np,d.numberAdditionOperationResultNumberDataType=ep,d.numberAdditionOperationResultNumberReturn=tl,d.numberAdditionOperationResultNumberReturnRef=Qu,d.numberAdditionOperationSecondNumberArgument=Qo,d.numberAdditionOperationSecondNumberArgumentRef=Ku,d.numberAdditionOperationSecondNumberDataType=Xu,d.numberPrototype=Q,d.numberSubtractionOperation=rl,d.numberSubtractionOperationDynamicSubtrahendArgument=Ip,d.numberSubtractionOperationDynamicSubtrahendArgumentType=vp,d.numberSubtractionOperationDynamicSubtrahendArgumentTypeParentRef=gp,d.numberSubtractionOperationError=Rp,d.numberSubtractionOperationErrorParentRef=bp,d.numberSubtractionOperationFirstNumberArgument=fp,d.numberSubtractionOperationFirstNumberArgumentRef=lp,d.numberSubtractionOperationFirstNumberDataType=cp,d.numberSubtractionOperationRef=nl,d.numberSubtractionOperationRefThree=Tp,d.numberSubtractionOperationRefTwo=hp,d.numberSubtractionOperationResultNumberDataType=yp,d.numberSubtractionOperationResultNumberReturn=Ep,d.numberSubtractionOperationResultNumberReturnRef=pp,d.numberSubtractionOperationSecondNumberArgument=mp,d.numberSubtractionOperationSecondNumberArgumentRef=dp,d.numberSubtractionOperationSecondNumberDataType=up,d.numberValueAutogenerationSchema=td,d.parallelExecutionOperation=qt,d.parallelExecutionOperationError=Bf,d.parallelExecutionOperationErrorParentRef=Cf,d.parallelExecutionOperationListOfExecutionResultsDataType=Af,d.parallelExecutionOperationListOfExecutionResultsReturn=pl,d.parallelExecutionOperationListOfExecutionResultsReturnRef=Pf,d.parallelExecutionOperationListOfFunctionsArgument=ul,d.parallelExecutionOperationListOfFunctionsArgumentDatatype=Df,d.parallelExecutionOperationListOfFunctionsArgumentRef=If,d.parallelExecutionOperationListOfFunctionsBlueprint=vf,d.parallelExecutionOperationListOfFunctionsBlueprintDynamicInput=gf,d.parallelExecutionOperationListOfFunctionsBlueprintDynamicOutput=Rf,d.parallelExecutionOperationRef=Of,d.parallelExecutionOperationRefThree=Sf,d.persistedBuiltInBaseEntity=xe,d.persistedBuiltInBaseEntityCreatedAtProperty=fb,d.persistedBuiltInBaseEntityCreatedAtPropertyDataType=pb,d.persistedBuiltInBaseEntityCreatedAtPropertyDataTypeRef=tO,d.persistedBuiltInBaseEntityCreatedAtPropertyParentRef=yb,d.persistedBuiltInBaseEntityCreatedAtPropertyRef=ub,d.persistedBuiltInBaseEntityDatabaseProperty=$i,d.persistedBuiltInBaseEntityDatabasePropertyDataTypeRef=KA,d.persistedBuiltInBaseEntityDatabasePropertyParentRef=nb,d.persistedBuiltInBaseEntityDatabasePropertyRef=tb,d.persistedBuiltInBaseEntityDeletedAtProperty=db,d.persistedBuiltInBaseEntityDeletedAtPropertyDataType=lb,d.persistedBuiltInBaseEntityDeletedAtPropertyDataTypeRef=eO,d.persistedBuiltInBaseEntityDeletedAtPropertyParentRef=cb,d.persistedBuiltInBaseEntityDeletedAtPropertyRef=ob,d.persistedBuiltInBaseEntityIdentifierProperty=sb,d.persistedBuiltInBaseEntityIdentifierPropertyDataTypeRef=rb,d.persistedBuiltInBaseEntityIdentifierPropertyParentRef=ab,d.persistedBuiltInBaseEntityIdentifierPropertyRef=ib,d.persistedBuiltInBaseEntityUpdatedAtProperty=Eb,d.persistedBuiltInBaseEntityUpdatedAtPropertyDataType=mb,d.persistedBuiltInBaseEntityUpdatedAtPropertyDataTypeRef=nO,d.persistedBuiltInBaseEntityUpdatedAtPropertyParentRef=Tb,d.persistedBuiltInBaseEntityUpdatedAtPropertyRef=hb,d.processOutputGlobalValueDescriptorDataType=Vb,d.processOutputGlobalValueDescriptorReturn=Wl,d.processOutputGlobalValueDescriptorReturnRef=Mb,d.projectPublicationCompletedGlobalEvent=ds,d.propertyToZodSchema=Zb,d.relationalDatabaseBuiltInBaseEntity=Nn,d.relationalDatabaseBuiltInBaseEntityAutoscalingProperty=Fl,d.relationalDatabaseBuiltInBaseEntityAutoscalingPropertyDataTypeRef=zE,d.relationalDatabaseBuiltInBaseEntityAutoscalingPropertyParentRef=ZE,d.relationalDatabaseBuiltInBaseEntityAutoscalingPropertyRef=HE,d.relationalDatabaseBuiltInBaseEntityDefaultProperty=$l,d.relationalDatabaseBuiltInBaseEntityDefaultPropertyDataTypeRef=WE,d.relationalDatabaseBuiltInBaseEntityDefaultPropertyRef=YE,d.relationalDatabaseBuiltInBaseEntityIdentifierProperty=ss,d.relationalDatabaseBuiltInBaseEntityIdentifierPropertyDataTypeRef=UE,d.relationalDatabaseBuiltInBaseEntityIdentifierPropertyRef=xE,d.relationalDatabaseBuiltInBaseEntityMinSizeProperty=cs,d.relationalDatabaseBuiltInBaseEntityMinSizePropertyDataTypeRef=qE,d.relationalDatabaseBuiltInBaseEntityMinSizePropertyRef=JE,d.relationalDatabaseBuiltInBaseEntityPasswordProperty=ls,d.relationalDatabaseBuiltInBaseEntityPasswordPropertyDataTypeRef=WA,d.relationalDatabaseBuiltInBaseEntityPasswordPropertyRef=kE,d.relationalDatabaseBuiltInBaseEntityRef=Hr,d.relationalDatabaseBuiltInBaseEntityUsernameProperty=os,d.relationalDatabaseBuiltInBaseEntityUsernamePropertyDataTypeRef=qA,d.relationalDatabaseBuiltInBaseEntityUsernamePropertyRef=jE,d.resolveActionDescriptorName=$P,d.resolveBaseEntityName=NP,d.resolveBuiltInBaseEntityDataTypeLabel=MP,d.resolveConditionOperatorLabel=Ao,d.resolveCustomEntityDataTypeLabel=VP,d.resolveDataType=Do,d.resolveDataTypeEntityOrNestedChildrenFromLiteralValue=Ou,d.resolveDataTypeLabel=lu,d.resolveEntityDataTypeLabel=Wk,d.resolveEntityName=C,d.resolveFirstCallsSecond=t7,d.resolveFirstWritesSecond=n7,d.resolvePrimitiveEntityName=GP,d.resolveSearchName=LP,d.resolveVariableScope=kk,d.sequentialExecutionOperation=hn,d.sequentialExecutionOperationError=Zf,d.sequentialExecutionOperationErrorParentRef=zf,d.sequentialExecutionOperationListOfExecutionResultsDataType=Wf,d.sequentialExecutionOperationListOfExecutionResultsReturn=fl,d.sequentialExecutionOperationListOfExecutionResultsReturnParentRef=Hf,d.sequentialExecutionOperationListOfExecutionResultsReturnRef=Jf,d.sequentialExecutionOperationListOfFunctionsArgument=yl,d.sequentialExecutionOperationListOfFunctionsArgumentDatatype=qf,d.sequentialExecutionOperationListOfFunctionsArgumentParentRef=Yf,d.sequentialExecutionOperationListOfFunctionsArgumentRef=kf,d.sequentialExecutionOperationListOfFunctionsBlueprint=jf,d.sequentialExecutionOperationListOfFunctionsBlueprintDynamicInput=xf,d.sequentialExecutionOperationListOfFunctionsBlueprintDynamicOutput=Uf,d.softDeletePersistedEntityMethod=QE,d.softDeletePersistedEntityMethodParentRef=XE,d.sortCallsBasedOnExecutionDependencies=nA,d.sortChildrenEntitiesBasedOnExecutionDependencies=Q2,d.splitListOperation=ol,d.splitListOperationError=ky,d.splitListOperationErrorParentRef=jy,d.splitListOperationFirstOutputListDataType=_y,d.splitListOperationFirstOutputListReturn=$y,d.splitListOperationFirstOutputListReturnParentRef=Gy,d.splitListOperationFirstOutputListReturnRef=sl,d.splitListOperationInputListArgument=My,d.splitListOperationInputListArgumentParentRef=Ny,d.splitListOperationInputListArgumentRef=Sy,d.splitListOperationInputListDataType=Cy,d.splitListOperationSecondOutputListDataType=Fy,d.splitListOperationSecondOutputListReturn=xy,d.splitListOperationSecondOutputListReturnParentRef=Uy,d.splitListOperationSplitIndexArgument=Ly,d.splitListOperationSplitIndexArgumentParentRef=Vy,d.splitListOperationSplitIndexArgumentRef=By,d.splitListOperationSplitIndexDataType=wy,d.splitStringOperation=il,d.splitStringOperationError=ly,d.splitStringOperationErrorParentRef=oy,d.splitStringOperationFirstPartResultStringDataType=Kp,d.splitStringOperationFirstPartResultStringReturn=sy,d.splitStringOperationFirstPartResultStringReturnParentRef=ay,d.splitStringOperationFirstPartResultStringReturnRef=Zp,d.splitStringOperationIndexArgument=ry,d.splitStringOperationIndexArgumentParentRef=ny,d.splitStringOperationIndexArgumentRef=Hp,d.splitStringOperationIndexDataType=zp,d.splitStringOperationSecondPartResultStringDataType=Qp,d.splitStringOperationSecondPartResultStringReturn=LA,d.splitStringOperationSecondPartResultStringReturnParentRef=iy,d.splitStringOperationSecondPartResultStringReturnRef=Xp,d.splitStringOperationStringArgument=ty,d.splitStringOperationStringArgumentParentRef=ey,d.splitStringOperationStringArgumentRef=Wp,d.splitStringOperationStringDataType=Yp,d.stringPrototype=x,d.stringValueAutogenerationSchema=ed,d.suggestNewIdForEntity=fu,d.test_primitive_entities_export=$7,d.toCamelCase=qk,d.toEntityState=wt,d.toKebabCase=_P,d.toLowerCaseKebabCase=Po,d.toPascalCase=Jk,d.untypedObjectPrototype=Ze,d.updateErrorsList=ae,d.updateValueReader=Ua,d.urlDefaultValue=Ah,d.uuidPrototype=ka,d.validateArgumentDeclarationName=pu,d.validateCalledByErrorIdInAction=q2,d.validateCalledByIdInAction=k2,d.validateCallers=YP,d.validateConditionEntityDeclaration=Y2,d.validateCustomEntityName=Oo,d.validateDataOperation=nr,d.validateDataOperationDataToValidateArgument=hh,d.validateDataOperationDataToValidateArgumentParentRef=fh,d.validateDataOperationDataToValidateArgumentRef=ph,d.validateDataOperationDataToValidateDataType=yh,d.validateDataOperationEntityToMatchTypeArgument=bh,d.validateDataOperationEntityToMatchTypeArgumentParentRef=Eh,d.validateDataOperationEntityToMatchTypeArgumentRef=mh,d.validateDataOperationEntityToMatchTypeDataType=Th,d.validateDataOperationError=Ih,d.validateDataOperationErrorParentRef=vh,d.validateDataOperationOutputEntityDeclaration=gh,d.validateDataOperationOutputEntityDeclarationParentRef=Rh,d.validateEntryCaller=WP,d.validateErrorCaller=JP,d.validateFunctionCallDeclaration=zP,d.validateFunctionDeclarationName=cu,d.validateGeneratedEntityParentIsNotBuiltInEntity=F2,d.validateGeneration=G2,d.validateGenerationTarget=Ne,d.validateGenerationUpdate=$2,d.validateLoopEntityDeclaration=H2,d.validateName=Yk,d.validateOperationEntityDeclaration=ZP,d.validatePropertyName=uu,d.validateReachability=Sn,d.validateReadsValueInActionPayload=J2,d.validateReferenceObject=Co,d.validateReferenceToOne=Eu,d.validateReferences=Je,d.validateReturnDeclarationName=yu,d.validateSuccessCaller=qP,d.validateValueReaderGenerationUpdate=Ga,d.validateValueWritter=Du,d.validateVariableDeclarationName=du,d.validateVariableInternalCallUse=Pu,d.valueAutogenerationCurrentDateAndTimeSchema=qI,d.valueAutogenerationGenericSchema=zs,d.valueAutogenerationOptions=rd,d.valueAutogenerationOptionsSchema=kI,d.valueAutogenerationRandomBooleanSchema=Qc,d.valueAutogenerationRandomDateBetweenSchema=QI,d.valueAutogenerationRandomDateFromSchema=KI,d.valueAutogenerationRandomDateSchema=Xs,d.valueAutogenerationRandomDateUntilSchema=XI,d.valueAutogenerationRandomNumberBetweenSchema=YI,d.valueAutogenerationRandomNumberFromSchema=JI,d.valueAutogenerationRandomNumberSchema=Zs,d.valueAutogenerationRandomNumberUntilSchema=WI,d.valueAutogenerationRandomSchema=Ta,d.valueAutogenerationRandomTextBetweenSchema=ZI,d.valueAutogenerationRandomTextFromSchema=HI,d.valueAutogenerationRandomTextSchema=Ks,d.valueAutogenerationRandomTextUntilSchema=zI,d.valueAutogenerationRangeValueTypesSchema=ma,d.valueAutogenerationUniqueSchema=Xc,d.waitOperation=dt,d.waitOperationMillisecondsNumberArgument=er,d.waitOperationMillisecondsNumberArgumentRef=Nf,d.waitOperationMillisecondsNumberDataType=Mf,d.waitOperationOperationError=Gf,d.waitOperationOperationErrorParentRef=Lf,d.waitOperationRef=Vf,Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})});
|