@uipath/maestro-builder-sdk 6.122.3 → 6.122.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.
- package/dist/api-index.md +83 -81
- package/dist/api-members.md +354 -354
- package/dist/bpmn/bpmn-sdk.d.ts +54 -19
- package/dist/bpmn/bpmn-sdk.js +42 -9
- package/dist/bpmn/decompile.js +46 -5
- package/dist/bpmn/merge.js +7 -3
- package/dist/bpmn/serialize.js +5 -1
- package/dist/bpmn-api.md +38 -9
- package/dist/core/refusals.d.ts +1 -0
- package/dist/core/refusals.js +1 -0
- package/dist/nodes/document/flow/family.d.ts +1 -0
- package/dist/nodes/document/flow/family.js +1 -0
- package/dist/nodes/document/flow/ixp.d.ts +9 -0
- package/dist/nodes/document/flow/ixp.js +11 -0
- package/dist/nodes/document/flow/node-type.js +2 -2
- package/dist/serialize.js +5 -2
- package/package.json +2 -2
package/dist/bpmn/bpmn-sdk.d.ts
CHANGED
|
@@ -53,10 +53,45 @@ export type ErrorLike = true | string | {
|
|
|
53
53
|
name: string;
|
|
54
54
|
code?: string;
|
|
55
55
|
};
|
|
56
|
+
/**
|
|
57
|
+
* The message choice that is not a message name — see {@link MessageLike}.
|
|
58
|
+
*
|
|
59
|
+
* Writes a bare `<bpmn:messageEventDefinition />` with no `messageRef` and declares
|
|
60
|
+
* no message: the shape Studio Web saves for a message event whose message was never
|
|
61
|
+
* picked, and the one it writes on events that host a connector wait or call.
|
|
62
|
+
* Decompile emits it for that shape. A registered symbol, like `ANY_ESCALATION`, so
|
|
63
|
+
* every loaded copy of the SDK matches it.
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* ```ts
|
|
67
|
+
* bpmn('p')
|
|
68
|
+
* .startEvent('s')
|
|
69
|
+
* .intermediateCatchEvent('reply', { message: NO_MESSAGE })
|
|
70
|
+
* .endEvent('e')
|
|
71
|
+
* .build();
|
|
72
|
+
* ```
|
|
73
|
+
*/
|
|
74
|
+
export declare const NO_MESSAGE: unique symbol;
|
|
75
|
+
/**
|
|
76
|
+
* What a message event waits for or throws: a message NAME, or {@link NO_MESSAGE}.
|
|
77
|
+
*
|
|
78
|
+
* A name declares (or reuses) a definitions-level `bpmn:message` with that name and
|
|
79
|
+
* points the event's `messageRef` at it. `NO_MESSAGE` declares nothing.
|
|
80
|
+
*
|
|
81
|
+
* A blank name is refused (`BPMN_MESSAGE_NAME_EMPTY`): it would declare a
|
|
82
|
+
* `bpmn:message` with no name, which `uip maestro bpmn validate` rejects
|
|
83
|
+
* (`EVENT_OBJECT_EMPTY_REQUIRED_FIELD`).
|
|
84
|
+
*/
|
|
85
|
+
export type MessageLike = string | typeof NO_MESSAGE;
|
|
56
86
|
/** The resolved event definition attached to an event node. */
|
|
57
|
-
export type EventDef =
|
|
87
|
+
export type EventDef =
|
|
88
|
+
/**
|
|
89
|
+
* A message definition. `messageRef` absent is a bare
|
|
90
|
+
* `<bpmn:messageEventDefinition />` pointing at no declaration — see {@link MessageLike}.
|
|
91
|
+
*/
|
|
92
|
+
{
|
|
58
93
|
type: 'message';
|
|
59
|
-
messageRef
|
|
94
|
+
messageRef?: string;
|
|
60
95
|
} | {
|
|
61
96
|
type: 'timer';
|
|
62
97
|
timer: TimerSpec;
|
|
@@ -701,7 +736,7 @@ export interface ExtensionPayload {
|
|
|
701
736
|
*
|
|
702
737
|
* ```ts
|
|
703
738
|
* .endEvent('notify', {
|
|
704
|
-
* message:
|
|
739
|
+
* message: NO_MESSAGE,
|
|
705
740
|
* payload: {
|
|
706
741
|
* type: 'Intsvc.ActivityExecution',
|
|
707
742
|
* contextRows: [
|
|
@@ -729,8 +764,8 @@ export interface ExtensionPayload {
|
|
|
729
764
|
export interface StartOpts {
|
|
730
765
|
/** Display name the designer shows on the event. */
|
|
731
766
|
name?: string;
|
|
732
|
-
/** Start when this message arrives — declares/reuses a definitions-level `bpmn:message
|
|
733
|
-
message?:
|
|
767
|
+
/** Start when this message arrives — declares/reuses a definitions-level `bpmn:message`; `NO_MESSAGE` for none — see {@link MessageLike}. */
|
|
768
|
+
message?: MessageLike;
|
|
734
769
|
/**
|
|
735
770
|
* Catch an error — an INTERRUPTING error start event
|
|
736
771
|
* (`bpmn:errorEventDefinition`), declaring/reusing a definitions-level
|
|
@@ -838,8 +873,8 @@ export interface EndOpts {
|
|
|
838
873
|
name?: string;
|
|
839
874
|
/** End as a TERMINATE event — abort the whole process instance, not just this path. */
|
|
840
875
|
terminate?: boolean;
|
|
841
|
-
/** End by throwing this message — declares/reuses a definitions-level `bpmn:message
|
|
842
|
-
message?:
|
|
876
|
+
/** End by throwing this message — declares/reuses a definitions-level `bpmn:message`; `NO_MESSAGE` for none — see {@link MessageLike}. */
|
|
877
|
+
message?: MessageLike;
|
|
843
878
|
/**
|
|
844
879
|
* End by throwing this error (a name, or `{ name, code }`) — declares/reuses a
|
|
845
880
|
* definitions-level `bpmn:error`.
|
|
@@ -861,8 +896,8 @@ export interface EndOpts {
|
|
|
861
896
|
export interface CatchOpts {
|
|
862
897
|
/** Display name the designer shows on the event. */
|
|
863
898
|
name?: string;
|
|
864
|
-
/** Wait for this message — declares/reuses a definitions-level `bpmn:message
|
|
865
|
-
message?:
|
|
899
|
+
/** Wait for this message — declares/reuses a definitions-level `bpmn:message`; `NO_MESSAGE` for none — see {@link MessageLike}. */
|
|
900
|
+
message?: MessageLike;
|
|
866
901
|
/** Wait for a timer — an ISO-8601 duration string, or a full {@link TimerSpec}. */
|
|
867
902
|
timer?: TimerLike;
|
|
868
903
|
/** An extension payload on the event — see {@link ExtensionPayload}. */
|
|
@@ -872,8 +907,8 @@ export interface CatchOpts {
|
|
|
872
907
|
export interface ThrowOpts {
|
|
873
908
|
/** Display name the designer shows on the event. */
|
|
874
909
|
name?: string;
|
|
875
|
-
/** The message to throw — declares/reuses a definitions-level `bpmn:message
|
|
876
|
-
message?:
|
|
910
|
+
/** The message to throw — declares/reuses a definitions-level `bpmn:message`; `NO_MESSAGE` for none — see {@link MessageLike}. */
|
|
911
|
+
message?: MessageLike;
|
|
877
912
|
/** An extension payload on the event — see {@link ExtensionPayload}. */
|
|
878
913
|
payload?: ExtensionPayload;
|
|
879
914
|
}
|
|
@@ -895,8 +930,8 @@ export interface BoundaryOpts {
|
|
|
895
930
|
attachedTo: string;
|
|
896
931
|
/** true (default) = interrupting; false = non-interrupting. */
|
|
897
932
|
cancelActivity?: boolean;
|
|
898
|
-
/** Catch this message — declares/reuses a definitions-level `bpmn:message
|
|
899
|
-
message?:
|
|
933
|
+
/** Catch this message — declares/reuses a definitions-level `bpmn:message`; `NO_MESSAGE` for none — see {@link MessageLike}. */
|
|
934
|
+
message?: MessageLike;
|
|
900
935
|
/** Fire on a timer — an ISO-8601 duration string, or a full {@link TimerSpec}. */
|
|
901
936
|
timer?: TimerLike;
|
|
902
937
|
/**
|
|
@@ -2149,8 +2184,8 @@ export interface EventSubProcessOpts {
|
|
|
2149
2184
|
* Always interrupting.
|
|
2150
2185
|
*/
|
|
2151
2186
|
error?: ErrorLike;
|
|
2152
|
-
/** Start when this message arrives while the container is active. */
|
|
2153
|
-
message?:
|
|
2187
|
+
/** Start when this message arrives while the container is active; `NO_MESSAGE` for none — see {@link MessageLike}. */
|
|
2188
|
+
message?: MessageLike;
|
|
2154
2189
|
/** Start on a timer measured from the container's own start. */
|
|
2155
2190
|
timer?: TimerLike;
|
|
2156
2191
|
/**
|
|
@@ -3801,20 +3836,20 @@ export declare class ActivityBuilder {
|
|
|
3801
3836
|
* Catch a message while the activity runs — declaring or reusing the
|
|
3802
3837
|
* definitions-level `bpmn:message`.
|
|
3803
3838
|
*
|
|
3804
|
-
* @param message - The message's name.
|
|
3839
|
+
* @param message - The message's name, or `NO_MESSAGE` for a bare definition — see {@link MessageLike}.
|
|
3805
3840
|
* @param body - The handler path.
|
|
3806
3841
|
* @returns This builder, so handlers chain.
|
|
3807
3842
|
*/
|
|
3808
|
-
onMessage(message:
|
|
3843
|
+
onMessage(message: MessageLike, body?: ArmBodyFn): this;
|
|
3809
3844
|
/**
|
|
3810
3845
|
* Catch a message with options — `interrupting`, an `id`, a `name`.
|
|
3811
3846
|
*
|
|
3812
|
-
* @param message - The message's name.
|
|
3847
|
+
* @param message - The message's name, or `NO_MESSAGE` for a bare definition — see {@link MessageLike}.
|
|
3813
3848
|
* @param opts - See {@link MessageHandlerOpts}.
|
|
3814
3849
|
* @param body - The handler path.
|
|
3815
3850
|
* @returns This builder, so handlers chain.
|
|
3816
3851
|
*/
|
|
3817
|
-
onMessage(message:
|
|
3852
|
+
onMessage(message: MessageLike, opts: MessageHandlerOpts, body?: ArmBodyFn): this;
|
|
3818
3853
|
}
|
|
3819
3854
|
/**
|
|
3820
3855
|
* The top-level process builder `bpmn()` returns — every graph method of the
|
package/dist/bpmn/bpmn-sdk.js
CHANGED
|
@@ -14,6 +14,25 @@ export { connectorOutputVars, nodeDeclaredVars, typedNodeDeclaredVars } from './
|
|
|
14
14
|
function normTimer(t) {
|
|
15
15
|
return typeof t === 'string' ? { duration: t } : t;
|
|
16
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* The message choice that is not a message name — see {@link MessageLike}.
|
|
19
|
+
*
|
|
20
|
+
* Writes a bare `<bpmn:messageEventDefinition />` with no `messageRef` and declares
|
|
21
|
+
* no message: the shape Studio Web saves for a message event whose message was never
|
|
22
|
+
* picked, and the one it writes on events that host a connector wait or call.
|
|
23
|
+
* Decompile emits it for that shape. A registered symbol, like `ANY_ESCALATION`, so
|
|
24
|
+
* every loaded copy of the SDK matches it.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```ts
|
|
28
|
+
* bpmn('p')
|
|
29
|
+
* .startEvent('s')
|
|
30
|
+
* .intermediateCatchEvent('reply', { message: NO_MESSAGE })
|
|
31
|
+
* .endEvent('e')
|
|
32
|
+
* .build();
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export const NO_MESSAGE = Symbol.for('@uipath/maestro-builder-sdk/bpmn/noMessage');
|
|
17
36
|
/**
|
|
18
37
|
* The `uipath:type` version of an app-backed `.humanTask()`. PO.BpmnEngine
|
|
19
38
|
* (`AppTasksCreateArgs`) reads the app from `name`/`folderPath` only on `v2`; on `v1` it
|
|
@@ -238,6 +257,20 @@ function toErrorDef(defs, error, where) {
|
|
|
238
257
|
}
|
|
239
258
|
return { type: 'error', errorRef: defs.errorRef(spec.name, spec.code ?? spec.name) };
|
|
240
259
|
}
|
|
260
|
+
/**
|
|
261
|
+
* The message definition for an event's `message` option — see {@link MessageLike}.
|
|
262
|
+
* A blank name is refused: it would declare a `bpmn:message` validate rejects.
|
|
263
|
+
*/
|
|
264
|
+
function toMessageDef(defs, message, where) {
|
|
265
|
+
if (message === NO_MESSAGE)
|
|
266
|
+
return { type: 'message' };
|
|
267
|
+
if (typeof message !== 'string' || message.trim() === '') {
|
|
268
|
+
throw new CompileRefusal('BPMN_MESSAGE_NAME_EMPTY', `${where}: the message name is empty, so the declared \`bpmn:message\` has no name, which validate rejects. ` +
|
|
269
|
+
'Pass `message: NO_MESSAGE` for a message event with no message chosen (a bare `<bpmn:messageEventDefinition />`), ' +
|
|
270
|
+
'or a name — `message: "OrderPlaced"`.');
|
|
271
|
+
}
|
|
272
|
+
return { type: 'message', messageRef: defs.messageRef(message) };
|
|
273
|
+
}
|
|
241
274
|
/** The error a boundary event or event sub-process catches: its ref, or catch-all. */
|
|
242
275
|
function errorCaught(n) {
|
|
243
276
|
const event = 'event' in n ? n.event : undefined;
|
|
@@ -741,7 +774,7 @@ class ScopeBuilder {
|
|
|
741
774
|
// and because an intermediate catch event (the other `startCatchDef` caller)
|
|
742
775
|
// cannot carry one: BPMN catches errors at a boundary or an event sub-process
|
|
743
776
|
// start, never mid-flow.
|
|
744
|
-
event: opts.error !== undefined ? toErrorDef(this._defs, opts.error, `startEvent "${id}"`) : this.startCatchDef(opts),
|
|
777
|
+
event: opts.error !== undefined ? toErrorDef(this._defs, opts.error, `startEvent "${id}"`) : this.startCatchDef(opts, `startEvent "${id}"`),
|
|
745
778
|
trigger: opts.trigger === undefined
|
|
746
779
|
? undefined
|
|
747
780
|
: { type: 'Intsvc.TimerTrigger', outputVar: opts.trigger === true ? undefined : opts.trigger.outputVar },
|
|
@@ -761,7 +794,7 @@ class ScopeBuilder {
|
|
|
761
794
|
else if (opts.error !== undefined)
|
|
762
795
|
event = toErrorDef(this._defs, opts.error, `endEvent "${id}"`);
|
|
763
796
|
else if (opts.message !== undefined)
|
|
764
|
-
event =
|
|
797
|
+
event = toMessageDef(this._defs, opts.message, `endEvent "${id}"`);
|
|
765
798
|
return this.push({ kind: 'endEvent', id, name: opts.name, event, payload: opts.payload });
|
|
766
799
|
}
|
|
767
800
|
/**
|
|
@@ -776,7 +809,7 @@ class ScopeBuilder {
|
|
|
776
809
|
kind: 'intermediateCatchEvent',
|
|
777
810
|
id,
|
|
778
811
|
name: opts.name,
|
|
779
|
-
event: this.startCatchDef(opts),
|
|
812
|
+
event: this.startCatchDef(opts, `intermediateCatchEvent "${id}"`),
|
|
780
813
|
payload: opts.payload,
|
|
781
814
|
});
|
|
782
815
|
}
|
|
@@ -788,7 +821,7 @@ class ScopeBuilder {
|
|
|
788
821
|
* @returns This builder, so calls chain.
|
|
789
822
|
*/
|
|
790
823
|
intermediateThrowEvent(id, opts = {}) {
|
|
791
|
-
const event = opts.message !== undefined ?
|
|
824
|
+
const event = opts.message !== undefined ? toMessageDef(this._defs, opts.message, `intermediateThrowEvent "${id}"`) : undefined;
|
|
792
825
|
return this.push({ kind: 'intermediateThrowEvent', id, name: opts.name, event, payload: opts.payload });
|
|
793
826
|
}
|
|
794
827
|
/**
|
|
@@ -805,7 +838,7 @@ class ScopeBuilder {
|
|
|
805
838
|
else if (opts.timer !== undefined)
|
|
806
839
|
event = { type: 'timer', timer: normTimer(opts.timer) };
|
|
807
840
|
else if (opts.message !== undefined)
|
|
808
|
-
event =
|
|
841
|
+
event = toMessageDef(this._defs, opts.message, `boundaryEvent "${id}"`);
|
|
809
842
|
return this.push({
|
|
810
843
|
kind: 'boundaryEvent',
|
|
811
844
|
id,
|
|
@@ -816,11 +849,11 @@ class ScopeBuilder {
|
|
|
816
849
|
payload: opts.payload,
|
|
817
850
|
});
|
|
818
851
|
}
|
|
819
|
-
startCatchDef(opts) {
|
|
852
|
+
startCatchDef(opts, where) {
|
|
820
853
|
if (opts.timer !== undefined)
|
|
821
854
|
return { type: 'timer', timer: normTimer(opts.timer) };
|
|
822
855
|
if (opts.message !== undefined)
|
|
823
|
-
return
|
|
856
|
+
return toMessageDef(this._defs, opts.message, where);
|
|
824
857
|
return undefined;
|
|
825
858
|
}
|
|
826
859
|
// ── Gateways ──
|
|
@@ -2224,7 +2257,7 @@ class ScopeBuilder {
|
|
|
2224
2257
|
else if (opts.timer !== undefined)
|
|
2225
2258
|
event = { type: 'timer', timer: normTimer(opts.timer) };
|
|
2226
2259
|
else
|
|
2227
|
-
event =
|
|
2260
|
+
event = toMessageDef(this._defs, opts.message, `eventSubProcess "${id}"`);
|
|
2228
2261
|
const sb = new SubProcessBuilder(this._defs, this._bindingRegistry, undefined, 'sequence', this._sugar);
|
|
2229
2262
|
sb._begin({
|
|
2230
2263
|
kind: 'startEvent',
|
|
@@ -2803,7 +2836,7 @@ export class ActivityBuilder {
|
|
|
2803
2836
|
onMessage(message, b, c) {
|
|
2804
2837
|
const opts = b !== undefined && typeof b === 'object' ? b : {};
|
|
2805
2838
|
const body = typeof b === 'function' ? b : c;
|
|
2806
|
-
this.scope._attach(this.activity, 'onMessage', { event:
|
|
2839
|
+
this.scope._attach(this.activity, 'onMessage', { event: toMessageDef(this.scope._defsOf(), message, `.onMessage() on "${this.activity}"`), interrupting: opts.interrupting ?? true, opts }, body);
|
|
2807
2840
|
return this;
|
|
2808
2841
|
}
|
|
2809
2842
|
}
|
package/dist/bpmn/decompile.js
CHANGED
|
@@ -298,6 +298,8 @@ let runUnmodelled = new Map();
|
|
|
298
298
|
* what each carried. Announced in the source header, like `runUnmodelled`.
|
|
299
299
|
*/
|
|
300
300
|
let runScriptTypes = new Map();
|
|
301
|
+
/** Whether this run's source names `NO_MESSAGE`, so the import lists it. */
|
|
302
|
+
let runUsesNoMessage = false;
|
|
301
303
|
let runLiftPlans = new Map();
|
|
302
304
|
let runLiftSkipped = [];
|
|
303
305
|
let runLiftCalls = new Map();
|
|
@@ -704,7 +706,13 @@ function eventOptions(el) {
|
|
|
704
706
|
return [];
|
|
705
707
|
switch (def.$type) {
|
|
706
708
|
case 'bpmn:MessageEventDefinition':
|
|
707
|
-
|
|
709
|
+
// No `messageRef` is a message event with no message chosen — what Studio Web
|
|
710
|
+
// saves on events that host a connector wait or call.
|
|
711
|
+
if (!def.messageRef) {
|
|
712
|
+
runUsesNoMessage = true;
|
|
713
|
+
return [['message', 'NO_MESSAGE']];
|
|
714
|
+
}
|
|
715
|
+
return [['message', tsText(def.messageRef.name ?? '')]];
|
|
708
716
|
case 'bpmn:TerminateEventDefinition':
|
|
709
717
|
return [['terminate', 'true']];
|
|
710
718
|
case 'bpmn:ErrorEventDefinition': {
|
|
@@ -2624,13 +2632,41 @@ function variablesHost(defs, process) {
|
|
|
2624
2632
|
`// those scoped to it are rehomed onto the process, which is a legal scope.\n\n`;
|
|
2625
2633
|
return { container: collab, rehome: { from: collab.id, to: process.id }, note };
|
|
2626
2634
|
}
|
|
2635
|
+
/**
|
|
2636
|
+
* The process this source describes, when the document has one per pool. A pool drawn
|
|
2637
|
+
* for an outside party is often empty (`<bpmn:process id="..." />`), so the first with
|
|
2638
|
+
* a start event wins, else the first with any flow element, else the first.
|
|
2639
|
+
*/
|
|
2640
|
+
function mainProcess(processes) {
|
|
2641
|
+
const elements = (p) => p.flowElements ?? [];
|
|
2642
|
+
return (processes.find((p) => elements(p).some((el) => el.$type === 'bpmn:StartEvent')) ??
|
|
2643
|
+
processes.find((p) => elements(p).length > 0) ??
|
|
2644
|
+
processes[0]);
|
|
2645
|
+
}
|
|
2646
|
+
/**
|
|
2647
|
+
* The header note naming every OTHER process that has content: the builder models one
|
|
2648
|
+
* process, so a bare recompile drops them, while `bpmn merge` back into the original
|
|
2649
|
+
* keeps them. Empty when no other process has a flow element.
|
|
2650
|
+
*/
|
|
2651
|
+
function otherPoolsNote(processes, chosen) {
|
|
2652
|
+
const others = processes.filter((p) => p !== chosen && (p.flowElements ?? []).length > 0);
|
|
2653
|
+
if (!others.length)
|
|
2654
|
+
return '';
|
|
2655
|
+
return (`// OTHER POOLS LEFT TO THE ORIGINAL. The document holds ${commentText(String(processes.length))} processes and this\n` +
|
|
2656
|
+
`// source describes one, ${commentText(String(chosen.id))}. A bare recompile drops the others;\n` +
|
|
2657
|
+
`// \`bpmn merge\` back into the original keeps them:\n` +
|
|
2658
|
+
others.map((p) => `// - bpmn:process ${commentText(String(p.id))} (${commentText(String((p.flowElements ?? []).length))} elements)\n`).join('') +
|
|
2659
|
+
'\n');
|
|
2660
|
+
}
|
|
2627
2661
|
export async function decompile(xml, options = {}) {
|
|
2628
2662
|
const moddle = new BpmnModdle({ uipath: uipathDescriptor });
|
|
2629
2663
|
const { rootElement } = await moddle.fromXML(xml, { lax: true });
|
|
2630
2664
|
const defs = rootElement;
|
|
2631
|
-
const
|
|
2665
|
+
const processes = (defs.rootElements ?? []).filter((r) => r.$type === 'bpmn:Process');
|
|
2666
|
+
const process = mainProcess(processes);
|
|
2632
2667
|
if (!process)
|
|
2633
2668
|
throw new Error('decompile: no bpmn:Process in the document');
|
|
2669
|
+
const otherPools = otherPoolsNote(processes, process);
|
|
2634
2670
|
const indent = ' ';
|
|
2635
2671
|
const chain = new Chain(indent);
|
|
2636
2672
|
const host = variablesHost(defs, process);
|
|
@@ -2740,6 +2776,7 @@ export async function decompile(xml, options = {}) {
|
|
|
2740
2776
|
runLibrary = options.library;
|
|
2741
2777
|
runUnmodelled = new Map();
|
|
2742
2778
|
runScriptTypes = new Map();
|
|
2779
|
+
runUsesNoMessage = false;
|
|
2743
2780
|
runLiftPlans = new Map();
|
|
2744
2781
|
runLiftSkipped = [];
|
|
2745
2782
|
runLiftCalls = new Map();
|
|
@@ -2800,7 +2837,7 @@ export async function decompile(xml, options = {}) {
|
|
|
2800
2837
|
runLibrary = undefined;
|
|
2801
2838
|
}
|
|
2802
2839
|
const importFrom = options.importSpecifier ?? './bpmn-sdk.js';
|
|
2803
|
-
const
|
|
2840
|
+
const importedNames = [...schemaPlan.imports];
|
|
2804
2841
|
const unmodelledNote = runUnmodelled.size
|
|
2805
2842
|
? `// DATA ELEMENTS LEFT TO THE ORIGINAL. The builder does not model BPMN data\n` +
|
|
2806
2843
|
`// objects or data stores, and no sequence flow touches them, so this source\n` +
|
|
@@ -2820,13 +2857,17 @@ export async function decompile(xml, options = {}) {
|
|
|
2820
2857
|
'\n'
|
|
2821
2858
|
: '';
|
|
2822
2859
|
runScriptTypes = new Map();
|
|
2860
|
+
if (runUsesNoMessage)
|
|
2861
|
+
importedNames.push('NO_MESSAGE');
|
|
2862
|
+
runUsesNoMessage = false;
|
|
2863
|
+
const imported = ['bpmn', ...importedNames.sort()].join(', ');
|
|
2823
2864
|
const imports = `import { ${imported} } from ${tsText(importFrom)};\n\n`;
|
|
2824
2865
|
const nameCall = process.name !== undefined ? `${indent}.name(${tsText(process.name)})` : undefined;
|
|
2825
2866
|
options.onConnectorLift?.({
|
|
2826
2867
|
lifted: [...runLiftPlans.keys()],
|
|
2827
2868
|
verbatim: runLiftSkipped,
|
|
2828
2869
|
preamble: {
|
|
2829
|
-
prefix: `${host.note}${unmodelledNote}${scriptTypeNote}${imports}`,
|
|
2870
|
+
prefix: `${host.note}${otherPools}${unmodelledNote}${scriptTypeNote}${imports}`,
|
|
2830
2871
|
head: `bpmn(${tsText(process.id)})`,
|
|
2831
2872
|
calls: [...(nameCall !== undefined ? [nameCall] : []), ...chain.all.slice(0, preambleLines)],
|
|
2832
2873
|
},
|
|
@@ -2842,7 +2883,7 @@ export async function decompile(xml, options = {}) {
|
|
|
2842
2883
|
binding: 'processBuilder',
|
|
2843
2884
|
indent,
|
|
2844
2885
|
});
|
|
2845
|
-
return `${host.note}${unmodelledNote}${scriptTypeNote}${imports}${body}\n`;
|
|
2886
|
+
return `${host.note}${otherPools}${unmodelledNote}${scriptTypeNote}${imports}${body}\n`;
|
|
2846
2887
|
}
|
|
2847
2888
|
/**
|
|
2848
2889
|
* Variable ids the serializer creates on its own from a node's output rows.
|
package/dist/bpmn/merge.js
CHANGED
|
@@ -90,8 +90,10 @@ import { placeAddedElements, retypedShapeSize } from './merge-placement.js';
|
|
|
90
90
|
import { findByLocal, parseXmlRanges } from './xml-ranges.js';
|
|
91
91
|
const WIRING = new Set(['incoming', 'outgoing']);
|
|
92
92
|
const isWiring = (range) => WIRING.has(range.local);
|
|
93
|
-
function processOf(xml, label) {
|
|
94
|
-
const
|
|
93
|
+
function processOf(xml, label, id) {
|
|
94
|
+
const roots = parseXmlRanges(xml);
|
|
95
|
+
const byId = id === undefined ? undefined : roots.flatMap((r) => r.children).find((c) => c.local === 'process' && c.id === id);
|
|
96
|
+
const process = byId ?? findByLocal(roots, 'process');
|
|
95
97
|
if (!process)
|
|
96
98
|
throw new Error(`merge: ${label} has no bpmn:process`);
|
|
97
99
|
return process;
|
|
@@ -715,8 +717,10 @@ function mergeCollaborationExtensions(documents, ctx) {
|
|
|
715
717
|
};
|
|
716
718
|
}
|
|
717
719
|
function twoWay(originalXml, editedXml) {
|
|
718
|
-
const originalProcess = processOf(originalXml, 'original');
|
|
719
720
|
const editedProcess = processOf(editedXml, 'edited');
|
|
721
|
+
// The original's process with the edited one's id: in a document with several pools,
|
|
722
|
+
// decompile describes the one that can run (`mainProcess`), not always the first.
|
|
723
|
+
const originalProcess = processOf(originalXml, 'original', editedProcess.id);
|
|
720
724
|
const originalById = new Map(originalProcess.children.filter((c) => c.id !== undefined).map((c) => [c.id, c]));
|
|
721
725
|
const authored = [];
|
|
722
726
|
const kept = new Set();
|
package/dist/bpmn/serialize.js
CHANGED
|
@@ -1077,7 +1077,11 @@ function eventDefinition(ctx, def) {
|
|
|
1077
1077
|
return undefined;
|
|
1078
1078
|
switch (def.type) {
|
|
1079
1079
|
case 'message':
|
|
1080
|
-
|
|
1080
|
+
// No `messageRef` is a bare `<bpmn:messageEventDefinition />` (see `MessageLike`);
|
|
1081
|
+
// moddle omits an undefined attribute, as for a catch-any error below.
|
|
1082
|
+
return m.create('bpmn:MessageEventDefinition', {
|
|
1083
|
+
messageRef: def.messageRef === undefined ? undefined : ctx.messageById.get(def.messageRef),
|
|
1084
|
+
});
|
|
1081
1085
|
case 'error':
|
|
1082
1086
|
// No `errorRef` is BPMN's catch-any, and moddle omits an undefined attribute —
|
|
1083
1087
|
// so this emits the bare `<bpmn:errorEventDefinition />` the product writes.
|
package/dist/bpmn-api.md
CHANGED
|
@@ -13,6 +13,12 @@ You do not need the `.d.ts` to write a `.bpmn.ts`. Read a declaration only for t
|
|
|
13
13
|
|
|
14
14
|
## BPMN authoring
|
|
15
15
|
|
|
16
|
+
### `NO_MESSAGE`
|
|
17
|
+
|
|
18
|
+
The message choice that is not a message name — see MessageLike.
|
|
19
|
+
|
|
20
|
+
- `const NO_MESSAGE: unique symbol`
|
|
21
|
+
|
|
16
22
|
### `errorSchema`
|
|
17
23
|
|
|
18
24
|
The `Error` variable's shape — the platform's own error envelope.
|
|
@@ -124,8 +130,8 @@ The boundary events of one activity, declared on the activity itself — what th
|
|
|
124
130
|
- `ActivityBuilder.onError(error: ErrorLike, opts: ErrorHandlerOpts, body?: ArmBodyFn): this` — Catch an error with options — an `id`, a `name`, an `errorVar` to capture it into.
|
|
125
131
|
- `ActivityBuilder.onTimer(timer: TimerLike, body?: ArmBodyFn): this` — Fire a timer while the activity runs — a deadline that cancels it, or a reminder that does not (`interrupting: false`).
|
|
126
132
|
- `ActivityBuilder.onTimer(timer: TimerLike, opts: TimerHandlerOpts, body?: ArmBodyFn): this` — Fire a timer with options — `interrupting`, an `id`, a `name`.
|
|
127
|
-
- `ActivityBuilder.onMessage(message:
|
|
128
|
-
- `ActivityBuilder.onMessage(message:
|
|
133
|
+
- `ActivityBuilder.onMessage(message: MessageLike, body?: ArmBodyFn): this` — Catch a message while the activity runs — declaring or reusing the definitions-level `bpmn:message`.
|
|
134
|
+
- `ActivityBuilder.onMessage(message: MessageLike, opts: MessageHandlerOpts, body?: ArmBodyFn): this` — Catch a message with options — `interrupting`, an `id`, a `name`.
|
|
129
135
|
|
|
130
136
|
## Option shapes
|
|
131
137
|
|
|
@@ -155,7 +161,7 @@ What every boundary handler on an ActivityBuilder accepts — `.onError()`, `.on
|
|
|
155
161
|
Options for `.startEvent()`.
|
|
156
162
|
|
|
157
163
|
- `StartOpts.name?: string` — Display name the designer shows on the event.
|
|
158
|
-
- `StartOpts.message?:
|
|
164
|
+
- `StartOpts.message?: MessageLike` — Start when this message arrives — declares/reuses a definitions-level `bpmn:message`; `NO_MESSAGE` for none — see…
|
|
159
165
|
- `StartOpts.error?: ErrorLike` — Catch an error — an INTERRUPTING error start event (`bpmn:errorEventDefinition`), declaring/reusing a definitions-level…
|
|
160
166
|
- `StartOpts.timer?: TimerLike` — Start on a timer — an ISO-8601 duration string, or a full TimerSpec.
|
|
161
167
|
- `StartOpts.trigger?: true | { outputVar?: string }` — Also declare this timed start as a platform TRIGGER (`Intsvc.TimerTrigger`).
|
|
@@ -169,7 +175,7 @@ Options for `.endEvent()`.
|
|
|
169
175
|
|
|
170
176
|
- `EndOpts.name?: string` — Display name the designer shows on the event.
|
|
171
177
|
- `EndOpts.terminate?: boolean` — End as a TERMINATE event — abort the whole process instance, not just this path.
|
|
172
|
-
- `EndOpts.message?:
|
|
178
|
+
- `EndOpts.message?: MessageLike` — End by throwing this message — declares/reuses a definitions-level `bpmn:message`; `NO_MESSAGE` for none — see…
|
|
173
179
|
- `EndOpts.error?: string | { name: string; code?: string }` — End by throwing this error (a name, or `{ name, code }`) — declares/reuses a definitions-level `bpmn:error`.
|
|
174
180
|
- `EndOpts.payload?: ExtensionPayload` — A `uipath:mapping` mapping variables onto process outputs — see ExtensionPayload.
|
|
175
181
|
|
|
@@ -178,7 +184,7 @@ Options for `.endEvent()`.
|
|
|
178
184
|
Options for `.intermediateCatchEvent()`.
|
|
179
185
|
|
|
180
186
|
- `CatchOpts.name?: string` — Display name the designer shows on the event.
|
|
181
|
-
- `CatchOpts.message?:
|
|
187
|
+
- `CatchOpts.message?: MessageLike` — Wait for this message — declares/reuses a definitions-level `bpmn:message`; `NO_MESSAGE` for none — see MessageLike.
|
|
182
188
|
- `CatchOpts.timer?: TimerLike` — Wait for a timer — an ISO-8601 duration string, or a full TimerSpec.
|
|
183
189
|
- `CatchOpts.payload?: ExtensionPayload` — An extension payload on the event — see ExtensionPayload.
|
|
184
190
|
|
|
@@ -187,7 +193,7 @@ Options for `.intermediateCatchEvent()`.
|
|
|
187
193
|
Options for `.intermediateThrowEvent()` — a `message` to throw, or none.
|
|
188
194
|
|
|
189
195
|
- `ThrowOpts.name?: string` — Display name the designer shows on the event.
|
|
190
|
-
- `ThrowOpts.message?:
|
|
196
|
+
- `ThrowOpts.message?: MessageLike` — The message to throw — declares/reuses a definitions-level `bpmn:message`; `NO_MESSAGE` for none — see MessageLike.
|
|
191
197
|
- `ThrowOpts.payload?: ExtensionPayload` — An extension payload on the event — see ExtensionPayload.
|
|
192
198
|
|
|
193
199
|
### `BoundaryOpts`
|
|
@@ -197,7 +203,7 @@ Options for `.boundaryEvent()`: the activity it attaches to, whether it interrup
|
|
|
197
203
|
- `BoundaryOpts.name?: string` — Display name the designer shows on the event.
|
|
198
204
|
- `BoundaryOpts.attachedTo: string` — id of the activity this boundary event is attached to.
|
|
199
205
|
- `BoundaryOpts.cancelActivity?: boolean` — true (default) = interrupting; false = non-interrupting.
|
|
200
|
-
- `BoundaryOpts.message?:
|
|
206
|
+
- `BoundaryOpts.message?: MessageLike` — Catch this message — declares/reuses a definitions-level `bpmn:message`; `NO_MESSAGE` for none — see MessageLike.
|
|
201
207
|
- `BoundaryOpts.timer?: TimerLike` — Fire on a timer — an ISO-8601 duration string, or a full TimerSpec.
|
|
202
208
|
- `BoundaryOpts.error?: ErrorLike` — Catch an error: `true` for ANY error, or a name (or `{ name, code }`) to catch one declared kind — see ErrorLike.
|
|
203
209
|
- `BoundaryOpts.payload?: ExtensionPayload` — A `uipath:activity` capturing the error payload — see ExtensionPayload.
|
|
@@ -418,7 +424,7 @@ Options for ScopeBuilder.eventSubProcess.
|
|
|
418
424
|
|
|
419
425
|
- `EventSubProcessOpts.name?: string` — Display name the designer shows on the sub-process.
|
|
420
426
|
- `EventSubProcessOpts.error?: ErrorLike` — Start when an error is thrown anywhere in the enclosing container that nothing closer caught: `true` for any error, or a…
|
|
421
|
-
- `EventSubProcessOpts.message?:
|
|
427
|
+
- `EventSubProcessOpts.message?: MessageLike` — Start when this message arrives while the container is active; `NO_MESSAGE` for none — see MessageLike.
|
|
422
428
|
- `EventSubProcessOpts.timer?: TimerLike` — Start on a timer measured from the container's own start.
|
|
423
429
|
- `EventSubProcessOpts.interrupting?: boolean` — For a `message` or `timer` start: `false` lets the container keep running while the sub-process handles the event…
|
|
424
430
|
- `EventSubProcessOpts.errorVar?: string | false` — With `error`: the variable the caught error is captured into, through the same `=Error` output row…
|
|
@@ -695,7 +701,24 @@ How a scope wires elements no explicit `.sequenceFlow()` covers — see ScopeBui
|
|
|
695
701
|
|
|
696
702
|
The resolved event definition attached to an event node.
|
|
697
703
|
|
|
698
|
-
|
|
704
|
+
One of 4 forms — form 1:
|
|
705
|
+
|
|
706
|
+
- `EventDef.type: 'message'`
|
|
707
|
+
- `EventDef.messageRef?: string`
|
|
708
|
+
|
|
709
|
+
One of 4 forms — form 2:
|
|
710
|
+
|
|
711
|
+
- `EventDef.type: 'timer'`
|
|
712
|
+
- `EventDef.timer: TimerSpec`
|
|
713
|
+
|
|
714
|
+
One of 4 forms — form 3:
|
|
715
|
+
|
|
716
|
+
- `EventDef.type: 'error'`
|
|
717
|
+
- `EventDef.errorRef?: string`
|
|
718
|
+
|
|
719
|
+
One of 4 forms — form 4:
|
|
720
|
+
|
|
721
|
+
- `EventDef.type: 'terminate'`
|
|
699
722
|
|
|
700
723
|
### `ArmBodyFn`
|
|
701
724
|
|
|
@@ -963,6 +986,12 @@ ISO-8601 timer specification (one of duration / date / cycle).
|
|
|
963
986
|
- `TimerSpec.date?: string` — Fire at this ISO-8601 date-time, e.g. `'2026-09-01T09:00:00Z'`.
|
|
964
987
|
- `TimerSpec.cycle?: string` — Fire on this ISO-8601 repeating interval, e.g. `'R/PT1H'`.
|
|
965
988
|
|
|
989
|
+
### `MessageLike`
|
|
990
|
+
|
|
991
|
+
What a message event waits for or throws: a message NAME, or NO_MESSAGE.
|
|
992
|
+
|
|
993
|
+
- `type MessageLike = string | typeof NO_MESSAGE`
|
|
994
|
+
|
|
966
995
|
### `ErrorLike`
|
|
967
996
|
|
|
968
997
|
What an author passes for an error definition.
|
package/dist/core/refusals.d.ts
CHANGED
|
@@ -122,6 +122,7 @@ export declare const REFUSALS: {
|
|
|
122
122
|
readonly BPMN_HUMAN_TASK_APP_V1_FIELDS: "lowering";
|
|
123
123
|
readonly BPMN_HUMAN_TASK_APP_XOR_FORM: "lowering";
|
|
124
124
|
readonly BPMN_JSON_INPUT_CDATA_END: "lowering";
|
|
125
|
+
readonly BPMN_MESSAGE_NAME_EMPTY: "lowering";
|
|
125
126
|
readonly BPMN_NO_DEFAULT_EXPORT: "lowering";
|
|
126
127
|
readonly BPMN_NO_ID: "lowering";
|
|
127
128
|
readonly BPMN_OUTPUT_VAR_NO_OUTPUT_ROW: "lowering";
|
package/dist/core/refusals.js
CHANGED
|
@@ -171,6 +171,7 @@ export const REFUSALS = {
|
|
|
171
171
|
BPMN_HUMAN_TASK_APP_V1_FIELDS: 'lowering',
|
|
172
172
|
BPMN_HUMAN_TASK_APP_XOR_FORM: 'lowering',
|
|
173
173
|
BPMN_JSON_INPUT_CDATA_END: 'lowering',
|
|
174
|
+
BPMN_MESSAGE_NAME_EMPTY: 'lowering',
|
|
174
175
|
BPMN_NO_DEFAULT_EXPORT: 'lowering',
|
|
175
176
|
BPMN_NO_ID: 'lowering',
|
|
176
177
|
BPMN_OUTPUT_VAR_NO_OUTPUT_ROW: 'lowering',
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/** The document node family, as flow-node-registry.ts lists it: Document Classify, Dynamic Extract and an IxP project's extractor. */
|
|
2
2
|
import type { FlowNodeFamily } from '../../../flow-node-type.js';
|
|
3
|
+
export { isIxpNodeType } from './ixp.js';
|
|
3
4
|
export declare const documentFlowFamily: FlowNodeFamily;
|
|
4
5
|
/**
|
|
5
6
|
* The IDP processor rules, for `compile` (`idp-processor-files.ts`) and
|
|
@@ -5,6 +5,15 @@ export type IxpExtractSpec = {
|
|
|
5
5
|
kind: 'ixpExtract';
|
|
6
6
|
inputs: IxpExtractInputs;
|
|
7
7
|
};
|
|
8
|
+
/**
|
|
9
|
+
* Whether a node of `typeName` is an IxP node instance, which carries no
|
|
10
|
+
* node-level `model`: the slim `{ type, serviceType }` lives only in
|
|
11
|
+
* `definitions[]`, and `flow validate` rejects a node-level copy on every
|
|
12
|
+
* `uipath.ixp.*` node ("Top-level `model` block is forbidden on IxP node
|
|
13
|
+
* instances"). Keyed on the prefix, as the product's rule is, so it holds for
|
|
14
|
+
* a type no factory owns as well as for `ixpExtract()` and `dynamicExtract()`.
|
|
15
|
+
*/
|
|
16
|
+
export declare function isIxpNodeType(typeName: string): boolean;
|
|
8
17
|
export declare const IXP_DIAGNOSTICS: DiagnosticCatalog;
|
|
9
18
|
/**
|
|
10
19
|
* Build the definition for one published IxP project.
|
|
@@ -17,6 +17,17 @@ import { parseIxpProjectType } from './spec.js';
|
|
|
17
17
|
import { CompileRefusal } from '../../../core/compile-refusal.js';
|
|
18
18
|
import { declareKeys } from '../../../core/option-keys.js';
|
|
19
19
|
const IXP_PREFIX = 'uipath.ixp.';
|
|
20
|
+
/**
|
|
21
|
+
* Whether a node of `typeName` is an IxP node instance, which carries no
|
|
22
|
+
* node-level `model`: the slim `{ type, serviceType }` lives only in
|
|
23
|
+
* `definitions[]`, and `flow validate` rejects a node-level copy on every
|
|
24
|
+
* `uipath.ixp.*` node ("Top-level `model` block is forbidden on IxP node
|
|
25
|
+
* instances"). Keyed on the prefix, as the product's rule is, so it holds for
|
|
26
|
+
* a type no factory owns as well as for `ixpExtract()` and `dynamicExtract()`.
|
|
27
|
+
*/
|
|
28
|
+
export function isIxpNodeType(typeName) {
|
|
29
|
+
return typeName.startsWith(IXP_PREFIX);
|
|
30
|
+
}
|
|
20
31
|
export const IXP_DIAGNOSTICS = {
|
|
21
32
|
IXP_FORBIDDEN_INPUT: { severity: 'error', summary: 'an IxP step setting an input the current node does not declare' },
|
|
22
33
|
IXP_NO_FILE: { severity: 'error', summary: 'an IxP step with no fileRef' },
|
|
@@ -351,8 +351,8 @@ export const dynamicExtractNodeType = {
|
|
|
351
351
|
},
|
|
352
352
|
// IxP instances must NOT carry the manifest's model block — the slim
|
|
353
353
|
// { type, serviceType } lives only in definitions[] (product validate
|
|
354
|
-
// rejects a node-level copy).
|
|
355
|
-
//
|
|
354
|
+
// rejects a node-level copy). `makeNode` drops it for every
|
|
355
|
+
// `uipath.ixp.*` node, a rawNode included (`isIxpNodeType`).
|
|
356
356
|
model: 'omit',
|
|
357
357
|
};
|
|
358
358
|
},
|
package/dist/serialize.js
CHANGED
|
@@ -13,6 +13,7 @@ import { Expr, toExpr, flatNameSegmentsOf, parallelFork } from './flow-sdk.js';
|
|
|
13
13
|
import { FlowAction, FlowTrigger } from './core/node-classes.js';
|
|
14
14
|
import { connectorRawNodeRefusal } from './nodes/connector/flow/family.js';
|
|
15
15
|
import { isAgentResourceType } from './nodes/agent/flow/family.js';
|
|
16
|
+
import { isIxpNodeType } from './nodes/document/flow/family.js';
|
|
16
17
|
import { CompileRefusal, LibraryRequiredRefusal } from './core/compile-refusal.js';
|
|
17
18
|
import { nearestName } from './core/edit-distance.js';
|
|
18
19
|
import { unknownOptionRefusal } from './core/option-keys.js';
|
|
@@ -1879,8 +1880,10 @@ function serializeFlow(built, opts) {
|
|
|
1879
1880
|
col++;
|
|
1880
1881
|
// A registered node type may carry no node-level `model`, whichever path
|
|
1881
1882
|
// emits it (its own serialize, or a rawNode through emitContribution) — the
|
|
1882
|
-
// Data Fabric verbs, whose reasons are in their family (`nodeModel`).
|
|
1883
|
-
|
|
1883
|
+
// Data Fabric verbs, whose reasons are in their family (`nodeModel`). Every
|
|
1884
|
+
// IxP node omits it too, registered type or not (`isIxpNodeType`).
|
|
1885
|
+
const omitModel = isIxpNodeType(type)
|
|
1886
|
+
|| registeredRawType(type, String(def?.version ?? ''))?.impl.nodeModel === 'omit';
|
|
1884
1887
|
if (def?.model && !omitModel)
|
|
1885
1888
|
node.model = subNodeId(jsonClone(def.model), id);
|
|
1886
1889
|
if (def?.outputDefinition)
|