@elyx-code/project-logic-tree 0.0.6660 → 0.0.6662

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
@@ -33,6 +33,7 @@ import { IWebsocketsClient } from '@elyx-code/common-ts-utils';
33
33
  import { JoinExpr } from 'sql-parser-cst';
34
34
  import { Keyword } from 'sql-parser-cst';
35
35
  import { LimitClause } from 'sql-parser-cst';
36
+ import { LoggerInstance } from '@elyx-code/common-ts-utils';
36
37
  import { OrderByClause } from 'sql-parser-cst';
37
38
  import { PivotExpr } from 'sql-parser-cst';
38
39
  import { PostgresqlOperatorExpr } from 'sql-parser-cst';
@@ -9470,6 +9471,7 @@ export declare class ChangeSet extends Events {
9470
9471
  events: Map<string, ChangeSetEvent>;
9471
9472
  ignoreNonEditable: boolean;
9472
9473
  ignoreNonDeletable: boolean;
9474
+ logger: LoggerInstance;
9473
9475
  constructor(project: ProjectState, author: string, timestamp: string, // ISO 8601 format
9474
9476
  self: UserManagedEntityState | null, autoclose?: boolean, autoCloseActionName?: string);
9475
9477
  get index(): number | null;
package/dist/index.js CHANGED
@@ -94792,7 +94792,9 @@ class Cgi {
94792
94792
  }
94793
94793
  class q extends Bf {
94794
94794
  constructor(i, n, l, c, e = !1, y = "") {
94795
- super(y ? y + "-cs-events" : "anonymous-cs-events");
94795
+ super(
94796
+ y ? y + "-cs-events" : "anonymous-cs-events"
94797
+ );
94796
94798
  I(this, "id", x.UUID.uuid());
94797
94799
  // In order of traversal dependency
94798
94800
  I(this, "seenEntities", []);
@@ -94837,7 +94839,10 @@ class q extends Bf {
94837
94839
  I(this, "events", /* @__PURE__ */ new Map());
94838
94840
  I(this, "ignoreNonEditable", !1);
94839
94841
  I(this, "ignoreNonDeletable", !1);
94840
- if (this.project = i, this.author = n || x.sessionAuthor || "", this.timestamp = l, this.self = c, this.autoclose = e, this.autoCloseActionName = y, this.autoclose && !this.autoCloseActionName)
94842
+ I(this, "logger");
94843
+ if (this.project = i, this.author = n || x.sessionAuthor || "", this.timestamp = l, this.self = c, this.autoclose = e, this.autoCloseActionName = y, this.logger = ie.module(
94844
+ "cs:" + (this.autoCloseActionName ? this.autoCloseActionName + ":" : "") + this.id
94845
+ ), this.autoclose && !this.autoCloseActionName)
94841
94846
  throw new Error(
94842
94847
  "Auto-close change-set must have an auto-close action name."
94843
94848
  );
@@ -94886,7 +94891,7 @@ class q extends Bf {
94886
94891
  return Object.keys(this.affected);
94887
94892
  }
94888
94893
  event(i) {
94889
- ie.log(`ChangeSet Event: ${i.action} (${i.id})`);
94894
+ this.logger.log(`ChangeSet Event: ${i.action} (${i.id})`);
94890
94895
  const n = new Cgi(i, this);
94891
94896
  this.events.set(i.id, n), this.emit("change-set-event", n);
94892
94897
  }
@@ -94910,7 +94915,7 @@ class q extends Bf {
94910
94915
  (y) => !c.includes(y)
94911
94916
  ).forEach((y) => {
94912
94917
  const T = this.get(y);
94913
- ie.warn(
94918
+ this.logger.warn(
94914
94919
  `Entity ${T == null ? void 0 : T.type} with id "${y}" present in change-set but not in project. Removing from change-set.`
94915
94920
  ), this.remove(y);
94916
94921
  }), this.added[this.project.id]) {
@@ -94971,13 +94976,13 @@ class q extends Bf {
94971
94976
  ...i
94972
94977
  };
94973
94978
  if (!this.open || this.startedClose)
94974
- return ie.warn(
94979
+ return this.logger.warn(
94975
94980
  `Change-set (${this.id}) is already closed or in the process of closing.`
94976
94981
  ), this;
94977
94982
  const l = i.awaitBeforeClose ?? !0, c = i.awaitExternalPersist ?? !0;
94978
- return this.startedClose || (this.startedClose = !0, l ? await this.beforeCloseAsync() : this.beforeCloseAsync()), !this.isValid && this.self && !this.added[this.self.id] && !this.updated[this.self.id] && this.removed[this.self.id], this.discardOrphans(), this.sanitize(), this.recursiveCaptureUpstreamVersions(), this.lockedVersions || (this.captureAllChangesInVersionInstances(), this.recursiveCaptureUpstreamVersions()), this.open = !1, this.isEmpty ? (ie.warn(
94983
+ return this.startedClose || (this.startedClose = !0, l ? await this.beforeCloseAsync() : this.beforeCloseAsync()), !this.isValid && this.self && !this.added[this.self.id] && !this.updated[this.self.id] && this.removed[this.self.id], this.discardOrphans(), this.sanitize(), this.recursiveCaptureUpstreamVersions(), this.lockedVersions || (this.captureAllChangesInVersionInstances(), this.recursiveCaptureUpstreamVersions()), this.open = !1, this.isEmpty ? (this.logger.warn(
94979
94984
  `[ChangeSet.closeAsync] Empty change-set (${this.id}) discarded upon closing.`
94980
- ), this.dirty = !1, this.project.discardChangeSet(this), ie.log("[ChangeSet.closeAsync] Closing pending change-sets..."), this.project.closePersistChangeSetsSequentially(), this) : (this.project.emit(
94985
+ ), this.dirty = !1, this.project.discardChangeSet(this), this.logger.log("[ChangeSet.closeAsync] Closing pending change-sets..."), this.project.closePersistChangeSetsSequentially(), this) : (this.project.emit(
94981
94986
  Ti.CHANGE_SET_CLOSED_BEFORE_PERSIST,
94982
94987
  this
94983
94988
  ), c ? n.persistType === "parallel" ? await this.project.persistChangeSetInParallel(this) : await this.project.persistChangeSetSequentially(this) : n.persistType === "parallel" ? this.project.persistChangeSetInParallel(this) : this.project.persistChangeSetSequentially(this), this.destroy(), this);
@@ -95068,13 +95073,13 @@ class q extends Bf {
95068
95073
  ...i
95069
95074
  };
95070
95075
  if (!this.open || this.startedClose)
95071
- return ie.warn(
95076
+ return this.logger.warn(
95072
95077
  `Change-set (${this.id}) is already closed or in the process of closing.`
95073
95078
  ), this;
95074
95079
  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)
95075
- return ie.warn(
95080
+ return this.logger.warn(
95076
95081
  `[ChangeSet.close] Empty change-set (${this.id}) discarded upon closing.`
95077
- ), this.project.discardChangeSet(this), ie.log("[ChangeSet.close] Closing pending change-sets..."), this.project.closePersistChangeSetsSequentially(), this;
95082
+ ), this.project.discardChangeSet(this), this.logger.log("[ChangeSet.close] Closing pending change-sets..."), this.project.closePersistChangeSetsSequentially(), this;
95078
95083
  if (this.added[this.project.id] && this.updatedIds.length)
95079
95084
  throw new Error(
95080
95085
  "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"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elyx-code/project-logic-tree",
3
- "version": "0.0.6660",
3
+ "version": "0.0.6662",
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",
@@ -36,7 +36,7 @@
36
36
  },
37
37
  "devDependencies": {
38
38
  "@aws-sdk/client-s3": "^3.850.0",
39
- "@elyx-code/common-ts-utils": "^0.0.118",
39
+ "@elyx-code/common-ts-utils": "^0.0.119",
40
40
  "@elyx-code/compiler": "^0.0.8014",
41
41
  "@nangohq/node": "^0.58.4",
42
42
  "@nangohq/types": "^0.58.4",
@@ -54,7 +54,7 @@
54
54
  "yaml": "^2.7.1"
55
55
  },
56
56
  "peerDependencies": {
57
- "@elyx-code/common-ts-utils": "^0.0.118",
57
+ "@elyx-code/common-ts-utils": "^0.0.119",
58
58
  "sql-parser-cst": "^0.33.1"
59
59
  },
60
60
  "peerDependenciesMeta": {