@uipath/maestro-builder-sdk 6.107.0 → 6.109.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.
Files changed (35) hide show
  1. package/dist/api-index.md +10 -10
  2. package/dist/api-members.md +50 -45
  3. package/dist/check-cli.js +8 -3
  4. package/dist/check.d.ts +8 -0
  5. package/dist/check.js +10 -6
  6. package/dist/compile-cli.js +5 -0
  7. package/dist/core/nodes/node-type.d.ts +12 -2
  8. package/dist/core/refusals.d.ts +13 -0
  9. package/dist/core/refusals.js +13 -0
  10. package/dist/core/resource-resolution.d.ts +32 -0
  11. package/dist/core/resource-resolution.js +2 -0
  12. package/dist/core/solution-projects.d.ts +63 -0
  13. package/dist/core/solution-projects.js +37 -0
  14. package/dist/flow-node-type.d.ts +17 -0
  15. package/dist/merge-cli.js +8 -3
  16. package/dist/nodes/process/flow/check.js +36 -20
  17. package/dist/nodes/process/flow/contract.d.ts +81 -0
  18. package/dist/nodes/process/flow/contract.js +253 -0
  19. package/dist/nodes/process/flow/in-solution.d.ts +32 -0
  20. package/dist/nodes/process/flow/in-solution.js +169 -0
  21. package/dist/nodes/process/flow/node-type.js +37 -12
  22. package/dist/nodes/process/flow/refusals.d.ts +4 -1
  23. package/dist/nodes/process/flow/refusals.js +13 -1
  24. package/dist/nodes/process/flow/spec.d.ts +175 -20
  25. package/dist/registry/prepare/process-schema.d.ts +39 -0
  26. package/dist/registry/prepare/process-schema.js +90 -0
  27. package/dist/registry/prepare/resources.d.ts +2 -1
  28. package/dist/registry/prepare/resources.js +24 -3
  29. package/dist/registry/uip/commands.d.ts +8 -0
  30. package/dist/registry/uip/commands.js +10 -0
  31. package/dist/serialize.d.ts +9 -0
  32. package/dist/serialize.js +4 -2
  33. package/dist/solution-projects-files.d.ts +6 -0
  34. package/dist/solution-projects-files.js +163 -0
  35. package/package.json +2 -2
