@onify/flow-extensions 9.1.1 → 10.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/types/index.d.ts CHANGED
@@ -1,58 +1,316 @@
1
1
  declare module '@onify/flow-extensions' {
2
- import { SequenceFlow, TimerEventDefinition, ElementBase, IExtension, ContextInstance } from 'bpmn-elements';
3
- import { extendFn as extendFunction } from 'moddle-context-serializer';
2
+ import type { SequenceFlow, TimerEventDefinition } from 'bpmn-elements';
3
+ /**
4
+ * Onify flow extensions factory, pass to the engine as `extensions: { onify: extensions }`
5
+ * */
6
+ export function extensions(element: import("bpmn-elements").ElementBase, context: import("bpmn-elements").ContextInstance): import("bpmn-elements").IExtension;
7
+ /**
8
+ * Extend function for moddle-context-serializer, registers scripts and timers at serialize time
9
+ * */
10
+ export function extendFn(behaviour: import("bpmn-moddle").BaseElement & Record<string, any>, context: import("moddle-context-serializer").ExtendContext): void;
11
+ export class OnifySequenceFlow extends SequenceFlow {
12
+ extensions: OnifyExtensions;
13
+ #private;
14
+ }
15
+ export class OnifyTimerEventDefinition extends TimerEventDefinition {
16
+ /**
17
+ * Supported timeCycle formats
18
+ * */
19
+ get supports(): string[];
20
+ }
21
+ /**
22
+ * assembled element extensions
23
+ */
24
+ type OnifyExtensions = {
25
+ /**
26
+ * enter/end formatting
27
+ */
28
+ format?: FormatActivity | FormatProcess | undefined;
29
+ /**
30
+ * service factory
31
+ */
32
+ Service?: import("bpmn-elements").IActivityBehaviour | undefined;
33
+ /**
34
+ * camunda:InputOutput
35
+ */
36
+ io?: InputOutput | undefined;
37
+ /**
38
+ * camunda:Properties
39
+ */
40
+ properties?: IOProperties | undefined;
41
+ /**
42
+ * camunda:FormData
43
+ */
44
+ form?: IOForm | undefined;
45
+ /**
46
+ * camunda:ExecutionListener
47
+ */
48
+ listeners?: ExecutionListeners | undefined;
49
+ };
50
+ class FormatActivity {
51
+
52
+ constructor(activity: import("bpmn-elements").Activity);
53
+ activity: import("bpmn-elements").Activity;
54
+ resultVariable: any;
55
+ timeCycles: never[] | undefined;
56
+ hasFormatting: boolean;
57
+
58
+ resolve(elementApi: import("bpmn-elements").IApi<import("bpmn-elements").Activity>): any;
59
+ }
60
+ class FormatProcess {
61
+
62
+ constructor(bp: import("bpmn-elements").Process);
63
+ process: import("bpmn-elements").Process;
64
+ _historyTTL: any;
65
+
66
+ resolve(elementApi: import("bpmn-elements").IApi<import("bpmn-elements").Process>): any;
67
+ }
68
+ class IOBase {
69
+ constructor(parm: any);
70
+
71
+ name: string;
72
+
73
+ type: string;
74
+
75
+ behaviour: any;
76
+
77
+ getValue(activity: import("bpmn-elements").Activity, executionMessage: import("bpmn-elements").ElementBrokerMessage): Promise<{
78
+ name: any;
79
+ }>;
80
+ }
81
+ class InputOutput {
82
+
83
+ constructor(parentId: string, behaviour: any, context: import("bpmn-elements").ContextInstance);
84
+ parentId: string;
85
+ context: import("bpmn-elements").ContextInstance;
86
+ input: IOBase[];
87
+ output: IOBase[];
88
+
89
+ getInput(activity: import("bpmn-elements").Activity, executionMessage: import("bpmn-elements").ElementBrokerMessage): Promise<Record<string, any>>;
90
+
91
+ getOutput(activity: import("bpmn-elements").Activity, executionMessage: import("bpmn-elements").ElementBrokerMessage): Promise<Record<string, any>>;
92
+ /**
93
+ * @param parentId parent element id
94
+ * @param list list of IO behaviours
95
+ * @param ioType type of IO
96
+ * */
97
+ _map(parentId: string, list: any[], ioType: string, context: import("bpmn-elements").ContextInstance): IOBase[];
98
+ }
99
+ class IOProperties {
100
+ constructor(activity: any, behaviour: any);
101
+ activity: any;
102
+ behaviour: any;
103
+ /**
104
+ * @param : import('bpmn-elements').IApi<any>} elementApi
105
+ * */
106
+ resolve(elementApi: any): Record<string, any>;
107
+ }
108
+ class IOForm {
109
+ constructor(activity: any, behaviour: any);
110
+ activity: any;
111
+ behaviour: any;
112
+
113
+ resolve(elementApi: import("bpmn-elements").IApi<import("bpmn-elements").Activity>): Record<string, any>;
114
+ }
115
+ class ExecutionListeners {
116
+
117
+ constructor(activity: import("bpmn-elements").Activity | import("bpmn-elements").SequenceFlow, context: import("bpmn-elements").ContextInstance);
118
+ activity: import("bpmn-elements").Activity | import("bpmn-elements").SequenceFlow;
119
+ context: import("bpmn-elements").ContextInstance;
120
+
121
+ listeners: (ScriptListener | ExpressionListener)[];
122
+ get length(): number;
123
+ get onStart(): boolean;
124
+ get onEnd(): boolean;
125
+ get onTake(): boolean;
126
+ add(extension: any, pos: any): void;
127
+ execute(event: any, message: any): Promise<{}>;
128
+ }
129
+ class ScriptListener extends Listener {
130
+ /**
131
+ * @param pos execution listener position
132
+ */
133
+ constructor(activity: import("bpmn-elements").Activity | import("bpmn-elements").SequenceFlow, context: import("bpmn-elements").ContextInstance, extension: {
134
+ script: {
135
+ $type: string;
136
+ [x: string]: any;
137
+ };
138
+ [x: string]: any;
139
+ }, pos: number);
140
+ id: string;
141
+ execute(api: any): Promise<any>;
142
+ _register(context: any, id: any, script: any): void;
143
+ }
144
+ class ExpressionListener extends Listener {
145
+ execute(api: any): Promise<{
146
+ expression: any;
147
+ }>;
148
+ }
149
+ class Listener {
150
+
151
+ constructor(activity: import("bpmn-elements").Activity | import("bpmn-elements").SequenceFlow, context: import("bpmn-elements").ContextInstance, extension: {
152
+ $type: string;
153
+ event: string;
154
+ [x: string]: any;
155
+ });
156
+ activity: import("bpmn-elements").Activity | import("bpmn-elements").SequenceFlow;
157
+ environment: import("bpmn-elements").Environment;
158
+ context: import("bpmn-elements").ContextInstance;
159
+ extension: {
160
+ [x: string]: any;
161
+ $type: string;
162
+ event: string;
163
+ };
164
+ type: string;
165
+ event: string;
166
+
167
+ execute(_api: import("bpmn-elements").IApi<any>): Promise<any>;
168
+
169
+ _getScope(api: import("bpmn-elements").IApi<any>, extend?: Record<string, any>): {
170
+ type: string;
171
+ listener: {
172
+ event: string;
173
+ };
174
+ fields: Required<import("smqp").MessageFields>;
175
+ content: import("bpmn-elements").ElementMessageContent;
176
+ properties: import("smqp").MessageProperties;
177
+ environment: import("bpmn-elements").Environment;
178
+ logger: import("bpmn-elements").ILogger;
179
+ };
180
+
181
+ _getFields(environment: import("bpmn-elements").Environment, scope: any): Record<string, any>;
182
+ }
4
183
 
5
- export class OnifySequenceFlow extends SequenceFlow {}
6
- export class OnifyTimerEventDefinition extends TimerEventDefinition {
7
- readonly supports: string[];
8
- }
9
- export function extensions(element: ElementBase, context: ContextInstance): IExtension;
10
- export const extendFn: extendFunction;
184
+ export {};
11
185
  }
