@elyx-code/project-logic-tree 0.0.6433 → 0.0.6435

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 CHANGED
@@ -2124,8 +2124,8 @@ export declare class ConditionState extends VersionedState implements ICondition
2124
2124
  getErrors(): EntityError[];
2125
2125
  getShallowErrors(): EntityError[];
2126
2126
  clone(changeSet?: ChangeSet | null, parent?: EntryPointEntityState | ProjectState | ConditionState | null, newId?: string | null, subscribe?: boolean): ConditionState;
2127
- addToAndGroup(child: ConditionState): ConditionState;
2128
- addToOrGroup(child: ConditionState): ConditionState;
2127
+ addToAndGroup(child: ConditionState, changeSet?: ChangeSet | null): ConditionState;
2128
+ addToOrGroup(child: ConditionState, changeSet?: ChangeSet | null): ConditionState;
2129
2129
  removeUnrecognizedInputs(changeSet?: ChangeSet | null): IChangeSet<ConditionState>;
2130
2130
  syncInputs(changeSet?: ChangeSet | null): IChangeSet<ConditionState>;
2131
2131
  getUnusedInputs(): ActionInputMapState[];
@@ -2587,8 +2587,8 @@ export declare class DataTypeState extends VersionedState implements IDataType,
2587
2587
  getShallowErrors(): EntityError[];
2588
2588
  clone(changeSet?: ChangeSet | null, parent?: PropertyState | VariableDeclarationState | ArgumentDeclarationState | ReturnDeclarationState | ValueDescriptorState | InputMapState | OutputMapState | DataTypeState | null, newId?: string | null, subscribe?: boolean): DataTypeState;
2589
2589
  merge(sourceEntity: DataTypeState, changeSet?: ChangeSet | null): IChangeSet<DataTypeState>;
2590
- addToAndGroup(child: DataTypeState): DataTypeState;
2591
- addToOrGroup(child: DataTypeState): DataTypeState;
2590
+ addToAndGroup(child: DataTypeState, changeSet?: ChangeSet | null): DataTypeState;
2591
+ addToOrGroup(child: DataTypeState, changeSet?: ChangeSet | null): DataTypeState;
2592
2592
  setEntity(entity: DefinitionEntityState | PrimitiveEntityState | ActionDescriptorState | BuiltInBaseEntityState | LiteralValueState | null, changeSet?: ChangeSet | null): DataTypeState;
2593
2593
  isObject(): boolean;
2594
2594
  canBeObject(): boolean;
package/dist/index.js CHANGED
@@ -35275,37 +35275,38 @@ Alternatively you can update the entity with 'update' action. Or replace it by f
35275
35275
  "update-with-shallow-transfer"
35276
35276
  )
