@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.
Files changed (238) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +322 -0
  3. package/dist/bindings-v2.d.ts +37 -0
  4. package/dist/bindings-v2.js +155 -0
  5. package/dist/bindings.d.ts +6 -0
  6. package/dist/bindings.js +6 -0
  7. package/dist/bpmn/bpmn-expr-check.d.ts +41 -0
  8. package/dist/bpmn/bpmn-expr-check.js +218 -0
  9. package/dist/bpmn/bpmn-sdk.d.ts +2257 -0
  10. package/dist/bpmn/bpmn-sdk.js +1476 -0
  11. package/dist/bpmn/check-cli.d.ts +3 -0
  12. package/dist/bpmn/check-cli.js +32 -0
  13. package/dist/bpmn/check.d.ts +25 -0
  14. package/dist/bpmn/check.js +430 -0
  15. package/dist/bpmn/compile-cli.d.ts +3 -0
  16. package/dist/bpmn/compile-cli.js +60 -0
  17. package/dist/bpmn/connector.d.ts +56 -0
  18. package/dist/bpmn/connector.js +199 -0
  19. package/dist/bpmn/decompile-cli.d.ts +8 -0
  20. package/dist/bpmn/decompile-cli.js +54 -0
  21. package/dist/bpmn/decompile.d.ts +6 -0
  22. package/dist/bpmn/decompile.js +1108 -0
  23. package/dist/bpmn/format-profile.d.ts +27 -0
  24. package/dist/bpmn/format-profile.js +11 -0
  25. package/dist/bpmn/intsvc.d.ts +77 -0
  26. package/dist/bpmn/intsvc.js +155 -0
  27. package/dist/bpmn/load.d.ts +4 -0
  28. package/dist/bpmn/load.js +22 -0
  29. package/dist/bpmn/merge-cli.d.ts +3 -0
  30. package/dist/bpmn/merge-cli.js +45 -0
  31. package/dist/bpmn/merge.d.ts +19 -0
  32. package/dist/bpmn/merge.js +293 -0
  33. package/dist/bpmn/registry-types.json +1869 -0
  34. package/dist/bpmn/serialize.d.ts +28 -0
  35. package/dist/bpmn/serialize.js +757 -0
  36. package/dist/bpmn/tidy-cli.d.ts +2 -0
  37. package/dist/bpmn/tidy-cli.js +39 -0
  38. package/dist/bpmn/typed-node.d.ts +382 -0
  39. package/dist/bpmn/typed-node.js +551 -0
  40. package/dist/bpmn/uipath-moddle.v1.json +823 -0
  41. package/dist/bpmn/xml-ranges.d.ts +45 -0
  42. package/dist/bpmn/xml-ranges.js +151 -0
  43. package/dist/case/case-expr-check.d.ts +35 -0
  44. package/dist/case/case-expr-check.js +85 -0
  45. package/dist/case/case-sdk.d.ts +1282 -0
  46. package/dist/case/case-sdk.js +923 -0
  47. package/dist/case/check-cli.d.ts +3 -0
  48. package/dist/case/check-cli.js +31 -0
  49. package/dist/case/check.d.ts +18 -0
  50. package/dist/case/check.js +456 -0
  51. package/dist/case/compile-cli.d.ts +3 -0
  52. package/dist/case/compile-cli.js +291 -0
  53. package/dist/case/decompile-cli.d.ts +9 -0
  54. package/dist/case/decompile-cli.js +117 -0
  55. package/dist/case/decompile.d.ts +187 -0
  56. package/dist/case/decompile.js +1170 -0
  57. package/dist/case/entry-points.d.ts +79 -0
  58. package/dist/case/entry-points.js +118 -0
  59. package/dist/case/format-profile.d.ts +60 -0
  60. package/dist/case/format-profile.js +79 -0
  61. package/dist/case/ids.d.ts +24 -0
  62. package/dist/case/ids.js +76 -0
  63. package/dist/case/load.d.ts +12 -0
  64. package/dist/case/load.js +32 -0
  65. package/dist/case/preserve.d.ts +133 -0
  66. package/dist/case/preserve.js +105 -0
  67. package/dist/case/serialize.d.ts +10 -0
  68. package/dist/case/serialize.js +1414 -0
  69. package/dist/check-cli.d.ts +3 -0
  70. package/dist/check-cli.js +118 -0
  71. package/dist/check.d.ts +146 -0
  72. package/dist/check.js +4898 -0
  73. package/dist/cli/commands/bpmn.d.ts +2 -0
  74. package/dist/cli/commands/bpmn.js +73 -0
  75. package/dist/cli/commands/case.d.ts +2 -0
  76. package/dist/cli/commands/case.js +60 -0
  77. package/dist/cli/commands/flow.d.ts +2 -0
  78. package/dist/cli/commands/flow.js +99 -0
  79. package/dist/cli/commands/registry.d.ts +10 -0
  80. package/dist/cli/commands/registry.js +170 -0
  81. package/dist/cli/common.d.ts +30 -0
  82. package/dist/cli/common.js +92 -0
  83. package/dist/cli/index.d.ts +2 -0
  84. package/dist/cli/index.js +18 -0
  85. package/dist/cli-run.d.ts +2 -0
  86. package/dist/cli-run.js +42 -0
  87. package/dist/compile-cli.d.ts +3 -0
  88. package/dist/compile-cli.js +160 -0
  89. package/dist/config.d.ts +47 -0
  90. package/dist/config.js +201 -0
  91. package/dist/core/actions.d.ts +3244 -0
  92. package/dist/core/actions.js +1062 -0
  93. package/dist/core/binding-messages.d.ts +1 -0
  94. package/dist/core/binding-messages.js +16 -0
  95. package/dist/core/bindings.d.ts +12 -0
  96. package/dist/core/bindings.js +67 -0
  97. package/dist/core/ceql.d.ts +73 -0
  98. package/dist/core/ceql.js +272 -0
  99. package/dist/core/cli-spelling.d.ts +39 -0
  100. package/dist/core/cli-spelling.js +62 -0
  101. package/dist/core/connector-raw-node.d.ts +21 -0
  102. package/dist/core/connector-raw-node.js +47 -0
  103. package/dist/core/connectors.d.ts +184 -0
  104. package/dist/core/connectors.js +128 -0
  105. package/dist/core/expr-check.d.ts +93 -0
  106. package/dist/core/expr-check.js +186 -0
  107. package/dist/core/expr.d.ts +323 -0
  108. package/dist/core/expr.js +400 -0
  109. package/dist/core/index.d.ts +10 -0
  110. package/dist/core/index.js +10 -0
  111. package/dist/core/library.d.ts +440 -0
  112. package/dist/core/library.js +1183 -0
  113. package/dist/core/list-envelope.d.ts +45 -0
  114. package/dist/core/list-envelope.js +97 -0
  115. package/dist/core/lookup-store.d.ts +22 -0
  116. package/dist/core/lookup-store.js +85 -0
  117. package/dist/core/lookups.d.ts +227 -0
  118. package/dist/core/lookups.js +231 -0
  119. package/dist/core/node-classes.d.ts +234 -0
  120. package/dist/core/node-classes.js +158 -0
  121. package/dist/core/script-return.d.ts +68 -0
  122. package/dist/core/script-return.js +197 -0
  123. package/dist/core/stable-id.d.ts +28 -0
  124. package/dist/core/stable-id.js +37 -0
  125. package/dist/core-definitions.json +16249 -0
  126. package/dist/decompile-cli.d.ts +3 -0
  127. package/dist/decompile-cli.js +131 -0
  128. package/dist/decompile.d.ts +138 -0
  129. package/dist/decompile.js +2482 -0
  130. package/dist/emit.d.ts +10 -0
  131. package/dist/emit.js +60 -0
  132. package/dist/event-filters.d.ts +130 -0
  133. package/dist/event-filters.js +137 -0
  134. package/dist/flow-expr-check.d.ts +17 -0
  135. package/dist/flow-expr-check.js +193 -0
  136. package/dist/flow-sdk.d.ts +1341 -0
  137. package/dist/flow-sdk.js +1164 -0
  138. package/dist/flow-variables.d.ts +13 -0
  139. package/dist/flow-variables.js +42 -0
  140. package/dist/format-profile.d.ts +72 -0
  141. package/dist/format-profile.js +97 -0
  142. package/dist/generators/_connections.py +287 -0
  143. package/dist/generators/_events.py +355 -0
  144. package/dist/generators/_lookups.py +114 -0
  145. package/dist/generators/_naming.py +185 -0
  146. package/dist/generators/_objects.py +299 -0
  147. package/dist/generators/_resolve.py +273 -0
  148. package/dist/generators/convert_library_to_md.py +1441 -0
  149. package/dist/generators/extract_library.py +125 -0
  150. package/dist/generators/generate_connectors_ts.py +936 -0
  151. package/dist/generators/generate_library_json.py +2527 -0
  152. package/dist/generators/generate_triggers_ts.py +110 -0
  153. package/dist/generators/materialize_registry.py +155 -0
  154. package/dist/generators/prepare_connector.py +1688 -0
  155. package/dist/index.d.ts +35 -0
  156. package/dist/index.js +35 -0
  157. package/dist/ixp-definition.json +1982 -0
  158. package/dist/library.d.ts +6 -0
  159. package/dist/library.js +6 -0
  160. package/dist/load.d.ts +16 -0
  161. package/dist/load.js +95 -0
  162. package/dist/merge-cli.d.ts +3 -0
  163. package/dist/merge-cli.js +47 -0
  164. package/dist/merge.d.ts +125 -0
  165. package/dist/merge.js +0 -0
  166. package/dist/migrate.d.ts +15 -0
  167. package/dist/migrate.js +245 -0
  168. package/dist/node-runtime.d.ts +3 -0
  169. package/dist/node-runtime.js +22 -0
  170. package/dist/package-name.d.ts +17 -0
  171. package/dist/package-name.js +17 -0
  172. package/dist/ref-resolve.d.ts +77 -0
  173. package/dist/ref-resolve.js +170 -0
  174. package/dist/registry/cache.d.ts +55 -0
  175. package/dist/registry/cache.js +134 -0
  176. package/dist/registry/curated-overlay.d.ts +16 -0
  177. package/dist/registry/curated-overlay.js +62 -0
  178. package/dist/registry/extractor.d.ts +22 -0
  179. package/dist/registry/extractor.js +18 -0
  180. package/dist/registry/materialize-bin.d.ts +2 -0
  181. package/dist/registry/materialize-bin.js +7 -0
  182. package/dist/registry/materialize-cli.d.ts +1 -0
  183. package/dist/registry/materialize-cli.js +46 -0
  184. package/dist/registry/materializer.d.ts +23 -0
  185. package/dist/registry/materializer.js +34 -0
  186. package/dist/registry/path-cli.d.ts +1 -0
  187. package/dist/registry/path-cli.js +56 -0
  188. package/dist/registry/prepare-cli.d.ts +62 -0
  189. package/dist/registry/prepare-cli.js +185 -0
  190. package/dist/registry/pull-cli.d.ts +1 -0
  191. package/dist/registry/pull-cli.js +274 -0
  192. package/dist/registry/python.d.ts +26 -0
  193. package/dist/registry/python.js +46 -0
  194. package/dist/registry/search-cli.d.ts +52 -0
  195. package/dist/registry/search-cli.js +159 -0
  196. package/dist/schema-version.d.ts +165 -0
  197. package/dist/schema-version.js +148 -0
  198. package/dist/serialize.d.ts +64 -0
  199. package/dist/serialize.js +6398 -0
  200. package/lib/README.md +112 -0
  201. package/lib/library-json.samples/index.json +158 -0
  202. package/lib/library-json.samples/invariant-collections.json +83 -0
  203. package/lib/library-json.samples/list-envelopes.json +123 -0
  204. package/lib/library-json.samples/uipath-atlassian-jira/create-issue@1.0.0.json +131 -0
  205. package/lib/library-json.samples/uipath-atlassian-jira/create-issue@1.0.0.v1def.json +306 -0
  206. package/lib/library-json.samples/uipath-atlassian-jira/generic/create_issue/create@1.0.0.json +86 -0
  207. package/lib/library-json.samples/uipath-atlassian-jira/generic/create_issue/create@1.0.0.v1def.json +208 -0
  208. package/lib/library-json.samples/uipath-atlassian-jira/get-issue@1.0.0.json +2040 -0
  209. package/lib/library-json.samples/uipath-atlassian-jira/get-issue@1.0.0.v1def.json +195 -0
  210. package/lib/library-json.samples/uipath-google-vertex/execute-google-vertex-agent@1.0.0.json +169 -0
  211. package/lib/library-json.samples/uipath-google-vertex/execute-google-vertex-agent@1.0.0.v1def.json +209 -0
  212. package/lib/library-json.samples/uipath-http-webhook/event-http-webhook@1.0.0.json +63 -0
  213. package/lib/library-json.samples/uipath-http-webhook/event-http-webhook@1.0.0.v1def.json +262 -0
  214. package/lib/library-json.samples/uipath-http-webhook/trigger-http-webhook@1.0.0.json +63 -0
  215. package/lib/library-json.samples/uipath-http-webhook/trigger-http-webhook@1.0.0.v1def.json +213 -0
  216. package/lib/library-json.samples/uipath-microsoft-azureactivedirectory/list-groups@1.0.0.json +227 -0
  217. package/lib/library-json.samples/uipath-microsoft-azureactivedirectory/list-groups@1.0.0.v1def.json +373 -0
  218. package/lib/library-json.samples/uipath-microsoft-onedrive/event-file-created@1.0.0.json +116 -0
  219. package/lib/library-json.samples/uipath-microsoft-onedrive/event-file-created@1.0.0.v1def.json +369 -0
  220. package/lib/library-json.samples/uipath-microsoft-onedrive/event-list-item-added@1.0.0.json +56 -0
  221. package/lib/library-json.samples/uipath-microsoft-onedrive/event-list-item-added@1.0.0.v1def.json +256 -0
  222. package/lib/library-json.samples/uipath-microsoft-onedrive/trigger-file-created@1.0.0.json +116 -0
  223. package/lib/library-json.samples/uipath-microsoft-onedrive/trigger-file-created@1.0.0.v1def.json +320 -0
  224. package/lib/library-json.samples/uipath-microsoft-onedrive/trigger-list-item-added@1.0.0.json +56 -0
  225. package/lib/library-json.samples/uipath-microsoft-onedrive/trigger-list-item-added@1.0.0.v1def.json +207 -0
  226. package/lib/library-json.samples/uipath-microsoft-outlook365/event-email-received@1.0.0.json +107 -0
  227. package/lib/library-json.samples/uipath-microsoft-outlook365/event-email-received@1.0.0.v1def.json +264 -0
  228. package/lib/library-json.samples/uipath-microsoft-outlook365/send-email@1.0.0.json +142 -0
  229. package/lib/library-json.samples/uipath-microsoft-outlook365/send-email@1.0.0.v1def.json +306 -0
  230. package/lib/library-json.samples/uipath-microsoft-outlook365/trigger-email-received@1.0.0.json +107 -0
  231. package/lib/library-json.samples/uipath-microsoft-outlook365/trigger-email-received@1.0.0.v1def.json +217 -0
  232. package/lib/library-json.samples/uipath-microsoft-powerautomate/invoke-a-microsoft-power-automate-flow@1.0.0.json +85 -0
  233. package/lib/library-json.samples/uipath-microsoft-powerautomate/invoke-a-microsoft-power-automate-flow@1.0.0.v1def.json +209 -0
  234. package/lib/library-json.samples/uipath-salesforce-slack/send-message-to-user@1.0.0.json +755 -0
  235. package/lib/library-json.samples/uipath-salesforce-slack/send-message-to-user@1.0.0.v1def.json +513 -0
  236. package/lib/library-json.samples/uipath-uipath-dataservice/query-entity-records@1.0.0.json +122 -0
  237. package/lib/library-json.samples/uipath-uipath-dataservice/query-entity-records@1.0.0.v1def.json +227 -0
  238. package/package.json +85 -0
