@uipath/maestro-builder-sdk 6.106.0 → 6.108.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 +43 -42
- package/dist/api-members.md +147 -140
- package/dist/check-cli.js +8 -3
- package/dist/check.d.ts +8 -0
- package/dist/check.js +8 -4
- package/dist/compile-cli.js +19 -0
- package/dist/core/refusals.d.ts +6 -0
- package/dist/core/refusals.js +6 -0
- package/dist/core/solution-projects.d.ts +63 -0
- package/dist/core/solution-projects.js +37 -0
- package/dist/decompile.js +78 -33
- package/dist/flow-node-type.d.ts +17 -0
- package/dist/flow-output-backing.d.ts +1 -0
- package/dist/flow-output-backing.js +1 -1
- package/dist/flow-sdk.d.ts +15 -0
- package/dist/flow-sdk.js +6 -0
- package/dist/flow-types.d.ts +10 -5
- package/dist/flow-types.js +10 -5
- package/dist/flow-variables.d.ts +4 -0
- package/dist/flow-variables.js +5 -1
- package/dist/merge-cli.js +22 -4
- package/dist/nodes/process/flow/check.js +17 -10
- package/dist/nodes/process/flow/in-solution.d.ts +32 -0
- package/dist/nodes/process/flow/in-solution.js +169 -0
- package/dist/nodes/process/flow/node-type.js +12 -5
- package/dist/nodes/process/flow/spec.d.ts +120 -20
- package/dist/project-flows.d.ts +40 -0
- package/dist/project-flows.js +136 -0
- package/dist/serialize.d.ts +9 -0
- package/dist/serialize.js +19 -9
- package/dist/solution-projects-files.d.ts +6 -0
- package/dist/solution-projects-files.js +163 -0
- package/package.json +2 -2
package/dist/flow-types.js
CHANGED
|
@@ -11,7 +11,10 @@
|
|
|
11
11
|
*
|
|
12
12
|
* The others are Case-only. Packaging turns `date` / `datetime` into a plain
|
|
13
13
|
* `string` with no format, the expression model types `float` / `double` /
|
|
14
|
-
* `jsonSchema` as `any`, and no Flow editor offers any of them.
|
|
14
|
+
* `jsonSchema` as `any`, and no Flow editor offers any of them. One thing is
|
|
15
|
+
* kept: packaging writes a `float` / `double` global as `"type":"number"` with
|
|
16
|
+
* `"format":"float"` / `"double"` in the entry point's schema, so a Flow
|
|
17
|
+
* number may carry that width as `{ type: types.number, format }`.
|
|
15
18
|
*
|
|
16
19
|
* `satisfies Record<TypeDesc, …>` makes this exhaustive: adding a type to
|
|
17
20
|
* `types` without deciding whether Flow takes it is a compile error here.
|
|
@@ -25,8 +28,8 @@ const flowTypeSupport = {
|
|
|
25
28
|
file: true,
|
|
26
29
|
any: true,
|
|
27
30
|
integer: true,
|
|
28
|
-
float:
|
|
29
|
-
double:
|
|
31
|
+
float: "{ type: types.number, format: 'float' }",
|
|
32
|
+
double: "{ type: types.number, format: 'double' }",
|
|
30
33
|
date: 'types.string',
|
|
31
34
|
datetime: 'types.string',
|
|
32
35
|
jsonSchema: 'types.object or types.array, with its shape in { schema }',
|
|
@@ -54,8 +57,10 @@ export function nonFlowTypeReplacement(type) {
|
|
|
54
57
|
* older SDK or Studio Web wrote still round-trips; the recompile writes
|
|
55
58
|
* `"type":"string"`, which the decompile warning announces.
|
|
56
59
|
*
|
|
57
|
-
* `undefined` for every other type
|
|
58
|
-
* `
|
|
60
|
+
* `undefined` for every other type. Decompile prints `float` / `double` as
|
|
61
|
+
* `{ type: types.number, format }` (`VarSpec.format`), which writes the same
|
|
62
|
+
* type back, and `jsonSchema` as `types.object` / `types.array` with the
|
|
63
|
+
* shape in `{ schema }`.
|
|
59
64
|
*/
|
|
60
65
|
export function runtimeEquivalentFlowType(type) {
|
|
61
66
|
return type === 'date' || type === 'datetime' ? 'string' : undefined;
|
package/dist/flow-variables.d.ts
CHANGED
|
@@ -93,6 +93,8 @@ export interface SharedInputFeed {
|
|
|
93
93
|
export interface SharedInputTarget {
|
|
94
94
|
name: string;
|
|
95
95
|
type: string;
|
|
96
|
+
/** An `auto` target's number width, from the first input feeding it. */
|
|
97
|
+
format?: string;
|
|
96
98
|
/** What declares it: an explicit `.var()` / `.output()`, or the SDK (`auto`). */
|
|
97
99
|
declaredAs: 'var' | 'output' | 'auto';
|
|
98
100
|
hasDefault: boolean;
|
|
@@ -112,12 +114,14 @@ export interface SharedInputsPlan {
|
|
|
112
114
|
autoVars: {
|
|
113
115
|
name: string;
|
|
114
116
|
type: string;
|
|
117
|
+
format?: string;
|
|
115
118
|
}[];
|
|
116
119
|
problems: SharedInputsProblem[];
|
|
117
120
|
}
|
|
118
121
|
/** The `{ shared }` slice of an input declaration. */
|
|
119
122
|
interface SharedCapable extends DeclaredVariable {
|
|
120
123
|
shared?: string;
|
|
124
|
+
format?: string;
|
|
121
125
|
}
|
|
122
126
|
/**
|
|
123
127
|
* Plan the variables that root inputs feed with `{ shared: '<var>' }`.
|
package/dist/flow-variables.js
CHANGED
|
@@ -157,6 +157,7 @@ export function planSharedInputs(decl) {
|
|
|
157
157
|
target = {
|
|
158
158
|
name,
|
|
159
159
|
type: declared ? String(declared.type) : String(inp.type),
|
|
160
|
+
...(!declared && inp.format !== undefined ? { format: inp.format } : {}),
|
|
160
161
|
declaredAs: od ? 'output' : vd ? 'var' : 'auto',
|
|
161
162
|
hasDefault: (od?.default ?? vd?.default) !== undefined,
|
|
162
163
|
feeds: [],
|
|
@@ -216,7 +217,10 @@ export function planSharedInputs(decl) {
|
|
|
216
217
|
const targets = [...byName.values()];
|
|
217
218
|
// A target that names an input is already refused above; leaving it out here
|
|
218
219
|
// keeps the global plan from reporting the same name a second time.
|
|
219
|
-
|
|
220
|
+
// An auto variable keeps the first feeding input's number width, so its global has the input's type.
|
|
221
|
+
const autoVars = targets.filter((t) => t.declaredAs === 'auto' && !inputNames.has(t.name)).map((t) => ({
|
|
222
|
+
name: t.name, type: t.type, ...(t.format !== undefined ? { format: t.format } : {}),
|
|
223
|
+
}));
|
|
220
224
|
return { targets, autoVars, problems };
|
|
221
225
|
}
|
|
222
226
|
/**
|
package/dist/merge-cli.js
CHANGED
|
@@ -63,6 +63,10 @@
|
|
|
63
63
|
* the sidecars in memory; what merge cannot carry is warned, and refused under
|
|
64
64
|
* `--strict`. See merge-sidecars.ts.
|
|
65
65
|
*
|
|
66
|
+
* Writing into a Flow project that already holds another `.flow` outside its
|
|
67
|
+
* dot-folders (a candidate beside the original, a backup) warns
|
|
68
|
+
* `SECOND_FLOW_IN_PROJECT` (project-flows.ts).
|
|
69
|
+
*
|
|
66
70
|
* Agent resources (#1221): a context or tool the edit adds or changes is written
|
|
67
71
|
* beside the merged output too. One the edit REMOVES is listed, one
|
|
68
72
|
* `flow-merge: remove <dir>` line each (and `removed` in `--json`), because
|
|
@@ -72,16 +76,18 @@
|
|
|
72
76
|
* merged flow and its agents, as compile does, and written beside the merged
|
|
73
77
|
* output when it changes.
|
|
74
78
|
*/
|
|
75
|
-
import { reportCompileRefusal, reportDiagnostics, reportResult } from './cli-result.js';
|
|
79
|
+
import { diagnosticLine, reportCompileRefusal, reportDiagnostics, reportResult } from './cli-result.js';
|
|
76
80
|
import { writeJsonFile } from './core/json-file.js';
|
|
77
81
|
import { existsSync, mkdirSync, readdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
78
82
|
import { inlineAgentResources, mergeBindingsV2, projectBindingRows, refreshInlineAgentRows } from './bindings-v2.js';
|
|
79
83
|
import { readBindingsV2, readInlineAgentFiles } from './bindings-v2-files.js';
|
|
84
|
+
import { readSolutionProjects } from './solution-projects-files.js';
|
|
80
85
|
import { basename, dirname, join, relative, resolve } from 'node:path';
|
|
81
86
|
import { MergeRefusedError, mergeFlowWithSidecars } from './merge.js';
|
|
82
87
|
import { sidecarSetFromList } from './merge-sidecars.js';
|
|
83
88
|
import { isWithin } from './path-within.js';
|
|
84
89
|
import { flowSources, projectMainFlow, resourceSourcesOfOtherFlows } from './project-resource-users.js';
|
|
90
|
+
import { secondFlowWarning } from './project-flows.js';
|
|
85
91
|
import { flagValue, flagValues, runWhenInvokedDirectly } from './cli-run.js';
|
|
86
92
|
import { readFlowFile } from './decompile-file.js';
|
|
87
93
|
import { readFlowStamp, restampFlowSource, sourceDigest, STAMP_MARKER } from './decompile-stamp.js';
|
|
@@ -308,7 +314,11 @@ export async function run(argv) {
|
|
|
308
314
|
const bindings = derivedFrom || editedIsSource ? new Bindings(flagValue(argv, '--bindings') ?? defaultBindingsFile()) : undefined;
|
|
309
315
|
// The node registry cache a manifest-less `rawNode` resolves from (#1981), read on first use.
|
|
310
316
|
const nodeCatalog = readNodeCatalog();
|
|
311
|
-
|
|
317
|
+
// The solution the edited source sits in, read as compile and check read it, so a
|
|
318
|
+
// step named by `project` merges as it compiles (#1978).
|
|
319
|
+
const solution = readSolutionProjects(dirname(resolve(editedPath)));
|
|
320
|
+
const compileOpts = { library, bindings, nodeCatalog, ...(solution !== undefined ? { solution } : {}) };
|
|
321
|
+
const checkOpts = { ...flowCheckOpts(library, bindings), nodeCatalog, ...(solution !== undefined ? { solution } : {}) };
|
|
312
322
|
// Resolved as decompile resolves it, so a split `.flow` merges as the document the
|
|
313
323
|
// source was decompiled from.
|
|
314
324
|
const originalParts = [];
|
|
@@ -329,7 +339,7 @@ export async function run(argv) {
|
|
|
329
339
|
editedSidecars = compiled.sidecars;
|
|
330
340
|
drafts = compiled.drafts;
|
|
331
341
|
lowering = compiled.lowering.map(onNode);
|
|
332
|
-
diagnostics = checkEdited(compiled.built, edited,
|
|
342
|
+
diagnostics = checkEdited(compiled.built, edited, checkOpts);
|
|
333
343
|
}
|
|
334
344
|
else {
|
|
335
345
|
edited = JSON.parse(readFileSync(editedPath, 'utf8'));
|
|
@@ -430,7 +440,7 @@ export async function run(argv) {
|
|
|
430
440
|
const baselineFindings = baselineCompile === undefined ? undefined : findingCounts([
|
|
431
441
|
...baselineCompile.drafts,
|
|
432
442
|
...baselineCompile.lowering,
|
|
433
|
-
...checkEdited(baselineCompile.built, baselineCompile.flow,
|
|
443
|
+
...checkEdited(baselineCompile.built, baselineCompile.flow, checkOpts).filter((d) => d.level === 'error'),
|
|
434
444
|
]);
|
|
435
445
|
const unplacedDrafts = splitUnplaced(unplaced, baselineFindings);
|
|
436
446
|
const unplacedChecks = splitUnplaced(checked.unplaced, baselineFindings);
|
|
@@ -508,6 +518,14 @@ export async function run(argv) {
|
|
|
508
518
|
mkdirSync(outDir, { recursive: true });
|
|
509
519
|
writeJsonFile(out, flow);
|
|
510
520
|
console.log(`flow-merge: wrote ${basename(out)} (${(flow.nodes ?? []).length} nodes, ${(flow.edges ?? []).length} edges)`);
|
|
521
|
+
// A candidate written into the original's Flow project outside a dot-folder, or an
|
|
522
|
+
// in-place merge into a project that holds a backup, leaves a second `.flow` where
|
|
523
|
+
// `uip` or a globbing reader can take it for the project's (#1996). Never fatal.
|
|
524
|
+
const second = secondFlowWarning(out);
|
|
525
|
+
if (second !== undefined) {
|
|
526
|
+
console.error(` ${diagnosticLine(second)}`);
|
|
527
|
+
reportDiagnostics([second]);
|
|
528
|
+
}
|
|
511
529
|
for (const { sidecar, target } of targets) {
|
|
512
530
|
mkdirSync(dirname(target), { recursive: true });
|
|
513
531
|
writeJsonFile(target, sidecar.json);
|
|
@@ -55,6 +55,11 @@ export const PROCESS_DIAGNOSTICS = {
|
|
|
55
55
|
FUNCTION_READ_NOT_OUTPUT: { severity: 'error', summary: 'a function step read outside output' },
|
|
56
56
|
FUNCTION_READ_UNKNOWN_FIELD: { severity: 'error', summary: 'a function step read of a field returns does not declare' },
|
|
57
57
|
FUNCTION_READ_WITHOUT_RETURNS: { severity: 'error', summary: 'a function step field read with no returns' },
|
|
58
|
+
IN_SOLUTION_KEY_MISMATCH: { severity: 'error', summary: 'an in-solution process step whose key or projectId is not its project\'s' },
|
|
59
|
+
IN_SOLUTION_NO_SOLUTION: { severity: 'error', summary: 'an in-solution process step named by project, compiled outside a solution' },
|
|
60
|
+
IN_SOLUTION_PROJECT_NOT_FOUND: { severity: 'error', summary: 'an in-solution process step naming no project of the solution' },
|
|
61
|
+
IN_SOLUTION_PROJECT_PUBLISHED: { severity: 'error', summary: 'a process step naming a project with location published' },
|
|
62
|
+
IN_SOLUTION_WRONG_BUILDER: { severity: 'error', summary: 'an in-solution process step whose builder does not call its project\'s type' },
|
|
58
63
|
RPA_KEY_NOT_KEY: { severity: 'error', summary: 'an RPA step whose key is not a GUID' },
|
|
59
64
|
RPA_LOCAL_HAS_FOLDER: { severity: 'error', summary: 'an RPA step in-solution, with a folderPath' },
|
|
60
65
|
RPA_LOCAL_NO_PROJECT_ID: { severity: 'warning', summary: 'an RPA step in-solution, with no projectId' },
|
|
@@ -127,10 +132,12 @@ export function checkRpaWorkflow(inputs, ctx) {
|
|
|
127
132
|
at('RPA_NO_FOLDER', `RPA step "${step}" has no \`folderPath\`. The runtime starts the job by name + folder, so the `
|
|
128
133
|
+ `Orchestrator folder holding the process is required.`, `folderPath: 'Shared/uipath-maestro-flow/ProjectEuler RPA'`);
|
|
129
134
|
}
|
|
130
|
-
|
|
135
|
+
// A step named by `project` has its projectId filled by `withSolution`, or the
|
|
136
|
+
// serializer's IN_SOLUTION_* refusal says why it could not be (in-solution.ts).
|
|
137
|
+
if (inSolution && blank(inputs?.projectId) && blank(inputs?.project)) {
|
|
131
138
|
at('RPA_LOCAL_NO_PROJECT_ID', noProjectIdMessage('RPA', step, 'process'), `projectId: '<resource.projectKey>'`);
|
|
132
139
|
}
|
|
133
|
-
else if (inSolution && !GUID_RE.test(String(inputs.projectId).trim())) {
|
|
140
|
+
else if (inSolution && !blank(inputs?.projectId) && !GUID_RE.test(String(inputs.projectId).trim())) {
|
|
134
141
|
at('RPA_LOCAL_PROJECT_ID_NOT_GUID', `In-solution RPA step "${step}" has projectId ${JSON.stringify(inputs.projectId)}, which is not `
|
|
135
142
|
+ `the sibling project's GUID. Read \`resource.projectKey\` from the generated resource file.`, `projectId: '<resource.projectKey>'`);
|
|
136
143
|
}
|
|
@@ -184,10 +191,10 @@ export function checkApiWorkflow(inputs, ctx) {
|
|
|
184
191
|
+ `Orchestrator folder holding the workflow is required. For an API workflow in the SAME solution, set `
|
|
185
192
|
+ `\`location: 'in-solution'\` and its \`projectId\` instead.`, `folderPath: 'Shared'`);
|
|
186
193
|
}
|
|
187
|
-
if (inSolution && blank(inputs?.projectId)) {
|
|
194
|
+
if (inSolution && blank(inputs?.projectId) && blank(inputs?.project)) {
|
|
188
195
|
at('APIWF_LOCAL_NO_PROJECT_ID', noProjectIdMessage('API workflow', step, 'api'), `projectId: '<resource.projectKey>'`);
|
|
189
196
|
}
|
|
190
|
-
else if (inSolution && !GUID_RE.test(String(inputs.projectId).trim())) {
|
|
197
|
+
else if (inSolution && !blank(inputs?.projectId) && !GUID_RE.test(String(inputs.projectId).trim())) {
|
|
191
198
|
at('APIWF_LOCAL_PROJECT_ID_NOT_GUID', `In-solution API workflow step "${step}" has projectId ${JSON.stringify(inputs.projectId)}, which is not `
|
|
192
199
|
+ `the sibling project's GUID. Read \`resource.projectKey\` from the generated resource file.`, `projectId: '<resource.projectKey>'`);
|
|
193
200
|
}
|
|
@@ -235,10 +242,10 @@ export function checkPublishedFunction(inputs, ctx) {
|
|
|
235
242
|
+ `than assuming 'Shared'. For a coded function in the SAME solution, set \`location: 'in-solution'\` `
|
|
236
243
|
+ `and its \`projectId\` instead.`, `folderPath: 'Shared/acme-echo'`);
|
|
237
244
|
}
|
|
238
|
-
if (inSolution && blank(inputs?.projectId)) {
|
|
245
|
+
if (inSolution && blank(inputs?.projectId) && blank(inputs?.project)) {
|
|
239
246
|
at('FUNCTION_LOCAL_NO_PROJECT_ID', noProjectIdMessage('function', step, 'function'), `projectId: '<resource.projectKey>'`);
|
|
240
247
|
}
|
|
241
|
-
else if (inSolution && !GUID_RE.test(String(inputs.projectId).trim())) {
|
|
248
|
+
else if (inSolution && !blank(inputs?.projectId) && !GUID_RE.test(String(inputs.projectId).trim())) {
|
|
242
249
|
at('FUNCTION_LOCAL_PROJECT_ID_NOT_GUID', `In-solution function step "${step}" has projectId ${JSON.stringify(inputs.projectId)}, which is not `
|
|
243
250
|
+ `the sibling project's GUID. Read \`resource.projectKey\` from the generated resource file.`, `projectId: '<resource.projectKey>'`);
|
|
244
251
|
}
|
|
@@ -318,11 +325,11 @@ export function checkAgenticProcess(inputs, ctx) {
|
|
|
318
325
|
+ `published process instead (drop \`location\` and \`projectId\`, set \`folderPath\`), or use `
|
|
319
326
|
+ `\`form: 'flow'\` if the sibling is a Flow.`, `location: 'published', folderPath: 'Shared/<folder>'`);
|
|
320
327
|
}
|
|
321
|
-
if (inSolution && blank(inputs?.projectId)) {
|
|
328
|
+
if (inSolution && blank(inputs?.projectId) && blank(inputs?.project)) {
|
|
322
329
|
const folder = (ownEntry(AGENTIC_PROCESS_FORMS, inputs?.form ?? 'bpmn') ?? AGENTIC_PROCESS_FORMS.bpmn).solutionFolder;
|
|
323
330
|
at('AGENTIC_LOCAL_NO_PROJECT_ID', noProjectIdMessage('agentic process', step, folder), `projectId: '<resource.projectKey>'`);
|
|
324
331
|
}
|
|
325
|
-
else if (inSolution && !GUID_RE.test(String(inputs.projectId).trim())) {
|
|
332
|
+
else if (inSolution && !blank(inputs?.projectId) && !GUID_RE.test(String(inputs.projectId).trim())) {
|
|
326
333
|
at('AGENTIC_LOCAL_PROJECT_ID_NOT_GUID', `In-solution agentic process step "${step}" has projectId ${JSON.stringify(inputs.projectId)}, which is not `
|
|
327
334
|
+ `the sibling project's GUID. Read \`resource.projectKey\` from the generated resource file.`, `projectId: '<resource.projectKey>'`);
|
|
328
335
|
}
|
|
@@ -496,12 +503,12 @@ export function checkAgent(inputs, ctx) {
|
|
|
496
503
|
+ `two same-named agents: this tenant has \`CountLetters\` in both \`Shared\` and `
|
|
497
504
|
+ `\`Shared/uipath-maestro-flow/CountLetters CodedAgent\`.`, `folderPath: 'Shared/uipath-maestro-flow/CountLetters LowCode'`);
|
|
498
505
|
}
|
|
499
|
-
if (inSolution && blank(inputs?.projectId)) {
|
|
506
|
+
if (inSolution && blank(inputs?.projectId) && blank(inputs?.project)) {
|
|
500
507
|
at('AGENT_LOCAL_NO_PROJECT_ID', `In-solution agent step "${step}" has no \`projectId\`. Read \`resource.projectKey\` from `
|
|
501
508
|
+ `\`resources/solution_folder/process/agent/<project>.json\` after registering the sibling `
|
|
502
509
|
+ `with \`uip solution projects add\`.`, `projectId: '<resource.projectKey>'`);
|
|
503
510
|
}
|
|
504
|
-
else if (inSolution && !GUID_RE.test(String(inputs.projectId).trim())) {
|
|
511
|
+
else if (inSolution && !blank(inputs?.projectId) && !GUID_RE.test(String(inputs.projectId).trim())) {
|
|
505
512
|
at('AGENT_LOCAL_PROJECT_ID_NOT_GUID', `In-solution agent step "${step}" has projectId ${JSON.stringify(inputs.projectId)}, which is not `
|
|
506
513
|
+ `the registered sibling project's GUID. Read \`resource.projectKey\` from the generated resource file.`, `projectId: '<resource.projectKey>'`);
|
|
507
514
|
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type ProcessKind } from '../../../core/process-resource.js';
|
|
2
|
+
import { type SolutionProject, type SolutionProjects } from '../../../core/solution-projects.js';
|
|
3
|
+
/** The factory call a sibling takes: its kind, and for an agentic process its form. */
|
|
4
|
+
interface Builder {
|
|
5
|
+
kind: ProcessKind;
|
|
6
|
+
form?: 'bpmn' | 'flow' | 'case';
|
|
7
|
+
/** The builder, for messages: `rpaWorkflow`, `agenticProcess` with form 'flow'. */
|
|
8
|
+
label: string;
|
|
9
|
+
/** How the call opens, for a suggestion: `agenticProcess({ form: 'flow', `. */
|
|
10
|
+
open: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* The factory that calls `project`. The entry point's own type wins over the
|
|
14
|
+
* folder: `uip solution projects add` files a coded agent with no `ProjectType`
|
|
15
|
+
* under `process/function/`, while its `entry-points.json` still says `agent`.
|
|
16
|
+
*/
|
|
17
|
+
export declare function builderOf(project: SolutionProject): Builder | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* `inputs` with what the solution says about the sibling it names filled in.
|
|
20
|
+
* Only an in-solution step named by `project`, whose sibling is found and is
|
|
21
|
+
* this factory's, is filled; a field the author wrote is kept (a wrong one is
|
|
22
|
+
* `refuseInSolution`'s). Anything else is returned unchanged.
|
|
23
|
+
*/
|
|
24
|
+
export declare function resolveInSolution(kind: ProcessKind, inputs: unknown, solution: SolutionProjects | undefined): unknown;
|
|
25
|
+
/**
|
|
26
|
+
* Throw what the serializer cannot write correctly about an in-solution step,
|
|
27
|
+
* knowing the solution. For instance `publishedFunction({ location:
|
|
28
|
+
* 'in-solution', project: 'Summarizer' })` on a project whose entry point is an
|
|
29
|
+
* agent throws `IN_SOLUTION_WRONG_BUILDER`, naming `agent(`.
|
|
30
|
+
*/
|
|
31
|
+
export declare function refuseInSolution(kind: ProcessKind, inputs: unknown, solution: SolutionProjects | undefined, step: string): void;
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An in-solution process step resolved against the solution on disk (#1978).
|
|
3
|
+
*
|
|
4
|
+
* The author names the sibling by project:
|
|
5
|
+
*
|
|
6
|
+
* rpaWorkflow({ location: 'in-solution', project: 'CalculatePay', inputs: { hours: 40 } })
|
|
7
|
+
*
|
|
8
|
+
* and `resolveInSolution` fills what the sibling's resource file and entry points
|
|
9
|
+
* say: `key` (`resource.key`), `projectId` (`resource.projectKey`), `name` (the
|
|
10
|
+
* project's name) and, when the step declares none, `returns` (the entry point's
|
|
11
|
+
* output fields). The serializer and `check` both run it (`withSolution` on the
|
|
12
|
+
* node type), so the read rules see the filled `returns` and the two rungs agree.
|
|
13
|
+
*
|
|
14
|
+
* `refuseInSolution` is the serializer's half: what it cannot write correctly once
|
|
15
|
+
* it knows the solution. A `project` it cannot find, a sibling the factory cannot
|
|
16
|
+
* call (a coded agent under `process/function/` called with `publishedFunction()`
|
|
17
|
+
* "validates and dispatches nothing"), and a `key` or `projectId` that names no
|
|
18
|
+
* sibling of this solution. Without a solution (a library call, or a flow outside
|
|
19
|
+
* any `.uipx` folder) an explicit `key` is not judged, and a `project` is refused:
|
|
20
|
+
* nothing can say what it names.
|
|
21
|
+
*/
|
|
22
|
+
import { CompileRefusal } from '../../../core/compile-refusal.js';
|
|
23
|
+
import { nearestName } from '../../../core/edit-distance.js';
|
|
24
|
+
import { blank } from '../../../core/process-resource.js';
|
|
25
|
+
import { sameGuid, solutionProjectByKey, solutionProjectByName, } from '../../../core/solution-projects.js';
|
|
26
|
+
/**
|
|
27
|
+
* The factory that calls `project`. The entry point's own type wins over the
|
|
28
|
+
* folder: `uip solution projects add` files a coded agent with no `ProjectType`
|
|
29
|
+
* under `process/function/`, while its `entry-points.json` still says `agent`.
|
|
30
|
+
*/
|
|
31
|
+
export function builderOf(project) {
|
|
32
|
+
const entry = project.entryPointType?.toLowerCase();
|
|
33
|
+
if (entry === 'agent')
|
|
34
|
+
return { kind: 'agent', label: 'agent', open: 'agent({ ' };
|
|
35
|
+
if (entry === 'function')
|
|
36
|
+
return { kind: 'publishedFunction', label: 'publishedFunction', open: 'publishedFunction({ ' };
|
|
37
|
+
switch (project.resourceType.toLowerCase()) {
|
|
38
|
+
case 'process': return { kind: 'rpaWorkflow', label: 'rpaWorkflow', open: 'rpaWorkflow({ ' };
|
|
39
|
+
case 'api': return { kind: 'apiWorkflow', label: 'apiWorkflow', open: 'apiWorkflow({ ' };
|
|
40
|
+
case 'function': return { kind: 'publishedFunction', label: 'publishedFunction', open: 'publishedFunction({ ' };
|
|
41
|
+
case 'agent': return { kind: 'agent', label: 'agent', open: 'agent({ ' };
|
|
42
|
+
case 'flow': return { kind: 'agenticProcess', form: 'flow', label: "agenticProcess with form 'flow'", open: "agenticProcess({ form: 'flow', " };
|
|
43
|
+
case 'processorchestration': return { kind: 'agenticProcess', form: 'bpmn', label: "agenticProcess with form 'bpmn'", open: "agenticProcess({ form: 'bpmn', " };
|
|
44
|
+
case 'casemanagement': return { kind: 'agenticProcess', form: 'case', label: "agenticProcess with form 'case'", open: "agenticProcess({ form: 'case', " };
|
|
45
|
+
default: return undefined;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/** Whether a `kind` step (with `form`, for an agentic process) is the call `builder` names. */
|
|
49
|
+
function fits(builder, kind, form) {
|
|
50
|
+
if (builder === undefined || builder.kind !== kind)
|
|
51
|
+
return false;
|
|
52
|
+
return kind !== 'agenticProcess' || (form ?? 'bpmn') === builder.form;
|
|
53
|
+
}
|
|
54
|
+
/** A JSON schema type as a `returns` type; anything else (a union, `null`) reads as `object`. */
|
|
55
|
+
function returnType(type) {
|
|
56
|
+
return type === 'string' || type === 'number' || type === 'integer' || type === 'boolean' || type === 'array'
|
|
57
|
+
? type
|
|
58
|
+
: 'object';
|
|
59
|
+
}
|
|
60
|
+
/** The project a step names: by `project`, else by its `key`. */
|
|
61
|
+
function namedProject(s, solution) {
|
|
62
|
+
if (!blank(s.project))
|
|
63
|
+
return solutionProjectByName(solution, String(s.project).trim());
|
|
64
|
+
return !blank(s.key) ? solutionProjectByKey(solution, String(s.key)) : undefined;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* `inputs` with what the solution says about the sibling it names filled in.
|
|
68
|
+
* Only an in-solution step named by `project`, whose sibling is found and is
|
|
69
|
+
* this factory's, is filled; a field the author wrote is kept (a wrong one is
|
|
70
|
+
* `refuseInSolution`'s). Anything else is returned unchanged.
|
|
71
|
+
*/
|
|
72
|
+
export function resolveInSolution(kind, inputs, solution) {
|
|
73
|
+
const authored = (inputs ?? {});
|
|
74
|
+
// `project` names a sibling, so it implies the location; beside 'published' it is refused.
|
|
75
|
+
if (blank(authored.project) || (authored.location !== undefined && authored.location !== 'in-solution'))
|
|
76
|
+
return inputs;
|
|
77
|
+
const s = { ...authored, location: 'in-solution' };
|
|
78
|
+
const project = String(s.project).trim();
|
|
79
|
+
// The name is the project's either way, so an unresolved one is not also "has no name".
|
|
80
|
+
const found = solution !== undefined ? solutionProjectByName(solution, project) : undefined;
|
|
81
|
+
if (found === undefined || !fits(builderOf(found), kind, s.form)) {
|
|
82
|
+
return blank(s.name) ? { ...s, name: project } : s;
|
|
83
|
+
}
|
|
84
|
+
const outputs = found.outputs !== undefined && Object.keys(found.outputs).length > 0 ? found.outputs : undefined;
|
|
85
|
+
const fillReturns = s.returns === undefined && s.completion !== 'fire-and-forget' && outputs !== undefined;
|
|
86
|
+
return {
|
|
87
|
+
...s,
|
|
88
|
+
key: blank(s.key) ? found.key : s.key,
|
|
89
|
+
name: blank(s.name) ? found.name : s.name,
|
|
90
|
+
projectId: blank(s.projectId) ? found.projectId : s.projectId,
|
|
91
|
+
...(fillReturns ? { returns: Object.fromEntries(Object.entries(outputs).map(([f, t]) => [f, returnType(t)])) } : {}),
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
/** ` The solution's projects: "CalculatePay" (rpaWorkflow, resources/…/CalculatePay.json); …` */
|
|
95
|
+
function siblingList(solution) {
|
|
96
|
+
if (solution.projects.length === 0)
|
|
97
|
+
return '';
|
|
98
|
+
return ` The solution's projects: ${solution.projects
|
|
99
|
+
.map((p) => `"${p.name}" (${builderOf(p)?.label ?? p.resourceType}, ${p.file})`)
|
|
100
|
+
.join('; ')}.`;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Throw what the serializer cannot write correctly about an in-solution step,
|
|
104
|
+
* knowing the solution. For instance `publishedFunction({ location:
|
|
105
|
+
* 'in-solution', project: 'Summarizer' })` on a project whose entry point is an
|
|
106
|
+
* agent throws `IN_SOLUTION_WRONG_BUILDER`, naming `agent(`.
|
|
107
|
+
*/
|
|
108
|
+
export function refuseInSolution(kind, inputs, solution, step) {
|
|
109
|
+
const s = (inputs ?? {});
|
|
110
|
+
const byProject = !blank(s.project);
|
|
111
|
+
if (byProject && s.location !== undefined && s.location !== 'in-solution') {
|
|
112
|
+
throw new CompileRefusal('IN_SOLUTION_PROJECT_PUBLISHED', `Step "${step}" names project ${JSON.stringify(s.project)} with \`location: ${JSON.stringify(s.location)}\`. `
|
|
113
|
+
+ `\`project\` names a sibling of this solution; a published process is named by \`key\`, \`name\` and `
|
|
114
|
+
+ `\`folderPath\`. Drop \`location\` (or set 'in-solution') to call the sibling, or drop \`project\`.`, `location: 'in-solution'`);
|
|
115
|
+
}
|
|
116
|
+
if (s.location !== 'in-solution')
|
|
117
|
+
return;
|
|
118
|
+
if (solution === undefined) {
|
|
119
|
+
if (!byProject)
|
|
120
|
+
return;
|
|
121
|
+
throw new CompileRefusal('IN_SOLUTION_NO_SOLUTION', `Step "${step}" calls in-solution project ${JSON.stringify(s.project)}, but this compile was given no `
|
|
122
|
+
+ `solution to look it up in. \`flow compile\`, \`flow check\` and \`flow merge\` read it from the nearest folder `
|
|
123
|
+
+ `at or above the flow that holds a \`.uipx\`, and found none; a library call to \`serialize()\` or \`check()\` `
|
|
124
|
+
+ `passes it as the \`solution\` option. Run the command from inside the solution (\`<Solution>/<FlowProject>/\`), `
|
|
125
|
+
+ `or write the sibling's \`key\` and \`projectId\` instead of \`project\`.`, `key: '<resource.key>', projectId: '<resource.projectKey>'`);
|
|
126
|
+
}
|
|
127
|
+
// Nothing to check an explicit key against: the solution was never refreshed,
|
|
128
|
+
// so the step's key cannot be judged here (`flow validate` sees it).
|
|
129
|
+
if (!byProject && solution.projects.length === 0)
|
|
130
|
+
return;
|
|
131
|
+
const project = namedProject(s, solution);
|
|
132
|
+
if (project === undefined) {
|
|
133
|
+
const refresh = solution.projects.length === 0
|
|
134
|
+
? ` The solution has no project resource files yet: run \`uip solution resources refresh\` in ${solution.dir} `
|
|
135
|
+
+ `after \`uip solution projects add\`, then compile again.`
|
|
136
|
+
: '';
|
|
137
|
+
if (byProject) {
|
|
138
|
+
const near = nearestName(String(s.project), solution.projects.map((p) => p.name));
|
|
139
|
+
throw new CompileRefusal('IN_SOLUTION_PROJECT_NOT_FOUND', `Step "${step}" calls in-solution project ${JSON.stringify(s.project)}, but the solution has no project of that `
|
|
140
|
+
+ `name under resources/solution_folder/process/.${siblingList(solution)}${refresh}`, near !== undefined ? `project: '${near}'` : undefined);
|
|
141
|
+
}
|
|
142
|
+
const byName = !blank(s.name) ? solutionProjectByName(solution, String(s.name).trim()) : undefined;
|
|
143
|
+
if (byName !== undefined) {
|
|
144
|
+
throw new CompileRefusal('IN_SOLUTION_KEY_MISMATCH', `In-solution step "${step}" has \`key\` ${JSON.stringify(s.key)}, but project "${byName.name}" has resource key `
|
|
145
|
+
+ `"${byName.key}" (${byName.file}). A key that names no sibling is a node the platform cannot resolve. `
|
|
146
|
+
+ `Write \`project: '${byName.name}'\` and drop \`key\` and \`projectId\`, so compile reads them.`, `project: '${byName.name}'`);
|
|
147
|
+
}
|
|
148
|
+
throw new CompileRefusal('IN_SOLUTION_PROJECT_NOT_FOUND', `In-solution step "${step}" has \`key\` ${JSON.stringify(s.key)}, which is no project's resource key in this `
|
|
149
|
+
+ `solution.${siblingList(solution)} Name the sibling with \`project: '<name>'\` and drop \`key\` and \`projectId\`.`);
|
|
150
|
+
}
|
|
151
|
+
const builder = builderOf(project);
|
|
152
|
+
if (!fits(builder, kind, s.form)) {
|
|
153
|
+
const why = project.entryPointType !== undefined
|
|
154
|
+
? `its entry point is of type "${project.entryPointType}" and its resource is in ${project.file}`
|
|
155
|
+
: `its resource is in ${project.file}`;
|
|
156
|
+
throw new CompileRefusal('IN_SOLUTION_WRONG_BUILDER', `Step "${step}" calls project "${project.name}" with the wrong builder: ${why}, so it is called with `
|
|
157
|
+
+ `${builder !== undefined ? builder.label : 'no process builder'}. The wrong builder writes a node `
|
|
158
|
+
+ `that validates and starts nothing.`, builder !== undefined ? `${builder.open}location: 'in-solution', project: '${project.name}', … })` : undefined);
|
|
159
|
+
}
|
|
160
|
+
if (!blank(s.key) && !sameGuid(String(s.key), project.key)) {
|
|
161
|
+
throw new CompileRefusal('IN_SOLUTION_KEY_MISMATCH', `In-solution step "${step}" has \`key\` ${JSON.stringify(s.key)}, but project "${project.name}" has resource key `
|
|
162
|
+
+ `"${project.key}" (${project.file}). Drop \`key\` and let compile read it from \`project\`.`, `key: '${project.key}'`);
|
|
163
|
+
}
|
|
164
|
+
if (!blank(s.projectId) && !sameGuid(String(s.projectId), project.projectId)) {
|
|
165
|
+
throw new CompileRefusal('IN_SOLUTION_KEY_MISMATCH', `In-solution step "${step}" has \`projectId\` ${JSON.stringify(s.projectId)}, but project "${project.name}" has `
|
|
166
|
+
+ `\`resource.projectKey\` "${project.projectId}" (${project.file}). Drop \`projectId\` and let compile read it `
|
|
167
|
+
+ `from \`project\`.`, `projectId: '${project.projectId}'`);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
@@ -19,6 +19,7 @@ import { resourceNodeSortOrder } from '../../../core/process-resource-sort-order
|
|
|
19
19
|
import { processResourceBindings, processResourceLocation } from '../../../core/process-resource.js';
|
|
20
20
|
import { checkAgent, checkAgentRead, checkAgenticProcess, checkAgenticProcessRead, checkApiWorkflow, checkApiWorkflowRead, checkPublishedFunction, checkPublishedFunctionRead, checkRpaWorkflow, rpaWorkflowRead, } from './check.js';
|
|
21
21
|
import { refuseLossyProcess } from './refusals.js';
|
|
22
|
+
import { refuseInSolution, resolveInSolution } from './in-solution.js';
|
|
22
23
|
import { declareKeys } from '../../../core/option-keys.js';
|
|
23
24
|
/** The RPA-workflow node type family. The process's release key is the suffix. */
|
|
24
25
|
const RPA_WORKFLOW_PREFIX = 'uipath.core.rpa-workflow.';
|
|
@@ -644,6 +645,9 @@ export function processDefinition(spec) {
|
|
|
644
645
|
* are identical, and the DATA paths that differ are all downstream in the engine.
|
|
645
646
|
*/
|
|
646
647
|
function serializeProcess(spec, ctx) {
|
|
648
|
+
// A sibling the solution does not have, or one this factory cannot call:
|
|
649
|
+
// refused before the generic rules, which would only say "no key" (#1978).
|
|
650
|
+
refuseInSolution(spec.kind, spec.inputs, ctx.solution, ctx.step);
|
|
647
651
|
// A missing key, a folder beside in-solution, a reserved `fireAndForget`
|
|
648
652
|
// argument: each would be written wrong, so it is refused here (#1518).
|
|
649
653
|
refuseLossyProcess(spec.kind, spec.inputs, ctx.step);
|
|
@@ -834,11 +838,11 @@ function processCheck(spec, ctx) {
|
|
|
834
838
|
}
|
|
835
839
|
/** Every key of each factory's options (builder-sdk#1990), by kind; `tsc` holds each list to its type. */
|
|
836
840
|
const PROCESS_OPTIONS = {
|
|
837
|
-
rpaWorkflow: { inputs: declareKeys({ key: true, name: true, location: true, folderPath: true, projectId: true, inputs: true, returns: true }) },
|
|
838
|
-
apiWorkflow: { inputs: declareKeys({ key: true, name: true, location: true, folderPath: true, projectId: true, inputs: true, returns: true }) },
|
|
839
|
-
publishedFunction: { inputs: declareKeys({ key: true, name: true, location: true, folderPath: true, projectId: true, inputs: true, returns: true }) },
|
|
840
|
-
agenticProcess: { inputs: declareKeys({ key: true, name: true, location: true, folderPath: true, projectId: true, inputs: true, form: true, completion: true, returns: true }) },
|
|
841
|
-
agent: { inputs: declareKeys({ key: true, name: true, location: true, folderPath: true, projectId: true, inputs: true, returns: true, flavour: true }) },
|
|
841
|
+
rpaWorkflow: { inputs: declareKeys({ key: true, name: true, location: true, project: true, folderPath: true, projectId: true, inputs: true, returns: true }) },
|
|
842
|
+
apiWorkflow: { inputs: declareKeys({ key: true, name: true, location: true, project: true, folderPath: true, projectId: true, inputs: true, returns: true }) },
|
|
843
|
+
publishedFunction: { inputs: declareKeys({ key: true, name: true, location: true, project: true, folderPath: true, projectId: true, inputs: true, returns: true }) },
|
|
844
|
+
agenticProcess: { inputs: declareKeys({ key: true, name: true, location: true, project: true, folderPath: true, projectId: true, inputs: true, form: true, completion: true, returns: true }) },
|
|
845
|
+
agent: { inputs: declareKeys({ key: true, name: true, location: true, project: true, folderPath: true, projectId: true, inputs: true, returns: true, flavour: true }) },
|
|
842
846
|
};
|
|
843
847
|
function processType(kind, prefix, factory, form) {
|
|
844
848
|
const impl = {
|
|
@@ -853,6 +857,9 @@ function processType(kind, prefix, factory, form) {
|
|
|
853
857
|
// check collected no expressions for a process step before the port; unchanged by it.
|
|
854
858
|
expressions: () => [],
|
|
855
859
|
output: processOutput,
|
|
860
|
+
// An in-solution step named by `project` takes its key, project id, name and
|
|
861
|
+
// returns from the sibling's files (#1978).
|
|
862
|
+
withSolution: (spec, solution) => ({ ...spec, inputs: resolveInSolution(spec.kind, spec.inputs, solution) }),
|
|
856
863
|
...(kind === 'agenticProcess' ? {
|
|
857
864
|
fireAndForget: ({ inputs }) => inputs?.completion === 'fire-and-forget'
|
|
858
865
|
? { fix: "completion: 'wait'" }
|