@elyx-code/project-logic-tree 0.0.7006 → 0.0.7008

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
@@ -19168,10 +19168,10 @@ export declare enum BaseValueDescriptorIds {
19168
19168
  entityType: EntityType.LiteralValue;
19169
19169
  }
19170
19170
 
19171
- export declare interface ILiteralValueShallowTransfer extends ILiteralValue_meta, IChildEntityShallowTransfer {
19171
+ export declare interface ILiteralValueShallowTransfer extends ILiteralValue_meta {
19172
19172
  valueAsTypeSingle: LiteralValueAsTypeReference | null;
19173
19173
  valueAsTypeList: LiteralValueAsTypeReference[] | null;
19174
- parent: IDataTypeReference | IInputMapReference | IVariableDeclarationReference | IVariableInstanceReference | IArgumentDeclarationReference | IReturnStatementReference | IBreakStatementReference | IContinueStatementReference | IPropertyReference | IValueDescriptorReference;
19174
+ parent: null | IDataTypeReference | IInputMapReference | IVariableDeclarationReference | IVariableInstanceReference | IArgumentDeclarationReference | IReturnStatementReference | IBreakStatementReference | IContinueStatementReference | IPropertyReference | IValueDescriptorReference;
19175
19175
  standaloneParent?: EntityWithValueReference;
19176
19176
  }
19177
19177
 
@@ -22054,6 +22054,8 @@ export declare enum BaseValueDescriptorIds {
22054
22054
  ValueAsTypeList = "value-as-type-list"
22055
22055
  }
22056
22056
 
22057
+ export declare type LiteralValueParentState = DataTypeState | InputMapState | PropertyState | ArgumentDeclarationState | ReturnStatementState | BreakStatementState | ContinueStatementState | VariableDeclarationState | VariableInstanceState | ValueDescriptorState;
22058
+
22057
22059
  export declare type LiteralValuePayloadUnion = LiteralValueState | LiteralValueTypesUnion;
22058
22060
 
22059
22061
  export declare class LiteralValueState extends UserManagedVersionedState implements UserManagedBaseState, UserManagedEntityStateTemplate, ChildEntityBaseClass, ILiteralValue {
@@ -22067,8 +22069,8 @@ export declare enum BaseValueDescriptorIds {
22067
22069
  valueAsTypeSingle: ValueAsTypeState | null;
22068
22070
  valueAsTypeList: ValueAsTypeState[] | null;
22069
22071
  errors: EntityError[];
22070
- parent: DataTypeState | InputMapState | PropertyState | ArgumentDeclarationState | ReturnStatementState | BreakStatementState | ContinueStatementState | VariableDeclarationState | VariableInstanceState | ValueDescriptorState;
22071
- standaloneParent: EntityWithValueState;
22072
+ parent: null | DataTypeState | InputMapState | PropertyState | ArgumentDeclarationState | ReturnStatementState | BreakStatementState | ContinueStatementState | VariableDeclarationState | VariableInstanceState | ValueDescriptorState;
22073
+ standaloneParent: EntityWithValueState | null;
22072
22074
  project: ProjectState;
22073
22075
  detachedDependents: Record<EntityId, {
22074
22076
  entity: UserManagedEntityState;
package/dist/index.js CHANGED
@@ -103750,8 +103750,8 @@ const hi = class hi extends sn {
103750
103750
  R(this, "valueAsTypeSingle", null);
103751
103751
  R(this, "valueAsTypeList", null);
103752
103752
  R(this, "errors", []);
103753
- R(this, "parent");
103754
- R(this, "standaloneParent");
103753
+ R(this, "parent", null);
103754
+ R(this, "standaloneParent", null);
103755
103755
  // Parent project full state
103756
103756
  R(this, "project");
103757
103757
  R(this, "detachedDependents", {});
@@ -103879,7 +103879,8 @@ const hi = class hi extends sn {
103879
103879
  Final means the value cannot be changed during runtime, but the user can set it manually.
103880
103880
  */
103881
103881
  get isFinal() {
103882
- return !!(this.parent.type === d.Property && (this.parent.constant || this.parent.implements.some((i) => i.constant)) || this.parent.type === d.Property && this.parent.parent.type === d.DefinitionEntity && !io(this.parent.parent));
103882
+ var i, r;
103883
+ return !!(((i = this.parent) == null ? void 0 : i.type) === d.Property && (this.parent.constant || this.parent.implements.some((a) => a.constant)) || ((r = this.parent) == null ? void 0 : r.type) === d.Property && this.parent.parent.type === d.DefinitionEntity && !io(this.parent.parent));
103883
103884
  }
103884
103885
  validateGeneratedUpdate(i) {
103885
103886
  const r = [], a = [];
@@ -104462,7 +104463,7 @@ This is likely an incorrect strategy, either the '${this.type}' entity doesn't n
104462
104463
  i,
104463
104464
  D.SetParent,
104464
104465
  r
104465
- ) ? (((a = this.parent) == null ? void 0 : a.id) !== (i == null ? void 0 : i.id) && (this.parent = i, r && (r == null || r.add(this, W.Updated))), r == null || r.attemptAutoclose(D.SetParent, this.id), this) : this;
104466
+ ) ? (((a = this.parent) == null ? void 0 : a.id) !== (i == null ? void 0 : i.id) && (this.parent = i, this.standaloneParent && (this.standaloneParent = null, this.standalone = !1), r && (r == null || r.add(this, W.Updated))), r == null || r.attemptAutoclose(D.SetParent, this.id), this) : this;
104466
104467
  }
104467
104468
  setStandaloneParent(i, r = this.project.addChangeSet(
104468
104469
  new Z(
@@ -104475,15 +104476,21 @@ This is likely an incorrect strategy, either the '${this.type}' entity doesn't n
104475
104476
  )
104476
104477
  )) {
104477
104478
  var a;
104478
- return this.checkCanEditWithCounterpartAndSideEffects(
104479
+ if (!this.checkCanEditWithCounterpartAndSideEffects(
104479
104480
  this,
104480
104481
  i,
104481
104482
  D.SetStandaloneParent,
104482
104483
  r
104483
- ) ? (((a = this.standaloneParent) == null ? void 0 : a.id) !== (i == null ? void 0 : i.id) && (this.standaloneParent = i, r && (r == null || r.add(this, W.Updated))), r == null || r.attemptAutoclose(
104484
+ ))
104485
+ return this;
104486
+ if (this.project.get(this.id) && this.parent)
104487
+ throw new Error(
104488
+ "[LiteralValueState.setStandaloneParent] This literal-value belongs to the project AST and setting a standalone parent is not possible. Clone the instance, or create a separate one to be standalone."
104489
+ );
104490
+ return ((a = this.standaloneParent) == null ? void 0 : a.id) !== (i == null ? void 0 : i.id) && (this.parent && (this.removeFromParent(r), this.parent = null), this.standaloneParent = i, this.standalone = !0, r && (r == null || r.add(this, W.Updated))), r == null || r.attemptAutoclose(
104484
104491
  D.SetStandaloneParent,
104485
104492
  this.id
104486
- ), this) : this;
104493
+ ), this;
104487
104494
  }
104488
104495
  addValueAsTypeToList(i, r = this.project.addChangeSet(
104489
104496
  new Z(
@@ -105001,8 +105008,8 @@ This is likely an incorrect strategy, either the '${this.type}' entity doesn't n
105001
105008
  i
105002
105009
  )
105003
105010
  ) : null,
105004
- parent: (a = this.parent) == null ? void 0 : a.toReference(),
105005
- standaloneParent: (c = this.standaloneParent) == null ? void 0 : c.toReference()
105011
+ parent: ((a = this.parent) == null ? void 0 : a.toReference()) || null,
105012
+ standaloneParent: ((c = this.standaloneParent) == null ? void 0 : c.toReference()) || null
105006
105013
  });
105007
105014
  }
105008
105015
  toJSONClone(i = lt) {
@@ -105036,12 +105043,12 @@ This is likely an incorrect strategy, either the '${this.type}' entity doesn't n
105036
105043
  newId: null
105037
105044
  })
105038
105045
  ) : null,
