@elyx-code/project-logic-tree 0.0.6230 → 0.0.6232

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -54024,6 +54024,7 @@ This is likely an incorrect strategy, either the '${this.type}' entity doesn't n
54024
54024
  "remove-entity"
54025
54025
  )
54026
54026
  )) {
54027
+ var l;
54027
54028
  const r = [], s = [], d = [], o = [];
54028
54029
  if (t != null && t.hasRemoved(this.id))
54029
54030
  return t == null || t.attemptAutoclose("remove-entity", this.id), {
@@ -54033,27 +54034,42 @@ This is likely an incorrect strategy, either the '${this.type}' entity doesn't n
54033
54034
  affected: [],
54034
54035
  self: this
54035
54036
  };
54036
- if (s.push(this), this.unsubscribe(), this.project.subscribeDeletedInstance(this), this.metaSync({ deleted: !0 }, t), Object.values(this.detachedDependents).forEach((l) => {
54037
+ if (s.push(this), this.unsubscribe(), this.project.subscribeDeletedInstance(this), this.metaSync({ deleted: !0 }, t), Object.values(this.detachedDependents).forEach((u) => {
54037
54038
  const {
54038
- updated: u,
54039
- removed: h,
54040
- added: c
54041
- } = l.entity.onDetachedDependencyRemoved(
54039
+ updated: h,
54040
+ removed: c,
54041
+ added: T
54042
+ } = u.entity.onDetachedDependencyRemoved(
54042
54043
  this,
54043
- l.field,
54044
+ u.field,
54044
54045
  t
54045
54046
  );
54046
- r.push(...u), s.push(...h), d.push(...c);
54047
+ r.push(...h), s.push(...c), d.push(...T);
54047
54048
  }), this.defaultValue) {
54048
- const { updated: l, removed: u } = this.defaultValue.remove(
54049
+ const { updated: u, removed: h } = this.defaultValue.remove(
54049
54050
  {
54050
54051
  ignoreUpstream: !0
54051
54052
  },
54052
54053
  t
54053
54054
  );
54054
- r.push(...l), s.push(...u);
54055
+ r.push(...u), s.push(...h);
54056
+ }
54057
+ if (this.readsValue && (r.push(this.readsValue), this.readsValue.removeValueReader(this, t)), this.defaultValue && (r.push(this.defaultValue), this.defaultValue.remove({ ignoreUpstream: !0 }, t)), this.declaration) {
54058
+ if (
54059
+ // If the declaration is a property, aprt of an inferred, dynamic data type entity, we delete the property too
54060
+ this.declaration.type === n.Property && this.declaration.parent.type === n.DefinitionEntity && this.declaration.parent.parent.type === n.DataType && !(t != null && t.hasRemoved(this.declaration.id)) && !this.declaration.deleted
54061
+ ) {
54062
+ const { updated: u, removed: h } = this.declaration.remove({ ignoreUpstream: !1 }, t);
54063
+ r.push(...u), s.push(...h);
54064
+ } else if (
54065
+ // If the declaraiton if a value-descriptor, part of a search statement, we delete the value-descriptor too
54066
+ this.declaration.type === n.ValueDescriptor && ((l = this.declaration.parent) == null ? void 0 : l.type) === n.Search && !(t != null && t.hasRemoved(this.declaration.id)) && !this.declaration.deleted
54067
+ ) {
54068
+ const { updated: u, removed: h } = this.declaration.remove({ ignoreUpstream: !1 }, t);
54069
+ r.push(...u), s.push(...h);
54070
+ }
54055
54071
  }
54056
- return this.readsValue && (r.push(this.readsValue), this.readsValue.removeValueReader(this, t)), this.defaultValue && (r.push(this.defaultValue), this.defaultValue.remove({ ignoreUpstream: !0 }, t)), e || (r.push(this.parent), this.parent.removeInput(
54072
+ return e || (r.push(this.parent), this.parent.removeInput(
54057
54073
  this,
54058
54074
  t
54059
54075
  )), t == null || t.attemptAutoclose("remove-entity", this.id), {
@@ -57348,7 +57364,7 @@ This is likely an incorrect strategy, either the '${this.type}' entity doesn't n
57348
57364
  };
57349
57365
  }
57350
57366
  toJSON(e = /* @__PURE__ */ new Set()) {
57351
- var t, r;
57367
+ var t, r, s;
57352
57368
  return e.has(this.id) ? this.toReference() : (e.add(this.id), {
57353
57369
  id: this.id,
57354
57370
  version: this.version,
@@ -57364,13 +57380,14 @@ This is likely an incorrect strategy, either the '${this.type}' entity doesn't n
57364
57380
  e
57365
57381
  )) || null,
57366
57382
  valueAsTypeList: Array.isArray(this.valueAsTypeSingle) ? this.valueAsTypeSingle.map(
57367
- (s) => s.toJSON(e)
57383
+ (d) => d.toJSON(e)
57368
57384
  ) : null,
57369
- parent: (r = this.parent) == null ? void 0 : r.toReference()
57385
+ parent: (r = this.parent) == null ? void 0 : r.toReference(),
57386
+ standaloneParent: (s = this.standaloneParent) == null ? void 0 : s.toReference()
57370
57387
  });
57371
57388
  }
57372
57389
  toJSONClone(e = J) {
57373
- var r, s, d, o, l, u;
57390
+ var r, s, d, o, l, u, h;
57374
57391
  let t;
57375
57392
  return (r = e.seenEntityMaps) != null && r.has(this.id) ? t = e.seenEntityMaps.get(this.id) : (t = e.newId || ht(this, this.project, e.uuidStrategy), e.seenEntityMaps && e.seenEntityMaps.set(this.id, t)), (s = e.seenEntities) != null && s.has(t) || (d = e.seenEntities) != null && d.has(this.id) ? this.toReference({ seenEntityMaps: e.seenEntityMaps }) : ((o = e.seenEntities) == null || o.add(t), (l = e.seenEntities) == null || l.add(this.id), {
57376
57393
  id: t,
@@ -57386,10 +57403,13 @@ This is likely an incorrect strategy, either the '${this.type}' entity doesn't n
57386
57403
  // @ts-ignore
57387
57404
  valueAsTypeSingle: this.valueAsTypeSingle ? this.project.getBuiltIn(this.valueAsTypeSingle.id) ? this.valueAsTypeSingle.toJSON() : this.valueAsTypeSingle.toJSONClone({ ...e, newId: null }) : null,
57388
57405
  valueAsTypeList: this.valueAsTypeSingle && Array.isArray(this.valueAsTypeSingle) ? this.valueAsTypeSingle.map(
57389
- (h) => this.project.getBuiltIn(h.id) ? h.toJSON() : h.toJSONClone({ ...e, newId: null })
57406
+ (c) => this.project.getBuiltIn(c.id) ? c.toJSON() : c.toJSONClone({ ...e, newId: null })
57390
57407
  ) : null,
57391
57408
  parent: (u = this.parent) == null ? void 0 : u.toReference({
57392
57409
  seenEntityMaps: e.seenEntityMaps
57410
+ }),
57411
+ standaloneParent: (h = this.standaloneParent) == null ? void 0 : h.toReference({
57412
+ seenEntityMaps: e.seenEntityMaps
57393
57413
  })
57394
57414
  });
57395
57415
  }
@@ -57405,7 +57425,7 @@ This is likely an incorrect strategy, either the '${this.type}' entity doesn't n
57405
57425
  };
57406
57426
  }
57407
57427
  toShallowJSON(e = J) {
57408
- var r, s, d;
57428
+ var r, s, d, o;
57409
57429
  let t = this.id;
57410
57430
  return (r = e.seenEntityMaps) != null && r.has(this.id) && (t = e.seenEntityMaps.get(this.id)), {
57411
57431
  id: t,
@@ -57420,11 +57440,12 @@ This is likely an incorrect strategy, either the '${this.type}' entity doesn't n
57420
57440
  e
57421
57441
  )) || null,
57422
57442
  valueAsTypeList: Array.isArray(this.valueAsTypeSingle) ? this.valueAsTypeSingle.map(
57423
- (o) => o.toReference(e)
57443
+ (l) => l.toReference(e)
57424
57444
  ) : null,
57425
57445
  value: this.value,
57426
57446
  autogeneration: this.autogeneration,
57427
- parent: (d = this.parent) == null ? void 0 : d.toReference(e)
57447
+ parent: (d = this.parent) == null ? void 0 : d.toReference(e),
57448
+ standaloneParent: (o = this.standaloneParent) == null ? void 0 : o.toReference(e)
57428
57449
  };
57429
57450
  }
57430
57451
  toFlatJSON(e = /* @__PURE__ */ new Set()) {
@@ -57437,16 +57458,17 @@ This is likely an incorrect strategy, either the '${this.type}' entity doesn't n
57437
57458
  ]);
57438
57459
  }
57439
57460
  toGenerationTarget() {
57440
- var e, t;
57461
+ var e, t, r;
57441
57462
  return {
57442
57463
  id: this.id,
57443
57464
  type: this.type,
57444
57465
  name: this.name,
57445
57466
  valueAsTypeSingle: ((e = this.valueAsTypeSingle) == null ? void 0 : e.id) || null,
57446
- valueAsTypeList: Array.isArray(this.valueAsTypeSingle) ? this.valueAsTypeSingle.map((r) => r.id) : null,
57467
+ valueAsTypeList: Array.isArray(this.valueAsTypeSingle) ? this.valueAsTypeSingle.map((s) => s.id) : null,
57447
57468
  value: this.value,
57448
57469
  autogeneration: this.autogeneration,
57449
- parent: (t = this.parent) == null ? void 0 : t.id
57470
+ parent: (t = this.parent) == null ? void 0 : t.id,
57471
+ standaloneParent: (r = this.standaloneParent) == null ? void 0 : r.id
57450
57472
  };
57451
57473
  }
