@0dep/bpmn-extensions 0.0.2 → 0.0.4

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
@@ -18,8 +18,8 @@ declare module '@0dep/bpmn-extensions' {
18
18
  * A flow extension activated by bpmn-elements around an element's run.
19
19
  */
20
20
  export type FlowExtension = {
21
- activate: (message: any) => void;
22
- deactivate: (message?: any) => void;
21
+ activate: (message: import("bpmn-elements").ElementBrokerMessage) => void;
22
+ deactivate: (message?: import("bpmn-elements").ElementBrokerMessage) => void;
23
23
  };
24
24
  /**
25
25
  * FEEL-aware expressions implementation for bpmn-elements.
@@ -29,7 +29,10 @@ declare module '@0dep/bpmn-extensions' {
29
29
  * `${...}` template expressions.
30
30
  *
31
31
  * */
32
- export function FeelExpressions(): import("bpmn-elements").IExpressions;
32
+ export function FeelExpressions(): import("bpmn-elements").IExpressions & {
33
+ isExpression: (text: string) => boolean;
34
+ hasExpression: (text: string) => boolean;
35
+ };
33
36
  /**
34
37
  * A bpmn-elements `scripts` implementation for script tasks.
35
38
  *
@@ -75,7 +78,10 @@ declare module '@0dep/bpmn-extensions' {
75
78
  type: string | undefined;
76
79
  taskType: any;
77
80
  activity: any;
78
- execute(executionMessage: any, callback: any): any;
81
+ /**
82
+ * Execute
83
+ * */
84
+ execute(executionMessage: import("bpmn-elements").ElementBrokerMessage, callback: CallableFunction): any;
79
85
  }
80
86
  /**
81
87
  * Activity-level extensions.
@@ -85,29 +91,29 @@ declare module '@0dep/bpmn-extensions' {
85
91
  * proceeding — the same mechanism bpmn-elements uses for extension formatting.
86
92
  */
87
93
  export class ElementExtensions {
88
- constructor(activity: any);
89
- activity: any;
90
- formatQ: any;
91
- extensions: {
92
- format: FormatActivity | FormatProcess;
93
- io?: IoMapping;
94
- headers?: TaskHeaders;
95
- properties?: Properties;
96
- listeners?: ExecutionListeners;
97
- form?: Form;
98
- loop?: LoopCharacteristics;
99
- script?: any;
100
- calledDecision?: any;
101
- Service?: Function;
102
- };
103
- activate(message: any): void;
94
+
95
+ constructor(activity: import("bpmn-elements").Activity, context: import("bpmn-elements").ContextInstance);
96
+ activity: import("bpmn-elements").Activity;
97
+ formatQ: import("smqp").Queue | undefined;
98
+
99
+ extensions: ExtensionHandlers;
100
+ /**
101
+ * Activate extensions
102
+ * */
103
+ activate(message: import("bpmn-elements").ElementBrokerMessage): void;
104
104
  deactivate(): void;
105
- /** @internal Shared with SubProcessExtensions. */
106
- _onEnter(elementApi: any): Promise<void>;
107
- /** @internal Shared with SubProcessExtensions. */
108
- _onExecuted(elementApi: any): Promise<void>;
109
- /** @internal Shared with SubProcessExtensions. */
110
- _onListener(eventType: any, elementApi: any): Promise<void>;
105
+ /**
106
+ * @internal Shared with SubProcessExtensions.
107
+ * */
108
+ _onEnter(elementApi: import("bpmn-elements").IApi<import("bpmn-elements").Activity>): Promise<void>;
109
+ /**
110
+ * @internal Shared with SubProcessExtensions.
111
+ * */
112
+ _onExecuted(elementApi: import("bpmn-elements").IApi<import("bpmn-elements").Activity>): Promise<void>;
113
+ /**
114
+ * @internal Shared with SubProcessExtensions.
115
+ * */
116
+ _onListener(eventType: any, elementApi: import("bpmn-elements").IApi<import("bpmn-elements").Activity>): Promise<void>;
111
117
  #private;
112
118
  }
113
119
  /**
@@ -115,20 +121,11 @@ declare module '@0dep/bpmn-extensions' {
115
121
  * the result to the process variables.
116
122
  */
