@elyx-code/project-logic-tree 0.0.6123 → 0.0.6125

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.js CHANGED
@@ -23770,9 +23770,9 @@ function b5(r) {
23770
23770
  return "Entity";
23771
23771
  }
23772
23772
  function Mq(r) {
23773
- const e = TT(r);
23773
+ const e = ET(r);
23774
23774
  if (!e) {
23775
- const t = mT(r);
23775
+ const t = TT(r);
23776
23776
  return t.includes(j.HTTP_ENDPOINT) ? "HTTP endpoint" : t.includes(j.PERSISTED_ENTITY) ? "Persisted entity" : t.includes(j.CRON_JOB) ? "Scheduled execution" : t.includes(j.RELATIONAL_DATABASE) ? "Relational database" : C(r, r.project) + " entity";
23777
23777
  }
23778
23778
  return C(e, r.project) + " entity";
@@ -24217,7 +24217,7 @@ function Qm(r, e) {
24217
24217
  })
24218
24218
  );
24219
24219
  else {
24220
- const o = yT(
24220
+ const o = hT(
24221
24221
  a
24222
24222
  ).filter(
24223
24223
  (l) => l.name === r.name
@@ -35076,7 +35076,7 @@ This variable's data-type has an 'entity' field that references an entity with i
35076
35076
  }).error
35077
35077
  );
35078
35078
  else {
35079
- const a = ET(n), s = [];
35079
+ const a = vT(n), s = [];
35080
35080
  [
35081
35081
  i.DefinitionEntity,
35082
35082
  i.BuiltInBaseEntity,
@@ -35258,7 +35258,7 @@ This variable's data-type has an 'entity' field that references an entity with i
35258
35258
  })
35259
35259
  );
