@elyx-code/project-logic-tree 0.0.6447 → 0.0.6448

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.
@@ -386,7 +386,7 @@ The only use for declaring global callable entities is for a 'variable-declarati
386
386
  Or for a logic that the user is going to manually test themselves by clicking on the user-interface.`,entity:d}));else{const i=qp(d);if(!i.reachable){let a=`This '${d.type}' entity "${W(d,d.project)}" with id "${d.id}" is not reachable from the project's closest entry point '${i.entryPoint.type}' "${W(i.entryPoint,d.project)}".`;a+=`
387
387
  This is because there are termination statements in the call chain before reaching this '${d.type}'.
388
388
  If a caller entity calls a termination statement, it will always prevent all other calls from executing.`;let o=`
389
- This '${d.type}' is blocked `;i.blocks.forEach((p,e)=>{const y=p.blockedByCaller,v=p.blockedByCalling;e===0?o+="by ":e===i.blocks.length-1&&(o+="and by "),o+=`its ancestor "${W(y,d.project)}" with id "${y.id}" that calls a '${v.type}' entity with id "${v.id}"`,e<i.blocks.length-1?o+=", ":o+="."}),u.push(new ar({id:`${d.id}--${ee.UnreachableEntity}`,code:ee.UnreachableEntity,severity:q.Warning,message:`${a}${o}`,entity:d}))}}return Er(d.errors,u)}function po(d){const u=[],i=d.project.requestActiveDynamicValue(d);if((i==null?void 0:i.type)===Ae.Missing){const a=lt({id:`${d.id}--${Q.MissingRequiredValue}`,message:`The '${d.type}' entity "${W(d,d.project)}" with id "${d.id}" is missing its required value before it can be executed or published.`,severity:q.Error,code:Q.MissingRequiredValue,entity:d});u.push(a.error)}return u}function ZA(d){const u=[];if(!d.internalCalls.length)return u;const i=d.internalCalls.some(a=>a.calledBy.length||a.successCalls.length||a.errorCalls.length||a.getUsedInputs().length||a.getUsedOutputs().length);if(d.readsValue&&i){const a=lt({id:`${d.id}--${Q.VariableReadsValueAndInternalCall}`,message:`Variable "${W(d,d.project)}" with id "${d.id}" reads a value. A variable with internal calls can't read a value.`,severity:q.Error,code:Q.VariableReadsValueAndInternalCall,entity:d});u.push(a.error)}if(d.writesValues.length&&i){const a=lt({id:`${d.id}--${Q.VariableWritesValuesAndInternalCall}`,message:`Variable "${W(d,d.project)}" with id "${d.id}" writes values. A variable with internal calls can't write a value.`,severity:q.Error,code:Q.VariableWritesValuesAndInternalCall,entity:d});u.push(a.error)}if(d.getUsedInputs().length&&i){const a=lt({id:`${d.id}--${Q.VariableHasInputsAndInternalCall}`,message:`Variable "${W(d,d.project)}" with id "${d.id}" has inputs. A variable with internal calls can't have inputs.`,severity:q.Error,code:Q.VariableHasInputsAndInternalCall,entity:d});u.push(a.error)}if(d.getUsedOutputs().length&&i){const a=lt({id:`${d.id}--${Q.VariableHasOutputsAndInternalCall}`,message:`Variable "${W(d,d.project)}" with id "${d.id}" has outputs. A variable with internal calls can't have outputs.`,severity:q.Error,code:Q.VariableHasOutputsAndInternalCall,entity:d});u.push(a.error)}if(d.calledBy.length&&i){const a=lt({id:`${d.id}--${Q.VariableIsCalledAndHasInternalCall}`,message:`Variable "${W(d,d.project)}" with id "${d.id}" is called by other entities. A variable with internal calls can't be called by other entities.`,severity:q.Error,code:Q.VariableIsCalledAndHasInternalCall,entity:d});u.push(a.error)}if([...d.successCalls,...d.errorCalls].length&&i){const a=lt({id:`${d.id}--${Q.VariableCallsOthersAndHasInternalCall}`,message:`Variable "${W(d,d.project)}" with id "${d.id}" calls other entities. A variable with internal calls can't call other entities.`,severity:q.Error,code:Q.VariableCallsOthersAndHasInternalCall,entity:d});u.push(a.error)}return u}function WTe(d){const u=d.variableDeclarations,i=d.events.flatMap(e=>[e,...bt(e)]),a=d.functions.flatMap(e=>d.instancesList.find(y=>y.type===f.FunctionCall&&y.declaration.id===e.id)?[e,...bt(e)]:[]),o=d.entities.flatMap(e=>[e,...d.entities.reduce((y,v)=>[...y,...v.methods.flatMap(E=>[E,...bt(E)])],[])]);return xT([...u,...i,...a,...o].flatMap(e=>e.getErrors()))}function HA(d){var u,i;return d.type!==f.InternalCall&&(!Dt.includes(d.parent.type)||!((u=d.parent.implements)!=null&&u.outputs.length))||d.type===f.InternalCall&&(!Dt.includes(d.parent.parent.type)||!((i=d.parent.parent.implements)!=null&&i.outputs.length))}function WA(d){var a;const u=[];if(!((a=d.implements)!=null&&a.outputs.length))return u;if(bt(d).filter(o=>!fr.includes(o.type)&&!o.successCalls.length&&!o.errorCalls.length&&!!o.calledBy.length&&!!HA(o)).length){const o=lt({id:`${d.id}--${Q.LackingReturnStatementOnSomeBranches}`,message:`The '${d.type}' entity "${W(d,d.project)}" with id "${d.id}" is missing the required return statement by its implementation on some branches.`,severity:q.Error,code:Q.LackingReturnStatementOnSomeBranches,entity:d});u.push(o.error)}return u}function Ca(d){const u=[];if(!oi.includes(d.type)||fr.includes(d.type)||Dt.includes(d.type)||HA(d))return u;if(!d.successCalls.length&&!d.errorCalls.length&&d.calledBy.length){const i=lt({id:`${d.id}--${Q.LastCalledEntityMustBeReturnEntity}`,message:`The '${d.type}' entity "${W(d,d.project)}" with id "${d.id}" cannot be the last entity of the branch. A return statement must be the last entity on all branches of its parent entry-point.`,severity:q.Error,code:Q.LastCalledEntityMustBeReturnEntity,entity:d});u.push(i.error)}return u}function m5(d){var a;d.inputs.forEach(o=>o.validate()),d.outputs.forEach(o=>o.validate()),(a=d.error)==null||a.validate();const i=[...Oa(d),...Ca(d)];return Er(d.errors,i)}const JTe=Object.freeze(Object.defineProperty({__proto__:null,validate:m5},Symbol.toStringTag,{value:"Module"}));var v5=(d=>(d.Parent="parent",d.Declaration="declaration",d))(v5||{});const Qt=class Qt extends Cr{constructor(i,a){super(i);g(this,"initialData");g(this,"id");g(this,"x");g(this,"y");g(this,"type",f.FunctionCall);g(this,"successCalls",[]);g(this,"errorCalls",[]);g(this,"process",null);g(this,"declaration");g(this,"inputs",[]);g(this,"outputs",[]);g(this,"calledBySuccess",[]);g(this,"calledByError",[]);g(this,"calledByEntry",[]);g(this,"error",null);g(this,"parent");g(this,"errors",[]);g(this,"project");g(this,"detachedDependents",{});g(this,"knownVersions",null);g(this,"activeVersion",!1);g(this,"initialized",!1);g(this,"startedInitialization",!1);this.initialData=i,this.project=a,this.id=i.id,this.x=i.x,this.y=i.y}static new(i=null){return{id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||L().toISOString(),author:(i==null?void 0:i.author)||N.sessionAuthor,previousVersion:null,deleted:!1,type:f.FunctionCall,declaration:null,inputs:[],outputs:[],process:null,error:null,parent:null,calledByEntry:[],calledBySuccess:[],calledByError:[],errorCalls:[],successCalls:[],x:0,y:0}}static fromGenerationTarget(i,a){let o=a;if(i.parent){const $=H(i.parent);o=a.get($)}const p=H(i.declaration),e=a.get(p),y=i.calledByEntry.map($=>{const V=H($);return a.get(V)}),v=i.calledBySuccess.map($=>{const V=H($);return a.get(V)}),E=i.calledByError.map($=>{const V=H($);return a.get(V)}),b={id:i.id,version:N.UUID.uuid(),createdAt:L().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,type:f.FunctionCall,declaration:e.toReference(),calledByEntry:y,calledBySuccess:v,calledByError:E,errorCalls:[],successCalls:[],inputs:[],outputs:[],process:null,error:null,x:0,y:0,parent:o},A=ie(b,a);return A.setParent(o,null),A}static validateGenerationTarget(i,a){let o=JSON.parse(JSON.stringify(i));const p=[],e=ti(o,{parent:{list:!1,types:[...Nr,f.Project],optional:!0}},a);o=e.modifiedData,p.push(...e.errors,...Vr(o));const y=H(o.declaration);if(y){const v=f5(y,a);p.push(...v)}else{const v=a.functions.length?`
389
+ This '${d.type}' is blocked `;i.blocks.forEach((p,e)=>{const y=p.blockedByCaller,v=p.blockedByCalling;e===0?o+="by ":e===i.blocks.length-1&&(o+="and by "),o+=`its ancestor "${W(y,d.project)}" with id "${y.id}" that calls a '${v.type}' entity with id "${v.id}"`,e<i.blocks.length-1?o+=", ":o+="."}),u.push(new ar({id:`${d.id}--${ee.UnreachableEntity}`,code:ee.UnreachableEntity,severity:q.Warning,message:`${a}${o}`,entity:d}))}}return Er(d.errors,u)}function po(d){const u=[],i=d.project.requestActiveDynamicValue(d);if((i==null?void 0:i.type)===Ae.Missing){const a=lt({id:`${d.id}--${Q.MissingRequiredValue}`,message:`The '${d.type}' entity "${W(d,d.project)}" with id "${d.id}" is missing its required value before it can be executed or published.`,severity:q.Error,code:Q.MissingRequiredValue,entity:d});u.push(a.error)}return u}function ZA(d){const u=[];if(!d.internalCalls.length)return u;const i=d.internalCalls.some(a=>a.calledBy.length||a.successCalls.length||a.errorCalls.length||a.getUsedInputs().length||a.getUsedOutputs().length);if(d.readsValue&&i){const a=lt({id:`${d.id}--${Q.VariableReadsValueAndInternalCall}`,message:`Variable "${W(d,d.project)}" with id "${d.id}" reads a value. A variable with internal calls can't read a value.`,severity:q.Error,code:Q.VariableReadsValueAndInternalCall,entity:d});u.push(a.error)}if(d.writesValues.length&&i){const a=lt({id:`${d.id}--${Q.VariableWritesValuesAndInternalCall}`,message:`Variable "${W(d,d.project)}" with id "${d.id}" writes values. A variable with internal calls can't write a value.`,severity:q.Error,code:Q.VariableWritesValuesAndInternalCall,entity:d});u.push(a.error)}if(d.getUsedInputs().length&&i){const a=lt({id:`${d.id}--${Q.VariableHasInputsAndInternalCall}`,message:`Variable "${W(d,d.project)}" with id "${d.id}" has inputs. A variable with internal calls can't have inputs.`,severity:q.Error,code:Q.VariableHasInputsAndInternalCall,entity:d});u.push(a.error)}if(d.getUsedOutputs().length&&i){const a=lt({id:`${d.id}--${Q.VariableHasOutputsAndInternalCall}`,message:`Variable "${W(d,d.project)}" with id "${d.id}" has outputs. A variable with internal calls can't have outputs.`,severity:q.Error,code:Q.VariableHasOutputsAndInternalCall,entity:d});u.push(a.error)}if(d.calledBy.length&&i){const a=lt({id:`${d.id}--${Q.VariableIsCalledAndHasInternalCall}`,message:`Variable "${W(d,d.project)}" with id "${d.id}" is called by other entities. A variable with internal calls can't be called by other entities.`,severity:q.Error,code:Q.VariableIsCalledAndHasInternalCall,entity:d});u.push(a.error)}if([...d.successCalls,...d.errorCalls].length&&i){const a=lt({id:`${d.id}--${Q.VariableCallsOthersAndHasInternalCall}`,message:`Variable "${W(d,d.project)}" with id "${d.id}" calls other entities. A variable with internal calls can't call other entities.`,severity:q.Error,code:Q.VariableCallsOthersAndHasInternalCall,entity:d});u.push(a.error)}return u}function WTe(d){const u=d.variableDeclarations,i=d.events.flatMap(e=>[e,...bt(e)]),a=d.functions.flatMap(e=>d.instancesList.find(y=>y.type===f.FunctionCall&&y.declaration.id===e.id)?[e,...bt(e)]:[]),o=d.entities.flatMap(e=>[e,...d.entities.reduce((y,v)=>[...y,...v.methods.flatMap(E=>[E,...bt(E)])],[])]);return xT([...u,...i,...a,...o].flatMap(e=>e.getErrors()))}function HA(d){var i,a,o,p;if(d.type!==f.InternalCall){if(!Dt.includes(d.parent.type))return!1;const e=d.parent;return!(!((i=e.implements)!=null&&i.outputs.length)||!((a=e.implements)!=null&&a.outputs.some(y=>y.required)))}if(!Dt.includes(d.parent.parent.type))return!1;const u=d.parent.parent;return!(!((o=u.implements)!=null&&o.outputs.length)||!((p=u.implements)!=null&&p.outputs.some(e=>e.required)))}function WA(d){var o,p;const u=[];if(!((o=d.implements)!=null&&o.outputs.length)||!((p=d.implements)!=null&&p.outputs.some(e=>e.required)))return u;if(bt(d).filter(e=>fr.includes(e.type)||!HA(e)?!1:!!(!e.successCalls.length&&!e.errorCalls.length&&e.calledBy.length)).length){const e=lt({id:`${d.id}--${Q.LackingReturnStatementOnSomeBranches}`,message:`The '${d.type}' entity "${W(d,d.project)}" with id "${d.id}" is missing the required return statement by its implementation on some branches.`,severity:q.Error,code:Q.LackingReturnStatementOnSomeBranches,entity:d});u.push(e.error)}return u}function Ca(d){const u=[];if(!oi.includes(d.type)||fr.includes(d.type)||Dt.includes(d.type)||HA(d))return u;if(!d.successCalls.length&&!d.errorCalls.length&&d.calledBy.length){const i=lt({id:`${d.id}--${Q.LastCalledEntityMustBeReturnEntity}`,message:`The '${d.type}' entity "${W(d,d.project)}" with id "${d.id}" cannot be the last entity of the branch. A return statement must be the last entity on all branches of its parent entry-point.`,severity:q.Error,code:Q.LastCalledEntityMustBeReturnEntity,entity:d});u.push(i.error)}return u}function m5(d){var a;d.inputs.forEach(o=>o.validate()),d.outputs.forEach(o=>o.validate()),(a=d.error)==null||a.validate();const i=[...Oa(d),...Ca(d)];return Er(d.errors,i)}const JTe=Object.freeze(Object.defineProperty({__proto__:null,validate:m5},Symbol.toStringTag,{value:"Module"}));var v5=(d=>(d.Parent="parent",d.Declaration="declaration",d))(v5||{});const Qt=class Qt extends Cr{constructor(i,a){super(i);g(this,"initialData");g(this,"id");g(this,"x");g(this,"y");g(this,"type",f.FunctionCall);g(this,"successCalls",[]);g(this,"errorCalls",[]);g(this,"process",null);g(this,"declaration");g(this,"inputs",[]);g(this,"outputs",[]);g(this,"calledBySuccess",[]);g(this,"calledByError",[]);g(this,"calledByEntry",[]);g(this,"error",null);g(this,"parent");g(this,"errors",[]);g(this,"project");g(this,"detachedDependents",{});g(this,"knownVersions",null);g(this,"activeVersion",!1);g(this,"initialized",!1);g(this,"startedInitialization",!1);this.initialData=i,this.project=a,this.id=i.id,this.x=i.x,this.y=i.y}static new(i=null){return{id:N.UUID.uuid(),version:N.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||L().toISOString(),author:(i==null?void 0:i.author)||N.sessionAuthor,previousVersion:null,deleted:!1,type:f.FunctionCall,declaration:null,inputs:[],outputs:[],process:null,error:null,parent:null,calledByEntry:[],calledBySuccess:[],calledByError:[],errorCalls:[],successCalls:[],x:0,y:0}}static fromGenerationTarget(i,a){let o=a;if(i.parent){const $=H(i.parent);o=a.get($)}const p=H(i.declaration),e=a.get(p),y=i.calledByEntry.map($=>{const V=H($);return a.get(V)}),v=i.calledBySuccess.map($=>{const V=H($);return a.get(V)}),E=i.calledByError.map($=>{const V=H($);return a.get(V)}),b={id:i.id,version:N.UUID.uuid(),createdAt:L().toISOString(),author:N.sessionAuthor,previousVersion:null,deleted:!1,type:f.FunctionCall,declaration:e.toReference(),calledByEntry:y,calledBySuccess:v,calledByError:E,errorCalls:[],successCalls:[],inputs:[],outputs:[],process:null,error:null,x:0,y:0,parent:o},A=ie(b,a);return A.setParent(o,null),A}static validateGenerationTarget(i,a){let o=JSON.parse(JSON.stringify(i));const p=[],e=ti(o,{parent:{list:!1,types:[...Nr,f.Project],optional:!0}},a);o=e.modifiedData,p.push(...e.errors,...Vr(o));const y=H(o.declaration);if(y){const v=f5(y,a);p.push(...v)}else{const v=a.functions.length?`
390
390
  All global 'function-declaration' entity ids are:
391
391
  - ${a.functions.map(E=>`${E.id} (${W(E,a)})`).join(`
392
392
  - `)}.`:`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elyx-code/project-logic-tree",
3
- "version": "0.0.6447",
3
+ "version": "0.0.6448",
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",