@uipath/maestro-builder-sdk 6.109.0 → 6.110.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/check.d.ts CHANGED
@@ -9,7 +9,7 @@
9
9
  * lives in the serializer alone.
10
10
  */
11
11
  import type { SolutionProjects } from './core/solution-projects.js';
12
- import type { ResourceResolutions } from './core/resource-resolution.js';
12
+ import { type ResourceResolutions } from './core/resource-resolution.js';
13
13
  import type { NodeCatalog } from './core/node-catalog.js';
14
14
  import type { Library } from './core/library.js';
15
15
  import type { BuiltFlow } from './flow-sdk.js';
package/dist/check.js CHANGED
@@ -1,3 +1,6 @@
1
+ import { isResourceToken } from './core/resource-resolution.js';
2
+ import { isLookupToken } from './core/lookups.js';
3
+ import { prepareCommand } from './core/cli-spelling.js';
1
4
  import { Expr, parallelFork } from './flow-sdk.js';
2
5
  import { FlowNode } from './core/node-classes.js';
3
6
  import { definitionHasErrorPort } from './core/error-port.js';
@@ -1291,6 +1294,58 @@ function checkConnectorResourceScope(step, spec, opts, diags) {
1291
1294
  function checkConnectorSchema(step, spec, opts, diags) {
1292
1295
  const { where, report } = connectorSite(step, diags);
1293
1296
  coreCheckConnectorSchema(where, spec, opts, FLOW_EXPR_DIALECT, report);
1297
+ checkConnectorSchemaReplay(where, spec, opts, report);
1298
+ }
1299
+ /**
1300
+ * SCHEMA_REPLAY_PARENT_MISMATCH (#1972): a step on a prepared schema-dynamic
1301
+ * operation that sets a parent to another literal than the one prepared. A
1302
+ * warning: compile writes the step's own request, and the flow may be right;
1303
+ * what is unproven is that its inputs fit that parent's fields.
1304
+ *
1305
+ * SCHEMA_REPLAY_MISSING (#1972): a schema-dynamic operation whose fields depend
1306
+ * on the VALUES of parent inputs (Jira `create-issue` on project and issue
1307
+ * type), on a step that compile would write `customFieldsRequestDetails: null`
1308
+ * for — no `prepare -f` recorded a request, and a parent is unset or computed
1309
+ * at run time. `validate` accepts that, and the designer cannot replay the
1310
+ * schema, so it opens the node with only the parents. A warning: the run reads
1311
+ * the node's parameters, not the request. The fix is the prepare that records
1312
+ * the request for the values the step means.
1313
+ *
1314
+ * A `lookup()` or `resource()` token is a literal by compile time, so it counts
1315
+ * as set.
1316
+ */
1317
+ function checkConnectorSchemaReplay(where, spec, opts, report) {
1318
+ const authored = Object.entries(spec.inputs ?? {});
1319
+ // A token's value is not known here, so it is not compared with the prepared one.
1320
+ const mismatch = opts.schemaReplayMismatch?.(spec, Object.fromEntries(authored.filter(([, v]) => !isLookupToken(v) && !isResourceToken(v))));
1321
+ if (mismatch) {
1322
+ report({
1323
+ level: 'warning',
1324
+ code: 'SCHEMA_REPLAY_PARENT_MISMATCH',
1325
+ message: `${where}: this operation's fields were prepared for `
1326
+ + mismatch.mismatches.map((m) => `${m.name} = ${JSON.stringify(m.recorded)}`).join(', ')
1327
+ + `, but this step sets ${mismatch.mismatches.map((m) => `${m.name} = ${JSON.stringify(m.given)}`).join(', ')}. `
1328
+ + "Compile writes this step's own schema replay request, but its inputs were checked against the prepared values' "
1329
+ + 'fields, which can differ. To check them against this step\'s fields, prepare for its values and re-run check:\n'
1330
+ + ` ${prepareCommand(spec.key, spec.action, ...mismatch.flags)}\n`
1331
+ + 'One operation keeps one prepared field set, so with several steps on it, check each one this way in turn.',
1332
+ });
1333
+ }
1334
+ const inputs = Object.fromEntries(authored
1335
+ .map(([k, v]) => [k, isLookupToken(v) || isResourceToken(v) ? '<resolved at compile>' : v]));
1336
+ const gap = opts.schemaReplayGap?.(spec, inputs);
1337
+ if (!gap)
1338
+ return;
1339
+ const flags = gap.parents.flatMap((p) => ['-f', `${p}=<value>`]);
1340
+ report({
1341
+ level: 'warning',
1342
+ code: 'SCHEMA_REPLAY_MISSING',
1343
+ message: `${where}: this operation's fields depend on the values of ${gap.parents.map((p) => `\`${p}\``).join(', ')}, `
1344
+ + `and ${gap.unresolved.map((p) => `\`${p}\``).join(', ')} ${gap.unresolved.length === 1 ? 'has' : 'have'} no literal value here, `
1345
+ + 'so compile writes no schema replay request (customFieldsRequestDetails: null). validate accepts that, but the '
1346
+ + 'designer cannot load the fields for it. Record the request for the values the step is designed for:\n'
1347
+ + ` ${prepareCommand(spec.key, spec.action, ...flags)}`,
1348
+ });
1294
1349
  }
1295
1350
  /**
1296
1351
  * Reject a wrapper hop when the runtime shape of a list has been measured: the
@@ -22,6 +22,7 @@ import { flagValue } from '../cli-run.js';
22
22
  import { defaultOverlayDir } from '../workdir.js';
23
23
  import { EQUALS_EXPR_DIALECT } from './connector-checks.js';
24
24
  import { connectorInputErrors, connectorResourceRefusals } from './connector-inputs.js';
25
+ import { schemaReplayGap, schemaReplayMismatch } from './connector-configuration.js';
25
26
  /**
26
27
  * The library for this invocation, or `undefined` when there is none.
27
28
  *
@@ -149,6 +150,16 @@ export function connectorCheckOpts(library, bindings, inputErrors = (rc, inputs,
149
150
  return undefined;
150
151
  return inputErrors(r.rc, inputs, library.lookupResolutions ?? {}, library.lookupSpecs(spec.key, spec.action, spec.version, spec.object) ?? {});
151
152
  },
153
+ // A schema-dynamic operation compile would write no replay request for (#1972).
154
+ schemaReplayGap: (spec, inputs) => {
155
+ const r = resolve(spec);
156
+ return 'rc' in r ? schemaReplayGap(r.rc.entry, inputs) : undefined;
157
+ },
158
+ // A prepared one whose parents the step sets to other values (#1972).
159
+ schemaReplayMismatch: (spec, inputs) => {
160
+ const r = resolve(spec);
161
+ return 'rc' in r ? schemaReplayMismatch(r.rc.entry, inputs) : undefined;
162
+ },
152
163
  // The unresolved `resource()` tokens, through the field paths compile projects.
153
164
  connectorResources: (spec, inputs, resources) => {
154
165
  const r = resolve(spec);
@@ -159,6 +159,38 @@ export interface ConnectorCheckOpts {
159
159
  * steps share across connections from one `prepare` can fix.
160
160
  */
161
161
  lookupConnections?: LookupConnectionIndex;
162
+ /**
163
+ * For a schema-dynamic operation compile would write no replay request for:
164
+ * its parents, and the ones these inputs leave without a literal value
165
+ * (`schemaReplayGap`, core/connector-configuration.ts). `undefined` otherwise.
166
+ */
167
+ schemaReplayGap?: (spec: {
168
+ key: string;
169
+ action: string;
170
+ version?: string;
171
+ object?: string;
172
+ }, inputs: Record<string, unknown>) => {
173
+ parents: string[];
174
+ unresolved: string[];
175
+ } | undefined;
176
+ /**
177
+ * For a prepared schema-dynamic operation: the parents these inputs set to
178
+ * other literals than `prepare -f` recorded, and the `-f` flags that would
179
+ * record the step's values (`schemaReplayMismatch`). `undefined` otherwise.
180
+ */
181
+ schemaReplayMismatch?: (spec: {
182
+ key: string;
183
+ action: string;
184
+ version?: string;
185
+ object?: string;
186
+ }, inputs: Record<string, unknown>) => {
187
+ mismatches: Array<{
188
+ name: string;
189
+ recorded: string;
190
+ given: string;
191
+ }>;
192
+ flags: string[];
193
+ } | undefined;
162
194
  }
163
195
  /**
164
196
  * The `resource()` / `entity()` inputs.
@@ -9,6 +9,58 @@
9
9
  * nodes already store. See {@link buildConfiguration} for why the split form
10
10
  * broke the designer (flow-builder-sdk#936).
11
11
  */
12
+ /**
13
+ * The parents a prepared replay request was recorded for that the step sets to
14
+ * a DIFFERENT literal, as `{ name, recorded, given }`.
15
+ *
16
+ * `registry prepare -f <parent>=<value>` records the request
17
+ * (`customFieldsRequestDetails`) and the field set those values select. A step
18
+ * that names another project or issue type had its inputs checked against the
19
+ * old fields (#1972). A parent the step leaves unset, or
20
+ * sets from a runtime expression, is not compared: the recorded values are the
21
+ * author's design-time choice for it.
22
+ */
23
+ export declare function schemaReplayParentMismatches(details: unknown, inputValues: Record<string, unknown> | undefined): Array<{
24
+ name: string;
25
+ recorded: string;
26
+ given: string;
27
+ }>;
28
+ /**
29
+ * The parents a schema-dynamic operation needs literal values for before
30
+ * compile can write a replay request, or `undefined` when it writes one (or
31
+ * needs none).
32
+ *
33
+ * An operation is schema-dynamic when the library records its design-time
34
+ * action (`operation.schemaAction` with `parents`). Compile writes the request
35
+ * `prepare -f` recorded, else one from the step's own literal parents; with a
36
+ * parent unset or computed at run time it writes `customFieldsRequestDetails:
37
+ * null`, which `validate` accepts and the designer cannot replay
38
+ * (`SCHEMA_REPLAY_MISSING`, #1972).
39
+ */
40
+ export declare function schemaReplayGap(entry: any, inputValues: Record<string, unknown>): {
41
+ parents: string[];
42
+ unresolved: string[];
43
+ } | undefined;
44
+ /**
45
+ * A prepared operation's mismatch for one step: the parents the step sets to
46
+ * another literal, and the `prepare` that would record the step's own values,
47
+ * or `undefined` when the step matches what was prepared (or nothing was).
48
+ *
49
+ * `prepare -f` records ONE request per operation, so two steps on the same
50
+ * operation with different parents (two entities, two Jira projects) cannot
51
+ * both match it. Compile therefore writes each step's own request (see
52
+ * {@link schemaReplayDetails}); what is left is that the step's inputs were
53
+ * validated against the prepared values' field set, which `check` reports as
54
+ * the warning `SCHEMA_REPLAY_PARENT_MISMATCH` (#1972).
55
+ */
56
+ export declare function schemaReplayMismatch(entry: any, inputValues: Record<string, unknown>): {
57
+ mismatches: Array<{
58
+ name: string;
59
+ recorded: string;
60
+ given: string;
61
+ }>;
62
+ flags: string[];
63
+ } | undefined;
12
64
  /**
13
65
  * Compose the `=jsonString:`-wrapped configuration for a connector library entry.
14
66
  *
@@ -89,9 +89,136 @@ const ESSENTIAL_KEYS = new Set([
89
89
  'path',
90
90
  'unifiedTypesCompatible',
91
91
  ]);
92
- function schemaReplayDetails(operation, inputValues) {
92
+ /**
93
+ * An input's value by the library's name for it: the flat key (`project`,
94
+ * `fields.project.key` as one key), else the nested path a body object holds
95
+ * (`{ fields: { project: { key } } }`).
96
+ */
97
+ function inputAt(inputValues, name) {
98
+ if (Object.hasOwn(inputValues, name))
99
+ return inputValues[name];
100
+ let at = inputValues;
101
+ for (const segment of name.split('.')) {
102
+ if (typeof at !== 'object' || at === null || Array.isArray(at) || !Object.hasOwn(at, segment))
103
+ return undefined;
104
+ at = at[segment];
105
+ }
106
+ return at;
107
+ }
108
+ /**
109
+ * A parent input's literal text, or `undefined` for one that is not a literal:
110
+ * absent, a container, or a runtime expression (Flow's `=js:…`, BPMN's
111
+ * `=vars.…`; a literal parent value never starts with `=`).
112
+ */
113
+ function literalParent(value) {
114
+ if (typeof value === 'number' || typeof value === 'boolean')
115
+ return String(value);
116
+ if (typeof value === 'string' && !value.startsWith('='))
117
+ return value;
118
+ return undefined;
119
+ }
120
+ /**
121
+ * The parents a prepared replay request was recorded for that the step sets to
122
+ * a DIFFERENT literal, as `{ name, recorded, given }`.
123
+ *
124
+ * `registry prepare -f <parent>=<value>` records the request
125
+ * (`customFieldsRequestDetails`) and the field set those values select. A step
126
+ * that names another project or issue type had its inputs checked against the
127
+ * old fields (#1972). A parent the step leaves unset, or
128
+ * sets from a runtime expression, is not compared: the recorded values are the
129
+ * author's design-time choice for it.
130
+ */
131
+ export function schemaReplayParentMismatches(details, inputValues) {
132
+ const rows = details?.parameterValues;
133
+ if (!inputValues || !Array.isArray(rows))
134
+ return [];
135
+ const mismatches = [];
136
+ for (const row of rows) {
137
+ if (!Array.isArray(row) || typeof row[0] !== 'string')
138
+ continue;
139
+ const name = row[0].replaceAll('_sub_', '.');
140
+ const recorded = String(row[1]);
141
+ const given = literalParent(inputAt(inputValues, name));
142
+ if (given !== undefined && given !== recorded)
143
+ mismatches.push({ name, recorded, given });
144
+ }
145
+ return mismatches;
146
+ }
147
+ /**
148
+ * The parents a schema-dynamic operation needs literal values for before
149
+ * compile can write a replay request, or `undefined` when it writes one (or
150
+ * needs none).
151
+ *
152
+ * An operation is schema-dynamic when the library records its design-time
153
+ * action (`operation.schemaAction` with `parents`). Compile writes the request
154
+ * `prepare -f` recorded, else one from the step's own literal parents; with a
155
+ * parent unset or computed at run time it writes `customFieldsRequestDetails:
156
+ * null`, which `validate` accepts and the designer cannot replay
157
+ * (`SCHEMA_REPLAY_MISSING`, #1972).
158
+ */
159
+ export function schemaReplayGap(entry, inputValues) {
160
+ const operation = entry?.operation ?? {};
93
161
  if (operation.customFieldsRequestDetails)
94
- return operation.customFieldsRequestDetails;
162
+ return undefined;
163
+ const action = operation.schemaAction;
164
+ const parents = Array.isArray(action?.parents) ? action.parents.filter((p) => typeof p === 'string') : [];
165
+ if (typeof action?.name !== 'string' || parents.length === 0)
166
+ return undefined;
167
+ const unresolved = parents.filter((p) => literalParent(inputAt(inputValues, p)) === undefined);
168
+ return unresolved.length > 0 ? { parents, unresolved } : undefined;
169
+ }
170
+ /**
171
+ * A prepared operation's mismatch for one step: the parents the step sets to
172
+ * another literal, and the `prepare` that would record the step's own values,
173
+ * or `undefined` when the step matches what was prepared (or nothing was).
174
+ *
175
+ * `prepare -f` records ONE request per operation, so two steps on the same
176
+ * operation with different parents (two entities, two Jira projects) cannot
177
+ * both match it. Compile therefore writes each step's own request (see
178
+ * {@link schemaReplayDetails}); what is left is that the step's inputs were
179
+ * validated against the prepared values' field set, which `check` reports as
180
+ * the warning `SCHEMA_REPLAY_PARENT_MISMATCH` (#1972).
181
+ */
182
+ export function schemaReplayMismatch(entry, inputValues) {
183
+ const details = entry?.operation?.customFieldsRequestDetails;
184
+ const mismatches = schemaReplayParentMismatches(details, inputValues);
185
+ if (mismatches.length === 0)
186
+ return undefined;
187
+ const flags = details.parameterValues
188
+ .filter((row) => Array.isArray(row) && typeof row[0] === 'string')
189
+ .flatMap((row) => {
190
+ const name = String(row[0]).replaceAll('_sub_', '.');
191
+ const changed = mismatches.find((m) => m.name === name);
192
+ return ['-f', `${name}=${changed ? changed.given : String(row[1])}`];
193
+ });
194
+ return { mismatches, flags };
195
+ }
196
+ /**
197
+ * The schema replay request compile writes for one step.
198
+ *
199
+ * A prepared request whose parents the step sets to other literals is rebuilt
200
+ * with the step's values: the request is per step, the recording per
201
+ * operation, so the recorded one would describe another parent's schema
202
+ * (#1972). A parent the step leaves unset or computes at run time keeps the
203
+ * prepared value, the author's design-time choice for it.
204
+ */
205
+ function schemaReplayDetails(entry, inputValues) {
206
+ const operation = entry?.operation ?? {};
207
+ if (operation.customFieldsRequestDetails) {
208
+ const details = operation.customFieldsRequestDetails;
209
+ const mismatches = schemaReplayParentMismatches(details, inputValues);
210
+ if (mismatches.length === 0)
211
+ return details;
212
+ return {
213
+ ...details,
214
+ parameterValues: details.parameterValues.map((row) => {
215
+ if (!Array.isArray(row) || typeof row[0] !== 'string')
216
+ return row;
217
+ const changed = mismatches.find((m) => m.name === String(row[0]).replaceAll('_sub_', '.'));
218
+ return changed ? [row[0], changed.given] : row;
219
+ }),
220
+ };
221
+ }
95
222
  const action = operation.schemaAction;
96
223
  const parents = Array.isArray(action?.parents) ? action.parents : [];
97
224
  if (!inputValues || typeof action?.name !== 'string' || parents.length === 0)
@@ -241,7 +368,7 @@ export function buildEssentialConfiguration(entry, version, inputValues, seed =
241
368
  // activity has none (`null`, the default).
242
369
  executionType,
243
370
  operation: verb,
244
- customFieldsRequestDetails: schemaReplayDetails(op, inputValues),
371
+ customFieldsRequestDetails: schemaReplayDetails(entry, inputValues),
245
372
  savedFilterTrees: savedFilterTrees(op, inputValues, seed),
246
373
  objectName: op.objectName,
247
374
  httpMethod: transportHttpMethod(op.httpMethod),
@@ -703,6 +703,8 @@ export declare const REFUSALS: {
703
703
  readonly SCHEDULE_NEVER_FIRES: "lint";
704
704
  readonly SCHEDULE_NOT_ISO: "lint";
705
705
  readonly SCHEDULE_NO_INTERVAL: "lint";
706
+ readonly SCHEMA_REPLAY_MISSING: "lint";
707
+ readonly SCHEMA_REPLAY_PARENT_MISMATCH: "lint";
706
708
  readonly SCHEMA_VERSION_ABOVE_FLOOR: "lint";
707
709
  readonly SCHEMA_VERSION_BELOW_FLOOR: "lint";
708
710
  readonly SCHEMA_VERSION_ON_SUBFLOW: "lint";
@@ -779,6 +779,8 @@ export const REFUSALS = {
779
779
  SCHEDULE_NEVER_FIRES: 'lint',
780
780
  SCHEDULE_NOT_ISO: 'lint',
781
781
  SCHEDULE_NO_INTERVAL: 'lint',
782
+ SCHEMA_REPLAY_MISSING: 'lint',
783
+ SCHEMA_REPLAY_PARENT_MISMATCH: 'lint',
782
784
  SCHEMA_VERSION_ABOVE_FLOOR: 'lint',
783
785
  SCHEMA_VERSION_BELOW_FLOOR: 'lint',
784
786
  SCHEMA_VERSION_ON_SUBFLOW: 'lint',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uipath/maestro-builder-sdk",
3
- "version": "6.109.0",
3
+ "version": "6.110.0",
4
4
  "description": "Build UiPath Flow, Case, and BPMN artifacts by writing TypeScript.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://docs.uipath.com/maestro",
@@ -123,5 +123,5 @@
123
123
  "@types/node": "^22.7.0",
124
124
  "esbuild": "^0.28.1"
125
125
  },
126
- "gitref": "5b4742b27753c744b24c39aa70538961b642b18c"
126
+ "gitref": "0a9aff796fc17366d91e10f723108adb494d09b4"
127
127
  }