-
Notifications
You must be signed in to change notification settings - Fork 49
/
Copy pathengine.ts
141 lines (130 loc) · 3.55 KB
/
engine.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
import { ITEM_STATUS, EXECUTION_STATUS, NODE_ACTION, FLOW_ACTION, TOKEN_STATUS } from './Enums';
import { IItemData , IInstanceData } from './';
import { ILogger, IAppDelegate, IBPMNServer, IDefinition, IElement, Execution, Token, Item, Element, INode, Node, IServerComponent } from '../';
import { EventEmitter } from 'events';
interface IDataStore {
}
interface IToken {
id: any;
type;
execution: IExecution;
dataPath: string;
startNodeId: any;
parentToken?: IToken;
// branchNode?: any;
originItem: IItem;
path: IItem[];
loop;
currentNode: any;
processId: any;
status: TOKEN_STATUS;
data;
currentItem: IItem;
lastItem: IItem;
firstItem: Item;
childrenTokens: Token[];
save(): {
id: any;
type;
status: TOKEN_STATUS;
dataPath: string;
loopId: any;
parentToken: any;
originItem: any;
startNodeId: any;
currentNode: any;
};
resume(): void;
stop(): void;
processError()
restored(): void;
getChildrenTokens(): any[];
preExecute(): Promise<boolean>;
preNext(): Promise<boolean>;
/**
* this is the primary exectuion method for a token
*/
execute(inputData): Promise<any>;
appendData(inputData: any,item: IItem): void;
/**
* is called by Gateways to cancel current token
*
* */
terminate(): void;
signal(data: any): Promise<any>;
getFullPath(fullPath?: any): Item[];
end(): Promise<void>;
goNext(): Promise<void>;
getSubProcessToken(): IToken;
log(...msg: any): void;
error(msg: any): void;
}
interface IExecution extends IServerComponent {
instance: IInstanceData;
server: IBPMNServer;
tokens: Map<any, IToken>;
definition: IDefinition;
appDelegate: IAppDelegate;
logger: ILogger;
process: any;
promises;
listener;
isLocked:boolean;
errors;
item;
messageMatchingKey;
worker;
userName;
id;
status;
options;
name;
getNodeById(id: any): Node;
getToken(id: number): IToken;
tokenEnded(token: IToken): void;
getItemsData(): IItemData[];
save(): Promise<void>;
end(): Promise<void>;
/**
*
* causes the execution to stop from running any further
* */
stop(): void;
terminate(): void;
execute(startNodeId?: any, inputData?: {}): Promise<void>;
/**
*
* invoke scenarios:
* itemId
* elementId - but only one is active
* elementId - for a startEvent in a secondary process
*
* @param executionId
* @param inputData
*/
signalItem(executionId: any, inputData: any,options?:{}): Promise<IExecution>;
signalEvent(executionId: any, inputData: any,options?:{}): Promise<IExecution>;
signalRepeatTimerEvent(executionId,prevItem, inputData:any,options?:{}): Promise<IExecution>;
getItems(query?: any): IItem[];
getState(): IInstanceData;
restored(): void;
resume(): void;
report(): void;
uids: {};
getNewId(scope: string): number;
getUUID(): any;
doExecutionEvent(process:any, event: any): Promise<any>;
doItemEvent(item: any, event: any): Promise<any>;
log(...msg: any): void;
error(msg: any): void;
appendData(inputData: any,item:IItem, dataPath?: any,assignment?:any): void;
getData(dataPath: any): any;
getAndCreateData(dataPath: any, asArray?: boolean): any;
}
interface IItem extends IItemData {
element: Element;
token: Token;
context: IExecution;
node: Node;
}
export { IItem, IToken, IExecution}