@uipath/packager-tool-case 1.202.0-preview.141 → 1.202.0-preview.143
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/LICENSE.txt +3 -0
- package/dist/THIRD-PARTY-NOTICES.md +8 -0
- package/package.json +5 -10
- package/src/case-bpmn-compiler.ts +0 -48
- package/src/case-tool-factory.ts +0 -25
- package/src/case-tool.ts +0 -408
- package/src/index.ts +0 -17
- package/src/node.ts +0 -35
package/LICENSE.txt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
© 2026 UiPath
|
|
2
|
+
Use of this product is subject (a) to the applicable licensing agreement available: https://www.uipath.com/legal/trust-and-security/legal-terms#content-1 and, (b) for paid products listed here https://licensing.uipath.com/: the licensing agreement agreed between you and UiPath.
|
|
3
|
+
(UiPath means UiPath SRL with headquarters at 4 Vasile Alecsandri Str. and 11 Constantin Daniel Str., Building A, floors 5 and 6, District 1, Bucharest 010639, Romania and UiPath Inc. with principal place of business: One Vanderbilt Avenue, 60th Floor, New York, NY 10017)
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# Third-party notices for @uipath/packager-tool-case
|
|
2
|
+
|
|
3
|
+
This package is distributed as a bundle: the dependencies below are
|
|
4
|
+
compiled into its `dist/` output rather than installed alongside it.
|
|
5
|
+
Their licences and copyright notices are reproduced here in full, as
|
|
6
|
+
those licences require.
|
|
7
|
+
|
|
8
|
+
No third-party code is bundled into this package.
|
package/package.json
CHANGED
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uipath/packager-tool-case",
|
|
3
|
-
"version": "1.202.0-preview.
|
|
3
|
+
"version": "1.202.0-preview.143",
|
|
4
4
|
"description": "UiPath Case Management tool implementation",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
7
|
-
".":
|
|
8
|
-
"source": "./src/index.ts",
|
|
9
|
-
"default": "./dist/index.js"
|
|
10
|
-
},
|
|
7
|
+
".": "./dist/index.js",
|
|
11
8
|
"./node": {
|
|
12
|
-
"source": "./src/node.ts",
|
|
13
9
|
"types": "./dist/node.d.ts",
|
|
14
10
|
"default": "./dist/node.js"
|
|
15
11
|
}
|
|
@@ -24,13 +20,12 @@
|
|
|
24
20
|
},
|
|
25
21
|
"types": "./dist/index.d.ts",
|
|
26
22
|
"files": [
|
|
27
|
-
"dist"
|
|
28
|
-
"src"
|
|
23
|
+
"dist"
|
|
29
24
|
],
|
|
30
25
|
"author": "",
|
|
31
|
-
"license": "
|
|
26
|
+
"license": "SEE LICENSE IN LICENSE.txt",
|
|
32
27
|
"peerDependencies": {
|
|
33
28
|
"@uipath/solutionpackager-tool-core": "1.202.0"
|
|
34
29
|
},
|
|
35
|
-
"gitHead": "
|
|
30
|
+
"gitHead": "23b5a7038ead7264439af18f8b807c7cc99a29d5"
|
|
36
31
|
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Registry for the `caseplan.json` -> BPMN compiler.
|
|
3
|
-
*
|
|
4
|
-
* The compiler lives in `@uipath/case-schema`, a 2.5 MB CommonJS bundle that
|
|
5
|
-
* `require`s `child_process`, `tls` and `http2`. This package builds for the
|
|
6
|
-
* browser (StudioWeb loads it as a micro-frontend), so it cannot import that
|
|
7
|
-
* dependency directly. Instead it declares the interface and whoever runs on
|
|
8
|
-
* Node registers the real thing — `@uipath/packager-tool-case/node` provides
|
|
9
|
-
* that implementation, and the CLI tools that register the Case factory call
|
|
10
|
-
* it alongside.
|
|
11
|
-
*
|
|
12
|
-
* Nothing registered means no compile: `CaseTool` then requires the project to
|
|
13
|
-
* carry an already-compiled `.bpmn` and fails the build with an actionable
|
|
14
|
-
* message if it does not. It never packs a case silently missing its BPMN.
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
/** Compiles the contents of `caseplan.json` into BPMN XML. */
|
|
18
|
-
export type CaseBpmnCompiler = (casePlanJson: string) => Promise<string>;
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Global singleton key, keyed with `Symbol.for()` so every copy of this module
|
|
22
|
-
* resolves to the same slot. There are always several: `maestro-tool` and
|
|
23
|
-
* `case-tool` each bundle their own copy of this package, and the Node entry
|
|
24
|
-
* that registers the compiler is a separate build output from the browser one
|
|
25
|
-
* that reads it. A module-local `let` would leave the registration in one copy
|
|
26
|
-
* and the lookup in another — which is silently the old bug, a package packed
|
|
27
|
-
* without its BPMN. Mirrors `toolsFactoryRepository` in
|
|
28
|
-
* `@uipath/solutionpackager-tool-core`.
|
|
29
|
-
*/
|
|
30
|
-
const COMPILER_KEY = Symbol.for("@uipath/packager-tool-case/caseBpmnCompiler");
|
|
31
|
-
|
|
32
|
-
const _global = globalThis as Record<symbol, CaseBpmnCompiler | undefined>;
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Register the compiler used by `CaseTool.buildAsync`. Last call wins. Pass
|
|
36
|
-
* `undefined` to clear it — how a test reproduces a host that never
|
|
37
|
-
* registered one.
|
|
38
|
-
*/
|
|
39
|
-
export function registerCaseBpmnCompiler(
|
|
40
|
-
caseBpmnCompiler: CaseBpmnCompiler | undefined,
|
|
41
|
-
): void {
|
|
42
|
-
_global[COMPILER_KEY] = caseBpmnCompiler;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/** The registered compiler, or `undefined` when none was registered. */
|
|
46
|
-
export function getCaseBpmnCompiler(): CaseBpmnCompiler | undefined {
|
|
47
|
-
return _global[COMPILER_KEY];
|
|
48
|
-
}
|
package/src/case-tool-factory.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
type IFileSystem,
|
|
3
|
-
type IProjectToolFactory,
|
|
4
|
-
type IToolLogger,
|
|
5
|
-
type ProjectTool,
|
|
6
|
-
type ProjectType,
|
|
7
|
-
ProjectTypes,
|
|
8
|
-
} from "@uipath/solutionpackager-tool-core";
|
|
9
|
-
import { CaseTool } from "./case-tool.js";
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Factory for creating Case Management project tools
|
|
13
|
-
*/
|
|
14
|
-
export class CaseToolFactory implements IProjectToolFactory {
|
|
15
|
-
readonly supportedTypes: readonly ProjectType[] = [
|
|
16
|
-
ProjectTypes.CaseManagement,
|
|
17
|
-
];
|
|
18
|
-
|
|
19
|
-
async createAsync(
|
|
20
|
-
logger: IToolLogger,
|
|
21
|
-
fileSystem: IFileSystem,
|
|
22
|
-
): Promise<ProjectTool> {
|
|
23
|
-
return new CaseTool(fileSystem, logger);
|
|
24
|
-
}
|
|
25
|
-
}
|
package/src/case-tool.ts
DELETED
|
@@ -1,408 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
IProjectBuildOptions,
|
|
3
|
-
IProjectPackOptions,
|
|
4
|
-
IProjectRestoreOptions,
|
|
5
|
-
IProjectValidateOptions,
|
|
6
|
-
} from "@uipath/solutionpackager-tool-core";
|
|
7
|
-
import {
|
|
8
|
-
ensureContentOperateFile,
|
|
9
|
-
type IFileSystem,
|
|
10
|
-
type IToolLogger,
|
|
11
|
-
NugetConstants,
|
|
12
|
-
NugetPackager,
|
|
13
|
-
Path,
|
|
14
|
-
ProjectTool,
|
|
15
|
-
ProjectTypes,
|
|
16
|
-
TemporaryStorageService,
|
|
17
|
-
ToolErrorCodes,
|
|
18
|
-
ToolResult,
|
|
19
|
-
} from "@uipath/solutionpackager-tool-core";
|
|
20
|
-
import { getCaseBpmnCompiler } from "./case-bpmn-compiler.js";
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Case Management-specific file names
|
|
24
|
-
*/
|
|
25
|
-
const CaseConstants = {
|
|
26
|
-
EntryPointsFileName: "entry-points.json",
|
|
27
|
-
BindingsV2FileName: "bindings_v2.json",
|
|
28
|
-
CasePlanFileName: "caseplan.json",
|
|
29
|
-
CompiledBpmnFileName: "caseplan.json.bpmn",
|
|
30
|
-
} as const;
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Case Management project tool implementation.
|
|
34
|
-
*
|
|
35
|
-
* The authored source is `caseplan.json`; the runtime reads the BPMN compiled
|
|
36
|
-
* from it. `entry-points.json` points at `/content/caseplan.json.bpmn`, so the
|
|
37
|
-
* build compiles that file into content/ — a package without it deploys and
|
|
38
|
-
* activates fine and then faults every job it starts (UV-15809). All files are
|
|
39
|
-
* placed in the content/ folder (no separate source folder like flow_files/).
|
|
40
|
-
*/
|
|
41
|
-
export class CaseTool extends ProjectTool {
|
|
42
|
-
private readonly _temporaryStorage: TemporaryStorageService;
|
|
43
|
-
|
|
44
|
-
constructor(fileSystem: IFileSystem, logger: IToolLogger) {
|
|
45
|
-
super(fileSystem, logger);
|
|
46
|
-
this._temporaryStorage = new TemporaryStorageService(fileSystem);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
override async restoreAsync(
|
|
50
|
-
_options: IProjectRestoreOptions,
|
|
51
|
-
_cancellationToken?: AbortSignal,
|
|
52
|
-
): Promise<ToolResult> {
|
|
53
|
-
this.logger.info(
|
|
54
|
-
"Restore operation is not required for Case Management projects",
|
|
55
|
-
);
|
|
56
|
-
return ToolResult.success();
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
override async validateAsync(
|
|
60
|
-
_options: IProjectValidateOptions,
|
|
61
|
-
_cancellationToken?: AbortSignal,
|
|
62
|
-
): Promise<ToolResult> {
|
|
63
|
-
this.logger.info(
|
|
64
|
-
"Validate operation is not required for Case Management projects",
|
|
65
|
-
);
|
|
66
|
-
return ToolResult.success();
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
override async buildAsync(
|
|
70
|
-
options: IProjectBuildOptions,
|
|
71
|
-
_cancellationToken?: AbortSignal,
|
|
72
|
-
): Promise<ToolResult> {
|
|
73
|
-
const tempFolder = await this._temporaryStorage.getTempFolderPath();
|
|
74
|
-
const localBuildFolder = Path.join(
|
|
75
|
-
tempFolder,
|
|
76
|
-
NugetConstants.OutputFolderName,
|
|
77
|
-
);
|
|
78
|
-
const contentFolder = Path.join(
|
|
79
|
-
localBuildFolder,
|
|
80
|
-
NugetConstants.ContentFolderName,
|
|
81
|
-
);
|
|
82
|
-
|
|
83
|
-
try {
|
|
84
|
-
this.logger.progress("Copying files...");
|
|
85
|
-
await this.copyFiles(options.projectPath, contentFolder);
|
|
86
|
-
|
|
87
|
-
this.logger.progress("Compiling case plan to BPMN...");
|
|
88
|
-
const compileResult = await this.compileCasePlan(
|
|
89
|
-
options.projectPath,
|
|
90
|
-
contentFolder,
|
|
91
|
-
);
|
|
92
|
-
if (!compileResult.isSuccess) {
|
|
93
|
-
return compileResult;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
this.logger.progress("Creating operate.json file...");
|
|
97
|
-
await this.createOperateFile(options, contentFolder);
|
|
98
|
-
|
|
99
|
-
this.logger.progress("Creating package-descriptor.json file...");
|
|
100
|
-
await this.createPackageDescriptor(localBuildFolder, contentFolder);
|
|
101
|
-
|
|
102
|
-
return new ToolResult(ToolErrorCodes.Success, "done", [
|
|
103
|
-
localBuildFolder,
|
|
104
|
-
]);
|
|
105
|
-
} catch (error) {
|
|
106
|
-
const errorMessage =
|
|
107
|
-
error instanceof Error ? error.toString() : String(error);
|
|
108
|
-
this.logger.error(errorMessage);
|
|
109
|
-
return ToolResult.error(
|
|
110
|
-
ToolErrorCodes.InternalError,
|
|
111
|
-
"An error occurred while building Case Management project files",
|
|
112
|
-
);
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
override async packAsync(
|
|
117
|
-
options: IProjectPackOptions,
|
|
118
|
-
cancellationToken?: AbortSignal,
|
|
119
|
-
): Promise<ToolResult> {
|
|
120
|
-
// First, run the build step to prepare the bundle content
|
|
121
|
-
const buildResult = await this.buildAsync(options, cancellationToken);
|
|
122
|
-
if (!buildResult.isSuccess) {
|
|
123
|
-
return buildResult;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
const localBuildFolder = buildResult.packages[0];
|
|
127
|
-
|
|
128
|
-
try {
|
|
129
|
-
// Create the NuGet package
|
|
130
|
-
this.logger.progress("Creating NuGet package...");
|
|
131
|
-
|
|
132
|
-
const nupkgFileName = `${options.package.id}.${options.package.version}.nupkg`;
|
|
133
|
-
const nupkgPath = Path.join(options.outputPath, nupkgFileName);
|
|
134
|
-
|
|
135
|
-
const packager = new NugetPackager(this.fileSystem);
|
|
136
|
-
const result = await packager.packAsync(
|
|
137
|
-
localBuildFolder,
|
|
138
|
-
options.package,
|
|
139
|
-
nupkgPath,
|
|
140
|
-
);
|
|
141
|
-
|
|
142
|
-
this.logger.progress("Package created successfully");
|
|
143
|
-
return new ToolResult(ToolErrorCodes.Success, "done", [
|
|
144
|
-
result.outputPath,
|
|
145
|
-
]);
|
|
146
|
-
} catch (error) {
|
|
147
|
-
const errorMessage =
|
|
148
|
-
error instanceof Error ? error.toString() : String(error);
|
|
149
|
-
this.logger.error(errorMessage);
|
|
150
|
-
return ToolResult.error(
|
|
151
|
-
ToolErrorCodes.InternalError,
|
|
152
|
-
"An error occurred while packing Case Management project",
|
|
153
|
-
);
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
override async dispose(): Promise<void> {
|
|
158
|
-
this.logger.info("Disposing Case Management Tool");
|
|
159
|
-
try {
|
|
160
|
-
await this._temporaryStorage.cleanup();
|
|
161
|
-
} catch {
|
|
162
|
-
// Ignore errors during cleanup
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
/**
|
|
167
|
-
* Copy all files from source path to content/.
|
|
168
|
-
* Case Management projects keep all files in content/ (no separate folder).
|
|
169
|
-
*/
|
|
170
|
-
private async copyFiles(
|
|
171
|
-
sourcePath: string,
|
|
172
|
-
contentFolder: string,
|
|
173
|
-
): Promise<void> {
|
|
174
|
-
await this.fileSystem.mkdir(contentFolder);
|
|
175
|
-
|
|
176
|
-
const files = await this.fileSystem.readdir(sourcePath);
|
|
177
|
-
|
|
178
|
-
for (const file of files) {
|
|
179
|
-
const sourceFile = Path.join(sourcePath, file);
|
|
180
|
-
|
|
181
|
-
const stat = await this.fileSystem.stat(sourceFile);
|
|
182
|
-
if (stat?.isFile()) {
|
|
183
|
-
const content = await this.fileSystem.readFile(sourceFile);
|
|
184
|
-
if (content) {
|
|
185
|
-
const destinationFile = Path.join(contentFolder, file);
|
|
186
|
-
await this.fileSystem.writeFile(destinationFile, content);
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
/**
|
|
193
|
-
* Compile `caseplan.json` into `content/caseplan.json.bpmn`.
|
|
194
|
-
*
|
|
195
|
-
* Runs after copyFiles on purpose: a stale `caseplan.json.bpmn` left in the
|
|
196
|
-
* project directory by an earlier `uip maestro case pack` is copied in
|
|
197
|
-
* first and then overwritten here, so an edited case plan can never ship
|
|
198
|
-
* against an old BPMN. Nothing is written back into the project directory —
|
|
199
|
-
* packing a solution does not mutate the user's source tree.
|
|
200
|
-
*
|
|
201
|
-
* The compiler is injected (see `case-bpmn-compiler.ts`). With none
|
|
202
|
-
* registered — a browser host, where `@uipath/case-schema` cannot run — the
|
|
203
|
-
* project has to bring its own compiled `.bpmn`.
|
|
204
|
-
*/
|
|
205
|
-
private async compileCasePlan(
|
|
206
|
-
projectPath: string,
|
|
207
|
-
contentFolder: string,
|
|
208
|
-
): Promise<ToolResult> {
|
|
209
|
-
const compile = getCaseBpmnCompiler();
|
|
210
|
-
const casePlanPath = Path.join(
|
|
211
|
-
projectPath,
|
|
212
|
-
CaseConstants.CasePlanFileName,
|
|
213
|
-
);
|
|
214
|
-
|
|
215
|
-
if (!compile || !(await this.fileSystem.exists(casePlanPath))) {
|
|
216
|
-
return this.checkEntryPointBpmnPresent(contentFolder);
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
const casePlan = await this.fileSystem.readFile(casePlanPath);
|
|
220
|
-
if (!casePlan || casePlan.length === 0) {
|
|
221
|
-
return ToolResult.error(
|
|
222
|
-
ToolErrorCodes.InternalError,
|
|
223
|
-
`'${CaseConstants.CasePlanFileName}' in ${projectPath} is empty, so there is nothing to compile into '${CaseConstants.CompiledBpmnFileName}'. Author the case plan, or re-scaffold the project with 'uip maestro case init'.`,
|
|
224
|
-
);
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
try {
|
|
228
|
-
const bpmnXml = await compile(new TextDecoder().decode(casePlan));
|
|
229
|
-
await this.fileSystem.writeFile(
|
|
230
|
-
Path.join(contentFolder, CaseConstants.CompiledBpmnFileName),
|
|
231
|
-
bpmnXml,
|
|
232
|
-
);
|
|
233
|
-
// A compile alone does not prove the package is coherent: the
|
|
234
|
-
// entry point could name a different file. Check what was declared.
|
|
235
|
-
return await this.checkEntryPointBpmnPresent(contentFolder);
|
|
236
|
-
} catch (error) {
|
|
237
|
-
const message =
|
|
238
|
-
error instanceof Error ? error.message : String(error);
|
|
239
|
-
this.logger.error(message);
|
|
240
|
-
return ToolResult.error(
|
|
241
|
-
ToolErrorCodes.InternalError,
|
|
242
|
-
`Failed to compile '${CaseConstants.CasePlanFileName}' into '${CaseConstants.CompiledBpmnFileName}': ${message}. Run 'uip maestro case validate ${projectPath}' to find the problem in the case plan, then pack again.`,
|
|
243
|
-
);
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
/**
|
|
248
|
-
* Verify every `.bpmn` `entry-points.json` names is actually in content/.
|
|
249
|
-
*
|
|
250
|
-
* This is the defect UV-15809 reported, checked mechanically: the entry
|
|
251
|
-
* point resolved to a file the package did not contain, so it deployed and
|
|
252
|
-
* activated cleanly and then faulted every job. Checking the declaration
|
|
253
|
-
* rather than a fixed filename covers both project shapes — a CLI project
|
|
254
|
-
* (`caseplan.json` -> `caseplan.json.bpmn`) and a Studio Web one
|
|
255
|
-
* (`<name>.stage.json` shipped with its compiled `<name>.stage.json.bpmn`)
|
|
256
|
-
* — and a stray `.bpmn` left behind by `uip case debug` cannot stand in for
|
|
257
|
-
* the one that is missing.
|
|
258
|
-
*
|
|
259
|
-
* No `entry-points.json` means nothing declares an entry point, so there is
|
|
260
|
-
* nothing to resolve and nothing to fail on.
|
|
261
|
-
*/
|
|
262
|
-
private async checkEntryPointBpmnPresent(
|
|
263
|
-
contentFolder: string,
|
|
264
|
-
): Promise<ToolResult> {
|
|
265
|
-
const referenced = await this.readEntryPointBpmnFiles(contentFolder);
|
|
266
|
-
if (referenced === null) {
|
|
267
|
-
return ToolResult.error(
|
|
268
|
-
ToolErrorCodes.InternalError,
|
|
269
|
-
`'${CaseConstants.EntryPointsFileName}' could not be read as JSON, so pack cannot check that the BPMN it declares is in the package. Fix or re-scaffold '${CaseConstants.EntryPointsFileName}', then pack again.`,
|
|
270
|
-
);
|
|
271
|
-
}
|
|
272
|
-
if (referenced.length === 0) {
|
|
273
|
-
return ToolResult.success();
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
const contentFiles = await this.fileSystem.readdir(contentFolder);
|
|
277
|
-
const missing = referenced.filter(
|
|
278
|
-
(file) => !contentFiles.includes(file),
|
|
279
|
-
);
|
|
280
|
-
if (missing.length === 0) {
|
|
281
|
-
return ToolResult.success();
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
// Only the CLI shape can be produced by packing: the missing file is
|
|
285
|
-
// compiled from `caseplan.json`. A Studio Web project ships its own
|
|
286
|
-
// `<name>.stage.json.bpmn`, and telling that user to author a
|
|
287
|
-
// `caseplan.json` their project type does not use is wrong.
|
|
288
|
-
const fix = missing.includes(CaseConstants.CompiledBpmnFileName)
|
|
289
|
-
? `Author '${CaseConstants.CasePlanFileName}' so pack can compile it (see 'uip maestro case init'), then pack again.`
|
|
290
|
-
: `Add the missing file to the project, or point '${CaseConstants.EntryPointsFileName}' at the BPMN the project does ship, then pack again.`;
|
|
291
|
-
|
|
292
|
-
return ToolResult.error(
|
|
293
|
-
ToolErrorCodes.InternalError,
|
|
294
|
-
`'${CaseConstants.EntryPointsFileName}' points at ${missing.map((f) => `'content/${f}'`).join(", ")}, which the package does not contain, so it would deploy and activate and then fault every job. ${fix}`,
|
|
295
|
-
);
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
/**
|
|
299
|
-
* The `.bpmn` file names `entry-points.json` refers to. Entries look like
|
|
300
|
-
* `/content/caseplan.json.bpmn#<triggerId>`; `uip case debug` writes them
|
|
301
|
-
* without the `content/` prefix, so both forms are accepted.
|
|
302
|
-
*
|
|
303
|
-
* No file at all means nothing is declared, so the caller has nothing to
|
|
304
|
-
* check. A file that is there but cannot be read as JSON returns `null`:
|
|
305
|
-
* treating that as "nothing declared" would wave through the very package
|
|
306
|
-
* this check exists to stop, since the entry point it names is unknown.
|
|
307
|
-
*/
|
|
308
|
-
private async readEntryPointBpmnFiles(
|
|
309
|
-
contentFolder: string,
|
|
310
|
-
): Promise<string[] | null> {
|
|
311
|
-
const entryPointsPath = Path.join(
|
|
312
|
-
contentFolder,
|
|
313
|
-
CaseConstants.EntryPointsFileName,
|
|
314
|
-
);
|
|
315
|
-
if (!(await this.fileSystem.exists(entryPointsPath))) {
|
|
316
|
-
return [];
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
const raw = await this.fileSystem.readFile(entryPointsPath);
|
|
320
|
-
if (!raw || raw.length === 0) {
|
|
321
|
-
return null;
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
try {
|
|
325
|
-
const parsed = JSON.parse(new TextDecoder().decode(raw)) as {
|
|
326
|
-
entryPoints?: { filePath?: string }[];
|
|
327
|
-
};
|
|
328
|
-
const names = (parsed.entryPoints ?? [])
|
|
329
|
-
.map((entry) => entry.filePath ?? "")
|
|
330
|
-
.map((filePath) => filePath.split("#")[0])
|
|
331
|
-
.map((filePath) => filePath.split("/").pop() ?? "")
|
|
332
|
-
.filter((name) => name.endsWith(".bpmn"));
|
|
333
|
-
return [...new Set(names)];
|
|
334
|
-
} catch {
|
|
335
|
-
return null;
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
/**
|
|
340
|
-
* Create operate.json file if it doesn't already exist
|
|
341
|
-
*/
|
|
342
|
-
private async createOperateFile(
|
|
343
|
-
options: IProjectBuildOptions,
|
|
344
|
-
contentFolder: string,
|
|
345
|
-
): Promise<void> {
|
|
346
|
-
await ensureContentOperateFile(this.fileSystem, {
|
|
347
|
-
contentFolder,
|
|
348
|
-
projectPath: options.projectPath,
|
|
349
|
-
projectStorageId: options.projectStorageId,
|
|
350
|
-
contentType: ProjectTypes.CaseManagement,
|
|
351
|
-
});
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
/**
|
|
355
|
-
* Create package-descriptor.json file.
|
|
356
|
-
* Lists standard packaging files and .bpmn files from content/.
|
|
357
|
-
*/
|
|
358
|
-
private async createPackageDescriptor(
|
|
359
|
-
localBuildFolder: string,
|
|
360
|
-
contentFolder: string,
|
|
361
|
-
): Promise<void> {
|
|
362
|
-
const descriptorFiles: Record<string, string> = {};
|
|
363
|
-
|
|
364
|
-
// Standard packaging files
|
|
365
|
-
descriptorFiles[NugetConstants.OperateFileName] = Path.join(
|
|
366
|
-
NugetConstants.ContentFolderName,
|
|
367
|
-
NugetConstants.OperateFileName,
|
|
368
|
-
);
|
|
369
|
-
descriptorFiles[CaseConstants.EntryPointsFileName] = Path.join(
|
|
370
|
-
NugetConstants.ContentFolderName,
|
|
371
|
-
CaseConstants.EntryPointsFileName,
|
|
372
|
-
);
|
|
373
|
-
descriptorFiles[NugetConstants.BindingsFileId] = Path.join(
|
|
374
|
-
NugetConstants.ContentFolderName,
|
|
375
|
-
CaseConstants.BindingsV2FileName,
|
|
376
|
-
);
|
|
377
|
-
|
|
378
|
-
// Add .bpmn files from content/
|
|
379
|
-
const contentFiles = await this.fileSystem.readdir(contentFolder);
|
|
380
|
-
for (const file of contentFiles) {
|
|
381
|
-
if (file.endsWith(".bpmn")) {
|
|
382
|
-
descriptorFiles[file] = Path.join(
|
|
383
|
-
NugetConstants.ContentFolderName,
|
|
384
|
-
file,
|
|
385
|
-
);
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
const packageDescriptorPath = Path.join(
|
|
390
|
-
localBuildFolder,
|
|
391
|
-
NugetConstants.ContentFolderName,
|
|
392
|
-
NugetConstants.PackageDescriptorFileName,
|
|
393
|
-
);
|
|
394
|
-
const packageDescriptorJson = JSON.stringify(
|
|
395
|
-
{
|
|
396
|
-
$schema:
|
|
397
|
-
"https://cloud.uipath.com/draft/2024-12/package-descriptor",
|
|
398
|
-
files: descriptorFiles,
|
|
399
|
-
},
|
|
400
|
-
null,
|
|
401
|
-
2,
|
|
402
|
-
);
|
|
403
|
-
await this.fileSystem.writeFile(
|
|
404
|
-
packageDescriptorPath,
|
|
405
|
-
packageDescriptorJson,
|
|
406
|
-
);
|
|
407
|
-
}
|
|
408
|
-
}
|
package/src/index.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
// Case Management tool factory.
|
|
2
|
-
//
|
|
3
|
-
// Self-registers on import so micro-frontend consumers (whose MFEs UiPath does
|
|
4
|
-
// not control) that load this package via a side-effect import get the factory
|
|
5
|
-
// registered automatically — StudioWeb does not reference this package, so it
|
|
6
|
-
// relies on self-registration. Also exported for consumers that register
|
|
7
|
-
// explicitly; re-registering the same factory class is an idempotent no-op.
|
|
8
|
-
import { toolsFactoryRepository } from "@uipath/solutionpackager-tool-core";
|
|
9
|
-
import { CaseToolFactory } from "./case-tool-factory.js";
|
|
10
|
-
|
|
11
|
-
toolsFactoryRepository.registerProjectToolFactory(new CaseToolFactory());
|
|
12
|
-
|
|
13
|
-
export {
|
|
14
|
-
type CaseBpmnCompiler,
|
|
15
|
-
registerCaseBpmnCompiler,
|
|
16
|
-
} from "./case-bpmn-compiler.js";
|
|
17
|
-
export { CaseToolFactory };
|
package/src/node.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
// Node-only entry point: wires the real `caseplan.json` -> BPMN compiler into
|
|
2
|
-
// the Case packager. Kept out of `index.ts` because `@uipath/case-schema`
|
|
3
|
-
// requires Node built-ins and would break the browser build — see
|
|
4
|
-
// `case-bpmn-compiler.ts`.
|
|
5
|
-
|
|
6
|
-
import {
|
|
7
|
-
type CaseBpmnCompiler,
|
|
8
|
-
registerCaseBpmnCompiler,
|
|
9
|
-
} from "./case-bpmn-compiler.js";
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* `@uipath/case-schema` ships as a single 2.5 MB CommonJS bundle with no
|
|
13
|
-
* `exports` map, so nothing in it can be tree-shaken — importing one function
|
|
14
|
-
* costs the whole file. Behind `await import` it becomes its own lazy chunk,
|
|
15
|
-
* parsed only when a Case project is actually built, instead of loading with
|
|
16
|
-
* every `uip maestro -h`. `case-tool` keeps the same shape for its own
|
|
17
|
-
* `uip maestro case pack` path (`services/case-schema-loader.ts`).
|
|
18
|
-
*/
|
|
19
|
-
const compileCasePlan: CaseBpmnCompiler = async (casePlanJson) => {
|
|
20
|
-
const { serializeCaseDiskJsonToBpmnAndRulesJson } = await import(
|
|
21
|
-
"@uipath/case-schema"
|
|
22
|
-
);
|
|
23
|
-
const { bpmnXml } =
|
|
24
|
-
await serializeCaseDiskJsonToBpmnAndRulesJson(casePlanJson);
|
|
25
|
-
return bpmnXml;
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Register the Node `caseplan.json` -> BPMN compiler. Call it wherever the
|
|
30
|
-
* Case project tool factory is registered on Node — without it a Case project
|
|
31
|
-
* can only be packed from an already-compiled `.bpmn`.
|
|
32
|
-
*/
|
|
33
|
-
export function registerNodeCaseBpmnCompiler(): void {
|
|
34
|
-
registerCaseBpmnCompiler(compileCasePlan);
|
|
35
|
-
}
|