117
123
  export class ProcessExtensions {
118
- constructor(bp: any);
119
- process: any;
120
- extensions: {
121
- format: FormatActivity | FormatProcess;
122
- io?: IoMapping;
123
- headers?: TaskHeaders;
124
- properties?: Properties;
125
- listeners?: ExecutionListeners;
126
- form?: Form;
127
- loop?: LoopCharacteristics;
128
- script?: any;
129
- calledDecision?: any;
130
- Service?: Function;
131
- };
124
+
125
+ constructor(bp: import("bpmn-elements").Process);
126
+ process: import("bpmn-elements").Process;
127
+
128
+ extensions: ExtensionHandlers;
132
129
  activate(): void;
133
130
  deactivate(): void;
134
131
  #private;
@@ -143,6 +140,7 @@ declare module '@0dep/bpmn-extensions' {
143
140
  * sub-process's own id.
144
141
  */
145
142
  export class SubProcessExtensions extends ElementExtensions {
143
+ activate(message: any): void;
146
144
  #private;
147
145
  }
148
146
  /**
@@ -164,7 +162,8 @@ declare module '@0dep/bpmn-extensions' {
164
162
  * @param expression FEEL unary test
165
163
  * @param input The value being tested, available as `?` in the test
166
164
  * @param context Additional variables in scope
167
- * */
165
+ * @returns true only when the test is satisfied — an undecidable (null) test is false
166
+ */
168
167
  export function evaluateFeelUnaryTest(expression: string, input: any, context?: Record<string, any>): boolean;
169
168
  /**
170
169
  * Resolve a value: evaluate it as FEEL when it starts with `=`, otherwise
@@ -172,6 +171,16 @@ declare module '@0dep/bpmn-extensions' {
172
171
  * @param context Variables in scope for FEEL evaluation
173
172
  * */
174
173
  export function resolveValue(value: any, context?: Record<string, any>): any;
174
+ /**
175
+ * Build the FEEL evaluation scope for an environment. The environment services are exposed
176
+ * under `services`, callable as FEEL functions (e.g. `services.isEligible(order)`) — resume-safe,
177
+ * since the host re-supplies services at recover time, unlike functions smuggled through
178
+ * variables, which JSON state serialization drops. The environment variables form the base
179
+ * scope, overlaid with any local variables (a job result, element-local variables such as a
180
+ * multi-instance item); a variable named `services` shadows the overlay.
181
+ * @param localVariables scope-local overlay
182
+ * */
183
+ export function getFeelScope(environment?: import("bpmn-elements").Environment, localVariables?: Record<string, any>): Record<string, any>;
175
184
  export class ServiceError extends Error {
176
185
  constructor(jobType: any);
177
186
  code: string;
@@ -186,15 +195,33 @@ declare module '@0dep/bpmn-extensions' {
186
195
  statusCode: number;
187
196
  };
188
197
  }
198
+ /**
199
+ * The extension handlers assembled for one element.
200
+ */
201
+ type ExtensionHandlers = {
202
+ format: FormatActivity | FormatProcess;
203
+ io?: IoMapping | undefined;
204
+ headers?: TaskHeaders | undefined;
205
+ properties?: Properties | undefined;
206
+ listeners?: ExecutionListeners | undefined;
207
+ form?: Form | undefined;
208
+ loop?: LoopCharacteristics | undefined;
209
+ script?: any;
210
+ calledDecision?: any;
211
+ Service?: Function | undefined;
212
+ subscription?: Subscription | undefined;
213
+ };
189
214
  /**
190
215
  * Format an activity on enter from its behaviour and extensions: documentation and,
191
216
  * for user tasks, the `zeebe:assignmentDefinition` (assignee, candidate users/groups).
192
217
  */
193
218
  class FormatActivity {
194
- constructor(activity: any, assignmentDefinition: any);
195
- activity: any;
219
+
220
+ constructor(activity: import("bpmn-elements").Activity, assignmentDefinition: any);
221
+ activity: import("bpmn-elements").Activity;
196
222
  assignmentDefinition: any;
197
- resolve(elementApi: any): {
223
+
224
+ resolve(elementApi: import("bpmn-elements").IApi<import("bpmn-elements").Activity>): {
198
225
  description: any;
199
226
  assignee: any;
200
227
  candidateUsers: any[];
@@ -205,9 +232,11 @@ declare module '@0dep/bpmn-extensions' {
205
232
  * Format a process on enter: documentation.
206
233
  */
207
234
  class FormatProcess {
208
- constructor(bp: any);
209
- process: any;
210
- resolve(elementApi: any): {
235
+
236
+ constructor(bp: import("bpmn-elements").Process);
237
+ process: import("bpmn-elements").Process;
238
+
239
+ resolve(elementApi: import("bpmn-elements").IApi<import("bpmn-elements").Process>): {
211
240
  description: any;
212
241
  };
213
242
  }
@@ -319,10 +348,43 @@ declare module '@0dep/bpmn-extensions' {
319
348
  get hasOutputCollection(): boolean;
320
349
  /**
321
350
  * @param indexedOutput bpmn-elements index-keyed instance outputs
322
- * @param baseScope process variables in scope for `outputElement`
351
+ * @param baseScope base scope for `outputElement` (services + process variables)
323
352
  * */
324
353
  aggregate(indexedOutput: Record<string, any> | undefined, baseScope: Record<string, any>): any[];
325
354
  }
355
+ /**
356
+ * `zeebe:subscription` — rides on the referenced `bpmn:Message`, not on the catching element.
357
+ *
358
+ * Resolves the correlation key in the activity's variable scope on enter and exposes it on the
359
+ * element content as `subscription`. Correlation itself is the embedding application's job:
360
+ * read the resolved key off the waiting activity (`getPostponed()` → `content.subscription`)
361
+ * and signal the matching one (`api.signal(...)`).
362
+ */
363
+ class Subscription {
364
+ /**
365
+ * @param messageRef The serialized message reference
366
+ * @param subscription The `zeebe:Subscription` behaviour
367
+ */
368
+ constructor(messageRef: {
369
+ id: string;
370
+ name?: string;
371
+ }, subscription: {
372
+ correlationKey: string;
373
+ });
374
+ message: {
375
+ id: string;
376
+ name: string | undefined;
377
+ };
378
+ correlationKey: string;
379
+
380
+ resolve(elementApi: import("bpmn-elements").IApi<any>): {
381
+ message: {
382
+ id: string;
383
+ name?: string;
384
+ };
385
+ correlationKey: any;
386
+ };
387
+ }
326
388
 
327
389
  export {};
328
390
  }
@@ -15,6 +15,7 @@
15
15
  "evaluateFeel",
16
16
  "evaluateFeelUnaryTest",
17
17
  "resolveValue",
18
+ "getFeelScope",
18
19
  "ServiceError",
19
20
  "FormatError",
20
21
  "FormatActivity",
@@ -24,7 +25,8 @@
24
25
  "Properties",
25
26
  "ExecutionListeners",
26
27
  "Form",
27
- "LoopCharacteristics"
28
+ "LoopCharacteristics",
29
+ "Subscription"
28
30
  ],
29
31
  "sources": [
30
32
  "../src/index.js",
@@ -42,7 +44,8 @@
42
44
  "../src/extensions/Properties.js",
43
45
  "../src/extensions/ExecutionListeners.js",
44
46
  "../src/extensions/Form.js",
45
- "../src/extensions/LoopCharacteristics.js"
47
+ "../src/extensions/LoopCharacteristics.js",
48
+ "../src/extensions/Subscription.js"
46
49
  ],
47
50
  "sourcesContent": [
48
51
  null,
@@ -60,8 +63,9 @@
60
63
  null,
61
64
  null,
62
65
  null,
66
+ null,
63
67
  null
64
68
  ],
65
- "mappings": ";;;;;;;iBAwBgBA,UAAUA;;;;;;;;iBAqBVC,QAAQA;;;;;;;;;;;;;;;;iBClCRC,eAAeA;;;;;;;;;;;iBCEfC,WAAWA;;;;;;;;;;;;;;;iBCIXC,UAAUA;cAAVA,UAAUA;;;;;;;;;;;;;;;;;;;;;;;;;;;;cCNbC,iBAAiBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cCJjBC,iBAAiBA;;;;;;;;;;;;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