@dra2020/baseclient 1.0.81 → 1.0.84

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/fsm/fsm.d.ts CHANGED
@@ -3,6 +3,7 @@ export declare const FSM_STARTING: number;
3
3
  export declare const FSM_PENDING: number;
4
4
  export declare const FSM_DONE: number;
5
5
  export declare const FSM_ERROR: number;
6
+ export declare const FSM_CANCEL: number;
6
7
  export declare const FSM_RELEASED: number;
7
8
  export declare const FSM_CUSTOM1: number;
8
9
  export declare const FSM_CUSTOM2: number;
@@ -44,6 +45,7 @@ export declare class Fsm {
44
45
  get ready(): boolean;
45
46
  get iserror(): boolean;
46
47
  get isDependentError(): boolean;
48
+ cancel(): void;
47
49
  setDependentError(): void;
48
50
  clearDependentError(): void;
49
51
  get ticked(): boolean;
@@ -94,6 +94,7 @@ export interface SessionProps {
94
94
  };
95
95
  groups: any;
96
96
  xid?: string;
97
+ colors?: string;
97
98
  }
98
99
  export declare type LabelUpdate = {
99
100
  [name: string]: boolean | null;
@@ -112,6 +113,7 @@ export interface SessionUpdateProps {
112
113
  accessUpdate?: AccessMap;
113
114
  restore?: string;
114
115
  revision?: Revision;
116
+ colors?: string;
115
117
  }
116
118
  export interface SessionsIndex {
117
119
  [key: string]: SessionProps;
package/lib/fsm/fsm.ts CHANGED
@@ -1,11 +1,12 @@
1
1
  // Shared libraries
2
2
  import * as Util from '../util/all';
3
3
 
4
- // States
4
+ // States (note these are no longer bit flags - most uses create custom values incrementally from CUSTOM1)
5
5
  export const FSM_STARTING: number = 0;
6
6
  export const FSM_PENDING: number = 1<<0;
7
7
  export const FSM_DONE: number = 1<<1;
8
8
  export const FSM_ERROR: number = 1<<2;
9
+ export const FSM_CANCEL: number = 5;
9
10
  export const FSM_RELEASED: number = 1<<3;
10
11
  export const FSM_CUSTOM1: number = 1<<4;
11
12
  export const FSM_CUSTOM2: number = 1<<5;
@@ -22,7 +23,7 @@ let doLater: any = global && global.setImmediate ? setImmediate : (cb: any) => {
22
23
 
23
24
  function FsmDone(s: number): boolean
24
25
  {
25
- return (s === FSM_DONE || s === FSM_ERROR || s === FSM_RELEASED);
26
+ return (s === FSM_DONE || s === FSM_ERROR || s === FSM_RELEASED || s === FSM_CANCEL);
26
27
  }
27
28
 
28
29
  function FsmStateToString(state: number): string
@@ -151,7 +152,7 @@ export class Fsm
151
152
 
152
153
  get iserror(): boolean
153
154
  {
154
- return (this.state === FSM_ERROR);
155
+ return (this.state === FSM_ERROR || this.state === FSM_CANCEL);
155
156
  }
156
157
 
157
158
  get isDependentError(): boolean
@@ -159,6 +160,12 @@ export class Fsm
159
160
  return this.dependentError;
160
161
  }
161
162
 
163
+ cancel(): void
164
+ {
165
+ // Override if you need to do more than marking complete
166
+ this.setState(FSM_CANCEL);
167
+ }
168
+
162
169
  setDependentError(): void
163
170
  {
164
171
  this.dependentError = true;
@@ -120,6 +120,7 @@ export interface SessionProps
120
120
  xprops?: { [prop: string]: string };
121
121
  groups: any; // DT.GroupsMapIndex
122
122
  xid?: string; // external ID
123
+ colors?: string; // cached district colors (specific to OT for redistricting)
123
124
  }
124
125
 
125
126
  // True to add, False to remove
@@ -140,6 +141,7 @@ export interface SessionUpdateProps
140
141
  accessUpdate?: AccessMap;
141
142
  restore?: string; // Revision ID
142
143
  revision?: Revision; // If ID is empty, snap a new revision, otherwise label it.
144
+ colors?: string; // cached district colors (specific to OT for redistricting)
143
145
  }
144
146
 
145
147
  export interface SessionsIndex
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dra2020/baseclient",
3
- "version": "1.0.81",
3
+ "version": "1.0.84",
4
4
  "description": "Utility functions for Javascript projects.",
5
5
  "main": "dist/baseclient.js",
6
6
  "types": "./dist/all/all.d.ts",