@uipath/maestro-builder-sdk 6.24.0 → 6.25.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/dist/api-index.md +115 -115
- package/dist/api-members.md +351 -351
- package/dist/check.js +1 -392
- package/dist/core/actions.d.ts +0 -304
- package/dist/core/actions.js +0 -54
- package/dist/core/form-field-type.d.ts +16 -0
- package/dist/core/form-field-type.js +33 -0
- package/dist/core/hitl-routing.d.ts +17 -3
- package/dist/core/stable-id.d.ts +9 -0
- package/dist/core/stable-id.js +16 -0
- package/dist/core/step-ports.d.ts +25 -1
- package/dist/core/step-ports.js +6 -47
- package/dist/core/typed-raw-node.js +0 -8
- package/dist/decompile.js +7 -191
- package/dist/flow-node-registry.js +2 -1
- package/dist/flow-node-type.d.ts +45 -1
- package/dist/flow-sdk.d.ts +1 -0
- package/dist/flow-sdk.js +1 -0
- package/dist/flow-step-exits.js +1 -1
- package/dist/nodes/hitl/flow/check.d.ts +38 -0
- package/dist/nodes/hitl/flow/check.js +357 -0
- package/dist/nodes/hitl/flow/factories.d.ts +58 -0
- package/dist/nodes/hitl/flow/factories.js +59 -0
- package/dist/nodes/hitl/flow/family.d.ts +3 -0
- package/dist/nodes/hitl/flow/family.js +8 -0
- package/dist/nodes/hitl/flow/index.d.ts +3 -0
- package/dist/nodes/hitl/flow/index.js +3 -0
- package/dist/nodes/hitl/flow/node-type.d.ts +7 -0
- package/dist/nodes/hitl/flow/node-type.js +601 -0
- package/dist/nodes/hitl/flow/spec.d.ts +265 -0
- package/dist/nodes/hitl/flow/spec.js +1 -0
- package/dist/serialize.d.ts +2 -4
- package/dist/serialize.js +35 -344
- package/package.json +2 -2
package/dist/core/actions.d.ts
CHANGED
|
@@ -106,254 +106,6 @@ export interface InOutField {
|
|
|
106
106
|
required?: boolean;
|
|
107
107
|
}
|
|
108
108
|
export type FormField = ShownField | AskedField | InOutField;
|
|
109
|
-
/**
|
|
110
|
-
* Where the task is delivered. The four ids are the platform's own — including
|
|
111
|
-
* the lowercase `'teams'`, which is how every deployed recipient spells
|
|
112
|
-
* Microsoft Teams (the canvas's channel list, `hitl-types.ts`).
|
|
113
|
-
*/
|
|
114
|
-
export type HitlChannel = 'Slack' | 'teams' | 'Email' | 'ActionCenter';
|
|
115
|
-
/**
|
|
116
|
-
* How the task is assigned, the platform's own vocabulary (canvas
|
|
117
|
-
* `HITL_ASSIGNEE_TYPE`): `'user'` a single user, `'group'` all users of a
|
|
118
|
-
* group, `'staticEmail'`/`'staticGroupName'` literal values instead of
|
|
119
|
-
* directory picks, `'workload'`/`'roundRobin'` distribution over a group, and
|
|
120
|
-
* `'custom'` an expression the engine evaluates (`value` holds it).
|
|
121
|
-
*/
|
|
122
|
-
export type HitlAssigneeType = 'user' | 'group' | 'staticEmail' | 'staticGroupName' | 'workload' | 'roundRobin' | 'custom';
|
|
123
|
-
/** A per-channel Integration Service connection (Slack / Teams delivery). */
|
|
124
|
-
export interface HitlConnection {
|
|
125
|
-
/** The connection's display name. */
|
|
126
|
-
name?: string | null;
|
|
127
|
-
/** The connection key the engine resolves, e.g. `'Slack'` for the default. */
|
|
128
|
-
key: string;
|
|
129
|
-
/** Folder the connection lives in; `null` for tenant-level defaults. */
|
|
130
|
-
folderPath?: string | null;
|
|
131
|
-
}
|
|
132
|
-
/**
|
|
133
|
-
* Who gets the task and over which channels. Omit the whole object for the
|
|
134
|
-
* definition's default (Email + Action Center, assigned to a group) — which is
|
|
135
|
-
* what 203 of 233 deployed v1 human tasks carry, and what this SDK has always
|
|
136
|
-
* emitted.
|
|
137
|
-
*
|
|
138
|
-
* ```ts
|
|
139
|
-
* hitl({
|
|
140
|
-
* recipient: {
|
|
141
|
-
* channels: ['Email', 'ActionCenter'],
|
|
142
|
-
* assignee: { type: 'user', value: 'reviewer@acme.test' },
|
|
143
|
-
* },
|
|
144
|
-
* …
|
|
145
|
-
* })
|
|
146
|
-
* ```
|
|
147
|
-
*/
|
|
148
|
-
export interface HitlRecipient {
|
|
149
|
-
/** Delivery channels. Defaults to the emitted definition's own default set. */
|
|
150
|
-
channels?: HitlChannel[];
|
|
151
|
-
/** Who the task is assigned to. */
|
|
152
|
-
assignee: {
|
|
153
|
-
type: HitlAssigneeType;
|
|
154
|
-
/**
|
|
155
|
-
* The user email / group name / expression, per `type`. The engine lowers
|
|
156
|
-
* this to its `{ Value, Type }` recipient contract; without one the task
|
|
157
|
-
* falls back to the tenant's assignment default.
|
|
158
|
-
*/
|
|
159
|
-
value?: string;
|
|
160
|
-
/** Display name the designer shows next to the pick. Cosmetic. */
|
|
161
|
-
displayName?: string;
|
|
162
|
-
};
|
|
163
|
-
/**
|
|
164
|
-
* Per-channel connections, keyed by channel id (`Slack` / `teams`). Only the
|
|
165
|
-
* connector-backed channels take one; Email and Action Center do not.
|
|
166
|
-
*/
|
|
167
|
-
connections?: Partial<Record<'Slack' | 'teams', HitlConnection>>;
|
|
168
|
-
}
|
|
169
|
-
/**
|
|
170
|
-
* The Document Validation task's subject — `variant: 'document-validation'`
|
|
171
|
-
* only. The reviewer gets the platform's validation station (or a custom app
|
|
172
|
-
* with a Validation Control) over a document and its extraction result.
|
|
173
|
-
*/
|
|
174
|
-
export interface DocValidationInputs {
|
|
175
|
-
/**
|
|
176
|
-
* The extraction result to validate — bind the `ExtractionResult` output of
|
|
177
|
-
* an upstream Extract step, e.g. `out('extract', 'ExtractionResult')`.
|
|
178
|
-
* Required: the station has nothing to validate without it.
|
|
179
|
-
*/
|
|
180
|
-
extractionResult: Expr | string;
|
|
181
|
-
/** Storage bucket id holding the document. */
|
|
182
|
-
storageBucket?: string;
|
|
183
|
-
/** The document's id within the bucket. */
|
|
184
|
-
documentId?: string;
|
|
185
|
-
/**
|
|
186
|
-
* `'standard'` (default) for the native validation station, `'custom'` for a
|
|
187
|
-
* custom app with a Validation Control — which then requires `taxonomy`.
|
|
188
|
-
*/
|
|
189
|
-
render?: 'standard' | 'custom';
|
|
190
|
-
/** The taxonomy the custom app validates against. Required when `render: 'custom'`. */
|
|
191
|
-
taxonomy?: Expr | string;
|
|
192
|
-
}
|
|
193
|
-
/**
|
|
194
|
-
* One completion button. `action: 'End'` marks an outcome that ENDS the process
|
|
195
|
-
* rather than continuing (the platform's own two-value vocabulary — anything
|
|
196
|
-
* that is not exactly `'End'` reads as continue).
|
|
197
|
-
*
|
|
198
|
-
* `id` is the outcome's wire id — `schema.outcomes[].id`, and the `outcome-<id>`
|
|
199
|
-
* port its edge leaves from. Leave it out and the id is a slug of `name`
|
|
200
|
-
* (`'Needs info'` → `needs-info`). Set it only to keep an id a flow already
|
|
201
|
-
* has, as decompile does for a task the designer drew
|
|
202
|
-
* (`{ name: 'Reject', id: 'outcome-1778015958049' }`): merge keeps the
|
|
203
|
-
* original node, so its edges must use that node's ids.
|
|
204
|
-
*
|
|
205
|
-
* @remarks
|
|
206
|
-
* A bare string is shorthand for `{ name }`.
|
|
207
|
-
*/
|
|
208
|
-
export type Outcome = string | {
|
|
209
|
-
name: string;
|
|
210
|
-
action?: 'Continue' | 'End';
|
|
211
|
-
id?: string;
|
|
212
|
-
};
|
|
213
|
-
/**
|
|
214
|
-
* WHICH human-task node type to emit. The platform ships three spellings of the
|
|
215
|
-
* same node; two of them resolve on this tenant and are what this option picks.
|
|
216
|
-
*
|
|
217
|
-
* @remarks
|
|
218
|
-
* - **omitted** — `uipath.human-in-the-loop`, the original node, which chooses
|
|
219
|
-
* the form kind with `inputs.type: 'quick'`. This is the default and it does
|
|
220
|
-
* not change: it is where the platform's own versioning continues, and 319 of
|
|
221
|
-
* the corpus's human tasks are on it.
|
|
222
|
-
* - **`'quick-form'`** — `uipath.human-in-the-loop.quick-form`. Same inline form,
|
|
223
|
-
* but the node TYPE is the "quick" choice, so no `inputs.type` is written
|
|
224
|
-
* (165 of its 175 deployed instances omit it). Everything you author is
|
|
225
|
-
* identical; pick it when something downstream keys on the literal type
|
|
226
|
-
* string, which flow-v1's own task checkers do.
|
|
227
|
-
* - **`'action-app'`** — `uipath.human-in-the-loop.coded-action-app`. The form is
|
|
228
|
-
* NOT in the flow: it belongs to a deployed Action App, named by `app`. You
|
|
229
|
-
* still declare `outcomes` (the flow routes on them); you must NOT declare
|
|
230
|
-
* `fields` (the app owns them) — `check` says so.
|
|
231
|
-
*
|
|
232
|
-
* - **`'document-validation'`** — `uipath.human-in-the-loop.document-validation`.
|
|
233
|
-
* A validation station over a document + extraction result, named by
|
|
234
|
-
* `document`. No `fields` (the station is the form); `outcomes` still route.
|
|
235
|
-
* The definition is BUNDLED from the workbench manifest — the tenant registry
|
|
236
|
-
* does not serve the family (same availability note as do-while).
|
|
237
|
-
*/
|
|
238
|
-
export type HitlVariant = 'quick-form' | 'action-app' | 'document-validation';
|
|
239
|
-
/**
|
|
240
|
-
* A deployed Action App that supplies a human task's form — the `'action-app'`
|
|
241
|
-
* variant's subject.
|
|
242
|
-
*
|
|
243
|
-
* @remarks
|
|
244
|
-
* The names are the platform's own, from flow-v1's app picker: an app is closed
|
|
245
|
-
* by `key` (its GUID) plus the `folderPath` it is deployed in, with `name` the
|
|
246
|
-
* human-readable title. This SDK is offline and never calls the Apps API, so
|
|
247
|
-
* what you write here is what you already know about the app.
|
|
248
|
-
*
|
|
249
|
-
* ```ts
|
|
250
|
-
* hitl({
|
|
251
|
-
* variant: 'action-app',
|
|
252
|
-
* app: {
|
|
253
|
-
* name: 'Expense Review',
|
|
254
|
-
* key: 'c0ba97df-8a30-4fe0-b4b4-4611a631d77b',
|
|
255
|
-
* folderPath: 'Shared',
|
|
256
|
-
* inputs: { 'Expense Amount': out('fetchExpense', 'total') },
|
|
257
|
-
* },
|
|
258
|
-
* outcomes: ['Approve', 'Reject'],
|
|
259
|
-
* })
|
|
260
|
-
* ```
|
|
261
|
-
*/
|
|
262
|
-
export interface AppRef {
|
|
263
|
-
/** The app's display title, e.g. `'Expense Review'`. */
|
|
264
|
-
name: string;
|
|
265
|
-
/** The app's key (a GUID) — how the platform resolves which app this is. */
|
|
266
|
-
key: string;
|
|
267
|
-
/** Fully-qualified folder the app is deployed in, e.g. `'Shared'`. */
|
|
268
|
-
folderPath: string;
|
|
269
|
-
/**
|
|
270
|
-
* The app's stable system name. `null` until the app's first deployment
|
|
271
|
-
* assigns one, which is why it is optional and why `null` is a legal value
|
|
272
|
-
* rather than something to omit.
|
|
273
|
-
*/
|
|
274
|
-
appSystemName?: string | null;
|
|
275
|
-
/**
|
|
276
|
-
* What to send the app, keyed by the app's OWN input parameter names — so the
|
|
277
|
-
* keys are the app author's, spaces and all (`'Invoice Amount'`), not
|
|
278
|
-
* identifiers of ours. Values are references, e.g. `out('step', 'field')`.
|
|
279
|
-
*
|
|
280
|
-
* Emitted as `inputs.appInputBindings`, the map flow-v1's serializer turns
|
|
281
|
-
* into the task's `HitlTaskArguments`.
|
|
282
|
-
*/
|
|
283
|
-
inputs?: Record<string, Expr | string>;
|
|
284
|
-
}
|
|
285
|
-
export interface HitlInputs {
|
|
286
|
-
/**
|
|
287
|
-
* Which human-task node type to emit. Omit it for today's default — see
|
|
288
|
-
* {@link HitlVariant}. Omitting it emits exactly what it always has.
|
|
289
|
-
*/
|
|
290
|
-
variant?: HitlVariant;
|
|
291
|
-
/**
|
|
292
|
-
* The deployed Action App that owns this task's form. Required by — and only
|
|
293
|
-
* legal with — `variant: 'action-app'`.
|
|
294
|
-
*/
|
|
295
|
-
app?: AppRef;
|
|
296
|
-
/** Task title the reviewer sees. Defaults to the step's label. */
|
|
297
|
-
title?: string;
|
|
298
|
-
/** Action Center priority. Defaults to `'Low'`. */
|
|
299
|
-
priority?: 'Low' | 'Medium' | 'High';
|
|
300
|
-
/**
|
|
301
|
-
* The form, as an array of field descriptors — `direction: 'input'` for a value
|
|
302
|
-
* the reviewer reads, `'output'` for one they fill in. An array (not a map)
|
|
303
|
-
* because the ids are yours and order is the order on the form.
|
|
304
|
-
*
|
|
305
|
-
* Required for the inline-form variants (the default and `'quick-form'`).
|
|
306
|
-
* FORBIDDEN with `variant: 'action-app'`, where the form belongs to the
|
|
307
|
-
* deployed app rather than to the flow — `check` says so both ways.
|
|
308
|
-
*/
|
|
309
|
-
fields?: FormField[];
|
|
310
|
-
/**
|
|
311
|
-
* The completion buttons, e.g. `['Approve', 'Reject']`. At least one, or the
|
|
312
|
-
* reviewer has no way to complete the task and the flow waits forever. The
|
|
313
|
-
* first is the primary (default) one. Each outcome is its own exit,
|
|
314
|
-
* `outcome-<slug>`: the default node and `'quick-form'` never leave on
|
|
315
|
-
* `completed` once they have outcomes. On the default node MORE THAN ONE
|
|
316
|
-
* outcome routes per outcome: the first continues the main path and the rest
|
|
317
|
-
* are routed with `.stepToList('outcome-<slug>', …)`. With `'quick-form'`,
|
|
318
|
-
* {@link HitlInputs.outcomePorts | outcomePorts}`: false`, an explicit
|
|
319
|
-
* `{ version }` or one outcome, `.step()` continues EVERY outcome instead.
|
|
320
|
-
*
|
|
321
|
-
* Which one they pressed is also `out('<step>', 'Action')` — that is what the
|
|
322
|
-
* platform's own routing conditions compare against.
|
|
323
|
-
*/
|
|
324
|
-
outcomes: Outcome[];
|
|
325
|
-
/** Who gets the task and how. Omit for the definition's default delivery. */
|
|
326
|
-
recipient?: HitlRecipient;
|
|
327
|
-
/** Action Center labels, comma-separated (the platform stores one string). */
|
|
328
|
-
labels?: string;
|
|
329
|
-
/**
|
|
330
|
-
* Whether the task ROUTES per outcome. Each outcome has its own exit either
|
|
331
|
-
* way (`outcome-<id>`, the name slugified: `'Approve'` → `outcome-approve`).
|
|
332
|
-
*
|
|
333
|
-
* `true`: the FIRST outcome continues the main path and the others are routed
|
|
334
|
-
* with `.stepToList('outcome-<id>', …)`, or the run stalls when the reviewer
|
|
335
|
-
* picks one. The default node with more than one outcome already does this,
|
|
336
|
-
* on its **1.1** definition unless a `{ version }` pins another; `'quick-form'`
|
|
337
|
-
* supports it on its one definition. `false`: EVERY outcome continues to the
|
|
338
|
-
* next step on its own edge — a task that routes the decision as DATA by
|
|
339
|
-
* reading `out('<step>', 'Action')`; `'quick-form'` does this by default.
|
|
340
|
-
* `'action-app'` and `'document-validation'` read their outcomes from the app
|
|
341
|
-
* and leave on their one `completed` exit, so `true` is refused there.
|
|
342
|
-
*/
|
|
343
|
-
outcomePorts?: boolean;
|
|
344
|
-
/**
|
|
345
|
-
* Expose the task's runtime error as a bindable `out('<step>', 'error')`
|
|
346
|
-
* object (`{ code, message, detail, category, status }`). Selects the node's
|
|
347
|
-
* **1.2** definition — which also routes per outcome, so this implies
|
|
348
|
-
* {@link HitlInputs.outcomePorts | outcomePorts}. Default node only.
|
|
349
|
-
*/
|
|
350
|
-
exposeError?: boolean;
|
|
351
|
-
/**
|
|
352
|
-
* The document to validate. Required by — and only legal with —
|
|
353
|
-
* `variant: 'document-validation'`.
|
|
354
|
-
*/
|
|
355
|
-
document?: DocValidationInputs;
|
|
356
|
-
}
|
|
357
109
|
/**
|
|
358
110
|
* How a conversational agent gets its turn — the node's own
|
|
359
111
|
* `conversationalAgentSettings` sub-object.
|
|
@@ -1700,10 +1452,6 @@ export interface ContextIndexRef {
|
|
|
1700
1452
|
* whole body rather than an inputs payload.
|
|
1701
1453
|
*/
|
|
1702
1454
|
export interface FlowActionSpecs {
|
|
1703
|
-
/** The spec {@link hitl} builds. */
|
|
1704
|
-
hitl: {
|
|
1705
|
-
inputs: HitlInputs;
|
|
1706
|
-
};
|
|
1707
1455
|
/** The spec {@link rpaWorkflow} builds. */
|
|
1708
1456
|
rpaWorkflow: {
|
|
1709
1457
|
inputs: RpaWorkflowInputs;
|
|
@@ -1807,58 +1555,6 @@ export declare function builtinActionSpec<S extends object>(spec: S): S;
|
|
|
1807
1555
|
* @returns The same spec, as a `FlowTrigger` instance.
|
|
1808
1556
|
*/
|
|
1809
1557
|
export declare function builtinTriggerSpec<S extends object>(spec: S): S;
|
|
1810
|
-
/**
|
|
1811
|
-
* Declare a human task — a step that pauses for a person to read some values,
|
|
1812
|
-
* fill others in, and press one of the outcome buttons.
|
|
1813
|
-
*
|
|
1814
|
-
* @remarks
|
|
1815
|
-
* Read an answer with `out('review', '<fieldId>')`, and which button they pressed
|
|
1816
|
-
* with `out('review', 'Action')` — branch on that for per-outcome routing.
|
|
1817
|
-
*
|
|
1818
|
-
* ### Picking a node type with `variant`
|
|
1819
|
-
*
|
|
1820
|
-
* The example above emits `uipath.human-in-the-loop`, the original node, and
|
|
1821
|
-
* that stays the default. Two other spellings of the same human task exist
|
|
1822
|
-
* ({@link HitlVariant}), and `variant` is how you say which:
|
|
1823
|
-
*
|
|
1824
|
-
* ```ts
|
|
1825
|
-
* // Same inline form, the newer node type — no `inputs.type` is written.
|
|
1826
|
-
* hitl({ variant: 'quick-form', fields: […], outcomes: ['Approve', 'Reject'] })
|
|
1827
|
-
*
|
|
1828
|
-
* // The form lives in a DEPLOYED APP: no `fields`, but still your outcomes.
|
|
1829
|
-
* hitl({
|
|
1830
|
-
* variant: 'action-app',
|
|
1831
|
-
* app: { name: 'Expense Review', key: '<guid>', folderPath: 'Shared',
|
|
1832
|
-
* inputs: { 'Expense Amount': out('fetchExpense', 'total') } },
|
|
1833
|
-
* outcomes: ['Approve', 'Reject'],
|
|
1834
|
-
* })
|
|
1835
|
-
* ```
|
|
1836
|
-
*
|
|
1837
|
-
* What every variant shares: one `completed` port, and the same two outputs
|
|
1838
|
-
* (`output`, carrying the answers, and `status`, carrying the outcome name) —
|
|
1839
|
-
* all three definitions declare them identically, so downstream reads do not
|
|
1840
|
-
* change when you switch.
|
|
1841
|
-
*
|
|
1842
|
-
* @example
|
|
1843
|
-
* **Pause for a person to approve, then read their decision**
|
|
1844
|
-
* ```ts
|
|
1845
|
-
* .step('review', hitl({
|
|
1846
|
-
* title: 'Review Expense',
|
|
1847
|
-
* fields: [
|
|
1848
|
-
* { id: 'amount', type: 'number', direction: 'input', value: input('amount') },
|
|
1849
|
-
* { id: 'approved', type: 'boolean', direction: 'output' },
|
|
1850
|
-
* { id: 'comments', type: 'text', direction: 'output' },
|
|
1851
|
-
* ],
|
|
1852
|
-
* outcomes: ['Approve', 'Reject'],
|
|
1853
|
-
* }))
|
|
1854
|
-
* .step('log', script({ code: 'return "Decision: " + $vars.review.output.approved;' }))
|
|
1855
|
-
* ```
|
|
1856
|
-
*
|
|
1857
|
-
* @param inputs - The form's fields, outcomes and recipient.
|
|
1858
|
-
* @returns An action spec for `.step(...)`.
|
|
1859
|
-
* @example example-eval/GallerySubmission.flow.ts
|
|
1860
|
-
*/
|
|
1861
|
-
export declare function hitl(inputs: HitlInputs): ActionSpec;
|
|
1862
1558
|
/**
|
|
1863
1559
|
* Extract fields from a document with a published IxP project — the platform's
|
|
1864
1560
|
* **Extract** node (`uipath.ixp.*`, service contract `IXP.Extraction`).
|
package/dist/core/actions.js
CHANGED
|
@@ -88,60 +88,6 @@ export function builtinActionSpec(spec) {
|
|
|
88
88
|
export function builtinTriggerSpec(spec) {
|
|
89
89
|
return new BuiltinTrigger(spec);
|
|
90
90
|
}
|
|
91
|
-
/**
|
|
92
|
-
* Declare a human task — a step that pauses for a person to read some values,
|
|
93
|
-
* fill others in, and press one of the outcome buttons.
|
|
94
|
-
*
|
|
95
|
-
* @remarks
|
|
96
|
-
* Read an answer with `out('review', '<fieldId>')`, and which button they pressed
|
|
97
|
-
* with `out('review', 'Action')` — branch on that for per-outcome routing.
|
|
98
|
-
*
|
|
99
|
-
* ### Picking a node type with `variant`
|
|
100
|
-
*
|
|
101
|
-
* The example above emits `uipath.human-in-the-loop`, the original node, and
|
|
102
|
-
* that stays the default. Two other spellings of the same human task exist
|
|
103
|
-
* ({@link HitlVariant}), and `variant` is how you say which:
|
|
104
|
-
*
|
|
105
|
-
* ```ts
|
|
106
|
-
* // Same inline form, the newer node type — no `inputs.type` is written.
|
|
107
|
-
* hitl({ variant: 'quick-form', fields: […], outcomes: ['Approve', 'Reject'] })
|
|
108
|
-
*
|
|
109
|
-
* // The form lives in a DEPLOYED APP: no `fields`, but still your outcomes.
|
|
110
|
-
* hitl({
|
|
111
|
-
* variant: 'action-app',
|
|
112
|
-
* app: { name: 'Expense Review', key: '<guid>', folderPath: 'Shared',
|
|
113
|
-
* inputs: { 'Expense Amount': out('fetchExpense', 'total') } },
|
|
114
|
-
* outcomes: ['Approve', 'Reject'],
|
|
115
|
-
* })
|
|
116
|
-
* ```
|
|
117
|
-
*
|
|
118
|
-
* What every variant shares: one `completed` port, and the same two outputs
|
|
119
|
-
* (`output`, carrying the answers, and `status`, carrying the outcome name) —
|
|
120
|
-
* all three definitions declare them identically, so downstream reads do not
|
|
121
|
-
* change when you switch.
|
|
122
|
-
*
|
|
123
|
-
* @example
|
|
124
|
-
* **Pause for a person to approve, then read their decision**
|
|
125
|
-
* ```ts
|
|
126
|
-
* .step('review', hitl({
|
|
127
|
-
* title: 'Review Expense',
|
|
128
|
-
* fields: [
|
|
129
|
-
* { id: 'amount', type: 'number', direction: 'input', value: input('amount') },
|
|
130
|
-
* { id: 'approved', type: 'boolean', direction: 'output' },
|
|
131
|
-
* { id: 'comments', type: 'text', direction: 'output' },
|
|
132
|
-
* ],
|
|
133
|
-
* outcomes: ['Approve', 'Reject'],
|
|
134
|
-
* }))
|
|
135
|
-
* .step('log', script({ code: 'return "Decision: " + $vars.review.output.approved;' }))
|
|
136
|
-
* ```
|
|
137
|
-
*
|
|
138
|
-
* @param inputs - The form's fields, outcomes and recipient.
|
|
139
|
-
* @returns An action spec for `.step(...)`.
|
|
140
|
-
* @example example-eval/GallerySubmission.flow.ts
|
|
141
|
-
*/
|
|
142
|
-
export function hitl(inputs) {
|
|
143
|
-
return builtinActionSpec({ kind: 'hitl', inputs });
|
|
144
|
-
}
|
|
145
91
|
/**
|
|
146
92
|
* Extract fields from a document with a published IxP project — the platform's
|
|
147
93
|
* **Extract** node (`uipath.ixp.*`, service contract `IXP.Extraction`).
|
|
@@ -31,3 +31,19 @@ import type { FormFieldType } from './actions.js';
|
|
|
31
31
|
* sdkFormFieldType('integer') // undefined
|
|
32
32
|
*/
|
|
33
33
|
export declare function sdkFormFieldType(wire: unknown): FormFieldType | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* Why a form-field type is refused: a product spelling of a type the SDK
|
|
36
|
+
* models (`"string"` is the platform's own name for text), or a type
|
|
37
|
+
* the SDK does not model at all. `unknownWhy` is the caller's reason for the
|
|
38
|
+
* second case; the default is a human task's.
|
|
39
|
+
*/
|
|
40
|
+
export declare function formFieldTypeWhy(type: unknown, unknownWhy?: string): string;
|
|
41
|
+
/** The form-field types the SDK models. */
|
|
42
|
+
export declare const FORM_FIELD_TYPES: string[];
|
|
43
|
+
/** The `suggestion` for an unknown form-field type: the nearest valid one, else `type: 'text'`. */
|
|
44
|
+
export declare function formFieldTypeHint(type: unknown): string;
|
|
45
|
+
/** JSON-Schema type per form-field type, as flow-v1's form serializer maps them (quick-form escalations and human tasks). */
|
|
46
|
+
export declare const FORM_FIELD_JSON_TYPE: Record<FormFieldType, {
|
|
47
|
+
type: string;
|
|
48
|
+
format?: string;
|
|
49
|
+
}>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { nearestName } from './edit-distance.js';
|
|
1
2
|
const PRODUCT_SPELLINGS = {
|
|
2
3
|
text: 'text',
|
|
3
4
|
string: 'text',
|
|
@@ -28,3 +29,35 @@ const PRODUCT_SPELLINGS = {
|
|
|
28
29
|
export function sdkFormFieldType(wire) {
|
|
29
30
|
return typeof wire === 'string' && Object.hasOwn(PRODUCT_SPELLINGS, wire) ? PRODUCT_SPELLINGS[wire] : undefined;
|
|
30
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* Why a form-field type is refused: a product spelling of a type the SDK
|
|
34
|
+
* models (`"string"` is the platform's own name for text), or a type
|
|
35
|
+
* the SDK does not model at all. `unknownWhy` is the caller's reason for the
|
|
36
|
+
* second case; the default is a human task's.
|
|
37
|
+
*/
|
|
38
|
+
export function formFieldTypeWhy(type, unknownWhy = `which the platform does not recognize. Older runtimes read it as text, newer ones reject `
|
|
39
|
+
+ `the form`) {
|
|
40
|
+
const alias = sdkFormFieldType(type);
|
|
41
|
+
return alias !== undefined
|
|
42
|
+
? `which is the platform's spelling of the SDK's '${alias}' — the SDK writes '${alias}'`
|
|
43
|
+
: unknownWhy;
|
|
44
|
+
}
|
|
45
|
+
/** Every FormFieldType, once; `Record<FormFieldType, …>` makes tsc refuse a missing or extra one. */
|
|
46
|
+
const FORM_FIELD_TYPE_SET = { text: true, number: true, boolean: true, 'date-time': true };
|
|
47
|
+
/** The form-field types the SDK models. */
|
|
48
|
+
export const FORM_FIELD_TYPES = Object.keys(FORM_FIELD_TYPE_SET);
|
|
49
|
+
/** The `suggestion` for an unknown form-field type: the nearest valid one, else `type: 'text'`. */
|
|
50
|
+
export function formFieldTypeHint(type) {
|
|
51
|
+
const alias = sdkFormFieldType(type);
|
|
52
|
+
if (alias !== undefined)
|
|
53
|
+
return `type: '${alias}'`;
|
|
54
|
+
const nearest = nearestName(String(type), FORM_FIELD_TYPES);
|
|
55
|
+
return nearest !== undefined ? `type: '${nearest}'` : `type: 'text'`;
|
|
56
|
+
}
|
|
57
|
+
/** JSON-Schema type per form-field type, as flow-v1's form serializer maps them (quick-form escalations and human tasks). */
|
|
58
|
+
export const FORM_FIELD_JSON_TYPE = {
|
|
59
|
+
text: { type: 'string' },
|
|
60
|
+
number: { type: 'number' },
|
|
61
|
+
boolean: { type: 'boolean' },
|
|
62
|
+
'date-time': { type: 'string', format: 'date-time' },
|
|
63
|
+
};
|
|
@@ -69,7 +69,21 @@
|
|
|
69
69
|
* type, including the two app-backed variants, so that `serialize` and `check`
|
|
70
70
|
* refuse them there with their own message rather than silently ignoring them.
|
|
71
71
|
*/
|
|
72
|
-
|
|
72
|
+
/**
|
|
73
|
+
* The fields of a human task's inputs the routing model reads — structural, so
|
|
74
|
+
* this module stays in `core/` while the authoring type (`HitlInputs`) belongs
|
|
75
|
+
* to the HITL family (nodes/hitl/flow/).
|
|
76
|
+
*/
|
|
77
|
+
export interface HitlRoutingInputs {
|
|
78
|
+
readonly variant?: unknown;
|
|
79
|
+
readonly outcomes?: ReadonlyArray<string | {
|
|
80
|
+
readonly name?: unknown;
|
|
81
|
+
readonly action?: unknown;
|
|
82
|
+
readonly id?: unknown;
|
|
83
|
+
}>;
|
|
84
|
+
readonly outcomePorts?: boolean;
|
|
85
|
+
readonly exposeError?: boolean;
|
|
86
|
+
}
|
|
73
87
|
/**
|
|
74
88
|
* An outcome's stable id — the slug that names its `outcome-<id>` port.
|
|
75
89
|
*
|
|
@@ -117,9 +131,9 @@ export type HitlExitModel = {
|
|
|
117
131
|
export declare const OUTCOME_HANDLE_NODE_TYPES: ReadonlySet<string>;
|
|
118
132
|
/** The same test on the authored side: no variant (the base node), or quick-form. */
|
|
119
133
|
export declare function hitlDerivesOutcomeHandles(variant: unknown): boolean;
|
|
120
|
-
export declare function hitlExitModel(inputs:
|
|
134
|
+
export declare function hitlExitModel(inputs: HitlRoutingInputs | undefined, pinnedVersion?: string): HitlExitModel;
|
|
121
135
|
/** Does this task route PER OUTCOME (primary continues, the rest are routed)? */
|
|
122
|
-
export declare function hitlRoutesPerOutcome(inputs:
|
|
136
|
+
export declare function hitlRoutesPerOutcome(inputs: HitlRoutingInputs | undefined, pinnedVersion?: string): boolean;
|
|
123
137
|
type NodeLike = {
|
|
124
138
|
id?: unknown;
|
|
125
139
|
type?: unknown;
|
package/dist/core/stable-id.d.ts
CHANGED
|
@@ -59,3 +59,12 @@ export declare function fnv1aX4Uuid(seed: string): string;
|
|
|
59
59
|
* Consumer: a Case entry point's `uniqueId` in `entry-points.json` (`case/compile-cli.ts`).
|
|
60
60
|
*/
|
|
61
61
|
export declare function sha256Uuid(seed: string): string;
|
|
62
|
+
/**
|
|
63
|
+
* A deterministic UUID for the form schema, derived from the flow and node ids.
|
|
64
|
+
*
|
|
65
|
+
* The platform uses `schemaId` to identify and cache a form, so it has to be
|
|
66
|
+
* stable across builds of the same flow — a random one would make every rebuild a
|
|
67
|
+
* different form and every emitted `.flow` a different file. Shaped as a v5 UUID
|
|
68
|
+
* (SHA-1 based, version + variant bits set) because that is what the field holds.
|
|
69
|
+
*/
|
|
70
|
+
export declare function schemaId(flowId: string, nodeId: string): string;
|
package/dist/core/stable-id.js
CHANGED
|
@@ -91,3 +91,19 @@ export function sha256Uuid(seed) {
|
|
|
91
91
|
const h = createHash('sha256').update(seed).digest('hex');
|
|
92
92
|
return `${h.slice(0, 8)}-${h.slice(8, 12)}-${h.slice(12, 16)}-${h.slice(16, 20)}-${h.slice(20, 32)}`;
|
|
93
93
|
}
|
|
94
|
+
/**
|
|
95
|
+
* A deterministic UUID for the form schema, derived from the flow and node ids.
|
|
96
|
+
*
|
|
97
|
+
* The platform uses `schemaId` to identify and cache a form, so it has to be
|
|
98
|
+
* stable across builds of the same flow — a random one would make every rebuild a
|
|
99
|
+
* different form and every emitted `.flow` a different file. Shaped as a v5 UUID
|
|
100
|
+
* (SHA-1 based, version + variant bits set) because that is what the field holds.
|
|
101
|
+
*/
|
|
102
|
+
export function schemaId(flowId, nodeId) {
|
|
103
|
+
const h = createHash('sha1').update(`uipath.human-in-the-loop:${flowId}:${nodeId}`).digest();
|
|
104
|
+
const b = Buffer.from(h.subarray(0, 16));
|
|
105
|
+
b[6] = (b[6] & 0x0f) | 0x50;
|
|
106
|
+
b[8] = (b[8] & 0x3f) | 0x80;
|
|
107
|
+
const hex = b.toString('hex');
|
|
108
|
+
return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
|
|
109
|
+
}
|
|
@@ -1,3 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The exits an action declares that the AUTHOR named — a human task's outcomes,
|
|
3
|
+
* an HTTP call's response branches — and the port each one leaves on. Every
|
|
4
|
+
* family that has them is a registered node type and declares its own
|
|
5
|
+
* (`FlowNodeType.exits`); `stepExits` in flow-step-exits.ts asks it first, and
|
|
6
|
+
* what is left here is the reason a kind has none.
|
|
7
|
+
*
|
|
8
|
+
* This is what `.stepSwitch()` routes over, and the reason it exists as a table
|
|
9
|
+
* rather than as more `if (spec.kind === …)` arms: `serialize` has to turn
|
|
10
|
+
* an arm's `value` into a port, `check` has to say which values are legal and
|
|
11
|
+
* which were left out, and `decompile` has to turn a port back into a value.
|
|
12
|
+
* Those three read the same list instead of each carrying their own copy of
|
|
13
|
+
* "how a human task names its ports".
|
|
14
|
+
*
|
|
15
|
+
* `undefined` means the family has no author-declared fan-out at all, which is
|
|
16
|
+
* what makes `.stepSwitch()` on it an error rather than a no-op.
|
|
17
|
+
*
|
|
18
|
+
* The `error` port is deliberately NOT here. It is declared by the definition
|
|
19
|
+
* rather than by the author, it exists on families that have no other fan-out,
|
|
20
|
+
* and it is already routed by `.onError()` / `.stepToList('error', …)`. Folding
|
|
21
|
+
* it in would make every action a `.stepSwitch` candidate and would put failure
|
|
22
|
+
* handling and outcome routing in one list, where an omitted arm would mean two
|
|
23
|
+
* different things.
|
|
24
|
+
*/
|
|
1
25
|
/** One author-named exit: the value an arm matches on, and the port it wires. */
|
|
2
26
|
export interface DeclaredExit {
|
|
3
27
|
/** What `.stepSwitch()`'s arm `value` matches — the outcome or branch NAME. */
|
|
@@ -31,7 +55,7 @@ type SpecLike = {
|
|
|
31
55
|
* The author-declared exits of `spec`, or a `NoExits` explaining why there are
|
|
32
56
|
* none to route.
|
|
33
57
|
*/
|
|
34
|
-
export declare function declaredExits(spec: SpecLike | undefined,
|
|
58
|
+
export declare function declaredExits(spec: SpecLike | undefined, _pinnedVersion?: string): DeclaredExit[] | NoExits;
|
|
35
59
|
/** Narrowing helper — `declaredExits` returns one or the other. */
|
|
36
60
|
export declare function hasExits(r: DeclaredExit[] | NoExits): r is DeclaredExit[];
|
|
37
61
|
export {};
|
package/dist/core/step-ports.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The exits an action declares that the AUTHOR named — a human task's outcomes
|
|
3
|
-
* and the port each one leaves on.
|
|
4
|
-
*
|
|
5
|
-
* flow-step-exits.ts asks it first and
|
|
2
|
+
* The exits an action declares that the AUTHOR named — a human task's outcomes,
|
|
3
|
+
* an HTTP call's response branches — and the port each one leaves on. Every
|
|
4
|
+
* family that has them is a registered node type and declares its own
|
|
5
|
+
* (`FlowNodeType.exits`); `stepExits` in flow-step-exits.ts asks it first, and
|
|
6
|
+
* what is left here is the reason a kind has none.
|
|
6
7
|
*
|
|
7
8
|
* This is what `.stepSwitch()` routes over, and the reason it exists as a table
|
|
8
9
|
* rather than as more `if (spec.kind === …)` arms: `serialize` has to turn
|
|
@@ -21,54 +22,12 @@
|
|
|
21
22
|
* handling and outcome routing in one list, where an omitted arm would mean two
|
|
22
23
|
* different things.
|
|
23
24
|
*/
|
|
24
|
-
import { hitlExitModel } from './hitl-routing.js';
|
|
25
25
|
/**
|
|
26
26
|
* The author-declared exits of `spec`, or a `NoExits` explaining why there are
|
|
27
27
|
* none to route.
|
|
28
28
|
*/
|
|
29
|
-
export function declaredExits(spec,
|
|
29
|
+
export function declaredExits(spec, _pinnedVersion) {
|
|
30
30
|
const kind = spec && 'kind' in spec ? spec.kind : undefined;
|
|
31
|
-
if (kind === 'hitl') {
|
|
32
|
-
const inputs = spec?.inputs;
|
|
33
|
-
const model = hitlExitModel(inputs, pinnedVersion);
|
|
34
|
-
if (model.shape === 'placeholder') {
|
|
35
|
-
// WHY it has no outcome exits decides what the author can do about it, so
|
|
36
|
-
// the caller gets the specific one rather than "ports are off".
|
|
37
|
-
if ((inputs?.outcomes ?? []).length === 0) {
|
|
38
|
-
return { reason: 'it declares no outcomes', suggestion: `outcomes: ['Approve', 'Reject']` };
|
|
39
|
-
}
|
|
40
|
-
return {
|
|
41
|
-
reason: `the '${inputs?.variant}' variant reads its outcomes from its app and leaves on its single 'completed' exit`,
|
|
42
|
-
suggestion: `Use .step() and switch on out('<step>', 'Action').`,
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
// A quick-form task and a pinned one continue every outcome under `.step()`,
|
|
46
|
-
// but their outcome handles are real, so `.stepSwitch` routes them. The
|
|
47
|
-
// other fan-out reasons leave nothing to route.
|
|
48
|
-
if (model.shape === 'every-outcome' && model.why !== 'quick-form' && model.why !== 'pinned') {
|
|
49
|
-
if (model.why === 'outcomePorts: false') {
|
|
50
|
-
return {
|
|
51
|
-
reason: 'outcomePorts: false continues every outcome to the next step',
|
|
52
|
-
suggestion: 'Drop `outcomePorts: false`.',
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
if (model.why === 'one outcome') {
|
|
56
|
-
return {
|
|
57
|
-
reason: 'a single outcome has a single exit, so there is nothing to route',
|
|
58
|
-
suggestion: 'Use .step() — the next step follows it unconditionally.',
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
return {
|
|
62
|
-
reason: 'every outcome ends the process, so no exit distinguishes them',
|
|
63
|
-
suggestion: 'Use .step().',
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
return model.exits.map((e) => ({
|
|
67
|
-
value: e.value,
|
|
68
|
-
port: e.port,
|
|
69
|
-
...(e.endsProcess ? { endsProcess: true } : {}),
|
|
70
|
-
}));
|
|
71
|
-
}
|
|
72
31
|
return {
|
|
73
32
|
reason: `a ${kind ?? 'custom'} step declares no author-named exits`,
|
|
74
33
|
suggestion: 'Use .step(); route failures with .onError().',
|
|
@@ -34,14 +34,6 @@ export const TYPED_FACTORIES = {
|
|
|
34
34
|
'uipath.agent.voice': { factory: 'voiceAgent()' },
|
|
35
35
|
'uipath.conversational.voice.create-outgoing-call': { factory: 'createOutgoingCall()' },
|
|
36
36
|
'uipath.conversational.voice.end-call': { factory: 'endCall()' },
|
|
37
|
-
'uipath.human-in-the-loop': { factory: 'hitl()' },
|
|
38
|
-
'uipath.human-in-the-loop.coded-action-app': {
|
|
39
|
-
factory: "hitl({ variant: 'action-app' })",
|
|
40
|
-
},
|
|
41
|
-
'uipath.human-in-the-loop.document-validation': {
|
|
42
|
-
factory: "hitl({ variant: 'document-validation' })",
|
|
43
|
-
},
|
|
44
|
-
'uipath.human-in-the-loop.quick-form': { factory: "hitl({ variant: 'quick-form' })" },
|
|
45
37
|
};
|
|
46
38
|
/**
|
|
47
39
|
* A reminder, as a `warning`, that a `rawNode` stands in for a typed factory,
|