@uipath/maestro-builder-sdk 6.34.0 → 6.35.1
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 +77 -73
- package/dist/api-members.md +266 -251
- package/dist/check.js +6 -2
- package/dist/core/actions.d.ts +103 -18
- package/dist/core/form-field-type.d.ts +77 -29
- package/dist/core/form-field-type.js +264 -46
- package/dist/decompile.js +57 -18
- package/dist/flow-node-type.d.ts +6 -0
- package/dist/merge.js +18 -6
- package/dist/nodes/hitl/flow/check.js +8 -4
- package/dist/nodes/hitl/flow/node-type.js +20 -20
- package/dist/serialize.js +7 -4
- package/package.json +2 -2
package/dist/check.js
CHANGED
|
@@ -10,7 +10,7 @@ import { FlowNode } from './core/node-classes.js';
|
|
|
10
10
|
import { planContributionBindings } from './core/contribution-bindings.js';
|
|
11
11
|
import { definitionHasErrorPort, errorPortRefusal } from './core/error-port.js';
|
|
12
12
|
import { actionVersion, bundledActionNodeType, bundledContainerDefinition, bundledDefinition, perCallDefinition, resolveContributionDefinition } from './serialize.js';
|
|
13
|
-
import { FORM_FIELD_TYPES, formFieldOptionsProblem, formFieldOptionsWhy, formFieldTypeHint, formFieldTypeWhy, validFormFieldTypesText } from './core/form-field-type.js';
|
|
13
|
+
import { FORM_FIELD_TYPES, formFieldOptionsProblem, formFieldOptionsWhy, formFieldSettingProblems, formFieldTypeHint, formFieldTypeWhy, validFormFieldTypesText, } from './core/form-field-type.js';
|
|
14
14
|
import { AGENTIC_PROCESS_FORMS } from './core/agentic-process-forms.js';
|
|
15
15
|
import { checkEventResolution, checkEventSubscription, eventParamsFor, } from './core/event-checks.js';
|
|
16
16
|
import { checkCookedEscapes } from './flow-expr-check.js';
|
|
@@ -3573,7 +3573,7 @@ function checkInlineAgent(step, inputs, diags, opts = {}, ledger = newResourceId
|
|
|
3573
3573
|
+ `${JSON.stringify(f?.type)}, ${formFieldTypeWhy(f?.type, `which the form does not recognize — it would `
|
|
3574
3574
|
+ `be published as a plain string`)}. Valid: ${validFormFieldTypesText()}.`, formFieldTypeHint(f?.type));
|
|
3575
3575
|
}
|
|
3576
|
-
const optionsProblem = formFieldOptionsProblem(f
|
|
3576
|
+
const optionsProblem = formFieldOptionsProblem(f);
|
|
3577
3577
|
if (optionsProblem !== undefined) {
|
|
3578
3578
|
const message = `Inline agent step "${step}"'s quick-form escalation field "${String(f?.id ?? '?')}" `
|
|
3579
3579
|
+ `${formFieldOptionsWhy(optionsProblem, f?.type)}.`;
|
|
@@ -3583,6 +3583,10 @@ function checkInlineAgent(step, inputs, diags, opts = {}, ledger = newResourceId
|
|
|
3583
3583
|
at('INLINE_AGENT_ESCALATION_FIELD_OPTIONS', message, `options: [{ id: 'opt-1', value: 'high', label: 'High' }, { id: 'opt-2', value: 'low', label: 'Low' }]`);
|
|
3584
3584
|
}
|
|
3585
3585
|
}
|
|
3586
|
+
for (const problem of formFieldSettingProblems(f)) {
|
|
3587
|
+
at('INLINE_AGENT_ESCALATION_FIELD_SETTING_INVALID', `Inline agent step "${step}"'s quick-form escalation gives the field "${String(f?.id ?? '?')}" `
|
|
3588
|
+
+ `${problem}. The platform refuses the form.`);
|
|
3589
|
+
}
|
|
3586
3590
|
}
|
|
3587
3591
|
continue;
|
|
3588
3592
|
}
|
package/dist/core/actions.d.ts
CHANGED
|
@@ -102,19 +102,114 @@ export interface FormFieldOption {
|
|
|
102
102
|
/** What the reviewer sees, e.g. `'High'`. */
|
|
103
103
|
label: string;
|
|
104
104
|
}
|
|
105
|
+
/**
|
|
106
|
+
* How a form field renders (`@uipath/hitl-schema-types` `controlType`). It is a
|
|
107
|
+
* separate vocabulary from the data `type`: a single choice is `type: 'string'`
|
|
108
|
+
* with `controlType: 'dropdown'`. When it is absent, the form uses the data
|
|
109
|
+
* type's default control (or the one a choice spelling such as `singleSelect`
|
|
110
|
+
* implies).
|
|
111
|
+
*/
|
|
112
|
+
export type FormFieldControlType = 'text' | 'textarea' | 'numberInput' | 'datePicker' | 'dateAndTimePicker' | 'checkbox' | 'dropdown' | 'radioGroup' | 'multiSelect' | 'checkboxGroup' | 'fileUpload';
|
|
113
|
+
/**
|
|
114
|
+
* One condition of a form-field rule (`@uipath/hitl-schema-types`
|
|
115
|
+
* `fieldConditionSchema`): `when` names the field it reads, and the other keys
|
|
116
|
+
* say what that field's value must be.
|
|
117
|
+
*/
|
|
118
|
+
export interface FormFieldCondition {
|
|
119
|
+
/** The id of the field the condition reads, e.g. `'priority'`. */
|
|
120
|
+
when: string;
|
|
121
|
+
/** The value must equal this. */
|
|
122
|
+
is?: unknown;
|
|
123
|
+
/** The value must not equal this. */
|
|
124
|
+
isNot?: unknown;
|
|
125
|
+
/** The value must be one of these. */
|
|
126
|
+
in?: unknown[];
|
|
127
|
+
/** The value must be none of these. */
|
|
128
|
+
notIn?: unknown[];
|
|
129
|
+
/** The value must match this regular expression. */
|
|
130
|
+
matches?: string;
|
|
131
|
+
/** A custom condition expression, kept as written. */
|
|
132
|
+
custom?: string;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* A form-field rule (`@uipath/hitl-schema-types` `fieldRuleSchema`): when its
|
|
136
|
+
* conditions hold, its `effects` apply to the field, for example
|
|
137
|
+
* `{ visible: true }` or `{ required: true }`.
|
|
138
|
+
*
|
|
139
|
+
* @example
|
|
140
|
+
* hitl({
|
|
141
|
+
* fields: [
|
|
142
|
+
* { id: 'priority', type: 'singleSelect', direction: 'output', options: [{ id: 'o1', value: 'high', label: 'High' }] },
|
|
143
|
+
* {
|
|
144
|
+
* id: 'reason', type: 'string', direction: 'output',
|
|
145
|
+
* // Required only when the priority is high.
|
|
146
|
+
* rules: [{ id: 'rule-1', conditions: [{ when: 'priority', is: 'high' }], effects: { required: true } }],
|
|
147
|
+
* },
|
|
148
|
+
* ],
|
|
149
|
+
* outcomes: ['Done'],
|
|
150
|
+
* })
|
|
151
|
+
*/
|
|
152
|
+
export interface FormFieldRule {
|
|
153
|
+
/** The rule's own stable id, e.g. `'rule-1'`. */
|
|
154
|
+
id: string;
|
|
155
|
+
/** What must hold for the effects to apply. */
|
|
156
|
+
conditions: FormFieldCondition[];
|
|
157
|
+
/** How the conditions combine. The platform's default is `'AND'`. */
|
|
158
|
+
operator?: 'AND' | 'OR';
|
|
159
|
+
/** What applies while the conditions hold, keyed by effect (`visible`, `required`, `disabled`). */
|
|
160
|
+
effects: Record<string, unknown>;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* The form-field keys that say how a field looks and behaves, with the
|
|
164
|
+
* platform's own names and shapes (`@uipath/hitl-schema-types` `fieldSchemaFor`).
|
|
165
|
+
* Every one is optional and written to the form row as given, so a field the
|
|
166
|
+
* canvas saved keeps them through decompile, an edit and compile.
|
|
167
|
+
*
|
|
168
|
+
* @example
|
|
169
|
+
* hitl({
|
|
170
|
+
* fields: [{
|
|
171
|
+
* id: 'priority', label: 'Priority', type: 'string', direction: 'output', required: true,
|
|
172
|
+
* controlType: 'dropdown',
|
|
173
|
+
* options: [{ id: 'o1', value: 'high', label: 'High' }, { id: 'o2', value: 'low', label: 'Low' }],
|
|
174
|
+
* defaultValue: 'high', colSpan: 6, requiredMessage: 'Pick one',
|
|
175
|
+
* description: 'How urgent the invoice is.',
|
|
176
|
+
* }],
|
|
177
|
+
* outcomes: ['Done'],
|
|
178
|
+
* })
|
|
179
|
+
*/
|
|
180
|
+
export interface FormFieldSettings {
|
|
181
|
+
/** Conditions that show, require or disable the field. */
|
|
182
|
+
rules?: FormFieldRule[];
|
|
183
|
+
/** The message the form shows when a required field is left empty. */
|
|
184
|
+
requiredMessage?: string;
|
|
185
|
+
/** The field's width on the form's 12-column grid: an integer from 1 to 12. Absent means the full width. */
|
|
186
|
+
colSpan?: number;
|
|
187
|
+
/**
|
|
188
|
+
* How the field renders, e.g. `'dropdown'` or `'textarea'`. Absent means the
|
|
189
|
+
* data type's default control.
|
|
190
|
+
*/
|
|
191
|
+
controlType?: FormFieldControlType;
|
|
192
|
+
/**
|
|
193
|
+
* The choices of a picker field — a `dropdown` / `singleSelect` / `enum`, or a
|
|
194
|
+
* `multiSelect`. Written to the form verbatim, in order.
|
|
195
|
+
*/
|
|
196
|
+
options?: FormFieldOption[];
|
|
197
|
+
/**
|
|
198
|
+
* The value the form starts with: one `options` value for a single-choice
|
|
199
|
+
* field, a list of them for a multi-select, or the starting text.
|
|
200
|
+
*/
|
|
201
|
+
defaultValue?: string | string[];
|
|
202
|
+
/** Guidance for an agent that pre-fills the field. */
|
|
203
|
+
description?: string;
|
|
204
|
+
}
|
|
105
205
|
/** A value the reviewer READS: shown on the form, filled in from the flow. */
|
|
106
|
-
export interface ShownField {
|
|
206
|
+
export interface ShownField extends FormFieldSettings {
|
|
107
207
|
/** Field id — the key the answer object uses. Must be unique on the form. */
|
|
108
208
|
id: string;
|
|
109
209
|
/** Label the reviewer sees. Defaults to `id`. */
|
|
110
210
|
label?: string;
|
|
111
211
|
type: FormFieldType;
|
|
112
212
|
direction: 'input';
|
|
113
|
-
/**
|
|
114
|
-
* The choices of a picker field — a `singleSelect` / `enum` dropdown or a
|
|
115
|
-
* `multiSelect`. Written to the form verbatim, in order.
|
|
116
|
-
*/
|
|
117
|
-
options?: FormFieldOption[];
|
|
118
213
|
/**
|
|
119
214
|
* What to show — a reference, e.g. `input('amount')` or
|
|
120
215
|
* `out('fetchInvoice', 'body.total')`. Required: a shown field with nothing
|
|
@@ -124,18 +219,13 @@ export interface ShownField {
|
|
|
124
219
|
value: Expr;
|
|
125
220
|
}
|
|
126
221
|
/** A value the reviewer FILLS IN: read downstream with `out('<step>', '<id>')`. */
|
|
127
|
-
export interface AskedField {
|
|
222
|
+
export interface AskedField extends FormFieldSettings {
|
|
128
223
|
/** Field id — the key the answer object uses. Must be unique on the form. */
|
|
129
224
|
id: string;
|
|
130
225
|
/** Label the reviewer sees. Defaults to `id`. */
|
|
131
226
|
label?: string;
|
|
132
227
|
type: FormFieldType;
|
|
133
228
|
direction: 'output';
|
|
134
|
-
/**
|
|
135
|
-
* The choices of a picker field — a `singleSelect` / `enum` dropdown or a
|
|
136
|
-
* `multiSelect`. Written to the form verbatim, in order.
|
|
137
|
-
*/
|
|
138
|
-
options?: FormFieldOption[];
|
|
139
229
|
/** Reviewer must fill it in before the task can be completed. */
|
|
140
230
|
required?: boolean;
|
|
141
231
|
}
|
|
@@ -145,18 +235,13 @@ export interface AskedField {
|
|
|
145
235
|
* answer. Read it downstream with `out('<step>', '<id>')` — the write target is
|
|
146
236
|
* the field's own id, deliberately decoupled from where the pre-fill came from.
|
|
147
237
|
*/
|
|
148
|
-
export interface InOutField {
|
|
238
|
+
export interface InOutField extends FormFieldSettings {
|
|
149
239
|
/** Field id — the key the answer object uses. Must be unique on the form. */
|
|
150
240
|
id: string;
|
|
151
241
|
/** Label the reviewer sees. Defaults to `id`. */
|
|
152
242
|
label?: string;
|
|
153
243
|
type: FormFieldType;
|
|
154
244
|
direction: 'inOut';
|
|
155
|
-
/**
|
|
156
|
-
* The choices of a picker field — a `singleSelect` / `enum` dropdown or a
|
|
157
|
-
* `multiSelect`. Written to the form verbatim, in order.
|
|
158
|
-
*/
|
|
159
|
-
options?: FormFieldOption[];
|
|
160
245
|
/** What to pre-fill — a reference, e.g. `out('fetchInvoice', 'body.total')`. */
|
|
161
246
|
value: Expr;
|
|
162
247
|
/** Reviewer must confirm/fill it before the task can be completed. */
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
* agent quick-form escalations), decompile, and the serializers' output
|
|
27
27
|
* schemas.
|
|
28
28
|
*/
|
|
29
|
-
import type { CanonicalFormFieldType, ControlFormFieldType,
|
|
29
|
+
import type { CanonicalFormFieldType, ControlFormFieldType, FormFieldControlType, FormFieldSettings } from './actions.js';
|
|
30
30
|
/** The product's 11 canonical quick-form field types, in its own order. */
|
|
31
31
|
export declare const CANONICAL_FORM_FIELD_TYPES: CanonicalFormFieldType[];
|
|
32
32
|
/** The SDK's legacy spellings (`text`, `date-time`), for diagnostics that list them. */
|
|
@@ -117,48 +117,50 @@ export declare function formFieldJsonSchema(type: unknown): {
|
|
|
117
117
|
format?: string;
|
|
118
118
|
} | undefined;
|
|
119
119
|
/**
|
|
120
|
-
*
|
|
121
|
-
* `
|
|
122
|
-
*
|
|
123
|
-
*
|
|
120
|
+
* Every key of a quick-form field row, in the platform's own order
|
|
121
|
+
* (`@uipath/hitl-schema-types` 1.2.0 `fieldSchemaFor`). The contract test
|
|
122
|
+
* compares this list with the real package, so a key added upstream fails
|
|
123
|
+
* there until the SDK decides how to carry it.
|
|
124
124
|
*/
|
|
125
|
-
export declare
|
|
125
|
+
export declare const FORM_FIELD_ROW_KEYS: readonly ["id", "type", "label", "direction", "required", "variable", "binding", "value", "rules", "requiredMessage", "colSpan", "controlType", "options", "defaultValue", "description"];
|
|
126
|
+
/** The platform's controls (`controlType`), in its own order. */
|
|
127
|
+
export declare const FORM_FIELD_CONTROL_TYPES: readonly FormFieldControlType[];
|
|
126
128
|
/**
|
|
127
|
-
*
|
|
128
|
-
*
|
|
129
|
-
*
|
|
130
|
-
* out, not coerced: `{ id: 'o1', value: 1 }` is not rewritten to
|
|
131
|
-
* `value: '1', label: ''`. Decompile (human task and quick-form escalation)
|
|
132
|
-
* reads through this, so a canvas dropdown's choices survive an edit.
|
|
129
|
+
* Each settings key a field sets to a value the platform's schema refuses, as
|
|
130
|
+
* `key: value (what it must be)`. Empty when every setting is valid. `check`
|
|
131
|
+
* reports these: a form with one fails the platform's validation.
|
|
133
132
|
*
|
|
134
133
|
* @example
|
|
135
|
-
*
|
|
136
|
-
* // [{ id: 'o1', value: 'a', label: 'A' }]
|
|
134
|
+
* formFieldSettingProblems({ colSpan: 13 }) // ['colSpan: 13 (must be an integer from 1 to 12 …)']
|
|
137
135
|
*/
|
|
138
|
-
export declare function
|
|
136
|
+
export declare function formFieldSettingProblems(f: unknown): string[];
|
|
137
|
+
/** The `FormFieldSettings` keys, in the platform's row order. */
|
|
138
|
+
export declare const FORM_FIELD_SETTINGS_KEYS: (keyof FormFieldSettings)[];
|
|
139
139
|
/**
|
|
140
|
-
* What is wrong with a form field's
|
|
141
|
-
* `check` reports each (human task and quick-form escalation)
|
|
140
|
+
* What is wrong with a form field's choices, or `undefined` when nothing is.
|
|
141
|
+
* `check` reports each (human task and quick-form escalation). A field is a
|
|
142
|
+
* picker when its type is a choice-control spelling (`singleSelect`,
|
|
143
|
+
* `multiSelect`, `enum`) or its `controlType` is a picker control (`dropdown`,
|
|
144
|
+
* `radioGroup`, `multiSelect`, `checkboxGroup`).
|
|
142
145
|
*
|
|
143
|
-
* - `'
|
|
144
|
-
*
|
|
145
|
-
*
|
|
146
|
-
*
|
|
147
|
-
*
|
|
148
|
-
*
|
|
146
|
+
* - `'missing'`: a picker with no choices. The form publishes an empty picker.
|
|
147
|
+
* - `'ignored'`: choices on a field that is not a picker. The form renders a
|
|
148
|
+
* plain input and never shows them.
|
|
149
|
+
*
|
|
150
|
+
* `options` that do not have the platform's shape are reported by
|
|
151
|
+
* `formFieldSettingProblems` instead, so they get no second diagnostic here.
|
|
149
152
|
*
|
|
150
153
|
* @example
|
|
151
|
-
* formFieldOptionsProblem('singleSelect'
|
|
152
|
-
* formFieldOptionsProblem('
|
|
153
|
-
* formFieldOptionsProblem('string', [{ id: 'o1', value: 'a', label: 'A' }]) //
|
|
154
|
-
* formFieldOptionsProblem('enum', [{ id: 'o1', value: 'a', label: 'A' }]) // undefined
|
|
154
|
+
* formFieldOptionsProblem({ type: 'singleSelect' }) // 'missing'
|
|
155
|
+
* formFieldOptionsProblem({ type: 'string', options: [{ id: 'o1', value: 'a', label: 'A' }] }) // 'ignored'
|
|
156
|
+
* formFieldOptionsProblem({ type: 'string', controlType: 'dropdown', options: [{ id: 'o1', value: 'a', label: 'A' }] }) // undefined
|
|
155
157
|
*/
|
|
156
|
-
export declare function formFieldOptionsProblem(
|
|
158
|
+
export declare function formFieldOptionsProblem(f: unknown): 'missing' | 'ignored' | undefined;
|
|
157
159
|
/**
|
|
158
160
|
* The reason text for a `formFieldOptionsProblem`, worded for a diagnostic
|
|
159
161
|
* that starts "… the field "<id>" …".
|
|
160
162
|
*/
|
|
161
|
-
export declare function formFieldOptionsWhy(problem: '
|
|
163
|
+
export declare function formFieldOptionsWhy(problem: 'missing' | 'ignored', type: unknown): string;
|
|
162
164
|
/**
|
|
163
165
|
* The spelling a form field's type is written in on the wire: the product's
|
|
164
166
|
* canonical one for the SDK's legacy spellings (`text` is written `string`,
|
|
@@ -173,3 +175,49 @@ export declare function formFieldOptionsWhy(problem: 'malformed' | 'missing' | '
|
|
|
173
175
|
* wireFormFieldType('number') // 'number'
|
|
174
176
|
*/
|
|
175
177
|
export declare function wireFormFieldType(type: unknown): unknown;
|
|
178
|
+
/**
|
|
179
|
+
* A field's settings as the form row carries them: each key the author set,
|
|
180
|
+
* in the platform's row order, copied so the wire never aliases the author's
|
|
181
|
+
* objects. Both serializers (human task, quick-form escalation) append this
|
|
182
|
+
* after the row's own keys.
|
|
183
|
+
*
|
|
184
|
+
* @example
|
|
185
|
+
* formFieldSettingsWire({ colSpan: 6, controlType: 'dropdown' }) // { colSpan: 6, controlType: 'dropdown' }
|
|
186
|
+
*/
|
|
187
|
+
export declare function formFieldSettingsWire(f: FormFieldSettings): Record<string, unknown>;
|
|
188
|
+
/**
|
|
189
|
+
* A form row's settings read back for source: each settings key whose value
|
|
190
|
+
* has the platform's shape, copied, without any key the platform's schema does
|
|
191
|
+
* not define. A key with any other value is left out here; both cases are
|
|
192
|
+
* reported by `formFieldRowLoss`.
|
|
193
|
+
*/
|
|
194
|
+
export declare function liftFormFieldSettings(row: Record<string, unknown>): FormFieldSettings;
|
|
195
|
+
/**
|
|
196
|
+
* A field's settings as source options, in the platform's row order, for the
|
|
197
|
+
* decompilers' printers. `value` prints one data value (`'high'`, `6`,
|
|
198
|
+
* `[{ id: 'o1', … }]`).
|
|
199
|
+
*/
|
|
200
|
+
export declare function formFieldSettingsSource(settings: FormFieldSettings, value: (v: unknown) => string): Array<[string, string | undefined]>;
|
|
201
|
+
/**
|
|
202
|
+
* Where a form row lives, which decides which of its binding keys the SDK
|
|
203
|
+
* derives: a human task writes `binding` for a shown or pre-filled field and
|
|
204
|
+
* `variable: 'vars.<id>'` for an asked one; a quick-form escalation writes
|
|
205
|
+
* neither (the agent fills the form).
|
|
206
|
+
*/
|
|
207
|
+
export type FormRowSite = 'human task' | 'escalation';
|
|
208
|
+
/**
|
|
209
|
+
* The keys of a form row the SDK cannot carry into source, each with why.
|
|
210
|
+
* Empty when decompile → compile writes the row back as it was. The lifts
|
|
211
|
+
* report a non-empty list as a warning (an error under `--strict`), so no key
|
|
212
|
+
* is dropped silently.
|
|
213
|
+
*
|
|
214
|
+
* @example
|
|
215
|
+
* formFieldRowLoss({ id: 'a', label: 'A', type: 'string', direction: 'output', colSpan: 13 }, 'human task')
|
|
216
|
+
* // ['colSpan: 13 (not the platform\'s shape for it)']
|
|
217
|
+
*/
|
|
218
|
+
export declare function formFieldRowLoss(row: Record<string, unknown>, site: FormRowSite): string[];
|
|
219
|
+
/**
|
|
220
|
+
* The warning (or `--strict` error) for a row `formFieldRowLoss` reported.
|
|
221
|
+
* `where` names the form, e.g. `human task "review"`.
|
|
222
|
+
*/
|
|
223
|
+
export declare function formFieldRowLossMessage(where: string, fieldId: string, loss: readonly string[]): string;
|