@elyx-code/project-logic-tree 0.0.6988 → 0.0.6990
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.cjs +1 -1
- package/dist/index.js +3 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -602,7 +602,7 @@ The only use for declaring global callable entities is for a 'variable-declarati
|
|
|
602
602
|
Or for a logic that the user is going to manually test themselves by clicking on the user-interface.`,entity:s}));else{const i=tv(s);if(!i.reachable&&i.entryPoint){let r=`This '${s.type}' entity "${oe(s,s.project)}" with id "${s.id}" is not reachable from the project's closest entry point '${i.entryPoint.type}' "${oe(i.entryPoint,s.project)}".`;r+=`
|
|
603
603
|
This is because there are termination statements in the call chain before reaching this '${s.type}'.
|
|
604
604
|
If a caller entity calls a termination statement, it will always prevent all other calls from executing.`;let a=`
|
|
605
|
-
This '${s.type}' is blocked `;i.blocks.forEach((c,e)=>{const f=c.blockedByCaller,h=c.blockedByCalling;e===0?a+="by ":e===i.blocks.length-1&&(a+="and by "),a+=`its ancestor "${oe(f,s.project)}" with id "${f.id}" that calls a '${h.type}' entity with id "${h.id}"`,e<i.blocks.length-1?a+=", ":a+="."}),u.push(new Bi({id:`${s.id}--${we.UnreachableEntity}`,code:we.UnreachableEntity,severity:ve.Warning,message:`${r}${a}`,entity:s}))}}return qt(s.errors,u)}function ga(s){const u=[],i=jt(s,s.project);if(i){if(i.type===d.Project)return u}else return u;const r=i.getDataType(null),a=qs(r,{removeDuplicates:!0}),c=a.find(f=>{var h;return((h=f==null?void 0:f.entity)==null?void 0:h.id)!==re["primitive-entity"].void.id}),e=a.every(f=>{var h;return f.isResolved&&((h=f.entity)==null?void 0:h.id)!==re["primitive-entity"].void.id});return!r||!c?u:((s.type===d.Condition||s.catchesError)&&!s.errorCalls.length&&e&&u.push(new Bi({id:`${s.id}--${be.ParentScopeRequiresReturnCurrentCatchesErrorWithNoCalls}`,code:be.ParentScopeRequiresReturnCurrentCatchesErrorWithNoCalls,severity:ve.
|
|
605
|
+
This '${s.type}' is blocked `;i.blocks.forEach((c,e)=>{const f=c.blockedByCaller,h=c.blockedByCalling;e===0?a+="by ":e===i.blocks.length-1&&(a+="and by "),a+=`its ancestor "${oe(f,s.project)}" with id "${f.id}" that calls a '${h.type}' entity with id "${h.id}"`,e<i.blocks.length-1?a+=", ":a+="."}),u.push(new Bi({id:`${s.id}--${we.UnreachableEntity}`,code:we.UnreachableEntity,severity:ve.Warning,message:`${r}${a}`,entity:s}))}}return qt(s.errors,u)}function ga(s){const u=[],i=jt(s,s.project);if(i){if(i.type===d.Project)return u}else return u;if(s.type===d.Condition&&s.parent.type===d.Condition)return u;const r=i.getDataType(null),a=qs(r,{removeDuplicates:!0}),c=a.find(f=>{var h;return((h=f==null?void 0:f.entity)==null?void 0:h.id)!==re["primitive-entity"].void.id}),e=a.every(f=>{var h;return f.isResolved&&((h=f.entity)==null?void 0:h.id)!==re["primitive-entity"].void.id});return!r||!c?u:((s.type===d.Condition||s.catchesError)&&!s.errorCalls.length&&e&&u.push(new Bi({id:`${s.id}--${be.ParentScopeRequiresReturnCurrentCatchesErrorWithNoCalls}`,code:be.ParentScopeRequiresReturnCurrentCatchesErrorWithNoCalls,severity:ve.Error,message:`This '${s.type}' entity "${oe(s,s.project)}" with id "${s.id}" catches its errors, which terminates the branch, but its parent ${i.type} "${oe(i,s.project)}" with id "${i.id}" requires a returned value.`,entity:s})),qt(s.errors,u))}function wn(s){const u=[];if(s.type===d.InputMap&&Mt.includes(s.parent.type)&&s.parent.internalCalls.some(r=>!!r.calledBy.length))return u;const i=s.project.requestActiveDynamicValue(s,!0);if((i==null?void 0:i.type)===je.Missing){const r=Dt({id:`${s.id}--${be.MissingRequiredValue}`,message:`The '${s.type}' entity "${oe(s,s.project)}" with id "${s.id}" is missing its required value before it can be executed or published.`,severity:ve.Error,code:be.MissingRequiredValue,entity:s});u.push(r.error)}return u}function ts(s){var i,r;const u=[];if(s.codeNativeValueValidation){const a=s.project.requestActiveDynamicValue(s,!0);if(a&&((i=a.value)!=null&&i.value)){const c=s.codeNativeValueValidation(s,(r=a.value)==null?void 0:r.value);u.push(...c.errors)}}return u}function Tv(s){var u;return!!((u=wn(s))!=null&&u.find(i=>i.code===be.MissingRequiredValue))}function XE(s){const u=[];if(!s.internalCalls.length)return u;const i=s.internalCalls.some(r=>r.calledBy.length||r.successCalls.length||r.errorCalls.length||r.getUsedInputs().length||r.getUsedOutputs().length);if(s.readsValue&&i){const r=Dt({id:`${s.id}--${be.VariableReadsValueAndInternalCall}`,message:`Variable "${oe(s,s.project)}" with id "${s.id}" reads a value. A variable with internal calls can't read a value.`,severity:ve.Error,code:be.VariableReadsValueAndInternalCall,entity:s});u.push(r.error)}if(s.writesValues.length&&i){const r=Dt({id:`${s.id}--${be.VariableWritesValuesAndInternalCall}`,message:`Variable "${oe(s,s.project)}" with id "${s.id}" writes values. A variable with internal calls can't write a value.`,severity:ve.Error,code:be.VariableWritesValuesAndInternalCall,entity:s});u.push(r.error)}if(s.getUsedInputs().length&&i){const r=Dt({id:`${s.id}--${be.VariableHasInputsAndInternalCall}`,message:`Variable "${oe(s,s.project)}" with id "${s.id}" has inputs. A variable with internal calls can't have inputs.`,severity:ve.Error,code:be.VariableHasInputsAndInternalCall,entity:s});u.push(r.error)}if(s.getUsedOutputs().length&&i){const r=Dt({id:`${s.id}--${be.VariableHasOutputsAndInternalCall}`,message:`Variable "${oe(s,s.project)}" with id "${s.id}" has outputs. A variable with internal calls can't have outputs.`,severity:ve.Error,code:be.VariableHasOutputsAndInternalCall,entity:s});u.push(r.error)}if(s.calledBy.length&&i){const r=Dt({id:`${s.id}--${be.VariableIsCalledAndHasInternalCall}`,message:`Variable "${oe(s,s.project)}" with id "${s.id}" is called by other entities. A variable with internal calls can't be called by other entities.`,severity:ve.Error,code:be.VariableIsCalledAndHasInternalCall,entity:s});u.push(r.error)}if([...s.successCalls,...s.errorCalls].length&&i){const r=Dt({id:`${s.id}--${be.VariableCallsOthersAndHasInternalCall}`,message:`Variable "${oe(s,s.project)}" with id "${s.id}" calls other entities. A variable with internal calls can't call other entities.`,severity:ve.Error,code:be.VariableCallsOthersAndHasInternalCall,entity:s});u.push(r.error)}return u}function xVi(s){const u=s.variableDeclarations,i=s.events.flatMap(e=>[e,...ft(e)]),r=s.functions.flatMap(e=>s.instancesList.find(f=>f.type===d.FunctionCall&&f.declaration.id===e.id)?[e,...ft(e)]:[]),a=s.entities.flatMap(e=>[e,...s.entities.reduce((f,h)=>[...f,...h.methods.flatMap(m=>[m,...ft(m)])],[])]);return DE([...u,...i,...r,...a].flatMap(e=>e.getErrors()))}function wL(s){var a,c,e,f;if(s.type!==d.InternalCall){if(!Ft.includes(s.parent.type))return!1;const h=s.parent;if(!!h.returnStatements.length)return!0;const E=((a=h.implements)==null?void 0:a.getDataType(null))||null;return!(!E||((c=E.entity)==null?void 0:c.id)===re["primitive-entity"].void.id)}if(!Ft.includes(s.parent.parent.type))return!1;const u=s.parent.parent;if(!!u.returnStatements.length)return!0;const r=((e=u.implements)==null?void 0:e.getDataType(null))||null;return!(!r||((f=r.entity)==null?void 0:f.id)===re["primitive-entity"].void.id)}function eb(s){var f,h;const u=[],i=((f=s.implements)==null?void 0:f.getDataType(null))||null,r=s.returnStatements.length,a=((h=i==null?void 0:i.entity)==null?void 0:h.id)!==re["primitive-entity"].void.id;if(ft(s).filter(m=>Rt.includes(m.type)||!wL(m)?!1:!!(!m.successCalls.length&&!m.errorCalls.length&&m.calledBy.length)).length&&(a||r)){const m=Dt({id:`${s.id}--${be.LackingReturnStatementOnSomeBranches}`,message:`The '${s.type}' entity "${oe(s,s.project)}" with id "${s.id}" is missing the required return statement by its implementation on some branches.`,severity:ve.Error,code:be.LackingReturnStatementOnSomeBranches,entity:s});u.push(m.error)}return u}function Ia(s){const u=[];if(!rr.includes(s.type)||Rt.includes(s.type)||Ft.includes(s.type)||!wL(s))return u;if(!s.successCalls.length&&!s.errorCalls.length&&s.calledBy.length){const i=Dt({id:`${s.id}--${be.LastCalledEntityMustBeReturnEntity}`,message:`The '${s.type}' entity "${oe(s,s.project)}" with id "${s.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:ve.Error,code:be.LastCalledEntityMustBeReturnEntity,entity:s});u.push(i.error)}return u}const zke=["class","function","if","else","for","while","do","switch","case","default","break","continue","return","try","catch","finally","throw","import","export","as","from","in","instanceof","typeof","yield","await","async","this","new","delete","void","with","const","let","var","public","private","protected","static","get","set","constructor","extends","implements","interface","namespace","package","abstract","readonly","module"];function tb(s,u=[ir],i=[],r){const a=[],c=r??s.name;if(!c){const m=Dt({id:`${s.id}--${we.EmptyName}`,message:`${fs[s.type].singular} "${oe(s,s.project)}" with id "${s.id}" does not have a name. Entities of type ${s.type} must have valid names.`,severity:ve.Error,code:we.EmptyName,entity:s});return a.push(m.error),a}const e=c.trim(),f=!i.some(m=>m.name===c||m.name===e);if(!f){const m=Dt({id:`${s.id}--${we.NameNotUniqueInScope}`,message:`${fs[s.type].singular} "${oe(s,s.project)}" with id "${s.id}" does not have a unique name. Entities of type ${s.type} must have valid names among all other entities of its type.`,severity:ve.Error,code:we.NameNotUniqueInScope,entity:s});a.push(m.error)}if(u.forEach(m=>{const E=m(c);if(!!i.some(_=>m(_.name||"")===E)&&f){const _=Dt({id:`${s.id}--${we.NameAsResolvedCodeNameNotUniqueInScope}`,message:`${fs[s.type].singular} "${oe(s,s.project)}" with id "${s.id}" does not have a unique name once it is resolved as it will appear in code: "${E}". Entities of type ${s.type} must have valid names including their code name form.`,severity:ve.Error,code:we.NameAsResolvedCodeNameNotUniqueInScope,entity:s});a.push(_.error)}if(zke.find(_=>_===E)){const _=Dt({id:`${s.id}--${we.NameIsForbiddenKeyword}`,message:`${fs[s.type].singular} "${oe(s,s.project)}" with id "${s.id}" has a name that is a forbidden keyword: "${E}". Entities of type ${s.type} must not use reserved keywords as names.`,severity:ve.Error,code:we.NameIsForbiddenKeyword,entity:s});a.push(_.error)}}),!/^[a-zA-Z_]/.test(c)){const m=Dt({id:`${s.id}--${we.NameMustStartWithLetterOrUnderscore}`,message:`${fs[s.type].singular} "${oe(s,s.project)}" with id "${s.id}" has a name that does not start with a letter or underscore.`,severity:ve.Error,code:we.NameMustStartWithLetterOrUnderscore,entity:s});a.push(m.error)}return a}async function Yke(s,u={}){var e,f;const i=J.YieldTracker.from(u),r=[];let a=[];if(s.entity&&a.push("entity"),s.andChildrenGroup&&a.push("andChildrenGroup"),s.orChildrenGroup&&a.push("orChildrenGroup"),s.foreignKeyRef&&a.push("foreignKeyRef"),s.foreignKeyAllowed&&a.push("foreignKeyAllowed"),a.length>1){const h=Dt({id:s.id+"--"+be.InvalidPropertiesCombination,message:`Data type with id "${s.id}" has invalid properties combination. Only one of the following properties can be present at the time: 'entity', 'andChildrenGroup', 'orChildrenGroup', 'foreignKeyRef' or 'foreignKeyAllowed'.
|
|
606
606
|
|
|
607
607
|
Currently present fields: "${At(a,'", "','" and "')}".`,severity:ve.Error,code:be.InvalidPropertiesCombination,entity:s});r.push(h.error)}if(((e=s.entity)==null?void 0:e.type)===d.PrimitiveEntity&&s.entity.id===re["primitive-entity"].enum.id&&!((f=s.options)!=null&&f.length)){const h=Dt({id:s.id+"--"+be.MissingEnumOptions,message:`Data type with id "${s.id}" is an enum but has no options.`,severity:ve.Error,code:be.MissingEnumOptions,entity:s});r.push(h.error)}const c=qt(s.errors,r);await i.tick();for(const h of s.andChildrenGroup||[])await h.validateAsync({tracker:i});for(const h of s.orChildrenGroup||[])await h.validateAsync({tracker:i});return c}function Jke(s){var r,a;const u=[];let i=[];if(s.entity&&i.push("entity"),s.andChildrenGroup&&i.push("andChildrenGroup"),s.orChildrenGroup&&i.push("orChildrenGroup"),s.foreignKeyRef&&i.push("foreignKeyRef"),s.foreignKeyAllowed&&i.push("foreignKeyAllowed"),i.length>1){const c=Dt({id:s.id+"--"+be.InvalidPropertiesCombination,message:`Data type with id "${s.id}" has invalid properties combination. Only one of the following properties can be present at the time: 'entity', 'andChildrenGroup', 'orChildrenGroup', 'foreignKeyRef' or 'foreignKeyAllowed'.
|
|
608
608
|
|
package/dist/index.js
CHANGED
|
@@ -183229,6 +183229,8 @@ function $a(s) {
|
|
|
183229
183229
|
return u;
|
|
183230
183230
|
} else
|
|
183231
183231
|
return u;
|
|
183232
|
+
if (s.type === d.Condition && s.parent.type === d.Condition)
|
|
183233
|
+
return u;
|
|
183232
183234
|
const r = i.getDataType(null), a = bl(r, {
|
|
183233
183235
|
removeDuplicates: !0
|
|
183234
183236
|
}), c = a.find(
|
|
@@ -183246,7 +183248,7 @@ function $a(s) {
|
|
|
183246
183248
|
new Zi({
|
|
183247
183249
|
id: `${s.id}--${Ee.ParentScopeRequiresReturnCurrentCatchesErrorWithNoCalls}`,
|
|
183248
183250
|
code: Ee.ParentScopeRequiresReturnCurrentCatchesErrorWithNoCalls,
|
|
183249
|
-
severity: ve.
|
|
183251
|
+
severity: ve.Error,
|
|
183250
183252
|
message: `This '${s.type}' entity "${le(
|
|
183251
183253
|
s,
|
|
183252
183254
|
s.project
|
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.6990",
|
|
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",
|