dal-engine-core-js-lib-dev 0.0.6 → 0.0.8

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.cjs CHANGED
@@ -467,8 +467,7 @@ class Behavior extends Base {
467
467
 
468
468
  class TransitionAlreadyExistsError extends DALEngineError {
469
469
  constructor (behaviorName, transitionName) {
470
- let msg = `Node with behavior named "${behaviorName}" already has a transition\
471
- to behavior "${transitionName}".`;
470
+ let msg = `Node with behavior named "${behaviorName}" already has a transition to behavior "${transitionName}".`;
472
471
  super(msg);
473
472
  }
474
473
  }
@@ -550,7 +549,7 @@ class GraphNode extends Base {
550
549
  */
551
550
  addGoToBehavior (behaviorId) {
552
551
  if (this._goToBehaviorIds.includes(behaviorId)) {
553
- throw new TransitionAlreadyExistsError(this.behaviorName, behaviorId);
552
+ throw new TransitionAlreadyExistsError(this._behavior.name, behaviorId);
554
553
  }
555
554
  this._goToBehaviorIds.push(behaviorId);
556
555
  }
@@ -799,6 +798,7 @@ class Graphs {
799
798
  * @param {String} jsonText JSON text representing the collection of graphs.
800
799
  */
801
800
  loadFromJson (jsonText) {
801
+ this._graphs = {};
802
802
  const parsed = JSON.parse(jsonText);
803
803
  Object.keys(parsed._graphs).forEach(graphId => {
804
804
  this._graphs[graphId] = new BehavioralControlGraph(parsed._graphs[graphId]);
package/dist/index.esm.js CHANGED
@@ -465,8 +465,7 @@ class Behavior extends Base {
465
465
 
466
466
  class TransitionAlreadyExistsError extends DALEngineError {
467
467
  constructor (behaviorName, transitionName) {
468
- let msg = `Node with behavior named "${behaviorName}" already has a transition\
469
- to behavior "${transitionName}".`;
468
+ let msg = `Node with behavior named "${behaviorName}" already has a transition to behavior "${transitionName}".`;
470
469
  super(msg);
471
470
  }
472
471
  }
@@ -548,7 +547,7 @@ class GraphNode extends Base {
548
547
  */
549
548
  addGoToBehavior (behaviorId) {
550
549
  if (this._goToBehaviorIds.includes(behaviorId)) {
551
- throw new TransitionAlreadyExistsError(this.behaviorName, behaviorId);
550
+ throw new TransitionAlreadyExistsError(this._behavior.name, behaviorId);
552
551
  }
553
552
  this._goToBehaviorIds.push(behaviorId);
554
553
  }
@@ -797,6 +796,7 @@ class Graphs {
797
796
  * @param {String} jsonText JSON text representing the collection of graphs.
798
797
  */
799
798
  loadFromJson (jsonText) {
799
+ this._graphs = {};
800
800
  const parsed = JSON.parse(jsonText);
801
801
  Object.keys(parsed._graphs).forEach(graphId => {
802
802
  this._graphs[graphId] = new BehavioralControlGraph(parsed._graphs[graphId]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dal-engine-core-js-lib-dev",
3
- "version": "0.0.6",
3
+ "version": "0.0.8",
4
4
  "main": "dist/index.cjs",
5
5
  "module": "dist/index.esm.js",
6
6
  "type": "module",
@@ -83,7 +83,7 @@ class GraphNode extends Base {
83
83
  */
84
84
  addGoToBehavior (behaviorId) {
85
85
  if (this._goToBehaviorIds.includes(behaviorId)) {
86
- throw new TransitionAlreadyExistsError(this.behaviorName, behaviorId);
86
+ throw new TransitionAlreadyExistsError(this._behavior.name, behaviorId);
87
87
  }
88
88
  this._goToBehaviorIds.push(behaviorId);
89
89
  }
@@ -24,6 +24,7 @@ class Graphs {
24
24
  * @param {String} jsonText JSON text representing the collection of graphs.
25
25
  */
26
26
  loadFromJson (jsonText) {
27
+ this._graphs = {};
27
28
  const parsed = JSON.parse(jsonText);
28
29
  Object.keys(parsed._graphs).forEach(graphId => {
29
30
  this._graphs[graphId] = new BehavioralControlGraph(parsed._graphs[graphId]);
@@ -2,8 +2,7 @@ import DALEngineError from "./DALEngineError";
2
2
 
3
3
  class TransitionAlreadyExistsError extends DALEngineError {
4
4
  constructor (behaviorName, transitionName) {
5
- let msg = `Node with behavior named "${behaviorName}" already has a transition\
6
- to behavior "${transitionName}".`;
5
+ let msg = `Node with behavior named "${behaviorName}" already has a transition to behavior "${transitionName}".`;
7
6
  super(msg);
8
7
  }
9
8
  }