@elyx-code/project-logic-tree 0.0.6992 → 0.0.6993

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
@@ -3,7 +3,7 @@ Please provide a unique 'name' string.`,severity:ve.Error,code:we.NameNotUniqueI
3
3
  Please provide a unique 'name' string.`,severity:ve.Error,code:we.NameNotUniqueInScope}))}return i}function kx(s,u){const i=[];s.name||i.push(new Ce({id:`${s.id}--${we.EmptyName}`,message:`Entity with id "${s.id}" and type "${s.type}" has an empty name. Please provide a 'name' string.`,severity:ve.Error,code:we.EmptyName}));const r=s.parent&&Da(s.parent,u)||u;if(!r)i.push(new Ce({id:`${s.id}--parent-reference--${me.ReferencedEntityNotFound}`,message:`The entity with id '${s.parent}' that isn't yet found in the project. Perhaps it should be created first. Or perhaps the ID is incorrect.`,severity:ve.Error,code:me.ReferencedEntityNotFound}));else{const c=Bx(r).filter(e=>e.name===s.name);c.length&&i.push(new Ce({id:`${s.id}--${we.NameNotUniqueInScope}`,message:`Entity with id "${s.id}" and type "${s.type}" has a name "${s.name}" that is not unique in its scope or higher scopes. Entity with id "${c[0].id}" has the same name.
4
4
  Please provide a unique 'name' string.`,severity:ve.Error,code:we.NameNotUniqueInScope}))}return i}function Ux(s,u){const i=[];s.name||i.push(new Ce({id:`${s.id}--${we.EmptyName}`,message:`Entity with id "${s.id}" and type "${s.type}" has an empty name. Please provide a 'name' string.`,severity:ve.Error,code:we.EmptyName}));const r=re(s.parent);if(!r)i.push(new Ce({id:`${s.id}--parent-reference--${me.InvalidReferenceObjectStructure}`,message:`Reference object at 'parent' property for entity with id "${s.id}" and type "${s.type}" is not a valid reference. A reference needs to be a 'id' string of an existing entity in the project.`,severity:ve.Error,code:me.InvalidReferenceObjectStructure}));else{const a=u.get(r);if(!a)i.push(new Ce({id:`${s.id}--parent-reference--${me.ReferencedEntityNotFound}`,message:`The entity with id '${r}' that isn't yet found in the project. Perhaps it should be created first. Or perhaps the ID is incorrect.`,severity:ve.Error,code:me.ReferencedEntityNotFound}));else{const e=a.properties.filter(f=>f.name===s.name);e.length&&i.push(new Ce({id:`${s.id}--${we.NameNotUniqueInScope}`,message:`Entity with id "${s.id}" and type "${s.type}" has a name "${s.name}" that is not unique among all properties in the parent entity. Entity with id "${e[0].id}" has the same name.
5
5
  Please provide a unique 'name' string.`,severity:ve.Error,code:we.NameNotUniqueInScope}))}}return i}function Fx(s,u){const i=[];s.name||i.push(new Ce({id:`${s.id}--${we.EmptyName}`,message:`Entity with id "${s.id}" and type "${s.type}" has an empty name. Please provide a 'name' string.`,severity:ve.Error,code:we.EmptyName}));const r=re(s.parent);if(!r)i.push(new Ce({id:`${s.id}--parent-reference--${me.InvalidReferenceObjectStructure}`,message:`Reference object at 'parent' property for entity with id "${s.id}" and type "${s.type}" is not a valid reference. A reference needs to be a 'id' string of an existing entity in the project.`,severity:ve.Error,code:me.InvalidReferenceObjectStructure}));else{const a=u.get(r);if(!a)i.push(new Ce({id:`${s.id}--parent-reference--${me.ReferencedEntityNotFound}`,message:`The entity with id '${r}' that isn't yet found in the project. Perhaps it should be created first. Or perhaps the ID is incorrect.`,severity:ve.Error,code:me.ReferencedEntityNotFound}));else{const e=GL(a).filter(f=>f.name===s.name);e.length&&i.push(new Ce({id:`${s.id}--${we.NameNotUniqueInScope}`,message:`Entity with id "${s.id}" and type "${s.type}" has a name "${s.name}" that is not unique among all inputs declared in the parent entity. Entity with id "${e[0].id}" has the same name.
6
- Please provide a unique 'name' string.`,severity:ve.Error,code:we.NameNotUniqueInScope}))}}return i}function igi(s,u){switch(s.type){case d.DefinitionEntity:return Gx(s,u);case d.FunctionDeclaration:return jx(s,u);case d.VariableDeclaration:return kx(s,u);case d.Property:return Ux(s,u);case d.ArgumentDeclaration:return Fx(s,u);default:return[]}}function Dp(s,u){var r;const i=s;switch(s.type){case d.FunctionCall:case d.InternalCall:return Da(s.declaration,u).codeName;case d.ActionDescriptor:case d.DefinitionEntity:case d.VariableDeclaration:case d.ValueDescriptor:case d.FunctionDeclaration:return s.codeName||null;case d.Property:case d.ArgumentDeclaration:{if(s.codeName)return s.codeName;if((r=s.implements)!=null&&r.length){const a=s.implements.find(c=>{const e=Da(c,u);return!!(e!=null&&e.codeName)});if(a)return Da(a,u).codeName||null}break}case d.InputMap:case d.OutputMap:case d.VariableInstance:{if(s.declaration){const a=Da(s.declaration,u);return Dp(a,u)||""}break}}return i.codeName||null}function du(s,u){let i=s;if(!!u.some(a=>a.name===i)){const a=s.split(" "),c=a.pop()||"",e=parseInt(c);return!isNaN(e)?a.push(`${e+1}`):(a.push(c),a.push("1")),i=a.join(" "),du(i,u)}return i}function k_e(s,u){const r=s.project.getDefinitionEntities(new Set([s.id])).filter(a=>a.id!==s.id&&a.name.toLowerCase()===s.name.toLowerCase());if(r.length){const a=du(s.name,r);s.metaSync({name:a},u)}}function rgi(s){switch(s){case dt.List:return"Loop over list items";case dt.ManualFlow:return"Manual flow control loop";case dt.ObjectKeys:return"Loop over object keys";case dt.ObjectValues:return"Loop over object values";case dt.Counted:return"Loop given number of times";case dt.String:return"Loop over text characters";case Ut.PrimitiveEqual:return"Is equal to";case Ut.PrimitiveNotEqual:return"Is not equal to";case Ut.Empty:return"Is empty";case Ut.NotEmpty:return"Is present";case xe.DeleteKey:return"Delete property from object";case xe.DeleteNestedKey:return"Delete nested property from object";case xe.HasKey:return"Check if object has property";case xe.HasNestedKey:return"Check if object has nested property";case xe.IsInstanceOfType:return"Check if object is instance of type";case xe.KeyValueEquals:return"Check if object property equals value";case xe.NestedKeyValueEquals:return"Check if object nested property equals value";case xe.ReadKey:return"Read property from object";case xe.ReadNestedKey:return"Read nested property from object";case xe.Validate:return"Validate object structure";case xe.WriteKey:return"Write property to object";case xe.WriteNestedKey:return"Write nested property to object";case xe.WriteSafeNestedKeyRecursively:return"Write safe nested property to object recursively";case xe.Merge:return"Merge objects";case xe.Entries:return"Get a list with the object keys, and values";case xe.Keys:return"Get a list with the object keys";case xe.Values:return"Get a list with the object values";case Qe.DecodeBase64:return"Decode Base64 text to bytes";case Qe.EncodeBase64:return"Encode bytes to Base64 text";case Qe.DecodeBase64Url:return"Decode Base64URL text to bytes";case Qe.EncodeBase64Url:return"Encode bytes to Base64URL text";case Qe.DecodeHex:return"Decode Hex text to bytes";case Qe.EncodeHex:return"Encode bytes to Hex text";case Qe.FromBytesToString:return"Convert bytes to text";case Qe.ToBytes:return"Convert text to bytes";case Qe.ToString:return"Convert value to text";case Qe.GetTypeOf:return"Get data type of value";case Qe.ToNumber:return"Convert value to number";case pe.Addition:return"Sum numbers";case pe.Subtraction:return"Subtract numbers";case pe.Multiplication:return"Multiply numbers";case pe.Division:return"Divide numbers";case pe.Remainder:return"Get remainder of numbers";case pe.Absolute:return"Get absolute value of numbers";case pe.Acos:return"Get arc cosine of numbers";case pe.Asin:return"Get arc sine of numbers";case pe.Atan:return"Get arc tangent of numbers";case pe.Ceil:return"Round numbers up";case pe.Cos:return"Get cosine of numbers";case pe.Floor:return"Round numbers down";case pe.LogNatural:return"Get natural logarithm of numbers";case pe.Log10:return"Get base-10 logarithm of numbers";case pe.MaxOf:return"Get maximum of numbers";case pe.MinOf:return"Get minimum of numbers";case pe.Round:return"Round numbers to nearest integer";case pe.Sin:return"Get sine of numbers";case pe.SquareRoot:return"Get square root of numbers";case pe.Tan:return"Get tangent of numbers";case pe.Negate:return"Negate numbers";case pe.Atan2:return"Get arc tangent of two numbers";case pe.Exp:return"Get exponential of numbers";case pe.Average:return"Get average of numbers";case pe.Clamp:return"Clamp numbers within range";case pe.CubeRoot:return"Get cube root of numbers";case pe.LessThan:return"Check if numbers are less than";case pe.LessThanOrEqual:return"Check if numbers are less than or equal to";case pe.MoreThan:return"Check if numbers are more than";case pe.MoreThanOrEqual:return"Check if numbers are more than or equal to";case pe.MapRange:return"Map numbers from one range to another";case pe.Median:return"Get median of numbers";case pe.NthRoot:return"Get nth root of numbers";case pe.PercentOf:return"Get percentage of numbers";case pe.PercentageChange:return"Get percentage change between numbers";case pe.RoundToDecimals:return"Round numbers to given decimal places";case pe.Sign:return"Get sign of numbers";case pe.SnapToStep:return"Snap numbers to nearest step";case tt.GenerateRandomBase64:return"Generate random Base64 text";case tt.GenerateRandomBytes:return"Generate random bytes";case tt.GenerateRandomFloat:return"Generate random decimal number";case tt.GenerateRandomInteger:return"Generate random whole number";case tt.GenerateRandomHexadecimal:return"Generate random hexadecimal text";case tt.GenerateRandomUUIDv4:return"Generate random UUID v4";case tt.GenerateShortIdentifier:return"Generate short unique identifier";case bl.PROJECT_PUBLICATION_COMPLETED:return"Project publication completed";default:return null}}function U_e(s,u,i){const a=`${Gg(s)}-${u}-id`;return i.instances[a]?x.UUID.uuid():a}function M_(s,u){let i="",r=null;if(s.parent){const c=u.get(s.parent);c&&(r=c)}let a="";return r&&(a=`${Gg(le(r,u))}-`),i=`${a}${Gg(le(s,u))}-id`,u.instances[i]?x.UUID.uuid():i}function pn(s,u,i="uuid"){return i==="semantic"?U_e(le(s,u),s.type,u):x.UUID.uuid()}const ngi=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;function Kx(s){return typeof s=="string"&&ngi.test(s)}const agi=/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;function G_(s){return typeof s=="string"&&agi.test(s)}function sgi(s){return s instanceof Error&&s.name==="ZodError"&&"issues"in s&&Array.isArray(s.issues)}var lgi=class extends Error{constructor(u,i){super(u,i);R(this,"name");R(this,"details");this.name="ZodValidationError",this.details=ogi(i)}toString(){return this.message}};function ogi(s){if(s){const u=s.cause;if(sgi(u))return u.issues}return[]}function dgi(s){return s.length!==0}function Qk(s){return s.description??""}var ugi=/[$_\p{ID_Start}][$\u200c\u200d\p{ID_Continue}]*/u;function pgi(s){if(s.length===1){let u=s[0];return typeof u=="symbol"&&(u=Qk(u)),u.toString()||'""'}return s.reduce((u,i)=>{if(typeof i=="number")return u+"["+i.toString()+"]";if(typeof i=="symbol"&&(i=Qk(i)),i.includes('"'))return u+'["'+cgi(i)+'"]';if(!ugi.test(i))return u+'["'+i+'"]';const r=u.length===0?"":".";return u+r+i},"")}function cgi(s){return s.replace(/"/g,'\\"')}var fgi="; ",ygi=99,F_e="Validation error",hgi=": ",mgi=", or ";function Tgi(s={}){const{issueSeparator:u=fgi,unionSeparator:i=mgi,prefixSeparator:r=hgi,prefix:a=F_e,includePath:c=!0,maxIssuesInMessage:e=ygi}=s;return f=>{const h=f.slice(0,e).map(m=>hg({issue:m,issueSeparator:u,unionSeparator:i,includePath:c})).join(u);return vgi(h,a,r)}}function hg(s){const{issue:u,issueSeparator:i,unionSeparator:r,includePath:a}=s;if(u.code===ot.invalid_union)return u.unionErrors.reduce((c,e)=>{const f=e.issues.map(h=>hg({issue:h,issueSeparator:i,unionSeparator:r,includePath:a})).join(i);return c.includes(f)||c.push(f),c},[]).join(r);if(u.code===ot.invalid_arguments)return[u.message,...u.argumentsError.issues.map(c=>hg({issue:c,issueSeparator:i,unionSeparator:r,includePath:a}))].join(i);if(u.code===ot.invalid_return_type)return[u.message,...u.returnTypeError.issues.map(c=>hg({issue:c,issueSeparator:i,unionSeparator:r,includePath:a}))].join(i);if(a&&dgi(u.path)){if(u.path.length===1){const c=u.path[0];if(typeof c=="number")return`${u.message} at index ${c}`}return`${u.message} at "${pgi(u.path)}"`}return u.message}function vgi(s,u,i){return u!==null?s.length>0?[u,s].join(i):u:s.length>0?s:F_e}function Egi(s,u={}){const r=bgi(u)([s]);return new lgi(r,{cause:new yd([s])})}function bgi(s){return"messageBuilder"in s?s.messageBuilder:Tgi(s)}async function K_e(s,u={}){var c;const i=J.YieldTracker.from(u),r=[...wn(s),...is(s)];await i.tick();const a=Kt(s.errors,r);return await((c=s.dataType)==null?void 0:c.validateAsync({tracker:i})),a}function q_e(s){var i;(i=s.dataType)==null||i.validate();const u=[...wn(s),...is(s)];return Kt(s.errors,u)}const Agi=Object.freeze(Object.defineProperty({__proto__:null,validate:q_e,validateAsync:K_e},Symbol.toStringTag,{value:"Module"}));function S_e(s){return s.listAdded.forEach(u=>{const i=s.project.get(u.id);(i==null?void 0:i.type)===d.DefinitionEntity&&i.parent.type!==d.DataType&&(s.project.emit(pi.EXPLICIT_DEFINITION_ENTITY_ADDED,i,s),ui(i,ge.PERSISTED_ENTITY)?s.project.emit(pi.PERSISTED_DEFINITION_ENTITY_ADDED,i,s):ui(i,ge.RELATIONAL_DATABASE)&&s.project.emit(pi.RELATIONAL_DATABASE_DEFINITION_ENTITY_ADDED,i,s))}),s.listUpdated.forEach(u=>{const i=s.project.get(u.id);(i==null?void 0:i.type)===d.DefinitionEntity&&i.parent.type!==d.DataType&&(s.project.emit(pi.EXPLICIT_DEFINITION_ENTITY_UPDATED,i,s),ui(i,ge.PERSISTED_ENTITY)?s.project.emit(pi.PERSISTED_DEFINITION_ENTITY_UPDATED,i,s):ui(i,ge.RELATIONAL_DATABASE)&&s.project.emit(pi.RELATIONAL_DATABASE_DEFINITION_ENTITY_UPDATED,i,s))}),s.listRemoved.forEach(u=>{const i=s.project.get(u.id)||s.project.getDeleted(u.id);(i==null?void 0:i.type)===d.DefinitionEntity&&i.parent.type!==d.DataType&&(s.project.emit(pi.EXPLICIT_DEFINITION_ENTITY_REMOVED,i,s),ui(i,ge.PERSISTED_ENTITY)?s.project.emit(pi.PERSISTED_DEFINITION_ENTITY_REMOVED,i,s):ui(i,ge.RELATIONAL_DATABASE)&&s.project.emit(pi.RELATIONAL_DATABASE_DEFINITION_ENTITY_REMOVED,i,s))}),s}async function Z_e(s,u={}){const i=J.YieldTracker.from(u),r=[];for(const a of s.listAdded){const c=s.project.get(a.id);(c==null?void 0:c.type)===d.DefinitionEntity&&c.parent.type!==d.DataType&&(r.push(s.project.emitAsync(pi.EXPLICIT_DEFINITION_ENTITY_ADDED,c,s)),ui(c,ge.PERSISTED_ENTITY)?r.push(s.project.emitAsync(pi.PERSISTED_DEFINITION_ENTITY_ADDED,c,s)):ui(c,ge.RELATIONAL_DATABASE)&&r.push(s.project.emitAsync(pi.RELATIONAL_DATABASE_DEFINITION_ENTITY_ADDED,c,s))),await i.tick()}for(const a of s.listUpdated){const c=s.project.get(a.id);(c==null?void 0:c.type)===d.DefinitionEntity&&c.parent.type!==d.DataType&&(r.push(s.project.emitAsync(pi.EXPLICIT_DEFINITION_ENTITY_UPDATED,c,s)),ui(c,ge.PERSISTED_ENTITY)?r.push(s.project.emitAsync(pi.PERSISTED_DEFINITION_ENTITY_UPDATED,c,s)):ui(c,ge.RELATIONAL_DATABASE)&&r.push(s.project.emitAsync(pi.RELATIONAL_DATABASE_DEFINITION_ENTITY_UPDATED,c,s))),await i.tick()}for(const a of s.listRemoved){const c=s.project.get(a.id)||s.project.getDeleted(a.id);(c==null?void 0:c.type)===d.DefinitionEntity&&c.parent.type!==d.DataType&&(r.push(s.project.emitAsync(pi.EXPLICIT_DEFINITION_ENTITY_REMOVED,c,s)),ui(c,ge.PERSISTED_ENTITY)?r.push(s.project.emitAsync(pi.PERSISTED_DEFINITION_ENTITY_REMOVED,c,s)):ui(c,ge.RELATIONAL_DATABASE)&&r.push(s.project.emitAsync(pi.RELATIONAL_DATABASE_DEFINITION_ENTITY_REMOVED,c,s))),await i.tick()}return await Promise.all(r),s}var E1=(s=>(s.Manual="manual",s.Automatic="automatic",s))(E1||{}),H=(s=>(s.Added="added",s.Updated="updated",s.Removed="removed",s.Affected="affected",s))(H||{}),w=(s=>(s.AddSuccessCall="add-success-call",s.AddErrorCall="add-error-call",s.AddCall="add-call",s.SetParent="set-parent",s.SetStandaloneParent="set-standalone-parent",s.AfterAllChildrenInitialized="after-all-children-initialized",s.UpdateWithShallowTransfer="update-with-shallow-transfer",s.UpdateWithGenerationTarget="update-with-generation-target",s.RemoveFromParent="remove-from-parent",s.RemoveEntity="remove-entity",s.RestoreEntity="restore-entity",s.CloneEntity="clone-entity",s.AddInput="add-input",s.RemoveInput="remove-input",s.SetDataType="set-data-type",s.RemoveDataType="remove-data-type",s.SetAdditionalPropertiesDataType="set-additional-properties-data-type",s.RemoveAdditionalPropertiesDataType="remove-additional-properties-data-type",s.SetAllPropertiesImplement="set-all-properties-implement",s.RemoveAllPropertiesImplement="remove-all-properties-implement",s.RemoveValueReader="remove-value-reader",s.AddValueReader="add-value-reader",s.RemoveValueWriter="remove-value-writer",s.SetValueWriter="set-value-writer",s.AddEntryCaller="add-entry-caller",s.AddSuccessCaller="add-success-caller",s.AddErrorCaller="add-error-caller",s.RemoveCall="remove-call",s.RemoveCaller="remove-caller",s.RemoveChildGroup="remove-child-group",s.AddToAndGroup="add-to-and-group",s.AddToOrGroup="add-to-or-group",s.RemoveUnrecognizedInputs="remove-unrecognized-inputs",s.RemoveUnrecognizedOutputs="remove-unrecognized-outputs",s.SyncInputs="sync-inputs",s.SyncOutputs="sync-outputs",s.SetImplements="set-implements",s.SetExtends="set-extends",s.SetExtension="set-extension",s.AddImplementation="add-implementation",s.RemoveImplementation="remove-implementation",s.AddProperty="add-property",s.RemoveProperty="remove-property",s.AddMethod="add-method",s.RemoveMethod="remove-method",s.AddAbstractMethod="add-abstract-method",s.RemoveAbstractMethod="remove-abstract-method",s.SetValueAsTypeSingle="set-value-as-type-single",s.SetValueAsTypeList="set-value-as-type-list",s.SetValueAsType="set-value-as-type",s.RemoveErrorCatching="remove-error-catching",s.RemoveAllErrorCallers="remove-all-error-callers",s.RemoveAllSuccessCallers="remove-all-success-callers",s.RemoveAllCallers="remove-all-callers",s.RemoveAllErrorCalls="remove-all-error-calls",s.SetDataTypeEntityValue="set-data-type-entity-value",s.MergeDataTypes="merge-data-types",s.SetDataTypeForeignKeyRef="set-data-type-foreign-key-ref",s.SetErrorEntity="set-error-entity",s.AddValueAsTypeToList="add-value-as-type-to-list",s.RemoveValueAsTypeFromList="remove-value-as-type-from-list",s.CreateFromGenerationTarget="create-from-generation-target",s.ConnectExternalAccount="connect-external-account",s.ChangeExternalAccountConnectionUsed="change-external-account-connection-used",s.MoveInlineDefToCanvas="move-inline-def-to-canvas",s.CreateDefFromValue="create-def-from-value",s.PrettifyCanvas="prettify-canvas",s.SetPrimitiveDefaultValue="set-primitive-default-value",s.MakeArgRequired="make-argument-required",s.MakeArgNonRequired="make-argument-non-required",s.RecalculateArg="recalculate-arg",s.RenameArg="rename-argument",s.ChangeArgDescription="changed-argument-description",s.RemoveArgBaseImplementation="remove-argument-base-implementation",s.AddArgBaseImplementation="add-argument-base-implementation",s.ChangeArgDataType="change-argument-data-type",s.RecalculateCondition="recalculate-condition",s.ChangeTypeOfCondition="change-type-of-condition",s.RenameDefinition="rename-definition",s.RecalculateDef="recalculate-definition",s.ChangeDefDescription="changed-definition-description",s.RemoveDefBaseImplementation="remove-definition-base-implementation",s.AddDefBaseImplementation="add-definition-base-implementation",s.RemoveDefExtension="remove-definition-extension",s.SetDefExtends="set-definition-extension",s.MakeDefStatic="make-def-static",s.MakeDefNonStatic="make-def-non-static",s.MakeDefAbstract="make-def-abstract",s.MakeDefNonAbstract="make-def-non-abstract",s.RecalculateFuncCall="recalculate-function-call",s.ChangeFuncCallDeclaration="change-function-call-declaration",s.RenameFuncDecl="rename-function-declaration",s.ChangeFuncDeclDescription="changed-function-declaration-description",s.RecalculateFuncDecl="recalculate-function-declaration",s.SetFuncDeclBaseImplementation="set-function-declaration-base-implementation",s.ChangeFuncDeclOutputDataType="change-function-declaration-output-data-type",s.RecalculateGlobalEvent="recalculate-global-event",s.ChangeGlobalEventDescription="changed-global-event-description",s.ChangeGlobalEventType="changed-global-event-type",s.RecalculateInputMap="recalculate-input",s.ChangeInputMapDescription="changed-input-description",s.ChangeInputMapDataType="change-input-data-type",s.RecalculateLoop="recalculate-loop",s.ChangeLoopType="changed-loop-type",s.RecalculateOperation="recalculate-operation",s.ChangeOperationType="changed-operation-type",s.RecalculateOutputMap="recalculate-output",s.ChangeOutputMapDataType="change-output-data-type",s.RecalculateProperty="recalculate-property",s.MakePropertyRequired="make-property-required",s.MakePropertyNonRequired="make-property-non-required",s.MakePropertyConstant="make-property-constant",s.MakePropertyNonConstant="make-property-non-constant",s.MakePropertyUnique="make-property-unique",s.MakePropertyNonUnique="make-property-non-unique",s.MakePropertyStatic="make-property-static",s.MakePropertyNonStatic="make-property-non-static",s.MakePropertyAbstract="make-property-abstract",s.MakePropertyNonAbstract="make-property-non-abstract",s.RenameProperty="rename-property",s.ChangePropertyDescription="changed-property-description",s.RemovePropertyBaseImplementation="remove-property-base-implementation",s.AddPropertyBaseImplementation="add-property-base-implementation",s.ChangePropertyDataType="change-property-data-type",s.RecalculateSearch="recalculate-search",s.RenameSearch="rename-search",s.ChangeSearchDescription="changed-search-description",s.ChangeSearchQuery="changed-search-query",s.MakeValueDescriptorRequired="make-value-descriptor-required",s.MakeSearchInputRequired="make-search-input-required",s.MakeValueDescriptorNonRequired="make-value-descriptor-non-required",s.MakeSearchInputNonRequired="make-search-input-non-required",s.RenameValueDescriptor="rename-value-descriptor",s.RenameSearchInput="rename-search-input",s.ChangeValueDescriptorDescription="changed-value-descriptor-description",s.ChangeSearchInputDescription="changed-search-input-description",s.ChangeValueDescriptorDataType="change-value-descriptor-data-type",s.RecalculateVarDecl="recalculate-variable-declaration",s.MakeVarDeclConstant="make-variable-declaration-constant",s.MakeVarDeclNonConstant="make-variable-declaration-non-constant",s.RenameVarDecl="rename-variable-declaration",s.ChangeVarDeclDescription="changed-variable-declaration-description",s.ChangeVarDeclDataType="change-variable-declaration-data-type",s.RecalculateVarInst="recalculate-variable-instance",s.ChangeVarInstDeclaration="change-variable-instance-declaration",s.HideFuncDeclBody="hide-function-declaration-body",s.ShowFuncDeclBody="show-function-declaration-body",s.HideGlobalEventBody="hide-global-event-body",s.ShowGlobalEventBody="show-global-event-body",s.HideLoopBody="hide-loop-body",s.ShowLoopBody="show-loop-body",s.HideTriggerBody="hide-trigger-body",s.ShowTriggerBody="show-trigger-body",s.AddNestedAndCondition="add-nested-and-condition",s.AddInputToCondition="add-input-to-condition",s.RecalculateNode="recalculate-node",s.AddInputToFuncDecl="add-input-to-function-declaration",s.ChangeInternalCallToThrowErrors="change-internal-call-to-throw-errors",s.ChangeInternalCallToCatchErrors="change-internal-call-to-catch-errors",s.AddErrorOutputToInternalCall="add-error-output-to-internal-call",s.ChangeLoopToThrowErrors="change-loop-to-throw-errors",s.ChangeLoopToCatchErrors="change-loop-to-catch-errors",s.RecalculateLoopBody="recalculate-loop-body",s.RecalculateMethod="recalculate-method",s.AddArgToLoopBody="add-arg-to-loop-body",s.AddArgToMethod="add-arg-to-method",s.RecalculateNestedCondition="recalculate-nested-condition",s.ChangeNodeToThrowErrors="change-node-to-throw-errors",s.ChangeNodeToCatchErrors="change-node-to-catch-errors",s.ChangeOperationToThrowErrors="change-operation-to-throw-errors",s.ChangeOperationToCatchErrors="change-operation-to-catch-errors",s.ChangeFuncCallToThrowErrors="change-function-call-to-throw-errors",s.ChangeFuncCallToCatchErrors="change-function-call-to-catch-errors",s.ChangeSearchToThrowErrors="change-search-to-throw-errors",s.ChangeSearchToCatchErrors="change-search-to-catch-errors",s.ChangeVarDeclToThrowErrors="change-variable-declaration-to-throw-errors",s.ChangeVarDeclToCatchErrors="change-variable-declaration-to-catch-errors",s.ChangeVarInstToThrowErrors="change-variable-instance-to-throw-errors",s.ChangeVarInstToCatchErrors="change-variable-instance-to-catch-errors",s.AddErrorOutputToNode="add-error-output-to-node",s.AddErrorOutputToOperation="add-error-output-to-operation",s.AddErrorOutputToFuncCall="add-error-output-to-function-call",s.AddErrorOutputToSearch="add-error-output-to-search",s.AddErrorOutputToVarDecl="add-error-output-to-variable-declaration",s.AddErrorOutputToVarInst="add-error-output-to-variable-instance",s.AddInputToNode="add-input-to-node",s.AddInputToOperation="add-input-to-operation",s.AddInputToFuncCall="add-input-to-function-call",s.AddInputToSearch="add-input-to-search",s.AddPropertyToVarDecl="add-property-to-variable-declaration",s.AddPropertyToVarInst="add-property-to-variable-instance",s.AddMethodToDef="add-method-to-definition",s.ReSyncRowTransformer="re-sync-row-transformer",s.ManuallyAddRowTransformer="manually-add-row-transformer",s.AddPropertyToDef="add-property-to-definition",s.RestablishExternalAccountConnection="restablish-external-account-connection",s.AddThrownError="add-thrown-error",s.RecalculateTerminationStatement="recalculate-termination-statement",s.RecalculateReturnStmt="recalculate-return-statement",s.RecalculateContinueStmt="recalculate-continue-statement",s.RecalculateBreakStmt="recalculate-break-statement",s.AddPropertyToTerminationStatement="add-property-to-termination-statement",s.AddPropertyToReturnStmt="add-property-to-return-statement",s.AddPropertyToContinueStmt="add-property-to-continue-statement",s.AddPropertyToBreakStmt="add-property-to-break-statement",s.SetLiteralValueToExplicitlyEmpty="set-literal-value-to-explicitly-empty",s.ModifyLiteralValue="modify-literal-value",s.RemoveLiteralValue="remove-literal-value",s.ModifyLiteralValueAsType="modify-literal-value-as-type",s.UpdateProjectMetadata="update-project-metadata",s.RenameProject="rename-project",s.ChangeProjectDescription="change-project-description",s.RestoreNode="restore-node",s.RestoreDef="restore-definition",s.RestoreFuncDecl="restore-function-declaration",s.RestoreGlobalEvent="restore-global-event",s.RestoreSearch="restore-search",s.RestoreVarDecl="restore-variable-declaration",s.RestoreVarInst="restore-variable-instance",s.RestoreFuncCall="restore-function-call",s.RestoreOperation="restore-operation",s.RestoreCondition="restore-condition",s.RestoreReturnStmt="restore-return-statement",s.RestoreContinueStmt="restore-continue-statement",s.RestoreBreakStmt="restore-break-statement",s.RestoreInstalledProject="restore-installed-project",s.RestoreLoop="restore-loop",s.CreateNewDef="create-new-definition",s.CreateNewFuncDecl="create-new-function-declaration",s.CreateNewGlobalEvent="create-new-global-event",s.CreateNewSearch="create-new-search",s.CreateNewVarDecl="create-new-variable-declaration",s.CreateNewVarInst="create-new-variable-instance",s.CreateNewFuncCall="create-new-function-call",s.CreateNewOperation="create-new-operation",s.CreateNewCondition="create-new-condition",s.CreateNewReturnStmt="create-new-return-statement",s.CreateNewContinueStmt="create-new-continue-statement",s.CreateNewBreakStmt="create-new-break-statement",s.CreateNewInternalCall="create-new-internal-call",s.CreateNewLoop="create-new-loop",s.ImplementBuiltInFunctionalityAsDef="implement-built-in-functionality-as-definition",s.ImplementAbstractEntityAsDef="implement-abstract-entity-as-definition",s.ImplementNewHTTPEndpoint="implement-new-http-endpoint",s.ImplementNewScheduledTrigger="implement-new-scheduled-trigger",s.ImplementNewPersistedEntity="implement-new-persisted-entity",s.AddedNewRowTransformer="added-new-row-transformer",s.AddedSQLConnectionConfig="added-sql-connection-config",s.AddedNewSSLConnectionConfig="added-new-ssl-connection-config",s.AddedGoogleConnection="added-google-connection",s.AddedSlackConnection="added-slack-connection",s.AddedNewExternalAccountConnection="added-new-external-account-connection",s.AddedGoogleDriveConnection="added-google-drive-connection",s.AddedGoogleSheetsConnection="added-google-sheets-connection",s.AddedGoogleSlidesConnection="added-google-slides-connection",s.AddedGoogleMailConnection="added-gmail-connection",s.ManuallyCreateIndividualNode="manually-create-individual-node",s.UpdateNode="update-node",s.CreateNewProjectPublicationCompletedEvent="create-new-project-publication-completed-event",s.CreateNewCountedLoop="create-new-counted-loop",s.CreateNewListLoop="create-new-list-loop",s.CreateNewManualFlowLoop="create-new-manual-flow-loop",s.CreateNewObjectKeysLoop="create-new-object-keys-loop",s.CreateNewObjectValuesLoop="create-new-object-values-loop",s.CreateNewStringLoop="create-new-string-loop",s.CreateNewIsFalseCondition="create-new-is-false-condition",s.CreateNewIsTrueCondition="create-new-is-true-condition",s.CreateNewAndCondition="create-new-and-condition",s.CreateNewOrCondition="create-new-or-condition",s.DisconnectNodes="disconnect-nodes",s.DisconnectExecutions="disconnect-executions",s.DisconnectValues="disconnect-values",s.ConnectNodes="connect-nodes",s.ConnectExecution="connect-execution",s.ConnectValues="connect-values",s.ConnectValueToNewInput="connect-value-to-new-input",s.ConnectValueToNewOperationInput="connect-value-to-new-operation-input",s.ConnectValueToNewConditionInput="connect-value-to-new-condition-input",s.ConnectValueToNewSearchInput="connect-value-to-new-search-input",s.ConnectValueToNewVarDeclProperty="connect-value-to-new-variable-declaration-property",s.ConnectValueToNewVarInstProperty="connect-value-to-new-variable-instance-property",s.ConnectValueToNewReturnStmtProperty="connect-value-to-new-return-statement-property",s.ConnectValueToNewContinueStmtProperty="connect-value-to-new-continue-statement-property",s.ConnectValueToNewBreakStmtProperty="connect-value-to-new-break-statement-property",s.ConnectNewFuncDeclArgToValue="connect-new-function-argument-to-value",s.RemoveNodes="remove-nodes",s.RemoveNode="remove-node",s.InitialLoadAutomaticCanvasRefresh="initial-load-automatic-canvas-refresh",s.MoveNodes="move-nodes",s.MoveNode="move-node",s.CloneNodes="clone-nodes",s.CloneNode="clone-node",s.GenerateSQLMigrationOnPersistedEntityUpdate="generate-sql-migration-on-persisted-entity-update",s))(w||{}),Me=(s=>(s.ActionOwnerEntityNotEditable="action-owner-entity-not-editable",s.ActionCounterpartEntityNotEditable="action-counterpart-entity-not-editable",s.ActionOwnerEntityNonDeletable="action-owner-entity-non-deletable",s.GlobalVariableDeclarationCannnotCatchError="global-variable-declaration-cannot-catch-error",s.GlobalVariableDeclarationCannotReadValue="global-variable-declaration-cannot-read-value",s.GlobalVariableDeclarationCannotBeCalled="global-variable-declaration-cannot-be-called",s.GlobalVariableDeclarationCannotCallFromError="global-variable-declaration-cannot-call-from-error",s.ValueReadingOverridesConstantProperty="value-reading-overrides-constant-property",s.DefaultValueOverridesConstantProperty="default-value-overrides-constant-property",s.ValueReadingOverridesConstantVariable="value-reading-overrides-constant-variable",s.DefaultValueOverridesConstantVariable="default-value-overrides-constant-variable",s.CannotSuccessCallItself="cannot-success-call-itself",s.CannotErrorCallItself="cannot-error-call-itself",s.CannotEntryCallItself="cannot-entry-call-itself",s.CannotValueWriteItself="cannot-value-write-itself",s.CannotBeCalledBeforeDeclaration="cannot-be-called-before-declaration",s.CannotBeCalledInParallelBranchToDeclaration="cannot-be-called-in-parallel-branch-to-declaration",s.CannotBeHigherScopeThanDeclaration="cannot-be-higher-scope-than-declaration",s.InputsInGlobalVariableDeclarationsCannotReadValues="inputs-in-global-variable-declarations-cannot-read-values",s))(Me||{});class H_e{constructor({id:u,action:i,errorReason:r,owner:a,counterpart:c,rootAction:e},f){R(this,"id");R(this,"action");R(this,"errorReason");R(this,"owner",null);R(this,"counterpart",null);R(this,"rootAction",!1);R(this,"parent");this.id=u,this.action=i,this.errorReason=r||null,this.owner=a||null,this.counterpart=c||null,this.rootAction=e||!1,this.parent=f}}class S extends J.Events{constructor(i,r,a,c,e=!1,f=""){super(f?f+"-cs-events":"anonymous-cs-events");R(this,"id",x.UUID.uuid());R(this,"seenEntities",[]);R(this,"added",{});R(this,"updated",{});R(this,"removed",{});R(this,"affected",{});R(this,"self",null);R(this,"author");R(this,"timestamp");R(this,"open",!0);R(this,"startedClose",!1);R(this,"dirty",!0);R(this,"submitting",!1);R(this,"lockedVersions",!1);R(this,"type","manual");R(this,"autoclose",!1);R(this,"actionName","");R(this,"project");R(this,"events",new Map);R(this,"ignoreNonEditable",!1);R(this,"ignoreNonDeletable",!1);R(this,"logger");if(this.project=i,this.author=r||x.sessionAuthor||"",this.timestamp=a,this.self=c,this.autoclose=e,this.actionName=f,this.logger=J.Logger.module("cs:"+(this.actionName?this.actionName+":":"")+this.id),this.autoclose&&!this.actionName)throw new Error("Auto-close change-set must have an auto-close action name.")}get index(){const i=this.project.history.indexOf(this);return i===-1?null:i}get isEmpty(){return Object.keys(this.added).length===0&&Object.keys(this.updated).length===0&&Object.keys(this.removed).length===0}get isValid(){var i;return!(this.isEmpty&&this.self&&!this.affected[(i=this.self)==null?void 0:i.id])}get list(){return[...Object.values(this.added),...Object.values(this.updated),...Object.values(this.removed)]}get listAdded(){return Object.values(this.added)}get listUpdated(){return Object.values(this.updated)}get listRemoved(){return Object.values(this.removed)}get listAffected(){return Object.values(this.affected)}get addedIds(){return Object.keys(this.added)}get updatedIds(){return Object.keys(this.updated)}get removedIds(){return Object.keys(this.removed)}get affectedIds(){return Object.keys(this.affected)}event(i){this.logger.log(`ChangeSet Event: ${i.action} (${i.id})`);const r=new H_e(i,this);this.events.set(i.id,r),this.emit("change-set-event",r)}discardOrphans(){this.added[this.project.id]&&(this.updatedIds.forEach(e=>{const f=this.updated[e];this.added[e]=f,delete this.updated[e]}),this.removedIds.forEach(e=>{this.remove(e)}));const i=[...this.addedIds,...this.updatedIds],a=this.project.toFlatIds().filter(e=>!this.project.diggestedBuiltInBaseEntitiesIds.has(e));if(i.filter(e=>!a.includes(e)).forEach(e=>{const f=this.get(e);this.logger.warn(`[discardOrphans] Entity ${f==null?void 0:f.type} with id "${e}" present in change-set but not in project. Removing from change-set.`),this.remove(e)}),this.added[this.project.id]){const e=[...this.addedIds,...this.updatedIds];this.project.toFlatIds().filter(E=>!this.project.diggestedBuiltInBaseEntitiesIds.has(E)).filter(E=>!e.includes(E)).forEach(E=>{const b=this.project.get(E);this.add(b,"added")})}}async discardOrphansAsync(i={}){const r=J.YieldTracker.from(i),a=this.project.toFlatIds();if(this.added[this.project.id]){for(const h of this.updatedIds){const m=this.updated[h];this.added[h]=m,delete this.updated[h],await r.tick()}for(const h of this.removedIds)this.remove(h),await r.tick()}const c=[...this.addedIds,...this.updatedIds],e=a.filter(h=>!this.project.diggestedBuiltInBaseEntitiesIds.has(h)),f=c.filter(h=>!e.includes(h));for(const h of f){const m=this.get(h);this.logger.warn(`[discardOrphansAsync] Entity ${m==null?void 0:m.type} with id "${h}" present in change-set but not in project. Removing from change-set.`),this.remove(h),await r.tick()}if(this.added[this.project.id]){const h=[...this.addedIds,...this.updatedIds],E=a.filter(b=>!this.project.diggestedBuiltInBaseEntitiesIds.has(b)).filter(b=>!h.includes(b));for(const b of E){const A=this.project.get(b);this.add(A,"added"),await r.tick()}}}captureAllChangesInVersionInstances(){[...this.addedIds,...this.updatedIds].forEach(r=>{const a=this.project.get(r);if(!a){const e=this.added[r],f=this.updated[r],h=e||f;throw new Error(`Entity ${(h==null?void 0:h.type)||"of unknown type"} with id "${r}" was ${e?"added":"updated"} but isn't found in the project state when capturing version for change-set.`)}const c=this.get(r);a.version===c.version&&a.captureVersion()}),this.removedIds.forEach(r=>{const a=this.project.getDeleted(r);if(!a){const e=this.removed[r];throw new Error(`Entity ${(e==null?void 0:e.type)||"of unknown type"} with id "${r}" was removed but isn't found in the project state when capturing version for change-set.`)}const c=this.get(r);a.version===c.version&&a.captureVersion()})}async captureAllChangesInVersionInstancesAsync(i={}){const r=J.YieldTracker.from(i),a=[...this.addedIds,...this.updatedIds];for(const c of a){const e=this.project.get(c);if(!e){const h=this.added[c],m=this.updated[c],E=h||m;throw new Error(`Entity ${(E==null?void 0:E.type)||"of unknown type"} with id "${c}" was ${h?"added":"updated"} but isn't found in the project state when capturing version for change-set.`)}const f=this.get(c);e.version===f.version&&e.captureVersion(),await r.tick()}for(const c of this.removedIds){const e=this.project.getDeleted(c);if(!e){const h=this.removed[c];throw new Error(`Entity ${(h==null?void 0:h.type)||"of unknown type"} with id "${c}" was removed but isn't found in the project state when capturing version for change-set.`)}const f=this.get(c);e.version===f.version&&e.captureVersion(),await r.tick()}}async attemptAutocloseAsync(i,r){var a;return this.autoclose&&this.actionName&&this.actionName===i&&(this.self&&r===((a=this.self)==null?void 0:a.id)||!this.self)&&await this.closeAsync(),this}async closeAsync(i={}){const r=J.YieldTracker.from(i),a={persistType:"sequential",...i};if(!this.open||this.startedClose)return this.logger.warn(`Change-set (${this.id}) is already closed or in the process of closing.`),this;const c=i.awaitBeforeClose??!0,e=i.awaitExternalPersist??!0;return this.startedClose||(this.startedClose=!0,c?await this.beforeCloseAsync({tracker:r}):this.beforeCloseAsync({tracker:r})),!this.isValid&&this.self&&!this.added[this.self.id]&&!this.updated[this.self.id]&&this.removed[this.self.id],await this.discardOrphansAsync({tracker:r}),await this.sanitizeAsync({tracker:r}),await this.recursiveCaptureUpstreamVersionsAsync({tracker:r}),this.lockedVersions||(await this.captureAllChangesInVersionInstancesAsync({tracker:r}),await this.recursiveCaptureUpstreamVersionsAsync({tracker:r})),this.open=!1,this.isEmpty?(this.logger.warn(`[ChangeSet.closeAsync] Empty change-set (${this.id}) discarded upon closing.`),this.dirty=!1,this.project.discardChangeSet(this),this.logger.log("[ChangeSet.closeAsync] Closing pending change-sets..."),this.project.closePersistChangeSetsSequentially(),this):(this.project.emit(pi.CHANGE_SET_CLOSED_BEFORE_PERSIST,this),e?a.persistType==="parallel"?await this.project.persistChangeSetInParallel(this):await this.project.persistChangeSetSequentially(this):a.persistType==="parallel"?this.project.persistChangeSetInParallel(this):this.project.persistChangeSetSequentially(this),this.destroy(),this)}attemptAutoclose(i,r){var a;return this.autoclose&&this.actionName&&this.actionName===i&&(this.self&&r===((a=this.self)==null?void 0:a.id)||!this.self)&&this.close(),this}recursiveCaptureUpstreamVersions(){if(this.lockedVersions)return;[...this.addedIds,...this.updatedIds,...this.removedIds].forEach(r=>{const a=this.get(r),{added:c,updated:e,removed:f,affected:h}=a.recursiveCaptureUpstreamVersions(this.timestamp);for(const m of c)this.add(m,"added");for(const m of e)this.add(m,"updated");for(const m of f)this.add(m,"removed");for(const m of h)this.add(m,"affected")})}async recursiveCaptureUpstreamVersionsAsync(i={}){if(this.lockedVersions)return;const r=J.YieldTracker.from(i),a=[...this.addedIds,...this.updatedIds,...this.removedIds];for await(const c of a){const e=this.get(c),{added:f,updated:h,removed:m,affected:E}=e.recursiveCaptureUpstreamVersions(this.timestamp);for(const b of f)this.add(b,"added");for(const b of h)this.add(b,"updated");for(const b of m)this.add(b,"removed");for(const b of E)this.add(b,"affected");await r.tick()}}sanitize(){this.listAdded.forEach(i=>{i.previousVersion=null})}async sanitizeAsync(i={}){const r=J.YieldTracker.from(i);for(const a of this.listAdded)a.previousVersion=null,await r.tick()}syncDependents(){return[...this.list,...this.listAffected].forEach(i=>{const r=this.project.get(i.id);!r||r.deleted||Vg(r,this.project)||r==null||r.syncDependents(this)}),this}async syncDependentsAsync(i={}){const r=J.YieldTracker.from(i);for(const a of[...this.list,...this.listAffected]){const c=this.project.get(a.id);!c||c.deleted||Vg(c,this.project)||(c==null||c.syncDependents(this),await r.tick())}return this}async beforeCloseAsync(i={}){const r=J.YieldTracker.from(i);await this.project.emitAsync(pi.BEFORE_CHANGE_SET_CLOSE_BEFORE_SIDE_EFFECTS,this),await this.syncDependentsAsync({tracker:r}),await this.emitAsyncProjectSideEffects({tracker:r}),await this.project.emitAsync(pi.BEFORE_CHANGE_SET_CLOSE_AFTER_SIDE_EFFECTS,this),this.teardown()}beforeClose(){this.project.emit(pi.BEFORE_CHANGE_SET_CLOSE_BEFORE_SIDE_EFFECTS,this),this.syncDependents(),this.emitProjectSideEffects(),this.project.emit(pi.BEFORE_CHANGE_SET_CLOSE_AFTER_SIDE_EFFECTS,this),this.teardown()}teardown(){this.destroy()}emitProjectSideEffects(){return S_e(this)}async emitAsyncProjectSideEffects(i={}){return Z_e(this,i)}close(i={}){const r={persistType:"sequential",...i};if(!this.open||this.startedClose)return this.logger.warn(`Change-set (${this.id}) is already closed or in the process of closing.`),this;if(this.startedClose||(this.startedClose=!0,this.beforeClose()),!this.isValid&&this.self&&!this.added[this.self.id]&&!this.updated[this.self.id]&&this.removed[this.self.id],this.discardOrphans(),this.sanitize(),this.captureAllChangesInVersionInstances(),this.lockedVersions||(this.recursiveCaptureUpstreamVersions(),this.captureAllChangesInVersionInstances()),this.open=!1,this.isEmpty)return this.logger.warn(`[ChangeSet.close] Empty change-set (${this.id}) discarded upon closing.`),this.project.discardChangeSet(this),this.logger.log("[ChangeSet.close] Closing pending change-sets..."),this.project.closePersistChangeSetsSequentially(),this;if(this.added[this.project.id]&&this.updatedIds.length)throw new Error("No 'updated' entities should be present in the change-set when the project entity is in the 'added' list. New projects can only have newly added entities");if(this.added[this.project.id]&&this.removedIds.length)throw new Error("No 'removed' entities should be present in the change-set when the project entity is in the 'added' list. New projects can only have newly added entities");if(!this.updated[this.project.id]&&!this.added[this.project.id])throw new Error("Change-set must also have the project entity as 'updated' or 'added'. All changes must propagate upstream until the root project entity.");return this.project.emit(pi.CHANGE_SET_CLOSED_BEFORE_PERSIST,this),r.persistType==="parallel"?this.project.persistChangeSetInParallel(this):this.project.persistChangeSetSequentially(this),this.destroy(),this}addDependentsToAffected(i){Object.values(i.detachedDependents).forEach(r=>{const{entity:a,field:c}=r;this.has(a.id)||this.add(a,"affected")})}get(i){return this.added[i]?this.added[i]:this.updated[i]?this.updated[i]:this.removed[i]?this.removed[i]:null}remove(i){return this.has(i)&&(delete this.added[i],delete this.updated[i],delete this.removed[i],delete this.affected[i],this.seenEntities=this.seenEntities.filter(r=>r!==i)),this}add(i,r,a={preventRecursion:!1}){var e,f,h,m;if(!this.open||!this.dirty)return this;if(Vg(i,this.project))return this;if(this.seenEntities.indexOf(i.id)===-1&&this.seenEntities.push(i.id),r==="removed"){if(this.added[i.id])return delete this.added[i.id],delete this.affected[i.id],delete this.updated[i.id],this.seenEntities=this.seenEntities.filter(b=>b!==i.id),delete this.project.deletedInstances[i.id],this;if(this.updated[i.id]&&delete this.updated[i.id],this.affected[i.id]&&delete this.affected[i.id],!this.hasRemoved(i.id)&&!this.lockedVersions&&(i.increaseVersion(this.timestamp),!a.preventRecursion)){const{added:b,updated:A,removed:_,affected:P}=i.recursiveCaptureUpstreamVersions(this.timestamp);for(const V of b)this.add(V,"added");for(const V of A)this.add(V,"updated");for(const V of _)this.add(V,"removed");for(const V of P)this.add(V,"affected")}i.captureVersion();const E=(e=i.knownVersions)==null?void 0:e.get(i.version);if(!E)throw Error(`Version ${i.version} should have a cached version instance but it wasn't found when adding entity to change-set`);return this.removed[i.id]=E,this}if(r==="added"){if(this.removed[i.id])return this;if(this.updated[i.id]&&delete this.updated[i.id],this.affected[i.id]&&delete this.affected[i.id],!this.hasAdded(i.id)&&!this.lockedVersions&&!a.preventRecursion){const{added:b,updated:A,removed:_,affected:P}=i.recursiveCaptureUpstreamVersions(this.timestamp);for(const V of b)this.add(V,"added");for(const V of A)this.add(V,"updated");for(const V of _)this.add(V,"removed");for(const V of P)this.add(V,"affected")}i.previousVersion=null,i.captureVersion();const E=(f=i.knownVersions)==null?void 0:f.get(i.version);if(!E)throw Error(`Version ${i.version} should have a cached version instance but it wasn't found when adding entity to change-set`);return this.added[i.id]=E,delete this.affected[i.id],this.addDependentsToAffected(i),this}if(r==="updated"){if(this.removed[i.id])return this;if(this.added[i.id])return i.captureVersion(),this.addDependentsToAffected(i),this;if(this.affected[i.id]&&delete this.affected[i.id],!this.hasUpdated(i.id)&&!this.lockedVersions&&(i.increaseVersion(this.timestamp),!a.preventRecursion)){const{added:b,updated:A,removed:_,affected:P}=i.recursiveCaptureUpstreamVersions(this.timestamp);for(const V of b)this.add(V,"added");for(const V of A)this.add(V,"updated");for(const V of _)this.add(V,"removed");for(const V of P)this.add(V,"affected")}i.activeVersion=!0,i.captureVersion();const E=(h=i.knownVersions)==null?void 0:h.get(i.version);if(!E)throw Error(`Version ${i.version} should have a cached version instance but it wasn't found when adding entity to change-set`);return this.updated[i.id]=E,this.addDependentsToAffected(i),this}if(r==="affected"){if(this.removed[i.id])return this;if(this.added[i.id])return this;if(this.updated[i.id])return this;if(this.affected[i.id]=i,!this.lockedVersions){const E=i.version+"--"+this.id,b=((m=i.knownVersions)==null?void 0:m.get(E))||i.snapshot();i.apply(b),i.knownVersions=i.knownVersions?i.knownVersions.set(E,b):new Map().set(E,b)}}return this}toJSON(){var f;const i={},r={},a={},c=new Set;for(const h of Object.values(this.added))i[h.id]=h.toShallowJSON();for(const h of Object.values(this.updated))r[h.id]=h.toShallowJSON();for(const h of Object.values(this.removed))a[h.id]=h.toShallowJSON();for(const h of Object.values(this.affected))c.add(h.id);const e=this.get(((f=this.self)==null?void 0:f.id)||"");return{added:i,updated:r,removed:a,affected:Array.from(c),self:e?e.toShallowJSON():null,seenEntities:this.seenEntities,actionName:this.actionName}}has(i){return!!this.added[i]||!!this.removed[i]||!!this.updated[i]||!!this.affected[i]}hasAdded(i){return!!this.added[i]}hasUpdated(i){return!!this.updated[i]}hasRemoved(i){return!!this.removed[i]}hasAffected(i){return!!this.affected[i]}}function ggi(s){return new Set([...Object.keys(s.added),...Object.keys(s.updated),...Object.keys(s.removed),...Array.from(s.affected)])}function j_(s,u,i){var f;const r=new Date().toISOString(),a=new S(i,x.sessionAuthor,r,i);if(a.lockedVersions=!0,s===u)throw J.Logger.error("From: ",s),J.Logger.error("To: ",u),new Error("Cannot generate transitional change set between the same two versions or change-sets");let c;if(s==="initial"?c=!0:u==="initial"?c=!1:B(s.timestamp).isBefore(B(u.timestamp))?c=!0:c=!1,J.Logger.log("Transitioning from ",s==="initial"?"initial":s.index),J.Logger.log("Transitioning to ",u==="initial"?"initial":u.index),J.Logger.log("Is forward: ",c),c){const h=u,m=h.index,E=s==="initial"?0:s.index;J.Logger.log("ownIndex: ",m),J.Logger.log("startIndex: ",E),J.Logger.log("CH ID: ",h.id);const b=m===E?[i.history[m]]:i.history.slice(E+1,m+1);if(b.sort((A,_)=>B(A.timestamp).isAfter(B(_.timestamp))?1:-1),!b.length)throw new Error("No change sets in the history between the history indexes provided");J.Logger.log("REDO change-set: ",b[0].id," ",b[0].timestamp),b.forEach(A=>{k_(A,_=>{const P=i.instances[_.id]||i.deletedInstances[_.id];let V="";try{V=le(_,i)}catch{}if(!P)throw new Error(`Entity ${_.type} ${V?`"${V}" `:""}with id "${_.id}" doesn't have an 'activeVersion' set.`);if(!P.knownVersions)throw new Error(`Entity ${_.type} ${V?`"${V}" `:""}with id "${_.id}" has an active version instance missing the 'knownVersions' property value.`);if(!P.knownVersions.get(_.version))throw new Error(`Entity ${_.type} ${V?`"${V}" `:""}with id "${_.id}" has an active version instance missing the 'knownVersions' property value for version "${_.version}".`);P.restoreVersion(_.version),P.addSelfToProject(a),a.timestamp=P.createdAt,a.add(P,H.Added,{preventRecursion:!0})},_=>{const P=i.instances[_.id]||i.deletedInstances[_.id];let V="";try{V=le(_,i)}catch{}if(!P)throw new Error(`Entity ${_.type} ${V?`"${V}" `:""}with id "${_.id}" doesn't have an 'activeVersion' set.`);if(!P.knownVersions)throw new Error(`Entity ${_.type} ${V?`"${V}" `:""}with id "${_.id}" has an active version instance missing the 'knownVersions' property value.`);if(!P.knownVersions.get(_.version))throw new Error(`Entity ${_.type} ${V?`"${V}" `:""}with id "${_.id}" has an active version instance missing the 'knownVersions' property value for version "${_.version}".`);P.restoreVersion(_.version),a.timestamp=P.createdAt,a.add(P,H.Updated,{preventRecursion:!0})},_=>{var M;const P=i.instances[_.id]||i.deletedInstances[_.id];let V="";try{V=le(_,i)}catch{}if(!P)throw new Error(`Entity ${_.type} ${V?`"${V}" `:""}with id "${_.id}" doesn't have an 'activeVersion' set.`);if(!P.knownVersions)throw new Error(`Entity ${_.type} ${V?`"${V}" `:""}with id "${_.id}" has an active version instance missing the 'knownVersions' property value.`);if(!P.knownVersions.get(_.version))throw new Error(`Entity ${_.type} ${V?`"${V}" `:""}with id "${_.id}" has an active version instance missing the 'knownVersions' property value for version "${_.version}".`);P.restoreVersion(_.version),(M=P.removeFromParent)==null||M.call(P,a),P.unsubscribe(),P.unsubscribeFromDependencies(),i.subscribeDeletedInstance(P),a.timestamp=P.createdAt,a.add(P,H.Removed,{preventRecursion:!0})},_=>{const P=i.instances[_.id]||i.deletedInstances[_.id];let V="";try{V=le(_,i)}catch{}if(!P)throw new Error(`Entity ${_.type} ${V?`"${V}" `:""}with id "${_.id}" doesn't have an 'activeVersion' set.`);if(!P.knownVersions)throw new Error(`Entity ${_.type} ${V?`"${V}" `:""}with id "${_.id}" has an active version instance missing the 'knownVersions' property value.`);if(!P.knownVersions.get(_.version))throw new Error(`Entity ${_.type} ${V?`"${V}" `:""}with id "${_.id}" has an active version instance missing the 'knownVersions' property value for version "${_.version}".`);const M=_.version+"--"+A.id;P.restoreVersion(M),a.timestamp=P.createdAt,a.add(P,H.Updated,{preventRecursion:!0})})})}else{const h=s,m=h.index,E=u==="initial"?0:u.index;J.Logger.log("CH ID: ",h.id);const b=m===E?[i.history[m]]:i.history.slice(E+1,m+1);if(b.sort((A,_)=>B(_.timestamp).isAfter(B(A.timestamp))?1:-1),!b.length)throw new Error("No change sets in the history between the history indexes provided");J.Logger.log("UNDO change-set: ",b[0].id," ",b[0].timestamp),b.forEach(A=>{k_(A,_=>{var M;const P=i.instances[_.id]||i.deletedInstances[_.id];let V="";try{V=le(_,i)}catch{}if(!P)throw new Error(`Entity ${_.type} ${V?`"${V}" `:""}with id "${_.id}" doesn't have an 'activeVersion' set.`);if(!P.knownVersions)throw new Error(`Entity ${_.type} ${V?`"${V}" `:""}with id "${_.id}" has an active version instance missing the 'knownVersions' property value.`);if(!P.knownVersions.get(_.version))throw new Error(`Entity ${_.type} ${V?`"${V}" `:""}with id "${_.id}" has an active version instance missing the 'knownVersions' property value for version "${_.version}".`);_.previousVersion&&(P.restoreVersion(_.previousVersion),(M=P.removeFromParent)==null||M.call(P,a),P.unsubscribe(),P.unsubscribeFromDependencies(),i.subscribeDeletedInstance(P)),a.timestamp=P.createdAt,a.add(P,H.Removed,{preventRecursion:!0})},_=>{const P=i.instances[_.id]||i.deletedInstances[_.id];let V="";try{V=le(_,i)}catch{}if(!P)throw new Error(`Entity ${_.type} ${V?`"${V}" `:""}with id "${_.id}" doesn't have an 'activeVersion' set.`);if(!P.knownVersions)throw new Error(`Entity ${_.type} ${V?`"${V}" `:""}with id "${_.id}" has an active version instance missing the 'knownVersions' property value.`);if(!P.knownVersions.get(_.version))throw new Error(`Entity ${_.type} ${V?`"${V}" `:""}with id "${_.id}" has an active version instance missing the 'knownVersions' property value for version "${_.version}".`);P.restoreVersion(_.previousVersion),a.timestamp=P.createdAt,a.add(P,H.Updated,{preventRecursion:!0})},_=>{const P=i.instances[_.id]||i.deletedInstances[_.id];let V="";try{V=le(_,i)}catch{}if(!P)throw new Error(`Entity ${_.type} ${V?`"${V}" `:""}with id "${_.id}" doesn't have an 'activeVersion' set.`);if(!P.knownVersions)throw new Error(`Entity ${_.type} ${V?`"${V}" `:""}with id "${_.id}" has an active version instance missing the 'knownVersions' property value.`);if(!P.knownVersions.get(_.version))throw new Error(`Entity ${_.type} ${V?`"${V}" `:""}with id "${_.id}" has an active version instance missing the 'knownVersions' property value for version "${_.version}".`);P.restoreVersion(_.previousVersion),P.addSelfToProject(a),a.timestamp=P.createdAt,a.add(P,H.Added,{preventRecursion:!0})},_=>{const P=i.instances[_.id]||i.deletedInstances[_.id];let V="";try{V=le(_,i)}catch{}if(!P)throw new Error(`Entity ${_.type} ${V?`"${V}" `:""}with id "${_.id}" doesn't have an 'activeVersion' set.`);if(!P.knownVersions)throw new Error(`Entity ${_.type} ${V?`"${V}" `:""}with id "${_.id}" has an active version instance missing the 'knownVersions' property value.`);if(!P.knownVersions.get(_.version))throw new Error(`Entity ${_.type} ${V?`"${V}" `:""}with id "${_.id}" has an active version instance missing the 'knownVersions' property value for version "${_.version}".`);P.restoreVersion(P.version),a.timestamp=P.createdAt,a.add(P,H.Affected,{preventRecursion:!0})})})}let e;if(u==="initial"){const h=Array.from(((f=i.knownVersions)==null?void 0:f.values())||[]).reduce((m,E)=>!m||B(E.createdAt).isBefore(B(m.createdAt))?E:m,null);if(!h)throw new Error("No oldest version found");e=h.createdAt}else e=u.timestamp;return a.open=!1,{transitionalChangeSet:a,transitionTime:r,timeOfOriginalTargetChanges:e}}function k_(s,u,i,r,a){var h;if(!(s!=null&&s.self))throw new Error("Change set must have a valid `self` entity state to be traversed");const c=((h=s.self)==null?void 0:h.type)===d.Project?s.self:s.self.project,e=new Fn(s.self,{allBuiltInEntityIds:c.diggestedBuiltInBaseEntitiesIds});J.Logger.log("changeSet.added: ",Object.keys(s.added).length),J.Logger.log("changeSet.updated: ",Object.keys(s.updated).length),J.Logger.log("changeSet.removed: ",Object.keys(s.removed).length);const f={...s.added,...s.updated,...s.removed,...s.affected};e.order=Object.keys(f),e.flatRecord=f,e.orderEntities(),J.Logger.log("All entities: ",e.order.map((m,E)=>`${E+1}: ${f[m].type} - ${m}`).join(`,
6
+ Please provide a unique 'name' string.`,severity:ve.Error,code:we.NameNotUniqueInScope}))}}return i}function igi(s,u){switch(s.type){case d.DefinitionEntity:return Gx(s,u);case d.FunctionDeclaration:return jx(s,u);case d.VariableDeclaration:return kx(s,u);case d.Property:return Ux(s,u);case d.ArgumentDeclaration:return Fx(s,u);default:return[]}}function Dp(s,u){var r;const i=s;switch(s.type){case d.FunctionCall:case d.InternalCall:return Da(s.declaration,u).codeName;case d.ActionDescriptor:case d.DefinitionEntity:case d.VariableDeclaration:case d.ValueDescriptor:case d.FunctionDeclaration:return s.codeName||null;case d.Property:case d.ArgumentDeclaration:{if(s.codeName)return s.codeName;if((r=s.implements)!=null&&r.length){const a=s.implements.find(c=>{const e=Da(c,u);return!!(e!=null&&e.codeName)});if(a)return Da(a,u).codeName||null}break}case d.InputMap:case d.OutputMap:case d.VariableInstance:{if(s.declaration){const a=Da(s.declaration,u);return Dp(a,u)||""}break}}return i.codeName||null}function du(s,u){let i=s;if(!!u.some(a=>a.name===i)){const a=s.split(" "),c=a.pop()||"",e=parseInt(c);return!isNaN(e)?a.push(`${e+1}`):(a.push(c),a.push("1")),i=a.join(" "),du(i,u)}return i}function k_e(s,u){const r=s.project.getDefinitionEntities(new Set([s.id])).filter(a=>a.id!==s.id&&a.name.toLowerCase()===s.name.toLowerCase());if(r.length){const a=du(s.name,r);s.metaSync({name:a},u)}}function rgi(s){switch(s){case dt.List:return"Loop over list items";case dt.ManualFlow:return"Manual flow control loop";case dt.ObjectKeys:return"Loop over object keys";case dt.ObjectValues:return"Loop over object values";case dt.Counted:return"Loop given number of times";case dt.String:return"Loop over text characters";case Ut.PrimitiveEqual:return"Is equal to";case Ut.PrimitiveNotEqual:return"Is not equal to";case Ut.Empty:return"Is empty";case Ut.NotEmpty:return"Is present";case xe.DeleteKey:return"Delete property from object";case xe.DeleteNestedKey:return"Delete nested property from object";case xe.HasKey:return"Check if object has property";case xe.HasNestedKey:return"Check if object has nested property";case xe.IsInstanceOfType:return"Check if object is instance of type";case xe.KeyValueEquals:return"Check if object property equals value";case xe.NestedKeyValueEquals:return"Check if object nested property equals value";case xe.ReadKey:return"Read property from object";case xe.ReadNestedKey:return"Read nested property from object";case xe.Validate:return"Validate object structure";case xe.WriteKey:return"Write property to object";case xe.WriteNestedKey:return"Write nested property to object";case xe.WriteSafeNestedKeyRecursively:return"Write safe nested property to object recursively";case xe.Merge:return"Merge objects";case xe.Entries:return"Get a list with the object keys, and values";case xe.Keys:return"Get a list with the object keys";case xe.Values:return"Get a list with the object values";case Qe.DecodeBase64:return"Decode Base64 text to bytes";case Qe.EncodeBase64:return"Encode bytes to Base64 text";case Qe.DecodeBase64Url:return"Decode Base64URL text to bytes";case Qe.EncodeBase64Url:return"Encode bytes to Base64URL text";case Qe.DecodeHex:return"Decode Hex text to bytes";case Qe.EncodeHex:return"Encode bytes to Hex text";case Qe.FromBytesToString:return"Convert bytes to text";case Qe.ToBytes:return"Convert text to bytes";case Qe.ToString:return"Convert value to text";case Qe.GetTypeOf:return"Get data type of value";case Qe.ToNumber:return"Convert value to number";case pe.Addition:return"Sum numbers";case pe.Subtraction:return"Subtract numbers";case pe.Multiplication:return"Multiply numbers";case pe.Division:return"Divide numbers";case pe.Remainder:return"Get remainder of numbers";case pe.Absolute:return"Get absolute value of numbers";case pe.Acos:return"Get arc cosine of numbers";case pe.Asin:return"Get arc sine of numbers";case pe.Atan:return"Get arc tangent of numbers";case pe.Ceil:return"Round numbers up";case pe.Cos:return"Get cosine of numbers";case pe.Floor:return"Round numbers down";case pe.LogNatural:return"Get natural logarithm of numbers";case pe.Log10:return"Get base-10 logarithm of numbers";case pe.MaxOf:return"Get maximum of numbers";case pe.MinOf:return"Get minimum of numbers";case pe.Round:return"Round numbers to nearest integer";case pe.Sin:return"Get sine of numbers";case pe.SquareRoot:return"Get square root of numbers";case pe.Tan:return"Get tangent of numbers";case pe.Negate:return"Negate numbers";case pe.Atan2:return"Get arc tangent of two numbers";case pe.Exp:return"Get exponential of numbers";case pe.Average:return"Get average of numbers";case pe.Clamp:return"Clamp numbers within range";case pe.CubeRoot:return"Get cube root of numbers";case pe.LessThan:return"Check if numbers are less than";case pe.LessThanOrEqual:return"Check if numbers are less than or equal to";case pe.MoreThan:return"Check if numbers are more than";case pe.MoreThanOrEqual:return"Check if numbers are more than or equal to";case pe.MapRange:return"Map numbers from one range to another";case pe.Median:return"Get median of numbers";case pe.NthRoot:return"Get nth root of numbers";case pe.PercentOf:return"Get percentage of numbers";case pe.PercentageChange:return"Get percentage change between numbers";case pe.RoundToDecimals:return"Round numbers to given decimal places";case pe.Sign:return"Get sign of numbers";case pe.SnapToStep:return"Snap numbers to nearest step";case tt.GenerateRandomBase64:return"Generate random Base64 text";case tt.GenerateRandomBytes:return"Generate random bytes";case tt.GenerateRandomFloat:return"Generate random decimal number";case tt.GenerateRandomInteger:return"Generate random whole number";case tt.GenerateRandomHexadecimal:return"Generate random hexadecimal text";case tt.GenerateRandomUUIDv4:return"Generate random UUID v4";case tt.GenerateShortIdentifier:return"Generate short unique identifier";case bl.PROJECT_PUBLICATION_COMPLETED:return"Project publication completed";default:return null}}function U_e(s,u,i){const a=`${Gg(s)}-${u}-id`;return i.instances[a]?x.UUID.uuid():a}function M_(s,u){let i="",r=null;if(s.parent){const c=u.get(s.parent);c&&(r=c)}let a="";return r&&(a=`${Gg(le(r,u))}-`),i=`${a}${Gg(le(s,u))}-id`,u.instances[i]?x.UUID.uuid():i}function pn(s,u,i="uuid"){return i==="semantic"?U_e(le(s,u),s.type,u):x.UUID.uuid()}const ngi=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;function Kx(s){return typeof s=="string"&&ngi.test(s)}const agi=/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;function G_(s){return typeof s=="string"&&agi.test(s)}function sgi(s){return s instanceof Error&&s.name==="ZodError"&&"issues"in s&&Array.isArray(s.issues)}var lgi=class extends Error{constructor(u,i){super(u,i);R(this,"name");R(this,"details");this.name="ZodValidationError",this.details=ogi(i)}toString(){return this.message}};function ogi(s){if(s){const u=s.cause;if(sgi(u))return u.issues}return[]}function dgi(s){return s.length!==0}function Qk(s){return s.description??""}var ugi=/[$_\p{ID_Start}][$\u200c\u200d\p{ID_Continue}]*/u;function pgi(s){if(s.length===1){let u=s[0];return typeof u=="symbol"&&(u=Qk(u)),u.toString()||'""'}return s.reduce((u,i)=>{if(typeof i=="number")return u+"["+i.toString()+"]";if(typeof i=="symbol"&&(i=Qk(i)),i.includes('"'))return u+'["'+cgi(i)+'"]';if(!ugi.test(i))return u+'["'+i+'"]';const r=u.length===0?"":".";return u+r+i},"")}function cgi(s){return s.replace(/"/g,'\\"')}var fgi="; ",ygi=99,F_e="Validation error",hgi=": ",mgi=", or ";function Tgi(s={}){const{issueSeparator:u=fgi,unionSeparator:i=mgi,prefixSeparator:r=hgi,prefix:a=F_e,includePath:c=!0,maxIssuesInMessage:e=ygi}=s;return f=>{const h=f.slice(0,e).map(m=>hg({issue:m,issueSeparator:u,unionSeparator:i,includePath:c})).join(u);return vgi(h,a,r)}}function hg(s){const{issue:u,issueSeparator:i,unionSeparator:r,includePath:a}=s;if(u.code===ot.invalid_union)return u.unionErrors.reduce((c,e)=>{const f=e.issues.map(h=>hg({issue:h,issueSeparator:i,unionSeparator:r,includePath:a})).join(i);return c.includes(f)||c.push(f),c},[]).join(r);if(u.code===ot.invalid_arguments)return[u.message,...u.argumentsError.issues.map(c=>hg({issue:c,issueSeparator:i,unionSeparator:r,includePath:a}))].join(i);if(u.code===ot.invalid_return_type)return[u.message,...u.returnTypeError.issues.map(c=>hg({issue:c,issueSeparator:i,unionSeparator:r,includePath:a}))].join(i);if(a&&dgi(u.path)){if(u.path.length===1){const c=u.path[0];if(typeof c=="number")return`${u.message} at index ${c}`}return`${u.message} at "${pgi(u.path)}"`}return u.message}function vgi(s,u,i){return u!==null?s.length>0?[u,s].join(i):u:s.length>0?s:F_e}function Egi(s,u={}){const r=bgi(u)([s]);return new lgi(r,{cause:new yd([s])})}function bgi(s){return"messageBuilder"in s?s.messageBuilder:Tgi(s)}async function K_e(s,u={}){var c;const i=J.YieldTracker.from(u),r=[...wn(s),...is(s)];await i.tick();const a=Kt(s.errors,r);return await((c=s.dataType)==null?void 0:c.validateAsync({tracker:i})),a}function q_e(s){var i;(i=s.dataType)==null||i.validate();const u=[...wn(s),...is(s)];return Kt(s.errors,u)}const Agi=Object.freeze(Object.defineProperty({__proto__:null,validate:q_e,validateAsync:K_e},Symbol.toStringTag,{value:"Module"}));function S_e(s){return s.listAdded.forEach(u=>{const i=s.project.get(u.id);(i==null?void 0:i.type)===d.DefinitionEntity&&i.parent.type!==d.DataType&&(s.project.emit(pi.EXPLICIT_DEFINITION_ENTITY_ADDED,i,s),ui(i,ge.PERSISTED_ENTITY)?s.project.emit(pi.PERSISTED_DEFINITION_ENTITY_ADDED,i,s):ui(i,ge.RELATIONAL_DATABASE)&&s.project.emit(pi.RELATIONAL_DATABASE_DEFINITION_ENTITY_ADDED,i,s))}),s.listUpdated.forEach(u=>{const i=s.project.get(u.id);(i==null?void 0:i.type)===d.DefinitionEntity&&i.parent.type!==d.DataType&&(s.project.emit(pi.EXPLICIT_DEFINITION_ENTITY_UPDATED,i,s),ui(i,ge.PERSISTED_ENTITY)?s.project.emit(pi.PERSISTED_DEFINITION_ENTITY_UPDATED,i,s):ui(i,ge.RELATIONAL_DATABASE)&&s.project.emit(pi.RELATIONAL_DATABASE_DEFINITION_ENTITY_UPDATED,i,s))}),s.listRemoved.forEach(u=>{const i=s.project.get(u.id)||s.project.getDeleted(u.id);(i==null?void 0:i.type)===d.DefinitionEntity&&i.parent.type!==d.DataType&&(s.project.emit(pi.EXPLICIT_DEFINITION_ENTITY_REMOVED,i,s),ui(i,ge.PERSISTED_ENTITY)?s.project.emit(pi.PERSISTED_DEFINITION_ENTITY_REMOVED,i,s):ui(i,ge.RELATIONAL_DATABASE)&&s.project.emit(pi.RELATIONAL_DATABASE_DEFINITION_ENTITY_REMOVED,i,s))}),s}async function Z_e(s,u={}){const i=J.YieldTracker.from(u),r=[];for(const a of s.listAdded){const c=s.project.get(a.id);(c==null?void 0:c.type)===d.DefinitionEntity&&c.parent.type!==d.DataType&&(r.push(s.project.emitAsync(pi.EXPLICIT_DEFINITION_ENTITY_ADDED,c,s)),ui(c,ge.PERSISTED_ENTITY)?r.push(s.project.emitAsync(pi.PERSISTED_DEFINITION_ENTITY_ADDED,c,s)):ui(c,ge.RELATIONAL_DATABASE)&&r.push(s.project.emitAsync(pi.RELATIONAL_DATABASE_DEFINITION_ENTITY_ADDED,c,s))),await i.tick()}for(const a of s.listUpdated){const c=s.project.get(a.id);(c==null?void 0:c.type)===d.DefinitionEntity&&c.parent.type!==d.DataType&&(r.push(s.project.emitAsync(pi.EXPLICIT_DEFINITION_ENTITY_UPDATED,c,s)),ui(c,ge.PERSISTED_ENTITY)?r.push(s.project.emitAsync(pi.PERSISTED_DEFINITION_ENTITY_UPDATED,c,s)):ui(c,ge.RELATIONAL_DATABASE)&&r.push(s.project.emitAsync(pi.RELATIONAL_DATABASE_DEFINITION_ENTITY_UPDATED,c,s))),await i.tick()}for(const a of s.listRemoved){const c=s.project.get(a.id)||s.project.getDeleted(a.id);(c==null?void 0:c.type)===d.DefinitionEntity&&c.parent.type!==d.DataType&&(r.push(s.project.emitAsync(pi.EXPLICIT_DEFINITION_ENTITY_REMOVED,c,s)),ui(c,ge.PERSISTED_ENTITY)?r.push(s.project.emitAsync(pi.PERSISTED_DEFINITION_ENTITY_REMOVED,c,s)):ui(c,ge.RELATIONAL_DATABASE)&&r.push(s.project.emitAsync(pi.RELATIONAL_DATABASE_DEFINITION_ENTITY_REMOVED,c,s))),await i.tick()}return await Promise.all(r),s}var E1=(s=>(s.Manual="manual",s.Automatic="automatic",s))(E1||{}),H=(s=>(s.Added="added",s.Updated="updated",s.Removed="removed",s.Affected="affected",s))(H||{}),w=(s=>(s.AddSuccessCall="add-success-call",s.AddErrorCall="add-error-call",s.AddCall="add-call",s.SetParent="set-parent",s.SetStandaloneParent="set-standalone-parent",s.AfterAllChildrenInitialized="after-all-children-initialized",s.UpdateWithShallowTransfer="update-with-shallow-transfer",s.UpdateWithGenerationTarget="update-with-generation-target",s.RemoveFromParent="remove-from-parent",s.RemoveEntity="remove-entity",s.RestoreEntity="restore-entity",s.CloneEntity="clone-entity",s.AddInput="add-input",s.RemoveInput="remove-input",s.SetDataType="set-data-type",s.RemoveDataType="remove-data-type",s.SetAdditionalPropertiesDataType="set-additional-properties-data-type",s.RemoveAdditionalPropertiesDataType="remove-additional-properties-data-type",s.SetAllPropertiesImplement="set-all-properties-implement",s.RemoveAllPropertiesImplement="remove-all-properties-implement",s.RemoveValueReader="remove-value-reader",s.AddValueReader="add-value-reader",s.RemoveValueWriter="remove-value-writer",s.SetValueWriter="set-value-writer",s.AddEntryCaller="add-entry-caller",s.AddSuccessCaller="add-success-caller",s.AddErrorCaller="add-error-caller",s.RemoveCall="remove-call",s.RemoveCaller="remove-caller",s.RemoveChildGroup="remove-child-group",s.AddToAndGroup="add-to-and-group",s.AddToOrGroup="add-to-or-group",s.RemoveUnrecognizedInputs="remove-unrecognized-inputs",s.RemoveUnrecognizedOutputs="remove-unrecognized-outputs",s.SyncInputs="sync-inputs",s.SyncOutputs="sync-outputs",s.SetImplements="set-implements",s.SetExtends="set-extends",s.SetExtension="set-extension",s.AddImplementation="add-implementation",s.RemoveImplementation="remove-implementation",s.AddProperty="add-property",s.RemoveProperty="remove-property",s.AddMethod="add-method",s.RemoveMethod="remove-method",s.AddAbstractMethod="add-abstract-method",s.RemoveAbstractMethod="remove-abstract-method",s.SetValueAsTypeSingle="set-value-as-type-single",s.SetValueAsTypeList="set-value-as-type-list",s.SetValueAsType="set-value-as-type",s.RemoveErrorCatching="remove-error-catching",s.RemoveAllErrorCallers="remove-all-error-callers",s.RemoveAllSuccessCallers="remove-all-success-callers",s.RemoveAllCallers="remove-all-callers",s.RemoveAllErrorCalls="remove-all-error-calls",s.SetDataTypeEntityValue="set-data-type-entity-value",s.MergeDataTypes="merge-data-types",s.SetDataTypeForeignKeyRef="set-data-type-foreign-key-ref",s.SetErrorEntity="set-error-entity",s.AddValueAsTypeToList="add-value-as-type-to-list",s.RemoveValueAsTypeFromList="remove-value-as-type-from-list",s.CreateFromGenerationTarget="create-from-generation-target",s.ConnectExternalAccount="connect-external-account",s.ChangeExternalAccountConnectionUsed="change-external-account-connection-used",s.MoveInlineDefToCanvas="move-inline-def-to-canvas",s.CreateDefFromValue="create-def-from-value",s.PrettifyCanvas="prettify-canvas",s.SetPrimitiveDefaultValue="set-primitive-default-value",s.MakeArgRequired="make-argument-required",s.MakeArgNonRequired="make-argument-non-required",s.RecalculateArg="recalculate-arg",s.RenameArg="rename-argument",s.ChangeArgDescription="changed-argument-description",s.RemoveArgBaseImplementation="remove-argument-base-implementation",s.AddArgBaseImplementation="add-argument-base-implementation",s.ChangeArgDataType="change-argument-data-type",s.RecalculateCondition="recalculate-condition",s.ChangeTypeOfCondition="change-type-of-condition",s.RenameDefinition="rename-definition",s.RecalculateDef="recalculate-definition",s.ChangeDefDescription="changed-definition-description",s.RemoveDefBaseImplementation="remove-definition-base-implementation",s.AddDefBaseImplementation="add-definition-base-implementation",s.RemoveDefExtension="remove-definition-extension",s.SetDefExtends="set-definition-extension",s.MakeDefStatic="make-def-static",s.MakeDefNonStatic="make-def-non-static",s.MakeDefAbstract="make-def-abstract",s.MakeDefNonAbstract="make-def-non-abstract",s.RecalculateFuncCall="recalculate-function-call",s.ChangeFuncCallDeclaration="change-function-call-declaration",s.RenameFuncDecl="rename-function-declaration",s.ChangeFuncDeclDescription="changed-function-declaration-description",s.RecalculateFuncDecl="recalculate-function-declaration",s.SetFuncDeclBaseImplementation="set-function-declaration-base-implementation",s.ChangeFuncDeclOutputDataType="change-function-declaration-output-data-type",s.RecalculateGlobalEvent="recalculate-global-event",s.ChangeGlobalEventDescription="changed-global-event-description",s.ChangeGlobalEventType="changed-global-event-type",s.RecalculateInputMap="recalculate-input",s.ChangeInputMapDescription="changed-input-description",s.ChangeInputMapDataType="change-input-data-type",s.RecalculateLoop="recalculate-loop",s.ChangeLoopType="changed-loop-type",s.ChangeLoopOutputDataType="change-loop-output-data-type",s.RecalculateOperation="recalculate-operation",s.ChangeOperationType="changed-operation-type",s.RecalculateOutputMap="recalculate-output",s.ChangeOutputMapDataType="change-output-data-type",s.RecalculateProperty="recalculate-property",s.MakePropertyRequired="make-property-required",s.MakePropertyNonRequired="make-property-non-required",s.MakePropertyConstant="make-property-constant",s.MakePropertyNonConstant="make-property-non-constant",s.MakePropertyUnique="make-property-unique",s.MakePropertyNonUnique="make-property-non-unique",s.MakePropertyStatic="make-property-static",s.MakePropertyNonStatic="make-property-non-static",s.MakePropertyAbstract="make-property-abstract",s.MakePropertyNonAbstract="make-property-non-abstract",s.RenameProperty="rename-property",s.ChangePropertyDescription="changed-property-description",s.RemovePropertyBaseImplementation="remove-property-base-implementation",s.AddPropertyBaseImplementation="add-property-base-implementation",s.ChangePropertyDataType="change-property-data-type",s.RecalculateSearch="recalculate-search",s.RenameSearch="rename-search",s.ChangeSearchDescription="changed-search-description",s.ChangeSearchQuery="changed-search-query",s.MakeValueDescriptorRequired="make-value-descriptor-required",s.MakeSearchInputRequired="make-search-input-required",s.MakeValueDescriptorNonRequired="make-value-descriptor-non-required",s.MakeSearchInputNonRequired="make-search-input-non-required",s.RenameValueDescriptor="rename-value-descriptor",s.RenameSearchInput="rename-search-input",s.ChangeValueDescriptorDescription="changed-value-descriptor-description",s.ChangeSearchInputDescription="changed-search-input-description",s.ChangeValueDescriptorDataType="change-value-descriptor-data-type",s.RecalculateVarDecl="recalculate-variable-declaration",s.MakeVarDeclConstant="make-variable-declaration-constant",s.MakeVarDeclNonConstant="make-variable-declaration-non-constant",s.RenameVarDecl="rename-variable-declaration",s.ChangeVarDeclDescription="changed-variable-declaration-description",s.ChangeVarDeclDataType="change-variable-declaration-data-type",s.RecalculateVarInst="recalculate-variable-instance",s.ChangeVarInstDeclaration="change-variable-instance-declaration",s.HideFuncDeclBody="hide-function-declaration-body",s.ShowFuncDeclBody="show-function-declaration-body",s.HideGlobalEventBody="hide-global-event-body",s.ShowGlobalEventBody="show-global-event-body",s.HideLoopBody="hide-loop-body",s.ShowLoopBody="show-loop-body",s.HideTriggerBody="hide-trigger-body",s.ShowTriggerBody="show-trigger-body",s.AddNestedAndCondition="add-nested-and-condition",s.AddInputToCondition="add-input-to-condition",s.RecalculateNode="recalculate-node",s.AddInputToFuncDecl="add-input-to-function-declaration",s.ChangeInternalCallToThrowErrors="change-internal-call-to-throw-errors",s.ChangeInternalCallToCatchErrors="change-internal-call-to-catch-errors",s.AddErrorOutputToInternalCall="add-error-output-to-internal-call",s.ChangeLoopToThrowErrors="change-loop-to-throw-errors",s.ChangeLoopToCatchErrors="change-loop-to-catch-errors",s.RecalculateLoopBody="recalculate-loop-body",s.RecalculateMethod="recalculate-method",s.AddArgToLoopBody="add-arg-to-loop-body",s.AddArgToMethod="add-arg-to-method",s.RecalculateNestedCondition="recalculate-nested-condition",s.ChangeNodeToThrowErrors="change-node-to-throw-errors",s.ChangeNodeToCatchErrors="change-node-to-catch-errors",s.ChangeOperationToThrowErrors="change-operation-to-throw-errors",s.ChangeOperationToCatchErrors="change-operation-to-catch-errors",s.ChangeFuncCallToThrowErrors="change-function-call-to-throw-errors",s.ChangeFuncCallToCatchErrors="change-function-call-to-catch-errors",s.ChangeSearchToThrowErrors="change-search-to-throw-errors",s.ChangeSearchToCatchErrors="change-search-to-catch-errors",s.ChangeVarDeclToThrowErrors="change-variable-declaration-to-throw-errors",s.ChangeVarDeclToCatchErrors="change-variable-declaration-to-catch-errors",s.ChangeVarInstToThrowErrors="change-variable-instance-to-throw-errors",s.ChangeVarInstToCatchErrors="change-variable-instance-to-catch-errors",s.AddErrorOutputToNode="add-error-output-to-node",s.AddErrorOutputToOperation="add-error-output-to-operation",s.AddErrorOutputToFuncCall="add-error-output-to-function-call",s.AddErrorOutputToSearch="add-error-output-to-search",s.AddErrorOutputToVarDecl="add-error-output-to-variable-declaration",s.AddErrorOutputToVarInst="add-error-output-to-variable-instance",s.AddInputToNode="add-input-to-node",s.AddInputToOperation="add-input-to-operation",s.AddInputToFuncCall="add-input-to-function-call",s.AddInputToSearch="add-input-to-search",s.AddPropertyToVarDecl="add-property-to-variable-declaration",s.AddPropertyToVarInst="add-property-to-variable-instance",s.AddMethodToDef="add-method-to-definition",s.ReSyncRowTransformer="re-sync-row-transformer",s.ManuallyAddRowTransformer="manually-add-row-transformer",s.AddPropertyToDef="add-property-to-definition",s.RestablishExternalAccountConnection="restablish-external-account-connection",s.AddThrownError="add-thrown-error",s.RecalculateTerminationStatement="recalculate-termination-statement",s.RecalculateReturnStmt="recalculate-return-statement",s.RecalculateContinueStmt="recalculate-continue-statement",s.RecalculateBreakStmt="recalculate-break-statement",s.AddPropertyToTerminationStatement="add-property-to-termination-statement",s.AddPropertyToReturnStmt="add-property-to-return-statement",s.AddPropertyToContinueStmt="add-property-to-continue-statement",s.AddPropertyToBreakStmt="add-property-to-break-statement",s.SetLiteralValueToExplicitlyEmpty="set-literal-value-to-explicitly-empty",s.ModifyLiteralValue="modify-literal-value",s.RemoveLiteralValue="remove-literal-value",s.ModifyLiteralValueAsType="modify-literal-value-as-type",s.UpdateProjectMetadata="update-project-metadata",s.RenameProject="rename-project",s.ChangeProjectDescription="change-project-description",s.RestoreNode="restore-node",s.RestoreDef="restore-definition",s.RestoreFuncDecl="restore-function-declaration",s.RestoreGlobalEvent="restore-global-event",s.RestoreSearch="restore-search",s.RestoreVarDecl="restore-variable-declaration",s.RestoreVarInst="restore-variable-instance",s.RestoreFuncCall="restore-function-call",s.RestoreOperation="restore-operation",s.RestoreCondition="restore-condition",s.RestoreReturnStmt="restore-return-statement",s.RestoreContinueStmt="restore-continue-statement",s.RestoreBreakStmt="restore-break-statement",s.RestoreInstalledProject="restore-installed-project",s.RestoreLoop="restore-loop",s.CreateNewDef="create-new-definition",s.CreateNewFuncDecl="create-new-function-declaration",s.CreateNewGlobalEvent="create-new-global-event",s.CreateNewSearch="create-new-search",s.CreateNewVarDecl="create-new-variable-declaration",s.CreateNewVarInst="create-new-variable-instance",s.CreateNewFuncCall="create-new-function-call",s.CreateNewOperation="create-new-operation",s.CreateNewCondition="create-new-condition",s.CreateNewReturnStmt="create-new-return-statement",s.CreateNewContinueStmt="create-new-continue-statement",s.CreateNewBreakStmt="create-new-break-statement",s.CreateNewInternalCall="create-new-internal-call",s.CreateNewLoop="create-new-loop",s.ImplementBuiltInFunctionalityAsDef="implement-built-in-functionality-as-definition",s.ImplementAbstractEntityAsDef="implement-abstract-entity-as-definition",s.ImplementNewHTTPEndpoint="implement-new-http-endpoint",s.ImplementNewScheduledTrigger="implement-new-scheduled-trigger",s.ImplementNewPersistedEntity="implement-new-persisted-entity",s.AddedNewRowTransformer="added-new-row-transformer",s.AddedSQLConnectionConfig="added-sql-connection-config",s.AddedNewSSLConnectionConfig="added-new-ssl-connection-config",s.AddedGoogleConnection="added-google-connection",s.AddedSlackConnection="added-slack-connection",s.AddedNewExternalAccountConnection="added-new-external-account-connection",s.AddedGoogleDriveConnection="added-google-drive-connection",s.AddedGoogleSheetsConnection="added-google-sheets-connection",s.AddedGoogleSlidesConnection="added-google-slides-connection",s.AddedGoogleMailConnection="added-gmail-connection",s.ManuallyCreateIndividualNode="manually-create-individual-node",s.UpdateNode="update-node",s.CreateNewProjectPublicationCompletedEvent="create-new-project-publication-completed-event",s.CreateNewCountedLoop="create-new-counted-loop",s.CreateNewListLoop="create-new-list-loop",s.CreateNewManualFlowLoop="create-new-manual-flow-loop",s.CreateNewObjectKeysLoop="create-new-object-keys-loop",s.CreateNewObjectValuesLoop="create-new-object-values-loop",s.CreateNewStringLoop="create-new-string-loop",s.CreateNewIsFalseCondition="create-new-is-false-condition",s.CreateNewIsTrueCondition="create-new-is-true-condition",s.CreateNewAndCondition="create-new-and-condition",s.CreateNewOrCondition="create-new-or-condition",s.DisconnectNodes="disconnect-nodes",s.DisconnectExecutions="disconnect-executions",s.DisconnectValues="disconnect-values",s.ConnectNodes="connect-nodes",s.ConnectExecution="connect-execution",s.ConnectValues="connect-values",s.ConnectValueToNewInput="connect-value-to-new-input",s.ConnectValueToNewOperationInput="connect-value-to-new-operation-input",s.ConnectValueToNewConditionInput="connect-value-to-new-condition-input",s.ConnectValueToNewSearchInput="connect-value-to-new-search-input",s.ConnectValueToNewVarDeclProperty="connect-value-to-new-variable-declaration-property",s.ConnectValueToNewVarInstProperty="connect-value-to-new-variable-instance-property",s.ConnectValueToNewReturnStmtProperty="connect-value-to-new-return-statement-property",s.ConnectValueToNewContinueStmtProperty="connect-value-to-new-continue-statement-property",s.ConnectValueToNewBreakStmtProperty="connect-value-to-new-break-statement-property",s.ConnectNewFuncDeclArgToValue="connect-new-function-argument-to-value",s.RemoveNodes="remove-nodes",s.RemoveNode="remove-node",s.InitialLoadAutomaticCanvasRefresh="initial-load-automatic-canvas-refresh",s.MoveNodes="move-nodes",s.MoveNode="move-node",s.CloneNodes="clone-nodes",s.CloneNode="clone-node",s.GenerateSQLMigrationOnPersistedEntityUpdate="generate-sql-migration-on-persisted-entity-update",s))(w||{}),Me=(s=>(s.ActionOwnerEntityNotEditable="action-owner-entity-not-editable",s.ActionCounterpartEntityNotEditable="action-counterpart-entity-not-editable",s.ActionOwnerEntityNonDeletable="action-owner-entity-non-deletable",s.GlobalVariableDeclarationCannnotCatchError="global-variable-declaration-cannot-catch-error",s.GlobalVariableDeclarationCannotReadValue="global-variable-declaration-cannot-read-value",s.GlobalVariableDeclarationCannotBeCalled="global-variable-declaration-cannot-be-called",s.GlobalVariableDeclarationCannotCallFromError="global-variable-declaration-cannot-call-from-error",s.ValueReadingOverridesConstantProperty="value-reading-overrides-constant-property",s.DefaultValueOverridesConstantProperty="default-value-overrides-constant-property",s.ValueReadingOverridesConstantVariable="value-reading-overrides-constant-variable",s.DefaultValueOverridesConstantVariable="default-value-overrides-constant-variable",s.CannotSuccessCallItself="cannot-success-call-itself",s.CannotErrorCallItself="cannot-error-call-itself",s.CannotEntryCallItself="cannot-entry-call-itself",s.CannotValueWriteItself="cannot-value-write-itself",s.CannotBeCalledBeforeDeclaration="cannot-be-called-before-declaration",s.CannotBeCalledInParallelBranchToDeclaration="cannot-be-called-in-parallel-branch-to-declaration",s.CannotBeHigherScopeThanDeclaration="cannot-be-higher-scope-than-declaration",s.InputsInGlobalVariableDeclarationsCannotReadValues="inputs-in-global-variable-declarations-cannot-read-values",s))(Me||{});class H_e{constructor({id:u,action:i,errorReason:r,owner:a,counterpart:c,rootAction:e},f){R(this,"id");R(this,"action");R(this,"errorReason");R(this,"owner",null);R(this,"counterpart",null);R(this,"rootAction",!1);R(this,"parent");this.id=u,this.action=i,this.errorReason=r||null,this.owner=a||null,this.counterpart=c||null,this.rootAction=e||!1,this.parent=f}}class S extends J.Events{constructor(i,r,a,c,e=!1,f=""){super(f?f+"-cs-events":"anonymous-cs-events");R(this,"id",x.UUID.uuid());R(this,"seenEntities",[]);R(this,"added",{});R(this,"updated",{});R(this,"removed",{});R(this,"affected",{});R(this,"self",null);R(this,"author");R(this,"timestamp");R(this,"open",!0);R(this,"startedClose",!1);R(this,"dirty",!0);R(this,"submitting",!1);R(this,"lockedVersions",!1);R(this,"type","manual");R(this,"autoclose",!1);R(this,"actionName","");R(this,"project");R(this,"events",new Map);R(this,"ignoreNonEditable",!1);R(this,"ignoreNonDeletable",!1);R(this,"logger");if(this.project=i,this.author=r||x.sessionAuthor||"",this.timestamp=a,this.self=c,this.autoclose=e,this.actionName=f,this.logger=J.Logger.module("cs:"+(this.actionName?this.actionName+":":"")+this.id),this.autoclose&&!this.actionName)throw new Error("Auto-close change-set must have an auto-close action name.")}get index(){const i=this.project.history.indexOf(this);return i===-1?null:i}get isEmpty(){return Object.keys(this.added).length===0&&Object.keys(this.updated).length===0&&Object.keys(this.removed).length===0}get isValid(){var i;return!(this.isEmpty&&this.self&&!this.affected[(i=this.self)==null?void 0:i.id])}get list(){return[...Object.values(this.added),...Object.values(this.updated),...Object.values(this.removed)]}get listAdded(){return Object.values(this.added)}get listUpdated(){return Object.values(this.updated)}get listRemoved(){return Object.values(this.removed)}get listAffected(){return Object.values(this.affected)}get addedIds(){return Object.keys(this.added)}get updatedIds(){return Object.keys(this.updated)}get removedIds(){return Object.keys(this.removed)}get affectedIds(){return Object.keys(this.affected)}event(i){this.logger.log(`ChangeSet Event: ${i.action} (${i.id})`);const r=new H_e(i,this);this.events.set(i.id,r),this.emit("change-set-event",r)}discardOrphans(){this.added[this.project.id]&&(this.updatedIds.forEach(e=>{const f=this.updated[e];this.added[e]=f,delete this.updated[e]}),this.removedIds.forEach(e=>{this.remove(e)}));const i=[...this.addedIds,...this.updatedIds],a=this.project.toFlatIds().filter(e=>!this.project.diggestedBuiltInBaseEntitiesIds.has(e));if(i.filter(e=>!a.includes(e)).forEach(e=>{const f=this.get(e);this.logger.warn(`[discardOrphans] Entity ${f==null?void 0:f.type} with id "${e}" present in change-set but not in project. Removing from change-set.`),this.remove(e)}),this.added[this.project.id]){const e=[...this.addedIds,...this.updatedIds];this.project.toFlatIds().filter(E=>!this.project.diggestedBuiltInBaseEntitiesIds.has(E)).filter(E=>!e.includes(E)).forEach(E=>{const b=this.project.get(E);this.add(b,"added")})}}async discardOrphansAsync(i={}){const r=J.YieldTracker.from(i),a=this.project.toFlatIds();if(this.added[this.project.id]){for(const h of this.updatedIds){const m=this.updated[h];this.added[h]=m,delete this.updated[h],await r.tick()}for(const h of this.removedIds)this.remove(h),await r.tick()}const c=[...this.addedIds,...this.updatedIds],e=a.filter(h=>!this.project.diggestedBuiltInBaseEntitiesIds.has(h)),f=c.filter(h=>!e.includes(h));for(const h of f){const m=this.get(h);this.logger.warn(`[discardOrphansAsync] Entity ${m==null?void 0:m.type} with id "${h}" present in change-set but not in project. Removing from change-set.`),this.remove(h),await r.tick()}if(this.added[this.project.id]){const h=[...this.addedIds,...this.updatedIds],E=a.filter(b=>!this.project.diggestedBuiltInBaseEntitiesIds.has(b)).filter(b=>!h.includes(b));for(const b of E){const A=this.project.get(b);this.add(A,"added"),await r.tick()}}}captureAllChangesInVersionInstances(){[...this.addedIds,...this.updatedIds].forEach(r=>{const a=this.project.get(r);if(!a){const e=this.added[r],f=this.updated[r],h=e||f;throw new Error(`Entity ${(h==null?void 0:h.type)||"of unknown type"} with id "${r}" was ${e?"added":"updated"} but isn't found in the project state when capturing version for change-set.`)}const c=this.get(r);a.version===c.version&&a.captureVersion()}),this.removedIds.forEach(r=>{const a=this.project.getDeleted(r);if(!a){const e=this.removed[r];throw new Error(`Entity ${(e==null?void 0:e.type)||"of unknown type"} with id "${r}" was removed but isn't found in the project state when capturing version for change-set.`)}const c=this.get(r);a.version===c.version&&a.captureVersion()})}async captureAllChangesInVersionInstancesAsync(i={}){const r=J.YieldTracker.from(i),a=[...this.addedIds,...this.updatedIds];for(const c of a){const e=this.project.get(c);if(!e){const h=this.added[c],m=this.updated[c],E=h||m;throw new Error(`Entity ${(E==null?void 0:E.type)||"of unknown type"} with id "${c}" was ${h?"added":"updated"} but isn't found in the project state when capturing version for change-set.`)}const f=this.get(c);e.version===f.version&&e.captureVersion(),await r.tick()}for(const c of this.removedIds){const e=this.project.getDeleted(c);if(!e){const h=this.removed[c];throw new Error(`Entity ${(h==null?void 0:h.type)||"of unknown type"} with id "${c}" was removed but isn't found in the project state when capturing version for change-set.`)}const f=this.get(c);e.version===f.version&&e.captureVersion(),await r.tick()}}async attemptAutocloseAsync(i,r){var a;return this.autoclose&&this.actionName&&this.actionName===i&&(this.self&&r===((a=this.self)==null?void 0:a.id)||!this.self)&&await this.closeAsync(),this}async closeAsync(i={}){const r=J.YieldTracker.from(i),a={persistType:"sequential",...i};if(!this.open||this.startedClose)return this.logger.warn(`Change-set (${this.id}) is already closed or in the process of closing.`),this;const c=i.awaitBeforeClose??!0,e=i.awaitExternalPersist??!0;return this.startedClose||(this.startedClose=!0,c?await this.beforeCloseAsync({tracker:r}):this.beforeCloseAsync({tracker:r})),!this.isValid&&this.self&&!this.added[this.self.id]&&!this.updated[this.self.id]&&this.removed[this.self.id],await this.discardOrphansAsync({tracker:r}),await this.sanitizeAsync({tracker:r}),await this.recursiveCaptureUpstreamVersionsAsync({tracker:r}),this.lockedVersions||(await this.captureAllChangesInVersionInstancesAsync({tracker:r}),await this.recursiveCaptureUpstreamVersionsAsync({tracker:r})),this.open=!1,this.isEmpty?(this.logger.warn(`[ChangeSet.closeAsync] Empty change-set (${this.id}) discarded upon closing.`),this.dirty=!1,this.project.discardChangeSet(this),this.logger.log("[ChangeSet.closeAsync] Closing pending change-sets..."),this.project.closePersistChangeSetsSequentially(),this):(this.project.emit(pi.CHANGE_SET_CLOSED_BEFORE_PERSIST,this),e?a.persistType==="parallel"?await this.project.persistChangeSetInParallel(this):await this.project.persistChangeSetSequentially(this):a.persistType==="parallel"?this.project.persistChangeSetInParallel(this):this.project.persistChangeSetSequentially(this),this.destroy(),this)}attemptAutoclose(i,r){var a;return this.autoclose&&this.actionName&&this.actionName===i&&(this.self&&r===((a=this.self)==null?void 0:a.id)||!this.self)&&this.close(),this}recursiveCaptureUpstreamVersions(){if(this.lockedVersions)return;[...this.addedIds,...this.updatedIds,...this.removedIds].forEach(r=>{const a=this.get(r),{added:c,updated:e,removed:f,affected:h}=a.recursiveCaptureUpstreamVersions(this.timestamp);for(const m of c)this.add(m,"added");for(const m of e)this.add(m,"updated");for(const m of f)this.add(m,"removed");for(const m of h)this.add(m,"affected")})}async recursiveCaptureUpstreamVersionsAsync(i={}){if(this.lockedVersions)return;const r=J.YieldTracker.from(i),a=[...this.addedIds,...this.updatedIds,...this.removedIds];for await(const c of a){const e=this.get(c),{added:f,updated:h,removed:m,affected:E}=e.recursiveCaptureUpstreamVersions(this.timestamp);for(const b of f)this.add(b,"added");for(const b of h)this.add(b,"updated");for(const b of m)this.add(b,"removed");for(const b of E)this.add(b,"affected");await r.tick()}}sanitize(){this.listAdded.forEach(i=>{i.previousVersion=null})}async sanitizeAsync(i={}){const r=J.YieldTracker.from(i);for(const a of this.listAdded)a.previousVersion=null,await r.tick()}syncDependents(){return[...this.list,...this.listAffected].forEach(i=>{const r=this.project.get(i.id);!r||r.deleted||Vg(r,this.project)||r==null||r.syncDependents(this)}),this}async syncDependentsAsync(i={}){const r=J.YieldTracker.from(i);for(const a of[...this.list,...this.listAffected]){const c=this.project.get(a.id);!c||c.deleted||Vg(c,this.project)||(c==null||c.syncDependents(this),await r.tick())}return this}async beforeCloseAsync(i={}){const r=J.YieldTracker.from(i);await this.project.emitAsync(pi.BEFORE_CHANGE_SET_CLOSE_BEFORE_SIDE_EFFECTS,this),await this.syncDependentsAsync({tracker:r}),await this.emitAsyncProjectSideEffects({tracker:r}),await this.project.emitAsync(pi.BEFORE_CHANGE_SET_CLOSE_AFTER_SIDE_EFFECTS,this),this.teardown()}beforeClose(){this.project.emit(pi.BEFORE_CHANGE_SET_CLOSE_BEFORE_SIDE_EFFECTS,this),this.syncDependents(),this.emitProjectSideEffects(),this.project.emit(pi.BEFORE_CHANGE_SET_CLOSE_AFTER_SIDE_EFFECTS,this),this.teardown()}teardown(){this.destroy()}emitProjectSideEffects(){return S_e(this)}async emitAsyncProjectSideEffects(i={}){return Z_e(this,i)}close(i={}){const r={persistType:"sequential",...i};if(!this.open||this.startedClose)return this.logger.warn(`Change-set (${this.id}) is already closed or in the process of closing.`),this;if(this.startedClose||(this.startedClose=!0,this.beforeClose()),!this.isValid&&this.self&&!this.added[this.self.id]&&!this.updated[this.self.id]&&this.removed[this.self.id],this.discardOrphans(),this.sanitize(),this.captureAllChangesInVersionInstances(),this.lockedVersions||(this.recursiveCaptureUpstreamVersions(),this.captureAllChangesInVersionInstances()),this.open=!1,this.isEmpty)return this.logger.warn(`[ChangeSet.close] Empty change-set (${this.id}) discarded upon closing.`),this.project.discardChangeSet(this),this.logger.log("[ChangeSet.close] Closing pending change-sets..."),this.project.closePersistChangeSetsSequentially(),this;if(this.added[this.project.id]&&this.updatedIds.length)throw new Error("No 'updated' entities should be present in the change-set when the project entity is in the 'added' list. New projects can only have newly added entities");if(this.added[this.project.id]&&this.removedIds.length)throw new Error("No 'removed' entities should be present in the change-set when the project entity is in the 'added' list. New projects can only have newly added entities");if(!this.updated[this.project.id]&&!this.added[this.project.id])throw new Error("Change-set must also have the project entity as 'updated' or 'added'. All changes must propagate upstream until the root project entity.");return this.project.emit(pi.CHANGE_SET_CLOSED_BEFORE_PERSIST,this),r.persistType==="parallel"?this.project.persistChangeSetInParallel(this):this.project.persistChangeSetSequentially(this),this.destroy(),this}addDependentsToAffected(i){Object.values(i.detachedDependents).forEach(r=>{const{entity:a,field:c}=r;this.has(a.id)||this.add(a,"affected")})}get(i){return this.added[i]?this.added[i]:this.updated[i]?this.updated[i]:this.removed[i]?this.removed[i]:null}remove(i){return this.has(i)&&(delete this.added[i],delete this.updated[i],delete this.removed[i],delete this.affected[i],this.seenEntities=this.seenEntities.filter(r=>r!==i)),this}add(i,r,a={preventRecursion:!1}){var e,f,h,m;if(!this.open||!this.dirty)return this;if(Vg(i,this.project))return this;if(this.seenEntities.indexOf(i.id)===-1&&this.seenEntities.push(i.id),r==="removed"){if(this.added[i.id])return delete this.added[i.id],delete this.affected[i.id],delete this.updated[i.id],this.seenEntities=this.seenEntities.filter(b=>b!==i.id),delete this.project.deletedInstances[i.id],this;if(this.updated[i.id]&&delete this.updated[i.id],this.affected[i.id]&&delete this.affected[i.id],!this.hasRemoved(i.id)&&!this.lockedVersions&&(i.increaseVersion(this.timestamp),!a.preventRecursion)){const{added:b,updated:A,removed:_,affected:P}=i.recursiveCaptureUpstreamVersions(this.timestamp);for(const V of b)this.add(V,"added");for(const V of A)this.add(V,"updated");for(const V of _)this.add(V,"removed");for(const V of P)this.add(V,"affected")}i.captureVersion();const E=(e=i.knownVersions)==null?void 0:e.get(i.version);if(!E)throw Error(`Version ${i.version} should have a cached version instance but it wasn't found when adding entity to change-set`);return this.removed[i.id]=E,this}if(r==="added"){if(this.removed[i.id])return this;if(this.updated[i.id]&&delete this.updated[i.id],this.affected[i.id]&&delete this.affected[i.id],!this.hasAdded(i.id)&&!this.lockedVersions&&!a.preventRecursion){const{added:b,updated:A,removed:_,affected:P}=i.recursiveCaptureUpstreamVersions(this.timestamp);for(const V of b)this.add(V,"added");for(const V of A)this.add(V,"updated");for(const V of _)this.add(V,"removed");for(const V of P)this.add(V,"affected")}i.previousVersion=null,i.captureVersion();const E=(f=i.knownVersions)==null?void 0:f.get(i.version);if(!E)throw Error(`Version ${i.version} should have a cached version instance but it wasn't found when adding entity to change-set`);return this.added[i.id]=E,delete this.affected[i.id],this.addDependentsToAffected(i),this}if(r==="updated"){if(this.removed[i.id])return this;if(this.added[i.id])return i.captureVersion(),this.addDependentsToAffected(i),this;if(this.affected[i.id]&&delete this.affected[i.id],!this.hasUpdated(i.id)&&!this.lockedVersions&&(i.increaseVersion(this.timestamp),!a.preventRecursion)){const{added:b,updated:A,removed:_,affected:P}=i.recursiveCaptureUpstreamVersions(this.timestamp);for(const V of b)this.add(V,"added");for(const V of A)this.add(V,"updated");for(const V of _)this.add(V,"removed");for(const V of P)this.add(V,"affected")}i.activeVersion=!0,i.captureVersion();const E=(h=i.knownVersions)==null?void 0:h.get(i.version);if(!E)throw Error(`Version ${i.version} should have a cached version instance but it wasn't found when adding entity to change-set`);return this.updated[i.id]=E,this.addDependentsToAffected(i),this}if(r==="affected"){if(this.removed[i.id])return this;if(this.added[i.id])return this;if(this.updated[i.id])return this;if(this.affected[i.id]=i,!this.lockedVersions){const E=i.version+"--"+this.id,b=((m=i.knownVersions)==null?void 0:m.get(E))||i.snapshot();i.apply(b),i.knownVersions=i.knownVersions?i.knownVersions.set(E,b):new Map().set(E,b)}}return this}toJSON(){var f;const i={},r={},a={},c=new Set;for(const h of Object.values(this.added))i[h.id]=h.toShallowJSON();for(const h of Object.values(this.updated))r[h.id]=h.toShallowJSON();for(const h of Object.values(this.removed))a[h.id]=h.toShallowJSON();for(const h of Object.values(this.affected))c.add(h.id);const e=this.get(((f=this.self)==null?void 0:f.id)||"");return{added:i,updated:r,removed:a,affected:Array.from(c),self:e?e.toShallowJSON():null,seenEntities:this.seenEntities,actionName:this.actionName}}has(i){return!!this.added[i]||!!this.removed[i]||!!this.updated[i]||!!this.affected[i]}hasAdded(i){return!!this.added[i]}hasUpdated(i){return!!this.updated[i]}hasRemoved(i){return!!this.removed[i]}hasAffected(i){return!!this.affected[i]}}function ggi(s){return new Set([...Object.keys(s.added),...Object.keys(s.updated),...Object.keys(s.removed),...Array.from(s.affected)])}function j_(s,u,i){var f;const r=new Date().toISOString(),a=new S(i,x.sessionAuthor,r,i);if(a.lockedVersions=!0,s===u)throw J.Logger.error("From: ",s),J.Logger.error("To: ",u),new Error("Cannot generate transitional change set between the same two versions or change-sets");let c;if(s==="initial"?c=!0:u==="initial"?c=!1:B(s.timestamp).isBefore(B(u.timestamp))?c=!0:c=!1,J.Logger.log("Transitioning from ",s==="initial"?"initial":s.index),J.Logger.log("Transitioning to ",u==="initial"?"initial":u.index),J.Logger.log("Is forward: ",c),c){const h=u,m=h.index,E=s==="initial"?0:s.index;J.Logger.log("ownIndex: ",m),J.Logger.log("startIndex: ",E),J.Logger.log("CH ID: ",h.id);const b=m===E?[i.history[m]]:i.history.slice(E+1,m+1);if(b.sort((A,_)=>B(A.timestamp).isAfter(B(_.timestamp))?1:-1),!b.length)throw new Error("No change sets in the history between the history indexes provided");J.Logger.log("REDO change-set: ",b[0].id," ",b[0].timestamp),b.forEach(A=>{k_(A,_=>{const P=i.instances[_.id]||i.deletedInstances[_.id];let V="";try{V=le(_,i)}catch{}if(!P)throw new Error(`Entity ${_.type} ${V?`"${V}" `:""}with id "${_.id}" doesn't have an 'activeVersion' set.`);if(!P.knownVersions)throw new Error(`Entity ${_.type} ${V?`"${V}" `:""}with id "${_.id}" has an active version instance missing the 'knownVersions' property value.`);if(!P.knownVersions.get(_.version))throw new Error(`Entity ${_.type} ${V?`"${V}" `:""}with id "${_.id}" has an active version instance missing the 'knownVersions' property value for version "${_.version}".`);P.restoreVersion(_.version),P.addSelfToProject(a),a.timestamp=P.createdAt,a.add(P,H.Added,{preventRecursion:!0})},_=>{const P=i.instances[_.id]||i.deletedInstances[_.id];let V="";try{V=le(_,i)}catch{}if(!P)throw new Error(`Entity ${_.type} ${V?`"${V}" `:""}with id "${_.id}" doesn't have an 'activeVersion' set.`);if(!P.knownVersions)throw new Error(`Entity ${_.type} ${V?`"${V}" `:""}with id "${_.id}" has an active version instance missing the 'knownVersions' property value.`);if(!P.knownVersions.get(_.version))throw new Error(`Entity ${_.type} ${V?`"${V}" `:""}with id "${_.id}" has an active version instance missing the 'knownVersions' property value for version "${_.version}".`);P.restoreVersion(_.version),a.timestamp=P.createdAt,a.add(P,H.Updated,{preventRecursion:!0})},_=>{var M;const P=i.instances[_.id]||i.deletedInstances[_.id];let V="";try{V=le(_,i)}catch{}if(!P)throw new Error(`Entity ${_.type} ${V?`"${V}" `:""}with id "${_.id}" doesn't have an 'activeVersion' set.`);if(!P.knownVersions)throw new Error(`Entity ${_.type} ${V?`"${V}" `:""}with id "${_.id}" has an active version instance missing the 'knownVersions' property value.`);if(!P.knownVersions.get(_.version))throw new Error(`Entity ${_.type} ${V?`"${V}" `:""}with id "${_.id}" has an active version instance missing the 'knownVersions' property value for version "${_.version}".`);P.restoreVersion(_.version),(M=P.removeFromParent)==null||M.call(P,a),P.unsubscribe(),P.unsubscribeFromDependencies(),i.subscribeDeletedInstance(P),a.timestamp=P.createdAt,a.add(P,H.Removed,{preventRecursion:!0})},_=>{const P=i.instances[_.id]||i.deletedInstances[_.id];let V="";try{V=le(_,i)}catch{}if(!P)throw new Error(`Entity ${_.type} ${V?`"${V}" `:""}with id "${_.id}" doesn't have an 'activeVersion' set.`);if(!P.knownVersions)throw new Error(`Entity ${_.type} ${V?`"${V}" `:""}with id "${_.id}" has an active version instance missing the 'knownVersions' property value.`);if(!P.knownVersions.get(_.version))throw new Error(`Entity ${_.type} ${V?`"${V}" `:""}with id "${_.id}" has an active version instance missing the 'knownVersions' property value for version "${_.version}".`);const M=_.version+"--"+A.id;P.restoreVersion(M),a.timestamp=P.createdAt,a.add(P,H.Updated,{preventRecursion:!0})})})}else{const h=s,m=h.index,E=u==="initial"?0:u.index;J.Logger.log("CH ID: ",h.id);const b=m===E?[i.history[m]]:i.history.slice(E+1,m+1);if(b.sort((A,_)=>B(_.timestamp).isAfter(B(A.timestamp))?1:-1),!b.length)throw new Error("No change sets in the history between the history indexes provided");J.Logger.log("UNDO change-set: ",b[0].id," ",b[0].timestamp),b.forEach(A=>{k_(A,_=>{var M;const P=i.instances[_.id]||i.deletedInstances[_.id];let V="";try{V=le(_,i)}catch{}if(!P)throw new Error(`Entity ${_.type} ${V?`"${V}" `:""}with id "${_.id}" doesn't have an 'activeVersion' set.`);if(!P.knownVersions)throw new Error(`Entity ${_.type} ${V?`"${V}" `:""}with id "${_.id}" has an active version instance missing the 'knownVersions' property value.`);if(!P.knownVersions.get(_.version))throw new Error(`Entity ${_.type} ${V?`"${V}" `:""}with id "${_.id}" has an active version instance missing the 'knownVersions' property value for version "${_.version}".`);_.previousVersion&&(P.restoreVersion(_.previousVersion),(M=P.removeFromParent)==null||M.call(P,a),P.unsubscribe(),P.unsubscribeFromDependencies(),i.subscribeDeletedInstance(P)),a.timestamp=P.createdAt,a.add(P,H.Removed,{preventRecursion:!0})},_=>{const P=i.instances[_.id]||i.deletedInstances[_.id];let V="";try{V=le(_,i)}catch{}if(!P)throw new Error(`Entity ${_.type} ${V?`"${V}" `:""}with id "${_.id}" doesn't have an 'activeVersion' set.`);if(!P.knownVersions)throw new Error(`Entity ${_.type} ${V?`"${V}" `:""}with id "${_.id}" has an active version instance missing the 'knownVersions' property value.`);if(!P.knownVersions.get(_.version))throw new Error(`Entity ${_.type} ${V?`"${V}" `:""}with id "${_.id}" has an active version instance missing the 'knownVersions' property value for version "${_.version}".`);P.restoreVersion(_.previousVersion),a.timestamp=P.createdAt,a.add(P,H.Updated,{preventRecursion:!0})},_=>{const P=i.instances[_.id]||i.deletedInstances[_.id];let V="";try{V=le(_,i)}catch{}if(!P)throw new Error(`Entity ${_.type} ${V?`"${V}" `:""}with id "${_.id}" doesn't have an 'activeVersion' set.`);if(!P.knownVersions)throw new Error(`Entity ${_.type} ${V?`"${V}" `:""}with id "${_.id}" has an active version instance missing the 'knownVersions' property value.`);if(!P.knownVersions.get(_.version))throw new Error(`Entity ${_.type} ${V?`"${V}" `:""}with id "${_.id}" has an active version instance missing the 'knownVersions' property value for version "${_.version}".`);P.restoreVersion(_.previousVersion),P.addSelfToProject(a),a.timestamp=P.createdAt,a.add(P,H.Added,{preventRecursion:!0})},_=>{const P=i.instances[_.id]||i.deletedInstances[_.id];let V="";try{V=le(_,i)}catch{}if(!P)throw new Error(`Entity ${_.type} ${V?`"${V}" `:""}with id "${_.id}" doesn't have an 'activeVersion' set.`);if(!P.knownVersions)throw new Error(`Entity ${_.type} ${V?`"${V}" `:""}with id "${_.id}" has an active version instance missing the 'knownVersions' property value.`);if(!P.knownVersions.get(_.version))throw new Error(`Entity ${_.type} ${V?`"${V}" `:""}with id "${_.id}" has an active version instance missing the 'knownVersions' property value for version "${_.version}".`);P.restoreVersion(P.version),a.timestamp=P.createdAt,a.add(P,H.Affected,{preventRecursion:!0})})})}let e;if(u==="initial"){const h=Array.from(((f=i.knownVersions)==null?void 0:f.values())||[]).reduce((m,E)=>!m||B(E.createdAt).isBefore(B(m.createdAt))?E:m,null);if(!h)throw new Error("No oldest version found");e=h.createdAt}else e=u.timestamp;return a.open=!1,{transitionalChangeSet:a,transitionTime:r,timeOfOriginalTargetChanges:e}}function k_(s,u,i,r,a){var h;if(!(s!=null&&s.self))throw new Error("Change set must have a valid `self` entity state to be traversed");const c=((h=s.self)==null?void 0:h.type)===d.Project?s.self:s.self.project,e=new Fn(s.self,{allBuiltInEntityIds:c.diggestedBuiltInBaseEntitiesIds});J.Logger.log("changeSet.added: ",Object.keys(s.added).length),J.Logger.log("changeSet.updated: ",Object.keys(s.updated).length),J.Logger.log("changeSet.removed: ",Object.keys(s.removed).length);const f={...s.added,...s.updated,...s.removed,...s.affected};e.order=Object.keys(f),e.flatRecord=f,e.orderEntities(),J.Logger.log("All entities: ",e.order.map((m,E)=>`${E+1}: ${f[m].type} - ${m}`).join(`,
7
7
  `)),J.Logger.log("Traversing additions"),e.visit(async m=>{if(s.added[m.id])try{u(m)}catch(E){J.Logger.error("Error: ",E)}}),J.Logger.log("Traversing updates"),e.visit(async m=>{if(s.updated[m.id])try{i(m)}catch(E){J.Logger.error("Error: ",E)}}),J.Logger.log("Traversing removals"),e.visit(async(m,E)=>{if(s.removed[m.id])try{r(m)}catch(b){J.Logger.error("Error: ",b)}}),J.Logger.log("Traversing affected"),e.visit(async(m,E)=>{if(s.affected[m.id])try{a(m)}catch(b){J.Logger.error("Error: ",b)}})}function U_(s,u,i){const r=s+1;return u.splice(r,u.length-r,i),u.length-1}function Igi(s){[...s.listUpdated,...s.listAdded].forEach(u=>{const i=s.project.get(u.id);i.editable=!0})}function Rgi(s){[...s.listUpdated,...s.listAdded].forEach(u=>{const i=s.project.get(u.id);i.deletable=!0})}function Dgi(s){[...s.listUpdated,...s.listAdded].forEach(u=>{const i=s.project.get(u.id);i.editable=!0,i.deletable=!0})}function wgi(s){[...s.listUpdated,...s.listAdded].forEach(u=>{const i=s.project.get(u.id);i.editable=!1})}function Cgi(s){[...s.listUpdated,...s.listAdded].forEach(u=>{const i=s.project.get(u.id);i.deletable=!1})}function Ogi(s){[...s.listUpdated,...s.listAdded].forEach(u=>{const i=s.project.get(u.id);i.editable=!1,i.deletable=!1})}function _gi(s,u){u?s.metaSync({editable:!1,deletable:!1},u):(s.editable=!1,s.deletable=!1),Fe(s,new Set,{ignoreBuiltInBaseEntities:!0}).forEach(r=>{u?r.metaSync({editable:!1,deletable:!1},u):(r.editable=!1,r.deletable=!1)})}function Vgi(s,u){u?s.metaSync({editable:!0,deletable:!0},u):(s.editable=!0,s.deletable=!0),Fe(s,new Set,{ignoreBuiltInBaseEntities:!0}).forEach(r=>{u?r.metaSync({editable:!0,deletable:!0},u):(r.editable=!0,r.deletable=!0)})}function Pgi(s){const{projectRecord:u,chain:i,projectId:r,sort:a,order:c}=s,e=a?(i||[]).sort((E,b)=>{const A=E.updated[r],_=b.updated[r];return B(A.createdAt).valueOf()-B(_.createdAt).valueOf()}):i||[],f={...u};e.forEach(E=>{Object.values(E.removed).forEach(A=>{delete f[A.id]}),Object.values(E.added).forEach(A=>{f[A.id]=A}),Object.values(E.updated).forEach(A=>{f[A.id]=A});const b=E.updated[r];f[r]=b});let h=null;if(c){const E=new Fn;E.flatRecord=f,E.orderEntities(),h=E.order}return{project:f[r],record:f,order:h}}class qx{constructor(u){R(this,"version");R(this,"previousVersion");R(this,"createdAt");R(this,"deleted",!1);R(this,"author");this.version=u.version,this.previousVersion=u.previousVersion,this.createdAt=B(u.createdAt).toISOString(),this.deleted=u.deleted,this.author=u.author}baseMetaSync(u,i,r){this.deleted=u.deleted!==void 0?u.deleted:this.deleted}}class cn extends qx{constructor(i){super(i);R(this,"deletable",!0);R(this,"editable",!0);this.deletable=i.deletable,this.editable=i.editable}checkCanEditWithCounterpartAndSideEffects(i,r,a,c){var e,f;return!this.checkCanEdit(i,c)||!this.checkCanEdit(r,c)?(this.checkCanEdit(r,c)?(J.Logger.warn(`[${a}] User is not allowed to edit this ${i.type} entity with id: ${i.id}`),c==null||c.event({id:`${a}-${i.id}--${r.id}--${Me.ActionOwnerEntityNotEditable}`,action:a,owner:i,counterpart:r,errorReason:Me.ActionOwnerEntityNotEditable,rootAction:((f=c==null?void 0:c.self)==null?void 0:f.id)===i.id&&(c==null?void 0:c.actionName)===a})):(J.Logger.warn(`[${a}] User is not allowed to edit this ${i.type} entity with id: ${i.id} because its counterpart ${r.type} with id: ${r.id} is not editable`),c==null||c.event({id:`${a}-${i.id}--${r.id}--${Me.ActionCounterpartEntityNotEditable}`,action:a,owner:i,counterpart:r,errorReason:Me.ActionCounterpartEntityNotEditable,rootAction:((e=c==null?void 0:c.self)==null?void 0:e.id)===i.id&&(c==null?void 0:c.actionName)===a})),c==null||c.attemptAutoclose(a,i.id),!1):!0}checkCanEditFromScopeOwner(i,r){const a=Mt(i,i.project);return a?this.checkCanEdit(a,r):!0}checkCanEditFromScopeOwnerWithSideEffects(i,r,a){var e;const c=this.checkCanEditFromScopeOwner(i,a);return!c&&!(a!=null&&a.ignoreNonEditable)&&(J.Logger.warn(`[${r}] User is not allowed to edit this ${i.type} entity with id: ${i.id}`),a==null||a.event({id:`${r}-${i.id}--${Me.ActionOwnerEntityNotEditable}`,action:r,owner:i,errorReason:Me.ActionOwnerEntityNotEditable,rootAction:((e=a==null?void 0:a.self)==null?void 0:e.id)===i.id&&(a==null?void 0:a.actionName)===r}),a==null||a.attemptAutoclose(r,i.id)),c}checkCanEdit(i,r){var a;return(a=i.project)!=null&&a.initialized?i.type===d.BuiltInBaseEntity||i.type===d.PrimitiveEntity?!1:i.initialized?!(i.project.diggestedBuiltInBaseEntitiesIds.has(i.id)||i.parent&&!(this.checkCanEdit(i.parent,r)&&i.editable)&&!(r!=null&&r.ignoreNonEditable)||!i.editable&&!(r!=null&&r.ignoreNonEditable)):!0:!0}checkCanDelete(i,r){var a;return i.type!==d.Project&&i.project.diggestedBuiltInBaseEntitiesIds.has(i.id)?!1:i.type===d.Project||(a=i.parent)!=null&&a.deleted?!0:!(!i.deletable&&!(r!=null&&r.ignoreNonDeletable))}baseMetaSync(i,r,a){this.deletable=i.deletable!==void 0?i.deletable:this.deletable,this.editable=i.editable!==void 0?i.editable:this.editable;const c={...i,deleted:this.checkCanDelete(r,a)?i.deleted:!1};super.baseMetaSync(c,r,a)}}var W_e=(s=>(s.ArgumentDataTypeEntityField="data-type-entity-field",s.ArgumentDataTypeField="data-type-field",s.ArgumentImplementsField="argument-implements-field",s))(W_e||{});const Ai=class Ai extends cn{constructor(i,r){super(i);R(this,"initialData");R(this,"id");R(this,"name");R(this,"codeName",null);R(this,"description",null);R(this,"index");R(this,"required");R(this,"constant",!0);R(this,"type",d.ArgumentDeclaration);R(this,"defaultValue",null);R(this,"dataType",null);R(this,"writesValues",[]);R(this,"implements",[]);R(this,"project");R(this,"errors",[]);R(this,"parent");R(this,"detachedDependents",{});R(this,"knownVersions",null);R(this,"activeVersion",!1);R(this,"initialized",!1);R(this,"startedInitialization",!1);R(this,"suggestion",!1);R(this,"_codeNativeValueValidation",null);this.initialData=i,this.project=r,this.id=i.id,this.index=i.index,this.name=i.name,this.description=i.description,this.codeName=i.codeName,this.required=i.required,this.constant=!0}static new(i=null){return{id:x.UUID.uuid(),version:x.UUID.uuid(),createdAt:(i==null?void 0:i.timestamp)||B().toISOString(),author:(i==null?void 0:i.author)||x.sessionAuthor,previousVersion:null,deleted:!1,deletable:!0,editable:!0,type:d.ArgumentDeclaration,name:"",codeName:null,description:"",index:0,required:!1,constant:!0,implements:[],dataType:null,defaultValue:null,writesValues:[],parent:null}}static fromGenerationTarget(i,r,a){const c=a===void 0?r.addChangeSet(new S(r,x.sessionAuthor,B().toISOString(),r,!0,w.CreateFromGenerationTarget)):a,e=re(i.parent),f=r.get(e),h={id:i.id,version:x.UUID.uuid(),createdAt:(c==null?void 0:c.timestamp)||B().toISOString(),author:(c==null?void 0:c.author)||x.sessionAuthor,previousVersion:null,deleted:!1,name:i.name,deletable:!0,editable:!0,type:d.ArgumentDeclaration,index:f.inputs.length,defaultValue:null,codeName:i.codeName||null,description:i.description||null,required:i.required??!1,constant:!0,implements:[],dataType:null,writesValues:[],parent:f.toReference()},m=Re(h,r);return m.hydrateAncestors(),m.setParent(f,c),m.addSelfToProject(c),c==null||c.add(m,H.Added),m.initChildren(c),c||m.captureVersion(),m}static validateGenerationTarget(i,r){let a=JSON.parse(JSON.stringify(i));const c=[],e=[],f=Mn(a,{parent:{list:!1,types:[d.FunctionDeclaration,d.Search,d.Condition]}},r);c.push(...f.explanations),a=f.modifiedData;const h=Fx(a,r);if(a.parent){const E=r.get(re(a.parent));if(E&&Ft.includes(E.type)){const b=E.implements;if(b){const A=b.inputs.find(j=>j.name===a.name),_=b.inputs.filter(j=>!E.inputs.find(se=>se.type===d.ArgumentDeclaration&&se.name===j.name)),P=E.inputs.filter(j=>j.type===d.ArgumentDeclaration),V=P.find(j=>j.name===a.name),M=P.length?`The parent entity already implements the following arguments: ${At(P.map(j=>`'${j.id}' (${j.name})`),", "," and ")}.`:"The parent entity does not yet have any implemented arguments.",G=_.length?`The parent entity is still missing the following arguments in the implementation: ${At(_.map(j=>`'${j.id}' (${j.name})`),", "," and ")}.`:"The parent entity has all the arguments it needs implemented.";A?V&&e.push(new Ce({id:`${a.id}--${we.NoOverlapWithImplementedSignature}`,code:we.NoOverlapWithImplementedSignature,severity:ve.Error,message:`Entity of type '${d.ArgumentDeclaration}' with id '${a.id}' should not exist in a parent entity of type '${E.type}' with id '${E.id}' that implements a ${d.ActionDescriptor} with fixed arguments.
8
8
  Adding a new argument would make the implementation invalid. An argument with the same name already exists in the parent entity.
9
9
  ${M}
@@ -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 "${le(s,s.project)}" with id "${s.id}" is not reachable from the project's closest entry point '${i.entryPoint.type}' "${le(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 "${le(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 vi({id:`${s.id}--${we.UnreachableEntity}`,code:we.UnreachableEntity,severity:ve.Warning,message:`${r}${a}`,entity:s}))}}return Kt(s.errors,u)}function zke(s){const u=[],i=Mt(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=Wa(r,{removeDuplicates:!0}),c=a.find(f=>{var h;return((h=f==null?void 0:f.entity)==null?void 0:h.id)!==ie["primitive-entity"].void.id}),e=a.every(f=>{var h;return f.isResolved&&((h=f.entity)==null?void 0:h.id)!==ie["primitive-entity"].void.id});return!r||!c?u:((s.type===d.Condition||s.catchesError)&&!s.errorCalls.length&&e&&u.push(new vi({id:`${s.id}--${be.ParentScopeRequiresReturnCurrentCatchesErrorWithNoCalls}`,code:be.ParentScopeRequiresReturnCurrentCatchesErrorWithNoCalls,severity:ve.Error,message:`This '${s.type}' entity "${le(s,s.project)}" with id "${s.id}" catches its errors, which terminates the branch, but its parent ${i.type} "${le(i,s.project)}" with id "${i.id}" requires a returned value.`,entity:s})),Kt(s.errors,u))}function ga(s){const u=[...zke(s)],i=Mt(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=Wa(r,{removeDuplicates:!0}),c=a.find(f=>{var h;return((h=f==null?void 0:f.entity)==null?void 0:h.id)!==ie["primitive-entity"].void.id}),e=a.every(f=>{var h;return f.isResolved&&((h=f.entity)==null?void 0:h.id)!==ie["primitive-entity"].void.id});return!r||!c?u:(!s.successCalls.length&&e&&u.push(new vi({id:`${s.id}--${be.ParentScopeRequiresReturnCurrentHasNoSuccessCalls}`,code:be.ParentScopeRequiresReturnCurrentHasNoSuccessCalls,severity:ve.Error,message:`This '${s.type}' entity "${le(s,s.project)}" with id "${s.id}" has no success calls, which terminates the branch, but its parent ${i.type} "${le(i,s.project)}" with id "${i.id}" requires a returned value.`,entity:s})),Kt(s.errors,u))}function wn(s){const u=[];if(s.type===d.InputMap&&Gt.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)===Ge.Missing){const r=Dt({id:`${s.id}--${be.MissingRequiredValue}`,message:`The '${s.type}' entity "${le(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 is(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 vv(s){var u;return!!((u=wn(s))!=null&&u.find(i=>i.code===be.MissingRequiredValue))}function eb(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 "${le(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 "${le(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 "${le(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 "${le(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 "${le(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 "${le(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 $Vi(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 wE([...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)===ie["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)===ie["primitive-entity"].void.id)}function tb(s){const u=[],i=s.getDataType(null)||null,r=Wa(i,{removeDuplicates:!0}),a=r.find(m=>{var E;return((E=m==null?void 0:m.entity)==null?void 0:E.id)!==ie["primitive-entity"].void.id}),c=r.every(m=>{var E;return m.isResolved&&((E=m.entity)==null?void 0:E.id)!==ie["primitive-entity"].void.id});if(!i||!a)return u;const e=s.returnStatements.length;if(ft(s).filter(m=>Rt.includes(m.type)||!wL(m)?!1:!!((!m.successCalls.length||!m.errorCalls.length)&&m.calledBy.length)).length&&(c||e)){const m=Dt({id:`${s.id}--${be.LackingReturnStatementOnSomeBranches}`,message:`The '${s.type}' entity "${le(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 "${le(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 Yke=["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 ib(s,u=[ir],i=[],r){const a=[],c=r??s.name;if(!c){const m=Dt({id:`${s.id}--${we.EmptyName}`,message:`${ys[s.type].singular} "${le(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:`${ys[s.type].singular} "${le(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:`${ys[s.type].singular} "${le(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(Yke.find(_=>_===E)){const _=Dt({id:`${s.id}--${we.NameIsForbiddenKeyword}`,message:`${ys[s.type].singular} "${le(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:`${ys[s.type].singular} "${le(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 Jke(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'.
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 "${le(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 vi({id:`${s.id}--${we.UnreachableEntity}`,code:we.UnreachableEntity,severity:ve.Warning,message:`${r}${a}`,entity:s}))}}return Kt(s.errors,u)}function zke(s){const u=[],i=Mt(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=Wa(r,{removeDuplicates:!0}),c=a.find(f=>{var h;return((h=f==null?void 0:f.entity)==null?void 0:h.id)!==ie["primitive-entity"].void.id}),e=a.every(f=>{var h;return f.isResolved&&((h=f.entity)==null?void 0:h.id)!==ie["primitive-entity"].void.id});return!r||!c?u:((s.type===d.Condition||s.catchesError)&&!s.errorCalls.length&&e&&u.push(new vi({id:`${s.id}--${be.ParentScopeRequiresReturnCurrentCatchesErrorWithNoCalls}`,code:be.ParentScopeRequiresReturnCurrentCatchesErrorWithNoCalls,severity:ve.Error,message:`This '${s.type}' entity "${le(s,s.project)}" with id "${s.id}" catches its errors, which terminates the branch, but its parent ${i.type} "${le(i,s.project)}" with id "${i.id}" requires a returned value.`,entity:s})),Kt(s.errors,u))}function ga(s){const u=[...zke(s)],i=Mt(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||s.type===d.InternalCall&&!s.calledBy.length)return u;const r=i.getDataType(null),a=Wa(r,{removeDuplicates:!0}),c=a.find(f=>{var h;return((h=f==null?void 0:f.entity)==null?void 0:h.id)!==ie["primitive-entity"].void.id}),e=a.every(f=>{var h;return f.isResolved&&((h=f.entity)==null?void 0:h.id)!==ie["primitive-entity"].void.id});return!r||!c?u:(!s.successCalls.length&&e&&u.push(new vi({id:`${s.id}--${be.ParentScopeRequiresReturnCurrentHasNoSuccessCalls}`,code:be.ParentScopeRequiresReturnCurrentHasNoSuccessCalls,severity:ve.Error,message:`This '${s.type}' entity "${le(s,s.project)}" with id "${s.id}" has no success calls, which terminates the branch, but its parent ${i.type} "${le(i,s.project)}" with id "${i.id}" requires a returned value.`,entity:s})),Kt(s.errors,u))}function wn(s){const u=[];if(s.type===d.InputMap&&Gt.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)===Ge.Missing){const r=Dt({id:`${s.id}--${be.MissingRequiredValue}`,message:`The '${s.type}' entity "${le(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 is(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 vv(s){var u;return!!((u=wn(s))!=null&&u.find(i=>i.code===be.MissingRequiredValue))}function eb(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 "${le(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 "${le(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 "${le(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 "${le(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 "${le(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 "${le(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 $Vi(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 wE([...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)===ie["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)===ie["primitive-entity"].void.id)}function tb(s){const u=[],i=s.getDataType(null)||null,r=Wa(i,{removeDuplicates:!0}),a=r.find(m=>{var E;return((E=m==null?void 0:m.entity)==null?void 0:E.id)!==ie["primitive-entity"].void.id}),c=r.every(m=>{var E;return m.isResolved&&((E=m.entity)==null?void 0:E.id)!==ie["primitive-entity"].void.id});if(!i||!a)return u;const e=s.returnStatements.length;if(ft(s).filter(m=>Rt.includes(m.type)||!wL(m)?!1:!!((!m.successCalls.length||!m.errorCalls.length)&&m.calledBy.length)).length&&(c||e)){const m=Dt({id:`${s.id}--${be.LackingReturnStatementOnSomeBranches}`,message:`The '${s.type}' entity "${le(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 "${le(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 Yke=["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 ib(s,u=[ir],i=[],r){const a=[],c=r??s.name;if(!c){const m=Dt({id:`${s.id}--${we.EmptyName}`,message:`${ys[s.type].singular} "${le(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:`${ys[s.type].singular} "${le(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:`${ys[s.type].singular} "${le(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(Yke.find(_=>_===E)){const _=Dt({id:`${s.id}--${we.NameIsForbiddenKeyword}`,message:`${ys[s.type].singular} "${le(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:`${ys[s.type].singular} "${le(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 Jke(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===ie["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=Kt(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 Qke(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.d.ts CHANGED
@@ -9873,7 +9873,7 @@ export declare enum BaseValueDescriptorIds {
9873
9873
  counterpart: UserManagedEntityState | PrimitiveEntityState | BuiltInBaseEntityState | null;
9874
9874
  rootAction: boolean;
9875
9875
  parent: ChangeSet;
9876
- constructor({ id, action, errorReason, owner, counterpart, rootAction, }: IChangeSetEventCreationPayload, changeSet: ChangeSet);
9876
+ constructor({ id, action, errorReason, owner, counterpart, rootAction }: IChangeSetEventCreationPayload, changeSet: ChangeSet);
9877
9877
  }
9878
9878
 
9879
9879
  export declare function changeSetJSONRecordToUniqueIds(changeSet: IRecordChangeSet): Set<EntityId>;
@@ -29963,6 +29963,7 @@ export declare enum BaseValueDescriptorIds {
29963
29963
  ChangeInputMapDataType = "change-input-data-type",
29964
29964
  RecalculateLoop = "recalculate-loop",
29965
29965
  ChangeLoopType = "changed-loop-type",
29966
+ ChangeLoopOutputDataType = "change-loop-output-data-type",
29966
29967
  RecalculateOperation = "recalculate-operation",
29967
29968
  ChangeOperationType = "changed-operation-type",
29968
29969
  RecalculateOutputMap = "recalculate-output",
package/dist/index.js CHANGED
@@ -81620,7 +81620,7 @@ async function ipi(s, u = {}) {
81620
81620
  }
81621
81621
  return await Promise.all(r), s;
81622
81622
  }
81623
- var Y_ = /* @__PURE__ */ ((s) => (s.Manual = "manual", s.Automatic = "automatic", s))(Y_ || {}), W = /* @__PURE__ */ ((s) => (s.Added = "added", s.Updated = "updated", s.Removed = "removed", s.Affected = "affected", s))(W || {}), D = /* @__PURE__ */ ((s) => (s.AddSuccessCall = "add-success-call", s.AddErrorCall = "add-error-call", s.AddCall = "add-call", s.SetParent = "set-parent", s.SetStandaloneParent = "set-standalone-parent", s.AfterAllChildrenInitialized = "after-all-children-initialized", s.UpdateWithShallowTransfer = "update-with-shallow-transfer", s.UpdateWithGenerationTarget = "update-with-generation-target", s.RemoveFromParent = "remove-from-parent", s.RemoveEntity = "remove-entity", s.RestoreEntity = "restore-entity", s.CloneEntity = "clone-entity", s.AddInput = "add-input", s.RemoveInput = "remove-input", s.SetDataType = "set-data-type", s.RemoveDataType = "remove-data-type", s.SetAdditionalPropertiesDataType = "set-additional-properties-data-type", s.RemoveAdditionalPropertiesDataType = "remove-additional-properties-data-type", s.SetAllPropertiesImplement = "set-all-properties-implement", s.RemoveAllPropertiesImplement = "remove-all-properties-implement", s.RemoveValueReader = "remove-value-reader", s.AddValueReader = "add-value-reader", s.RemoveValueWriter = "remove-value-writer", s.SetValueWriter = "set-value-writer", s.AddEntryCaller = "add-entry-caller", s.AddSuccessCaller = "add-success-caller", s.AddErrorCaller = "add-error-caller", s.RemoveCall = "remove-call", s.RemoveCaller = "remove-caller", s.RemoveChildGroup = "remove-child-group", s.AddToAndGroup = "add-to-and-group", s.AddToOrGroup = "add-to-or-group", s.RemoveUnrecognizedInputs = "remove-unrecognized-inputs", s.RemoveUnrecognizedOutputs = "remove-unrecognized-outputs", s.SyncInputs = "sync-inputs", s.SyncOutputs = "sync-outputs", s.SetImplements = "set-implements", s.SetExtends = "set-extends", s.SetExtension = "set-extension", s.AddImplementation = "add-implementation", s.RemoveImplementation = "remove-implementation", s.AddProperty = "add-property", s.RemoveProperty = "remove-property", s.AddMethod = "add-method", s.RemoveMethod = "remove-method", s.AddAbstractMethod = "add-abstract-method", s.RemoveAbstractMethod = "remove-abstract-method", s.SetValueAsTypeSingle = "set-value-as-type-single", s.SetValueAsTypeList = "set-value-as-type-list", s.SetValueAsType = "set-value-as-type", s.RemoveErrorCatching = "remove-error-catching", s.RemoveAllErrorCallers = "remove-all-error-callers", s.RemoveAllSuccessCallers = "remove-all-success-callers", s.RemoveAllCallers = "remove-all-callers", s.RemoveAllErrorCalls = "remove-all-error-calls", s.SetDataTypeEntityValue = "set-data-type-entity-value", s.MergeDataTypes = "merge-data-types", s.SetDataTypeForeignKeyRef = "set-data-type-foreign-key-ref", s.SetErrorEntity = "set-error-entity", s.AddValueAsTypeToList = "add-value-as-type-to-list", s.RemoveValueAsTypeFromList = "remove-value-as-type-from-list", s.CreateFromGenerationTarget = "create-from-generation-target", s.ConnectExternalAccount = "connect-external-account", s.ChangeExternalAccountConnectionUsed = "change-external-account-connection-used", s.MoveInlineDefToCanvas = "move-inline-def-to-canvas", s.CreateDefFromValue = "create-def-from-value", s.PrettifyCanvas = "prettify-canvas", s.SetPrimitiveDefaultValue = "set-primitive-default-value", s.MakeArgRequired = "make-argument-required", s.MakeArgNonRequired = "make-argument-non-required", s.RecalculateArg = "recalculate-arg", s.RenameArg = "rename-argument", s.ChangeArgDescription = "changed-argument-description", s.RemoveArgBaseImplementation = "remove-argument-base-implementation", s.AddArgBaseImplementation = "add-argument-base-implementation", s.ChangeArgDataType = "change-argument-data-type", s.RecalculateCondition = "recalculate-condition", s.ChangeTypeOfCondition = "change-type-of-condition", s.RenameDefinition = "rename-definition", s.RecalculateDef = "recalculate-definition", s.ChangeDefDescription = "changed-definition-description", s.RemoveDefBaseImplementation = "remove-definition-base-implementation", s.AddDefBaseImplementation = "add-definition-base-implementation", s.RemoveDefExtension = "remove-definition-extension", s.SetDefExtends = "set-definition-extension", s.MakeDefStatic = "make-def-static", s.MakeDefNonStatic = "make-def-non-static", s.MakeDefAbstract = "make-def-abstract", s.MakeDefNonAbstract = "make-def-non-abstract", s.RecalculateFuncCall = "recalculate-function-call", s.ChangeFuncCallDeclaration = "change-function-call-declaration", s.RenameFuncDecl = "rename-function-declaration", s.ChangeFuncDeclDescription = "changed-function-declaration-description", s.RecalculateFuncDecl = "recalculate-function-declaration", s.SetFuncDeclBaseImplementation = "set-function-declaration-base-implementation", s.ChangeFuncDeclOutputDataType = "change-function-declaration-output-data-type", s.RecalculateGlobalEvent = "recalculate-global-event", s.ChangeGlobalEventDescription = "changed-global-event-description", s.ChangeGlobalEventType = "changed-global-event-type", s.RecalculateInputMap = "recalculate-input", s.ChangeInputMapDescription = "changed-input-description", s.ChangeInputMapDataType = "change-input-data-type", s.RecalculateLoop = "recalculate-loop", s.ChangeLoopType = "changed-loop-type", s.RecalculateOperation = "recalculate-operation", s.ChangeOperationType = "changed-operation-type", s.RecalculateOutputMap = "recalculate-output", s.ChangeOutputMapDataType = "change-output-data-type", s.RecalculateProperty = "recalculate-property", s.MakePropertyRequired = "make-property-required", s.MakePropertyNonRequired = "make-property-non-required", s.MakePropertyConstant = "make-property-constant", s.MakePropertyNonConstant = "make-property-non-constant", s.MakePropertyUnique = "make-property-unique", s.MakePropertyNonUnique = "make-property-non-unique", s.MakePropertyStatic = "make-property-static", s.MakePropertyNonStatic = "make-property-non-static", s.MakePropertyAbstract = "make-property-abstract", s.MakePropertyNonAbstract = "make-property-non-abstract", s.RenameProperty = "rename-property", s.ChangePropertyDescription = "changed-property-description", s.RemovePropertyBaseImplementation = "remove-property-base-implementation", s.AddPropertyBaseImplementation = "add-property-base-implementation", s.ChangePropertyDataType = "change-property-data-type", s.RecalculateSearch = "recalculate-search", s.RenameSearch = "rename-search", s.ChangeSearchDescription = "changed-search-description", s.ChangeSearchQuery = "changed-search-query", s.MakeValueDescriptorRequired = "make-value-descriptor-required", s.MakeSearchInputRequired = "make-search-input-required", s.MakeValueDescriptorNonRequired = "make-value-descriptor-non-required", s.MakeSearchInputNonRequired = "make-search-input-non-required", s.RenameValueDescriptor = "rename-value-descriptor", s.RenameSearchInput = "rename-search-input", s.ChangeValueDescriptorDescription = "changed-value-descriptor-description", s.ChangeSearchInputDescription = "changed-search-input-description", s.ChangeValueDescriptorDataType = "change-value-descriptor-data-type", s.RecalculateVarDecl = "recalculate-variable-declaration", s.MakeVarDeclConstant = "make-variable-declaration-constant", s.MakeVarDeclNonConstant = "make-variable-declaration-non-constant", s.RenameVarDecl = "rename-variable-declaration", s.ChangeVarDeclDescription = "changed-variable-declaration-description", s.ChangeVarDeclDataType = "change-variable-declaration-data-type", s.RecalculateVarInst = "recalculate-variable-instance", s.ChangeVarInstDeclaration = "change-variable-instance-declaration", s.HideFuncDeclBody = "hide-function-declaration-body", s.ShowFuncDeclBody = "show-function-declaration-body", s.HideGlobalEventBody = "hide-global-event-body", s.ShowGlobalEventBody = "show-global-event-body", s.HideLoopBody = "hide-loop-body", s.ShowLoopBody = "show-loop-body", s.HideTriggerBody = "hide-trigger-body", s.ShowTriggerBody = "show-trigger-body", s.AddNestedAndCondition = "add-nested-and-condition", s.AddInputToCondition = "add-input-to-condition", s.RecalculateNode = "recalculate-node", s.AddInputToFuncDecl = "add-input-to-function-declaration", s.ChangeInternalCallToThrowErrors = "change-internal-call-to-throw-errors", s.ChangeInternalCallToCatchErrors = "change-internal-call-to-catch-errors", s.AddErrorOutputToInternalCall = "add-error-output-to-internal-call", s.ChangeLoopToThrowErrors = "change-loop-to-throw-errors", s.ChangeLoopToCatchErrors = "change-loop-to-catch-errors", s.RecalculateLoopBody = "recalculate-loop-body", s.RecalculateMethod = "recalculate-method", s.AddArgToLoopBody = "add-arg-to-loop-body", s.AddArgToMethod = "add-arg-to-method", s.RecalculateNestedCondition = "recalculate-nested-condition", s.ChangeNodeToThrowErrors = "change-node-to-throw-errors", s.ChangeNodeToCatchErrors = "change-node-to-catch-errors", s.ChangeOperationToThrowErrors = "change-operation-to-throw-errors", s.ChangeOperationToCatchErrors = "change-operation-to-catch-errors", s.ChangeFuncCallToThrowErrors = "change-function-call-to-throw-errors", s.ChangeFuncCallToCatchErrors = "change-function-call-to-catch-errors", s.ChangeSearchToThrowErrors = "change-search-to-throw-errors", s.ChangeSearchToCatchErrors = "change-search-to-catch-errors", s.ChangeVarDeclToThrowErrors = "change-variable-declaration-to-throw-errors", s.ChangeVarDeclToCatchErrors = "change-variable-declaration-to-catch-errors", s.ChangeVarInstToThrowErrors = "change-variable-instance-to-throw-errors", s.ChangeVarInstToCatchErrors = "change-variable-instance-to-catch-errors", s.AddErrorOutputToNode = "add-error-output-to-node", s.AddErrorOutputToOperation = "add-error-output-to-operation", s.AddErrorOutputToFuncCall = "add-error-output-to-function-call", s.AddErrorOutputToSearch = "add-error-output-to-search", s.AddErrorOutputToVarDecl = "add-error-output-to-variable-declaration", s.AddErrorOutputToVarInst = "add-error-output-to-variable-instance", s.AddInputToNode = "add-input-to-node", s.AddInputToOperation = "add-input-to-operation", s.AddInputToFuncCall = "add-input-to-function-call", s.AddInputToSearch = "add-input-to-search", s.AddPropertyToVarDecl = "add-property-to-variable-declaration", s.AddPropertyToVarInst = "add-property-to-variable-instance", s.AddMethodToDef = "add-method-to-definition", s.ReSyncRowTransformer = "re-sync-row-transformer", s.ManuallyAddRowTransformer = "manually-add-row-transformer", s.AddPropertyToDef = "add-property-to-definition", s.RestablishExternalAccountConnection = "restablish-external-account-connection", s.AddThrownError = "add-thrown-error", s.RecalculateTerminationStatement = "recalculate-termination-statement", s.RecalculateReturnStmt = "recalculate-return-statement", s.RecalculateContinueStmt = "recalculate-continue-statement", s.RecalculateBreakStmt = "recalculate-break-statement", s.AddPropertyToTerminationStatement = "add-property-to-termination-statement", s.AddPropertyToReturnStmt = "add-property-to-return-statement", s.AddPropertyToContinueStmt = "add-property-to-continue-statement", s.AddPropertyToBreakStmt = "add-property-to-break-statement", s.SetLiteralValueToExplicitlyEmpty = "set-literal-value-to-explicitly-empty", s.ModifyLiteralValue = "modify-literal-value", s.RemoveLiteralValue = "remove-literal-value", s.ModifyLiteralValueAsType = "modify-literal-value-as-type", s.UpdateProjectMetadata = "update-project-metadata", s.RenameProject = "rename-project", s.ChangeProjectDescription = "change-project-description", s.RestoreNode = "restore-node", s.RestoreDef = "restore-definition", s.RestoreFuncDecl = "restore-function-declaration", s.RestoreGlobalEvent = "restore-global-event", s.RestoreSearch = "restore-search", s.RestoreVarDecl = "restore-variable-declaration", s.RestoreVarInst = "restore-variable-instance", s.RestoreFuncCall = "restore-function-call", s.RestoreOperation = "restore-operation", s.RestoreCondition = "restore-condition", s.RestoreReturnStmt = "restore-return-statement", s.RestoreContinueStmt = "restore-continue-statement", s.RestoreBreakStmt = "restore-break-statement", s.RestoreInstalledProject = "restore-installed-project", s.RestoreLoop = "restore-loop", s.CreateNewDef = "create-new-definition", s.CreateNewFuncDecl = "create-new-function-declaration", s.CreateNewGlobalEvent = "create-new-global-event", s.CreateNewSearch = "create-new-search", s.CreateNewVarDecl = "create-new-variable-declaration", s.CreateNewVarInst = "create-new-variable-instance", s.CreateNewFuncCall = "create-new-function-call", s.CreateNewOperation = "create-new-operation", s.CreateNewCondition = "create-new-condition", s.CreateNewReturnStmt = "create-new-return-statement", s.CreateNewContinueStmt = "create-new-continue-statement", s.CreateNewBreakStmt = "create-new-break-statement", s.CreateNewInternalCall = "create-new-internal-call", s.CreateNewLoop = "create-new-loop", s.ImplementBuiltInFunctionalityAsDef = "implement-built-in-functionality-as-definition", s.ImplementAbstractEntityAsDef = "implement-abstract-entity-as-definition", s.ImplementNewHTTPEndpoint = "implement-new-http-endpoint", s.ImplementNewScheduledTrigger = "implement-new-scheduled-trigger", s.ImplementNewPersistedEntity = "implement-new-persisted-entity", s.AddedNewRowTransformer = "added-new-row-transformer", s.AddedSQLConnectionConfig = "added-sql-connection-config", s.AddedNewSSLConnectionConfig = "added-new-ssl-connection-config", s.AddedGoogleConnection = "added-google-connection", s.AddedSlackConnection = "added-slack-connection", s.AddedNewExternalAccountConnection = "added-new-external-account-connection", s.AddedGoogleDriveConnection = "added-google-drive-connection", s.AddedGoogleSheetsConnection = "added-google-sheets-connection", s.AddedGoogleSlidesConnection = "added-google-slides-connection", s.AddedGoogleMailConnection = "added-gmail-connection", s.ManuallyCreateIndividualNode = "manually-create-individual-node", s.UpdateNode = "update-node", s.CreateNewProjectPublicationCompletedEvent = "create-new-project-publication-completed-event", s.CreateNewCountedLoop = "create-new-counted-loop", s.CreateNewListLoop = "create-new-list-loop", s.CreateNewManualFlowLoop = "create-new-manual-flow-loop", s.CreateNewObjectKeysLoop = "create-new-object-keys-loop", s.CreateNewObjectValuesLoop = "create-new-object-values-loop", s.CreateNewStringLoop = "create-new-string-loop", s.CreateNewIsFalseCondition = "create-new-is-false-condition", s.CreateNewIsTrueCondition = "create-new-is-true-condition", s.CreateNewAndCondition = "create-new-and-condition", s.CreateNewOrCondition = "create-new-or-condition", s.DisconnectNodes = "disconnect-nodes", s.DisconnectExecutions = "disconnect-executions", s.DisconnectValues = "disconnect-values", s.ConnectNodes = "connect-nodes", s.ConnectExecution = "connect-execution", s.ConnectValues = "connect-values", s.ConnectValueToNewInput = "connect-value-to-new-input", s.ConnectValueToNewOperationInput = "connect-value-to-new-operation-input", s.ConnectValueToNewConditionInput = "connect-value-to-new-condition-input", s.ConnectValueToNewSearchInput = "connect-value-to-new-search-input", s.ConnectValueToNewVarDeclProperty = "connect-value-to-new-variable-declaration-property", s.ConnectValueToNewVarInstProperty = "connect-value-to-new-variable-instance-property", s.ConnectValueToNewReturnStmtProperty = "connect-value-to-new-return-statement-property", s.ConnectValueToNewContinueStmtProperty = "connect-value-to-new-continue-statement-property", s.ConnectValueToNewBreakStmtProperty = "connect-value-to-new-break-statement-property", s.ConnectNewFuncDeclArgToValue = "connect-new-function-argument-to-value", s.RemoveNodes = "remove-nodes", s.RemoveNode = "remove-node", s.InitialLoadAutomaticCanvasRefresh = "initial-load-automatic-canvas-refresh", s.MoveNodes = "move-nodes", s.MoveNode = "move-node", s.CloneNodes = "clone-nodes", s.CloneNode = "clone-node", s.GenerateSQLMigrationOnPersistedEntityUpdate = "generate-sql-migration-on-persisted-entity-update", s))(D || {}), Be = /* @__PURE__ */ ((s) => (s.ActionOwnerEntityNotEditable = "action-owner-entity-not-editable", s.ActionCounterpartEntityNotEditable = "action-counterpart-entity-not-editable", s.ActionOwnerEntityNonDeletable = "action-owner-entity-non-deletable", s.GlobalVariableDeclarationCannnotCatchError = "global-variable-declaration-cannot-catch-error", s.GlobalVariableDeclarationCannotReadValue = "global-variable-declaration-cannot-read-value", s.GlobalVariableDeclarationCannotBeCalled = "global-variable-declaration-cannot-be-called", s.GlobalVariableDeclarationCannotCallFromError = "global-variable-declaration-cannot-call-from-error", s.ValueReadingOverridesConstantProperty = "value-reading-overrides-constant-property", s.DefaultValueOverridesConstantProperty = "default-value-overrides-constant-property", s.ValueReadingOverridesConstantVariable = "value-reading-overrides-constant-variable", s.DefaultValueOverridesConstantVariable = "default-value-overrides-constant-variable", s.CannotSuccessCallItself = "cannot-success-call-itself", s.CannotErrorCallItself = "cannot-error-call-itself", s.CannotEntryCallItself = "cannot-entry-call-itself", s.CannotValueWriteItself = "cannot-value-write-itself", s.CannotBeCalledBeforeDeclaration = "cannot-be-called-before-declaration", s.CannotBeCalledInParallelBranchToDeclaration = "cannot-be-called-in-parallel-branch-to-declaration", s.CannotBeHigherScopeThanDeclaration = "cannot-be-higher-scope-than-declaration", s.InputsInGlobalVariableDeclarationsCannotReadValues = "inputs-in-global-variable-declarations-cannot-read-values", s))(Be || {});
81623
+ var Y_ = /* @__PURE__ */ ((s) => (s.Manual = "manual", s.Automatic = "automatic", s))(Y_ || {}), W = /* @__PURE__ */ ((s) => (s.Added = "added", s.Updated = "updated", s.Removed = "removed", s.Affected = "affected", s))(W || {}), D = /* @__PURE__ */ ((s) => (s.AddSuccessCall = "add-success-call", s.AddErrorCall = "add-error-call", s.AddCall = "add-call", s.SetParent = "set-parent", s.SetStandaloneParent = "set-standalone-parent", s.AfterAllChildrenInitialized = "after-all-children-initialized", s.UpdateWithShallowTransfer = "update-with-shallow-transfer", s.UpdateWithGenerationTarget = "update-with-generation-target", s.RemoveFromParent = "remove-from-parent", s.RemoveEntity = "remove-entity", s.RestoreEntity = "restore-entity", s.CloneEntity = "clone-entity", s.AddInput = "add-input", s.RemoveInput = "remove-input", s.SetDataType = "set-data-type", s.RemoveDataType = "remove-data-type", s.SetAdditionalPropertiesDataType = "set-additional-properties-data-type", s.RemoveAdditionalPropertiesDataType = "remove-additional-properties-data-type", s.SetAllPropertiesImplement = "set-all-properties-implement", s.RemoveAllPropertiesImplement = "remove-all-properties-implement", s.RemoveValueReader = "remove-value-reader", s.AddValueReader = "add-value-reader", s.RemoveValueWriter = "remove-value-writer", s.SetValueWriter = "set-value-writer", s.AddEntryCaller = "add-entry-caller", s.AddSuccessCaller = "add-success-caller", s.AddErrorCaller = "add-error-caller", s.RemoveCall = "remove-call", s.RemoveCaller = "remove-caller", s.RemoveChildGroup = "remove-child-group", s.AddToAndGroup = "add-to-and-group", s.AddToOrGroup = "add-to-or-group", s.RemoveUnrecognizedInputs = "remove-unrecognized-inputs", s.RemoveUnrecognizedOutputs = "remove-unrecognized-outputs", s.SyncInputs = "sync-inputs", s.SyncOutputs = "sync-outputs", s.SetImplements = "set-implements", s.SetExtends = "set-extends", s.SetExtension = "set-extension", s.AddImplementation = "add-implementation", s.RemoveImplementation = "remove-implementation", s.AddProperty = "add-property", s.RemoveProperty = "remove-property", s.AddMethod = "add-method", s.RemoveMethod = "remove-method", s.AddAbstractMethod = "add-abstract-method", s.RemoveAbstractMethod = "remove-abstract-method", s.SetValueAsTypeSingle = "set-value-as-type-single", s.SetValueAsTypeList = "set-value-as-type-list", s.SetValueAsType = "set-value-as-type", s.RemoveErrorCatching = "remove-error-catching", s.RemoveAllErrorCallers = "remove-all-error-callers", s.RemoveAllSuccessCallers = "remove-all-success-callers", s.RemoveAllCallers = "remove-all-callers", s.RemoveAllErrorCalls = "remove-all-error-calls", s.SetDataTypeEntityValue = "set-data-type-entity-value", s.MergeDataTypes = "merge-data-types", s.SetDataTypeForeignKeyRef = "set-data-type-foreign-key-ref", s.SetErrorEntity = "set-error-entity", s.AddValueAsTypeToList = "add-value-as-type-to-list", s.RemoveValueAsTypeFromList = "remove-value-as-type-from-list", s.CreateFromGenerationTarget = "create-from-generation-target", s.ConnectExternalAccount = "connect-external-account", s.ChangeExternalAccountConnectionUsed = "change-external-account-connection-used", s.MoveInlineDefToCanvas = "move-inline-def-to-canvas", s.CreateDefFromValue = "create-def-from-value", s.PrettifyCanvas = "prettify-canvas", s.SetPrimitiveDefaultValue = "set-primitive-default-value", s.MakeArgRequired = "make-argument-required", s.MakeArgNonRequired = "make-argument-non-required", s.RecalculateArg = "recalculate-arg", s.RenameArg = "rename-argument", s.ChangeArgDescription = "changed-argument-description", s.RemoveArgBaseImplementation = "remove-argument-base-implementation", s.AddArgBaseImplementation = "add-argument-base-implementation", s.ChangeArgDataType = "change-argument-data-type", s.RecalculateCondition = "recalculate-condition", s.ChangeTypeOfCondition = "change-type-of-condition", s.RenameDefinition = "rename-definition", s.RecalculateDef = "recalculate-definition", s.ChangeDefDescription = "changed-definition-description", s.RemoveDefBaseImplementation = "remove-definition-base-implementation", s.AddDefBaseImplementation = "add-definition-base-implementation", s.RemoveDefExtension = "remove-definition-extension", s.SetDefExtends = "set-definition-extension", s.MakeDefStatic = "make-def-static", s.MakeDefNonStatic = "make-def-non-static", s.MakeDefAbstract = "make-def-abstract", s.MakeDefNonAbstract = "make-def-non-abstract", s.RecalculateFuncCall = "recalculate-function-call", s.ChangeFuncCallDeclaration = "change-function-call-declaration", s.RenameFuncDecl = "rename-function-declaration", s.ChangeFuncDeclDescription = "changed-function-declaration-description", s.RecalculateFuncDecl = "recalculate-function-declaration", s.SetFuncDeclBaseImplementation = "set-function-declaration-base-implementation", s.ChangeFuncDeclOutputDataType = "change-function-declaration-output-data-type", s.RecalculateGlobalEvent = "recalculate-global-event", s.ChangeGlobalEventDescription = "changed-global-event-description", s.ChangeGlobalEventType = "changed-global-event-type", s.RecalculateInputMap = "recalculate-input", s.ChangeInputMapDescription = "changed-input-description", s.ChangeInputMapDataType = "change-input-data-type", s.RecalculateLoop = "recalculate-loop", s.ChangeLoopType = "changed-loop-type", s.ChangeLoopOutputDataType = "change-loop-output-data-type", s.RecalculateOperation = "recalculate-operation", s.ChangeOperationType = "changed-operation-type", s.RecalculateOutputMap = "recalculate-output", s.ChangeOutputMapDataType = "change-output-data-type", s.RecalculateProperty = "recalculate-property", s.MakePropertyRequired = "make-property-required", s.MakePropertyNonRequired = "make-property-non-required", s.MakePropertyConstant = "make-property-constant", s.MakePropertyNonConstant = "make-property-non-constant", s.MakePropertyUnique = "make-property-unique", s.MakePropertyNonUnique = "make-property-non-unique", s.MakePropertyStatic = "make-property-static", s.MakePropertyNonStatic = "make-property-non-static", s.MakePropertyAbstract = "make-property-abstract", s.MakePropertyNonAbstract = "make-property-non-abstract", s.RenameProperty = "rename-property", s.ChangePropertyDescription = "changed-property-description", s.RemovePropertyBaseImplementation = "remove-property-base-implementation", s.AddPropertyBaseImplementation = "add-property-base-implementation", s.ChangePropertyDataType = "change-property-data-type", s.RecalculateSearch = "recalculate-search", s.RenameSearch = "rename-search", s.ChangeSearchDescription = "changed-search-description", s.ChangeSearchQuery = "changed-search-query", s.MakeValueDescriptorRequired = "make-value-descriptor-required", s.MakeSearchInputRequired = "make-search-input-required", s.MakeValueDescriptorNonRequired = "make-value-descriptor-non-required", s.MakeSearchInputNonRequired = "make-search-input-non-required", s.RenameValueDescriptor = "rename-value-descriptor", s.RenameSearchInput = "rename-search-input", s.ChangeValueDescriptorDescription = "changed-value-descriptor-description", s.ChangeSearchInputDescription = "changed-search-input-description", s.ChangeValueDescriptorDataType = "change-value-descriptor-data-type", s.RecalculateVarDecl = "recalculate-variable-declaration", s.MakeVarDeclConstant = "make-variable-declaration-constant", s.MakeVarDeclNonConstant = "make-variable-declaration-non-constant", s.RenameVarDecl = "rename-variable-declaration", s.ChangeVarDeclDescription = "changed-variable-declaration-description", s.ChangeVarDeclDataType = "change-variable-declaration-data-type", s.RecalculateVarInst = "recalculate-variable-instance", s.ChangeVarInstDeclaration = "change-variable-instance-declaration", s.HideFuncDeclBody = "hide-function-declaration-body", s.ShowFuncDeclBody = "show-function-declaration-body", s.HideGlobalEventBody = "hide-global-event-body", s.ShowGlobalEventBody = "show-global-event-body", s.HideLoopBody = "hide-loop-body", s.ShowLoopBody = "show-loop-body", s.HideTriggerBody = "hide-trigger-body", s.ShowTriggerBody = "show-trigger-body", s.AddNestedAndCondition = "add-nested-and-condition", s.AddInputToCondition = "add-input-to-condition", s.RecalculateNode = "recalculate-node", s.AddInputToFuncDecl = "add-input-to-function-declaration", s.ChangeInternalCallToThrowErrors = "change-internal-call-to-throw-errors", s.ChangeInternalCallToCatchErrors = "change-internal-call-to-catch-errors", s.AddErrorOutputToInternalCall = "add-error-output-to-internal-call", s.ChangeLoopToThrowErrors = "change-loop-to-throw-errors", s.ChangeLoopToCatchErrors = "change-loop-to-catch-errors", s.RecalculateLoopBody = "recalculate-loop-body", s.RecalculateMethod = "recalculate-method", s.AddArgToLoopBody = "add-arg-to-loop-body", s.AddArgToMethod = "add-arg-to-method", s.RecalculateNestedCondition = "recalculate-nested-condition", s.ChangeNodeToThrowErrors = "change-node-to-throw-errors", s.ChangeNodeToCatchErrors = "change-node-to-catch-errors", s.ChangeOperationToThrowErrors = "change-operation-to-throw-errors", s.ChangeOperationToCatchErrors = "change-operation-to-catch-errors", s.ChangeFuncCallToThrowErrors = "change-function-call-to-throw-errors", s.ChangeFuncCallToCatchErrors = "change-function-call-to-catch-errors", s.ChangeSearchToThrowErrors = "change-search-to-throw-errors", s.ChangeSearchToCatchErrors = "change-search-to-catch-errors", s.ChangeVarDeclToThrowErrors = "change-variable-declaration-to-throw-errors", s.ChangeVarDeclToCatchErrors = "change-variable-declaration-to-catch-errors", s.ChangeVarInstToThrowErrors = "change-variable-instance-to-throw-errors", s.ChangeVarInstToCatchErrors = "change-variable-instance-to-catch-errors", s.AddErrorOutputToNode = "add-error-output-to-node", s.AddErrorOutputToOperation = "add-error-output-to-operation", s.AddErrorOutputToFuncCall = "add-error-output-to-function-call", s.AddErrorOutputToSearch = "add-error-output-to-search", s.AddErrorOutputToVarDecl = "add-error-output-to-variable-declaration", s.AddErrorOutputToVarInst = "add-error-output-to-variable-instance", s.AddInputToNode = "add-input-to-node", s.AddInputToOperation = "add-input-to-operation", s.AddInputToFuncCall = "add-input-to-function-call", s.AddInputToSearch = "add-input-to-search", s.AddPropertyToVarDecl = "add-property-to-variable-declaration", s.AddPropertyToVarInst = "add-property-to-variable-instance", s.AddMethodToDef = "add-method-to-definition", s.ReSyncRowTransformer = "re-sync-row-transformer", s.ManuallyAddRowTransformer = "manually-add-row-transformer", s.AddPropertyToDef = "add-property-to-definition", s.RestablishExternalAccountConnection = "restablish-external-account-connection", s.AddThrownError = "add-thrown-error", s.RecalculateTerminationStatement = "recalculate-termination-statement", s.RecalculateReturnStmt = "recalculate-return-statement", s.RecalculateContinueStmt = "recalculate-continue-statement", s.RecalculateBreakStmt = "recalculate-break-statement", s.AddPropertyToTerminationStatement = "add-property-to-termination-statement", s.AddPropertyToReturnStmt = "add-property-to-return-statement", s.AddPropertyToContinueStmt = "add-property-to-continue-statement", s.AddPropertyToBreakStmt = "add-property-to-break-statement", s.SetLiteralValueToExplicitlyEmpty = "set-literal-value-to-explicitly-empty", s.ModifyLiteralValue = "modify-literal-value", s.RemoveLiteralValue = "remove-literal-value", s.ModifyLiteralValueAsType = "modify-literal-value-as-type", s.UpdateProjectMetadata = "update-project-metadata", s.RenameProject = "rename-project", s.ChangeProjectDescription = "change-project-description", s.RestoreNode = "restore-node", s.RestoreDef = "restore-definition", s.RestoreFuncDecl = "restore-function-declaration", s.RestoreGlobalEvent = "restore-global-event", s.RestoreSearch = "restore-search", s.RestoreVarDecl = "restore-variable-declaration", s.RestoreVarInst = "restore-variable-instance", s.RestoreFuncCall = "restore-function-call", s.RestoreOperation = "restore-operation", s.RestoreCondition = "restore-condition", s.RestoreReturnStmt = "restore-return-statement", s.RestoreContinueStmt = "restore-continue-statement", s.RestoreBreakStmt = "restore-break-statement", s.RestoreInstalledProject = "restore-installed-project", s.RestoreLoop = "restore-loop", s.CreateNewDef = "create-new-definition", s.CreateNewFuncDecl = "create-new-function-declaration", s.CreateNewGlobalEvent = "create-new-global-event", s.CreateNewSearch = "create-new-search", s.CreateNewVarDecl = "create-new-variable-declaration", s.CreateNewVarInst = "create-new-variable-instance", s.CreateNewFuncCall = "create-new-function-call", s.CreateNewOperation = "create-new-operation", s.CreateNewCondition = "create-new-condition", s.CreateNewReturnStmt = "create-new-return-statement", s.CreateNewContinueStmt = "create-new-continue-statement", s.CreateNewBreakStmt = "create-new-break-statement", s.CreateNewInternalCall = "create-new-internal-call", s.CreateNewLoop = "create-new-loop", s.ImplementBuiltInFunctionalityAsDef = "implement-built-in-functionality-as-definition", s.ImplementAbstractEntityAsDef = "implement-abstract-entity-as-definition", s.ImplementNewHTTPEndpoint = "implement-new-http-endpoint", s.ImplementNewScheduledTrigger = "implement-new-scheduled-trigger", s.ImplementNewPersistedEntity = "implement-new-persisted-entity", s.AddedNewRowTransformer = "added-new-row-transformer", s.AddedSQLConnectionConfig = "added-sql-connection-config", s.AddedNewSSLConnectionConfig = "added-new-ssl-connection-config", s.AddedGoogleConnection = "added-google-connection", s.AddedSlackConnection = "added-slack-connection", s.AddedNewExternalAccountConnection = "added-new-external-account-connection", s.AddedGoogleDriveConnection = "added-google-drive-connection", s.AddedGoogleSheetsConnection = "added-google-sheets-connection", s.AddedGoogleSlidesConnection = "added-google-slides-connection", s.AddedGoogleMailConnection = "added-gmail-connection", s.ManuallyCreateIndividualNode = "manually-create-individual-node", s.UpdateNode = "update-node", s.CreateNewProjectPublicationCompletedEvent = "create-new-project-publication-completed-event", s.CreateNewCountedLoop = "create-new-counted-loop", s.CreateNewListLoop = "create-new-list-loop", s.CreateNewManualFlowLoop = "create-new-manual-flow-loop", s.CreateNewObjectKeysLoop = "create-new-object-keys-loop", s.CreateNewObjectValuesLoop = "create-new-object-values-loop", s.CreateNewStringLoop = "create-new-string-loop", s.CreateNewIsFalseCondition = "create-new-is-false-condition", s.CreateNewIsTrueCondition = "create-new-is-true-condition", s.CreateNewAndCondition = "create-new-and-condition", s.CreateNewOrCondition = "create-new-or-condition", s.DisconnectNodes = "disconnect-nodes", s.DisconnectExecutions = "disconnect-executions", s.DisconnectValues = "disconnect-values", s.ConnectNodes = "connect-nodes", s.ConnectExecution = "connect-execution", s.ConnectValues = "connect-values", s.ConnectValueToNewInput = "connect-value-to-new-input", s.ConnectValueToNewOperationInput = "connect-value-to-new-operation-input", s.ConnectValueToNewConditionInput = "connect-value-to-new-condition-input", s.ConnectValueToNewSearchInput = "connect-value-to-new-search-input", s.ConnectValueToNewVarDeclProperty = "connect-value-to-new-variable-declaration-property", s.ConnectValueToNewVarInstProperty = "connect-value-to-new-variable-instance-property", s.ConnectValueToNewReturnStmtProperty = "connect-value-to-new-return-statement-property", s.ConnectValueToNewContinueStmtProperty = "connect-value-to-new-continue-statement-property", s.ConnectValueToNewBreakStmtProperty = "connect-value-to-new-break-statement-property", s.ConnectNewFuncDeclArgToValue = "connect-new-function-argument-to-value", s.RemoveNodes = "remove-nodes", s.RemoveNode = "remove-node", s.InitialLoadAutomaticCanvasRefresh = "initial-load-automatic-canvas-refresh", s.MoveNodes = "move-nodes", s.MoveNode = "move-node", s.CloneNodes = "clone-nodes", s.CloneNode = "clone-node", s.GenerateSQLMigrationOnPersistedEntityUpdate = "generate-sql-migration-on-persisted-entity-update", s))(D || {}), Be = /* @__PURE__ */ ((s) => (s.ActionOwnerEntityNotEditable = "action-owner-entity-not-editable", s.ActionCounterpartEntityNotEditable = "action-counterpart-entity-not-editable", s.ActionOwnerEntityNonDeletable = "action-owner-entity-non-deletable", s.GlobalVariableDeclarationCannnotCatchError = "global-variable-declaration-cannot-catch-error", s.GlobalVariableDeclarationCannotReadValue = "global-variable-declaration-cannot-read-value", s.GlobalVariableDeclarationCannotBeCalled = "global-variable-declaration-cannot-be-called", s.GlobalVariableDeclarationCannotCallFromError = "global-variable-declaration-cannot-call-from-error", s.ValueReadingOverridesConstantProperty = "value-reading-overrides-constant-property", s.DefaultValueOverridesConstantProperty = "default-value-overrides-constant-property", s.ValueReadingOverridesConstantVariable = "value-reading-overrides-constant-variable", s.DefaultValueOverridesConstantVariable = "default-value-overrides-constant-variable", s.CannotSuccessCallItself = "cannot-success-call-itself", s.CannotErrorCallItself = "cannot-error-call-itself", s.CannotEntryCallItself = "cannot-entry-call-itself", s.CannotValueWriteItself = "cannot-value-write-itself", s.CannotBeCalledBeforeDeclaration = "cannot-be-called-before-declaration", s.CannotBeCalledInParallelBranchToDeclaration = "cannot-be-called-in-parallel-branch-to-declaration", s.CannotBeHigherScopeThanDeclaration = "cannot-be-higher-scope-than-declaration", s.InputsInGlobalVariableDeclarationsCannotReadValues = "inputs-in-global-variable-declarations-cannot-read-values", s))(Be || {});
81624
81624
  class rpi {
81625
81625
  constructor({
81626
81626
  id: u,
@@ -81904,7 +81904,9 @@ class Z extends Yy {
81904
81904
  const c = i.awaitBeforeClose ?? !0, e = i.awaitExternalPersist ?? !0;
81905
81905
  return this.startedClose || (this.startedClose = !0, c ? await this.beforeCloseAsync({ tracker: r }) : this.beforeCloseAsync({ tracker: r })), !this.isValid && this.self && !this.added[this.self.id] && !this.updated[this.self.id] && this.removed[this.self.id], await this.discardOrphansAsync({ tracker: r }), await this.sanitizeAsync({ tracker: r }), await this.recursiveCaptureUpstreamVersionsAsync({ tracker: r }), this.lockedVersions || (await this.captureAllChangesInVersionInstancesAsync({ tracker: r }), await this.recursiveCaptureUpstreamVersionsAsync({ tracker: r })), this.open = !1, this.isEmpty ? (this.logger.warn(
81906
81906
  `[ChangeSet.closeAsync] Empty change-set (${this.id}) discarded upon closing.`
81907
- ), this.dirty = !1, this.project.discardChangeSet(this), this.logger.log("[ChangeSet.closeAsync] Closing pending change-sets..."), this.project.closePersistChangeSetsSequentially(), this) : (this.project.emit(
81907
+ ), this.dirty = !1, this.project.discardChangeSet(this), this.logger.log(
81908
+ "[ChangeSet.closeAsync] Closing pending change-sets..."
81909
+ ), this.project.closePersistChangeSetsSequentially(), this) : (this.project.emit(
81908
81910
  fi.CHANGE_SET_CLOSED_BEFORE_PERSIST,
81909
81911
  this
81910
81912
  ), e ? a.persistType === "parallel" ? await this.project.persistChangeSetInParallel(this) : await this.project.persistChangeSetSequentially(this) : a.persistType === "parallel" ? this.project.persistChangeSetInParallel(this) : this.project.persistChangeSetSequentially(this), this.destroy(), this);
@@ -81918,7 +81920,11 @@ class Z extends Yy {
81918
81920
  recursiveCaptureUpstreamVersions() {
81919
81921
  if (this.lockedVersions)
81920
81922
  return;
81921
- [...this.addedIds, ...this.updatedIds, ...this.removedIds].forEach((r) => {
81923
+ [
81924
+ ...this.addedIds,
81925
+ ...this.updatedIds,
81926
+ ...this.removedIds
81927
+ ].forEach((r) => {
81922
81928
  const a = this.get(r), { added: c, updated: e, removed: f, affected: h } = a.recursiveCaptureUpstreamVersions(this.timestamp);
81923
81929
  for (const m of c)
81924
81930
  this.add(
@@ -81949,7 +81955,11 @@ class Z extends Yy {
81949
81955
  async recursiveCaptureUpstreamVersionsAsync(i = {}) {
81950
81956
  if (this.lockedVersions)
81951
81957
  return;
81952
- const r = Ze.from(i), a = [...this.addedIds, ...this.updatedIds, ...this.removedIds];
81958
+ const r = Ze.from(i), a = [
81959
+ ...this.addedIds,
81960
+ ...this.updatedIds,
81961
+ ...this.removedIds
81962
+ ];
81953
81963
  for await (const c of a) {
81954
81964
  const e = this.get(c), { added: f, updated: h, removed: m, affected: b } = e.recursiveCaptureUpstreamVersions(this.timestamp);
81955
81965
  for (const E of f)
@@ -82083,7 +82093,9 @@ class Z extends Yy {
82083
82093
  return this.added[i] ? this.added[i] : this.updated[i] ? this.updated[i] : this.removed[i] ? this.removed[i] : null;
82084
82094
  }
82085
82095
  remove(i) {
82086
- return this.has(i) && (delete this.added[i], delete this.updated[i], delete this.removed[i], delete this.affected[i], this.seenEntities = this.seenEntities.filter((r) => r !== i)), this;
82096
+ return this.has(i) && (delete this.added[i], delete this.updated[i], delete this.removed[i], delete this.affected[i], this.seenEntities = this.seenEntities.filter(
82097
+ (r) => r !== i
82098
+ )), this;
82087
82099
  }
82088
82100
  add(i, r, a = { preventRecursion: !1 }) {
82089
82101
  var e, f, h, m;
@@ -82093,7 +82105,9 @@ class Z extends Yy {
82093
82105
  return this;
82094
82106
  if (this.seenEntities.indexOf(i.id) === -1 && this.seenEntities.push(i.id), r === "removed") {
82095
82107
  if (this.added[i.id])
82096
- return delete this.added[i.id], delete this.affected[i.id], delete this.updated[i.id], this.seenEntities = this.seenEntities.filter((E) => E !== i.id), delete this.project.deletedInstances[i.id], this;
82108
+ return delete this.added[i.id], delete this.affected[i.id], delete this.updated[i.id], this.seenEntities = this.seenEntities.filter(
82109
+ (E) => E !== i.id
82110
+ ), delete this.project.deletedInstances[i.id], this;
82097
82111
  if (this.updated[i.id] && delete this.updated[i.id], this.affected[i.id] && delete this.affected[i.id], !this.hasRemoved(i.id) && !this.lockedVersions && (i.increaseVersion(this.timestamp), !a.preventRecursion)) {
82098
82112
  const { added: E, updated: A, removed: _, affected: N } = i.recursiveCaptureUpstreamVersions(this.timestamp);
82099
82113
  for (const V of E)
@@ -82122,7 +82136,9 @@ class Z extends Yy {
82122
82136
  );
82123
82137
  }
82124
82138
  i.captureVersion();
82125
- const b = (e = i.knownVersions) == null ? void 0 : e.get(i.version);
82139
+ const b = (e = i.knownVersions) == null ? void 0 : e.get(
82140
+ i.version
82141
+ );
82126
82142
  if (!b)
82127
82143
  throw Error(
82128
82144
  `Version ${i.version} should have a cached version instance but it wasn't found when adding entity to change-set`
@@ -82160,7 +82176,9 @@ class Z extends Yy {
82160
82176
  );
82161
82177
  }
82162
82178
  i.previousVersion = null, i.captureVersion();
82163
- const b = (f = i.knownVersions) == null ? void 0 : f.get(i.version);
82179
+ const b = (f = i.knownVersions) == null ? void 0 : f.get(
82180
+ i.version
82181
+ );
82164
82182
  if (!b)
82165
82183
  throw Error(
82166
82184
  `Version ${i.version} should have a cached version instance but it wasn't found when adding entity to change-set`
@@ -82200,7 +82218,9 @@ class Z extends Yy {
82200
82218
  );
82201
82219
  }
82202
82220
  i.activeVersion = !0, i.captureVersion();
82203
- const b = (h = i.knownVersions) == null ? void 0 : h.get(i.version);
82221
+ const b = (h = i.knownVersions) == null ? void 0 : h.get(
82222
+ i.version
82223
+ );
82204
82224
  if (!b)
82205
82225
  throw Error(
82206
82226
  `Version ${i.version} should have a cached version instance but it wasn't found when adding entity to change-set`
@@ -183267,7 +183287,7 @@ function $a(s) {
183267
183287
  return u;
183268
183288
  } else
183269
183289
  return u;
183270
- if (s.type === d.Condition && s.parent.type === d.Condition)
183290
+ if (s.type === d.Condition && s.parent.type === d.Condition || s.type === d.InternalCall && !s.calledBy.length)
183271
183291
  return u;
183272
183292
  const r = i.getDataType(null), a = ps(r, {
183273
183293
  removeDuplicates: !0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elyx-code/project-logic-tree",
3
- "version": "0.0.6992",
3
+ "version": "0.0.6993",
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",