@5minds/processcube_engine_sdk 7.2.0-alpha.3 → 7.2.0-alpha.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.
Files changed (60) hide show
  1. package/dist/DataModels/ApplicationInfo.d.ts +3 -0
  2. package/dist/DataModels/EngineMetadata.d.ts +13 -0
  3. package/dist/DataModels/ProcessInstance/ProcessInstance.d.ts +1 -0
  4. package/dist/DataModels/index.d.ts +1 -0
  5. package/dist/Engine.d.ts +22 -1
  6. package/dist/EngineConfiguration.d.ts +2 -0
  7. package/dist/EngineEventBus.d.ts +87 -0
  8. package/dist/EngineEventBusSettings.d.ts +141 -0
  9. package/dist/EngineEvents/EventPayloads/KillProcessInstanceMessage.d.ts +11 -0
  10. package/dist/EngineEvents/EventPayloads/TerminateProcessInstance.d.ts +1 -0
  11. package/dist/EngineEvents/EventPayloads/index.d.ts +1 -0
  12. package/dist/EngineEvents/index.d.ts +0 -1
  13. package/dist/EngineRestApiSettings.d.ts +2107 -0
  14. package/dist/EngineSocketIoSettings.d.ts +67 -0
  15. package/dist/ExtensionAdapter/ClusterExtensionAdapter.d.ts +14 -0
  16. package/dist/ExtensionAdapter/MessageEventExtensionAdapter.d.ts +4 -0
  17. package/dist/ExtensionAdapter/NotificationExtensionAdapter.d.ts +4 -4
  18. package/dist/ExtensionAdapter/SignalEventExtensionAdapter.d.ts +4 -0
  19. package/dist/ExtensionAdapter/index.d.ts +3 -0
  20. package/dist/ProcessModel/Model/Activities/SubProcess.d.ts +1 -0
  21. package/dist/ProcessModel/Model/Events/ErrorEvents.d.ts +2 -1
  22. package/dist/ProcessModel/Model/Events/EventBase.d.ts +4 -0
  23. package/dist/commonjs/{EngineEvents/Subscription.js → DataModels/EngineMetadata.js} +1 -1
  24. package/dist/commonjs/DataModels/EngineMetadata.js.map +1 -0
  25. package/dist/commonjs/DataModels/ProcessInstance/ProcessInstance.js.map +1 -1
  26. package/dist/commonjs/DataModels/index.js +1 -0
  27. package/dist/commonjs/DataModels/index.js.map +1 -1
  28. package/dist/commonjs/Engine.js.map +1 -1
  29. package/dist/commonjs/EngineEventBus.js +3 -0
  30. package/dist/commonjs/EngineEventBus.js.map +1 -0
  31. package/dist/commonjs/EngineEventBusSettings.js +99 -0
  32. package/dist/commonjs/EngineEventBusSettings.js.map +1 -0
  33. package/dist/commonjs/EngineEvents/EventPayloads/KillProcessInstanceMessage.js +3 -0
  34. package/dist/commonjs/EngineEvents/EventPayloads/KillProcessInstanceMessage.js.map +1 -0
  35. package/dist/commonjs/EngineEvents/EventPayloads/index.js +1 -0
  36. package/dist/commonjs/EngineEvents/EventPayloads/index.js.map +1 -1
  37. package/dist/commonjs/EngineEvents/index.js +0 -1
  38. package/dist/commonjs/EngineEvents/index.js.map +1 -1
  39. package/dist/commonjs/EngineRestApiSettings.js +2139 -0
  40. package/dist/commonjs/EngineRestApiSettings.js.map +1 -0
  41. package/dist/commonjs/EngineSocketIoSettings.js +76 -0
  42. package/dist/commonjs/EngineSocketIoSettings.js.map +1 -0
  43. package/dist/commonjs/ExtensionAdapter/ClusterExtensionAdapter.js +3 -0
  44. package/dist/commonjs/ExtensionAdapter/ClusterExtensionAdapter.js.map +1 -0
  45. package/dist/commonjs/ExtensionAdapter/MessageEventExtensionAdapter.js +3 -0
  46. package/dist/commonjs/ExtensionAdapter/MessageEventExtensionAdapter.js.map +1 -0
  47. package/dist/commonjs/ExtensionAdapter/SignalEventExtensionAdapter.js +3 -0
  48. package/dist/commonjs/ExtensionAdapter/SignalEventExtensionAdapter.js.map +1 -0
  49. package/dist/commonjs/ExtensionAdapter/index.js +3 -0
  50. package/dist/commonjs/ExtensionAdapter/index.js.map +1 -1
  51. package/dist/commonjs/ProcessModel/ProcessModelParser/Parser/FlowNodeParsers/ActivityParsers/SubprocessParser.js +4 -0
  52. package/dist/commonjs/ProcessModel/ProcessModelParser/Parser/FlowNodeParsers/ActivityParsers/SubprocessParser.js.map +1 -1
  53. package/dist/commonjs/ProcessModel/ProcessModelParser/Parser/FlowNodeParsers/EventParser.js +7 -0
  54. package/dist/commonjs/ProcessModel/ProcessModelParser/Parser/FlowNodeParsers/EventParser.js.map +1 -1
  55. package/dist/commonjs/index.js +4 -0
  56. package/dist/commonjs/index.js.map +1 -1
  57. package/dist/index.d.ts +4 -0
  58. package/package.json +10 -12
  59. package/dist/EngineEvents/Subscription.d.ts +0 -26
  60. package/dist/commonjs/EngineEvents/Subscription.js.map +0 -1
