@uipath/flow-tool 0.9.1 → 1.0.4
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/README.md +37 -37
- package/dist/index.js +1 -1
- package/dist/packager-tool.js +63928 -49263
- package/dist/services/flow-validate-service.d.ts +56 -0
- package/dist/services/node-validators/expression-prefix-validator.d.ts +45 -0
- package/dist/services/node-validators/index.d.ts +2 -0
- package/dist/services/node-validators/model-source-validator.d.ts +25 -0
- package/dist/services/node-validators/types.d.ts +1 -1
- package/dist/tool.js +197545 -200220
- package/dist/utils/handle-expansion.d.ts +50 -0
- package/dist/validation.d.ts +1 -1
- package/dist/validation.js +91132 -100106
- package/package.json +18 -18
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { NodeManifest } from "@uipath/flow-core";
|
|
1
2
|
import { type FlowNodeValidator, type ValidationIssue } from "./node-validators/index.js";
|
|
2
3
|
import type { WorkflowGovernanceEnforcements, WorkflowValidationRule } from "./node-validators/workflow-rule-types.js";
|
|
3
4
|
interface FlowValidateResult {
|
|
@@ -5,6 +6,7 @@ interface FlowValidateResult {
|
|
|
5
6
|
filePath: string;
|
|
6
7
|
issues: ValidationIssue[];
|
|
7
8
|
}
|
|
9
|
+
type ManifestForCurrentValidation = Pick<NodeManifest, "nodeType" | "version" | "handleConfiguration" | "supportsErrorHandling">;
|
|
8
10
|
/**
|
|
9
11
|
* Optional hooks callers can use to extend validation without editing this
|
|
10
12
|
* service. See `packages/flow-tool/src/services/node-validators/types.ts`
|
|
@@ -37,6 +39,18 @@ export interface FlowValidateOptions {
|
|
|
37
39
|
* in this allow-list.
|
|
38
40
|
*/
|
|
39
41
|
availableModelNames?: string[];
|
|
42
|
+
/**
|
|
43
|
+
* Compare edge handles against the current bundled OOTB manifests in
|
|
44
|
+
* addition to the definitions embedded in the .flow file. This catches
|
|
45
|
+
* flows generated with stale OOTB definitions that are internally
|
|
46
|
+
* consistent but render incorrectly in Studio Web.
|
|
47
|
+
*/
|
|
48
|
+
validateCurrentManifests?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Test/host override for the current manifest set. Supplying this also
|
|
51
|
+
* enables current-manifest validation.
|
|
52
|
+
*/
|
|
53
|
+
currentManifests?: ManifestForCurrentValidation[];
|
|
40
54
|
}
|
|
41
55
|
export declare class FlowValidateService {
|
|
42
56
|
private readonly fs;
|
|
@@ -44,15 +58,57 @@ export declare class FlowValidateService {
|
|
|
44
58
|
private readonly nodeValidators;
|
|
45
59
|
private readonly governanceEnforcements?;
|
|
46
60
|
private readonly availableModelNames?;
|
|
61
|
+
private readonly validateCurrentManifests;
|
|
62
|
+
private readonly currentManifestOverrides?;
|
|
63
|
+
private currentManifestCache?;
|
|
47
64
|
constructor(options?: FlowValidateOptions);
|
|
48
65
|
execute(flowFilePath: string): Promise<number>;
|
|
66
|
+
private loadCurrentManifestMap;
|
|
67
|
+
private loadCurrentManifestMapUncached;
|
|
49
68
|
validateFile(flowFilePath: string): Promise<FlowValidateResult>;
|
|
69
|
+
/**
|
|
70
|
+
* For agent nodes that reference an external agent definition via a
|
|
71
|
+
* `projectId` UUID, read the sibling `<uuid>/agent.json` file and
|
|
72
|
+
* populate `systemPrompt` / `userPrompt` (and governance-relevant
|
|
73
|
+
* settings) from the agent's `messages` array so that schema
|
|
74
|
+
* validation sees them.
|
|
75
|
+
*
|
|
76
|
+
* The UUID may be at `inputs.source` (canonical post-flow-core-0.2.50)
|
|
77
|
+
* or `model.source` (legacy). The autonomous-agent manifest's
|
|
78
|
+
* `model.source: true` declaration is a historical artifact from
|
|
79
|
+
* before the migration; current canvas writes go to `inputs.source`.
|
|
80
|
+
* `node.model.source` is read for backwards compatibility with older
|
|
81
|
+
* `.flow` files. MST-9263.
|
|
82
|
+
*
|
|
83
|
+
* Returns a map of `nodeId → AgentHydrationDiagnosis` so callers can
|
|
84
|
+
* decorate downstream `REQUIRED_FIELD` validator errors with a
|
|
85
|
+
* specific reason hydration could not fill the prompt fields.
|
|
86
|
+
*/
|
|
87
|
+
private resolveAgentPrompts;
|
|
88
|
+
/**
|
|
89
|
+
* Decorate `[REQUIRED_FIELD] systemPrompt|userPrompt` validator errors
|
|
90
|
+
* on inline-agent nodes with a diagnostic hint pinpointing why the
|
|
91
|
+
* resolver couldn't fill the field — so users see "agent.json not
|
|
92
|
+
* found at <path>" instead of just "systemPrompt is required". The
|
|
93
|
+
* raw AJV error stays in the message; the hint is appended on a
|
|
94
|
+
* second line. MST-9263.
|
|
95
|
+
*/
|
|
96
|
+
private enrichInlineAgentPromptIssues;
|
|
50
97
|
private validateGraph;
|
|
51
98
|
private validateEdgeReferences;
|
|
52
99
|
private validateNodeTypeDefinitions;
|
|
53
100
|
private validateUniqueIds;
|
|
54
101
|
/** Uniqueness check for `variables.globals` IDs; called once per scope (root + each subflow). */
|
|
55
102
|
private validateGlobalVariableUniqueness;
|
|
103
|
+
/**
|
|
104
|
+
* Catch stale embedded OOTB definitions. Studio Web renders against the
|
|
105
|
+
* current node manifest, while .flow files carry a serialized copy of the
|
|
106
|
+
* manifest that may have been produced by an older CLI. A flow can
|
|
107
|
+
* therefore be internally consistent, pass embedded-definition validation,
|
|
108
|
+
* and still render with missing edges because the edge handle no longer
|
|
109
|
+
* exists in the current manifest.
|
|
110
|
+
*/
|
|
111
|
+
private validateEdgeHandlesAgainstCurrentManifests;
|
|
56
112
|
/**
|
|
57
113
|
* Check that every edge references handles declared in the source/target
|
|
58
114
|
* node manifests, and that no handle exceeds its maxConnections constraint.
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { FlowNodeValidator } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Lints two related authoring failure modes around `=js:` expression-mode:
|
|
4
|
+
*
|
|
5
|
+
* 1. **Connector / HTTP parameters missing the `=js:` prefix (MST-9107).**
|
|
6
|
+
* The flow-workbench BPMN serializer rewrites `$vars` → `vars` regardless
|
|
7
|
+
* of whether the value carries the `=js:` prefix, so a string like
|
|
8
|
+
* `"$vars.X.output.Id"` ships to the runtime as the literal string
|
|
9
|
+
* `"vars.X.output.Id"` instead of being evaluated as an expression. The
|
|
10
|
+
* failure is silent: `flow validate` (without this rule) and `flow format`
|
|
11
|
+
* both pass; the activity input ends up bound to the literal string at
|
|
12
|
+
* runtime.
|
|
13
|
+
*
|
|
14
|
+
* Also catches the agent-invented `nodes.<id>.output.Y` syntax — there
|
|
15
|
+
* is no such reference dialect; the agent should write
|
|
16
|
+
* `=js:$vars.<id>.output.<f>`.
|
|
17
|
+
*
|
|
18
|
+
* 2. **Script-node `inputs.source` written as an expression-mode string
|
|
19
|
+
* (MST-9265 / MST-9260).** A Script node's `source` field is the
|
|
20
|
+
* JavaScript function body, not an expression-mode value. Authoring
|
|
21
|
+
* `inputs.source = "=js:vars.start.output.text"` makes the runtime
|
|
22
|
+
* treat the literal string as the JS source — i.e., the script reverses
|
|
23
|
+
* its own source code instead of the input. Flag values that begin with
|
|
24
|
+
* `=js:` so the agent gets an actionable error before `flow debug`.
|
|
25
|
+
*
|
|
26
|
+
* Scope:
|
|
27
|
+
* - Connector activity nodes (`uipath.connector.*`, excluding triggers) —
|
|
28
|
+
* missing-prefix scan against `inputs.detail.{body,query,path}Parameters`.
|
|
29
|
+
* - Managed HTTP nodes (`core.action.http.v2`) — same scan.
|
|
30
|
+
* - Custom HTTP nodes (`core.action.http`) — same scan.
|
|
31
|
+
* - Script nodes (`core.action.script`) — `inputs.source` literal-vs-
|
|
32
|
+
* expression check (MST-9260).
|
|
33
|
+
*
|
|
34
|
+
* Out of scope:
|
|
35
|
+
* - Decision / Switch / HTTP branch condition expressions — those are always
|
|
36
|
+
* parsed as JS, so `=js:` is forbidden, not required. Covered by the
|
|
37
|
+
* `condition-expression` rule in `@uipath/flow-schema`.
|
|
38
|
+
* - Variable updates — `bpmn-moddle.ensureJsPrefix` already auto-prefixes and
|
|
39
|
+
* warns; covered by `variable-update-service`.
|
|
40
|
+
* - End node output `source` and subflow input `source` — those ARE
|
|
41
|
+
* expression-mode fields where `=js:` is valid. A future check can lint
|
|
42
|
+
* their *contents* (resolvability) but the leading-`=js:` rule does not
|
|
43
|
+
* apply.
|
|
44
|
+
*/
|
|
45
|
+
export declare const expressionPrefixValidator: FlowNodeValidator;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { FlowNodeValidator } from "./types.js";
|
|
2
2
|
export { connectorNodeValidator } from "./connector-validator.js";
|
|
3
|
+
export { expressionPrefixValidator } from "./expression-prefix-validator.js";
|
|
4
|
+
export { modelSourceValidator } from "./model-source-validator.js";
|
|
3
5
|
export type { FlowNodeValidator, FlowValidatorContext, FlowValidatorNode, ValidationIssue, ValidationIssueSeverity, } from "./types.js";
|
|
4
6
|
/**
|
|
5
7
|
* Validators applied by default in `FlowValidateService`. Downstream tools
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { FlowNodeValidator } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Enforces the source-UUID contract for nodes whose plugin manifest declares
|
|
4
|
+
* `model: { source: true, ... }` at the top level.
|
|
5
|
+
*
|
|
6
|
+
* flow-core 0.2.50 moved the per-instance source UUID from `node.model.source`
|
|
7
|
+
* to `node.inputs.source`. Older `.flow` files may still carry the legacy
|
|
8
|
+
* `model.source` shape, so validation accepts both locations while reporting
|
|
9
|
+
* missing values against the canonical `inputs.source` path.
|
|
10
|
+
*
|
|
11
|
+
* Scope:
|
|
12
|
+
* - Any node whose plugin manifest declares `model.source === true`.
|
|
13
|
+
* - Currently observed plugins: `uipath.agent.autonomous`,
|
|
14
|
+
* `uipath.agent.conversational`. Plugin-list discovered dynamically
|
|
15
|
+
* from the registry — adding new agent-style plugins in the future
|
|
16
|
+
* doesn't require updating this validator.
|
|
17
|
+
*
|
|
18
|
+
* Out of scope:
|
|
19
|
+
* - Plugins that don't declare `model.source: true` (most node types).
|
|
20
|
+
* - Validating the UUID format of the source value — handled by the
|
|
21
|
+
* schema-validation rule in `@uipath/flow-schema`.
|
|
22
|
+
* - The `model.type`, `model.serviceType`, `model.version` fields —
|
|
23
|
+
* those are written by the canvas, not by the agent.
|
|
24
|
+
*/
|
|
25
|
+
export declare const modelSourceValidator: FlowNodeValidator;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Contribution surface for node-type-scoped validators in `uip flow validate`.
|
|
2
|
+
* Contribution surface for node-type-scoped validators in `uip maestro flow validate`.
|
|
3
3
|
*
|
|
4
4
|
* A `FlowNodeValidator` runs once per node during the validate pass and emits
|
|
5
5
|
* zero or more `ValidationIssue`s. This is the second pluggability layer of
|