@@ -0,0 +1,1282 @@
1
+ /**
2
+ * case-sdk — a fluent builder for UiPath Case Management plans (`caseplan.json`,
3
+ * schema V30).
4
+ *
5
+ * Like the Flow builder, this constructs a plain description of a case — its
6
+ * stages, the tasks inside them, and the entry/exit *conditions* that drive
7
+ * transitions — which `serialize()` turns into a real `caseplan.json`. A case is
8
+ * a hierarchy (stages → tasks), not a graph: there are **no edges**; flow
9
+ * between stages is expressed entirely through conditions (see `rule()`).
10
+ *
11
+ * This first cut is **reference-mode**: a task points at an already-published
12
+ * process/agent/rpa/workflow by name + folder. (Embedding an inline flow/bpmn
13
+ * body in a task is a later phase.) The builder uses callback closures for
14
+ * nesting, matching the Flow SDK's `.branch(name, cond, b => …)` style — so a
15
+ * `casePlan()` only ever exposes case methods, and each nested builder only its
16
+ * own.
17
+ *
18
+ * `casePlan` (not `case`) is the entry point: `case` is a reserved word.
19
+ */
20
+ import type { TypeDesc } from '../core/expr.js';
21
+ import { type ActionSpec, type ConnectorOpts, type EventSubscription, type TriggerOptions } from '../core/actions.js';
22
+ import { type ConnectorDescriptor, type TriggerDescriptor } from '../core/connectors.js';
23
+ export { preserveCaseJson } from './preserve.js';
24
+ export type { CaseJsonPreservation, PreservedCaseNode, PreservedTaskFields, PreservedVariableLane } from './preserve.js';
25
+ export { CaseBuildError } from './case-expr-check.js';
26
+ export type { CaseLocatedDiagnostic } from './case-expr-check.js';
27
+ export type CaseRuleType = 'case-entered' | 'required-tasks-completed' | 'required-stages-completed' | 'selected-stage-completed' | 'selected-stage-exited' | 'selected-tasks-completed' | 'current-stage-entered' | 'adhoc' | 'runs-sequentially' | 'user-selected-stage' | 'wait-for-connector' | 'sla-status-change';
28
+ export interface RuleOpts {
29
+ /**
30
+ * Symbolic stage label (for `selected-stage-completed` / `selected-stage-exited`).
31
+ *
32
+ * @remarks
33
+ * Both rules serialize identically — to the one-element `selectedStageIds` array — so this SDK draws no
34
+ * distinction between them; the difference is interpreted at runtime. Use
35
+ * `selected-stage-exited` for an interrupting exception-stage entry (what the
36
+ * shipped example does) and `selected-stage-completed` when you mean the stage
37
+ * finished normally.
38
+ */
39
+ stage?: string;
40
+ /**
41
+ * Task references for `selected-tasks-completed`. Resolved **case-wide, not
42
+ * per-stage** — a rule in one stage may reference a task in another.
43
+ *
44
+ * @remarks
45
+ * Two forms:
46
+ * - bare `'Task Name'` — the normal form.
47
+ * - qualified `'<Stage Label>/<Task Name>'` — also accepted, and clearer when a
48
+ * name's stage is not obvious from context.
49
+ *
50
+ * Task names must be UNIQUE CASE-WIDE: `uip maestro case validate` rejects
51
+ * duplicates outright ("Task name 'X' is duplicate"), and `check` now flags them
52
+ * as DUP_TASK. Names that naturally recur across stages ("Withdraw Request",
53
+ * "Reject") must be qualified at the source, e.g. `'Withdraw Request (Counsel)'`.
54
+ */
55
+ tasks?: string[];
56
+ /**
57
+ * For a `wait-for-connector` rule — the connector event to suspend on. Omit for
58
+ * a placeholder (both fields default to `"placeholder"`). Emits the rule's
59
+ * `uipath` subscription bag (`serviceType: "Intsvc.WaitForEvent"` + a `context`
60
+ * naming the connector/operation).
61
+ */
62
+ connector?: WaitConnectorSpec;
63
+ /**
64
+ * For a `sla-status-change` rule — the **displayName of the SLA** whose status
65
+ * change fires this rule (react to a deadline breach / at-risk). Declare the SLA
66
+ * with that `displayName` via `.sla({ displayName, … })`; resolved to `slaId`.
67
+ */
68
+ sla?: string;
69
+ /**
70
+ * For an **at-risk** `sla-status-change` rule — the displayName of the escalation
71
+ * (declared on the referenced SLA, `trigger: 'at-risk'`) that fires it. Omit for
72
+ * a **breach** rule (`slaId` alone). Resolved to `escalationId`.
73
+ */
74
+ escalation?: string;
75
+ /** A `=js:` gate on case state (for `adhoc`, or as an extra guard on any rule). */
76
+ expression?: string;
77
+ }
78
+ /** A single DNF rule. Symbolic references (`stage`/`tasks`) are resolved to ids at serialize. */
79
+ export interface CaseRule extends RuleOpts {
80
+ rule: CaseRuleType;
81
+ }
82
+ /**
83
+ * Declare a condition rule. Pass one rule, an array for an AND-group, or an
84
+ * array of arrays for the complete OR-of-AND grid to
85
+ * `entryWhen`/`exitWhen`/etc.
86
+ *
87
+ * @param type - Which condition, e.g. `'case-entered'` or `'selected-tasks-completed'`.
88
+ * @param opts - What the rule needs, e.g. the `tasks` a task-completion rule waits on.
89
+ * @returns A rule to pass to `entryWhen` / `exitWhen` / `completeWhen`.
90
+ */
91
+ export declare function rule(type: CaseRuleType, opts?: RuleOpts): CaseRule;
92
+ /**
93
+ * A pure expression gate. The receiving condition slot supplies its canonical
94
+ * event: `case-entered` for stage entry, `selected-tasks-completed` for stage
95
+ * exit, `current-stage-entered` for task entry, and
96
+ * `required-stages-completed` for case completion.
97
+ */
98
+ export interface WhenExpression {
99
+ /** Identifies this value as an expression gate until a condition slot resolves it. */
100
+ readonly kind: 'case-when-expression';
101
+ /** The `=js:` expression evaluated against case `vars.*`. */
102
+ readonly expression: string;
103
+ }
104
+ /**
105
+ * Gate a condition slot only on case data without naming its default event.
106
+ *
107
+ * @param expression - A `=js:` expression over declared `vars.*` values.
108
+ * @returns A slot-agnostic marker resolved by `entryWhen`, `exitWhen`, or `completeWhen`.
109
+ */
110
+ export declare function when(expression: string): WhenExpression;
111
+ /** A concrete rule or a pure expression gate resolved by its receiving slot. */
112
+ export type CaseRuleInput = CaseRule | WhenExpression;
113
+ /** One rule, one AND-group, or a complete OR-of-AND condition grid. */
114
+ export type CaseRuleGrid = CaseRuleInput | CaseRuleInput[] | CaseRuleInput[][];
115
+ /** SLA deadline unit. `min` = minutes, `h` = hours, `d` = days, `w` = weeks, `m` = months. */
116
+ export type SlaUnit = 'min' | 'h' | 'd' | 'w' | 'm';
117
+ /** When an escalation fires: as the deadline approaches (`at-risk`) or once it passes (`sla-breached`). */
118
+ export type EscalationTrigger = 'at-risk' | 'sla-breached';
119
+ /** Who an escalation notifies. `scope` picks a single user or a whole group. */
120
+ export interface EscalationRecipient {
121
+ scope: 'User' | 'UserGroup';
122
+ /** The user/group identifier (email, id, or name the tenant resolves). */
123
+ target: string;
124
+ /** Optional display value; defaults to `target` when omitted. */
125
+ value?: string;
126
+ }
127
+ export interface EscalationOpts {
128
+ /** Fire as the deadline nears (`at-risk`) or after it is missed (`sla-breached`). */
129
+ trigger: EscalationTrigger;
130
+ /** Who to notify (at least one). Build with {@link toUser}/{@link toGroup}. */
131
+ notify: EscalationRecipient[];
132
+ /**
133
+ * For an `at-risk` trigger, the percentage of the SLA elapsed when it fires
134
+ * (e.g. `80` = at 80% of the deadline). Defaults to `100` when omitted and
135
+ * is ignored for `sla-breached`.
136
+ */
137
+ atRiskPercentage?: number;
138
+ displayName?: string;
139
+ }
140
+ /** A built escalation (the notification an SLA fires). */
141
+ export interface BuiltEscalation extends EscalationOpts {
142
+ }
143
+ /**
144
+ * Declare an escalation. `notify` recipients come from {@link toUser}/{@link toGroup}.
145
+ *
146
+ * @param opts - When it fires (`after`) and who it notifies (`notify`).
147
+ * @returns An escalation to attach to an SLA.
148
+ */
149
+ export declare function escalation(opts: EscalationOpts): BuiltEscalation;
150
+ /**
151
+ * An escalation recipient that is a single user.
152
+ *
153
+ * @param target - How the user is addressed, e.g. `'email'`.
154
+ * @param value - The address itself, when `target` names a lookup rather than a value.
155
+ * @returns A recipient for an escalation's `notify` list.
156
+ */
157
+ export declare function toUser(target: string, value?: string): EscalationRecipient;
158
+ /**
159
+ * An escalation recipient that is a user group.
160
+ *
161
+ * @param target - How the group is addressed, e.g. `'name'`.
162
+ * @param value - The value itself, when `target` names a lookup rather than a value.
163
+ * @returns A recipient for an escalation's `notify` list.
164
+ */
165
+ export declare function toGroup(target: string, value?: string): EscalationRecipient;
166
+ export interface SlaOpts {
167
+ /** Deadline magnitude (with {@link SlaUnit}). */
168
+ count: number;
169
+ unit: SlaUnit;
170
+ /**
171
+ * A human title, emitted as the SLA's `displayName`. Required to reference this
172
+ * SLA from a `sla-status-change` rule (`rule('sla-status-change', { sla })`).
173
+ * Must be unique across the case and contain no `:`.
174
+ */
175
+ displayName?: string;
176
+ /**
177
+ * A `=js:` gate deciding when this SLA applies — for conditional SLAs (e.g. a
178
+ * tighter deadline for high-priority cases). Omit for the default SLA (the one
179
+ * that always applies); the default must be the LAST `.sla(...)` declared and
180
+ * emits the always-true gate `=js:true`.
181
+ */
182
+ when?: string;
183
+ /** Escalations fired off this deadline. */
184
+ escalations?: BuiltEscalation[];
185
+ }
186
+ /** A built SLA rule (`slaRules[]` entry). */
187
+ export interface BuiltSla {
188
+ count: number;
189
+ unit: SlaUnit;
190
+ displayName?: string;
191
+ /** The `=js:` gate; `=js:true` (always-true) for the default SLA. */
192
+ expression: string;
193
+ escalations: BuiltEscalation[];
194
+ }
195
+ export type CaseTriggerKind = 'manual' | 'timer' | 'event';
196
+ export interface BuiltTrigger {
197
+ kind: CaseTriggerKind;
198
+ /** Node label (defaults to `Trigger <n>` at serialize when omitted). */
199
+ name?: string;
200
+ description?: string;
201
+ /** Timer only: an ISO-8601 repeating interval (see {@link TimerTriggerOpts.every}). */
202
+ timeCycle?: string;
203
+ /** Event only: payload-field extractions onto the trigger's `outputs[]` (see {@link EventTriggerOpts.outputs}). */
204
+ eventOutputs?: TaskOutputBinding[];
205
+ /** Event only: a library-resolved Integration Service subscription. */
206
+ eventSubscription?: EventSubscription;
207
+ }
208
+ export interface ManualTriggerOpts {
209
+ name?: string;
210
+ description?: string;
211
+ }
212
+ export interface TimerTriggerOpts {
213
+ /**
214
+ * The schedule, as an
215
+ * {@link https://docs.digi.com/resources/documentation/digidocs/90001488-13/reference/r_iso_8601_duration_format.htm | ISO-8601 repeating interval}
216
+ * (emitted verbatim as
217
+ * `timeCycle`): `R/PT1H` (every hour, unbounded), `R5/P1D` (5 times, daily), or
218
+ * bounded-with-start `R5/2026-04-26T09:00:00Z/P1D` (5 times, daily from that
219
+ * instant). `R` = repeat, `R<n>` = repeat n times.
220
+ */
221
+ every: string;
222
+ name?: string;
223
+ description?: string;
224
+ }
225
+ /**
226
+ * A manual (user-initiated) case trigger.
227
+ *
228
+ * @param opts - Display name and other trigger metadata.
229
+ * @returns A trigger to pass to `.trigger(...)`.
230
+ */
231
+ export declare function manualTrigger(opts?: ManualTriggerOpts): BuiltTrigger;
232
+ /**
233
+ * A timer (scheduled) case trigger. `every` is an ISO-8601 repeating interval.
234
+ *
235
+ * @param opts - The schedule — `every`, as an ISO-8601 repeating interval.
236
+ * @returns A trigger to pass to `.trigger(...)`.
237
+ */
238
+ export declare function timerTrigger(opts: TimerTriggerOpts): BuiltTrigger;
239
+ export interface EventTriggerOpts {
240
+ name?: string;
241
+ description?: string;
242
+ /**
243
+ * Stringly resolved subscription. Prefer the descriptor overload when a
244
+ * prepared connector module is available. Omit this for the legacy
245
+ * `serviceType`-only placeholder.
246
+ */
247
+ subscription?: EventSubscription;
248
+ /**
249
+ * Optional event-payload extractions. Each key is a case-variable name read
250
+ * downstream as `=vars.<name>`; each value is the payload field expression
251
+ * (`=response.<field>`). Pass `{ source, type }` for a non-`string` type. Each
252
+ * emits a trigger `outputs[]` row plus a readable root `inputOutputs` companion.
253
+ *
254
+ * @remarks
255
+ * With **no** outputs the event trigger is a **placeholder** (`data.inputs`
256
+ * carries only `serviceType`) — the offline shape for an event on a connector
257
+ * not yet registered; attach the real connection after registering it.
258
+ */
259
+ outputs?: Record<string, string | {
260
+ source: string;
261
+ type?: TypeDesc;
262
+ }>;
263
+ }
264
+ /** Options for the typed `eventTrigger(Descriptor, options)` form. */
265
+ export interface ResolvedEventTriggerOpts<W extends Record<string, string> = Record<string, string>> extends TriggerOptions<W> {
266
+ /** Trigger node label. */
267
+ name?: string;
268
+ /** Trigger node description. */
269
+ description?: string;
270
+ /** Event-payload fields to extract into readable case variables. */
271
+ outputs?: Record<string, string | {
272
+ source: string;
273
+ type?: TypeDesc;
274
+ }>;
275
+ }
276
+ /**
277
+ * An Integration Service **event** trigger — an external event (a new row, an
278
+ * email, a webhook) starts the case. A generated descriptor supplies the
279
+ * connector and event identity; serialization resolves its context, inputs,
280
+ * outputs, and root bindings through the connector library.
281
+ *
282
+ * @param descriptor - A generated connector-event descriptor.
283
+ * @param opts - Subscription scope/bindings plus trigger display and output options.
284
+ * @returns A trigger to pass to `.trigger(...)`.
285
+ */
286
+ export declare function eventTrigger<W extends Record<string, string>>(descriptor: TriggerDescriptor<W, unknown>, opts?: ResolvedEventTriggerOpts<W>): BuiltTrigger;
287
+ /**
288
+ * An Integration Service event trigger in placeholder or stringly-resolved form.
289
+ *
290
+ * @param opts - Display/output options and an optional symbolic subscription.
291
+ * @returns A trigger to pass to `.trigger(...)`.
292
+ */
293
+ export declare function eventTrigger(opts?: EventTriggerOpts): BuiltTrigger;
294
+ export interface BuiltEntryCondition {
295
+ displayName?: string;
296
+ isInterrupting?: boolean;
297
+ rules: CaseRule[][];
298
+ }
299
+ export type StageExitType = 'exit-only' | 'wait-for-user' | 'return-to-origin';
300
+ /** Data Fabric entity used by the Case runtime to deliver a person's next-stage selection. */
301
+ export interface SelectNextStageSpec {
302
+ /** Data Fabric entity name. It must expose `instanceId` and `nextStage` string fields. */
303
+ objectName: string;
304
+ /**
305
+ * Optional Integration Service subscription identity. Use this when preserving
306
+ * a designer-authored full connector; the engine itself consumes `objectName`.
307
+ */
308
+ connector?: {
309
+ /** Integration Service connector key, for example `uipath-http-webhook`. */
310
+ connectorKey: string;
311
+ /** Connector event operation, for example `GENERIC`. */
312
+ operation: string;
313
+ /** Symbolic connection name declared in bindings.json. */
314
+ connection?: string;
315
+ /** Symbolic folder name declared in bindings.json. */
316
+ folder?: string;
317
+ };
318
+ }
319
+ export interface BuiltExitCondition {
320
+ displayName?: string;
321
+ marksStageComplete?: boolean;
322
+ /**
323
+ * How the stage leaves. `exit-only` just exits; `wait-for-user` holds the case
324
+ * until a person picks the onward path (pair with a `user-selected-stage` entry
325
+ * on the destinations) — use this when the process must NOT advance on its own;
326
+ * `return-to-origin` goes back where it came from.
327
+ */
328
+ type?: StageExitType;
329
+ /**
330
+ * Symbolic target stage label — the routed destination for THIS exit row.
331
+ * Serialized as `exitToStageId` after label resolution; an unknown label is a
332
+ * hard error at compile.
333
+ *
334
+ * @remarks
335
+ * Multi-way branching: give the stage one `.exitWhen(...)` per outcome, each
336
+ * with its own rules and its own `exitToStage`. The destination stage still
337
+ * needs its own `entryWhen(...)`; routing does not bypass it. Note that
338
+ * `selected-stage-completed`/`-exited` name only the SOURCE STAGE, so several
339
+ * branches out of one stage produce the same entry rule at each destination —
340
+ * gate the destinations on the distinguishing task instead
341
+ * (`selected-tasks-completed`), not on the source stage alone.
342
+ */
343
+ exitToStage?: string;
344
+ /** Configure the runtime select-next-stage bridge for this `wait-for-user` exit. */
345
+ selectNextStage?: SelectNextStageSpec;
346
+ rules: CaseRule[][];
347
+ }
348
+ export interface BuiltTaskEntryCondition {
349
+ displayName?: string;
350
+ rules: CaseRule[][];
351
+ }
352
+ export interface BuiltCaseExitCondition {
353
+ displayName?: string;
354
+ marksCaseComplete?: boolean;
355
+ rules: CaseRule[][];
356
+ }
357
+ export type TaskKind = 'process' | 'agent' | 'rpa' | 'api-workflow' | 'case-management' | 'flow-process' | 'external-agent' | 'external-workflow' | 'action' | 'connector' | 'wait-for-timer' | 'wait-for-connector';
358
+ /** Published-resource task kinds that the Case schema permits as unresolved skeletons. */
359
+ export type UnresolvedReferenceTaskKind = 'process' | 'agent' | 'rpa' | 'api-workflow' | 'case-management';
360
+ /**
361
+ * A `wait-for-connector` subscription: suspend on an Integration Service event.
362
+ * Omit `connectorKey`/`operation` for a bare **placeholder** (for a connector not
363
+ * yet registered — `data.uipath` carries only `serviceType`).
364
+ */
365
+ export interface WaitConnectorPlaceholderSpec {
366
+ /** Connector key, e.g. `uipath-microsoft-outlook365`. */
367
+ connectorKey?: string;
368
+ /** Event operation, e.g. `EMAIL_RECEIVED`. */
369
+ operation?: string;
370
+ }
371
+ /**
372
+ * A placeholder connector/operation pair, or a library-resolved event
373
+ * subscription using the same symbolic shape as Flow `waitForEvent()`.
374
+ */
375
+ export type WaitConnectorSpec = WaitConnectorPlaceholderSpec | EventSubscription;
376
+ /**
377
+ * An Integration Service connector task — the connector variant of the shared
378
+ * `ActionSpec`.
379
+ *
380
+ * @remarks
381
+ * `ActionSpec` is the Flow action union; only its `kind: 'connector'` arm is
382
+ * reachable here, so it is documented in the Flow reference (`api.md`) rather
383
+ * than repeated in this one. Author a connector task with
384
+ * {@link TaskBuilder.connector}, which takes the descriptor and inputs directly.
385
+ */
386
+ export type ConnectorSpecData = Extract<ActionSpec, {
387
+ kind: 'connector';
388
+ }>;
389
+ /** Whether an external Integration Service task blocks for its result or waits for a callback. */
390
+ export type ExternalExecutionMode = 'sync' | 'async';
391
+ /** Required wiring and typed inputs for an external agent/workflow invocation. */
392
+ export interface ExternalTaskOptions<I extends Record<string, unknown>> {
393
+ /** Symbolic Integration Service connection name declared in `bindings.json`. */
394
+ connection: string;
395
+ /** Symbolic Orchestrator folder binding name declared in `bindings.json`. */
396
+ folder: string;
397
+ /** Closed runtime mode; each family lowers this to its exact supported service type. */
398
+ mode: ExternalExecutionMode;
399
+ /** Inputs statically checked by the generated connector descriptor. */
400
+ inputs: I;
401
+ }
402
+ /** Normalized descriptor and execution mode stored on a built external task. */
403
+ export interface ExternalTaskSpecData {
404
+ /** Requested blocking or callback execution mode. */
405
+ mode: ExternalExecutionMode;
406
+ /** Shared connector action identity, inputs, and symbolic bindings. */
407
+ connector: ConnectorSpecData;
408
+ }
409
+ export interface TaskRef {
410
+ name: string;
411
+ folderPath: string;
412
+ }
413
+ /**
414
+ * Action-task recipient type. `2` = a single user by email — the only value the
415
+ * platform corpus exercises for case action tasks; `0`/`1`/`3` are reserved for
416
+ * other assignee kinds. A bare email string on `.action({ recipient })` becomes
417
+ * `{ type: 2, value: email }`.
418
+ */
419
+ export type RecipientType = 0 | 1 | 2 | 3;
420
+ /**
421
+ * One field of an Action Center task's form. **Inputs** are read-only context the
422
+ * assignee sees; **outputs** are the values they fill in. Emitted as a schema
423
+ * `InputOutput` row under `data.inputs[]` / `data.outputs[]`.
424
+ *
425
+ * @remarks
426
+ * `required: true` means this serialized row must already hold a non-empty
427
+ * `value`; it does not mean that the reviewer must fill the field. The source
428
+ * checker and `uip maestro case validate` both reject an empty required row with
429
+ * `EMPTY_REQUIRED_FIELD`. Reviewer input is still modeled by placing the field
430
+ * in `outputs` rather than `inputs`.
431
+ */
432
+ export interface ActionField {
433
+ /** Field key. */
434
+ name: string;
435
+ /** Field type (default `string`). */
436
+ type?: TypeDesc;
437
+ /** UI control subtype, for example `dropdown`. */
438
+ subType?: string;
439
+ /** Human-facing label (defaults to `name` in the UI when omitted). */
440
+ displayName?: string;
441
+ /** Input literal/expression, or the readable variable name for an output field. */
442
+ value?: string;
443
+ /** Require `value` to be non-empty at validation time. */
444
+ required?: boolean;
445
+ /** Dropdown choices, using the product's lower-case `{ value, label }` shape. */
446
+ options?: Array<{
447
+ value: string;
448
+ label: string;
449
+ }>;
450
+ }
451
+ export interface ActionSpecData {
452
+ title?: string;
453
+ priority?: 'Low' | 'Medium' | 'High' | 'Critical';
454
+ recipient?: {
455
+ type: RecipientType;
456
+ value: string;
457
+ };
458
+ /** Action Center labels (persisted as a single `data.labels` string). */
459
+ labels?: string;
460
+ /** The Action Center action-app / catalog this task instantiates. */
461
+ actionCatalogName?: string;
462
+ /** Read-only context fields the assignee sees (`data.inputs[]`). */
463
+ inputs?: ActionField[];
464
+ /** Fields the assignee fills in (`data.outputs[]`). */
465
+ outputs?: ActionField[];
466
+ }
467
+ /** Exactly one product-supported timer value. */
468
+ export type TimerSpecData = {
469
+ duration: string;
470
+ date?: never;
471
+ cycle?: never;
472
+ } | {
473
+ duration?: never;
474
+ date: string;
475
+ cycle?: never;
476
+ } | {
477
+ duration?: never;
478
+ date?: never;
479
+ cycle: string;
480
+ };
481
+ /** A task input binding: a resource input parameter set to a literal or a `=`-expression. */
482
+ export interface TaskInputBinding {
483
+ /** The resource's input parameter name. */
484
+ name: string;
485
+ /** The bound value — a literal, `=vars.<name>`, or a `=js:` expression. */
486
+ value: string;
487
+ type: TypeDesc;
488
+ }
489
+ /**
490
+ * A task output extraction: bind a field of the task's result (`source`) into a
491
+ * case variable (`var`) that later tasks/conditions read as `=vars.<var>`.
492
+ */
493
+ export interface TaskOutputBinding {
494
+ /** The case-variable name the field feeds (read downstream as `=vars.<var>`). */
495
+ var: string;
496
+ /** The source field expression, e.g. `=response` or `=Error.Message`. */
497
+ source: string;
498
+ type: TypeDesc;
499
+ }
500
+ export interface BuiltTask {
501
+ /** Task key + display name (also the handle used by `selected-tasks-completed`). */
502
+ name: string;
503
+ kind: TaskKind;
504
+ ref?: TaskRef;
505
+ action?: ActionSpecData;
506
+ connector?: ConnectorSpecData;
507
+ /** Descriptor-resolved external agent/workflow configuration. */
508
+ external?: ExternalTaskSpecData;
509
+ timer?: TimerSpecData;
510
+ /** wait-for-connector task: the event subscription (placeholder when key/operation omitted). */
511
+ waitConnector?: WaitConnectorSpec;
512
+ required?: boolean;
513
+ runOnce?: boolean;
514
+ description?: string;
515
+ skip?: string;
516
+ /** Reference-mode task input bindings (`data.inputs[]`). */
517
+ inputs?: TaskInputBinding[];
518
+ /** Reference-mode task output extractions (`data.outputs[]` + a readable case-variable companion). */
519
+ outputs?: TaskOutputBinding[];
520
+ entry: BuiltTaskEntryCondition[];
521
+ }
522
+ export interface BuiltStage {
523
+ label: string;
524
+ exception: boolean;
525
+ description?: string;
526
+ required?: boolean;
527
+ lanes: BuiltTask[][];
528
+ entry: BuiltEntryCondition[];
529
+ exit: BuiltExitCondition[];
530
+ slaRules: BuiltSla[];
531
+ }
532
+ /**
533
+ * A structured (object/array) variable type + its JSON-schema `body`, as returned
534
+ * by {@link jsonSchema}. Persists as `type: 'jsonSchema'` with the object/array
535
+ * shape carried in `body.type`.
536
+ */
537
+ export interface JsonSchemaType {
538
+ type: 'jsonSchema';
539
+ body: unknown;
540
+ }
541
+ /**
542
+ * Declare a structured (object/array) variable type. Pass the JSON schema — object
543
+ * vs array is `body.type`. Use in `.var()`/`.input()`/`.output()` where a
544
+ * {@link TypeDesc} is expected.
545
+ *
546
+ * @example
547
+ * **Declare an object variable and an array variable**
548
+ * ```ts
549
+ * .var('caseData', jsonSchema({ type: 'object', properties: { status: { type: 'string' } } }))
550
+ * .var('attachments', jsonSchema({ type: 'array', items: { type: 'string' } }))
551
+ * ```
552
+ *
553
+ * @param body - The JSON schema. Its `type` decides object vs array.
554
+ * @returns A type descriptor for `.var()` / `.input()` / `.output()`.
555
+ */
556
+ export declare function jsonSchema(body: unknown): JsonSchemaType;
557
+ export interface CaseVarDecl {
558
+ name: string;
559
+ type: TypeDesc;
560
+ direction: 'in' | 'out' | 'inout';
561
+ default?: unknown;
562
+ /** For `type: 'jsonSchema'` — the structured var's JSON-schema `body`. */
563
+ body?: unknown;
564
+ /**
565
+ * In-args only: the trigger this argument is bound to (its value arrives when
566
+ * that trigger fires). Set via `.input(shape, { from })`. When present, the arg
567
+ * emits the full three-entry binding (formal slot + companion + trigger-output
568
+ * bridge); when absent it stays a bare declaration.
569
+ */
570
+ sourceTrigger?: BuiltTrigger;
571
+ }
572
+ /** A value displayed in one Case App section. Nested objects and arrays are not supported by the Case App client. */
573
+ export type CaseAppDetailValue = string | number | boolean | null;
574
+ /** One summary section in the generated Case App. */
575
+ export interface CaseAppSection {
576
+ /** Stable wire identity. Omit it to generate a deterministic id from the section's position and title. */
577
+ id?: string;
578
+ /** Heading shown above the section's details. */
579
+ title: string;
580
+ /** At most six primitive values. The serializer writes this map as the JSON-encoded wire string. */
581
+ details: Record<string, CaseAppDetailValue>;
582
+ }
583
+ /** Typed configuration for the generated Case App. */
584
+ export interface CaseAppConfig {
585
+ /** Case summary expression or literal displayed by the Case App. */
586
+ summary: string;
587
+ /** Detail sections displayed by the Case App. */
588
+ sections: CaseAppSection[];
589
+ }
590
+ /** Designer-only fields the shipped Case transformer moves into `layout.nodes[id]`. */
591
+ export interface CaseNodeLayout {
592
+ /** Absolute canvas position. */
593
+ position?: {
594
+ x: number;
595
+ y: number;
596
+ };
597
+ /** Canvas style values retained by the Case designer. */
598
+ style?: Record<string, string | number>;
599
+ /** Size measured by the canvas renderer. */
600
+ measured?: {
601
+ width: number;
602
+ height: number;
603
+ };
604
+ /** Explicit canvas width. */
605
+ width?: number;
606
+ /** Explicit canvas height. */
607
+ height?: number;
608
+ /** Canvas stacking order. */
609
+ zIndex?: number;
610
+ }
611
+ /**
612
+ * Optional Case designer layout, keyed by author-level stage and trigger names.
613
+ * Serialization resolves those names to final node ids after preservation has
614
+ * restored foreign identities. Omitted entries retain their existing/default
615
+ * layout; authored fields override only the same fields on a preserved entry.
616
+ */
617
+ export interface CaseLayout {
618
+ /** Stage node layout keyed by the exact stage label passed to `.stage()`. */
619
+ stages?: Record<string, CaseNodeLayout>;
620
+ /** Trigger node layout keyed by its display name (`Trigger 1` for the default). */
621
+ triggers?: Record<string, CaseNodeLayout>;
622
+ }
623
+ export interface BuiltCase {
624
+ id: string;
625
+ name: string;
626
+ /**
627
+ * The Case JSON format version the document declares — the serializer's write
628
+ * version unless `.schemaVersion()` declared one of the (currently one) other
629
+ * writable versions. `readonly` because it is a grammar claim about the
630
+ * emitted document, not an author release value.
631
+ */
632
+ readonly version: string;
633
+ description?: string;
634
+ identifier: string;
635
+ identifierType: 'constant' | 'external';
636
+ caseAppEnabled: boolean;
637
+ caseAppConfig?: CaseAppConfig;
638
+ /** Whether optional tasks with an `adhoc` entry rule may be started on demand. */
639
+ allowAdhocOptionalStageTasks?: boolean;
640
+ vars: CaseVarDecl[];
641
+ stages: BuiltStage[];
642
+ caseExit: BuiltCaseExitCondition[];
643
+ slaRules: BuiltSla[];
644
+ /** Empty = the default single manual trigger. */
645
+ triggers: BuiltTrigger[];
646
+ /** Optional designer layout, resolved to final node ids by the serializer. */
647
+ layout?: CaseLayout;
648
+ }
649
+ /** Options common to a stage/task entry condition. */
650
+ export interface EntryOpts {
651
+ /**
652
+ * Names the condition. Omit it and the name is derived from the owner —
653
+ * `"<stage> entry"` / `"<task> entry"` — because `uip maestro case validate`
654
+ * requires condition names to be unique across the whole case and rejects a
655
+ * repeat as `CASE_MGMT_RULE_NAME_DUPLICATE`, at error severity. A name given
656
+ * here is emitted verbatim; duplicating one is reported by `case check` as
657
+ * `DUP_RULE_NAME`.
658
+ */
659
+ displayName?: string;
660
+ isInterrupting?: boolean;
661
+ }
662
+ /** Options for `stage.exitWhen(rules, opts)` — one call per outcome. */
663
+ export interface ExitOpts {
664
+ /**
665
+ * Names the condition. Omit it and the name is derived from the owner —
666
+ * `"<stage> complete"`, or `"<stage> exit"` when this exit does not mark the
667
+ * stage complete. See {@link EntryOpts.displayName} for why the default is
668
+ * derived rather than constant.
669
+ */
670
+ displayName?: string;
671
+ /** Mark the stage complete on this exit. Every stage needs at least one. */
672
+ marksStageComplete?: boolean;
673
+ /**
674
+ * `wait-for-user` holds the case until a person chooses the onward path — use it
675
+ * when the process must not advance by itself. See {@link StageExitType}.
676
+ */
677
+ type?: StageExitType;
678
+ /**
679
+ * Route this exit to a named stage (a stage LABEL). For multi-way branching give
680
+ * the stage one `.exitWhen(...)` per outcome, each with its own rules and
681
+ * `exitToStage` — including backward edges (returning to an earlier stage is just
682
+ * an exit that routes there).
683
+ *
684
+ * @remarks
685
+ * The destination still evaluates its own `entryWhen(...)`. At the product pin,
686
+ * `selected-tasks-completed` is valid at stage entry when its `{ tasks: [...] }`
687
+ * payload resolves; use it when a source-stage task identifies the branch. The
688
+ * checker validates those task references separately from placement legality.
689
+ * For a human-chosen path use `type: 'wait-for-user'` here plus a
690
+ * `user-selected-stage` entry on each destination.
691
+ */
692
+ exitToStage?: string;
693
+ /**
694
+ * Enable the runtime select-next-stage API for this `wait-for-user` exit.
695
+ * `objectName` is the Data Fabric entity that receives `{ instanceId, nextStage }`.
696
+ */
697
+ selectNextStage?: SelectNextStageSpec;
698
+ }
699
+ declare class TaskBuilder {
700
+ private readonly _name;
701
+ private _kind?;
702
+ private _ref?;
703
+ private _action?;
704
+ private _connector?;
705
+ private _external?;
706
+ private _timer?;
707
+ private _waitConnector?;
708
+ private _required?;
709
+ private _runOnce?;
710
+ private _description?;
711
+ private _skip?;
712
+ private _inputs?;
713
+ private _outputs?;
714
+ private readonly _entry;
715
+ constructor(_name: string);
716
+ private setKind;
717
+ private reference;
718
+ /**
719
+ * Reference a published Maestro process.
720
+ *
721
+ * @param name - The published process's name.
722
+ * @param opts - `folder` — the Orchestrator folder it lives in.
723
+ * @returns This builder, so calls chain.
724
+ */
725
+ process(name: string, opts?: {
726
+ folder?: string;
727
+ }): this;
728
+ /**
729
+ * Preserve an explicitly unresolved published-resource task as a typed
730
+ * skeleton whose serialized `data` is `{}`.
731
+ *
732
+ * @remarks
733
+ * Use this only when the requested resource identity cannot be resolved.
734
+ * Do not invent a name or folder. An unresolved task cannot declare input or
735
+ * output bindings because there is no referenced contract to bind against.
736
+ *
737
+ * @param kind - The published-resource family to preserve.
738
+ * @returns This builder, so calls chain.
739
+ */
740
+ unresolved(kind: UnresolvedReferenceTaskKind): this;
741
+ /**
742
+ * Reference a published agent.
743
+ *
744
+ * @param name - The published agent's name.
745
+ * @param opts - `folder` — the Orchestrator folder it lives in.
746
+ * @returns This builder, so calls chain.
747
+ */
748
+ agent(name: string, opts?: {
749
+ folder?: string;
750
+ }): this;
751
+ /**
752
+ * Reference a published RPA process.
753
+ *
754
+ * @param name - The published RPA process's name.
755
+ * @param opts - `folder` — the Orchestrator folder it lives in.
756
+ * @returns This builder, so calls chain.
757
+ */
758
+ rpa(name: string, opts?: {
759
+ folder?: string;
760
+ }): this;
761
+ /**
762
+ * Reference a published API workflow.
763
+ *
764
+ * @param name - The published API workflow's name.
765
+ * @param opts - `folder` — the Orchestrator folder it lives in.
766
+ * @returns This builder, so calls chain.
767
+ */
768
+ apiWorkflow(name: string, opts?: {
769
+ folder?: string;
770
+ }): this;
771
+ /**
772
+ * Reference another published case (a **sub-case**). Pass data into the child
773
+ * with `.inputs({...})` and read results back with `.outputs({...})` — the same
774
+ * io-binding as reference-mode tasks.
775
+ *
776
+ * @param name - The published child case's name.
777
+ * @param opts - `folder` — the Orchestrator folder it lives in.
778
+ * @returns This builder, so calls chain.
779
+ */
780
+ caseManagement(name: string, opts?: {
781
+ folder?: string;
782
+ }): this;
783
+ /**
784
+ * Reference a published Maestro Flow.
785
+ *
786
+ * @param name - The published Flow's name.
787
+ * @param opts - `folder` — the Orchestrator folder it lives in.
788
+ * @returns This builder, so calls chain.
789
+ */
790
+ flowProcess(name: string, opts?: {
791
+ folder?: string;
792
+ }): this;
793
+ private external;
794
+ /**
795
+ * Invoke an external agent through its generated Integration Service descriptor.
796
+ *
797
+ * @param descriptor - An `AgentExecution` operation from a generated connector module.
798
+ * @param opts - Required connection/folder bindings, sync/async mode, and descriptor-typed inputs.
799
+ * @returns This builder, so calls chain.
800
+ */
801
+ externalAgent<I extends Record<string, unknown>, O>(descriptor: ConnectorDescriptor<I, O>, opts: ExternalTaskOptions<I>): this;
802
+ /**
803
+ * Invoke an external workflow through its generated Integration Service descriptor.
804
+ *
805
+ * @param descriptor - A `ProcessExecution` operation from a generated connector module.
806
+ * @param opts - Required connection/folder bindings, sync/async mode, and descriptor-typed inputs.
807
+ * @returns This builder, so calls chain.
808
+ */
809
+ externalWorkflow<I extends Record<string, unknown>, O>(descriptor: ConnectorDescriptor<I, O>, opts: ExternalTaskOptions<I>): this;
810
+ /**
811
+ * An Action Center human task. `recipient` may be an email (→ Type 2) or
812
+ * `{ type, value }`. `inputs`/`outputs` declare the task's form fields — inputs
813
+ * are read-only context the assignee sees, outputs are what they fill in.
814
+ * `labels` and `actionCatalogName` tag the task and name its action app.
815
+ *
816
+ * @param spec - The human task: its `title`, `priority`, `recipient`, and the `inputs` / `outputs` its form shows and collects.
817
+ * @returns This builder, so calls chain.
818
+ */
819
+ action(spec?: {
820
+ title?: string;
821
+ priority?: 'Low' | 'Medium' | 'High' | 'Critical';
822
+ recipient?: string | {
823
+ type: RecipientType;
824
+ value: string;
825
+ };
826
+ labels?: string;
827
+ actionCatalogName?: string;
828
+ inputs?: ActionField[];
829
+ outputs?: ActionField[];
830
+ }): this;
831
+ /**
832
+ * An Integration Service connector task — runs a connector activity (e.g. Slack
833
+ * `send-message-to-channel`) — the typed form, where a generated descriptor
834
+ * supplies the operation and its input types.
835
+ *
836
+ * @remarks
837
+ * Same surface as the Flow `connector()` action: pass a generated descriptor
838
+ * (typed inputs) or `key`/`action` strings, plus the connector inputs and
839
+ * `{ connection, folder }` bindings.
840
+ *
841
+ * @param descriptor - The generated operation, from a prepared connector module.
842
+ * @param inputs - The activity's inputs, typed by the descriptor.
843
+ * @param opts - Symbolic `connection` / `folder`, an action `version`, and the
844
+ * `object` a generic operation addresses.
845
+ * @returns This builder, so calls chain.
846
+ */
847
+ connector<I extends Record<string, unknown>, O>(descriptor: ConnectorDescriptor<I, O>, inputs: I, opts?: ConnectorOpts): this;
848
+ /**
849
+ * Stringly form, for a connector with no prepared module.
850
+ *
851
+ * @param key - The connector library key, e.g. `'uipath-salesforce-slack'`.
852
+ * @param action - The operation id, e.g. `'send-message-to-channel'`.
853
+ * @param inputs - The activity's inputs.
854
+ * @param opts - Symbolic `connection` / `folder`, an action `version`, and the
855
+ * `object` a generic operation addresses.
856
+ * @returns This builder, so calls chain.
857
+ */
858
+ connector(key: string, action: string, inputs?: Record<string, unknown>, opts?: ConnectorOpts): this;
859
+ /**
860
+ * A wait-for-connector task — suspend the stage until an Integration Service
861
+ * **event** fires. A generated descriptor supplies the connector/event identity;
862
+ * serialization resolves its full subscription through the connector library.
863
+ *
864
+ * @param descriptor - A generated connector-event descriptor.
865
+ * @param opts - Subscription scope plus symbolic connection/folder bindings.
866
+ * @returns This builder, so calls chain.
867
+ */
868
+ waitForConnector<W extends Record<string, string>>(descriptor: TriggerDescriptor<W, unknown>, opts?: TriggerOptions<W>): this;
869
+ /**
870
+ * A wait-for-connector task in placeholder or stringly-resolved form.
871
+ *
872
+ * @param spec - Omit for a placeholder, pass `connectorKey`/`operation` for the legacy named placeholder,
873
+ * or pass a symbolic `{ connector, event, ... }` subscription for library resolution.
874
+ * @returns This builder, so calls chain.
875
+ */
876
+ waitForConnector(spec?: WaitConnectorSpec): this;
877
+ /**
878
+ * A wait-for-timer task (ISO-8601 `duration`, ISO `date`, or repeating `cycle`).
879
+ *
880
+ * @param spec - How long to wait: an ISO-8601 `duration`, a `date`, or a repeating `cycle`.
881
+ * @returns This builder, so calls chain.
882
+ */
883
+ waitForTimer(spec: TimerSpecData): this;
884
+ /**
885
+ * Mark this task required, so its stage cannot complete without it.
886
+ *
887
+ * @param value - Whether the task is required.
888
+ * @returns This builder, so calls chain.
889
+ */
890
+ required(value?: boolean): this;
891
+ /**
892
+ * Run this task at most once, even if its entry condition is met again.
893
+ *
894
+ * @param value - Whether the task runs only once.
895
+ * @returns This builder, so calls chain.
896
+ */
897
+ runOnce(value?: boolean): this;
898
+ /**
899
+ * Run this task again whenever its entry condition is met after stage re-entry.
900
+ * This is the semantic inverse of {@link TaskBuilder.runOnce} and emits an explicit
901
+ * `shouldRunOnlyOnce: false`.
902
+ *
903
+ * @returns This builder, so calls chain.
904
+ */
905
+ runOnReEntry(): this;
906
+ /**
907
+ * Describe this task.
908
+ *
909
+ * @param text - Prose the designer shows on the task.
910
+ * @returns This builder, so calls chain.
911
+ */
912
+ description(text: string): this;
913
+ /**
914
+ * Skip this task when the `=js:` expression is truthy.
915
+ *
916
+ * @param expression - An `=js:` expression; the task is skipped when it is truthy.
917
+ * @returns This builder, so calls chain.
918
+ */
919
+ skipWhen(expression: string): this;
920
+ /**
921
+ * Bind resource **input** parameters (reference-mode tasks). Each key is a
922
+ * declared input parameter name; each value is a literal, a case-variable read
923
+ * `=vars.<name>`, or a `=js:` expression. Pass `{ value, type }` to set a
924
+ * non-string type (default `string`).
925
+ *
926
+ * @param shape - Input parameter names to literals, case-variable references, or `{ value, type }`.
927
+ * @returns This builder, so calls chain.
928
+ */
929
+ inputs(shape: Record<string, string | {
930
+ value: string;
931
+ type?: TypeDesc;
932
+ }>): this;
933
+ /**
934
+ * Extract fields of the task's **result** into case variables (reference-mode
935
+ * tasks). Each key is the case-variable name a later task/condition reads as
936
+ * `=vars.<name>`; each value is the source field expression (e.g. `=response`,
937
+ * `=Error.Message`). Pass `{ source, type }` to set a non-string type. Emits a
938
+ * `data.outputs[]` row plus a root `inputOutputs` companion so the name resolves.
939
+ *
940
+ * @param shape - Case-variable names to the result field they take, or `{ source, type }`.
941
+ * @returns This builder, so calls chain.
942
+ */
943
+ outputs(shape: Record<string, string | {
944
+ source: string;
945
+ type?: TypeDesc;
946
+ }>): this;
947
+ /**
948
+ * Add a task-entry condition. Pass a nested array for the complete OR-of-AND grid.
949
+ *
950
+ * @param rules - One rule, an AND-group, or the complete OR-of-AND grid.
951
+ * @param opts - `displayName` for the condition.
952
+ * @returns This builder, so calls chain.
953
+ */
954
+ entryWhen(rules: CaseRuleGrid, opts?: {
955
+ displayName?: string;
956
+ }): this;
957
+ /** @internal */
958
+ _build(): BuiltTask;
959
+ }
960
+ declare class StageBuilder {
961
+ private readonly _label;
962
+ private readonly _exception;
963
+ private _description?;
964
+ private _required?;
965
+ private readonly _lanes;
966
+ private readonly _entry;
967
+ private readonly _exit;
968
+ private readonly _sla;
969
+ constructor(_label: string, _exception: boolean);
970
+ /**
971
+ * Describe this stage.
972
+ *
973
+ * @param text - Prose the designer shows on the stage.
974
+ * @returns This builder, so calls chain.
975
+ */
976
+ description(text: string): this;
977
+ /**
978
+ * Mark this stage required, so the case cannot complete without it.
979
+ *
980
+ * @param value - Whether the stage is required.
981
+ * @returns This builder, so calls chain.
982
+ */
983
+ required(value?: boolean): this;
984
+ /**
985
+ * Add a task. `fn` receives a task sub-builder. `lane` is the index of the
986
+ * task's SET in `data.tasks[][]` (default 0) and orders SEQUENTIAL sets — a
987
+ * task whose entry conditions are all `runs-sequentially` waits for the
988
+ * previous set. It does NOT make tasks parallel: every other task runs when
989
+ * its own entry condition fires, whatever set it sits in.
990
+ *
991
+ * Two tasks on `current-stage-entered` therefore convert to byte-identical
992
+ * scheduler rules whether they share a set or not, and the designer writes
993
+ * one task per set even for a stage its own SDD calls parallel.
994
+ *
995
+ * @param displayName - The task's display name.
996
+ * @param fn - Receives a sub-builder for what the task does.
997
+ * @param opts - `lane` is the task's set index in `data.tasks[][]` (default 0);
998
+ * it orders `runs-sequentially` sets and is inert for every other task.
999
+ * @returns This builder, so calls chain.
1000
+ */
1001
+ task(displayName: string, fn: (t: TaskBuilder) => void, opts?: {
1002
+ lane?: number;
1003
+ }): this;
1004
+ /**
1005
+ * Add a stage-entry condition. Pass a nested array for the complete OR-of-AND grid.
1006
+ *
1007
+ * @param rules - One rule, an AND-group, or the complete OR-of-AND grid.
1008
+ * @param opts - `displayName`, and the entry behaviour flags.
1009
+ * @returns This builder, so calls chain.
1010
+ */
1011
+ entryWhen(rules: CaseRuleGrid, opts?: EntryOpts): this;
1012
+ /**
1013
+ * Add a stage-exit condition. Pass a nested array for the complete OR-of-AND grid.
1014
+ *
1015
+ * @param rules - One rule, an AND-group, or the complete OR-of-AND grid.
1016
+ * @param opts - `displayName`, and whether meeting it completes the stage.
1017
+ * @returns This builder, so calls chain.
1018
+ */
1019
+ exitWhen(rules: CaseRuleGrid, opts?: ExitOpts): this;
1020
+ /**
1021
+ * Set an SLA (deadline + escalations) on this stage. Call more than once for
1022
+ * conditional SLAs (each with a `when` gate); the default SLA (no `when`) must
1023
+ * be last.
1024
+ *
1025
+ * @param opts - The deadline, its escalations, and an optional `when` gate.
1026
+ * @returns This builder, so calls chain.
1027
+ */
1028
+ sla(opts: SlaOpts): this;
1029
+ /** @internal */
1030
+ _build(): BuiltStage;
1031
+ }
1032
+ declare class CaseBuilder {
1033
+ private readonly _id;
1034
+ private _name;
1035
+ private _authoredVersion?;
1036
+ private _schemaVersion?;
1037
+ private _description?;
1038
+ private _identifier?;
1039
+ private _identifierType;
1040
+ private _caseApp;
1041
+ private _caseAppConfig?;
1042
+ private _allowAdhocTasks?;
1043
+ private _layout?;
1044
+ private readonly _vars;
1045
+ private readonly _stages;
1046
+ private readonly _caseExit;
1047
+ private readonly _sla;
1048
+ private readonly _triggers;
1049
+ constructor(_id: string);
1050
+ /**
1051
+ * Set the case plan's display name.
1052
+ *
1053
+ * @param n - The name the designer shows.
1054
+ * @returns This builder, so calls chain.
1055
+ */
1056
+ name(n: string): this;
1057
+ /**
1058
+ * Set the case plan's schema version during the compatibility window.
1059
+ *
1060
+ * @deprecated Use {@link CaseBuilder.schemaVersion}, which declares the same
1061
+ * concept and accepts only versions this build can actually write. This call
1062
+ * was never a switch: it recorded a requested version that `check()` then
1063
+ * compared against the serializer's profile.
1064
+ * @param v - The legacy requested schema version.
1065
+ * @returns This builder, so calls chain.
1066
+ */
1067
+ version(v: string): this;
1068
+ /**
1069
+ * Declare the Case JSON SCHEMA version this plan targets.
1070
+ *
1071
+ * @remarks
1072
+ * The top-level `version` of a `caseplan.json` is a claim that the whole
1073
+ * document matches that grammar — `@uipath/case-schema` ships one closed
1074
+ * schema per version — so this accepts only what the serializer can emit,
1075
+ * currently `30.0.0` alone. Omit it and the plan declares the same thing;
1076
+ * declaring it explicitly is what lets `case-decompile` PRESERVE the version
1077
+ * it read rather than re-stamping the SDK's own default, so a later write-floor
1078
+ * bump cannot silently upgrade a document a decompile already captured.
1079
+ *
1080
+ * Case has no `migrate` command: documents move forward on read, through the
1081
+ * platform's feature-flag-gated chain. An older version is therefore refused
1082
+ * with the reason rather than written onto V30 bytes.
1083
+ *
1084
+ * @example
1085
+ * ```ts
1086
+ * casePlan('claims').schemaVersion('30.0.0')
1087
+ * ```
1088
+ *
1089
+ * @param version - A writable Case JSON schema version, e.g. `'30.0.0'`.
1090
+ * @returns This builder, so calls chain.
1091
+ * @throws Error when this SDK build cannot write `version`.
1092
+ * @defaultValue `'30.0.0'` — `CASE_FORMAT_PROFILE.writeVersion`.
1093
+ */
1094
+ schemaVersion(version: string): this;
1095
+ /**
1096
+ * Describe the case plan.
1097
+ *
1098
+ * @param text - Prose the designer shows alongside the plan.
1099
+ * @returns This builder, so calls chain.
1100
+ */
1101
+ description(text: string): this;
1102
+ /**
1103
+ * Set the runtime case identifier (constant prefix, or an `=`-expression when type is `external`).
1104
+ *
1105
+ * @param id - The prefix, or an `=`-expression when `type` is `'external'`.
1106
+ * @param type - `'constant'` for a fixed prefix, `'external'` to compute it.
1107
+ * @returns This builder, so calls chain.
1108
+ */
1109
+ identifier(id: string, type?: 'constant' | 'external'): this;
1110
+ /**
1111
+ * Turn the generated Case App on or off, or configure its summary and sections.
1112
+ *
1113
+ * Section `details` are authored as a map of at most six primitive values; the
1114
+ * serializer JSON-encodes that map into the shipped wire string. Configuring a
1115
+ * Case App enables it. The platform-owned Case App version markers are never
1116
+ * inferred by this method.
1117
+ *
1118
+ * @example
1119
+ * **Configure a summary and one detail section**
1120
+ * ```ts
1121
+ * .caseApp({
1122
+ * summary: '=js:vars.summary',
1123
+ * sections: [{ title: 'Amounts', details: { total: '=js:vars.total', urgent: true } }],
1124
+ * })
1125
+ * ```
1126
+ *
1127
+ * @param enabledOrConfig - A boolean toggle, or the typed Case App configuration.
1128
+ * @returns This builder, so calls chain.
1129
+ */
1130
+ caseApp(enabledOrConfig?: boolean | CaseAppConfig): this;
1131
+ /**
1132
+ * Enable optional tasks whose entry rule is `adhoc`, allowing them to be
1133
+ * started through the Case ad-hoc message contract.
1134
+ *
1135
+ * @param enabled - Whether ad-hoc optional-stage tasks are enabled.
1136
+ * @returns This builder, so calls chain.
1137
+ */
1138
+ allowAdhocTasks(enabled?: boolean): this;
1139
+ /**
1140
+ * Set optional designer layout for stages and triggers by their author-level
1141
+ * names. This metadata does not affect Case behavior. Unknown or ambiguous
1142
+ * names fail serialization rather than being silently dropped.
1143
+ *
1144
+ * When editing a decompiled foreign Case, an authored field wins only for the
1145
+ * named node and field; all other preserved layout bytes remain untouched.
1146
+ *
1147
+ * @example
1148
+ * **Move a stage and a named trigger**
1149
+ * ```ts
1150
+ * .layout({
1151
+ * stages: { Intake: { position: { x: 160, y: 120 } } },
1152
+ * triggers: { 'Order received': { position: { x: 40, y: 120 } } },
1153
+ * })
1154
+ * ```
1155
+ *
1156
+ * @param layout - Stage and trigger layout keyed by their exact display names.
1157
+ * @returns This builder, so calls chain.
1158
+ */
1159
+ layout(layout: CaseLayout): this;
1160
+ /**
1161
+ * Declare case In-args. Each value is a {@link TypeDesc}, or `{ type, default }`
1162
+ * to set a default. Pass `{ from: <trigger> }` to bind the args to a trigger —
1163
+ * their value arrives when it fires, readable as `=vars.<name>` — and they are
1164
+ * projected into that trigger's `entry-points.json` input schema. A declared
1165
+ * In-arg is readable as `=vars.<name>` (its `inputOutputs` companion resolves it).
1166
+ *
1167
+ * @example
1168
+ * **Bind case In-args to a trigger's payload**
1169
+ * ```ts
1170
+ * const t = manualTrigger();
1171
+ * casePlan('x').trigger(t)
1172
+ * .input({ claimId: 'string', riskScore: { type: 'float', default: '1.5' } }, { from: t })
1173
+ * ```
1174
+ *
1175
+ * @param shape - In-arg names to types, or `{ type, default }`.
1176
+ * @param opts - `{ from: <trigger> }` binds the args to a trigger's payload.
1177
+ * @returns This builder, so calls chain.
1178
+ */
1179
+ input(shape: Record<string, TypeDesc | JsonSchemaType | {
1180
+ type: TypeDesc;
1181
+ default?: unknown;
1182
+ body?: unknown;
1183
+ }>, opts?: {
1184
+ from?: BuiltTrigger;
1185
+ }): this;
1186
+ /**
1187
+ * Declare case Out-args. Each value is a {@link TypeDesc}, or `{ type, default }`
1188
+ * to set a default. Out-args are readable as `=vars.<name>` and projected into
1189
+ * every trigger's `entry-points.json` output schema (with their default).
1190
+ *
1191
+ * @param shape - Out-arg names to types, or `{ type, default }`.
1192
+ * @returns This builder, so calls chain.
1193
+ */
1194
+ output(shape: Record<string, TypeDesc | JsonSchemaType | {
1195
+ type: TypeDesc;
1196
+ default?: unknown;
1197
+ body?: unknown;
1198
+ }>): this;
1199
+ /**
1200
+ * Declare a read/write case variable.
1201
+ *
1202
+ * @remarks
1203
+ * Readable from a `=js:vars.<name>` expression, like a trigger-bound In-arg.
1204
+ *
1205
+ * This comment used to say the opposite — that only `.input(shape, { from })`
1206
+ * could be read, and that a bare `.var()` failed `uip maestro case validate`
1207
+ * with "Variable 'vars.<name>' does not exist". That was true when written and
1208
+ * stopped being true at #257, which made the serializer emit the `inputOutputs`
1209
+ * companion (`id: <name>`, `elementId: "root"`) the platform resolves
1210
+ * `vars.<name>` against. `check` carried a matching `VAR_NOT_REFERENCEABLE`
1211
+ * error and dropped it for the same reason.
1212
+ *
1213
+ * Binding is about WHEN a value arrives, not whether it can be read. An
1214
+ * UNDECLARED `vars.<x>` is still a hard error, thrown by `.build()`.
1215
+ *
1216
+ * @param name - The variable's name; read it as `=vars.<name>`.
1217
+ * @param type - A `types.*` descriptor, or {@link jsonSchema} for a structured one.
1218
+ * @param defaultValue - Its initial value. Non-string values are JSON-encoded
1219
+ * before emission because the Case artifact contract stores every default as
1220
+ * a string. Omit it to start unset.
1221
+ * @returns This builder, so calls chain.
1222
+ */
1223
+ var(name: string, type: TypeDesc | JsonSchemaType, defaultValue?: unknown): this;
1224
+ /**
1225
+ * Add a case trigger (what starts the case). Call more than once for
1226
+ * multiple triggers; the first is the primary. Omit entirely for the default
1227
+ * single manual trigger. Build specs with {@link manualTrigger}/{@link timerTrigger}.
1228
+ *
1229
+ * @param t - A trigger from `manualTrigger` / `timerTrigger` / `eventTrigger`.
1230
+ * @returns This builder, so calls chain.
1231
+ */
1232
+ trigger(t: BuiltTrigger): this;
1233
+ /**
1234
+ * Add a primary stage. `fn` receives a stage sub-builder.
1235
+ *
1236
+ * @param label - The stage's display name.
1237
+ * @param fn - Receives a sub-builder for the stage's tasks and conditions.
1238
+ * @returns This builder, so calls chain.
1239
+ */
1240
+ stage(label: string, fn: (s: StageBuilder) => void): this;
1241
+ /**
1242
+ * Add a secondary/exception stage (`case-management:Stage` with `data.stageType: "secondary"`).
1243
+ *
1244
+ * @param label - The stage's display name.
1245
+ * @param fn - Receives a sub-builder for the stage's tasks and conditions.
1246
+ * @returns This builder, so calls chain.
1247
+ */
1248
+ exceptionStage(label: string, fn: (s: StageBuilder) => void): this;
1249
+ /**
1250
+ * Add a case-completion rule (`metadata.caseExitRules`, `marksCaseComplete: true` by default).
1251
+ *
1252
+ * @param rules - One rule, an AND-group, or the complete OR-of-AND grid.
1253
+ * @param opts - `displayName`, and whether meeting it completes the case.
1254
+ * @returns This builder, so calls chain.
1255
+ */
1256
+ completeWhen(rules: CaseRuleGrid, opts?: {
1257
+ displayName?: string;
1258
+ marksCaseComplete?: boolean;
1259
+ }): this;
1260
+ /**
1261
+ * Set a case-level SLA (deadline + escalations for the whole case), emitted to
1262
+ * `metadata.slaRules`. Call more than once for conditional SLAs; the default
1263
+ * (no `when`) must be last.
1264
+ *
1265
+ * @param opts - The deadline, its escalations, and an optional `when` gate.
1266
+ * @returns This builder, so calls chain.
1267
+ */
1268
+ sla(opts: SlaOpts): this;
1269
+ /**
1270
+ * Finish the plan and return the description the serializer writes.
1271
+ *
1272
+ * @returns The built case — its stages, tasks, triggers and variables.
1273
+ */
1274
+ build(): BuiltCase;
1275
+ }
1276
+ /**
1277
+ * Start building a case plan with the given id. (`casePlan`, not `case` — reserved word.)
1278
+ *
1279
+ * @param id - The plan's stable identifier.
1280
+ * @returns A {@link CaseBuilder} to declare stages and tasks on.
1281
+ */
1282
+ export declare function casePlan(id: string): CaseBuilder;