35277
35277
  )) {
35278
+ var o, p;
35278
35279
  if (this.metaSync(i, a), this.version = i.version, this.createdAt = i.createdAt, this.author = i.author, this.deleted = i.deleted, this.previousVersion = i.previousVersion, this.unsubscribeFromDependencies(), i.parent) {
35279
- const o = Z(i.parent), p = this.project.get(o), e = this.parent;
35280
- if (e && e.id !== (p == null ? void 0 : p.id) && this.removeFromParent(a), p)
35281
- this.setParent(p, a), this.addSelfToProject(a);
35280
+ const e = Z(i.parent), y = this.project.get(e), v = this.parent;
35281
+ if (v && v.id !== (y == null ? void 0 : y.id) && this.removeFromParent(a), y)
35282
+ this.setParent(y, a), this.addSelfToProject(a);
35282
35283
  else
35283
35284
  throw a == null || a.attemptAutoclose("update-with-shallow-transfer", this.id), new Error(
35284
- `${this.type} with id '${this.id}' has a 'parent' reference '${o}' that isn't found in the project`
35285
+ `${this.type} with id '${this.id}' has a 'parent' reference '${e}' that isn't found in the project`
35285
35286
  );
35286
35287
  } else
35287
35288
  throw a == null || a.attemptAutoclose("update-with-shallow-transfer", this.id), new Error(`${this.type} with id '${this.id}' must have a 'parent'`);
35288
35289
  if (i.entity) {
35289
- const o = Z(i.entity), p = this.project.get(o);
35290
- p && (p.type === f.DefinitionEntity && p.parent === this || this.setEntity(p, null));
35290
+ const e = Z(i.entity), y = this.project.get(e);
35291
+ y && (y.type === f.DefinitionEntity && y.parent === this || this.setEntity(y, null));
35291
35292
  }
35292
- return i.andChildrenGroup && (this.andChildrenGroup = i.andChildrenGroup.map(
35293
- (o) => {
35294
- const p = Z(o), e = this.project.get(p);
35295
- if (e && !(e.type === f.DataType && e.parent === this))
35296
- return e;
35297
- }
35298
- ).filter(
35299
- (o) => !!o
35300
- )), i.orChildrenGroup && (this.orChildrenGroup = i.orChildrenGroup.map(
35301
- (o) => {
35302
- const p = Z(o), e = this.project.get(p);
35303
- if (e && !(e.type === f.DataType && e.parent === this))
35304
- return e;
35305
- }
35306
- ).filter(
35307
- (o) => !!o
35308
- )), this.captureVersion(), this.subscribeToDependencies(), a == null || a.attemptAutoclose("update-with-shallow-transfer", this.id), this;
35293
+ return (o = i.andChildrenGroup) == null || o.forEach((e) => {
35294
+ const y = Z(e), v = this.project.get(y);
35295
+ v && (this.addToAndGroup(v, a), v.setParent(this, a));
35296
+ }), [...this.andChildrenGroup || []].forEach((e) => {
35297
+ var v;
35298
+ ((v = i.andChildrenGroup) == null ? void 0 : v.find(
35299
+ (E) => Z(E) === e.id
35300
+ )) || (this.removeChildGroup(e, a), e.removeFromParent(a));
35301
+ }), (p = i.orChildrenGroup) == null || p.forEach((e) => {
35302
+ const y = Z(e), v = this.project.get(y);
35303
+ v && (this.addToOrGroup(v, a), v.setParent(this, a));
35304
+ }), [...this.orChildrenGroup || []].forEach((e) => {
35305
+ var v;
35306
+ ((v = i.orChildrenGroup) == null ? void 0 : v.find(
35307
+ (E) => Z(E) === e.id
35308
+ )) || (this.removeChildGroup(e, a), e.removeFromParent(a));
35309
+ }), this.captureVersion(), this.subscribeToDependencies(), a == null || a.attemptAutoclose("update-with-shallow-transfer", this.id), this;
35309
35310
  }
35310
35311
  hydrateAncestors() {
35311
35312
  const i = [], a = [], o = [], p = [];
@@ -35370,7 +35371,7 @@ Alternatively you can update the entity with 'update' action. Or replace it by f
35370
35371
  )
