@elyx-code/project-logic-tree 0.0.6330 → 0.0.6331
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 +1 -1
- package/dist/index.umd.cjs +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -84157,7 +84157,7 @@ The 'id' has been changed to "${m}".`,
|
|
|
84157
84157
|
}
|
|
84158
84158
|
if (n = {
|
|
84159
84159
|
...u,
|
|
84160
|
-
id: n.id
|
|
84160
|
+
id: (n == null ? void 0 : n.id) || u.id || ""
|
|
84161
84161
|
}, !u.type)
|
|
84162
84162
|
return {
|
|
84163
84163
|
errors: [
|
package/dist/index.umd.cjs
CHANGED
|
@@ -200,7 +200,7 @@ An action descriptor can only have one error value descriptor child.
|
|
|
200
200
|
Either remove the existing error value descriptor or update it with the 'update' action.
|
|
201
201
|
You can use the 'describe_entity' action to get more information about the existing error value descriptor like so:
|
|
202
202
|
${vn({describe_entity:m.error.id})}`,issue:null}))),{errors:p,modifiedData:l}}validateGeneratedUpdate(n){return{errors:[],modifiedData:n}}subscribeDependents(n){return n.forEach(a=>{this.detachedDependents[a.entity.id]||(this.detachedDependents[a.entity.id]=a)}),this}unsubscribeDependents(n){return n.forEach(a=>{this.detachedDependents[a.entity.id]&&delete this.detachedDependents[a.entity.id]}),this}syncDependents(n=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),this,!0,"sync-dependents"))){const a=[],l=[],p=[],t=[];return Object.values(this.detachedDependents).forEach(m=>{const v=m.entity.afterAllChildrenInitialized(n);a.push(...v.updated),l.push(...v.added),p.push(...v.removed),t.push(...v.affected)}),n==null||n.attemptAutoclose("sync-dependents",this.id),{updated:w(a),added:w(l),removed:w(p),affected:w(t),self:this}}onDetachedDependencyRemoved(n,a,l){const p=[],t=[],m=[],v=[];return{updated:w(p),added:w(t),removed:w(m),affected:w(v),self:this}}onDetachedDependencyRestored(n,a,l){const p=[],t=[],m=[],v=[];return{updated:w(p),added:w(t),removed:w(m),affected:w(v),self:this}}unsubscribeFromDependencies(){var n,a,l;return(l=(a=(n=this.dataType)==null?void 0:n.entity)==null?void 0:a.unsubscribeDependents)==null||l.call(a,[{entity:this,field:"data-type-entity"}]),this}subscribeToDependencies(){var n,a,l;return(l=(a=(n=this.dataType)==null?void 0:n.entity)==null?void 0:a.subscribeDependents)==null||l.call(a,[{entity:this,field:"data-type-entity"}]),this}increaseVersion(n){if(n&&!N(n).isValid())throw new Error(`The shared timestamp '${n}' is not a valid ISO 8601 date string.`);return n&&N(n).isSame(N(this.createdAt))?this:(this.previousVersion=this.version,this.version=P.UUID.uuid(),this.createdAt=N(n).toISOString()||N().toISOString(),this)}captureVersion(){var a;const n=((a=this.knownVersions)==null?void 0:a.get(this.version))||new Rt(this,this.project);return n.metaSync(this.toMeta(),null),this.knownVersions=this.knownVersions?this.knownVersions.set(this.version,n):new Map([[this.version,n]]),n.defaultValue=this.defaultValue,n.dataType=this.dataType,n.parent=this.parent,this}recursiveCaptureUpstreamVersions(n){const a=[],l=[],p=[],t=[];if(this.parent){this.parent.increaseVersion(n);const m=this.parent.recursiveCaptureUpstreamVersions(n);a.push(this.parent,...m.updated),l.push(...m.added),p.push(...m.removed)}return{updated:w(a),added:w(l),removed:w(p),affected:w(t),self:this}}async restoreVersion(n){var v;const a=[],l=[],p=[],t=[];if(this.version===n)return{updated:w(a),added:w(l),removed:w(p),affected:w(t),self:this};if(!this.knownVersions){const b=new Map;for(const[_,I]of this.knownVersions||new Map){if(b.set(_,I),I.activeVersion=!1,I.knownVersions)for(const[V,B]of I.knownVersions)b.set(V,B);I.knownVersions=null}}let m=(v=this.knownVersions)==null?void 0:v.get(n);if(!m){const b=await this.APILoadVersion({},n);if(!b)throw new Error(`Version with id '${n}' for entity with id '${this.id}' not found.`);m=new Rt(b,this.project)}return this.metaSync(m.toShallowJSON(),null),this.previousVersion=m.previousVersion,this.version=m.version,this.createdAt=m.createdAt,this.author=m.author,this.deleted=m.deleted,this.defaultValue=m.defaultValue,this.dataType=m.dataType,this.parent=m.parent,{updated:w(a),added:w(l),removed:w(p),affected:w(t),self:this}}updateWithShallowTransfer(n,a=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),this,!0,"update-with-shallow-transfer"))){if(this.metaSync(n,a),this.version=n.version,this.createdAt=n.createdAt,this.author=n.author,this.deleted=n.deleted,this.previousVersion=n.previousVersion,this.unsubscribeFromDependencies(),n.parent){const l=W(n.parent),p=this.project.get(l),t=this.parent;if(t&&t.id!==(p==null?void 0:p.id)&&(this.removeFromParent(a),this.parent=null),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'`);return this.captureVersion(),this.subscribeToDependencies(),a==null||a.attemptAutoclose("update-with-shallow-transfer",this.id),this}hydrateAncestors(){const n=[],a=[],l=[],p=[];if(this.initialData.parent){const t=W(this.initialData.parent),m=this.project.get(t);if(m)this.setParent(m,null),n.push(m);else throw new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${t}' that isn't found in the project`)}else throw new Error(`${this.type} with id '${this.id}' must have a 'parent'`);return{updated:w(n),added:w(a),removed:w(l),affected:w(p),self:this}}afterAllChildrenInitialized(n=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),this,!0,"after-all-children-initialized"))){const a=[],l=[],p=[],t=[];return this.initialized=!0,this.captureVersion(),n==null||n.attemptAutoclose("after-all-children-initialized",this.id),{updated:w(a),added:w(l),removed:w(p),affected:w(t),self:this}}addSelfToProject(n=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),this,!0,"add-self-to-project"))){var m,v,b,_,I,V,B,K;const a=[this],l=[],p=[],t=[];return this.parentRelationType===ie.FixedArguments||this.parentRelationType===ie.DynamicArgument?((m=this.parent)==null?void 0:m.type)===f.Search||((v=this.parent)==null?void 0:v.type)===f.Loop?(this.parent.addInputDeclaration(this,n),t.push(this.parent)):((_=(b=this.parent)==null?void 0:b.addInput)==null||_.call(b,this,n),a.push(this.parent)):this.parentRelationType===ie.FixedReturns||this.parentRelationType===ie.DynamicReturn?((I=this.parent)==null?void 0:I.type)===f.Search||((V=this.parent)==null?void 0:V.type)===f.Loop?(this.parent.addOutputDeclaration(this,n),t.push(this.parent)):((K=(B=this.parent)==null?void 0:B.addOutput)==null||K.call(B,this,n),a.push(this.parent)):this.parentRelationType===ie.ReturnedError&&this.parent&&(this.parent.error=this,t.push(this.parent)),this.subscribe(),this.subscribeToDependencies(),n==null||n.attemptAutoclose("add-self-to-project",this.id),{updated:w(a),added:w(l),removed:w(p),affected:w(t),self:this}}setParent(n,a=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),this,!0,"set-parent"))){var l;return((l=this.parent)==null?void 0:l.id)!==(n==null?void 0:n.id)&&(this.parent=n,a&&(a==null||a.add(this,G.Updated))),a==null||a.attemptAutoclose("set-parent",this.id),this}initChildren(n=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),this,!0,"init-children"))){return this.initialized||this.startedInitialization?this:(this.startedInitialization=!0,this.initialData.defaultValue&&(this.defaultValue=z(this.initialData.defaultValue,this.project),this.defaultValue.setParent(this,null),this.defaultValue.initChildren(n)),this.initialData.dataType&&(this.dataType=z(this.initialData.dataType,this.project),this.dataType.setParent(this,null),this.dataType.initChildren(n)),this.subscribeToDependencies(),this.afterAllChildrenInitialized(n),n==null||n.attemptAutoclose("init-children",this.id),this)}subscribe(){return this.activeVersion=!0,this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}metaSync(n,a=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),this,!0,"meta-sync"))){const l=cr(this,n),p=this.toMeta();return this.name=n.name!==void 0?n.name:p.name,this.description=n.description!==void 0?n.description:p.description,this.index=n.index||(n.index!==0?p.index:0),this.required=n.required!==void 0?n.required:this.required,this.parentRelationType=n.parentRelationType!==void 0?n.parentRelationType:this.parentRelationType,super.metaSync(n),n.deleted===!0&&!p.deleted?a==null||a.add(this,G.Removed):n.deleted===!1&&p.deleted?a==null||a.add(this,G.Added):l&&(a==null||a.add(this,G.Updated)),a==null||a.attemptAutoclose("meta-sync",this.id),this}async APILoad(n=oe,...a){return await Rt.repository.APILoad(this.id,...a),this}async APICreate(n=oe,...a){return await Rt.repository.APICreate(this.toShallowJSON(),...a),this}async APIUpdate(n=oe,...a){return await Rt.repository.APIUpdate(this.toShallowJSON(),...a),this}async APIDelete(n=oe,...a){return await Rt.repository.APIDelete(this.toShallowJSON(),...a),this}async APIClone(n=oe,...a){return await Rt.repository.APIClone(this.id,...a),this}async APILoadVersion(n=oe,a,...l){return await Rt.repository.APILoadVersion(this.id,a,...l)}removeFromParent(n=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),this,!0,"remove-from-parent"))){var m,v,b,_,I,V,B;const a=[],l=[],p=[],t=[];return this.parent&&(((m=this.parent)==null?void 0:m.type)===f.Search?this.parentRelationType===ie.FixedReturns||this.parentRelationType===ie.DynamicReturn?((v=this.parent)==null||v.removeOutputDeclaration(this,n),t.push(this.parent)):this.parentRelationType===ie.FixedArguments||this.parentRelationType===ie.DynamicArgument?((b=this.parent)==null||b.removeInputDeclaration(this,n),t.push(this.parent)):this.parentRelationType===ie.ReturnedError&&(this.parent.error=null,t.push(this.parent)):((_=this.parent)==null?void 0:_.type)===f.Loop?this.parentRelationType===ie.FixedReturns||this.parentRelationType===ie.DynamicReturn?((I=this.parent)==null||I.removeOutputDeclaration(this,n),t.push(this.parent)):this.parentRelationType===ie.ReturnedError&&(this.parent.error=null,t.push(this.parent)):this.parentRelationType===ie.FixedReturns||this.parentRelationType===ie.DynamicReturn?((V=this.parent)==null||V.removeOutput(this,n),t.push(this.parent)):(this.parentRelationType===ie.FixedArguments||this.parentRelationType===ie.DynamicArgument)&&((B=this.parent)==null||B.removeInput(this,n),t.push(this.parent))),n==null||n.attemptAutoclose("remove-from-parent",this.id),{added:w(p),updated:w(a),removed:w(l),affected:w(t),self:this}}remove({ignoreUpstream:n}={ignoreUpstream:!1},a=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),this,!0,"remove-entity"))){const l=[],p=[],t=[],m=[];if(Array.from(new Set([...bs(),...this.project.getAllBuiltInIds()])).includes(this.id))return a==null||a.attemptAutoclose("remove-entity",this.id),{added:[],updated:[],removed:[],affected:[],self:this};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(b=>{const{updated:_,removed:I,added:V}=b.entity.onDetachedDependencyRemoved(this,b.field,a);l.push(..._),p.push(...I),t.push(...V)}),this.defaultValue){const{updated:b,removed:_}=this.defaultValue.remove({ignoreUpstream:!0},a);l.push(...b),p.push(..._)}if(this.dataType){const{updated:b,removed:_}=this.dataType.remove({ignoreUpstream:!0},a);l.push(...b),p.push(..._)}if(!n){const b=this.removeFromParent(a);t.push(...b.added),l.push(...b.updated),p.push(...b.removed),m.push(...b.affected)}return a==null||a.attemptAutoclose("remove-entity",this.id),{added:w(t),updated:w(l),removed:w(p),affected:w(m),self:this}}restore({}={},n=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),this,!0,"restore-entity"))){var m,v,b,_,I,V,B;const a=[],l=[],p=[],t=[];if(n!=null&&n.hasAdded(this.id))return n==null||n.attemptAutoclose("restore-entity",this.id),{added:[],updated:[],removed:[],affected:[],self:this};if(this.subscribe(),this.project.unsubscribeDeletedInstance(this),this.metaSync({deleted:!1},n),Object.values(this.detachedDependents).forEach(K=>{const{updated:q,removed:Z,added:te}=K.entity.onDetachedDependencyRestored(this,K.field,n);l.push(...q),p.push(...Z),a.push(...te)}),this.defaultValue){const{updated:K}=this.defaultValue.restore({},n);l.push(...K)}if(this.dataType){const{updated:K}=this.dataType.restore({},n);l.push(...K)}return((m=this.parent)==null?void 0:m.type)===f.Search?this.parentRelationType===ie.FixedReturns||this.parentRelationType===ie.DynamicReturn?(v=this.parent)==null||v.addOutputDeclaration(this,n):(this.parentRelationType===ie.FixedArguments||this.parentRelationType===ie.DynamicArgument)&&((b=this.parent)==null||b.addInputDeclaration(this,n)):((_=this.parent)==null?void 0:_.type)===f.Loop?(this.parentRelationType===ie.FixedReturns||this.parentRelationType===ie.DynamicReturn)&&((I=this.parent)==null||I.addOutputDeclaration(this,n)):this.parentRelationType===ie.FixedReturns||this.parentRelationType===ie.DynamicReturn?(V=this.parent)==null||V.addOutput(this,n):(this.parentRelationType===ie.FixedArguments||this.parentRelationType===ie.DynamicArgument)&&((B=this.parent)==null||B.addInput(this,n)),n==null||n.attemptAutoclose("restore-entity",this.id),{added:w(a),updated:w(l),removed:w(p),affected:w(t),self:this}}toFlat(n=new Set){var l;return n.has(this.id)?[]:(n.add(this.id),[this,...((l=this.defaultValue)==null?void 0:l.toFlat(n))||[],...this.dataType?this.dataType.toFlat(n):[]])}toFlatIds(n=new Set){var l;return n.has(this.id)?[]:(n.add(this.id),[this.id,...((l=this.defaultValue)==null?void 0:l.toFlatIds(n))||[],...this.dataType?this.dataType.toFlatIds(n):[]])}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,required:this.required,parentRelationType:this.parentRelationType,type:this.type,name:this.name}}toJSON(n=new Set){var a,l,p;return n.has(this.id)?this.toReference():(n.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,description:this.description,index:this.index,required:this.required,defaultValue:((a=this.defaultValue)==null?void 0:a.toJSON(n))||null,parentRelationType:this.parentRelationType,dataType:((l=this.dataType)==null?void 0:l.toJSON(n))||null,parent:((p=this.parent)==null?void 0:p.toReference())||null})}toJSONClone(n=Ce){var l,p,t,m,v,b,_,I;let a;return(l=n.seenEntityMaps)!=null&&l.has(this.id)?a=n.seenEntityMaps.get(this.id):(a=n.newId||hr(this,this.project,n.uuidStrategy),n.seenEntityMaps&&n.seenEntityMaps.set(this.id,a)),(p=n.seenEntities)!=null&&p.has(a)||(t=n.seenEntities)!=null&&t.has(this.id)?this.toReference({seenEntityMaps:n.seenEntityMaps}):((m=n.seenEntities)==null||m.add(a),(v=n.seenEntities)==null||v.add(this.id),{id:a,version:P.UUID.uuid(),createdAt:n.timestamp||N().toISOString(),author:P.sessionAuthor,previousVersion:null,deleted:!1,type:this.type,name:this.name,description:this.description,index:this.index,required:this.required,defaultValue:((b=this.defaultValue)==null?void 0:b.toJSONClone({...n,newId:null}))||null,parentRelationType:this.parentRelationType,dataType:((_=this.dataType)==null?void 0:_.toJSONClone({...n,newId:null}))||null,parent:((I=this.parent)==null?void 0:I.toReference({seenEntityMaps:n.seenEntityMaps}))||null})}toReference(n=Ce){var l;let a=this.id;return(l=n.seenEntityMaps)!=null&&l.has(this.id)&&(a=n.seenEntityMaps.get(this.id)),{id:a+"--"+P.UUID.uuid()+"--ref",type:f.GenericReference,entityId:a,version:this.version,entityType:this.type}}toShallowJSON(n=Ce){var l,p,t,m;let a=this.id;return(l=n.seenEntityMaps)!=null&&l.has(this.id)&&(a=n.seenEntityMaps.get(this.id)),{id:a,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,required:this.required,parentRelationType:this.parentRelationType,defaultValue:((p=this.defaultValue)==null?void 0:p.toReference(n))||null,dataType:((t=this.dataType)==null?void 0:t.toReference(n))||null,parent:((m=this.parent)==null?void 0:m.toReference(n))||null}}toFlatJSON(n=new Set){var l;return n.has(this.id)?[]:(n.add(this.id),[this.toShallowJSON(),...((l=this.defaultValue)==null?void 0:l.toFlatJSON(n))||[],...this.dataType?this.dataType.toFlatJSON(n):[]])}toGenerationTarget(){var n;return{id:this.id,name:this.name,description:this.description,type:this.type,required:this.required,parentRelationType:this.parentRelationType,parent:(n=this.parent)==null?void 0:n.id}}toFlatGenerationTarget(n=new Set){return n.has(this.id)?[]:(n.add(this.id),[this.toGenerationTarget(),...this.defaultValue?this.defaultValue.toFlatGenerationTarget(n):[],...this.dataType?this.dataType.toFlatGenerationTarget(n):[]])}clearErrors(){var n,a;return this.errors=[],(n=this.defaultValue)==null||n.clearErrors(),(a=this.dataType)==null||a.clearErrors(),this}validate(){const n=J3(this);return this.errors=n,{success:!0,error:null,data:this.toJSON()}}getErrors(){return[...this.errors,...this.dataType?this.dataType.getErrors():[]]}getShallowErrors(){return this.errors}clone(n=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),this,!0,"clone-entity")),a=null,l=null,p=!0){var B,K;if(Array.from(new Set([...bs(),...this.project.getAllBuiltInIds()])).includes(this.id))return this;let m=yr(a,this);const v=l||P.UUID.uuid(),b=this.toJSON();b.id=v,b.version=P.UUID.uuid(),b.createdAt=(n==null?void 0:n.timestamp)||N().toISOString(),b.author=(n==null?void 0:n.author)||"1",b.previousVersion=null,b.deleted=!1;const _=er(b,m);a&&_.setParent(a,null),n==null||n.add(_,G.Added),p&&_.subscribe();const I=((B=this.dataType)==null?void 0:B.clone(n,_,P.UUID.uuid(),p))||null;I&&_.setDataType(I,n);const V=(K=this.defaultValue)==null?void 0:K.clone(n,_,P.UUID.uuid(),p);return _.defaultValue=V||null,n==null||n.attemptAutoclose("clone-entity",this.id),_}getDataType(n=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),this,!0,"get-data-type"))){return n==null||n.attemptAutoclose("get-data-type",this.id),this.dataType||null}setDataType(n,a=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),this,!0,"set-data-type"))){const l=this.dataType;return(l==null?void 0:l.id)!==(n==null?void 0:n.id)&&(l==null||l.remove({ignoreUpstream:!0},a),this.dataType=n,this.subscribeToDependencies(),a==null||a.add(this,G.Affected)),a==null||a.attemptAutoclose("set-data-type",this.id),this}getDefaultValue(){return this.defaultValue||null}setDefaultValue(n,a=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),this,!0,"set-default-value"))){const l=this.defaultValue;return(l==null?void 0:l.id)!==(n==null?void 0:n.id)&&(l==null||l.remove({ignoreUpstream:!0},a),this.defaultValue=n,a==null||a.add(this,G.Affected)),a==null||a.attemptAutoclose("set-default-value",this.id),this}removeDataType(){return this.dataType=null,this}implementAsReturnDeclaration(n=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),this,!0,"implement-as-return-declaration")),a,l){const p=wi.new(n);p.id=l||p.id,p.name=this.name,p.description=this.description,p.parent=a.toReference(),p.implements=this.toJSON(),p.isError=this.parentRelationType===ie.ReturnedError;const t=er(p,this.project);if(t.hydrateAncestors(),t.addSelfToProject(n),n==null||n.add(t,G.Added),t.initChildren(n),this.dataType){const m=this.dataType.clone(n,t);t.setDataType(m,n)}if(this.defaultValue){const m=this.defaultValue.clone(n,t);t.setDefaultValue(m,n)}return n==null||n.attemptAutoclose("implement-as-return-declaration",this.id),t}implementAsArgumentDeclaration(n=this.project.addChangeSet(new F(this.project,P.sessionAuthor,N().toISOString(),this,!0,"implement-as-return-declaration")),a,l){const p=ea.new(n);p.id=l||p.id,p.name=this.name,p.description=this.description,p.parent=a.toReference(),p.implements=this.toJSON();const t=er(p,this.project);if(t.hydrateAncestors(),t.addSelfToProject(n),n==null||n.add(t,G.Added),t.initChildren(n),this.dataType){const m=this.dataType.clone(n,t);t.setDataType(m,n)}if(this.defaultValue){const m=this.defaultValue.clone(n,t);t.setDefaultValue(m,n)}return n==null||n.attemptAutoclose("implement-as-return-declaration",this.id),t}};g(Rt,"repository",{APICreate:async(n,...a)=>n,APIUpdate:async(n,...a)=>n,APIDelete:async(n,...a)=>n,APIClone:async(n,...a)=>{},APILoad:async(n,...a)=>null,APILoadVersion:async(n,a,...l)=>null}),g(Rt,"type",f.ValueDescriptor),g(Rt,"USER_MANAGED_PARENT_TYPES",[f.ActionDescriptor,f.Loop,f.Search]),g(Rt,"PARENT_TYPES",[...Rt.USER_MANAGED_PARENT_TYPES]),g(Rt,"MUTABLE_BASE_PROPERTIES",["name","description","required"]),g(Rt,"INMUTABLE_BASE_PROPERTIES",["id","version","type","parentRelationType","createdAt","author","previousVersion"]),g(Rt,"BASE_PROPERTIES",[...Rt.MUTABLE_BASE_PROPERTIES,...Rt.INMUTABLE_BASE_PROPERTIES]),g(Rt,"MUTABLE_META_PROPERTIES",[...Rt.MUTABLE_BASE_PROPERTIES,"index"]),g(Rt,"INMUTABLE_META_PROPERTIES",[...Rt.INMUTABLE_BASE_PROPERTIES]),g(Rt,"META_PROPERTIES",[...Rt.MUTABLE_META_PROPERTIES,...Rt.INMUTABLE_META_PROPERTIES]),g(Rt,"MUTABLE_UPSTREAM_PROPERTIES",[]),g(Rt,"INMUTABLE_UPSTREAM_PROPERTIES",["parent"]),g(Rt,"UPSTREAM_PROPERTIES",[...Rt.MUTABLE_UPSTREAM_PROPERTIES,...Rt.INMUTABLE_UPSTREAM_PROPERTIES]),g(Rt,"MUTABLE_DOWNSTREAM_PROPERTIES",["dataType","defaultValue"]),g(Rt,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),g(Rt,"DOWNSTREAM_PROPERTIES",[...Rt.MUTABLE_DOWNSTREAM_PROPERTIES,...Rt.INMUTABLE_DOWNSTREAM_PROPERTIES]),g(Rt,"PROPERTIES",[...Rt.META_PROPERTIES,...Rt.UPSTREAM_PROPERTIES,...Rt.DOWNSTREAM_PROPERTIES]);let ks=Rt;function _he(u,d){let n=null;const a=[];if(!u.id)n={...u,id:P.UUID.uuid()};else if(!WL(u.id)){const m=P.UUID.uuid();n={...u,id:m},a.push(new Y({id:`${u.id}--${k.InvalidUUIDStringFormat}`,message:`Entity with id "${u.id}" has an invalid UUID string format. The 'id' property must be a valid UUID string.
|
|
203
|
-
The 'id' has been changed to "${m}".`,severity:S.Error,code:k.InvalidUUIDStringFormat,issue:null}))}if(n={...u,id:n.id},!u.type)return{errors:[...a,new Y({id:`${n.id}--${k.MissingTypeProperty}`,message:`Entity with id "${n.id}" is missing a 'type' property.`,severity:S.Error,code:k.MissingTypeProperty,issue:null})],modifiedData:n};if(u.type===f.GenericReference)return{errors:[...a,new Y({id:`${n.id}--${k.RootReference}`,message:`Generic reference entity with id "${n.id}". A generic reference cannot be generated as a standalone entity. Only in the body of another entity.`,severity:S.Error,code:k.RootReference,issue:null})],modifiedData:n};const l=n,p=d.instances[l.id],t=d.builtInInstances[l.id];if(p&&!t&&l.type!==f.GenericReference){let m=`A previously generated entity with id "${l.id}" already exists in the project state.
|
|
203
|
+
The 'id' has been changed to "${m}".`,severity:S.Error,code:k.InvalidUUIDStringFormat,issue:null}))}if(n={...u,id:(n==null?void 0:n.id)||u.id||""},!u.type)return{errors:[...a,new Y({id:`${n.id}--${k.MissingTypeProperty}`,message:`Entity with id "${n.id}" is missing a 'type' property.`,severity:S.Error,code:k.MissingTypeProperty,issue:null})],modifiedData:n};if(u.type===f.GenericReference)return{errors:[...a,new Y({id:`${n.id}--${k.RootReference}`,message:`Generic reference entity with id "${n.id}". A generic reference cannot be generated as a standalone entity. Only in the body of another entity.`,severity:S.Error,code:k.RootReference,issue:null})],modifiedData:n};const l=n,p=d.instances[l.id],t=d.builtInInstances[l.id];if(p&&!t&&l.type!==f.GenericReference){let m=`A previously generated entity with id "${l.id}" already exists in the project state.
|
|
204
204
|
Are you trying to update that entity?
|
|
205
205
|
If so, you should use the 'update' action for core mutable metadata properties, or 'delete' and then 'post' again to replace it.
|
|
206
206
|
If you are trying to create a new entity, please use a different id, for example: "${UT(l,d)}".`;return{errors:[...a,new Y({id:`duplicate--${l.id}--${k.EntityIdNotUnique}`,message:m,severity:S.Error,code:k.EntityIdNotUnique,issue:null})],modifiedData:n}}else if(p&&l.type!==f.GenericReference)return{errors:[...a,new Y({id:`${l.id}--${k.EntityIdNotUnique}`,message:`A built in entity with id "${l.id}" already exists. You cannot modify built in entities. If you are trying to create a new entity, please use a different id, for example: "${UT(l,d)}".`,severity:S.Error,code:k.EntityIdNotUnique,issue:null})],modifiedData:n};switch(l.type){case f.Project:{const m=P.validateGenerationTarget(l,d);return{...m,errors:[...a,...m.errors]}}case f.DefinitionEntity:{const m=ia.validateGenerationTarget(l,d);return{...m,errors:[...a,...m.errors]}}case f.Property:{const m=Xn.validateGenerationTarget(l,d);return{...m,errors:[...a,...m.errors]}}case f.FunctionDeclaration:{const m=_a.validateGenerationTarget(l,d);return{...m,errors:[...a,...m.errors]}}case f.DataType:{const m=ts.validateGenerationTarget(l,d);return{...m,errors:[...a,...m.errors]}}case f.Operation:{const m=Da.validateGenerationTarget(l,d);return{...m,errors:[...a,...m.errors]}}case f.FunctionCall:{const m=Fa.validateGenerationTarget(l,d);return{...m,errors:[...a,...m.errors]}}case f.VariableDeclaration:{const m=Va.validateGenerationTarget(l,d);return{...m,errors:[...a,...m.errors]}}case f.VariableInstance:{const m=Pa.validateGenerationTarget(l,d);return{...m,errors:[...a,...m.errors]}}case f.GlobalEvent:{const m=$a.validateGenerationTarget(l,d);return{...m,errors:[...a,...m.errors]}}case f.InputMap:{const m=Es.validateGenerationTarget(l,d);return{...m,errors:[...a,...m.errors]}}case f.OutputMap:{const m=Ks.validateGenerationTarget(l,d);return{...m,errors:[...a,...m.errors]}}case f.ArgumentDeclaration:{const m=ea.validateGenerationTarget(l,d);return{...m,errors:[...a,...m.errors]}}case f.ReturnDeclaration:{const m=wi.validateGenerationTarget(l,d);return{...m,errors:[...a,...m.errors]}}case f.Loop:{const m=Oa.validateGenerationTarget(l,d);return{...m,errors:[...a,...m.errors]}}case f.Condition:{const m=Ca.validateGenerationTarget(l,d);return{...m,errors:[...a,...m.errors]}}case f.Search:{const m=Na.validateGenerationTarget(l,d);return{...m,errors:[...a,...m.errors]}}case f.InstalledProject:{const m=La.validateGenerationTarget(l,d);return{...m,errors:[...a,...m.errors]}}case f.InternalCall:{const m=Ma.validateGenerationTarget(l,d);return{...m,errors:[...a,...m.errors]}}case f.LiteralValue:{const m=Fs.validateGenerationTarget(l,d);return{...m,errors:[...a,...m.errors]}}case f.ReturnStatement:{const m=ga.validateGenerationTarget(l,d);return{...m,errors:[...a,...m.errors]}}case f.BreakStatement:{const m=Ba.validateGenerationTarget(l,d);return{...m,errors:[...a,...m.errors]}}case f.ContinueStatement:{const m=Qr.validateGenerationTarget(l,d);return{...m,errors:[...a,...m.errors]}}case f.ActionDescriptor:{const m=Lt.validateGenerationTarget(l,d);return{...m,errors:[...a,...m.errors]}}case f.ValueDescriptor:{const m=ks.validateGenerationTarget(l,d);return{...m,errors:[...a,...m.errors]}}case f.BuiltInBaseEntity:case f.PrimitiveEntity:{const m="Did you mean to generate a",b={[f.BuiltInBaseEntity]:`${m} '${f.DefinitionEntity}' instead?`,[f.PrimitiveEntity]:`${m} '${f.DefinitionEntity}' instead?`}[l.type]||"";return{errors:[...a,new Y({id:`${l.id}--${k.BuiltInEntityGenerated}`,message:`Entity with id "${l.id} is of "${l.type}" type and should not be generated. Built in entities can only be referenced by user created entities.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elyx-code/project-logic-tree",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6331",
|
|
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",
|