@elyx-code/project-logic-tree 0.0.6089 → 0.0.6090
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
|
@@ -38326,6 +38326,9 @@ ${cn(
|
|
|
38326
38326
|
var e;
|
|
38327
38327
|
return ((e = this.dataType) == null ? void 0 : e.defaultValue) || null;
|
|
38328
38328
|
}
|
|
38329
|
+
removeDataType() {
|
|
38330
|
+
return this.dataType = null, this;
|
|
38331
|
+
}
|
|
38329
38332
|
};
|
|
38330
38333
|
c(Ae, "MUTABLE_BASE_PROPERTIES", ["name", "description", "required"]), c(Ae, "INMUTABLE_BASE_PROPERTIES", [
|
|
38331
38334
|
"id",
|
package/dist/index.umd.cjs
CHANGED
|
@@ -167,7 +167,7 @@ You can't modify system entities that are built-in.`,issue:null})),o&&o.type===n
|
|
|
167
167
|
An action descriptor can only have one error value descriptor child.
|
|
168
168
|
Either remove the existing error value descriptor or update it with the 'update' action.
|
|
169
169
|
You can use the 'describe_entity' action to get more information about the existing error value descriptor like so:
|
|
170
|
-
${dn({describe_entity:o.error.id})}`,issue:null}))),{errors:a,modifiedData:i}}validateGeneratedUpdate(e){return{errors:[],modifiedData:e}}addSelfToProject(){var a,s,o,l;const e=[this],t=[],i=[];return this.parentRelationType===O.FixedArguments||this.parentRelationType===O.DynamicArgument?(s=(a=this.parent)==null?void 0:a.addInput)==null||s.call(a,this):this.parentRelationType===O.FixedReturns||this.parentRelationType===O.DynamicReturn?(l=(o=this.parent)==null?void 0:o.addOutput)==null||l.call(o,this):this.parentRelationType===O.ReturnedError&&this.parent&&(this.parent.error=this),this.parent&&([n.Search,n.Loop].includes(this.parent.type)&&this.parent.addOutputDeclaration(this),e.push(this.parent)),{updated:E(e),added:E(t),removed:E(i),self:this}}setParent(e){return this.parent=e,this}initChildren(){return this.initialized?this:(this.initialized=!0,this.initialData.dataType&&(this.dataType=g(this.initialData.dataType,this.project),this.dataType.setParent(this),this.dataType.initChildren()),this)}subscribe(){return this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}sync(e){return this.version=e.version||this.version,this.name=e.name||this.name,this.description=e.description||this.description,this.index=e.index||(e.index!==0?this.index:0),this.required=e.required||this.required,this.parentRelationType=e.parentRelationType||this.parentRelationType,this}async load(){return this}async create(){return this}async update(e){return this}async delete(){return this}remove({ignoreUpstream:e,seenEntities:t}={ignoreUpstream:!1,seenEntities:new Set}){const i=[],a=[];if(t.has(this.id))return{affected:[],removed:[]};if(t.add(this.id),a.push(this),this.unsubscribe(),this.dataType){const{affected:s,removed:o}=this.dataType.remove({ignoreUpstream:!0,seenEntities:t});i.push(...s),a.push(...o)}return{affected:E(i),removed:E(a)}}restore({seenEntities:e}={seenEntities:new Set}){const t=[];if(e.has(this.id))return{affected:[],self:this};if(e.add(this.id),this.subscribe(),this.dataType){const{affected:i}=this.dataType.restore({seenEntities:e});t.push(...i)}return{affected:E(t),self:this}}toFlat(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this,...this.dataType?this.dataType.toFlat(e):[]])}toFlatIds(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.id,...this.dataType?this.dataType.toFlatIds(e):[]])}toJSON(){var e,t;return{id:this.id,version:this.version,type:this.type,name:this.name,description:this.description,index:this.index,required:this.required,parentRelationType:this.parentRelationType,dataType:((e=this.dataType)==null?void 0:e.toJSON())||null,parent:((t=this.parent)==null?void 0:t.toReference())||null}}toReference(){return{id:this.id+"--"+_.UUID.uuid()+"--ref",type:n.GenericReference,entityId:this.id,entityType:this.type}}toShallowJSON(){var e,t;return{id:this.id,version:this.version,type:this.type,name:this.name,description:this.description,index:this.index,required:this.required,parentRelationType:this.parentRelationType,dataType:((e=this.dataType)==null?void 0:e.toReference())||null,parent:((t=this.parent)==null?void 0:t.toReference())||null}}toFlatJSON(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toShallowJSON(),...this.dataType?this.dataType.toFlatJSON(e):[]])}toGenerationTarget(){var e;return{id:this.id,name:this.name,description:this.description,type:this.type,required:this.required,parentRelationType:this.parentRelationType,parent:(e=this.parent)==null?void 0:e.id}}toFlatGenerationTarget(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toGenerationTarget(),...this.dataType?this.dataType.toFlatGenerationTarget(e):[]])}clearErrors(){var e;return this.errors=[],(e=this.dataType)==null||e.clearErrors(),this}validate(){const e=x2(this);return this.errors=e,{success:!0,error:null,data:this.toJSON()}}getErrors(){return[...this.errors,...this.dataType?this.dataType.getErrors():[]]}getShallowErrors(){return this.errors}clone(e=null,t=null,i=!0){var h;const a=t||Ze(C(this,this.project),n.ValueDescriptor,this.project),s=a.split("-id"),o=s[s.length-1||0]||a,l=this.toJSON();l.id=a;const p=kt(l,this.project);e&&p.setParent(e),i&&p.subscribe();const y=((h=this.dataType)==null?void 0:h.clone(p,o+"-data-type-id",i))||null;return y&&p.setDataType(y),p}getDataType(){return this.dataType||null}setDataType(e){return this.dataType=e,this}getDefaultValue(){var e;return((e=this.dataType)==null?void 0:e.defaultValue)||null}};d(we,"MUTABLE_BASE_PROPERTIES",["name","description","required"]),d(we,"INMUTABLE_BASE_PROPERTIES",["id","version","type","parentRelationType"]),d(we,"BASE_PROPERTIES",[...we.MUTABLE_BASE_PROPERTIES,...we.INMUTABLE_BASE_PROPERTIES]),d(we,"MUTABLE_META_PROPERTIES",[...we.MUTABLE_BASE_PROPERTIES,"index"]),d(we,"INMUTABLE_META_PROPERTIES",[...we.INMUTABLE_BASE_PROPERTIES]),d(we,"META_PROPERTIES",[...we.MUTABLE_META_PROPERTIES,...we.INMUTABLE_META_PROPERTIES]),d(we,"MUTABLE_UPSTREAM_PROPERTIES",[]),d(we,"INMUTABLE_UPSTREAM_PROPERTIES",["parent"]),d(we,"UPSTREAM_PROPERTIES",[...we.MUTABLE_UPSTREAM_PROPERTIES,...we.INMUTABLE_UPSTREAM_PROPERTIES]),d(we,"MUTABLE_DOWNSTREAM_PROPERTIES",["dataType"]),d(we,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),d(we,"DOWNSTREAM_PROPERTIES",[...we.MUTABLE_DOWNSTREAM_PROPERTIES,...we.INMUTABLE_DOWNSTREAM_PROPERTIES]),d(we,"PROPERTIES",[...we.META_PROPERTIES,...we.UPSTREAM_PROPERTIES,...we.DOWNSTREAM_PROPERTIES]);let Ur=we;function j2(r,e){if(!r.type&&!r.id)return{errors:[new b({id:`last-generated-entity-payload--${f.MissingTypeProperty}`,message:"Last generated entity payload is missing a 'type' property.",severity:T.Error,code:f.MissingTypeProperty,issue:null}),new b({id:`last-generated-entity-payload--${f.MissingIdProperty}`,message:"Last generated entity payload is missing an 'id' property.",severity:T.Error,code:f.MissingIdProperty,issue:null})],modifiedData:null};if(r.type){if(!r.id)return{errors:[new b({id:`last-generated-entity-payload--${f.MissingIdProperty}`,message:`Last generated entity, with type "${r.type}" is missing an 'id' property.`,severity:T.Error,code:f.MissingIdProperty,issue:null})],modifiedData:null}}else return{errors:[new b({id:`${r.id}--${f.MissingTypeProperty}`,message:`Entity with id "${r.id}" is missing a 'type' property.`,severity:T.Error,code:f.MissingTypeProperty,issue:null})],modifiedData:null};if(r.type===n.GenericReference)return{errors:[new b({id:`${r.id}--${f.RootReference}`,message:`Generic reference entity with id "${r.id}". A generic reference cannot be generated as a standalone entity. Only in the body of another entity.`,severity:T.Error,code:f.RootReference,issue:null})],modifiedData:null};const t=r,i=e.instances[t.id],a=e.builtInInstances[t.id];if(i&&!a&&t.type!==n.GenericReference){let s=`A previously generated entity with id "${t.id}" already exists in the project state.
|
|
170
|
+
${dn({describe_entity:o.error.id})}`,issue:null}))),{errors:a,modifiedData:i}}validateGeneratedUpdate(e){return{errors:[],modifiedData:e}}addSelfToProject(){var a,s,o,l;const e=[this],t=[],i=[];return this.parentRelationType===O.FixedArguments||this.parentRelationType===O.DynamicArgument?(s=(a=this.parent)==null?void 0:a.addInput)==null||s.call(a,this):this.parentRelationType===O.FixedReturns||this.parentRelationType===O.DynamicReturn?(l=(o=this.parent)==null?void 0:o.addOutput)==null||l.call(o,this):this.parentRelationType===O.ReturnedError&&this.parent&&(this.parent.error=this),this.parent&&([n.Search,n.Loop].includes(this.parent.type)&&this.parent.addOutputDeclaration(this),e.push(this.parent)),{updated:E(e),added:E(t),removed:E(i),self:this}}setParent(e){return this.parent=e,this}initChildren(){return this.initialized?this:(this.initialized=!0,this.initialData.dataType&&(this.dataType=g(this.initialData.dataType,this.project),this.dataType.setParent(this),this.dataType.initChildren()),this)}subscribe(){return this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}sync(e){return this.version=e.version||this.version,this.name=e.name||this.name,this.description=e.description||this.description,this.index=e.index||(e.index!==0?this.index:0),this.required=e.required||this.required,this.parentRelationType=e.parentRelationType||this.parentRelationType,this}async load(){return this}async create(){return this}async update(e){return this}async delete(){return this}remove({ignoreUpstream:e,seenEntities:t}={ignoreUpstream:!1,seenEntities:new Set}){const i=[],a=[];if(t.has(this.id))return{affected:[],removed:[]};if(t.add(this.id),a.push(this),this.unsubscribe(),this.dataType){const{affected:s,removed:o}=this.dataType.remove({ignoreUpstream:!0,seenEntities:t});i.push(...s),a.push(...o)}return{affected:E(i),removed:E(a)}}restore({seenEntities:e}={seenEntities:new Set}){const t=[];if(e.has(this.id))return{affected:[],self:this};if(e.add(this.id),this.subscribe(),this.dataType){const{affected:i}=this.dataType.restore({seenEntities:e});t.push(...i)}return{affected:E(t),self:this}}toFlat(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this,...this.dataType?this.dataType.toFlat(e):[]])}toFlatIds(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.id,...this.dataType?this.dataType.toFlatIds(e):[]])}toJSON(){var e,t;return{id:this.id,version:this.version,type:this.type,name:this.name,description:this.description,index:this.index,required:this.required,parentRelationType:this.parentRelationType,dataType:((e=this.dataType)==null?void 0:e.toJSON())||null,parent:((t=this.parent)==null?void 0:t.toReference())||null}}toReference(){return{id:this.id+"--"+_.UUID.uuid()+"--ref",type:n.GenericReference,entityId:this.id,entityType:this.type}}toShallowJSON(){var e,t;return{id:this.id,version:this.version,type:this.type,name:this.name,description:this.description,index:this.index,required:this.required,parentRelationType:this.parentRelationType,dataType:((e=this.dataType)==null?void 0:e.toReference())||null,parent:((t=this.parent)==null?void 0:t.toReference())||null}}toFlatJSON(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toShallowJSON(),...this.dataType?this.dataType.toFlatJSON(e):[]])}toGenerationTarget(){var e;return{id:this.id,name:this.name,description:this.description,type:this.type,required:this.required,parentRelationType:this.parentRelationType,parent:(e=this.parent)==null?void 0:e.id}}toFlatGenerationTarget(e=new Set){return e.has(this.id)?[]:(e.add(this.id),[this.toGenerationTarget(),...this.dataType?this.dataType.toFlatGenerationTarget(e):[]])}clearErrors(){var e;return this.errors=[],(e=this.dataType)==null||e.clearErrors(),this}validate(){const e=x2(this);return this.errors=e,{success:!0,error:null,data:this.toJSON()}}getErrors(){return[...this.errors,...this.dataType?this.dataType.getErrors():[]]}getShallowErrors(){return this.errors}clone(e=null,t=null,i=!0){var h;const a=t||Ze(C(this,this.project),n.ValueDescriptor,this.project),s=a.split("-id"),o=s[s.length-1||0]||a,l=this.toJSON();l.id=a;const p=kt(l,this.project);e&&p.setParent(e),i&&p.subscribe();const y=((h=this.dataType)==null?void 0:h.clone(p,o+"-data-type-id",i))||null;return y&&p.setDataType(y),p}getDataType(){return this.dataType||null}setDataType(e){return this.dataType=e,this}getDefaultValue(){var e;return((e=this.dataType)==null?void 0:e.defaultValue)||null}removeDataType(){return this.dataType=null,this}};d(we,"MUTABLE_BASE_PROPERTIES",["name","description","required"]),d(we,"INMUTABLE_BASE_PROPERTIES",["id","version","type","parentRelationType"]),d(we,"BASE_PROPERTIES",[...we.MUTABLE_BASE_PROPERTIES,...we.INMUTABLE_BASE_PROPERTIES]),d(we,"MUTABLE_META_PROPERTIES",[...we.MUTABLE_BASE_PROPERTIES,"index"]),d(we,"INMUTABLE_META_PROPERTIES",[...we.INMUTABLE_BASE_PROPERTIES]),d(we,"META_PROPERTIES",[...we.MUTABLE_META_PROPERTIES,...we.INMUTABLE_META_PROPERTIES]),d(we,"MUTABLE_UPSTREAM_PROPERTIES",[]),d(we,"INMUTABLE_UPSTREAM_PROPERTIES",["parent"]),d(we,"UPSTREAM_PROPERTIES",[...we.MUTABLE_UPSTREAM_PROPERTIES,...we.INMUTABLE_UPSTREAM_PROPERTIES]),d(we,"MUTABLE_DOWNSTREAM_PROPERTIES",["dataType"]),d(we,"INMUTABLE_DOWNSTREAM_PROPERTIES",[]),d(we,"DOWNSTREAM_PROPERTIES",[...we.MUTABLE_DOWNSTREAM_PROPERTIES,...we.INMUTABLE_DOWNSTREAM_PROPERTIES]),d(we,"PROPERTIES",[...we.META_PROPERTIES,...we.UPSTREAM_PROPERTIES,...we.DOWNSTREAM_PROPERTIES]);let Ur=we;function j2(r,e){if(!r.type&&!r.id)return{errors:[new b({id:`last-generated-entity-payload--${f.MissingTypeProperty}`,message:"Last generated entity payload is missing a 'type' property.",severity:T.Error,code:f.MissingTypeProperty,issue:null}),new b({id:`last-generated-entity-payload--${f.MissingIdProperty}`,message:"Last generated entity payload is missing an 'id' property.",severity:T.Error,code:f.MissingIdProperty,issue:null})],modifiedData:null};if(r.type){if(!r.id)return{errors:[new b({id:`last-generated-entity-payload--${f.MissingIdProperty}`,message:`Last generated entity, with type "${r.type}" is missing an 'id' property.`,severity:T.Error,code:f.MissingIdProperty,issue:null})],modifiedData:null}}else return{errors:[new b({id:`${r.id}--${f.MissingTypeProperty}`,message:`Entity with id "${r.id}" is missing a 'type' property.`,severity:T.Error,code:f.MissingTypeProperty,issue:null})],modifiedData:null};if(r.type===n.GenericReference)return{errors:[new b({id:`${r.id}--${f.RootReference}`,message:`Generic reference entity with id "${r.id}". A generic reference cannot be generated as a standalone entity. Only in the body of another entity.`,severity:T.Error,code:f.RootReference,issue:null})],modifiedData:null};const t=r,i=e.instances[t.id],a=e.builtInInstances[t.id];if(i&&!a&&t.type!==n.GenericReference){let s=`A previously generated entity with id "${t.id}" already exists in the project state.
|
|
171
171
|
Are you trying to update that entity?
|
|
172
172
|
If so, you should use the 'update' action for core mutable metadata properties, or 'delete' and then 'post' again to replace it.
|
|
173
173
|
If you are trying to create a new entity, please use a different id, for example: "${Tu(t,e)}".`;return{errors:[new b({id:`duplicate--${t.id}--${f.EntityIdNotUnique}`,message:s,severity:T.Error,code:f.EntityIdNotUnique,issue:null})],modifiedData:r}}else if(i&&t.type!==n.GenericReference)return{errors:[new b({id:`${t.id}--${f.EntityIdNotUnique}`,message:`A built in entity with id "${t.id}" already exists. You cannot modify built in entities. If you are trying to create a new entity, please use a different id, for example: "${Tu(t,e)}".`,severity:T.Error,code:f.EntityIdNotUnique,issue:null})],modifiedData:r};switch(t.type){case n.Project:return _.validateGenerationTarget(t,e);case n.CustomEntity:return kr.validateGenerationTarget(t,e);case n.Property:return Cr.validateGenerationTarget(t,e);case n.FunctionDeclaration:return Br.validateGenerationTarget(t,e);case n.DataType:return Oi.validateGenerationTarget(t,e);case n.Operation:return wr.validateGenerationTarget(t,e);case n.FunctionCall:return xr.validateGenerationTarget(t,e);case n.VariableDeclaration:return Mr.validateGenerationTarget(t,e);case n.VariableInstance:return Vr.validateGenerationTarget(t,e);case n.GlobalEvent:return Si.validateGenerationTarget(t,e);case n.InputMap:return On.validateGenerationTarget(t,e);case n.OutputMap:return Sn.validateGenerationTarget(t,e);case n.ArgumentDeclaration:return $r.validateGenerationTarget(t,e);case n.ReturnDeclaration:return _t.validateGenerationTarget(t,e);case n.Loop:return _r.validateGenerationTarget(t,e);case n.Condition:return Nr.validateGenerationTarget(t,e);case n.Search:return Lr.validateGenerationTarget(t,e);case n.InstalledProject:return Gr.validateGenerationTarget(t,e);case n.InternalCall:return Ci.validateGenerationTarget(t,e);case n.PrimitiveValue:return Bi.validateGenerationTarget(t,e);case n.ReturnStatement:return Fr.validateGenerationTarget(t,e);case n.BreakStatement:return wi.validateGenerationTarget(t,e);case n.ContinueStatement:return bt.validateGenerationTarget(t,e);case n.ActionDescriptor:return te.validateGenerationTarget(t,e);case n.ValueDescriptor:return Ur.validateGenerationTarget(t,e);case n.BuiltInBaseEntity:case n.PrimitiveEntity:{const s="Did you mean to generate a",l={[n.BuiltInBaseEntity]:`${s} '${n.CustomEntity}' instead?`,[n.PrimitiveEntity]:`${s} '${n.CustomEntity}' instead?`}[t.type]||"";return{errors:[new b({id:`${t.id}--${f.BuiltInEntityGenerated}`,message:`Entity with id "${t.id} is of "${t.type}" type and should not be generated. Built in entities can only be referenced by user created entities.
|
|
@@ -91,5 +91,6 @@ export declare class ValueDescriptorState implements IValueDescriptor, UserManag
|
|
|
91
91
|
getDataType(): DataTypeState | null;
|
|
92
92
|
setDataType(dataType: DataTypeState): ValueDescriptorState;
|
|
93
93
|
getDefaultValue(): PrimitiveValueState | null;
|
|
94
|
+
removeDataType(): ValueDescriptorState;
|
|
94
95
|
}
|
|
95
96
|
export type ValueDescriptorPayloadUnion = ValueDescriptorState | ValueDescriptorTypesUnion;
|
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.6090",
|
|
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",
|