@elyx-code/project-logic-tree 0.0.6925 → 0.0.6927
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 +7 -9
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -589,7 +589,7 @@ The only use for declaring global callable entities is for a 'variable-declarati
|
|
|
589
589
|
Or for a logic that the user is going to manually test themselves by clicking on the user-interface.`,entity:s}));else{const i=YT(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+=`
|
|
590
590
|
This is because there are termination statements in the call chain before reaching this '${s.type}'.
|
|
591
591
|
If a caller entity calls a termination statement, it will always prevent all other calls from executing.`;let a=`
|
|
592
|
-
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+="."}),p.push(new Ki({id:`${s.id}--${Ce.UnreachableEntity}`,code:Ce.UnreachableEntity,severity:ve.Warning,message:`${r}${a}`,entity:s}))}}return Zt(s.errors,p)}function In(s){const p=[];if(s.type===d.InputMap&&Bt.includes(s.parent.type)&&s.parent.internalCalls.some(r=>!!r.calledBy.length))return p;const i=s.project.requestActiveDynamicValue(s,!0);if((i==null?void 0:i.type)===Be.Missing){const r=gt({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});p.push(r.error)}return p}function Qa(s){var i,r;const p=[];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);p.push(...c.errors)}}return p}function cv(s){var p;return!!((p=In(s))!=null&&p.find(i=>i.code===be.MissingRequiredValue))}function WE(s){const p=[];if(!s.internalCalls.length)return p;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=gt({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});p.push(r.error)}if(s.writesValues.length&&i){const r=gt({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});p.push(r.error)}if(s.getUsedInputs().length&&i){const r=gt({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});p.push(r.error)}if(s.getUsedOutputs().length&&i){const r=gt({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});p.push(r.error)}if(s.calledBy.length&&i){const r=gt({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});p.push(r.error)}if([...s.successCalls,...s.errorCalls].length&&i){const r=gt({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});p.push(r.error)}return p}function AVi(s){const p=s.variableDeclarations,i=s.events.flatMap(e=>[e,...pt(e)]),r=s.functions.flatMap(e=>s.instancesList.find(f=>f.type===d.FunctionCall&&f.declaration.id===e.id)?[e,...pt(e)]:[]),a=s.entities.flatMap(e=>[e,...s.entities.reduce((f,h)=>[...f,...h.methods.flatMap(m=>[m,...pt(m)])],[])]);return bE([...p,...i,...r,...a].flatMap(e=>e.getErrors()))}function mL(s){var r,a,c,e;if(s.type!==d.InternalCall){if(!kt.includes(s.parent.type))return!1;const h=((r=s.parent.implements)==null?void 0:r.getDataType(null))||null;return!(!h||((a=h.entity)==null?void 0:a.id)===ne["primitive-entity"].void.id)}if(!kt.includes(s.parent.parent.type))return!1;const i=((c=s.parent.parent.implements)==null?void 0:c.getDataType(null))||null;return!(!i||((e=i.entity)==null?void 0:e.id)===ne["primitive-entity"].void.id)}function zE(s){var
|
|
592
|
+
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+="."}),p.push(new Ki({id:`${s.id}--${Ce.UnreachableEntity}`,code:Ce.UnreachableEntity,severity:ve.Warning,message:`${r}${a}`,entity:s}))}}return Zt(s.errors,p)}function In(s){const p=[];if(s.type===d.InputMap&&Bt.includes(s.parent.type)&&s.parent.internalCalls.some(r=>!!r.calledBy.length))return p;const i=s.project.requestActiveDynamicValue(s,!0);if((i==null?void 0:i.type)===Be.Missing){const r=gt({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});p.push(r.error)}return p}function Qa(s){var i,r;const p=[];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);p.push(...c.errors)}}return p}function cv(s){var p;return!!((p=In(s))!=null&&p.find(i=>i.code===be.MissingRequiredValue))}function WE(s){const p=[];if(!s.internalCalls.length)return p;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=gt({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});p.push(r.error)}if(s.writesValues.length&&i){const r=gt({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});p.push(r.error)}if(s.getUsedInputs().length&&i){const r=gt({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});p.push(r.error)}if(s.getUsedOutputs().length&&i){const r=gt({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});p.push(r.error)}if(s.calledBy.length&&i){const r=gt({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});p.push(r.error)}if([...s.successCalls,...s.errorCalls].length&&i){const r=gt({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});p.push(r.error)}return p}function AVi(s){const p=s.variableDeclarations,i=s.events.flatMap(e=>[e,...pt(e)]),r=s.functions.flatMap(e=>s.instancesList.find(f=>f.type===d.FunctionCall&&f.declaration.id===e.id)?[e,...pt(e)]:[]),a=s.entities.flatMap(e=>[e,...s.entities.reduce((f,h)=>[...f,...h.methods.flatMap(m=>[m,...pt(m)])],[])]);return bE([...p,...i,...r,...a].flatMap(e=>e.getErrors()))}function mL(s){var r,a,c,e;if(s.type!==d.InternalCall){if(!kt.includes(s.parent.type))return!1;const h=((r=s.parent.implements)==null?void 0:r.getDataType(null))||null;return!(!h||((a=h.entity)==null?void 0:a.id)===ne["primitive-entity"].void.id)}if(!kt.includes(s.parent.parent.type))return!1;const i=((c=s.parent.parent.implements)==null?void 0:c.getDataType(null))||null;return!(!i||((e=i.entity)==null?void 0:e.id)===ne["primitive-entity"].void.id)}function zE(s){var f,h;const p=[],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)!==ne["primitive-entity"].void.id;if(pt(s).filter(m=>At.includes(m.type)||!mL(m)?!1:!!(!m.successCalls.length&&!m.errorCalls.length&&m.calledBy.length)).length&&(a||r)){const m=gt({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});p.push(m.error)}return p}function ga(s){const p=[];if(!rr.includes(s.type)||At.includes(s.type)||kt.includes(s.type)||!mL(s))return p;if(!s.successCalls.length&&!s.errorCalls.length&&s.calledBy.length){const i=gt({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});p.push(i.error)}return p}const Gje=["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 YE(s,p=[Xi],i=[],r){const a=[],c=r??s.name;if(!c){const m=gt({id:`${s.id}--${Ce.EmptyName}`,message:`${us[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:Ce.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=gt({id:`${s.id}--${Ce.NameNotUniqueInScope}`,message:`${us[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:Ce.NameNotUniqueInScope,entity:s});a.push(m.error)}if(p.forEach(m=>{const E=m(c);if(!!i.some(_=>m(_.name||"")===E)&&f){const _=gt({id:`${s.id}--${Ce.NameAsResolvedCodeNameNotUniqueInScope}`,message:`${us[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:Ce.NameAsResolvedCodeNameNotUniqueInScope,entity:s});a.push(_.error)}if(Gje.find(_=>_===E)){const _=gt({id:`${s.id}--${Ce.NameIsForbiddenKeyword}`,message:`${us[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:Ce.NameIsForbiddenKeyword,entity:s});a.push(_.error)}}),!/^[a-zA-Z_]/.test(c)){const m=gt({id:`${s.id}--${Ce.NameMustStartWithLetterOrUnderscore}`,message:`${us[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:Ce.NameMustStartWithLetterOrUnderscore,entity:s});a.push(m.error)}return a}async function kje(s,p={}){var e,f;const i=z.YieldTracker.from(p),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=gt({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'.
|
|
593
593
|
|
|
594
594
|
Currently present fields: "${vt(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===ne["primitive-entity"].enum.id&&!((f=s.options)!=null&&f.length)){const h=gt({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=Zt(s.errors,r);return await i.tick(),c}function jje(s){var r,a;const p=[];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=gt({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'.
|
|
595
595
|
|
package/dist/index.js
CHANGED
|
@@ -179542,14 +179542,12 @@ function S6(s) {
|
|
|
179542
179542
|
return !(!i || ((e = i.entity) == null ? void 0 : e.id) === re["primitive-entity"].void.id);
|
|
179543
179543
|
}
|
|
179544
179544
|
function A1(s) {
|
|
179545
|
-
var
|
|
179546
|
-
const p = [], i = ((
|
|
179547
|
-
if (
|
|
179548
|
-
|
|
179549
|
-
|
|
179550
|
-
|
|
179551
|
-
) ? !1 : !!(!f.successCalls.length && !f.errorCalls.length && f.calledBy.length)).length) {
|
|
179552
|
-
const f = Rt({
|
|
179545
|
+
var f, h;
|
|
179546
|
+
const p = [], 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;
|
|
179547
|
+
if (ct(s).filter((m) => gt.includes(m.type) || !S6(
|
|
179548
|
+
m
|
|
179549
|
+
) ? !1 : !!(!m.successCalls.length && !m.errorCalls.length && m.calledBy.length)).length && (a || r)) {
|
|
179550
|
+
const m = Rt({
|
|
179553
179551
|
id: `${s.id}--${Ee.LackingReturnStatementOnSomeBranches}`,
|
|
179554
179552
|
message: `The '${s.type}' entity "${le(
|
|
179555
179553
|
s,
|
|
@@ -179559,7 +179557,7 @@ function A1(s) {
|
|
|
179559
179557
|
code: Ee.LackingReturnStatementOnSomeBranches,
|
|
179560
179558
|
entity: s
|
|
179561
179559
|
});
|
|
179562
|
-
p.push(
|
|
179560
|
+
p.push(m.error);
|
|
179563
179561
|
}
|
|
179564
179562
|
return p;
|
|
179565
179563
|
}
|
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.6927",
|
|
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",
|