@uipath/maestro-builder-sdk 5.2.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/LICENSE +21 -0
- package/README.md +322 -0
- package/dist/bindings-v2.d.ts +37 -0
- package/dist/bindings-v2.js +155 -0
- package/dist/bindings.d.ts +6 -0
- package/dist/bindings.js +6 -0
- package/dist/bpmn/bpmn-expr-check.d.ts +41 -0
- package/dist/bpmn/bpmn-expr-check.js +218 -0
- package/dist/bpmn/bpmn-sdk.d.ts +2257 -0
- package/dist/bpmn/bpmn-sdk.js +1476 -0
- package/dist/bpmn/check-cli.d.ts +3 -0
- package/dist/bpmn/check-cli.js +32 -0
- package/dist/bpmn/check.d.ts +25 -0
- package/dist/bpmn/check.js +430 -0
- package/dist/bpmn/compile-cli.d.ts +3 -0
- package/dist/bpmn/compile-cli.js +60 -0
- package/dist/bpmn/connector.d.ts +56 -0
- package/dist/bpmn/connector.js +199 -0
- package/dist/bpmn/decompile-cli.d.ts +8 -0
- package/dist/bpmn/decompile-cli.js +54 -0
- package/dist/bpmn/decompile.d.ts +6 -0
- package/dist/bpmn/decompile.js +1108 -0
- package/dist/bpmn/format-profile.d.ts +27 -0
- package/dist/bpmn/format-profile.js +11 -0
- package/dist/bpmn/intsvc.d.ts +77 -0
- package/dist/bpmn/intsvc.js +155 -0
- package/dist/bpmn/load.d.ts +4 -0
- package/dist/bpmn/load.js +22 -0
- package/dist/bpmn/merge-cli.d.ts +3 -0
- package/dist/bpmn/merge-cli.js +45 -0
- package/dist/bpmn/merge.d.ts +19 -0
- package/dist/bpmn/merge.js +293 -0
- package/dist/bpmn/registry-types.json +1869 -0
- package/dist/bpmn/serialize.d.ts +28 -0
- package/dist/bpmn/serialize.js +757 -0
- package/dist/bpmn/tidy-cli.d.ts +2 -0
- package/dist/bpmn/tidy-cli.js +39 -0
- package/dist/bpmn/typed-node.d.ts +382 -0
- package/dist/bpmn/typed-node.js +551 -0
- package/dist/bpmn/uipath-moddle.v1.json +823 -0
- package/dist/bpmn/xml-ranges.d.ts +45 -0
- package/dist/bpmn/xml-ranges.js +151 -0
- package/dist/case/case-expr-check.d.ts +35 -0
- package/dist/case/case-expr-check.js +85 -0
- package/dist/case/case-sdk.d.ts +1282 -0
- package/dist/case/case-sdk.js +923 -0
- package/dist/case/check-cli.d.ts +3 -0
- package/dist/case/check-cli.js +31 -0
- package/dist/case/check.d.ts +18 -0
- package/dist/case/check.js +456 -0
- package/dist/case/compile-cli.d.ts +3 -0
- package/dist/case/compile-cli.js +291 -0
- package/dist/case/decompile-cli.d.ts +9 -0
- package/dist/case/decompile-cli.js +117 -0
- package/dist/case/decompile.d.ts +187 -0
- package/dist/case/decompile.js +1170 -0
- package/dist/case/entry-points.d.ts +79 -0
- package/dist/case/entry-points.js +118 -0
- package/dist/case/format-profile.d.ts +60 -0
- package/dist/case/format-profile.js +79 -0
- package/dist/case/ids.d.ts +24 -0
- package/dist/case/ids.js +76 -0
- package/dist/case/load.d.ts +12 -0
- package/dist/case/load.js +32 -0
- package/dist/case/preserve.d.ts +133 -0
- package/dist/case/preserve.js +105 -0
- package/dist/case/serialize.d.ts +10 -0
- package/dist/case/serialize.js +1414 -0
- package/dist/check-cli.d.ts +3 -0
- package/dist/check-cli.js +118 -0
- package/dist/check.d.ts +146 -0
- package/dist/check.js +4898 -0
- package/dist/cli/commands/bpmn.d.ts +2 -0
- package/dist/cli/commands/bpmn.js +73 -0
- package/dist/cli/commands/case.d.ts +2 -0
- package/dist/cli/commands/case.js +60 -0
- package/dist/cli/commands/flow.d.ts +2 -0
- package/dist/cli/commands/flow.js +99 -0
- package/dist/cli/commands/registry.d.ts +10 -0
- package/dist/cli/commands/registry.js +170 -0
- package/dist/cli/common.d.ts +30 -0
- package/dist/cli/common.js +92 -0
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.js +18 -0
- package/dist/cli-run.d.ts +2 -0
- package/dist/cli-run.js +42 -0
- package/dist/compile-cli.d.ts +3 -0
- package/dist/compile-cli.js +160 -0
- package/dist/config.d.ts +47 -0
- package/dist/config.js +201 -0
- package/dist/core/actions.d.ts +3244 -0
- package/dist/core/actions.js +1062 -0
- package/dist/core/binding-messages.d.ts +1 -0
- package/dist/core/binding-messages.js +16 -0
- package/dist/core/bindings.d.ts +12 -0
- package/dist/core/bindings.js +67 -0
- package/dist/core/ceql.d.ts +73 -0
- package/dist/core/ceql.js +272 -0
- package/dist/core/cli-spelling.d.ts +39 -0
- package/dist/core/cli-spelling.js +62 -0
- package/dist/core/connector-raw-node.d.ts +21 -0
- package/dist/core/connector-raw-node.js +47 -0
- package/dist/core/connectors.d.ts +184 -0
- package/dist/core/connectors.js +128 -0
- package/dist/core/expr-check.d.ts +93 -0
- package/dist/core/expr-check.js +186 -0
- package/dist/core/expr.d.ts +323 -0
- package/dist/core/expr.js +400 -0
- package/dist/core/index.d.ts +10 -0
- package/dist/core/index.js +10 -0
- package/dist/core/library.d.ts +440 -0
- package/dist/core/library.js +1183 -0
- package/dist/core/list-envelope.d.ts +45 -0
- package/dist/core/list-envelope.js +97 -0
- package/dist/core/lookup-store.d.ts +22 -0
- package/dist/core/lookup-store.js +85 -0
- package/dist/core/lookups.d.ts +227 -0
- package/dist/core/lookups.js +231 -0
- package/dist/core/node-classes.d.ts +234 -0
- package/dist/core/node-classes.js +158 -0
- package/dist/core/script-return.d.ts +68 -0
- package/dist/core/script-return.js +197 -0
- package/dist/core/stable-id.d.ts +28 -0
- package/dist/core/stable-id.js +37 -0
- package/dist/core-definitions.json +16249 -0
- package/dist/decompile-cli.d.ts +3 -0
- package/dist/decompile-cli.js +131 -0
- package/dist/decompile.d.ts +138 -0
- package/dist/decompile.js +2482 -0
- package/dist/emit.d.ts +10 -0
- package/dist/emit.js +60 -0
- package/dist/event-filters.d.ts +130 -0
- package/dist/event-filters.js +137 -0
- package/dist/flow-expr-check.d.ts +17 -0
- package/dist/flow-expr-check.js +193 -0
- package/dist/flow-sdk.d.ts +1341 -0
- package/dist/flow-sdk.js +1164 -0
- package/dist/flow-variables.d.ts +13 -0
- package/dist/flow-variables.js +42 -0
- package/dist/format-profile.d.ts +72 -0
- package/dist/format-profile.js +97 -0
- package/dist/generators/_connections.py +287 -0
- package/dist/generators/_events.py +355 -0
- package/dist/generators/_lookups.py +114 -0
- package/dist/generators/_naming.py +185 -0
- package/dist/generators/_objects.py +299 -0
- package/dist/generators/_resolve.py +273 -0
- package/dist/generators/convert_library_to_md.py +1441 -0
- package/dist/generators/extract_library.py +125 -0
- package/dist/generators/generate_connectors_ts.py +936 -0
- package/dist/generators/generate_library_json.py +2527 -0
- package/dist/generators/generate_triggers_ts.py +110 -0
- package/dist/generators/materialize_registry.py +155 -0
- package/dist/generators/prepare_connector.py +1688 -0
- package/dist/index.d.ts +35 -0
- package/dist/index.js +35 -0
- package/dist/ixp-definition.json +1982 -0
- package/dist/library.d.ts +6 -0
- package/dist/library.js +6 -0
- package/dist/load.d.ts +16 -0
- package/dist/load.js +95 -0
- package/dist/merge-cli.d.ts +3 -0
- package/dist/merge-cli.js +47 -0
- package/dist/merge.d.ts +125 -0
- package/dist/merge.js +0 -0
- package/dist/migrate.d.ts +15 -0
- package/dist/migrate.js +245 -0
- package/dist/node-runtime.d.ts +3 -0
- package/dist/node-runtime.js +22 -0
- package/dist/package-name.d.ts +17 -0
- package/dist/package-name.js +17 -0
- package/dist/ref-resolve.d.ts +77 -0
- package/dist/ref-resolve.js +170 -0
- package/dist/registry/cache.d.ts +55 -0
- package/dist/registry/cache.js +134 -0
- package/dist/registry/curated-overlay.d.ts +16 -0
- package/dist/registry/curated-overlay.js +62 -0
- package/dist/registry/extractor.d.ts +22 -0
- package/dist/registry/extractor.js +18 -0
- package/dist/registry/materialize-bin.d.ts +2 -0
- package/dist/registry/materialize-bin.js +7 -0
- package/dist/registry/materialize-cli.d.ts +1 -0
- package/dist/registry/materialize-cli.js +46 -0
- package/dist/registry/materializer.d.ts +23 -0
- package/dist/registry/materializer.js +34 -0
- package/dist/registry/path-cli.d.ts +1 -0
- package/dist/registry/path-cli.js +56 -0
- package/dist/registry/prepare-cli.d.ts +62 -0
- package/dist/registry/prepare-cli.js +185 -0
- package/dist/registry/pull-cli.d.ts +1 -0
- package/dist/registry/pull-cli.js +274 -0
- package/dist/registry/python.d.ts +26 -0
- package/dist/registry/python.js +46 -0
- package/dist/registry/search-cli.d.ts +52 -0
- package/dist/registry/search-cli.js +159 -0
- package/dist/schema-version.d.ts +165 -0
- package/dist/schema-version.js +148 -0
- package/dist/serialize.d.ts +64 -0
- package/dist/serialize.js +6398 -0
- package/lib/README.md +112 -0
- package/lib/library-json.samples/index.json +158 -0
- package/lib/library-json.samples/invariant-collections.json +83 -0
- package/lib/library-json.samples/list-envelopes.json +123 -0
- package/lib/library-json.samples/uipath-atlassian-jira/create-issue@1.0.0.json +131 -0
- package/lib/library-json.samples/uipath-atlassian-jira/create-issue@1.0.0.v1def.json +306 -0
- package/lib/library-json.samples/uipath-atlassian-jira/generic/create_issue/create@1.0.0.json +86 -0
- package/lib/library-json.samples/uipath-atlassian-jira/generic/create_issue/create@1.0.0.v1def.json +208 -0
- package/lib/library-json.samples/uipath-atlassian-jira/get-issue@1.0.0.json +2040 -0
- package/lib/library-json.samples/uipath-atlassian-jira/get-issue@1.0.0.v1def.json +195 -0
- package/lib/library-json.samples/uipath-google-vertex/execute-google-vertex-agent@1.0.0.json +169 -0
- package/lib/library-json.samples/uipath-google-vertex/execute-google-vertex-agent@1.0.0.v1def.json +209 -0
- package/lib/library-json.samples/uipath-http-webhook/event-http-webhook@1.0.0.json +63 -0
- package/lib/library-json.samples/uipath-http-webhook/event-http-webhook@1.0.0.v1def.json +262 -0
- package/lib/library-json.samples/uipath-http-webhook/trigger-http-webhook@1.0.0.json +63 -0
- package/lib/library-json.samples/uipath-http-webhook/trigger-http-webhook@1.0.0.v1def.json +213 -0
- package/lib/library-json.samples/uipath-microsoft-azureactivedirectory/list-groups@1.0.0.json +227 -0
- package/lib/library-json.samples/uipath-microsoft-azureactivedirectory/list-groups@1.0.0.v1def.json +373 -0
- package/lib/library-json.samples/uipath-microsoft-onedrive/event-file-created@1.0.0.json +116 -0
- package/lib/library-json.samples/uipath-microsoft-onedrive/event-file-created@1.0.0.v1def.json +369 -0
- package/lib/library-json.samples/uipath-microsoft-onedrive/event-list-item-added@1.0.0.json +56 -0
- package/lib/library-json.samples/uipath-microsoft-onedrive/event-list-item-added@1.0.0.v1def.json +256 -0
- package/lib/library-json.samples/uipath-microsoft-onedrive/trigger-file-created@1.0.0.json +116 -0
- package/lib/library-json.samples/uipath-microsoft-onedrive/trigger-file-created@1.0.0.v1def.json +320 -0
- package/lib/library-json.samples/uipath-microsoft-onedrive/trigger-list-item-added@1.0.0.json +56 -0
- package/lib/library-json.samples/uipath-microsoft-onedrive/trigger-list-item-added@1.0.0.v1def.json +207 -0
- package/lib/library-json.samples/uipath-microsoft-outlook365/event-email-received@1.0.0.json +107 -0
- package/lib/library-json.samples/uipath-microsoft-outlook365/event-email-received@1.0.0.v1def.json +264 -0
- package/lib/library-json.samples/uipath-microsoft-outlook365/send-email@1.0.0.json +142 -0
- package/lib/library-json.samples/uipath-microsoft-outlook365/send-email@1.0.0.v1def.json +306 -0
- package/lib/library-json.samples/uipath-microsoft-outlook365/trigger-email-received@1.0.0.json +107 -0
- package/lib/library-json.samples/uipath-microsoft-outlook365/trigger-email-received@1.0.0.v1def.json +217 -0
- package/lib/library-json.samples/uipath-microsoft-powerautomate/invoke-a-microsoft-power-automate-flow@1.0.0.json +85 -0
- package/lib/library-json.samples/uipath-microsoft-powerautomate/invoke-a-microsoft-power-automate-flow@1.0.0.v1def.json +209 -0
- package/lib/library-json.samples/uipath-salesforce-slack/send-message-to-user@1.0.0.json +755 -0
- package/lib/library-json.samples/uipath-salesforce-slack/send-message-to-user@1.0.0.v1def.json +513 -0
- package/lib/library-json.samples/uipath-uipath-dataservice/query-entity-records@1.0.0.json +122 -0
- package/lib/library-json.samples/uipath-uipath-dataservice/query-entity-records@1.0.0.v1def.json +227 -0
- package/package.json +85 -0
|
@@ -0,0 +1,2257 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* bpmn-sdk — a fluent builder for UiPath Maestro BPMN processes (`.bpmn` XML).
|
|
3
|
+
*
|
|
4
|
+
* Like the Flow and Case builders, this constructs a plain description of a
|
|
5
|
+
* process — a **graph** of BPMN elements (events, gateways, tasks, sub-processes)
|
|
6
|
+
* wired by `sequenceFlow`s — which `serialize()` turns into real `.bpmn` XML. The
|
|
7
|
+
* builder methods are **1-1 with BPMN elements**: `.startEvent()` ↔
|
|
8
|
+
* `bpmn:startEvent`, `.exclusiveGateway()` ↔ `bpmn:exclusiveGateway`,
|
|
9
|
+
* `.sequenceFlow()` ↔ `bpmn:sequenceFlow`, and so on. `.build()` returns the
|
|
10
|
+
* in-memory graph (`BuiltBpmn`); `serialize()` walks that graph into the XML.
|
|
11
|
+
*
|
|
12
|
+
* This is the **structural core**: the elements Maestro lets you author directly
|
|
13
|
+
* (the "registry gap" half — gateways, events, boundary events, script/variable
|
|
14
|
+
* tasks, sub-processes, multi-instance loops). Registry-backed typed nodes
|
|
15
|
+
* (service/user/send/receive tasks, call activities) resolve `uipath:*` payloads
|
|
16
|
+
* from the BPMN registry and land in a later phase.
|
|
17
|
+
*
|
|
18
|
+
* Diagram interchange (`bpmndi`) is intentionally **not** emitted here: BPMN
|
|
19
|
+
* validation is layout-independent, so the SDK emits semantic-only XML and a
|
|
20
|
+
* separate "tidy" step lays it out. See serialize.ts.
|
|
21
|
+
*/
|
|
22
|
+
import type { TypeDesc } from '../core/expr.js';
|
|
23
|
+
import { type ConnectorOpts } from '../core/actions.js';
|
|
24
|
+
import type { ConnectorDescriptor } from '../core/connectors.js';
|
|
25
|
+
import type { TypedContextRow, TypedOutputRow } from './typed-node.js';
|
|
26
|
+
export { BpmnBuildError } from './bpmn-expr-check.js';
|
|
27
|
+
export type { BpmnLocatedDiagnostic } from './bpmn-expr-check.js';
|
|
28
|
+
/** ISO-8601 timer specification (one of duration / date / cycle). */
|
|
29
|
+
export interface TimerSpec {
|
|
30
|
+
/** Fire after this ISO-8601 duration, e.g. `'PT30S'`. */
|
|
31
|
+
duration?: string;
|
|
32
|
+
/** Fire at this ISO-8601 date-time, e.g. `'2026-09-01T09:00:00Z'`. */
|
|
33
|
+
date?: string;
|
|
34
|
+
/** Fire on this ISO-8601 repeating interval, e.g. `'R/PT1H'`. */
|
|
35
|
+
cycle?: string;
|
|
36
|
+
}
|
|
37
|
+
/** A timer as an ISO-8601 duration string (shorthand for `{ duration }`) or a full spec. */
|
|
38
|
+
export type TimerLike = string | TimerSpec;
|
|
39
|
+
/**
|
|
40
|
+
* What an author passes for an error definition.
|
|
41
|
+
*
|
|
42
|
+
* `true` means CATCH ANY — a bare `<bpmn:errorEventDefinition />` with no
|
|
43
|
+
* `errorRef`, which is what every error boundary in five real Studio Web exports
|
|
44
|
+
* uses, and the only form any of them uses. A name (or a `{ name, code }` pair
|
|
45
|
+
* when the wire code differs) narrows it to one declared error instead.
|
|
46
|
+
*/
|
|
47
|
+
export type ErrorLike = true | string | {
|
|
48
|
+
name: string;
|
|
49
|
+
code?: string;
|
|
50
|
+
};
|
|
51
|
+
/** The resolved event definition attached to an event node. */
|
|
52
|
+
export type EventDef = {
|
|
53
|
+
type: 'message';
|
|
54
|
+
messageRef: string;
|
|
55
|
+
} | {
|
|
56
|
+
type: 'timer';
|
|
57
|
+
timer: TimerSpec;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* An error definition. `errorRef` absent is BPMN's CATCH-ANY: a bare
|
|
61
|
+
* `<bpmn:errorEventDefinition />` pointing at no declaration, which catches every
|
|
62
|
+
* error rather than one named kind.
|
|
63
|
+
*/
|
|
64
|
+
| {
|
|
65
|
+
type: 'error';
|
|
66
|
+
errorRef?: string;
|
|
67
|
+
} | {
|
|
68
|
+
type: 'terminate';
|
|
69
|
+
};
|
|
70
|
+
/** The four gateway element kinds a {@link BpmnNode} can be. */
|
|
71
|
+
export type GatewayKind = 'exclusiveGateway' | 'parallelGateway' | 'inclusiveGateway' | 'eventBasedGateway';
|
|
72
|
+
/** The four non-boundary event element kinds a {@link BpmnNode} can be. */
|
|
73
|
+
export type EventKind = 'startEvent' | 'endEvent' | 'intermediateCatchEvent' | 'intermediateThrowEvent';
|
|
74
|
+
/** Multi-instance loop over a collection (`uipath:loopCharacteristics`). */
|
|
75
|
+
export interface LoopSpec {
|
|
76
|
+
/** `=`-expression yielding the collection to iterate. */
|
|
77
|
+
collection: string;
|
|
78
|
+
/** Name the current item is bound to inside the body (`iterator.<itemVar>`). */
|
|
79
|
+
itemVar: string;
|
|
80
|
+
/** true = one at a time (sequential); false/omitted = parallel. */
|
|
81
|
+
sequential?: boolean;
|
|
82
|
+
/** Optional `=`-expression completion condition. */
|
|
83
|
+
completion?: string;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* One node in the built graph — a discriminated union with one arm per BPMN
|
|
87
|
+
* element kind, which the serializer walks into the corresponding XML element.
|
|
88
|
+
*/
|
|
89
|
+
export type BpmnNode = {
|
|
90
|
+
kind: EventKind;
|
|
91
|
+
id: string;
|
|
92
|
+
name?: string;
|
|
93
|
+
event?: EventDef;
|
|
94
|
+
/**
|
|
95
|
+
* A registry-backed TRIGGER declaration on this event, on top of its event
|
|
96
|
+
* definition — see {@link StartOpts.trigger}. The two are orthogonal halves
|
|
97
|
+
* of one element: the definition schedules, this names the node type and
|
|
98
|
+
* declares the payload variable.
|
|
99
|
+
*/
|
|
100
|
+
trigger?: {
|
|
101
|
+
type: string;
|
|
102
|
+
outputVar?: string;
|
|
103
|
+
};
|
|
104
|
+
/** A `uipath:mapping` / `uipath:activity` payload on the event — see {@link ExtensionPayload}. */
|
|
105
|
+
payload?: ExtensionPayload;
|
|
106
|
+
} | {
|
|
107
|
+
kind: 'boundaryEvent';
|
|
108
|
+
id: string;
|
|
109
|
+
name?: string;
|
|
110
|
+
attachedTo: string;
|
|
111
|
+
cancelActivity: boolean;
|
|
112
|
+
event: EventDef;
|
|
113
|
+
/** A `uipath:activity` payload on the boundary — see {@link ExtensionPayload}. */
|
|
114
|
+
payload?: ExtensionPayload;
|
|
115
|
+
} | {
|
|
116
|
+
kind: GatewayKind;
|
|
117
|
+
id: string;
|
|
118
|
+
name?: string;
|
|
119
|
+
default?: string;
|
|
120
|
+
} | (ActivityNodeFields & {
|
|
121
|
+
kind: 'scriptTask';
|
|
122
|
+
id: string;
|
|
123
|
+
name?: string;
|
|
124
|
+
script: string;
|
|
125
|
+
scriptFormat: string;
|
|
126
|
+
inputs: Record<string, string>;
|
|
127
|
+
outputs: Record<string, string>;
|
|
128
|
+
/** The mapping's extension type — see {@link ScriptTaskOpts.type}. */
|
|
129
|
+
type: string;
|
|
130
|
+
/** The `uipath:inputSchema` body — see {@link ScriptTaskOpts.inputSchema}. */
|
|
131
|
+
inputSchema?: unknown;
|
|
132
|
+
/** Output rows spelled out, replacing the ones `outputs` would derive. */
|
|
133
|
+
outputRows?: TypedOutputRow[];
|
|
134
|
+
}) | (ActivityNodeFields & {
|
|
135
|
+
kind: 'task';
|
|
136
|
+
id: string;
|
|
137
|
+
name?: string;
|
|
138
|
+
set: Record<string, string>;
|
|
139
|
+
}) | (ActivityNodeFields & {
|
|
140
|
+
kind: 'connector';
|
|
141
|
+
id: string;
|
|
142
|
+
name?: string;
|
|
143
|
+
/** connector key + action (identify the library op), like Flow/Case. */
|
|
144
|
+
key: string;
|
|
145
|
+
action: string;
|
|
146
|
+
version?: string;
|
|
147
|
+
/** symbolic connection/folder names resolved via bindings.json. */
|
|
148
|
+
connection?: string;
|
|
149
|
+
folder?: string;
|
|
150
|
+
/** Which OBJECT a generic operation addresses — see `ConnectorOpts.object`. */
|
|
151
|
+
object?: string;
|
|
152
|
+
inputs: Record<string, unknown>;
|
|
153
|
+
/** Variable the response lands in; defaults to `<id>_response`. */
|
|
154
|
+
outputVar?: string;
|
|
155
|
+
/** `=`-expression that, when true, skips this activity (`uipath:activity/@skipCondition`). */
|
|
156
|
+
skipCondition?: string;
|
|
157
|
+
}) | (ActivityNodeFields & {
|
|
158
|
+
kind: 'typed';
|
|
159
|
+
id: string;
|
|
160
|
+
name?: string;
|
|
161
|
+
/** The registry extension type, e.g. `'Intsvc.UnifiedHttpRequest'`. */
|
|
162
|
+
type: string;
|
|
163
|
+
/** `uipath:context` values, by field name. */
|
|
164
|
+
context: Record<string, unknown>;
|
|
165
|
+
/** The payload, shaped by the type's `inputPattern`. */
|
|
166
|
+
inputs: Record<string, unknown>;
|
|
167
|
+
/** Variable the output lands in; defaults to `<id>_<outputName>`. */
|
|
168
|
+
outputVar?: string;
|
|
169
|
+
/** Extra output rows: variable id → `=`-expression against the node's result. */
|
|
170
|
+
outputs?: Record<string, string>;
|
|
171
|
+
/** Output rows spelled out, replacing the derived ones — see `TypedOutputRow`. */
|
|
172
|
+
outputRows?: TypedOutputRow[];
|
|
173
|
+
/** The `uipath:type` `version` attribute — see `ActivityNodeOpts.typeVersion`. */
|
|
174
|
+
typeVersion?: string;
|
|
175
|
+
/** The `uipath:inputSchema` body — see `ActivityNodeOpts.inputSchema`. */
|
|
176
|
+
inputSchema?: unknown;
|
|
177
|
+
/** Context rows spelled out — see {@link TypedContextRow}. */
|
|
178
|
+
contextRows?: TypedContextRow[];
|
|
179
|
+
/** `=`-expression that skips the node when truthy. */
|
|
180
|
+
skipCondition?: string;
|
|
181
|
+
/** Emit `context` exactly as given — for importers; see `TypedNodeInput`. */
|
|
182
|
+
contextVerbatim?: boolean;
|
|
183
|
+
}) | (ActivityNodeFields & {
|
|
184
|
+
kind: 'connectorEvent';
|
|
185
|
+
id: string;
|
|
186
|
+
name?: string;
|
|
187
|
+
/**
|
|
188
|
+
* `trigger` STARTS the process (`Intsvc.EventTrigger`, a `bpmn:startEvent`
|
|
189
|
+
* carrying a message event definition); `event` pauses one mid-flow
|
|
190
|
+
* (`Intsvc.WaitForEvent`, a `bpmn:receiveTask`). The platform ships both for
|
|
191
|
+
* one connector operation and the namespace is the only difference, which is
|
|
192
|
+
* why one node kind carries both.
|
|
193
|
+
*/
|
|
194
|
+
subscribe: 'trigger' | 'event';
|
|
195
|
+
/**
|
|
196
|
+
* Connector key + event name, resolved against the library at serialize.
|
|
197
|
+
*
|
|
198
|
+
* `eventName` rather than `event`: this union's event nodes already carry an
|
|
199
|
+
* `event?: EventDef` (the BPMN event DEFINITION), and reusing the name broke
|
|
200
|
+
* the `'event' in n` narrowing `check()` uses to validate timers.
|
|
201
|
+
*/
|
|
202
|
+
key: string;
|
|
203
|
+
eventName: string;
|
|
204
|
+
version?: string;
|
|
205
|
+
/** Symbolic binding names, as `.connector()` takes them. */
|
|
206
|
+
connection?: string;
|
|
207
|
+
folder?: string;
|
|
208
|
+
/** The folder PATH, which the type requires alongside the folder key. */
|
|
209
|
+
folderPath?: string;
|
|
210
|
+
/** The `where` scope and extra event parameters, when the operation declares any. */
|
|
211
|
+
filter?: Record<string, unknown>;
|
|
212
|
+
parameters?: Record<string, unknown>;
|
|
213
|
+
outputVar?: string;
|
|
214
|
+
outputs?: Record<string, string>;
|
|
215
|
+
skipCondition?: string;
|
|
216
|
+
}) | (ActivityNodeFields & {
|
|
217
|
+
kind: 'externalTask';
|
|
218
|
+
id: string;
|
|
219
|
+
name?: string;
|
|
220
|
+
/** Which family — an external agent or an external workflow. */
|
|
221
|
+
family: 'agent' | 'workflow';
|
|
222
|
+
/** `sync` waits for the result; `async` starts it and moves on. */
|
|
223
|
+
mode: 'sync' | 'async';
|
|
224
|
+
/** Connector key + action, resolved against the library at serialize. */
|
|
225
|
+
key: string;
|
|
226
|
+
action: string;
|
|
227
|
+
version?: string;
|
|
228
|
+
/** The invocation payload — one merged `body` row, per the type's template. */
|
|
229
|
+
inputs: Record<string, unknown>;
|
|
230
|
+
connection?: string;
|
|
231
|
+
folder?: string;
|
|
232
|
+
outputVar?: string;
|
|
233
|
+
outputs?: Record<string, string>;
|
|
234
|
+
skipCondition?: string;
|
|
235
|
+
}) | (ActivityNodeFields & {
|
|
236
|
+
kind: 'plainTask';
|
|
237
|
+
id: string;
|
|
238
|
+
name?: string;
|
|
239
|
+
/** Which task element to emit. */
|
|
240
|
+
element: PlainTaskElement;
|
|
241
|
+
}) | (ActivityNodeFields & {
|
|
242
|
+
kind: 'subProcess';
|
|
243
|
+
/** A `uipath:mapping` on the sub-process element — see {@link ExtensionPayload}. */
|
|
244
|
+
payload?: ExtensionPayload;
|
|
245
|
+
id: string;
|
|
246
|
+
name?: string;
|
|
247
|
+
triggeredByEvent?: boolean;
|
|
248
|
+
nodes: BpmnNode[];
|
|
249
|
+
flows: BpmnFlow[];
|
|
250
|
+
variables: BpmnVarDecl[];
|
|
251
|
+
});
|
|
252
|
+
/**
|
|
253
|
+
* One row of `uipath:errorMapping` — how an activity classifies one kind of failure.
|
|
254
|
+
*
|
|
255
|
+
* @remarks
|
|
256
|
+
* **What is enforced, and by whom, differs — worth knowing before relying on any of
|
|
257
|
+
* it.** `uip maestro bpmn validate` polices NOTHING here beyond the tag being a known
|
|
258
|
+
* one: an empty row, an unknown attribute and `retryable="yes"` all return `Valid`.
|
|
259
|
+
* The CANVAS is stricter, and it is the stricter gate that matters: a `condition`
|
|
260
|
+
* containing an assignment is a warning there, and one referencing an undeclared
|
|
261
|
+
* variable is a BLOCKING error the CLI never mentions. So `condition` is expression-
|
|
262
|
+
* checked at author time like any other expression.
|
|
263
|
+
*
|
|
264
|
+
* **Only `retryable` has runtime meaning that this repo can demonstrate.** The local
|
|
265
|
+
* engine mirrors the platform's retry policy: an activity with a retry policy that
|
|
266
|
+
* does NOT set `allErrors` retries only when the failure's code is in the mapped
|
|
267
|
+
* retryable set. Measured on a failing activity with `maxRetries: 2` — `allErrors`
|
|
268
|
+
* gives 3 attempts, and a selective policy with no mapping gives 1, because there is
|
|
269
|
+
* nothing to match against. That is what this feature supplies.
|
|
270
|
+
*
|
|
271
|
+
* `priority` and `detail` are carried faithfully and interpreted by neither this SDK
|
|
272
|
+
* nor the local engine. They are modelled because an imported artifact may hold them
|
|
273
|
+
* and dropping them would break a round trip — not because their effect is known.
|
|
274
|
+
*/
|
|
275
|
+
export interface ErrorMappingRow {
|
|
276
|
+
/**
|
|
277
|
+
* The error CODE this row matches — the wire's `errorRef`.
|
|
278
|
+
*
|
|
279
|
+
* Read as a code rather than a reference to a definitions-level `bpmn:error`,
|
|
280
|
+
* on engine evidence: the runtime compares it against the failure's
|
|
281
|
+
* `externalFaultCode` and `statusCode`. Both a bare code (`TIMEOUT`) and a declared
|
|
282
|
+
* error's id validate, so the platform does not disambiguate this for us.
|
|
283
|
+
*/
|
|
284
|
+
code: string;
|
|
285
|
+
/** Whether a retry policy on this activity should retry this failure. */
|
|
286
|
+
retryable?: boolean;
|
|
287
|
+
/** Row id, when the artifact carries one. */
|
|
288
|
+
id?: string;
|
|
289
|
+
/** Match order. Carried, not interpreted — see the remarks above. */
|
|
290
|
+
priority?: number | string;
|
|
291
|
+
/**
|
|
292
|
+
* `=`-expression narrowing when this row applies.
|
|
293
|
+
*
|
|
294
|
+
* Expression-checked, because the canvas rejects an undeclared variable reference
|
|
295
|
+
* here as a blocking error while the CLI stays silent.
|
|
296
|
+
*/
|
|
297
|
+
condition?: string;
|
|
298
|
+
/** Human-facing detail. Carried, not interpreted. */
|
|
299
|
+
detail?: string;
|
|
300
|
+
}
|
|
301
|
+
/**
|
|
302
|
+
* The fields every activity arm of {@link BpmnNode} carries — the built form of
|
|
303
|
+
* {@link ActivityOpts}. One shape, so the serializer emits `uipath:retry`,
|
|
304
|
+
* `uipath:errorMapping` and the loop characteristics from a single place regardless of
|
|
305
|
+
* which activity it is walking.
|
|
306
|
+
*/
|
|
307
|
+
export interface ActivityNodeFields {
|
|
308
|
+
/** `uipath:tags` on the node — see {@link ActivityOpts.tags}. */
|
|
309
|
+
tags?: Record<string, string>;
|
|
310
|
+
/** Retry policy (`uipath:retry`). */
|
|
311
|
+
retry?: RetrySpec;
|
|
312
|
+
/** Multi-instance loop (`bpmn:multiInstanceLoopCharacteristics` + `uipath:loopCharacteristics`). */
|
|
313
|
+
loop?: LoopSpec;
|
|
314
|
+
/** Failure classification (`uipath:errorMapping`) — see {@link ErrorMappingRow}. */
|
|
315
|
+
errorMapping?: ErrorMappingRow[];
|
|
316
|
+
}
|
|
317
|
+
/** One sequence flow in the built graph — the edge from `source` to `target` (`bpmn:sequenceFlow`). */
|
|
318
|
+
export interface BpmnFlow {
|
|
319
|
+
/** The flow's element id. */
|
|
320
|
+
id: string;
|
|
321
|
+
/** The id of the element the flow leaves. */
|
|
322
|
+
source: string;
|
|
323
|
+
/** The id of the element it arrives at. */
|
|
324
|
+
target: string;
|
|
325
|
+
/** Edge label the designer shows. */
|
|
326
|
+
name?: string;
|
|
327
|
+
/** `=`-expression gating this flow (exclusive/inclusive gateway outgoing). Read a declared process variable as `=vars.<id>`. */
|
|
328
|
+
condition?: string;
|
|
329
|
+
}
|
|
330
|
+
/**
|
|
331
|
+
* How a variable is exposed: `'input'` (read-only entry input), `'output'` (a
|
|
332
|
+
* return value), or `'inputOutput'` (a mutable flow variable).
|
|
333
|
+
*/
|
|
334
|
+
export type VarDirection = 'input' | 'inputOutput' | 'output';
|
|
335
|
+
/** A declared variable in the built graph (`uipath:input` / `uipath:inputOutput` / `uipath:output`, by `direction`). */
|
|
336
|
+
export interface BpmnVarDecl {
|
|
337
|
+
/** The variable's id — what expressions read as `vars.<id>`. */
|
|
338
|
+
id: string;
|
|
339
|
+
/** Display name; `.var()`/`.input()`/`.output()` default it to the id. */
|
|
340
|
+
name: string;
|
|
341
|
+
/** The variable's `types.*` descriptor. */
|
|
342
|
+
type: TypeDesc;
|
|
343
|
+
/** How the variable crosses the process boundary — see {@link VarDirection}. */
|
|
344
|
+
direction: VarDirection;
|
|
345
|
+
/** Optional initial value. */
|
|
346
|
+
default?: unknown;
|
|
347
|
+
/** When set, the variable is scoped to that element rather than root/global. */
|
|
348
|
+
elementId?: string;
|
|
349
|
+
/** The declaration's body — a JSON Schema for a structured variable. */
|
|
350
|
+
schema?: unknown;
|
|
351
|
+
/** Mark the declaration `required="true"`, as a process input can be. */
|
|
352
|
+
required?: boolean;
|
|
353
|
+
}
|
|
354
|
+
/**
|
|
355
|
+
* A declared external identifier the process needs supplied at deploy time — a
|
|
356
|
+
* connection id, a folder key, a process name, a base URL (`uipath:binding`).
|
|
357
|
+
* Expressions read it as `=bindings.<id>`.
|
|
358
|
+
*/
|
|
359
|
+
export interface BindingDecl {
|
|
360
|
+
/** The binding's id — what `=bindings.<id>` refers to. */
|
|
361
|
+
id: string;
|
|
362
|
+
/** Display name the designer shows. Defaults to the id. */
|
|
363
|
+
name: string;
|
|
364
|
+
/** The kind of resource this identifies, e.g. `'Connection'`, `'process'`, `'queue'`. */
|
|
365
|
+
resource: string;
|
|
366
|
+
/** Which property of that resource is wanted, e.g. `'ConnectionId'`, `'Key'`. */
|
|
367
|
+
propertyAttribute: string;
|
|
368
|
+
/** The value used when nothing overrides it — what an offline run resolves to. */
|
|
369
|
+
default?: string;
|
|
370
|
+
/** The resource's key, when it differs from `default`. */
|
|
371
|
+
resourceKey?: string;
|
|
372
|
+
/**
|
|
373
|
+
* Narrows the resource, e.g. `'Agent'` for an agent process. Required by some
|
|
374
|
+
* extension types and stated by none of them — see `REGISTRY_GAPS`.
|
|
375
|
+
*/
|
|
376
|
+
resourceSubType?: string;
|
|
377
|
+
}
|
|
378
|
+
/** A definitions-level `bpmn:message` declaration, referenced by message events. */
|
|
379
|
+
export interface MessageDecl {
|
|
380
|
+
/** The declaration's id — what an event's `messageRef` points at. */
|
|
381
|
+
id: string;
|
|
382
|
+
/** The message's name, as authored on the event option. */
|
|
383
|
+
name: string;
|
|
384
|
+
}
|
|
385
|
+
/** A definitions-level `bpmn:error` declaration, referenced by error events. */
|
|
386
|
+
export interface ErrorDecl {
|
|
387
|
+
/** The declaration's id — what an event's `errorRef` points at. */
|
|
388
|
+
id: string;
|
|
389
|
+
/** The error's name, as authored on the event option. */
|
|
390
|
+
name: string;
|
|
391
|
+
/** The error code the runtime matches on. */
|
|
392
|
+
code?: string;
|
|
393
|
+
}
|
|
394
|
+
/**
|
|
395
|
+
* The built in-memory process graph `.build()` returns — the IR `serialize()`
|
|
396
|
+
* walks into `.bpmn` XML.
|
|
397
|
+
*/
|
|
398
|
+
export interface BuiltBpmn {
|
|
399
|
+
/** The process id, as passed to `bpmn()`. */
|
|
400
|
+
id: string;
|
|
401
|
+
/** The process's display name, from `.name()`. */
|
|
402
|
+
name?: string;
|
|
403
|
+
/** Every declared variable, root and element-scoped alike. */
|
|
404
|
+
variables: BpmnVarDecl[];
|
|
405
|
+
/** definitions-level `bpmn:message` declarations referenced by message events. */
|
|
406
|
+
messages: MessageDecl[];
|
|
407
|
+
/** definitions-level `bpmn:error` declarations referenced by error events. */
|
|
408
|
+
errors: ErrorDecl[];
|
|
409
|
+
/** Author-declared `uipath:binding` entries (connector wiring adds its own at serialize). */
|
|
410
|
+
bindings: BindingDecl[];
|
|
411
|
+
/** The top-level elements, in authoring order (sub-processes nest their own). */
|
|
412
|
+
nodes: BpmnNode[];
|
|
413
|
+
/** The top-level sequence flows (sub-processes nest their own). */
|
|
414
|
+
flows: BpmnFlow[];
|
|
415
|
+
/** Process-level metadata from `.metadata()`, when any was declared. */
|
|
416
|
+
metadata?: ProcessMetadata;
|
|
417
|
+
/** Named schemas from `.schema()`, which a row's `schema` may reference by id. */
|
|
418
|
+
schemas: Map<string, unknown>;
|
|
419
|
+
}
|
|
420
|
+
/**
|
|
421
|
+
* Process-level metadata — the `uipath:*` children of the process's own
|
|
422
|
+
* `extensionElements` that describe the DOCUMENT rather than any element in it.
|
|
423
|
+
*
|
|
424
|
+
* Every field here is optional and omitted entirely when unset, because an empty
|
|
425
|
+
* declaration is not the same as an absent one: `uipath:migrationVersion` with no
|
|
426
|
+
* `version` fails product validation outright, so a half-filled block is worse than
|
|
427
|
+
* none. The moddle descriptor has always declared these types; only the builder had no
|
|
428
|
+
* way to reach them.
|
|
429
|
+
*/
|
|
430
|
+
export interface ProcessMetadata {
|
|
431
|
+
/**
|
|
432
|
+
* Canvas schema generation the document targets (`uipath:migrationVersion`), e.g.
|
|
433
|
+
* `'11'` or `'11.5'`. Studio Web stamps it on export and some graders require it, so
|
|
434
|
+
* a process that omits it is not what the platform round-trips.
|
|
435
|
+
*
|
|
436
|
+
* `.schemaVersion(v)` sets the same field under the name the Flow and Case
|
|
437
|
+
* builders use for the same concept, and is what `bpmn-decompile` emits.
|
|
438
|
+
*/
|
|
439
|
+
migrationVersion?: string;
|
|
440
|
+
/** The root start event's package entry-point id (`uipath:entryPointId`). */
|
|
441
|
+
entryPointId?: string;
|
|
442
|
+
/** Free-form document tags (`uipath:tags` / `uipath:tag`). */
|
|
443
|
+
tags?: string[];
|
|
444
|
+
/** Case-management marker (`uipath:caseManagement`) — `version` plus its body value. */
|
|
445
|
+
caseManagement?: {
|
|
446
|
+
version: string;
|
|
447
|
+
value?: string;
|
|
448
|
+
};
|
|
449
|
+
/**
|
|
450
|
+
* `bpmn:process/@isExecutable`. Defaults to `true`.
|
|
451
|
+
*
|
|
452
|
+
* Worth modelling because the serializer used to hardcode `true`, so a
|
|
453
|
+
* decompile-recompile of a NON-executable process silently turned it executable — a
|
|
454
|
+
* draft or diagram-only document promoted to a runnable one, with nothing said. It is
|
|
455
|
+
* the only `bpmn:process` attribute the builder did not carry.
|
|
456
|
+
*/
|
|
457
|
+
executable?: boolean;
|
|
458
|
+
}
|
|
459
|
+
/**
|
|
460
|
+
* An extension payload carried by an element the payload does not describe.
|
|
461
|
+
*
|
|
462
|
+
* The product hangs a `uipath:mapping` off a start event (mapping process inputs
|
|
463
|
+
* onto variables), an end event (variables onto process outputs) and a
|
|
464
|
+
* sub-process, and a `uipath:activity` off an error boundary to capture the error
|
|
465
|
+
* payload. In each case the element kind is what the element IS, and the payload
|
|
466
|
+
* only decorates it — so this rides as an option on that element's own builder
|
|
467
|
+
* method rather than turning it into a task.
|
|
468
|
+
*
|
|
469
|
+
* Rows are emitted verbatim, which is what makes an imported event round-trip:
|
|
470
|
+
* the product's `name` is the SOURCE variable's display name, not the target's,
|
|
471
|
+
* and no derivation reproduces that.
|
|
472
|
+
*
|
|
473
|
+
* @example
|
|
474
|
+
* **A start event mapping two process inputs onto variables**
|
|
475
|
+
* ```ts
|
|
476
|
+
* bpmn('intake')
|
|
477
|
+
* .input('vClaimId', 'string', { name: 'in_claimId' })
|
|
478
|
+
* .var('claimId', 'string', { name: 'in_claimId' })
|
|
479
|
+
* .startEvent('start', {
|
|
480
|
+
* payload: {
|
|
481
|
+
* type: 'BPMN.Variables',
|
|
482
|
+
* outputRows: [{ name: 'in_claimId', type: 'string', source: '=vars.vClaimId', var: 'claimId' }],
|
|
483
|
+
* },
|
|
484
|
+
* })
|
|
485
|
+
* .endEvent('done')
|
|
486
|
+
* .sequenceFlow('start', 'done')
|
|
487
|
+
* .build();
|
|
488
|
+
* ```
|
|
489
|
+
*/
|
|
490
|
+
export interface ExtensionPayload {
|
|
491
|
+
/** The extension type, e.g. `'BPMN.Variables'` or `'uipath:Activity'`. */
|
|
492
|
+
type: string;
|
|
493
|
+
/** `uipath:output` rows, emitted exactly as given — see {@link TypedOutputRow}. */
|
|
494
|
+
outputRows: TypedOutputRow[];
|
|
495
|
+
}
|
|
496
|
+
/**
|
|
497
|
+
* Options for `.startEvent()`. At most one of `message` / `timer` picks the
|
|
498
|
+
* event definition (`timer` wins if both are set); neither means a plain start.
|
|
499
|
+
*/
|
|
500
|
+
export interface StartOpts {
|
|
501
|
+
/** Display name the designer shows on the event. */
|
|
502
|
+
name?: string;
|
|
503
|
+
/** Start when this message arrives — declares/reuses a definitions-level `bpmn:message`. */
|
|
504
|
+
message?: string;
|
|
505
|
+
/**
|
|
506
|
+
* Catch an error — an INTERRUPTING error start event
|
|
507
|
+
* (`bpmn:errorEventDefinition`), declaring/reusing a definitions-level
|
|
508
|
+
* `bpmn:error`. Pass a name, or `{ name, code }` when the wire code differs.
|
|
509
|
+
*
|
|
510
|
+
* @remarks
|
|
511
|
+
* Only legal as the single start event of an **event sub-process**
|
|
512
|
+
* (`.subProcess(id, fn, { triggeredByEvent: true })`) — that is the construct BPMN
|
|
513
|
+
* has for catching an error thrown elsewhere in the same container. At the process
|
|
514
|
+
* root it is meaningless: nothing can throw into it, so the branch is dead. `check()`
|
|
515
|
+
* reports that as `ERROR_START_OUTSIDE_EVENT_SUBPROCESS` rather than leaving it to
|
|
516
|
+
* be discovered at run time, because `uip maestro bpmn validate` accepts it.
|
|
517
|
+
*
|
|
518
|
+
* Interrupting is the only form emitted: `isInterrupting` is left unset, which is
|
|
519
|
+
* BPMN's default and what the platform's own templates produce. A
|
|
520
|
+
* non-interrupting error start is not a thing — the throw has already ended its
|
|
521
|
+
* scope by the time the handler sees it.
|
|
522
|
+
*/
|
|
523
|
+
error?: ErrorLike;
|
|
524
|
+
/** Start on a timer — an ISO-8601 duration string, or a full {@link TimerSpec}. */
|
|
525
|
+
timer?: TimerLike;
|
|
526
|
+
/**
|
|
527
|
+
* Also declare this timed start as a platform TRIGGER (`Intsvc.TimerTrigger`).
|
|
528
|
+
*
|
|
529
|
+
* @remarks
|
|
530
|
+
* Requires `timer`, and refuses to be set without it.
|
|
531
|
+
*
|
|
532
|
+
* **What this does and does not add.** The schedule lives in the
|
|
533
|
+
* `bpmn:timerEventDefinition` that `timer` already writes — that is what the
|
|
534
|
+
* platform's scheduler reads, and it is what the product's own Flow→BPMN
|
|
535
|
+
* converter emits for `.trigger(scheduled(…))`, with no extension at all. This
|
|
536
|
+
* flag adds the other half: a `uipath:activity` payload naming the node type, so
|
|
537
|
+
* the designer renders it as a Timer trigger rather than a bare timed start, plus
|
|
538
|
+
* one output row carrying the fire payload into a variable.
|
|
539
|
+
*
|
|
540
|
+
* So the two are orthogonal, not alternatives, which is why this is a flag rather
|
|
541
|
+
* than a separate method — and why it cannot be set alone. The registry declares
|
|
542
|
+
* NO context fields for the type, so `outputVar` is the only thing to configure;
|
|
543
|
+
* it defaults to `<id>_result`.
|
|
544
|
+
*
|
|
545
|
+
* Setting it without `timer` would emit `<bpmn:timerEventDefinition />` empty — a
|
|
546
|
+
* trigger with no schedule — and `uip maestro bpmn validate` calls that `Valid`,
|
|
547
|
+
* so nothing downstream would catch it.
|
|
548
|
+
*
|
|
549
|
+
* @example
|
|
550
|
+
* **The same schedule, bare and then declared as a trigger**
|
|
551
|
+
* ```ts
|
|
552
|
+
* // bare — the shape the platform's own Flow→BPMN converter emits
|
|
553
|
+
* bpmn('nightly')
|
|
554
|
+
* .startEvent('start', { timer: { cycle: 'R/P1D' } })
|
|
555
|
+
* .scriptTask('rollup', { script: 'return { ok: true };' })
|
|
556
|
+
* .endEvent('done')
|
|
557
|
+
* .sequenceFlow('start', 'rollup')
|
|
558
|
+
* .sequenceFlow('rollup', 'done')
|
|
559
|
+
* .build();
|
|
560
|
+
*
|
|
561
|
+
* // typed — same schedule, plus designer identity and a payload variable
|
|
562
|
+
* bpmn('nightly')
|
|
563
|
+
* .startEvent('start', { timer: { cycle: 'R/P1D' }, trigger: { outputVar: 'tick' } })
|
|
564
|
+
* .scriptTask('rollup', { script: 'return { ok: true };' })
|
|
565
|
+
* .endEvent('done')
|
|
566
|
+
* .sequenceFlow('start', 'rollup')
|
|
567
|
+
* .sequenceFlow('rollup', 'done')
|
|
568
|
+
* .build();
|
|
569
|
+
* ```
|
|
570
|
+
*/
|
|
571
|
+
trigger?: true | {
|
|
572
|
+
outputVar?: string;
|
|
573
|
+
};
|
|
574
|
+
/** A `uipath:mapping` mapping process inputs onto variables — see {@link ExtensionPayload}. */
|
|
575
|
+
payload?: ExtensionPayload;
|
|
576
|
+
}
|
|
577
|
+
/**
|
|
578
|
+
* Options for `.endEvent()`. `terminate`, `error`, or `message` picks the event
|
|
579
|
+
* definition, checked in that order; none of them means a plain end.
|
|
580
|
+
*/
|
|
581
|
+
export interface EndOpts {
|
|
582
|
+
/** Display name the designer shows on the event. */
|
|
583
|
+
name?: string;
|
|
584
|
+
/** End as a TERMINATE event — abort the whole process instance, not just this path. */
|
|
585
|
+
terminate?: boolean;
|
|
586
|
+
/** End by throwing this message — declares/reuses a definitions-level `bpmn:message`. */
|
|
587
|
+
message?: string;
|
|
588
|
+
/**
|
|
589
|
+
* End by throwing this error (a name, or `{ name, code }`) — declares/reuses a
|
|
590
|
+
* definitions-level `bpmn:error`.
|
|
591
|
+
*
|
|
592
|
+
* Deliberately narrower than {@link ErrorLike}: catch-any has no meaning on a
|
|
593
|
+
* THROW, which has to say what it throws.
|
|
594
|
+
*/
|
|
595
|
+
error?: string | {
|
|
596
|
+
name: string;
|
|
597
|
+
code?: string;
|
|
598
|
+
};
|
|
599
|
+
/** A `uipath:mapping` mapping variables onto process outputs — see {@link ExtensionPayload}. */
|
|
600
|
+
payload?: ExtensionPayload;
|
|
601
|
+
}
|
|
602
|
+
/**
|
|
603
|
+
* Options for `.intermediateCatchEvent()`. `message` or `timer` picks what the
|
|
604
|
+
* event waits for (`timer` wins if both are set).
|
|
605
|
+
*/
|
|
606
|
+
export interface CatchOpts {
|
|
607
|
+
/** Display name the designer shows on the event. */
|
|
608
|
+
name?: string;
|
|
609
|
+
/** Wait for this message — declares/reuses a definitions-level `bpmn:message`. */
|
|
610
|
+
message?: string;
|
|
611
|
+
/** Wait for a timer — an ISO-8601 duration string, or a full {@link TimerSpec}. */
|
|
612
|
+
timer?: TimerLike;
|
|
613
|
+
/** An extension payload on the event — see {@link ExtensionPayload}. */
|
|
614
|
+
payload?: ExtensionPayload;
|
|
615
|
+
}
|
|
616
|
+
/** Options for `.intermediateThrowEvent()` — a `message` to throw, or none. */
|
|
617
|
+
export interface ThrowOpts {
|
|
618
|
+
/** Display name the designer shows on the event. */
|
|
619
|
+
name?: string;
|
|
620
|
+
/** The message to throw — declares/reuses a definitions-level `bpmn:message`. */
|
|
621
|
+
message?: string;
|
|
622
|
+
/** An extension payload on the event — see {@link ExtensionPayload}. */
|
|
623
|
+
payload?: ExtensionPayload;
|
|
624
|
+
}
|
|
625
|
+
/**
|
|
626
|
+
* Options for `.boundaryEvent()`: the activity it attaches to, whether it
|
|
627
|
+
* interrupts that activity, and the event definition — exactly one of
|
|
628
|
+
* `message` / `timer` / `error` (checked in the order error, timer, message;
|
|
629
|
+
* none at all is refused).
|
|
630
|
+
*/
|
|
631
|
+
export interface BoundaryOpts {
|
|
632
|
+
/** Display name the designer shows on the event. */
|
|
633
|
+
name?: string;
|
|
634
|
+
/** id of the activity this boundary event is attached to. */
|
|
635
|
+
attachedTo: string;
|
|
636
|
+
/** true (default) = interrupting; false = non-interrupting. */
|
|
637
|
+
cancelActivity?: boolean;
|
|
638
|
+
/** Catch this message — declares/reuses a definitions-level `bpmn:message`. */
|
|
639
|
+
message?: string;
|
|
640
|
+
/** Fire on a timer — an ISO-8601 duration string, or a full {@link TimerSpec}. */
|
|
641
|
+
timer?: TimerLike;
|
|
642
|
+
/**
|
|
643
|
+
* Catch an error: `true` for ANY error, or a name (or `{ name, code }`) to catch
|
|
644
|
+
* one declared kind — see {@link ErrorLike}.
|
|
645
|
+
*/
|
|
646
|
+
error?: ErrorLike;
|
|
647
|
+
/** A `uipath:activity` capturing the error payload — see {@link ExtensionPayload}. */
|
|
648
|
+
payload?: ExtensionPayload;
|
|
649
|
+
}
|
|
650
|
+
/** Options for `.exclusiveGateway()` / `.inclusiveGateway()`. */
|
|
651
|
+
export interface GatewayOpts {
|
|
652
|
+
/** Display name the designer shows on the gateway. */
|
|
653
|
+
name?: string;
|
|
654
|
+
/** Outgoing flow id taken when no condition matches (exclusive/inclusive). */
|
|
655
|
+
default?: string;
|
|
656
|
+
}
|
|
657
|
+
/**
|
|
658
|
+
* Retry an activity that fails (`uipath:retry`).
|
|
659
|
+
*
|
|
660
|
+
* @example
|
|
661
|
+
* **Three retries, backing off 1s, then 2s, then 4s**
|
|
662
|
+
* ```ts
|
|
663
|
+
* bpmn('sync')
|
|
664
|
+
* .startEvent('start')
|
|
665
|
+
* .scriptTask('fetch', {
|
|
666
|
+
* script: 'return { ok: true };',
|
|
667
|
+
* retry: { maxRetries: 3, backoff: 'PT1S', backoffType: 'exponential', exponentialBase: 2 },
|
|
668
|
+
* })
|
|
669
|
+
* .endEvent('done')
|
|
670
|
+
* .sequenceFlow('start', 'fetch')
|
|
671
|
+
* .sequenceFlow('fetch', 'done')
|
|
672
|
+
* .build();
|
|
673
|
+
* ```
|
|
674
|
+
*/
|
|
675
|
+
export interface RetrySpec {
|
|
676
|
+
/**
|
|
677
|
+
* How many times to retry AFTER the first attempt — so `3` means up to four
|
|
678
|
+
* runs in total. Must be a positive integer; the runtime ignores a policy with
|
|
679
|
+
* a count of zero or less.
|
|
680
|
+
*/
|
|
681
|
+
maxRetries: number;
|
|
682
|
+
/**
|
|
683
|
+
* Wait this long before retrying, as an ISO-8601 duration (`'PT30S'`, `'PT1M'`,
|
|
684
|
+
* `'P1DT12H'`). Days, hours, minutes and seconds only — the runtime's duration
|
|
685
|
+
* parser does not accept weeks, months or years.
|
|
686
|
+
*/
|
|
687
|
+
backoff?: string;
|
|
688
|
+
/**
|
|
689
|
+
* `'static'` (default) waits `backoff` before every retry; `'exponential'`
|
|
690
|
+
* multiplies it by {@link RetrySpec.exponentialBase} each time.
|
|
691
|
+
*/
|
|
692
|
+
backoffType?: 'static' | 'exponential';
|
|
693
|
+
/** Multiplier for `'exponential'` backoff, e.g. `2` for 1s → 2s → 4s. */
|
|
694
|
+
exponentialBase?: number;
|
|
695
|
+
/** Retry every failure, not only the ones the platform marks retryable. */
|
|
696
|
+
allErrors?: boolean;
|
|
697
|
+
/** Give up after this much total elapsed time, as an ISO-8601 duration. */
|
|
698
|
+
maxDuration?: string;
|
|
699
|
+
}
|
|
700
|
+
/**
|
|
701
|
+
* What every ACTIVITY accepts, on top of its own options — a script task, a
|
|
702
|
+
* variable task, a connector task, a sub-process.
|
|
703
|
+
*
|
|
704
|
+
* Note what is *not* here: `skipCondition`. Skipping is carried on a
|
|
705
|
+
* `uipath:activity`, and a script or variable task must use `uipath:mapping`
|
|
706
|
+
* instead (`uip maestro bpmn validate` rejects `BPMN.Variables` under
|
|
707
|
+
* `uipath:activity`), which has no such attribute — so an authored skip on one
|
|
708
|
+
* would be silently dropped in serialization and the step would run anyway. It
|
|
709
|
+
* therefore lives on {@link BpmnConnectorOpts} alone, where it works.
|
|
710
|
+
*/
|
|
711
|
+
export interface ActivityOpts {
|
|
712
|
+
/**
|
|
713
|
+
* `uipath:tags` on the activity — key/value pairs the designer carries alongside
|
|
714
|
+
* the node, as a SIBLING of its payload.
|
|
715
|
+
*
|
|
716
|
+
* Distinct from `.metadata({ tags })`, which is the process-level `uipath:Tags`
|
|
717
|
+
* and is a plain list of values. This one is per-node and keyed: every service
|
|
718
|
+
* task in the real exports carries `caseTaskType` this way (143 rows across five
|
|
719
|
+
* files), and nothing could express it.
|
|
720
|
+
*/
|
|
721
|
+
tags?: Record<string, string>;
|
|
722
|
+
/** Retry the activity when it fails — see {@link RetrySpec}. */
|
|
723
|
+
retry?: RetrySpec;
|
|
724
|
+
/** Run it once per item of a collection — see {@link LoopSpec}. */
|
|
725
|
+
loop?: LoopSpec;
|
|
726
|
+
/**
|
|
727
|
+
* Classify the activity's failures — see {@link ErrorMappingRow}.
|
|
728
|
+
*
|
|
729
|
+
* Most useful alongside `retry` WITHOUT `allErrors`: such a policy retries only the
|
|
730
|
+
* codes marked `retryable` here, and with no mapping it retries nothing at all.
|
|
731
|
+
*/
|
|
732
|
+
errorMapping?: ErrorMappingRow[];
|
|
733
|
+
}
|
|
734
|
+
/** Options for `.scriptTask()` — the Jint JavaScript body and its input/output mappings. */
|
|
735
|
+
export interface ScriptTaskOpts extends ActivityOpts {
|
|
736
|
+
/** Display name the designer shows on the task. */
|
|
737
|
+
name?: string;
|
|
738
|
+
/**
|
|
739
|
+
* The script body (Jint JavaScript). Each `inputs` key is available as a
|
|
740
|
+
* top-level identifier (for example `inputs: { amount: '=vars.amount' }`
|
|
741
|
+
* makes the script read `amount`, not `args.amount`).
|
|
742
|
+
*/
|
|
743
|
+
script: string;
|
|
744
|
+
/** The script language marker. Defaults to `'JavaScript'` (Jint). */
|
|
745
|
+
scriptFormat?: string;
|
|
746
|
+
/** `uipath:input` rows: field name → `=`-expression read into the script. */
|
|
747
|
+
inputs?: Record<string, string>;
|
|
748
|
+
/**
|
|
749
|
+
* `uipath:output` rows: variable id → `=`-expression.
|
|
750
|
+
*
|
|
751
|
+
* @remarks
|
|
752
|
+
* **Read `=result.response`, not `=result.<field>`.** The serializer emits
|
|
753
|
+
* `<uipath:scriptVersion value="v3" />`, and the runtime wraps a v2-or-later
|
|
754
|
+
* script task's return value: `ScriptActivities.DoInvokeScriptTaskAsync` in
|
|
755
|
+
* PO.BpmnEngine returns `{ "response": <whatever the script returned> }` when
|
|
756
|
+
* `IsVersionAtLeast(version, 2)`. So the script may return any JSON value and
|
|
757
|
+
* `=result.response` is that value; `=result.Error` is its error slot.
|
|
758
|
+
*
|
|
759
|
+
* Only a v1 script task spreads the return object's fields, and it must return an
|
|
760
|
+
* object or the activity throws. This SDK does not emit v1.
|
|
761
|
+
*/
|
|
762
|
+
outputs?: Record<string, string>;
|
|
763
|
+
/**
|
|
764
|
+
* Output rows spelled out, replacing the ones `outputs` derives — see
|
|
765
|
+
* {@link TypedOutputRow}.
|
|
766
|
+
*
|
|
767
|
+
* For importers. `outputs` names each row after the VARIABLE it writes, which is
|
|
768
|
+
* right when you are authoring one; the product names it after the value the
|
|
769
|
+
* script returns (`scriptResponse`, `Error`) and binds a differently-named
|
|
770
|
+
* variable, and no derivation reproduces that pair.
|
|
771
|
+
*/
|
|
772
|
+
outputRows?: TypedOutputRow[];
|
|
773
|
+
/**
|
|
774
|
+
* The `uipath:inputSchema` body inside the mapping's `uipath:context` — a JSON
|
|
775
|
+
* Schema for the `args` the script receives. Real script tasks all carry one.
|
|
776
|
+
*/
|
|
777
|
+
inputSchema?: unknown;
|
|
778
|
+
/**
|
|
779
|
+
* The mapping's extension type. Defaults to `'BPMN.Variables'`, which is the
|
|
780
|
+
* only value the runtime contract defines.
|
|
781
|
+
*
|
|
782
|
+
* @remarks
|
|
783
|
+
* **There is no second valid value.** `BPMN.Variables` "is intended to be the
|
|
784
|
+
* common description for the context/input/output section in the
|
|
785
|
+
* `uipath:mapping`", and the script itself rides in the native `<bpmn:script>`
|
|
786
|
+
* tag — so a script task differs from a variables task by its ELEMENT, not by
|
|
787
|
+
* its extension type. `BPMN.ScriptTask`, which this SDK used to emit, "is not a
|
|
788
|
+
* valid type for `uipath:type`" (Maestro runtime contract owner, 2026-08-28;
|
|
789
|
+
* see the *BPMN Metamodel Runtime Contract — Script task* page).
|
|
790
|
+
*
|
|
791
|
+
* That matches the artifacts exactly: all 29 script tasks across the five real
|
|
792
|
+
* Studio Web exports in `research/bpmn-roundtrip` are `BPMN.Variables`, and none
|
|
793
|
+
* is anything else. `uip maestro bpmn validate` accepts both, so nothing in the
|
|
794
|
+
* toolchain catches the wrong one — which is why the SDK emitted it for so long.
|
|
795
|
+
*
|
|
796
|
+
* The option is kept rather than removed because it shipped (v3.25.0), and an
|
|
797
|
+
* importer may still meet a legacy artifact carrying the invalid value. Decompile
|
|
798
|
+
* does NOT preserve it: reproducing markup the contract rejects is propagating a
|
|
799
|
+
* defect, not fidelity — the same call the round trip already makes for a bare
|
|
800
|
+
* `<uipath:input name="args">`.
|
|
801
|
+
*/
|
|
802
|
+
type?: string;
|
|
803
|
+
}
|
|
804
|
+
/** Options for `.task()` — a display name and the variable assignments the task makes. */
|
|
805
|
+
export interface TaskOpts extends ActivityOpts {
|
|
806
|
+
/** Display name the designer shows on the task. */
|
|
807
|
+
name?: string;
|
|
808
|
+
/**
|
|
809
|
+
* Variable assignments (`BPMN.Variables`): variable id → the value to assign.
|
|
810
|
+
*
|
|
811
|
+
* A value starting with `=` is an expression evaluated against the surrounding
|
|
812
|
+
* variables (`'=js:vars.total + 1'`). Anything else is a **string literal**
|
|
813
|
+
* (`'hello'`), which the serializer wraps into an equivalent expression — so
|
|
814
|
+
* to assign a number or a boolean, write it as an expression (`'=js:5'`),
|
|
815
|
+
* since `'5'` assigns the string.
|
|
816
|
+
*/
|
|
817
|
+
set?: Record<string, string>;
|
|
818
|
+
}
|
|
819
|
+
/** Options for `.subProcess()`. */
|
|
820
|
+
export interface SubProcessOpts extends ActivityOpts {
|
|
821
|
+
/** Display name the designer shows on the sub-process. */
|
|
822
|
+
name?: string;
|
|
823
|
+
/** Mark an EVENT sub-process — started by an event inside it, not by an incoming flow. */
|
|
824
|
+
triggeredByEvent?: boolean;
|
|
825
|
+
/**
|
|
826
|
+
* A `uipath:mapping` on the sub-process itself, mapping its results back out to
|
|
827
|
+
* the enclosing scope's variables — see {@link ExtensionPayload}.
|
|
828
|
+
*
|
|
829
|
+
* Distinct from the variables the sub-process DECLARES (`sp.var(…)` inside the
|
|
830
|
+
* body), which are its own scope; this is the handoff at its boundary.
|
|
831
|
+
*/
|
|
832
|
+
payload?: ExtensionPayload;
|
|
833
|
+
}
|
|
834
|
+
/** Options for `.binding()`. */
|
|
835
|
+
export interface BindingOpts {
|
|
836
|
+
/** Display name the designer shows. Defaults to the binding's id. */
|
|
837
|
+
name?: string;
|
|
838
|
+
/**
|
|
839
|
+
* The value the binding resolves to when nothing overrides it — which is what
|
|
840
|
+
* an offline run reads, so it is the one field a local run needs.
|
|
841
|
+
*/
|
|
842
|
+
value?: string;
|
|
843
|
+
/**
|
|
844
|
+
* The kind of resource this identifies. Defaults to `'custom'`, which is the
|
|
845
|
+
* right answer for a plain configurable value; use the registry's resource name
|
|
846
|
+
* (`'Connection'`, `'process'`, `'queue'`, `'businessRule'`) when the binding
|
|
847
|
+
* addresses one of those.
|
|
848
|
+
*/
|
|
849
|
+
resource?: string;
|
|
850
|
+
/** Which property of that resource is wanted. Defaults to `'value'`. */
|
|
851
|
+
propertyAttribute?: string;
|
|
852
|
+
/** The resource's key, when it differs from {@link BindingOpts.value}. */
|
|
853
|
+
resourceKey?: string;
|
|
854
|
+
/**
|
|
855
|
+
* Narrows the resource, e.g. `'Agent'` for an agent process.
|
|
856
|
+
*
|
|
857
|
+
* Some extension types require it and none of them state it — `.startAgent()`
|
|
858
|
+
* supplies it from `REGISTRY_GAPS`. It is exposed here so a hand-written or
|
|
859
|
+
* DECOMPILED binding can reproduce one, which is what keeps a round-trip exact.
|
|
860
|
+
*/
|
|
861
|
+
resourceSubType?: string;
|
|
862
|
+
}
|
|
863
|
+
/**
|
|
864
|
+
* Options for `.http()` — an `Intsvc.UnifiedHttpRequest` node.
|
|
865
|
+
*
|
|
866
|
+
* The field names are the registry's own context fields, so what you write is
|
|
867
|
+
* what the platform reads. `mode` is required-and-hidden in the registry and
|
|
868
|
+
* always emitted as `manual`; it is not an option because there is nothing to
|
|
869
|
+
* choose.
|
|
870
|
+
*/
|
|
871
|
+
export interface HttpOpts extends ActivityOpts {
|
|
872
|
+
/** Display name the designer shows on the task. */
|
|
873
|
+
name?: string;
|
|
874
|
+
/** Request URL. Accepts an `=`-expression, including `=bindings.<id>`. */
|
|
875
|
+
url: string;
|
|
876
|
+
/** HTTP method. Defaults to `'GET'`, matching the registry's own default. */
|
|
877
|
+
method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD' | 'OPTIONS';
|
|
878
|
+
/** Request headers — serialized to the node's json context field. */
|
|
879
|
+
headers?: Record<string, unknown>;
|
|
880
|
+
/** Query parameters — serialized to the node's json context field. */
|
|
881
|
+
parameters?: Record<string, unknown>;
|
|
882
|
+
/** Request body — serialized to the node's json context field. */
|
|
883
|
+
body?: unknown;
|
|
884
|
+
/**
|
|
885
|
+
* EXTRA output rows: variable id → `=`-expression read against the node's own result,
|
|
886
|
+
* e.g. `{ runStatus: '=Status' }`.
|
|
887
|
+
*
|
|
888
|
+
* Needed for the same reason `.humanTask()` has it: this family declares a TYPED output
|
|
889
|
+
* (`type="Orchestrator.RunJob"` and friends) with no `source`, which the designer resolves
|
|
890
|
+
* into sub-fields but the local engine cannot — so the variable stays `undefined` on a local
|
|
891
|
+
* run and nothing downstream can read or branch on it. An explicit row maps one field the
|
|
892
|
+
* way every other output row works. The spec's own row is still emitted, so the artifact
|
|
893
|
+
* stays what the platform expects.
|
|
894
|
+
*/
|
|
895
|
+
outputs?: Record<string, string>;
|
|
896
|
+
/** Variable the response lands in. Defaults to `<id>_response`. */
|
|
897
|
+
outputVar?: string;
|
|
898
|
+
/** `=`-expression that skips the request when truthy. */
|
|
899
|
+
skipCondition?: string;
|
|
900
|
+
}
|
|
901
|
+
/**
|
|
902
|
+
* What every Orchestrator invocation needs: which process, in which folder, with
|
|
903
|
+
* what input.
|
|
904
|
+
*
|
|
905
|
+
* `process` becomes the node's `name` context field, which is what the runtime
|
|
906
|
+
* resolves a release key from — so a process is addressed by NAME, not by key, and
|
|
907
|
+
* the same artifact works against any tenant that has one by that name. Pass
|
|
908
|
+
* `releaseKey` only when you have a binding for the key itself.
|
|
909
|
+
*/
|
|
910
|
+
export interface OrchestratorOpts extends ActivityOpts {
|
|
911
|
+
/** Display name the designer shows on the node. */
|
|
912
|
+
name?: string;
|
|
913
|
+
/** The Orchestrator process to start, by name. */
|
|
914
|
+
process: string;
|
|
915
|
+
/** Folder path the process lives in. Omit for the personal/default folder. */
|
|
916
|
+
folder?: string;
|
|
917
|
+
/** Input arguments — serialized as the node's `JobArguments` body. */
|
|
918
|
+
input?: Record<string, unknown>;
|
|
919
|
+
/** The release key, when a binding supplies it (`=bindings.<id>`). */
|
|
920
|
+
releaseKey?: string;
|
|
921
|
+
/**
|
|
922
|
+
* EXTRA output rows: variable id → `=`-expression read against the node's own result,
|
|
923
|
+
* e.g. `{ runStatus: '=Status' }`.
|
|
924
|
+
*
|
|
925
|
+
* Needed for the same reason `.humanTask()` has it: this family declares a TYPED output
|
|
926
|
+
* (`type="Orchestrator.RunJob"` and friends) with no `source`, which the designer resolves
|
|
927
|
+
* into sub-fields but the local engine cannot — so the variable stays `undefined` on a local
|
|
928
|
+
* run and nothing downstream can read or branch on it. An explicit row maps one field the
|
|
929
|
+
* way every other output row works. The spec's own row is still emitted, so the artifact
|
|
930
|
+
* stays what the platform expects.
|
|
931
|
+
*/
|
|
932
|
+
outputs?: Record<string, string>;
|
|
933
|
+
/** Variable the job response lands in. Defaults to `<id>_processResponse`. */
|
|
934
|
+
outputVar?: string;
|
|
935
|
+
/** `=`-expression that skips the invocation when truthy. */
|
|
936
|
+
skipCondition?: string;
|
|
937
|
+
}
|
|
938
|
+
/** Options for the two agentic/case call activities, which come in sync and async forms. */
|
|
939
|
+
export interface OrchestratorAsyncOpts extends OrchestratorOpts {
|
|
940
|
+
/**
|
|
941
|
+
* `true` starts the process and carries on without waiting (`…Async`), so only
|
|
942
|
+
* an error is mapped back. Default `false` — start and wait.
|
|
943
|
+
*/
|
|
944
|
+
async?: boolean;
|
|
945
|
+
}
|
|
946
|
+
/**
|
|
947
|
+
* Options for `.queueItem()`.
|
|
948
|
+
*
|
|
949
|
+
* `folder` is REQUIRED here, unlike the process family: queue items are
|
|
950
|
+
* folder-scoped and the runtime refuses to dispatch without a folder path
|
|
951
|
+
* (`queue items are folder-scoped; supply its binding`). The registry marks the
|
|
952
|
+
* field optional, so this is the SDK being stricter than the spec on purpose.
|
|
953
|
+
*/
|
|
954
|
+
export interface QueueItemOpts extends ActivityOpts {
|
|
955
|
+
/** Display name the designer shows on the node. */
|
|
956
|
+
name?: string;
|
|
957
|
+
/** The queue to add the item to. */
|
|
958
|
+
queue: string;
|
|
959
|
+
/** Folder path the queue lives in. */
|
|
960
|
+
folder: string;
|
|
961
|
+
/** The item's content — serialized as the node's `ItemData` body. */
|
|
962
|
+
item?: Record<string, unknown>;
|
|
963
|
+
/**
|
|
964
|
+
* `true` waits for the item to be processed and maps its outcome back
|
|
965
|
+
* (`Orchestrator.CreateAndWaitForQueueItem`); default adds it and carries on.
|
|
966
|
+
*/
|
|
967
|
+
wait?: boolean;
|
|
968
|
+
/**
|
|
969
|
+
* EXTRA output rows: variable id → `=`-expression read against the node's own result,
|
|
970
|
+
* e.g. `{ runStatus: '=Status' }`.
|
|
971
|
+
*
|
|
972
|
+
* Needed for the same reason `.humanTask()` has it: this family declares a TYPED output
|
|
973
|
+
* (`type="Orchestrator.RunJob"` and friends) with no `source`, which the designer resolves
|
|
974
|
+
* into sub-fields but the local engine cannot — so the variable stays `undefined` on a local
|
|
975
|
+
* run and nothing downstream can read or branch on it. An explicit row maps one field the
|
|
976
|
+
* way every other output row works. The spec's own row is still emitted, so the artifact
|
|
977
|
+
* stays what the platform expects.
|
|
978
|
+
*/
|
|
979
|
+
outputs?: Record<string, string>;
|
|
980
|
+
/** Variable the response lands in. Defaults to `<id>_response`. */
|
|
981
|
+
outputVar?: string;
|
|
982
|
+
/** `=`-expression that skips the enqueue when truthy. */
|
|
983
|
+
skipCondition?: string;
|
|
984
|
+
}
|
|
985
|
+
/**
|
|
986
|
+
* Options for `.humanTask()` — an `Actions.HITL` action-app task.
|
|
987
|
+
*
|
|
988
|
+
* `app` is the Action App's id and the registry marks it the type's primary key,
|
|
989
|
+
* so it comes from the tenant (`RequiresDiscovery: Yes`). Nothing offline can
|
|
990
|
+
* resolve it: pass the id, or a `=bindings.<id>` reference so it is configurable
|
|
991
|
+
* per environment.
|
|
992
|
+
*/
|
|
993
|
+
export interface HumanTaskOpts extends ActivityOpts {
|
|
994
|
+
/** Display name the designer shows on the task. */
|
|
995
|
+
name?: string;
|
|
996
|
+
/** The Action App's id (`appId`). Tenant-specific — see the remarks above. */
|
|
997
|
+
app: string;
|
|
998
|
+
/** The app version (`appVersion`). */
|
|
999
|
+
appVersion?: number;
|
|
1000
|
+
/**
|
|
1001
|
+
* The outcomes a human can pick, e.g. `['approve', 'reject']`.
|
|
1002
|
+
*
|
|
1003
|
+
* Joined with commas. The registry types this field as a bare `string` and says
|
|
1004
|
+
* nothing about its encoding, and `uip maestro bpmn validate` accepts a
|
|
1005
|
+
* comma-joined list, a JSON array, a single word and an empty string alike — so
|
|
1006
|
+
* this is the plausible reading, not a verified one. If a LIVE run mis-reads the
|
|
1007
|
+
* outcomes, this is the first thing to compare against a Studio Web export.
|
|
1008
|
+
*/
|
|
1009
|
+
actions?: string[];
|
|
1010
|
+
/** The task title a human sees (`taskTitle`). */
|
|
1011
|
+
title?: string;
|
|
1012
|
+
/** An existing task key, when resuming rather than creating (`key`). */
|
|
1013
|
+
key?: string;
|
|
1014
|
+
/** Data the task shows the human — the node's `HitlTaskArguments`. */
|
|
1015
|
+
input?: Record<string, unknown>;
|
|
1016
|
+
/**
|
|
1017
|
+
* Fields to pull out of the human's response into variables, e.g.
|
|
1018
|
+
* `{ decision: '=Action' }`.
|
|
1019
|
+
*
|
|
1020
|
+
* Worth setting whenever a gateway branches on the outcome. The type's own
|
|
1021
|
+
* output row is typed (`type="Actions.HITL"`, no `source`), which the designer
|
|
1022
|
+
* resolves but the local runtime leaves `undefined` — so without a mapped field
|
|
1023
|
+
* here, a local run cannot branch on the decision at all. `=Action` is the field
|
|
1024
|
+
* the runtime's own outcome routing reads.
|
|
1025
|
+
*/
|
|
1026
|
+
outputs?: Record<string, string>;
|
|
1027
|
+
/** Variable the whole typed response lands in. Defaults to `<id>_processResponse`. */
|
|
1028
|
+
outputVar?: string;
|
|
1029
|
+
/** `=`-expression that skips the task when truthy. */
|
|
1030
|
+
skipCondition?: string;
|
|
1031
|
+
}
|
|
1032
|
+
/**
|
|
1033
|
+
* Options for `.receiveMessage()` — `Maestro.ReceiveMessageEvent`.
|
|
1034
|
+
*
|
|
1035
|
+
* The typed counterpart of `.intermediateCatchEvent({ message })`, and NOT the same
|
|
1036
|
+
* thing on the wire. The plain form declares a definitions-level `bpmn:message` and
|
|
1037
|
+
* points the event's `messageRef` at it; the typed form carries the message name in
|
|
1038
|
+
* its own `uipath:context` and takes a correlation `reference`. Reach for this one
|
|
1039
|
+
* when the sender is another Maestro process; the plain form for ordinary BPMN
|
|
1040
|
+
* message flow.
|
|
1041
|
+
*/
|
|
1042
|
+
export interface ReceiveMessageOpts extends ActivityOpts {
|
|
1043
|
+
/** Display name the designer shows on the event. */
|
|
1044
|
+
name?: string;
|
|
1045
|
+
/** The message name to wait for — the type's required `name` context field. */
|
|
1046
|
+
message: string;
|
|
1047
|
+
/**
|
|
1048
|
+
* Correlation reference matching this receive to its sender.
|
|
1049
|
+
*
|
|
1050
|
+
* Required by the registry. Emitted as its own `uipath:input` row targeting
|
|
1051
|
+
* `bodyField`, which is the field's declared target rather than its key — see
|
|
1052
|
+
* `RegistryInputField.target` for why that distinction cost a defect.
|
|
1053
|
+
*/
|
|
1054
|
+
reference: string;
|
|
1055
|
+
/** Variable the typed response lands in. Defaults to `<id>_response`. */
|
|
1056
|
+
outputVar?: string;
|
|
1057
|
+
/** `=`-expression that skips the event when truthy. */
|
|
1058
|
+
skipCondition?: string;
|
|
1059
|
+
/**
|
|
1060
|
+
* There is deliberately NO `outputs` here, unlike `.humanTask()`.
|
|
1061
|
+
*
|
|
1062
|
+
* This type permits exactly ONE output row. A second is refused by the platform:
|
|
1063
|
+
*
|
|
1064
|
+
* [error] Maestro.ReceiveMessageEvent output name must be "response".
|
|
1065
|
+
* [error] Maestro.ReceiveMessageEvent output type must be "Maestro.ReceiveMessageEvent".
|
|
1066
|
+
*
|
|
1067
|
+
* Which is not derivable from the registry — `Actions.HITL` declares a
|
|
1068
|
+
* structurally IDENTICAL output (a typed row, no `source`) and accepts a mapped
|
|
1069
|
+
* second row happily, which is the whole basis of offline approval routing. So
|
|
1070
|
+
* the constraint is recorded in `REGISTRY_GAPS` rather than inferred, and this
|
|
1071
|
+
* option simply does not exist. Read the message with `outputVar` and an
|
|
1072
|
+
* expression against the typed row instead.
|
|
1073
|
+
*/
|
|
1074
|
+
readonly outputs?: never;
|
|
1075
|
+
}
|
|
1076
|
+
/**
|
|
1077
|
+
* Shared options for the two connector-event methods.
|
|
1078
|
+
*
|
|
1079
|
+
* `connection` and `folder` are SYMBOLIC binding names, exactly as `.connector()`
|
|
1080
|
+
* takes them — the offline rungs compile them to `=bindings.<name>` and only a live
|
|
1081
|
+
* run needs real ids. Both are required by the platform: the type declares
|
|
1082
|
+
* `connectionId`, `folderId`, `folderPath` and `folderKey` all required, so a node
|
|
1083
|
+
* missing either is refused at serialize rather than by the CLI a build later.
|
|
1084
|
+
*/
|
|
1085
|
+
export interface ConnectorEventOpts extends ActivityOpts {
|
|
1086
|
+
/** Display name; defaults to the descriptor's own label. */
|
|
1087
|
+
name?: string;
|
|
1088
|
+
/** Symbolic binding name for the Integration Service connection. */
|
|
1089
|
+
connection: string;
|
|
1090
|
+
/** Symbolic binding name for the folder. */
|
|
1091
|
+
folder: string;
|
|
1092
|
+
/** The folder path the type requires alongside the key. Defaults to `/Shared`. */
|
|
1093
|
+
folderPath?: string;
|
|
1094
|
+
/** Pin the descriptor version, as `.connector()` does. */
|
|
1095
|
+
version?: string;
|
|
1096
|
+
/**
|
|
1097
|
+
* The `where` scope narrowing the subscription, when the operation declares
|
|
1098
|
+
* parameters. `Library.eventParameterFields()` is the authority on which names an
|
|
1099
|
+
* operation accepts — and note that "declares none" is a real answer for some
|
|
1100
|
+
* operations (HTTP Webhook scopes by the connection), not a lookup failure.
|
|
1101
|
+
*/
|
|
1102
|
+
filter?: Record<string, unknown>;
|
|
1103
|
+
/** Extra event parameters, for operations that declare them. */
|
|
1104
|
+
parameters?: Record<string, unknown>;
|
|
1105
|
+
/** Variable the event payload lands in. Defaults to `<id>_result`. */
|
|
1106
|
+
outputVar?: string;
|
|
1107
|
+
/**
|
|
1108
|
+
* Fields to pull out of the payload into variables, e.g. `{ amount: '=amount' }`.
|
|
1109
|
+
*
|
|
1110
|
+
* Worth setting whenever anything branches on the payload. The type's own row is
|
|
1111
|
+
* `type="custom" source="."` — the whole result — which the local engine does NOT
|
|
1112
|
+
* resolve, so the default variable is `undefined` on a local run and nothing can
|
|
1113
|
+
* branch on it. A mapped row IS resolved, and unlike `Maestro.ReceiveMessageEvent`
|
|
1114
|
+
* this family accepts one: verified `Valid`, with both gateway arms exercised
|
|
1115
|
+
* offline via `--mock-data`.
|
|
1116
|
+
*/
|
|
1117
|
+
outputs?: Record<string, string>;
|
|
1118
|
+
/** `=`-expression that skips the node when truthy. */
|
|
1119
|
+
skipCondition?: string;
|
|
1120
|
+
}
|
|
1121
|
+
/** Options for `.externalAgent()` / `.externalWorkflow()`. */
|
|
1122
|
+
export interface ExternalTaskOpts extends ActivityOpts {
|
|
1123
|
+
/** Display name; defaults to the descriptor's own label. */
|
|
1124
|
+
name?: string;
|
|
1125
|
+
/** `sync` waits for the result; `async` starts it and moves on. */
|
|
1126
|
+
mode: 'sync' | 'async';
|
|
1127
|
+
/** Symbolic binding name for the Integration Service connection. */
|
|
1128
|
+
connection: string;
|
|
1129
|
+
/** Symbolic binding name for the folder. */
|
|
1130
|
+
folder: string;
|
|
1131
|
+
/** Pin the descriptor version. */
|
|
1132
|
+
version?: string;
|
|
1133
|
+
/** Variable the response lands in. Defaults to `<id>_result`. */
|
|
1134
|
+
outputVar?: string;
|
|
1135
|
+
/** Fields to pull out of the response into variables — see {@link ConnectorEventOpts.outputs}. */
|
|
1136
|
+
outputs?: Record<string, string>;
|
|
1137
|
+
/** `=`-expression that skips the node when truthy. */
|
|
1138
|
+
skipCondition?: string;
|
|
1139
|
+
}
|
|
1140
|
+
/**
|
|
1141
|
+
* Options for `.activity()` — the generic registry-backed node.
|
|
1142
|
+
*
|
|
1143
|
+
* Field names are the registry's own, so this is the same surface the typed
|
|
1144
|
+
* methods sit on: `context` are the `uipath:context` inputs, `inputs` the payload
|
|
1145
|
+
* shaped by the type's `inputPattern`.
|
|
1146
|
+
*/
|
|
1147
|
+
export interface ActivityNodeOpts extends ActivityOpts {
|
|
1148
|
+
/** Display name the designer shows. */
|
|
1149
|
+
name?: string;
|
|
1150
|
+
/** `uipath:context` values, by the registry's field names. */
|
|
1151
|
+
context?: Record<string, unknown>;
|
|
1152
|
+
/**
|
|
1153
|
+
* Context rows spelled out, replacing `context` — see {@link TypedContextRow}.
|
|
1154
|
+
*
|
|
1155
|
+
* For importers. `context` is a name→value record, so a row's declared type comes
|
|
1156
|
+
* from the registry and a field the registry does not declare is written
|
|
1157
|
+
* `type="string"`; these rows carry their own.
|
|
1158
|
+
*/
|
|
1159
|
+
contextRows?: TypedContextRow[];
|
|
1160
|
+
/** The payload, shaped by the type's `inputPattern`. */
|
|
1161
|
+
inputs?: Record<string, unknown>;
|
|
1162
|
+
/** Variable the type's own output lands in. Defaults to `<id>_<outputName>`. */
|
|
1163
|
+
outputVar?: string;
|
|
1164
|
+
/** Extra output rows: variable id → `=`-expression against the node's result. */
|
|
1165
|
+
outputs?: Record<string, string>;
|
|
1166
|
+
/**
|
|
1167
|
+
* The output rows spelled out, replacing `outputVar` and `outputs`. Set by
|
|
1168
|
+
* `bpmn-decompile` when a row carries detail those cannot express — a
|
|
1169
|
+
* connector's `jsonSchema` rows and their schema bodies. See
|
|
1170
|
+
* {@link TypedOutputRow}.
|
|
1171
|
+
*/
|
|
1172
|
+
outputRows?: TypedOutputRow[];
|
|
1173
|
+
/**
|
|
1174
|
+
* The `uipath:type` `version` attribute. Defaults to `'v1'`, which is what the
|
|
1175
|
+
* registry's own `XmlTemplate` writes.
|
|
1176
|
+
*
|
|
1177
|
+
* @remarks
|
|
1178
|
+
* Set this only to reproduce an imported artifact. Every `Orchestrator.*` and
|
|
1179
|
+
* `Actions.HITL` node across five real Studio Web exports carries `version="v2"`,
|
|
1180
|
+
* while the registry snapshot the SDK emits from still says `v1` — refreshing it
|
|
1181
|
+
* against the live tenant changes nothing but the provenance string, so the
|
|
1182
|
+
* registry is simply behind the writer. Both pass `uip maestro bpmn validate`.
|
|
1183
|
+
*
|
|
1184
|
+
* The authoring default follows the registry rather than the corpus, on the same
|
|
1185
|
+
* reasoning as {@link ScriptTaskOpts.type}: an import must not silently rewrite
|
|
1186
|
+
* what it found, and the SDK must not pick a side on the strength of five files.
|
|
1187
|
+
*/
|
|
1188
|
+
typeVersion?: string;
|
|
1189
|
+
/**
|
|
1190
|
+
* The `uipath:inputSchema` body inside `uipath:context` — a JSON Schema for the
|
|
1191
|
+
* payload the node accepts.
|
|
1192
|
+
*
|
|
1193
|
+
* A string is written through untouched; anything else is JSON-stringified. Real
|
|
1194
|
+
* exports carry one on nearly every connector, agent and API-workflow call (173
|
|
1195
|
+
* across five files), and it survived nothing before this existed.
|
|
1196
|
+
*/
|
|
1197
|
+
inputSchema?: unknown;
|
|
1198
|
+
/** `=`-expression that skips the node when truthy (activity/event tags only). */
|
|
1199
|
+
skipCondition?: string;
|
|
1200
|
+
/**
|
|
1201
|
+
* Emit `context` exactly as given, injecting no registry defaults. Set by
|
|
1202
|
+
* `bpmn-decompile` so an imported artifact round-trips unchanged; an author
|
|
1203
|
+
* writing `.activity()` by hand wants the defaults.
|
|
1204
|
+
*/
|
|
1205
|
+
contextVerbatim?: boolean;
|
|
1206
|
+
}
|
|
1207
|
+
/**
|
|
1208
|
+
* The BPMN task elements that are legal with NO `uipath:*` payload.
|
|
1209
|
+
*
|
|
1210
|
+
* All seven validate clean as bare elements — `uip maestro bpmn validate` accepts every
|
|
1211
|
+
* one — so an artifact can legitimately contain them and the builder has to be able to
|
|
1212
|
+
* say so. See {@link ScopeBuilder.plainTask}.
|
|
1213
|
+
*/
|
|
1214
|
+
export type PlainTaskElement = 'bpmn:task' | 'bpmn:userTask' | 'bpmn:serviceTask' | 'bpmn:sendTask' | 'bpmn:manualTask' | 'bpmn:businessRuleTask' | 'bpmn:receiveTask';
|
|
1215
|
+
/** Options for `.plainTask()`. */
|
|
1216
|
+
export interface PlainTaskOpts extends ActivityOpts {
|
|
1217
|
+
/** Display name the designer shows. */
|
|
1218
|
+
name?: string;
|
|
1219
|
+
/** Which task element to emit. Defaults to `bpmn:task`. */
|
|
1220
|
+
element?: PlainTaskElement;
|
|
1221
|
+
}
|
|
1222
|
+
/** Options for `.sequenceFlow()`. */
|
|
1223
|
+
export interface FlowOpts {
|
|
1224
|
+
/** The flow's element id. Defaults to `Flow_<source>_<target>`. */
|
|
1225
|
+
id?: string;
|
|
1226
|
+
/** Edge label the designer shows. */
|
|
1227
|
+
name?: string;
|
|
1228
|
+
/** `=`-expression gating this flow (exclusive/inclusive gateway outgoing). */
|
|
1229
|
+
condition?: string;
|
|
1230
|
+
}
|
|
1231
|
+
/** Options for `.var()` / `.input()` / `.output()`. */
|
|
1232
|
+
export interface VarOpts {
|
|
1233
|
+
/** Display name; defaults to the variable's id. */
|
|
1234
|
+
name?: string;
|
|
1235
|
+
/** Optional initial value. */
|
|
1236
|
+
default?: unknown;
|
|
1237
|
+
/** When set, the variable is scoped to that element rather than root/global. */
|
|
1238
|
+
elementId?: string;
|
|
1239
|
+
/**
|
|
1240
|
+
* The declaration's BODY — a JSON Schema describing the shape of a `jsonSchema`
|
|
1241
|
+
* (or `json`) variable.
|
|
1242
|
+
*
|
|
1243
|
+
* A JSON value is written as-is. A string is either the ID of a schema declared
|
|
1244
|
+
* with {@link BpmnBuilder.schema}, or — when it names none — raw JSON text passed
|
|
1245
|
+
* through untouched. The schema is carried, never interpreted, so a field this SDK
|
|
1246
|
+
* does not know about survives.
|
|
1247
|
+
*
|
|
1248
|
+
* Real exports put one on nearly every structured variable — 332 rows across five
|
|
1249
|
+
* of them — and without somewhere to keep it the row round-tripped as a bare
|
|
1250
|
+
* declaration with its shape erased.
|
|
1251
|
+
*/
|
|
1252
|
+
schema?: unknown;
|
|
1253
|
+
/** Mark the declaration `required="true"`, as a process input can be. */
|
|
1254
|
+
required?: boolean;
|
|
1255
|
+
}
|
|
1256
|
+
/**
|
|
1257
|
+
* Collects `uipath:binding` declarations, de-duped by id.
|
|
1258
|
+
*
|
|
1259
|
+
* Shared with every scope rather than living on the top-level builder, because a
|
|
1260
|
+
* typed node can NEED a binding — `Orchestrator.StartAgentJob` requires its
|
|
1261
|
+
* process and folder to be `=bindings.<id>` references — and such a node can be
|
|
1262
|
+
* authored inside a sub-process. Same reasoning as {@link DefinitionsRegistry}.
|
|
1263
|
+
*/
|
|
1264
|
+
declare class BindingsRegistry {
|
|
1265
|
+
/** Every declared binding, in declaration order — `BuiltBpmn.bindings`. */
|
|
1266
|
+
readonly bindings: BindingDecl[];
|
|
1267
|
+
/**
|
|
1268
|
+
* Declare once and keep the FIRST declaration, so an author's own `.binding()`
|
|
1269
|
+
* wins over one a typed node would have derived.
|
|
1270
|
+
*
|
|
1271
|
+
* @param decl - The binding to declare.
|
|
1272
|
+
* @returns The declaration in force for that id — the existing one on a collision.
|
|
1273
|
+
*/
|
|
1274
|
+
declare(decl: BindingDecl): BindingDecl;
|
|
1275
|
+
/**
|
|
1276
|
+
* @param id - The binding id to look for.
|
|
1277
|
+
* @returns Whether that id is already declared.
|
|
1278
|
+
*/
|
|
1279
|
+
has(id: string): boolean;
|
|
1280
|
+
}
|
|
1281
|
+
/** Collects definitions-level message/error declarations, de-duped by name. */
|
|
1282
|
+
declare class DefinitionsRegistry {
|
|
1283
|
+
/** Every declared message, in declaration order — `BuiltBpmn.messages`. */
|
|
1284
|
+
readonly messages: MessageDecl[];
|
|
1285
|
+
/** Every declared error, in declaration order — `BuiltBpmn.errors`. */
|
|
1286
|
+
readonly errors: ErrorDecl[];
|
|
1287
|
+
private readonly messageByName;
|
|
1288
|
+
private readonly errorByName;
|
|
1289
|
+
/**
|
|
1290
|
+
* Declare a message once and reuse it, returning the id events reference.
|
|
1291
|
+
*
|
|
1292
|
+
* @param name - The message's name.
|
|
1293
|
+
* @returns The message id to put in an event's definition.
|
|
1294
|
+
*/
|
|
1295
|
+
messageRef(name: string): string;
|
|
1296
|
+
/**
|
|
1297
|
+
* Declare an error once and reuse it, returning the id events reference.
|
|
1298
|
+
*
|
|
1299
|
+
* @param name - The error's name.
|
|
1300
|
+
* @param code - The error code the runtime matches on.
|
|
1301
|
+
* @returns The error id to put in an event's definition.
|
|
1302
|
+
*/
|
|
1303
|
+
errorRef(name: string, code?: string): string;
|
|
1304
|
+
}
|
|
1305
|
+
/**
|
|
1306
|
+
* The set of node/flow/variable methods common to the process root and every
|
|
1307
|
+
* sub-process. Methods return `this`, so fluent chaining preserves the concrete
|
|
1308
|
+
* builder type (top-level or sub-process).
|
|
1309
|
+
*/
|
|
1310
|
+
declare abstract class ScopeBuilder {
|
|
1311
|
+
/** @internal */
|
|
1312
|
+
protected readonly _nodes: BpmnNode[];
|
|
1313
|
+
/** @internal */
|
|
1314
|
+
protected readonly _flows: BpmnFlow[];
|
|
1315
|
+
/** @internal */
|
|
1316
|
+
protected readonly _vars: BpmnVarDecl[];
|
|
1317
|
+
/** @internal */
|
|
1318
|
+
protected readonly _defs: DefinitionsRegistry;
|
|
1319
|
+
/** @internal */
|
|
1320
|
+
protected readonly _bindingRegistry: BindingsRegistry;
|
|
1321
|
+
/**
|
|
1322
|
+
* @param defs - Definitions-level message/error declarations, shared with every scope.
|
|
1323
|
+
* @param bindings - `uipath:binding` declarations, shared so a typed node can
|
|
1324
|
+
* declare one from inside a sub-process.
|
|
1325
|
+
* @returns The scope builder.
|
|
1326
|
+
*/
|
|
1327
|
+
constructor(defs: DefinitionsRegistry, bindings: BindingsRegistry);
|
|
1328
|
+
private push;
|
|
1329
|
+
/**
|
|
1330
|
+
* A start event (authorable definitions: none / message / timer).
|
|
1331
|
+
*
|
|
1332
|
+
* @remarks
|
|
1333
|
+
* With no definition at all, the process is started by a CALLER — an API call,
|
|
1334
|
+
* `uip maestro`, a parent process, or an Orchestrator trigger configured against
|
|
1335
|
+
* the deployed process. `timer` moves the schedule INTO the artifact, where the
|
|
1336
|
+
* platform's scheduler reads it. `trigger` additionally declares the timed start
|
|
1337
|
+
* as a typed platform trigger — see {@link StartOpts.trigger}.
|
|
1338
|
+
*
|
|
1339
|
+
* @param id - The element id, unique in the process and used by `sequenceFlow`.
|
|
1340
|
+
* @param opts - `name`, the definition — message or timer — and `trigger`.
|
|
1341
|
+
* @returns This builder, so calls chain.
|
|
1342
|
+
* @throws If `trigger` is set without `timer`, which would emit a trigger with no
|
|
1343
|
+
* schedule that every offline gate still calls valid.
|
|
1344
|
+
*/
|
|
1345
|
+
startEvent(id: string, opts?: StartOpts): this;
|
|
1346
|
+
/**
|
|
1347
|
+
* An end event (authorable definitions: none / message / error / terminate).
|
|
1348
|
+
*
|
|
1349
|
+
* @param id - The element id, unique in the process and used by `sequenceFlow`.
|
|
1350
|
+
* @param opts - `name`, and the definition — message, error, or terminate.
|
|
1351
|
+
* @returns This builder, so calls chain.
|
|
1352
|
+
*/
|
|
1353
|
+
endEvent(id: string, opts?: EndOpts): this;
|
|
1354
|
+
/**
|
|
1355
|
+
* An intermediate catch event (authorable: message / timer).
|
|
1356
|
+
*
|
|
1357
|
+
* @param id - The element id, unique in the process and used by `sequenceFlow`.
|
|
1358
|
+
* @param opts - `name`, and the definition — message or timer.
|
|
1359
|
+
* @returns This builder, so calls chain.
|
|
1360
|
+
*/
|
|
1361
|
+
intermediateCatchEvent(id: string, opts?: CatchOpts): this;
|
|
1362
|
+
/**
|
|
1363
|
+
* An intermediate throw event (authorable: none / message).
|
|
1364
|
+
*
|
|
1365
|
+
* @param id - The element id, unique in the process and used by `sequenceFlow`.
|
|
1366
|
+
* @param opts - `name`, and the definition — none or message.
|
|
1367
|
+
* @returns This builder, so calls chain.
|
|
1368
|
+
*/
|
|
1369
|
+
intermediateThrowEvent(id: string, opts?: ThrowOpts): this;
|
|
1370
|
+
/**
|
|
1371
|
+
* A boundary event on an activity (authorable: message / timer / error).
|
|
1372
|
+
*
|
|
1373
|
+
* @param id - The element id, unique in the process and used by `sequenceFlow`.
|
|
1374
|
+
* @param opts - The activity it attaches to, whether it interrupts, and the definition — message, timer, or error.
|
|
1375
|
+
* @returns This builder, so calls chain.
|
|
1376
|
+
*/
|
|
1377
|
+
boundaryEvent(id: string, opts: BoundaryOpts): this;
|
|
1378
|
+
private startCatchDef;
|
|
1379
|
+
/**
|
|
1380
|
+
* An exclusive gateway — exactly one outgoing flow is taken (`bpmn:exclusiveGateway`).
|
|
1381
|
+
*
|
|
1382
|
+
* @param id - The element id, unique in the process and used by `sequenceFlow`.
|
|
1383
|
+
* @param opts - `name`, and the `default` flow taken when no condition matches.
|
|
1384
|
+
* @returns This builder, so calls chain.
|
|
1385
|
+
*/
|
|
1386
|
+
exclusiveGateway(id: string, opts?: GatewayOpts): this;
|
|
1387
|
+
/**
|
|
1388
|
+
* A parallel gateway — every outgoing flow is taken, and a join waits for every incoming one (`bpmn:parallelGateway`).
|
|
1389
|
+
*
|
|
1390
|
+
* @param id - The element id, unique in the process and used by `sequenceFlow`.
|
|
1391
|
+
* @param opts - `name` for the gateway.
|
|
1392
|
+
* @returns This builder, so calls chain.
|
|
1393
|
+
*/
|
|
1394
|
+
parallelGateway(id: string, opts?: {
|
|
1395
|
+
name?: string;
|
|
1396
|
+
}): this;
|
|
1397
|
+
/**
|
|
1398
|
+
* An inclusive gateway — every outgoing flow whose condition holds is taken (`bpmn:inclusiveGateway`).
|
|
1399
|
+
*
|
|
1400
|
+
* @param id - The element id, unique in the process and used by `sequenceFlow`.
|
|
1401
|
+
* @param opts - `name`, and the `default` flow taken when no condition matches.
|
|
1402
|
+
* @returns This builder, so calls chain.
|
|
1403
|
+
*/
|
|
1404
|
+
inclusiveGateway(id: string, opts?: GatewayOpts): this;
|
|
1405
|
+
/**
|
|
1406
|
+
* An event-based gateway — the first of the events it leads to wins, and the rest are cancelled (`bpmn:eventBasedGateway`).
|
|
1407
|
+
*
|
|
1408
|
+
* @param id - The element id, unique in the process and used by `sequenceFlow`.
|
|
1409
|
+
* @param opts - `name` for the gateway.
|
|
1410
|
+
* @returns This builder, so calls chain.
|
|
1411
|
+
*/
|
|
1412
|
+
eventBasedGateway(id: string, opts?: {
|
|
1413
|
+
name?: string;
|
|
1414
|
+
}): this;
|
|
1415
|
+
/**
|
|
1416
|
+
* A script task (Jint JavaScript body + input/output mappings).
|
|
1417
|
+
*
|
|
1418
|
+
* @param id - The element id, unique in the process and used by `sequenceFlow`.
|
|
1419
|
+
* @param opts - The Jint JavaScript `script`, and its input/output mappings.
|
|
1420
|
+
* @returns This builder, so calls chain.
|
|
1421
|
+
*/
|
|
1422
|
+
scriptTask(id: string, opts: ScriptTaskOpts): this;
|
|
1423
|
+
/**
|
|
1424
|
+
* A plain task that assigns variables (`BPMN.Variables`).
|
|
1425
|
+
*
|
|
1426
|
+
* @param id - The element id, unique in the process and used by `sequenceFlow`.
|
|
1427
|
+
* @param opts - `name`, and the variable assignments the task makes.
|
|
1428
|
+
* @returns This builder, so calls chain.
|
|
1429
|
+
*/
|
|
1430
|
+
task(id: string, opts?: TaskOpts): this;
|
|
1431
|
+
/**
|
|
1432
|
+
* A task element carrying NO `uipath:*` payload — an abstract task, in BPMN's terms.
|
|
1433
|
+
*
|
|
1434
|
+
* @remarks
|
|
1435
|
+
* The platform accepts all seven task elements bare, so an artifact can legitimately
|
|
1436
|
+
* contain one, and until this existed the builder could not express any of them. That
|
|
1437
|
+
* made such a file unimportable: `bpmn-decompile` refused six of the seven outright,
|
|
1438
|
+
* and the seventh — `bpmn:task` — was worse, because it came back through `.task()`
|
|
1439
|
+
* and silently GAINED a `BPMN.Variables` mapping it never had.
|
|
1440
|
+
*
|
|
1441
|
+
* Not the same as {@link ScopeBuilder.task}, which emits a `BPMN.Variables` mapping to
|
|
1442
|
+
* assign variables, or {@link ScopeBuilder.humanTask}, which emits an `Actions.HITL`
|
|
1443
|
+
* activity. Those are tasks that DO something; this is a task element that stands for
|
|
1444
|
+
* work the process does not model — the shape a diagram-first tool writes before
|
|
1445
|
+
* anything is wired up.
|
|
1446
|
+
*
|
|
1447
|
+
* @param id - The element id, unique in the process and used by `sequenceFlow`.
|
|
1448
|
+
* @param opts - `name`, and which task `element` to emit (default `bpmn:task`).
|
|
1449
|
+
* @returns This builder, so calls chain.
|
|
1450
|
+
*
|
|
1451
|
+
* @example
|
|
1452
|
+
* ```ts
|
|
1453
|
+
* bpmn('review')
|
|
1454
|
+
* .startEvent('s')
|
|
1455
|
+
* .plainTask('approve', { name: 'Approve', element: 'bpmn:userTask' })
|
|
1456
|
+
* .endEvent('e')
|
|
1457
|
+
* ```
|
|
1458
|
+
*/
|
|
1459
|
+
plainTask(id: string, opts?: PlainTaskOpts): this;
|
|
1460
|
+
/**
|
|
1461
|
+
* An Integration Service **connector** service task (`bpmn:sendTask` +
|
|
1462
|
+
* `uipath:activity` / `Intsvc.ActivityExecution`) — the typed form, where a
|
|
1463
|
+
* generated descriptor supplies the operation and its input types.
|
|
1464
|
+
*
|
|
1465
|
+
* @remarks
|
|
1466
|
+
* Identify the op by a typed descriptor or by `key`/`action` (like Flow/Case);
|
|
1467
|
+
* `inputs` are the op's fields; `connection`/`folder` are symbolic
|
|
1468
|
+
* bindings-names. Resolved against the connector library at serialize (pass
|
|
1469
|
+
* `{ library }` to `serialize`/compile). `id` is the BPMN element id, `name`
|
|
1470
|
+
* the display name.
|
|
1471
|
+
*
|
|
1472
|
+
* @param id - The element id, unique in the process and used by `sequenceFlow`.
|
|
1473
|
+
* @param descriptor - The generated operation, from a prepared connector module.
|
|
1474
|
+
* @param inputs - The activity's inputs, typed by the descriptor.
|
|
1475
|
+
* @param opts - `name`, plus symbolic `connection` / `folder`, an action
|
|
1476
|
+
* `version`, and the `object` a generic operation addresses.
|
|
1477
|
+
* @returns This builder, so calls chain.
|
|
1478
|
+
*/
|
|
1479
|
+
connector<I extends Record<string, unknown>, O>(id: string, descriptor: ConnectorDescriptor<I, O>, inputs: I, opts?: BpmnConnectorOpts): this;
|
|
1480
|
+
/**
|
|
1481
|
+
* Stringly form, for a connector with no prepared module.
|
|
1482
|
+
*
|
|
1483
|
+
* @param id - The element id, unique in the process and used by `sequenceFlow`.
|
|
1484
|
+
* @param key - The connector library key, e.g. `'uipath-salesforce-slack'`.
|
|
1485
|
+
* @param action - The operation id, e.g. `'send-message-to-channel'`.
|
|
1486
|
+
* @param inputs - The activity's inputs.
|
|
1487
|
+
* @param opts - `name`, plus symbolic `connection` / `folder`, an action
|
|
1488
|
+
* `version`, and the `object` a generic operation addresses.
|
|
1489
|
+
* @returns This builder, so calls chain.
|
|
1490
|
+
*/
|
|
1491
|
+
connector(id: string, key: string, action: string, inputs?: Record<string, unknown>, opts?: BpmnConnectorOpts): this;
|
|
1492
|
+
/**
|
|
1493
|
+
* An **HTTP request** service task (`bpmn:sendTask` +
|
|
1494
|
+
* `uipath:activity` / `Intsvc.UnifiedHttpRequest`).
|
|
1495
|
+
*
|
|
1496
|
+
* @remarks
|
|
1497
|
+
* The first registry-backed typed node (`docs/BPMN_COVERAGE_DESIGN.md` Phase 3).
|
|
1498
|
+
* Its wire shape — element, tag, context fields, output row — comes from the
|
|
1499
|
+
* committed registry snapshot rather than hand-written emission, so it cannot
|
|
1500
|
+
* drift from what the platform validates. Chosen as the pilot because it needs
|
|
1501
|
+
* no tenant discovery (`RequiresDiscovery: No`) and the local engine dispatches
|
|
1502
|
+
* it for real in `--mode live`.
|
|
1503
|
+
*
|
|
1504
|
+
* The response lands in `<id>_response` unless `outputVar` says otherwise, and
|
|
1505
|
+
* that variable is readable downstream as `=vars.<name>` with no `.var()`.
|
|
1506
|
+
*
|
|
1507
|
+
* @example
|
|
1508
|
+
* ```ts
|
|
1509
|
+
* bpmn('sync')
|
|
1510
|
+
* .var('body', 'object')
|
|
1511
|
+
* .startEvent('start')
|
|
1512
|
+
* .http('fetch', { method: 'GET', url: 'https://api.example.com/orders' })
|
|
1513
|
+
* .task('keep', { set: { body: '=js:vars.fetch_response' } })
|
|
1514
|
+
* .endEvent('done')
|
|
1515
|
+
* .sequenceFlow('start', 'fetch')
|
|
1516
|
+
* .sequenceFlow('fetch', 'keep')
|
|
1517
|
+
* .sequenceFlow('keep', 'done')
|
|
1518
|
+
* .build();
|
|
1519
|
+
* ```
|
|
1520
|
+
*
|
|
1521
|
+
* @param id - The element id, unique in the process and used by `sequenceFlow`.
|
|
1522
|
+
* @param opts - The request, plus `name`, `outputVar`, and the shared activity options.
|
|
1523
|
+
* @returns This builder, so calls chain.
|
|
1524
|
+
*/
|
|
1525
|
+
http(id: string, opts: HttpOpts): this;
|
|
1526
|
+
/**
|
|
1527
|
+
* @internal Turn a literal into a binding reference where the platform demands
|
|
1528
|
+
* one, declaring the binding on the author's behalf.
|
|
1529
|
+
*
|
|
1530
|
+
* `Orchestrator.StartAgentJob` requires its `name` and `folderPath` to be
|
|
1531
|
+
* `=bindings.<id>` references AND requires those bindings to target
|
|
1532
|
+
* `resource: process` with the right `propertyAttribute` — a literal is rejected,
|
|
1533
|
+
* and so is a binding pointing at the wrong property. Both facts are in the
|
|
1534
|
+
* registry snapshot, so the SDK can satisfy them from the plain value the author
|
|
1535
|
+
* wrote instead of making them hand-build two bindings and get the attributes
|
|
1536
|
+
* right. An author who passes an `=`-expression already knows what they want and
|
|
1537
|
+
* is left alone.
|
|
1538
|
+
*/
|
|
1539
|
+
private bindRequiredContext;
|
|
1540
|
+
/** @internal Shared body of the Orchestrator process-invocation methods. */
|
|
1541
|
+
private orchestratorNode;
|
|
1542
|
+
/**
|
|
1543
|
+
* Start an **RPA process** and wait for it (`Orchestrator.StartJob`).
|
|
1544
|
+
*
|
|
1545
|
+
* @example
|
|
1546
|
+
* ```ts
|
|
1547
|
+
* bpmn('nightly')
|
|
1548
|
+
* .startEvent('start')
|
|
1549
|
+
* .startProcess('rpa', { process: 'InvoicePosting', folder: 'Finance', input: { batch: 42 } })
|
|
1550
|
+
* .endEvent('done')
|
|
1551
|
+
* .sequenceFlow('start', 'rpa')
|
|
1552
|
+
* .sequenceFlow('rpa', 'done')
|
|
1553
|
+
* .build();
|
|
1554
|
+
* ```
|
|
1555
|
+
*
|
|
1556
|
+
* @param id - The element id, unique in the process and used by `sequenceFlow`.
|
|
1557
|
+
* @param opts - Which process, folder, and input arguments.
|
|
1558
|
+
* @returns This builder, so calls chain.
|
|
1559
|
+
*/
|
|
1560
|
+
startProcess(id: string, opts: OrchestratorOpts): this;
|
|
1561
|
+
/**
|
|
1562
|
+
* Start an **agent** and wait for it (`Orchestrator.StartAgentJob`).
|
|
1563
|
+
*
|
|
1564
|
+
* @param id - The element id, unique in the process and used by `sequenceFlow`.
|
|
1565
|
+
* @param opts - Which agent process, folder, and input arguments.
|
|
1566
|
+
* @returns This builder, so calls chain.
|
|
1567
|
+
*/
|
|
1568
|
+
startAgent(id: string, opts: OrchestratorOpts): this;
|
|
1569
|
+
/**
|
|
1570
|
+
* Invoke an **agentic process** as a call activity
|
|
1571
|
+
* (`Orchestrator.StartAgenticProcess`, or `…Async` when `async` is set).
|
|
1572
|
+
*
|
|
1573
|
+
* @param id - The element id, unique in the process and used by `sequenceFlow`.
|
|
1574
|
+
* @param opts - Which process, folder, input arguments, and whether to wait.
|
|
1575
|
+
* @returns This builder, so calls chain.
|
|
1576
|
+
*/
|
|
1577
|
+
startAgenticProcess(id: string, opts: OrchestratorAsyncOpts): this;
|
|
1578
|
+
/**
|
|
1579
|
+
* Invoke a **case-management process** as a call activity
|
|
1580
|
+
* (`Orchestrator.StartCaseMgmtProcess`, or `…Async` when `async` is set).
|
|
1581
|
+
*
|
|
1582
|
+
* @param id - The element id, unique in the process and used by `sequenceFlow`.
|
|
1583
|
+
* @param opts - Which case process, folder, input arguments, and whether to wait.
|
|
1584
|
+
* @returns This builder, so calls chain.
|
|
1585
|
+
*/
|
|
1586
|
+
startCaseProcess(id: string, opts: OrchestratorAsyncOpts): this;
|
|
1587
|
+
/**
|
|
1588
|
+
* Execute an **API workflow**, fire-and-forget
|
|
1589
|
+
* (`Orchestrator.ExecuteApiWorkflowAsync`).
|
|
1590
|
+
*
|
|
1591
|
+
* @remarks
|
|
1592
|
+
* The registry offers only the async form, so there is nothing to wait on: the
|
|
1593
|
+
* node maps back an error and nothing else.
|
|
1594
|
+
*
|
|
1595
|
+
* @param id - The element id, unique in the process and used by `sequenceFlow`.
|
|
1596
|
+
* @param opts - Which workflow, folder, and input arguments.
|
|
1597
|
+
* @returns This builder, so calls chain.
|
|
1598
|
+
*/
|
|
1599
|
+
executeApiWorkflow(id: string, opts: OrchestratorOpts): this;
|
|
1600
|
+
/**
|
|
1601
|
+
* Execute a **business rule** and wait for it (`Orchestrator.BusinessRules`, on a
|
|
1602
|
+
* `bpmn:businessRuleTask`).
|
|
1603
|
+
*
|
|
1604
|
+
* @remarks
|
|
1605
|
+
* **Not a DMN decision table**, despite the element and the label. The registry spec
|
|
1606
|
+
* is an Orchestrator process invocation — `releaseKey`/`folderId`/`folderPath`/`name`
|
|
1607
|
+
* plus `JobArguments`, `BindingPattern: businessRule` over `Resource: process` —
|
|
1608
|
+
* structurally identical to {@link ScopeBuilder.startProcess}. `process` names a
|
|
1609
|
+
* package whose Orchestrator process type is `BusinessRules`; whatever decision logic
|
|
1610
|
+
* exists lives INSIDE that package, not in the `.bpmn`. So this is the job-start
|
|
1611
|
+
* family's sixth member, not a rules subsystem, and it shares every option with it.
|
|
1612
|
+
*
|
|
1613
|
+
* Distinct from the Case SDK's `rule()`, which declares DNF lifecycle conditions
|
|
1614
|
+
* (`case-entered`, `required-tasks-completed`, …) deciding when a stage enters or
|
|
1615
|
+
* exits. The two share a word and nothing else.
|
|
1616
|
+
*
|
|
1617
|
+
* The extension type is marked `[Preview]` by the registry. That is a caveat on the
|
|
1618
|
+
* SHAPE, not on this method: a preview extension type can gain or rename fields, and
|
|
1619
|
+
* the snapshot refresh (`scripts/materialize-bpmn-registry.mjs`) is what would surface
|
|
1620
|
+
* it as a data diff.
|
|
1621
|
+
*
|
|
1622
|
+
* @example
|
|
1623
|
+
* ```ts
|
|
1624
|
+
* bpmn('pricing')
|
|
1625
|
+
* .var('tier', 'string', { default: 'none' })
|
|
1626
|
+
* .startEvent('start')
|
|
1627
|
+
* .businessRule('tier', {
|
|
1628
|
+
* process: 'DiscountTier',
|
|
1629
|
+
* folder: 'Finance',
|
|
1630
|
+
* input: { amount: 4200 },
|
|
1631
|
+
* outputs: { tier: '=response.tier' },
|
|
1632
|
+
* })
|
|
1633
|
+
* .endEvent('done')
|
|
1634
|
+
* .sequenceFlow('start', 'tier')
|
|
1635
|
+
* .sequenceFlow('tier', 'done')
|
|
1636
|
+
* .build();
|
|
1637
|
+
* ```
|
|
1638
|
+
*
|
|
1639
|
+
* @param id - The element id, unique in the process and used by `sequenceFlow`.
|
|
1640
|
+
* @param opts - Which rule package, folder, and input arguments. `outputVar` defaults
|
|
1641
|
+
* to `<id>_businessRuleResponse` — see the note in the implementation for why this one
|
|
1642
|
+
* type does not take its default from the spec.
|
|
1643
|
+
* @returns This builder, so calls chain.
|
|
1644
|
+
*/
|
|
1645
|
+
businessRule(id: string, opts: OrchestratorOpts): this;
|
|
1646
|
+
/**
|
|
1647
|
+
* Add an item to an Orchestrator **queue** (`Orchestrator.CreateQueueItem`, or
|
|
1648
|
+
* `Orchestrator.CreateAndWaitForQueueItem` when `wait` is set).
|
|
1649
|
+
*
|
|
1650
|
+
* @example
|
|
1651
|
+
* ```ts
|
|
1652
|
+
* bpmn('intake')
|
|
1653
|
+
* .startEvent('start')
|
|
1654
|
+
* .queueItem('enqueue', { queue: 'Invoices', folder: 'Finance', item: { id: 'INV-1' } })
|
|
1655
|
+
* .endEvent('done')
|
|
1656
|
+
* .sequenceFlow('start', 'enqueue')
|
|
1657
|
+
* .sequenceFlow('enqueue', 'done')
|
|
1658
|
+
* .build();
|
|
1659
|
+
* ```
|
|
1660
|
+
*
|
|
1661
|
+
* @param id - The element id, unique in the process and used by `sequenceFlow`.
|
|
1662
|
+
* @param opts - Which queue and folder, the item content, and whether to wait for it.
|
|
1663
|
+
* @returns This builder, so calls chain.
|
|
1664
|
+
*/
|
|
1665
|
+
queueItem(id: string, opts: QueueItemOpts): this;
|
|
1666
|
+
/**
|
|
1667
|
+
* A **human task** — an Action App task a person completes (`bpmn:userTask` +
|
|
1668
|
+
* `uipath:activity` / `Actions.HITL`).
|
|
1669
|
+
*
|
|
1670
|
+
* @remarks
|
|
1671
|
+
* The offline runtime can stand in for the human — `--hitl-response` injects an
|
|
1672
|
+
* outcome — so an approval gate's branches are testable with no tenant and no
|
|
1673
|
+
* waiting. That is why this is the one discovery-requiring type worth authoring
|
|
1674
|
+
* early:
|
|
1675
|
+
*
|
|
1676
|
+
* ```bash
|
|
1677
|
+
* flow-debug Invoice.bpmn --mock --virtual-time --hitl-response 'approve={"Action":"approve"}'
|
|
1678
|
+
* ```
|
|
1679
|
+
*
|
|
1680
|
+
* Map the decision into a variable with `outputs` if anything branches on it —
|
|
1681
|
+
* see {@link HumanTaskOpts.outputs} for why the type's own output is not enough.
|
|
1682
|
+
*
|
|
1683
|
+
* @example
|
|
1684
|
+
* **An approval gate whose branches can be exercised offline**
|
|
1685
|
+
* ```ts
|
|
1686
|
+
* bpmn('invoice')
|
|
1687
|
+
* .var('outcome', 'string', { default: 'none' })
|
|
1688
|
+
* .startEvent('start')
|
|
1689
|
+
* .humanTask('approve', {
|
|
1690
|
+
* app: 'app-123',
|
|
1691
|
+
* title: 'Approve the invoice',
|
|
1692
|
+
* actions: ['approve', 'reject'],
|
|
1693
|
+
* input: { amount: 100 },
|
|
1694
|
+
* outputs: { decision: '=Action' },
|
|
1695
|
+
* })
|
|
1696
|
+
* .exclusiveGateway('gw', { default: 'fReject' })
|
|
1697
|
+
* .task('ok', { set: { outcome: 'approved' } })
|
|
1698
|
+
* .task('no', { set: { outcome: 'rejected' } })
|
|
1699
|
+
* .exclusiveGateway('join', { default: 'fJoin' })
|
|
1700
|
+
* .endEvent('done')
|
|
1701
|
+
* .sequenceFlow('start', 'approve')
|
|
1702
|
+
* .sequenceFlow('approve', 'gw')
|
|
1703
|
+
* .sequenceFlow('gw', 'ok', { id: 'fApprove', condition: '=js:vars.decision == "approve"' })
|
|
1704
|
+
* .sequenceFlow('gw', 'no', { id: 'fReject' })
|
|
1705
|
+
* .sequenceFlow('ok', 'join', { id: 'fOk' })
|
|
1706
|
+
* .sequenceFlow('no', 'join', { id: 'fNo' })
|
|
1707
|
+
* .sequenceFlow('join', 'done', { id: 'fJoin' })
|
|
1708
|
+
* .build();
|
|
1709
|
+
* ```
|
|
1710
|
+
*
|
|
1711
|
+
* @param id - The element id, unique in the process and used by `sequenceFlow`.
|
|
1712
|
+
* @param opts - The app, the outcomes offered, what the human sees, and which
|
|
1713
|
+
* response fields to keep.
|
|
1714
|
+
* @returns This builder, so calls chain.
|
|
1715
|
+
*/
|
|
1716
|
+
humanTask(id: string, opts: HumanTaskOpts): this;
|
|
1717
|
+
/**
|
|
1718
|
+
* Wait for an internal message from another Maestro process
|
|
1719
|
+
* (`Maestro.ReceiveMessageEvent` on a `bpmn:intermediateCatchEvent`).
|
|
1720
|
+
*
|
|
1721
|
+
* @remarks
|
|
1722
|
+
* **No offline behavioural assertion is possible for this node**, and that is
|
|
1723
|
+
* worth knowing before relying on it. The local engine treats intermediate catch
|
|
1724
|
+
* and throw events as pass-throughs (`engine.ts`: "For lightweight engine, just
|
|
1725
|
+
* pass through"), so a local run walks straight past this event without waiting,
|
|
1726
|
+
* without correlating, and without populating its output. A green local ladder
|
|
1727
|
+
* therefore proves the graph runs and the artifact validates — nothing about the
|
|
1728
|
+
* message actually arriving. See Phase 5 in `docs/BPMN_COVERAGE_DESIGN.md`.
|
|
1729
|
+
*
|
|
1730
|
+
* The throw side (`Maestro.SendMessageEvent`) is deliberately NOT authored: its
|
|
1731
|
+
* required `Reference` payload field cannot be expressed in a way the platform
|
|
1732
|
+
* validator accepts. See `unsatisfiableRequiredInputs`.
|
|
1733
|
+
*
|
|
1734
|
+
* @example
|
|
1735
|
+
* **Wait for another process to signal a shipment**
|
|
1736
|
+
* ```ts
|
|
1737
|
+
* bpmn('fulfil')
|
|
1738
|
+
* .var('orderId', 'string', { default: 'ORD-1' })
|
|
1739
|
+
* .var('shipment', 'object')
|
|
1740
|
+
* .startEvent('start')
|
|
1741
|
+
* .receiveMessage('await', {
|
|
1742
|
+
* message: 'ShipmentReady',
|
|
1743
|
+
* reference: '=js:vars.orderId',
|
|
1744
|
+
* outputVar: 'shipment',
|
|
1745
|
+
* })
|
|
1746
|
+
* .endEvent('done')
|
|
1747
|
+
* .sequenceFlow('start', 'await')
|
|
1748
|
+
* .sequenceFlow('await', 'done')
|
|
1749
|
+
* .build();
|
|
1750
|
+
* ```
|
|
1751
|
+
*
|
|
1752
|
+
* @param id - The element id, unique in the process and used by `sequenceFlow`.
|
|
1753
|
+
* @param opts - The message name, the correlation reference, and what to keep.
|
|
1754
|
+
* @returns This builder, so calls chain.
|
|
1755
|
+
*/
|
|
1756
|
+
receiveMessage(id: string, opts: ReceiveMessageOpts): this;
|
|
1757
|
+
/**
|
|
1758
|
+
* Wait mid-flow for an Integration Service connector event
|
|
1759
|
+
* (`Intsvc.WaitForEvent` on a `bpmn:receiveTask`).
|
|
1760
|
+
*
|
|
1761
|
+
* @remarks
|
|
1762
|
+
* The sibling of {@link ScopeBuilder.eventTrigger}: one connector operation, two
|
|
1763
|
+
* placements. This one pauses a RUNNING process; `.eventTrigger()` starts one.
|
|
1764
|
+
* The platform ships both for the same operation and only the library namespace
|
|
1765
|
+
* differs, which is the same pairing Flow models as `waitForEvent()` / `onEvent()`.
|
|
1766
|
+
*
|
|
1767
|
+
* **This family DOES have an offline behavioural assertion**, unlike the other
|
|
1768
|
+
* wait-shaped nodes: the engine mocks a receive task like any other, so
|
|
1769
|
+
* `--mock-data` supplies a payload and a gateway branches on it. Map the field
|
|
1770
|
+
* with `outputs` — the type's own `source="."` row is not resolved locally.
|
|
1771
|
+
*
|
|
1772
|
+
* @example
|
|
1773
|
+
* **Wait for an email, then branch on it**
|
|
1774
|
+
* ```ts
|
|
1775
|
+
* bpmn('intake')
|
|
1776
|
+
* .binding('outlook', { value: 'conn-uuid', resource: 'Connection', propertyAttribute: 'ConnectionId' })
|
|
1777
|
+
* .binding('shared', { value: 'folder-key', resource: 'Connection', propertyAttribute: 'folderKey' })
|
|
1778
|
+
* .var('subject', 'string', { default: '' })
|
|
1779
|
+
* .startEvent('start')
|
|
1780
|
+
* .waitForEvent('mail', 'uipath-microsoft-outlook365', 'email-received', {
|
|
1781
|
+
* connection: 'outlook',
|
|
1782
|
+
* folder: 'shared',
|
|
1783
|
+
* outputs: { subject: '=subject' },
|
|
1784
|
+
* })
|
|
1785
|
+
* .endEvent('done')
|
|
1786
|
+
* .sequenceFlow('start', 'mail')
|
|
1787
|
+
* .sequenceFlow('mail', 'done')
|
|
1788
|
+
* .build();
|
|
1789
|
+
* ```
|
|
1790
|
+
*
|
|
1791
|
+
* @param id - The element id, unique in the process and used by `sequenceFlow`.
|
|
1792
|
+
* @param connector - The connector key, e.g. `'uipath-microsoft-outlook365'`.
|
|
1793
|
+
* @param event - The event name, e.g. `'email-received'`.
|
|
1794
|
+
* @param opts - Connection/folder bindings, the `where` scope, and what to keep.
|
|
1795
|
+
* @returns This builder, so calls chain.
|
|
1796
|
+
*/
|
|
1797
|
+
waitForEvent(id: string, connector: string, event: string, opts: ConnectorEventOpts): this;
|
|
1798
|
+
/**
|
|
1799
|
+
* START the process when an Integration Service connector event fires
|
|
1800
|
+
* (`Intsvc.EventTrigger` on a `bpmn:startEvent` carrying a message event
|
|
1801
|
+
* definition).
|
|
1802
|
+
*
|
|
1803
|
+
* @remarks
|
|
1804
|
+
* Its own method rather than a flag on `.startEvent()` — the opposite call from
|
|
1805
|
+
* the timer trigger, and for a stated reason. `Intsvc.TimerTrigger` declares NO
|
|
1806
|
+
* fields, so the only thing to configure there is an output variable and a flag
|
|
1807
|
+
* suffices. This type declares nine, including the connection and folder
|
|
1808
|
+
* bindings, which is a method's worth of surface.
|
|
1809
|
+
*
|
|
1810
|
+
* **No offline behavioural assertion**, unlike `.waitForEvent()`: this is a start
|
|
1811
|
+
* event, and the engine applies a start event's output rows against the variable
|
|
1812
|
+
* scope rather than a mocked result, so nothing populates the payload locally.
|
|
1813
|
+
*
|
|
1814
|
+
* @param id - The element id, unique in the process and used by `sequenceFlow`.
|
|
1815
|
+
* @param connector - The connector key, e.g. `'uipath-http-webhook'`.
|
|
1816
|
+
* @param event - The event name, e.g. `'http-webhook'`.
|
|
1817
|
+
* @param opts - Connection/folder bindings, the `where` scope, and what to keep.
|
|
1818
|
+
* @returns This builder, so calls chain.
|
|
1819
|
+
*/
|
|
1820
|
+
eventTrigger(id: string, connector: string, event: string, opts: ConnectorEventOpts): this;
|
|
1821
|
+
/**
|
|
1822
|
+
* Invoke an external agent through an Integration Service connector
|
|
1823
|
+
* (`Intsvc.SyncAgentExecution` / `Intsvc.AsyncAgentExecution`).
|
|
1824
|
+
*
|
|
1825
|
+
* @remarks
|
|
1826
|
+
* `mode: 'sync'` waits for the agent's answer; `'async'` starts it and moves on.
|
|
1827
|
+
* The descriptor must be an `AgentExecution` operation — the library is the
|
|
1828
|
+
* authority, and a plain connector action is refused rather than emitted as a node
|
|
1829
|
+
* the validator accepts and the runtime dispatches to the wrong handler.
|
|
1830
|
+
*
|
|
1831
|
+
* **The shipped library contains very few of these** (2 agent operations, 1
|
|
1832
|
+
* workflow), so this is a narrow surface by nature, not by omission.
|
|
1833
|
+
*
|
|
1834
|
+
* @example
|
|
1835
|
+
* ```ts
|
|
1836
|
+
* bpmn('triage')
|
|
1837
|
+
* .binding('vertex', { value: 'conn-uuid', resource: 'Connection', propertyAttribute: 'ConnectionId' })
|
|
1838
|
+
* .binding('shared', { value: 'folder-key', resource: 'Connection', propertyAttribute: 'folderKey' })
|
|
1839
|
+
* .startEvent('start')
|
|
1840
|
+
* .externalAgent('summarise', 'uipath-google-vertex', 'execute-google-vertex-agent',
|
|
1841
|
+
* { prompt: 'Summarise the ticket' },
|
|
1842
|
+
* { mode: 'sync', connection: 'vertex', folder: 'shared' })
|
|
1843
|
+
* .endEvent('done')
|
|
1844
|
+
* .sequenceFlow('start', 'summarise')
|
|
1845
|
+
* .sequenceFlow('summarise', 'done')
|
|
1846
|
+
* .build();
|
|
1847
|
+
* ```
|
|
1848
|
+
*
|
|
1849
|
+
* @param id - The element id, unique in the process and used by `sequenceFlow`.
|
|
1850
|
+
* @param connector - The connector key.
|
|
1851
|
+
* @param action - The `AgentExecution` operation name.
|
|
1852
|
+
* @param inputs - The invocation payload.
|
|
1853
|
+
* @param opts - `mode`, the connection/folder bindings, and what to keep.
|
|
1854
|
+
* @returns This builder, so calls chain.
|
|
1855
|
+
*/
|
|
1856
|
+
externalAgent(id: string, connector: string, action: string, inputs: Record<string, unknown>, opts: ExternalTaskOpts): this;
|
|
1857
|
+
/**
|
|
1858
|
+
* Invoke an external workflow through an Integration Service connector
|
|
1859
|
+
* (`Intsvc.SyncWorkflowExecution` / `Intsvc.AsyncWorkflowExecution`).
|
|
1860
|
+
*
|
|
1861
|
+
* @remarks
|
|
1862
|
+
* The workflow counterpart of {@link ScopeBuilder.externalAgent}; the descriptor
|
|
1863
|
+
* must be a `ProcessExecution` operation.
|
|
1864
|
+
*
|
|
1865
|
+
* @param id - The element id, unique in the process and used by `sequenceFlow`.
|
|
1866
|
+
* @param connector - The connector key.
|
|
1867
|
+
* @param action - The `ProcessExecution` operation name.
|
|
1868
|
+
* @param inputs - The invocation payload.
|
|
1869
|
+
* @param opts - `mode`, the connection/folder bindings, and what to keep.
|
|
1870
|
+
* @returns This builder, so calls chain.
|
|
1871
|
+
*/
|
|
1872
|
+
externalWorkflow(id: string, connector: string, action: string, inputs: Record<string, unknown>, opts: ExternalTaskOpts): this;
|
|
1873
|
+
/** @internal Shared body of the two external-invocation methods. */
|
|
1874
|
+
private externalTask;
|
|
1875
|
+
/**
|
|
1876
|
+
* ANY registry-backed node, by extension type — the generic form the typed
|
|
1877
|
+
* methods are sugar over.
|
|
1878
|
+
*
|
|
1879
|
+
* @remarks
|
|
1880
|
+
* Reach for a typed method first (`.http()`, `.startProcess()`, `.humanTask()`,
|
|
1881
|
+
* …): it names the fields, defaults what the registry defaults, and declares the
|
|
1882
|
+
* bindings a type demands. This is for the types that have no wrapper yet, and
|
|
1883
|
+
* it is what `bpmn-decompile` emits for them — which is why it exists at all.
|
|
1884
|
+
* Nothing is validated for you beyond what the registry states, so the emitted
|
|
1885
|
+
* node is exactly as correct as the `context` you pass.
|
|
1886
|
+
*
|
|
1887
|
+
* The element, tag, input shape, output row and event definition all come from
|
|
1888
|
+
* the committed registry snapshot, so the wire form is right even when the
|
|
1889
|
+
* ergonomics are bare.
|
|
1890
|
+
*
|
|
1891
|
+
* @example
|
|
1892
|
+
* ```ts
|
|
1893
|
+
* bpmn('agentic')
|
|
1894
|
+
* .startEvent('start')
|
|
1895
|
+
* .activity('call', 'A2A.AgentExecution', { inputs: { prompt: 'summarise' } })
|
|
1896
|
+
* .endEvent('done')
|
|
1897
|
+
* .sequenceFlow('start', 'call')
|
|
1898
|
+
* .sequenceFlow('call', 'done')
|
|
1899
|
+
* .build();
|
|
1900
|
+
* ```
|
|
1901
|
+
*
|
|
1902
|
+
* @param id - The element id, unique in the process and used by `sequenceFlow`.
|
|
1903
|
+
* @param type - The registry extension type, e.g. `'A2A.AgentExecution'`.
|
|
1904
|
+
* @param opts - Context values, payload, output mapping and the shared activity options.
|
|
1905
|
+
* @returns This builder, so calls chain.
|
|
1906
|
+
*/
|
|
1907
|
+
activity(id: string, type: string, opts?: ActivityNodeOpts): this;
|
|
1908
|
+
/**
|
|
1909
|
+
* A sub-process — a scope of its own, with its own elements and flows (`bpmn:subProcess`).
|
|
1910
|
+
*
|
|
1911
|
+
* @param id - The element id, unique in the process and used by `sequenceFlow`.
|
|
1912
|
+
* @param fn - Receives a sub-builder for the elements inside it.
|
|
1913
|
+
* @param opts - `name`, and the loop characteristics when it repeats.
|
|
1914
|
+
* @returns This builder, so calls chain.
|
|
1915
|
+
*/
|
|
1916
|
+
subProcess(id: string, fn: (sp: SubProcessBuilder) => void, opts?: SubProcessOpts): this;
|
|
1917
|
+
/**
|
|
1918
|
+
* A sequence flow from `source` to `target` (1-1 with `bpmn:sequenceFlow`).
|
|
1919
|
+
*
|
|
1920
|
+
* @param source - The id of the element the flow leaves.
|
|
1921
|
+
* @param target - The id of the element it arrives at.
|
|
1922
|
+
* @param opts - `name`, and the `condition` guarding it.
|
|
1923
|
+
* @returns This builder, so calls chain.
|
|
1924
|
+
*/
|
|
1925
|
+
sequenceFlow(source: string, target: string, opts?: FlowOpts): this;
|
|
1926
|
+
/**
|
|
1927
|
+
* A mutable flow variable (`uipath:inputOutput`). Root unless `elementId` scopes it.
|
|
1928
|
+
*
|
|
1929
|
+
* @param id - The variable's name.
|
|
1930
|
+
* @param type - A `types.*` descriptor.
|
|
1931
|
+
* @param opts - `direction`, a `default`, and `elementId` to scope it to one element.
|
|
1932
|
+
* @returns This builder, so calls chain.
|
|
1933
|
+
*/
|
|
1934
|
+
var(id: string, type: TypeDesc, opts?: VarOpts): this;
|
|
1935
|
+
/**
|
|
1936
|
+
* A read-only entry input (`uipath:input`).
|
|
1937
|
+
*
|
|
1938
|
+
* @param id - The input's name.
|
|
1939
|
+
* @param type - A `types.*` descriptor.
|
|
1940
|
+
* @param opts - A `default`, and `elementId` to scope it to one element.
|
|
1941
|
+
* @returns This builder, so calls chain.
|
|
1942
|
+
*/
|
|
1943
|
+
input(id: string, type: TypeDesc, opts?: VarOpts): this;
|
|
1944
|
+
/**
|
|
1945
|
+
* A return value (`uipath:output`).
|
|
1946
|
+
*
|
|
1947
|
+
* @param id - The output's name.
|
|
1948
|
+
* @param type - A `types.*` descriptor.
|
|
1949
|
+
* @param opts - A `default`, and `elementId` to scope it to one element.
|
|
1950
|
+
* @returns This builder, so calls chain.
|
|
1951
|
+
*/
|
|
1952
|
+
output(id: string, type: TypeDesc, opts?: VarOpts): this;
|
|
1953
|
+
private declareVar;
|
|
1954
|
+
}
|
|
1955
|
+
/**
|
|
1956
|
+
* `.connector()` options: the shared connector options, plus the BPMN-only
|
|
1957
|
+
* display `name` and output-variable override.
|
|
1958
|
+
*/
|
|
1959
|
+
export type BpmnConnectorOpts = ConnectorOpts & ActivityOpts & {
|
|
1960
|
+
/** Display name the designer shows on the task. */
|
|
1961
|
+
name?: string;
|
|
1962
|
+
/**
|
|
1963
|
+
* `=`-expression that skips this activity when it evaluates truthy — the step
|
|
1964
|
+
* is recorded as not executed and the flow carries on
|
|
1965
|
+
* (`uipath:activity/@skipCondition`).
|
|
1966
|
+
*
|
|
1967
|
+
* Only connectors (and other `uipath:activity` nodes) can carry it: a script or
|
|
1968
|
+
* variable task serializes a `uipath:mapping`, which has no such attribute, so
|
|
1969
|
+
* a skip authored there would be dropped and the step would run regardless.
|
|
1970
|
+
*/
|
|
1971
|
+
skipCondition?: string;
|
|
1972
|
+
/**
|
|
1973
|
+
* Variable the connector's response lands in. Defaults to `<id>_response`,
|
|
1974
|
+
* which is what makes two connectors in one process independent — a shared
|
|
1975
|
+
* name would have the second clobber the first. The standard error payload
|
|
1976
|
+
* always lands in `<id>_Error`.
|
|
1977
|
+
*/
|
|
1978
|
+
outputVar?: string;
|
|
1979
|
+
};
|
|
1980
|
+
/**
|
|
1981
|
+
* The variables a connector task's output rows land in.
|
|
1982
|
+
*
|
|
1983
|
+
* Per-node by default, because a `uipath:output`'s `var` IS the variable
|
|
1984
|
+
* declaration as far as the platform is concerned (its canvas model maps every
|
|
1985
|
+
* node output to a variable keyed by `var`). A shared name would therefore mean
|
|
1986
|
+
* two connectors writing one variable, with the second silently clobbering the
|
|
1987
|
+
* first — and it is the reason both the serializer and the expression check need
|
|
1988
|
+
* the same answer, hence one function.
|
|
1989
|
+
*
|
|
1990
|
+
* @param n - The connector node.
|
|
1991
|
+
* @returns The response and error variable names.
|
|
1992
|
+
*
|
|
1993
|
+
* @internal
|
|
1994
|
+
*/
|
|
1995
|
+
export declare function connectorOutputVars(n: Extract<BpmnNode, {
|
|
1996
|
+
kind: 'connector';
|
|
1997
|
+
}>): {
|
|
1998
|
+
response: string;
|
|
1999
|
+
error: string;
|
|
2000
|
+
};
|
|
2001
|
+
/**
|
|
2002
|
+
* The variables a typed node writes — the ONE definition of that set.
|
|
2003
|
+
*
|
|
2004
|
+
* It had grown three: this one (what an expression may read), `implicitNodeVars` in
|
|
2005
|
+
* serialize (what gets declared in `uipath:variables`), and `derivedVariableIds` in
|
|
2006
|
+
* decompile (what a decompiled file must NOT re-declare). All three must agree, and
|
|
2007
|
+
* adding `outputRows` proved they do not stay agreed on their own: two were updated,
|
|
2008
|
+
* this one was missed, and a human task's mapped output stopped being visible to the
|
|
2009
|
+
* expression checker — `vars.decision` reported undeclared for a variable the node
|
|
2010
|
+
* plainly writes. So serialize now calls this instead of repeating it, and only
|
|
2011
|
+
* decompile's copy is separate, which its own comment already flags as load-bearing.
|
|
2012
|
+
*
|
|
2013
|
+
* @param n - The typed node.
|
|
2014
|
+
* @returns The variable ids its output rows write.
|
|
2015
|
+
* @internal
|
|
2016
|
+
*/
|
|
2017
|
+
export declare function typedNodeDeclaredVars(n: Extract<BpmnNode, {
|
|
2018
|
+
kind: 'typed';
|
|
2019
|
+
}>): string[];
|
|
2020
|
+
/**
|
|
2021
|
+
* Every variable name a node DECLARES by writing to it — the platform counts a
|
|
2022
|
+
* node's output `var` as a declaration, so a downstream `=vars.<name>` resolves
|
|
2023
|
+
* against it without any `uipath:variables` entry. The expression check mirrors
|
|
2024
|
+
* that, or it would reject reads the platform accepts.
|
|
2025
|
+
*
|
|
2026
|
+
* @param n - The node to inspect.
|
|
2027
|
+
* @returns The variable names it declares, if any.
|
|
2028
|
+
*
|
|
2029
|
+
* @internal
|
|
2030
|
+
*/
|
|
2031
|
+
export declare function nodeDeclaredVars(n: BpmnNode): string[];
|
|
2032
|
+
/** A sub-process body: the same graph methods, plus an internal node builder. */
|
|
2033
|
+
export declare class SubProcessBuilder extends ScopeBuilder {
|
|
2034
|
+
/** @internal */
|
|
2035
|
+
_buildNode(id: string, opts: SubProcessOpts): BpmnNode;
|
|
2036
|
+
}
|
|
2037
|
+
/**
|
|
2038
|
+
* The top-level process builder `bpmn()` returns — every graph method of the
|
|
2039
|
+
* shared scope (events, gateways, tasks, sub-processes, flows, variables) plus
|
|
2040
|
+
* the process's `.name()` and the `.build()` that finishes it.
|
|
2041
|
+
*/
|
|
2042
|
+
export declare class BpmnBuilder extends ScopeBuilder {
|
|
2043
|
+
private readonly _id;
|
|
2044
|
+
private _name?;
|
|
2045
|
+
private _metadata?;
|
|
2046
|
+
/**
|
|
2047
|
+
* @param _id - The process id, as passed to `bpmn()`.
|
|
2048
|
+
* @returns The top-level builder.
|
|
2049
|
+
*/
|
|
2050
|
+
constructor(_id: string);
|
|
2051
|
+
/**
|
|
2052
|
+
* Set the process's display name.
|
|
2053
|
+
*
|
|
2054
|
+
* @param n - The name the designer shows.
|
|
2055
|
+
* @returns This builder, so calls chain.
|
|
2056
|
+
*/
|
|
2057
|
+
name(n: string): this;
|
|
2058
|
+
/**
|
|
2059
|
+
* Process-level metadata — see {@link ProcessMetadata}.
|
|
2060
|
+
*
|
|
2061
|
+
* Repeated calls MERGE rather than replace, so a caller can set one field without
|
|
2062
|
+
* knowing what an earlier call set.
|
|
2063
|
+
*
|
|
2064
|
+
* @param meta - The fields to declare; anything omitted stays absent.
|
|
2065
|
+
* @returns This builder, so calls chain.
|
|
2066
|
+
*
|
|
2067
|
+
* @example
|
|
2068
|
+
* ```ts
|
|
2069
|
+
* bpmn('order').metadata({ migrationVersion: '11' })
|
|
2070
|
+
* ```
|
|
2071
|
+
*/
|
|
2072
|
+
metadata(meta: ProcessMetadata): this;
|
|
2073
|
+
/**
|
|
2074
|
+
* Declare the Canvas SCHEMA generation this document targets
|
|
2075
|
+
* (`uipath:migrationVersion`).
|
|
2076
|
+
*
|
|
2077
|
+
* @remarks
|
|
2078
|
+
* The same field {@link ProcessMetadata.migrationVersion} sets, under the name
|
|
2079
|
+
* the Flow and Case builders use for the same concept — a document's schema
|
|
2080
|
+
* version, as opposed to anything about the process's own release. Both
|
|
2081
|
+
* spellings stay valid; the later call wins, as with any `.metadata()` field.
|
|
2082
|
+
*
|
|
2083
|
+
* Unlike Flow's file format and Case's grammar, this one does not change what
|
|
2084
|
+
* the serializer emits: the `.bpmn` is the same XML whatever generation is
|
|
2085
|
+
* stamped on it, so any non-empty value is accepted and carried through
|
|
2086
|
+
* verbatim. An empty one is refused, because an empty
|
|
2087
|
+
* `uipath:migrationVersion` fails product validation — absent beats blank.
|
|
2088
|
+
*
|
|
2089
|
+
* `bpmn-decompile` emits this call with the stamp it read, which is what keeps
|
|
2090
|
+
* a decompile → edit → recompile from dropping a generation Studio Web wrote
|
|
2091
|
+
* and some graders require.
|
|
2092
|
+
*
|
|
2093
|
+
* @example
|
|
2094
|
+
* ```ts
|
|
2095
|
+
* bpmn('order').schemaVersion('11.5')
|
|
2096
|
+
* ```
|
|
2097
|
+
*
|
|
2098
|
+
* @param version - The Canvas schema generation, e.g. `'11'` or `'11.5'`.
|
|
2099
|
+
* @returns This builder, so calls chain.
|
|
2100
|
+
* @throws Error when `version` is empty.
|
|
2101
|
+
*/
|
|
2102
|
+
schemaVersion(version: string): this;
|
|
2103
|
+
/** Named schemas declared with `.schema()`, resolved when a row references one. */
|
|
2104
|
+
private readonly _schemas;
|
|
2105
|
+
/**
|
|
2106
|
+
* Name a JSON Schema once so several variables can share it.
|
|
2107
|
+
*
|
|
2108
|
+
* @remarks
|
|
2109
|
+
* Purely a source-level convenience: there is no shared-schema concept on the
|
|
2110
|
+
* wire, so every reference expands back to the same inline body and the emitted
|
|
2111
|
+
* XML is byte-identical either way. What it saves is the source — a real process
|
|
2112
|
+
* repeats a handful of shapes across dozens of variables, and one export carried
|
|
2113
|
+
* 57 schema bodies of which only 13 were distinct.
|
|
2114
|
+
*
|
|
2115
|
+
* `schema: errorSchema` covers the platform's own error envelope, which needs no
|
|
2116
|
+
* declaration at all; this is for the shapes that belong to a particular process.
|
|
2117
|
+
*
|
|
2118
|
+
* @param id - The name to reference it by, in `schema: id`.
|
|
2119
|
+
* @param schema - The JSON Schema, as a value rather than a string.
|
|
2120
|
+
* @returns This builder, so calls chain.
|
|
2121
|
+
*
|
|
2122
|
+
* @example
|
|
2123
|
+
* ```ts
|
|
2124
|
+
* bpmn('orders')
|
|
2125
|
+
* .schema('queueItem', { type: 'object', properties: { Id: { type: 'integer' } } })
|
|
2126
|
+
* .var('response1', 'jsonSchema', { name: 'response', schema: 'queueItem' })
|
|
2127
|
+
* .var('response2', 'jsonSchema', { name: 'response', schema: 'queueItem' })
|
|
2128
|
+
* ```
|
|
2129
|
+
*/
|
|
2130
|
+
schema(id: string, schema: unknown): this;
|
|
2131
|
+
/**
|
|
2132
|
+
* Declare an external identifier the process needs supplied — a base URL, a
|
|
2133
|
+
* folder path, a process name (`uipath:binding`). Expressions read it as
|
|
2134
|
+
* `=bindings.<id>`, and an offline run resolves it to `value`.
|
|
2135
|
+
*
|
|
2136
|
+
* @remarks
|
|
2137
|
+
* A connector's `connection`/`folder` already produce their own bindings at
|
|
2138
|
+
* serialize time; this is for everything else, and it is what lets a value be
|
|
2139
|
+
* configured per environment rather than baked into the process. Declaring the
|
|
2140
|
+
* same id twice keeps the FIRST declaration.
|
|
2141
|
+
*
|
|
2142
|
+
* @example
|
|
2143
|
+
* ```ts
|
|
2144
|
+
* bpmn('sync')
|
|
2145
|
+
* .binding('apiBase', { name: 'API base URL', value: 'https://api.example.com' })
|
|
2146
|
+
* .var('url', 'string')
|
|
2147
|
+
* .startEvent('start')
|
|
2148
|
+
* .task('resolve', { set: { url: '=js:bindings.apiBase + "/v1/orders"' } })
|
|
2149
|
+
* ```
|
|
2150
|
+
*
|
|
2151
|
+
* @param id - The binding's id — what `=bindings.<id>` refers to.
|
|
2152
|
+
* @param opts - Display `name`, the `value` it defaults to, and which resource it addresses.
|
|
2153
|
+
* @returns This builder, so calls chain.
|
|
2154
|
+
*/
|
|
2155
|
+
binding(id: string, opts?: BindingOpts): this;
|
|
2156
|
+
/**
|
|
2157
|
+
* Finish the process and return the graph the serializer turns into XML.
|
|
2158
|
+
*
|
|
2159
|
+
* @returns The built process — its elements, flows and variables.
|
|
2160
|
+
*/
|
|
2161
|
+
build(): BuiltBpmn;
|
|
2162
|
+
}
|
|
2163
|
+
/**
|
|
2164
|
+
* The `Error` variable's shape — the platform's own error envelope.
|
|
2165
|
+
*
|
|
2166
|
+
* Every node that can fail writes one, so a real process declares this schema once
|
|
2167
|
+
* per node and an imported one repeats it verbatim: 243 byte-identical copies across
|
|
2168
|
+
* five unrelated customer exports, 27 in a single 71-element process.
|
|
2169
|
+
*
|
|
2170
|
+
* It is a contract, not a convention. `V2EndEventBody.BuildErrorCoreResult` in
|
|
2171
|
+
* PO.BpmnEngine builds it — *"the ErrorEndEvent core result with one `Error` entry
|
|
2172
|
+
* and the six expected fields"* — as `code`, `message`, `detail`, `category`,
|
|
2173
|
+
* `status`, `element`, with `status` an HTTP status code and the rest strings.
|
|
2174
|
+
*
|
|
2175
|
+
* @example
|
|
2176
|
+
* ```ts
|
|
2177
|
+
* bpmn('p').var('error1', 'jsonSchema', { name: 'Error', schema: errorSchema })
|
|
2178
|
+
* ```
|
|
2179
|
+
*
|
|
2180
|
+
* @see errorSchemaWithResponse
|
|
2181
|
+
*/
|
|
2182
|
+
export declare const errorSchema: {
|
|
2183
|
+
readonly type: "object";
|
|
2184
|
+
readonly properties: {
|
|
2185
|
+
readonly code: {
|
|
2186
|
+
readonly type: "string";
|
|
2187
|
+
};
|
|
2188
|
+
readonly message: {
|
|
2189
|
+
readonly type: "string";
|
|
2190
|
+
};
|
|
2191
|
+
readonly detail: {
|
|
2192
|
+
readonly type: "string";
|
|
2193
|
+
};
|
|
2194
|
+
readonly category: {
|
|
2195
|
+
readonly type: "string";
|
|
2196
|
+
};
|
|
2197
|
+
readonly status: {
|
|
2198
|
+
readonly type: "number";
|
|
2199
|
+
};
|
|
2200
|
+
readonly element: {
|
|
2201
|
+
readonly type: "string";
|
|
2202
|
+
};
|
|
2203
|
+
};
|
|
2204
|
+
};
|
|
2205
|
+
/**
|
|
2206
|
+
* The same envelope plus `response` — what a node whose failure carries a payload
|
|
2207
|
+
* writes, and what the same source calls *"the generic failure mapping shape, which
|
|
2208
|
+
* includes a `response` key"*, distinguishing it from {@link errorSchema}.
|
|
2209
|
+
*
|
|
2210
|
+
* 42 copies across the corpus, against 243 of the six-field form.
|
|
2211
|
+
*/
|
|
2212
|
+
export declare const errorSchemaWithResponse: {
|
|
2213
|
+
readonly type: "object";
|
|
2214
|
+
readonly properties: {
|
|
2215
|
+
readonly response: {
|
|
2216
|
+
readonly type: "string";
|
|
2217
|
+
};
|
|
2218
|
+
readonly code: {
|
|
2219
|
+
readonly type: "string";
|
|
2220
|
+
};
|
|
2221
|
+
readonly message: {
|
|
2222
|
+
readonly type: "string";
|
|
2223
|
+
};
|
|
2224
|
+
readonly detail: {
|
|
2225
|
+
readonly type: "string";
|
|
2226
|
+
};
|
|
2227
|
+
readonly category: {
|
|
2228
|
+
readonly type: "string";
|
|
2229
|
+
};
|
|
2230
|
+
readonly status: {
|
|
2231
|
+
readonly type: "number";
|
|
2232
|
+
};
|
|
2233
|
+
readonly element: {
|
|
2234
|
+
readonly type: "string";
|
|
2235
|
+
};
|
|
2236
|
+
};
|
|
2237
|
+
};
|
|
2238
|
+
/**
|
|
2239
|
+
* Start building a BPMN process with the given id.
|
|
2240
|
+
*
|
|
2241
|
+
* @example
|
|
2242
|
+
* **A minimal start → task → end process**
|
|
2243
|
+
* ```ts
|
|
2244
|
+
* export default bpmn('intake')
|
|
2245
|
+
* .startEvent('start')
|
|
2246
|
+
* .var('note', 'string', { default: '' })
|
|
2247
|
+
* .task('assign', { set: { note: 'hello' } })
|
|
2248
|
+
* .endEvent('done')
|
|
2249
|
+
* .sequenceFlow('start', 'assign')
|
|
2250
|
+
* .sequenceFlow('assign', 'done')
|
|
2251
|
+
* .build();
|
|
2252
|
+
* ```
|
|
2253
|
+
*
|
|
2254
|
+
* @param id - The process id.
|
|
2255
|
+
* @returns A {@link BpmnBuilder} to add elements to.
|
|
2256
|
+
*/
|
|
2257
|
+
export declare function bpmn(id: string): BpmnBuilder;
|