@elyx-code/project-logic-tree 0.0.6124 → 0.0.6125

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.
@@ -50,7 +50,7 @@ export interface IOutputMapTransfer extends IOutputMap_meta, IChildEntityTransfe
50
50
  export interface IOutputMapGenerationTarget extends IChildEntityGenerationTarget, IValueWritingEntityGenerationTarget {
51
51
  id: EntityId;
52
52
  type: EntityType.OutputMap;
53
- declaration: EntityId;
53
+ declaration?: EntityId | null;
54
54
  parent: EntityId;
55
55
  }
56
56
  export interface IOutputMapShallowTransfer extends IOutputMap_meta, IChildEntityShallowTransfer, IValueWritingEntityShallowTransfer {
package/dist/index.js CHANGED
@@ -36855,7 +36855,7 @@ const Te = class Te {
36855
36855
  (u) => u !== i.Condition
36856
36856
  ).includes(o.type)) {
36857
36857
  const u = o.outputs.find(
36858
- (c) => c.declaration.id === D(n.declaration)
36858
+ (c) => c.declaration.id === (n.declaration ? D(n.declaration) : null)
36859
36859
  );
36860
36860
  if (u)
36861
36861
  a.push(
@@ -36870,7 +36870,7 @@ You can't edit output-map entities as they need to match their return declaratio
36870
36870
  })
36871
36871
  );
36872
36872
  else {
36873
- const c = t.get(n.declaration);
36873
+ const c = n.declaration ? t.get(n.declaration) : null;
36874
36874
  if (c && $e.includes(o.type)) {
36875
36875
  const y = $r(o), h = y.dataType, E = (l = y.dataType) == null ? void 0 : l.entity;
36876
36876
  h ? E ? E.type === i.ActionDescriptor ? a.push(
@@ -37175,7 +37175,7 @@ This is likely an incorrect strategy, either the '${this.type}' entity doesn't n
37175
37175
  };
37176
37176
  }
37177
37177
  toShallowJSON(e = N) {
37178
- var n, a;
37178
+ var n, a, s;
37179
37179
  let t = this.id;
37180
37180
  return (n = e.seenEntityMaps) != null && n.has(this.id) && (t = e.seenEntityMaps.get(this.id)), {
37181
37181
  id: t,
@@ -37184,9 +37184,9 @@ This is likely an incorrect strategy, either the '${this.type}' entity doesn't n
37184
37184
  index: this.index,
37185
37185
  parentRelationType: this.parentRelationType,
37186
37186
  defaultValue: ((a = this.defaultValue) == null ? void 0 : a.toReference(e)) || null,
37187
- declaration: this.declaration.toReference(e),
37187
+ declaration: (s = this.declaration) == null ? void 0 : s.toReference(e),
37188
37188
  writesValues: this.writesValues.map(
37189
- (s) => s.toReference(e)
37189
+ (o) => o.toReference(e)
37190
37190
  ),
37191
37191
  parent: this.parent.toReference(e)
37192
37192
  };
@@ -37200,10 +37200,11 @@ This is likely an incorrect strategy, either the '${this.type}' entity doesn't n
37200
37200
  ]);
37201
37201
  }
37202
37202
  toGenerationTarget() {
37203
+ var e;
37203
37204
  return {
37204
37205
  id: this.id,
37205
37206
  type: this.type,
37206
- declaration: this.declaration.id,
37207
+ declaration: ((e = this.declaration) == null ? void 0 : e.id) || null,
37207
37208
  parent: this.parent.id
37208
37209
  };
37209
37210
  }
