@elyx-code/project-logic-tree 0.0.6302 → 0.0.6303
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.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/index.umd.cjs +2 -2
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1988,7 +1988,7 @@ export declare class DataTypeState extends VersionedState implements IDataType,
|
|
|
1988
1988
|
canBeObject(): boolean;
|
|
1989
1989
|
hasStrictObjectStructure(): boolean;
|
|
1990
1990
|
isInlineDeclaredEntity(): boolean;
|
|
1991
|
-
|
|
1991
|
+
canModifyObjectStructure(): boolean;
|
|
1992
1992
|
inferFromInputs(inputs: VariableInputMapState[], changeSet?: ChangeSet | null): IChangeSet<DataTypeState>;
|
|
1993
1993
|
}
|
|
1994
1994
|
|
package/dist/index.js
CHANGED
|
@@ -29200,7 +29200,7 @@ function Jyt(u, d = null) {
|
|
|
29200
29200
|
return mn(u.declaration, d);
|
|
29201
29201
|
}
|
|
29202
29202
|
function Wyt(u, d = null) {
|
|
29203
|
-
return u.dataType && !u.dataType.inferred ? u.dataType : u.dataType && u.dataType.inferred || !u.dataType ? (u.inferDataTypeAndSyncInstancesInputsAndOutputs(d), u.dataType) : null;
|
|
29203
|
+
return u.dataType && !u.dataType.inferred ? u.dataType : (u.dataType && u.dataType.inferred || !u.dataType) && u.project.initialized ? (u.inferDataTypeAndSyncInstancesInputsAndOutputs(d), u.dataType) : null;
|
|
29204
29204
|
}
|
|
29205
29205
|
function M4(u, d = null) {
|
|
29206
29206
|
var n;
|
|
@@ -35904,7 +35904,7 @@ Alternatively you can update the entity with 'update' action. Or replace it by f
|
|
|
35904
35904
|
var n, o;
|
|
35905
35905
|
return ((n = this.entity) == null ? void 0 : n.type) === c.DefinitionEntity && ((o = this.entity.parent) == null ? void 0 : o.id) === (this == null ? void 0 : this.id);
|
|
35906
35906
|
}
|
|
35907
|
-
|
|
35907
|
+
canModifyObjectStructure() {
|
|
35908
35908
|
var n;
|
|
35909
35909
|
return this.isInlineDeclaredEntity() || this.canBeObject() || ((n = this.entity) == null ? void 0 : n.name) === te.KeyValue;
|
|
35910
35910
|
}
|
package/dist/index.umd.cjs
CHANGED
|
@@ -10,7 +10,7 @@ __p+='`),A}),f+=`';
|
|
|
10
10
|
`,t="obj";f=`var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};
|
|
11
11
|
`+f+`return __p;
|
|
12
12
|
`;var m;try{m=new Function(t,"_",f)}catch(A){throw A.source=f,A}var E=function(A){return m.call(this,A,Zt)};return E.source="function("+t+`){
|
|
13
|
-
`+f+"}",E}function ace(u,d,n){d=Ju(d);var o=d.length;if(!o)return Ii(n)?n.call(u):n;for(var l=0;l<o;l++){var f=u==null?void 0:u[d[l]];f===void 0&&(f=n,l=o),u=Ii(f)?f.call(u):f}return u}var oce=0;function lce(u){var d=++oce+"";return u?u+d:d}function dce(u){var d=Zt(u);return d._chain=!0,d}function cL(u,d,n,o,l){if(!(o instanceof d))return u.apply(n,l);var f=sL(u.prototype),t=u.apply(f,l);return js(t)?t:f}var Wl=Mi(function(u,d){var n=Wl.placeholder,o=function(){for(var l=0,f=d.length,t=Array(f),m=0;m<f;m++)t[m]=d[m]===n?arguments[l++]:d[m];for(;l<arguments.length;)t.push(arguments[l++]);return cL(u,o,this,this,t)};return o});Wl.placeholder=Zt;const pL=Mi(function(u,d,n){if(!Ii(u))throw new TypeError("Bind must be called on a function");var o=Mi(function(l){return cL(u,o,d,this,n.concat(l))});return o}),es=qN(Bi);function Vo(u,d,n,o){if(o=o||[],!d&&d!==0)d=1/0;else if(d<=0)return o.concat(u);for(var l=o.length,f=0,t=Bi(u);f<t;f++){var m=u[f];if(es(m)&&(Po(m)||sT(m)))if(d>1)Vo(m,d-1,n,o),l=o.length;else for(var E=0,A=m.length;E<A;)o[l++]=m[E++];else n||(o[l++]=m)}return o}const uce=Mi(function(u,d){d=Vo(d,!1,!1);var n=d.length;if(n<1)throw new Error("bindAll must be passed function names");for(;n--;){var o=d[n];u[o]=pL(u[o],u)}return u});function cce(u,d){var n=function(o){var l=n.cache,f=""+(d?d.apply(this,arguments):o);return wa(l,f)||(l[f]=u.apply(this,arguments)),l[f]};return n.cache={},n}const fL=Mi(function(u,d,n){return setTimeout(function(){return u.apply(null,n)},d)}),pce=Wl(fL,Zt,1);function fce(u,d,n){var o,l,f,t,m=0;n||(n={});var E=function(){m=n.leading===!1?0:zu(),o=null,t=u.apply(l,f),o||(l=f=null)},A=function(){var g=zu();!m&&n.leading===!1&&(m=g);var w=d-(g-m);return l=this,f=arguments,w<=0||w>d?(o&&(clearTimeout(o),o=null),m=g,t=u.apply(l,f),o||(l=f=null)):!o&&n.trailing!==!1&&(o=setTimeout(E,w)),t};return A.cancel=function(){clearTimeout(o),m=0,o=l=f=null},A}function hce(u,d,n){var o,l,f,t,m,E=function(){var g=zu()-l;d>g?o=setTimeout(E,d-g):(o=null,n||(t=u.apply(m,f)),o||(f=m=null))},A=Mi(function(g){return m=this,f=g,l=zu(),o||(o=setTimeout(E,d),n&&(t=u.apply(m,f))),t});return A.cancel=function(){clearTimeout(o),o=f=m=null},A}function yce(u,d){return Wl(d,u)}function vT(u){return function(){return!u.apply(this,arguments)}}function mce(){var u=arguments,d=u.length-1;return function(){for(var n=d,o=u[d].apply(this,arguments);n--;)o=u[n].call(this,o);return o}}function vce(u,d){return function(){if(--u<1)return d.apply(this,arguments)}}function hL(u,d){var n;return function(){return--u>0&&(n=d.apply(this,arguments)),u<=1&&(d=null),n}}const Ece=Wl(hL,2);function yL(u,d,n){d=Ui(d,n);for(var o=Wr(u),l,f=0,t=o.length;f<t;f++)if(l=o[f],d(u[l],l,u))return l}function mL(u){return function(d,n,o){n=Ui(n,o);for(var l=Bi(d),f=u>0?0:l-1;f>=0&&f<l;f+=u)if(n(d[f],f,d))return f;return-1}}const ET=mL(1),vL=mL(-1);function EL(u,d,n,o){n=Ui(n,o,1);for(var l=n(d),f=0,t=Bi(u);f<t;){var m=Math.floor((f+t)/2);n(u[m])<l?f=m+1:t=m}return f}function TL(u,d,n){return function(o,l,f){var t=0,m=Bi(o);if(typeof f=="number")u>0?t=f>=0?f:Math.max(f+m,t):m=f>=0?Math.min(f+1,m):f+m+1;else if(n&&f&&m)return f=n(o,l),o[f]===l?f:-1;if(l!==l)return f=d(ku.call(o,t,m),KN),f>=0?f+t:-1;for(f=u>0?t:m-1;f>=0&&f<m;f+=u)if(o[f]===l)return f;return-1}}const bL=TL(1,ET,EL),Tce=TL(-1,vL);function TT(u,d,n){var o=es(u)?ET:yL,l=o(u,d,n);if(l!==void 0&&l!==-1)return u[l]}function bce(u,d){return TT(u,Wu(d))}function zn(u,d,n){d=Yu(d,n);var o,l;if(es(u))for(o=0,l=u.length;o<l;o++)d(u[o],o,u);else{var f=Wr(u);for(o=0,l=f.length;o<l;o++)d(u[f[o]],f[o],u)}return u}function No(u,d,n){d=Ui(d,n);for(var o=!es(u)&&Wr(u),l=(o||u).length,f=Array(l),t=0;t<l;t++){var m=o?o[t]:t;f[t]=d(u[m],m,u)}return f}function AL(u){var d=function(n,o,l,f){var t=!es(n)&&Wr(n),m=(t||n).length,E=u>0?0:m-1;for(f||(l=n[t?t[E]:E],E+=u);E>=0&&E<m;E+=u){var A=t?t[E]:E;l=o(l,n[A],A,n)}return l};return function(n,o,l,f){var t=arguments.length>=3;return d(n,Yu(o,f,4),l,t)}}const bT=AL(1),IL=AL(-1);function Yl(u,d,n){var o=[];return d=Ui(d,n),zn(u,function(l,f,t){d(l,f,t)&&o.push(l)}),o}function Ace(u,d,n){return Yl(u,vT(Ui(d)),n)}function wL(u,d,n){d=Ui(d,n);for(var o=!es(u)&&Wr(u),l=(o||u).length,f=0;f<l;f++){var t=o?o[f]:f;if(!d(u[t],t,u))return!1}return!0}function RL(u,d,n){d=Ui(d,n);for(var o=!es(u)&&Wr(u),l=(o||u).length,f=0;f<l;f++){var t=o?o[f]:f;if(d(u[t],t,u))return!0}return!1}function Hn(u,d,n,o){return es(u)||(u=Jl(u)),(typeof n!="number"||o)&&(n=0),bL(u,d,n)>=0}const Ice=Mi(function(u,d,n){var o,l;return Ii(d)?l=d:(d=Ju(d),o=d.slice(0,-1),d=d[d.length-1]),No(u,function(f){var t=l;if(!t){if(o&&o.length&&(f=cT(f,o)),f==null)return;t=f[d]}return t==null?t:t.apply(f,n)})});function AT(u,d){return No(u,fT(d))}function wce(u,d){return Yl(u,Wu(d))}function _L(u,d,n){var o=-1/0,l=-1/0,f,t;if(d==null||typeof d=="number"&&typeof u[0]!="object"&&u!=null){u=es(u)?u:Jl(u);for(var m=0,E=u.length;m<E;m++)f=u[m],f!=null&&f>o&&(o=f)}else d=Ui(d,n),zn(u,function(A,g,w){t=d(A,g,w),(t>l||t===-1/0&&o===-1/0)&&(o=A,l=t)});return o}function Rce(u,d,n){var o=1/0,l=1/0,f,t;if(d==null||typeof d=="number"&&typeof u[0]!="object"&&u!=null){u=es(u)?u:Jl(u);for(var m=0,E=u.length;m<E;m++)f=u[m],f!=null&&f<o&&(o=f)}else d=Ui(d,n),zn(u,function(A,g,w){t=d(A,g,w),(t<l||t===1/0&&o===1/0)&&(o=A,l=t)});return o}var _ce=/[^\ud800-\udfff]|[\ud800-\udbff][\udc00-\udfff]|[\ud800-\udfff]/g;function gL(u){return u?Po(u)?ku.call(u):tT(u)?u.match(_ce):es(u)?No(u,pT):Jl(u):[]}function DL(u,d,n){if(d==null||n)return es(u)||(u=Jl(u)),u[yT(u.length-1)];var o=gL(u),l=Bi(o);d=Math.max(Math.min(d,l),0);for(var f=l-1,t=0;t<d;t++){var m=yT(t,f),E=o[t];o[t]=o[m],o[m]=E}return o.slice(0,d)}function gce(u){return DL(u,1/0)}function Dce(u,d,n){var o=0;return d=Ui(d,n),AT(No(u,function(l,f,t){return{value:l,index:o++,criteria:d(l,f,t)}}).sort(function(l,f){var t=l.criteria,m=f.criteria;if(t!==m){if(t>m||t===void 0)return 1;if(t<m||m===void 0)return-1}return l.index-f.index}),"value")}function Fh(u,d){return function(n,o,l){var f=d?[[],[]]:{};return o=Ui(o,l),zn(n,function(t,m){var E=o(t,m,n);u(f,t,E)}),f}}const Oce=Fh(function(u,d,n){wa(u,n)?u[n].push(d):u[n]=[d]}),$ce=Fh(function(u,d,n){u[n]=d}),Cce=Fh(function(u,d,n){wa(u,n)?u[n]++:u[n]=1}),Pce=Fh(function(u,d,n){u[n?0:1].push(d)},!0);function Vce(u){return u==null?0:es(u)?u.length:Wr(u).length}function Nce(u,d,n){return d in n}const OL=Mi(function(u,d){var n={},o=d[0];if(u==null)return n;Ii(o)?(d.length>1&&(o=Yu(o,d[1])),d=Zu(u)):(o=Nce,d=Vo(d,!1,!1),u=Object(u));for(var l=0,f=d.length;l<f;l++){var t=d[l],m=u[t];o(m,t,u)&&(n[t]=m)}return n}),Lce=Mi(function(u,d){var n=d[0],o;return Ii(n)?(n=vT(n),d.length>1&&(o=d[1])):(d=No(Vo(d,!1,!1),String),n=function(l,f){return!Hn(d,f)}),OL(u,n,o)});function $L(u,d,n){return ku.call(u,0,Math.max(0,u.length-(d==null||n?1:d)))}function IT(u,d,n){return u==null||u.length<1?d==null||n?void 0:[]:d==null||n?u[0]:$L(u,u.length-d)}function Kh(u,d,n){return ku.call(u,d==null||n?1:d)}function Mce(u,d,n){return u==null||u.length<1?d==null||n?void 0:[]:d==null||n?u[u.length-1]:Kh(u,Math.max(0,u.length-d))}function Bce(u){return Yl(u,Boolean)}function Uce(u,d){return Vo(u,d,!1)}const CL=Mi(function(u,d){return d=Vo(d,!0,!0),Yl(u,function(n){return!Hn(d,n)})}),jce=Mi(function(u,d){return CL(u,d)});function wT(u,d,n,o){MN(d)||(o=n,n=d,d=!1),n!=null&&(n=Ui(n,o));for(var l=[],f=[],t=0,m=Bi(u);t<m;t++){var E=u[t],A=n?n(E,t,u):E;d&&!n?((!t||f!==A)&&l.push(E),f=A):n?Hn(f,A)||(f.push(A),l.push(E)):Hn(l,E)||l.push(E)}return l}const xce=Mi(function(u){return wT(Vo(u,!0,!0))});function Gce(u){for(var d=[],n=arguments.length,o=0,l=Bi(u);o<l;o++){var f=u[o];if(!Hn(d,f)){var t;for(t=1;t<n&&Hn(arguments[t],f);t++);t===n&&d.push(f)}}return d}function RT(u){for(var d=u&&_L(u,Bi).length||0,n=Array(d),o=0;o<d;o++)n[o]=AT(u,o);return n}const Fce=Mi(RT);function Kce(u,d){for(var n={},o=0,l=Bi(u);o<l;o++)d?n[u[o]]=d[o]:n[u[o][0]]=u[o][1];return n}function kce(u,d,n){d==null&&(d=u||0,u=0),n||(n=d<u?-1:1);for(var o=Math.max(Math.ceil((d-u)/n),0),l=Array(o),f=0;f<o;f++,u+=n)l[f]=u;return l}function qce(u,d){if(d==null||d<1)return[];for(var n=[],o=0,l=u.length;o<l;)n.push(ku.call(u,o,o+=d));return n}function _T(u,d){return u._chain?Zt(d).chain():d}function PL(u){return zn(dT(u),function(d){var n=Zt[d]=u[d];Zt.prototype[d]=function(){var o=[this._wrapped];return yue.apply(o,arguments),_T(this,n.apply(Zt,o))}}),Zt}zn(["pop","push","reverse","shift","sort","splice","unshift"],function(u){var d=Uh[u];Zt.prototype[u]=function(){var n=this._wrapped;return n!=null&&(d.apply(n,arguments),(u==="shift"||u==="splice")&&n.length===0&&delete n[0]),_T(this,n)}}),zn(["concat","join","slice"],function(u){var d=Uh[u];Zt.prototype[u]=function(){var n=this._wrapped;return n!=null&&(n=d.apply(n,arguments)),_T(this,n)}});var VL=PL(Object.freeze(Object.defineProperty({__proto__:null,VERSION:_N,after:vce,all:wL,allKeys:Zu,any:RL,assign:Gh,before:hL,bind:pL,bindAll:uce,chain:dce,chunk:qce,clone:Sue,collect:No,compact:Bce,compose:mce,constant:kN,contains:Hn,countBy:Cce,create:que,debounce:hce,default:Zt,defaults:iL,defer:pce,delay:fL,detect:TT,difference:CL,drop:Kh,each:zn,escape:Hue,every:wL,extend:rL,extendOwn:Gh,filter:Yl,find:TT,findIndex:ET,findKey:yL,findLastIndex:vL,findWhere:bce,first:IT,flatten:Uce,foldl:bT,foldr:IL,forEach:zn,functions:dT,get:aL,groupBy:Oce,has:Jue,head:IT,identity:pT,include:Hn,includes:Hn,indexBy:$ce,indexOf:bL,initial:$L,inject:bT,intersection:Gce,invert:tL,invoke:Ice,isArguments:sT,isArray:Po,isArrayBuffer:jN,isBoolean:MN,isDataView:jh,isDate:Rue,isElement:wue,isEmpty:Su,isEqual:Mue,isError:gue,isFinite:Cue,isFunction:Ii,isMap:jue,isMatch:WN,isNaN:KN,isNull:Iue,isNumber:BN,isObject:js,isRegExp:_ue,isSet:Gue,isString:tT,isSymbol:UN,isTypedArray:ZN,isUndefined:LN,isWeakMap:xue,isWeakSet:Fue,iteratee:hT,keys:Wr,last:Mce,lastIndexOf:Tce,map:No,mapObject:Wue,matcher:Wu,matches:Wu,max:_L,memoize:cce,methods:dT,min:Rce,mixin:PL,negate:vT,noop:lL,now:zu,object:Kce,omit:Lce,once:Ece,pairs:Kue,partial:Wl,partition:Pce,pick:OL,pluck:AT,property:fT,propertyOf:Yue,random:yT,range:kce,reduce:bT,reduceRight:IL,reject:Ace,rest:Kh,restArguments:Mi,result:ace,sample:DL,select:Yl,shuffle:gce,size:Vce,some:RL,sortBy:Dce,sortedIndex:EL,tail:Kh,take:IT,tap:Zue,template:nce,templateSettings:ece,throttle:fce,times:zue,toArray:gL,toPath:nL,transpose:RT,unescape:Que,union:xce,uniq:wT,unique:wT,uniqueId:lce,unzip:RT,values:Jl,where:wce,without:jce,wrap:yce,zip:Fce},Symbol.toStringTag,{value:"Module"})));VL._=VL;function kr(u){return u.charAt(0).toUpperCase()+u.slice(1)}function Hu(u){return u.charAt(0).toLowerCase()+u.slice(1)}function NL(u,d){if(u.type!==p.Property||d.type!==p.Property)throw new Error(`Expected property entities for comparison. But got ${u.type} and ${d.type}.`);return u===d||u.id===d.id?!0:u.name!==d.name||u.static!==d.static||u.abstract!==d.abstract?!1:ms(u.dataType,d.dataType).compatible}function LL(u,d){if(u.type!==p.DefinitionEntity||d.type!==p.DefinitionEntity)throw new Error(`Expected definition entities for comparison. But got ${u.type} and ${d.type}.`);if(u===d||u.id===d.id)return!0;if(u.properties.length!==d.properties.length)return!1;let n=[...d.properties];const o=[];for(let l=0;l<u.properties.length;l++){const f=u.properties[l];n.find(m=>{const E=NL(f,m);return E&&(n=n.filter(A=>A.id!==m.id)),E})||o.push(f)}return!(o.length>0)}var ys=(u=>(u.BothUnconstrained="both-unconstrained",u.AConstraintBUnconstrained="a-constraint-b-unconstrained",u.BConstraintAUnconstrained="b-constraint-a-unconstrained",u.Same="same",u.AIsListBIsNot="a-is-list-b-is-not",u.BIsListAIsNot="b-is-list-a-is-not",u.AIsNullableBIsNot="a-is-nullable-b-is-not",u.BIsNullableAIsNot="b-is-nullable-a-is-not",u.AIsTemplateBIsNot="a-is-template-b-is-not",u.BIsTemplateAIsNot="b-is-template-a-is-not",u.BothUntyped="both-untyped",u.AIsUntypedBIsNot="a-is-untyped-b-is-not",u.BIsUntypedAIsNot="b-is-untyped-a-is-not",u.TypeEntityMismatch="type-entity-mismatch",u.SameDefinitionEntities="same-definition-entities",u.CompatibleDefinitionEntities="compatible-definition-entities",u.IncompatibleDefinitionEntities="incompatible-definition-entities",u.SamePrimitiveEntities="same-primitive-entities",u.IncompatiblePrimitiveEntities="incompatible-primitive-entities",u.SameBuiltInBaseEntities="same-built-in-base-entities",u.IncompatibleBuiltInBaseEntities="incompatible-built-in-base-entities",u.CheckUnknown="check-unknown",u))(ys||{});function ms(u,d){var n,o,l,f,t,m,E,A,g,w,V;if(u&&u.type!==p.DataType||d&&d.type!==p.DataType)throw new Error(`Expected data-type entities for comparison. But got ${u==null?void 0:u.type} and ${d==null?void 0:d.type}.`);if(u===null&&d===null)return{compatible:!0,type:"both-unconstrained"};if(u===null)return{compatible:!0,type:"a-constraint-b-unconstrained"};if(d===null)return{compatible:!0,type:"b-constraint-a-unconstrained"};if(u===d)return{compatible:!0,type:"same"};if(u.id===d.id)return{compatible:!0,type:"same"};if(u.isList!==d.isList)return{compatible:!1,type:u.isList?"a-is-list-b-is-not":"b-is-list-a-is-not"};if(u.asType!==d.asType)return{compatible:!1,type:u.asType?"a-is-template-b-is-not":"b-is-template-a-is-not"};if(!u.entity&&d.entity)return{compatible:!0,type:"a-is-untyped-b-is-not"};if(u.entity&&!d.entity)return{compatible:!0,type:"b-is-untyped-a-is-not"};if(!u.entity&&!d.entity)return{compatible:!0,type:"both-untyped"};if(((n=u.entity)==null?void 0:n.type)!==((o=d.entity)==null?void 0:o.type))return{compatible:!1,type:"type-entity-mismatch"};if(((l=u.entity)==null?void 0:l.type)===p.DefinitionEntity){if(((f=u.entity)==null?void 0:f.id)===((t=d.entity)==null?void 0:t.id))return{compatible:!0,type:"same-definition-entities"};const B=LL(u.entity,d.entity);return{compatible:B,type:B?"compatible-definition-entities":"incompatible-definition-entities"}}return((m=u.entity)==null?void 0:m.type)===p.PrimitiveEntity?((E=u.entity)==null?void 0:E.id)===((A=d.entity)==null?void 0:A.id)?{compatible:!0,type:"same-primitive-entities"}:{compatible:!1,type:"incompatible-primitive-entities"}:((g=u.entity)==null?void 0:g.type)===p.BuiltInBaseEntity?((w=u.entity)==null?void 0:w.id)===((V=d.entity)==null?void 0:V.id)?{compatible:!0,type:"same-built-in-base-entities"}:{compatible:!1,type:"incompatible-built-in-base-entities"}:{compatible:!1,type:"check-unknown"}}function Sce(u,d){const n=u.project.builtInBaseEntities.find(f=>f.id===Oe.EXECUTION),o={id:P.UUID.uuid(),version:P.UUID.uuid(),createdAt:(d==null?void 0:d.timestamp)||new Date().toISOString(),author:P.sessionAuthor,previousVersion:null,deleted:!1,type:p.DataType,isList:!1,isNullable:!1,andChildrenGroup:null,orChildrenGroup:null,asType:!1,entity:null,constant:!1,defaultValue:null,parent:null},l=Y(o,u.project);return l.inferred=!0,d==null||d.add(l,G.Added),l.metaSync(o,d),l.setParent(u,d),l.entity=n,l}function ML(u,d=null){return u.dataType?u.dataType:null}function gT(u,d=null){var o;const n=(o=u.declaration)==null?void 0:o.getDataType(d);return n&&n.isResolved?n:u.readsValue?xs(u.readsValue,d):null}function DT(u,d=null){return u.dataType&&!u.dataType.inferred&&u.dataType.isResolved?u.dataType:u.readsValue?xs(u.readsValue,d):null}function BL(u,d=null){return xs(u.declaration,d)}function UL(u,d=null){return u.dataType&&!u.dataType.inferred?u.dataType:u.dataType&&u.dataType.inferred||!u.dataType?(u.inferDataTypeAndSyncInstancesInputsAndOutputs(d),u.dataType):null}function OT(u,d=null){var n;return((n=u.declaration)==null?void 0:n.dataType)||null}function jL(u,d=null){return(u==null?void 0:u.dataType)||null}function xL(u,d=null){return(u==null?void 0:u.dataType)||null}function xs(u,d=null){switch(u.type){case p.VariableDeclaration:return UL(u,d);case p.ArgumentDeclaration:return ML(u,d);case p.ReturnDeclaration:return DT(u,d);case p.VariableInstance:return BL(u,d);case p.InputMap:return gT(u,d);case p.OutputMap:return OT(u,d);case p.Property:return jL(u,d);case p.ValueDescriptor:return xL(u,d);default:throw new Error(`Cannot infer data type from entity of type ${u.type}.`)}}function kh(u,d=null){switch(u.type){case p.ArgumentDeclaration:return u.getDataType(d);case p.InputMap:return u.getDataType(d);case p.VariableDeclaration:return u.getDataType(d);case p.VariableInstance:return u.getDataType(d);case p.OutputMap:return u.getDataType(d);case p.ReturnDeclaration:return u.getDataType(d);case p.Property:return u.getDataType(d);case p.ValueDescriptor:return u.getDataType(d);default:return null}}function Q(u){if(u){let d=null;return typeof u=="string"?d=u:u.entityId?d=u.entityId:u.type!==p.GenericReference&&(d=u.id),d}return null}function Lo(u){return u.declaration||u}function Zce(u){return u.type===p.VariableDeclaration?u.parent===u.project?"global-declaration":"local-declaration":u.declaration.parent===u.project?"global-instance":"local-instance"}function $T(u,d){const n=[];if(u.type===p.Project)n.push(...u.variableDeclarations);else{const l=ei(nt(u)).filter(f=>f.type===p.VariableDeclaration);n.push(...l),u.parent&&(br.includes(u.parent.type)||u.parent.type===p.Project)&&n.push(...$T(u.parent))}return n}function Ra(u){return u.split(/[\s-]+/).filter(o=>o.length>0).map((o,l)=>l===0?o.toLowerCase():o[0].toUpperCase()+o.slice(1).toLowerCase()).join("")}function zl(u){return u.split(/[\s-]+/).filter(o=>o.length>0).map(o=>o[0].toUpperCase()+o.slice(1).toLowerCase()).join("")}function GL(u){var d;return(d=u.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g))==null?void 0:d.map(n=>n.toLowerCase()).join("-")}function qh(u){return GL(u).toLowerCase()}function Sh(u){var n,o,l,f;if(!u)return"Any data type";let d="";if(u.interactiveEntities===!1?d+=` but only definition nodes ${u.asType?"as template ":""}that don't include non-interactive built-in functionality`:u.interactiveEntities===!0&&(d+=` but only definition nodes ${u.asType?"as template ":""}that extend or implement interactive built-in functionality`),u.staticEntities===!1?d?d+=" and that aren't a single global copy instance":d+=` but only definition nodes ${u.asType?"as template ":""}that aren't a single global copy instance`:u.staticEntities===!0&&(d?d+=" and that are a single global copy instance":d+=` but only definition nodes ${u.asType?"as template ":""}that are a single global copy instance`),u.actionEntities===!1?d?d+=" excluding executable/action nodes":d+=` excluding executable/action nodes ${u.asType?"templates ":""}`:u.actionEntities===!0&&(d?d+=" and not executable/action nodes":d+=" but not executable/action nodes"),u.entity&&(d=""),u.asType&&!d&&!((n=u.andChildrenGroup)!=null&&n.length)&&!((o=u.orChildrenGroup)!=null&&o.length)&&(d=" as template"),!u.entity){const t=u.isList;if(!((l=u.andChildrenGroup)!=null&&l.length)&&!((f=u.orChildrenGroup)!=null&&f.length))return t?`List of an any data type${d}`:`Any data type${d}`;let m="",E=!1,A=!1;return(u.andChildrenGroup||[]).forEach(g=>{const w=Sh(g),V=Hu(w);E&&(m+=" and "),g.isGroup?m+="("+V+")":E?m+=V:m+=w,E=!0,A=!0}),(u.orChildrenGroup||[]).forEach(g=>{const w=Sh(g),V=Hu(w);E&&(A&&(m+=","),m+=" or "),g.isGroup?m+="("+V+")":E?m+=V:m+=w,E=!0}),t?`List of ${Hu(m)}`:m}if(u.entity.type===p.PrimitiveEntity){let t=u.entity.name;switch(u.entity.name){case re.String:t="Text";break;case re.KeyValue:t="Data structure";break}return u.isList?`List of ${t}s${d}`:`${t.slice(0,1).toUpperCase()}${t.slice(1)}${d}`}else if(u.entity.type===p.DefinitionEntity){const t=ce(u.entity,u.project);return u.isList?`List of ${t} values${d}`:t.slice(0,1).toUpperCase()+t.slice(1)+d}else if(u.entity.type===p.BuiltInBaseEntity){const t=KL(u.entity);return u.isList?`List of ${t} values${d}`:t.slice(0,1).toUpperCase()+t.slice(1)+d}else if(u.entity.type===p.LiteralValue){if(u.entity.name===re.Null)return"Empty value";if(u.entity.name===re.Untyped)return"Untyped value";if(u.entity.name===re.File)return"File";if(u.entity.name===re.String)return`"${u.entity.value}" text`;if(u.entity.name===re.Number)return`Number '${u.entity.value}'`;if(u.entity.name===re.Boolean)return`${u.entity.value} value`;if(u.entity.name===re.UUID)return`"${u.entity.value}" unique identifier`;if(u.entity.name===re.Date)return`"${u.entity.value}" date`}return u.isList?`List of ${ce(u.entity,u.project)} values${d}`:`${ce(u.entity,u.project).slice(0,1).toUpperCase()+ce(u.entity,u.project).slice(1)} value${d}`}function Jce(u){if(!u)return"Any data type";const d=u.getDataType(null);return Sh(d)}function Zh(u){switch(u.declaration.id){case fr.Equal:return"is equal to";case fr.NotEqual:return"is not equal to";case fr.MoreThan:return"is greater than";case fr.MoreThanOrEqual:return"is greater than or equal to";case fr.LessThan:return"is less than";case fr.LessThanOrEqual:return"is less than or equal to";case fr.And:return"and";case fr.Or:return"or";case cs.Empty:return"is empty";case cs.NotEmpty:return"is not empty"}}function FL(u){return u.includes(Oe.HTTP_ENDPOINT)?"HTTP endpoint":u.includes(Oe.PERSISTED_ENTITY)?"Persisted entity":u.includes(Oe.CRON_JOB)?"Scheduled execution":u.includes(Oe.RELATIONAL_DATABASE)?"Relational database":"Entity"}function KL(u){switch(u.name){case Oe.HTTP_ENDPOINT:return"HTTP endpoint";case Oe.PERSISTED_ENTITY:return"Persisted entity";case Oe.CRON_JOB:return"Scheduled execution";case Oe.RELATIONAL_DATABASE:return"Relational database"}return"Entity"}function Wce(u){const d=Db(u);if(!d){const n=Ty(u);return n.includes(Oe.HTTP_ENDPOINT)?"HTTP endpoint":n.includes(Oe.PERSISTED_ENTITY)?"Persisted entity":n.includes(Oe.CRON_JOB)?"Scheduled execution":n.includes(Oe.RELATIONAL_DATABASE)?"Relational database":ce(u,u.project)+" entity"}return ce(d,u.project)+" entity"}function kL(u){let d="Find ";return u.outputsDeclarations.forEach((n,o)=>{const l=kh(n,null),f=Hu(l&&l.entity?ce(l.entity,u.project):"unstructured data");o===0?d+=`${f} `:o===u.outputsDeclarations.length-1?d+=`and ${f} `:d+=`, ${f} `}),d}function qL(u){switch(u.name){case re.String:return"Text";case re.Number:return"Number";case re.Boolean:return"Boolean";case re.KeyValue:return"Data structure";case re.UUID:return"Unique identifier";case re.Date:return"Date";case re.EntityTemplate:return"Entity as template";case re.Enum:return"Enumeration";case re.File:return"File";case re.Null:return"Empty";case re.ActionDescriptor:return"Action descriptor";case re.Untyped:return"Untyped";default:return u.name}}function SL(u){switch(u.id){case Be.List:return"Loop over list items";case Be.ManualFlow:return"Manual flow control loop";case Be.ObjectKeys:return"Loop over object keys";case Be.ObjectValues:return"Loop over object values";case Be.Counted:return"Loop given number of times";case Be.String:return"Loop over text characters";case Ht.Addition:return"Sum numbers";case Ht.Subtraction:return"Subtract numbers";case Ht.Multiplication:return"Multiply numbers";case Ht.Division:return"Divide numbers";case Ht.Remainder:return"Get remainder of numbers";case Ht.Exponentiation:return"Get exponent of numbers";case dt.AddIndex:return"Add at index position";case dt.DeleteFirst:return"Delete first character";case dt.DeleteLast:return"Delete last character";case dt.DeleteIndex:return"Delete at index position";case dt.Join:return"Join texts";case dt.ReplaceAllMatches:return"Replace all matches";case dt.ReplaceFirst:return"Replace first match";case dt.ReplaceLast:return"Replace last match";case dt.Split:return"Split text";case dt.ReplaceIndex:return"Replace at index position";case dt.ReplaceSingleMatch:return"Replace single match";case dt.GetFirst:return"Get first character";case dt.GetLast:return"Get last character";case dt.GetIndex:return"Get at index position";case dt.Append:return"Add at the end";case dt.Prepend:return"Add at the start";case Jt.Wait:return"Wait";case Jt.Parallel:return"Run in parallel";case Jt.Sequential:return"Run in sequence";case Hr.HttpRequest:return"HTTP request";case Wt.CreateNewInstance:return"Create new copy of entity";case rt.AddIndex:return"Add item at index position";case rt.DeleteFirst:return"Delete first item";case rt.DeleteLast:return"Delete last item";case rt.DeleteIndex:return"Delete item at index position";case rt.Join:return"Join lists";case rt.ReplaceAllMatches:return"Replace all matches";case rt.ReplaceFirst:return"Replace first match";case rt.ReplaceLast:return"Replace last match";case rt.Split:return"Split list";case rt.ReplaceIndex:return"Replace at index position";case rt.ReplaceSingleMatch:return"Replace single match";case rt.GetFirst:return"Get first item";case rt.GetLast:return"Get last item";case rt.GetIndex:return"Get item at index position";case rt.Append:return"Add item at the end";case rt.Prepend:return"Add item at the start";case Mn.PROJECT_PUBLICATION_COMPLETED:return"Project publication completed";default:return(u.name.slice(0,1).toUpperCase()+u.name.slice(1)).replaceAll("-"," ")}}function ce(u,d){var n;if(p.FunctionDeclaration===u.type){const o=u.name;if(Object.values(Ji).includes(o))switch(o){case Ji.AbortExecution:return"Abort execution";case Ji.DeletePersistedEntity:return"Delete persisted entity";case Ji.SoftDeletePersistedEntity:return"Soft delete persisted entity";default:return kr(u.type).replaceAll("-"," ")}return o}if(p.BuiltInBaseEntity===u.type)return FL([u.name]);if(e1.includes(u.type)&&u.type!==p.ActionDescriptor)return u.name;switch(u.type){case p.Search:return kL(u);case p.GlobalEvent:return u.implements?ce(u.implements,d):kr(u.type).replaceAll("-"," ");case p.Operation:case p.InternalCall:case p.Loop:const o=bs(u.declaration,d);return ce(o,d);case p.ActionDescriptor:return SL(u);case p.BreakStatement:const l=bs(u.parent,d);return`Stop loop ${ce(l,d)}`;case p.ContinueStatement:const f=bs(u.parent,d);return`Execute next iteration of ${ce(f,d)}`;case p.FunctionCall:return bs(u.declaration,d).name;case p.Condition:{const m=u;if((n=u.inputs)!=null&&n.length){const E=ce(m.inputs[0],m.project);if(m.inputs[1]){const A=m.inputs[1].declaration.name;return`If ${E} ${Zh(m)} ${A}`}return`If ${E} ${Zh(m)}`}else return`If ${Zh(m)}`}case p.ReturnStatement:{const m=bs(u.parent,d);return`Output of ${ce(m,d)}`}case p.InputMap:if(u.declaration){const m=bs(u.declaration,d);return ce(m,d)||""}else return u.name||"";case p.VariableInstance:{const m=bs(u.declaration,d);return ce(m,d)||""}case p.OutputMap:if(u.declaration){const m=bs(u.declaration,d);return(m==null?void 0:m.name)||""}else return"";case p.PrimitiveEntity:case p.LiteralValue:return qL(u);default:return kr(u.type).replaceAll("-"," ")}}function CT(u,d){const n=[];u.name||n.push(new W({id:`${u.id}--${de.EmptyName}`,message:`Entity with id "${u.id}" and type "${u.type}" has an empty name. Please provide a 'name' string.`,severity:S.Error,code:de.EmptyName,issue:null}));const o=d.entities.filter(l=>l.name===u.name);return o.length&&n.push(new W({id:`${u.id}--${de.NameNotUniqueInScope}`,message:`Entity with id "${u.id}" and type "${u.type}" has a name "${u.name}" that is not unique in the project. Entity with id "${o[0].id}" has the same name.
|
|
13
|
+
`+f+"}",E}function ace(u,d,n){d=Ju(d);var o=d.length;if(!o)return Ii(n)?n.call(u):n;for(var l=0;l<o;l++){var f=u==null?void 0:u[d[l]];f===void 0&&(f=n,l=o),u=Ii(f)?f.call(u):f}return u}var oce=0;function lce(u){var d=++oce+"";return u?u+d:d}function dce(u){var d=Zt(u);return d._chain=!0,d}function cL(u,d,n,o,l){if(!(o instanceof d))return u.apply(n,l);var f=sL(u.prototype),t=u.apply(f,l);return js(t)?t:f}var Wl=Mi(function(u,d){var n=Wl.placeholder,o=function(){for(var l=0,f=d.length,t=Array(f),m=0;m<f;m++)t[m]=d[m]===n?arguments[l++]:d[m];for(;l<arguments.length;)t.push(arguments[l++]);return cL(u,o,this,this,t)};return o});Wl.placeholder=Zt;const pL=Mi(function(u,d,n){if(!Ii(u))throw new TypeError("Bind must be called on a function");var o=Mi(function(l){return cL(u,o,d,this,n.concat(l))});return o}),es=qN(Bi);function Vo(u,d,n,o){if(o=o||[],!d&&d!==0)d=1/0;else if(d<=0)return o.concat(u);for(var l=o.length,f=0,t=Bi(u);f<t;f++){var m=u[f];if(es(m)&&(Po(m)||sT(m)))if(d>1)Vo(m,d-1,n,o),l=o.length;else for(var E=0,A=m.length;E<A;)o[l++]=m[E++];else n||(o[l++]=m)}return o}const uce=Mi(function(u,d){d=Vo(d,!1,!1);var n=d.length;if(n<1)throw new Error("bindAll must be passed function names");for(;n--;){var o=d[n];u[o]=pL(u[o],u)}return u});function cce(u,d){var n=function(o){var l=n.cache,f=""+(d?d.apply(this,arguments):o);return wa(l,f)||(l[f]=u.apply(this,arguments)),l[f]};return n.cache={},n}const fL=Mi(function(u,d,n){return setTimeout(function(){return u.apply(null,n)},d)}),pce=Wl(fL,Zt,1);function fce(u,d,n){var o,l,f,t,m=0;n||(n={});var E=function(){m=n.leading===!1?0:zu(),o=null,t=u.apply(l,f),o||(l=f=null)},A=function(){var g=zu();!m&&n.leading===!1&&(m=g);var w=d-(g-m);return l=this,f=arguments,w<=0||w>d?(o&&(clearTimeout(o),o=null),m=g,t=u.apply(l,f),o||(l=f=null)):!o&&n.trailing!==!1&&(o=setTimeout(E,w)),t};return A.cancel=function(){clearTimeout(o),m=0,o=l=f=null},A}function hce(u,d,n){var o,l,f,t,m,E=function(){var g=zu()-l;d>g?o=setTimeout(E,d-g):(o=null,n||(t=u.apply(m,f)),o||(f=m=null))},A=Mi(function(g){return m=this,f=g,l=zu(),o||(o=setTimeout(E,d),n&&(t=u.apply(m,f))),t});return A.cancel=function(){clearTimeout(o),o=f=m=null},A}function yce(u,d){return Wl(d,u)}function vT(u){return function(){return!u.apply(this,arguments)}}function mce(){var u=arguments,d=u.length-1;return function(){for(var n=d,o=u[d].apply(this,arguments);n--;)o=u[n].call(this,o);return o}}function vce(u,d){return function(){if(--u<1)return d.apply(this,arguments)}}function hL(u,d){var n;return function(){return--u>0&&(n=d.apply(this,arguments)),u<=1&&(d=null),n}}const Ece=Wl(hL,2);function yL(u,d,n){d=Ui(d,n);for(var o=Wr(u),l,f=0,t=o.length;f<t;f++)if(l=o[f],d(u[l],l,u))return l}function mL(u){return function(d,n,o){n=Ui(n,o);for(var l=Bi(d),f=u>0?0:l-1;f>=0&&f<l;f+=u)if(n(d[f],f,d))return f;return-1}}const ET=mL(1),vL=mL(-1);function EL(u,d,n,o){n=Ui(n,o,1);for(var l=n(d),f=0,t=Bi(u);f<t;){var m=Math.floor((f+t)/2);n(u[m])<l?f=m+1:t=m}return f}function TL(u,d,n){return function(o,l,f){var t=0,m=Bi(o);if(typeof f=="number")u>0?t=f>=0?f:Math.max(f+m,t):m=f>=0?Math.min(f+1,m):f+m+1;else if(n&&f&&m)return f=n(o,l),o[f]===l?f:-1;if(l!==l)return f=d(ku.call(o,t,m),KN),f>=0?f+t:-1;for(f=u>0?t:m-1;f>=0&&f<m;f+=u)if(o[f]===l)return f;return-1}}const bL=TL(1,ET,EL),Tce=TL(-1,vL);function TT(u,d,n){var o=es(u)?ET:yL,l=o(u,d,n);if(l!==void 0&&l!==-1)return u[l]}function bce(u,d){return TT(u,Wu(d))}function zn(u,d,n){d=Yu(d,n);var o,l;if(es(u))for(o=0,l=u.length;o<l;o++)d(u[o],o,u);else{var f=Wr(u);for(o=0,l=f.length;o<l;o++)d(u[f[o]],f[o],u)}return u}function No(u,d,n){d=Ui(d,n);for(var o=!es(u)&&Wr(u),l=(o||u).length,f=Array(l),t=0;t<l;t++){var m=o?o[t]:t;f[t]=d(u[m],m,u)}return f}function AL(u){var d=function(n,o,l,f){var t=!es(n)&&Wr(n),m=(t||n).length,E=u>0?0:m-1;for(f||(l=n[t?t[E]:E],E+=u);E>=0&&E<m;E+=u){var A=t?t[E]:E;l=o(l,n[A],A,n)}return l};return function(n,o,l,f){var t=arguments.length>=3;return d(n,Yu(o,f,4),l,t)}}const bT=AL(1),IL=AL(-1);function Yl(u,d,n){var o=[];return d=Ui(d,n),zn(u,function(l,f,t){d(l,f,t)&&o.push(l)}),o}function Ace(u,d,n){return Yl(u,vT(Ui(d)),n)}function wL(u,d,n){d=Ui(d,n);for(var o=!es(u)&&Wr(u),l=(o||u).length,f=0;f<l;f++){var t=o?o[f]:f;if(!d(u[t],t,u))return!1}return!0}function RL(u,d,n){d=Ui(d,n);for(var o=!es(u)&&Wr(u),l=(o||u).length,f=0;f<l;f++){var t=o?o[f]:f;if(d(u[t],t,u))return!0}return!1}function Hn(u,d,n,o){return es(u)||(u=Jl(u)),(typeof n!="number"||o)&&(n=0),bL(u,d,n)>=0}const Ice=Mi(function(u,d,n){var o,l;return Ii(d)?l=d:(d=Ju(d),o=d.slice(0,-1),d=d[d.length-1]),No(u,function(f){var t=l;if(!t){if(o&&o.length&&(f=cT(f,o)),f==null)return;t=f[d]}return t==null?t:t.apply(f,n)})});function AT(u,d){return No(u,fT(d))}function wce(u,d){return Yl(u,Wu(d))}function _L(u,d,n){var o=-1/0,l=-1/0,f,t;if(d==null||typeof d=="number"&&typeof u[0]!="object"&&u!=null){u=es(u)?u:Jl(u);for(var m=0,E=u.length;m<E;m++)f=u[m],f!=null&&f>o&&(o=f)}else d=Ui(d,n),zn(u,function(A,g,w){t=d(A,g,w),(t>l||t===-1/0&&o===-1/0)&&(o=A,l=t)});return o}function Rce(u,d,n){var o=1/0,l=1/0,f,t;if(d==null||typeof d=="number"&&typeof u[0]!="object"&&u!=null){u=es(u)?u:Jl(u);for(var m=0,E=u.length;m<E;m++)f=u[m],f!=null&&f<o&&(o=f)}else d=Ui(d,n),zn(u,function(A,g,w){t=d(A,g,w),(t<l||t===1/0&&o===1/0)&&(o=A,l=t)});return o}var _ce=/[^\ud800-\udfff]|[\ud800-\udbff][\udc00-\udfff]|[\ud800-\udfff]/g;function gL(u){return u?Po(u)?ku.call(u):tT(u)?u.match(_ce):es(u)?No(u,pT):Jl(u):[]}function DL(u,d,n){if(d==null||n)return es(u)||(u=Jl(u)),u[yT(u.length-1)];var o=gL(u),l=Bi(o);d=Math.max(Math.min(d,l),0);for(var f=l-1,t=0;t<d;t++){var m=yT(t,f),E=o[t];o[t]=o[m],o[m]=E}return o.slice(0,d)}function gce(u){return DL(u,1/0)}function Dce(u,d,n){var o=0;return d=Ui(d,n),AT(No(u,function(l,f,t){return{value:l,index:o++,criteria:d(l,f,t)}}).sort(function(l,f){var t=l.criteria,m=f.criteria;if(t!==m){if(t>m||t===void 0)return 1;if(t<m||m===void 0)return-1}return l.index-f.index}),"value")}function Fh(u,d){return function(n,o,l){var f=d?[[],[]]:{};return o=Ui(o,l),zn(n,function(t,m){var E=o(t,m,n);u(f,t,E)}),f}}const Oce=Fh(function(u,d,n){wa(u,n)?u[n].push(d):u[n]=[d]}),$ce=Fh(function(u,d,n){u[n]=d}),Cce=Fh(function(u,d,n){wa(u,n)?u[n]++:u[n]=1}),Pce=Fh(function(u,d,n){u[n?0:1].push(d)},!0);function Vce(u){return u==null?0:es(u)?u.length:Wr(u).length}function Nce(u,d,n){return d in n}const OL=Mi(function(u,d){var n={},o=d[0];if(u==null)return n;Ii(o)?(d.length>1&&(o=Yu(o,d[1])),d=Zu(u)):(o=Nce,d=Vo(d,!1,!1),u=Object(u));for(var l=0,f=d.length;l<f;l++){var t=d[l],m=u[t];o(m,t,u)&&(n[t]=m)}return n}),Lce=Mi(function(u,d){var n=d[0],o;return Ii(n)?(n=vT(n),d.length>1&&(o=d[1])):(d=No(Vo(d,!1,!1),String),n=function(l,f){return!Hn(d,f)}),OL(u,n,o)});function $L(u,d,n){return ku.call(u,0,Math.max(0,u.length-(d==null||n?1:d)))}function IT(u,d,n){return u==null||u.length<1?d==null||n?void 0:[]:d==null||n?u[0]:$L(u,u.length-d)}function Kh(u,d,n){return ku.call(u,d==null||n?1:d)}function Mce(u,d,n){return u==null||u.length<1?d==null||n?void 0:[]:d==null||n?u[u.length-1]:Kh(u,Math.max(0,u.length-d))}function Bce(u){return Yl(u,Boolean)}function Uce(u,d){return Vo(u,d,!1)}const CL=Mi(function(u,d){return d=Vo(d,!0,!0),Yl(u,function(n){return!Hn(d,n)})}),jce=Mi(function(u,d){return CL(u,d)});function wT(u,d,n,o){MN(d)||(o=n,n=d,d=!1),n!=null&&(n=Ui(n,o));for(var l=[],f=[],t=0,m=Bi(u);t<m;t++){var E=u[t],A=n?n(E,t,u):E;d&&!n?((!t||f!==A)&&l.push(E),f=A):n?Hn(f,A)||(f.push(A),l.push(E)):Hn(l,E)||l.push(E)}return l}const xce=Mi(function(u){return wT(Vo(u,!0,!0))});function Gce(u){for(var d=[],n=arguments.length,o=0,l=Bi(u);o<l;o++){var f=u[o];if(!Hn(d,f)){var t;for(t=1;t<n&&Hn(arguments[t],f);t++);t===n&&d.push(f)}}return d}function RT(u){for(var d=u&&_L(u,Bi).length||0,n=Array(d),o=0;o<d;o++)n[o]=AT(u,o);return n}const Fce=Mi(RT);function Kce(u,d){for(var n={},o=0,l=Bi(u);o<l;o++)d?n[u[o]]=d[o]:n[u[o][0]]=u[o][1];return n}function kce(u,d,n){d==null&&(d=u||0,u=0),n||(n=d<u?-1:1);for(var o=Math.max(Math.ceil((d-u)/n),0),l=Array(o),f=0;f<o;f++,u+=n)l[f]=u;return l}function qce(u,d){if(d==null||d<1)return[];for(var n=[],o=0,l=u.length;o<l;)n.push(ku.call(u,o,o+=d));return n}function _T(u,d){return u._chain?Zt(d).chain():d}function PL(u){return zn(dT(u),function(d){var n=Zt[d]=u[d];Zt.prototype[d]=function(){var o=[this._wrapped];return yue.apply(o,arguments),_T(this,n.apply(Zt,o))}}),Zt}zn(["pop","push","reverse","shift","sort","splice","unshift"],function(u){var d=Uh[u];Zt.prototype[u]=function(){var n=this._wrapped;return n!=null&&(d.apply(n,arguments),(u==="shift"||u==="splice")&&n.length===0&&delete n[0]),_T(this,n)}}),zn(["concat","join","slice"],function(u){var d=Uh[u];Zt.prototype[u]=function(){var n=this._wrapped;return n!=null&&(n=d.apply(n,arguments)),_T(this,n)}});var VL=PL(Object.freeze(Object.defineProperty({__proto__:null,VERSION:_N,after:vce,all:wL,allKeys:Zu,any:RL,assign:Gh,before:hL,bind:pL,bindAll:uce,chain:dce,chunk:qce,clone:Sue,collect:No,compact:Bce,compose:mce,constant:kN,contains:Hn,countBy:Cce,create:que,debounce:hce,default:Zt,defaults:iL,defer:pce,delay:fL,detect:TT,difference:CL,drop:Kh,each:zn,escape:Hue,every:wL,extend:rL,extendOwn:Gh,filter:Yl,find:TT,findIndex:ET,findKey:yL,findLastIndex:vL,findWhere:bce,first:IT,flatten:Uce,foldl:bT,foldr:IL,forEach:zn,functions:dT,get:aL,groupBy:Oce,has:Jue,head:IT,identity:pT,include:Hn,includes:Hn,indexBy:$ce,indexOf:bL,initial:$L,inject:bT,intersection:Gce,invert:tL,invoke:Ice,isArguments:sT,isArray:Po,isArrayBuffer:jN,isBoolean:MN,isDataView:jh,isDate:Rue,isElement:wue,isEmpty:Su,isEqual:Mue,isError:gue,isFinite:Cue,isFunction:Ii,isMap:jue,isMatch:WN,isNaN:KN,isNull:Iue,isNumber:BN,isObject:js,isRegExp:_ue,isSet:Gue,isString:tT,isSymbol:UN,isTypedArray:ZN,isUndefined:LN,isWeakMap:xue,isWeakSet:Fue,iteratee:hT,keys:Wr,last:Mce,lastIndexOf:Tce,map:No,mapObject:Wue,matcher:Wu,matches:Wu,max:_L,memoize:cce,methods:dT,min:Rce,mixin:PL,negate:vT,noop:lL,now:zu,object:Kce,omit:Lce,once:Ece,pairs:Kue,partial:Wl,partition:Pce,pick:OL,pluck:AT,property:fT,propertyOf:Yue,random:yT,range:kce,reduce:bT,reduceRight:IL,reject:Ace,rest:Kh,restArguments:Mi,result:ace,sample:DL,select:Yl,shuffle:gce,size:Vce,some:RL,sortBy:Dce,sortedIndex:EL,tail:Kh,take:IT,tap:Zue,template:nce,templateSettings:ece,throttle:fce,times:zue,toArray:gL,toPath:nL,transpose:RT,unescape:Que,union:xce,uniq:wT,unique:wT,uniqueId:lce,unzip:RT,values:Jl,where:wce,without:jce,wrap:yce,zip:Fce},Symbol.toStringTag,{value:"Module"})));VL._=VL;function kr(u){return u.charAt(0).toUpperCase()+u.slice(1)}function Hu(u){return u.charAt(0).toLowerCase()+u.slice(1)}function NL(u,d){if(u.type!==p.Property||d.type!==p.Property)throw new Error(`Expected property entities for comparison. But got ${u.type} and ${d.type}.`);return u===d||u.id===d.id?!0:u.name!==d.name||u.static!==d.static||u.abstract!==d.abstract?!1:ms(u.dataType,d.dataType).compatible}function LL(u,d){if(u.type!==p.DefinitionEntity||d.type!==p.DefinitionEntity)throw new Error(`Expected definition entities for comparison. But got ${u.type} and ${d.type}.`);if(u===d||u.id===d.id)return!0;if(u.properties.length!==d.properties.length)return!1;let n=[...d.properties];const o=[];for(let l=0;l<u.properties.length;l++){const f=u.properties[l];n.find(m=>{const E=NL(f,m);return E&&(n=n.filter(A=>A.id!==m.id)),E})||o.push(f)}return!(o.length>0)}var ys=(u=>(u.BothUnconstrained="both-unconstrained",u.AConstraintBUnconstrained="a-constraint-b-unconstrained",u.BConstraintAUnconstrained="b-constraint-a-unconstrained",u.Same="same",u.AIsListBIsNot="a-is-list-b-is-not",u.BIsListAIsNot="b-is-list-a-is-not",u.AIsNullableBIsNot="a-is-nullable-b-is-not",u.BIsNullableAIsNot="b-is-nullable-a-is-not",u.AIsTemplateBIsNot="a-is-template-b-is-not",u.BIsTemplateAIsNot="b-is-template-a-is-not",u.BothUntyped="both-untyped",u.AIsUntypedBIsNot="a-is-untyped-b-is-not",u.BIsUntypedAIsNot="b-is-untyped-a-is-not",u.TypeEntityMismatch="type-entity-mismatch",u.SameDefinitionEntities="same-definition-entities",u.CompatibleDefinitionEntities="compatible-definition-entities",u.IncompatibleDefinitionEntities="incompatible-definition-entities",u.SamePrimitiveEntities="same-primitive-entities",u.IncompatiblePrimitiveEntities="incompatible-primitive-entities",u.SameBuiltInBaseEntities="same-built-in-base-entities",u.IncompatibleBuiltInBaseEntities="incompatible-built-in-base-entities",u.CheckUnknown="check-unknown",u))(ys||{});function ms(u,d){var n,o,l,f,t,m,E,A,g,w,V;if(u&&u.type!==p.DataType||d&&d.type!==p.DataType)throw new Error(`Expected data-type entities for comparison. But got ${u==null?void 0:u.type} and ${d==null?void 0:d.type}.`);if(u===null&&d===null)return{compatible:!0,type:"both-unconstrained"};if(u===null)return{compatible:!0,type:"a-constraint-b-unconstrained"};if(d===null)return{compatible:!0,type:"b-constraint-a-unconstrained"};if(u===d)return{compatible:!0,type:"same"};if(u.id===d.id)return{compatible:!0,type:"same"};if(u.isList!==d.isList)return{compatible:!1,type:u.isList?"a-is-list-b-is-not":"b-is-list-a-is-not"};if(u.asType!==d.asType)return{compatible:!1,type:u.asType?"a-is-template-b-is-not":"b-is-template-a-is-not"};if(!u.entity&&d.entity)return{compatible:!0,type:"a-is-untyped-b-is-not"};if(u.entity&&!d.entity)return{compatible:!0,type:"b-is-untyped-a-is-not"};if(!u.entity&&!d.entity)return{compatible:!0,type:"both-untyped"};if(((n=u.entity)==null?void 0:n.type)!==((o=d.entity)==null?void 0:o.type))return{compatible:!1,type:"type-entity-mismatch"};if(((l=u.entity)==null?void 0:l.type)===p.DefinitionEntity){if(((f=u.entity)==null?void 0:f.id)===((t=d.entity)==null?void 0:t.id))return{compatible:!0,type:"same-definition-entities"};const B=LL(u.entity,d.entity);return{compatible:B,type:B?"compatible-definition-entities":"incompatible-definition-entities"}}return((m=u.entity)==null?void 0:m.type)===p.PrimitiveEntity?((E=u.entity)==null?void 0:E.id)===((A=d.entity)==null?void 0:A.id)?{compatible:!0,type:"same-primitive-entities"}:{compatible:!1,type:"incompatible-primitive-entities"}:((g=u.entity)==null?void 0:g.type)===p.BuiltInBaseEntity?((w=u.entity)==null?void 0:w.id)===((V=d.entity)==null?void 0:V.id)?{compatible:!0,type:"same-built-in-base-entities"}:{compatible:!1,type:"incompatible-built-in-base-entities"}:{compatible:!1,type:"check-unknown"}}function Sce(u,d){const n=u.project.builtInBaseEntities.find(f=>f.id===Oe.EXECUTION),o={id:P.UUID.uuid(),version:P.UUID.uuid(),createdAt:(d==null?void 0:d.timestamp)||new Date().toISOString(),author:P.sessionAuthor,previousVersion:null,deleted:!1,type:p.DataType,isList:!1,isNullable:!1,andChildrenGroup:null,orChildrenGroup:null,asType:!1,entity:null,constant:!1,defaultValue:null,parent:null},l=Y(o,u.project);return l.inferred=!0,d==null||d.add(l,G.Added),l.metaSync(o,d),l.setParent(u,d),l.entity=n,l}function ML(u,d=null){return u.dataType?u.dataType:null}function gT(u,d=null){var o;const n=(o=u.declaration)==null?void 0:o.getDataType(d);return n&&n.isResolved?n:u.readsValue?xs(u.readsValue,d):null}function DT(u,d=null){return u.dataType&&!u.dataType.inferred&&u.dataType.isResolved?u.dataType:u.readsValue?xs(u.readsValue,d):null}function BL(u,d=null){return xs(u.declaration,d)}function UL(u,d=null){return u.dataType&&!u.dataType.inferred?u.dataType:(u.dataType&&u.dataType.inferred||!u.dataType)&&u.project.initialized?(u.inferDataTypeAndSyncInstancesInputsAndOutputs(d),u.dataType):null}function OT(u,d=null){var n;return((n=u.declaration)==null?void 0:n.dataType)||null}function jL(u,d=null){return(u==null?void 0:u.dataType)||null}function xL(u,d=null){return(u==null?void 0:u.dataType)||null}function xs(u,d=null){switch(u.type){case p.VariableDeclaration:return UL(u,d);case p.ArgumentDeclaration:return ML(u,d);case p.ReturnDeclaration:return DT(u,d);case p.VariableInstance:return BL(u,d);case p.InputMap:return gT(u,d);case p.OutputMap:return OT(u,d);case p.Property:return jL(u,d);case p.ValueDescriptor:return xL(u,d);default:throw new Error(`Cannot infer data type from entity of type ${u.type}.`)}}function kh(u,d=null){switch(u.type){case p.ArgumentDeclaration:return u.getDataType(d);case p.InputMap:return u.getDataType(d);case p.VariableDeclaration:return u.getDataType(d);case p.VariableInstance:return u.getDataType(d);case p.OutputMap:return u.getDataType(d);case p.ReturnDeclaration:return u.getDataType(d);case p.Property:return u.getDataType(d);case p.ValueDescriptor:return u.getDataType(d);default:return null}}function Q(u){if(u){let d=null;return typeof u=="string"?d=u:u.entityId?d=u.entityId:u.type!==p.GenericReference&&(d=u.id),d}return null}function Lo(u){return u.declaration||u}function Zce(u){return u.type===p.VariableDeclaration?u.parent===u.project?"global-declaration":"local-declaration":u.declaration.parent===u.project?"global-instance":"local-instance"}function $T(u,d){const n=[];if(u.type===p.Project)n.push(...u.variableDeclarations);else{const l=ei(nt(u)).filter(f=>f.type===p.VariableDeclaration);n.push(...l),u.parent&&(br.includes(u.parent.type)||u.parent.type===p.Project)&&n.push(...$T(u.parent))}return n}function Ra(u){return u.split(/[\s-]+/).filter(o=>o.length>0).map((o,l)=>l===0?o.toLowerCase():o[0].toUpperCase()+o.slice(1).toLowerCase()).join("")}function zl(u){return u.split(/[\s-]+/).filter(o=>o.length>0).map(o=>o[0].toUpperCase()+o.slice(1).toLowerCase()).join("")}function GL(u){var d;return(d=u.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g))==null?void 0:d.map(n=>n.toLowerCase()).join("-")}function qh(u){return GL(u).toLowerCase()}function Sh(u){var n,o,l,f;if(!u)return"Any data type";let d="";if(u.interactiveEntities===!1?d+=` but only definition nodes ${u.asType?"as template ":""}that don't include non-interactive built-in functionality`:u.interactiveEntities===!0&&(d+=` but only definition nodes ${u.asType?"as template ":""}that extend or implement interactive built-in functionality`),u.staticEntities===!1?d?d+=" and that aren't a single global copy instance":d+=` but only definition nodes ${u.asType?"as template ":""}that aren't a single global copy instance`:u.staticEntities===!0&&(d?d+=" and that are a single global copy instance":d+=` but only definition nodes ${u.asType?"as template ":""}that are a single global copy instance`),u.actionEntities===!1?d?d+=" excluding executable/action nodes":d+=` excluding executable/action nodes ${u.asType?"templates ":""}`:u.actionEntities===!0&&(d?d+=" and not executable/action nodes":d+=" but not executable/action nodes"),u.entity&&(d=""),u.asType&&!d&&!((n=u.andChildrenGroup)!=null&&n.length)&&!((o=u.orChildrenGroup)!=null&&o.length)&&(d=" as template"),!u.entity){const t=u.isList;if(!((l=u.andChildrenGroup)!=null&&l.length)&&!((f=u.orChildrenGroup)!=null&&f.length))return t?`List of an any data type${d}`:`Any data type${d}`;let m="",E=!1,A=!1;return(u.andChildrenGroup||[]).forEach(g=>{const w=Sh(g),V=Hu(w);E&&(m+=" and "),g.isGroup?m+="("+V+")":E?m+=V:m+=w,E=!0,A=!0}),(u.orChildrenGroup||[]).forEach(g=>{const w=Sh(g),V=Hu(w);E&&(A&&(m+=","),m+=" or "),g.isGroup?m+="("+V+")":E?m+=V:m+=w,E=!0}),t?`List of ${Hu(m)}`:m}if(u.entity.type===p.PrimitiveEntity){let t=u.entity.name;switch(u.entity.name){case re.String:t="Text";break;case re.KeyValue:t="Data structure";break}return u.isList?`List of ${t}s${d}`:`${t.slice(0,1).toUpperCase()}${t.slice(1)}${d}`}else if(u.entity.type===p.DefinitionEntity){const t=ce(u.entity,u.project);return u.isList?`List of ${t} values${d}`:t.slice(0,1).toUpperCase()+t.slice(1)+d}else if(u.entity.type===p.BuiltInBaseEntity){const t=KL(u.entity);return u.isList?`List of ${t} values${d}`:t.slice(0,1).toUpperCase()+t.slice(1)+d}else if(u.entity.type===p.LiteralValue){if(u.entity.name===re.Null)return"Empty value";if(u.entity.name===re.Untyped)return"Untyped value";if(u.entity.name===re.File)return"File";if(u.entity.name===re.String)return`"${u.entity.value}" text`;if(u.entity.name===re.Number)return`Number '${u.entity.value}'`;if(u.entity.name===re.Boolean)return`${u.entity.value} value`;if(u.entity.name===re.UUID)return`"${u.entity.value}" unique identifier`;if(u.entity.name===re.Date)return`"${u.entity.value}" date`}return u.isList?`List of ${ce(u.entity,u.project)} values${d}`:`${ce(u.entity,u.project).slice(0,1).toUpperCase()+ce(u.entity,u.project).slice(1)} value${d}`}function Jce(u){if(!u)return"Any data type";const d=u.getDataType(null);return Sh(d)}function Zh(u){switch(u.declaration.id){case fr.Equal:return"is equal to";case fr.NotEqual:return"is not equal to";case fr.MoreThan:return"is greater than";case fr.MoreThanOrEqual:return"is greater than or equal to";case fr.LessThan:return"is less than";case fr.LessThanOrEqual:return"is less than or equal to";case fr.And:return"and";case fr.Or:return"or";case cs.Empty:return"is empty";case cs.NotEmpty:return"is not empty"}}function FL(u){return u.includes(Oe.HTTP_ENDPOINT)?"HTTP endpoint":u.includes(Oe.PERSISTED_ENTITY)?"Persisted entity":u.includes(Oe.CRON_JOB)?"Scheduled execution":u.includes(Oe.RELATIONAL_DATABASE)?"Relational database":"Entity"}function KL(u){switch(u.name){case Oe.HTTP_ENDPOINT:return"HTTP endpoint";case Oe.PERSISTED_ENTITY:return"Persisted entity";case Oe.CRON_JOB:return"Scheduled execution";case Oe.RELATIONAL_DATABASE:return"Relational database"}return"Entity"}function Wce(u){const d=Db(u);if(!d){const n=Ty(u);return n.includes(Oe.HTTP_ENDPOINT)?"HTTP endpoint":n.includes(Oe.PERSISTED_ENTITY)?"Persisted entity":n.includes(Oe.CRON_JOB)?"Scheduled execution":n.includes(Oe.RELATIONAL_DATABASE)?"Relational database":ce(u,u.project)+" entity"}return ce(d,u.project)+" entity"}function kL(u){let d="Find ";return u.outputsDeclarations.forEach((n,o)=>{const l=kh(n,null),f=Hu(l&&l.entity?ce(l.entity,u.project):"unstructured data");o===0?d+=`${f} `:o===u.outputsDeclarations.length-1?d+=`and ${f} `:d+=`, ${f} `}),d}function qL(u){switch(u.name){case re.String:return"Text";case re.Number:return"Number";case re.Boolean:return"Boolean";case re.KeyValue:return"Data structure";case re.UUID:return"Unique identifier";case re.Date:return"Date";case re.EntityTemplate:return"Entity as template";case re.Enum:return"Enumeration";case re.File:return"File";case re.Null:return"Empty";case re.ActionDescriptor:return"Action descriptor";case re.Untyped:return"Untyped";default:return u.name}}function SL(u){switch(u.id){case Be.List:return"Loop over list items";case Be.ManualFlow:return"Manual flow control loop";case Be.ObjectKeys:return"Loop over object keys";case Be.ObjectValues:return"Loop over object values";case Be.Counted:return"Loop given number of times";case Be.String:return"Loop over text characters";case Ht.Addition:return"Sum numbers";case Ht.Subtraction:return"Subtract numbers";case Ht.Multiplication:return"Multiply numbers";case Ht.Division:return"Divide numbers";case Ht.Remainder:return"Get remainder of numbers";case Ht.Exponentiation:return"Get exponent of numbers";case dt.AddIndex:return"Add at index position";case dt.DeleteFirst:return"Delete first character";case dt.DeleteLast:return"Delete last character";case dt.DeleteIndex:return"Delete at index position";case dt.Join:return"Join texts";case dt.ReplaceAllMatches:return"Replace all matches";case dt.ReplaceFirst:return"Replace first match";case dt.ReplaceLast:return"Replace last match";case dt.Split:return"Split text";case dt.ReplaceIndex:return"Replace at index position";case dt.ReplaceSingleMatch:return"Replace single match";case dt.GetFirst:return"Get first character";case dt.GetLast:return"Get last character";case dt.GetIndex:return"Get at index position";case dt.Append:return"Add at the end";case dt.Prepend:return"Add at the start";case Jt.Wait:return"Wait";case Jt.Parallel:return"Run in parallel";case Jt.Sequential:return"Run in sequence";case Hr.HttpRequest:return"HTTP request";case Wt.CreateNewInstance:return"Create new copy of entity";case rt.AddIndex:return"Add item at index position";case rt.DeleteFirst:return"Delete first item";case rt.DeleteLast:return"Delete last item";case rt.DeleteIndex:return"Delete item at index position";case rt.Join:return"Join lists";case rt.ReplaceAllMatches:return"Replace all matches";case rt.ReplaceFirst:return"Replace first match";case rt.ReplaceLast:return"Replace last match";case rt.Split:return"Split list";case rt.ReplaceIndex:return"Replace at index position";case rt.ReplaceSingleMatch:return"Replace single match";case rt.GetFirst:return"Get first item";case rt.GetLast:return"Get last item";case rt.GetIndex:return"Get item at index position";case rt.Append:return"Add item at the end";case rt.Prepend:return"Add item at the start";case Mn.PROJECT_PUBLICATION_COMPLETED:return"Project publication completed";default:return(u.name.slice(0,1).toUpperCase()+u.name.slice(1)).replaceAll("-"," ")}}function ce(u,d){var n;if(p.FunctionDeclaration===u.type){const o=u.name;if(Object.values(Ji).includes(o))switch(o){case Ji.AbortExecution:return"Abort execution";case Ji.DeletePersistedEntity:return"Delete persisted entity";case Ji.SoftDeletePersistedEntity:return"Soft delete persisted entity";default:return kr(u.type).replaceAll("-"," ")}return o}if(p.BuiltInBaseEntity===u.type)return FL([u.name]);if(e1.includes(u.type)&&u.type!==p.ActionDescriptor)return u.name;switch(u.type){case p.Search:return kL(u);case p.GlobalEvent:return u.implements?ce(u.implements,d):kr(u.type).replaceAll("-"," ");case p.Operation:case p.InternalCall:case p.Loop:const o=bs(u.declaration,d);return ce(o,d);case p.ActionDescriptor:return SL(u);case p.BreakStatement:const l=bs(u.parent,d);return`Stop loop ${ce(l,d)}`;case p.ContinueStatement:const f=bs(u.parent,d);return`Execute next iteration of ${ce(f,d)}`;case p.FunctionCall:return bs(u.declaration,d).name;case p.Condition:{const m=u;if((n=u.inputs)!=null&&n.length){const E=ce(m.inputs[0],m.project);if(m.inputs[1]){const A=m.inputs[1].declaration.name;return`If ${E} ${Zh(m)} ${A}`}return`If ${E} ${Zh(m)}`}else return`If ${Zh(m)}`}case p.ReturnStatement:{const m=bs(u.parent,d);return`Output of ${ce(m,d)}`}case p.InputMap:if(u.declaration){const m=bs(u.declaration,d);return ce(m,d)||""}else return u.name||"";case p.VariableInstance:{const m=bs(u.declaration,d);return ce(m,d)||""}case p.OutputMap:if(u.declaration){const m=bs(u.declaration,d);return(m==null?void 0:m.name)||""}else return"";case p.PrimitiveEntity:case p.LiteralValue:return qL(u);default:return kr(u.type).replaceAll("-"," ")}}function CT(u,d){const n=[];u.name||n.push(new W({id:`${u.id}--${de.EmptyName}`,message:`Entity with id "${u.id}" and type "${u.type}" has an empty name. Please provide a 'name' string.`,severity:S.Error,code:de.EmptyName,issue:null}));const o=d.entities.filter(l=>l.name===u.name);return o.length&&n.push(new W({id:`${u.id}--${de.NameNotUniqueInScope}`,message:`Entity with id "${u.id}" and type "${u.type}" has a name "${u.name}" that is not unique in the project. Entity with id "${o[0].id}" has the same name.
|
|
14
14
|
Please provide a unique 'name' string.`,severity:S.Error,code:de.NameNotUniqueInScope,issue:null})),n}function PT(u,d){const n=[];u.name||n.push(new W({id:`${u.id}--${de.EmptyName}`,message:`Entity with id "${u.id}" and type "${u.type}" has an empty name. Please provide a 'name' string.`,severity:S.Error,code:de.EmptyName,issue:null}));const o=u.parent?Q(u.parent):null;let l=d;o&&(l=d.get(o));const f=[];l.type===p.DefinitionEntity?f.push(...l.methods.map(m=>m)):l.type===p.Project?f.push(...l.functions.map(m=>m)):l.type===p.Loop?l.body&&f.push(l.body):l.type===p.InstalledProject&&f.push(...l.functions.map(m=>m));const t=f.filter(m=>m.name===u.name);return t.length&&n.push(new W({id:`${u.id}--${de.NameNotUniqueInScope}`,message:`Entity with id "${u.id}" and type "${u.type}" has a name "${u.name}" that is not unique in ${l.type===p.Project?"the globally declared project scope":"its parent entity"}. Entity with id "${t[0].id}" has the same name.
|
|
15
15
|
Please provide a unique 'name' string.`,severity:S.Error,code:de.NameNotUniqueInScope,issue:null})),n}function VT(u,d){const n=[];u.name||n.push(new W({id:`${u.id}--${de.EmptyName}`,message:`Entity with id "${u.id}" and type "${u.type}" has an empty name. Please provide a 'name' string.`,severity:S.Error,code:de.EmptyName,issue:null}));const o=u.parent&&bs(u.parent,d)||d;if(!o)n.push(new W({id:`${u.id}--parent-reference--${q.ReferencedEntityNotFound}`,message:`The entity with id '${u.parent}' that isn't yet found in the project. Perhaps it should be created first. Or perhaps the ID is incorrect.`,severity:S.Error,code:q.ReferencedEntityNotFound,issue:null}));else{const f=$T(o).filter(t=>t.name===u.name);f.length&&n.push(new W({id:`${u.id}--${de.NameNotUniqueInScope}`,message:`Entity with id "${u.id}" and type "${u.type}" has a name "${u.name}" that is not unique in its scope or higher scopes. Entity with id "${f[0].id}" has the same name.
|
|
16
16
|
Please provide a unique 'name' string.`,severity:S.Error,code:de.NameNotUniqueInScope,issue:null}))}return n}function NT(u,d){const n=[];u.name||n.push(new W({id:`${u.id}--${de.EmptyName}`,message:`Entity with id "${u.id}" and type "${u.type}" has an empty name. Please provide a 'name' string.`,severity:S.Error,code:de.EmptyName,issue:null}));const o=Q(u.parent);if(!o)n.push(new W({id:`${u.id}--parent-reference--${q.InvalidReferenceObjectStructure}`,message:`Reference object at 'parent' property for entity with id "${u.id}" and type "${u.type}" is not a valid reference. A reference needs to be a 'id' string of an existing entity in the project.`,severity:S.Error,code:q.InvalidReferenceObjectStructure,issue:null}));else{const l=d.get(o);if(!l)n.push(new W({id:`${u.id}--parent-reference--${q.ReferencedEntityNotFound}`,message:`The entity with id '${o}' that isn't yet found in the project. Perhaps it should be created first. Or perhaps the ID is incorrect.`,severity:S.Error,code:q.ReferencedEntityNotFound,issue:null}));else{const t=l.properties.filter(m=>m.name===u.name);t.length&&n.push(new W({id:`${u.id}--${de.NameNotUniqueInScope}`,message:`Entity with id "${u.id}" and type "${u.type}" has a name "${u.name}" that is not unique among all properties in the parent entity. Entity with id "${t[0].id}" has the same name.
|
|
@@ -60,7 +60,7 @@ ${xa}`,issue:null}))}}}const m=l.parent&&o.get(l.parent)||o.getBuiltIn(l.parent)
|
|
|
60
60
|
The entitities of type '${Ke(w,"', '","' and '")}' can only have one 'data-type' child under the 'dataType' property so no 'parentRelationType' is needed.`,issue:null})),m.dataType)){const V=(A=m.dataType)==null?void 0:A.id;f.push(new W({id:`${n.id}--${q.NewEntityWouldOverriteExisting}`,code:q.NewEntityWouldOverriteExisting,severity:S.Error,message:`The entity with id '${n.id}' and type '${n.type}', cannot be added as a child to the entity with id '${l.parent}' and type '${g}', because it already has a 'data-type' child with id '${V}'.
|
|
61
61
|
The entitities of type '${Ke(w,"', '","' and '")}' can only have one 'data-type' child under the 'dataType' property. You can inspect the existing data-type entity with the 'describe_entity' action. Like so:
|
|
62
62
|
${En({describe_entity:V})}
|
|
63
|
-
Alternatively you can update the entity with 'update' action. Or replace it by first removing it and then creating a new one.`,issue:null}))}g===p.DataType&&(!l.parentRelationType||!(l.parentRelationType===Gr.AndDataTypeGroup||l.parentRelationType===Gr.OrDataTypeGroup))&&f.push(new W({id:`${n.id}--${q.InvalidParentRelationType}`,code:q.InvalidParentRelationType,severity:S.Error,message:`The entity with id '${n.id}' and type '${n.type}', must have a 'parentRelationType' property set to either 'or-data-type-group' or 'and-data-type-group' when being added as a child to an entity of type 'data-type'.`,issue:null}))}return{errors:f,modifiedData:l}}get isGroup(){const n=[...this.andChildrenGroup||[],...this.orChildrenGroup||[]];if(n.length>1){let o=0;for(const l of n)if(l.isResolved&&(o++,o>1))return!0}return!1}get isResolved(){return[p.BuiltInBaseEntity,p.ActionDescriptor].includes(this.parent.type)||Ka(this.parent)?!0:!(!this.entity&&!this.isGroup)}validateGeneratedUpdate(n){return{errors:[],modifiedData:n}}subscribeDependents(n){return n.forEach(o=>{this.detachedDependents[o.entity.id]||(this.detachedDependents[o.entity.id]=o)}),this}unsubscribeDependents(n){return n.forEach(o=>{this.detachedDependents[o.entity.id]&&delete this.detachedDependents[o.entity.id]}),this}syncDependents(n=this.project.addChangeSet(new F(this.project,P.sessionAuthor,L().toISOString(),this,!0,"sync-dependents"))){const o=[],l=[],f=[],t=[];return Object.values(this.detachedDependents).forEach(m=>{const E=m.entity.afterAllChildrenInitialized(n);o.push(...E.updated),l.push(...E.added),f.push(...E.removed),t.push(...E.affected)}),n==null||n.attemptAutoclose("sync-dependents",this.id),{updated:R(o),added:R(l),removed:R(f),affected:R(t),self:this}}onDetachedDependencyRemoved(n,o,l){const f=[],t=[],m=[],E=[];return o==="entity"&&this.setEntity(n,l),{updated:R(f),added:R(t),removed:R(m),affected:R(E),self:this}}onDetachedDependencyRestored(n,o,l){const f=[],t=[],m=[],E=[];return o==="entity"&&this.setEntity(null,l),{updated:R(f),added:R(t),removed:R(m),affected:R(E),self:this}}unsubscribeFromDependencies(){var n,o;return(o=(n=this.entity)==null?void 0:n.unsubscribeDependents)==null||o.call(n,[{entity:this,field:"entity"}]),this}subscribeToDependencies(){var n,o;return(o=(n=this.entity)==null?void 0:n.subscribeDependents)==null||o.call(n,[{entity:this,field:"entity"}]),this}increaseVersion(n){if(n&&!L(n).isValid())throw new Error(`The shared timestamp '${n}' is not a valid ISO 8601 date string.`);return n&&L(n).isSame(L(this.createdAt))?this:(this.previousVersion=this.version,this.version=P.UUID.uuid(),this.createdAt=L(n).toISOString()||L().toISOString(),this)}captureVersion(){var o;const n=((o=this.knownVersions)==null?void 0:o.get(this.version))||new pt(this,this.project);return n.metaSync(this.toMeta(),null),this.knownVersions=this.knownVersions?this.knownVersions.set(this.version,n):new Map([[this.version,n]]),n.entity=this.entity,n.andChildrenGroup=this.andChildrenGroup?[...this.andChildrenGroup]:this.andChildrenGroup,n.orChildrenGroup=this.orChildrenGroup?[...this.orChildrenGroup]:this.orChildrenGroup,n.parent=this.parent,this}recursiveCaptureUpstreamVersions(n){const o=[],l=[],f=[],t=[];if(this.parent){this.parent.increaseVersion(n);const m=this.parent.recursiveCaptureUpstreamVersions(n);o.push(this.parent,...m.updated),l.push(...m.added),f.push(...m.removed)}return{updated:R(o),added:R(l),removed:R(f),affected:R(t),self:this}}async restoreVersion(n){var E;const o=[],l=[],f=[],t=[];if(this.version===n)return{updated:R(o),added:R(l),removed:R(f),affected:R(t),self:this};if(!this.knownVersions){const A=new Map;for(const[g,w]of this.knownVersions||new Map){if(A.set(g,w),w.activeVersion=!1,w.knownVersions)for(const[V,B]of w.knownVersions)A.set(V,B);w.knownVersions=null}}let m=(E=this.knownVersions)==null?void 0:E.get(n);if(!m){const A=await this.APILoadVersion({},n);if(!A)throw new Error(`Version with id '${n}' for entity with id '${this.id}' not found.`);m=new pt(A,this.project)}return this.metaSync(m.toShallowJSON(),null),this.previousVersion=m.previousVersion,this.version=m.version,this.createdAt=m.createdAt,this.author=m.author,this.deleted=m.deleted,this.entity=m.entity,this.andChildrenGroup=m.andChildrenGroup,this.orChildrenGroup=m.orChildrenGroup,this.parent=m.parent,{updated:R(o),added:R(l),removed:R(f),affected:R(t),self:this}}hydrateAncestors(){const n=[],o=[],l=[],f=[];if(this.initialData.parent){const t=Q(this.initialData.parent),m=this.project.get(t);if(m)this.setParent(m,null),n.push(m);else throw new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${t}' that isn't found in the project`)}else throw new Error(`${this.type} with id '${this.id}' must have a 'parent'`);if(this.initialData.entity){const t=Q(this.initialData.entity),m=this.project.get(t);m&&(m.type===p.DefinitionEntity&&m.parent===this||(this.setEntity(m,null),m.type!==p.BuiltInBaseEntity&&m.type!==p.PrimitiveEntity&&n.push(m)))}return{updated:R(n),added:R(o),removed:R(l),affected:R(f),self:this}}afterAllChildrenInitialized(n=this.project.addChangeSet(new F(this.project,P.sessionAuthor,L().toISOString(),this,!0,"after-all-children-initialized"))){const o=[],l=[],f=[],t=[];return this.initialized=!0,this.captureVersion(),n==null||n.attemptAutoclose("after-all-children-initialized",this.id),{updated:R(o),added:R(l),removed:R(f),affected:R(t),self:this}}addSelfToProject(n=this.project.addChangeSet(new F(this.project,P.sessionAuthor,L().toISOString(),this,!0,"add-self-to-project"))){const o=[this],l=[],f=[],t=[];return this.parent.type===p.DataType?this.parentRelationType===Gr.AndDataTypeGroup?this.parent.addToAndGroup(this):this.parentRelationType===Gr.OrDataTypeGroup&&this.parent.addToOrGroup(this):this.parent.setDataType(this,n),o.push(this.parent),this.subscribe(),this.subscribeToDependencies(),n==null||n.attemptAutoclose("add-self-to-project",this.id),{updated:R(o),added:R(l),removed:R(f),affected:R(t),self:this}}setParent(n,o=this.project.addChangeSet(new F(this.project,P.sessionAuthor,L().toISOString(),this,!0,"set-parent"))){var l;return((l=this.parent)==null?void 0:l.id)!==(n==null?void 0:n.id)&&(this.parent=n,o&&(o==null||o.add(this,G.Updated))),o==null||o.attemptAutoclose("set-parent",this.id),this}removeChildGroup(n){if(this.andChildrenGroup){const o=this.andChildrenGroup.findIndex(l=>l.id===n.id);o!==-1&&this.andChildrenGroup.splice(o,1)}if(this.orChildrenGroup){const o=this.orChildrenGroup.findIndex(l=>l.id===n.id);o!==-1&&this.orChildrenGroup.splice(o,1)}return this}initChildren(n=this.project.addChangeSet(new F(this.project,P.sessionAuthor,L().toISOString(),this,!0,"init-children"))){var o,l,f,t;if(this.initialized||this.startedInitialization)return this;if(this.startedInitialization=!0,this.initialData.entity)if(this.initialData.entity.type===p.GenericReference){const m=this.project.findSubscribedInstanceFromReference(this.initialData.entity);this.entity=m}else this.entity=Y(this.initialData.entity,this.project),((l=(o=this.initialData.entity)==null?void 0:o.parent)==null?void 0:l.id)===this.id&&this.entity.setParent(this,null),(t=(f=this.entity).initChildren)==null||t.call(f,n);return this.initialData.andChildrenGroup&&(this.andChildrenGroup=this.initialData.andChildrenGroup.map(m=>{const E=Y(m,this.project);return E.setParent(this,null),E.initChildren(n),E})),this.initialData.orChildrenGroup&&(this.orChildrenGroup=this.initialData.orChildrenGroup.map(m=>{const E=Y(m,this.project);return E.setParent(this,null),E.initChildren(n),E})),this.subscribeToDependencies(),this.afterAllChildrenInitialized(n),n==null||n.attemptAutoclose("init-children",this.id),this}subscribe(){return this.activeVersion=!0,this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}metaSync(n,o=this.project.addChangeSet(new F(this.project,P.sessionAuthor,L().toISOString(),this,!0,"meta-sync"))){const l=cr(this,n),f=this.toMeta();return this.options=n.options||f.options,this.parentRelationType=n.parentRelationType||f.parentRelationType,this.isList=n.isList!==void 0?n.isList:f.isList,this.inferred=n.inferred!==void 0?n.inferred:f.inferred,this.like=n.like!==void 0?n.like:f.like,this.asType=n.asType!==void 0?n.asType:f.asType,this.implementationChooseOne=n.implementationChooseOne!==void 0?n.implementationChooseOne:f.implementationChooseOne,this.staticEntities=n.staticEntities!==void 0?n.staticEntities:f.staticEntities,this.interactiveEntities=n.interactiveEntities!==void 0?n.interactiveEntities:f.interactiveEntities,this.actionEntities=n.actionEntities!==void 0?n.actionEntities:f.actionEntities,super.metaSync(n),n.deleted===!0&&!f.deleted?o==null||o.add(this,G.Removed):n.deleted===!1&&f.deleted?o==null||o.add(this,G.Added):l&&(o==null||o.add(this,G.Updated)),o==null||o.attemptAutoclose("meta-sync",this.id),this}async APILoad(n=oe,...o){return await pt.repository.APILoad(this.id,...o),this}async APICreate(n=oe,...o){return await pt.repository.APICreate(this.toShallowJSON(),...o),this}async APIUpdate(n=oe,...o){return await pt.repository.APIUpdate(this.toShallowJSON(),...o),this}async APIDelete(n=oe,...o){return await pt.repository.APIDelete(this.toShallowJSON(),...o),this}async APIClone(n=oe,...o){return await pt.repository.APIClone(this.id,...o),this}async APILoadVersion(n=oe,o,...l){return await pt.repository.APILoadVersion(this.id,o,...l)}remove({ignoreUpstream:n}={ignoreUpstream:!1},o=this.project.addChangeSet(new F(this.project,P.sessionAuthor,L().toISOString(),this,!0,"remove-entity"))){var E;const l=[],f=[],t=[],m=[];if(o!=null&&o.hasRemoved(this.id))return o==null||o.attemptAutoclose("remove-entity",this.id),{added:[],updated:[],removed:[],affected:[],self:this};if(f.push(this),this.unsubscribe(),this.unsubscribeFromDependencies(),this.project.subscribeDeletedInstance(this),this.metaSync({deleted:!0},o),Object.values(this.detachedDependents).forEach(A=>{const{updated:g,removed:w,added:V}=A.entity.onDetachedDependencyRemoved(this,A.field,o);l.push(...g),f.push(...w),t.push(...V)}),this.entity&&this.entity.type===p.DefinitionEntity&&this.entity.parent===this){const{updated:A,removed:g}=this.entity.remove({ignoreUpstream:!0},o);l.push(...A),f.push(...g)}if(!n){((E=this.parent)==null?void 0:E.type)===p.DataType&&this.parent.removeChildGroup(this);const A=this.parent;if((A==null?void 0:A.type)===p.DataType){if(this.parentRelationType===Gr.AndDataTypeGroup){if(Array.isArray(A.andChildrenGroup)){const g=A.andChildrenGroup.findIndex(w=>w.id===this.id);g!==-1&&A.andChildrenGroup.splice(g,1)}}else if(this.parentRelationType===Gr.OrDataTypeGroup&&Array.isArray(A.orChildrenGroup)){const g=A.orChildrenGroup.findIndex(w=>w.id===this.id);g!==-1&&A.orChildrenGroup.splice(g,1)}}else{const g=this.parent;g==null||g.removeDataType()}A&&l.push(A)}return o==null||o.attemptAutoclose("remove-entity",this.id),{added:R(t),updated:R(l),removed:R(f),affected:R(m),self:this}}restore({}={},n=this.project.addChangeSet(new F(this.project,P.sessionAuthor,L().toISOString(),this,!0,"restore-entity"))){const o=[],l=[],f=[],t=[];if(n!=null&&n.hasAdded(this.id))return n==null||n.attemptAutoclose("restore-entity",this.id),{added:[],updated:[],removed:[],affected:[],self:this};if(this.subscribe(),this.project.unsubscribeDeletedInstance(this),this.metaSync({deleted:!1},n),Object.values(this.detachedDependents).forEach(m=>{const{updated:E,removed:A,added:g}=m.entity.onDetachedDependencyRestored(this,m.field,n);l.push(...E),f.push(...A),o.push(...g)}),this.entity&&this.entity.type===p.DefinitionEntity&&this.entity.parent===this){const{updated:m}=this.entity.restore({},n);l.push(...m)}if(this.parent.type===p.DataType){const m=this.parent;Array.isArray(m.andChildrenGroup)&&m.andChildrenGroup.push(this)}if(this.parent.type===p.DataType){const m=this.parent;this.parentRelationType===Gr.AndDataTypeGroup?Array.isArray(m.andChildrenGroup)&&m.andChildrenGroup.push(this):this.parentRelationType===Gr.OrDataTypeGroup&&Array.isArray(m.orChildrenGroup)&&m.orChildrenGroup.push(this)}else{const m=this.parent;m.setDataType(this,n),l.push(m)}return n==null||n.attemptAutoclose("restore-entity",this.id),{added:R(o),updated:R(l),removed:R(f),affected:R(t),self:this}}toFlat(n=new Set){var l,f,t;return n.has(this.id)?[]:(n.add(this.id),[this,...((l=this.andChildrenGroup)==null?void 0:l.flatMap(m=>m.toFlat(n)))||[],...((f=this.orChildrenGroup)==null?void 0:f.flatMap(m=>m.toFlat(n)))||[],...((t=this.entity)==null?void 0:t.toFlat(n))||[]])}toFlatIds(n=new Set){var l,f,t;return n.has(this.id)?[]:(n.add(this.id),[this.id,...((l=this.andChildrenGroup)==null?void 0:l.flatMap(m=>m.toFlatIds(n)))||[],...((f=this.orChildrenGroup)==null?void 0:f.flatMap(m=>m.toFlatIds(n)))||[],...((t=this.entity)==null?void 0:t.toFlatIds(n))||[]])}toMeta(){return{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,like:this.like,isList:this.isList,inferred:this.inferred,parentRelationType:this.parentRelationType,implementationChooseOne:this.implementationChooseOne,staticEntities:this.staticEntities,interactiveEntities:this.interactiveEntities,actionEntities:this.actionEntities,options:this.options,asType:this.asType,type:this.type}}toJSON(n=new Set){var o,l,f,t;return n.has(this.id)?this.toReference():(n.add(this.id),{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,options:this.options,isList:this.isList,asType:this.asType,like:this.like,inferred:this.inferred,parentRelationType:this.parentRelationType,implementationChooseOne:this.implementationChooseOne,staticEntities:this.staticEntities,interactiveEntities:this.interactiveEntities,actionEntities:this.actionEntities,andChildrenGroup:((o=this.andChildrenGroup)==null?void 0:o.map(m=>m.toJSON(n)))||null,orChildrenGroup:((l=this.orChildrenGroup)==null?void 0:l.map(m=>m.toJSON(n)))||null,entity:((f=this.entity)==null?void 0:f.parent)===this?this.entity.toJSON(n):((t=this.entity)==null?void 0:t.toReference())||null,parent:this.parent.toReference()})}toJSONClone(n=$e){var l,f,t,m,E,A,g,w,V;let o;return(l=n.seenEntityMaps)!=null&&l.has(this.id)?o=n.seenEntityMaps.get(this.id):(o=n.newId||hr(this,this.project,n.uuidStrategy),n.seenEntityMaps&&n.seenEntityMaps.set(this.id,o)),(f=n.seenEntities)!=null&&f.has(o)||(t=n.seenEntities)!=null&&t.has(this.id)?this.toReference({seenEntityMaps:n.seenEntityMaps}):((m=n.seenEntities)==null||m.add(o),(E=n.seenEntities)==null||E.add(this.id),{id:o,version:P.UUID.uuid(),createdAt:n.timestamp||L().toISOString(),previousVersion:null,author:this.author,deleted:this.deleted,type:this.type,options:this.options,isList:this.isList,asType:this.asType,like:this.like,inferred:this.inferred,parentRelationType:this.parentRelationType,implementationChooseOne:this.implementationChooseOne,staticEntities:this.staticEntities,interactiveEntities:this.interactiveEntities,actionEntities:this.actionEntities,andChildrenGroup:((A=this.andChildrenGroup)==null?void 0:A.map(B=>B.toJSONClone({...n,newId:null})))||null,orChildrenGroup:((g=this.orChildrenGroup)==null?void 0:g.map(B=>B.toJSONClone({...n,newId:null})))||null,entity:((w=this.entity)==null?void 0:w.parent)===this?this.entity.toJSONClone({...n,newId:null}):((V=this.entity)==null?void 0:V.toReference({seenEntityMaps:n.seenEntityMaps}))||null,parent:this.parent.toReference({seenEntityMaps:n.seenEntityMaps})})}toReference(n=$e){var l;let o=this.id;return(l=n.seenEntityMaps)!=null&&l.has(this.id)&&(o=n.seenEntityMaps.get(this.id)),{id:o+"--"+P.UUID.uuid()+"--ref",type:p.GenericReference,entityId:o,version:this.version,entityType:this.type}}toShallowJSON(n=$e){var l,f,t,m;let o=this.id;return(l=n.seenEntityMaps)!=null&&l.has(this.id)&&(o=n.seenEntityMaps.get(this.id)),{id:o,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,isList:this.isList,options:this.options,asType:this.asType,parentRelationType:this.parentRelationType,like:this.like,inferred:this.inferred,implementationChooseOne:this.implementationChooseOne,staticEntities:this.staticEntities,interactiveEntities:this.interactiveEntities,actionEntities:this.actionEntities,andChildrenGroup:((f=this.andChildrenGroup)==null?void 0:f.map(E=>E.toReference(n)))||null,orChildrenGroup:((t=this.orChildrenGroup)==null?void 0:t.map(E=>E.toReference(n)))||null,entity:((m=this.entity)==null?void 0:m.toReference(n))||null,parent:this.parent.toReference(n)}}toFlatJSON(n=new Set){var l,f,t;return n.has(this.id)?[]:(n.add(this.id),[this.toShallowJSON(),...((l=this.andChildrenGroup)==null?void 0:l.flatMap(m=>m.toFlatJSON(n)))||[],...((f=this.orChildrenGroup)==null?void 0:f.flatMap(m=>m.toFlatJSON(n)))||[],...((t=this.entity)==null?void 0:t.toFlatJSON(n))||[]])}toGenerationTarget(){var n;return{id:this.id,type:this.type,options:this.options||void 0,isList:this.isList,like:this.like,parentRelationType:this.parentRelationType||void 0,asType:this.asType,entity:((n=this.entity)==null?void 0:n.id)||null,parent:this.parent.id}}toFlatGenerationTarget(n=new Set){var l,f;return n.has(this.id)?[]:(n.add(this.id),[this.toGenerationTarget(),...((l=this.andChildrenGroup)==null?void 0:l.flatMap(t=>t.toFlatGenerationTarget(n)))||[],...((f=this.orChildrenGroup)==null?void 0:f.flatMap(t=>t.toFlatGenerationTarget(n)))||[],...this.entity&&this.entity.type==p.DefinitionEntity&&this.entity.parent===this&&this.entity.toFlatGenerationTarget(n)||[]])}clearErrors(){var n,o,l,f;return this.errors=[],(n=this.andChildrenGroup)==null||n.forEach(t=>t.clearErrors()),(o=this.orChildrenGroup)==null||o.forEach(t=>t.clearErrors()),this.inferred&&this.entity&&this.entity.type===p.DefinitionEntity&&((l=this.entity)==null?void 0:l.parent)===this&&((f=this.entity)==null||f.clearErrors()),this}validate(){const n=sM(this);return this.errors=n,{success:!0,error:null,data:this.toJSON()}}getErrors(){return[...this.errors]}getShallowErrors(){return this.errors}clone(n=this.project.addChangeSet(new F(this.project,P.sessionAuthor,L().toISOString(),this,!0,"clone-entity")),o=null,l=null,f=!0){var B,K,k;let t=yr(o,this),m=o||this.parent;const A={id:l||P.UUID.uuid(),version:P.UUID.uuid(),createdAt:(n==null?void 0:n.timestamp)||L().toISOString(),author:(n==null?void 0:n.author)||"1",previousVersion:null,deleted:!1,type:p.DataType,isList:this.isList,asType:this.asType,options:this.options,parentRelationType:this.parentRelationType,staticEntities:this.staticEntities,interactiveEntities:this.interactiveEntities,actionEntities:this.actionEntities,like:this.like,inferred:this.inferred,implementationChooseOne:this.implementationChooseOne,andChildrenGroup:null,orChildrenGroup:null,entity:null,parent:m.toReference()},g=er(A,t);o&&g.setParent(o,null),f&&g.subscribe(),g.initChildren(n),n==null||n.add(g,G.Added);const w=(B=this.andChildrenGroup)==null?void 0:B.map(Z=>Z.clone(n,g,P.UUID.uuid(),f)),V=(K=this.orChildrenGroup)==null?void 0:K.map(Z=>Z.clone(n,g,P.UUID.uuid(),f));if(g.andChildrenGroup=w||null,g.orChildrenGroup=V||null,this.entity&&this.entity.type===p.DefinitionEntity&&((k=this.entity)==null?void 0:k.parent)===this){const Z=this.entity.clone(n,g,P.UUID.uuid(),f);g.setEntity(Z,n)}else this.entity&&g.setEntity(this.entity,n);return n==null||n.attemptAutoclose("clone-entity",this.id),g}merge(n,o=this.project.addChangeSet(new F(this.project,P.sessionAuthor,L().toISOString(),this,!0,"merge-entity"))){const l=[],f=[],t=[],m=[];if(this.asType!==(n==null?void 0:n.asType)&&(this.metaSync({asType:n==null?void 0:n.asType},o),o==null||o.add(this,G.Updated),l.push(this)),this.isList!==(n==null?void 0:n.isList)&&(this.metaSync({isList:n==null?void 0:n.isList},o),o==null||o.add(this,G.Updated),l.push(this)),this.like!==(n==null?void 0:n.like)&&(this.metaSync({like:n==null?void 0:n.like},o),o==null||o.add(this,G.Updated),l.push(this)),n!=null&&n.inferred){if(n.entity&&n.entity.type===p.DefinitionEntity&&n.entity.parent===n){const E=n.entity.clone(o,this,P.UUID.uuid(),!0);this.setEntity(E,o),f.push(E)}else n.entity&&(this.setEntity(n.entity,o),o==null||o.add(this,G.Updated),l.push(this));this.inferred||(this.metaSync({inferred:!0},o),o==null||o.add(this,G.Updated),l.push(this))}else if(this.inferred){if(this.metaSync({inferred:!1},o),o==null||o.add(this,G.Updated),l.push(this),this.entity&&this.entity.type===p.DefinitionEntity&&this.entity.parent===this){const{updated:E,removed:A}=this.entity.remove({ignoreUpstream:!0},o);t.push(...A),E.push(...E)}n.entity!==this.entity&&(this.setEntity(n.entity,o),o==null||o.add(this,G.Updated),l.push(this))}else n.entity!==this.entity&&(this.setEntity(n.entity,o),o==null||o.add(this,G.Updated),l.push(this));return o==null||o.attemptAutoclose("merge-entity",this.id),{updated:R(l),added:R(f),removed:R(t),affected:R(m),self:this}}addToAndGroup(n){return this.andChildrenGroup||(this.andChildrenGroup=[]),this.andChildrenGroup.includes(n)||this.andChildrenGroup.push(n),this}addToOrGroup(n){return this.orChildrenGroup||(this.orChildrenGroup=[]),this.orChildrenGroup.includes(n)||this.orChildrenGroup.push(n),this}setEntity(n,o=this.project.addChangeSet(new F(this.project,P.sessionAuthor,L().toISOString(),this,!0,"set-data-type-entity-value"))){var f;const l=this.entity;return(l==null?void 0:l.id)!==(n==null?void 0:n.id)&&(this.entity=n,o==null||o.add(this,G.Affected),l&&l.type===p.DefinitionEntity&&((f=l.parent)==null?void 0:f.id)===this.id&&(l==null||l.remove({ignoreUpstream:!0},o))),o==null||o.attemptAutoclose("set-data-type-entity-value",this.id),this}isObject(){return!!this.entity&&(this.entity.type===p.DefinitionEntity||this.entity.type===p.BuiltInBaseEntity||this.entity.name===re.KeyValue)&&!this.isList}canBeObject(){let n=!1;if(this.parent.type!==p.DataType){const o=this.project.requestActiveValue(this.parent);o?!o.valueAsType&&(o.value===""||o.value===null||js(o))&&(n=!0):n=!0}return(this.isObject()||!this.entity||this.entity.name===re.Untyped)&&n}hasStrictObjectStructure(){var n;return this.isObject()&&((n=this.entity)==null?void 0:n.type)===p.DefinitionEntity}isInlineDeclaredEntity(){var n,o;return((n=this.entity)==null?void 0:n.type)===p.DefinitionEntity&&((o=this.entity.parent)==null?void 0:o.id)===(this==null?void 0:this.id)}canModifyInlineDeclaredEntity(){var n;return this.isInlineDeclaredEntity()||this.canBeObject()||((n=this.entity)==null?void 0:n.name)===re.KeyValue}inferFromInputs(n,o=this.project.addChangeSet(new F(this.project,P.sessionAuthor,L().toISOString(),this,!0,"infer-data-type-from-inputs"))){var E;const l=[],f=[],t=[],m=[];if(!this.inferred)return o==null||o.attemptAutoclose("infer-data-type-from-inputs",this.id),{updated:[],added:[],removed:[],affected:[],self:this};if(!this.entity&&n.length){const A=ce(this.parent,this.project)+" data type definition",g={id:P.UUID.uuid(),type:p.DefinitionEntity,version:P.UUID.uuid(),createdAt:(o==null?void 0:o.timestamp)||L().toISOString(),author:P.sessionAuthor,previousVersion:null,deleted:!1,name:A,description:((E=this.parent)==null?void 0:E.description)||null,static:!0,abstract:!1,properties:[],methods:[],extends:[],implements:[],abstractMethods:[],x:0,y:0,parent:this.toReference()},w=Y(g,this.project);w.setParent(this,o),w.initChildren(o),o==null||o.add(w,G.Added),w.metaSync(g,o),this.setEntity(w,o),o==null||o.add(this,G.Updated)}if(this.entity&&this.entity.type===p.DefinitionEntity&&this.entity.parent!==this&&this.entity.setParent(this,o),this.entity){const{updated:A,added:g,removed:w,affected:V}=this.entity.inferFromInputs(n,o);f.push(...A),l.push(...g),t.push(...w),m.push(...V)}return this.like||this.metaSync({like:!0},o),o==null||o.attemptAutoclose("infer-data-type-from-inputs",this.id),{updated:R(f),added:R(l),removed:R(t),affected:R(m),self:this}}};D(pt,"repository",{APICreate:async(n,...o)=>n,APIUpdate:async(n,...o)=>n,APIDelete:async(n,...o)=>n,APIClone:async(n,...o)=>{},APILoad:async(n,...o)=>null,APILoadVersion:async(n,o,...l)=>null}),D(pt,"type",p.DataType),D(pt,"USER_MANAGED_PARENT_TYPES",[p.Property,p.ArgumentDeclaration,p.ReturnDeclaration,p.VariableDeclaration,p.ValueDescriptor,p.InputMap,p.OutputMap,p.DataType]),D(pt,"PARENT_TYPES",[...pt.USER_MANAGED_PARENT_TYPES]),D(pt,"MUTABLE_BASE_PROPERTIES",["isList","asType","options","parentRelationType","like","implementationChooseOne","staticEntities","interactiveEntities","actionEntities"]),D(pt,"INMUTABLE_BASE_PROPERTIES",["id","type","version","createdAt","author","previousVersion"]),D(pt,"BASE_PROPERTIES",[...pt.MUTABLE_BASE_PROPERTIES,...pt.INMUTABLE_BASE_PROPERTIES]),D(pt,"MUTABLE_META_PROPERTIES",[...pt.MUTABLE_BASE_PROPERTIES,"inferred"]),D(pt,"INMUTABLE_META_PROPERTIES",[...pt.INMUTABLE_BASE_PROPERTIES]),D(pt,"META_PROPERTIES",[...pt.MUTABLE_META_PROPERTIES,...pt.INMUTABLE_META_PROPERTIES]),D(pt,"MUTABLE_UPSTREAM_PROPERTIES",["entity","parent"]),D(pt,"INMUTABLE_UPSTREAM_PROPERTIES",[]),D(pt,"UPSTREAM_PROPERTIES",[...pt.MUTABLE_UPSTREAM_PROPERTIES,...pt.INMUTABLE_UPSTREAM_PROPERTIES]),D(pt,"MUTABLE_DOWNSTREAM_PROPERTIES",[]),D(pt,"INMUTABLE_DOWNSTREAM_PROPERTIES",["andChildrenGroup","orChildrenGroup"]),D(pt,"DOWNSTREAM_PROPERTIES",[...pt.MUTABLE_DOWNSTREAM_PROPERTIES,...pt.INMUTABLE_DOWNSTREAM_PROPERTIES]),D(pt,"PROPERTIES",[...pt.META_PROPERTIES,...pt.UPSTREAM_PROPERTIES,...pt.DOWNSTREAM_PROPERTIES]);let ts=pt;function nM(u){var m;const d=Cle(),n=u.toJSON();d.safeParse(n).success;const l=ope(u),f=ta(u),t=[...l,...f];if(u.id==="exec-sequentially-operation-call-id"){const E=Qe({id:`${u.id}--${he.PropertyImplementsNonAbstact}`,message:`Property "${ce(u,u.project)}" with id "${u.id}" implements a non-abstract property "${ce(u,u.project)}" with id "${u.id}".`,issue:null,severity:S.Error,code:he.PropertyImplementsNonAbstact,entity:u});t.push(E.error)}return u.outputs.forEach(E=>E.validate()),(m=u.error)==null||m.validate(),qt(u.errors,t)}function ope(u){const d=[];return u.inputs.forEach(n=>{n.validate()}),qt(u.errors,d)}const lpe=Object.freeze(Object.defineProperty({__proto__:null,validate:nM},Symbol.toStringTag,{value:"Module"}));var aM=(u=>(u.Parent="parent",u))(aM||{});const ft=class ft extends ar{constructor(n,o){super(n);D(this,"initialData");D(this,"id");D(this,"x");D(this,"y");D(this,"type",p.Operation);D(this,"declaration");D(this,"inputs",[]);D(this,"outputs",[]);D(this,"process",null);D(this,"successCalls",[]);D(this,"errorCalls",[]);D(this,"error",null);D(this,"calledBySuccess",[]);D(this,"calledByError",[]);D(this,"calledByEntry",[]);D(this,"parent");D(this,"errors",[]);D(this,"project");D(this,"detachedDependents",{});D(this,"knownVersions",null);D(this,"activeVersion",!1);D(this,"initialized",!1);D(this,"startedInitialization",!1);this.initialData=n,this.project=o,this.id=n.id,this.x=n.x,this.y=n.y}static new(n=null){return{id:P.UUID.uuid(),version:P.UUID.uuid(),createdAt:(n==null?void 0:n.timestamp)||L().toISOString(),author:(n==null?void 0:n.author)||P.sessionAuthor,previousVersion:null,deleted:!1,type:p.Operation,declaration:null,inputs:[],outputs:[],process:null,error:null,parent:null,calledByEntry:[],calledBySuccess:[],calledByError:[],errorCalls:[],successCalls:[],x:0,y:0}}static fromGenerationTarget(n,o){let l=o;if(n.parent){const V=Q(n.parent);l=o.get(V)}const f=Q(n.declaration),t=o.get(f),m=n.calledByEntry.map(V=>{const B=Q(V);return o.get(B)}),E=n.calledBySuccess.map(V=>{const B=Q(V);return o.get(B)}),A=n.calledByError.map(V=>{const B=Q(V);return o.get(B)}),g={id:n.id,version:P.UUID.uuid(),createdAt:L().toISOString(),author:P.sessionAuthor,previousVersion:null,deleted:!1,type:p.Operation,declaration:t,calledByEntry:m,calledBySuccess:E,calledByError:A,errorCalls:[],successCalls:[],inputs:[],outputs:[],process:null,error:null,x:0,y:0,parent:l},w=Y(g,o);return w.setParent(l,null),w.initChildren(null),w}static validateGenerationTarget(n,o){let l=JSON.parse(JSON.stringify(n));const f=[],t=Cr(l,{parent:{list:!1,types:[...br,p.Project],optional:!0}},o);l=t.modifiedData,f.push(...t.errors,...ur(l));const m=Q(l.declaration);if(m){const E=iU(m,o);f.push(...E)}else{const E=`
|
|
63
|
+
Alternatively you can update the entity with 'update' action. Or replace it by first removing it and then creating a new one.`,issue:null}))}g===p.DataType&&(!l.parentRelationType||!(l.parentRelationType===Gr.AndDataTypeGroup||l.parentRelationType===Gr.OrDataTypeGroup))&&f.push(new W({id:`${n.id}--${q.InvalidParentRelationType}`,code:q.InvalidParentRelationType,severity:S.Error,message:`The entity with id '${n.id}' and type '${n.type}', must have a 'parentRelationType' property set to either 'or-data-type-group' or 'and-data-type-group' when being added as a child to an entity of type 'data-type'.`,issue:null}))}return{errors:f,modifiedData:l}}get isGroup(){const n=[...this.andChildrenGroup||[],...this.orChildrenGroup||[]];if(n.length>1){let o=0;for(const l of n)if(l.isResolved&&(o++,o>1))return!0}return!1}get isResolved(){return[p.BuiltInBaseEntity,p.ActionDescriptor].includes(this.parent.type)||Ka(this.parent)?!0:!(!this.entity&&!this.isGroup)}validateGeneratedUpdate(n){return{errors:[],modifiedData:n}}subscribeDependents(n){return n.forEach(o=>{this.detachedDependents[o.entity.id]||(this.detachedDependents[o.entity.id]=o)}),this}unsubscribeDependents(n){return n.forEach(o=>{this.detachedDependents[o.entity.id]&&delete this.detachedDependents[o.entity.id]}),this}syncDependents(n=this.project.addChangeSet(new F(this.project,P.sessionAuthor,L().toISOString(),this,!0,"sync-dependents"))){const o=[],l=[],f=[],t=[];return Object.values(this.detachedDependents).forEach(m=>{const E=m.entity.afterAllChildrenInitialized(n);o.push(...E.updated),l.push(...E.added),f.push(...E.removed),t.push(...E.affected)}),n==null||n.attemptAutoclose("sync-dependents",this.id),{updated:R(o),added:R(l),removed:R(f),affected:R(t),self:this}}onDetachedDependencyRemoved(n,o,l){const f=[],t=[],m=[],E=[];return o==="entity"&&this.setEntity(n,l),{updated:R(f),added:R(t),removed:R(m),affected:R(E),self:this}}onDetachedDependencyRestored(n,o,l){const f=[],t=[],m=[],E=[];return o==="entity"&&this.setEntity(null,l),{updated:R(f),added:R(t),removed:R(m),affected:R(E),self:this}}unsubscribeFromDependencies(){var n,o;return(o=(n=this.entity)==null?void 0:n.unsubscribeDependents)==null||o.call(n,[{entity:this,field:"entity"}]),this}subscribeToDependencies(){var n,o;return(o=(n=this.entity)==null?void 0:n.subscribeDependents)==null||o.call(n,[{entity:this,field:"entity"}]),this}increaseVersion(n){if(n&&!L(n).isValid())throw new Error(`The shared timestamp '${n}' is not a valid ISO 8601 date string.`);return n&&L(n).isSame(L(this.createdAt))?this:(this.previousVersion=this.version,this.version=P.UUID.uuid(),this.createdAt=L(n).toISOString()||L().toISOString(),this)}captureVersion(){var o;const n=((o=this.knownVersions)==null?void 0:o.get(this.version))||new pt(this,this.project);return n.metaSync(this.toMeta(),null),this.knownVersions=this.knownVersions?this.knownVersions.set(this.version,n):new Map([[this.version,n]]),n.entity=this.entity,n.andChildrenGroup=this.andChildrenGroup?[...this.andChildrenGroup]:this.andChildrenGroup,n.orChildrenGroup=this.orChildrenGroup?[...this.orChildrenGroup]:this.orChildrenGroup,n.parent=this.parent,this}recursiveCaptureUpstreamVersions(n){const o=[],l=[],f=[],t=[];if(this.parent){this.parent.increaseVersion(n);const m=this.parent.recursiveCaptureUpstreamVersions(n);o.push(this.parent,...m.updated),l.push(...m.added),f.push(...m.removed)}return{updated:R(o),added:R(l),removed:R(f),affected:R(t),self:this}}async restoreVersion(n){var E;const o=[],l=[],f=[],t=[];if(this.version===n)return{updated:R(o),added:R(l),removed:R(f),affected:R(t),self:this};if(!this.knownVersions){const A=new Map;for(const[g,w]of this.knownVersions||new Map){if(A.set(g,w),w.activeVersion=!1,w.knownVersions)for(const[V,B]of w.knownVersions)A.set(V,B);w.knownVersions=null}}let m=(E=this.knownVersions)==null?void 0:E.get(n);if(!m){const A=await this.APILoadVersion({},n);if(!A)throw new Error(`Version with id '${n}' for entity with id '${this.id}' not found.`);m=new pt(A,this.project)}return this.metaSync(m.toShallowJSON(),null),this.previousVersion=m.previousVersion,this.version=m.version,this.createdAt=m.createdAt,this.author=m.author,this.deleted=m.deleted,this.entity=m.entity,this.andChildrenGroup=m.andChildrenGroup,this.orChildrenGroup=m.orChildrenGroup,this.parent=m.parent,{updated:R(o),added:R(l),removed:R(f),affected:R(t),self:this}}hydrateAncestors(){const n=[],o=[],l=[],f=[];if(this.initialData.parent){const t=Q(this.initialData.parent),m=this.project.get(t);if(m)this.setParent(m,null),n.push(m);else throw new Error(`${this.type} with id '${this.id}' has a 'parent' reference '${t}' that isn't found in the project`)}else throw new Error(`${this.type} with id '${this.id}' must have a 'parent'`);if(this.initialData.entity){const t=Q(this.initialData.entity),m=this.project.get(t);m&&(m.type===p.DefinitionEntity&&m.parent===this||(this.setEntity(m,null),m.type!==p.BuiltInBaseEntity&&m.type!==p.PrimitiveEntity&&n.push(m)))}return{updated:R(n),added:R(o),removed:R(l),affected:R(f),self:this}}afterAllChildrenInitialized(n=this.project.addChangeSet(new F(this.project,P.sessionAuthor,L().toISOString(),this,!0,"after-all-children-initialized"))){const o=[],l=[],f=[],t=[];return this.initialized=!0,this.captureVersion(),n==null||n.attemptAutoclose("after-all-children-initialized",this.id),{updated:R(o),added:R(l),removed:R(f),affected:R(t),self:this}}addSelfToProject(n=this.project.addChangeSet(new F(this.project,P.sessionAuthor,L().toISOString(),this,!0,"add-self-to-project"))){const o=[this],l=[],f=[],t=[];return this.parent.type===p.DataType?this.parentRelationType===Gr.AndDataTypeGroup?this.parent.addToAndGroup(this):this.parentRelationType===Gr.OrDataTypeGroup&&this.parent.addToOrGroup(this):this.parent.setDataType(this,n),o.push(this.parent),this.subscribe(),this.subscribeToDependencies(),n==null||n.attemptAutoclose("add-self-to-project",this.id),{updated:R(o),added:R(l),removed:R(f),affected:R(t),self:this}}setParent(n,o=this.project.addChangeSet(new F(this.project,P.sessionAuthor,L().toISOString(),this,!0,"set-parent"))){var l;return((l=this.parent)==null?void 0:l.id)!==(n==null?void 0:n.id)&&(this.parent=n,o&&(o==null||o.add(this,G.Updated))),o==null||o.attemptAutoclose("set-parent",this.id),this}removeChildGroup(n){if(this.andChildrenGroup){const o=this.andChildrenGroup.findIndex(l=>l.id===n.id);o!==-1&&this.andChildrenGroup.splice(o,1)}if(this.orChildrenGroup){const o=this.orChildrenGroup.findIndex(l=>l.id===n.id);o!==-1&&this.orChildrenGroup.splice(o,1)}return this}initChildren(n=this.project.addChangeSet(new F(this.project,P.sessionAuthor,L().toISOString(),this,!0,"init-children"))){var o,l,f,t;if(this.initialized||this.startedInitialization)return this;if(this.startedInitialization=!0,this.initialData.entity)if(this.initialData.entity.type===p.GenericReference){const m=this.project.findSubscribedInstanceFromReference(this.initialData.entity);this.entity=m}else this.entity=Y(this.initialData.entity,this.project),((l=(o=this.initialData.entity)==null?void 0:o.parent)==null?void 0:l.id)===this.id&&this.entity.setParent(this,null),(t=(f=this.entity).initChildren)==null||t.call(f,n);return this.initialData.andChildrenGroup&&(this.andChildrenGroup=this.initialData.andChildrenGroup.map(m=>{const E=Y(m,this.project);return E.setParent(this,null),E.initChildren(n),E})),this.initialData.orChildrenGroup&&(this.orChildrenGroup=this.initialData.orChildrenGroup.map(m=>{const E=Y(m,this.project);return E.setParent(this,null),E.initChildren(n),E})),this.subscribeToDependencies(),this.afterAllChildrenInitialized(n),n==null||n.attemptAutoclose("init-children",this.id),this}subscribe(){return this.activeVersion=!0,this.project.subscribeInstance(this),this}unsubscribe(){return this.project.unsubscribeInstance(this),this}metaSync(n,o=this.project.addChangeSet(new F(this.project,P.sessionAuthor,L().toISOString(),this,!0,"meta-sync"))){const l=cr(this,n),f=this.toMeta();return this.options=n.options||f.options,this.parentRelationType=n.parentRelationType||f.parentRelationType,this.isList=n.isList!==void 0?n.isList:f.isList,this.inferred=n.inferred!==void 0?n.inferred:f.inferred,this.like=n.like!==void 0?n.like:f.like,this.asType=n.asType!==void 0?n.asType:f.asType,this.implementationChooseOne=n.implementationChooseOne!==void 0?n.implementationChooseOne:f.implementationChooseOne,this.staticEntities=n.staticEntities!==void 0?n.staticEntities:f.staticEntities,this.interactiveEntities=n.interactiveEntities!==void 0?n.interactiveEntities:f.interactiveEntities,this.actionEntities=n.actionEntities!==void 0?n.actionEntities:f.actionEntities,super.metaSync(n),n.deleted===!0&&!f.deleted?o==null||o.add(this,G.Removed):n.deleted===!1&&f.deleted?o==null||o.add(this,G.Added):l&&(o==null||o.add(this,G.Updated)),o==null||o.attemptAutoclose("meta-sync",this.id),this}async APILoad(n=oe,...o){return await pt.repository.APILoad(this.id,...o),this}async APICreate(n=oe,...o){return await pt.repository.APICreate(this.toShallowJSON(),...o),this}async APIUpdate(n=oe,...o){return await pt.repository.APIUpdate(this.toShallowJSON(),...o),this}async APIDelete(n=oe,...o){return await pt.repository.APIDelete(this.toShallowJSON(),...o),this}async APIClone(n=oe,...o){return await pt.repository.APIClone(this.id,...o),this}async APILoadVersion(n=oe,o,...l){return await pt.repository.APILoadVersion(this.id,o,...l)}remove({ignoreUpstream:n}={ignoreUpstream:!1},o=this.project.addChangeSet(new F(this.project,P.sessionAuthor,L().toISOString(),this,!0,"remove-entity"))){var E;const l=[],f=[],t=[],m=[];if(o!=null&&o.hasRemoved(this.id))return o==null||o.attemptAutoclose("remove-entity",this.id),{added:[],updated:[],removed:[],affected:[],self:this};if(f.push(this),this.unsubscribe(),this.unsubscribeFromDependencies(),this.project.subscribeDeletedInstance(this),this.metaSync({deleted:!0},o),Object.values(this.detachedDependents).forEach(A=>{const{updated:g,removed:w,added:V}=A.entity.onDetachedDependencyRemoved(this,A.field,o);l.push(...g),f.push(...w),t.push(...V)}),this.entity&&this.entity.type===p.DefinitionEntity&&this.entity.parent===this){const{updated:A,removed:g}=this.entity.remove({ignoreUpstream:!0},o);l.push(...A),f.push(...g)}if(!n){((E=this.parent)==null?void 0:E.type)===p.DataType&&this.parent.removeChildGroup(this);const A=this.parent;if((A==null?void 0:A.type)===p.DataType){if(this.parentRelationType===Gr.AndDataTypeGroup){if(Array.isArray(A.andChildrenGroup)){const g=A.andChildrenGroup.findIndex(w=>w.id===this.id);g!==-1&&A.andChildrenGroup.splice(g,1)}}else if(this.parentRelationType===Gr.OrDataTypeGroup&&Array.isArray(A.orChildrenGroup)){const g=A.orChildrenGroup.findIndex(w=>w.id===this.id);g!==-1&&A.orChildrenGroup.splice(g,1)}}else{const g=this.parent;g==null||g.removeDataType()}A&&l.push(A)}return o==null||o.attemptAutoclose("remove-entity",this.id),{added:R(t),updated:R(l),removed:R(f),affected:R(m),self:this}}restore({}={},n=this.project.addChangeSet(new F(this.project,P.sessionAuthor,L().toISOString(),this,!0,"restore-entity"))){const o=[],l=[],f=[],t=[];if(n!=null&&n.hasAdded(this.id))return n==null||n.attemptAutoclose("restore-entity",this.id),{added:[],updated:[],removed:[],affected:[],self:this};if(this.subscribe(),this.project.unsubscribeDeletedInstance(this),this.metaSync({deleted:!1},n),Object.values(this.detachedDependents).forEach(m=>{const{updated:E,removed:A,added:g}=m.entity.onDetachedDependencyRestored(this,m.field,n);l.push(...E),f.push(...A),o.push(...g)}),this.entity&&this.entity.type===p.DefinitionEntity&&this.entity.parent===this){const{updated:m}=this.entity.restore({},n);l.push(...m)}if(this.parent.type===p.DataType){const m=this.parent;Array.isArray(m.andChildrenGroup)&&m.andChildrenGroup.push(this)}if(this.parent.type===p.DataType){const m=this.parent;this.parentRelationType===Gr.AndDataTypeGroup?Array.isArray(m.andChildrenGroup)&&m.andChildrenGroup.push(this):this.parentRelationType===Gr.OrDataTypeGroup&&Array.isArray(m.orChildrenGroup)&&m.orChildrenGroup.push(this)}else{const m=this.parent;m.setDataType(this,n),l.push(m)}return n==null||n.attemptAutoclose("restore-entity",this.id),{added:R(o),updated:R(l),removed:R(f),affected:R(t),self:this}}toFlat(n=new Set){var l,f,t;return n.has(this.id)?[]:(n.add(this.id),[this,...((l=this.andChildrenGroup)==null?void 0:l.flatMap(m=>m.toFlat(n)))||[],...((f=this.orChildrenGroup)==null?void 0:f.flatMap(m=>m.toFlat(n)))||[],...((t=this.entity)==null?void 0:t.toFlat(n))||[]])}toFlatIds(n=new Set){var l,f,t;return n.has(this.id)?[]:(n.add(this.id),[this.id,...((l=this.andChildrenGroup)==null?void 0:l.flatMap(m=>m.toFlatIds(n)))||[],...((f=this.orChildrenGroup)==null?void 0:f.flatMap(m=>m.toFlatIds(n)))||[],...((t=this.entity)==null?void 0:t.toFlatIds(n))||[]])}toMeta(){return{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,like:this.like,isList:this.isList,inferred:this.inferred,parentRelationType:this.parentRelationType,implementationChooseOne:this.implementationChooseOne,staticEntities:this.staticEntities,interactiveEntities:this.interactiveEntities,actionEntities:this.actionEntities,options:this.options,asType:this.asType,type:this.type}}toJSON(n=new Set){var o,l,f,t;return n.has(this.id)?this.toReference():(n.add(this.id),{id:this.id,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,options:this.options,isList:this.isList,asType:this.asType,like:this.like,inferred:this.inferred,parentRelationType:this.parentRelationType,implementationChooseOne:this.implementationChooseOne,staticEntities:this.staticEntities,interactiveEntities:this.interactiveEntities,actionEntities:this.actionEntities,andChildrenGroup:((o=this.andChildrenGroup)==null?void 0:o.map(m=>m.toJSON(n)))||null,orChildrenGroup:((l=this.orChildrenGroup)==null?void 0:l.map(m=>m.toJSON(n)))||null,entity:((f=this.entity)==null?void 0:f.parent)===this?this.entity.toJSON(n):((t=this.entity)==null?void 0:t.toReference())||null,parent:this.parent.toReference()})}toJSONClone(n=$e){var l,f,t,m,E,A,g,w,V;let o;return(l=n.seenEntityMaps)!=null&&l.has(this.id)?o=n.seenEntityMaps.get(this.id):(o=n.newId||hr(this,this.project,n.uuidStrategy),n.seenEntityMaps&&n.seenEntityMaps.set(this.id,o)),(f=n.seenEntities)!=null&&f.has(o)||(t=n.seenEntities)!=null&&t.has(this.id)?this.toReference({seenEntityMaps:n.seenEntityMaps}):((m=n.seenEntities)==null||m.add(o),(E=n.seenEntities)==null||E.add(this.id),{id:o,version:P.UUID.uuid(),createdAt:n.timestamp||L().toISOString(),previousVersion:null,author:this.author,deleted:this.deleted,type:this.type,options:this.options,isList:this.isList,asType:this.asType,like:this.like,inferred:this.inferred,parentRelationType:this.parentRelationType,implementationChooseOne:this.implementationChooseOne,staticEntities:this.staticEntities,interactiveEntities:this.interactiveEntities,actionEntities:this.actionEntities,andChildrenGroup:((A=this.andChildrenGroup)==null?void 0:A.map(B=>B.toJSONClone({...n,newId:null})))||null,orChildrenGroup:((g=this.orChildrenGroup)==null?void 0:g.map(B=>B.toJSONClone({...n,newId:null})))||null,entity:((w=this.entity)==null?void 0:w.parent)===this?this.entity.toJSONClone({...n,newId:null}):((V=this.entity)==null?void 0:V.toReference({seenEntityMaps:n.seenEntityMaps}))||null,parent:this.parent.toReference({seenEntityMaps:n.seenEntityMaps})})}toReference(n=$e){var l;let o=this.id;return(l=n.seenEntityMaps)!=null&&l.has(this.id)&&(o=n.seenEntityMaps.get(this.id)),{id:o+"--"+P.UUID.uuid()+"--ref",type:p.GenericReference,entityId:o,version:this.version,entityType:this.type}}toShallowJSON(n=$e){var l,f,t,m;let o=this.id;return(l=n.seenEntityMaps)!=null&&l.has(this.id)&&(o=n.seenEntityMaps.get(this.id)),{id:o,version:this.version,createdAt:this.createdAt,previousVersion:this.previousVersion,author:this.author,deleted:this.deleted,type:this.type,isList:this.isList,options:this.options,asType:this.asType,parentRelationType:this.parentRelationType,like:this.like,inferred:this.inferred,implementationChooseOne:this.implementationChooseOne,staticEntities:this.staticEntities,interactiveEntities:this.interactiveEntities,actionEntities:this.actionEntities,andChildrenGroup:((f=this.andChildrenGroup)==null?void 0:f.map(E=>E.toReference(n)))||null,orChildrenGroup:((t=this.orChildrenGroup)==null?void 0:t.map(E=>E.toReference(n)))||null,entity:((m=this.entity)==null?void 0:m.toReference(n))||null,parent:this.parent.toReference(n)}}toFlatJSON(n=new Set){var l,f,t;return n.has(this.id)?[]:(n.add(this.id),[this.toShallowJSON(),...((l=this.andChildrenGroup)==null?void 0:l.flatMap(m=>m.toFlatJSON(n)))||[],...((f=this.orChildrenGroup)==null?void 0:f.flatMap(m=>m.toFlatJSON(n)))||[],...((t=this.entity)==null?void 0:t.toFlatJSON(n))||[]])}toGenerationTarget(){var n;return{id:this.id,type:this.type,options:this.options||void 0,isList:this.isList,like:this.like,parentRelationType:this.parentRelationType||void 0,asType:this.asType,entity:((n=this.entity)==null?void 0:n.id)||null,parent:this.parent.id}}toFlatGenerationTarget(n=new Set){var l,f;return n.has(this.id)?[]:(n.add(this.id),[this.toGenerationTarget(),...((l=this.andChildrenGroup)==null?void 0:l.flatMap(t=>t.toFlatGenerationTarget(n)))||[],...((f=this.orChildrenGroup)==null?void 0:f.flatMap(t=>t.toFlatGenerationTarget(n)))||[],...this.entity&&this.entity.type==p.DefinitionEntity&&this.entity.parent===this&&this.entity.toFlatGenerationTarget(n)||[]])}clearErrors(){var n,o,l,f;return this.errors=[],(n=this.andChildrenGroup)==null||n.forEach(t=>t.clearErrors()),(o=this.orChildrenGroup)==null||o.forEach(t=>t.clearErrors()),this.inferred&&this.entity&&this.entity.type===p.DefinitionEntity&&((l=this.entity)==null?void 0:l.parent)===this&&((f=this.entity)==null||f.clearErrors()),this}validate(){const n=sM(this);return this.errors=n,{success:!0,error:null,data:this.toJSON()}}getErrors(){return[...this.errors]}getShallowErrors(){return this.errors}clone(n=this.project.addChangeSet(new F(this.project,P.sessionAuthor,L().toISOString(),this,!0,"clone-entity")),o=null,l=null,f=!0){var B,K,k;let t=yr(o,this),m=o||this.parent;const A={id:l||P.UUID.uuid(),version:P.UUID.uuid(),createdAt:(n==null?void 0:n.timestamp)||L().toISOString(),author:(n==null?void 0:n.author)||"1",previousVersion:null,deleted:!1,type:p.DataType,isList:this.isList,asType:this.asType,options:this.options,parentRelationType:this.parentRelationType,staticEntities:this.staticEntities,interactiveEntities:this.interactiveEntities,actionEntities:this.actionEntities,like:this.like,inferred:this.inferred,implementationChooseOne:this.implementationChooseOne,andChildrenGroup:null,orChildrenGroup:null,entity:null,parent:m.toReference()},g=er(A,t);o&&g.setParent(o,null),f&&g.subscribe(),g.initChildren(n),n==null||n.add(g,G.Added);const w=(B=this.andChildrenGroup)==null?void 0:B.map(Z=>Z.clone(n,g,P.UUID.uuid(),f)),V=(K=this.orChildrenGroup)==null?void 0:K.map(Z=>Z.clone(n,g,P.UUID.uuid(),f));if(g.andChildrenGroup=w||null,g.orChildrenGroup=V||null,this.entity&&this.entity.type===p.DefinitionEntity&&((k=this.entity)==null?void 0:k.parent)===this){const Z=this.entity.clone(n,g,P.UUID.uuid(),f);g.setEntity(Z,n)}else this.entity&&g.setEntity(this.entity,n);return n==null||n.attemptAutoclose("clone-entity",this.id),g}merge(n,o=this.project.addChangeSet(new F(this.project,P.sessionAuthor,L().toISOString(),this,!0,"merge-entity"))){const l=[],f=[],t=[],m=[];if(this.asType!==(n==null?void 0:n.asType)&&(this.metaSync({asType:n==null?void 0:n.asType},o),o==null||o.add(this,G.Updated),l.push(this)),this.isList!==(n==null?void 0:n.isList)&&(this.metaSync({isList:n==null?void 0:n.isList},o),o==null||o.add(this,G.Updated),l.push(this)),this.like!==(n==null?void 0:n.like)&&(this.metaSync({like:n==null?void 0:n.like},o),o==null||o.add(this,G.Updated),l.push(this)),n!=null&&n.inferred){if(n.entity&&n.entity.type===p.DefinitionEntity&&n.entity.parent===n){const E=n.entity.clone(o,this,P.UUID.uuid(),!0);this.setEntity(E,o),f.push(E)}else n.entity&&(this.setEntity(n.entity,o),o==null||o.add(this,G.Updated),l.push(this));this.inferred||(this.metaSync({inferred:!0},o),o==null||o.add(this,G.Updated),l.push(this))}else if(this.inferred){if(this.metaSync({inferred:!1},o),o==null||o.add(this,G.Updated),l.push(this),this.entity&&this.entity.type===p.DefinitionEntity&&this.entity.parent===this){const{updated:E,removed:A}=this.entity.remove({ignoreUpstream:!0},o);t.push(...A),E.push(...E)}n.entity!==this.entity&&(this.setEntity(n.entity,o),o==null||o.add(this,G.Updated),l.push(this))}else n.entity!==this.entity&&(this.setEntity(n.entity,o),o==null||o.add(this,G.Updated),l.push(this));return o==null||o.attemptAutoclose("merge-entity",this.id),{updated:R(l),added:R(f),removed:R(t),affected:R(m),self:this}}addToAndGroup(n){return this.andChildrenGroup||(this.andChildrenGroup=[]),this.andChildrenGroup.includes(n)||this.andChildrenGroup.push(n),this}addToOrGroup(n){return this.orChildrenGroup||(this.orChildrenGroup=[]),this.orChildrenGroup.includes(n)||this.orChildrenGroup.push(n),this}setEntity(n,o=this.project.addChangeSet(new F(this.project,P.sessionAuthor,L().toISOString(),this,!0,"set-data-type-entity-value"))){var f;const l=this.entity;return(l==null?void 0:l.id)!==(n==null?void 0:n.id)&&(this.entity=n,o==null||o.add(this,G.Affected),l&&l.type===p.DefinitionEntity&&((f=l.parent)==null?void 0:f.id)===this.id&&(l==null||l.remove({ignoreUpstream:!0},o))),o==null||o.attemptAutoclose("set-data-type-entity-value",this.id),this}isObject(){return!!this.entity&&(this.entity.type===p.DefinitionEntity||this.entity.type===p.BuiltInBaseEntity||this.entity.name===re.KeyValue)&&!this.isList}canBeObject(){let n=!1;if(this.parent.type!==p.DataType){const o=this.project.requestActiveValue(this.parent);o?!o.valueAsType&&(o.value===""||o.value===null||js(o))&&(n=!0):n=!0}return(this.isObject()||!this.entity||this.entity.name===re.Untyped)&&n}hasStrictObjectStructure(){var n;return this.isObject()&&((n=this.entity)==null?void 0:n.type)===p.DefinitionEntity}isInlineDeclaredEntity(){var n,o;return((n=this.entity)==null?void 0:n.type)===p.DefinitionEntity&&((o=this.entity.parent)==null?void 0:o.id)===(this==null?void 0:this.id)}canModifyObjectStructure(){var n;return this.isInlineDeclaredEntity()||this.canBeObject()||((n=this.entity)==null?void 0:n.name)===re.KeyValue}inferFromInputs(n,o=this.project.addChangeSet(new F(this.project,P.sessionAuthor,L().toISOString(),this,!0,"infer-data-type-from-inputs"))){var E;const l=[],f=[],t=[],m=[];if(!this.inferred)return o==null||o.attemptAutoclose("infer-data-type-from-inputs",this.id),{updated:[],added:[],removed:[],affected:[],self:this};if(!this.entity&&n.length){const A=ce(this.parent,this.project)+" data type definition",g={id:P.UUID.uuid(),type:p.DefinitionEntity,version:P.UUID.uuid(),createdAt:(o==null?void 0:o.timestamp)||L().toISOString(),author:P.sessionAuthor,previousVersion:null,deleted:!1,name:A,description:((E=this.parent)==null?void 0:E.description)||null,static:!0,abstract:!1,properties:[],methods:[],extends:[],implements:[],abstractMethods:[],x:0,y:0,parent:this.toReference()},w=Y(g,this.project);w.setParent(this,o),w.initChildren(o),o==null||o.add(w,G.Added),w.metaSync(g,o),this.setEntity(w,o),o==null||o.add(this,G.Updated)}if(this.entity&&this.entity.type===p.DefinitionEntity&&this.entity.parent!==this&&this.entity.setParent(this,o),this.entity){const{updated:A,added:g,removed:w,affected:V}=this.entity.inferFromInputs(n,o);f.push(...A),l.push(...g),t.push(...w),m.push(...V)}return this.like||this.metaSync({like:!0},o),o==null||o.attemptAutoclose("infer-data-type-from-inputs",this.id),{updated:R(f),added:R(l),removed:R(t),affected:R(m),self:this}}};D(pt,"repository",{APICreate:async(n,...o)=>n,APIUpdate:async(n,...o)=>n,APIDelete:async(n,...o)=>n,APIClone:async(n,...o)=>{},APILoad:async(n,...o)=>null,APILoadVersion:async(n,o,...l)=>null}),D(pt,"type",p.DataType),D(pt,"USER_MANAGED_PARENT_TYPES",[p.Property,p.ArgumentDeclaration,p.ReturnDeclaration,p.VariableDeclaration,p.ValueDescriptor,p.InputMap,p.OutputMap,p.DataType]),D(pt,"PARENT_TYPES",[...pt.USER_MANAGED_PARENT_TYPES]),D(pt,"MUTABLE_BASE_PROPERTIES",["isList","asType","options","parentRelationType","like","implementationChooseOne","staticEntities","interactiveEntities","actionEntities"]),D(pt,"INMUTABLE_BASE_PROPERTIES",["id","type","version","createdAt","author","previousVersion"]),D(pt,"BASE_PROPERTIES",[...pt.MUTABLE_BASE_PROPERTIES,...pt.INMUTABLE_BASE_PROPERTIES]),D(pt,"MUTABLE_META_PROPERTIES",[...pt.MUTABLE_BASE_PROPERTIES,"inferred"]),D(pt,"INMUTABLE_META_PROPERTIES",[...pt.INMUTABLE_BASE_PROPERTIES]),D(pt,"META_PROPERTIES",[...pt.MUTABLE_META_PROPERTIES,...pt.INMUTABLE_META_PROPERTIES]),D(pt,"MUTABLE_UPSTREAM_PROPERTIES",["entity","parent"]),D(pt,"INMUTABLE_UPSTREAM_PROPERTIES",[]),D(pt,"UPSTREAM_PROPERTIES",[...pt.MUTABLE_UPSTREAM_PROPERTIES,...pt.INMUTABLE_UPSTREAM_PROPERTIES]),D(pt,"MUTABLE_DOWNSTREAM_PROPERTIES",[]),D(pt,"INMUTABLE_DOWNSTREAM_PROPERTIES",["andChildrenGroup","orChildrenGroup"]),D(pt,"DOWNSTREAM_PROPERTIES",[...pt.MUTABLE_DOWNSTREAM_PROPERTIES,...pt.INMUTABLE_DOWNSTREAM_PROPERTIES]),D(pt,"PROPERTIES",[...pt.META_PROPERTIES,...pt.UPSTREAM_PROPERTIES,...pt.DOWNSTREAM_PROPERTIES]);let ts=pt;function nM(u){var m;const d=Cle(),n=u.toJSON();d.safeParse(n).success;const l=ope(u),f=ta(u),t=[...l,...f];if(u.id==="exec-sequentially-operation-call-id"){const E=Qe({id:`${u.id}--${he.PropertyImplementsNonAbstact}`,message:`Property "${ce(u,u.project)}" with id "${u.id}" implements a non-abstract property "${ce(u,u.project)}" with id "${u.id}".`,issue:null,severity:S.Error,code:he.PropertyImplementsNonAbstact,entity:u});t.push(E.error)}return u.outputs.forEach(E=>E.validate()),(m=u.error)==null||m.validate(),qt(u.errors,t)}function ope(u){const d=[];return u.inputs.forEach(n=>{n.validate()}),qt(u.errors,d)}const lpe=Object.freeze(Object.defineProperty({__proto__:null,validate:nM},Symbol.toStringTag,{value:"Module"}));var aM=(u=>(u.Parent="parent",u))(aM||{});const ft=class ft extends ar{constructor(n,o){super(n);D(this,"initialData");D(this,"id");D(this,"x");D(this,"y");D(this,"type",p.Operation);D(this,"declaration");D(this,"inputs",[]);D(this,"outputs",[]);D(this,"process",null);D(this,"successCalls",[]);D(this,"errorCalls",[]);D(this,"error",null);D(this,"calledBySuccess",[]);D(this,"calledByError",[]);D(this,"calledByEntry",[]);D(this,"parent");D(this,"errors",[]);D(this,"project");D(this,"detachedDependents",{});D(this,"knownVersions",null);D(this,"activeVersion",!1);D(this,"initialized",!1);D(this,"startedInitialization",!1);this.initialData=n,this.project=o,this.id=n.id,this.x=n.x,this.y=n.y}static new(n=null){return{id:P.UUID.uuid(),version:P.UUID.uuid(),createdAt:(n==null?void 0:n.timestamp)||L().toISOString(),author:(n==null?void 0:n.author)||P.sessionAuthor,previousVersion:null,deleted:!1,type:p.Operation,declaration:null,inputs:[],outputs:[],process:null,error:null,parent:null,calledByEntry:[],calledBySuccess:[],calledByError:[],errorCalls:[],successCalls:[],x:0,y:0}}static fromGenerationTarget(n,o){let l=o;if(n.parent){const V=Q(n.parent);l=o.get(V)}const f=Q(n.declaration),t=o.get(f),m=n.calledByEntry.map(V=>{const B=Q(V);return o.get(B)}),E=n.calledBySuccess.map(V=>{const B=Q(V);return o.get(B)}),A=n.calledByError.map(V=>{const B=Q(V);return o.get(B)}),g={id:n.id,version:P.UUID.uuid(),createdAt:L().toISOString(),author:P.sessionAuthor,previousVersion:null,deleted:!1,type:p.Operation,declaration:t,calledByEntry:m,calledBySuccess:E,calledByError:A,errorCalls:[],successCalls:[],inputs:[],outputs:[],process:null,error:null,x:0,y:0,parent:l},w=Y(g,o);return w.setParent(l,null),w.initChildren(null),w}static validateGenerationTarget(n,o){let l=JSON.parse(JSON.stringify(n));const f=[],t=Cr(l,{parent:{list:!1,types:[...br,p.Project],optional:!0}},o);l=t.modifiedData,f.push(...t.errors,...ur(l));const m=Q(l.declaration);if(m){const E=iU(m,o);f.push(...E)}else{const E=`
|
|
64
64
|
All built-in 'action-descriptor' entity ids are:
|
|
65
65
|
- ${o.operationDeclarations.map(A=>`${A.id} (${ce(A,o)})`).join(`
|
|
66
66
|
- `)}.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elyx-code/project-logic-tree",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6303",
|
|
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",
|