12
186
 
13
187
  declare module '@onify/flow-extensions/FlowScripts' {
14
- import { IScripts, Script, ExecutionScope } from 'bpmn-elements';
15
- import { SerializableElement } from 'moddle-context-serializer';
16
- import { ScriptOptions } from 'node:vm';
188
+ import type { Script } from 'node:vm';
189
+ /**
190
+ * Flow scripts provider
191
+ * @param flowName Flow name
192
+ * @param resourceBase External resource base
193
+ * @param runContext Optional script globals
194
+ * @param timeout Optional execution timeout in milliseconds, default 60000
195
+ */
196
+ export function FlowScripts(flowName: string, resourceBase: string, runContext?: any, timeout?: number): void;
197
+ export class FlowScripts {
198
+ /**
199
+ * Flow scripts provider
200
+ * @param flowName Flow name
201
+ * @param resourceBase External resource base
202
+ * @param runContext Optional script globals
203
+ * @param timeout Optional execution timeout in milliseconds, default 60000
204
+ */
205
+ constructor(flowName: string, resourceBase: string, runContext?: any, timeout?: number);
206
+ flowName: string;
207
+
208
+ scripts: Map<string, JavaScript | JavaScriptResource>;
209
+ timeout: number;
210
+ runContext: any;
211
+ /**
212
+ * Register script element
213
+ * */
214
+ register({ id, type, behaviour }: import("moddle-context-serializer").SerializableElement): void;
215
+ /**
216
+ * Get registered script
217
+ * */
218
+ getScript(scriptType: string, { id }: {
219
+ id: string;
220
+ }): JavaScript | JavaScriptResource | undefined;
221
+ [kResources]: string;
222
+ }
223
+ /**
224
+ * Java script
225
+ *
226
+ */
227
+ export function JavaScript(flowName: string, scriptBody: string | Buffer, runContext?: any, options?: import("node:vm").ScriptOptions & {
228
+ filename?: string;
229
+ timeout?: number;
230
+ }): void;
231
+ export class JavaScript {
232
+ /**
233
+ * Java script
234
+ *
235
+ */
236
+ constructor(flowName: string, scriptBody: string | Buffer, runContext?: any, options?: import("node:vm").ScriptOptions & {
237
+ filename?: string;
238
+ timeout?: number;
239
+ });
240
+ flowName: string;
241
+ options: (import("node:vm").ScriptOptions & {
242
+ filename?: string;
243
+ timeout?: number;
244
+ }) | undefined;
245
+ runContext: any;
246
+ timeout: number | undefined;
247
+ script: Script | undefined;
248
+ /**
249
+ * Execute script
250
+ * */
251
+ execute(executionContext: import("bpmn-elements").ExecutionScope, callback: CallableFunction): Promise<any>;
252
+ [kSyntaxError]: FlowSyntaxError;
253
+ }
254
+ /**
255
+ * Java script resource
256
+ * @param resource Resource name or path
257
+ * @param resourceBase Resource base
258
+ *
259
+ */
260
+ export function JavaScriptResource(flowName: string, resource: string, resourceBase: string, runContext?: any, options?: import("node:vm").ScriptOptions & {
261
+ filename?: string;
262
+ timeout?: number;
263
+ }): void;
264
+ export class JavaScriptResource {
265
+ /**
266
+ * Java script resource
267
+ * @param resource Resource name or path
268
+ * @param resourceBase Resource base
269
+ *
270
+ */
271
+ constructor(flowName: string, resource: string, resourceBase: string, runContext?: any, options?: import("node:vm").ScriptOptions & {
272
+ filename?: string;
273
+ timeout?: number;
274
+ });
275
+ flowName: string;
276
+ resource: string;
277
+ runContext: any;
278
+ options: (import("node:vm").ScriptOptions & {
279
+ filename?: string;
280
+ timeout?: number;
281
+ }) | undefined;
282
+ timeout: number | undefined;
283
+ resourceBase: string;
284
+ /**
285
+ * Get javascript resource content
286
+ * @param resourceBase Resource base
287
+ * @param resource Resolved resource name or path
288
+ * @returns Resource content
289
+ */
290
+ getResourceContent(resourceBase: string, resource: string): Promise<string | Buffer>;
291
+ /**
292
+ * Execute script resource
293
+ * */
294
+ execute(executionContext: import("bpmn-elements").ExecutionScope, callback: CallableFunction): Promise<any>;
295
+ }
296
+ export class FlowScriptError extends Error {
297
+
298
+ constructor(fromErr: Error);
299
+ }
300
+ export class FlowSyntaxError extends Error {
301
+
302
+ constructor(fromErr: Error);
303
+ }
304
+ export class FlowResourceError extends FlowScriptError {
305
+
306
+ constructor(fromErr: Error, filename?: string);
307
+ filename: string | undefined;
308
+ inner: Error;
309
+ }
310
+ const kResources: unique symbol;
311
+ const kSyntaxError: unique symbol;
17
312
 
18
- type registerArgument = SerializableElement | { id: string; type: string; behavior: any };
19
-
20
- export interface FlowScriptOptions extends ScriptOptions {
21
- timeout?: number;
22
- }
23
-
24
- export class FlowScripts implements IScripts {
25
- /**
26
- * @param flowName Flow name
27
- * @param resourceBase External resource base
28
- * @param runContext Optional script globals
29
- * @param timeout Optional execution timeout in milliseconds, default 60000
30
- */
31
- constructor(flowName: string, resourceBase: string, runContext?: any, timeout?: number);
32
- flowName: string;
33
- timeout: number;
34
- /** Registered scripts */
35
- get scripts(): Map<string, Script | JavaScriptResource>;
36
- /** Registered scripts */
37
- register(element: registerArgument): Script | undefined;
38
- getScript(language: string, identifier: { id: string; [x: string]: any }): Script;
39
- }
40
-
41
- export class JavaScript implements Script {
42
- constructor(flowName: string, scriptBody: string | Buffer, runContext: any, options?: FlowScriptOptions);
43
- get flowName(): string;
44
- get runContext(): unknown;
45
- get options(): FlowScriptOptions;
46
- execute(executionContext: ExecutionScope, callback: CallableFunction): void;
47
- }
48
-
49
- export class JavaScriptResource extends JavaScript {
50
- constructor(flowName: string, resource: string, resourceBase: string, runContext?: unknown, options?: FlowScriptOptions);
51
- /**
52
- * Get javascript resource content
53
- * @param resourceBase Resource base
54
- * @param resource Resolved resource name or path
55
- */
56
- getResourceContent(resourceBase: string, resource: string): Promise<string | Buffer>;
57
- }
313
+ export {};
58
314
  }
