bpmn-elements 17.2.2 → 18.0.0
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/README.md +3 -1
- package/dist/Api.js +83 -0
- package/dist/Context.js +228 -22
- package/dist/Environment.js +111 -31
- package/dist/EventBroker.js +57 -1
- package/dist/Expressions.js +3 -4
- package/dist/MessageFormatter.js +29 -16
- package/dist/Timers.js +13 -9
- package/dist/Tracker.js +1 -0
- package/dist/activity/Activity.js +458 -254
- package/dist/activity/ActivityExecution.js +113 -40
- package/dist/activity/Dummy.js +6 -1
- package/dist/activity/Escalation.js +36 -24
- package/dist/activity/ExecutionScope.js +1 -1
- package/dist/activity/Message.js +36 -24
- package/dist/activity/Signal.js +36 -24
- package/dist/activity/outbound-evaluator.js +1 -1
- package/dist/condition.js +12 -6
- package/dist/constants.js +21 -0
- package/dist/definition/Definition.js +182 -64
- package/dist/definition/DefinitionExecution.js +195 -82
- package/dist/error/BpmnError.js +12 -1
- package/dist/error/Errors.js +50 -9
- package/dist/eventDefinitions/CancelEventDefinition.js +29 -11
- package/dist/eventDefinitions/CompensateEventDefinition.js +51 -31
- package/dist/eventDefinitions/ConditionalEventDefinition.js +21 -9
- package/dist/eventDefinitions/ErrorEventDefinition.js +46 -30
- package/dist/eventDefinitions/EscalationEventDefinition.js +44 -27
- package/dist/eventDefinitions/EventDefinitionExecution.js +30 -23
- package/dist/eventDefinitions/LinkEventDefinition.js +45 -120
- package/dist/eventDefinitions/MessageEventDefinition.js +44 -29
- package/dist/eventDefinitions/SignalEventDefinition.js +46 -31
- package/dist/eventDefinitions/TerminateEventDefinition.js +10 -1
- package/dist/eventDefinitions/TimerEventDefinition.js +57 -37
- package/dist/eventDefinitions/index.js +20 -21
- package/dist/events/BoundaryEvent.js +52 -40
- package/dist/events/EndEvent.js +22 -8
- package/dist/events/IntermediateCatchEvent.js +26 -8
- package/dist/events/IntermediateThrowEvent.js +24 -9
- package/dist/events/StartEvent.js +30 -14
- package/dist/events/index.js +10 -11
- package/dist/flows/Association.js +50 -7
- package/dist/flows/MessageFlow.js +49 -10
- package/dist/flows/SequenceFlow.js +93 -22
- package/dist/flows/index.js +6 -7
- package/dist/gateways/EventBasedGateway.js +29 -15
- package/dist/gateways/ExclusiveGateway.js +20 -5
- package/dist/gateways/InclusiveGateway.js +21 -5
- package/dist/gateways/ParallelGateway.js +253 -15
- package/dist/gateways/index.js +8 -9
- package/dist/getPropertyValue.js +2 -2
- package/dist/index.js +42 -43
- package/dist/io/BpmnIO.js +15 -1
- package/dist/io/EnvironmentDataObject.js +29 -1
- package/dist/io/EnvironmentDataStore.js +24 -1
- package/dist/io/EnvironmentDataStoreReference.js +24 -1
- package/dist/io/InputOutputSpecification.js +21 -11
- package/dist/io/Properties.js +28 -17
- package/dist/messageHelper.js +41 -4
- package/dist/process/Lane.js +15 -4
- package/dist/process/Process.js +174 -76
- package/dist/process/ProcessExecution.js +362 -177
- package/dist/shared.js +2 -0
- package/dist/tasks/CallActivity.js +19 -4
- package/dist/tasks/LoopCharacteristics.js +94 -9
- package/dist/tasks/ReceiveTask.js +36 -21
- package/dist/tasks/ScriptTask.js +22 -6
- package/dist/tasks/ServiceImplementation.js +7 -4
- package/dist/tasks/ServiceTask.js +19 -4
- package/dist/tasks/SignalTask.js +19 -4
- package/dist/tasks/StandardLoopCharacteristics.js +8 -4
- package/dist/tasks/SubProcess.js +44 -29
- package/dist/tasks/Task.js +19 -4
- package/dist/tasks/Transaction.js +8 -4
- package/dist/tasks/index.js +16 -18
- package/package.json +31 -13
- package/src/Api.js +70 -0
- package/src/Context.js +200 -19
- package/src/Environment.js +99 -30
- package/src/EventBroker.js +46 -1
- package/src/Expressions.js +2 -3
- package/src/MessageFormatter.js +24 -16
- package/src/Timers.js +12 -9
- package/src/Tracker.js +1 -0
- package/src/activity/Activity.js +388 -231
- package/src/activity/ActivityExecution.js +93 -42
- package/src/activity/Dummy.js +6 -1
- package/src/activity/Escalation.js +25 -18
- package/src/activity/ExecutionScope.js +1 -1
- package/src/activity/Message.js +25 -18
- package/src/activity/Signal.js +25 -18
- package/src/activity/outbound-evaluator.js +1 -1
- package/src/condition.js +11 -5
- package/src/constants.js +15 -0
- package/src/definition/Definition.js +157 -62
- package/src/definition/DefinitionExecution.js +161 -83
- package/src/error/BpmnError.js +11 -1
- package/src/error/Errors.js +44 -5
- package/src/eventDefinitions/CancelEventDefinition.js +27 -13
- package/src/eventDefinitions/CompensateEventDefinition.js +48 -32
- package/src/eventDefinitions/ConditionalEventDefinition.js +20 -10
- package/src/eventDefinitions/ErrorEventDefinition.js +44 -33
- package/src/eventDefinitions/EscalationEventDefinition.js +39 -26
- package/src/eventDefinitions/EventDefinitionExecution.js +30 -24
- package/src/eventDefinitions/LinkEventDefinition.js +34 -120
- package/src/eventDefinitions/MessageEventDefinition.js +42 -31
- package/src/eventDefinitions/SignalEventDefinition.js +43 -32
- package/src/eventDefinitions/TerminateEventDefinition.js +9 -1
- package/src/eventDefinitions/TimerEventDefinition.js +53 -35
- package/src/eventDefinitions/index.js +10 -23
- package/src/events/BoundaryEvent.js +50 -39
- package/src/events/EndEvent.js +19 -7
- package/src/events/IntermediateCatchEvent.js +24 -8
- package/src/events/IntermediateThrowEvent.js +24 -8
- package/src/events/StartEvent.js +25 -14
- package/src/events/index.js +5 -18
- package/src/flows/Association.js +43 -9
- package/src/flows/MessageFlow.js +41 -10
- package/src/flows/SequenceFlow.js +82 -19
- package/src/flows/index.js +3 -4
- package/src/gateways/EventBasedGateway.js +27 -15
- package/src/gateways/ExclusiveGateway.js +16 -3
- package/src/gateways/InclusiveGateway.js +16 -3
- package/src/gateways/ParallelGateway.js +301 -10
- package/src/gateways/index.js +4 -4
- package/src/getPropertyValue.js +2 -2
- package/src/index.js +19 -19
- package/src/io/BpmnIO.js +13 -1
- package/src/io/EnvironmentDataObject.js +26 -1
- package/src/io/EnvironmentDataStore.js +22 -1
- package/src/io/EnvironmentDataStoreReference.js +22 -1
- package/src/io/InputOutputSpecification.js +17 -8
- package/src/io/Properties.js +23 -13
- package/src/messageHelper.js +36 -4
- package/src/process/Lane.js +14 -4
- package/src/process/Process.js +154 -72
- package/src/process/ProcessExecution.js +326 -175
- package/src/shared.js +1 -0
- package/src/tasks/CallActivity.js +16 -2
- package/src/tasks/LoopCharacteristics.js +77 -11
- package/src/tasks/ReceiveTask.js +33 -22
- package/src/tasks/ScriptTask.js +17 -3
- package/src/tasks/ServiceImplementation.js +6 -3
- package/src/tasks/ServiceTask.js +16 -2
- package/src/tasks/SignalTask.js +16 -2
- package/src/tasks/StandardLoopCharacteristics.js +7 -3
- package/src/tasks/SubProcess.js +37 -23
- package/src/tasks/Task.js +16 -2
- package/src/tasks/Transaction.js +7 -3
- package/src/tasks/index.js +8 -9
- package/types/bundle-errors.d.ts +1 -0
- package/types/bundle.d.ts +97 -0
- package/types/index.d.ts +2614 -84
- package/types/interfaces.d.ts +636 -0
- package/types/types.d.ts +0 -765
package/types/types.d.ts
DELETED
|
@@ -1,765 +0,0 @@
|
|
|
1
|
-
import { Broker } from 'smqp';
|
|
2
|
-
import { BrokerState } from 'smqp/types/Broker';
|
|
3
|
-
import { Consumer } from 'smqp/types/Queue';
|
|
4
|
-
import { MessageMessage, MessageFields, MessageProperties } from 'smqp/types/Message';
|
|
5
|
-
import { SerializableContext, SerializableElement } from 'moddle-context-serializer';
|
|
6
|
-
|
|
7
|
-
declare interface ElementBroker<T> extends Broker {
|
|
8
|
-
get owner(): T;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
declare type signalMessage = {
|
|
12
|
-
/**
|
|
13
|
-
* Optional signal id
|
|
14
|
-
* - Activity id
|
|
15
|
-
* - Signal-, Message-, Escalation id, etc
|
|
16
|
-
*/
|
|
17
|
-
id?: string;
|
|
18
|
-
/**
|
|
19
|
-
* Optional execution id
|
|
20
|
-
* e.g. excutionId of a parallel multi instance user task
|
|
21
|
-
*/
|
|
22
|
-
executionId?: string;
|
|
23
|
-
/** Any other input that will be added to completed activity output */
|
|
24
|
-
[x: string]: any;
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
declare interface ElementMessageContent {
|
|
28
|
-
id?: string;
|
|
29
|
-
type?: string;
|
|
30
|
-
executionId?: string;
|
|
31
|
-
parent?: ElementParent;
|
|
32
|
-
[x: string]: any;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
declare interface ElementBrokerMessage extends MessageMessage {
|
|
36
|
-
content: ElementMessageContent;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
declare class EventDefinition {
|
|
40
|
-
constructor(activity: Activity, eventDefinitionElement: SerializableElement, context?: ContextInstance, index?: number);
|
|
41
|
-
get id(): string;
|
|
42
|
-
get type(): string;
|
|
43
|
-
get executionId(): string;
|
|
44
|
-
get isThrowing(): boolean;
|
|
45
|
-
get activity(): Activity;
|
|
46
|
-
get broker(): Broker;
|
|
47
|
-
get logger(): ILogger;
|
|
48
|
-
get reference(): {
|
|
49
|
-
id?: string;
|
|
50
|
-
name: string;
|
|
51
|
-
referenceType: string;
|
|
52
|
-
};
|
|
53
|
-
[x: string]: any;
|
|
54
|
-
execute(executeMessage: ElementBrokerMessage): void;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
declare const enum TimerType {
|
|
58
|
-
TimeCycle = 'timeCycle',
|
|
59
|
-
TimeDuration = 'timeDuration',
|
|
60
|
-
TimeDate = 'timeDate',
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
type parsedTimer = {
|
|
64
|
-
/** Expires at date time */
|
|
65
|
-
expireAt?: Date;
|
|
66
|
-
/** Repeat number of times */
|
|
67
|
-
repeat?: number;
|
|
68
|
-
/** Delay in milliseconds */
|
|
69
|
-
delay?: number;
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
declare class TimerEventDefinition extends EventDefinition {
|
|
73
|
-
/**
|
|
74
|
-
* Parse timer type
|
|
75
|
-
* @param timerType type of timer
|
|
76
|
-
* @param timerValue resolved expression timer string
|
|
77
|
-
*/
|
|
78
|
-
parse(timerType: TimerType, timerValue: string): parsedTimer;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
declare interface ICondition {
|
|
82
|
-
/** Condition type */
|
|
83
|
-
get type(): string;
|
|
84
|
-
[x: string]: any;
|
|
85
|
-
execute(message: ElementBrokerMessage, callback: CallableFunction): void;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
declare class ConditionalEventDefinition extends EventDefinition {
|
|
89
|
-
/**
|
|
90
|
-
* Evaluate condition
|
|
91
|
-
* @param message
|
|
92
|
-
* @param callback
|
|
93
|
-
*/
|
|
94
|
-
evaluate(message: ElementBrokerMessage, callback: CallableFunction): void;
|
|
95
|
-
/**
|
|
96
|
-
* Handle evaluate result or error
|
|
97
|
-
* @param err Condition evaluation error
|
|
98
|
-
* @param result Result from evaluated condition, completes execution if truthy
|
|
99
|
-
*/
|
|
100
|
-
evaluateCallback(err: Error | null, result?: any): void;
|
|
101
|
-
/**
|
|
102
|
-
* Get condition from behaviour
|
|
103
|
-
* @param index Event definition sequence number, used to name registered script
|
|
104
|
-
*/
|
|
105
|
-
getCondition(index: number): ICondition | null;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
declare abstract class ElementBase {
|
|
109
|
-
get id(): string;
|
|
110
|
-
get type(): string;
|
|
111
|
-
get name(): string;
|
|
112
|
-
get parent(): ElementParent;
|
|
113
|
-
get behaviour(): SerializableElement;
|
|
114
|
-
get broker(): Broker;
|
|
115
|
-
get environment(): Environment;
|
|
116
|
-
get context(): ContextInstance;
|
|
117
|
-
get logger(): ILogger;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
declare abstract class Element<T> extends ElementBase {
|
|
121
|
-
get broker(): ElementBroker<T>;
|
|
122
|
-
stop(): void;
|
|
123
|
-
resume(): void;
|
|
124
|
-
getApi(message?: ElementBrokerMessage): Api<T>;
|
|
125
|
-
on(eventName: string, callback: CallableFunction, options?: any): Consumer;
|
|
126
|
-
once(eventName: string, callback: CallableFunction, options?: any): Consumer;
|
|
127
|
-
waitFor(eventName: string, options?: any): Promise<Api<T>>;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
declare interface ElementParent {
|
|
131
|
-
get id(): string;
|
|
132
|
-
get type(): string;
|
|
133
|
-
get executionId(): string;
|
|
134
|
-
get path(): ElementParent[];
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
declare type Extension = (activity: ElementBase, context: ContextInstance) => IExtension;
|
|
138
|
-
declare interface IExtension {
|
|
139
|
-
activate(message: ElementBrokerMessage): void;
|
|
140
|
-
deactivate(message: ElementBrokerMessage): void;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
declare interface IExpressions {
|
|
144
|
-
resolveExpression(templatedString: string, context?: any, expressionFnContext?: any): any;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
declare interface EnvironmentSettings {
|
|
148
|
-
/** true returns dummy service function for service task if not found */
|
|
149
|
-
enableDummyService?: boolean;
|
|
150
|
-
/** true forces activity runs to go forward in steps, defaults to false */
|
|
151
|
-
step?: boolean;
|
|
152
|
-
/** strict mode, see documentation, defaults to false */
|
|
153
|
-
strict?: boolean;
|
|
154
|
-
/** positive integer to control parallel loop batch size, defaults to 50 */
|
|
155
|
-
batchSize?: number;
|
|
156
|
-
/**
|
|
157
|
-
* disable tracking state between recover and resume
|
|
158
|
-
* true will only return state for elements that are actually running
|
|
159
|
-
* Defaults to falsy
|
|
160
|
-
*/
|
|
161
|
-
disableTrackState?: boolean;
|
|
162
|
-
[x: string]: any;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
declare interface EnvironmentOptions {
|
|
166
|
-
settings?: EnvironmentSettings;
|
|
167
|
-
variables?: Record<string, any>;
|
|
168
|
-
services?: Record<string, CallableFunction>;
|
|
169
|
-
Logger?: LoggerFactory;
|
|
170
|
-
timers?: ITimers;
|
|
171
|
-
scripts?: IScripts;
|
|
172
|
-
extensions?: Record<string, Extension>;
|
|
173
|
-
/**
|
|
174
|
-
* optional override expressions handler
|
|
175
|
-
*/
|
|
176
|
-
expressions?: IExpressions;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
declare type startActivityFilterOptions = {
|
|
180
|
-
/** Event definition id, i.e. Message, Signal, Error, etc */
|
|
181
|
-
referenceId?: string;
|
|
182
|
-
/** Event definition type, i.e. message, signal, error, etc */
|
|
183
|
-
referenceType?: string;
|
|
184
|
-
};
|
|
185
|
-
|
|
186
|
-
type filterPostponed = (elementApi: Api<ElementBase>) => boolean;
|
|
187
|
-
|
|
188
|
-
declare const enum DefinitionRunStatus {
|
|
189
|
-
Entered = 'entered',
|
|
190
|
-
Start = 'start',
|
|
191
|
-
Executing = 'executing',
|
|
192
|
-
End = 'end',
|
|
193
|
-
Discarded = 'discarded',
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
declare const enum ProcessRunStatus {
|
|
197
|
-
Entered = 'entered',
|
|
198
|
-
Start = 'start',
|
|
199
|
-
Executing = 'executing',
|
|
200
|
-
Errored = 'errored',
|
|
201
|
-
End = 'end',
|
|
202
|
-
Discarded = 'discarded',
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
/**
|
|
206
|
-
* Activity status
|
|
207
|
-
* Can be used to decide when to save states, Timer and Wait is recommended.
|
|
208
|
-
*/
|
|
209
|
-
declare const enum ActivityStatus {
|
|
210
|
-
/** Idle, not running anything */
|
|
211
|
-
Idle = 'idle',
|
|
212
|
-
/**
|
|
213
|
-
* At least one activity is executing,
|
|
214
|
-
* e.g. a service task making a asynchronous request
|
|
215
|
-
*/
|
|
216
|
-
Executing = 'executing',
|
|
217
|
-
/**
|
|
218
|
-
* At least one activity is waiting for a timer to complete,
|
|
219
|
-
* usually only TimerEventDefinition's
|
|
220
|
-
*/
|
|
221
|
-
Timer = 'timer',
|
|
222
|
-
/**
|
|
223
|
-
* At least one activity is waiting for a signal of some sort,
|
|
224
|
-
* e.g. user tasks, intermediate catch events, etc
|
|
225
|
-
*/
|
|
226
|
-
Wait = 'wait',
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
/**
|
|
230
|
-
* Activity run status
|
|
231
|
-
*/
|
|
232
|
-
declare const enum ActivityRunStatus {
|
|
233
|
-
/** Run entered, triggered by taken inbound flow */
|
|
234
|
-
Entered = 'entered',
|
|
235
|
-
/** Run started */
|
|
236
|
-
Started = 'started',
|
|
237
|
-
/** Executing activity behaviour */
|
|
238
|
-
Executing = 'executing',
|
|
239
|
-
/** Activity behaviour execution completed successfully */
|
|
240
|
-
Executed = 'executed',
|
|
241
|
-
/** Run end, take outbound flows */
|
|
242
|
-
End = 'end',
|
|
243
|
-
/** Entering discard run, triggered by discarded inbound flow */
|
|
244
|
-
Discard = 'discard',
|
|
245
|
-
/** Run was discarded, discard outbound flows */
|
|
246
|
-
Discarded = 'discarded',
|
|
247
|
-
/** Activity behaviour execution failed, discard run */
|
|
248
|
-
Error = 'error',
|
|
249
|
-
/** Formatting next run message */
|
|
250
|
-
Formatting = 'formatting',
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
declare interface DefinitionExecution {
|
|
254
|
-
get id(): string;
|
|
255
|
-
get type(): string;
|
|
256
|
-
get broker(): Broker;
|
|
257
|
-
get environment(): Environment;
|
|
258
|
-
get context(): ContextInstance;
|
|
259
|
-
get executionId(): string;
|
|
260
|
-
get stopped(): boolean;
|
|
261
|
-
get completed(): boolean;
|
|
262
|
-
get status(): string;
|
|
263
|
-
get processes(): Process[];
|
|
264
|
-
get postponedCount(): number;
|
|
265
|
-
get isRunning(): boolean;
|
|
266
|
-
get activityStatus(): ActivityStatus;
|
|
267
|
-
execute(executeMessage: ElementBrokerMessage): void;
|
|
268
|
-
getProcesses(): Process[];
|
|
269
|
-
getProcessById(processId: string): Process;
|
|
270
|
-
getProcessesById(processId: string): Process[];
|
|
271
|
-
getProcessByExecutionId(processExecutionId: string): Process;
|
|
272
|
-
getRunningProcesses(): Process[];
|
|
273
|
-
getExecutableProcesses(): Process[];
|
|
274
|
-
getPostponed(filterFn?: filterPostponed): Api<ElementBase>[];
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
declare interface ActivityExecution {
|
|
278
|
-
get completed(): boolean;
|
|
279
|
-
get executionId(): string;
|
|
280
|
-
get source(): IActivityBehaviour;
|
|
281
|
-
execute(executeMessage: ElementBrokerMessage): void;
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
declare interface IActivityBehaviour {
|
|
285
|
-
id: string;
|
|
286
|
-
type: string;
|
|
287
|
-
activity: Activity;
|
|
288
|
-
environment: Environment;
|
|
289
|
-
new (activity: Activity, context: ContextInstance): IActivityBehaviour;
|
|
290
|
-
execute(executeMessage: ElementBrokerMessage): void;
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
declare function ActivityBehaviour(activityDef: SerializableElement, context: ContextInstance): Activity;
|
|
294
|
-
|
|
295
|
-
declare interface Api<T> extends ElementBrokerMessage {
|
|
296
|
-
get id(): string;
|
|
297
|
-
get type(): string;
|
|
298
|
-
get name(): string;
|
|
299
|
-
get executionId(): string;
|
|
300
|
-
get environment(): Environment;
|
|
301
|
-
get broker(): ElementBroker<T>;
|
|
302
|
-
get owner(): T;
|
|
303
|
-
cancel(message?: signalMessage, options?: any): void;
|
|
304
|
-
discard(): void;
|
|
305
|
-
fail(error: Error): void;
|
|
306
|
-
signal(message?: signalMessage, options?: any): void;
|
|
307
|
-
stop(): void;
|
|
308
|
-
resolveExpression(expression: string): any;
|
|
309
|
-
sendApiMessage(action: string, content?: signalMessage, options?: any): void;
|
|
310
|
-
getPostponed(...args: any[]): any[];
|
|
311
|
-
createMessage(content?: Record<string, any>): any;
|
|
312
|
-
getExecuting(): Api<T>[];
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
interface ExecutionScope {
|
|
316
|
-
/** Calling element id */
|
|
317
|
-
id: string;
|
|
318
|
-
/** Calling element type */
|
|
319
|
-
type: string;
|
|
320
|
-
/** Execution message fields */
|
|
321
|
-
fields: MessageFields;
|
|
322
|
-
/** Execution message content */
|
|
323
|
-
content: ElementMessageContent;
|
|
324
|
-
/** Execution message properties */
|
|
325
|
-
properties: MessageProperties;
|
|
326
|
-
environment: Environment;
|
|
327
|
-
/** Calling element logger instance */
|
|
328
|
-
logger?: ILogger;
|
|
329
|
-
/**
|
|
330
|
-
* Resolve expression with the current scope
|
|
331
|
-
* @param expression expression string
|
|
332
|
-
* @returns Whatever the expression returns
|
|
333
|
-
*/
|
|
334
|
-
resolveExpression: (expression: string) => any;
|
|
335
|
-
ActivityError: ActivityError;
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
declare interface Script {
|
|
339
|
-
execute(executionContext: ExecutionScope, callback: CallableFunction): void;
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
declare abstract class MessageElement {
|
|
343
|
-
get id(): string;
|
|
344
|
-
get type(): string;
|
|
345
|
-
get name(): string;
|
|
346
|
-
get parent(): ElementParent;
|
|
347
|
-
resolve(executionMessage: ElementBrokerMessage): {
|
|
348
|
-
parent: ElementParent;
|
|
349
|
-
name: string;
|
|
350
|
-
id: string;
|
|
351
|
-
type: string;
|
|
352
|
-
messageType: string;
|
|
353
|
-
};
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
declare class Environment {
|
|
357
|
-
constructor(options?: EnvironmentOptions);
|
|
358
|
-
options: Record<string, any>;
|
|
359
|
-
expressions: IExpressions;
|
|
360
|
-
extensions: Record<string, IExtension>;
|
|
361
|
-
scripts: IScripts;
|
|
362
|
-
timers: ITimers;
|
|
363
|
-
Logger: LoggerFactory;
|
|
364
|
-
get settings(): EnvironmentSettings;
|
|
365
|
-
get variables(): Record<string, any>;
|
|
366
|
-
get output(): Record<string, any>;
|
|
367
|
-
set services(arg: any);
|
|
368
|
-
get services(): any;
|
|
369
|
-
getState(): EnvironmentState;
|
|
370
|
-
recover(state?: EnvironmentState): Environment;
|
|
371
|
-
clone(overrideOptions?: EnvironmentOptions): Environment;
|
|
372
|
-
assignVariables(newVars: Record<string, any>): void;
|
|
373
|
-
assignSettings(newSettings: Record<string, any>): void;
|
|
374
|
-
registerScript(activity: any): Script;
|
|
375
|
-
getScript(language: string, identifier: { id: string; [x: string]: any }): Script;
|
|
376
|
-
getServiceByName(serviceName: string): CallableFunction;
|
|
377
|
-
resolveExpression(expression: string, message?: ElementBrokerMessage, expressionFnContext?: any): any;
|
|
378
|
-
addService(name: string, fn: CallableFunction): void;
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
declare function Context(definitionContext: SerializableContext, environment?: Environment): ContextInstance;
|
|
382
|
-
declare class ContextInstance {
|
|
383
|
-
constructor(definitionContext: SerializableContext, environment?: Environment);
|
|
384
|
-
get id(): string;
|
|
385
|
-
get name(): string;
|
|
386
|
-
get type(): string;
|
|
387
|
-
/** Unique context instance id */
|
|
388
|
-
get sid(): string;
|
|
389
|
-
get definitionContext(): SerializableContext;
|
|
390
|
-
get environment(): Environment;
|
|
391
|
-
/** Context owner, Process or SubProcess activity */
|
|
392
|
-
get owner(): Process | Activity | undefined;
|
|
393
|
-
getActivityById<T>(activityId: string): T;
|
|
394
|
-
getSequenceFlowById(sequenceFlowId: string): SequenceFlow;
|
|
395
|
-
getInboundSequenceFlows(activityId: string): SequenceFlow[];
|
|
396
|
-
getOutboundSequenceFlows(activityId: string): SequenceFlow[];
|
|
397
|
-
getInboundAssociations(activityId: string): Association[];
|
|
398
|
-
getOutboundAssociations(activityId: string): Association[];
|
|
399
|
-
getActivities(scopeId?: string): ElementBase[];
|
|
400
|
-
getSequenceFlows(scopeId?: string): SequenceFlow[];
|
|
401
|
-
getAssociations(scopeId?: string): Association[];
|
|
402
|
-
clone(newEnvironment?: Environment): ContextInstance;
|
|
403
|
-
getProcessById(processId: string): Process;
|
|
404
|
-
getNewProcessById(processId: string): Process;
|
|
405
|
-
getProcesses(): Process[];
|
|
406
|
-
getExecutableProcesses(): Process[];
|
|
407
|
-
getMessageFlows(sourceId: string): MessageFlow[];
|
|
408
|
-
getDataObjectById(referenceId: string): any;
|
|
409
|
-
getDataStoreById(referenceId: string): any;
|
|
410
|
-
getStartActivities(filterOptions?: startActivityFilterOptions, scopeId?: string): Activity[];
|
|
411
|
-
loadExtensions(activity: ElementBase): IExtension;
|
|
412
|
-
}
|
|
413
|
-
|
|
414
|
-
declare interface ElementState {
|
|
415
|
-
id: string;
|
|
416
|
-
type: string;
|
|
417
|
-
broker?: BrokerState;
|
|
418
|
-
[x: string]: any;
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
declare interface EnvironmentState {
|
|
422
|
-
settings: EnvironmentSettings;
|
|
423
|
-
variables: Record<string, any>;
|
|
424
|
-
output: Record<string, any>;
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
declare type completedCounters = { completed: number; discarded: number };
|
|
428
|
-
|
|
429
|
-
declare interface ActivityExecutionState {
|
|
430
|
-
completed: boolean;
|
|
431
|
-
[x: string]: any;
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
declare interface ActivityState extends ElementState {
|
|
435
|
-
status?: string;
|
|
436
|
-
executionId: string;
|
|
437
|
-
stopped: boolean;
|
|
438
|
-
counters: { taken: number; discarded: number };
|
|
439
|
-
execution?: ActivityExecutionState;
|
|
440
|
-
}
|
|
441
|
-
|
|
442
|
-
declare interface SequenceFlowState extends ElementState {
|
|
443
|
-
counters: { take: number; discard: number; looped: number };
|
|
444
|
-
}
|
|
445
|
-
|
|
446
|
-
declare interface MessageFlowState extends ElementState {
|
|
447
|
-
counters: { messages: number };
|
|
448
|
-
}
|
|
449
|
-
|
|
450
|
-
declare interface AssociationState extends ElementState {
|
|
451
|
-
counters: { take: number; discard: number };
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
declare interface ProcessExecutionState {
|
|
455
|
-
executionId: string;
|
|
456
|
-
stopped: boolean;
|
|
457
|
-
completed: boolean;
|
|
458
|
-
status: string;
|
|
459
|
-
children: ActivityState[];
|
|
460
|
-
flows?: SequenceFlowState[];
|
|
461
|
-
messageFlows?: MessageFlowState[];
|
|
462
|
-
associations?: AssociationState[];
|
|
463
|
-
}
|
|
464
|
-
|
|
465
|
-
declare interface ProcessState extends ElementState {
|
|
466
|
-
status: string;
|
|
467
|
-
stopped: boolean;
|
|
468
|
-
executionId?: string;
|
|
469
|
-
counters: completedCounters;
|
|
470
|
-
environment: EnvironmentState;
|
|
471
|
-
execution?: ProcessExecutionState;
|
|
472
|
-
}
|
|
473
|
-
|
|
474
|
-
declare interface DefinitionExecutionState {
|
|
475
|
-
executionId: string;
|
|
476
|
-
stopped: boolean;
|
|
477
|
-
completed: boolean;
|
|
478
|
-
status: string;
|
|
479
|
-
processes: ProcessState[];
|
|
480
|
-
}
|
|
481
|
-
|
|
482
|
-
declare interface DefinitionState extends ElementState {
|
|
483
|
-
status: string;
|
|
484
|
-
stopped: boolean;
|
|
485
|
-
executionId?: string;
|
|
486
|
-
counters: completedCounters;
|
|
487
|
-
environment: EnvironmentState;
|
|
488
|
-
execution?: DefinitionExecutionState;
|
|
489
|
-
}
|
|
490
|
-
|
|
491
|
-
declare type runCallback = (err: Error, definitionApi: Api<Definition>) => void;
|
|
492
|
-
declare class Definition extends Element<Definition> {
|
|
493
|
-
constructor(context: ContextInstance, options?: EnvironmentOptions);
|
|
494
|
-
get counters(): completedCounters;
|
|
495
|
-
get execution(): DefinitionExecution;
|
|
496
|
-
get executionId(): string;
|
|
497
|
-
get isRunning(): boolean;
|
|
498
|
-
get status(): DefinitionRunStatus | undefined;
|
|
499
|
-
get stopped(): boolean;
|
|
500
|
-
get activityStatus(): ActivityStatus;
|
|
501
|
-
run(): Definition;
|
|
502
|
-
run(runContent: Record<string, any>): Definition;
|
|
503
|
-
run(runContent: Record<string, any>, callback: runCallback): Definition;
|
|
504
|
-
run(callback: runCallback): Definition;
|
|
505
|
-
getState(): DefinitionState;
|
|
506
|
-
recover(state?: DefinitionState): Definition;
|
|
507
|
-
resume(): void;
|
|
508
|
-
resume(callback: (err: Error, definitionApi: Api<Definition>) => void): void;
|
|
509
|
-
shake(startId?: string): object;
|
|
510
|
-
getProcesses(): Process[];
|
|
511
|
-
/** get processes marked with isExecutable=true */
|
|
512
|
-
getExecutableProcesses(): Process[];
|
|
513
|
-
getRunningProcesses(): Process[];
|
|
514
|
-
getProcessById(processId: string): Process;
|
|
515
|
-
getActivityById(childId: string): Activity;
|
|
516
|
-
getElementById<T>(elementId: string): Element<T>;
|
|
517
|
-
getPostponed(filterFn?: filterPostponed): Api<ElementBase>[];
|
|
518
|
-
/** Send delegated signal message */
|
|
519
|
-
signal(message: any): void;
|
|
520
|
-
cancelActivity(message: any): void;
|
|
521
|
-
sendMessage(message: any): void;
|
|
522
|
-
}
|
|
523
|
-
|
|
524
|
-
declare class Process extends Element<Process> {
|
|
525
|
-
constructor(processDef: SerializableElement, context: ContextInstance);
|
|
526
|
-
get isExecutable(): boolean;
|
|
527
|
-
get counters(): completedCounters;
|
|
528
|
-
get lanes(): Lane[] | undefined;
|
|
529
|
-
get extensions(): IExtension;
|
|
530
|
-
get stopped(): boolean;
|
|
531
|
-
get isRunning(): boolean;
|
|
532
|
-
get executionId(): string;
|
|
533
|
-
get execution(): ProcessExecution;
|
|
534
|
-
get status(): ProcessRunStatus | undefined;
|
|
535
|
-
get activityStatus(): ActivityStatus;
|
|
536
|
-
init(useAsExecutionId?: string): void;
|
|
537
|
-
run(runContent?: Record<string, any>): void;
|
|
538
|
-
getState(): ProcessState;
|
|
539
|
-
recover(state?: ProcessState): Process;
|
|
540
|
-
shake(startId?: string): void;
|
|
541
|
-
signal(message: any): any;
|
|
542
|
-
cancelActivity(message: any): any;
|
|
543
|
-
sendMessage(message: any): void;
|
|
544
|
-
getActivityById<T>(childId: string): T;
|
|
545
|
-
getActivities(): Activity[];
|
|
546
|
-
getStartActivities(filterOptions?: startActivityFilterOptions): Activity[];
|
|
547
|
-
getSequenceFlows(): SequenceFlow[];
|
|
548
|
-
getLaneById(laneId: string): Lane | undefined;
|
|
549
|
-
getPostponed(filterFn: filterPostponed): Api<ElementBase>[];
|
|
550
|
-
}
|
|
551
|
-
|
|
552
|
-
declare interface ProcessExecution {
|
|
553
|
-
get isSubProcess(): boolean;
|
|
554
|
-
get broker(): Broker;
|
|
555
|
-
get environment(): Environment;
|
|
556
|
-
get context(): ContextInstance;
|
|
557
|
-
get executionId(): string;
|
|
558
|
-
get stopped(): boolean;
|
|
559
|
-
get completed(): boolean;
|
|
560
|
-
get status(): string;
|
|
561
|
-
get postponedCount(): number;
|
|
562
|
-
get isRunning(): boolean;
|
|
563
|
-
get activityStatus(): ActivityStatus;
|
|
564
|
-
execute(executeMessage: ElementBrokerMessage): void;
|
|
565
|
-
getPostponed(filterFn: filterPostponed): Api<ElementBase>[];
|
|
566
|
-
getActivities(): Activity[];
|
|
567
|
-
getActivityById<T>(activityId: string): T;
|
|
568
|
-
getSequenceFlows(): SequenceFlow[];
|
|
569
|
-
getApi(message?: ElementBrokerMessage): Api<ElementBase>;
|
|
570
|
-
}
|
|
571
|
-
|
|
572
|
-
declare class Lane extends ElementBase {
|
|
573
|
-
constructor(process: Process, laneDefinition: SerializableElement);
|
|
574
|
-
/** Process broker */
|
|
575
|
-
get broker(): Broker;
|
|
576
|
-
get process(): Process;
|
|
577
|
-
}
|
|
578
|
-
|
|
579
|
-
declare interface ISequenceFlowCondition {
|
|
580
|
-
/** Condition type, e.g. script or expression */
|
|
581
|
-
get type(): string;
|
|
582
|
-
/**
|
|
583
|
-
* Execute sequence flow condition
|
|
584
|
-
* @param message Source element execution message
|
|
585
|
-
* @param callback Callback with truthy result if flow should be taken
|
|
586
|
-
*/
|
|
587
|
-
execute(message: ElementBrokerMessage, callback: (err: Error, result: any) => void): void;
|
|
588
|
-
}
|
|
589
|
-
|
|
590
|
-
declare class SequenceFlow extends Element<SequenceFlow> {
|
|
591
|
-
constructor(flowDef: SerializableElement, context: ContextInstance);
|
|
592
|
-
get sourceId(): string;
|
|
593
|
-
get targetId(): string;
|
|
594
|
-
get isDefault(): boolean;
|
|
595
|
-
get isSequenceFlow(): boolean;
|
|
596
|
-
get counters(): { take: number; discard: number; looped: number };
|
|
597
|
-
take(content?: any): boolean;
|
|
598
|
-
discard(content?: any): void;
|
|
599
|
-
shake(message: any): number;
|
|
600
|
-
getCondition(): ISequenceFlowCondition | null;
|
|
601
|
-
createMessage(override?: any): object;
|
|
602
|
-
/**
|
|
603
|
-
* Evaluate flow
|
|
604
|
-
* Executes condition if any, default flow is
|
|
605
|
-
* @param fromMessage Activity message
|
|
606
|
-
* @param {evaluateCallback} callback Callback with evaluation result, if truthy flow should be taken
|
|
607
|
-
*/
|
|
608
|
-
evaluate(fromMessage: ElementBrokerMessage, callback: (err: Error, result: any) => void): void;
|
|
609
|
-
getState(): SequenceFlowState | undefined;
|
|
610
|
-
}
|
|
611
|
-
|
|
612
|
-
declare interface MessageFlowReference {
|
|
613
|
-
/** activity id */
|
|
614
|
-
get id(): string;
|
|
615
|
-
get processId(): string;
|
|
616
|
-
}
|
|
617
|
-
|
|
618
|
-
declare class MessageFlow extends Element<MessageFlow> {
|
|
619
|
-
constructor(flowDef: SerializableElement, context: ContextInstance);
|
|
620
|
-
get source(): MessageFlowReference;
|
|
621
|
-
get target(): MessageFlowReference;
|
|
622
|
-
get counters(): { messages: number };
|
|
623
|
-
activate(): void;
|
|
624
|
-
deactivate(): void;
|
|
625
|
-
getState(): MessageFlowState | undefined;
|
|
626
|
-
}
|
|
627
|
-
|
|
628
|
-
declare class Association extends Element<Association> {
|
|
629
|
-
constructor(associationDef: SerializableElement, context: ContextInstance);
|
|
630
|
-
get sourceId(): string;
|
|
631
|
-
get targetId(): string;
|
|
632
|
-
get isAssociation(): boolean;
|
|
633
|
-
get counters(): { take: number; discard: number };
|
|
634
|
-
take(content?: any): boolean;
|
|
635
|
-
discard(content?: any): boolean;
|
|
636
|
-
getState(): AssociationState | undefined;
|
|
637
|
-
}
|
|
638
|
-
|
|
639
|
-
declare type LoggerFactory = (scope: string) => ILogger;
|
|
640
|
-
|
|
641
|
-
declare interface ILogger {
|
|
642
|
-
debug(...args: any[]): void;
|
|
643
|
-
error(...args: any[]): void;
|
|
644
|
-
warn(...args: any[]): void;
|
|
645
|
-
[x: string]: any;
|
|
646
|
-
}
|
|
647
|
-
|
|
648
|
-
declare type wrappedSetTimeout = (handler: CallableFunction, delay: number, ...args: any[]) => Timer;
|
|
649
|
-
declare type wrappedClearTimeout = (ref: any) => void;
|
|
650
|
-
|
|
651
|
-
declare interface Timer {
|
|
652
|
-
/** The function to call when the timer elapses */
|
|
653
|
-
readonly callback: CallableFunction;
|
|
654
|
-
/** The number of milliseconds to wait before calling the callback */
|
|
655
|
-
readonly delay: number;
|
|
656
|
-
/** Optional arguments to pass when the callback is called */
|
|
657
|
-
readonly args?: any[];
|
|
658
|
-
/** Timer owner if any */
|
|
659
|
-
readonly owner?: any;
|
|
660
|
-
/** Timer Id */
|
|
661
|
-
readonly timerId: string;
|
|
662
|
-
/** Timeout, return from setTimeout */
|
|
663
|
-
readonly timerRef: any;
|
|
664
|
-
[x: string]: any;
|
|
665
|
-
}
|
|
666
|
-
|
|
667
|
-
declare interface RegisteredTimer {
|
|
668
|
-
owner?: any;
|
|
669
|
-
get setTimeout(): wrappedSetTimeout;
|
|
670
|
-
get clearTimeout(): wrappedClearTimeout;
|
|
671
|
-
}
|
|
672
|
-
|
|
673
|
-
declare interface ITimers {
|
|
674
|
-
get setTimeout(): wrappedSetTimeout;
|
|
675
|
-
get clearTimeout(): wrappedClearTimeout;
|
|
676
|
-
register(owner?: any): RegisteredTimer;
|
|
677
|
-
[x: string]: any;
|
|
678
|
-
}
|
|
679
|
-
|
|
680
|
-
declare interface TimersOptions {
|
|
681
|
-
/** Defaults to builtin setTimeout */
|
|
682
|
-
setTimeout?: typeof setTimeout;
|
|
683
|
-
/** Defaults to builtin clearTimeout */
|
|
684
|
-
clearTimeout?: typeof clearTimeout;
|
|
685
|
-
[x: string]: any;
|
|
686
|
-
}
|
|
687
|
-
|
|
688
|
-
declare class Timers implements ITimers {
|
|
689
|
-
options: TimersOptions;
|
|
690
|
-
constructor(options?: TimersOptions);
|
|
691
|
-
get executing(): Timer[];
|
|
692
|
-
get setTimeout(): wrappedSetTimeout;
|
|
693
|
-
get clearTimeout(): wrappedClearTimeout;
|
|
694
|
-
register(owner?: any): RegisteredTimer;
|
|
695
|
-
}
|
|
696
|
-
|
|
697
|
-
declare interface IScripts {
|
|
698
|
-
register(activity: any): Script | undefined;
|
|
699
|
-
getScript(language: string, identifier: { id: string; [x: string]: any }): Script;
|
|
700
|
-
}
|
|
701
|
-
|
|
702
|
-
declare class MessageFormatter {
|
|
703
|
-
id: string;
|
|
704
|
-
broker: Broker;
|
|
705
|
-
logger: ILogger;
|
|
706
|
-
format(message: MessageElement, callback: CallableFunction): void;
|
|
707
|
-
}
|
|
708
|
-
|
|
709
|
-
declare class Activity extends Element<Activity> {
|
|
710
|
-
constructor(behaviour: IActivityBehaviour, activityDef: SerializableElement, context: ContextInstance);
|
|
711
|
-
get Behaviour(): IActivityBehaviour;
|
|
712
|
-
get stopped(): boolean;
|
|
713
|
-
get status(): ActivityRunStatus | undefined;
|
|
714
|
-
get context(): ContextInstance;
|
|
715
|
-
get counters(): { taken: number; discarded: number };
|
|
716
|
-
get execution(): ActivityExecution;
|
|
717
|
-
get executionId(): string;
|
|
718
|
-
get extensions(): IExtension;
|
|
719
|
-
get isRunning(): boolean;
|
|
720
|
-
get outbound(): SequenceFlow[];
|
|
721
|
-
get inbound(): SequenceFlow[];
|
|
722
|
-
get isEnd(): boolean;
|
|
723
|
-
get isStart(): boolean;
|
|
724
|
-
get isSubProcess(): boolean;
|
|
725
|
-
get isMultiInstance(): boolean;
|
|
726
|
-
get isThrowing(): boolean;
|
|
727
|
-
get isForCompensation(): boolean;
|
|
728
|
-
get triggeredByEvent(): boolean;
|
|
729
|
-
get attachedTo(): Activity;
|
|
730
|
-
get eventDefinitions(): EventDefinition[];
|
|
731
|
-
get formatter(): MessageFormatter;
|
|
732
|
-
/** Parent element process or sub process reference */
|
|
733
|
-
get parentElement(): Process | Activity;
|
|
734
|
-
activate(): void;
|
|
735
|
-
deactivate(): void;
|
|
736
|
-
init(initContent?: any): void;
|
|
737
|
-
run(runContent?: any): void;
|
|
738
|
-
discard(discardContent?: any): void;
|
|
739
|
-
next(): ElementBrokerMessage;
|
|
740
|
-
shake(): void;
|
|
741
|
-
evaluateOutbound(
|
|
742
|
-
fromMessage: ElementBrokerMessage,
|
|
743
|
-
discardRestAtTake: boolean,
|
|
744
|
-
callback: (err: Error, evaluationResult: any) => void
|
|
745
|
-
): void;
|
|
746
|
-
getState(): ActivityState | undefined;
|
|
747
|
-
}
|
|
748
|
-
|
|
749
|
-
declare class ActivityError extends Error {
|
|
750
|
-
type: string;
|
|
751
|
-
description: string;
|
|
752
|
-
/** Activity that threw error */
|
|
753
|
-
source?: ElementBrokerMessage;
|
|
754
|
-
/** Original error */
|
|
755
|
-
inner?: Error;
|
|
756
|
-
code?: string;
|
|
757
|
-
constructor(description: string, sourceMessage: MessageMessage, inner?: Error);
|
|
758
|
-
}
|
|
759
|
-
|
|
760
|
-
/**
|
|
761
|
-
* Evaluate flow callback
|
|
762
|
-
* @callback evaluateCallback
|
|
763
|
-
* @param {Error} err Evaluation error
|
|
764
|
-
* @param {boolean|object} evaluationResult If thruthy flow should be taken
|
|
765
|
-
*/
|