35260
35260
  else {
35261
- const y = ET(
35261
+ const y = vT(
35262
35262
  c
35263
35263
  );
35264
35264
  let h = "";
@@ -36317,7 +36317,7 @@ The entity of the data-type has the following properties that can be reads as in
36317
36317
  } else if (qe.filter(
36318
36318
  (y) => $e.includes(y)
36319
36319
  ).includes(o.type)) {
36320
- const h = yT(o), E = h.find(
36320
+ const h = hT(o), E = h.find(
36321
36321
  (g) => g.id === n.declaration
36322
36322
  ), R = `The parent entity has the following argument declarations that can be referenced by input-maps, ids: '${k(
36323
36323
  h.map((g) => g.id),
@@ -36855,7 +36855,7 @@ const Te = class Te {
36855
36855
  (u) => u !== i.Condition
36856
36856
  ).includes(o.type)) {
36857
36857
  const u = o.outputs.find(
36858
- (c) => c.declaration.id === D(n.declaration)
36858
+ (c) => c.declaration.id === (n.declaration ? D(n.declaration) : null)
36859
36859
  );
36860
36860
  if (u)
36861
36861
  a.push(
@@ -36870,7 +36870,7 @@ You can't edit output-map entities as they need to match their return declaratio
36870
36870
  })
36871
36871
  );
36872
36872
  else {
36873
- const c = t.get(n.declaration);
36873
+ const c = n.declaration ? t.get(n.declaration) : null;
36874
36874
  if (c && $e.includes(o.type)) {
36875
36875
  const y = $r(o), h = y.dataType, E = (l = y.dataType) == null ? void 0 : l.entity;
36876
36876
  h ? E ? E.type === i.ActionDescriptor ? a.push(
@@ -37175,7 +37175,7 @@ This is likely an incorrect strategy, either the '${this.type}' entity doesn't n
37175
37175
  };
37176
37176
  }
37177
37177
  toShallowJSON(e = N) {
37178
- var n, a;
37178
+ var n, a, s;
37179
37179
  let t = this.id;
37180
37180
  return (n = e.seenEntityMaps) != null && n.has(this.id) && (t = e.seenEntityMaps.get(this.id)), {
37181
37181
  id: t,
@@ -37184,9 +37184,9 @@ This is likely an incorrect strategy, either the '${this.type}' entity doesn't n
37184
37184
  index: this.index,
37185
37185
  parentRelationType: this.parentRelationType,
37186
37186
  defaultValue: ((a = this.defaultValue) == null ? void 0 : a.toReference(e)) || null,
37187
- declaration: this.declaration.toReference(e),
37187
+ declaration: (s = this.declaration) == null ? void 0 : s.toReference(e),
37188
37188
  writesValues: this.writesValues.map(
37189
- (s) => s.toReference(e)
37189
+ (o) => o.toReference(e)
37190
37190
  ),
37191
37191
  parent: this.parent.toReference(e)
37192
37192
  };
@@ -37200,10 +37200,11 @@ This is likely an incorrect strategy, either the '${this.type}' entity doesn't n
37200
37200
  ]);
37201
37201
  }
37202
37202
  toGenerationTarget() {
37203
+ var e;
37203
37204
  return {
37204
37205
  id: this.id,
37205
37206
  type: this.type,
37206
- declaration: this.declaration.id,
37207
+ declaration: ((e = this.declaration) == null ? void 0 : e.id) || null,
37207
37208
  parent: this.parent.id
37208
37209
  };
37209
37210
  }
@@ -44686,6 +44687,121 @@ d(Ae, "MUTABLE_DOWNSTREAM_PROPERTIES", [
44686
44687
  ...Ae.DOWNSTREAM_PROPERTIES
44687
44688
  ]);
44688
44689
  let ii = Ae;
44690
+ function au(r) {
44691
+ return r && typeof r.then == "function";
44692
+ }
44693
+ class oT {
44694
+ constructor(e) {
44695
+ d(this, "order", []);
44696
+ d(this, "flatRecord", {});
44697
+ d(this, "onGoingVisits", {});
44698
+ this.flatten(e), this.orderEntities();
44699
+ }
44700
+ flatten(e) {
44701
+ const t = new Set(yT()), n = f(
44702
+ P(e, t, {
44703
+ ignoreBuiltInBaseEntities: !0
44704
+ })
44705
+ ), a = /* @__PURE__ */ new Set();
44706
+ for (const s of n)
44707
+ this.flatRecord[s.id] = s, a.add(s.id);
44708
+ this.order = Array.from(a);
44709
+ }
44710
+ moveEntityAfterDependencies(e) {
44711
+ const t = _o(e, this.flatRecord);
44712
+ for (const n of t) {
44713
+ const a = this.order.indexOf(n), s = this.order.indexOf(e.id);
44714
+ if (a > s)
44715
+ return this.order.splice(s, 1), this.order.splice(a, 0, e.id), !0;
44716
+ }
44717
+ return !1;
44718
+ }
44719
+ orderEntities() {
44720
+ let e = !1;
44721
+ for (let t = 0; t < this.order.length; t++) {
44722
+ const n = this.order[t], a = this.flatRecord[n];
44723
+ if (this.moveEntityAfterDependencies(a)) {
44724
+ e = !0;
44725
+ break;
44726
+ }
44727
+ }
44728
+ e && this.orderEntities();
44729
+ }
44730
+ getUpstreamOngoingDependenciesVisits(e, t) {
44731
+ const n = _o(
44732
+ this.flatRecord[e],
44733
+ this.flatRecord
44734
+ ), a = {};
44735
+ return Object.entries(this.onGoingVisits[t] || {}).forEach(
44736
+ ([s, o]) => {
44737
+ Array.from(n).includes(s) && (a[s] = o);
44738
+ }
44739
+ ), a;
44740
+ }
44741
+ // For the reverse visit, the relevant dependencies are downstream dependencies.
44742
+ // So a given entity would have to wait for downstream dependencies to finish before it can be visited.
44743
+ // Instead of getting the upstream dependency of the entity that we will execute next ('entityId'),
44744
+ // we get the upstream dependencies of all ongoing visits and check if the entity we are about to visit is among them.
44745
+ getDownstreamOngoingDependenciesVisits(e, t) {
44746
+ const n = Object.keys(this.onGoingVisits[t] || {}), a = new Set(
44747
+ n.flatMap(
44748
+ (o) => Array.from(
44749
+ _o(this.flatRecord[o], this.flatRecord)
44750
+ )
44751
+ )
44752
+ ), s = {};
44753
+ return Array.from(a).forEach((o) => {
44754
+ o === e && (s[o] = this.onGoingVisits[t][o]);
44755
+ }), s;
44756
+ }
44757
+ // Awaits and clears the promises for the given entities
44758
+ async settlePromises(e, t) {
44759
+ const n = Object.values(e);
44760
+ n.length && await Promise.all(n), Object.keys(e).forEach((a) => {
44761
+ delete this.onGoingVisits[t][a];
44762
+ });
44763
+ }
44764
+ visit(e) {
44765
+ const t = this.order;
44766
+ for (const n of t)
44767
+ e(this.flatRecord[n]);
44768
+ return this;
44769
+ }
44770
+ reverseVisit(e) {
44771
+ const t = this.order.slice().reverse();
44772
+ for (const n of t)
44773
+ e(this.flatRecord[n]);
44774
+ return this;
44775
+ }
44776
+ async visitAsync(e) {
44777
+ const t = this.order, n = Math.random().toString(36).substring(7);
44778
+ this.onGoingVisits[n] = {};
44779
+ for (const a of t) {
44780
+ const s = this.getUpstreamOngoingDependenciesVisits(
44781
+ a,
44782
+ n
44783
+ );
44784
+ Object.keys(s).length && await this.settlePromises(s, n);
44785
+ const o = e(this.flatRecord[a]);
44786
+ au(o) && (this.onGoingVisits[n][a] = o);
44787
+ }
44788
+ return await this.settlePromises(this.onGoingVisits[n], n), this.onGoingVisits[n] = {}, this;
44789
+ }
44790
+ async reverseVisitAsync(e) {
44791
+ const t = this.order.slice().reverse(), n = Math.random().toString(36).substring(7);
44792
+ this.onGoingVisits[n] = {};
44793
+ for (const a of t) {
44794
+ const s = this.getDownstreamOngoingDependenciesVisits(
44795
+ a,
44796
+ n
44797
+ );
44798
+ Object.keys(s).length && await this.settlePromises(s, n);
44799
+ const o = e(this.flatRecord[a]);
44800
+ au(o) && (this.onGoingVisits[n][a] = o);
44801
+ }
44802
+ return await this.settlePromises(this.onGoingVisits[n], n), this.onGoingVisits[n] = {}, this;
44803
+ }
44804
+ }
44689
44805
  function h2(r) {
44690
44806
  var e;
44691
44807
  switch (r.id) {
@@ -44883,7 +44999,7 @@ function Dc(r, e, t) {
44883
44999
  }
44884
45000
  };
44885
45001
  }
44886
- function oT(r, e) {
45002
+ function lT(r, e) {
44887
45003
  return e.entities.find((a) => {
44888
45004
  const s = a.properties, o = s.map((h) => h.name), l = r.every((h) => o.includes(h)), u = o.filter((h) => !r.includes(h)), c = s.every(
44889
45005
  (h) => !u.includes(h.name) || !h.required
@@ -44916,7 +45032,7 @@ function m2(r, e, t = et.OrDataTypeGroup) {
44916
45032
  self: u
44917
45033
  };
44918
45034
  }
44919
- function lT(r, e, t, n) {
45035
+ function dT(r, e, t, n) {
44920
45036
  const a = [], s = [], o = [];
44921
45037
  switch (typeof r) {
44922
45038
  case "string":
@@ -45067,7 +45183,7 @@ function lT(r, e, t, n) {
45067
45183
  } else
45068
45184
  R.length === 1 && !E ? e.setEntity(R[0]) : c.forEach((g, I) => {
45069
45185
  if (typeof g == "object" && !Array.isArray(g) && g !== null) {
45070
- const S = oT(
45186
+ const S = lT(
45071
45187
  Object.keys(g),
45072
45188
  e.project
45073
45189
  );
@@ -45098,7 +45214,7 @@ function lT(r, e, t, n) {
45098
45214
  e.project
45099
45215
  );
45100
45216
  L.setParent(e), L.initChildren(), L.addSelfToProject();
45101
- const $ = lT(
45217
+ const $ = dT(
45102
45218
  g,
45103
45219
  L,
45104
45220
  {
@@ -45144,7 +45260,7 @@ function lT(r, e, t, n) {
45144
45260
  };
45145
45261
  }
45146
45262
  function Mo(r, e, t, n) {
45147
- const a = [], s = [], o = [], l = Object.keys(r), u = oT(l, e);
45263
+ const a = [], s = [], o = [], l = Object.keys(r), u = lT(l, e);
45148
45264
  if (u)
45149
45265
  return {
45150
45266
  hasCreated: !1,
@@ -45219,7 +45335,7 @@ function Mo(r, e, t, n) {
45219
45335
  e
45220
45336
  );
45221
45337
  ie.setParent(L), ie.initChildren(), ie.addSelfToProject(), s.push(ie);
45222
- const He = lT(
45338
+ const He = dT(
45223
45339
  $,
45224
45340
  ie,
45225
45341
  {
@@ -45284,7 +45400,7 @@ function Kq(r) {
45284
45400
  }
45285
45401
  return null;
45286
45402
  }
45287
- function dT(r, e) {
45403
+ function cT(r, e) {
45288
45404
  if (!r || !e)
45289
45405
  throw new Error("Both entities must be defined to find a common ancestor");
45290
45406
  if (r === e)
@@ -45305,7 +45421,7 @@ function dT(r, e) {
45305
45421
  return null;
45306
45422
  } else
45307
45423
  return null;
45308
- return dT(t, n);
45424
+ return cT(t, n);
45309
45425
  }
45310
45426
  function lt(r) {
45311
45427
  if (Qo.includes(r.type)) {
@@ -45378,7 +45494,7 @@ function Xq(r) {
45378
45494
  }
45379
45495
  function Qq(r) {
45380
45496
  const e = ur(r), t = [], n = [];
45381
- wT.includes(r.type) && t.push(...cT(r));
45497
+ wT.includes(r.type) && t.push(...uT(r));
45382
45498
  const a = e.filter((s) => {
45383
45499
  const o = t.includes(s);
45384
45500
  return o ? !1 : dn.includes(s.type) && !o ? (n.push(s), !1) : !0;
@@ -45405,7 +45521,7 @@ function Ct(r) {
45405
45521
  );
45406
45522
  return f(e);
45407
45523
  }
45408
- function cT(r) {
45524
+ function uT(r) {
45409
45525
  return qe.includes(r.type) ? [
45410
45526
  ...Ct(
45411
45527
  r.successCalls
@@ -45418,13 +45534,13 @@ function cT(r) {
45418
45534
  ) : [];
45419
45535
  }
45420
45536
  function tJ(r, e) {
45421
- return cT(r).includes(e);
45537
+ return uT(r).includes(e);
45422
45538
  }
45423
- function uT(r) {
45539
+ function pT(r) {
45424
45540
  return r.writesValues || [];
45425
45541
  }
45426
45542
  function nJ(r, e) {
45427
- return uT(r).includes(e);
45543
+ return pT(r).includes(e);
45428
45544
  }
45429
45545
  function g2(r) {
45430
45546
  var e;
@@ -46211,7 +46327,7 @@ function a7(r, e = /* @__PURE__ */ new Set(), t = {
46211
46327
  ...r.parent ? P(r.parent, e, t) : []
46212
46328
  ];
46213
46329
  }
46214
- function pT() {
46330
+ function yT() {
46215
46331
  const r = /* @__PURE__ */ new Set();
46216
46332
  return SS.flatMap(
46217
46333
  (t) => P(t, r)
@@ -46224,7 +46340,7 @@ function P(r, e = /* @__PURE__ */ new Set(), t = {
46224
46340
  throw new Error("Entity must be defined to be flattened");
46225
46341
  if (r.type === i.GenericReference)
46226
46342
  return [];
46227
- if (t.ignoreBuiltInBaseEntities && (yr.includes(r.type) || pT().includes(r.id)))
46343
+ if (t.ignoreBuiltInBaseEntities && (yr.includes(r.type) || yT().includes(r.id)))
46228
46344
  return [];
46229
46345
  if (e.has(r.id))
46230
46346
  return [];
@@ -46325,7 +46441,7 @@ function _o(r, e) {
46325
46441
  }
46326
46442
  return n;
46327
46443
  }
46328
- function yT(r) {
46444
+ function hT(r) {
46329
46445
  return r.type === i.FunctionCall || r.type === i.InternalCall || [i.Operation, i.Condition, i.Loop].includes(
46330
46446
  r.type
46331
46447
  ) ? r.declaration.inputs : r.type === i.FunctionDeclaration || la.includes(r.type) ? r.inputs : r.type === i.Search ? r.inputsDeclarations : [];
@@ -46367,7 +46483,7 @@ function d7(r) {
46367
46483
  );
46368
46484
  }
46369
46485
  function _i(r) {
46370
- const e = uT(r), t = [];
46486
+ const e = pT(r), t = [];
46371
46487
  return e.forEach((n) => {
46372
46488
  if ($e.includes(n.type))
46373
46489
  t.push(n);
@@ -46520,23 +46636,23 @@ function Ac(r) {
46520
46636
  ...Oc(t)
46521
46637
  ] : [...e, t.name], []);
46522
46638
  }
46523
- function hT(r) {
46639
+ function fT(r) {
46524
46640
  return r.extends.reduce((e, t) => t.type === i.DefinitionEntity ? [
46525
46641
  ...e,
46526
46642
  t,
46527
- ...hT(t),
46528
- ...fT(t)
46643
+ ...fT(t),
46644
+ ...mT(t)
46529
46645
  ] : [...e, t], []);
46530
46646
  }
46531
- function fT(r) {
46647
+ function mT(r) {
46532
46648
  return r.implements.reduce((e, t) => t.type === i.DefinitionEntity ? [
46533
46649
  ...e,
46534
46650
  t,
46535
- ...fT(t),
46536
- ...hT(t)
46651
+ ...mT(t),
46652
+ ...fT(t)
46537
46653
  ] : [...e, t], []);
46538
46654
  }
46539
- function mT(r) {
46655
+ function TT(r) {
46540
46656
  return [
46541
46657
  ...Ac(r),
46542
46658
  ...Oc(r)
@@ -46571,7 +46687,7 @@ function cJ(r) {
46571
46687
  );
46572
46688
  return e && e.type === i.BuiltInBaseEntity ? e : null;
46573
46689
  }
46574
- function TT(r) {
46690
+ function ET(r) {
46575
46691
  const e = r.extends.find(
46576
46692
  (t) => t.type === i.DefinitionEntity
46577
46693
  );
@@ -46587,7 +46703,7 @@ function _r(r) {
46587
46703
  );
46588
46704
  return f(e);
46589
46705
  }
46590
- function ET(r) {
46706
+ function vT(r) {
46591
46707
  return r.type === i.PrimitiveEntity ? !0 : r.type === i.BuiltInBaseEntity ? r.interactive : !_r(r).find(
46592
46708
  (n) => !n.interactive
46593
46709
  );
@@ -46595,7 +46711,7 @@ function ET(r) {
46595
46711
  function uJ(r) {
46596
46712
  return r.parent === r.project && r.project.variableDeclarations.includes(r);
46597
46713
  }
46598
- function vT(r) {
46714
+ function bT(r) {
46599
46715
  return r.parent !== r.project ? !1 : i.VariableDeclaration === r.type ? r.project.variableDeclarations.includes(r) : i.VariableInstance === r.type ? r.project.variableInstances.includes(r) : i.FunctionCall === r.type ? r.project.functionCalls.includes(r) : i.Condition === r.type ? r.project.conditions.includes(r) : i.Operation === r.type ? r.project.operations.includes(r) : i.Loop === r.type ? r.project.loops.includes(r) : i.Search === r.type ? r.project.searches.includes(r) : !1;
46600
46716
  }
46601
46717
  function y7(r) {
@@ -46604,25 +46720,25 @@ function y7(r) {
46604
46720
  i.DefinitionEntity,
46605
46721
  i.InstalledProject,
46606
46722
  i.Project
46607
- ].includes(r.type) || vT(
46723
+ ].includes(r.type) || bT(
46608
46724
  r
46609
46725
  ))
46610
46726
  return !1;
46611
46727
  const e = Mi(r);
46612
46728
  return e.length === 0 ? !0 : e.some((t) => y7(t));
46613
46729
  }
46614
- function bT(r) {
46730
+ function RT(r) {
46615
46731
  return [
46616
46732
  ...Je,
46617
46733
  i.DefinitionEntity,
46618
46734
  i.InstalledProject,
46619
46735
  i.Project
46620
- ].includes(r.type) || vT(
46736
+ ].includes(r.type) || bT(
46621
46737
  r
46622
46738
  ) ? !1 : Mi(r).length === 0;
46623
46739
  }
46624
46740
  function h7(r, e = 0) {
46625
- if (bT(r)) {
46741
+ if (RT(r)) {
46626
46742
  const t = Mi(r);
46627
46743
  return t.length === 0 ? r : t.map((a) => h7(a, e + 1)).reduce((a, s) => a ? s && s.x < a.x ? s : a : s, null);
46628
46744
  }
@@ -46630,7 +46746,7 @@ function h7(r, e = 0) {
46630
46746
  }
46631
46747
  function f7(r) {
46632
46748
  const e = [];
46633
- if (bT(r))
46749
+ if (RT(r))
46634
46750
  e.push(r);
46635
46751
  else
46636
46752
  return [];
@@ -46712,14 +46828,14 @@ function Ot(r, e) {
46712
46828
  } else
46713
46829
  return t === e ? e : Ot(t, e);
46714
46830
  }
46715
- function RT(r, e) {
46831
+ function gT(r, e) {
46716
46832
  if (yr.includes(r.type) || e.getBuiltIn(r.id))
46717
46833
  return null;
46718
46834
  const t = Vt(
46719
46835
  r.parent,
46720
46836
  e
46721
46837
  );
46722
- return t ? t === e ? Et.includes(r.type) ? r : null : t.type === i.DefinitionEntity ? r : RT(t, e) : null;
46838
+ return t ? t === e ? Et.includes(r.type) ? r : null : t.type === i.DefinitionEntity ? r : gT(t, e) : null;
46723
46839
  }
46724
46840
  function Ko(r, e, t) {
46725
46841
  if (r === e || e === t || r === t)
@@ -46773,7 +46889,7 @@ function hs(r, e, t) {
46773
46889
  type: "a-in-b",
46774
46890
  commonAncestorScope: a
46775
46891
  };
46776
- const l = dT(n, a);
46892
+ const l = cT(n, a);
46777
46893
  return l === t ? {
46778
46894
  compatible: !1,
46779
46895
  type: "parallel-in-project",
@@ -46892,7 +47008,7 @@ function Ka(r) {
46892
47008
  blockedByCalling: o
46893
47009
  });
46894
47010
  }
46895
- const a = RT(
47011
+ const a = gT(
46896
47012
  r,
46897
47013
  r.project
46898
47014
  );
@@ -46983,8 +47099,8 @@ function fJ(r) {
46983
47099
  function Ua(r, e) {
46984
47100
  if (r.type !== i.DefinitionEntity || r.abstract)
46985
47101
  return !1;
46986
- const t = TT(r) || r;
46987
- return !!mT(t).includes(e);
47102
+ const t = ET(r) || r;
47103
+ return !!TT(t).includes(e);
46988
47104
  }
46989
47105
  function mJ(r) {
46990
47106
  const e = [];
@@ -48738,11 +48854,11 @@ class PJ {
48738
48854
  }
48739
48855
  class OJ {
48740
48856
  }
48741
- class gT {
48857
+ class IT {
48742
48858
  }
48743
- class AJ extends gT {
48859
+ class AJ extends IT {
48744
48860
  }
48745
- class CJ extends gT {
48861
+ class CJ extends IT {
48746
48862
  }
48747
48863
  class wJ {
48748
48864
  }
@@ -50484,121 +50600,6 @@ function k7(r) {
50484
50600
  t.initChildren(), r.subscribeBuiltInInstance(t);
50485
50601
  }), r.operationDeclarations = e, e;
50486
50602
  }
50487
- function au(r) {
50488
- return r && typeof r.then == "function";
50489
- }
50490
- class IT {
50491
- constructor(e) {
50492
- d(this, "order", []);
50493
- d(this, "flatRecord", {});
50494
- d(this, "onGoingVisits", {});
50495
- this.flatten(e), this.orderEntities();
50496
- }
50497
- flatten(e) {
50498
- const t = new Set(pT()), n = f(
50499
- P(e, t, {
50500
- ignoreBuiltInBaseEntities: !0
50501
- })
50502
- ), a = /* @__PURE__ */ new Set();
50503
- for (const s of n)
50504
- this.flatRecord[s.id] = s, a.add(s.id);
50505
- this.order = Array.from(a);
50506
- }
50507
- moveEntityAfterDependencies(e) {
50508
- const t = _o(e, this.flatRecord);
50509
- for (const n of t) {
50510
- const a = this.order.indexOf(n), s = this.order.indexOf(e.id);
50511
- if (a > s)
50512
- return this.order.splice(s, 1), this.order.splice(a, 0, e.id), !0;
50513
- }
50514
- return !1;
50515
- }
50516
- orderEntities() {
50517
- let e = !1;
50518
- for (let t = 0; t < this.order.length; t++) {
50519
- const n = this.order[t], a = this.flatRecord[n];
50520
- if (this.moveEntityAfterDependencies(a)) {
50521
- e = !0;
50522
- break;
50523
- }
50524
- }
50525
- e && this.orderEntities();
50526
- }
50527
- getUpstreamOngoingDependenciesVisits(e, t) {
50528
- const n = _o(
50529
- this.flatRecord[e],
50530
- this.flatRecord
50531
- ), a = {};
50532
- return Object.entries(this.onGoingVisits[t] || {}).forEach(
50533
- ([s, o]) => {
50534
- Array.from(n).includes(s) && (a[s] = o);
50535
- }
50536
- ), a;
50537
- }
50538
- // For the reverse visit, the relevant dependencies are downstream dependencies.
50539
- // So a given entity would have to wait for downstream dependencies to finish before it can be visited.
50540
- // Instead of getting the upstream dependency of the entity that we will execute next ('entityId'),
50541
- // we get the upstream dependencies of all ongoing visits and check if the entity we are about to visit is among them.
50542
- getDownstreamOngoingDependenciesVisits(e, t) {
50543
- const n = Object.keys(this.onGoingVisits[t] || {}), a = new Set(
50544
- n.flatMap(
50545
- (o) => Array.from(
50546
- _o(this.flatRecord[o], this.flatRecord)
50547
- )
50548
- )
50549
- ), s = {};
50550
- return Array.from(a).forEach((o) => {
50551
- o === e && (s[o] = this.onGoingVisits[t][o]);
50552
- }), s;
50553
- }
50554
- // Awaits and clears the promises for the given entities
50555
- async settlePromises(e, t) {
50556
- const n = Object.values(e);
50557
- n.length && await Promise.all(n), Object.keys(e).forEach((a) => {
50558
- delete this.onGoingVisits[t][a];
50559
- });
50560
- }
50561
- visit(e) {
50562
- const t = this.order;
50563
- for (const n of t)
50564
- e(this.flatRecord[n]);
50565
- return this;
50566
- }
50567
- reverseVisit(e) {
50568
- const t = this.order.slice().reverse();
50569
- for (const n of t)
50570
- e(this.flatRecord[n]);
50571
- return this;
50572
- }
50573
- async visitAsync(e) {
50574
- const t = this.order, n = Math.random().toString(36).substring(7);
50575
- this.onGoingVisits[n] = {};
50576
- for (const a of t) {
50577
- const s = this.getUpstreamOngoingDependenciesVisits(
50578
- a,
50579
- n
50580
- );
50581
- Object.keys(s).length && await this.settlePromises(s, n);
50582
- const o = e(this.flatRecord[a]);
50583
- au(o) && (this.onGoingVisits[n][a] = o);
50584
- }
50585
- return await this.settlePromises(this.onGoingVisits[n], n), this.onGoingVisits[n] = {}, this;
50586
- }
50587
- async reverseVisitAsync(e) {
50588
- const t = this.order.slice().reverse(), n = Math.random().toString(36).substring(7);
50589
- this.onGoingVisits[n] = {};
50590
- for (const a of t) {
50591
- const s = this.getDownstreamOngoingDependenciesVisits(
50592
- a,
50593
- n
50594
- );
50595
- Object.keys(s).length && await this.settlePromises(s, n);
50596
- const o = e(this.flatRecord[a]);
50597
- au(o) && (this.onGoingVisits[n][a] = o);
50598
- }
50599
- return await this.settlePromises(this.onGoingVisits[n], n), this.onGoingVisits[n] = {}, this;
50600
- }
50601
- }
50602
50603
  const Lr = {}, Ja = {};
50603
50604
  async function q7(r, e = {}) {
50604
50605
  const t = {
@@ -50643,7 +50644,7 @@ function MJ(r) {
50643
50644
  const n = DT(
50644
50645
  r.toShallowJSON({ seenEntityMaps: e })
50645
50646
  );
50646
- return new IT(r).visit((a) => {
50647
+ return new oT(r).visit((a) => {
50647
50648
  const s = b(
50648
50649
  a.toShallowJSON({
50649
50650
  seenEntityMaps: e
@@ -50660,7 +50661,7 @@ function MJ(r) {
50660
50661
  }
50661
50662
  function J7(r) {
50662
50663
  const e = DT(r);
50663
- return new IT(r).visit((t) => {
50664
+ return new oT(r).visit((t) => {
50664
50665
  const n = b(
50665
50666
  t,
50666
50667
  e
@@ -50726,7 +50727,7 @@ export {
50726
50727
  ES as CONDITIONS,
50727
50728
  pR as CUSTOM_ENTITY_OPERATIONS,
50728
50729
  OJ as CallableEntityClass,
50729
- gT as CallerEntityClass,
50730
+ IT as CallerEntityClass,
50730
50731
  PJ as ChildEntityState,
50731
50732
  ke as ComparisonOperatorTypes,
50732
50733
  Kr as ConditionState,
@@ -50827,6 +50828,7 @@ export {
50827
50828
  Xt as StandaloneOperatorTypes,
50828
50829
  ne as StringOperations,
50829
50830
  Fe as TERMINATION_TYPES,
50831
+ oT as Traverser,
50830
50832
  MT as USER_MANAGED_ENTITY_TYPES,
50831
50833
  IJ as UserManagedEntityStateFunctionality,
50832
50834
  rT as VALUE_READING_ENTITIES_EXPLANATION,
@@ -50873,9 +50875,9 @@ export {
50873
50875
  Ka as checkIsCallableEntityReachable,
50874
50876
  hJ as checkIsCanvasEntity,
50875
50877
  y7 as checkIsDetachedBranch,
50876
- bT as checkIsDetachedBranchShallow,
50878
+ RT as checkIsDetachedBranchShallow,
50877
50879
  uJ as checkIsGlobalVariable,
50878
- vT as checkIsGloballyDeclared,
50880
+ bT as checkIsGloballyDeclared,
50879
50881
  m7 as checkIsMethod,
50880
50882
  Ko as checkIsNestedScope,
50881
50883
  hs as checkScopeCompatibility,
@@ -50994,7 +50996,7 @@ export {
50994
50996
  rS as executionBuiltInEntityAbortMethodParentRef,
50995
50997
  f as filterOutDuplicateEntities,
50996
50998
  iq as filterOutDuplicateErrors,
50997
- oT as findEntityFromKeys,
50999
+ lT as findEntityFromKeys,
50998
51000
  B2 as findReferenceToSelfInList,
50999
51001
  aJ as findReferencesToSelfInProject,
51000
51002
  _2 as flattenActionDescriptor,
@@ -51007,10 +51009,10 @@ export {
51007
51009
  G2 as flattenContinueStatement,
51008
51010
  F2 as flattenDataType,
51009
51011
  $2 as flattenDefinitionEntity,
51010
- mT as flattenDefinitionEntityExtensionAndImplementationTypes,
51012
+ TT as flattenDefinitionEntityExtensionAndImplementationTypes,
51011
51013
  Ac as flattenDefinitionEntityExtensionTypes,
51012
- hT as flattenDefinitionEntityExtensions,
51013
- fT as flattenDefinitionEntityImplementations,
51014
+ fT as flattenDefinitionEntityExtensions,
51015
+ mT as flattenDefinitionEntityImplementations,
51014
51016
  Oc as flattenDefinitionEntityImplementionTypes,
51015
51017
  Nt as flattenDerivedCanvasEntities,
51016
51018
  f7 as flattenDetachedBranch,
@@ -51066,7 +51068,7 @@ export {
51066
51068
  Co as getAllActionDescriptorsForGlobalEvents,
51067
51069
  wo as getAllActionDescriptorsForLoops,
51068
51070
  Yq as getAllActionDescriptorsForOperations,
51069
- pT as getAllBuiltInEntityIds,
51071
+ yT as getAllBuiltInEntityIds,
51070
51072
  d2 as getAllGloballyDeclaredFunctionDeclarationsExplanation,
51071
51073
  _r as getBaseBuiltInEntities,
51072
51074
  t2 as getBaseSchemaBasedOnType,
@@ -51076,7 +51078,7 @@ export {
51076
51078
  Wt as getCalledBy,
51077
51079
  dq as getCallerEntityReferenceSchema,
51078
51080
  lq as getCallerEntityTypeSchema,
51079
- cT as getCalls,
51081
+ uT as getCalls,
51080
51082
  d7 as getCanvasEntitiesDerivedFromInternalCalls,
51081
51083
  _i as getCanvasEntitiesDerivedFromWrites,
51082
51084
  Zo as getCanvasEntityDerivedFromValueReadingEntity,
@@ -51085,7 +51087,7 @@ export {
51085
51087
  Sq as getCanvasEntityTypeSchema,
51086
51088
  Xq as getChildrenEntityWithValues,
51087
51089
  vJ as getColumnProperties,
51088
- dT as getCommonAncestor,
51090
+ cT as getCommonAncestor,
51089
51091
  T2 as getCommonChildren,
51090
51092
  TJ as getDatabaseEntities,
51091
51093
  bJ as getDatabaseEntity,
@@ -51102,7 +51104,7 @@ export {
51102
51104
  Xd as getDraggablePassThroughCallableEntityTypeSchema,
51103
51105
  bq as getDraggablePlayableEntityReferenceSchema,
51104
51106
  vq as getDraggablePlayableEntityTypeSchema,
51105
- yT as getEntityArgumentDeclarations,
51107
+ hT as getEntityArgumentDeclarations,
51106
51108
  s7 as getEntityInputMaps,
51107
51109
  lJ as getEntityOutputMaps,
51108
51110
  Dq as getEntityReferenceSchema,
@@ -51119,12 +51121,12 @@ export {
51119
51121
  yq as getExecutableEntityReferenceSchema,
51120
51122
  pq as getExecutableEntityTypeSchema,
51121
51123
  dJ as getExtendedBuiltInEntity,
51122
- TT as getExtendedDefinitionEntity,
51124
+ ET as getExtendedDefinitionEntity,
51123
51125
  n2 as getGenerationTargetSchemaBasedOnType,
51124
51126
  h7 as getHeadIfPartOfDetachedBranch,
51125
51127
  T7 as getHighestScope,
51126
51128
  cJ as getImplementedBuiltInEntity,
51127
- ET as getIsInteractive,
51129
+ vT as getIsInteractive,
51128
51130
  vu as getLastInListOperation,
51129
51131
  Wv as getLastInListOperationError,
51130
51132
  Jv as getLastInListOperationErrorParentRef,
@@ -51158,7 +51160,7 @@ export {
51158
51160
  Mi as getRelatedCanvasElementsOnTheLeft,
51159
51161
  M2 as getRelatedCanvasElementsOnTheLeftFromTransfer,
51160
51162
  ur as getRelatedCanvasElementsOnTheRight,
51161
- RT as getRootEntryPointScopeOwner,
51163
+ gT as getRootEntryPointScopeOwner,
51162
51164
  Ot as getScopeOwner,
51163
51165
  gq as getTerminationReferenceSchema,
51164
51166
  Rq as getTerminationTypeSchema,
@@ -51179,7 +51181,7 @@ export {
51179
51181
  O2 as getVariablesFromOutputMaps,
51180
51182
  D2 as getVariablesFromReturnDeclarations,
51181
51183
  zm as getVariablesInSameOrHigherScope,
51182
- uT as getWrites,
51184
+ pT as getWrites,
51183
51185
  eJ as groupCallsBasedOnParallelizableExecution,
51184
51186
  f2 as handleAfterEntityImplementationSideEffects,
51185
51187
  h2 as handleBeforeEntityImplementationSideEffects,
@@ -51236,6 +51238,7 @@ export {
51236
51238
  h5 as inferVariableInstanceDataType,
51237
51239
  DT as initBaseProjectEntity,
51238
51240
  J7 as initProject,
51241
+ au as isPromise,
51239
51242
  Dg as iterateOverListActionDescriptorListArgumentDeclaration,
51240
51243
  gg as iterateOverListActionDescriptorListArgumentDeclarationDataType,
51241
51244
  Rg as iterateOverListActionDescriptorListArgumentDeclarationDataTypeParentRef,
@@ -51495,7 +51498,7 @@ export {
51495
51498
  Ye as resolveClonedEntityProject,
51496
51499
  So as resolveConditionOperatorLabel,
51497
51500
  Rc as resolveDataType,
51498
- lT as resolveDataTypeEntityOrNestedChildrenFromLiteralValue,
51501
+ dT as resolveDataTypeEntityOrNestedChildrenFromLiteralValue,
51499
51502
  ps as resolveDataTypeLabel,
51500
51503
  Mq as resolveDefinitionEntityDataTypeLabel,
51501
51504
  Bq as resolveEntityDataTypeLabel,