35371
35372
  )) {
35372
35373
  const a = [this], o = [], p = [], e = [];
35373
- return this.parent.type === f.DataType ? this.parentRelationType === wi.AndDataTypeGroup ? this.parent.addToAndGroup(this) : this.parentRelationType === wi.OrDataTypeGroup && this.parent.addToOrGroup(this) : this.parent.setDataType(this, i), e.push(this.parent), this.subscribe(), this.subscribeToDependencies(), i == null || i.attemptAutoclose("add-self-to-project", this.id), {
35374
+ return this.parent.type === f.DataType ? this.parentRelationType === wi.AndDataTypeGroup ? this.parent.addToAndGroup(this, i) : this.parentRelationType === wi.OrDataTypeGroup && this.parent.addToOrGroup(this, i) : this.parent.setDataType(this, i), e.push(this.parent), this.subscribe(), this.subscribeToDependencies(), i == null || i.attemptAutoclose("add-self-to-project", this.id), {
35374
35375
  updated: _(a),
35375
35376
  added: _(o),
35376
35377
  removed: _(p),
@@ -36046,12 +36047,30 @@ Alternatively you can update the entity with 'update' action. Or replace it by f
36046
36047
  };
36047
36048
  }
36048
36049
  // Add a child to the 'and' group
36049
- addToAndGroup(i) {
36050
- return this.andChildrenGroup || (this.andChildrenGroup = []), this.andChildrenGroup.includes(i) || this.andChildrenGroup.push(i), this;
36050
+ addToAndGroup(i, a = this.project.addChangeSet(
36051
+ new j(
36052
+ this.project,
36053
+ P.sessionAuthor,
36054
+ N().toISOString(),
36055
+ this,
36056
+ !0,
36057
+ "add-to-and-group"
36058
+ )
36059
+ )) {
36060
+ return this.andChildrenGroup || (this.andChildrenGroup = []), this.andChildrenGroup.includes(i) || (this.andChildrenGroup.push(i), a == null || a.add(i, F.Affected)), a == null || a.attemptAutoclose("add-to-and-group", this.id), this;
36051
36061
  }
36052
36062
  // Add a child to the 'or' group
36053
- addToOrGroup(i) {
36054
- return this.orChildrenGroup || (this.orChildrenGroup = []), this.orChildrenGroup.includes(i) || this.orChildrenGroup.push(i), this;
36063
+ addToOrGroup(i, a = this.project.addChangeSet(
36064
+ new j(
36065
+ this.project,
36066
+ P.sessionAuthor,
36067
+ N().toISOString(),
36068
+ this,
36069
+ !0,
36070
+ "add-to-or-group"
36071
+ )
36072
+ )) {
36073
+ return this.orChildrenGroup || (this.orChildrenGroup = []), this.orChildrenGroup.includes(i) || (this.orChildrenGroup.push(i), a == null || a.add(i, F.Affected)), a == null || a.attemptAutoclose("add-to-or-group", this.id), this;
36055
36074
  }
36056
36075
  setEntity(i, a = this.project.addChangeSet(
36057
36076
  new j(
@@ -47482,57 +47501,66 @@ If an entity is called by another, they must be in the same scope, which means t
47482
47501
  "update-with-shallow-transfer"
47483
47502
  )
47484
47503
  )) {
47504
+ var o, p;
47485
47505
  if (this.metaSync(i, a), this.version = i.version, this.createdAt = i.createdAt, this.author = i.author, this.deleted = i.deleted, this.previousVersion = i.previousVersion, i.parent) {
47486
- const o = Z(i.parent), p = this.project.get(o), e = this.parent;
47487
- if (e && e.id !== (p == null ? void 0 : p.id) && this.removeFromParent(a), p)
47488
- this.setParent(p, a), this.addSelfToProject(a);
47506
+ const e = Z(i.parent), y = this.project.get(e), v = this.parent;
47507
+ if (v && v.id !== (y == null ? void 0 : y.id) && this.removeFromParent(a), y)
47508
+ this.setParent(y, a), this.addSelfToProject(a);
47489
47509
  else
47490
47510
  throw a == null || a.attemptAutoclose("update-with-shallow-transfer", this.id), new Error(
47491
- `${this.type} with id '${this.id}' has a 'parent' reference '${o}' that isn't found in the project`
47511
+ `${this.type} with id '${this.id}' has a 'parent' reference '${e}' that isn't found in the project`
47492
47512
  );
47493
47513
  } else
47494
47514
  throw a == null || a.attemptAutoclose("update-with-shallow-transfer", this.id), new Error(`${this.type} with id '${this.id}' must have a 'parent'`);
47495
47515
  if (i.declaration) {
47496
- const o = Z(
47516
+ const e = Z(
47497
47517
  i.declaration
47498
- ), p = this.project.get(
47499
- o
47518
+ ), y = this.project.get(
47519
+ e
47500
47520
  );
47501
- p && this.setDeclaration(p);
47521
+ y && this.setDeclaration(y);
47502
47522
  }
47503
- return i.andChildrenGroup && (this.andChildrenGroup = i.andChildrenGroup.map((o) => {
47504
- const p = Z(o), e = this.project.get(p);
47505
- if (e && !(e.type === f.Condition && e.parent === this))
47506
- return e;
47507
- }).filter((o) => !!o)), i.orChildrenGroup && (this.orChildrenGroup = i.orChildrenGroup.map((o) => {
47508
- const p = Z(o), e = this.project.get(p);
47509
- if (e && !(e.type === f.Condition && e.parent === this))
47510
- return e;
47511
- }).filter((o) => !!o)), i.calledByEntry.forEach((o) => {
47512
- const p = Z(o), e = this.project.get(p);
47513
- e && (this.addEntryCaller(e, a), e.addCall(this, a));
47514
- }), [...this.calledByEntry].forEach((o) => {
47523
+ return (o = i.andChildrenGroup) == null || o.forEach((e) => {
47524
+ const y = Z(e), v = this.project.get(y);
47525
+ v && (this.addToAndGroup(v, a), v.setParent(this, a));
47526
+ }), [...this.andChildrenGroup || []].forEach((e) => {
47527
+ var v;
47528
+ ((v = i.andChildrenGroup) == null ? void 0 : v.find(
47529
+ (E) => Z(E) === e.id
47530
+ )) || (this.removeChildGroup(e, a), e.removeFromParent(a));
47531
+ }), (p = i.orChildrenGroup) == null || p.forEach((e) => {
47532
+ const y = Z(e), v = this.project.get(y);
47533
+ v && (this.addToOrGroup(v, a), v.setParent(this, a));
47534
+ }), [...this.orChildrenGroup || []].forEach((e) => {
47535
+ var v;
47536
+ ((v = i.orChildrenGroup) == null ? void 0 : v.find(
47537
+ (E) => Z(E) === e.id
47538
+ )) || (this.removeChildGroup(e, a), e.removeFromParent(a));
47539
+ }), i.calledByEntry.forEach((e) => {
47540
+ const y = Z(e), v = this.project.get(y);
47541
+ v && (this.addEntryCaller(v, a), v.addCall(this, a));
47542
+ }), [...this.calledByEntry].forEach((e) => {
47515
47543
  i.calledByEntry.find(
47516
- (e) => Z(e) === o.id
47517
- ) || (this.removeCaller(o, a), o.removeCall(this, a));
47518
- }), i.calledBySuccess.forEach((o) => {
47519
- const p = Z(o), e = this.project.get(
47520
- p
47544
+ (v) => Z(v) === e.id
47545
+ ) || (this.removeCaller(e, a), e.removeCall(this, a));
47546
+ }), i.calledBySuccess.forEach((e) => {
47547
+ const y = Z(e), v = this.project.get(
47548
+ y
47521
47549
  );
47522
- e && (this.addSuccessCaller(e, a), e.addSuccessCall(this, a));
47523
- }), [...this.calledBySuccess].forEach((o) => {
47550
+ v && (this.addSuccessCaller(v, a), v.addSuccessCall(this, a));
47551
+ }), [...this.calledBySuccess].forEach((e) => {
47524
47552
  i.calledBySuccess.find(
47525
- (e) => Z(e) === o.id
47526
- ) || (this.removeCaller(o, a), o.removeCall(this, a));
47527
- }), i.calledByError.forEach((o) => {
47528
- const p = Z(o), e = this.project.get(
47529
- p
47553
+ (v) => Z(v) === e.id
47554
+ ) || (this.removeCaller(e, a), e.removeCall(this, a));
47555
+ }), i.calledByError.forEach((e) => {
47556
+ const y = Z(e), v = this.project.get(
47557
+ y
47530
47558
  );
47531
- e && (this.addErrorCaller(e, a), e.addErrorCall(this, a));
47532
- }), [...this.calledBySuccess].forEach((o) => {
47559
+ v && (this.addErrorCaller(v, a), v.addErrorCall(this, a));
47560
+ }), [...this.calledBySuccess].forEach((e) => {
47533
47561
  i.calledBySuccess.find(
47534
- (e) => Z(e) === o.id
47535
- ) || (this.removeCaller(o, a), o.removeCall(this, a));
47562
+ (v) => Z(v) === e.id
47563
+ ) || (this.removeCaller(e, a), e.removeCall(this, a));
47536
47564
  }), this.captureVersion(), this.subscribeToDependencies(), a == null || a.attemptAutoclose("update-with-shallow-transfer", this.id), this;
47537
47565
  }
47538
47566
  hydrateAncestors() {
@@ -47619,7 +47647,7 @@ If an entity is called by another, they must be in the same scope, which means t
47619
47647
  )
47620
47648
  )) {
47621
47649
  const a = [this], o = [], p = [], e = [];
47622
- return this.parent === this.project ? this.project.addCondition(this) : this.parent.type === f.Condition && (this.parent.declaration.id === Br.And ? this.parent.addToAndGroup(this) : this.parent.declaration.id === Br.Or && this.parent.addToOrGroup(this)), this.successCalls.forEach((y) => {
47650
+ return this.parent === this.project ? this.project.addCondition(this) : this.parent.type === f.Condition && (this.parent.declaration.id === Br.And ? this.parent.addToAndGroup(this, i) : this.parent.declaration.id === Br.Or && this.parent.addToOrGroup(this, i)), this.successCalls.forEach((y) => {
47623
47651
  y.addSuccessCaller(this, i), a.push(y);
47624
47652
  }), this.errorCalls.forEach((y) => {
47625
47653
  y.addErrorCaller(this, i), a.push(y);
@@ -48387,12 +48415,30 @@ If an entity is called by another, they must be in the same scope, which means t
48387
48415
  return A.inputs = x, i == null || i.attemptAutoclose("clone-entity", this.id), A;
48388
48416
  }
48389
48417
  // Add a child to the 'and' group
48390
- addToAndGroup(i) {
48391
- return this.andChildrenGroup || (this.andChildrenGroup = []), this.andChildrenGroup.includes(i) || this.andChildrenGroup.push(i), this;
48418
+ addToAndGroup(i, a = this.project.addChangeSet(
48419
+ new j(
48420
+ this.project,
48421
+ P.sessionAuthor,
48422
+ N().toISOString(),
48423
+ this,
48424
+ !0,
48425
+ "add-to-and-group"
48426
+ )
48427
+ )) {
48428
+ return this.andChildrenGroup || (this.andChildrenGroup = []), this.andChildrenGroup.includes(i) || (this.andChildrenGroup.push(i), a == null || a.add(i, F.Affected)), a == null || a.attemptAutoclose("add-to-and-group", this.id), this;
48392
48429
  }
48393
48430
  // Add a child to the 'or' group
48394
- addToOrGroup(i) {
48395
- return this.orChildrenGroup || (this.orChildrenGroup = []), this.orChildrenGroup.includes(i) || this.orChildrenGroup.push(i), this;
48431
+ addToOrGroup(i, a = this.project.addChangeSet(
48432
+ new j(
48433
+ this.project,
48434
+ P.sessionAuthor,
48435
+ N().toISOString(),
48436
+ this,
48437
+ !0,
48438
+ "add-to-or-group"
48439
+ )
48440
+ )) {
48441
+ return this.orChildrenGroup || (this.orChildrenGroup = []), this.orChildrenGroup.includes(i) || (this.orChildrenGroup.push(i), a == null || a.add(i, F.Affected)), a == null || a.attemptAutoclose("add-to-or-group", this.id), this;
48396
48442
  }
48397
48443
  removeUnrecognizedInputs(i = this.project.addChangeSet(
48398
48444
  new j(
@@ -102993,6 +103039,8 @@ function w_t(d, u = /* @__PURE__ */ new Set(), i = {
102993
103039
  throw new Error("Entity must be a condition to be flattened");
102994
103040
  return [
102995
103041
  d,
103042
+ ...(d.andChildrenGroup || []).flatMap((a) => ye(a, u, i)),
103043
+ ...(d.orChildrenGroup || []).flatMap((a) => ye(a, u, i)),
102996
103044
  ...(d.inputs || []).flatMap((a) => ye(a, u, i)),
102997
103045
  ...(d.successCalls || []).flatMap((a) => ye(a, u, i)),
102998
103046
  ...(d.errorCalls || []).flatMap((a) => ye(a, u, i)),