@uipath/case-tool 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 +172 -3
- package/dist/{authoring-e757p9dq.js → authoring-kngaggwm.js} +42 -4
- package/dist/{case-api-42s4mbpn.js → case-api-v6cjyrfw.js} +8 -8
- package/dist/case-bindings-service-1wxfghzd.js +240 -0
- package/dist/case-debug-studio-web-service-0624c07c.js +133 -0
- package/dist/case-format-service-q345a2fd.js +84 -0
- package/dist/{case-pack-service-8exkecnd.js → case-pack-service-29rza2q2.js} +61 -11
- package/dist/{case-validate-service-xvxkr026.js → case-validate-service-e06varbt.js} +1422 -40
- package/dist/{connector-enrichment-service-xq9xtz95.js → connector-enrichment-service-2pes4b1b.js} +20 -20
- package/dist/{connector-lookup-service-bk1wscyr.js → connector-lookup-service-2bkybhkf.js} +7 -7
- package/dist/{connector-task-spec-0g34na74.js → connector-task-spec-q59xmzm0.js} +24 -24
- package/dist/{de-7XQXX2DK-tqdy5n2b.js → de-FGHEJRCI-rv513mfh.js} +153 -9
- package/dist/{de-5KVP66U6-1bnf4zt5.js → de-MUJPA4EB-dpg7t2rw.js} +15 -3
- package/dist/{debug-service-f6t4ntmg.js → debug-service-8x087xxt.js} +2 -2
- package/dist/{index-j3xb87ag.js → embedded-file-reader-0sjt4nkj.js} +96 -16641
- package/dist/{en-5ZGC5VQ3-h581y30k.js → en-BWGKA5OE-1qkvb9rn.js} +140 -2
- package/dist/{en-X3S6IZ5J-nhkg6pwn.js → en-FBPVNKFN-dqt573xn.js} +29 -3
- package/dist/{enrichment-service-k1zhkzgr.js → enrichment-service-7vbxcwge.js} +7 -7
- package/dist/{es-VFPNVMP5-bx2c337j.js → es-7SE7HX2X-8yh1aj2y.js} +15 -3
- package/dist/{es-ZGCPPOME-8gazspjj.js → es-KR3ZSNMP-84zphx0x.js} +153 -9
- package/dist/{es-MX-XAVLOQW3-q00km2y7.js → es-MX-2MYFZU7X-3rek4r73.js} +15 -3
- package/dist/{es-MX-U2VN3SZW-anynsmd8.js → es-MX-XXZJGC4R-2mr8jtgm.js} +153 -9
- package/dist/first-party-service-srxaftkn.js +27 -0
- package/dist/{fr-E5MDO4EG-c3mkty2t.js → fr-MDFKNZ4C-h4a122k9.js} +15 -3
- package/dist/{fr-T3G5GZCT-y3f7xb1q.js → fr-Y6NPVODW-8vr1ja4b.js} +153 -9
- package/dist/{index-f0rf4m8p.js → index-8yv94z7r.js} +6 -4
- package/dist/{index-kwxe1vep.js → index-fz4ttsde.js} +16 -4
- package/dist/index-jxj2jz45.js +16742 -0
- package/dist/index-kmp9fmhb.js +25 -0
- package/dist/index.js +10 -10
- package/dist/{input-reader-vgsdjgst.js → input-reader-pnh948bq.js} +1 -1
- package/dist/{ja-BI5K3JDZ-77zat4z2.js → ja-Q5PXKJ2V-p4msxzjd.js} +153 -9
- package/dist/{ja-DPO5PPLO-mysfmznx.js → ja-UTQEAP34-8e0q6swp.js} +15 -3
- package/dist/{known-types-qryebm95.js → known-types-mn8xn36b.js} +4 -4
- package/dist/{ko-ITOPNIYI-hmxd2asd.js → ko-AXCHW2OK-askct7f6.js} +15 -3
- package/dist/{ko-JOBF5V7N-4bv0mjje.js → ko-AYBDSRZG-41mdmsg1.js} +153 -9
- package/dist/{node-strategy-0267x5e5.js → node-strategy-gc4sg6a2.js} +4 -4
- package/dist/{node-sync-service-ac8rzgnj.js → node-sync-service-9d0dqz4z.js} +12 -14
- package/dist/{packager-tool-5yw9xatr.js → packager-tool-052kvydg.js} +1 -1
- package/dist/{packager-tool-3tfbb641.js → packager-tool-32jxda3r.js} +213 -51
- package/dist/packager-tool-53w8skv5.js +262 -0
- package/dist/{packager-tool-w0209wf4.js → packager-tool-61hxhgeg.js} +1 -1
- package/dist/{packager-tool-58q3tvh7.js → packager-tool-7q6z6npd.js} +166 -28
- package/dist/packager-tool-83qnybab.js +1564 -0
- package/dist/{packager-tool-eh50gcdk.js → packager-tool-8q7vzh65.js} +5 -4
- package/dist/{packager-tool-8rf8qda5.js → packager-tool-adcaxdhs.js} +15 -5
- package/dist/{packager-tool-933n6t8x.js → packager-tool-af2s79jb.js} +6 -6
- package/dist/{packager-tool-sk2b33km.js → packager-tool-b6368khs.js} +10 -9
- package/dist/{packager-tool-d73376xs.js → packager-tool-cg2j4rma.js} +8 -8
- package/dist/packager-tool-d4sjk46c.js +88 -0
- package/dist/{packager-tool-a42jnpy5.js → packager-tool-d88rqwk8.js} +29 -3
- package/dist/packager-tool-dd8bq6az.js +8462 -0
- package/dist/packager-tool-gdtpsdn7.js +342 -0
- package/dist/{packager-tool-v60h8pvv.js → packager-tool-hrdan5ms.js} +1 -1
- package/dist/{packager-tool-bmn50g7v.js → packager-tool-hz1mz8fs.js} +1 -1
- package/dist/{packager-tool-v0vdet53.js → packager-tool-jf4hmztd.js} +10 -13
- package/dist/{packager-tool-c23zrhj8.js → packager-tool-jysvpt8p.js} +2 -2
- package/dist/{packager-tool-jhdf8gt1.js → packager-tool-kkxhc0fp.js} +13554 -8844
- package/dist/{packager-tool-4knkebkr.js → packager-tool-kpcjnxd1.js} +269 -23
- package/dist/{packager-tool-nx0j1294.js → packager-tool-rhkk0pta.js} +31 -30
- package/dist/{packager-tool-d128hs55.js → packager-tool-wefb1zw3.js} +1 -1
- package/dist/{packager-tool-3kbkkv2a.js → packager-tool-x4vxexvk.js} +11 -11
- package/dist/{packager-tool-dqs5qy9s.js → packager-tool-yrsrzz1a.js} +134 -19
- package/dist/packager-tool.js +5 -1501
- package/dist/{project-artifacts-43c2ynd9.js → project-artifacts-8snev67g.js} +1 -1
- package/dist/{pt-YI4VE4YQ-wdkn2dcf.js → pt-3DIO5QWG-59b3f4bc.js} +15 -3
- package/dist/{pt-BR-7DYX2YPT-fqxqzqtf.js → pt-BR-TKHNHMET-sn91xyq0.js} +153 -9
- package/dist/{pt-BR-BXURWX4W-bwfcwhk1.js → pt-BR-Y6K6XHXK-mp3hwhw1.js} +15 -3
- package/dist/{pt-HTXGGX6Y-97t21dty.js → pt-ROXU257Y-2f6bxev4.js} +153 -9
- package/dist/{resourcesSyncService-7ampdrez.js → resourcesSyncService-5bq0j9wf.js} +20 -20
- package/dist/{ro-KTNQ3MNU-y08n1x5g.js → ro-AVAWPKOO-b89pw79r.js} +153 -9
- package/dist/{ro-RKXZUG7Z-nndrrsq7.js → ro-BWR3ONRR-vzx3hy8a.js} +15 -3
- package/dist/ru-WBLQ5B2U-s4em88p0.js +10 -0
- package/dist/sdd-lookup-x08j9g9m.js +48 -0
- package/dist/{strict-case-rules-303vjvas.js → strict-case-rules-x6t0vb40.js} +141 -109
- package/dist/strict-sdd-audit-8e2fh9jg.js +2520 -0
- package/dist/tool.js +9 -9
- package/dist/{tr-AA6O2WSR-86ba4bdf.js → tr-5IIHSFW5-hw4cewew.js} +15 -3
- package/dist/{tr-XHSSPNK7-cmqyc4wd.js → tr-JMIP7ZSL-c39b6pe4.js} +153 -9
- package/dist/{trigger-enrichment-service-cg99dk1f.js → trigger-enrichment-service-kkh3197w.js} +24 -24
- package/dist/{zh-CN-2EHQT23P-mr63c4xz.js → zh-CN-IFFXSEJS-9wm9gmrv.js} +153 -9
- package/dist/{zh-CN-R2KLHXQV-agqr45ds.js → zh-CN-R2KU4U5L-tc1hat59.js} +15 -3
- package/dist/{zh-TW-RJGCQANM-w0x3qc1p.js → zh-TW-GNKMELBF-j674515r.js} +15 -3
- package/dist/{zh-TW-MGZCE5BT-c4ekmrz9.js → zh-TW-IYBNYAMG-8727c7v2.js} +153 -9
- package/package.json +3 -2
- package/dist/case-debug-studio-web-service-npcw81ay.js +0 -335
- package/dist/packager-tool-134mvmcm.js +0 -3040
- package/dist/packager-tool-ty1t2byf.js +0 -27
- package/dist/ru-WBLQ5B2U-8r3c7v6d.js +0 -10
- package/dist/strict-sdd-audit-qdmc9e1y.js +0 -1024
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import {
|
|
2
|
+
loadCaseSchemaAsync
|
|
3
|
+
} from "./packager-tool-p7jgrm5r.js";
|
|
4
|
+
import {
|
|
5
|
+
buildSolutionPackageFromDir,
|
|
6
|
+
uploadOrOverwriteSolution
|
|
7
|
+
} from "./packager-tool-jf4hmztd.js";
|
|
8
|
+
import {
|
|
9
|
+
findSolutionFile,
|
|
10
|
+
updateSolutionFile
|
|
11
|
+
} from "./packager-tool-052kvydg.js";
|
|
12
|
+
import {
|
|
13
|
+
CasePlanFileNames,
|
|
14
|
+
buildCasePackageDescriptor,
|
|
15
|
+
casePlanSidecarName,
|
|
16
|
+
entryPointBpmnNames,
|
|
17
|
+
findCasePlanFileName,
|
|
18
|
+
misnamedEntryPointBpmn,
|
|
19
|
+
normalizeEntryPointPath,
|
|
20
|
+
resolveDeclaredFileName
|
|
21
|
+
} from "./packager-tool-83qnybab.js";
|
|
22
|
+
import"./packager-tool-b098y4a2.js";
|
|
23
|
+
import {
|
|
24
|
+
uploadAndDebugSolution
|
|
25
|
+
} from "./packager-tool-adcaxdhs.js";
|
|
26
|
+
import {
|
|
27
|
+
logger
|
|
28
|
+
} from "./packager-tool-kpcjnxd1.js";
|
|
29
|
+
import {
|
|
30
|
+
getFileSystem
|
|
31
|
+
} from "./packager-tool-0v3s8r01.js";
|
|
32
|
+
import"./packager-tool-1yh8g550.js";
|
|
33
|
+
|
|
34
|
+
// src/services/case-debug-studio-web-service.ts
|
|
35
|
+
class CaseDebugStudioWebService {
|
|
36
|
+
fs;
|
|
37
|
+
constructor() {
|
|
38
|
+
this.fs = getFileSystem();
|
|
39
|
+
}
|
|
40
|
+
async executeProjectViaStudioWeb(projectPath, config, callbacks, pollInterval) {
|
|
41
|
+
const absoluteProjectPath = this.fs.path.resolve(projectPath);
|
|
42
|
+
const projectUiprojPath = this.fs.path.join(absoluteProjectPath, "project.uiproj");
|
|
43
|
+
if (!await this.fs.exists(projectUiprojPath)) {
|
|
44
|
+
throw new Error(`Not a valid case project directory: missing project.uiproj in ${absoluteProjectPath}`);
|
|
45
|
+
}
|
|
46
|
+
const projectUiprojContent = await this.fs.readFile(projectUiprojPath, "utf-8");
|
|
47
|
+
if (projectUiprojContent === null) {
|
|
48
|
+
throw new Error(`Could not read project.uiproj in ${absoluteProjectPath}`);
|
|
49
|
+
}
|
|
50
|
+
const projectUiproj = JSON.parse(projectUiprojContent);
|
|
51
|
+
const projectName = projectUiproj.Name;
|
|
52
|
+
const entryPointsPath = this.fs.path.join(absoluteProjectPath, "entry-points.json");
|
|
53
|
+
if (!await this.fs.exists(entryPointsPath)) {
|
|
54
|
+
throw new Error(`Not a valid case project directory: missing entry-points.json in ${absoluteProjectPath}`);
|
|
55
|
+
}
|
|
56
|
+
const entryPointsContent = await this.fs.readFile(entryPointsPath, "utf-8");
|
|
57
|
+
if (entryPointsContent === null) {
|
|
58
|
+
throw new Error(`Could not read entry-points.json in ${absoluteProjectPath}`);
|
|
59
|
+
}
|
|
60
|
+
const declared = entryPointBpmnNames(entryPointsContent);
|
|
61
|
+
if (declared === null) {
|
|
62
|
+
throw new Error(`entry-points.json in ${absoluteProjectPath} could not be read as JSON, so debug cannot check that the BPMN it declares is in the project.`);
|
|
63
|
+
}
|
|
64
|
+
const entryPointsJson = JSON.parse(entryPointsContent);
|
|
65
|
+
const rawEntryPoint = entryPointsJson.entryPoints?.[0]?.filePath ?? "";
|
|
66
|
+
const entryPoint = normalizeEntryPointPath(rawEntryPoint);
|
|
67
|
+
logger.info("Looking for .uipx solution file...");
|
|
68
|
+
const solutionInfo = await findSolutionFile(this.fs, absoluteProjectPath);
|
|
69
|
+
const existingSolutionId = solutionInfo?.solutionId;
|
|
70
|
+
logger.info("Reading case plan file...");
|
|
71
|
+
const casePlanFileName = findCasePlanFileName(await this.fs.readdir(absoluteProjectPath));
|
|
72
|
+
if (!casePlanFileName) {
|
|
73
|
+
throw new Error(`Not a valid case project directory: no case plan in ${absoluteProjectPath}. Expected one of ${CasePlanFileNames.join(", ")}.`);
|
|
74
|
+
}
|
|
75
|
+
const caseJsonPath = this.fs.path.join(absoluteProjectPath, casePlanFileName);
|
|
76
|
+
const caseFileContent = await this.fs.readFile(caseJsonPath, "utf-8");
|
|
77
|
+
if (caseFileContent === null) {
|
|
78
|
+
throw new Error(`Could not read file: ${caseJsonPath}`);
|
|
79
|
+
}
|
|
80
|
+
const sidecarFileName = casePlanSidecarName(casePlanFileName);
|
|
81
|
+
logger.info("Converting case plan to BPMN and case plan JSON...");
|
|
82
|
+
const { serializeCaseDiskJsonToBpmnAndRulesJson } = await loadCaseSchemaAsync();
|
|
83
|
+
const { bpmnXml, rulesJson: casePlanJson } = await serializeCaseDiskJsonToBpmnAndRulesJson(caseFileContent);
|
|
84
|
+
await this.fs.writeFile(this.fs.path.join(absoluteProjectPath, sidecarFileName), bpmnXml);
|
|
85
|
+
await this.fs.writeFile(this.fs.path.join(absoluteProjectPath, "case-plan.json"), `${JSON.stringify(casePlanJson, null, 2)}
|
|
86
|
+
`);
|
|
87
|
+
const projectFiles = new Set([
|
|
88
|
+
...await this.fs.readdir(absoluteProjectPath),
|
|
89
|
+
sidecarFileName
|
|
90
|
+
]);
|
|
91
|
+
const missing = declared.filter((file) => !projectFiles.has(file));
|
|
92
|
+
if (missing.length > 0) {
|
|
93
|
+
throw new Error(`entry-points.json points at ${missing.join(", ")}, which ${absoluteProjectPath} does not hold, so the debug run would fault. Point the entry point at '${sidecarFileName}', or add the missing file.`);
|
|
94
|
+
}
|
|
95
|
+
const misnamed = misnamedEntryPointBpmn(declared, casePlanFileName);
|
|
96
|
+
if (misnamed) {
|
|
97
|
+
throw new Error(`entry-points.json points at '${misnamed}', the sidecar of a case plan this project does not carry. '${casePlanFileName}' compiles to '${sidecarFileName}', so the debug run would resolve a BPMN nothing here produced. Point the entry point at '${sidecarFileName}'.`);
|
|
98
|
+
}
|
|
99
|
+
const entryPointFileName = resolveDeclaredFileName(rawEntryPoint);
|
|
100
|
+
if (!declared.includes(entryPointFileName)) {
|
|
101
|
+
throw new Error(`entry-points.json's first entry point resolves to '${entryPointFileName || entryPoint}', which is not a declared .bpmn file this project ships, so the debug run would fault. Point the entry point at '${sidecarFileName}'.`);
|
|
102
|
+
}
|
|
103
|
+
await this.fs.writeFile(this.fs.path.join(absoluteProjectPath, "package-descriptor.json"), `${JSON.stringify(buildCasePackageDescriptor([...projectFiles]), null, 2)}
|
|
104
|
+
`);
|
|
105
|
+
logger.info("Building solution package from project...");
|
|
106
|
+
const solutionDir = this.fs.path.resolve(absoluteProjectPath, "..");
|
|
107
|
+
const uisPath = await buildSolutionPackageFromDir(this.fs, solutionDir);
|
|
108
|
+
const apiConfig = {
|
|
109
|
+
baseUrl: config.baseUrl,
|
|
110
|
+
organizationId: config.organizationId,
|
|
111
|
+
tenantName: config.tenantName,
|
|
112
|
+
tenantId: config.tenantId,
|
|
113
|
+
authToken: config.authToken,
|
|
114
|
+
organizationUnitId: config.organizationUnitId
|
|
115
|
+
};
|
|
116
|
+
return uploadAndDebugSolution({
|
|
117
|
+
upload: () => uploadOrOverwriteSolution(apiConfig, config.organizationName, uisPath, existingSolutionId, this.fs),
|
|
118
|
+
onSolutionId: (id) => updateSolutionFile(this.fs, absoluteProjectPath, id),
|
|
119
|
+
projectName,
|
|
120
|
+
entryPoint,
|
|
121
|
+
projectType: "CaseManagement",
|
|
122
|
+
apiConfig,
|
|
123
|
+
organizationName: config.organizationName,
|
|
124
|
+
callbacks,
|
|
125
|
+
pollInterval
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
export {
|
|
130
|
+
CaseDebugStudioWebService
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
//# debugId=BA02F2B9880B270D64756E2164756E21
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import {
|
|
2
|
+
catchError
|
|
3
|
+
} from "./packager-tool-kpcjnxd1.js";
|
|
4
|
+
import {
|
|
5
|
+
getFileSystem
|
|
6
|
+
} from "./packager-tool-0v3s8r01.js";
|
|
7
|
+
import"./packager-tool-1yh8g550.js";
|
|
8
|
+
|
|
9
|
+
// src/services/case-format-service.ts
|
|
10
|
+
var INDENT = 2;
|
|
11
|
+
var longestLineOf = (text) => {
|
|
12
|
+
let longest = 0;
|
|
13
|
+
let current = 0;
|
|
14
|
+
for (const ch of text) {
|
|
15
|
+
if (ch === `
|
|
16
|
+
`) {
|
|
17
|
+
longest = Math.max(longest, current);
|
|
18
|
+
current = 0;
|
|
19
|
+
continue;
|
|
20
|
+
}
|
|
21
|
+
current += 1;
|
|
22
|
+
}
|
|
23
|
+
return Math.max(longest, current);
|
|
24
|
+
};
|
|
25
|
+
var formatCasePlan = async (filePath) => {
|
|
26
|
+
const fs = getFileSystem();
|
|
27
|
+
const resolved = fs.path.resolve(filePath);
|
|
28
|
+
if (!await fs.exists(resolved)) {
|
|
29
|
+
return {
|
|
30
|
+
ok: false,
|
|
31
|
+
message: `Case plan file not found: ${resolved}`,
|
|
32
|
+
instructions: "Pass the path to an existing case plan JSON file, for example 'uip maestro case format case.json'."
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
const [readError, raw] = await catchError(fs.readFile(resolved, "utf-8"));
|
|
36
|
+
if (readError || raw == null) {
|
|
37
|
+
return {
|
|
38
|
+
ok: false,
|
|
39
|
+
message: `Failed to read case plan: ${readError?.message ?? "empty content"}`,
|
|
40
|
+
instructions: `Verify read permissions on ${resolved}.`
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
const [parseError, document] = catchError(() => JSON.parse(raw));
|
|
44
|
+
if (parseError) {
|
|
45
|
+
return {
|
|
46
|
+
ok: false,
|
|
47
|
+
message: `Case plan is not valid JSON: ${parseError.message}`,
|
|
48
|
+
instructions: `Fix the JSON in ${resolved} before formatting it — formatting cannot repair a file it cannot parse.`
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
const formatted = `${JSON.stringify(document, null, INDENT)}
|
|
52
|
+
`;
|
|
53
|
+
if (formatted === raw) {
|
|
54
|
+
return {
|
|
55
|
+
ok: true,
|
|
56
|
+
path: resolved,
|
|
57
|
+
changed: false,
|
|
58
|
+
lines: formatted.split(`
|
|
59
|
+
`).length - 1,
|
|
60
|
+
longestLine: longestLineOf(formatted)
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
const [writeError] = await catchError(fs.writeFile(resolved, formatted));
|
|
64
|
+
if (writeError) {
|
|
65
|
+
return {
|
|
66
|
+
ok: false,
|
|
67
|
+
message: `Failed to write case plan: ${writeError.message}`,
|
|
68
|
+
instructions: `Verify write permissions on ${resolved}.`
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
return {
|
|
72
|
+
ok: true,
|
|
73
|
+
path: resolved,
|
|
74
|
+
changed: true,
|
|
75
|
+
lines: formatted.split(`
|
|
76
|
+
`).length - 1,
|
|
77
|
+
longestLine: longestLineOf(formatted)
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
export {
|
|
81
|
+
formatCasePlan
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
//# debugId=E8837B95902F865564756E2164756E21
|
|
@@ -5,6 +5,15 @@ import {
|
|
|
5
5
|
NugetPackager,
|
|
6
6
|
ensureProjectId
|
|
7
7
|
} from "./packager-tool-sfkyb4kz.js";
|
|
8
|
+
import {
|
|
9
|
+
CasePlanFileNames,
|
|
10
|
+
buildCasePackageDescriptor,
|
|
11
|
+
casePlanSidecarName,
|
|
12
|
+
entryPointBpmnNames,
|
|
13
|
+
findCasePlanFileName,
|
|
14
|
+
misnamedEntryPointBpmn,
|
|
15
|
+
resolveDeclaredFileName
|
|
16
|
+
} from "./packager-tool-83qnybab.js";
|
|
8
17
|
import"./packager-tool-b098y4a2.js";
|
|
9
18
|
import {
|
|
10
19
|
VALID_PACKAGE_NAME_REGEX
|
|
@@ -13,7 +22,7 @@ import {
|
|
|
13
22
|
catchError,
|
|
14
23
|
logger,
|
|
15
24
|
mapPackageMetadataOptions
|
|
16
|
-
} from "./packager-tool-
|
|
25
|
+
} from "./packager-tool-kpcjnxd1.js";
|
|
17
26
|
import {
|
|
18
27
|
getFileSystem
|
|
19
28
|
} from "./packager-tool-0v3s8r01.js";
|
|
@@ -41,7 +50,7 @@ Packing Case project...
|
|
|
41
50
|
logger.info(` Output: ${absoluteOutputPath}`);
|
|
42
51
|
logger.info("");
|
|
43
52
|
await this.validate(absoluteProjectPath);
|
|
44
|
-
await this.
|
|
53
|
+
const casePlanFileName = await this.convertCaseToBpmn(absoluteProjectPath);
|
|
45
54
|
await ensureProjectId(absoluteProjectPath, this.fs);
|
|
46
55
|
await this.fs.mkdir(absoluteOutputPath);
|
|
47
56
|
let tempDir;
|
|
@@ -49,7 +58,10 @@ Packing Case project...
|
|
|
49
58
|
tempDir = await this.fs.getTempDir();
|
|
50
59
|
const stagingDir = this.fs.path.join(tempDir, "case-pack-staging");
|
|
51
60
|
await this.fs.mkdir(stagingDir);
|
|
52
|
-
|
|
61
|
+
const contentDir = this.fs.path.join(stagingDir, "content");
|
|
62
|
+
await this.fs.copyDirectory(absoluteProjectPath, contentDir);
|
|
63
|
+
await this.checkEntryPointBpmn(contentDir, casePlanFileName);
|
|
64
|
+
await this.regeneratePackageDescriptor(contentDir);
|
|
53
65
|
const packageId = `${packageName}.case.Case`;
|
|
54
66
|
const version = options.version || "1.0.0";
|
|
55
67
|
const nupkgPath = this.fs.path.join(absoluteOutputPath, `${packageId}.${version}.nupkg`);
|
|
@@ -74,18 +86,51 @@ Packing Case project...
|
|
|
74
86
|
}
|
|
75
87
|
}
|
|
76
88
|
}
|
|
77
|
-
async
|
|
78
|
-
const
|
|
79
|
-
if (!
|
|
80
|
-
|
|
89
|
+
async convertCaseToBpmn(projectPath) {
|
|
90
|
+
const casePlanFileName = findCasePlanFileName(await this.fs.readdir(projectPath));
|
|
91
|
+
if (!casePlanFileName) {
|
|
92
|
+
throw new Error(`No case plan in ${projectPath}. Expected one of ${CasePlanFileNames.join(", ")}.`);
|
|
81
93
|
}
|
|
82
|
-
logger.info("Converting case
|
|
83
|
-
const caseContent = String(await this.fs.readFile(
|
|
94
|
+
logger.info("Converting case plan to BPMN...");
|
|
95
|
+
const caseContent = String(await this.fs.readFile(this.fs.path.join(projectPath, casePlanFileName), "utf-8"));
|
|
84
96
|
const { serializeCaseDiskJsonToBpmnAndRulesJson } = await loadCaseSchemaAsync();
|
|
85
97
|
const { bpmnXml: bpmn } = await serializeCaseDiskJsonToBpmnAndRulesJson(caseContent);
|
|
86
|
-
const bpmnFilePath = this.fs.path.join(projectPath,
|
|
98
|
+
const bpmnFilePath = this.fs.path.join(projectPath, casePlanSidecarName(casePlanFileName));
|
|
87
99
|
await this.fs.writeFile(bpmnFilePath, bpmn);
|
|
88
100
|
logger.info(`BPMN file written to ${bpmnFilePath}`);
|
|
101
|
+
return casePlanFileName;
|
|
102
|
+
}
|
|
103
|
+
async checkEntryPointBpmn(contentPath, casePlanFileName) {
|
|
104
|
+
const entryPointsPath = this.fs.path.join(contentPath, "entry-points.json");
|
|
105
|
+
if (!await this.fs.exists(entryPointsPath)) {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
const raw = await this.fs.readFile(entryPointsPath, "utf-8");
|
|
109
|
+
const declared = raw ? entryPointBpmnNames(String(raw)) : null;
|
|
110
|
+
if (declared === null) {
|
|
111
|
+
throw new Error(`entry-points.json in ${contentPath} could not be read as JSON, so pack cannot check that the BPMN it declares is in the package.`);
|
|
112
|
+
}
|
|
113
|
+
const firstEntry = firstEntryPointFileName(String(raw));
|
|
114
|
+
if (firstEntry && !declared.includes(firstEntry)) {
|
|
115
|
+
const own = casePlanSidecarName(casePlanFileName);
|
|
116
|
+
throw new Error(`entry-points.json's first entry point resolves to '${firstEntry}', which is not a declared .bpmn file this project ships, so it would deploy and activate and then fault every job. Point the first entry point at '${own}'.`);
|
|
117
|
+
}
|
|
118
|
+
const present = new Set(await this.fs.readdir(contentPath));
|
|
119
|
+
const missing = declared.filter((file) => !present.has(file));
|
|
120
|
+
if (missing.length > 0) {
|
|
121
|
+
throw new Error(`entry-points.json points at ${missing.join(", ")}, which the package does not contain, so it would deploy and activate and then fault every job.`);
|
|
122
|
+
}
|
|
123
|
+
const misnamed = misnamedEntryPointBpmn(declared, casePlanFileName);
|
|
124
|
+
if (misnamed) {
|
|
125
|
+
const own = casePlanSidecarName(casePlanFileName);
|
|
126
|
+
throw new Error(`entry-points.json points at '${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}'.`);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
async regeneratePackageDescriptor(contentDir) {
|
|
130
|
+
const contentFiles = await this.fs.readdir(contentDir);
|
|
131
|
+
const descriptor = buildCasePackageDescriptor(contentFiles);
|
|
132
|
+
await this.fs.writeFile(this.fs.path.join(contentDir, "package-descriptor.json"), `${JSON.stringify(descriptor, null, 2)}
|
|
133
|
+
`);
|
|
89
134
|
}
|
|
90
135
|
async validate(projectPath) {
|
|
91
136
|
if (!await this.fs.exists(projectPath)) {
|
|
@@ -105,8 +150,13 @@ Packing Case project...
|
|
|
105
150
|
}
|
|
106
151
|
}
|
|
107
152
|
}
|
|
153
|
+
function firstEntryPointFileName(entryPointsJson) {
|
|
154
|
+
const parsed = JSON.parse(entryPointsJson);
|
|
155
|
+
const filePath = parsed.entryPoints?.[0]?.filePath ?? "";
|
|
156
|
+
return resolveDeclaredFileName(filePath);
|
|
157
|
+
}
|
|
108
158
|
export {
|
|
109
159
|
CasePackService
|
|
110
160
|
};
|
|
111
161
|
|
|
112
|
-
//# debugId=
|
|
162
|
+
//# debugId=AFB0C029C8C764C664756E2164756E21
|