@elyx-code/project-logic-tree 0.0.6408 → 0.0.6409

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.d.ts CHANGED
@@ -13175,6 +13175,7 @@ export declare class OutputMapState extends VersionedState implements IOutputMap
13175
13175
  errors: EntityGenerationError[];
13176
13176
  modifiedData: IOutputMapGenerationTarget;
13177
13177
  };
13178
+ get codeName(): string | null;
13178
13179
  get codeNativeValueValidation(): ValueValidationCallback | null;
13179
13180
  validateGeneratedUpdate(data: Partial<IOutputMapGenerationTarget>): {
13180
13181
  errors: EntityGenerationError[];
package/dist/index.js CHANGED
@@ -79415,6 +79415,10 @@ You can't edit output-map entities as they need to match their return declaratio
79415
79415
  modifiedData: l
79416
79416
  };
79417
79417
  }
79418
+ get codeName() {
79419
+ var i;
79420
+ return (i = this.declaration) == null ? void 0 : i.codeName;
79421
+ }
79418
79422
  get codeNativeValueValidation() {
79419
79423
  var i;
79420
79424
  return this._codeNativeValueValidation || ((i = this.declaration) == null ? void 0 : i.codeNativeValueValidation) || null;
@@ -79658,17 +79662,11 @@ This is likely an incorrect strategy, either the '${this.type}' entity doesn't n
79658
79662
  if (e && e.id !== (p == null ? void 0 : p.id) && this.removeFromParent(a), p)
79659
79663
  this.setParent(p, a);
79660
79664
  else
79661
- throw a == null || a.attemptAutoclose(
79662
- "update-with-shallow-transfer",
79663
- this.id
79664
- ), new Error(
79665
+ throw a == null || a.attemptAutoclose("update-with-shallow-transfer", this.id), new Error(
79665
79666
  `${this.type} with id '${this.id}' has a 'parent' reference '${l}' that isn't found in the project`
79666
79667
  );
79667
79668
  } else
79668
- throw a == null || a.attemptAutoclose(
79669
- "update-with-shallow-transfer",
79670
- this.id
79671
- ), new Error(`${this.type} with id '${this.id}' must have a 'parent'`);
79669
+ throw a == null || a.attemptAutoclose("update-with-shallow-transfer", this.id), new Error(`${this.type} with id '${this.id}' must have a 'parent'`);
79672
79670
  if (i.declaration) {
79673
79671
  const l = Z(i.declaration), p = this.project.get(
79674
79672
  l
@@ -157,7 +157,7 @@ The entity of the data-type has the following properties that can be reads as ou
157
157
  ${bb}`,issue:null})):p.push(new ee({id:`${l.id}--${ae.NoOverlapWithImplementedSignature}`,code:ae.NoOverlapWithImplementedSignature,severity:q.Error,message:`Entity of type '${f.OutputMap}' with id '${l.id}' cannot be added to the parent entity of type '${y.type}' with id '${y.id}'. The data type of the 'variable-declaration' is not set, so it cannot be determined if the output-map is reading a valid property of the data type entity.
158
158
  ${bb}`,issue:null}))}else if(w){const A=y.outputs.find($=>$.declaration.id===l.declaration);A&&p.push(new ee({id:`${l.id}--${k.OutputOverwrite}`,code:k.OutputOverwrite,severity:q.Error,message:`Entity of type '${f.OutputMap}' with id '${l.id}' cannot be added to the parent entity of type '${y.type}' with id '${y.id}'. The parent already has an output-map with id '${A.id}' that points to the same declaration.
159
159
  Any value reads can be done with that output-map instead.
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}))}}}return p.push(...e.errors,...Br(l)),{errors:p,modifiedData:l}}get codeNativeValueValidation(){var i;return this._codeNativeValueValidation||((i=this.declaration)==null?void 0:i.codeNativeValueValidation)||null}validateGeneratedUpdate(i){const a=[];return i.parent&&a.push(new ee({id:`${this.id}--${k.InvalidParentUpdate}`,code:k.InvalidParentUpdate,severity:q.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.
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}))}}}return p.push(...e.errors,...Br(l)),{errors:p,modifiedData:l}}get codeName(){var i;return(i=this.declaration)==null?void 0:i.codeName}get codeNativeValueValidation(){var i;return this._codeNativeValueValidation||((i=this.declaration)==null?void 0:i.codeNativeValueValidation)||null}validateGeneratedUpdate(i){const a=[];return i.parent&&a.push(new ee({id:`${this.id}--${k.InvalidParentUpdate}`,code:k.InvalidParentUpdate,severity:q.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.
161
161
  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:a,modifiedData:i}}subscribeDependents(i){return i.forEach(a=>{this.detachedDependents[a.entity.id]||(this.detachedDependents[a.entity.id]=a)}),this}unsubscribeDependents(i){return i.forEach(a=>{this.detachedDependents[a.entity.id]&&delete this.detachedDependents[a.entity.id]}),this}syncDependents(i=this.project.addChangeSet(new F(this.project,N.sessionAuthor,L().toISOString(),this,!0,"sync-dependents"))){const a=[],l=[],p=[],e=[];return Object.values(this.detachedDependents).forEach(y=>{const v=y.entity.afterAllChildrenInitialized(i);a.push(...v.updated),l.push(...v.added),p.push(...v.removed),e.push(...v.affected)}),i==null||i.attemptAutoclose("sync-dependents",this.id),{updated:R(a),added:R(l),removed:R(p),affected:R(e),self:this}}onDetachedDependencyRemoved(i,a,l){const p=[],e=[],y=[],v=[];if(a==="declaration"){const{updated:E,added:w,removed:A}=this.remove({ignoreUpstream:!1},l);p.push(...E),e.push(...w),y.push(...A)}return{updated:R(p),added:R(e),removed:R(y),affected:R(v),self:this}}onDetachedDependencyRestored(i,a,l){const p=[],e=[],y=[],v=[];if(a==="declaration"){const{updated:E,added:w,removed:A}=this.restore({},l);p.push(...E),e.push(...w),y.push(...A)}return{updated:R(p),added:R(e),removed:R(y),affected:R(v),self:this}}unsubscribeFromDependencies(){var i,a,l,p,e;return(a=(i=this.declaration)==null?void 0:i.unsubscribeDependents)==null||a.call(i,[{entity:this,field:"declaration"}]),(e=(p=(l=this.dataType)==null?void 0:l.entity)==null?void 0:p.unsubscribeDependents)==null||e.call(p,[{entity:this,field:"data-type-entity"}]),this}subscribeToDependencies(){var i,a,l,p,e;return(a=(i=this.declaration)==null?void 0:i.subscribeDependents)==null||a.call(i,[{entity:this,field:"declaration"}]),(e=(p=(l=this.dataType)==null?void 0:l.entity)==null?void 0:p.subscribeDependents)==null||e.call(p,[{entity:this,field:"data-type-entity"}]),this}increaseVersion(i){if(i&&!L(i).isValid())throw new Error(`The shared timestamp '${i}' is not a valid ISO 8601 date string.`);return i&&L(i).isSame(L(this.createdAt))?this:(this.previousVersion=this.version,this.version=N.UUID.uuid(),this.createdAt=L(i).toISOString()||L().toISOString(),this)}captureVersion(){var a;const i=((a=this.knownVersions)==null?void 0:a.get(this.version))||new St(this,this.project);return i.metaSync(this.toMeta(),null),this.knownVersions=this.knownVersions?this.knownVersions.set(this.version,i):new Map([[this.version,i]]),i.declaration=this.declaration,i.defaultValue=this.defaultValue,i.writesValues=[...this.writesValues],i.dataType=this.dataType,i.parent=this.parent,this}recursiveCaptureUpstreamVersions(i){const a=[],l=[],p=[],e=[];if(this.parent){this.parent.increaseVersion(i);const y=this.parent.recursiveCaptureUpstreamVersions(i);a.push(this.parent,...y.updated),l.push(...y.added),p.push(...y.removed)}return{updated:R(a),added:R(l),removed:R(p),affected:R(e),self:this}}async restoreVersion(i){var v;const a=[],l=[],p=[],e=[];if(this.version===i)return{updated:R(a),added:R(l),removed:R(p),affected:R(e),self:this};if(!this.knownVersions){const E=new Map;for(const[w,A]of this.knownVersions||new Map){if(E.set(w,A),A.activeVersion=!1,A.knownVersions)for(const[$,V]of A.knownVersions)E.set($,V);A.knownVersions=null}}let y=(v=this.knownVersions)==null?void 0:v.get(i);if(!y){const E=await this.APILoadVersion({},i);if(!E)throw new Error(`Version with id '${i}' for entity with id '${this.id}' not found.`);y=new St(E,this.project)}return this.metaSync(y.toShallowJSON(),null),this.previousVersion=y.previousVersion,this.version=y.version,this.createdAt=y.createdAt,this.author=y.author,this.deleted=y.deleted,this.declaration=y.declaration,this.defaultValue=y.defaultValue,this.writesValues=y.writesValues,this.dataType=y.dataType,this.parent=y.parent,{updated:R(a),added:R(l),removed:R(p),affected:R(e),self:this}}updateWithShallowTransfer(i,a=this.project.addChangeSet(new F(this.project,N.sessionAuthor,L().toISOString(),this,!0,"update-with-shallow-transfer"))){if(this.metaSync(i,a),this.version=i.version,this.createdAt=i.createdAt,this.author=i.author,this.deleted=i.deleted,this.previousVersion=i.previousVersion,this.unsubscribeFromDependencies(),i.parent){const l=Z(i.parent),p=this.project.get(l),e=this.parent;if(e&&e.id!==(p==null?void 0:p.id)&&this.removeFromParent(a),p)this.setParent(p,a);else throw a==null||a.attemptAutoclose("update-with-shallow-transfer",this.id),new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${l}' that isn't found in the project`)}else throw a==null||a.attemptAutoclose("update-with-shallow-transfer",this.id),new Error(`${this.type} with id '${this.id}' must have a 'parent'`);if(i.declaration){const l=Z(i.declaration),p=this.project.get(l);if(p)this.setDeclaration(p,a);else throw new Error(`${this.type} with id '${this.id}' has a 'declaration' reference '${l}' that isn't found in the project`)}else throw new Error(`${this.type} with id '${this.id}' must have a 'declaration'`);return this.captureVersion(),this.subscribeToDependencies(),a==null||a.attemptAutoclose("update-with-shallow-transfer",this.id),this}hydrateAncestors(){const i=[],a=[],l=[],p=[];if(this.initialData.parent){const e=Z(this.initialData.parent),y=this.project.get(e);if(y)this.setParent(y,null),i.push(y);else throw new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${e}' that isn't found in the project`)}else throw new Error(`${this.type} with id '${this.id}' must have a 'parent'`);if(this.initialData.declaration){const e=Z(this.initialData.declaration),y=this.project.get(e);if(y)this.setDeclaration(y,null),i.push(y);else throw new Error(`${this.type} with id '${this.id}' has a 'declaration' reference '${e}' that isn't found in the project`)}else throw new Error(`${this.type} with id '${this.id}' must have a 'declaration'`);return{updated:R(i),added:R(a),removed:R(l),affected:R(p),self:this}}afterAllChildrenInitialized(i=this.project.addChangeSet(new F(this.project,N.sessionAuthor,L().toISOString(),this,!0,"after-all-children-initialized"))){const a=[],l=[],p=[],e=[];return this.initialized=!0,this.captureVersion(),i==null||i.attemptAutoclose("after-all-children-initialized",this.id),{updated:R(a),added:R(l),removed:R(p),affected:R(e),self:this}}addSelfToProject(i=this.project.addChangeSet(new F(this.project,N.sessionAuthor,L().toISOString(),this,!0,"add-self-to-project"))){var y;const a=[this],l=[],p=[],e=[];return this.parentRelationType===Xl.Error?mt.includes(this.parent.type)||(this.parent.error=this):((y=this.declaration)==null?void 0:y.id)===Ee["value-descriptor"][Ql.ActionOngoingProcessOutputValue].id?this.parent.process=this:this.parent.addOutput(this,i),this.writesValues.forEach(v=>{v.setValueWriter(this,i),a.push(v)}),this.subscribe(),this.subscribeToDependencies(),i==null||i.attemptAutoclose("add-self-to-project",this.id),{updated:R(a),added:R(l),removed:R(p),affected:R(e),self:this}}addValueReader(i,a=this.project.addChangeSet(new F(this.project,N.sessionAuthor,L().toISOString(),this,!0,"add-value-reader"))){return this.writesValues.includes(i)?(a==null||a.attemptAutoclose("add-value-reader",this.id),this):(this.writesValues.push(i),a==null||a.add(this,S.Affected),this)}removeValueReader(i,a=this.project.addChangeSet(new F(this.project,N.sessionAuthor,L().toISOString(),this,!0,"remove-value-reader"))){return this.writesValues.includes(i)?(this.writesValues=this.writesValues.filter(l=>l.id!==i.id),a==null||a.add(this,S.Affected),this):(a==null||a.attemptAutoclose("remove-value-reader",this.id),this)}setParent(i,a=this.project.addChangeSet(new F(this.project,N.sessionAuthor,L().toISOString(),this,!0,"set-parent"))){var l;return((l=this.parent)==null?void 0:l.id)!==(i==null?void 0:i.id)&&(this.parent=i,a&&(a==null||a.add(this,S.Updated))),a==null||a.attemptAutoclose("set-parent",this.id),this}setDataType(i,a=this.project.addChangeSet(new F(this.project,N.sessionAuthor,L().toISOString(),this,!0,"set-data-type"))){const l=this.dataType;return(l==null?void 0:l.id)!==(i==null?void 0:i.id)&&(l==null||l.remove({ignoreUpstream:!0},a),this.dataType=i,this.subscribeToDependencies(),a==null||a.add(this,S.Affected)),a==null||a.attemptAutoclose("set-data-type",this.id),this}removeDataType(){return this.dataType=null,this}setDeclaration(i,a=this.project.addChangeSet(new F(this.project,N.sessionAuthor,L().toISOString(),this,!0,"set-declaration"))){var l;return((l=this.declaration)==null?void 0:l.id)!==(i==null?void 0:i.id)&&(this.declaration=i,a&&(a==null||a.add(this,S.Updated))),a==null||a.attemptAutoclose("set-declaration",this.id),this}initChildren(i=this.project.addChangeSet(new F(this.project,N.sessionAuthor,L().toISOString(),this,!0,"init-children"))){return this.initialized||this.startedInitialization?this:(this.startedInitialization=!0,this.initialData.defaultValue&&(this.defaultValue=te(this.initialData.defaultValue,this.project),this.defaultValue.setParent(this,null),this.defaultValue.initChildren(i)),df.initWritesValues(this,this.parent.parent),this.initialData.declaration&&(this.declaration=te(this.initialData.declaration,this.project)),this.subscribeToDependencies(),this.afterAllChildrenInitialized(i),i==null||i.attemptAutoclose("init-children",this.id),this)}subscribe(){return this.activeVersion=!0,this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}metaSync(i,a=this.project.addChangeSet(new F(this.project,N.sessionAuthor,L().toISOString(),this,!0,"meta-sync"))){const l=Ur(this,i),p=this.toMeta();return this.index=i.index||(i.index!==0?p.index:0),this.parentRelationType=i.parentRelationType!==void 0?i.parentRelationType:this.parentRelationType,super.metaSync(i),i.deleted===!0&&!p.deleted?a==null||a.add(this,S.Removed):i.deleted===!1&&p.deleted?a==null||a.add(this,S.Added):l&&(a==null||a.add(this,S.Updated)),a==null||a.attemptAutoclose("meta-sync",this.id),this}async APILoad(i=ve,...a){return await St.repository.APILoad(this.id,...a),this}async APICreate(i=ve,...a){return await St.repository.APICreate(this.toShallowJSON(),...a),this}async APIUpdate(i=ve,...a){return await St.repository.APIUpdate(this.toShallowJSON(),...a),this}async APIDelete(i=ve,...a){return await St.repository.APIDelete(this.toShallowJSON(),...a),this}async APIClone(i=ve,...a){return await St.repository.APIClone(this.id,...a),this}async APILoadVersion(i=ve,a,...l){return await St.repository.APILoadVersion(this.id,a,...l)}removeFromParent(i=this.project.addChangeSet(new F(this.project,N.sessionAuthor,L().toISOString(),this,!0,"remove-from-parent"))){const a=[],l=[],p=[],e=[];return i==null||i.attemptAutoclose("remove-from-parent",this.id),{added:R(p),updated:R(a),removed:R(l),affected:R(e),self:this}}remove({ignoreUpstream:i}={ignoreUpstream:!1},a=this.project.addChangeSet(new F(this.project,N.sessionAuthor,L().toISOString(),this,!0,"remove-entity"))){const l=[],p=[],e=[],y=[];if(a!=null&&a.hasRemoved(this.id))return a==null||a.attemptAutoclose("remove-entity",this.id),{added:[],updated:[],removed:[],affected:[],self:this};if(p.push(this),this.unsubscribe(),this.unsubscribeFromDependencies(),this.project.subscribeDeletedInstance(this),this.metaSync({deleted:!0},a),Object.values(this.detachedDependents).forEach(v=>{const{updated:E,removed:w,added:A}=v.entity.onDetachedDependencyRemoved(this,v.field,a);l.push(...E),p.push(...w),e.push(...A)}),this.defaultValue){const{updated:v,removed:E}=this.defaultValue.remove({ignoreUpstream:!0},a);l.push(...v),p.push(...E)}if(this.writesValues.forEach(v=>{l.push(v),v.readsValue=null}),!i){const v=this.removeFromParent(a);e.push(...v.added),l.push(...v.updated),p.push(...v.removed),y.push(...v.affected),y.push(this.parent),this.parentRelationType===Xl.Error?mt.includes(this.parent.type)||(this.parent.error=null):this.parent.removeOutput(this,a)}return a==null||a.attemptAutoclose("remove-entity",this.id),{added:R(e),updated:R(l),removed:R(p),affected:R(y),self:this}}restore({}={},i=this.project.addChangeSet(new F(this.project,N.sessionAuthor,L().toISOString(),this,!0,"restore-entity"))){const a=[],l=[],p=[],e=[];if(i!=null&&i.hasAdded(this.id))return i==null||i.attemptAutoclose("restore-entity",this.id),{added:[],updated:[],removed:[],affected:[],self:this};if(this.subscribe(),this.project.unsubscribeDeletedInstance(this),this.metaSync({deleted:!1},i),Object.values(this.detachedDependents).forEach(y=>{const{updated:v,removed:E,added:w}=y.entity.onDetachedDependencyRestored(this,y.field,i);l.push(...v),p.push(...E),a.push(...w)}),this.defaultValue){const{updated:y}=this.defaultValue.restore({},i);l.push(...y)}return this.writesValues.forEach(y=>{l.push(y),y.setValueWriter(this,i)}),e.push(this.parent),this.parentRelationType===Xl.Error?mt.includes(this.parent.type)||(this.parent.error=this):this.parent.addOutput(this,i),i==null||i.attemptAutoclose("restore-entity",this.id),{added:R(a),updated:R(l),removed:R(p),affected:R(e),self:this}}toFlat(i=new Set){var l,p;return i.has(this.id)?[]:(i.add(this.id),[this,...((l=this.defaultValue)==null?void 0:l.toFlat(i))||[],...((p=this.dataType)==null?void 0:p.toFlat(i))||[],...this.writesValues.flatMap(e=>e.toFlat(i)),...this.declaration?this.declaration.toFlat(i):[]])}toFlatIds(i=new Set){var l,p;return i.has(this.id)?[]:(i.add(this.id),[this.id,...((l=this.defaultValue)==null?void 0:l.toFlatIds(i))||[],...((p=this.dataType)==null?void 0:p.toFlatIds(i))||[],...this.writesValues.flatMap(e=>e.toFlatIds(i)),...this.declaration?this.declaration.toFlatIds(i):[]])}toMeta(){return{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,index:this.index,type:this.type}}toJSON(i=new Set){var a,l;return i.has(this.id)?this.toReference():(i.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,parentRelationType:this.parentRelationType,defaultValue:((a=this.defaultValue)==null?void 0:a.toJSON(i))||null,writesValues:this.writesValues.map(p=>p.toJSON(i)),declaration:((l=this.declaration)==null?void 0:l.toJSON(i))||null,parent:this.parent.toReference()})}toJSONClone(i=ke){var l,p,e,y,v,E,w,A,$,V;let a;return(l=i.seenEntityMaps)!=null&&l.has(this.id)?a=i.seenEntityMaps.get(this.id):(a=i.newId||Gr(this,this.project,i.uuidStrategy),i.seenEntityMaps&&i.seenEntityMaps.set(this.id,a)),(p=i.seenEntities)!=null&&p.has(a)||(e=i.seenEntities)!=null&&e.has(this.id)?this.toReference({seenEntityMaps:i.seenEntityMaps}):((y=i.seenEntities)==null||y.add(a),(v=i.seenEntities)==null||v.add(this.id),{id:a,version:N.UUID.uuid(),createdAt:i.timestamp||L().toISOString(),previousVersion:null,author:this.author,deleted:this.deleted,type:this.type,index:this.index,parentRelationType:this.parentRelationType,defaultValue:((E=this.defaultValue)==null?void 0:E.toJSONClone({...i,newId:null}))||null,writesValues:this.writesValues.map(U=>U.toJSONClone({...i,newId:null})),declaration:(w=this.declaration)!=null&&w.id&&this.project.getBuiltIn((A=this.declaration)==null?void 0:A.id)?($=this.declaration)==null?void 0:$.toJSON(i.seenEntities):((V=this.declaration)==null?void 0:V.toJSONClone({...i,newId:null}))||null,parent:this.parent.toReference({seenEntityMaps:i.seenEntityMaps})})}toReference(i=ke){var l;let a=this.id;return(l=i.seenEntityMaps)!=null&&l.has(this.id)&&(a=i.seenEntityMaps.get(this.id)),{id:a+"--"+N.UUID.uuid()+"--ref",type:f.GenericReference,entityId:a,version:this.version,entityType:this.type}}toShallowJSON(i=ke){var l,p,e;let a=this.id;return(l=i.seenEntityMaps)!=null&&l.has(this.id)&&(a=i.seenEntityMaps.get(this.id)),{id:a,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,index:this.index,parentRelationType:this.parentRelationType,defaultValue:((p=this.defaultValue)==null?void 0:p.toReference(i))||null,declaration:(e=this.declaration)==null?void 0:e.toReference(i),writesValues:this.writesValues.map(y=>y.toReference(i)),parent:this.parent.toReference(i)}}toFlatJSON(i=new Set){var l,p;return i.has(this.id)?[]:(i.add(this.id),[this.toShallowJSON(),...((l=this.defaultValue)==null?void 0:l.toFlatJSON(i))||[],...((p=this.dataType)==null?void 0:p.toFlatJSON(i))||[],...this.writesValues.flatMap(e=>e.toFlatJSON(i)),...this.declaration?this.declaration.toFlatJSON(i):[]])}toGenerationTarget(){var i;return{id:this.id,type:this.type,declaration:((i=this.declaration)==null?void 0:i.id)||null,parent:this.parent.id}}toFlatGenerationTarget(i=new Set){var l,p;return i.has(this.id)?[]:(i.add(this.id),[this.toGenerationTarget(),...((l=this.defaultValue)==null?void 0:l.toFlatGenerationTarget(i))||[],...((p=this.dataType)==null?void 0:p.toFlatGenerationTarget(i))||[],...this.writesValues.flatMap(e=>e.toFlatGenerationTarget(i)),...this.declaration?this.declaration.toFlatGenerationTarget(i):[]])}clearErrors(){var i;return this.errors=[],(i=this.defaultValue)==null||i.clearErrors(),this}validate(){const i=EF(this);return this.errors=i,{success:!0,error:null,data:this.toJSON()}}getErrors(){var a;return[...this.errors,...((a=this.defaultValue)==null?void 0:a.getErrors())||[]]}getShallowErrors(){return this.errors}getDefaultValue(){var i;return this.defaultValue||((i=this.declaration)==null?void 0:i.defaultValue)||null}setDefaultValue(i,a=this.project.addChangeSet(new F(this.project,N.sessionAuthor,L().toISOString(),this,!0,"set-default-value"))){const l=this.defaultValue;return(l==null?void 0:l.id)!==(i==null?void 0:i.id)&&(l==null||l.remove({ignoreUpstream:!0},a),this.defaultValue=i,a==null||a.add(this,S.Affected)),a==null||a.attemptAutoclose("set-default-value",this.id),this}clone(i=this.project.addChangeSet(new F(this.project,N.sessionAuthor,L().toISOString(),this,!0,"clone-entity")),a=null,l=null,p=!0){var $,V;let e=Fr(a,this);const y=this.toJSON(),v=l||N.UUID.uuid();y.id=v;const E=or(y,e);a?E.setParent(a,null):E.setParent(this.parent,null),p&&E.subscribe(),E.initChildren(i),i==null||i.add(E,S.Added);const w=($=this.dataType)==null?void 0:$.clone(i,E,N.UUID.uuid(),p);E.setDataType(w||null,i);const A=(V=this.defaultValue)==null?void 0:V.clone(i,E,N.UUID.uuid(),p);return E.defaultValue=A||null,i==null||i.attemptAutoclose("clone-entity",this.id),E}getDataType(i=this.project.addChangeSet(new F(this.project,N.sessionAuthor,L().toISOString(),this,!0,"get-data-type"))){var l;return this.parent.type===f.Operation?this.parent.declaration.inferOutputMapDataType(this,i).self:((l=this.declaration)==null?void 0:l.getDataType(i))||null}};g(St,"repository",{APICreate:async(i,...a)=>i,APIUpdate:async(i,...a)=>i,APIDelete:async(i,...a)=>i,APIClone:async(i,...a)=>{},APILoad:async(i,...a)=>null,APILoadVersion:async(i,a,...l)=>null}),g(St,"type",f.OutputMap),g(St,"USER_MANAGED_PARENT_TYPES",[...vg]),g(St,"PARENT_TYPES",[...St.USER_MANAGED_PARENT_TYPES]),g(St,"MUTABLE_BASE_PROPERTIES",[]),g(St,"INMUTABLE_BASE_PROPERTIES",["id","type","version","createdAt","author","previousVersion"]),g(St,"BASE_PROPERTIES",[...St.MUTABLE_BASE_PROPERTIES,...St.INMUTABLE_BASE_PROPERTIES]),g(St,"MUTABLE_META_PROPERTIES",[...St.MUTABLE_BASE_PROPERTIES,"index"]),g(St,"INMUTABLE_META_PROPERTIES",[...St.INMUTABLE_BASE_PROPERTIES]),g(St,"META_PROPERTIES",[...St.MUTABLE_META_PROPERTIES,...St.INMUTABLE_META_PROPERTIES]),g(St,"MUTABLE_UPSTREAM_PROPERTIES",[]),g(St,"INMUTABLE_UPSTREAM_PROPERTIES",["parent","declaration"]),g(St,"UPSTREAM_PROPERTIES",[...St.MUTABLE_UPSTREAM_PROPERTIES,...St.INMUTABLE_UPSTREAM_PROPERTIES]),g(St,"MUTABLE_DOWNSTREAM_PROPERTIES",["writesValues"]),g(St,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),g(St,"DOWNSTREAM_PROPERTIES",[...St.MUTABLE_DOWNSTREAM_PROPERTIES,...St.INMUTABLE_DOWNSTREAM_PROPERTIES]),g(St,"PROPERTIES",[...St.META_PROPERTIES,...St.UPSTREAM_PROPERTIES,...St.DOWNSTREAM_PROPERTIES]);let mn=St;class Xve extends mn{constructor(i,a){super(i,a);g(this,"declaration");g(this,"parent");g(this,"errors",[])}toJSON(i=new Set){return super.toJSON(i)}}class Qve extends mn{constructor(i,a){super(i,a);g(this,"declaration");g(this,"parent");g(this,"errors",[])}toJSON(i=new Set){return super.toJSON(i)}}function IF(d){const u=HI(),i=d.toJSON();u.safeParse(i).success;const l=[];return vr(d.errors,l)}const eEe=Object.freeze(Object.defineProperty({__proto__:null,validate:IF},Symbol.toStringTag,{value:"Module"}));function tEe(d,u){var a,l;const i=[];if(d.parent)if(d.parent){const p=u.get(d.parent);p?[f.InputMap,f.DataType].includes(p.type)?p.type===f.DataType&&p.entity?i.push(new ee({id:`${d.id}--${d.parent}--${k.NewEntityWouldOverriteExisting}`,code:k.NewEntityWouldOverriteExisting,severity:q.Error,message:`Entity of type "${d.type}" with id "${d.id}", has a 'parent' of type 'data-type' which already has an existing default value entity with id "${p.entity.id}".
162
162
  Data types can only have one 'literal-value' entity as 'entity'.
163
163
  You can update the existing 'literal-value' with the 'update' action, for example, like so:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elyx-code/project-logic-tree",
3
- "version": "0.0.6408",
3
+ "version": "0.0.6409",
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",