@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
|
@@ -15,19 +15,39 @@ export interface RpaWorkflowInputs {
|
|
|
15
15
|
* `uip or processes list --all-folders --process-type Process` (the row's `Key`)
|
|
16
16
|
* or `uip maestro flow registry search "uipath.core.rpa-workflow"`.
|
|
17
17
|
*
|
|
18
|
-
* For an in-solution sibling it
|
|
18
|
+
* For an in-solution sibling, leave it out and set `project`: compile fills
|
|
19
|
+
* it with `resource.key` from
|
|
19
20
|
* `resources/solution_folder/process/process/<project>.json` — the suffix of the
|
|
20
21
|
* node type `uip maestro flow registry list --local` shows.
|
|
21
22
|
*/
|
|
22
|
-
key
|
|
23
|
-
/** The process's name in Orchestrator — e.g. `'RPA Workflow'`. */
|
|
24
|
-
name
|
|
23
|
+
key?: string;
|
|
24
|
+
/** The process's name in Orchestrator — e.g. `'RPA Workflow'`. Filled from `project` for an in-solution sibling. */
|
|
25
|
+
name?: string;
|
|
25
26
|
/**
|
|
26
27
|
* Where the process lives. `'published'` (the default) is a process deployed
|
|
27
28
|
* to `folderPath`. `'in-solution'` is a sibling RPA project of the same
|
|
28
29
|
* solution: it needs `projectId` and no `folderPath`.
|
|
29
30
|
*/
|
|
30
31
|
location?: ProcessLocation;
|
|
32
|
+
/**
|
|
33
|
+
* The sibling project of this solution to call, by name — e.g.
|
|
34
|
+
* `'CalculatePay'`. It implies `location: 'in-solution'`. `compile` and `check`
|
|
35
|
+
* then read the project's `resources/solution_folder/process/<type>/<project>.json`
|
|
36
|
+
* and `entry-points.json`, and fill `key`, `projectId`, `name` and (when you
|
|
37
|
+
* declare none) `returns`, so none of them is copied by hand:
|
|
38
|
+
*
|
|
39
|
+
* ```ts
|
|
40
|
+
* rpaWorkflow({ location: 'in-solution', project: 'CalculatePay', inputs: { hours: 40 } })
|
|
41
|
+
* ```
|
|
42
|
+
*
|
|
43
|
+
* The flow must be compiled from inside its solution (a folder at or above it
|
|
44
|
+
* holds the `.uipx`), after `uip solution resources refresh`.
|
|
45
|
+
*
|
|
46
|
+
* @enforcedBy IN_SOLUTION_PROJECT_NOT_FOUND The solution has a project of this name.
|
|
47
|
+
* @enforcedBy IN_SOLUTION_WRONG_BUILDER The project is one this builder calls.
|
|
48
|
+
* @enforcedBy IN_SOLUTION_NO_SOLUTION The flow is compiled inside a solution.
|
|
49
|
+
*/
|
|
50
|
+
project?: string;
|
|
31
51
|
/**
|
|
32
52
|
* The Orchestrator folder holding the process — e.g.
|
|
33
53
|
* `'Shared/uipath-maestro-flow/ProjectEuler RPA'`. Required for a published
|
|
@@ -41,7 +61,8 @@ export interface RpaWorkflowInputs {
|
|
|
41
61
|
* `resources/solution_folder/process/process/<project>.json`. Used only when
|
|
42
62
|
* `location` is `'in-solution'`. The step resolves by `key`, so omitting it is a
|
|
43
63
|
* warning, not an error; but Studio Web's Run node reads it to deploy the
|
|
44
|
-
* sibling first, so set it on a step you author
|
|
64
|
+
* sibling first, so set it on a step you author,
|
|
65
|
+
* or set `project` and compile fills it.
|
|
45
66
|
*
|
|
46
67
|
* @enforcedBy RPA_LOCAL_NO_PROJECT_ID An in-solution process should name its project (warning).
|
|
47
68
|
*/
|
|
@@ -77,13 +98,14 @@ export interface ApiWorkflowInputs {
|
|
|
77
98
|
* `ProcessKey` reads `<name>.api.<name>`; the GUID you want is the row's `Key`)
|
|
78
99
|
* or `uip maestro flow registry search`.
|
|
79
100
|
*
|
|
80
|
-
* For an in-solution sibling it
|
|
101
|
+
* For an in-solution sibling, leave it out and set `project`: compile fills
|
|
102
|
+
* it with `resource.key` from
|
|
81
103
|
* `resources/solution_folder/process/api/<project>.json`, the suffix of the
|
|
82
104
|
* node type `uip maestro flow registry list --local` shows.
|
|
83
105
|
*/
|
|
84
|
-
key
|
|
85
|
-
/** The workflow's name in Orchestrator — e.g. `'NameToAgeFixed'`. */
|
|
86
|
-
name
|
|
106
|
+
key?: string;
|
|
107
|
+
/** The workflow's name in Orchestrator — e.g. `'NameToAgeFixed'`. Filled from `project` for an in-solution sibling. */
|
|
108
|
+
name?: string;
|
|
87
109
|
/**
|
|
88
110
|
* Where the workflow lives. `'published'` (the default) is a workflow
|
|
89
111
|
* deployed to `folderPath`. `'in-solution'` is a sibling API workflow project
|
|
@@ -91,6 +113,25 @@ export interface ApiWorkflowInputs {
|
|
|
91
113
|
* that sibling's `resource.key`.
|
|
92
114
|
*/
|
|
93
115
|
location?: ProcessLocation;
|
|
116
|
+
/**
|
|
117
|
+
* The sibling project of this solution to call, by name — e.g.
|
|
118
|
+
* `'CalculatePay'`. It implies `location: 'in-solution'`. `compile` and `check`
|
|
119
|
+
* then read the project's `resources/solution_folder/process/<type>/<project>.json`
|
|
120
|
+
* and `entry-points.json`, and fill `key`, `projectId`, `name` and (when you
|
|
121
|
+
* declare none) `returns`, so none of them is copied by hand:
|
|
122
|
+
*
|
|
123
|
+
* ```ts
|
|
124
|
+
* rpaWorkflow({ location: 'in-solution', project: 'CalculatePay', inputs: { hours: 40 } })
|
|
125
|
+
* ```
|
|
126
|
+
*
|
|
127
|
+
* The flow must be compiled from inside its solution (a folder at or above it
|
|
128
|
+
* holds the `.uipx`), after `uip solution resources refresh`.
|
|
129
|
+
*
|
|
130
|
+
* @enforcedBy IN_SOLUTION_PROJECT_NOT_FOUND The solution has a project of this name.
|
|
131
|
+
* @enforcedBy IN_SOLUTION_WRONG_BUILDER The project is one this builder calls.
|
|
132
|
+
* @enforcedBy IN_SOLUTION_NO_SOLUTION The flow is compiled inside a solution.
|
|
133
|
+
*/
|
|
134
|
+
project?: string;
|
|
94
135
|
/**
|
|
95
136
|
* The Orchestrator folder holding it — e.g. `'Shared'`. Required for a
|
|
96
137
|
* published workflow; omit it for an in-solution sibling.
|
|
@@ -142,13 +183,14 @@ export interface PublishedFunctionInputs {
|
|
|
142
183
|
* `uip maestro flow registry search "uipath.core.function"` (after
|
|
143
184
|
* `registry pull --force`) or the Orchestrator process listing.
|
|
144
185
|
*
|
|
145
|
-
* For an in-solution sibling it
|
|
186
|
+
* For an in-solution sibling, leave it out and set `project`: compile fills
|
|
187
|
+
* it with `resource.key` from
|
|
146
188
|
* `resources/solution_folder/process/function/<project>.json` — the suffix of
|
|
147
189
|
* the node type `uip maestro flow registry list --local` shows.
|
|
148
190
|
*/
|
|
149
|
-
key
|
|
150
|
-
/** The function's name in Orchestrator, e.g. `'acme-echo'`. */
|
|
151
|
-
name
|
|
191
|
+
key?: string;
|
|
192
|
+
/** The function's name in Orchestrator, e.g. `'acme-echo'`. Filled from `project` for an in-solution sibling. */
|
|
193
|
+
name?: string;
|
|
152
194
|
/**
|
|
153
195
|
* Where the function lives. `'published'` (the default) is a function
|
|
154
196
|
* deployed to `folderPath`. `'in-solution'` is a sibling coded-function
|
|
@@ -157,6 +199,25 @@ export interface PublishedFunctionInputs {
|
|
|
157
199
|
* `resources/solution_folder/process/function/<project>.json`.
|
|
158
200
|
*/
|
|
159
201
|
location?: ProcessLocation;
|
|
202
|
+
/**
|
|
203
|
+
* The sibling project of this solution to call, by name — e.g.
|
|
204
|
+
* `'CalculatePay'`. It implies `location: 'in-solution'`. `compile` and `check`
|
|
205
|
+
* then read the project's `resources/solution_folder/process/<type>/<project>.json`
|
|
206
|
+
* and `entry-points.json`, and fill `key`, `projectId`, `name` and (when you
|
|
207
|
+
* declare none) `returns`, so none of them is copied by hand:
|
|
208
|
+
*
|
|
209
|
+
* ```ts
|
|
210
|
+
* rpaWorkflow({ location: 'in-solution', project: 'CalculatePay', inputs: { hours: 40 } })
|
|
211
|
+
* ```
|
|
212
|
+
*
|
|
213
|
+
* The flow must be compiled from inside its solution (a folder at or above it
|
|
214
|
+
* holds the `.uipx`), after `uip solution resources refresh`.
|
|
215
|
+
*
|
|
216
|
+
* @enforcedBy IN_SOLUTION_PROJECT_NOT_FOUND The solution has a project of this name.
|
|
217
|
+
* @enforcedBy IN_SOLUTION_WRONG_BUILDER The project is one this builder calls.
|
|
218
|
+
* @enforcedBy IN_SOLUTION_NO_SOLUTION The flow is compiled inside a solution.
|
|
219
|
+
*/
|
|
220
|
+
project?: string;
|
|
160
221
|
/**
|
|
161
222
|
* The Orchestrator folder holding it. A function is usually deployed into a
|
|
162
223
|
* folder of its OWN name (e.g. `'Shared/acme-echo'`), and the binding's
|
|
@@ -203,9 +264,9 @@ interface AgenticProcessInputsBase {
|
|
|
203
264
|
* `--limit`/`--offset`, or scope the call with `--folder-path`, or a process that
|
|
204
265
|
* exists will look as though it does not.
|
|
205
266
|
*/
|
|
206
|
-
key
|
|
207
|
-
/** The process's name in Orchestrator — e.g. `'ProcurementProcess'`. */
|
|
208
|
-
name
|
|
267
|
+
key?: string;
|
|
268
|
+
/** The process's name in Orchestrator — e.g. `'ProcurementProcess'`. Filled from `project` for an in-solution sibling. */
|
|
269
|
+
name?: string;
|
|
209
270
|
/**
|
|
210
271
|
* Where the process lives. `'published'` (the default) is a process deployed
|
|
211
272
|
* to `folderPath`. `'in-solution'` is a sibling Flow of the same solution, so
|
|
@@ -217,6 +278,25 @@ interface AgenticProcessInputsBase {
|
|
|
217
278
|
* @enforcedBy AGENTIC_LOCAL_FORM_UNVERIFIED In-solution is supported for `form: 'flow'` only.
|
|
218
279
|
*/
|
|
219
280
|
location?: ProcessLocation;
|
|
281
|
+
/**
|
|
282
|
+
* The sibling project of this solution to call, by name — e.g.
|
|
283
|
+
* `'CalculatePay'`. It implies `location: 'in-solution'`. `compile` and `check`
|
|
284
|
+
* then read the project's `resources/solution_folder/process/<type>/<project>.json`
|
|
285
|
+
* and `entry-points.json`, and fill `key`, `projectId`, `name` and (when you
|
|
286
|
+
* declare none) `returns`, so none of them is copied by hand:
|
|
287
|
+
*
|
|
288
|
+
* ```ts
|
|
289
|
+
* rpaWorkflow({ location: 'in-solution', project: 'CalculatePay', inputs: { hours: 40 } })
|
|
290
|
+
* ```
|
|
291
|
+
*
|
|
292
|
+
* The flow must be compiled from inside its solution (a folder at or above it
|
|
293
|
+
* holds the `.uipx`), after `uip solution resources refresh`.
|
|
294
|
+
*
|
|
295
|
+
* @enforcedBy IN_SOLUTION_PROJECT_NOT_FOUND The solution has a project of this name.
|
|
296
|
+
* @enforcedBy IN_SOLUTION_WRONG_BUILDER The project is one this builder calls.
|
|
297
|
+
* @enforcedBy IN_SOLUTION_NO_SOLUTION The flow is compiled inside a solution.
|
|
298
|
+
*/
|
|
299
|
+
project?: string;
|
|
220
300
|
/**
|
|
221
301
|
* The Orchestrator folder holding it — e.g.
|
|
222
302
|
* `'Shared/uipath-agents/ProcurementProcess'`. Required for a published
|
|
@@ -303,7 +383,8 @@ export interface AgentInputs {
|
|
|
303
383
|
/**
|
|
304
384
|
* The agent resource key (a GUID). It becomes the node's TYPE,
|
|
305
385
|
* `uipath.core.agent.<key>`. For a published agent this is the Orchestrator
|
|
306
|
-
* release key; for an in-solution sibling it
|
|
386
|
+
* release key; for an in-solution sibling, leave it out and set `project`: compile fills it
|
|
387
|
+
* with `resource.key` from
|
|
307
388
|
* `resources/solution_folder/process/agent/<project>.json`.
|
|
308
389
|
*
|
|
309
390
|
* Find it with `uip or processes list --all-folders --process-type Agent` (an agent's
|
|
@@ -313,15 +394,34 @@ export interface AgentInputs {
|
|
|
313
394
|
* Pass `--limit`: `--all-folders` returns 50 rows and reports the truncation
|
|
314
395
|
* only in `Pagination.HasMore`, so an agent that exists can look absent.
|
|
315
396
|
*/
|
|
316
|
-
key
|
|
317
|
-
/** The agent project name. */
|
|
318
|
-
name
|
|
397
|
+
key?: string;
|
|
398
|
+
/** The agent project name. Filled from `project` for an in-solution sibling. */
|
|
399
|
+
name?: string;
|
|
319
400
|
/**
|
|
320
401
|
* Where the referenced agent lives. Published is the backward-compatible
|
|
321
402
|
* default. Use `in-solution` only after registering a sibling agent project
|
|
322
403
|
* with `uip solution projects add`.
|
|
323
404
|
*/
|
|
324
405
|
location?: AgentLocation;
|
|
406
|
+
/**
|
|
407
|
+
* The sibling project of this solution to call, by name — e.g.
|
|
408
|
+
* `'CalculatePay'`. It implies `location: 'in-solution'`. `compile` and `check`
|
|
409
|
+
* then read the project's `resources/solution_folder/process/<type>/<project>.json`
|
|
410
|
+
* and `entry-points.json`, and fill `key`, `projectId`, `name` and (when you
|
|
411
|
+
* declare none) `returns`, so none of them is copied by hand:
|
|
412
|
+
*
|
|
413
|
+
* ```ts
|
|
414
|
+
* rpaWorkflow({ location: 'in-solution', project: 'CalculatePay', inputs: { hours: 40 } })
|
|
415
|
+
* ```
|
|
416
|
+
*
|
|
417
|
+
* The flow must be compiled from inside its solution (a folder at or above it
|
|
418
|
+
* holds the `.uipx`), after `uip solution resources refresh`.
|
|
419
|
+
*
|
|
420
|
+
* @enforcedBy IN_SOLUTION_PROJECT_NOT_FOUND The solution has a project of this name.
|
|
421
|
+
* @enforcedBy IN_SOLUTION_WRONG_BUILDER The project is one this builder calls.
|
|
422
|
+
* @enforcedBy IN_SOLUTION_NO_SOLUTION The flow is compiled inside a solution.
|
|
423
|
+
*/
|
|
424
|
+
project?: string;
|
|
325
425
|
/**
|
|
326
426
|
* The Orchestrator folder holding it — e.g.
|
|
327
427
|
* `'Shared/uipath-maestro-flow/CountLetters LowCode'`.
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/** How many folder levels below the project the scan reads. */
|
|
2
|
+
export declare const MAX_DEPTH = 8;
|
|
3
|
+
/** How many folders the scan reads before it stops. */
|
|
4
|
+
export declare const MAX_DIRS = 2000;
|
|
5
|
+
/**
|
|
6
|
+
* The Flow project folder that holds `file`, or `undefined` when no
|
|
7
|
+
* `project.uiproj` sits at or above its folder.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* // Solution/Order/project.uiproj exists
|
|
11
|
+
* flowProjectOf('Solution/Order/backup/Order.flow') // '<abs>/Solution/Order'
|
|
12
|
+
* flowProjectOf('scratch/Order.flow') // undefined
|
|
13
|
+
*/
|
|
14
|
+
export declare function flowProjectOf(file: string): string | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* Every `.flow` file in the Flow project that holds `file`, other than `file`
|
|
17
|
+
* itself: paths relative to the project folder, sorted. Empty outside a project.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* otherProjectFlows('Solution/Order/Order.flow')
|
|
21
|
+
* // { project: '<abs>/Solution/Order', others: ['backup/Order.flow'] }
|
|
22
|
+
*/
|
|
23
|
+
export declare function otherProjectFlows(file: string): {
|
|
24
|
+
project: string | undefined;
|
|
25
|
+
others: string[];
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* The `SECOND_FLOW_IN_PROJECT` warning for writing `file`, or `undefined` when
|
|
29
|
+
* its project holds no other `.flow` a reader sees, or `file` itself sits where
|
|
30
|
+
* none looks (a dot-folder).
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* secondFlowWarning('Solution/Order/Order.flow')?.message
|
|
34
|
+
* // 'the Flow project Order/ holds another .flow besides Order.flow: backup/Order.flow. …'
|
|
35
|
+
*/
|
|
36
|
+
export declare function secondFlowWarning(file: string): {
|
|
37
|
+
level: 'warning';
|
|
38
|
+
code: 'SECOND_FLOW_IN_PROJECT';
|
|
39
|
+
message: string;
|
|
40
|
+
} | undefined;
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* project-flows — the other `.flow` files in the Flow project a write lands in,
|
|
3
|
+
* for compile's and merge's `SECOND_FLOW_IN_PROJECT` warning (#1996).
|
|
4
|
+
*
|
|
5
|
+
* Two readers take a project's `.flow` from its folder, not from a name:
|
|
6
|
+
*
|
|
7
|
+
* - `uip` (pack, debug, validate, `solution resources refresh`) picks one from
|
|
8
|
+
* the project root, `content/` or `flow_files/` (`scanProjectFlowFile` in the
|
|
9
|
+
* CLI's packager-tool-flow `flow-io.ts`). With several there and no
|
|
10
|
+
* `MainFile`, it takes whichever the file system lists first.
|
|
11
|
+
* - A reader that globs the project, as the eval graders do
|
|
12
|
+
* (`glob('**' + '/*.flow', recursive=True)`), reads every `.flow` below it
|
|
13
|
+
* outside dot-folders: Python's glob skips those.
|
|
14
|
+
*
|
|
15
|
+
* Neither reads a dot-folder, so `.flow-sdk/`, where the generated pipeline
|
|
16
|
+
* compiles its baseline, edited and merged candidates, is not scanned. A backup
|
|
17
|
+
* or a `baseline/` compile anywhere else in the project is. Compile and merge are
|
|
18
|
+
* the only writers of a `.flow`, so they say so:
|
|
19
|
+
*
|
|
20
|
+
* Solution/Order/project.uiproj
|
|
21
|
+
* Solution/Order/Order.flow <- the deliverable
|
|
22
|
+
* Solution/Order/backup/Order.flow <- warned: a second .flow
|
|
23
|
+
* Solution/Order/.flow-sdk/Order.merged.flow (not warned: no reader sees it)
|
|
24
|
+
*
|
|
25
|
+
* The project is found as `uip` finds it (`findFlowProjectRoot` in the CLI's
|
|
26
|
+
* packager-tool-flow `flow-project-root.ts`): the nearest folder at or above the
|
|
27
|
+
* written file that holds `project.uiproj`. Like `uip`, the climb tests only for
|
|
28
|
+
* that file, one `exists` per level: it never lists an ancestor, which for a
|
|
29
|
+
* write under a crowded `/tmp` would read every entry there. Outside a project
|
|
30
|
+
* nothing is a deliverable, and nothing is warned.
|
|
31
|
+
*
|
|
32
|
+
* The scan is bounded: it does not follow links, skips dot-folders,
|
|
33
|
+
* `node_modules/` and any nested folder that is a project of its own, and stops after
|
|
34
|
+
* {@link MAX_DEPTH} levels or {@link MAX_DIRS} folders.
|
|
35
|
+
*
|
|
36
|
+
* Library module (FB010): it returns the files, and the CLIs print the warning.
|
|
37
|
+
*/
|
|
38
|
+
import { existsSync, readdirSync } from 'node:fs';
|
|
39
|
+
import { dirname, join, relative, resolve } from 'node:path';
|
|
40
|
+
/** How many folder levels below the project the scan reads. */
|
|
41
|
+
export const MAX_DEPTH = 8;
|
|
42
|
+
/** How many folders the scan reads before it stops. */
|
|
43
|
+
export const MAX_DIRS = 2000;
|
|
44
|
+
/** Folders the scan never enters besides dot-folders. */
|
|
45
|
+
const SKIPPED = new Set(['node_modules']);
|
|
46
|
+
/**
|
|
47
|
+
* The Flow project folder that holds `file`, or `undefined` when no
|
|
48
|
+
* `project.uiproj` sits at or above its folder.
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* // Solution/Order/project.uiproj exists
|
|
52
|
+
* flowProjectOf('Solution/Order/backup/Order.flow') // '<abs>/Solution/Order'
|
|
53
|
+
* flowProjectOf('scratch/Order.flow') // undefined
|
|
54
|
+
*/
|
|
55
|
+
export function flowProjectOf(file) {
|
|
56
|
+
let dir = dirname(resolve(file));
|
|
57
|
+
for (;;) {
|
|
58
|
+
if (existsSync(join(dir, 'project.uiproj')))
|
|
59
|
+
return dir;
|
|
60
|
+
const parent = dirname(dir);
|
|
61
|
+
if (parent === dir)
|
|
62
|
+
return undefined;
|
|
63
|
+
dir = parent;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Every `.flow` file in the Flow project that holds `file`, other than `file`
|
|
68
|
+
* itself: paths relative to the project folder, sorted. Empty outside a project.
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* otherProjectFlows('Solution/Order/Order.flow')
|
|
72
|
+
* // { project: '<abs>/Solution/Order', others: ['backup/Order.flow'] }
|
|
73
|
+
*/
|
|
74
|
+
export function otherProjectFlows(file) {
|
|
75
|
+
const project = flowProjectOf(file);
|
|
76
|
+
if (project === undefined)
|
|
77
|
+
return { project, others: [] };
|
|
78
|
+
const self = resolve(file);
|
|
79
|
+
const others = [];
|
|
80
|
+
const queue = [{ dir: project, depth: 0 }];
|
|
81
|
+
let read = 0;
|
|
82
|
+
while (queue.length > 0 && read < MAX_DIRS) {
|
|
83
|
+
const { dir, depth } = queue.shift();
|
|
84
|
+
read++;
|
|
85
|
+
let entries;
|
|
86
|
+
try {
|
|
87
|
+
entries = readdirSync(dir, { withFileTypes: true });
|
|
88
|
+
}
|
|
89
|
+
catch {
|
|
90
|
+
continue;
|
|
91
|
+
}
|
|
92
|
+
for (const e of entries) {
|
|
93
|
+
const path = join(dir, e.name);
|
|
94
|
+
if (e.isFile() && e.name.endsWith('.flow')) {
|
|
95
|
+
if (path !== self)
|
|
96
|
+
others.push(relative(project, path));
|
|
97
|
+
}
|
|
98
|
+
else if (e.isDirectory() && !e.name.startsWith('.') && !SKIPPED.has(e.name) && depth < MAX_DEPTH && !existsSync(join(path, 'project.uiproj'))) {
|
|
99
|
+
queue.push({ dir: path, depth: depth + 1 });
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
return { project, others: others.sort() };
|
|
104
|
+
}
|
|
105
|
+
/** A project-relative path inside a folder the scan does not read (a dot-folder, `node_modules/`). */
|
|
106
|
+
function unread(rel) {
|
|
107
|
+
return rel.split(/[\\/]/).slice(0, -1).some((seg) => seg.startsWith('.') || SKIPPED.has(seg));
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* The `SECOND_FLOW_IN_PROJECT` warning for writing `file`, or `undefined` when
|
|
111
|
+
* its project holds no other `.flow` a reader sees, or `file` itself sits where
|
|
112
|
+
* none looks (a dot-folder).
|
|
113
|
+
*
|
|
114
|
+
* @example
|
|
115
|
+
* secondFlowWarning('Solution/Order/Order.flow')?.message
|
|
116
|
+
* // 'the Flow project Order/ holds another .flow besides Order.flow: backup/Order.flow. …'
|
|
117
|
+
*/
|
|
118
|
+
export function secondFlowWarning(file) {
|
|
119
|
+
const { project, others } = otherProjectFlows(file);
|
|
120
|
+
if (project === undefined || others.length === 0)
|
|
121
|
+
return undefined;
|
|
122
|
+
// Written into a dot-folder (the pipeline's `.flow-sdk/Order.baseline/Order.flow`):
|
|
123
|
+
// no reader sees this file, so it competes with nothing.
|
|
124
|
+
if (unread(relative(project, resolve(file))))
|
|
125
|
+
return undefined;
|
|
126
|
+
const shown = others.length > 5 ? `${others.slice(0, 5).join(', ')}, and ${others.length - 5} more` : others.join(', ');
|
|
127
|
+
const name = relative(dirname(project), project) || project;
|
|
128
|
+
return {
|
|
129
|
+
level: 'warning',
|
|
130
|
+
code: 'SECOND_FLOW_IN_PROJECT',
|
|
131
|
+
message: `the Flow project ${name}/ holds another .flow besides ${relative(project, resolve(file))}: ${shown}. `
|
|
132
|
+
+ '`uip` packs and validates one .flow per project, taken from its root, content/ or flow_files/ (the first listed when there are several and no MainFile), '
|
|
133
|
+
+ 'and a reader that globs the project (**/*.flow) reads every .flow outside dot-folders. '
|
|
134
|
+
+ 'Keep one .flow in the project: delete the others, or move them out of it or into .flow-sdk/.',
|
|
135
|
+
};
|
|
136
|
+
}
|
package/dist/serialize.d.ts
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
* the platform emits, so the result passes `uip maestro flow validate`.
|
|
8
8
|
*/
|
|
9
9
|
import { type ResourceResolutions } from './core/resource-resolution.js';
|
|
10
|
+
import type { SolutionProjects } from './core/solution-projects.js';
|
|
10
11
|
import type { NodeCatalog } from './core/node-catalog.js';
|
|
11
12
|
import type { DefinitionReference } from './core/node-classes.js';
|
|
12
13
|
import type { BuiltFlow } from './flow-sdk.js';
|
|
@@ -79,6 +80,14 @@ export interface SerializeOpts {
|
|
|
79
80
|
* cache at `~/.uipath/nodes/index.json`; a programmatic caller passes its own.
|
|
80
81
|
*/
|
|
81
82
|
nodeCatalog?: NodeCatalog;
|
|
83
|
+
/**
|
|
84
|
+
* The solution the flow is authored in and its sibling projects, read by the
|
|
85
|
+
* CLI (`readSolutionProjects`, #1978). An in-solution process step named by
|
|
86
|
+
* `project` compiles from its sibling's resource file, and an explicit `key`
|
|
87
|
+
* or `projectId` is checked against it. Absent: a step named by `project` is
|
|
88
|
+
* refused (`IN_SOLUTION_NO_SOLUTION`) and an explicit key is not judged.
|
|
89
|
+
*/
|
|
90
|
+
solution?: SolutionProjects;
|
|
82
91
|
/**
|
|
83
92
|
* Receives each {@link SerializeWarning}. `compile-cli` prints them as
|
|
84
93
|
* `⚠ [CODE] …` after `check()`'s diagnostics; a caller that passes nothing
|
package/dist/serialize.js
CHANGED
|
@@ -385,6 +385,14 @@ function renderUpdates(updates, rename) {
|
|
|
385
385
|
return { variableId: rename.updates?.get(name) ?? name, expression };
|
|
386
386
|
});
|
|
387
387
|
}
|
|
388
|
+
/**
|
|
389
|
+
* The `type` a declared variable's global carries: its `types.*` name, or for
|
|
390
|
+
* a `{ type: types.number, format }` the width (`"double"`), the type the
|
|
391
|
+
* `.flow` it was decompiled from had (`VarSpec.format`).
|
|
392
|
+
*/
|
|
393
|
+
function globalType(decl) {
|
|
394
|
+
return decl.format ?? decl.type;
|
|
395
|
+
}
|
|
388
396
|
/**
|
|
389
397
|
* The optional metadata a declared variable persists on its global — appended
|
|
390
398
|
* AFTER the fixed fields so a flow that declares none is byte-identical to
|
|
@@ -1989,16 +1997,16 @@ function serializeFlow(built, opts) {
|
|
|
1989
1997
|
emitEnd(scope, uid(scope, 'end'), capped);
|
|
1990
1998
|
const globals = [];
|
|
1991
1999
|
for (const inp of child.inputs)
|
|
1992
|
-
globals.push({ id: inp.name, name: inp.name, direction: 'in', type: inp
|
|
2000
|
+
globals.push({ id: inp.name, name: inp.name, direction: 'in', type: globalType(inp), triggerNodeId: startId, ...varMeta(inp) });
|
|
1993
2001
|
for (const o of childGlobals.outputs)
|
|
1994
|
-
globals.push({ id: o.name, name: o.name, direction: 'out', type: o
|
|
2002
|
+
globals.push({ id: o.name, name: o.name, direction: 'out', type: globalType(o), ...varMeta(o) });
|
|
1995
2003
|
for (const o of childGlobals.outputs) {
|
|
1996
2004
|
const b = childGlobals.backing.get(o.name);
|
|
1997
2005
|
if (b && !childGlobals.backingAdopted.has(o.name))
|
|
1998
2006
|
globals.push(outputBackingGlobal(o, b));
|
|
1999
2007
|
}
|
|
2000
2008
|
for (const vd of childGlobals.vars)
|
|
2001
|
-
globals.push({ id: vd.name, name: vd.name, direction: 'inout', type: vd
|
|
2009
|
+
globals.push({ id: vd.name, name: vd.name, direction: 'inout', type: globalType(vd), ...varMeta(vd) });
|
|
2002
2010
|
resolveRejoins(scope, addEdge, (from, refusal) => refuseOn(scope, stepOfNode(scope, from.node), refusal));
|
|
2003
2011
|
assertHitlExitInvariant(scope.nodes, scope.edges, legacyCompletedNodes);
|
|
2004
2012
|
typeAgentInputSchemas(scope, globals);
|
|
@@ -2248,11 +2256,12 @@ function serializeFlow(built, opts) {
|
|
|
2248
2256
|
*/
|
|
2249
2257
|
function emitRegistered(entry, step, tails, scope, parentId) {
|
|
2250
2258
|
const where = `step "${step.name}"`;
|
|
2251
|
-
const spec = step.spec;
|
|
2252
2259
|
// A pin the registry has no implementation for, but the flow carries, is
|
|
2253
2260
|
// emitted at that version with the carried definition (#1128).
|
|
2254
|
-
const resolved = resolveVersionCarried(entry.type, spec, step.options?.version, where, carriedFor);
|
|
2261
|
+
const resolved = resolveVersionCarried(entry.type, step.spec, step.options?.version, where, carriedFor);
|
|
2255
2262
|
const impl = resolved.impl;
|
|
2263
|
+
// What the solution says about a sibling the step names (#1978), as check reads it.
|
|
2264
|
+
const spec = impl.withSolution ? impl.withSolution(step.spec, opts.solution) : step.spec;
|
|
2256
2265
|
const version = resolved.version;
|
|
2257
2266
|
const id = stepUid(scope, step.name);
|
|
2258
2267
|
if (impl.capsOpenTail)
|
|
@@ -2303,6 +2312,7 @@ function serializeFlow(built, opts) {
|
|
|
2303
2312
|
// to the step's next resource (two tools on one process share it).
|
|
2304
2313
|
bind: (b) => { bound.push(b); resourceBindings.set(b.id, b); },
|
|
2305
2314
|
resources: opts.resources,
|
|
2315
|
+
...(opts.solution !== undefined ? { solution: opts.solution } : {}),
|
|
2306
2316
|
// At a carried version the node's own definition IS the carried one,
|
|
2307
2317
|
// whatever version the implementation asks for (it was written for a
|
|
2308
2318
|
// bundled one), so its defaults and outputs come from the file's entry.
|
|
@@ -3632,19 +3642,19 @@ function serializeFlow(built, opts) {
|
|
|
3632
3642
|
const globals = [];
|
|
3633
3643
|
const triggerNodeId = built.triggerId ?? 'start';
|
|
3634
3644
|
for (const inp of built.inputs)
|
|
3635
|
-
globals.push({ id: inp.name, name: inp.name, direction: 'in', type: inp
|
|
3645
|
+
globals.push({ id: inp.name, name: inp.name, direction: 'in', type: globalType(inp), triggerNodeId, ...varMeta(inp) });
|
|
3636
3646
|
for (const o of rootGlobals.outputs)
|
|
3637
|
-
globals.push({ id: o.name, name: o.name, direction: 'out', type: o
|
|
3647
|
+
globals.push({ id: o.name, name: o.name, direction: 'out', type: globalType(o), ...varMeta(o) });
|
|
3638
3648
|
for (const o of rootGlobals.outputs) {
|
|
3639
3649
|
const b = rootGlobals.backing.get(o.name);
|
|
3640
3650
|
if (b && !rootGlobals.backingAdopted.has(o.name))
|
|
3641
3651
|
globals.push(outputBackingGlobal(o, b));
|
|
3642
3652
|
}
|
|
3643
3653
|
for (const vd of rootGlobals.vars)
|
|
3644
|
-
globals.push({ id: vd.name, name: vd.name, direction: 'inout', type: vd
|
|
3654
|
+
globals.push({ id: vd.name, name: vd.name, direction: 'inout', type: globalType(vd), ...varMeta(vd) });
|
|
3645
3655
|
for (const ep of entryPoints) {
|
|
3646
3656
|
for (const inp of ep.inputs) {
|
|
3647
|
-
globals.push({ id: inp.name, name: inp.name, direction: 'in', type: inp
|
|
3657
|
+
globals.push({ id: inp.name, name: inp.name, direction: 'in', type: globalType(inp), triggerNodeId: ep.id, ...varMeta(inp) });
|
|
3648
3658
|
}
|
|
3649
3659
|
}
|
|
3650
3660
|
resolveRejoins(root, addEdge, (from, refusal) => refuseOn(root, stepOfNode(root, from.node), refusal));
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { SolutionProjects } from './core/solution-projects.js';
|
|
2
|
+
/**
|
|
3
|
+
* The solution `fromDir` sits in, and its sibling projects; `undefined` when
|
|
4
|
+
* no folder at or above `fromDir` holds a `.uipx`.
|
|
5
|
+
*/
|
|
6
|
+
export declare function readSolutionProjects(fromDir: string): SolutionProjects | undefined;
|