@@ -141,9 +141,9 @@ Input maps can only be added to variables which hold an entity with properties.`
141
141
  The entity of the data-type has the following properties that can be reads as input maps, ids: '${q(v.properties.map(D=>D.id),"', '","' and '")}'`,issue:null})))}else if(Je.filter(h=>Fe.includes(h)).includes(o.type)){const f=rp(o),R=f.find(I=>I.id===n.declaration),v=`The parent entity has the following argument declarations that can be referenced by input-maps, ids: '${q(f.map(I=>I.id),"', '","' and '")}'`;R||a.push(new g({id:`${n.id}--${B.NoOverlapWithImplementedSignature}`,code:B.NoOverlapWithImplementedSignature,severity:E.Error,message:`Entity of type '${i.InputMap}' with id '${n.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 '${n.declaration}'.
142
142
  You can't add an input-map to an entity that doesn't have a matching 'argument-declaration'.
143
143
  ${v}`,issue:null}))}}return a.push(...s.errors,...je(n)),{errors:a,modifiedData:n}}validateGeneratedUpdate(e){const t=[];let n=JSON.parse(JSON.stringify(e));const a=Qa(n,this);return n=a.modifiedData,t.push(...a.errors),n.parent&&t.push(new g({id:`${this.id}--${T.InvalidParentUpdate}`,code:T.InvalidParentUpdate,severity:E.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.
144
- 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:n}}hydrateAncestors(){const e=[],t=[],n=[];if(this.initialData.parent){const a=S(this.initialData.parent),s=this.project.get(a);s&&(this.setParent(s),e.push(s))}if(this.initialData.readsValue){const a=S(this.initialData.readsValue),s=this.project.get(a);s&&(this.setValueWriter(s),e.push(s))}if(this.initialData.declaration){const a=S(this.initialData.declaration),s=this.project.get(a);s&&(this.setDeclaration(s),e.push(s))}return qn.hydrateReadsValue(this),{updated:m(e),added:m(t),removed:m(n),self:this}}afterAllChildrenInitialized(){const e=[],t=[],n=[];return this.initialized=!0,{updated:m(e),added:m(t),removed:m(n),self:this}}addSelfToProject(){var a,s;const e=[this],t=[],n=[];if(this.parent.addInput(this),e.push(this.parent),(a=this.readsValue)==null||a.addValueReader(this),this.readsValue&&e.push(this.readsValue),Fe.includes(this.parent.type)&&((s=this.parent.getDataType())!=null&&s.inferred)){const o=this.parent.type===i.VariableDeclaration?this.parent:this.parent.declaration;o.inferDataTypeAndSyncInstancesInputsAndOutputs(),e.push(o,...o.variableInstances)}return{updated:m(e),added:m(t),removed:m(n),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=b(this.initialData.defaultValue,this.project),this.defaultValue.setParent(this),this.defaultValue.initChildren()),this.initialData.declaration&&(this.declaration=b(this.initialData.declaration,this.project)),qn.initReadsValue(this),this.afterAllChildrenInitialized(),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(e=V){return await Ee.repository.load(this.id),this}async create(e=V){return await Ee.repository.create(this.toShallowJSON()),this}async update(e=V){return await Ee.repository.update(this.toShallowJSON()),this}async delete(e=V){return await Ee.repository.delete(this.id),this}remove({ignoreUpstream:e,seenEntities:t}={ignoreUpstream:!1,seenEntities:new Set}){const n=[],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});n.push(...s),a.push(...o)}return this.readsValue&&(n.push(this.readsValue),this.readsValue.removeValueReader(this)),this.defaultValue&&(n.push(this.defaultValue),this.defaultValue.remove({ignoreUpstream:!0,seenEntities:t})),e||(n.push(this.parent),this.parent.removeInput(this)),{affected:n,removed: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:n}=this.defaultValue.restore({seenEntities:e});t.push(...n)}return 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):[],...this.declaration?this.declaration.toFlat(e):[],...this.readsValue?this.readsValue.toFlat(e):[]])}toFlatIds(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.id,...this.defaultValue?this.defaultValue.toFlatIds(e):[],...this.defaultValue?this.defaultValue.toFlatIds(e):[]])}toJSON(e=new Set){var t,n,a;return e.has(this.id)?this.toReference():(e.add(this.id),{id:this.id,version:this.version,type:this.type,index:this.index,name:this.name,description:this.description,defaultValue:((t=this.defaultValue)==null?void 0:t.toJSON(e))||null,declaration:((n=this.declaration)==null?void 0:n.toJSON(e))||null,readsValue:((a=this.readsValue)==null?void 0:a.toReference())||null,parent:this.parent.toReference()})}toJSONClone(e=L){var n,a,s,o,l,p,u,h,f,R,v;let t;return(n=e.seenEntityMaps)!=null&&n.has(this.id)?t=e.seenEntityMaps.get(this.id):(t=e.newId||Ye(this,this.project,e.uuidStrategy),e.seenEntityMaps&&e.seenEntityMaps.set(this.id,t)),(a=e.seenEntities)!=null&&a.has(t)||(s=e.seenEntities)!=null&&s.has(this.id)?this.toReference({seenEntityMaps:e.seenEntityMaps}):((o=e.seenEntities)==null||o.add(t),(l=e.seenEntities)==null||l.add(this.id),{id:t,version:this.version,type:this.type,index:this.index,name:this.name,description:this.description,defaultValue:((p=this.defaultValue)==null?void 0:p.toJSONClone({...e,newId:null}))||null,declaration:(u=this.declaration)!=null&&u.id&&this.project.getBuiltIn((h=this.declaration)==null?void 0:h.id)?(f=this.declaration)==null?void 0:f.toJSON(e.seenEntities):((R=this.declaration)==null?void 0:R.toJSONClone({...e,newId:null}))||null,readsValue:((v=this.readsValue)==null?void 0:v.toReference({seenEntityMaps:e.seenEntityMaps}))||null,parent:this.parent.toReference({seenEntityMaps:e.seenEntityMaps})})}toReference(e=L){var n;let t=this.id;return(n=e.seenEntityMaps)!=null&&n.has(this.id)&&(t=e.seenEntityMaps.get(this.id)),{id:t+"--"+M.UUID.uuid()+"--ref",type:i.GenericReference,entityId:t,entityType:this.type}}toShallowJSON(e=L){var n,a,s,o;let t=this.id;return(n=e.seenEntityMaps)!=null&&n.has(this.id)&&(t=e.seenEntityMaps.get(this.id)),{id:t,version:this.version,type:this.type,name:this.name,description:this.description,index:this.index,defaultValue:((a=this.defaultValue)==null?void 0:a.toReference(e))||null,declaration:((s=this.declaration)==null?void 0:s.toReference(e))||null,readsValue:((o=this.readsValue)==null?void 0:o.toReference(e))||null,parent:this.parent.toReference(e)}}toFlatJSON(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toShallowJSON(),...this.defaultValue?this.defaultValue.toFlatJSON(e):[],...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):[],...this.defaultValue?this.defaultValue.toFlatGenerationTarget(e):[]])}clearErrors(){var e;return this.errors=[],(e=this.defaultValue)==null||e.clearErrors(),this}validate(){const e=W7(this);return this.errors=e,{success:!0,error:null,data:this.toJSON()}}getErrors(){var t;return[...this.errors,...((t=this.defaultValue)==null?void 0:t.getErrors())||[]]}getShallowErrors(){return this.errors}getDefaultValue(){var e;return this.defaultValue||((e=this.declaration)==null?void 0:e.defaultValue)||null}setDefaultValue(e){return this.defaultValue=e,this}clone(e=null,t=null,n=!0){var f;let a=He(e,this);const s=this.toJSON(),o=t||de(w(this,this.project),i.InputMap,a);s.defaultValue=null;const l=o.split("-id"),p=l[l.length-1||0]||o;s.id=o;const u=ke(s,a);e?u.setParent(e):u.setParent(this.parent),n&&u.subscribe(),u.initChildren();const h=(f=this.defaultValue)==null?void 0:f.clone(u,p+"--default-value-id",n);return u.defaultValue=h||null,u}getDataType(){var t;if(this.parent.type===i.Operation)return this.parent.declaration.inferInputMapDataType(this);if(Fe.includes(this.parent.type)){const n=Ur(this.parent),a=n.getDataType();(!a||a.inferred)&&n.inferDataTypeAndSyncInstancesInputsAndOutputs()}const e=(t=this.declaration)==null?void 0:t.getDataType();if(!e){const n=gn(this);if(n)return n}return e||null}};c(Ee,"repository",{create:async e=>e,update:async e=>e,delete:async e=>{},load:async e=>null}),c(Ee,"MUTABLE_BASE_PROPERTIES",["name","description"]),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,"index"]),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",["readsValue"]),c(Ee,"INMUTABLE_UPSTREAM_PROPERTIES",["parent","declaration"]),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 xn=Ee;class Y7 extends xn{constructor(t,n){super(t,n);c(this,"declaration",null);c(this,"parent");c(this,"errors",[])}toJSON(t=new Set){return super.toJSON(t)}}class H7 extends xn{constructor(t,n){super(t,n);c(this,"name",null);c(this,"description",null);c(this,"declaration");c(this,"parent");c(this,"errors",[])}toJSON(t=new Set){return super.toJSON(t)}}function z7(r){const e=S6(),t=r.toJSON();e.safeParse(t).success;const a=[];if(r.id==="exec-sequentially-return-map-id"){const s=Q({id:`${r.id}--${G.PropertyImplementsNonAbstact}`,message:`Property "${w(r,r.project)}" with id "${r.id}" implements a non-abstract property "${w(r,r.project)}" with id "${r.id}".`,issue:null,severity:E.Error,code:G.PropertyImplementsNonAbstact,entity:r});a.push(s.error)}return Be(r.errors,a)}const Re=class Re{constructor(e,t){c(this,"initialData");c(this,"id");c(this,"version");c(this,"index");c(this,"type",i.OutputMap);c(this,"parentRelationType");c(this,"defaultValue",null);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 n=S(e.parent),a=t.get(n);let s;if(e.declaration){const p=S(e.declaration);s=t.get(p)}const o={id:e.id,version:1,type:i.OutputMap,index:(a.outputs||[]).length,defaultValue:null,declaration:s,writesValues:[],parent:a},l=b(o,t);return l.setParent(a),l.initChildren(),l}static validateGenerationTarget(e,t){var l;let n=JSON.parse(JSON.stringify(e));const a=[],s=tt(n,{parent:{list:!1,types:Je.filter(p=>p!==i.Condition)},declaration:{list:!1,types:[i.ReturnDeclaration,i.Property]}},t);n=s.modifiedData;const o=t.get(n.parent);if(o&&Je.filter(p=>p!==i.Condition).includes(o.type)){const p=o.outputs.find(u=>u.declaration.id===S(n.declaration));if(p)a.push(new g({id:`${n.id}--${T.OutputOverwrite}`,code:T.OutputOverwrite,severity:E.Error,message:`Entity of type '${i.OutputMap}' with id '${n.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'.
144
+ 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:n}}hydrateAncestors(){const e=[],t=[],n=[];if(this.initialData.parent){const a=S(this.initialData.parent),s=this.project.get(a);s&&(this.setParent(s),e.push(s))}if(this.initialData.readsValue){const a=S(this.initialData.readsValue),s=this.project.get(a);s&&(this.setValueWriter(s),e.push(s))}if(this.initialData.declaration){const a=S(this.initialData.declaration),s=this.project.get(a);s&&(this.setDeclaration(s),e.push(s))}return qn.hydrateReadsValue(this),{updated:m(e),added:m(t),removed:m(n),self:this}}afterAllChildrenInitialized(){const e=[],t=[],n=[];return this.initialized=!0,{updated:m(e),added:m(t),removed:m(n),self:this}}addSelfToProject(){var a,s;const e=[this],t=[],n=[];if(this.parent.addInput(this),e.push(this.parent),(a=this.readsValue)==null||a.addValueReader(this),this.readsValue&&e.push(this.readsValue),Fe.includes(this.parent.type)&&((s=this.parent.getDataType())!=null&&s.inferred)){const o=this.parent.type===i.VariableDeclaration?this.parent:this.parent.declaration;o.inferDataTypeAndSyncInstancesInputsAndOutputs(),e.push(o,...o.variableInstances)}return{updated:m(e),added:m(t),removed:m(n),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=b(this.initialData.defaultValue,this.project),this.defaultValue.setParent(this),this.defaultValue.initChildren()),this.initialData.declaration&&(this.declaration=b(this.initialData.declaration,this.project)),qn.initReadsValue(this),this.afterAllChildrenInitialized(),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(e=V){return await Ee.repository.load(this.id),this}async create(e=V){return await Ee.repository.create(this.toShallowJSON()),this}async update(e=V){return await Ee.repository.update(this.toShallowJSON()),this}async delete(e=V){return await Ee.repository.delete(this.id),this}remove({ignoreUpstream:e,seenEntities:t}={ignoreUpstream:!1,seenEntities:new Set}){const n=[],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});n.push(...s),a.push(...o)}return this.readsValue&&(n.push(this.readsValue),this.readsValue.removeValueReader(this)),this.defaultValue&&(n.push(this.defaultValue),this.defaultValue.remove({ignoreUpstream:!0,seenEntities:t})),e||(n.push(this.parent),this.parent.removeInput(this)),{affected:n,removed: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:n}=this.defaultValue.restore({seenEntities:e});t.push(...n)}return 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):[],...this.declaration?this.declaration.toFlat(e):[],...this.readsValue?this.readsValue.toFlat(e):[]])}toFlatIds(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.id,...this.defaultValue?this.defaultValue.toFlatIds(e):[],...this.defaultValue?this.defaultValue.toFlatIds(e):[]])}toJSON(e=new Set){var t,n,a;return e.has(this.id)?this.toReference():(e.add(this.id),{id:this.id,version:this.version,type:this.type,index:this.index,name:this.name,description:this.description,defaultValue:((t=this.defaultValue)==null?void 0:t.toJSON(e))||null,declaration:((n=this.declaration)==null?void 0:n.toJSON(e))||null,readsValue:((a=this.readsValue)==null?void 0:a.toReference())||null,parent:this.parent.toReference()})}toJSONClone(e=L){var n,a,s,o,l,p,u,h,f,R,v;let t;return(n=e.seenEntityMaps)!=null&&n.has(this.id)?t=e.seenEntityMaps.get(this.id):(t=e.newId||Ye(this,this.project,e.uuidStrategy),e.seenEntityMaps&&e.seenEntityMaps.set(this.id,t)),(a=e.seenEntities)!=null&&a.has(t)||(s=e.seenEntities)!=null&&s.has(this.id)?this.toReference({seenEntityMaps:e.seenEntityMaps}):((o=e.seenEntities)==null||o.add(t),(l=e.seenEntities)==null||l.add(this.id),{id:t,version:this.version,type:this.type,index:this.index,name:this.name,description:this.description,defaultValue:((p=this.defaultValue)==null?void 0:p.toJSONClone({...e,newId:null}))||null,declaration:(u=this.declaration)!=null&&u.id&&this.project.getBuiltIn((h=this.declaration)==null?void 0:h.id)?(f=this.declaration)==null?void 0:f.toJSON(e.seenEntities):((R=this.declaration)==null?void 0:R.toJSONClone({...e,newId:null}))||null,readsValue:((v=this.readsValue)==null?void 0:v.toReference({seenEntityMaps:e.seenEntityMaps}))||null,parent:this.parent.toReference({seenEntityMaps:e.seenEntityMaps})})}toReference(e=L){var n;let t=this.id;return(n=e.seenEntityMaps)!=null&&n.has(this.id)&&(t=e.seenEntityMaps.get(this.id)),{id:t+"--"+M.UUID.uuid()+"--ref",type:i.GenericReference,entityId:t,entityType:this.type}}toShallowJSON(e=L){var n,a,s,o;let t=this.id;return(n=e.seenEntityMaps)!=null&&n.has(this.id)&&(t=e.seenEntityMaps.get(this.id)),{id:t,version:this.version,type:this.type,name:this.name,description:this.description,index:this.index,defaultValue:((a=this.defaultValue)==null?void 0:a.toReference(e))||null,declaration:((s=this.declaration)==null?void 0:s.toReference(e))||null,readsValue:((o=this.readsValue)==null?void 0:o.toReference(e))||null,parent:this.parent.toReference(e)}}toFlatJSON(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toShallowJSON(),...this.defaultValue?this.defaultValue.toFlatJSON(e):[],...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):[],...this.defaultValue?this.defaultValue.toFlatGenerationTarget(e):[]])}clearErrors(){var e;return this.errors=[],(e=this.defaultValue)==null||e.clearErrors(),this}validate(){const e=W7(this);return this.errors=e,{success:!0,error:null,data:this.toJSON()}}getErrors(){var t;return[...this.errors,...((t=this.defaultValue)==null?void 0:t.getErrors())||[]]}getShallowErrors(){return this.errors}getDefaultValue(){var e;return this.defaultValue||((e=this.declaration)==null?void 0:e.defaultValue)||null}setDefaultValue(e){return this.defaultValue=e,this}clone(e=null,t=null,n=!0){var f;let a=He(e,this);const s=this.toJSON(),o=t||de(w(this,this.project),i.InputMap,a);s.defaultValue=null;const l=o.split("-id"),p=l[l.length-1||0]||o;s.id=o;const u=ke(s,a);e?u.setParent(e):u.setParent(this.parent),n&&u.subscribe(),u.initChildren();const h=(f=this.defaultValue)==null?void 0:f.clone(u,p+"--default-value-id",n);return u.defaultValue=h||null,u}getDataType(){var t;if(this.parent.type===i.Operation)return this.parent.declaration.inferInputMapDataType(this);if(Fe.includes(this.parent.type)){const n=Ur(this.parent),a=n.getDataType();(!a||a.inferred)&&n.inferDataTypeAndSyncInstancesInputsAndOutputs()}const e=(t=this.declaration)==null?void 0:t.getDataType();if(!e){const n=gn(this);if(n)return n}return e||null}};c(Ee,"repository",{create:async e=>e,update:async e=>e,delete:async e=>{},load:async e=>null}),c(Ee,"MUTABLE_BASE_PROPERTIES",["name","description"]),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,"index"]),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",["readsValue"]),c(Ee,"INMUTABLE_UPSTREAM_PROPERTIES",["parent","declaration"]),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 xn=Ee;class Y7 extends xn{constructor(t,n){super(t,n);c(this,"declaration",null);c(this,"parent");c(this,"errors",[])}toJSON(t=new Set){return super.toJSON(t)}}class H7 extends xn{constructor(t,n){super(t,n);c(this,"name",null);c(this,"description",null);c(this,"declaration");c(this,"parent");c(this,"errors",[])}toJSON(t=new Set){return super.toJSON(t)}}function z7(r){const e=S6(),t=r.toJSON();e.safeParse(t).success;const a=[];if(r.id==="exec-sequentially-return-map-id"){const s=Q({id:`${r.id}--${G.PropertyImplementsNonAbstact}`,message:`Property "${w(r,r.project)}" with id "${r.id}" implements a non-abstract property "${w(r,r.project)}" with id "${r.id}".`,issue:null,severity:E.Error,code:G.PropertyImplementsNonAbstact,entity:r});a.push(s.error)}return Be(r.errors,a)}const Re=class Re{constructor(e,t){c(this,"initialData");c(this,"id");c(this,"version");c(this,"index");c(this,"type",i.OutputMap);c(this,"parentRelationType");c(this,"defaultValue",null);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 n=S(e.parent),a=t.get(n);let s;if(e.declaration){const p=S(e.declaration);s=t.get(p)}const o={id:e.id,version:1,type:i.OutputMap,index:(a.outputs||[]).length,defaultValue:null,declaration:s,writesValues:[],parent:a},l=b(o,t);return l.setParent(a),l.initChildren(),l}static validateGenerationTarget(e,t){var l;let n=JSON.parse(JSON.stringify(e));const a=[],s=tt(n,{parent:{list:!1,types:Je.filter(p=>p!==i.Condition)},declaration:{list:!1,types:[i.ReturnDeclaration,i.Property]}},t);n=s.modifiedData;const o=t.get(n.parent);if(o&&Je.filter(p=>p!==i.Condition).includes(o.type)){const p=o.outputs.find(u=>u.declaration.id===(n.declaration?S(n.declaration):null));if(p)a.push(new g({id:`${n.id}--${T.OutputOverwrite}`,code:T.OutputOverwrite,severity:E.Error,message:`Entity of type '${i.OutputMap}' with id '${n.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'.
145
145
  Any value reads can be done with that output-map instead.