@@ -0,0 +1,163 @@
1
+ /**
2
+ * Reading a solution's sibling projects from disk, for `compile-cli` and
3
+ * `check-cli` (#1978). Apart from `core/solution-projects.ts`, whose shape the
4
+ * serializer and `check` read, so the flow core loads no `node:fs` (FB015).
5
+ *
6
+ * What is read, and where it comes from:
7
+ *
8
+ * - the solution folder: the nearest folder at or above the flow that holds a
9
+ * `*.uipx` (`solutionRoot`, which `registry prepare` and Case's orphan
10
+ * report use too);
11
+ * - every `resources/solution_folder/process/<type>/<Project>.json`, the
12
+ * resource file `uip solution resources refresh` writes for each project:
13
+ * `resource.name`, `resource.type`, `resource.key`, `resource.projectKey`;
14
+ * - each project's `entry-points.json`, found through the `.uipx` project
15
+ * whose `Id` is the resource's `projectKey` (else the folder named after the
16
+ * project), in the three places uipath-cli's `registry get --local` reads
17
+ * (`./`, `content/`, then `.local/content/`, where `uip rpa build` writes it),
18
+ * else, for a Flow project, the outputs its `.flow` declares.
19
+ *
20
+ * A file that is missing or does not parse is skipped, as the CLI's own reader
21
+ * skips it: one broken resource file must not fail a compile that does not
22
+ * call that project.
23
+ */
24
+ import { existsSync, readdirSync, readFileSync } from 'node:fs';
25
+ import { dirname, join, relative, resolve } from 'node:path';
26
+ import { isRecord } from './core/node-envelope.js';
27
+ import { sameGuid } from './core/solution-projects.js';
28
+ import { solutionRoot } from './registry/prepare/resources.js';
29
+ /** Parse a JSON file, or `undefined` when it is absent or is not JSON. */
30
+ function readJson(path) {
31
+ try {
32
+ return JSON.parse(readFileSync(path, 'utf8'));
33
+ }
34
+ catch {
35
+ return undefined;
36
+ }
37
+ }
38
+ /** The `.uipx` projects: id → the project's folder. */
39
+ function uipxProjectDirs(solutionDir) {
40
+ let entries;
41
+ try {
42
+ entries = readdirSync(solutionDir);
43
+ }
44
+ catch {
45
+ return [];
46
+ }
47
+ const uipx = entries.find((e) => e.endsWith('.uipx'));
48
+ if (uipx === undefined)
49
+ return [];
50
+ const parsed = readJson(join(solutionDir, uipx));
51
+ const projects = isRecord(parsed) && Array.isArray(parsed.Projects) ? parsed.Projects : [];
52
+ return projects.flatMap((p) => (isRecord(p) && typeof p.Id === 'string' && typeof p.ProjectRelativePath === 'string'
53
+ ? [{ id: p.Id, dir: resolve(solutionDir, dirname(p.ProjectRelativePath)) }]
54
+ : []));
55
+ }
56
+ /** The first entry point of the first `entry-points.json` that has one. */
57
+ function firstEntryPoint(projectDir) {
58
+ for (const path of [
59
+ join(projectDir, 'entry-points.json'),
60
+ join(projectDir, 'content', 'entry-points.json'),
61
+ join(projectDir, '.local', 'content', 'entry-points.json'),
62
+ ]) {
63
+ const parsed = readJson(path);
64
+ const entry = isRecord(parsed) && Array.isArray(parsed.entryPoints) ? parsed.entryPoints[0] : undefined;
65
+ if (isRecord(entry))
66
+ return entry;
67
+ }
68
+ return undefined;
69
+ }
70
+ /** `{ <field>: <type> }` from a JSON schema's `properties`; undefined when it has none. */
71
+ function schemaFields(schema) {
72
+ if (!isRecord(schema) || !isRecord(schema.properties))
73
+ return undefined;
74
+ const fields = {};
75
+ for (const [name, field] of Object.entries(schema.properties)) {
76
+ fields[name] = isRecord(field) && typeof field.type === 'string' ? field.type : 'object';
77
+ }
78
+ return fields;
79
+ }
80
+ /**
81
+ * The outputs a Flow project declares in its `.flow` (`variables.globals` with
82
+ * direction `out` or `inout`), for a sibling Flow no pack has written
83
+ * `entry-points.json` for yet: the fallback `registry get --local` takes too.
84
+ */
85
+ function flowOutputs(projectDir) {
86
+ let flowFile;
87
+ try {
88
+ flowFile = readdirSync(projectDir).sort().find((e) => e.endsWith('.flow'));
89
+ }
90
+ catch {
91
+ return undefined;
92
+ }
93
+ if (flowFile === undefined)
94
+ return undefined;
95
+ const parsed = readJson(join(projectDir, flowFile));
96
+ const globals = isRecord(parsed) && isRecord(parsed.variables) ? parsed.variables.globals : undefined;
97
+ if (!Array.isArray(globals))
98
+ return undefined;
99
+ const fields = {};
100
+ for (const g of globals) {
101
+ if (!isRecord(g) || typeof g.id !== 'string' || (g.direction !== 'out' && g.direction !== 'inout'))
102
+ continue;
103
+ fields[g.id] = typeof g.type === 'string' ? g.type : 'string';
104
+ }
105
+ return fields;
106
+ }
107
+ /**
108
+ * The solution `fromDir` sits in, and its sibling projects; `undefined` when
109
+ * no folder at or above `fromDir` holds a `.uipx`.
110
+ */
111
+ export function readSolutionProjects(fromDir) {
112
+ const dir = solutionRoot(fromDir);
113
+ if (dir === undefined)
114
+ return undefined;
115
+ const processDir = join(dir, 'resources', 'solution_folder', 'process');
116
+ if (!existsSync(processDir))
117
+ return { dir, projects: [] };
118
+ const uipx = uipxProjectDirs(dir);
119
+ const projects = [];
120
+ let typeDirs;
121
+ try {
122
+ typeDirs = readdirSync(processDir).sort();
123
+ }
124
+ catch {
125
+ return { dir, projects: [] };
126
+ }
127
+ for (const typeDir of typeDirs) {
128
+ let files;
129
+ try {
130
+ files = readdirSync(join(processDir, typeDir)).sort();
131
+ }
132
+ catch {
133
+ continue;
134
+ }
135
+ for (const file of files) {
136
+ if (!file.endsWith('.json'))
137
+ continue;
138
+ const path = join(processDir, typeDir, file);
139
+ const parsed = readJson(path);
140
+ const resource = isRecord(parsed) ? parsed.resource : undefined;
141
+ if (!isRecord(resource))
142
+ continue;
143
+ const { name, key, projectKey } = resource;
144
+ if (typeof name !== 'string' || typeof key !== 'string' || typeof projectKey !== 'string')
145
+ continue;
146
+ if (name === '' || key === '' || projectKey === '')
147
+ continue;
148
+ const projectDir = uipx.find((p) => sameGuid(p.id, projectKey))?.dir ?? join(dir, name);
149
+ const entry = firstEntryPoint(projectDir);
150
+ const outputs = entry !== undefined ? schemaFields(entry.output) : flowOutputs(projectDir);
151
+ projects.push({
152
+ name,
153
+ resourceType: typeof resource.type === 'string' ? resource.type : typeDir,
154
+ key,
155
+ projectId: projectKey,
156
+ file: relative(dir, path).split('\\').join('/'),
157
+ ...(typeof entry?.type === 'string' ? { entryPointType: entry.type } : {}),
158
+ ...(outputs !== undefined ? { outputs } : {}),
159
+ });
160
+ }
161
+ }
162
+ return { dir, projects };
163
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uipath/maestro-builder-sdk",
3
- "version": "6.107.0",
3
+ "version": "6.109.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": "4295f20ce709d1016209913e4bfc43b93ee986ef"
126
+ "gitref": "5b4742b27753c744b24c39aa70538961b642b18c"
127
127
  }