@elyx-code/project-logic-tree 0.0.6705 → 0.0.6707

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
@@ -79955,11 +79955,11 @@ class Z extends qf {
79955
79955
  // Sometimes when a change set is done, it contains entities that the project doesn't
79956
79956
  // Here we remove any entities that are present in the change-set but not the project
79957
79957
  discardOrphans() {
79958
- this.added[this.project.id] && (this.updatedIds.forEach((e) => {
79958
+ console.log("[discardOrphans] start"), this.added[this.project.id] && (console.log("[discardOrphans] project is in added list, moving updated to added"), this.updatedIds.forEach((e) => {
79959
79959
  const y = this.updated[e];
79960
79960
  this.added[e] = y, delete this.updated[e];
79961
79961
  }), this.removedIds.forEach((e) => {
79962
- this.remove(e);
79962
+ console.log("[discardOrphans] removedIds:", e), this.remove(e);
79963
79963
  }));
79964
79964
  const i = [
79965
79965
  ...this.addedIds,
@@ -79971,8 +79971,8 @@ class Z extends qf {
79971
79971
  (e) => !s.includes(e)
79972
79972
  ).forEach((e) => {
79973
79973
  const y = this.get(e);
79974
- this.logger.warn(
79975
- `Entity ${y == null ? void 0 : y.type} with id "${e}" present in change-set but not in project. Removing from change-set.`
79974
+ console.warn(
79975
+ `[discardOrphans] Entity ${y == null ? void 0 : y.type} with id "${e}" present in change-set but not in project. Removing from change-set.`
79976
79976
  ), this.remove(e);
79977
79977
  }), this.added[this.project.id]) {
79978
79978
  const e = [
@@ -79996,14 +79996,16 @@ class Z extends qf {
79996
79996
  }
79997
79997
  }
79998
79998
  async discardOrphansAsync(i = {}) {
79999
+ console.log("[discardOrphansAsync] start");
79999
80000
  const n = Ke.from(i), s = this.project.toFlatIds();
80000
80001
  if (this.added[this.project.id]) {
80002
+ console.log("[discardOrphansAsync] project is in added list, moving updated to added");
80001
80003
  for (const m of this.updatedIds) {
80002
80004
  const v = this.updated[m];
80003
80005
  this.added[m] = v, delete this.updated[m], await n.tick();
80004
80006
  }
80005
80007
  for (const m of this.removedIds)
80006
- this.remove(m), await n.tick();
80008
+ console.log("[discardOrphansAsync] removedIds:", m), this.remove(m), await n.tick();
80007
80009
  }
80008
80010
  const c = [
80009
80011
  ...this.addedIds,
@@ -80015,8 +80017,8 @@ class Z extends qf {
80015
80017
  );
80016
80018
  for (const m of y) {
80017
80019
  const v = this.get(m);
80018
- this.logger.warn(
80019
- `Entity ${v == null ? void 0 : v.type} with id "${m}" present in change-set but not in project. Removing from change-set.`
80020
+ console.warn(
80021
+ `[discardOrphansAsync] Entity ${v == null ? void 0 : v.type} with id "${m}" present in change-set but not in project. Removing from change-set.`
80020
80022
  ), this.remove(m), await n.tick();
80021
80023
  }
80022
80024
  if (this.added[this.project.id]) {
@@ -80101,9 +80103,9 @@ class Z extends qf {
80101
80103
  `Change-set (${this.id}) is already closed or in the process of closing.`
80102
80104
  ), this;
80103
80105
  const c = i.awaitBeforeClose ?? !0, e = i.awaitExternalPersist ?? !0;
80104
- return this.startedClose || (this.startedClose = !0, c ? await this.beforeCloseAsync({ tracker: n }) : this.beforeCloseAsync({ tracker: n })), !this.isValid && this.self && !this.added[this.self.id] && !this.updated[this.self.id] && this.removed[this.self.id], await this.discardOrphansAsync({ tracker: n }), await this.sanitizeAsync({ tracker: n }), await this.recursiveCaptureUpstreamVersionsAsync({ tracker: n }), this.lockedVersions || (await this.captureAllChangesInVersionInstancesAsync({ tracker: n }), await this.recursiveCaptureUpstreamVersionsAsync({ tracker: n })), this.open = !1, this.isEmpty ? (this.logger.warn(
80106
+ return this.startedClose || (this.startedClose = !0, c ? await this.beforeCloseAsync({ tracker: n }) : this.beforeCloseAsync({ tracker: n })), !this.isValid && this.self && !this.added[this.self.id] && !this.updated[this.self.id] && this.removed[this.self.id], await this.discardOrphansAsync({ tracker: n }), await this.sanitizeAsync({ tracker: n }), await this.recursiveCaptureUpstreamVersionsAsync({ tracker: n }), this.lockedVersions || (await this.captureAllChangesInVersionInstancesAsync({ tracker: n }), await this.recursiveCaptureUpstreamVersionsAsync({ tracker: n })), this.open = !1, this.isEmpty ? (console.warn(
80105
80107
  `[ChangeSet.closeAsync] Empty change-set (${this.id}) discarded upon closing.`
80106
- ), this.dirty = !1, this.project.discardChangeSet(this), this.logger.log("[ChangeSet.closeAsync] Closing pending change-sets..."), this.project.closePersistChangeSetsSequentially(), this) : (this.project.emit(
80108
+ ), this.dirty = !1, this.project.discardChangeSet(this), console.log("[ChangeSet.closeAsync] Closing pending change-sets..."), this.project.closePersistChangeSetsSequentially(), this) : (this.project.emit(
80107
80109
  Yt.CHANGE_SET_CLOSED_BEFORE_PERSIST,
80108
80110
  this
80109
80111
  ), e ? s.persistType === "parallel" ? await this.project.persistChangeSetInParallel(this) : await this.project.persistChangeSetSequentially(this) : s.persistType === "parallel" ? this.project.persistChangeSetInParallel(this) : this.project.persistChangeSetSequentially(this), this.destroy(), this);
@@ -80247,9 +80249,9 @@ class Z extends qf {
80247
80249
  `Change-set (${this.id}) is already closed or in the process of closing.`
80248
80250
  ), this;
80249
80251
  if (this.startedClose || (this.startedClose = !0, this.beforeClose()), !this.isValid && this.self && !this.added[this.self.id] && !this.updated[this.self.id] && this.removed[this.self.id], this.discardOrphans(), this.sanitize(), this.captureAllChangesInVersionInstances(), this.lockedVersions || (this.recursiveCaptureUpstreamVersions(), this.captureAllChangesInVersionInstances()), this.open = !1, this.isEmpty)
80250
- return this.logger.warn(
80252
+ return console.warn(
80251
80253
  `[ChangeSet.close] Empty change-set (${this.id}) discarded upon closing.`
80252
- ), this.project.discardChangeSet(this), this.logger.log("[ChangeSet.close] Closing pending change-sets..."), this.project.closePersistChangeSetsSequentially(), this;
80254
+ ), this.project.discardChangeSet(this), console.log("[ChangeSet.close] Closing pending change-sets..."), this.project.closePersistChangeSetsSequentially(), this;
80253
80255
  if (this.added[this.project.id] && this.updatedIds.length)
80254
80256
  throw new Error(
80255
80257
  "No 'updated' entities should be present in the change-set when the project entity is in the 'added' list. New projects can only have newly added entities"
@@ -80282,7 +80284,7 @@ class Z extends qf {
80282
80284
  return this.added[i] ? this.added[i] : this.updated[i] ? this.updated[i] : this.removed[i] ? this.removed[i] : null;
80283
80285
  }
80284
80286
  remove(i) {
80285
- return this.has(i) && (delete this.added[i], delete this.updated[i], delete this.removed[i], delete this.affected[i], this.seenEntities = this.seenEntities.filter((n) => n !== i)), this;
80287
+ return this.has(i) && (console.log("Removing entity from change-set:", i), delete this.added[i], delete this.updated[i], delete this.removed[i], delete this.affected[i], this.seenEntities = this.seenEntities.filter((n) => n !== i)), this;
80286
80288
  }
80287
80289
  add(i, n, s = { preventRecursion: !1 }) {
80288
80290
  var e, y, m;
@@ -151744,9 +151746,14 @@ const yi = class yi extends Gr {
151744
151746
  return kf(i);
151745
151747
  }
151746
151748
  rehydrateQuery() {
151749
+ if (this.id === "search-person-by-id-id")
151750
+ debugger;
151747
151751
  if (!this.query)
151748
151752
  return "";
151749
- const i = kf(this.query), n = ty.parse(i, {
151753
+ const i = kf(this.query);
151754
+ if (this.id === "search-person-by-id-id")
151755
+ debugger;
151756
+ const n = ty.parse(i, {
151750
151757
  dialect: "sqlite",
151751
151758
  // These are optional:
151752
151759
  includeSpaces: !0
@@ -151754,12 +151761,27 @@ const yi = class yi extends Gr {
151754
151761
  // includeNewlines: true, // Adds newlines
151755
151762
  // includeComments: true, // Adds comments
151756
151763
  // includeRange: true, // Adds source code location data
151757
- }), s = gm(
151764
+ });
151765
+ if (this.id === "search-person-by-id-id")
151766
+ debugger;
151767
+ const s = gm(
151758
151768
  n,
151759
151769
  this.project,
151760
151770
  this
151761
151771
  );
151762
- return s.state ? kf(s.state.toQuery()) : "";
151772
+ if (this.id === "search-person-by-id-id")
151773
+ debugger;
151774
+ if (!s.state) {
151775
+ if (this.id === "search-person-by-id-id")
151776
+ debugger;
151777
+ return "";
151778
+ }
151779
+ if (this.id === "search-person-by-id-id")
151780
+ debugger;
151781
+ const c = kf(s.state.toQuery());
151782
+ if (this.id === "search-person-by-id-id")
151783
+ debugger;
151784
+ return c;
151763
151785
  }
151764
151786
  onProjectInitialized(i, n = this.project.addChangeSet(
151765
151787
  new Z(
@@ -152300,7 +152322,20 @@ You shouldn't have to manually update a 'parent' property. The equivalent result
152300
152322
  added: m,
152301
152323
  removed: v
152302
152324
  } = this.syncInputMaps(i);
152303
- return n.push(...y), s.push(...m), c.push(...v), this.project.initialized && (this.metaSync({ query: this.rehydrateQuery() }, i), this.state = this.queryToState(), jG(this, this.state, i)), this.inputs.sort(
152325
+ if (n.push(...y), s.push(...m), c.push(...v), this.project.initialized) {
152326
+ if (this.id === "search-person-by-id-id") {
152327
+ console.log("[afterAllChildrenInitialized] query sync");
152328
+ debugger;
152329
+ }
152330
+ const b = this.rehydrateQuery();
152331
+ if (this.id === "search-person-by-id-id") {
152332
+ console.log("[afterAllChildrenInitialized] query sync");
152333
+ debugger;
152334
+ }
152335
+ this.metaSync({ query: b }, i), this.state = this.queryToState(), jG(this, this.state, i);
152336
+ } else
152337
+ this.id === "search-person-by-id-id" && console.log("[afterAllChildrenInitialized] skipping query sync");
152338
+ return this.inputs.sort(
152304
152339
  (b, E) => {
152305
152340
  var w, V;
152306
152341
  return (b.index ?? ((w = b.declaration) == null ? void 0 : w.index)) - (E.index ?? ((V = E.declaration) == null ? void 0 : V.index));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elyx-code/project-logic-tree",
3
- "version": "0.0.6705",
3
+ "version": "0.0.6707",
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",