@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/index.d.mts CHANGED
@@ -32,6 +32,7 @@ declare class ScopeOutputData {
32
32
  };
33
33
  get variableEngine(): VariableEngine;
34
34
  get globalVariableTable(): IVariableTable;
35
+ get version(): number;
35
36
  /**
36
37
  * @deprecated use onListOrAnyVarChange instead
37
38
  */
@@ -77,8 +78,11 @@ declare class ScopeAvailableData {
77
78
  clear: (key?: string | symbol) => void;
78
79
  };
79
80
  get globalVariableTable(): IVariableTable;
81
+ protected _version: number;
80
82
  protected refresh$: Subject<void>;
81
83
  protected _variables: VariableDeclaration[];
84
+ get version(): number;
85
+ protected bumpVersion(): void;
82
86
  refresh(): void;
83
87
  /**
84
88
  * 监听
package/dist/index.d.ts CHANGED
@@ -32,6 +32,7 @@ declare class ScopeOutputData {
32
32
  };
33
33
  get variableEngine(): VariableEngine;
34
34
  get globalVariableTable(): IVariableTable;
35
+ get version(): number;
35
36
  /**
36
37
  * @deprecated use onListOrAnyVarChange instead
37
38
  */
@@ -77,8 +78,11 @@ declare class ScopeAvailableData {
77
78
  clear: (key?: string | symbol) => void;
78
79
  };
79
80
  get globalVariableTable(): IVariableTable;
81
+ protected _version: number;
80
82
  protected refresh$: Subject<void>;
81
83
  protected _variables: VariableDeclaration[];
84
+ get version(): number;
85
+ protected bumpVersion(): void;
82
86
  refresh(): void;
83
87
  /**
84
88
  * 监听
package/dist/index.js CHANGED
@@ -119,6 +119,9 @@ var VariableTable = class {
119
119
  this.parentTable = parentTable;
120
120
  this.table = /* @__PURE__ */ new Map();
121
121
  this.toDispose = new import_utils2.DisposableCollection();
122
+ /**
123
+ * @deprecated
124
+ */
122
125
  this.onDataChangeEmitter = new import_utils2.Emitter();
123
126
  this.variables$ = new import_rxjs.Subject();
124
127
  // 监听变量列表中的单个变量变化
@@ -143,7 +146,9 @@ var VariableTable = class {
143
146
  this.toDispose.pushAll([
144
147
  this.onDataChangeEmitter,
145
148
  // active share()
146
- this.onAnyVariableChange(() => null)
149
+ this.onAnyVariableChange(() => {
150
+ this.bumpVersion();
151
+ })
147
152
  ]);
148
153
  }
149
154
  /**
@@ -172,7 +177,7 @@ var VariableTable = class {
172
177
  return disposables;
173
178
  }
174
179
  fireChange() {
175
- this._version++;
180
+ this.bumpVersion();
176
181
  this.onDataChangeEmitter.fire();
177
182
  this.variables$.next(this.variables);
178
183
  this.parentTable?.fireChange();
@@ -180,6 +185,12 @@ var VariableTable = class {
180
185
  get version() {
181
186
  return this._version;
182
187
  }
188
+ bumpVersion() {
189
+ this._version = this._version + 1;
190
+ if (this._version === Number.MAX_SAFE_INTEGER) {
191
+ this._version = 0;
192
+ }
193
+ }
183
194
  get variables() {
184
195
  return Array.from(this.table.values());
185
196
  }
@@ -1668,6 +1679,9 @@ var ScopeOutputData = class {
1668
1679
  get globalVariableTable() {
1669
1680
  return this.scope.variableEngine.globalVariableTable;
1670
1681
  }
1682
+ get version() {
1683
+ return this.variableTable.version;
1684
+ }
1671
1685
  /**
1672
1686
  * @deprecated use onListOrAnyVarChange instead
1673
1687
  */
@@ -1739,6 +1753,7 @@ var ScopeAvailableData = class {
1739
1753
  constructor(scope) {
1740
1754
  this.scope = scope;
1741
1755
  this.memo = createMemo();
1756
+ this._version = 0;
1742
1757
  this.refresh$ = new import_rxjs4.Subject();
1743
1758
  this._variables = [];
1744
1759
  /**
@@ -1783,10 +1798,12 @@ var ScopeAvailableData = class {
1783
1798
  this._variables = _variables;
1784
1799
  this.memo.clear();
1785
1800
  this.onDataChangeEmitter.fire(this._variables);
1801
+ this.bumpVersion();
1786
1802
  this.onListOrAnyVarChangeEmitter.fire(this._variables);
1787
1803
  }),
1788
1804
  this.onAnyVariableChange(() => {
1789
1805
  this.onDataChangeEmitter.fire(this._variables);
1806
+ this.bumpVersion();
1790
1807
  this.onListOrAnyVarChangeEmitter.fire(this._variables);
1791
1808
  }),
1792
1809
  import_utils5.Disposable.create(() => {
@@ -1798,6 +1815,15 @@ var ScopeAvailableData = class {
1798
1815
  get globalVariableTable() {
1799
1816
  return this.scope.variableEngine.globalVariableTable;
1800
1817
  }
1818
+ get version() {
1819
+ return this._version;
1820
+ }
1821
+ bumpVersion() {
1822
+ this._version = this._version + 1;
1823
+ if (this._version === Number.MAX_SAFE_INTEGER) {
1824
+ this._version = 0;
1825
+ }
1826
+ }
1801
1827
  // 刷新可访问变量列表
1802
1828
  refresh() {
1803
1829
  if (this.scope.disposed) {