@uipath/maestro-tool 1.200.0-preview.109 → 1.201.0-preview.115
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 +16 -0
- package/dist/authoring-0dk6xpfc.js +22 -0
- package/dist/authoring-de0qdv9t.js +20 -0
- package/dist/authoring-gqzd8ngc.js +20 -0
- package/dist/bpmn-refresh-service-vksd8z0m.js +451 -0
- package/dist/{browser-strategy-d4zm14fb.js → browser-strategy-rkcvc6tn.js} +1 -1
- package/dist/{conversion-COFE4RVO-yxwte1kj.js → conversion-MQ7TJMHW-avnhwgjk.js} +14 -14
- package/dist/{en-ZBJX4WAU-L7DPQ3FB-4saj6t9b.js → en-JGJNQYMG-BSN3EE6C-mhg57v8h.js} +61 -3
- package/dist/{en-ZBJX4WAU-5yq8e307.js → en-JGJNQYMG-xq29xvhk.js} +60 -2
- package/dist/en-UNT7BE26-rhh65jry.js +24 -0
- package/dist/{index-88d81ah5.js → index-2dvhe3at.js} +222 -31
- package/dist/index-9f8q2ege.js +2058 -0
- package/dist/index-hsadteg4.js +634 -0
- package/dist/{tool-znh2d5a7.js → index-mrht9sxd.js} +614 -13311
- package/dist/{index-29kkrpx1.js → index-y93b9sgy.js} +18 -13
- package/dist/index.js +15 -9
- package/dist/js-yaml-cggj6w7q.js +3145 -0
- package/dist/{node-gc1nyvyw.js → node-ked5b1gy.js} +7595 -7310
- package/dist/node-strategy-fwj45942.js +350 -0
- package/dist/packager-tool-00w2qnsw.js +6227 -0
- package/dist/packager-tool-066fzdae.js +5303 -0
- package/dist/packager-tool-1cb0d5e0.js +237 -0
- package/dist/packager-tool-1yepbxq4.js +201 -0
- package/dist/{packager-tool-1ps2qeqg.js → packager-tool-5arsyj36.js} +3 -2
- package/dist/{packager-tool-9bnpe8n1.js → packager-tool-5fpetbc1.js} +23579 -18538
- package/dist/{packager-tool-cwgxt2b5.js → packager-tool-anfb35wg.js} +3628 -1925
- package/dist/packager-tool-b7pdksch.js +2203 -0
- package/dist/{packager-tool-yf5tx1r8.js → packager-tool-bnqptw8n.js} +209 -37
- package/dist/{packager-tool-3g2yhe78.js → packager-tool-dmnhzh9p.js} +22461 -33320
- package/dist/packager-tool-fj5bja81.js +460 -0
- package/dist/packager-tool-gbgfwx8f.js +2 -0
- package/dist/{packager-tool-hkrpcn6d.js → packager-tool-htc0z863.js} +61 -3
- package/dist/packager-tool-jxb33prs.js +276 -0
- package/dist/{packager-tool-5aapw8s2.js → packager-tool-kkwtddht.js} +339 -48
- package/dist/{packager-tool-qz3cg5tg.js → packager-tool-kvgt1s4z.js} +61 -3
- package/dist/packager-tool-m2vn3cep.js +1119 -0
- package/dist/packager-tool-qa9gftnj.js +31 -0
- package/dist/{packager-tool-0cn35xnr.js → packager-tool-wdykzfrx.js} +253 -157
- package/dist/packager-tool-y3dezh8k.js +21 -0
- package/dist/packager-tool.js +12 -10
- package/dist/project-validator-g2ke2m4j.js +11 -0
- package/dist/{serialization-3RH6P643-z9b9wkfm.js → serialization-JNQMGOXW-3g31rma2.js} +9 -7
- package/dist/tool-1kq24429.js +12735 -0
- package/dist/{tool-8qwk6bcf.js → tool-fakm5dew.js} +155 -108
- package/dist/tool.js +14 -8
- package/package.json +2 -2
- package/dist/de-LVBY3VVG-gyt1s22e.js +0 -134
- package/dist/en-4UFXRW7N-p8f4r47q.js +0 -98
- package/dist/en-IMUXHKKC-3zcks7ks.js +0 -16
- package/dist/es-CI4AE5B5-yfv6qwgr.js +0 -134
- package/dist/es-MX-OLZNAYY5-6f3m32xs.js +0 -134
- package/dist/fr-CCN6ZO5E-srd8q9ne.js +0 -134
- package/dist/ja-O2NEV5D6-pvhh5bag.js +0 -134
- package/dist/ko-7XWV2SEQ-9dz74aam.js +0 -134
- package/dist/node-strategy-fp8vxmvc.js +0 -63
- package/dist/packager-tool-05gksq3e.js +0 -5046
- package/dist/packager-tool-060a9knt.js +0 -11
- package/dist/packager-tool-3advj6c6.js +0 -3149
- package/dist/packager-tool-3yjtbs1y.js +0 -95
- package/dist/packager-tool-87rnjsa9.js +0 -1161
- package/dist/packager-tool-ek2dnj9h.js +0 -13
- package/dist/packager-tool-vs9yv64x.js +0 -5021
- package/dist/project-validator-8jksv0s8.js +0 -9
- package/dist/pt-BR-Z4J3LEEO-t28qfgyc.js +0 -134
- package/dist/pt-CRSN3TCU-s7hxhsxv.js +0 -134
- package/dist/ro-WMQEVD7D-h0kamt4a.js +0 -134
- package/dist/ru-WBLQ5B2U-n1e7fn8t.js +0 -10
- package/dist/tr-UCMB7W3T-xv61hggk.js +0 -134
- package/dist/zh-CN-2QOHEFC5-meycvgab.js +0 -134
- package/dist/zh-TW-Q5QSSTS6-65s6kte4.js +0 -134
package/README.md
CHANGED
|
@@ -2,6 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
CLI tool for UiPath Maestro orchestration projects. The tool is exposed under `uip maestro` and groups BPMN, Flow, and Case commands.
|
|
4
4
|
|
|
5
|
+
## Shared Registry
|
|
6
|
+
|
|
7
|
+
Install or refresh the connector authoring library shared by Flow, Case, and
|
|
8
|
+
BPMN. The command verifies the published checksum, generates Markdown and
|
|
9
|
+
TypeScript views with the installed Flow SDK materializer, and activates the
|
|
10
|
+
result as an immutable local snapshot.
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
uip maestro registry pull
|
|
14
|
+
uip maestro registry pull --force
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
The cache is stored under `~/.uipath/maestro/registry`. Connection-specific
|
|
18
|
+
connector schemas are prepared separately and are not downloaded by this
|
|
19
|
+
command.
|
|
20
|
+
|
|
5
21
|
## BPMN Commands
|
|
6
22
|
|
|
7
23
|
### `maestro bpmn init`
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import {
|
|
2
|
+
registerCheckCommand,
|
|
3
|
+
registerCompileCommand,
|
|
4
|
+
registerDecompileCommand,
|
|
5
|
+
registerMergeCommand
|
|
6
|
+
} from "./packager-tool-jxb33prs.js";
|
|
7
|
+
import"./packager-tool-066fzdae.js";
|
|
8
|
+
import"./packager-tool-1cb0d5e0.js";
|
|
9
|
+
import"./packager-tool-wckvcay0.js";
|
|
10
|
+
|
|
11
|
+
// ../flow-tool/src/commands/authoring.ts
|
|
12
|
+
var registerFlowAuthoringCommands = (program) => {
|
|
13
|
+
registerCompileCommand(program, "flow");
|
|
14
|
+
registerCheckCommand(program, "flow");
|
|
15
|
+
registerDecompileCommand(program, "flow");
|
|
16
|
+
registerMergeCommand(program);
|
|
17
|
+
};
|
|
18
|
+
export {
|
|
19
|
+
registerFlowAuthoringCommands
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
//# debugId=312B5FA52AB0810D64756E2164756E21
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {
|
|
2
|
+
registerCheckCommand,
|
|
3
|
+
registerCompileCommand,
|
|
4
|
+
registerDecompileCommand
|
|
5
|
+
} from "./packager-tool-jxb33prs.js";
|
|
6
|
+
import"./packager-tool-066fzdae.js";
|
|
7
|
+
import"./packager-tool-1cb0d5e0.js";
|
|
8
|
+
import"./packager-tool-wckvcay0.js";
|
|
9
|
+
|
|
10
|
+
// ../case-tool/src/commands/authoring.ts
|
|
11
|
+
var registerCaseAuthoringCommands = (program) => {
|
|
12
|
+
registerCompileCommand(program, "case");
|
|
13
|
+
registerCheckCommand(program, "case");
|
|
14
|
+
registerDecompileCommand(program, "case");
|
|
15
|
+
};
|
|
16
|
+
export {
|
|
17
|
+
registerCaseAuthoringCommands
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
//# debugId=E3E3EE7B4978FB6064756E2164756E21
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {
|
|
2
|
+
registerCheckCommand,
|
|
3
|
+
registerCompileCommand,
|
|
4
|
+
registerTidyCommand
|
|
5
|
+
} from "./packager-tool-jxb33prs.js";
|
|
6
|
+
import"./packager-tool-066fzdae.js";
|
|
7
|
+
import"./packager-tool-1cb0d5e0.js";
|
|
8
|
+
import"./packager-tool-wckvcay0.js";
|
|
9
|
+
|
|
10
|
+
// src/commands/authoring.ts
|
|
11
|
+
var registerBpmnAuthoringCommands = (program) => {
|
|
12
|
+
registerCompileCommand(program, "bpmn");
|
|
13
|
+
registerCheckCommand(program, "bpmn");
|
|
14
|
+
registerTidyCommand(program);
|
|
15
|
+
};
|
|
16
|
+
export {
|
|
17
|
+
registerBpmnAuthoringCommands
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
//# debugId=2D1464E0B968BA6664756E2164756E21
|
|
@@ -0,0 +1,451 @@
|
|
|
1
|
+
import {
|
|
2
|
+
SimpleBpmnModdle
|
|
3
|
+
} from "./packager-tool-x8d8fpse.js";
|
|
4
|
+
import {
|
|
5
|
+
isIntsvcActivityExecutionV1
|
|
6
|
+
} from "./packager-tool-bnqptw8n.js";
|
|
7
|
+
import {
|
|
8
|
+
BPMN_PACKAGE_FILES,
|
|
9
|
+
BpmnValidateService,
|
|
10
|
+
buildBpmnPackageMetadata,
|
|
11
|
+
entryPointDisplayName,
|
|
12
|
+
formatBpmnPackageFile,
|
|
13
|
+
isJsonObject
|
|
14
|
+
} from "./packager-tool-fj5bja81.js";
|
|
15
|
+
import"./packager-tool-dmnhzh9p.js";
|
|
16
|
+
import"./packager-tool-9qecd4wb.js";
|
|
17
|
+
import"./packager-tool-qa9gftnj.js";
|
|
18
|
+
import"./packager-tool-5arsyj36.js";
|
|
19
|
+
import {
|
|
20
|
+
extractErrorMessageSync,
|
|
21
|
+
isGuid
|
|
22
|
+
} from "./packager-tool-066fzdae.js";
|
|
23
|
+
import {
|
|
24
|
+
getFileSystem
|
|
25
|
+
} from "./packager-tool-1cb0d5e0.js";
|
|
26
|
+
import"./packager-tool-1yepbxq4.js";
|
|
27
|
+
import"./packager-tool-kvgt1s4z.js";
|
|
28
|
+
import"./packager-tool-sc961w0q.js";
|
|
29
|
+
import"./packager-tool-gbgfwx8f.js";
|
|
30
|
+
import"./packager-tool-5fpetbc1.js";
|
|
31
|
+
import"./packager-tool-973f0r2g.js";
|
|
32
|
+
import"./packager-tool-c23zrhj8.js";
|
|
33
|
+
import"./packager-tool-wckvcay0.js";
|
|
34
|
+
|
|
35
|
+
// src/services/bpmn-node-utils.ts
|
|
36
|
+
function extensionValues(element) {
|
|
37
|
+
return element.extensionElements?.values ?? [];
|
|
38
|
+
}
|
|
39
|
+
function childNodes(node) {
|
|
40
|
+
return node?.$children ?? [];
|
|
41
|
+
}
|
|
42
|
+
function required(value, label) {
|
|
43
|
+
if (!value?.trim()) {
|
|
44
|
+
throw new Error(`${label} is required.`);
|
|
45
|
+
}
|
|
46
|
+
return value.trim();
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// src/services/bpmn-connection-resources.ts
|
|
50
|
+
function buildConnectionResources(processes, existingResources) {
|
|
51
|
+
const generated = new Map;
|
|
52
|
+
for (const process of processes) {
|
|
53
|
+
const workflowActivityConfigurationVersion = extensionValues(process).find((node) => node.$type === "uipath:intsvcActivityConfig")?.version;
|
|
54
|
+
const connectionBindings = childNodes(extensionValues(process).find((node) => node.$type === "uipath:bindings")).filter((node) => node.$type === "uipath:binding" && node.resource === "Connection" && node.propertyAttribute === "ConnectionId").map(toConnectionBinding);
|
|
55
|
+
const bindingById = new Map(connectionBindings.map((binding) => [binding.id, binding]));
|
|
56
|
+
for (const element of allFlowElements(process)) {
|
|
57
|
+
const activity = extensionValues(element).find((node) => node.$type === "uipath:activity");
|
|
58
|
+
const type = childNodes(activity).find((node) => node.$type === "uipath:type");
|
|
59
|
+
if (type?.value !== "Intsvc.ActivityExecution") {
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
62
|
+
const context = childNodes(activity).find((node) => node.$type === "uipath:context");
|
|
63
|
+
const values = new Map(childNodes(context).filter((node) => node.$type === "uipath:input" && node.name).map((node) => [
|
|
64
|
+
node.name,
|
|
65
|
+
node.value ?? node.$body
|
|
66
|
+
]));
|
|
67
|
+
if (!isIntsvcActivityExecutionV1(values.get("activityConfigurationVersion"), workflowActivityConfigurationVersion)) {
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
const activityId = required(element.id, "Integration Service activity id");
|
|
71
|
+
const activityDisplayName = element.name?.trim() || activityId;
|
|
72
|
+
const connector = required(values.get("connectorKey"), `Activity "${activityDisplayName}" connectorKey`);
|
|
73
|
+
const bindingId = bindingReference(values.get("connection"), activityDisplayName);
|
|
74
|
+
const binding = bindingById.get(bindingId);
|
|
75
|
+
if (!binding) {
|
|
76
|
+
throw new Error(`Activity "${activityDisplayName}" references missing Connection binding "${bindingId}".`);
|
|
77
|
+
}
|
|
78
|
+
const current = connectionResource({
|
|
79
|
+
activityId,
|
|
80
|
+
activityDisplayName,
|
|
81
|
+
connector,
|
|
82
|
+
binding
|
|
83
|
+
});
|
|
84
|
+
const prior = generated.get(binding.resourceKey);
|
|
85
|
+
if (prior) {
|
|
86
|
+
if (prior.metadata.Connector !== connector || prior.value.ConnectionId.defaultValue !== binding.connectionId) {
|
|
87
|
+
throw new Error(`Connection resource "${binding.resourceKey}" is used by Integration Service activities with different connectors or connections.`);
|
|
88
|
+
}
|
|
89
|
+
continue;
|
|
90
|
+
}
|
|
91
|
+
generated.set(binding.resourceKey, current);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
const updated = existingResources.flatMap((resource) => {
|
|
95
|
+
const replacement = resource.resource === "Connection" && typeof resource.key === "string" ? generated.get(resource.key) : undefined;
|
|
96
|
+
if (!replacement)
|
|
97
|
+
return [resource];
|
|
98
|
+
generated.delete(replacement.key);
|
|
99
|
+
return [replacement];
|
|
100
|
+
});
|
|
101
|
+
return [
|
|
102
|
+
...updated,
|
|
103
|
+
...[...generated.values()].sort((left, right) => left.key.localeCompare(right.key))
|
|
104
|
+
];
|
|
105
|
+
}
|
|
106
|
+
function connectionResource(options) {
|
|
107
|
+
const { activityId, activityDisplayName, connector, binding } = options;
|
|
108
|
+
return {
|
|
109
|
+
resource: "Connection",
|
|
110
|
+
key: binding.resourceKey,
|
|
111
|
+
activityId,
|
|
112
|
+
activityDisplayName,
|
|
113
|
+
value: {
|
|
114
|
+
ConnectionId: {
|
|
115
|
+
defaultValue: binding.connectionId,
|
|
116
|
+
isExpression: false
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
metadata: {
|
|
120
|
+
UseConnectionService: "true",
|
|
121
|
+
Connector: connector,
|
|
122
|
+
ActivityName: activityDisplayName,
|
|
123
|
+
BindingsVersion: "2.2",
|
|
124
|
+
SolutionsSupport: "true"
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
function toConnectionBinding(node) {
|
|
129
|
+
const binding = {
|
|
130
|
+
id: required(node.id, "Connection binding id"),
|
|
131
|
+
resourceKey: required(node.resourceKey, `Connection binding "${node.id ?? ""}" resourceKey`),
|
|
132
|
+
connectionId: required(node.default, `Connection binding "${node.id ?? ""}" default`)
|
|
133
|
+
};
|
|
134
|
+
if (!isGuid(binding.connectionId)) {
|
|
135
|
+
throw new Error(`Connection binding "${binding.id}" default must be a GUID.`);
|
|
136
|
+
}
|
|
137
|
+
return binding;
|
|
138
|
+
}
|
|
139
|
+
function allFlowElements(element) {
|
|
140
|
+
const result = [];
|
|
141
|
+
for (const child of element.flowElements ?? []) {
|
|
142
|
+
result.push(child, ...allFlowElements(child));
|
|
143
|
+
}
|
|
144
|
+
return result;
|
|
145
|
+
}
|
|
146
|
+
function bindingReference(value, activity) {
|
|
147
|
+
const match = /^=bindings\.([A-Za-z_][\w.-]*)$/.exec(value ?? "");
|
|
148
|
+
if (!match) {
|
|
149
|
+
throw new Error(`Activity "${activity}" connection must reference a root binding as "=bindings.<id>".`);
|
|
150
|
+
}
|
|
151
|
+
return match[1];
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
// src/services/bpmn-refresh-service.ts
|
|
155
|
+
class BpmnRefreshService {
|
|
156
|
+
fs;
|
|
157
|
+
createUuid;
|
|
158
|
+
constructor(fs = getFileSystem(), createUuid = () => crypto.randomUUID()) {
|
|
159
|
+
this.fs = fs;
|
|
160
|
+
this.createUuid = createUuid;
|
|
161
|
+
}
|
|
162
|
+
async execute(projectPath) {
|
|
163
|
+
const resolvedProjectPath = this.fs.path.resolve(projectPath);
|
|
164
|
+
const stats = await this.fs.stat(resolvedProjectPath);
|
|
165
|
+
if (!stats?.isDirectory()) {
|
|
166
|
+
throw new Error(`Maestro project directory does not exist: ${resolvedProjectPath}`);
|
|
167
|
+
}
|
|
168
|
+
const release = await this.fs.acquireLock(this.fs.path.join(resolvedProjectPath, ".bpmn-refresh"));
|
|
169
|
+
try {
|
|
170
|
+
const bpmnFile = await this.findBpmnFile(resolvedProjectPath);
|
|
171
|
+
await this.readProjectFile(resolvedProjectPath);
|
|
172
|
+
const bpmnPath = this.fs.path.join(resolvedProjectPath, bpmnFile);
|
|
173
|
+
const xml = await this.fs.readFile(bpmnPath, "utf-8");
|
|
174
|
+
if (!xml) {
|
|
175
|
+
throw new Error(`BPMN file is empty: ${bpmnPath}`);
|
|
176
|
+
}
|
|
177
|
+
const existing = await this.readGeneratedFiles(resolvedProjectPath);
|
|
178
|
+
const contents = await this.deriveFiles(bpmnFile, xml, existing);
|
|
179
|
+
await this.validateProject(resolvedProjectPath, bpmnFile, contents);
|
|
180
|
+
const planned = BPMN_PACKAGE_FILES.map((name) => ({
|
|
181
|
+
name,
|
|
182
|
+
path: this.fs.path.join(resolvedProjectPath, name),
|
|
183
|
+
content: contents[name],
|
|
184
|
+
previous: existing[name]
|
|
185
|
+
}));
|
|
186
|
+
const changed = planned.filter((file) => file.previous !== file.content);
|
|
187
|
+
await this.writeFilesWithRollback(changed);
|
|
188
|
+
return {
|
|
189
|
+
projectPath: resolvedProjectPath,
|
|
190
|
+
bpmnFile,
|
|
191
|
+
writtenFiles: changed.map((file) => file.name),
|
|
192
|
+
unchangedFiles: planned.filter((file) => file.previous === file.content).map((file) => file.name)
|
|
193
|
+
};
|
|
194
|
+
} finally {
|
|
195
|
+
await release();
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
async findBpmnFile(projectPath) {
|
|
199
|
+
const entries = await this.fs.readdir(projectPath);
|
|
200
|
+
const files = [];
|
|
201
|
+
for (const entry of entries.filter((name) => name.endsWith(".bpmn"))) {
|
|
202
|
+
if ((await this.fs.stat(this.fs.path.join(projectPath, entry)))?.isFile()) {
|
|
203
|
+
files.push(entry);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
files.sort((left, right) => left.localeCompare(right));
|
|
207
|
+
if (files.length !== 1) {
|
|
208
|
+
throw new Error(`Expected one BPMN file in ${projectPath}, found ${files.length}.`);
|
|
209
|
+
}
|
|
210
|
+
return files[0];
|
|
211
|
+
}
|
|
212
|
+
async readProjectFile(projectPath) {
|
|
213
|
+
const path = this.fs.path.join(projectPath, "project.uiproj");
|
|
214
|
+
const raw = await this.fs.readFile(path, "utf-8");
|
|
215
|
+
if (raw === null)
|
|
216
|
+
throw new Error(`Required file is missing: ${path}`);
|
|
217
|
+
const project = parseJson(raw, "project.uiproj");
|
|
218
|
+
if (project.ProjectType !== "ProcessOrchestration") {
|
|
219
|
+
throw new Error('project.uiproj must set "ProjectType" to "ProcessOrchestration".');
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
async readGeneratedFiles(projectPath) {
|
|
223
|
+
const result = {};
|
|
224
|
+
for (const name of BPMN_PACKAGE_FILES) {
|
|
225
|
+
result[name] = await this.fs.readFile(this.fs.path.join(projectPath, name), "utf-8");
|
|
226
|
+
}
|
|
227
|
+
return result;
|
|
228
|
+
}
|
|
229
|
+
async deriveFiles(bpmnFile, xml, existing) {
|
|
230
|
+
const { rootElement } = await new SimpleBpmnModdle().fromXML(xml);
|
|
231
|
+
const definitions = rootElement;
|
|
232
|
+
const processes = (definitions.rootElements ?? []).filter((element) => element.$type === "bpmn:Process");
|
|
233
|
+
if (processes.length === 0) {
|
|
234
|
+
throw new Error("BPMN file must contain a root process.");
|
|
235
|
+
}
|
|
236
|
+
const entryPoints = processes.flatMap((process) => this.deriveEntryPointsForProcess(process));
|
|
237
|
+
if (entryPoints.length === 0) {
|
|
238
|
+
throw new Error("BPMN file must contain a root manual start event with a uipath:entryPointId.");
|
|
239
|
+
}
|
|
240
|
+
const existingMetadata = {
|
|
241
|
+
"entry-points.json": null,
|
|
242
|
+
"bindings_v2.json": null,
|
|
243
|
+
"operate.json": null,
|
|
244
|
+
"package-descriptor.json": null
|
|
245
|
+
};
|
|
246
|
+
for (const name of [
|
|
247
|
+
"entry-points.json",
|
|
248
|
+
"bindings_v2.json",
|
|
249
|
+
"operate.json"
|
|
250
|
+
]) {
|
|
251
|
+
existingMetadata[name] = parseOptionalJson(existing[name], name);
|
|
252
|
+
}
|
|
253
|
+
const existingOperate = existingMetadata["operate.json"];
|
|
254
|
+
const oldProjectId = existingOperate?.projectId;
|
|
255
|
+
const projectId = typeof oldProjectId === "string" && isGuid(oldProjectId) ? oldProjectId : this.createUuid();
|
|
256
|
+
if (!isGuid(projectId)) {
|
|
257
|
+
throw new Error(`Generated project id "${projectId}" must be a GUID.`);
|
|
258
|
+
}
|
|
259
|
+
const oldBindings = existingMetadata["bindings_v2.json"];
|
|
260
|
+
const existingResources = Array.isArray(oldBindings?.resources) ? oldBindings.resources.filter(isJsonObject) : [];
|
|
261
|
+
const resources = buildConnectionResources(processes, existingResources);
|
|
262
|
+
const metadata = buildBpmnPackageMetadata({
|
|
263
|
+
bpmnFile,
|
|
264
|
+
entryPoints,
|
|
265
|
+
projectId,
|
|
266
|
+
resources,
|
|
267
|
+
existing: existingMetadata
|
|
268
|
+
});
|
|
269
|
+
const contents = Object.fromEntries(BPMN_PACKAGE_FILES.map((name) => [
|
|
270
|
+
name,
|
|
271
|
+
formatBpmnPackageFile(metadata[name])
|
|
272
|
+
]));
|
|
273
|
+
return contents;
|
|
274
|
+
}
|
|
275
|
+
deriveEntryPointsForProcess(process) {
|
|
276
|
+
const flowElements = process.flowElements ?? [];
|
|
277
|
+
const manualStartEvents = flowElements.filter((element) => element.$type === "bpmn:StartEvent" && (element.eventDefinitions?.length ?? 0) === 0 && !extensionValues(element).some((node) => node.$type === "uipath:event"));
|
|
278
|
+
if (manualStartEvents.length === 0)
|
|
279
|
+
return [];
|
|
280
|
+
const variables = childNodes(extensionValues(process).find((node) => node.$type === "uipath:variables"));
|
|
281
|
+
const inputs = variables.filter((node) => node.$type === "uipath:input");
|
|
282
|
+
const rootEndIds = new Set(flowElements.filter((element) => element.$type === "bpmn:EndEvent").map((element) => element.id).filter((id) => id !== undefined));
|
|
283
|
+
const outputs = variables.filter((node) => node.$type === "uipath:output");
|
|
284
|
+
for (const output of outputs) {
|
|
285
|
+
if (!output.elementId || !rootEndIds.has(output.elementId)) {
|
|
286
|
+
throw new Error(`Process output "${required(output.name, "Process output name")}" must target a root end event.`);
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
const outputSchema = variableSchema(outputs, "output");
|
|
290
|
+
return manualStartEvents.map((startEvent) => {
|
|
291
|
+
const startEventId = required(startEvent.id, "Root manual start event id");
|
|
292
|
+
const entryPoint = exactlyOne(extensionValues(startEvent).filter((node) => node.$type === "uipath:entryPointId"), `uipath:entryPointId on root manual start event "${startEventId}"`);
|
|
293
|
+
const entryPointId = required(entryPoint.value, `Root manual start event "${startEventId}" entryPointId`);
|
|
294
|
+
if (!isGuid(entryPointId)) {
|
|
295
|
+
throw new Error(`Root manual start event "${startEventId}" entryPointId "${entryPointId}" must be a GUID.`);
|
|
296
|
+
}
|
|
297
|
+
return {
|
|
298
|
+
startEventId,
|
|
299
|
+
entryPointId,
|
|
300
|
+
displayName: entryPointDisplayName(startEvent.name),
|
|
301
|
+
input: variableSchema(inputs.filter((input) => input.elementId === startEventId), "input"),
|
|
302
|
+
output: outputSchema
|
|
303
|
+
};
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
async validateProject(projectPath, bpmnFile, contents) {
|
|
307
|
+
const proposedFiles = new Map(BPMN_PACKAGE_FILES.map((name) => [
|
|
308
|
+
this.fs.path.join(projectPath, name),
|
|
309
|
+
contents[name]
|
|
310
|
+
]));
|
|
311
|
+
const fileSystem = proposedFileSystem(this.fs, proposedFiles);
|
|
312
|
+
const result = await new BpmnValidateService(fileSystem).validateFile(this.fs.path.join(projectPath, bpmnFile));
|
|
313
|
+
if (!result.success) {
|
|
314
|
+
const errors = result.issues.filter((issue) => issue.severity === "error").map((issue) => issue.ruleCode ? `${issue.ruleCode}: ${issue.message}` : issue.message);
|
|
315
|
+
throw new Error(`BPMN validation failed: ${errors.join("; ")}`);
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
async writeFilesWithRollback(files) {
|
|
319
|
+
if (files.length === 0)
|
|
320
|
+
return;
|
|
321
|
+
const transactionId = this.createUuid();
|
|
322
|
+
const staged = files.map((file) => ({
|
|
323
|
+
...file,
|
|
324
|
+
stagingPath: `${file.path}.${transactionId}.tmp`,
|
|
325
|
+
rollbackPath: `${file.path}.${transactionId}.rollback`
|
|
326
|
+
}));
|
|
327
|
+
const written = [];
|
|
328
|
+
try {
|
|
329
|
+
for (const file of staged) {
|
|
330
|
+
await this.fs.writeFile(file.stagingPath, file.content);
|
|
331
|
+
}
|
|
332
|
+
for (const file of staged) {
|
|
333
|
+
await this.fs.rename(file.stagingPath, file.path);
|
|
334
|
+
written.push(file);
|
|
335
|
+
}
|
|
336
|
+
} catch (error) {
|
|
337
|
+
const rollbackErrors = [];
|
|
338
|
+
for (const file of [...written].reverse()) {
|
|
339
|
+
try {
|
|
340
|
+
await this.restoreFile(file);
|
|
341
|
+
} catch (rollbackError) {
|
|
342
|
+
rollbackErrors.push(`${file.name}: ${extractErrorMessageSync(rollbackError)}`);
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
const rollbackMessage = rollbackErrors.length === 0 ? "" : ` Rollback also failed for ${rollbackErrors.join("; ")}.`;
|
|
346
|
+
throw new Error(`Could not update all BPMN package files: ${extractErrorMessageSync(error)}.${rollbackMessage}`);
|
|
347
|
+
} finally {
|
|
348
|
+
for (const file of staged) {
|
|
349
|
+
await this.fs.rm(file.stagingPath).catch(() => {
|
|
350
|
+
return;
|
|
351
|
+
});
|
|
352
|
+
await this.fs.rm(file.rollbackPath).catch(() => {
|
|
353
|
+
return;
|
|
354
|
+
});
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
async restoreFile(file) {
|
|
359
|
+
if (file.previous === null) {
|
|
360
|
+
await this.fs.rm(file.path);
|
|
361
|
+
return;
|
|
362
|
+
}
|
|
363
|
+
await this.fs.writeFile(file.rollbackPath, file.previous);
|
|
364
|
+
await this.fs.rename(file.rollbackPath, file.path);
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
function proposedFileSystem(fs, proposedFiles) {
|
|
368
|
+
return new Proxy(fs, {
|
|
369
|
+
get: (target, property, receiver) => {
|
|
370
|
+
if (property === "readFile") {
|
|
371
|
+
return async (path, options) => {
|
|
372
|
+
const proposed = proposedFiles.get(path);
|
|
373
|
+
if (proposed !== undefined) {
|
|
374
|
+
return options ? proposed : new TextEncoder().encode(proposed);
|
|
375
|
+
}
|
|
376
|
+
return options ? target.readFile(path, options) : target.readFile(path);
|
|
377
|
+
};
|
|
378
|
+
}
|
|
379
|
+
if (property === "exists") {
|
|
380
|
+
return (path) => proposedFiles.has(path) ? Promise.resolve(true) : target.exists(path);
|
|
381
|
+
}
|
|
382
|
+
const value = Reflect.get(target, property, receiver);
|
|
383
|
+
return typeof value === "function" ? value.bind(target) : value;
|
|
384
|
+
}
|
|
385
|
+
});
|
|
386
|
+
}
|
|
387
|
+
function variableSchema(variables, direction) {
|
|
388
|
+
const properties = Object.create(null);
|
|
389
|
+
const names = new Set;
|
|
390
|
+
for (const variable of variables) {
|
|
391
|
+
const name = required(variable.name, `Process ${direction} name`);
|
|
392
|
+
if (names.has(name)) {
|
|
393
|
+
throw new Error(`Duplicate process ${direction} "${name}".`);
|
|
394
|
+
}
|
|
395
|
+
names.add(name);
|
|
396
|
+
properties[name] = schemaForVariable(variable, direction);
|
|
397
|
+
}
|
|
398
|
+
return { type: "object", properties };
|
|
399
|
+
}
|
|
400
|
+
function schemaForVariable(variable, direction) {
|
|
401
|
+
if (variable.$body?.trim()) {
|
|
402
|
+
return parseJson(variable.$body, `Process ${direction} "${variable.name}" schema`);
|
|
403
|
+
}
|
|
404
|
+
const type = required(variable.type, `Process ${direction} "${variable.name}" type`);
|
|
405
|
+
return schemaForType(type);
|
|
406
|
+
}
|
|
407
|
+
function schemaForType(type) {
|
|
408
|
+
switch (type.toLowerCase()) {
|
|
409
|
+
case "string":
|
|
410
|
+
return { type: "string" };
|
|
411
|
+
case "boolean":
|
|
412
|
+
return { type: "boolean" };
|
|
413
|
+
case "integer":
|
|
414
|
+
return { type: "integer" };
|
|
415
|
+
case "number":
|
|
416
|
+
return { type: "number" };
|
|
417
|
+
case "array":
|
|
418
|
+
return { type: "array" };
|
|
419
|
+
case "object":
|
|
420
|
+
case "json":
|
|
421
|
+
return { type: "object" };
|
|
422
|
+
default:
|
|
423
|
+
throw new Error(`Unsupported process input/output type "${type}". Use string, boolean, integer, number, array, object, or json, or add an inline JSON schema.`);
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
function exactlyOne(values, label) {
|
|
427
|
+
if (values.length !== 1) {
|
|
428
|
+
throw new Error(`Expected one ${label}, found ${values.length}.`);
|
|
429
|
+
}
|
|
430
|
+
return values[0];
|
|
431
|
+
}
|
|
432
|
+
function parseOptionalJson(raw, label) {
|
|
433
|
+
return raw === null ? null : parseJson(raw, label);
|
|
434
|
+
}
|
|
435
|
+
function parseJson(raw, label) {
|
|
436
|
+
let value;
|
|
437
|
+
try {
|
|
438
|
+
value = JSON.parse(raw);
|
|
439
|
+
} catch (error) {
|
|
440
|
+
throw new Error(`${label} is not valid JSON: ${error instanceof Error ? error.message : String(error)}`);
|
|
441
|
+
}
|
|
442
|
+
if (!isJsonObject(value)) {
|
|
443
|
+
throw new Error(`${label} must contain a JSON object.`);
|
|
444
|
+
}
|
|
445
|
+
return value;
|
|
446
|
+
}
|
|
447
|
+
export {
|
|
448
|
+
BpmnRefreshService
|
|
449
|
+
};
|
|
450
|
+
|
|
451
|
+
//# debugId=E9C48270AC5B3C9564756E2164756E21
|
|
@@ -10,28 +10,28 @@ import {
|
|
|
10
10
|
getLatestDefinitionByNodeType,
|
|
11
11
|
isContainerNodeManifest,
|
|
12
12
|
resolveNodeOutputTypeSchema
|
|
13
|
-
} from "./packager-tool-
|
|
13
|
+
} from "./packager-tool-anfb35wg.js";
|
|
14
14
|
import"./packager-tool-x8d8fpse.js";
|
|
15
|
-
import {
|
|
16
|
-
CURRENT_WORKFLOW_VERSION,
|
|
17
|
-
generateNextId,
|
|
18
|
-
isSubflowNodeType
|
|
19
|
-
} from "./packager-tool-05gksq3e.js";
|
|
20
15
|
import"./packager-tool-jqtspg41.js";
|
|
21
|
-
import"./packager-tool-
|
|
16
|
+
import"./packager-tool-htc0z863.js";
|
|
22
17
|
import"./packager-tool-fr5b9qs6.js";
|
|
23
18
|
import {
|
|
24
19
|
init_esm_shims
|
|
25
20
|
} from "./packager-tool-ahm4ymrp.js";
|
|
26
21
|
import"./packager-tool-c19w8vg9.js";
|
|
27
|
-
import"./packager-tool-
|
|
28
|
-
import
|
|
29
|
-
|
|
22
|
+
import"./packager-tool-gbgfwx8f.js";
|
|
23
|
+
import {
|
|
24
|
+
MINIMUM_SUPPORTED_SCHEMA_VERSION,
|
|
25
|
+
generateNextId,
|
|
26
|
+
isSubflowNodeType
|
|
27
|
+
} from "./packager-tool-5fpetbc1.js";
|
|
28
|
+
import"./packager-tool-973f0r2g.js";
|
|
29
|
+
import"./packager-tool-c23zrhj8.js";
|
|
30
30
|
import {
|
|
31
31
|
__require
|
|
32
32
|
} from "./packager-tool-wckvcay0.js";
|
|
33
33
|
|
|
34
|
-
// ../../node_modules/@uipath/flow-converter/dist/conversion-
|
|
34
|
+
// ../../node_modules/@uipath/flow-converter/dist/conversion-MQ7TJMHW.js
|
|
35
35
|
init_esm_shims();
|
|
36
36
|
init_esm_shims();
|
|
37
37
|
init_esm_shims();
|
|
@@ -732,7 +732,7 @@ function createEmptyWorkflow(id = crypto.randomUUID(), name = "Untitled Workflow
|
|
|
732
732
|
}
|
|
733
733
|
return {
|
|
734
734
|
id,
|
|
735
|
-
version:
|
|
735
|
+
version: MINIMUM_SUPPORTED_SCHEMA_VERSION,
|
|
736
736
|
name,
|
|
737
737
|
nodes,
|
|
738
738
|
edges: [],
|
|
@@ -810,7 +810,7 @@ function applyGlobalInputOverrides(raw, inputs) {
|
|
|
810
810
|
}
|
|
811
811
|
}
|
|
812
812
|
}
|
|
813
|
-
var warmSerializationChunks = () => Promise.all([import("./index-
|
|
813
|
+
var warmSerializationChunks = () => Promise.all([import("./index-y93b9sgy.js"), import("./serialization-JNQMGOXW-3g31rma2.js")]);
|
|
814
814
|
async function flowJsonToBpmnXml(flowJson, options) {
|
|
815
815
|
const [{ fileFormatToInMemoryWorkflow }, { toXml }] = await warmSerializationChunks();
|
|
816
816
|
const raw = JSON.parse(flowJson);
|
|
@@ -843,4 +843,4 @@ export {
|
|
|
843
843
|
applyGlobalInputOverrides
|
|
844
844
|
};
|
|
845
845
|
|
|
846
|
-
//# debugId=
|
|
846
|
+
//# debugId=94A5251CF6EBB5CC64756E2164756E21
|