@elyx-code/project-logic-tree 0.0.6950 → 0.0.6951

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
@@ -180257,7 +180257,9 @@ const Ni = class Ni extends nn {
180257
180257
  e
180258
180258
  );
180259
180259
  let h = null;
180260
- i.entity && (h = r.get(i.entity));
180260
+ i.entity && (h = r.get(
180261
+ i.entity
180262
+ ));
180261
180263
  let m = null;
180262
180264
  i.foreignKeyRef && (m = r.get(
180263
180265
  i.foreignKeyRef
@@ -180303,7 +180305,10 @@ const Ni = class Ni extends nn {
180303
180305
  let a = JSON.parse(
180304
180306
  JSON.stringify(i)
180305
180307
  );
180306
- const c = [], e = [], f = xRi(a, r), h = an(
180308
+ const c = [], e = [], f = xRi(
180309
+ a,
180310
+ r
180311
+ ), h = an(
180307
180312
  a
180308
180313
  );
180309
180314
  if (e.push(
@@ -180329,7 +180334,9 @@ const Ni = class Ni extends nn {
180329
180334
  );
180330
180335
  if (N.length) {
180331
180336
  const V = N.length > 1 ? `entities with ids '${At(
180332
- N.map((B) => B.id),
180337
+ N.map(
180338
+ (B) => B.id
180339
+ ),
180333
180340
  "', '",
180334
180341
  "' and '"
180335
180342
  )}'` : `entity with id '${N[0].id}'`;
@@ -180352,7 +180359,9 @@ const Ni = class Ni extends nn {
180352
180359
  }
180353
180360
  const m = a.parent && r.get(
180354
180361
  a.parent
180355
- ) || r.getBuiltIn(a.parent), b = m ? sp(m) : null;
180362
+ ) || r.getBuiltIn(
180363
+ a.parent
180364
+ ), b = m ? sp(m) : null;
180356
180365
  if (b)
180357
180366
  e.push(
180358
180367
  new De({
@@ -180447,9 +180456,10 @@ Alternatively you can update the entity with 'update' action. Or replace it by f
180447
180456
  // Therefore it is a data type whose structure is could still need to be inferred
180448
180457
  // When a data type belong to a built in entity, it is considered resolved
180449
180458
  get isResolved() {
180450
- return [d.BuiltInBaseEntity, d.ActionDescriptor].includes(
180451
- this.parent.type
180452
- ) || sp(this.parent) ? !0 : !(!this.entity && !this.isGroup && !this.foreignKeyRef && !this.foreignKeyAllowed);
180459
+ return [
180460
+ d.BuiltInBaseEntity,
180461
+ d.ActionDescriptor
180462
+ ].includes(this.parent.type) || sp(this.parent) ? !0 : !(!this.entity && !this.isGroup && !this.foreignKeyRef && !this.foreignKeyAllowed);
180453
180463
  }
180454
180464
  validateGeneratedUpdate(i) {
180455
180465
  return { errors: [], explanations: [], modifiedData: i };
@@ -180482,9 +180492,15 @@ Alternatively you can update the entity with 'update' action. Or replace it by f
180482
180492
  const h = f.entity.afterAllChildrenInitialized(i);
180483
180493
  r.push(...h.updated), a.push(...h.added), c.push(...h.removed), e.push(...h.affected);
180484
180494
  }), i == null || i.attemptAutoclose("sync-dependents", this.id), {
180485
- updated: C(r),
180486
- added: C(a),
180487
- removed: C(c),
180495
+ updated: C(
180496
+ r
180497
+ ),
180498
+ added: C(
180499
+ a
180500
+ ),
180501
+ removed: C(
180502
+ c
180503
+ ),
180488
180504
  affected: C(
180489
180505
  e
180490
180506
  ),
@@ -180496,9 +180512,15 @@ Alternatively you can update the entity with 'update' action. Or replace it by f
180496
180512
  onDetachedDependencyRemoved(i, r, a) {
180497
180513
  const c = [], e = [], f = [], h = [];
180498
180514
  return r === "entity-field" && this.setEntity(null, a), r === "foreign-key-ref-field" && this.setForeignKeyRef(null, a), {
180499
- updated: C(c),
180500
- added: C(e),
180501
- removed: C(f),
180515
+ updated: C(
180516
+ c
180517
+ ),
180518
+ added: C(
180519
+ e
180520
+ ),
180521
+ removed: C(
180522
+ f
180523
+ ),
180502
180524
  affected: C(
180503
180525
  h
180504
180526
  ),
@@ -180513,9 +180535,15 @@ Alternatively you can update the entity with 'update' action. Or replace it by f
180513
180535
  i,
180514
180536
  a
180515
180537
  ), r === "foreign-key-ref-field" && this.setForeignKeyRef(i, a), {
180516
- updated: C(c),
180517
- added: C(e),
180518
- removed: C(f),
180538
+ updated: C(
180539
+ c
180540
+ ),
180541
+ added: C(
180542
+ e
180543
+ ),
180544
+ removed: C(
180545
+ f
180546
+ ),
180519
180547
  affected: C(
180520
180548
  h
180521
180549
  ),
@@ -180530,13 +180558,16 @@ Alternatively you can update the entity with 'update' action. Or replace it by f
180530
180558
  field: "entity-field"
180531
180559
  /* EntityField */
180532
180560
  }
180533
- ]), (c = (a = this.foreignKeyRef) == null ? void 0 : a.unsubscribeDependents) == null || c.call(a, [
180534
- {
180535
- entity: this,
180536
- field: "foreign-key-ref-field"
180537
- /* ForeignKeyRefField */
180538
- }
180539
- ]), this;
180561
+ ]), (c = (a = this.foreignKeyRef) == null ? void 0 : a.unsubscribeDependents) == null || c.call(
180562
+ a,
180563
+ [
180564
+ {
180565
+ entity: this,
180566
+ field: "foreign-key-ref-field"
180567
+ /* ForeignKeyRefField */
180568
+ }
180569
+ ]
180570
+ ), this;
180540
180571
  }
180541
180572
  // Calls the 'subscribeDependents' method with itself as the only argument on any dependencies the current entity has
180542
180573
  // It could be multiple
@@ -180593,7 +180624,10 @@ Alternatively you can update the entity with 'update' action. Or replace it by f
180593
180624
  return this.knownVersions = this.knownVersions ? this.knownVersions.set(this.version, i) : (/* @__PURE__ */ new Map()).set(this.version, i), this.apply(i), this;
180594
180625
  }
180595
180626
  snapshot() {
180596
- const i = new Ni(this, this.project);
180627
+ const i = new Ni(
180628
+ this,
180629
+ this.project
180630
+ );
180597
180631
  return this.apply(i);
180598
180632
  }
180599
180633
  /**
@@ -180616,9 +180650,15 @@ Alternatively you can update the entity with 'update' action. Or replace it by f
180616
180650
  r.push(this.parent, ...f.updated), a.push(...f.added), c.push(...f.removed);
180617
180651
  }
180618
180652
  return {
180619
- updated: C(r),
180620
- added: C(a),
180621
- removed: C(c),
180653
+ updated: C(
180654
+ r
180655
+ ),
180656
+ added: C(
180657
+ a
180658
+ ),
180659
+ removed: C(
180660
+ c
180661
+ ),
180622
180662
  affected: C(
180623
180663
  e
180624
180664
  ),
@@ -180641,7 +180681,9 @@ Alternatively you can update the entity with 'update' action. Or replace it by f
180641
180681
  updated: C(
180642
180682
  a
180643
180683
  ),
180644
- added: C(c),
180684
+ added: C(
180685
+ c
180686
+ ),
180645
180687
  removed: C(
180646
180688
  e
180647
180689
  ),
@@ -180677,9 +180719,15 @@ Alternatively you can update the entity with 'update' action. Or replace it by f
180677
180719
  );
180678
180720
  }
180679
180721
  return this.metaSync(h.toShallowJSON(), null), this.previousVersion = h.previousVersion, this.version = h.version, this.createdAt = h.createdAt, this.author = h.author, this.deleted = h.deleted, this.entity = h.entity, this.foreignKeyRef = h.foreignKeyRef, this.andChildrenGroup = h.andChildrenGroup ? [...h.andChildrenGroup] : null, this.orChildrenGroup = h.orChildrenGroup ? [...h.orChildrenGroup] : null, this.parent = h.parent, {
180680
- updated: C(a),
180681
- added: C(c),
180682
- removed: C(e),
180722
+ updated: C(
180723
+ a
180724
+ ),
180725
+ added: C(
180726
+ c
180727
+ ),
180728
+ removed: C(
180729
+ e
180730
+ ),
180683
180731
  affected: C(
180684
180732
  f
180685
180733
  ),
@@ -180721,7 +180769,9 @@ Alternatively you can update the entity with 'update' action. Or replace it by f
180721
180769
  throw r == null || r.attemptAutoclose(
180722
180770
  D.UpdateWithShallowTransfer,
180723
180771
  this.id
180724
- ), new Error(`${this.type} with id '${this.id}' must have a 'parent'`);
180772
+ ), new Error(
180773
+ `${this.type} with id '${this.id}' must have a 'parent'`
180774
+ );
180725
180775
  if (i.entity) {
180726
180776
  const e = te(i.entity), f = this.project.get(e);
180727
180777
  f && (this.setEntity(f, r), this.metaSync({ inferred: !1 }, r));
@@ -180737,7 +180787,9 @@ Alternatively you can update the entity with 'update' action. Or replace it by f
180737
180787
  } else
180738
180788
  this.setForeignKeyRef(null, r);
180739
180789
  return (a = i.andChildrenGroup) == null || a.forEach((e) => {
180740
- const f = te(e), h = this.project.get(f);
180790
+ const f = te(e), h = this.project.get(
180791
+ f
180792
+ );
180741
180793
  h && (this.addToAndGroup(h, r), h.setParent(this, r));
180742
180794
  }), [...this.andChildrenGroup || []].forEach((e) => {
180743
180795
  var h;
@@ -180745,7 +180797,9 @@ Alternatively you can update the entity with 'update' action. Or replace it by f
180745
180797
  (m) => te(m) === e.id
180746
180798
  )) || (this.removeChildGroup(e, r), e.removeFromParent(r));
180747
180799
  }), (c = i.orChildrenGroup) == null || c.forEach((e) => {
180748
- const f = te(e), h = this.project.get(f);
180800
+ const f = te(e), h = this.project.get(
180801
+ f
180802
+ );
180749
180803
  h && (this.addToOrGroup(h, r), h.setParent(this, r));
180750
180804
  }), [...this.orChildrenGroup || []].forEach((e) => {
180751
180805
  var h;
@@ -180832,11 +180886,15 @@ Alternatively you can update the entity with 'update' action. Or replace it by f
180832
180886
  `${this.type} with id '${this.id}' has a 'parent' reference '${e}' that isn't found in the project`
180833
180887
  );
180834
180888
  } else
180835
- throw new Error(`${this.type} with id '${this.id}' must have a 'parent'`);
180889
+ throw new Error(
180890
+ `${this.type} with id '${this.id}' must have a 'parent'`
180891
+ );
180836
180892
  if (this.initialData.entity) {
180837
180893
  const e = te(
180838
180894
  this.initialData.entity
180839
- ), f = this.project.get(e);
180895
+ ), f = this.project.get(
180896
+ e
180897
+ );
180840
180898
  f && (f.type === d.DefinitionEntity && f.parent === this || (this.setEntity(f, null), f.type !== d.BuiltInBaseEntity && f.type !== d.PrimitiveEntity && i.push(f)));
180841
180899
  }
180842
180900
  if (this.initialData.foreignKeyRef) {
@@ -180848,9 +180906,15 @@ Alternatively you can update the entity with 'update' action. Or replace it by f
180848
180906
  f && this.setForeignKeyRef(f, null);
180849
180907
  }
180850
180908
  return {
180851
- updated: C(i),
180852
- added: C(r),
180853
- removed: C(a),
180909
+ updated: C(
180910
+ i
180911
+ ),
180912
+ added: C(
180913
+ r
180914
+ ),
180915
+ removed: C(
180916
+ a
180917
+ ),
180854
180918
  affected: C(
180855
180919
  c
180856
180920
  ),
@@ -180896,13 +180960,23 @@ Alternatively you can update the entity with 'update' action. Or replace it by f
180896
180960
  i
180897
180961
  );
180898
180962
  }
180899
- return (h = this.andChildrenGroup) != null && h.length && this.andChildrenGroup.sort((A, _) => (A.index || 0) - (_.index || 0)), (m = this.orChildrenGroup) != null && m.length && this.orChildrenGroup.sort((A, _) => (A.index || 0) - (_.index || 0)), this.entity && this.entity.type === d.DefinitionEntity && ((b = this.entity.parent) == null ? void 0 : b.id) !== this.id && this.metaSync({ inferred: !1 }, i), this.bestEffortClearIncompatibleProperties(i), this.entity && this.entity.type === d.DefinitionEntity && ((E = this.entity.parent) == null ? void 0 : E.id) === this.id && this.entity.afterAllChildrenInitialized(i), i == null || i.attemptAutoclose(
180963
+ return (h = this.andChildrenGroup) != null && h.length && this.andChildrenGroup.sort(
180964
+ (A, _) => (A.index || 0) - (_.index || 0)
180965
+ ), (m = this.orChildrenGroup) != null && m.length && this.orChildrenGroup.sort(
180966
+ (A, _) => (A.index || 0) - (_.index || 0)
180967
+ ), this.entity && this.entity.type === d.DefinitionEntity && ((b = this.entity.parent) == null ? void 0 : b.id) !== this.id && this.metaSync({ inferred: !1 }, i), this.bestEffortClearIncompatibleProperties(i), this.entity && this.entity.type === d.DefinitionEntity && ((E = this.entity.parent) == null ? void 0 : E.id) === this.id && this.entity.afterAllChildrenInitialized(i), i == null || i.attemptAutoclose(
180900
180968
  D.AfterAllChildrenInitialized,
180901
180969
  this.id
180902
180970
  ), {
180903
- updated: C(r),
180904
- added: C(a),
180905
- removed: C(c),
180971
+ updated: C(
180972
+ r
180973
+ ),
180974
+ added: C(
180975
+ a
180976
+ ),
180977
+ removed: C(
180978
+ c
180979
+ ),
180906
180980
  affected: C(
180907
180981
  e
180908
180982
  ),
@@ -180922,9 +180996,15 @@ Alternatively you can update the entity with 'update' action. Or replace it by f
180922
180996
  )) {
180923
180997
  const r = [this], a = [], c = [], e = [];
180924
180998
  return this.parent.type === d.DataType ? (this.parentRelationType === Je.AndDataTypeGroup ? this.parent.addToAndGroup(this, i) : this.parentRelationType === Je.OrDataTypeGroup && this.parent.addToOrGroup(this, i), e.push(this.parent)) : this.parent.type === d.DefinitionEntity ? (this.parent.setAdditionalPropertiesDataType(this, i), e.push(this.parent)) : this.parent.type !== d.BuiltInBaseEntity && this.parent.setDataType(this, i), this.subscribe(), this.subscribeToDependencies(), i == null || i.attemptAutoclose("add-self-to-project", this.id), {
180925
- updated: C(r),
180926
- added: C(a),
180927
- removed: C(c),
180999
+ updated: C(
181000
+ r
181001
+ ),
181002
+ added: C(
181003
+ a
181004
+ ),
181005
+ removed: C(
181006
+ c
181007
+ ),
180928
181008
  affected: C(
180929
181009
  e
180930
181010
  ),
@@ -180981,7 +181061,10 @@ Alternatively you can update the entity with 'update' action. Or replace it by f
180981
181061
  this.orChildrenGroup.splice(a, 1), c.remove({ ignoreUpstream: !0 }, r);
180982
181062
  }
180983
181063
  }
180984
- return r == null || r.attemptAutoclose(D.RemoveChildGroup, this.id), this;
181064
+ return r == null || r.attemptAutoclose(
181065
+ D.RemoveChildGroup,
181066
+ this.id
181067
+ ), this;
180985
181068
  }
180986
181069
  initChildren(i = this.project.addChangeSet(
180987
181070
  new Z(
@@ -181006,7 +181089,13 @@ Alternatively you can update the entity with 'update' action. Or replace it by f
181006
181089
  this.entity = Re(
181007
181090
  this.initialData.entity,
181008
181091
  this.project
181009
- ), (((a = (r = this.initialData.entity) == null ? void 0 : r.parent) == null ? void 0 : a.id) === this.id || ((e = (c = this.initialData.entity) == null ? void 0 : c.parent) == null ? void 0 : e.type) === d.GenericReference && ((h = (f = this.initialData.entity) == null ? void 0 : f.parent) == null ? void 0 : h.entityId) == this.id) && this.entity.setParent(this, null), (b = (m = this.entity).initChildren) == null || b.call(m, i);
181092
+ ), (((a = (r = this.initialData.entity) == null ? void 0 : r.parent) == null ? void 0 : a.id) === this.id || ((e = (c = this.initialData.entity) == null ? void 0 : c.parent) == null ? void 0 : e.type) === d.GenericReference && ((h = (f = this.initialData.entity) == null ? void 0 : f.parent) == null ? void 0 : h.entityId) == this.id) && this.entity.setParent(
181093
+ this,
181094
+ null
181095
+ ), (b = (m = this.entity).initChildren) == null || b.call(
181096
+ m,
181097
+ i
181098
+ );
181010
181099
  if (this.initialData.foreignKeyRef)
181011
181100
  if (this.initialData.foreignKeyRef.type === d.GenericReference) {
181012
181101
  const _ = this.project.findSubscribedInstanceFromReference(
@@ -181018,19 +181107,23 @@ Alternatively you can update the entity with 'update' action. Or replace it by f
181018
181107
  this.initialData.foreignKeyRef,
181019
181108
  this.project
181020
181109
  ), (A = (E = this.foreignKeyRef).initChildren) == null || A.call(E, i);
181021
- return this.initialData.andChildrenGroup && (this.andChildrenGroup = this.initialData.andChildrenGroup.map((_) => {
181022
- const N = Re(
181023
- _,
181024
- this.project
181025
- );
181026
- return N.setParent(this, null), N.initChildren(i), N;
181027
- })), this.initialData.orChildrenGroup && (this.orChildrenGroup = this.initialData.orChildrenGroup.map((_) => {
181028
- const N = Re(
181029
- _,
181030
- this.project
181031
- );
181032
- return N.setParent(this, null), N.initChildren(i), N;
181033
- })), this.subscribeToDependencies(), this.afterAllChildrenInitialized(i), i == null || i.attemptAutoclose("init-children", this.id), this;
181110
+ return this.initialData.andChildrenGroup && (this.andChildrenGroup = this.initialData.andChildrenGroup.map(
181111
+ (_) => {
181112
+ const N = Re(
181113
+ _,
181114
+ this.project
181115
+ );
181116
+ return N.setParent(this, null), N.initChildren(i), N;
181117
+ }
181118
+ )), this.initialData.orChildrenGroup && (this.orChildrenGroup = this.initialData.orChildrenGroup.map(
181119
+ (_) => {
181120
+ const N = Re(
181121
+ _,
181122
+ this.project
181123
+ );
181124
+ return N.setParent(this, null), N.initChildren(i), N;
181125
+ }
181126
+ )), this.subscribeToDependencies(), this.afterAllChildrenInitialized(i), i == null || i.attemptAutoclose("init-children", this.id), this;
181034
181127
  }
181035
181128
  subscribe() {
181036
181129
  var i;
@@ -181122,10 +181215,19 @@ Alternatively you can update the entity with 'update' action. Or replace it by f
181122
181215
  const m = this.parent;
181123
181216
  m == null || m.removeDataType(i);
181124
181217
  }
181125
- return this.parent && this.parent.type !== d.BuiltInBaseEntity && r.push(this.parent), i == null || i.attemptAutoclose(D.RemoveFromParent, this.id), {
181126
- added: C(c),
181127
- updated: C(r),
181128
- removed: C(a),
181218
+ return this.parent && this.parent.type !== d.BuiltInBaseEntity && r.push(this.parent), i == null || i.attemptAutoclose(
181219
+ D.RemoveFromParent,
181220
+ this.id
181221
+ ), {
181222
+ added: C(
181223
+ c
181224
+ ),
181225
+ updated: C(
181226
+ r
181227
+ ),
181228
+ removed: C(
181229
+ a
181230
+ ),
181129
181231
  affected: C(
181130
181232
  e
181131
181233
  ),
@@ -181151,7 +181253,10 @@ Alternatively you can update the entity with 'update' action. Or replace it by f
181151
181253
  )) {
181152
181254
  const a = [], c = [], e = [], f = [];
181153
181255
  if (r != null && r.hasRemoved(this.id))
181154
- return r == null || r.attemptAutoclose(D.RemoveEntity, this.id), {
181256
+ return r == null || r.attemptAutoclose(
181257
+ D.RemoveEntity,
181258
+ this.id
181259
+ ), {
181155
181260
  added: [],
181156
181261
  updated: [],
181157
181262
  removed: [],
@@ -181195,9 +181300,15 @@ Alternatively you can update the entity with 'update' action. Or replace it by f
181195
181300
  e.push(...h.added), a.push(...h.updated), c.push(...h.removed), f.push(...h.affected);
181196
181301
  }
181197
181302
  return r == null || r.attemptAutoclose(D.RemoveEntity, this.id), {
181198
- added: C(e),
181199
- updated: C(a),
181200
- removed: C(c),
181303
+ added: C(
181304
+ e
181305
+ ),
181306
+ updated: C(
181307
+ a
181308
+ ),
181309
+ removed: C(
181310
+ c
181311
+ ),
181201
181312
  affected: C(
181202
181313
  f
181203
181314
  ),
@@ -181220,10 +181331,28 @@ Alternatively you can update the entity with 'update' action. Or replace it by f
181220
181331
  if (!this.checkCanEdit(this, i))
181221
181332
  return ce.warn(
181222
181333
  `[restore] User is not allowed to edit this ${this.type} entity with id: ${this.id}`
181223
- ), i == null || i.attemptAutoclose(D.RestoreEntity, this.id), { added: [], updated: [], removed: [], affected: [], self: this };
181334
+ ), i == null || i.attemptAutoclose(
181335
+ D.RestoreEntity,
181336
+ this.id
181337
+ ), {
181338
+ added: [],
181339
+ updated: [],
181340
+ removed: [],
181341
+ affected: [],
181342
+ self: this
181343
+ };
181224
181344
  const r = [], a = [], c = [], e = [];
181225
181345
  if (i != null && i.hasAdded(this.id))
181226
- return i == null || i.attemptAutoclose(D.RestoreEntity, this.id), { added: [], updated: [], removed: [], affected: [], self: this };
181346
+ return i == null || i.attemptAutoclose(
181347
+ D.RestoreEntity,
181348
+ this.id
181349
+ ), {
181350
+ added: [],
181351
+ updated: [],
181352
+ removed: [],
181353
+ affected: [],
181354
+ self: this
181355
+ };
181227
181356
  if (this.subscribe(), this.project.unsubscribeDeletedInstance(this), this.metaSync({ deleted: !1 }, i), Object.values(this.detachedDependents).forEach((f) => {
181228
181357
  const {
181229
181358
  updated: h,
@@ -181236,7 +181365,10 @@ Alternatively you can update the entity with 'update' action. Or replace it by f
181236
181365
  );
181237
181366
  a.push(...h), c.push(...m), r.push(...b);
181238
181367
  }), this.entity && this.entity.type === d.DefinitionEntity && this.entity.parent === this) {
181239
- const { updated: f } = this.entity.restore({}, i);
181368
+ const { updated: f } = this.entity.restore(
181369
+ {},
181370
+ i
181371
+ );
181240
181372
  a.push(...f);
181241
181373
  }
181242
181374
  if (this.andChildrenGroup && this.andChildrenGroup.forEach((f) => {
@@ -181266,9 +181398,15 @@ Alternatively you can update the entity with 'update' action. Or replace it by f
181266
181398
  f.setDataType(this, i), a.push(f);
181267
181399
  }
181268
181400
  return i == null || i.attemptAutoclose(D.RestoreEntity, this.id), {
181269
- added: C(r),
181270
- updated: C(a),
181271
- removed: C(c),
181401
+ added: C(
181402
+ r
181403
+ ),
181404
+ updated: C(
181405
+ a
181406
+ ),
181407
+ removed: C(
181408
+ c
181409
+ ),
181272
181410
  affected: C(
181273
181411
  e
181274
181412
  ),
@@ -181361,7 +181499,9 @@ Alternatively you can update the entity with 'update' action. Or replace it by f
181361
181499
  )) || null,
181362
181500
  entity: (
181363
181501
  // @ts-ignore
181364
- ((e = this.entity) == null ? void 0 : e.parent) === this ? this.entity.toJSON(i) : ((f = this.entity) == null ? void 0 : f.toReference()) || null
181502
+ ((e = this.entity) == null ? void 0 : e.parent) === this ? this.entity.toJSON(
181503
+ i
181504
+ ) : ((f = this.entity) == null ? void 0 : f.toReference()) || null
181365
181505
  ),
181366
181506
  parent: this.parent.toReference()
181367
181507
  });
@@ -181369,7 +181509,11 @@ Alternatively you can update the entity with 'update' action. Or replace it by f
181369
181509
  toJSONClone(i = lt) {
181370
181510
  var a, c, e, f, h, m, b, E, A, _;
181371
181511
  let r;
181372
- return (a = i.seenEntityMaps) != null && a.has(this.id) ? r = i.seenEntityMaps.get(this.id) : (r = i.newId || cn(this, this.project, i.uuidStrategy), i.seenEntityMaps && i.seenEntityMaps.set(this.id, r)), (c = i.seenEntities) != null && c.has(r) || (e = i.seenEntities) != null && e.has(this.id) ? this.toReference({ seenEntityMaps: i.seenEntityMaps }) : ((f = i.seenEntities) == null || f.add(r), (h = i.seenEntities) == null || h.add(this.id), {
181512
+ return (a = i.seenEntityMaps) != null && a.has(this.id) ? r = i.seenEntityMaps.get(this.id) : (r = i.newId || cn(
181513
+ this,
181514
+ this.project,
181515
+ i.uuidStrategy
181516
+ ), i.seenEntityMaps && i.seenEntityMaps.set(this.id, r)), (c = i.seenEntities) != null && c.has(r) || (e = i.seenEntities) != null && e.has(this.id) ? this.toReference({ seenEntityMaps: i.seenEntityMaps }) : ((f = i.seenEntities) == null || f.add(r), (h = i.seenEntities) == null || h.add(this.id), {
181373
181517
  id: r,
181374
181518
  version: x.UUID.uuid(),
181375
181519
  createdAt: i.timestamp || G().toISOString(),
@@ -181393,10 +181537,16 @@ Alternatively you can update the entity with 'update' action. Or replace it by f
181393
181537
  actionEntities: this.actionEntities,
181394
181538
  foreignKeyRef: ((m = this.foreignKeyRef) == null ? void 0 : m.toJSONClone({ ...i, newId: null })) || null,
181395
181539
  andChildrenGroup: ((b = this.andChildrenGroup) == null ? void 0 : b.map(
181396
- (N) => N.toJSONClone({ ...i, newId: null })
181540
+ (N) => N.toJSONClone({
181541
+ ...i,
181542
+ newId: null
181543
+ })
181397
181544
  )) || null,
181398
181545
  orChildrenGroup: ((E = this.orChildrenGroup) == null ? void 0 : E.map(
181399
- (N) => N.toJSONClone({ ...i, newId: null })
181546
+ (N) => N.toJSONClone({
181547
+ ...i,
181548
+ newId: null
181549
+ })
181400
181550
  )) || null,
181401
181551
  // @ts-ignore
181402
181552
  entity: (
@@ -181450,8 +181600,12 @@ Alternatively you can update the entity with 'update' action. Or replace it by f
181450
181600
  interactiveEntities: this.interactiveEntities,
181451
181601
  actionEntities: this.actionEntities,
181452
181602
  foreignKeyRef: ((c = this.foreignKeyRef) == null ? void 0 : c.toReference(i)) || null,
181453
- andChildrenGroup: ((e = this.andChildrenGroup) == null ? void 0 : e.map((m) => m.toReference(i))) || null,
181454
- orChildrenGroup: ((f = this.orChildrenGroup) == null ? void 0 : f.map((m) => m.toReference(i))) || null,
181603
+ andChildrenGroup: ((e = this.andChildrenGroup) == null ? void 0 : e.map(
181604
+ (m) => m.toReference(i)
181605
+ )) || null,
181606
+ orChildrenGroup: ((f = this.orChildrenGroup) == null ? void 0 : f.map(
181607
+ (m) => m.toReference(i)
181608
+ )) || null,
181455
181609
  entity: ((h = this.entity) == null ? void 0 : h.toReference(i)) || null,
181456
181610
  parent: this.parent.toReference(i)
181457
181611
  };
@@ -181608,7 +181762,10 @@ Alternatively you can update the entity with 'update' action. Or replace it by f
181608
181762
  }
181609
181763
  else if (this.entity) {
181610
181764
  const M = e.get(this.entity.id) || e.getBuiltIn(this.entity.id);
181611
- b.setEntity(M, i);
181765
+ b.setEntity(
181766
+ M,
181767
+ i
181768
+ );
181612
181769
  }
181613
181770
  return i || b.captureVersion(), i == null || i.attemptAutoclose(D.CloneEntity, this.id), b;
181614
181771
  }
@@ -181633,7 +181790,10 @@ Alternatively you can update the entity with 'update' action. Or replace it by f
181633
181790
  if (!this.checkCanEdit(this, r))
181634
181791
  return ce.warn(
181635
181792
  `[${D.MergeDataTypes}] User is not allowed to edit this ${this.type} entity with id: ${this.id}`
181636
- ), r == null || r.attemptAutoclose(D.MergeDataTypes, this.id), {
181793
+ ), r == null || r.attemptAutoclose(
181794
+ D.MergeDataTypes,
181795
+ this.id
181796
+ ), {
181637
181797
  added: [],
181638
181798
  updated: [],
181639
181799
  removed: [],
@@ -181662,7 +181822,9 @@ Alternatively you can update the entity with 'update' action. Or replace it by f
181662
181822
  if (m.implementSource) {
181663
181823
  if (((V = i == null ? void 0 : i.entity) == null ? void 0 : V.id) === ie["primitive-entity"].enum.id) {
181664
181824
  const J = new Set(this.options || []);
181665
- ((i == null ? void 0 : i.options) || []).forEach((ae) => J.add(ae)), this.metaSync(
181825
+ ((i == null ? void 0 : i.options) || []).forEach(
181826
+ (ae) => J.add(ae)
181827
+ ), this.metaSync(
181666
181828
  {
181667
181829
  options: Array.from(J)
181668
181830
  },
@@ -181708,12 +181870,21 @@ Alternatively you can update the entity with 'update' action. Or replace it by f
181708
181870
  like: i == null ? void 0 : i.like
181709
181871
  },
181710
181872
  r
181711
- ), c.push(this))), ((B = i == null ? void 0 : i.foreignKeyRef) == null ? void 0 : B.id) !== ((M = this.foreignKeyRef) == null ? void 0 : M.id) && (m.implementSource && this.foreignKeyRef ? si(this, i).compatible || (this.setForeignKeyRef((i == null ? void 0 : i.foreignKeyRef) || null, r), r == null || r.add(this, H.Updated), c.push(this), [
181873
+ ), c.push(this))), ((B = i == null ? void 0 : i.foreignKeyRef) == null ? void 0 : B.id) !== ((M = this.foreignKeyRef) == null ? void 0 : M.id) && (m.implementSource && this.foreignKeyRef ? si(
181874
+ this,
181875
+ i
181876
+ ).compatible || (this.setForeignKeyRef(
181877
+ (i == null ? void 0 : i.foreignKeyRef) || null,
181878
+ r
181879
+ ), r == null || r.add(this, H.Updated), c.push(this), [
181712
181880
  ...this.andChildrenGroup || [],
181713
181881
  ...this.orChildrenGroup || []
181714
181882
  ].forEach((ae) => {
181715
181883
  this.removeChildGroup(ae, r), f.push(ae);
181716
- }), this.setEntity(null, r)) : (this.setForeignKeyRef((i == null ? void 0 : i.foreignKeyRef) || null, r), r == null || r.add(this, H.Updated), c.push(this), [
181884
+ }), this.setEntity(null, r)) : (this.setForeignKeyRef(
181885
+ (i == null ? void 0 : i.foreignKeyRef) || null,
181886
+ r
181887
+ ), r == null || r.add(this, H.Updated), c.push(this), [
181717
181888
  ...this.andChildrenGroup || [],
181718
181889
  ...this.orChildrenGroup || []
181719
181890
  ].forEach((J) => {
@@ -181773,10 +181944,18 @@ Alternatively you can update the entity with 'update' action. Or replace it by f
181773
181944
  },
181774
181945
  r
181775
181946
  ), c.push(this)));
181776
- const _ = si(this, i);
181947
+ const _ = si(
181948
+ this,
181949
+ i
181950
+ );
181777
181951
  if (m.implementSource && _.compatible && A)
181778
- return r == null || r.attemptAutoclose(D.MergeDataTypes, this.id), {
181779
- added: C(e),
181952
+ return r == null || r.attemptAutoclose(
181953
+ D.MergeDataTypes,
181954
+ this.id
181955
+ ), {
181956
+ added: C(
181957
+ e
181958
+ ),
181780
181959
  updated: C(
181781
181960
  c
181782
181961
  ),
@@ -181797,17 +181976,28 @@ Alternatively you can update the entity with 'update' action. Or replace it by f
181797
181976
  r
181798
181977
  ), J = !0, i.orChildrenGroup.find(
181799
181978
  (ee) => si(this, ee).exact
181800
- ) || (this.orChildrenGroup = null, this.chooseOneFromOrGroupAndApply(i, r))), !J) {
181801
- const ae = [...i == null ? void 0 : i.orChildrenGroup];
181979
+ ) || (this.orChildrenGroup = null, this.chooseOneFromOrGroupAndApply(
181980
+ i,
181981
+ r
181982
+ ))), !J) {
181983
+ const ae = [
181984
+ ...i == null ? void 0 : i.orChildrenGroup
181985
+ ];
181802
181986
  this.orChildrenGroup = this.orChildrenGroup || [];
181803
181987
  const ee = [...this.orChildrenGroup || []];
181804
181988
  for (; ae.length > 0; ) {
181805
181989
  const se = ae.shift();
181806
181990
  let de = ee == null ? void 0 : ee.find(
181807
- (z) => si(z, se).exact
181991
+ (z) => si(
181992
+ z,
181993
+ se
181994
+ ).exact
181808
181995
  );
181809
181996
  if (de || (de = ee == null ? void 0 : ee.find(
181810
- (z) => si(z, se).compatible
181997
+ (z) => si(
181998
+ z,
181999
+ se
182000
+ ).compatible
181811
182001
  )), !de) {
181812
182002
  const z = ae.findIndex(
181813
182003
  (Y) => ee == null ? void 0 : ee.some(
@@ -181833,9 +182023,13 @@ Alternatively you can update the entity with 'update' action. Or replace it by f
181833
182023
  if (de) {
181834
182024
  const z = ee.indexOf(de);
181835
182025
  z !== -1 && ee.splice(z, 1);
181836
- const Y = de.merge(se, r, {
181837
- implementSource: m.implementSource
181838
- });
182026
+ const Y = de.merge(
182027
+ se,
182028
+ r,
182029
+ {
182030
+ implementSource: m.implementSource
182031
+ }
182032
+ );
181839
182033
  c.push(...Y.updated), e.push(...Y.added), f.push(...Y.removed), h.push(...Y.affected);
181840
182034
  } else if (m.implementSource) {
181841
182035
  const z = se.implement(
@@ -181857,8 +182051,14 @@ Alternatively you can update the entity with 'update' action. Or replace it by f
181857
182051
  }
181858
182052
  [...this.orChildrenGroup || []].forEach((se) => {
181859
182053
  ((i == null ? void 0 : i.orChildrenGroup) || []).find(
181860
- (z) => si(se, z).compatible
181861
- ) || (se.remove({ ignoreUpstream: !1 }, r), f.push(se));
182054
+ (z) => si(
182055
+ se,
182056
+ z
182057
+ ).compatible
182058
+ ) || (se.remove(
182059
+ { ignoreUpstream: !1 },
182060
+ r
182061
+ ), f.push(se));
181862
182062
  });
181863
182063
  }
181864
182064
  }
@@ -181879,10 +182079,19 @@ Alternatively you can update the entity with 'update' action. Or replace it by f
181879
182079
  ((i == null ? void 0 : i.andChildrenGroup) || []).find(
181880
182080
  (ee) => si(J, ee).compatible
181881
182081
  ) || (J.remove({ ignoreUpstream: !1 }, r), f.push(J));
181882
- })), r == null || r.attemptAutoclose(D.MergeDataTypes, this.id), {
181883
- updated: C(c),
181884
- added: C(e),
181885
- removed: C(f),
182082
+ })), r == null || r.attemptAutoclose(
182083
+ D.MergeDataTypes,
182084
+ this.id
182085
+ ), {
182086
+ updated: C(
182087
+ c
182088
+ ),
182089
+ added: C(
182090
+ e
182091
+ ),
182092
+ removed: C(
182093
+ f
182094
+ ),
181886
182095
  affected: C(
181887
182096
  h
181888
182097
  ),
@@ -181902,7 +182111,10 @@ Alternatively you can update the entity with 'update' action. Or replace it by f
181902
182111
  )) {
181903
182112
  return this.checkCanEdit(this, r) ? (this.andChildrenGroup || (this.andChildrenGroup = []), this.andChildrenGroup.includes(i) || (this.andChildrenGroup.push(i), r == null || r.add(i, H.Affected), this.entity && this.setEntity(null, r), this.foreignKeyRef && this.setForeignKeyRef(null, r)), r == null || r.attemptAutoclose(D.AddToAndGroup, this.id), this) : (ce.warn(
181904
182113
  `[${D.AddToAndGroup}] User is not allowed to edit this ${this.type} entity with id: ${this.id}`
181905
- ), r == null || r.attemptAutoclose(D.AddToAndGroup, this.id), this);
182114
+ ), r == null || r.attemptAutoclose(
182115
+ D.AddToAndGroup,
182116
+ this.id
182117
+ ), this);
181906
182118
  }
181907
182119
  // Add a child to the 'or' group
181908
182120
  addToOrGroup(i, r = this.project.addChangeSet(
@@ -181917,7 +182129,10 @@ Alternatively you can update the entity with 'update' action. Or replace it by f
181917
182129
  )) {
181918
182130
  return this.checkCanEdit(this, r) ? (this.orChildrenGroup || (this.orChildrenGroup = []), this.orChildrenGroup.includes(i) || (this.orChildrenGroup.push(i), r == null || r.add(i, H.Affected), this.entity && this.setEntity(null, r), this.foreignKeyRef && this.setForeignKeyRef(null, r)), r == null || r.attemptAutoclose(D.AddToOrGroup, this.id), this) : (ce.warn(
181919
182131
  `[${D.AddToOrGroup}] User is not allowed to edit this ${this.type} entity with id: ${this.id}`
181920
- ), r == null || r.attemptAutoclose(D.AddToOrGroup, this.id), this);
182132
+ ), r == null || r.attemptAutoclose(
182133
+ D.AddToOrGroup,
182134
+ this.id
182135
+ ), this);
181921
182136
  }
181922
182137
  setForeignKeyRef(i, r = this.project.addChangeSet(
181923
182138
  new Z(
@@ -181937,7 +182152,7 @@ Alternatively you can update the entity with 'update' action. Or replace it by f
181937
182152
  this.id
181938
182153
  ), this;
181939
182154
  const a = this.foreignKeyRef;
181940
- return (a == null ? void 0 : a.id) !== (i == null ? void 0 : i.id) && (this.foreignKeyRef = i, r == null || r.add(this, H.Updated)), r == null || r.attemptAutoclose(
182155
+ return (a == null ? void 0 : a.id) !== (i == null ? void 0 : i.id) && (this.foreignKeyRef = i, this.foreignKeyRef && this.setEntity(null, r), r == null || r.add(this, H.Updated)), r == null || r.attemptAutoclose(
181941
182156
  D.SetDataTypeForeignKeyRef,
181942
182157
  this.id
181943
182158
  ), this;
@@ -181961,11 +182176,14 @@ Alternatively you can update the entity with 'update' action. Or replace it by f
181961
182176
  this.id
181962
182177
  ), this;
181963
182178
  const a = this.entity;
181964
- return (a == null ? void 0 : a.id) !== (i == null ? void 0 : i.id) && (this.entity = i, r == null || r.add(this, H.Updated), a && (a.type === d.DefinitionEntity || a.type === d.LiteralValue || a.type === d.ActionDescriptor) && ((c = a.parent) == null ? void 0 : c.id) === this.id && (a == null || a.remove({ ignoreUpstream: !0 }, r)), (e = this.orChildrenGroup) != null && e.length && this.entity && (this.orChildrenGroup.forEach((h) => {
182179
+ return (a == null ? void 0 : a.id) !== (i == null ? void 0 : i.id) && (this.entity = i, r == null || r.add(this, H.Updated), a && (a.type === d.DefinitionEntity || a.type === d.LiteralValue || a.type === d.ActionDescriptor) && ((c = a.parent) == null ? void 0 : c.id) === this.id && (a == null || a.remove(
182180
+ { ignoreUpstream: !0 },
182181
+ r
182182
+ )), (e = this.orChildrenGroup) != null && e.length && this.entity && (this.orChildrenGroup.forEach((h) => {
181965
182183
  this.removeChildGroup(h, r);
181966
182184
  }), this.orChildrenGroup = null), (f = this.andChildrenGroup) != null && f.length && this.entity && (this.andChildrenGroup.forEach((h) => {
181967
182185
  this.removeChildGroup(h, r);
181968
- }), this.andChildrenGroup = null), this.foreignKeyRef && this.setForeignKeyRef(null, r)), r == null || r.attemptAutoclose(
182186
+ }), this.andChildrenGroup = null), this.foreignKeyRef && this.entity && this.setForeignKeyRef(null, r)), r == null || r.attemptAutoclose(
181969
182187
  D.SetDataTypeEntityValue,
181970
182188
  this.id
181971
182189
  ), this;
@@ -181978,9 +182196,7 @@ Alternatively you can update the entity with 'update' action. Or replace it by f
181978
182196
  let i = !1, r = !1;
181979
182197
  if (this.parent.type !== d.DataType && this.parent.type !== d.ActionDescriptor && this.parent.type !== d.BuiltInBaseEntity && this.parent.type !== d.DefinitionEntity && this.parent.type !== d.FunctionDeclaration) {
181980
182198
  r = !0;
181981
- const c = (a = this.project.requestActiveDynamicValue(
181982
- this.parent
181983
- )) == null ? void 0 : a.value;
182199
+ const c = (a = this.project.requestActiveDynamicValue(this.parent)) == null ? void 0 : a.value;
181984
182200
  c ? !c.valueAsType && (c.value === "" || c.value === null || un(c)) && (i = !0) : i = !0;
181985
182201
  }
181986
182202
  return (this.isObject() || !this.entity || this.entity.name === ye.Untyped) && (!r || r && i);
@@ -182077,9 +182293,15 @@ Alternatively you can update the entity with 'update' action. Or replace it by f
182077
182293
  },
182078
182294
  r
182079
182295
  ), r == null || r.attemptAutoclose("infer-data-type-from-inputs", this.id), {
182080
- updated: C(c),
182081
- added: C(a),
182082
- removed: C(e),
182296
+ updated: C(
182297
+ c
182298
+ ),
182299
+ added: C(
182300
+ a
182301
+ ),
182302
+ removed: C(
182303
+ e
182304
+ ),
182083
182305
  affected: C(
182084
182306
  f
182085
182307
  ),
@@ -182098,9 +182320,11 @@ Alternatively you can update the entity with 'update' action. Or replace it by f
182098
182320
  )) {
182099
182321
  var f, h, m, b;
182100
182322
  const r = [], a = [], c = [], e = [];
182101
- if (this.entity && this.andChildrenGroup && this.andChildrenGroup.length === 0 && this.orChildrenGroup && this.orChildrenGroup.length === 0 ? ([...this.andChildrenGroup, ...this.orChildrenGroup].forEach((E) => {
182102
- this.removeChildGroup(E, i);
182103
- }), this.andChildrenGroup = null, this.orChildrenGroup = null, i == null || i.add(this, H.Updated), a.push(this)) : !this.entity && this.andChildrenGroup && this.orChildrenGroup && (((f = this.andChildrenGroup) == null ? void 0 : f.length) > 0 && ((h = this.orChildrenGroup) == null ? void 0 : h.length) === 0 ? this.orChildrenGroup = null : ((m = this.orChildrenGroup) == null ? void 0 : m.length) > 0 && ((b = this.andChildrenGroup) == null ? void 0 : b.length) === 0 && (this.andChildrenGroup = null)), this.entity && this.foreignKeyRef)
182323
+ if (this.entity && this.andChildrenGroup && this.andChildrenGroup.length === 0 && this.orChildrenGroup && this.orChildrenGroup.length === 0 ? ([...this.andChildrenGroup, ...this.orChildrenGroup].forEach(
182324
+ (E) => {
182325
+ this.removeChildGroup(E, i);
182326
+ }
182327
+ ), this.andChildrenGroup = null, this.orChildrenGroup = null, i == null || i.add(this, H.Updated), a.push(this)) : !this.entity && this.andChildrenGroup && this.orChildrenGroup && (((f = this.andChildrenGroup) == null ? void 0 : f.length) > 0 && ((h = this.orChildrenGroup) == null ? void 0 : h.length) === 0 ? this.orChildrenGroup = null : ((m = this.orChildrenGroup) == null ? void 0 : m.length) > 0 && ((b = this.andChildrenGroup) == null ? void 0 : b.length) === 0 && (this.andChildrenGroup = null)), this.entity && this.foreignKeyRef)
182104
182328
  return i == null || i.attemptAutoclose(
182105
182329
  "best-effort-clear-incompatible-properties",
182106
182330
  this.id
@@ -182108,7 +182332,9 @@ Alternatively you can update the entity with 'update' action. Or replace it by f
182108
182332
  updated: C(
182109
182333
  a
182110
182334
  ),
182111
- added: C(r),
182335
+ added: C(
182336
+ r
182337
+ ),
182112
182338
  removed: C(
182113
182339
  c
182114
182340
  ),
@@ -182130,9 +182356,15 @@ Alternatively you can update the entity with 'update' action. Or replace it by f
182130
182356
  "best-effort-clear-incompatible-properties",
182131
182357
  this.id
182132
182358
  ), {
182133
- updated: C(a),
182134
- added: C(r),
182135
- removed: C(c),
182359
+ updated: C(
182360
+ a
182361
+ ),
182362
+ added: C(
182363
+ r
182364
+ ),
182365
+ removed: C(
182366
+ c
182367
+ ),
182136
182368
  affected: C(
182137
182369
  e
182138
182370
  ),
@@ -182184,7 +182416,10 @@ Alternatively you can update the entity with 'update' action. Or replace it by f
182184
182416
  h.length ? this.setEntity(h[0].entity, r) : f.length && this.setEntity(f[0].entity, r);
182185
182417
  }
182186
182418
  }
182187
- return r == null || r.attemptAutoclose("choose-one-from-or-group-and-apply", this.id), this;
182419
+ return r == null || r.attemptAutoclose(
182420
+ "choose-one-from-or-group-and-apply",
182421
+ this.id
182422
+ ), this;
182188
182423
  }
182189
182424
  implement(i, r = this.project.addChangeSet(
182190
182425
  new Z(