@@ -56,5 +56,8 @@ export type ApplicationInfo = {
56
56
  name: string;
57
57
  version: string;
58
58
  }>;
59
+ extensionInfo?: {
60
+ [extensionName: string]: any;
61
+ };
59
62
  extraInfo: any;
60
63
  };
@@ -0,0 +1,13 @@
1
+ export type EngineMetadata = {
2
+ engineId: string;
3
+ hostname: string;
4
+ lastSeen: number;
5
+ alive?: boolean;
6
+ leader?: boolean;
7
+ current?: boolean;
8
+ allProcesses?: number;
9
+ runningProcesses?: number;
10
+ finishedProcesses?: number;
11
+ erroredProcesses?: number;
12
+ terminatedProcesses?: number;
13
+ };
@@ -161,6 +161,7 @@ export declare type ProcessInstance = {
161
161
  metadata?: ProcessInstanceMetadata;
162
162
  correlation?: Correlation;
163
163
  triggeredByFlowNodeInstance?: FlowNodeInstance;
164
+ engineId?: string;
164
165
  };
165
166
  /**
166
167
  * @swagger
@@ -16,6 +16,7 @@ export * from './Constants';
16
16
  export * from './Correlation';
17
17
  export * from './Cronjob/index';
18
18
  export * from './DataObjectInstance';
19
+ export * from './EngineMetadata';
19
20
  export * from './ExternalTask/index';
20
21
  export * from './FlowNodeInstance/index';
21
22
  export * from './Iam/index';
package/dist/Engine.d.ts CHANGED
@@ -1,8 +1,9 @@
1
1
  import * as express from 'express';
2
2
  import { UserTaskInstance } from './DataModels';
3
3
  import { Identity } from './DataModels/Iam/index';
4
+ import { ExternalEventBus } from './EngineEventBus';
4
5
  import { EngineEventType, MiddlewareCallback } from './EngineEvents/index';
5
- import { IApplicationInfoExtensionAdapter, ICorrelationExtensionAdapter, ICronjobExtensionAdapter, IDataObjectInstanceExtensionAdapter, IEventExtensionAdapter, IExternalTaskExtensionAdapter, IFlowNodeInstanceExtensionAdapter, IIamExtensionAdapter, IManualTaskExtensionAdapter, INotificationExtensionAdapter, IProcessDefinitionExtensionAdapter, IProcessInstanceExtensionAdapter, IProcessModelExtensionAdapter, IUntypedTaskExtensionAdapter, IUserTaskExtensionAdapter } from './ExtensionAdapter';
6
+ import { IApplicationInfoExtensionAdapter, IClusterExtensionAdapter, ICorrelationExtensionAdapter, ICronjobExtensionAdapter, IDataObjectInstanceExtensionAdapter, IEventExtensionAdapter, IExternalTaskExtensionAdapter, IFlowNodeInstanceExtensionAdapter, IIamExtensionAdapter, IManualTaskExtensionAdapter, IMessageEventExtensionAdapter, INotificationExtensionAdapter, IProcessDefinitionExtensionAdapter, IProcessInstanceExtensionAdapter, IProcessModelExtensionAdapter, ISignalEventExtensionAdapter, IUntypedTaskExtensionAdapter, IUserTaskExtensionAdapter } from './ExtensionAdapter';
6
7
  import { EventViewModel, FlowNodeViewModel } from './ProcessModel/index';
7
8
  /**
8
9
  * Describes the onLoad function, which can be exported by an extension.
@@ -12,8 +13,16 @@ import { EventViewModel, FlowNodeViewModel } from './ProcessModel/index';
12
13
  * export const onLoad: onLoadFunction = (engine: Engine) => {}
13
14
  */