315
+
316
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,52 @@
1
+ {
2
+ "version": 3,
3
+ "file": "index.d.ts",
4
+ "names": [
5
+ "extensions",
6
+ "extendFn",
7
+ "OnifySequenceFlow",
8
+ "OnifyTimerEventDefinition",
9
+ "FormatActivity",
10
+ "FormatProcess",
11
+ "IOBase",
12
+ "InputOutput",
13
+ "IOProperties",
14
+ "IOForm",
15
+ "ExecutionListeners",
16
+ "ScriptListener",
17
+ "ExpressionListener",
18
+ "Listener",
19
+ "FlowScripts",
20
+ "JavaScript",
21
+ "JavaScriptResource",
22
+ "FlowScriptError",
23
+ "FlowSyntaxError",
24
+ "FlowResourceError",
25
+ "kResources",
26
+ "kSyntaxError"
27
+ ],
28
+ "sources": [
29
+ "../src/index.js",
30
+ "../src/OnifySequenceFlow.js",
31
+ "../src/OnifyTimerEventDefinition.js",
32
+ "../src/formatters.js",
33
+ "../src/IO.js",
34
+ "../src/IOProperties.js",
35
+ "../src/IOForm.js",
36
+ "../src/ExecutionListeners.js",
37
+ "../test/helpers/FlowScripts.js"
38
+ ],
39
+ "sourcesContent": [
40
+ null,
41
+ null,
42
+ null,
43
+ null,
44
+ null,
45
+ null,
46
+ null,
47
+ null,
48
+ null
49
+ ],
50
+ "mappings": ";;;;;iBAcgBA,UAAUA;;;;iBAoBVC,QAAQA;cC/BXC,iBAAiBA;;;;cCAjBC,yBAAyBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OCHzBC,cAAcA;;;;;;;;;;OAqDdC,aAAaA;;;;;;;;OCrDbC,MAAMA;;;;;;;;;;;;;OAoHNC,WAAWA;;;;;;;;;;;;;;;;;;OCpHXC,YAAYA;;;;;;;;;OCEZC,MAAMA;;;;;;;OCuHNC,kBAAkBA;;;;;;;;;;;;;;OAzDzBC,cAAcA;;;;;;;;;;;;;;;OAkDdC,kBAAkBA;;;;;OAlHlBC,QAAQA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBCwEEC,WAAWA;cAAXA,WAAWA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA+DXC,UAAUA;;;;cAAVA,UAAUA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA6DVC,kBAAkBA;;;;cAAlBA,kBAAkBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA7LrBC,eAAeA;;;;cAuBfC,eAAeA;;;;cAuBfC,iBAAiBA;;;;;;OAhDxBC,UAAUA;OADVC,YAAYA",
51
+ "ignoreList": []
52
+ }