@uipath/packager-tool-case 1.202.0 → 1.203.0-preview.160
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/THIRD-PARTY-NOTICES.md +83 -1
- package/dist/case-plan-file.d.ts +89 -0
- package/dist/case-tool.d.ts +22 -10
- package/dist/index.d.ts +1 -0
- package/dist/index.js +110 -40
- package/package.json +4 -4
|
@@ -5,4 +5,86 @@ compiled into its `dist/` output rather than installed alongside it.
|
|
|
5
5
|
Their licences and copyright notices are reproduced here in full, as
|
|
6
6
|
those licences require.
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
6 bundled dependencies:
|
|
9
|
+
|
|
10
|
+
- @uipath/case-schema@0.1052.3 — UNLICENSED
|
|
11
|
+
- lodash.isequal — MIT
|
|
12
|
+
- lodash.keys — MIT
|
|
13
|
+
- lodash.merge — MIT
|
|
14
|
+
- lodash.xor — MIT
|
|
15
|
+
- to-json-schema — MIT
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## @uipath/case-schema@0.1052.3
|
|
20
|
+
|
|
21
|
+
SPDX: UNLICENSED
|
|
22
|
+
|
|
23
|
+
The upstream package ships no licence file here; `UNLICENSED` is the
|
|
24
|
+
licence it is distributed under. The canonical text of that licence
|
|
25
|
+
applies, with copyright held by the package's authors.
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## lodash.isequal
|
|
30
|
+
|
|
31
|
+
Inlined by a bundled dependency rather than resolved directly,
|
|
32
|
+
so it does not appear in this package's source maps.
|
|
33
|
+
|
|
34
|
+
SPDX: MIT
|
|
35
|
+
|
|
36
|
+
The upstream package ships no licence file here; `MIT` is the
|
|
37
|
+
licence it is distributed under. The canonical text of that licence
|
|
38
|
+
applies, with copyright held by the package's authors.
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## lodash.keys
|
|
43
|
+
|
|
44
|
+
Inlined by a bundled dependency rather than resolved directly,
|
|
45
|
+
so it does not appear in this package's source maps.
|
|
46
|
+
|
|
47
|
+
SPDX: MIT
|
|
48
|
+
|
|
49
|
+
The upstream package ships no licence file here; `MIT` is the
|
|
50
|
+
licence it is distributed under. The canonical text of that licence
|
|
51
|
+
applies, with copyright held by the package's authors.
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## lodash.merge
|
|
56
|
+
|
|
57
|
+
Inlined by a bundled dependency rather than resolved directly,
|
|
58
|
+
so it does not appear in this package's source maps.
|
|
59
|
+
|
|
60
|
+
SPDX: MIT
|
|
61
|
+
|
|
62
|
+
The upstream package ships no licence file here; `MIT` is the
|
|
63
|
+
licence it is distributed under. The canonical text of that licence
|
|
64
|
+
applies, with copyright held by the package's authors.
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## lodash.xor
|
|
69
|
+
|
|
70
|
+
Inlined by a bundled dependency rather than resolved directly,
|
|
71
|
+
so it does not appear in this package's source maps.
|
|
72
|
+
|
|
73
|
+
SPDX: MIT
|
|
74
|
+
|
|
75
|
+
The upstream package ships no licence file here; `MIT` is the
|
|
76
|
+
licence it is distributed under. The canonical text of that licence
|
|
77
|
+
applies, with copyright held by the package's authors.
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
## to-json-schema
|
|
82
|
+
|
|
83
|
+
Inlined by a bundled dependency rather than resolved directly,
|
|
84
|
+
so it does not appear in this package's source maps.
|
|
85
|
+
|
|
86
|
+
SPDX: MIT
|
|
87
|
+
|
|
88
|
+
The upstream package ships no licence file here; `MIT` is the
|
|
89
|
+
licence it is distributed under. The canonical text of that licence
|
|
90
|
+
applies, with copyright held by the package's authors.
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { type PackageDescriptorFileModel } from "@uipath/solutionpackager-tool-core";
|
|
2
|
+
/**
|
|
3
|
+
* The names Studio Web gives a case plan on disk, newest first.
|
|
4
|
+
*
|
|
5
|
+
* Studio Web owns this file. It renames the plan to the newest name on every
|
|
6
|
+
* save and reads all four, so a project last saved on an earlier release still
|
|
7
|
+
* carries an older name and has to keep resolving.
|
|
8
|
+
*
|
|
9
|
+
* Match the whole name, not a `.case` suffix. A standalone canvas download can
|
|
10
|
+
* be any `<name>.case`, but inside a project Studio Web writes and reads these
|
|
11
|
+
* four exactly.
|
|
12
|
+
*
|
|
13
|
+
* @public
|
|
14
|
+
*/
|
|
15
|
+
export declare const CasePlanFileNames: readonly ["caseplan.case", "caseplan.json", "case.stage.json", "default.stage.json"];
|
|
16
|
+
/**
|
|
17
|
+
* The compiled BPMN's name: the plan's own full name plus `.bpmn`.
|
|
18
|
+
*
|
|
19
|
+
* `entry-points.json` records that name and the runtime resolves it by exact
|
|
20
|
+
* match, so deriving it here is what stops a renamed plan from shipping
|
|
21
|
+
* against the sidecar of the name it used to have.
|
|
22
|
+
*/
|
|
23
|
+
export declare const casePlanSidecarName: (casePlanFileName: string) => string;
|
|
24
|
+
/**
|
|
25
|
+
* The case plan among `entries`, or `undefined` when none is there.
|
|
26
|
+
*
|
|
27
|
+
* Precedence is the declaration order, so a project holding both a new and an
|
|
28
|
+
* old name resolves to the new one, the way Studio Web does.
|
|
29
|
+
*/
|
|
30
|
+
export declare const findCasePlanFileName: (entries: readonly string[]) => string | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* The name a declared `filePath` resolves to, or `""` when it does not.
|
|
33
|
+
*
|
|
34
|
+
* Any directory other than `content/` (or none) does not resolve at all:
|
|
35
|
+
* content/ is flat, so a path naming some other directory cannot be the file
|
|
36
|
+
* actually present there, even when its own basename happens to match one
|
|
37
|
+
* that is.
|
|
38
|
+
*/
|
|
39
|
+
export declare const resolveDeclaredFileName: (filePath: string) => string;
|
|
40
|
+
/**
|
|
41
|
+
* A declared `filePath`, rewritten to the single form PIMS accepts:
|
|
42
|
+
* `/<name>#<fragment>`, regardless of which prefix form the project wrote.
|
|
43
|
+
*
|
|
44
|
+
* Debug uploads this value, not the raw `filePath` — the same string
|
|
45
|
+
* {@link resolveDeclaredFileName} validates. Without sharing the prefix rule,
|
|
46
|
+
* a path that passes validation (any accepted prefix form) could still reach
|
|
47
|
+
* PIMS in a form only one of those forms happens to produce correctly.
|
|
48
|
+
*/
|
|
49
|
+
export declare const normalizeEntryPointPath: (filePath: string) => string;
|
|
50
|
+
/**
|
|
51
|
+
* The `.bpmn` names `entry-points.json` declares, or `null` when the document
|
|
52
|
+
* cannot be read as JSON, is not an object, its `entryPoints` is present but
|
|
53
|
+
* not a list, or an entry in that list has no usable `filePath`.
|
|
54
|
+
*
|
|
55
|
+
* `null` rather than an empty list: treating an unreadable document as
|
|
56
|
+
* "nothing declared" waves through the package whose entry point is exactly
|
|
57
|
+
* what the caller wanted to check. A `filePath` that is missing, not a
|
|
58
|
+
* string, or resolves to no name at all (empty, a bare `#fragment`, or a
|
|
59
|
+
* directory other than `content/`) gets the same treatment: silently
|
|
60
|
+
* dropping it, the way an entry naming a real but non-`.bpmn` file is
|
|
61
|
+
* dropped, would let `case debug` upload with an empty `entryPoint` instead
|
|
62
|
+
* of failing before the upload.
|
|
63
|
+
*/
|
|
64
|
+
export declare const entryPointBpmnNames: (entryPointsJson: string) => string[] | null;
|
|
65
|
+
/**
|
|
66
|
+
* The declared BPMN that belongs to a plan other than `casePlanFileName`, or
|
|
67
|
+
* `undefined` when every declared name is either this plan's own sidecar or a
|
|
68
|
+
* BPMN no plan compiles to.
|
|
69
|
+
*
|
|
70
|
+
* Studio Web can leave a sidecar named after the newest plan name beside a plan
|
|
71
|
+
* it did not rename, and point the entry point at it. The file is on disk, so a
|
|
72
|
+
* presence check passes and the runtime resolves the stale BPMN. A name no plan
|
|
73
|
+
* compiles to is a project shipping its own, which is a supported shape.
|
|
74
|
+
*/
|
|
75
|
+
export declare const misnamedEntryPointBpmn: (declared: readonly string[], casePlanFileName: string) => string | undefined;
|
|
76
|
+
/**
|
|
77
|
+
* `package-descriptor.json` for a case package, naming whichever plan file
|
|
78
|
+
* and `.bpmn` files the build actually produced.
|
|
79
|
+
*
|
|
80
|
+
* Studio Web renames the plan without touching the project's own
|
|
81
|
+
* `package-descriptor.json`, so a copy of that file made after a rename
|
|
82
|
+
* still names the sidecar the plan used to compile to. Regenerating it from
|
|
83
|
+
* the package's real content instead of copying the project's copy is what
|
|
84
|
+
* keeps the two in step. The plan itself is included alongside its sidecar
|
|
85
|
+
* because `case init` seeds a descriptor with both, and dropping the plan's
|
|
86
|
+
* own entry here would still change that shape even though nothing resolves
|
|
87
|
+
* entry points against it.
|
|
88
|
+
*/
|
|
89
|
+
export declare const buildCasePackageDescriptor: (contentFileNames: readonly string[]) => PackageDescriptorFileModel;
|
package/dist/case-tool.d.ts
CHANGED
|
@@ -3,8 +3,8 @@ import { type IFileSystem, type IToolLogger, ProjectTool, ToolResult } from "@ui
|
|
|
3
3
|
/**
|
|
4
4
|
* Case Management project tool implementation.
|
|
5
5
|
*
|
|
6
|
-
* The authored source is
|
|
7
|
-
* from it. `entry-points.json` points at
|
|
6
|
+
* The authored source is the case plan; the runtime reads the BPMN compiled
|
|
7
|
+
* from it. `entry-points.json` points at that BPMN by name, so the
|
|
8
8
|
* build compiles that file into content/ — a package without it deploys and
|
|
9
9
|
* activates fine and then faults every job it starts (UV-15809). All files are
|
|
10
10
|
* placed in the content/ folder (no separate source folder like flow_files/).
|
|
@@ -23,7 +23,8 @@ export declare class CaseTool extends ProjectTool {
|
|
|
23
23
|
*/
|
|
24
24
|
private copyFiles;
|
|
25
25
|
/**
|
|
26
|
-
* Compile
|
|
26
|
+
* Compile the case plan into the BPMN the runtime resolves, named after
|
|
27
|
+
* the plan itself.
|
|
27
28
|
*
|
|
28
29
|
* Runs after copyFiles on purpose: a stale `caseplan.json.bpmn` left in the
|
|
29
30
|
* project directory by an earlier `uip maestro case pack` is copied in
|
|
@@ -49,20 +50,31 @@ export declare class CaseTool extends ProjectTool {
|
|
|
49
50
|
* the one that is missing.
|
|
50
51
|
*
|
|
51
52
|
* No `entry-points.json` means nothing declares an entry point, so there is
|
|
52
|
-
* nothing to resolve and nothing to fail on.
|
|
53
|
+
* nothing to resolve and nothing to fail on. A declared name that belongs to
|
|
54
|
+
* a plan other than the one the project carries fails too, even when the
|
|
55
|
+
* file is present: it is a stale sidecar from before a rename.
|
|
53
56
|
*/
|
|
54
57
|
private checkEntryPointBpmnPresent;
|
|
55
58
|
/**
|
|
56
|
-
* The `.bpmn` file names `entry-points.json` refers to
|
|
57
|
-
* `/content/caseplan.json.bpmn#<triggerId>`; `uip case debug` writes them
|
|
58
|
-
* without the `content/` prefix, so both forms are accepted.
|
|
59
|
+
* The `.bpmn` file names `entry-points.json` refers to, read from content/.
|
|
59
60
|
*
|
|
60
61
|
* No file at all means nothing is declared, so the caller has nothing to
|
|
61
|
-
* check.
|
|
62
|
-
* treating
|
|
63
|
-
* this check exists to stop
|
|
62
|
+
* check. An empty or unreadable one returns `null`, which the caller
|
|
63
|
+
* reports: treating it as "nothing declared" would wave through the very
|
|
64
|
+
* package this check exists to stop.
|
|
64
65
|
*/
|
|
65
66
|
private readEntryPointBpmnFiles;
|
|
67
|
+
/**
|
|
68
|
+
* The name `entry-points.json`'s first entry resolves to, unfiltered by
|
|
69
|
+
* the `.bpmn` suffix `readEntryPointBpmnFiles` applies.
|
|
70
|
+
*
|
|
71
|
+
* `createOperateFile` derives operate.json's `main` the same way
|
|
72
|
+
* (`resolveEntryPointMain` in packager-core), so `checkEntryPointBpmnPresent`
|
|
73
|
+
* has to check the exact value that call will end up trusting, not just
|
|
74
|
+
* the declared list as a whole. Only called once `readEntryPointBpmnFiles`
|
|
75
|
+
* has proven the file exists and parses, so the read here cannot fail.
|
|
76
|
+
*/
|
|
77
|
+
private firstEntryPointFileName;
|
|
66
78
|
/**
|
|
67
79
|
* Create operate.json file if it doesn't already exist
|
|
68
80
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { CaseToolFactory } from "./case-tool-factory.js";
|
|
2
2
|
export { type CaseBpmnCompiler, registerCaseBpmnCompiler, } from "./case-bpmn-compiler.js";
|
|
3
|
+
export { buildCasePackageDescriptor, CasePlanFileNames, casePlanSidecarName, entryPointBpmnNames, findCasePlanFileName, misnamedEntryPointBpmn, normalizeEntryPointPath, resolveDeclaredFileName, } from "./case-plan-file.js";
|
|
3
4
|
export { CaseToolFactory };
|
package/dist/index.js
CHANGED
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
// src/case-tool.ts
|
|
10
10
|
import {
|
|
11
11
|
ensureContentOperateFile,
|
|
12
|
-
NugetConstants,
|
|
12
|
+
NugetConstants as NugetConstants2,
|
|
13
13
|
NugetPackager,
|
|
14
14
|
Path,
|
|
15
15
|
ProjectTool,
|
|
@@ -29,12 +29,70 @@ function getCaseBpmnCompiler() {
|
|
|
29
29
|
return _global[COMPILER_KEY];
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
// src/case-plan-file.ts
|
|
33
|
+
import {
|
|
34
|
+
NugetConstants
|
|
35
|
+
} from "@uipath/solutionpackager-tool-core";
|
|
36
|
+
var CasePlanFileNames = [
|
|
37
|
+
"caseplan.case",
|
|
38
|
+
"caseplan.json",
|
|
39
|
+
"case.stage.json",
|
|
40
|
+
"default.stage.json"
|
|
41
|
+
];
|
|
42
|
+
var casePlanSidecarName = (casePlanFileName) => `${casePlanFileName}.bpmn`;
|
|
43
|
+
var findCasePlanFileName = (entries) => {
|
|
44
|
+
const present = new Set(entries);
|
|
45
|
+
return CasePlanFileNames.find((candidate) => present.has(candidate));
|
|
46
|
+
};
|
|
47
|
+
var stripDeclaredFilePathPrefix = (filePath) => {
|
|
48
|
+
const withoutLeadingSlash = filePath.startsWith("/") ? filePath.slice(1) : filePath;
|
|
49
|
+
return withoutLeadingSlash.startsWith("content/") ? withoutLeadingSlash.slice("content/".length) : withoutLeadingSlash;
|
|
50
|
+
};
|
|
51
|
+
var resolveDeclaredFileName = (filePath) => {
|
|
52
|
+
const stripped = stripDeclaredFilePathPrefix(filePath.split("#")[0]);
|
|
53
|
+
return stripped.includes("/") ? "" : stripped;
|
|
54
|
+
};
|
|
55
|
+
var normalizeEntryPointPath = (filePath) => `/${stripDeclaredFilePathPrefix(filePath)}`;
|
|
56
|
+
var entryPointBpmnNames = (entryPointsJson) => {
|
|
57
|
+
try {
|
|
58
|
+
const parsed = JSON.parse(entryPointsJson);
|
|
59
|
+
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
|
|
60
|
+
throw new Error("document is not an object");
|
|
61
|
+
}
|
|
62
|
+
if (parsed.entryPoints !== undefined && !Array.isArray(parsed.entryPoints)) {
|
|
63
|
+
throw new Error("entryPoints is not a list");
|
|
64
|
+
}
|
|
65
|
+
const resolvedNames = (parsed.entryPoints ?? []).map((entry) => typeof entry.filePath === "string" ? resolveDeclaredFileName(entry.filePath) : "");
|
|
66
|
+
if (resolvedNames.includes("")) {
|
|
67
|
+
throw new Error("an entry point has no usable filePath");
|
|
68
|
+
}
|
|
69
|
+
const names = resolvedNames.filter((name) => name.endsWith(".bpmn"));
|
|
70
|
+
return [...new Set(names)];
|
|
71
|
+
} catch {
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
var misnamedEntryPointBpmn = (declared, casePlanFileName) => {
|
|
76
|
+
const own = casePlanSidecarName(casePlanFileName);
|
|
77
|
+
const otherPlans = new Set(CasePlanFileNames.filter((name) => name !== casePlanFileName).map(casePlanSidecarName));
|
|
78
|
+
return declared.find((file) => file !== own && otherPlans.has(file));
|
|
79
|
+
};
|
|
80
|
+
var buildCasePackageDescriptor = (contentFileNames) => ({
|
|
81
|
+
$schema: "https://cloud.uipath.com/draft/2024-12/package-descriptor",
|
|
82
|
+
files: {
|
|
83
|
+
[NugetConstants.OperateFileName]: `${NugetConstants.ContentFolderName}/${NugetConstants.OperateFileName}`,
|
|
84
|
+
[NugetConstants.EntryPointsFileName]: `${NugetConstants.ContentFolderName}/${NugetConstants.EntryPointsFileName}`,
|
|
85
|
+
[NugetConstants.BindingsFileId]: `${NugetConstants.ContentFolderName}/${NugetConstants.BindingsV2FileName}`,
|
|
86
|
+
...Object.fromEntries(contentFileNames.filter((name) => name.endsWith(".bpmn") || CasePlanFileNames.includes(name)).map((name) => [
|
|
87
|
+
name,
|
|
88
|
+
`${NugetConstants.ContentFolderName}/${name}`
|
|
89
|
+
]))
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
|
|
32
93
|
// src/case-tool.ts
|
|
33
94
|
var CaseConstants = {
|
|
34
|
-
EntryPointsFileName: "entry-points.json"
|
|
35
|
-
BindingsV2FileName: "bindings_v2.json",
|
|
36
|
-
CasePlanFileName: "caseplan.json",
|
|
37
|
-
CompiledBpmnFileName: "caseplan.json.bpmn"
|
|
95
|
+
EntryPointsFileName: "entry-points.json"
|
|
38
96
|
};
|
|
39
97
|
|
|
40
98
|
class CaseTool extends ProjectTool {
|
|
@@ -53,8 +111,8 @@ class CaseTool extends ProjectTool {
|
|
|
53
111
|
}
|
|
54
112
|
async buildAsync(options, _cancellationToken) {
|
|
55
113
|
const tempFolder = await this._temporaryStorage.getTempFolderPath();
|
|
56
|
-
const localBuildFolder = Path.join(tempFolder,
|
|
57
|
-
const contentFolder = Path.join(localBuildFolder,
|
|
114
|
+
const localBuildFolder = Path.join(tempFolder, NugetConstants2.OutputFolderName);
|
|
115
|
+
const contentFolder = Path.join(localBuildFolder, NugetConstants2.ContentFolderName);
|
|
58
116
|
try {
|
|
59
117
|
this.logger.progress("Copying files...");
|
|
60
118
|
await this.copyFiles(options.projectPath, contentFolder);
|
|
@@ -121,39 +179,55 @@ class CaseTool extends ProjectTool {
|
|
|
121
179
|
}
|
|
122
180
|
async compileCasePlan(projectPath, contentFolder) {
|
|
123
181
|
const compile = getCaseBpmnCompiler();
|
|
124
|
-
const
|
|
125
|
-
if (!compile || !
|
|
126
|
-
return this.checkEntryPointBpmnPresent(contentFolder);
|
|
182
|
+
const casePlanFileName = findCasePlanFileName(await this.fileSystem.readdir(projectPath));
|
|
183
|
+
if (!compile || !casePlanFileName) {
|
|
184
|
+
return this.checkEntryPointBpmnPresent(contentFolder, casePlanFileName);
|
|
127
185
|
}
|
|
186
|
+
const sidecarFileName = casePlanSidecarName(casePlanFileName);
|
|
187
|
+
const casePlanPath = Path.join(projectPath, casePlanFileName);
|
|
128
188
|
const casePlan = await this.fileSystem.readFile(casePlanPath);
|
|
129
189
|
if (!casePlan || casePlan.length === 0) {
|
|
130
|
-
return ToolResult.error(ToolErrorCodes.InternalError, `'${
|
|
190
|
+
return ToolResult.error(ToolErrorCodes.InternalError, `'${casePlanFileName}' in ${projectPath} is empty, so there is nothing to compile into '${sidecarFileName}'. Author the case plan, or re-scaffold the project with 'uip maestro case init'.`);
|
|
131
191
|
}
|
|
132
192
|
try {
|
|
133
193
|
const bpmnXml = await compile(new TextDecoder().decode(casePlan));
|
|
134
|
-
await this.fileSystem.writeFile(Path.join(contentFolder,
|
|
135
|
-
return await this.checkEntryPointBpmnPresent(contentFolder);
|
|
194
|
+
await this.fileSystem.writeFile(Path.join(contentFolder, sidecarFileName), bpmnXml);
|
|
195
|
+
return await this.checkEntryPointBpmnPresent(contentFolder, casePlanFileName);
|
|
136
196
|
} catch (error) {
|
|
137
197
|
const message = error instanceof Error ? error.message : String(error);
|
|
138
198
|
this.logger.error(message);
|
|
139
|
-
return ToolResult.error(ToolErrorCodes.InternalError, `Failed to compile '${
|
|
199
|
+
return ToolResult.error(ToolErrorCodes.InternalError, `Failed to compile '${casePlanFileName}' into '${sidecarFileName}': ${message}. Run 'uip maestro case validate ${projectPath}' to find the problem in the case plan, then pack again.`);
|
|
140
200
|
}
|
|
141
201
|
}
|
|
142
|
-
async checkEntryPointBpmnPresent(contentFolder) {
|
|
202
|
+
async checkEntryPointBpmnPresent(contentFolder, casePlanFileName) {
|
|
143
203
|
const referenced = await this.readEntryPointBpmnFiles(contentFolder);
|
|
144
204
|
if (referenced === null) {
|
|
145
205
|
return ToolResult.error(ToolErrorCodes.InternalError, `'${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.`);
|
|
146
206
|
}
|
|
207
|
+
const own = casePlanFileName ? casePlanSidecarName(casePlanFileName) : undefined;
|
|
208
|
+
const fix = own ?? `Author a case plan (${CasePlanFileNames.join(", ")}) so pack can compile it (see 'uip maestro case init'), then pack again.`;
|
|
209
|
+
const firstEntry = await this.firstEntryPointFileName(contentFolder);
|
|
210
|
+
if (firstEntry && !referenced.includes(firstEntry)) {
|
|
211
|
+
const firstEntryFix = own ? `Point the first entry point at '${own}', then pack again.` : fix;
|
|
212
|
+
return ToolResult.error(ToolErrorCodes.InternalError, `'${CaseConstants.EntryPointsFileName}' first entry point resolves to '${firstEntry}', which is not a declared .bpmn file this project ships, so operate.json's main would name a file pack cannot produce. ${firstEntryFix}`);
|
|
213
|
+
}
|
|
147
214
|
if (referenced.length === 0) {
|
|
148
215
|
return ToolResult.success();
|
|
149
216
|
}
|
|
150
217
|
const contentFiles = await this.fileSystem.readdir(contentFolder);
|
|
151
218
|
const missing = referenced.filter((file) => !contentFiles.includes(file));
|
|
152
219
|
if (missing.length === 0) {
|
|
220
|
+
if (casePlanFileName) {
|
|
221
|
+
const misnamed = misnamedEntryPointBpmn(referenced, casePlanFileName);
|
|
222
|
+
if (misnamed) {
|
|
223
|
+
return ToolResult.error(ToolErrorCodes.InternalError, `'${CaseConstants.EntryPointsFileName}' points at 'content/${misnamed}', the sidecar of a case plan this project does not carry. '${casePlanFileName}' compiles to '${own}', so the entry point would resolve to a BPMN pack did not produce. Point it at '${own}', then pack again.`);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
153
226
|
return ToolResult.success();
|
|
154
227
|
}
|
|
155
|
-
const
|
|
156
|
-
|
|
228
|
+
const missingFix = casePlanFileName ? `Add the missing file to the project, or point '${CaseConstants.EntryPointsFileName}' at the BPMN the project does ship, then pack again.` : fix;
|
|
229
|
+
const missingList = missing.map((f) => `'content/${f}'`).join(", ");
|
|
230
|
+
return ToolResult.error(ToolErrorCodes.InternalError, `'${CaseConstants.EntryPointsFileName}' points at ${missingList}, which the package does not contain, so it would deploy and activate and then fault every job. ${missingFix}`);
|
|
157
231
|
}
|
|
158
232
|
async readEntryPointBpmnFiles(contentFolder) {
|
|
159
233
|
const entryPointsPath = Path.join(contentFolder, CaseConstants.EntryPointsFileName);
|
|
@@ -164,13 +238,13 @@ class CaseTool extends ProjectTool {
|
|
|
164
238
|
if (!raw || raw.length === 0) {
|
|
165
239
|
return null;
|
|
166
240
|
}
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
241
|
+
return entryPointBpmnNames(new TextDecoder().decode(raw));
|
|
242
|
+
}
|
|
243
|
+
async firstEntryPointFileName(contentFolder) {
|
|
244
|
+
const raw = await this.fileSystem.readFile(Path.join(contentFolder, CaseConstants.EntryPointsFileName));
|
|
245
|
+
const parsed = JSON.parse(raw ? new TextDecoder().decode(raw) : "{}");
|
|
246
|
+
const filePath = parsed.entryPoints?.[0]?.filePath ?? "";
|
|
247
|
+
return resolveDeclaredFileName(filePath);
|
|
174
248
|
}
|
|
175
249
|
async createOperateFile(options, contentFolder) {
|
|
176
250
|
await ensureContentOperateFile(this.fileSystem, {
|
|
@@ -181,21 +255,9 @@ class CaseTool extends ProjectTool {
|
|
|
181
255
|
});
|
|
182
256
|
}
|
|
183
257
|
async createPackageDescriptor(localBuildFolder, contentFolder) {
|
|
184
|
-
const descriptorFiles = {};
|
|
185
|
-
descriptorFiles[NugetConstants.OperateFileName] = Path.join(NugetConstants.ContentFolderName, NugetConstants.OperateFileName);
|
|
186
|
-
descriptorFiles[CaseConstants.EntryPointsFileName] = Path.join(NugetConstants.ContentFolderName, CaseConstants.EntryPointsFileName);
|
|
187
|
-
descriptorFiles[NugetConstants.BindingsFileId] = Path.join(NugetConstants.ContentFolderName, CaseConstants.BindingsV2FileName);
|
|
188
258
|
const contentFiles = await this.fileSystem.readdir(contentFolder);
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
descriptorFiles[file] = Path.join(NugetConstants.ContentFolderName, file);
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
const packageDescriptorPath = Path.join(localBuildFolder, NugetConstants.ContentFolderName, NugetConstants.PackageDescriptorFileName);
|
|
195
|
-
const packageDescriptorJson = JSON.stringify({
|
|
196
|
-
$schema: "https://cloud.uipath.com/draft/2024-12/package-descriptor",
|
|
197
|
-
files: descriptorFiles
|
|
198
|
-
}, null, 2);
|
|
259
|
+
const packageDescriptorPath = Path.join(localBuildFolder, NugetConstants2.ContentFolderName, NugetConstants2.PackageDescriptorFileName);
|
|
260
|
+
const packageDescriptorJson = JSON.stringify(buildCasePackageDescriptor(contentFiles), null, 2);
|
|
199
261
|
await this.fileSystem.writeFile(packageDescriptorPath, packageDescriptorJson);
|
|
200
262
|
}
|
|
201
263
|
}
|
|
@@ -213,8 +275,16 @@ class CaseToolFactory {
|
|
|
213
275
|
// src/index.ts
|
|
214
276
|
toolsFactoryRepository.registerProjectToolFactory(new CaseToolFactory);
|
|
215
277
|
export {
|
|
278
|
+
CasePlanFileNames,
|
|
216
279
|
CaseToolFactory,
|
|
217
|
-
|
|
280
|
+
buildCasePackageDescriptor,
|
|
281
|
+
casePlanSidecarName,
|
|
282
|
+
entryPointBpmnNames,
|
|
283
|
+
findCasePlanFileName,
|
|
284
|
+
misnamedEntryPointBpmn,
|
|
285
|
+
normalizeEntryPointPath,
|
|
286
|
+
registerCaseBpmnCompiler,
|
|
287
|
+
resolveDeclaredFileName
|
|
218
288
|
};
|
|
219
289
|
|
|
220
|
-
//# debugId=
|
|
290
|
+
//# debugId=478D1E7AE28D7DC664756E2164756E21
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uipath/packager-tool-case",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.203.0-preview.160",
|
|
4
4
|
"description": "UiPath Case Management tool implementation",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -22,10 +22,10 @@
|
|
|
22
22
|
"files": [
|
|
23
23
|
"dist"
|
|
24
24
|
],
|
|
25
|
-
"author": "",
|
|
25
|
+
"author": "UiPath",
|
|
26
26
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
27
27
|
"peerDependencies": {
|
|
28
|
-
"@uipath/solutionpackager-tool-core": "1.
|
|
28
|
+
"@uipath/solutionpackager-tool-core": "1.203.0"
|
|
29
29
|
},
|
|
30
|
-
"gitHead": "
|
|
30
|
+
"gitHead": "3a42062ba731afca4595ba9aa8a80afc9667528d"
|
|
31
31
|
}
|