14
15
  export type OnLoad = (engine: Engine) => void | Promise<void>;
16
+ export type GetStatusInfo = () => Object | Promise<Object>;
15
17
  export type EngineExtension = {
16
18
  onLoad: OnLoad;
19
+ getStatusInfo?: GetStatusInfo;
20
+ };
21
+ export type Extension = {
22
+ exports: EngineExtension;
23
+ name: string;
24
+ version: string;
25
+ path: string;
17
26
  };
18
27
  export type CustomServiceTaskHandlerContext = {
19
28
  token: {
@@ -67,6 +76,7 @@ export type CustomHttpRouteRequest = {
67
76
  stale: boolean;
68
77
  subdomains: Array<string>;
69
78
  xhr: boolean;
79
+ nonce?: string;
70
80
  };
71
81
  export declare enum HttpResponseActionType {
72
82
  Send = "send",
@@ -213,6 +223,14 @@ export type Engine = {
213
223
  * @param callback The callback to call after the Engine has finished starting up.
214
224
  */
215
225
  onReady(callback: () => void | Promise<void>): void;
226
+ /**
227
+ * Registers a custom Event Bus, which will replace the Engine's own internal Event Bus.
228
+ *
229
+ * **NOTE:** Can only be used BEFORE the {@link Engine.onReady} Event was fired!
230
+ *
231
+ * @param eventBus A custom {@link ExternalEventBus}.
232
+ */
233
+ registerCustomEventBus(eventBus: ExternalEventBus): void;
216
234
  /**
217
235
  * Registers the given callback as an Event Middleware.
218
236
  * This middleware gets called whenever a Log Event occurs at the Engine.
@@ -357,6 +375,7 @@ export type Engine = {
357
375
  registerHttpRoute(path: string, method: 'get' | 'post' | 'put' | 'delete', routeHandler: CustomHttpRouteHandler, options?: CustomHttpRouteOptions): void;
358
376
  executeRuntimeExpression<TExpectedResult>(expression: string, params: RuntimeExpressionParameters): Promise<TExpectedResult>;
359
377
  applicationInfo: IApplicationInfoExtensionAdapter;
378
+ cluster: IClusterExtensionAdapter;
360
379
  correlations: ICorrelationExtensionAdapter;
361
380
  cronjobs: ICronjobExtensionAdapter;
362
381
  dataObjectInstances: IDataObjectInstanceExtensionAdapter;
@@ -366,9 +385,11 @@ export type Engine = {
366
385
  flowNodeInstances: IFlowNodeInstanceExtensionAdapter;
367
386
  iam: IIamExtensionAdapter;
368
387
  manualTasks: IManualTaskExtensionAdapter;
388
+ messageEvents: IMessageEventExtensionAdapter;
369
389
  notification: INotificationExtensionAdapter;
370
390
  processDefinitions: IProcessDefinitionExtensionAdapter;
371
391
  processInstances: IProcessInstanceExtensionAdapter;
372
392
  processModels: IProcessModelExtensionAdapter;
393
+ signalEvents: ISignalEventExtensionAdapter;
373
394
  userTasks: IUserTaskExtensionAdapter;
374
395
  };
@@ -30,6 +30,7 @@ export declare type ExtensionsConfig = {
30
30
  exclude?: string[];
31
31
  };
32
32
  export declare type RuntimeExpressionConfig = {
33
+ disableTimeout?: boolean;
33
34
  timeoutInMiliseconds?: number;
34
35
  workerPoolSize?: number;
35
36
  };
@@ -92,6 +93,7 @@ export declare type HttpServerConfig = {
92
93
  };
93
94
  export declare type IAMConfiguration = {
94
95
  baseUrl: string;
96
+ internalUrl?: string;
95
97
  allowAnonymousRootAccess?: boolean;
96
98
  rootAccessToken?: string;
97
99
  };
@@ -0,0 +1,87 @@
1
+ /**
2
+ * Defines the signature for the Callback that an EventSubscription should have.
3
+ *
4
+ * @param eventPayload Optional: The payload received with the event.
5
+ * @param eventName Optional: The name of the received event.
6
+ */
7
+ export type EventReceivedCallback = (eventPayload?: any, eventName?: string) => void | Promise<void>;
8
+ /**
9
+ * Contains information about a subscription on the EngineEventBus.
10
+ * External services can use this information to manage their own subscriptions.
11
+ */
12
+ export type Subscription = {
13
+ /**
14
+ * The Id under which the EngineEventBus has stored the Subscription.
15
+ */
16
+ readonly id: string;
17
+ /**
18
+ * The name of the event for which the Subscription was created.
19
+ */
20
+ readonly eventName: string;
21
+ /**
22
+ * If set to true, the Subscription will be destroyed after first receiving
23
+ * the event.
24
+ */
25
+ readonly onlyReceiveOnce: boolean;
26
+ };
27
+ export type ExternalSubscription = {
28
+ remove: () => Promise<void>;
29
+ };
30
+ /**
31
+ * The Event Bus is used by the Engine to manage communications between the individual engine services, as well as all Flow Node Instances and Process Instances.
32
+ *
33
+ * By default, the Engine uses its own EventAggregator.
34
+ *
35
+ * You can replace it with your own, if you want to connect the engine to an external messagebus.
36
+ */
37
+ export type EngineEventBus = {
38
+ /**
39
+ * Creates a new {@link Subscription} on the EventBus for the event with the given name.
40
+ * The {@link Subscription} will remain active, until manually disposed through the {@link EngineEventBus.unsubscribe} method.
41
+ *
42
+ * @param eventName The name of the Event to subscribe to.
43
+ * @param callback The callback to execute, when the event is received.
44
+ * @returns A {@link Subscription} object.
45
+ */
46
+ subscribe: (eventName: string, callback: EventReceivedCallback) => Subscription;
47
+ /**
48
+ * Creates a new {@link Subscription} on the EventBus for the event with the given name.
49
+ * The {@link Subscription} is automatically disposed, after the event was received once.
50
+ *
51
+ * @param eventName The name of the Event to subscribe to.
52
+ * @param callback The callback to execute, when the event is received.
53
+ * @returns A {@link Subscription} object.
54
+ */
55
+ subscribeOnce: (eventName: string, callback: EventReceivedCallback) => Subscription;
56
+ /**
57
+ * Publishes a given event on the EventBus.
58
+ * Usually, this function returns as soon as the Event was published.
59
+ * However, it is possible to wait for all Subscribers to acknowledge receiving the Event, by providing an "onAcknowledgement" Callback function.
60
+ *
61
+ * @param eventName The name of the Event to publish.
62
+ * @param payload The payload to send with the Event.
63
+ * @param onAcknowledgement Optional: The callback to call, after all Subscribers have acknowledged receiving the Event.
64
+ * @param eventId Optional: The Event ID to use.
65
+ */
66
+ publish: (eventName: string, payload?: Record<string, any>, onAcknowledgement?: () => void, eventId?: string) => void;
67
+ /**
68
+ * Allows a Subscriber to acknowledge the receit of an Event with the given ID.
69
+ *
70
+ * @param eventId The ID of the Event to acknowledge.
71
+ */
72
+ acknowledgeEvent: (eventId: string) => void;
73
+ /**
74
+ * Disposes the given Event Subscription.
75
+ *
76
+ * @param subscription The Subscription to dispose.
77
+ */
78
+ unsubscribe: (subscription: Subscription) => void;
79
+ };
80
+ export type ExternalEventBus = {
81
+ subscribeToWorkQueue: (queueName: string, callback: Function) => Promise<ExternalSubscription>;
82
+ subscribeToTopicWithRoutingKey: (topic: string, routingKey: string, callback: Function, oneTimeSubscription?: boolean) => Promise<ExternalSubscription>;
83
+ subscribeToBroadcast: (topic: string, callback: Function, oneTimeSubscription?: boolean) => Promise<ExternalSubscription>;
84
+ publishToWorkQueue: (queueName: string, payload: Record<string, any>) => Promise<void>;
85
+ publishToTopicWithRoutingKey: (topic: string, routingKey: string, payload: Record<string, any>) => Promise<void>;
86
+ publishToBroadcast: (topic: string, payload: Record<string, any>) => Promise<void>;
87
+ };
@@ -0,0 +1,141 @@
1
+ export declare const EngineEventBusSettings: {
2
+ messagePaths: {
3
+ activityReached: string;
4
+ activityFinished: string;
5
+ activityCanceled: string;
6
+ boundaryEventTriggered: string;
7
+ boundaryEventFinished: string;
8
+ boundaryEventWaiting: string;
9
+ changeCorrelationMetadata: {
10
+ topic: string;
11
+ routingKey: (correlationId: string) => string;
12
+ };
13
+ clusterSetupFinished: string;
14
+ correlationMetadataChanged: string;
15
+ cronjobCreated: string;
16
+ cronjobExecuted: string;
17
+ cronjobEnabledChanged: string;
18
+ cronjobStopped: string;
19
+ cronjobUpdated: string;
20
+ cronjobRemoved: string;
21
+ untypedTaskReached: string;
22
+ untypedTaskFinished: string;
23
+ endEventFinished: string;
24
+ engineDied: string;
25
+ externalTaskCreated: string;
26
+ externalTaskExpired: string;
27
+ externalTaskFinished: string;
28
+ externalTaskLocked: string;
29
+ externalTaskUnlocked: string;
30
+ finishExternalTask: string;
31
+ flowNodeEventRetrySending: string;
32
+ intermediateThrowEventTriggered: string;
33
+ intermediateCatchEventReached: string;
34
+ intermediateCatchEventFinished: string;
35
+ livenessProbe: string;
36
+ manualTaskReached: string;
37
+ processDeployed: string;
38
+ processUndeployed: string;
39
+ processInstancesDeleted: string;
40
+ processInstanceMetadataChanged: string;
41
+ processExecutableChanged: string;
42
+ startEventFinished: string;
43
+ terminateProcessInstance: string;
44
+ userTaskReached: string;
45
+ userTaskReserved: string;
46
+ userTaskReservationCanceled: string;
47
+ messageEventTriggeredOnPath: {
48
+ topic: string;
49
+ routingKey: (triggerValue: string, reference: string, processInstanceId: string) => string;
50
+ };
51
+ signalEventTriggeredOnPath: {
52
+ topic: string;
53
+ routingKey: (triggerValue: string, reference: string, processInstanceId: string) => string;
54
+ };
55
+ messageTriggered: string;
56
+ signalTriggered: string;
57
+ triggerTimerEvent: {
58
+ topic: string;
59
+ routingKey: (flowNodeInstanceId: string) => string;
60
+ };
61
+ tokenPayloadChange: {
62
+ topic: string;
63
+ routingKey: (flowNodeInstanceId: string) => string;
64
+ };
65
+ tokenPayloadChangeFinished: {
66
+ topic: string;
67
+ routingKey: (flowNodeInstanceId: string) => string;
68
+ };
69
+ activityError: string;
70
+ processStarting: string;
71
+ processResumed: string;
72
+ processOwnerChanged: string;
73
+ gatewayFinished: string;
74
+ gatewayReached: string;
75
+ finishUntypedTask: {
76
+ topic: string;
77
+ routingKey: (flowNodeInstanceId: string) => string;
78
+ };
79
+ finishUserTask: {
80
+ topic: string;
81
+ routingKey: (flowNodeInstanceId: string) => string;
82
+ };
83
+ userTaskFinished: {
84
+ topic: string;
85
+ routingKey: (flownodeInstanceId: string) => string;
86
+ };
87
+ finishManualTask: {
88
+ topic: string;
89
+ routingKey: (flowNodeInstanceId: string) => string;
90
+ };
91
+ manualTaskFinished: {
92
+ topic: string;
93
+ routingKey: (flowNodeInstanceId: string) => string;
94
+ };
95
+ endEventReached: {
96
+ topic: string;
97
+ routingKey: (processInstanceId: string) => string;
98
+ };
99
+ processStarted: {
100
+ topic: string;
101
+ routingKey: (processModelId: string) => string;
102
+ };
103
+ processEnded: {
104
+ topic: string;
105
+ routingKey: (processInstanceId: string) => string;
106
+ };
107
+ processErrored: {
108
+ topic: string;
109
+ routingKey: (processInstanceId: string) => string;
110
+ };
111
+ processTerminated: {
112
+ topic: string;
113
+ routingKey: (processInstanceId: string) => string;
114
+ };
115
+ killProcessInstance: {
116
+ topic: string;
117
+ routingKey: (processInstanceId?: string, engineId?: string) => string;
118
+ };
119
+ processKilled: {
120
+ topic: string;
121
+ routingKey: (processInstanceId: string) => string;
122
+ };
123
+ terminateEndEventReached: {
124
+ topic: string;
125
+ routingKey: (processInstanceId: string) => string;
126
+ };
127
+ changeProcessInstanceOwner: {
128
+ topic: string;
129
+ routingKey: (processInstanceId: string) => string;
130
+ };
131
+ processInstanceOwnerChanged: {
132
+ topic: string;
133
+ routingKey: (processInstanceId: string) => string;
134
+ };
135
+ lockExternalTask: string;
136
+ unlockExternalTask: string;
137
+ };
138
+ externalMessagePaths: {
139
+ processStartRequest: string;
140
+ };
141
+ };
@@ -0,0 +1,11 @@
1
+ import { Identity } from '../../DataModels';
2
+ /**
3
+ * Encapsulates a message for when a Process Instance gets killed by a user.
4
+ */
5
+ export type KillProcessInstanceMessage = {
6
+ /**
7
+ * Contain the killers identity.
8
+ */
9
+ killedBy: Identity;
10
+ processInstanceId: string;
11
+ };
@@ -3,6 +3,7 @@ import { Identity } from '../../DataModels/Iam/index';
3
3
  * Encapsulates a message for when a Process Instance gets terminated.
4
4
  */
5
5
  export type TerminateProcessInstanceMessage = {
6
+ processInstanceId: string;
6
7
  /**
7
8
  * If the Process Instance is terminated by a user, this will contain the users identity.
8
9
  */
@@ -5,6 +5,7 @@ export * from './ErrorEndEventReached';
5
5
  export * from './ExternalTaskMessages';
6
6
  export * from './FinishManualTask';
7
7
  export * from './FinishUserTask';
8
+ export * from './KillProcessInstanceMessage';
8
9
  export * from './MessageEventReached';
9
10
  export * from './MetadataChangedMessage';
10
11
  export * from './ProcessDeploymentMessage';
@@ -8,7 +8,6 @@ export * from './EventCallbackTypes';
8
8
  export * from './EngineEvent';
9
9
  export * from './EngineEventMiddlewares';
10
10
  export * from './EventPayloads/index';
11
- export * from './Subscription';
12
11
  export declare namespace Messages {
13
12
  export import EventMessage = eventPayloads.EventMessage;
14
13
  export import BpmnEvents = eventPayloads;