105039
- parent: (m = this.parent) == null ? void 0 : m.toReference({
105046
+ parent: ((m = this.parent) == null ? void 0 : m.toReference({
105040
105047
  seenEntityMaps: i.seenEntityMaps
105041
- }),
105042
- standaloneParent: (b = this.standaloneParent) == null ? void 0 : b.toReference({
105048
+ })) || null,
105049
+ standaloneParent: ((b = this.standaloneParent) == null ? void 0 : b.toReference({
105043
105050
  seenEntityMaps: i.seenEntityMaps
105044
- })
105051
+ })) || null
105045
105052
  });
105046
105053
  }
105047
105054
  toReference(i = lt) {
@@ -105080,7 +105087,7 @@ This is likely an incorrect strategy, either the '${this.type}' entity doesn't n
105080
105087
  value: this.value,
105081
105088
  rawString: this.rawString,
105082
105089
  autogeneration: this.autogeneration,
105083
- parent: (e = this.parent) == null ? void 0 : e.toReference(i),
105090
+ parent: ((e = this.parent) == null ? void 0 : e.toReference(i)) || null,
105084
105091
  standaloneParent: (f = this.standaloneParent) == null ? void 0 : f.toReference(i)
105085
105092
  };
105086
105093
  }
@@ -181576,7 +181583,7 @@ function e5(s, p) {
181576
181583
  if (p.type === d.LiteralValue) {
181577
181584
  const e = p.parent;
181578
181585
  let f = !1;
181579
- if (e.type === d.InputMap)
181586
+ if ((e == null ? void 0 : e.type) === d.InputMap)
181580
181587
  i.push(
181581
181588
  new Ce({
181582
181589
  id: `${s.id}--${p.id}--${me.InvalidReference}`,
@@ -181592,7 +181599,7 @@ All value writing entity types are: ${It(
181592
181599
  This literal-value entity belongs to an input map entity with id "${e.id}". Input map entities are value writing entities. Is that what you meant to reference?`
181593
181600
  })
181594
181601
  );
181595
- else if (e.type === d.DataType) {
181602
+ else if ((e == null ? void 0 : e.type) === d.DataType) {
181596
181603
  const h = e, m = h.parent;
181597
181604
  qi.includes(m.type) ? i.push(
181598
181605
  new Ce({
@@ -181998,7 +182005,7 @@ function j6i(s, p) {
181998
182005
  else if (a.type === d.LiteralValue) {
181999
182006
  const e = a.parent;
182000
182007
  let f = !1;
182001
- if (e.type === d.InputMap)
182008
+ if ((e == null ? void 0 : e.type) === d.InputMap)
182002
182009
  i.push(
182003
182010
  new Ce({
182004
182011
  id: `last-action--${a.id}--${me.InvalidReference}`,
@@ -182014,7 +182021,7 @@ All value writing entity types are: ${It(
182014
182021
  This literal-value entity belongs to an input map entity with id "${e.id}". Input map entities are value writing entities. Is that what you meant to reference?`
182015
182022
  })
182016
182023
  );
182017
- else if (e.type === d.DataType) {
182024
+ else if ((e == null ? void 0 : e.type) === d.DataType) {
182018
182025
  const h = e, m = h.parent;
182019
182026
  qi.includes(m.type) ? i.push(
182020
182027
  new Ce({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elyx-code/project-logic-tree",
3
- "version": "0.0.7006",
3
+ "version": "0.0.7008",
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",