@flowgram.ai/variable-core 0.3.3 → 0.3.5

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/esm/index.js CHANGED
@@ -55,6 +55,9 @@ var VariableTable = class {
55
55
  this.parentTable = parentTable;
56
56
  this.table = /* @__PURE__ */ new Map();
57
57
  this.toDispose = new DisposableCollection();
58
+ /**
59
+ * @deprecated
60
+ */
58
61
  this.onDataChangeEmitter = new Emitter();
59
62
  this.variables$ = new Subject();
60
63
  // 监听变量列表中的单个变量变化
@@ -79,7 +82,9 @@ var VariableTable = class {
79
82
  this.toDispose.pushAll([
80
83
  this.onDataChangeEmitter,
81
84
  // active share()
82
- this.onAnyVariableChange(() => null)
85
+ this.onAnyVariableChange(() => {
86
+ this.bumpVersion();
87
+ })
83
88
  ]);
84
89
  }
85
90
  /**
@@ -108,7 +113,7 @@ var VariableTable = class {
108
113
  return disposables;
109
114
  }
110
115
  fireChange() {
111
- this._version++;
116
+ this.bumpVersion();
112
117
  this.onDataChangeEmitter.fire();
113
118
  this.variables$.next(this.variables);
114
119
  this.parentTable?.fireChange();
@@ -116,6 +121,12 @@ var VariableTable = class {
116
121
  get version() {
117
122
  return this._version;
118
123
  }
124
+ bumpVersion() {
125
+ this._version = this._version + 1;
126
+ if (this._version === Number.MAX_SAFE_INTEGER) {
127
+ this._version = 0;
128
+ }
129
+ }
119
130
  get variables() {
120
131
  return Array.from(this.table.values());
121
132
  }
@@ -1620,6 +1631,9 @@ var ScopeOutputData = class {
1620
1631
  get globalVariableTable() {
1621
1632
  return this.scope.variableEngine.globalVariableTable;
1622
1633
  }
1634
+ get version() {
1635
+ return this.variableTable.version;
1636
+ }
1623
1637
  /**
1624
1638
  * @deprecated use onListOrAnyVarChange instead
1625
1639
  */
@@ -1703,6 +1717,7 @@ var ScopeAvailableData = class {
1703
1717
  constructor(scope) {
1704
1718
  this.scope = scope;
1705
1719
  this.memo = createMemo();
1720
+ this._version = 0;
1706
1721
  this.refresh$ = new Subject3();
1707
1722
  this._variables = [];
1708
1723
  /**
@@ -1747,10 +1762,12 @@ var ScopeAvailableData = class {
1747
1762
  this._variables = _variables;
1748
1763
  this.memo.clear();
1749
1764
  this.onDataChangeEmitter.fire(this._variables);
1765
+ this.bumpVersion();
1750
1766
  this.onListOrAnyVarChangeEmitter.fire(this._variables);
1751
1767
  }),
1752
1768
  this.onAnyVariableChange(() => {
1753
1769
  this.onDataChangeEmitter.fire(this._variables);
1770
+ this.bumpVersion();
1754
1771
  this.onListOrAnyVarChangeEmitter.fire(this._variables);
1755
1772
  }),
1756
1773
  Disposable3.create(() => {
@@ -1762,6 +1779,15 @@ var ScopeAvailableData = class {
1762
1779
  get globalVariableTable() {
1763
1780
  return this.scope.variableEngine.globalVariableTable;
1764
1781
  }
1782
+ get version() {
1783
+ return this._version;
1784
+ }
1785
+ bumpVersion() {
1786
+ this._version = this._version + 1;
1787
+ if (this._version === Number.MAX_SAFE_INTEGER) {
1788
+ this._version = 0;
1789
+ }
1790
+ }
1765
1791
  // 刷新可访问变量列表
1766
1792
  refresh() {
1767
1793
  if (this.scope.disposed) {