57452
57474
  toFlatGenerationTarget(e = /* @__PURE__ */ new Set()) {
@@ -155,7 +155,7 @@ Input maps can only be added to variables which hold an entity with properties.`
155
155
  The entity of the data-type has the following properties that can be reads as input maps, ids: '${se(O.properties.map(V=>V.id),"', '","' and '")}'`,issue:null})))}else if(lt.filter(c=>it.includes(c)).includes(o.type)){const I=Kc(o),E=I.find(P=>P.id===i.declaration),O=`The parent entity has the following argument declarations that can be referenced by input-maps, ids: '${se(I.map(P=>P.id),"', '","' and '")}'`;E||s.push(new w({id:`${i.id}--${$.NoOverlapWithImplementedSignature}`,code:$.NoOverlapWithImplementedSignature,severity:D.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}'.
156
156
  You can't add an input-map to an entity that doesn't have a matching 'argument-declaration'.
157
157
  ${O}`,issue:null}))}}return s.push(...d.errors,...pt(i)),{errors:s,modifiedData:i}}get codeNativeValueValidation(){var e;return this._codeNativeValueValidation||((e=this.declaration)==null?void 0:e.codeNativeValueValidation)||null}validateGeneratedUpdate(e){const t=[];let i=JSON.parse(JSON.stringify(e));const s=_a(i,this);return i=s.modifiedData,t.push(...s.errors),i.parent&&t.push(new w({id:`${this.id}--${R.InvalidParentUpdate}`,code:R.InvalidParentUpdate,severity:D.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.
158
- 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}}subscribeDependents(e){return e.forEach(t=>{this.detachedDependents[t.entity.id]||(this.detachedDependents[t.entity.id]=t)}),this}syncDependents(e=this.project.addChangeSet(new A(this.project,m.sessionAuthor,T().toISOString(),this,!0,"sync-dependents"))){const t=[],i=[],s=[],d=[];return Object.values(this.detachedDependents).forEach(o=>{const l=o.entity.afterAllChildrenInitialized(e);t.push(...l.updated),i.push(...l.added),s.push(...l.removed),d.push(...l.affected)}),e==null||e.attemptAutoclose("sync-dependents",this.id),{updated:p(t),added:p(i),removed:p(s),affected:p(d),self:this}}onDetachedDependencyRemoved(e,t,i){const s=[],d=[],o=[],l=[];if(t==="declaration"){const{updated:u,added:y,removed:c}=this.remove({ignoreUpstream:!1},i);s.push(...u),d.push(...y),o.push(...c)}return{updated:p(s),added:p(d),removed:p(o),affected:p(l),self:this}}onDetachedDependencyRestored(e,t,i){const s=[],d=[],o=[],l=[];if(t==="declaration"){const{updated:u,added:y,removed:c}=this.restore({},i);s.push(...u),d.push(...y),o.push(...c)}return{updated:p(s),added:p(d),removed:p(o),affected:p(l),self:this}}subscribeToDependencies(){var e,t,i,s,d;return(t=(e=this.declaration)==null?void 0:e.subscribeDependents)==null||t.call(e,[{entity:this,field:"declaration"}]),(d=(s=(i=this.dataType)==null?void 0:i.entity)==null?void 0:s.subscribeDependents)==null||d.call(s,[{entity:this,field:"data-type-entity"}]),this}increaseVersion(e){if(e&&!T(e).isValid())throw new Error(`The shared timestamp '${e}' is not a valid ISO 8601 date string.`);return e&&T(e).isSame(T(this.createdAt))?this:(this.previousVersion=this.version,this.version=m.UUID.uuid(),this.createdAt=T(e).toISOString()||T().toISOString(),this)}captureVersion(){var t;const e=((t=this.knownVersions)==null?void 0:t.get(this.version))||new _e(this,this.project);return e.metaSync(this.toMeta(),null),this.knownVersions=this.knownVersions?this.knownVersions.set(this.version,e):new Map([[this.version,e]]),e.declaration=this.declaration,e.defaultValue=this.defaultValue,e.readsValue=this.readsValue,e.dataType=this.dataType,e.parent=this.parent,this}recursiveCaptureUpstreamVersions(e){const t=[],i=[],s=[],d=[];if(this.parent){this.parent.increaseVersion(e);const o=this.parent.recursiveCaptureUpstreamVersions(e);t.push(this.parent,...o.updated),i.push(...o.added),s.push(...o.removed)}return{updated:p(t),added:p(i),removed:p(s),affected:p(d),self:this}}async restoreVersion(e){var l;const t=[],i=[],s=[],d=[];if(this.version===e)return{updated:p(t),added:p(i),removed:p(s),affected:p(d),self:this};if(!this.knownVersions){const u=new Map;for(const[y,c]of this.knownVersions||new Map){if(u.set(y,c),c.activeVersion=!1,c.knownVersions)for(const[I,E]of c.knownVersions)u.set(I,E);c.knownVersions=null}}let o=(l=this.knownVersions)==null?void 0:l.get(e);if(!o){const u=await this.APILoadVersion({},e);if(!u)throw new Error(`Version with id '${e}' for entity with id '${this.id}' not found.`);o=new _e(u,this.project)}return this.metaSync(o.toShallowJSON(),null),this.declaration=o.declaration,this.defaultValue=o.defaultValue,this.readsValue=o.readsValue,this.dataType=o.dataType,this.parent=o.parent,{updated:p(t),added:p(i),removed:p(s),affected:p(d),self:this}}hydrateAncestors(){const e=[],t=[],i=[],s=[];if(this.initialData.parent){const d=_(this.initialData.parent),o=this.project.get(d);if(o)this.setParent(o,null),e.push(o);else throw new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${d}' that isn't found in the project`)}else throw new Error(`${this.type} with id '${this.id}' must have a 'parent'`);if(this.initialData.readsValue){const d=_(this.initialData.readsValue),o=this.project.get(d);o&&(this.setValueWriter(o,null),e.push(o))}if(this.initialData.declaration){const d=_(this.initialData.declaration),o=this.project.get(d);o&&(this.setDeclaration(o),e.push(o))}return Rr.hydrateReadsValue(this),{updated:p(e),added:p(t),removed:p(i),affected:p(s),self:this}}afterAllChildrenInitialized(e=this.project.addChangeSet(new A(this.project,m.sessionAuthor,T().toISOString(),this,!0,"after-all-children-initialized"))){const t=[],i=[],s=[],d=[];return this.initialized=!0,this.captureVersion(),e==null||e.attemptAutoclose("after-all-children-initialized",this.id),{updated:p(t),added:p(i),removed:p(s),affected:p(d),self:this}}addSelfToProject(e=this.project.addChangeSet(new A(this.project,m.sessionAuthor,T().toISOString(),this,!0,"add-self-to-project"))){var o,l;const t=[this],i=[],s=[],d=[];if(this.parent.addInput(this,e),t.push(this.parent),(o=this.readsValue)==null||o.addValueReader(this,e),this.readsValue&&t.push(this.readsValue),it.includes(this.parent.type)&&((l=this.parent.getDataType(e))!=null&&l.inferred)){const u=this.parent.type===n.VariableDeclaration?this.parent:this.parent.declaration,{updated:y,added:c,removed:I,affected:E}=u.inferDataTypeAndSyncInstancesInputsAndOutputs(e);t.push(...y),i.push(...c),s.push(...I),d.push(...E),t.push(u,...u.variableInstances)}return this.subscribe(),this.subscribeToDependencies(),e==null||e.attemptAutoclose("add-self-to-project",this.id),{updated:p(t),added:p(i),removed:p(s),affected:p(d),self:this}}setParent(e,t=this.project.addChangeSet(new A(this.project,m.sessionAuthor,T().toISOString(),this,!0,"set-parent"))){var i;return((i=this.parent)==null?void 0:i.id)!==(e==null?void 0:e.id)&&(this.parent=e,t&&(t==null||t.add(this,b.Updated),t==null||t.attemptAutoclose("set-parent",this.id))),this}setDataType(e){return this.dataType=e,this}removeDataType(){return this.dataType=null,this}setDeclaration(e){return this.declaration=e,this}initChildren(e=this.project.addChangeSet(new A(this.project,m.sessionAuthor,T().toISOString(),this,!0,"init-children"))){return this.initialized||this.startedInitialization?this:(this.startedInitialization=!0,this.initialData.defaultValue&&(this.defaultValue=C(this.initialData.defaultValue,this.project),this.defaultValue.setParent(this,null),this.defaultValue.initChildren(e)),this.initialData.declaration&&(this.declaration=C(this.initialData.declaration,this.project)),Rr.initReadsValue(this),this.subscribeToDependencies(),this.afterAllChildrenInitialized(e),e==null||e.attemptAutoclose("init-children",this.id),this)}setValueWriter(e,t=this.project.addChangeSet(new A(this.project,m.sessionAuthor,T().toISOString(),this,!0,"set-value-writer"))){return this.readsValue!==e&&(this.readsValue=e,t==null||t.add(this,b.Updated)),t==null||t.attemptAutoclose("set-value-writer",this.id),this}removeValueWriter(e=this.project.addChangeSet(new A(this.project,m.sessionAuthor,T().toISOString(),this,!0,"remove-value-writer"))){return this.readsValue&&(this.readsValue=null,e==null||e.add(this,b.Updated)),e==null||e.attemptAutoclose("remove-value-writer",this.id),this}subscribe(){return this.activeVersion=!0,this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}metaSync(e,t=this.project.addChangeSet(new A(this.project,m.sessionAuthor,T().toISOString(),this,!0,"meta-sync"))){const i=ct(this,e),s=this.toMeta();return this.index=e.index||(e.index!==0?s.index:0),this.name=e.name!==void 0?e.name:s.name,this.description=e.description!==void 0?e.description:s.description,super.metaSync(e),e.deleted===!0&&!s.deleted?t==null||t.add(this,b.Removed):e.deleted===!1&&s.deleted?t==null||t.add(this,b.Added):i&&(t==null||t.add(this,b.Updated)),t==null||t.attemptAutoclose("meta-sync",this.id),this}async APILoad(e=U,...t){return await _e.repository.APILoad(this.id,...t),this}async APICreate(e=U,...t){return await _e.repository.APICreate(this.toShallowJSON(),...t),this}async APIUpdate(e=U,...t){return await _e.repository.APIUpdate(this.toShallowJSON(),...t),this}async APIDelete(e=U,...t){return await _e.repository.APIDelete(this.toShallowJSON(),...t),this}async APIClone(e=U,...t){return await _e.repository.APIClone(this.id,...t),this}async APILoadVersion(e=U,t,...i){return await _e.repository.APILoadVersion(this.id,t,...i)}remove({ignoreUpstream:e}={ignoreUpstream:!1},t=this.project.addChangeSet(new A(this.project,m.sessionAuthor,T().toISOString(),this,!0,"remove-entity"))){const i=[],s=[],d=[],o=[];if(t!=null&&t.hasRemoved(this.id))return t==null||t.attemptAutoclose("remove-entity",this.id),{added:[],updated:[],removed:[],affected:[],self:this};if(s.push(this),this.unsubscribe(),this.project.subscribeDeletedInstance(this),this.metaSync({deleted:!0},t),Object.values(this.detachedDependents).forEach(l=>{const{updated:u,removed:y,added:c}=l.entity.onDetachedDependencyRemoved(this,l.field,t);i.push(...u),s.push(...y),d.push(...c)}),this.defaultValue){const{updated:l,removed:u}=this.defaultValue.remove({ignoreUpstream:!0},t);i.push(...l),s.push(...u)}return this.readsValue&&(i.push(this.readsValue),this.readsValue.removeValueReader(this,t)),this.defaultValue&&(i.push(this.defaultValue),this.defaultValue.remove({ignoreUpstream:!0},t)),e||(i.push(this.parent),this.parent.removeInput(this,t)),t==null||t.attemptAutoclose("remove-entity",this.id),{added:p(d),updated:p(i),removed:p(s),affected:p(o),self:this}}restore({}={},e=this.project.addChangeSet(new A(this.project,m.sessionAuthor,T().toISOString(),this,!0,"restore-entity"))){const t=[],i=[],s=[],d=[];if(e!=null&&e.hasAdded(this.id))return e==null||e.attemptAutoclose("restore-entity",this.id),{added:[],updated:[],removed:[],affected:[],self:this};if(this.subscribe(),this.project.unsubscribeDeletedInstance(this),this.metaSync({deleted:!1},e),Object.values(this.detachedDependents).forEach(o=>{const{updated:l,removed:u,added:y}=o.entity.onDetachedDependencyRestored(this,o.field,e);i.push(...l),s.push(...u),t.push(...y)}),this.defaultValue){const{updated:o}=this.defaultValue.restore({},e);i.push(...o)}return this.readsValue&&(i.push(this.readsValue),this.readsValue.addValueReader(this,e)),this.defaultValue&&(i.push(this.defaultValue),this.defaultValue.restore({},e)),i.push(this.parent),this.parent.addInput(this,e),e==null||e.attemptAutoclose("restore-entity",this.id),{added:p(t),updated:p(i),removed:p(s),affected:p(d),self:this}}toFlat(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this,...this.defaultValue?this.defaultValue.toFlat(e):[],...this.dataType?this.dataType.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.dataType?this.dataType.toFlatIds(e):[],...this.declaration?this.declaration.toFlatIds(e):[],...this.readsValue?this.readsValue.toFlatIds(e):[]])}toMeta(){return{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,description:this.description,index:this.index,type:this.type,name:this.name}}toJSON(e=new Set){var t,i,s;return e.has(this.id)?this.toReference():(e.add(this.id),{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,index:this.index,name:this.name,description:this.description,defaultValue:((t=this.defaultValue)==null?void 0:t.toJSON(e))||null,declaration:((i=this.declaration)==null?void 0:i.toJSON(e))||null,readsValue:((s=this.readsValue)==null?void 0:s.toReference())||null,parent:this.parent.toReference()})}toJSONClone(e=J){var i,s,d,o,l,u,y,c,I,E,O;let t;return(i=e.seenEntityMaps)!=null&&i.has(this.id)?t=e.seenEntityMaps.get(this.id):(t=e.newId||ht(this,this.project,e.uuidStrategy),e.seenEntityMaps&&e.seenEntityMaps.set(this.id,t)),(s=e.seenEntities)!=null&&s.has(t)||(d=e.seenEntities)!=null&&d.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:m.UUID.uuid(),createdAt:e.timestamp||T().toISOString(),previousVersion:null,author:this.author,deleted:this.deleted,type:this.type,index:this.index,name:this.name,description:this.description,defaultValue:((u=this.defaultValue)==null?void 0:u.toJSONClone({...e,newId:null}))||null,declaration:(y=this.declaration)!=null&&y.id&&this.project.getBuiltIn((c=this.declaration)==null?void 0:c.id)?(I=this.declaration)==null?void 0:I.toJSON(e.seenEntities):((E=this.declaration)==null?void 0:E.toJSONClone({...e,newId:null}))||null,readsValue:((O=this.readsValue)==null?void 0:O.toReference({seenEntityMaps:e.seenEntityMaps}))||null,parent:this.parent.toReference({seenEntityMaps:e.seenEntityMaps})})}toReference(e=J){var i;let t=this.id;return(i=e.seenEntityMaps)!=null&&i.has(this.id)&&(t=e.seenEntityMaps.get(this.id)),{id:t+"--"+m.UUID.uuid()+"--ref",type:n.GenericReference,entityId:t,version:this.version,entityType:this.type}}toShallowJSON(e=J){var i,s,d,o;let t=this.id;return(i=e.seenEntityMaps)!=null&&i.has(this.id)&&(t=e.seenEntityMaps.get(this.id)),{id:t,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,name:this.name,description:this.description,index:this.index,defaultValue:((s=this.defaultValue)==null?void 0:s.toReference(e))||null,declaration:((d=this.declaration)==null?void 0:d.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.dataType?this.dataType.toFlatJSON(e):[],...this.declaration?this.declaration.toFlatJSON(e):[],...this.readsValue?this.readsValue.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.dataType?this.dataType.toFlatGenerationTarget(e):[],...this.readsValue?this.readsValue.toFlatGenerationTarget(e):[],...this.declaration?this.declaration.toFlatGenerationTarget(e):[]])}clearErrors(){var e;return this.errors=[],(e=this.defaultValue)==null||e.clearErrors(),this}validate(){const e=B1(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=this.project.addChangeSet(new A(this.project,m.sessionAuthor,T().toISOString(),this,!0,"clone-entity")),t=null,i=null,s=!0){var c;let d=mt(t,this);const o=this.toJSON(),l=i||m.UUID.uuid();o.defaultValue=null,o.id=l,o.version=m.UUID.uuid(),o.createdAt=(e==null?void 0:e.timestamp)||T().toISOString(),o.author=(e==null?void 0:e.author)||"1",o.previousVersion=null,o.deleted=!1;const u=nt(o,d);t?u.setParent(t,null):u.setParent(this.parent,null),s&&u.subscribe(),u.initChildren(e),e==null||e.add(u,b.Added);const y=(c=this.defaultValue)==null?void 0:c.clone(e,u,m.UUID.uuid(),s);return u.defaultValue=y||null,e==null||e.attemptAutoclose("clone-entity",this.id),u}getDataType(e=this.project.addChangeSet(new A(this.project,m.sessionAuthor,T().toISOString(),this,!0,"get-data-type"))){var i;if(this.parent.type===n.Operation)return this.parent.declaration.inferInputMapDataType(this,e).self;if(it.includes(this.parent.type)){const s=Un(this.parent),d=s.getDataType(e);(!d||d.inferred)&&s.inferDataTypeAndSyncInstancesInputsAndOutputs(e)}const t=(i=this.declaration)==null?void 0:i.getDataType(e);if(!t){const s=Hi(this,e);if(s)return s}return t||null}};f(_e,"repository",{APICreate:async(e,...t)=>e,APIUpdate:async(e,...t)=>e,APIDelete:async(e,...t)=>e,APIClone:async(e,...t)=>{},APILoad:async(e,...t)=>null,APILoadVersion:async(e,t,...i)=>null}),f(_e,"type",n.InputMap),f(_e,"USER_MANAGED_PARENT_TYPES",[...lt]),f(_e,"PARENT_TYPES",[..._e.USER_MANAGED_PARENT_TYPES]),f(_e,"MUTABLE_BASE_PROPERTIES",["name","description"]),f(_e,"INMUTABLE_BASE_PROPERTIES",["id","type","version","createdAt","author","previousVersion"]),f(_e,"BASE_PROPERTIES",[..._e.MUTABLE_BASE_PROPERTIES,..._e.INMUTABLE_BASE_PROPERTIES]),f(_e,"MUTABLE_META_PROPERTIES",[..._e.MUTABLE_BASE_PROPERTIES,"index"]),f(_e,"INMUTABLE_META_PROPERTIES",[..._e.INMUTABLE_BASE_PROPERTIES]),f(_e,"META_PROPERTIES",[..._e.MUTABLE_META_PROPERTIES,..._e.INMUTABLE_META_PROPERTIES]),f(_e,"MUTABLE_UPSTREAM_PROPERTIES",["readsValue"]),f(_e,"INMUTABLE_UPSTREAM_PROPERTIES",["parent","declaration"]),f(_e,"UPSTREAM_PROPERTIES",[..._e.MUTABLE_UPSTREAM_PROPERTIES,..._e.INMUTABLE_UPSTREAM_PROPERTIES]),f(_e,"MUTABLE_DOWNSTREAM_PROPERTIES",["defaultValue"]),f(_e,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),f(_e,"DOWNSTREAM_PROPERTIES",[..._e.MUTABLE_DOWNSTREAM_PROPERTIES,..._e.INMUTABLE_DOWNSTREAM_PROPERTIES]),f(_e,"PROPERTIES",[..._e.META_PROPERTIES,..._e.UPSTREAM_PROPERTIES,..._e.DOWNSTREAM_PROPERTIES]);let Ki=_e;class HJ extends Ki{constructor(e,t){super(e,t);f(this,"declaration",null);f(this,"parent");f(this,"errors",[])}toJSON(e=new Set){return super.toJSON(e)}}class KJ extends Ki{constructor(e,t){super(e,t);f(this,"name",null);f(this,"description",null);f(this,"declaration");f(this,"parent");f(this,"errors",[])}toJSON(e=new Set){return super.toJSON(e)}}function M1(r){const a=M5(),e=r.toJSON();a.safeParse(e).success;const i=[];if(r.id==="exec-sequentially-return-map-id"){const s=le({id:`${r.id}--${F.PropertyImplementsNonAbstact}`,message:`Property "${x(r,r.project)}" with id "${r.id}" implements a non-abstract property "${x(r,r.project)}" with id "${r.id}".`,issue:null,severity:D.Error,code:F.PropertyImplementsNonAbstact,entity:r});i.push(s.error)}return Ke(r.errors,i)}const XJ=Object.freeze(Object.defineProperty({__proto__:null,validate:M1},Symbol.toStringTag,{value:"Module"}));var N1=(r=>(r.Declaration="declaration",r.DataTypeEntity="data-type-entity",r))(N1||{});const Me=class Me extends dt{constructor(e,t){super(e);f(this,"initialData");f(this,"id");f(this,"index");f(this,"type",n.OutputMap);f(this,"parentRelationType");f(this,"defaultValue",null);f(this,"declaration");f(this,"writesValues",[]);f(this,"dataType");f(this,"project");f(this,"errors",[]);f(this,"parent");f(this,"detachedDependents",{});f(this,"knownVersions",null);f(this,"activeVersion",!1);f(this,"initialized",!1);f(this,"startedInitialization",!1);f(this,"suggestion",!1);f(this,"_codeNativeValueValidation",null);this.initialData=e,this.project=t,this.id=e.id,this.index=e.index,this.parentRelationType=e.parentRelationType}static new(e=null){return{id:m.UUID.uuid(),version:m.UUID.uuid(),createdAt:(e==null?void 0:e.timestamp)||T().toISOString(),author:(e==null?void 0:e.author)||m.sessionAuthor,previousVersion:null,deleted:!1,type:n.OutputMap,declaration:null,writesValues:[],index:0,defaultValue:null,parent:null}}static fromGenerationTarget(e,t){const i=_(e.parent),s=t.get(i);let d;if(e.declaration){const u=_(e.declaration);d=t.get(u)}const o={id:e.id,version:m.UUID.uuid(),createdAt:T().toISOString(),author:m.sessionAuthor,previousVersion:null,deleted:!1,type:n.OutputMap,index:(s.outputs||[]).length,defaultValue:null,declaration:d,writesValues:[],parent:s},l=C(o,t);return l.setParent(s,null),l.initChildren(null),l}static validateGenerationTarget(e,t){var l;let i=JSON.parse(JSON.stringify(e));const s=[],d=bt(i,{parent:{list:!1,types:lt.filter(u=>u!==n.Condition)},declaration:{list:!1,types:[n.ReturnDeclaration,n.Property]}},t);i=d.modifiedData;const o=t.get(i.parent);if(o&&lt.filter(u=>u!==n.Condition).includes(o.type)){const u=o.outputs.find(y=>y.declaration.id===(i.declaration?_(i.declaration):null));if(u)s.push(new w({id:`${i.id}--${R.OutputOverwrite}`,code:R.OutputOverwrite,severity:D.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 '${u.id}' that points to the same base 'return-declaration'.
158
+ 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}}subscribeDependents(e){return e.forEach(t=>{this.detachedDependents[t.entity.id]||(this.detachedDependents[t.entity.id]=t)}),this}syncDependents(e=this.project.addChangeSet(new A(this.project,m.sessionAuthor,T().toISOString(),this,!0,"sync-dependents"))){const t=[],i=[],s=[],d=[];return Object.values(this.detachedDependents).forEach(o=>{const l=o.entity.afterAllChildrenInitialized(e);t.push(...l.updated),i.push(...l.added),s.push(...l.removed),d.push(...l.affected)}),e==null||e.attemptAutoclose("sync-dependents",this.id),{updated:p(t),added:p(i),removed:p(s),affected:p(d),self:this}}onDetachedDependencyRemoved(e,t,i){const s=[],d=[],o=[],l=[];if(t==="declaration"){const{updated:u,added:y,removed:c}=this.remove({ignoreUpstream:!1},i);s.push(...u),d.push(...y),o.push(...c)}return{updated:p(s),added:p(d),removed:p(o),affected:p(l),self:this}}onDetachedDependencyRestored(e,t,i){const s=[],d=[],o=[],l=[];if(t==="declaration"){const{updated:u,added:y,removed:c}=this.restore({},i);s.push(...u),d.push(...y),o.push(...c)}return{updated:p(s),added:p(d),removed:p(o),affected:p(l),self:this}}subscribeToDependencies(){var e,t,i,s,d;return(t=(e=this.declaration)==null?void 0:e.subscribeDependents)==null||t.call(e,[{entity:this,field:"declaration"}]),(d=(s=(i=this.dataType)==null?void 0:i.entity)==null?void 0:s.subscribeDependents)==null||d.call(s,[{entity:this,field:"data-type-entity"}]),this}increaseVersion(e){if(e&&!T(e).isValid())throw new Error(`The shared timestamp '${e}' is not a valid ISO 8601 date string.`);return e&&T(e).isSame(T(this.createdAt))?this:(this.previousVersion=this.version,this.version=m.UUID.uuid(),this.createdAt=T(e).toISOString()||T().toISOString(),this)}captureVersion(){var t;const e=((t=this.knownVersions)==null?void 0:t.get(this.version))||new _e(this,this.project);return e.metaSync(this.toMeta(),null),this.knownVersions=this.knownVersions?this.knownVersions.set(this.version,e):new Map([[this.version,e]]),e.declaration=this.declaration,e.defaultValue=this.defaultValue,e.readsValue=this.readsValue,e.dataType=this.dataType,e.parent=this.parent,this}recursiveCaptureUpstreamVersions(e){const t=[],i=[],s=[],d=[];if(this.parent){this.parent.increaseVersion(e);const o=this.parent.recursiveCaptureUpstreamVersions(e);t.push(this.parent,...o.updated),i.push(...o.added),s.push(...o.removed)}return{updated:p(t),added:p(i),removed:p(s),affected:p(d),self:this}}async restoreVersion(e){var l;const t=[],i=[],s=[],d=[];if(this.version===e)return{updated:p(t),added:p(i),removed:p(s),affected:p(d),self:this};if(!this.knownVersions){const u=new Map;for(const[y,c]of this.knownVersions||new Map){if(u.set(y,c),c.activeVersion=!1,c.knownVersions)for(const[I,E]of c.knownVersions)u.set(I,E);c.knownVersions=null}}let o=(l=this.knownVersions)==null?void 0:l.get(e);if(!o){const u=await this.APILoadVersion({},e);if(!u)throw new Error(`Version with id '${e}' for entity with id '${this.id}' not found.`);o=new _e(u,this.project)}return this.metaSync(o.toShallowJSON(),null),this.declaration=o.declaration,this.defaultValue=o.defaultValue,this.readsValue=o.readsValue,this.dataType=o.dataType,this.parent=o.parent,{updated:p(t),added:p(i),removed:p(s),affected:p(d),self:this}}hydrateAncestors(){const e=[],t=[],i=[],s=[];if(this.initialData.parent){const d=_(this.initialData.parent),o=this.project.get(d);if(o)this.setParent(o,null),e.push(o);else throw new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${d}' that isn't found in the project`)}else throw new Error(`${this.type} with id '${this.id}' must have a 'parent'`);if(this.initialData.readsValue){const d=_(this.initialData.readsValue),o=this.project.get(d);o&&(this.setValueWriter(o,null),e.push(o))}if(this.initialData.declaration){const d=_(this.initialData.declaration),o=this.project.get(d);o&&(this.setDeclaration(o),e.push(o))}return Rr.hydrateReadsValue(this),{updated:p(e),added:p(t),removed:p(i),affected:p(s),self:this}}afterAllChildrenInitialized(e=this.project.addChangeSet(new A(this.project,m.sessionAuthor,T().toISOString(),this,!0,"after-all-children-initialized"))){const t=[],i=[],s=[],d=[];return this.initialized=!0,this.captureVersion(),e==null||e.attemptAutoclose("after-all-children-initialized",this.id),{updated:p(t),added:p(i),removed:p(s),affected:p(d),self:this}}addSelfToProject(e=this.project.addChangeSet(new A(this.project,m.sessionAuthor,T().toISOString(),this,!0,"add-self-to-project"))){var o,l;const t=[this],i=[],s=[],d=[];if(this.parent.addInput(this,e),t.push(this.parent),(o=this.readsValue)==null||o.addValueReader(this,e),this.readsValue&&t.push(this.readsValue),it.includes(this.parent.type)&&((l=this.parent.getDataType(e))!=null&&l.inferred)){const u=this.parent.type===n.VariableDeclaration?this.parent:this.parent.declaration,{updated:y,added:c,removed:I,affected:E}=u.inferDataTypeAndSyncInstancesInputsAndOutputs(e);t.push(...y),i.push(...c),s.push(...I),d.push(...E),t.push(u,...u.variableInstances)}return this.subscribe(),this.subscribeToDependencies(),e==null||e.attemptAutoclose("add-self-to-project",this.id),{updated:p(t),added:p(i),removed:p(s),affected:p(d),self:this}}setParent(e,t=this.project.addChangeSet(new A(this.project,m.sessionAuthor,T().toISOString(),this,!0,"set-parent"))){var i;return((i=this.parent)==null?void 0:i.id)!==(e==null?void 0:e.id)&&(this.parent=e,t&&(t==null||t.add(this,b.Updated),t==null||t.attemptAutoclose("set-parent",this.id))),this}setDataType(e){return this.dataType=e,this}removeDataType(){return this.dataType=null,this}setDeclaration(e){return this.declaration=e,this}initChildren(e=this.project.addChangeSet(new A(this.project,m.sessionAuthor,T().toISOString(),this,!0,"init-children"))){return this.initialized||this.startedInitialization?this:(this.startedInitialization=!0,this.initialData.defaultValue&&(this.defaultValue=C(this.initialData.defaultValue,this.project),this.defaultValue.setParent(this,null),this.defaultValue.initChildren(e)),this.initialData.declaration&&(this.declaration=C(this.initialData.declaration,this.project)),Rr.initReadsValue(this),this.subscribeToDependencies(),this.afterAllChildrenInitialized(e),e==null||e.attemptAutoclose("init-children",this.id),this)}setValueWriter(e,t=this.project.addChangeSet(new A(this.project,m.sessionAuthor,T().toISOString(),this,!0,"set-value-writer"))){return this.readsValue!==e&&(this.readsValue=e,t==null||t.add(this,b.Updated)),t==null||t.attemptAutoclose("set-value-writer",this.id),this}removeValueWriter(e=this.project.addChangeSet(new A(this.project,m.sessionAuthor,T().toISOString(),this,!0,"remove-value-writer"))){return this.readsValue&&(this.readsValue=null,e==null||e.add(this,b.Updated)),e==null||e.attemptAutoclose("remove-value-writer",this.id),this}subscribe(){return this.activeVersion=!0,this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}metaSync(e,t=this.project.addChangeSet(new A(this.project,m.sessionAuthor,T().toISOString(),this,!0,"meta-sync"))){const i=ct(this,e),s=this.toMeta();return this.index=e.index||(e.index!==0?s.index:0),this.name=e.name!==void 0?e.name:s.name,this.description=e.description!==void 0?e.description:s.description,super.metaSync(e),e.deleted===!0&&!s.deleted?t==null||t.add(this,b.Removed):e.deleted===!1&&s.deleted?t==null||t.add(this,b.Added):i&&(t==null||t.add(this,b.Updated)),t==null||t.attemptAutoclose("meta-sync",this.id),this}async APILoad(e=U,...t){return await _e.repository.APILoad(this.id,...t),this}async APICreate(e=U,...t){return await _e.repository.APICreate(this.toShallowJSON(),...t),this}async APIUpdate(e=U,...t){return await _e.repository.APIUpdate(this.toShallowJSON(),...t),this}async APIDelete(e=U,...t){return await _e.repository.APIDelete(this.toShallowJSON(),...t),this}async APIClone(e=U,...t){return await _e.repository.APIClone(this.id,...t),this}async APILoadVersion(e=U,t,...i){return await _e.repository.APILoadVersion(this.id,t,...i)}remove({ignoreUpstream:e}={ignoreUpstream:!1},t=this.project.addChangeSet(new A(this.project,m.sessionAuthor,T().toISOString(),this,!0,"remove-entity"))){var l;const i=[],s=[],d=[],o=[];if(t!=null&&t.hasRemoved(this.id))return t==null||t.attemptAutoclose("remove-entity",this.id),{added:[],updated:[],removed:[],affected:[],self:this};if(s.push(this),this.unsubscribe(),this.project.subscribeDeletedInstance(this),this.metaSync({deleted:!0},t),Object.values(this.detachedDependents).forEach(u=>{const{updated:y,removed:c,added:I}=u.entity.onDetachedDependencyRemoved(this,u.field,t);i.push(...y),s.push(...c),d.push(...I)}),this.defaultValue){const{updated:u,removed:y}=this.defaultValue.remove({ignoreUpstream:!0},t);i.push(...u),s.push(...y)}if(this.readsValue&&(i.push(this.readsValue),this.readsValue.removeValueReader(this,t)),this.defaultValue&&(i.push(this.defaultValue),this.defaultValue.remove({ignoreUpstream:!0},t)),this.declaration){if(this.declaration.type===n.Property&&this.declaration.parent.type===n.DefinitionEntity&&this.declaration.parent.parent.type===n.DataType&&!(t!=null&&t.hasRemoved(this.declaration.id))&&!this.declaration.deleted){const{updated:u,removed:y}=this.declaration.remove({ignoreUpstream:!1},t);i.push(...u),s.push(...y)}else if(this.declaration.type===n.ValueDescriptor&&((l=this.declaration.parent)==null?void 0:l.type)===n.Search&&!(t!=null&&t.hasRemoved(this.declaration.id))&&!this.declaration.deleted){const{updated:u,removed:y}=this.declaration.remove({ignoreUpstream:!1},t);i.push(...u),s.push(...y)}}return e||(i.push(this.parent),this.parent.removeInput(this,t)),t==null||t.attemptAutoclose("remove-entity",this.id),{added:p(d),updated:p(i),removed:p(s),affected:p(o),self:this}}restore({}={},e=this.project.addChangeSet(new A(this.project,m.sessionAuthor,T().toISOString(),this,!0,"restore-entity"))){const t=[],i=[],s=[],d=[];if(e!=null&&e.hasAdded(this.id))return e==null||e.attemptAutoclose("restore-entity",this.id),{added:[],updated:[],removed:[],affected:[],self:this};if(this.subscribe(),this.project.unsubscribeDeletedInstance(this),this.metaSync({deleted:!1},e),Object.values(this.detachedDependents).forEach(o=>{const{updated:l,removed:u,added:y}=o.entity.onDetachedDependencyRestored(this,o.field,e);i.push(...l),s.push(...u),t.push(...y)}),this.defaultValue){const{updated:o}=this.defaultValue.restore({},e);i.push(...o)}return this.readsValue&&(i.push(this.readsValue),this.readsValue.addValueReader(this,e)),this.defaultValue&&(i.push(this.defaultValue),this.defaultValue.restore({},e)),i.push(this.parent),this.parent.addInput(this,e),e==null||e.attemptAutoclose("restore-entity",this.id),{added:p(t),updated:p(i),removed:p(s),affected:p(d),self:this}}toFlat(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this,...this.defaultValue?this.defaultValue.toFlat(e):[],...this.dataType?this.dataType.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.dataType?this.dataType.toFlatIds(e):[],...this.declaration?this.declaration.toFlatIds(e):[],...this.readsValue?this.readsValue.toFlatIds(e):[]])}toMeta(){return{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,description:this.description,index:this.index,type:this.type,name:this.name}}toJSON(e=new Set){var t,i,s;return e.has(this.id)?this.toReference():(e.add(this.id),{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,index:this.index,name:this.name,description:this.description,defaultValue:((t=this.defaultValue)==null?void 0:t.toJSON(e))||null,declaration:((i=this.declaration)==null?void 0:i.toJSON(e))||null,readsValue:((s=this.readsValue)==null?void 0:s.toReference())||null,parent:this.parent.toReference()})}toJSONClone(e=J){var i,s,d,o,l,u,y,c,I,E,O;let t;return(i=e.seenEntityMaps)!=null&&i.has(this.id)?t=e.seenEntityMaps.get(this.id):(t=e.newId||ht(this,this.project,e.uuidStrategy),e.seenEntityMaps&&e.seenEntityMaps.set(this.id,t)),(s=e.seenEntities)!=null&&s.has(t)||(d=e.seenEntities)!=null&&d.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:m.UUID.uuid(),createdAt:e.timestamp||T().toISOString(),previousVersion:null,author:this.author,deleted:this.deleted,type:this.type,index:this.index,name:this.name,description:this.description,defaultValue:((u=this.defaultValue)==null?void 0:u.toJSONClone({...e,newId:null}))||null,declaration:(y=this.declaration)!=null&&y.id&&this.project.getBuiltIn((c=this.declaration)==null?void 0:c.id)?(I=this.declaration)==null?void 0:I.toJSON(e.seenEntities):((E=this.declaration)==null?void 0:E.toJSONClone({...e,newId:null}))||null,readsValue:((O=this.readsValue)==null?void 0:O.toReference({seenEntityMaps:e.seenEntityMaps}))||null,parent:this.parent.toReference({seenEntityMaps:e.seenEntityMaps})})}toReference(e=J){var i;let t=this.id;return(i=e.seenEntityMaps)!=null&&i.has(this.id)&&(t=e.seenEntityMaps.get(this.id)),{id:t+"--"+m.UUID.uuid()+"--ref",type:n.GenericReference,entityId:t,version:this.version,entityType:this.type}}toShallowJSON(e=J){var i,s,d,o;let t=this.id;return(i=e.seenEntityMaps)!=null&&i.has(this.id)&&(t=e.seenEntityMaps.get(this.id)),{id:t,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,name:this.name,description:this.description,index:this.index,defaultValue:((s=this.defaultValue)==null?void 0:s.toReference(e))||null,declaration:((d=this.declaration)==null?void 0:d.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.dataType?this.dataType.toFlatJSON(e):[],...this.declaration?this.declaration.toFlatJSON(e):[],...this.readsValue?this.readsValue.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.dataType?this.dataType.toFlatGenerationTarget(e):[],...this.readsValue?this.readsValue.toFlatGenerationTarget(e):[],...this.declaration?this.declaration.toFlatGenerationTarget(e):[]])}clearErrors(){var e;return this.errors=[],(e=this.defaultValue)==null||e.clearErrors(),this}validate(){const e=B1(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=this.project.addChangeSet(new A(this.project,m.sessionAuthor,T().toISOString(),this,!0,"clone-entity")),t=null,i=null,s=!0){var c;let d=mt(t,this);const o=this.toJSON(),l=i||m.UUID.uuid();o.defaultValue=null,o.id=l,o.version=m.UUID.uuid(),o.createdAt=(e==null?void 0:e.timestamp)||T().toISOString(),o.author=(e==null?void 0:e.author)||"1",o.previousVersion=null,o.deleted=!1;const u=nt(o,d);t?u.setParent(t,null):u.setParent(this.parent,null),s&&u.subscribe(),u.initChildren(e),e==null||e.add(u,b.Added);const y=(c=this.defaultValue)==null?void 0:c.clone(e,u,m.UUID.uuid(),s);return u.defaultValue=y||null,e==null||e.attemptAutoclose("clone-entity",this.id),u}getDataType(e=this.project.addChangeSet(new A(this.project,m.sessionAuthor,T().toISOString(),this,!0,"get-data-type"))){var i;if(this.parent.type===n.Operation)return this.parent.declaration.inferInputMapDataType(this,e).self;if(it.includes(this.parent.type)){const s=Un(this.parent),d=s.getDataType(e);(!d||d.inferred)&&s.inferDataTypeAndSyncInstancesInputsAndOutputs(e)}const t=(i=this.declaration)==null?void 0:i.getDataType(e);if(!t){const s=Hi(this,e);if(s)return s}return t||null}};f(_e,"repository",{APICreate:async(e,...t)=>e,APIUpdate:async(e,...t)=>e,APIDelete:async(e,...t)=>e,APIClone:async(e,...t)=>{},APILoad:async(e,...t)=>null,APILoadVersion:async(e,t,...i)=>null}),f(_e,"type",n.InputMap),f(_e,"USER_MANAGED_PARENT_TYPES",[...lt]),f(_e,"PARENT_TYPES",[..._e.USER_MANAGED_PARENT_TYPES]),f(_e,"MUTABLE_BASE_PROPERTIES",["name","description"]),f(_e,"INMUTABLE_BASE_PROPERTIES",["id","type","version","createdAt","author","previousVersion"]),f(_e,"BASE_PROPERTIES",[..._e.MUTABLE_BASE_PROPERTIES,..._e.INMUTABLE_BASE_PROPERTIES]),f(_e,"MUTABLE_META_PROPERTIES",[..._e.MUTABLE_BASE_PROPERTIES,"index"]),f(_e,"INMUTABLE_META_PROPERTIES",[..._e.INMUTABLE_BASE_PROPERTIES]),f(_e,"META_PROPERTIES",[..._e.MUTABLE_META_PROPERTIES,..._e.INMUTABLE_META_PROPERTIES]),f(_e,"MUTABLE_UPSTREAM_PROPERTIES",["readsValue"]),f(_e,"INMUTABLE_UPSTREAM_PROPERTIES",["parent","declaration"]),f(_e,"UPSTREAM_PROPERTIES",[..._e.MUTABLE_UPSTREAM_PROPERTIES,..._e.INMUTABLE_UPSTREAM_PROPERTIES]),f(_e,"MUTABLE_DOWNSTREAM_PROPERTIES",["defaultValue"]),f(_e,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),f(_e,"DOWNSTREAM_PROPERTIES",[..._e.MUTABLE_DOWNSTREAM_PROPERTIES,..._e.INMUTABLE_DOWNSTREAM_PROPERTIES]),f(_e,"PROPERTIES",[..._e.META_PROPERTIES,..._e.UPSTREAM_PROPERTIES,..._e.DOWNSTREAM_PROPERTIES]);let Ki=_e;class HJ extends Ki{constructor(e,t){super(e,t);f(this,"declaration",null);f(this,"parent");f(this,"errors",[])}toJSON(e=new Set){return super.toJSON(e)}}class KJ extends Ki{constructor(e,t){super(e,t);f(this,"name",null);f(this,"description",null);f(this,"declaration");f(this,"parent");f(this,"errors",[])}toJSON(e=new Set){return super.toJSON(e)}}function M1(r){const a=M5(),e=r.toJSON();a.safeParse(e).success;const i=[];if(r.id==="exec-sequentially-return-map-id"){const s=le({id:`${r.id}--${F.PropertyImplementsNonAbstact}`,message:`Property "${x(r,r.project)}" with id "${r.id}" implements a non-abstract property "${x(r,r.project)}" with id "${r.id}".`,issue:null,severity:D.Error,code:F.PropertyImplementsNonAbstact,entity:r});i.push(s.error)}return Ke(r.errors,i)}const XJ=Object.freeze(Object.defineProperty({__proto__:null,validate:M1},Symbol.toStringTag,{value:"Module"}));var N1=(r=>(r.Declaration="declaration",r.DataTypeEntity="data-type-entity",r))(N1||{});const Me=class Me extends dt{constructor(e,t){super(e);f(this,"initialData");f(this,"id");f(this,"index");f(this,"type",n.OutputMap);f(this,"parentRelationType");f(this,"defaultValue",null);f(this,"declaration");f(this,"writesValues",[]);f(this,"dataType");f(this,"project");f(this,"errors",[]);f(this,"parent");f(this,"detachedDependents",{});f(this,"knownVersions",null);f(this,"activeVersion",!1);f(this,"initialized",!1);f(this,"startedInitialization",!1);f(this,"suggestion",!1);f(this,"_codeNativeValueValidation",null);this.initialData=e,this.project=t,this.id=e.id,this.index=e.index,this.parentRelationType=e.parentRelationType}static new(e=null){return{id:m.UUID.uuid(),version:m.UUID.uuid(),createdAt:(e==null?void 0:e.timestamp)||T().toISOString(),author:(e==null?void 0:e.author)||m.sessionAuthor,previousVersion:null,deleted:!1,type:n.OutputMap,declaration:null,writesValues:[],index:0,defaultValue:null,parent:null}}static fromGenerationTarget(e,t){const i=_(e.parent),s=t.get(i);let d;if(e.declaration){const u=_(e.declaration);d=t.get(u)}const o={id:e.id,version:m.UUID.uuid(),createdAt:T().toISOString(),author:m.sessionAuthor,previousVersion:null,deleted:!1,type:n.OutputMap,index:(s.outputs||[]).length,defaultValue:null,declaration:d,writesValues:[],parent:s},l=C(o,t);return l.setParent(s,null),l.initChildren(null),l}static validateGenerationTarget(e,t){var l;let i=JSON.parse(JSON.stringify(e));const s=[],d=bt(i,{parent:{list:!1,types:lt.filter(u=>u!==n.Condition)},declaration:{list:!1,types:[n.ReturnDeclaration,n.Property]}},t);i=d.modifiedData;const o=t.get(i.parent);if(o&&lt.filter(u=>u!==n.Condition).includes(o.type)){const u=o.outputs.find(y=>y.declaration.id===(i.declaration?_(i.declaration):null));if(u)s.push(new w({id:`${i.id}--${R.OutputOverwrite}`,code:R.OutputOverwrite,severity:D.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 '${u.id}' that points to the same base 'return-declaration'.
159
159
  Any value reads can be done with that output-map instead.
160
160
  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=i.declaration?t.get(i.declaration):null;if(y&&it.includes(o.type)){const c=Un(o),I=c.dataType,E=(l=c.dataType)==null?void 0:l.entity;I?E?E.type===n.ActionDescriptor?s.push(new w({id:`${i.id}--${$.NoOverlapWithImplementedSignature}`,code:$.NoOverlapWithImplementedSignature,severity:D.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.
161
161
  This means it can hold a function-call or operation as its value, to be executed programatically.
@@ -199,7 +199,7 @@ You can update the existing 'literal-value' with the 'update' action, for exampl
199
199
  }
200
200
  }\`\`\`
201
201
  Or 'delete' and then 'post' actions to replace it.`,issue:null})):e.push(new w({id:`${r.id}--${r.parent}--${R.InvalidParentReference}`,code:R.InvalidParentReference,severity:D.Error,message:`Entity of type "${r.type}" with id "${r.id}", has a parent reference that isn't pointing to an entity of type 'input-map' or 'data-type'.`,issue:null})):e.push(new w({id:`${r.id}--${r.parent}--${R.ReferencedEntityNotFound}`,code:R.ReferencedEntityNotFound,severity:D.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 e.push(new w({id:`${r.id}--${$.InvalidObjectStructure}`,code:$.InvalidObjectStructure,severity:D.Error,message:`Entity of type "${r.type}" with id "${r.id}" is missing a 'parent' reference. The 'parent' of a literal value entity must be a reference to an entity of type 'input-map' or 'data-type'.`,issue:null}));else return e.push(new w({id:`${r.id}--${$.InvalidObjectStructure}`,code:$.InvalidObjectStructure,severity:D.Error,message:`Entity of type "${r.type}" with id "${r.id}" is missing a 'parent' reference. The 'parent' of a literal value entity must be a reference to an entity of type 'input-map' or 'data-type'.`,issue:null})),e;if(r.valueAsTypeSingle){const s=[],d=[],o=r.valueAsTypeSingle;Array.isArray(o)?o.forEach(l=>{typeof l=="string"?d.push(l):s.push(l)}):typeof o=="string"?d.push(o):s.push(o),s.forEach(l=>{const u=xd(l);e.push(...u),u.length===0&&d.push(l.entityId)}),d.forEach(l=>{const u=a.get(l);u?[n.DefinitionEntity,n.BuiltInBaseEntity].includes(u.type)||e.push(new w({id:`${r.id}--${l}--${R.InvalidImplementsReference}`,code:R.InvalidImplementsReference,severity:D.Error,message:`Entity of type "${r.type}" with id "${r.id}", has an 'valueAsTypeSingle' reference that isn't pointing to an entity of type 'definition-entity', 'function-declaration' or 'operation'.`,issue:null})):e.push(new w({id:`${r.id}--${l}--${R.ReferencedEntityNotFound}`,code:R.ReferencedEntityNotFound,severity:D.Error,message:`Entity of type "${r.type}" with id "${r.id}", is referencing an entity with id "${l}" that isn't yet found in the project. Perhaps it should be created first. Or perhaps the ID is incorrect.`,issue:null}))})}return e}var $1=(r=>(r.ValueAsTypeSingle="value-as-type-single",r.ValueAsTypeList="value-as-type-list",r))($1||{});const Le=class Le extends dt{constructor(e,t){super(e);f(this,"initialData");f(this,"type",n.LiteralValue);f(this,"id");f(this,"name");f(this,"autogeneration",null);f(this,"value",null);f(this,"valueAsTypeSingle",null);f(this,"valueAsTypeList",null);f(this,"errors",[]);f(this,"parent");f(this,"standaloneParent");f(this,"project");f(this,"detachedDependents",{});f(this,"knownVersions",null);f(this,"activeVersion",!1);f(this,"initialized",!1);f(this,"startedInitialization",!1);f(this,"standalone",!1);this.initialData=e,this.project=t,this.id=e.id,this.name=e.name,this.autogeneration=e.autogeneration,this.value=e.value}static new(e=null){return{id:m.UUID.uuid(),version:m.UUID.uuid(),createdAt:(e==null?void 0:e.timestamp)||T().toISOString(),author:(e==null?void 0:e.author)||m.sessionAuthor,previousVersion:null,deleted:!1,type:n.LiteralValue,name:"",autogeneration:null,value:null,valueAsTypeSingle:null,valueAsTypeList:null,parent:null}}static fromGenerationTarget(e,t){const i=_(e.parent),s=t.get(i);let d=null,o=null;e.valueAsTypeList?Array.isArray(e.valueAsTypeList)&&(o=e.valueAsTypeList.map(y=>t.get(y)||t.getBuiltIn(y))):e.valueAsTypeSingle&&(d=t.get(e.valueAsTypeSingle)||t.getBuiltIn(e.valueAsTypeSingle));const l={id:e.id,version:m.UUID.uuid(),createdAt:T().toISOString(),author:m.sessionAuthor,previousVersion:null,deleted:!1,type:n.LiteralValue,name:e.name,autogeneration:e.autogeneration,valueAsTypeSingle:d,valueAsTypeList:o,value:e.value||null,parent:s},u=C(l,t);return u.setParent(s,null),u.initChildren(null),u}static validateGenerationTarget(e,t){let i=JSON.parse(JSON.stringify(e));const s=[],d=rS(i,t);return s.push(...d,...pt(i)),{errors:s,modifiedData:i}}get valueAsType(){return this.valueAsTypeSingle?this.valueAsTypeSingle:this.valueAsTypeList?this.valueAsTypeList:null}get isFinal(){var e;return!!(this.parent.type===n.Property&&(this.parent.constant||(e=this.parent.implements)!=null&&e.constant)||this.parent.type===n.Property&&this.parent.parent.type===n.DefinitionEntity&&!Ua(this.parent.parent))}validateGeneratedUpdate(e){const t=[];return e.parent&&t.push(new w({id:`${this.id}--${R.InvalidParentUpdate}`,code:R.InvalidParentUpdate,severity:D.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.
202
- 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}}subscribeDependents(e){return e.forEach(t=>{this.detachedDependents[t.entity.id]||(this.detachedDependents[t.entity.id]=t)}),this}syncDependents(e=this.project.addChangeSet(new A(this.project,m.sessionAuthor,T().toISOString(),this,!0,"sync-dependents"))){const t=[],i=[],s=[],d=[];return Object.values(this.detachedDependents).forEach(o=>{const l=o.entity.afterAllChildrenInitialized(e);t.push(...l.updated),i.push(...l.added),s.push(...l.removed),d.push(...l.affected)}),e==null||e.attemptAutoclose("sync-dependents",this.id),{updated:p(t),added:p(i),removed:p(s),affected:p(d),self:this}}onDetachedDependencyRemoved(e,t,i){const s=[],d=[],o=[],l=[];return t==="value-as-type-single"&&(this.valueAsTypeSingle=null,i==null||i.add(this,b.Updated)),t==="value-as-type-list"&&(this.valueAsTypeList=(this.valueAsTypeList||[]).filter(u=>u.id!==e.id),i==null||i.add(this,b.Updated)),{updated:p(s),added:p(d),removed:p(o),affected:p(l),self:this}}onDetachedDependencyRestored(e,t,i){const s=[],d=[],o=[],l=[];return t==="value-as-type-single"&&(this.valueAsTypeSingle=e,i==null||i.add(this,b.Updated)),t==="value-as-type-list"&&(this.valueAsTypeList=[...Array.isArray(this.valueAsTypeList||[])?this.valueAsTypeList:[],e],i==null||i.add(this,b.Updated)),{updated:p(s),added:p(d),removed:p(o),affected:p(l),self:this}}subscribeToDependencies(){return!this.valueAsTypeSingle&&!this.valueAsTypeList?this:(this.valueAsTypeList&&Array.isArray(this.valueAsTypeList)?this.valueAsTypeList.forEach(e=>e.subscribeDependents([{entity:this,field:"value-as-type-list"}])):this.valueAsTypeSingle&&this.valueAsTypeSingle.subscribeDependents([{entity:this,field:"value-as-type-single"}]),this)}increaseVersion(e){if(e&&!T(e).isValid())throw new Error(`The shared timestamp '${e}' is not a valid ISO 8601 date string.`);return e&&T(e).isSame(T(this.createdAt))?this:(this.previousVersion=this.version,this.version=m.UUID.uuid(),this.createdAt=T(e).toISOString()||T().toISOString(),this)}captureVersion(){var t;const e=((t=this.knownVersions)==null?void 0:t.get(this.version))||new Le(this,this.project);return e.metaSync(this.toMeta(),null),this.knownVersions=this.knownVersions?this.knownVersions.set(this.version,e):new Map([[this.version,e]]),e.valueAsTypeSingle=this.valueAsTypeSingle,e.parent=this.parent,this}recursiveCaptureUpstreamVersions(e){const t=[],i=[],s=[],d=[];if(this.parent){this.parent.increaseVersion(e);const o=this.parent.recursiveCaptureUpstreamVersions(e);t.push(this.parent,...o.updated),i.push(...o.added),s.push(...o.removed)}return{updated:p(t),added:p(i),removed:p(s),affected:p(d),self:this}}async restoreVersion(e){var l;const t=[],i=[],s=[],d=[];if(this.version===e)return{updated:p(t),added:p(i),removed:p(s),affected:p(d),self:this};if(!this.knownVersions){const u=new Map;for(const[y,c]of this.knownVersions||new Map){if(u.set(y,c),c.activeVersion=!1,c.knownVersions)for(const[I,E]of c.knownVersions)u.set(I,E);c.knownVersions=null}}let o=(l=this.knownVersions)==null?void 0:l.get(e);if(!o){const u=await this.APILoadVersion({},e);if(!u)throw new Error(`Version with id '${e}' for entity with id '${this.id}' not found.`);o=new Le(u,this.project)}return this.metaSync(o.toShallowJSON(),null),this.valueAsTypeSingle=o.valueAsTypeSingle,this.parent=o.parent,{updated:p(t),added:p(i),removed:p(s),affected:p(d),self:this}}hydrateAncestors(){const e=[],t=[],i=[],s=[];if(this.initialData.parent&&this.initialData.standaloneParent)throw new Error(`Entity with id '${this.id}' cannot have both 'parent' and 'standaloneParent' properties set.`);if(this.initialData.parent){const d=_(this.initialData.parent),o=this.project.get(d);if(o)this.setParent(o,null),e.push(o);else throw new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${d}' that isn't found in the project`)}else if(this.initialData.standaloneParent){const d=_(this.initialData.standaloneParent),o=this.project.get(d);if(o)this.setStandaloneParent(o);else throw new Error(`${this.type} with id '${this.id}' has a 'standaloneParent' reference '${d}' that isn't found in the project`)}else throw new Error(`${this.type} with id '${this.id}' must have a 'parent'`);if(this.initialData.valueAsTypeList&&Array.isArray(this.initialData.valueAsTypeList))this.valueAsTypeList=this.valueAsTypeList||[],this.initialData.valueAsTypeList.forEach(d=>{const o=_(d),l=this.project.get(o);l&&this.valueAsTypeList.push(l)});else if(this.initialData.valueAsTypeSingle){const d=_(this.initialData.valueAsTypeSingle),o=this.project.get(d);o&&(this.valueAsTypeSingle=o)}return{updated:p(e),added:p(t),removed:p(i),affected:p(s),self:this}}afterAllChildrenInitialized(e=this.project.addChangeSet(new A(this.project,m.sessionAuthor,T().toISOString(),this,!0,"after-all-children-initialized"))){const t=[],i=[],s=[],d=[];return this.initialized=!0,this.captureVersion(),e==null||e.attemptAutoclose("after-all-children-initialized",this.id),{updated:p(t),added:p(i),removed:p(s),affected:p(d),self:this}}addSelfToProject(e=this.project.addChangeSet(new A(this.project,m.sessionAuthor,T().toISOString(),this,!0,"add-self-to-project"))){var o,l;const t=[this],i=[],s=[],d=[];return((o=this.parent)==null?void 0:o.type)===n.DataType?this.parent.setEntity(this):(l=this.parent)==null||l.setDefaultValue(this),t.push(this.parent),this.subscribe(),this.subscribeToDependencies(),e==null||e.attemptAutoclose("add-self-to-project",this.id),{updated:p(t),added:p(i),removed:p(s),affected:p(d),self:this}}setParent(e,t=this.project.addChangeSet(new A(this.project,m.sessionAuthor,T().toISOString(),this,!0,"set-parent"))){var i;return((i=this.parent)==null?void 0:i.id)!==(e==null?void 0:e.id)&&(this.parent=e,t&&(t==null||t.add(this,b.Updated),t==null||t.attemptAutoclose("set-parent",this.id))),this}setStandaloneParent(e){return this.standaloneParent=e,this}setValueAsTypeSingle(e,t=this.project.addChangeSet(new A(this.project,m.sessionAuthor,T().toISOString(),this,!0,"set-value-as-type-single"))){return this.valueAsTypeSingle!==e&&(this.valueAsTypeSingle=e,t==null||t.add(this,b.Updated)),t==null||t.attemptAutoclose("set-value-as-type-single",this.id),this}setValueAsTypeList(e,t=this.project.addChangeSet(new A(this.project,m.sessionAuthor,T().toISOString(),this,!0,"set-value-as-type-list"))){var i,s;return!e&&this.valueAsTypeList?(this.valueAsTypeList=null,t==null||t.add(this,b.Updated)):e&&!this.valueAsTypeList?(this.valueAsTypeList=e,t==null||t.add(this,b.Updated)):e&&this.valueAsTypeList&&((i=this.valueAsTypeList)==null?void 0:i.length)!==e.length?(this.valueAsTypeList=e,t==null||t.add(this,b.Updated)):e&&this.valueAsTypeList&&((s=this.valueAsTypeList)!=null&&s.every((d,o)=>d!==e[o]))&&(this.valueAsTypeList=e,t==null||t.add(this,b.Updated)),t==null||t.attemptAutoclose("set-value-as-type-list",this.id),this}setValueAsType(e,t=this.project.addChangeSet(new A(this.project,m.sessionAuthor,T().toISOString(),this,!0,"set-value-as-type"))){return e?(Array.isArray(e)?this.setValueAsTypeList(e,t):this.setValueAsTypeSingle(e,t),t==null||t.attemptAutoclose("set-value-as-type",this.id),this):(this.setValueAsTypeSingle(null,t),this.setValueAsTypeList(null,t),this)}initChildren(e=this.project.addChangeSet(new A(this.project,m.sessionAuthor,T().toISOString(),this,!0,"init-children"))){if(this.initialized||this.startedInitialization)return this;if(this.startedInitialization=!0,this.standalone){if(this.initialData.valueAsTypeList&&Array.isArray(this.initialData.valueAsTypeList))this.valueAsTypeList=this.initialData.valueAsTypeList.map(t=>{if(t.type===n.GenericReference){const s=this.project.findSubscribedBuiltInInstanceFromReference(t);if(!s)throw new Error(`Standalone entity of type '${this.type}' with id '${this.id}' has a reference to an entity of type '${t.entityType}' with id '${t.entityId}' that is not part of the project state.`);return s}const i=this.project.get(t.id);if(!i)throw new Error(`Standalone entity of type '${this.type}' with id '${this.id}' has a reference to an entity of type '${t.type}' with id '${t.id}' that is not part of the project state.`);return i});else if(this.initialData.valueAsTypeSingle){if(this.initialData.valueAsTypeSingle.type===n.GenericReference){const i=this.project.findSubscribedBuiltInInstanceFromReference(this.initialData.valueAsTypeSingle);if(!i)throw new Error(`Standalone entity of type '${this.type}' with id '${this.id}' has a reference to an entity of type '${this.initialData.valueAsTypeSingle.entityType}' with id '${this.initialData.valueAsTypeSingle.entityId}' that is not part of the project state.`);return this.valueAsTypeSingle=i,this}const t=this.project.get(this.initialData.valueAsTypeSingle.id);if(!t)throw new Error(`Standalone entity of type '${this.type}' with id '${this.id}' has a reference to an entity of type '${this.initialData.valueAsTypeSingle.type}' with id '${this.initialData.valueAsTypeSingle.id}' that is not part of the project state.`);this.valueAsTypeSingle=t}return this}if(this.initialData.valueAsTypeList&&Array.isArray(this.initialData.valueAsTypeList))this.valueAsTypeList=this.initialData.valueAsTypeList.map(t=>{if(t.type===n.GenericReference){const s=this.project.findSubscribedBuiltInInstanceFromReference(t);if(!s)throw new Error(`Standalone entity of type '${this.type}' with id '${this.id}' has a reference to an entity of type '${t.entityType}' with id '${t.entityId}' that is not part of the project state.`);return s}const i=this.project.get(t.id);if(!i)throw new Error(`Standalone entity of type '${this.type}' with id '${this.id}' has a reference to an entity of type '${t.type}' with id '${t.id}' that is not part of the project state.`);return i});else if(this.initialData.valueAsTypeSingle){if(this.initialData.valueAsTypeSingle.type===n.GenericReference){const i=_(this.initialData.valueAsTypeSingle),s=i?this.project.get(i):null;if(!s)throw new Error(`Standalone entity of type '${this.type}' with id '${this.id}' has a reference to an entity of type '${this.initialData.valueAsTypeSingle.entityType}' with id '${this.initialData.valueAsTypeSingle.entityId}' that is not part of the project state.`);return this.valueAsTypeSingle=s,this}const t=this.project.get(this.initialData.valueAsTypeSingle.id);if(!t)throw new Error(`Standalone entity of type '${this.type}' with id '${this.id}' has a reference to an entity of type '${this.initialData.valueAsTypeSingle.type}' with id '${this.initialData.valueAsTypeSingle.id}' that is not part of the project state.`);this.valueAsTypeSingle=t}return this.subscribeToDependencies(),this.afterAllChildrenInitialized(e),e==null||e.attemptAutoclose("init-children",this.id),this}subscribe(){return this.activeVersion=!0,this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}metaSync(e,t=this.project.addChangeSet(new A(this.project,m.sessionAuthor,T().toISOString(),this,!0,"meta-sync"))){const i=ct(this,e),s=this.toMeta();return this.name=e.name!==void 0?e.name:s.name,this.autogeneration=e.autogeneration!==void 0?e.autogeneration:s.autogeneration,this.value=e.value!==void 0?e.value:s.value,super.metaSync(e),e.deleted===!0&&!s.deleted?t==null||t.add(this,b.Removed):e.deleted===!1&&s.deleted?t==null||t.add(this,b.Added):i&&(t==null||t.add(this,b.Updated)),t==null||t.attemptAutoclose("meta-sync",this.id),this}async APILoad(e=U,...t){return await Le.repository.APILoad(this.id,...t),this}async APICreate(e=U,...t){return await Le.repository.APICreate(this.toShallowJSON(),...t),this}async APIUpdate(e=U,...t){return await Le.repository.APIUpdate(this.toShallowJSON(),...t),this}async APIDelete(e=U,...t){return await Le.repository.APIDelete(this.toShallowJSON(),...t),this}async APIClone(e=U,...t){return await Le.repository.APIClone(this.id,...t),this}async APILoadVersion(e=U,t,...i){return await Le.repository.APILoadVersion(this.id,t,...i)}remove({ignoreUpstream:e}={ignoreUpstream:!1},t=this.project.addChangeSet(new A(this.project,m.sessionAuthor,T().toISOString(),this,!0,"remove-entity"))){const i=[],s=[],d=[],o=[];return t!=null&&t.hasRemoved(this.id)?(t==null||t.attemptAutoclose("remove-entity",this.id),{added:[],updated:[],removed:[],affected:[],self:this}):(s.push(this),this.unsubscribe(),this.project.subscribeDeletedInstance(this),this.metaSync({deleted:!0},t),Object.values(this.detachedDependents).forEach(l=>{const{updated:u,removed:y,added:c}=l.entity.onDetachedDependencyRemoved(this,l.field,t);i.push(...u),s.push(...y),d.push(...c)}),t==null||t.attemptAutoclose("remove-entity",this.id),{added:p(d),updated:p(i),removed:p(s),affected:p(o),self:this})}restore({}={},e=this.project.addChangeSet(new A(this.project,m.sessionAuthor,T().toISOString(),this,!0,"restore-entity"))){const t=[],i=[],s=[],d=[];return e!=null&&e.hasAdded(this.id)?(e==null||e.attemptAutoclose("restore-entity",this.id),{added:[],updated:[],removed:[],affected:[],self:this}):(this.subscribe(),this.project.unsubscribeDeletedInstance(this),this.metaSync({deleted:!1},e),Object.values(this.detachedDependents).forEach(o=>{const{updated:l,removed:u,added:y}=o.entity.onDetachedDependencyRestored(this,o.field,e);i.push(...l),s.push(...u),t.push(...y)}),e==null||e.attemptAutoclose("restore-entity",this.id),{added:p(t),updated:p(i),removed:p(s),affected:p(d),self:this})}toFlat(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this,...this.valueAsTypeSingle?this.valueAsTypeSingle.toFlat(e):[],...this.valueAsTypeList&&Array.isArray(this.valueAsTypeList)?this.valueAsTypeList.flatMap(i=>i.toFlat(e)):[]])}toFlatIds(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.id,...this.valueAsTypeSingle?this.valueAsTypeSingle.toFlatIds(e):[],...this.valueAsTypeList&&Array.isArray(this.valueAsTypeList)?this.valueAsTypeList.flatMap(i=>i.toFlatIds(e)):[]])}toMeta(){return{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,value:this.value,autogeneration:this.autogeneration,type:this.type,name:this.name}}toJSON(e=new Set){var t,i;return e.has(this.id)?this.toReference():(e.add(this.id),{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,name:this.name,autogeneration:this.autogeneration,value:this.value,valueAsTypeSingle:((t=this.valueAsTypeSingle)==null?void 0:t.toJSON(e))||null,valueAsTypeList:Array.isArray(this.valueAsTypeSingle)?this.valueAsTypeSingle.map(s=>s.toJSON(e)):null,parent:(i=this.parent)==null?void 0:i.toReference()})}toJSONClone(e=J){var i,s,d,o,l,u;let t;return(i=e.seenEntityMaps)!=null&&i.has(this.id)?t=e.seenEntityMaps.get(this.id):(t=e.newId||ht(this,this.project,e.uuidStrategy),e.seenEntityMaps&&e.seenEntityMaps.set(this.id,t)),(s=e.seenEntities)!=null&&s.has(t)||(d=e.seenEntities)!=null&&d.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:m.UUID.uuid(),createdAt:e.timestamp||T().toISOString(),previousVersion:null,author:this.author,deleted:this.deleted,type:this.type,name:this.name,autogeneration:this.autogeneration,value:this.value,valueAsTypeSingle:this.valueAsTypeSingle?this.project.getBuiltIn(this.valueAsTypeSingle.id)?this.valueAsTypeSingle.toJSON():this.valueAsTypeSingle.toJSONClone({...e,newId:null}):null,valueAsTypeList:this.valueAsTypeSingle&&Array.isArray(this.valueAsTypeSingle)?this.valueAsTypeSingle.map(y=>this.project.getBuiltIn(y.id)?y.toJSON():y.toJSONClone({...e,newId:null})):null,parent:(u=this.parent)==null?void 0:u.toReference({seenEntityMaps:e.seenEntityMaps})})}toReference(e=J){var i;let t=this.id;return(i=e.seenEntityMaps)!=null&&i.has(this.id)&&(t=e.seenEntityMaps.get(this.id)),{id:t+"--"+m.UUID.uuid()+"--ref",type:n.GenericReference,entityId:t,version:this.version,entityType:this.type}}toShallowJSON(e=J){var i,s,d;let t=this.id;return(i=e.seenEntityMaps)!=null&&i.has(this.id)&&(t=e.seenEntityMaps.get(this.id)),{id:t,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,name:this.name,valueAsTypeSingle:((s=this.valueAsTypeSingle)==null?void 0:s.toReference(e))||null,valueAsTypeList:Array.isArray(this.valueAsTypeSingle)?this.valueAsTypeSingle.map(o=>o.toReference(e)):null,value:this.value,autogeneration:this.autogeneration,parent:(d=this.parent)==null?void 0:d.toReference(e)}}toFlatJSON(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toShallowJSON(),...this.valueAsTypeSingle?this.valueAsTypeSingle.toFlatJSON(e):[],...this.valueAsTypeList&&Array.isArray(this.valueAsTypeList)?this.valueAsTypeList.flatMap(i=>i.toFlatJSON(e)):[]])}toGenerationTarget(){var e,t;return{id:this.id,type:this.type,name:this.name,valueAsTypeSingle:((e=this.valueAsTypeSingle)==null?void 0:e.id)||null,valueAsTypeList:Array.isArray(this.valueAsTypeSingle)?this.valueAsTypeSingle.map(i=>i.id):null,value:this.value,autogeneration:this.autogeneration,parent:(t=this.parent)==null?void 0:t.id}}toFlatGenerationTarget(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toGenerationTarget(),...this.valueAsTypeSingle?this.valueAsTypeSingle.toFlatGenerationTarget(e):[],...this.valueAsTypeList&&Array.isArray(this.valueAsTypeList)?this.valueAsTypeList.flatMap(i=>i.toFlatGenerationTarget(e)):[]])}clearErrors(){return this.errors=[],this}validate(){const e=U1(this);return this.errors=e,{success:!0,error:null,data:this.toJSON()}}getErrors(){return[...this.errors]}getShallowErrors(){return this.errors}clone(e=this.project.addChangeSet(new A(this.project,m.sessionAuthor,T().toISOString(),this,!0,"clone-entity")),t=null,i=null,s=!0){let d=mt(t,this);const o=this.toJSON(),l=i||m.UUID.uuid();o.id=l,o.version=m.UUID.uuid(),o.createdAt=(e==null?void 0:e.timestamp)||T().toISOString(),o.author=(e==null?void 0:e.author)||"1",o.previousVersion=null,o.deleted=!1;const u=nt(o,d);return u.initChildren(e),t&&u.setParent(t,null),e==null||e.add(u,b.Added),s&&u.subscribe(),e==null||e.attemptAutoclose("clone-entity",this.id),u}merge(e,t=this.project.addChangeSet(new A(this.project,m.sessionAuthor,T().toISOString(),this,!0,"merge-literal-value"))){const i=[],s=[],d=[],o=[];return this.valueAsTypeSingle!==(e==null?void 0:e.valueAsTypeSingle)&&(this.setValueAsType(e.valueAsTypeSingle,t),i.push(this)),this.value!==e.value&&(this.metaSync({value:e.value},t),i.push(this)),this.autogeneration!==e.autogeneration&&(this.metaSync({autogeneration:e.autogeneration},t),i.push(this)),this.name!==e.name&&(this.metaSync({name:e.name},t),i.push(this)),t==null||t.attemptAutoclose("merge-literal-value",this.id),{updated:p(i),added:p(s),removed:p(d),affected:p(o),self:this}}};f(Le,"repository",{APICreate:async(e,...t)=>e,APIUpdate:async(e,...t)=>e,APIDelete:async(e,...t)=>e,APIClone:async(e,...t)=>{},APILoad:async(e,...t)=>null,APILoadVersion:async(e,t,...i)=>null}),f(Le,"type",n.LiteralValue),f(Le,"USER_MANAGED_PARENT_TYPES",[n.DataType,n.InputMap,n.Property,n.ArgumentDeclaration,n.ReturnDeclaration,n.VariableDeclaration,n.VariableInstance,n.ValueDescriptor,n.OutputMap]),f(Le,"PARENT_TYPES",[...Le.USER_MANAGED_PARENT_TYPES]),f(Le,"MUTABLE_BASE_PROPERTIES",["name","autogeneration","value"]),f(Le,"INMUTABLE_BASE_PROPERTIES",["id","type","version","createdAt","author","previousVersion"]),f(Le,"BASE_PROPERTIES",[...Le.MUTABLE_BASE_PROPERTIES,...Le.INMUTABLE_BASE_PROPERTIES]),f(Le,"MUTABLE_META_PROPERTIES",[...Le.MUTABLE_BASE_PROPERTIES]),f(Le,"INMUTABLE_META_PROPERTIES",[...Le.INMUTABLE_BASE_PROPERTIES]),f(Le,"META_PROPERTIES",[...Le.MUTABLE_META_PROPERTIES,...Le.INMUTABLE_META_PROPERTIES]),f(Le,"MUTABLE_UPSTREAM_PROPERTIES",[]),f(Le,"INMUTABLE_UPSTREAM_PROPERTIES",["parent"]),f(Le,"UPSTREAM_PROPERTIES",[...Le.MUTABLE_UPSTREAM_PROPERTIES,...Le.INMUTABLE_UPSTREAM_PROPERTIES]),f(Le,"MUTABLE_DOWNSTREAM_PROPERTIES",["valueAsTypeSingle","valueAsTypeList"]),f(Le,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),f(Le,"DOWNSTREAM_PROPERTIES",[...Le.MUTABLE_DOWNSTREAM_PROPERTIES,...Le.INMUTABLE_DOWNSTREAM_PROPERTIES]),f(Le,"PROPERTIES",[...Le.META_PROPERTIES,...Le.UPSTREAM_PROPERTIES,...Le.DOWNSTREAM_PROPERTIES]);let Qr=Le;function g1(r){var s;const a=S3(),e=r.toJSON();a.safeParse(e).success,(s=r.dataType)==null||s.validate();const i=[];return Ke(r.errors,i)}const nS=Object.freeze(Object.defineProperty({__proto__:null,validate:g1},Symbol.toStringTag,{value:"Module"}));var G1=(r=>(r.DataTypeEntity="data-type-entity",r))(G1||{});const je=class je extends dt{constructor(e,t){super(e);f(this,"initialData");f(this,"id");f(this,"name");f(this,"description",null);f(this,"index");f(this,"required");f(this,"parentRelationType");f(this,"type",n.ValueDescriptor);f(this,"defaultValue",null);f(this,"dataType",null);f(this,"project");f(this,"errors",[]);f(this,"parent");f(this,"detachedDependents",{});f(this,"knownVersions",null);f(this,"activeVersion",!1);f(this,"initialized",!1);f(this,"startedInitialization",!1);f(this,"codeNativeValueValidation",null);this.initialData=e,this.project=t,this.id=e.id,this.name=e.name,this.description=e.description,this.index=e.index,this.required=e.required,this.parentRelationType=e.parentRelationType}static new(e=null){return{id:m.UUID.uuid(),version:m.UUID.uuid(),createdAt:(e==null?void 0:e.timestamp)||T().toISOString(),author:(e==null?void 0:e.author)||m.sessionAuthor,previousVersion:null,deleted:!1,type:n.ValueDescriptor,name:"",description:"",dataType:null,index:0,required:!1,parentRelationType:N.FixedArguments,defaultValue:null,parent:null}}static fromGenerationTarget(e,t){const i=e.parent?_(e.parent):null,s=i?t.get(i):null,d=e.parentRelationType===N.FixedArguments?s==null?void 0:s.inputs.length:s==null?void 0:s.outputs.length,o={id:e.id,version:m.UUID.uuid(),createdAt:T().toISOString(),author:m.sessionAuthor,previousVersion:null,deleted:!1,name:e.name,type:n.ValueDescriptor,index:d||0,description:e.description,required:e.required,defaultValue:null,parentRelationType:e.parentRelationType,dataType:null,parent:s},l=C(o,t);return s&&l.setParent(s,null),l.initChildren(null),l}static validateGenerationTarget(e,t){let i=JSON.parse(JSON.stringify(e));const s=[],d=bt(i,{parent:{list:!1,types:[n.ActionDescriptor]}},t);i=d.modifiedData,s.push(...d.errors,...pt(i));const o=i.parent&&t.get(i.parent),l=o&&an(o);return l&&l.type===n.ActionDescriptor&&s.push(new w({id:`${e.id}--${R.BuiltInEntityParent}`,code:R.BuiltInEntityParent,severity:D.Error,message:`Entity of type "${e.type}" with id "${e.id}", has a parent that is a built-in entity "${l.name}" of type '${l.type}' with id '${l.id}'.
202
+ 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}}subscribeDependents(e){return e.forEach(t=>{this.detachedDependents[t.entity.id]||(this.detachedDependents[t.entity.id]=t)}),this}syncDependents(e=this.project.addChangeSet(new A(this.project,m.sessionAuthor,T().toISOString(),this,!0,"sync-dependents"))){const t=[],i=[],s=[],d=[];return Object.values(this.detachedDependents).forEach(o=>{const l=o.entity.afterAllChildrenInitialized(e);t.push(...l.updated),i.push(...l.added),s.push(...l.removed),d.push(...l.affected)}),e==null||e.attemptAutoclose("sync-dependents",this.id),{updated:p(t),added:p(i),removed:p(s),affected:p(d),self:this}}onDetachedDependencyRemoved(e,t,i){const s=[],d=[],o=[],l=[];return t==="value-as-type-single"&&(this.valueAsTypeSingle=null,i==null||i.add(this,b.Updated)),t==="value-as-type-list"&&(this.valueAsTypeList=(this.valueAsTypeList||[]).filter(u=>u.id!==e.id),i==null||i.add(this,b.Updated)),{updated:p(s),added:p(d),removed:p(o),affected:p(l),self:this}}onDetachedDependencyRestored(e,t,i){const s=[],d=[],o=[],l=[];return t==="value-as-type-single"&&(this.valueAsTypeSingle=e,i==null||i.add(this,b.Updated)),t==="value-as-type-list"&&(this.valueAsTypeList=[...Array.isArray(this.valueAsTypeList||[])?this.valueAsTypeList:[],e],i==null||i.add(this,b.Updated)),{updated:p(s),added:p(d),removed:p(o),affected:p(l),self:this}}subscribeToDependencies(){return!this.valueAsTypeSingle&&!this.valueAsTypeList?this:(this.valueAsTypeList&&Array.isArray(this.valueAsTypeList)?this.valueAsTypeList.forEach(e=>e.subscribeDependents([{entity:this,field:"value-as-type-list"}])):this.valueAsTypeSingle&&this.valueAsTypeSingle.subscribeDependents([{entity:this,field:"value-as-type-single"}]),this)}increaseVersion(e){if(e&&!T(e).isValid())throw new Error(`The shared timestamp '${e}' is not a valid ISO 8601 date string.`);return e&&T(e).isSame(T(this.createdAt))?this:(this.previousVersion=this.version,this.version=m.UUID.uuid(),this.createdAt=T(e).toISOString()||T().toISOString(),this)}captureVersion(){var t;const e=((t=this.knownVersions)==null?void 0:t.get(this.version))||new Le(this,this.project);return e.metaSync(this.toMeta(),null),this.knownVersions=this.knownVersions?this.knownVersions.set(this.version,e):new Map([[this.version,e]]),e.valueAsTypeSingle=this.valueAsTypeSingle,e.parent=this.parent,this}recursiveCaptureUpstreamVersions(e){const t=[],i=[],s=[],d=[];if(this.parent){this.parent.increaseVersion(e);const o=this.parent.recursiveCaptureUpstreamVersions(e);t.push(this.parent,...o.updated),i.push(...o.added),s.push(...o.removed)}return{updated:p(t),added:p(i),removed:p(s),affected:p(d),self:this}}async restoreVersion(e){var l;const t=[],i=[],s=[],d=[];if(this.version===e)return{updated:p(t),added:p(i),removed:p(s),affected:p(d),self:this};if(!this.knownVersions){const u=new Map;for(const[y,c]of this.knownVersions||new Map){if(u.set(y,c),c.activeVersion=!1,c.knownVersions)for(const[I,E]of c.knownVersions)u.set(I,E);c.knownVersions=null}}let o=(l=this.knownVersions)==null?void 0:l.get(e);if(!o){const u=await this.APILoadVersion({},e);if(!u)throw new Error(`Version with id '${e}' for entity with id '${this.id}' not found.`);o=new Le(u,this.project)}return this.metaSync(o.toShallowJSON(),null),this.valueAsTypeSingle=o.valueAsTypeSingle,this.parent=o.parent,{updated:p(t),added:p(i),removed:p(s),affected:p(d),self:this}}hydrateAncestors(){const e=[],t=[],i=[],s=[];if(this.initialData.parent&&this.initialData.standaloneParent)throw new Error(`Entity with id '${this.id}' cannot have both 'parent' and 'standaloneParent' properties set.`);if(this.initialData.parent){const d=_(this.initialData.parent),o=this.project.get(d);if(o)this.setParent(o,null),e.push(o);else throw new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${d}' that isn't found in the project`)}else if(this.initialData.standaloneParent){const d=_(this.initialData.standaloneParent),o=this.project.get(d);if(o)this.setStandaloneParent(o);else throw new Error(`${this.type} with id '${this.id}' has a 'standaloneParent' reference '${d}' that isn't found in the project`)}else throw new Error(`${this.type} with id '${this.id}' must have a 'parent'`);if(this.initialData.valueAsTypeList&&Array.isArray(this.initialData.valueAsTypeList))this.valueAsTypeList=this.valueAsTypeList||[],this.initialData.valueAsTypeList.forEach(d=>{const o=_(d),l=this.project.get(o);l&&this.valueAsTypeList.push(l)});else if(this.initialData.valueAsTypeSingle){const d=_(this.initialData.valueAsTypeSingle),o=this.project.get(d);o&&(this.valueAsTypeSingle=o)}return{updated:p(e),added:p(t),removed:p(i),affected:p(s),self:this}}afterAllChildrenInitialized(e=this.project.addChangeSet(new A(this.project,m.sessionAuthor,T().toISOString(),this,!0,"after-all-children-initialized"))){const t=[],i=[],s=[],d=[];return this.initialized=!0,this.captureVersion(),e==null||e.attemptAutoclose("after-all-children-initialized",this.id),{updated:p(t),added:p(i),removed:p(s),affected:p(d),self:this}}addSelfToProject(e=this.project.addChangeSet(new A(this.project,m.sessionAuthor,T().toISOString(),this,!0,"add-self-to-project"))){var o,l;const t=[this],i=[],s=[],d=[];return((o=this.parent)==null?void 0:o.type)===n.DataType?this.parent.setEntity(this):(l=this.parent)==null||l.setDefaultValue(this),t.push(this.parent),this.subscribe(),this.subscribeToDependencies(),e==null||e.attemptAutoclose("add-self-to-project",this.id),{updated:p(t),added:p(i),removed:p(s),affected:p(d),self:this}}setParent(e,t=this.project.addChangeSet(new A(this.project,m.sessionAuthor,T().toISOString(),this,!0,"set-parent"))){var i;return((i=this.parent)==null?void 0:i.id)!==(e==null?void 0:e.id)&&(this.parent=e,t&&(t==null||t.add(this,b.Updated),t==null||t.attemptAutoclose("set-parent",this.id))),this}setStandaloneParent(e){return this.standaloneParent=e,this}setValueAsTypeSingle(e,t=this.project.addChangeSet(new A(this.project,m.sessionAuthor,T().toISOString(),this,!0,"set-value-as-type-single"))){return this.valueAsTypeSingle!==e&&(this.valueAsTypeSingle=e,t==null||t.add(this,b.Updated)),t==null||t.attemptAutoclose("set-value-as-type-single",this.id),this}setValueAsTypeList(e,t=this.project.addChangeSet(new A(this.project,m.sessionAuthor,T().toISOString(),this,!0,"set-value-as-type-list"))){var i,s;return!e&&this.valueAsTypeList?(this.valueAsTypeList=null,t==null||t.add(this,b.Updated)):e&&!this.valueAsTypeList?(this.valueAsTypeList=e,t==null||t.add(this,b.Updated)):e&&this.valueAsTypeList&&((i=this.valueAsTypeList)==null?void 0:i.length)!==e.length?(this.valueAsTypeList=e,t==null||t.add(this,b.Updated)):e&&this.valueAsTypeList&&((s=this.valueAsTypeList)!=null&&s.every((d,o)=>d!==e[o]))&&(this.valueAsTypeList=e,t==null||t.add(this,b.Updated)),t==null||t.attemptAutoclose("set-value-as-type-list",this.id),this}setValueAsType(e,t=this.project.addChangeSet(new A(this.project,m.sessionAuthor,T().toISOString(),this,!0,"set-value-as-type"))){return e?(Array.isArray(e)?this.setValueAsTypeList(e,t):this.setValueAsTypeSingle(e,t),t==null||t.attemptAutoclose("set-value-as-type",this.id),this):(this.setValueAsTypeSingle(null,t),this.setValueAsTypeList(null,t),this)}initChildren(e=this.project.addChangeSet(new A(this.project,m.sessionAuthor,T().toISOString(),this,!0,"init-children"))){if(this.initialized||this.startedInitialization)return this;if(this.startedInitialization=!0,this.standalone){if(this.initialData.valueAsTypeList&&Array.isArray(this.initialData.valueAsTypeList))this.valueAsTypeList=this.initialData.valueAsTypeList.map(t=>{if(t.type===n.GenericReference){const s=this.project.findSubscribedBuiltInInstanceFromReference(t);if(!s)throw new Error(`Standalone entity of type '${this.type}' with id '${this.id}' has a reference to an entity of type '${t.entityType}' with id '${t.entityId}' that is not part of the project state.`);return s}const i=this.project.get(t.id);if(!i)throw new Error(`Standalone entity of type '${this.type}' with id '${this.id}' has a reference to an entity of type '${t.type}' with id '${t.id}' that is not part of the project state.`);return i});else if(this.initialData.valueAsTypeSingle){if(this.initialData.valueAsTypeSingle.type===n.GenericReference){const i=this.project.findSubscribedBuiltInInstanceFromReference(this.initialData.valueAsTypeSingle);if(!i)throw new Error(`Standalone entity of type '${this.type}' with id '${this.id}' has a reference to an entity of type '${this.initialData.valueAsTypeSingle.entityType}' with id '${this.initialData.valueAsTypeSingle.entityId}' that is not part of the project state.`);return this.valueAsTypeSingle=i,this}const t=this.project.get(this.initialData.valueAsTypeSingle.id);if(!t)throw new Error(`Standalone entity of type '${this.type}' with id '${this.id}' has a reference to an entity of type '${this.initialData.valueAsTypeSingle.type}' with id '${this.initialData.valueAsTypeSingle.id}' that is not part of the project state.`);this.valueAsTypeSingle=t}return this}if(this.initialData.valueAsTypeList&&Array.isArray(this.initialData.valueAsTypeList))this.valueAsTypeList=this.initialData.valueAsTypeList.map(t=>{if(t.type===n.GenericReference){const s=this.project.findSubscribedBuiltInInstanceFromReference(t);if(!s)throw new Error(`Standalone entity of type '${this.type}' with id '${this.id}' has a reference to an entity of type '${t.entityType}' with id '${t.entityId}' that is not part of the project state.`);return s}const i=this.project.get(t.id);if(!i)throw new Error(`Standalone entity of type '${this.type}' with id '${this.id}' has a reference to an entity of type '${t.type}' with id '${t.id}' that is not part of the project state.`);return i});else if(this.initialData.valueAsTypeSingle){if(this.initialData.valueAsTypeSingle.type===n.GenericReference){const i=_(this.initialData.valueAsTypeSingle),s=i?this.project.get(i):null;if(!s)throw new Error(`Standalone entity of type '${this.type}' with id '${this.id}' has a reference to an entity of type '${this.initialData.valueAsTypeSingle.entityType}' with id '${this.initialData.valueAsTypeSingle.entityId}' that is not part of the project state.`);return this.valueAsTypeSingle=s,this}const t=this.project.get(this.initialData.valueAsTypeSingle.id);if(!t)throw new Error(`Standalone entity of type '${this.type}' with id '${this.id}' has a reference to an entity of type '${this.initialData.valueAsTypeSingle.type}' with id '${this.initialData.valueAsTypeSingle.id}' that is not part of the project state.`);this.valueAsTypeSingle=t}return this.subscribeToDependencies(),this.afterAllChildrenInitialized(e),e==null||e.attemptAutoclose("init-children",this.id),this}subscribe(){return this.activeVersion=!0,this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}metaSync(e,t=this.project.addChangeSet(new A(this.project,m.sessionAuthor,T().toISOString(),this,!0,"meta-sync"))){const i=ct(this,e),s=this.toMeta();return this.name=e.name!==void 0?e.name:s.name,this.autogeneration=e.autogeneration!==void 0?e.autogeneration:s.autogeneration,this.value=e.value!==void 0?e.value:s.value,super.metaSync(e),e.deleted===!0&&!s.deleted?t==null||t.add(this,b.Removed):e.deleted===!1&&s.deleted?t==null||t.add(this,b.Added):i&&(t==null||t.add(this,b.Updated)),t==null||t.attemptAutoclose("meta-sync",this.id),this}async APILoad(e=U,...t){return await Le.repository.APILoad(this.id,...t),this}async APICreate(e=U,...t){return await Le.repository.APICreate(this.toShallowJSON(),...t),this}async APIUpdate(e=U,...t){return await Le.repository.APIUpdate(this.toShallowJSON(),...t),this}async APIDelete(e=U,...t){return await Le.repository.APIDelete(this.toShallowJSON(),...t),this}async APIClone(e=U,...t){return await Le.repository.APIClone(this.id,...t),this}async APILoadVersion(e=U,t,...i){return await Le.repository.APILoadVersion(this.id,t,...i)}remove({ignoreUpstream:e}={ignoreUpstream:!1},t=this.project.addChangeSet(new A(this.project,m.sessionAuthor,T().toISOString(),this,!0,"remove-entity"))){const i=[],s=[],d=[],o=[];return t!=null&&t.hasRemoved(this.id)?(t==null||t.attemptAutoclose("remove-entity",this.id),{added:[],updated:[],removed:[],affected:[],self:this}):(s.push(this),this.unsubscribe(),this.project.subscribeDeletedInstance(this),this.metaSync({deleted:!0},t),Object.values(this.detachedDependents).forEach(l=>{const{updated:u,removed:y,added:c}=l.entity.onDetachedDependencyRemoved(this,l.field,t);i.push(...u),s.push(...y),d.push(...c)}),t==null||t.attemptAutoclose("remove-entity",this.id),{added:p(d),updated:p(i),removed:p(s),affected:p(o),self:this})}restore({}={},e=this.project.addChangeSet(new A(this.project,m.sessionAuthor,T().toISOString(),this,!0,"restore-entity"))){const t=[],i=[],s=[],d=[];return e!=null&&e.hasAdded(this.id)?(e==null||e.attemptAutoclose("restore-entity",this.id),{added:[],updated:[],removed:[],affected:[],self:this}):(this.subscribe(),this.project.unsubscribeDeletedInstance(this),this.metaSync({deleted:!1},e),Object.values(this.detachedDependents).forEach(o=>{const{updated:l,removed:u,added:y}=o.entity.onDetachedDependencyRestored(this,o.field,e);i.push(...l),s.push(...u),t.push(...y)}),e==null||e.attemptAutoclose("restore-entity",this.id),{added:p(t),updated:p(i),removed:p(s),affected:p(d),self:this})}toFlat(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this,...this.valueAsTypeSingle?this.valueAsTypeSingle.toFlat(e):[],...this.valueAsTypeList&&Array.isArray(this.valueAsTypeList)?this.valueAsTypeList.flatMap(i=>i.toFlat(e)):[]])}toFlatIds(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.id,...this.valueAsTypeSingle?this.valueAsTypeSingle.toFlatIds(e):[],...this.valueAsTypeList&&Array.isArray(this.valueAsTypeList)?this.valueAsTypeList.flatMap(i=>i.toFlatIds(e)):[]])}toMeta(){return{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,value:this.value,autogeneration:this.autogeneration,type:this.type,name:this.name}}toJSON(e=new Set){var t,i,s;return e.has(this.id)?this.toReference():(e.add(this.id),{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,name:this.name,autogeneration:this.autogeneration,value:this.value,valueAsTypeSingle:((t=this.valueAsTypeSingle)==null?void 0:t.toJSON(e))||null,valueAsTypeList:Array.isArray(this.valueAsTypeSingle)?this.valueAsTypeSingle.map(d=>d.toJSON(e)):null,parent:(i=this.parent)==null?void 0:i.toReference(),standaloneParent:(s=this.standaloneParent)==null?void 0:s.toReference()})}toJSONClone(e=J){var i,s,d,o,l,u,y;let t;return(i=e.seenEntityMaps)!=null&&i.has(this.id)?t=e.seenEntityMaps.get(this.id):(t=e.newId||ht(this,this.project,e.uuidStrategy),e.seenEntityMaps&&e.seenEntityMaps.set(this.id,t)),(s=e.seenEntities)!=null&&s.has(t)||(d=e.seenEntities)!=null&&d.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:m.UUID.uuid(),createdAt:e.timestamp||T().toISOString(),previousVersion:null,author:this.author,deleted:this.deleted,type:this.type,name:this.name,autogeneration:this.autogeneration,value:this.value,valueAsTypeSingle:this.valueAsTypeSingle?this.project.getBuiltIn(this.valueAsTypeSingle.id)?this.valueAsTypeSingle.toJSON():this.valueAsTypeSingle.toJSONClone({...e,newId:null}):null,valueAsTypeList:this.valueAsTypeSingle&&Array.isArray(this.valueAsTypeSingle)?this.valueAsTypeSingle.map(c=>this.project.getBuiltIn(c.id)?c.toJSON():c.toJSONClone({...e,newId:null})):null,parent:(u=this.parent)==null?void 0:u.toReference({seenEntityMaps:e.seenEntityMaps}),standaloneParent:(y=this.standaloneParent)==null?void 0:y.toReference({seenEntityMaps:e.seenEntityMaps})})}toReference(e=J){var i;let t=this.id;return(i=e.seenEntityMaps)!=null&&i.has(this.id)&&(t=e.seenEntityMaps.get(this.id)),{id:t+"--"+m.UUID.uuid()+"--ref",type:n.GenericReference,entityId:t,version:this.version,entityType:this.type}}toShallowJSON(e=J){var i,s,d,o;let t=this.id;return(i=e.seenEntityMaps)!=null&&i.has(this.id)&&(t=e.seenEntityMaps.get(this.id)),{id:t,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,name:this.name,valueAsTypeSingle:((s=this.valueAsTypeSingle)==null?void 0:s.toReference(e))||null,valueAsTypeList:Array.isArray(this.valueAsTypeSingle)?this.valueAsTypeSingle.map(l=>l.toReference(e)):null,value:this.value,autogeneration:this.autogeneration,parent:(d=this.parent)==null?void 0:d.toReference(e),standaloneParent:(o=this.standaloneParent)==null?void 0:o.toReference(e)}}toFlatJSON(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toShallowJSON(),...this.valueAsTypeSingle?this.valueAsTypeSingle.toFlatJSON(e):[],...this.valueAsTypeList&&Array.isArray(this.valueAsTypeList)?this.valueAsTypeList.flatMap(i=>i.toFlatJSON(e)):[]])}toGenerationTarget(){var e,t,i;return{id:this.id,type:this.type,name:this.name,valueAsTypeSingle:((e=this.valueAsTypeSingle)==null?void 0:e.id)||null,valueAsTypeList:Array.isArray(this.valueAsTypeSingle)?this.valueAsTypeSingle.map(s=>s.id):null,value:this.value,autogeneration:this.autogeneration,parent:(t=this.parent)==null?void 0:t.id,standaloneParent:(i=this.standaloneParent)==null?void 0:i.id}}toFlatGenerationTarget(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toGenerationTarget(),...this.valueAsTypeSingle?this.valueAsTypeSingle.toFlatGenerationTarget(e):[],...this.valueAsTypeList&&Array.isArray(this.valueAsTypeList)?this.valueAsTypeList.flatMap(i=>i.toFlatGenerationTarget(e)):[]])}clearErrors(){return this.errors=[],this}validate(){const e=U1(this);return this.errors=e,{success:!0,error:null,data:this.toJSON()}}getErrors(){return[...this.errors]}getShallowErrors(){return this.errors}clone(e=this.project.addChangeSet(new A(this.project,m.sessionAuthor,T().toISOString(),this,!0,"clone-entity")),t=null,i=null,s=!0){let d=mt(t,this);const o=this.toJSON(),l=i||m.UUID.uuid();o.id=l,o.version=m.UUID.uuid(),o.createdAt=(e==null?void 0:e.timestamp)||T().toISOString(),o.author=(e==null?void 0:e.author)||"1",o.previousVersion=null,o.deleted=!1;const u=nt(o,d);return u.initChildren(e),t&&u.setParent(t,null),e==null||e.add(u,b.Added),s&&u.subscribe(),e==null||e.attemptAutoclose("clone-entity",this.id),u}merge(e,t=this.project.addChangeSet(new A(this.project,m.sessionAuthor,T().toISOString(),this,!0,"merge-literal-value"))){const i=[],s=[],d=[],o=[];return this.valueAsTypeSingle!==(e==null?void 0:e.valueAsTypeSingle)&&(this.setValueAsType(e.valueAsTypeSingle,t),i.push(this)),this.value!==e.value&&(this.metaSync({value:e.value},t),i.push(this)),this.autogeneration!==e.autogeneration&&(this.metaSync({autogeneration:e.autogeneration},t),i.push(this)),this.name!==e.name&&(this.metaSync({name:e.name},t),i.push(this)),t==null||t.attemptAutoclose("merge-literal-value",this.id),{updated:p(i),added:p(s),removed:p(d),affected:p(o),self:this}}};f(Le,"repository",{APICreate:async(e,...t)=>e,APIUpdate:async(e,...t)=>e,APIDelete:async(e,...t)=>e,APIClone:async(e,...t)=>{},APILoad:async(e,...t)=>null,APILoadVersion:async(e,t,...i)=>null}),f(Le,"type",n.LiteralValue),f(Le,"USER_MANAGED_PARENT_TYPES",[n.DataType,n.InputMap,n.Property,n.ArgumentDeclaration,n.ReturnDeclaration,n.VariableDeclaration,n.VariableInstance,n.ValueDescriptor,n.OutputMap]),f(Le,"PARENT_TYPES",[...Le.USER_MANAGED_PARENT_TYPES]),f(Le,"MUTABLE_BASE_PROPERTIES",["name","autogeneration","value"]),f(Le,"INMUTABLE_BASE_PROPERTIES",["id","type","version","createdAt","author","previousVersion"]),f(Le,"BASE_PROPERTIES",[...Le.MUTABLE_BASE_PROPERTIES,...Le.INMUTABLE_BASE_PROPERTIES]),f(Le,"MUTABLE_META_PROPERTIES",[...Le.MUTABLE_BASE_PROPERTIES]),f(Le,"INMUTABLE_META_PROPERTIES",[...Le.INMUTABLE_BASE_PROPERTIES]),f(Le,"META_PROPERTIES",[...Le.MUTABLE_META_PROPERTIES,...Le.INMUTABLE_META_PROPERTIES]),f(Le,"MUTABLE_UPSTREAM_PROPERTIES",[]),f(Le,"INMUTABLE_UPSTREAM_PROPERTIES",["parent"]),f(Le,"UPSTREAM_PROPERTIES",[...Le.MUTABLE_UPSTREAM_PROPERTIES,...Le.INMUTABLE_UPSTREAM_PROPERTIES]),f(Le,"MUTABLE_DOWNSTREAM_PROPERTIES",["valueAsTypeSingle","valueAsTypeList"]),f(Le,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),f(Le,"DOWNSTREAM_PROPERTIES",[...Le.MUTABLE_DOWNSTREAM_PROPERTIES,...Le.INMUTABLE_DOWNSTREAM_PROPERTIES]),f(Le,"PROPERTIES",[...Le.META_PROPERTIES,...Le.UPSTREAM_PROPERTIES,...Le.DOWNSTREAM_PROPERTIES]);let Qr=Le;function g1(r){var s;const a=S3(),e=r.toJSON();a.safeParse(e).success,(s=r.dataType)==null||s.validate();const i=[];return Ke(r.errors,i)}const nS=Object.freeze(Object.defineProperty({__proto__:null,validate:g1},Symbol.toStringTag,{value:"Module"}));var G1=(r=>(r.DataTypeEntity="data-type-entity",r))(G1||{});const je=class je extends dt{constructor(e,t){super(e);f(this,"initialData");f(this,"id");f(this,"name");f(this,"description",null);f(this,"index");f(this,"required");f(this,"parentRelationType");f(this,"type",n.ValueDescriptor);f(this,"defaultValue",null);f(this,"dataType",null);f(this,"project");f(this,"errors",[]);f(this,"parent");f(this,"detachedDependents",{});f(this,"knownVersions",null);f(this,"activeVersion",!1);f(this,"initialized",!1);f(this,"startedInitialization",!1);f(this,"codeNativeValueValidation",null);this.initialData=e,this.project=t,this.id=e.id,this.name=e.name,this.description=e.description,this.index=e.index,this.required=e.required,this.parentRelationType=e.parentRelationType}static new(e=null){return{id:m.UUID.uuid(),version:m.UUID.uuid(),createdAt:(e==null?void 0:e.timestamp)||T().toISOString(),author:(e==null?void 0:e.author)||m.sessionAuthor,previousVersion:null,deleted:!1,type:n.ValueDescriptor,name:"",description:"",dataType:null,index:0,required:!1,parentRelationType:N.FixedArguments,defaultValue:null,parent:null}}static fromGenerationTarget(e,t){const i=e.parent?_(e.parent):null,s=i?t.get(i):null,d=e.parentRelationType===N.FixedArguments?s==null?void 0:s.inputs.length:s==null?void 0:s.outputs.length,o={id:e.id,version:m.UUID.uuid(),createdAt:T().toISOString(),author:m.sessionAuthor,previousVersion:null,deleted:!1,name:e.name,type:n.ValueDescriptor,index:d||0,description:e.description,required:e.required,defaultValue:null,parentRelationType:e.parentRelationType,dataType:null,parent:s},l=C(o,t);return s&&l.setParent(s,null),l.initChildren(null),l}static validateGenerationTarget(e,t){let i=JSON.parse(JSON.stringify(e));const s=[],d=bt(i,{parent:{list:!1,types:[n.ActionDescriptor]}},t);i=d.modifiedData,s.push(...d.errors,...pt(i));const o=i.parent&&t.get(i.parent),l=o&&an(o);return l&&l.type===n.ActionDescriptor&&s.push(new w({id:`${e.id}--${R.BuiltInEntityParent}`,code:R.BuiltInEntityParent,severity:D.Error,message:`Entity of type "${e.type}" with id "${e.id}", has a parent that is a built-in entity "${l.name}" of type '${l.type}' with id '${l.id}'.
203
203
  You can't modify system entities that are built-in.`,issue:null})),o&&o.type===n.ActionDescriptor&&(!i.parentRelationType||!(i.parentRelationType===N.FixedArguments||i.parentRelationType===N.FixedReturns||i.parentRelationType===N.ReturnedError||i.parentRelationType===N.DynamicArgument||i.parentRelationType===N.DynamicReturn)?s.push(new w({id:`${e.id}--${R.InvalidParentRelationType}`,code:R.InvalidParentRelationType,severity:D.Error,message:`The entity with id '${e.id}' and type '${e.type}', must have a 'parentRelationType' property set to either '${N.FixedArguments}', '${N.FixedReturns}', or '${N.ReturnedError}' when being added as a child to an entity of type 'action-descriptor'.`,issue:null})):i.parentRelationType===N.ReturnedError&&o.error&&s.push(new w({id:`${e.id}--${R.NewEntityWouldOverriteExisting}`,code:R.NewEntityWouldOverriteExisting,severity:D.Error,message:`The entity with id '${e.id}' and type '${e.type}', is being added as an error value-descriptor to an entity of type 'action-descriptor' with id '${o.id}', which already has an error value descriptor with id '${o.error.id}'.
204
204
  An action descriptor can only have one error value descriptor child.
205
205
  Either remove the existing error value descriptor or update it with the 'update' action.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elyx-code/project-logic-tree",
3
- "version": "0.0.6230",
3
+ "version": "0.0.6232",
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",