146
- 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 u=t.get(n.declaration);if(u&&Fe.includes(o.type)){const h=Ur(o),f=h.dataType,R=(l=h.dataType)==null?void 0:l.entity;f?R?R.type===i.ActionDescriptor?a.push(new g({id:`${n.id}--${B.NoOverlapWithImplementedSignature}`,code:B.NoOverlapWithImplementedSignature,severity:E.Error,message:`Entity of type '${i.OutputMap}' with id '${n.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.
146
+ 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 u=n.declaration?t.get(n.declaration):null;if(u&&Fe.includes(o.type)){const h=Ur(o),f=h.dataType,R=(l=h.dataType)==null?void 0:l.entity;f?R?R.type===i.ActionDescriptor?a.push(new g({id:`${n.id}--${B.NoOverlapWithImplementedSignature}`,code:B.NoOverlapWithImplementedSignature,severity:E.Error,message:`Entity of type '${i.OutputMap}' with id '${n.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.
147
147
  This means it can hold a function-call or operation as its value, to be executed programatically.
148
148
  Output maps can only be added to variables which hold an entity with properties.`,issue:null})):(R.properties||[]).find(I=>I.id===u.id)||a.push(new g({id:`${n.id}--${B.NoOverlapWithImplementedSignature}`,code:B.NoOverlapWithImplementedSignature,severity:E.Error,message:`Entity of type '${i.OutputMap}' with id '${n.id}' cannot be added to the parent entity of type '${o.type}' with id '${o.id}'. The 'declaration' with '${u.id}' of the 'output-map' does not exist in the entity of the 'data-type'.
149
149
  The entity of the data-type has the following properties that can be reads as output maps, ids: '${q((R.properties||[]).map(I=>I.id),"', '","' and '")}'`,issue:null})):a.push(new g({id:`${n.id}--${B.NoOverlapWithImplementedSignature}`,code:B.NoOverlapWithImplementedSignature,severity:E.Error,message:`Entity of type '${i.OutputMap}' with id '${n.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.
@@ -151,7 +151,7 @@ ${ku}`,issue:null})):a.push(new g({id:`${n.id}--${B.NoOverlapWithImplementedSign
151
151
  ${ku}`,issue:null}))}else if(u){const h=o.outputs.find(f=>f.declaration.id===n.declaration);h&&a.push(new g({id:`${n.id}--${T.OutputOverwrite}`,code:T.OutputOverwrite,severity:E.Error,message:`Entity of type '${i.OutputMap}' with id '${n.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.
152
152
  Any value reads can be done with that output-map instead.
153
153
  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,...je(n)),{errors:a,modifiedData:n}}validateGeneratedUpdate(e){const t=[];return e.parent&&t.push(new g({id:`${this.id}--${T.InvalidParentUpdate}`,code:T.InvalidParentUpdate,severity:E.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.
154
- 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}}hydrateAncestors(){const e=[],t=[],n=[];if(this.initialData.parent){const a=S(this.initialData.parent),s=this.project.get(a);s&&(this.setParent(s),e.push(s))}if(this.initialData.declaration){const a=S(this.initialData.declaration),s=this.project.get(a);s&&(this.setDeclaration(s),e.push(s))}return{updated:m(e),added:m(t),removed:m(n),self:this}}afterAllChildrenInitialized(){const e=[],t=[],n=[];return this.initialized=!0,{updated:m(e),added:m(t),removed:m(n),self:this}}addSelfToProject(){var a;const e=[this],t=[],n=[];return this.parentRelationType===ri.Error?Fe.includes(this.parent.type)||(this.parent.error=this):((a=this.declaration)==null?void 0:a.id)===_["value-descriptor"][os.ActionOngoingProcessOutputValue].id?this.parent.process=this:this.parent.addOutput(this),this.writesValues.forEach(s=>{s.setValueWriter(this),e.push(s)}),{updated:m(e),added:m(t),removed:m(n),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,this.initialData.defaultValue&&(this.defaultValue=b(this.initialData.defaultValue,this.project),this.defaultValue.setParent(this),this.defaultValue.initChildren()),is.initWritesValues(this,this.parent.parent),this.initialData.declaration&&(this.declaration=b(this.initialData.declaration,this.project)),this.afterAllChildrenInitialized(),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(e=V){return await Re.repository.load(this.id),this}async create(e=V){return await Re.repository.create(this.toShallowJSON()),this}async update(e=V){return await Re.repository.update(this.toShallowJSON()),this}async delete(e=V){return await Re.repository.delete(this.id),this}remove({ignoreUpstream:e,seenEntities:t}={ignoreUpstream:!1,seenEntities:new Set}){const n=[],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});n.push(...s),a.push(...o)}return this.writesValues.forEach(s=>{n.push(s),s.readsValue=null}),e||(n.push(this.parent),this.parentRelationType===ri.Error?Fe.includes(this.parent.type)||(this.parent.error=null):this.parent.removeOutput(this)),{affected:n,removed: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:n}=this.defaultValue.restore({seenEntities:e});t.push(...n)}return this.writesValues.forEach(n=>{t.push(n),n.setValueWriter(this)}),t.push(this.parent),this.parentRelationType===ri.Error?Fe.includes(this.parent.type)||(this.parent.error=this):this.parent.addOutput(this),{affected:t,self:this}}toFlat(e=new Set){var n;return e.has(this.id)?[]:(e.add(this.id),[this,...((n=this.defaultValue)==null?void 0:n.toFlat(e))||[],...this.writesValues.flatMap(a=>a.toFlat(e))])}toFlatIds(e=new Set){var n;return e.has(this.id)?[]:(e.add(this.id),[this.id,...((n=this.defaultValue)==null?void 0:n.toFlatIds(e))||[],...this.writesValues.flatMap(a=>a.toFlatIds(e))])}toJSON(e=new Set){var t,n;return e.has(this.id)?this.toReference():(e.add(this.id),{id:this.id,version:this.version,type:this.type,index:this.index,parentRelationType:this.parentRelationType,defaultValue:((t=this.defaultValue)==null?void 0:t.toJSON(e))||null,writesValues:this.writesValues.map(a=>a.toJSON(e)),declaration:((n=this.declaration)==null?void 0:n.toJSON(e))||null,parent:this.parent.toReference()})}toJSONClone(e=L){var n,a,s,o,l,p,u,h,f,R;let t;return(n=e.seenEntityMaps)!=null&&n.has(this.id)?t=e.seenEntityMaps.get(this.id):(t=e.newId||Ye(this,this.project,e.uuidStrategy),e.seenEntityMaps&&e.seenEntityMaps.set(this.id,t)),(a=e.seenEntities)!=null&&a.has(t)||(s=e.seenEntities)!=null&&s.has(this.id)?this.toReference({seenEntityMaps:e.seenEntityMaps}):((o=e.seenEntities)==null||o.add(t),(l=e.seenEntities)==null||l.add(this.id),{id:t,version:this.version,type:this.type,index:this.index,parentRelationType:this.parentRelationType,defaultValue:((p=this.defaultValue)==null?void 0:p.toJSONClone({...e,newId:null}))||null,writesValues:this.writesValues.map(v=>v.toJSONClone({...e,newId:null})),declaration:(u=this.declaration)!=null&&u.id&&this.project.getBuiltIn((h=this.declaration)==null?void 0:h.id)?(f=this.declaration)==null?void 0:f.toJSON(e.seenEntities):((R=this.declaration)==null?void 0:R.toJSONClone({...e,newId:null}))||null,parent:this.parent.toReference({seenEntityMaps:e.seenEntityMaps})})}toReference(e=L){var n;let t=this.id;return(n=e.seenEntityMaps)!=null&&n.has(this.id)&&(t=e.seenEntityMaps.get(this.id)),{id:t+"--"+M.UUID.uuid()+"--ref",type:i.GenericReference,entityId:t,entityType:this.type}}toShallowJSON(e=L){var n,a;let t=this.id;return(n=e.seenEntityMaps)!=null&&n.has(this.id)&&(t=e.seenEntityMaps.get(this.id)),{id:t,version:this.version,type:this.type,index:this.index,parentRelationType:this.parentRelationType,defaultValue:((a=this.defaultValue)==null?void 0:a.toReference(e))||null,declaration:this.declaration.toReference(e),writesValues:this.writesValues.map(s=>s.toReference(e)),parent:this.parent.toReference(e)}}toFlatJSON(e=new Set){var n;return e.has(this.id)?[]:(e.add(this.id),[this.toShallowJSON(),...((n=this.defaultValue)==null?void 0:n.toFlatJSON(e))||[],...this.writesValues.flatMap(a=>a.toFlatJSON(e))])}toGenerationTarget(){return{id:this.id,type:this.type,declaration:this.declaration.id,parent:this.parent.id}}toFlatGenerationTarget(e=new Set){var n;return e.has(this.id)?[]:(e.add(this.id),[this.toGenerationTarget(),...((n=this.defaultValue)==null?void 0:n.toFlatGenerationTarget(e))||[],...this.writesValues.flatMap(a=>a.toFlatGenerationTarget(e))])}clearErrors(){var e;return this.errors=[],(e=this.defaultValue)==null||e.clearErrors(),this}validate(){const e=z7(this);return this.errors=e,{success:!0,error:null,data:this.toJSON()}}getErrors(){var t;return[...this.errors,...((t=this.defaultValue)==null?void 0:t.getErrors())||[]]}getShallowErrors(){return this.errors}getDefaultValue(){var e;return this.defaultValue||((e=this.declaration)==null?void 0:e.defaultValue)||null}setDefaultValue(e){return this.defaultValue=e,this}clone(e=null,t=null,n=!0){var R,v;let a=He(e,this);const s=this.toJSON(),o=t||de(w(this,this.project),i.OutputMap,a),l=o.split("-id"),p=l[l.length-1||0]||o;s.id=o;const u=ke(s,a);e?u.setParent(e):u.setParent(this.parent),n&&u.subscribe(),u.initChildren();const h=(R=this.dataType)==null?void 0:R.clone(u,p+"--data-type-id",n);u.dataType=h||null;const f=(v=this.defaultValue)==null?void 0:v.clone(u,p+"-default-value-id",n);return u.defaultValue=f||null,u}getDataType(){var t;return this.parent.type===i.Operation?this.parent.declaration.inferOutputMapDataType(this):((t=this.declaration)==null?void 0:t.getDataType())||null}};c(Re,"repository",{create:async e=>e,update:async e=>e,delete:async e=>{},load:async e=>null}),c(Re,"MUTABLE_BASE_PROPERTIES",[]),c(Re,"INMUTABLE_BASE_PROPERTIES",["id","type","version"]),c(Re,"BASE_PROPERTIES",[...Re.MUTABLE_BASE_PROPERTIES,...Re.INMUTABLE_BASE_PROPERTIES]),c(Re,"MUTABLE_META_PROPERTIES",[...Re.MUTABLE_BASE_PROPERTIES,"index"]),c(Re,"INMUTABLE_META_PROPERTIES",[...Re.INMUTABLE_BASE_PROPERTIES]),c(Re,"META_PROPERTIES",[...Re.MUTABLE_META_PROPERTIES,...Re.INMUTABLE_META_PROPERTIES]),c(Re,"MUTABLE_UPSTREAM_PROPERTIES",[]),c(Re,"INMUTABLE_UPSTREAM_PROPERTIES",["parent","declaration"]),c(Re,"UPSTREAM_PROPERTIES",[...Re.MUTABLE_UPSTREAM_PROPERTIES,...Re.INMUTABLE_UPSTREAM_PROPERTIES]),c(Re,"MUTABLE_DOWNSTREAM_PROPERTIES",["writesValues"]),c(Re,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),c(Re,"DOWNSTREAM_PROPERTIES",[...Re.MUTABLE_DOWNSTREAM_PROPERTIES,...Re.INMUTABLE_DOWNSTREAM_PROPERTIES]),c(Re,"PROPERTIES",[...Re.META_PROPERTIES,...Re.UPSTREAM_PROPERTIES,...Re.DOWNSTREAM_PROPERTIES]);let jn=Re;class Z7 extends jn{constructor(t,n){super(t,n);c(this,"declaration");c(this,"parent");c(this,"errors",[])}toJSON(t=new Set){return super.toJSON(t)}}class K7 extends jn{constructor(t,n){super(t,n);c(this,"declaration");c(this,"parent");c(this,"errors",[])}toJSON(t=new Set){return super.toJSON(t)}}function X7(r){var s;const e=s5(),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=Q({id:`${r.id}--${G.PropertyImplementsNonAbstact}`,message:`Property "${w(r,r.project)}" with id "${r.id}" implements a non-abstract property "${w(r,r.project)}" with id "${r.id}".`,issue:null,severity:E.Error,code:G.PropertyImplementsNonAbstact,entity:r});a.push(o.error)}if(r.id==="manual-hello-world-loop-current-iteration-number-output-map-id"){const o=Q({id:`${r.id}--${G.PropertyImplementsNonAbstact}`,message:`Property "${w(r,r.project)}" with id "${r.id}" implements a non-abstract property "${w(r,r.project)}" with id "${r.id}".`,issue:null,severity:E.Error,code:G.PropertyImplementsNonAbstact,entity:r});a.push(o.error)}return Be(r.errors,a)}const ge=class ge{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,"constant",!0);c(this,"type",i.ArgumentDeclaration);c(this,"defaultValue",null);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,this.constant=!0}static fromGenerationTarget(e,t){const n=S(e.parent),a=t.get(n),s={id:e.id,version:1,name:e.name,type:i.ArgumentDeclaration,index:a.inputs.length,defaultValue:null,description:e.description,required:e.required,constant:!0,implements:null,dataType:null,writesValues:[],parent:a},o=b(s,t);return o.setParent(a),o.initChildren(),o}static validateGenerationTarget(e,t){let n=JSON.parse(JSON.stringify(e));const a=[],s=tt(n,{parent:{list:!1,types:[i.FunctionDeclaration,i.Search,i.Condition]}},t);n=s.modifiedData;const o=Lu(n,t);if(n.parent){const l=t.get(S(n.parent));if(l&&We.includes(l.type)){const p=l.implements;if(p){const u=p.inputs.find(D=>D.name===n.name),h=p.inputs.filter(D=>!l.inputs.find($=>$.type===i.ArgumentDeclaration&&$.name===D.name)),f=l.inputs.filter(D=>D.type===i.ArgumentDeclaration),R=f.find(D=>D.name===n.name),v=f.length?`The parent entity already implements the following arguments: ${q(f.map(D=>`'${D.id}' (${D.name})`),", "," and ")}.`:"The parent entity does not yet have any implemented arguments.",I=h.length?`The parent entity is still missing the following arguments in the implementation: ${q(h.map(D=>`'${D.id}' (${D.name})`),", "," and ")}.`:"The parent entity has all the arguments it needs implemented.";u?R&&a.push(new g({id:`${n.id}--${B.NoOverlapWithImplementedSignature}`,code:B.NoOverlapWithImplementedSignature,severity:E.Error,message:`Entity of type '${i.ArgumentDeclaration}' with id '${n.id}' should not exist in a parent entity of type '${l.type}' with id '${l.id}' that implements a ${i.ActionDescriptor} with fixed arguments.
154
+ 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}}hydrateAncestors(){const e=[],t=[],n=[];if(this.initialData.parent){const a=S(this.initialData.parent),s=this.project.get(a);s&&(this.setParent(s),e.push(s))}if(this.initialData.declaration){const a=S(this.initialData.declaration),s=this.project.get(a);s&&(this.setDeclaration(s),e.push(s))}return{updated:m(e),added:m(t),removed:m(n),self:this}}afterAllChildrenInitialized(){const e=[],t=[],n=[];return this.initialized=!0,{updated:m(e),added:m(t),removed:m(n),self:this}}addSelfToProject(){var a;const e=[this],t=[],n=[];return this.parentRelationType===ri.Error?Fe.includes(this.parent.type)||(this.parent.error=this):((a=this.declaration)==null?void 0:a.id)===_["value-descriptor"][os.ActionOngoingProcessOutputValue].id?this.parent.process=this:this.parent.addOutput(this),this.writesValues.forEach(s=>{s.setValueWriter(this),e.push(s)}),{updated:m(e),added:m(t),removed:m(n),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,this.initialData.defaultValue&&(this.defaultValue=b(this.initialData.defaultValue,this.project),this.defaultValue.setParent(this),this.defaultValue.initChildren()),is.initWritesValues(this,this.parent.parent),this.initialData.declaration&&(this.declaration=b(this.initialData.declaration,this.project)),this.afterAllChildrenInitialized(),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(e=V){return await Re.repository.load(this.id),this}async create(e=V){return await Re.repository.create(this.toShallowJSON()),this}async update(e=V){return await Re.repository.update(this.toShallowJSON()),this}async delete(e=V){return await Re.repository.delete(this.id),this}remove({ignoreUpstream:e,seenEntities:t}={ignoreUpstream:!1,seenEntities:new Set}){const n=[],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});n.push(...s),a.push(...o)}return this.writesValues.forEach(s=>{n.push(s),s.readsValue=null}),e||(n.push(this.parent),this.parentRelationType===ri.Error?Fe.includes(this.parent.type)||(this.parent.error=null):this.parent.removeOutput(this)),{affected:n,removed: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:n}=this.defaultValue.restore({seenEntities:e});t.push(...n)}return this.writesValues.forEach(n=>{t.push(n),n.setValueWriter(this)}),t.push(this.parent),this.parentRelationType===ri.Error?Fe.includes(this.parent.type)||(this.parent.error=this):this.parent.addOutput(this),{affected:t,self:this}}toFlat(e=new Set){var n;return e.has(this.id)?[]:(e.add(this.id),[this,...((n=this.defaultValue)==null?void 0:n.toFlat(e))||[],...this.writesValues.flatMap(a=>a.toFlat(e))])}toFlatIds(e=new Set){var n;return e.has(this.id)?[]:(e.add(this.id),[this.id,...((n=this.defaultValue)==null?void 0:n.toFlatIds(e))||[],...this.writesValues.flatMap(a=>a.toFlatIds(e))])}toJSON(e=new Set){var t,n;return e.has(this.id)?this.toReference():(e.add(this.id),{id:this.id,version:this.version,type:this.type,index:this.index,parentRelationType:this.parentRelationType,defaultValue:((t=this.defaultValue)==null?void 0:t.toJSON(e))||null,writesValues:this.writesValues.map(a=>a.toJSON(e)),declaration:((n=this.declaration)==null?void 0:n.toJSON(e))||null,parent:this.parent.toReference()})}toJSONClone(e=L){var n,a,s,o,l,p,u,h,f,R;let t;return(n=e.seenEntityMaps)!=null&&n.has(this.id)?t=e.seenEntityMaps.get(this.id):(t=e.newId||Ye(this,this.project,e.uuidStrategy),e.seenEntityMaps&&e.seenEntityMaps.set(this.id,t)),(a=e.seenEntities)!=null&&a.has(t)||(s=e.seenEntities)!=null&&s.has(this.id)?this.toReference({seenEntityMaps:e.seenEntityMaps}):((o=e.seenEntities)==null||o.add(t),(l=e.seenEntities)==null||l.add(this.id),{id:t,version:this.version,type:this.type,index:this.index,parentRelationType:this.parentRelationType,defaultValue:((p=this.defaultValue)==null?void 0:p.toJSONClone({...e,newId:null}))||null,writesValues:this.writesValues.map(v=>v.toJSONClone({...e,newId:null})),declaration:(u=this.declaration)!=null&&u.id&&this.project.getBuiltIn((h=this.declaration)==null?void 0:h.id)?(f=this.declaration)==null?void 0:f.toJSON(e.seenEntities):((R=this.declaration)==null?void 0:R.toJSONClone({...e,newId:null}))||null,parent:this.parent.toReference({seenEntityMaps:e.seenEntityMaps})})}toReference(e=L){var n;let t=this.id;return(n=e.seenEntityMaps)!=null&&n.has(this.id)&&(t=e.seenEntityMaps.get(this.id)),{id:t+"--"+M.UUID.uuid()+"--ref",type:i.GenericReference,entityId:t,entityType:this.type}}toShallowJSON(e=L){var n,a,s;let t=this.id;return(n=e.seenEntityMaps)!=null&&n.has(this.id)&&(t=e.seenEntityMaps.get(this.id)),{id:t,version:this.version,type:this.type,index:this.index,parentRelationType:this.parentRelationType,defaultValue:((a=this.defaultValue)==null?void 0:a.toReference(e))||null,declaration:(s=this.declaration)==null?void 0:s.toReference(e),writesValues:this.writesValues.map(o=>o.toReference(e)),parent:this.parent.toReference(e)}}toFlatJSON(e=new Set){var n;return e.has(this.id)?[]:(e.add(this.id),[this.toShallowJSON(),...((n=this.defaultValue)==null?void 0:n.toFlatJSON(e))||[],...this.writesValues.flatMap(a=>a.toFlatJSON(e))])}toGenerationTarget(){var e;return{id:this.id,type:this.type,declaration:((e=this.declaration)==null?void 0:e.id)||null,parent:this.parent.id}}toFlatGenerationTarget(e=new Set){var n;return e.has(this.id)?[]:(e.add(this.id),[this.toGenerationTarget(),...((n=this.defaultValue)==null?void 0:n.toFlatGenerationTarget(e))||[],...this.writesValues.flatMap(a=>a.toFlatGenerationTarget(e))])}clearErrors(){var e;return this.errors=[],(e=this.defaultValue)==null||e.clearErrors(),this}validate(){const e=z7(this);return this.errors=e,{success:!0,error:null,data:this.toJSON()}}getErrors(){var t;return[...this.errors,...((t=this.defaultValue)==null?void 0:t.getErrors())||[]]}getShallowErrors(){return this.errors}getDefaultValue(){var e;return this.defaultValue||((e=this.declaration)==null?void 0:e.defaultValue)||null}setDefaultValue(e){return this.defaultValue=e,this}clone(e=null,t=null,n=!0){var R,v;let a=He(e,this);const s=this.toJSON(),o=t||de(w(this,this.project),i.OutputMap,a),l=o.split("-id"),p=l[l.length-1||0]||o;s.id=o;const u=ke(s,a);e?u.setParent(e):u.setParent(this.parent),n&&u.subscribe(),u.initChildren();const h=(R=this.dataType)==null?void 0:R.clone(u,p+"--data-type-id",n);u.dataType=h||null;const f=(v=this.defaultValue)==null?void 0:v.clone(u,p+"-default-value-id",n);return u.defaultValue=f||null,u}getDataType(){var t;return this.parent.type===i.Operation?this.parent.declaration.inferOutputMapDataType(this):((t=this.declaration)==null?void 0:t.getDataType())||null}};c(Re,"repository",{create:async e=>e,update:async e=>e,delete:async e=>{},load:async e=>null}),c(Re,"MUTABLE_BASE_PROPERTIES",[]),c(Re,"INMUTABLE_BASE_PROPERTIES",["id","type","version"]),c(Re,"BASE_PROPERTIES",[...Re.MUTABLE_BASE_PROPERTIES,...Re.INMUTABLE_BASE_PROPERTIES]),c(Re,"MUTABLE_META_PROPERTIES",[...Re.MUTABLE_BASE_PROPERTIES,"index"]),c(Re,"INMUTABLE_META_PROPERTIES",[...Re.INMUTABLE_BASE_PROPERTIES]),c(Re,"META_PROPERTIES",[...Re.MUTABLE_META_PROPERTIES,...Re.INMUTABLE_META_PROPERTIES]),c(Re,"MUTABLE_UPSTREAM_PROPERTIES",[]),c(Re,"INMUTABLE_UPSTREAM_PROPERTIES",["parent","declaration"]),c(Re,"UPSTREAM_PROPERTIES",[...Re.MUTABLE_UPSTREAM_PROPERTIES,...Re.INMUTABLE_UPSTREAM_PROPERTIES]),c(Re,"MUTABLE_DOWNSTREAM_PROPERTIES",["writesValues"]),c(Re,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),c(Re,"DOWNSTREAM_PROPERTIES",[...Re.MUTABLE_DOWNSTREAM_PROPERTIES,...Re.INMUTABLE_DOWNSTREAM_PROPERTIES]),c(Re,"PROPERTIES",[...Re.META_PROPERTIES,...Re.UPSTREAM_PROPERTIES,...Re.DOWNSTREAM_PROPERTIES]);let jn=Re;class Z7 extends jn{constructor(t,n){super(t,n);c(this,"declaration");c(this,"parent");c(this,"errors",[])}toJSON(t=new Set){return super.toJSON(t)}}class K7 extends jn{constructor(t,n){super(t,n);c(this,"declaration");c(this,"parent");c(this,"errors",[])}toJSON(t=new Set){return super.toJSON(t)}}function X7(r){var s;const e=s5(),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=Q({id:`${r.id}--${G.PropertyImplementsNonAbstact}`,message:`Property "${w(r,r.project)}" with id "${r.id}" implements a non-abstract property "${w(r,r.project)}" with id "${r.id}".`,issue:null,severity:E.Error,code:G.PropertyImplementsNonAbstact,entity:r});a.push(o.error)}if(r.id==="manual-hello-world-loop-current-iteration-number-output-map-id"){const o=Q({id:`${r.id}--${G.PropertyImplementsNonAbstact}`,message:`Property "${w(r,r.project)}" with id "${r.id}" implements a non-abstract property "${w(r,r.project)}" with id "${r.id}".`,issue:null,severity:E.Error,code:G.PropertyImplementsNonAbstact,entity:r});a.push(o.error)}return Be(r.errors,a)}const ge=class ge{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,"constant",!0);c(this,"type",i.ArgumentDeclaration);c(this,"defaultValue",null);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,this.constant=!0}static fromGenerationTarget(e,t){const n=S(e.parent),a=t.get(n),s={id:e.id,version:1,name:e.name,type:i.ArgumentDeclaration,index:a.inputs.length,defaultValue:null,description:e.description,required:e.required,constant:!0,implements:null,dataType:null,writesValues:[],parent:a},o=b(s,t);return o.setParent(a),o.initChildren(),o}static validateGenerationTarget(e,t){let n=JSON.parse(JSON.stringify(e));const a=[],s=tt(n,{parent:{list:!1,types:[i.FunctionDeclaration,i.Search,i.Condition]}},t);n=s.modifiedData;const o=Lu(n,t);if(n.parent){const l=t.get(S(n.parent));if(l&&We.includes(l.type)){const p=l.implements;if(p){const u=p.inputs.find(D=>D.name===n.name),h=p.inputs.filter(D=>!l.inputs.find($=>$.type===i.ArgumentDeclaration&&$.name===D.name)),f=l.inputs.filter(D=>D.type===i.ArgumentDeclaration),R=f.find(D=>D.name===n.name),v=f.length?`The parent entity already implements the following arguments: ${q(f.map(D=>`'${D.id}' (${D.name})`),", "," and ")}.`:"The parent entity does not yet have any implemented arguments.",I=h.length?`The parent entity is still missing the following arguments in the implementation: ${q(h.map(D=>`'${D.id}' (${D.name})`),", "," and ")}.`:"The parent entity has all the arguments it needs implemented.";u?R&&a.push(new g({id:`${n.id}--${B.NoOverlapWithImplementedSignature}`,code:B.NoOverlapWithImplementedSignature,severity:E.Error,message:`Entity of type '${i.ArgumentDeclaration}' with id '${n.id}' should not exist in a parent entity of type '${l.type}' with id '${l.id}' that implements a ${i.ActionDescriptor} with fixed arguments.
155
155
  Adding a new argument would make the implementation invalid. An argument with the same name already exists in the parent entity.
156
156
  ${v}
157
157
  ${I}`,issue:null})):a.push(new g({id:`${n.id}--${B.NoOverlapWithImplementedSignature}`,code:B.NoOverlapWithImplementedSignature,severity:E.Error,message:`Entity of type '${i.ArgumentDeclaration}' with id '${n.id}' should not exist in a parent entity of type '${l.type}' with id '${l.id}' that implements a ${i.ActionDescriptor} with fixed arguments.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elyx-code/project-logic-tree",
3
- "version": "0.0.6124",
3
+ "version": "0.0.6125",
4
4
  "author": "Sergio Herrero",
5
5
  "license": "UNLICENSED",
6
6
  "description": "An installable module which contains the type definitions and ephemeral state management for a projects' logic tree data structure",