@elyx-code/project-logic-tree 0.0.6924 → 0.0.6926

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 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 c,e;const p=[],i=((c=s.implements)==null?void 0:c.getDataType(null))||null;if(!i||((e=i.entity)==null?void 0:e.id)===ne["primitive-entity"].void.id)return p;if(pt(s).filter(f=>At.includes(f.type)||!mL(f)?!1:!!(!f.successCalls.length&&!f.errorCalls.length&&f.calledBy.length)).length){const f=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(f.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'.
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){const p=[];if(pt(s).filter(a=>At.includes(a.type)||!mL(a)?!1:!!(!a.successCalls.length&&!a.errorCalls.length&&a.calledBy.length)).length){const a=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(a.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.d.ts CHANGED
@@ -21282,6 +21282,9 @@ export declare enum BaseValueDescriptorIds {
21282
21282
  identifier: string;
21283
21283
  createdAt: string;
21284
21284
  project: string;
21285
+ selfId: EntityId;
21286
+ selfType: EntityType;
21287
+ selfVersion: EntityVersion;
21285
21288
  }
21286
21289
 
21287
21290
  export declare interface IArgumentDeclaration extends IArgumentDeclaration_meta, IBaseVariable, IChildEntity, IValueWritingEntity {
@@ -21622,6 +21625,9 @@ export declare enum BaseValueDescriptorIds {
21622
21625
  versionId: string;
21623
21626
  timestamp: string;
21624
21627
  actionName: string | null;
21628
+ selfId: EntityId;
21629
+ selfType: EntityType;
21630
+ selfVersion: EntityVersion;
21625
21631
  }
21626
21632
 
21627
21633
  export declare interface IBranchMerge {
package/dist/index.js CHANGED
@@ -179542,14 +179542,11 @@ 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 c, e;
179546
- const p = [], i = ((c = s.implements) == null ? void 0 : c.getDataType(null)) || null;
179547
- if (!i || ((e = i.entity) == null ? void 0 : e.id) === re["primitive-entity"].void.id)
179548
- return p;
179549
- if (ct(s).filter((f) => gt.includes(f.type) || !S6(
179550
- f
179551
- ) ? !1 : !!(!f.successCalls.length && !f.errorCalls.length && f.calledBy.length)).length) {
179552
- const f = Rt({
179545
+ const p = [];
179546
+ if (ct(s).filter((a) => gt.includes(a.type) || !S6(
179547
+ a
179548
+ ) ? !1 : !!(!a.successCalls.length && !a.errorCalls.length && a.calledBy.length)).length) {
179549
+ const a = Rt({
179553
179550
  id: `${s.id}--${Ee.LackingReturnStatementOnSomeBranches}`,
179554
179551
  message: `The '${s.type}' entity "${le(
179555
179552
  s,
@@ -179559,7 +179556,7 @@ function A1(s) {
179559
179556
  code: Ee.LackingReturnStatementOnSomeBranches,
179560
179557
  entity: s
179561
179558
  });
179562
- p.push(f.error);
179559
+ p.push(a.error);
179563
179560
  }
179564
179561
  return p;
179565
179562
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elyx-code/project-logic-tree",
3
- "version": "0.0.6924",
3
+ "version": "0.0.6926",
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",