@unlaxer/tramli 1.2.1 → 1.2.2

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.
@@ -24,6 +24,8 @@ export declare class FlowInstance<S extends string> {
24
24
  get exitState(): string | null;
25
25
  get isCompleted(): boolean;
26
26
  get activeSubFlow(): FlowInstance<any> | null;
27
+ /** Return a copy with the given version. For FlowStore optimistic locking. */
28
+ withVersion(newVersion: number): FlowInstance<S>;
27
29
  /** @internal */ transitionTo(state: S): void;
28
30
  /** @internal */ incrementGuardFailure(): void;
29
31
  /** @internal */ complete(exitState: string): void;
@@ -47,6 +47,12 @@ export class FlowInstance {
47
47
  get exitState() { return this._exitState; }
48
48
  get isCompleted() { return this._exitState !== null; }
49
49
  get activeSubFlow() { return this._activeSubFlow; }
50
+ /** Return a copy with the given version. For FlowStore optimistic locking. */
51
+ withVersion(newVersion) {
52
+ const copy = FlowInstance.restore(this.id, this.sessionId, this.definition, this.context, this._currentState, this.createdAt, this.expiresAt, this._guardFailureCount, newVersion, this._exitState);
53
+ copy.setActiveSubFlow(this._activeSubFlow);
54
+ return copy;
55
+ }
50
56
  /** @internal */ transitionTo(state) { this._currentState = state; }
51
57
  /** @internal */ incrementGuardFailure() { this._guardFailureCount++; }
52
58
  /** @internal */ complete(exitState) { this._exitState = exitState; }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unlaxer/tramli",
3
- "version": "1.2.1",
3
+ "version": "1.2.2",
4
4
  "description": "Constrained flow engine — state machines that prevent invalid transitions at build time",
5
5
  "type": "module",
6
6
  "exports": {