@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
|
@@ -1,335 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
loadCaseSchemaAsync
|
|
3
|
-
} from "./packager-tool-p7jgrm5r.js";
|
|
4
|
-
import {
|
|
5
|
-
buildSolutionPackageFromDir,
|
|
6
|
-
createZipFromDir,
|
|
7
|
-
uploadOrOverwriteSolution
|
|
8
|
-
} from "./packager-tool-v0vdet53.js";
|
|
9
|
-
import {
|
|
10
|
-
findSolutionFile,
|
|
11
|
-
updateSolutionFile
|
|
12
|
-
} from "./packager-tool-5yw9xatr.js";
|
|
13
|
-
import"./packager-tool-b098y4a2.js";
|
|
14
|
-
import {
|
|
15
|
-
extractStartEventId,
|
|
16
|
-
uploadAndDebugSolution
|
|
17
|
-
} from "./packager-tool-8rf8qda5.js";
|
|
18
|
-
import {
|
|
19
|
-
logger
|
|
20
|
-
} from "./packager-tool-4knkebkr.js";
|
|
21
|
-
import {
|
|
22
|
-
getFileSystem
|
|
23
|
-
} from "./packager-tool-0v3s8r01.js";
|
|
24
|
-
import"./packager-tool-1yh8g550.js";
|
|
25
|
-
|
|
26
|
-
// src/services/case-debug-studio-web-service.ts
|
|
27
|
-
class CaseDebugStudioWebService {
|
|
28
|
-
fs;
|
|
29
|
-
constructor() {
|
|
30
|
-
this.fs = getFileSystem();
|
|
31
|
-
}
|
|
32
|
-
async readCaseFile(caseFilePath) {
|
|
33
|
-
const absolutePath = this.fs.path.resolve(caseFilePath);
|
|
34
|
-
if (!await this.fs.exists(absolutePath)) {
|
|
35
|
-
throw new Error(`File not found: ${absolutePath}`);
|
|
36
|
-
}
|
|
37
|
-
if (!absolutePath.endsWith(".json")) {
|
|
38
|
-
throw new Error(`Expected a .json file but got: ${this.fs.path.basename(absolutePath)}`);
|
|
39
|
-
}
|
|
40
|
-
const content = await this.fs.readFile(absolutePath, "utf-8");
|
|
41
|
-
if (content === null) {
|
|
42
|
-
throw new Error(`Could not read file: ${absolutePath}`);
|
|
43
|
-
}
|
|
44
|
-
return JSON.parse(content);
|
|
45
|
-
}
|
|
46
|
-
async readBpmnFile(bpmnFilePath) {
|
|
47
|
-
const absolutePath = this.fs.path.resolve(bpmnFilePath);
|
|
48
|
-
if (!await this.fs.exists(absolutePath)) {
|
|
49
|
-
throw new Error(`File not found: ${absolutePath}`);
|
|
50
|
-
}
|
|
51
|
-
if (!absolutePath.endsWith(".bpmn")) {
|
|
52
|
-
throw new Error(`Expected a .bpmn file but got: ${this.fs.path.basename(absolutePath)}`);
|
|
53
|
-
}
|
|
54
|
-
const xml = await this.fs.readFile(absolutePath, "utf-8");
|
|
55
|
-
if (xml === null) {
|
|
56
|
-
throw new Error(`Could not read file: ${absolutePath}`);
|
|
57
|
-
}
|
|
58
|
-
return xml;
|
|
59
|
-
}
|
|
60
|
-
async generateProjectFiles(caseData, bpmnXml, casePlanJson, caseFileContent, startEventId) {
|
|
61
|
-
const caseName = caseData.name ?? caseData.root?.name ?? "case";
|
|
62
|
-
const safeName = caseName.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
63
|
-
const projectDir = this.fs.path.join(this.fs.env.tmpdir(), `.case-debug-${safeName}-${Date.now()}`);
|
|
64
|
-
await this.fs.mkdir(projectDir);
|
|
65
|
-
const entryPointId = crypto.randomUUID();
|
|
66
|
-
const name = safeName;
|
|
67
|
-
const resolvedStartEventId = startEventId ?? extractStartEventId(bpmnXml);
|
|
68
|
-
const entryPointsJson = {
|
|
69
|
-
$schema: "https://cloud.uipath.com/draft/2024-12/entry-point",
|
|
70
|
-
$id: "entry-points.json",
|
|
71
|
-
entryPoints: [
|
|
72
|
-
{
|
|
73
|
-
filePath: `/caseplan.json.bpmn#${resolvedStartEventId}`,
|
|
74
|
-
uniqueId: entryPointId,
|
|
75
|
-
type: "CaseManagement",
|
|
76
|
-
displayName: caseName
|
|
77
|
-
}
|
|
78
|
-
]
|
|
79
|
-
};
|
|
80
|
-
const bindingsJson = {
|
|
81
|
-
version: "2.0",
|
|
82
|
-
resources: caseData.bindings ?? []
|
|
83
|
-
};
|
|
84
|
-
const projectUiproj = {
|
|
85
|
-
Name: caseName,
|
|
86
|
-
ProjectType: "CaseManagement"
|
|
87
|
-
};
|
|
88
|
-
await this.fs.writeFile(this.fs.path.join(projectDir, "project.uiproj"), `${JSON.stringify(projectUiproj, null, 2)}
|
|
89
|
-
`);
|
|
90
|
-
await this.fs.writeFile(this.fs.path.join(projectDir, "entry-points.json"), `${JSON.stringify(entryPointsJson, null, 2)}
|
|
91
|
-
`);
|
|
92
|
-
await this.fs.writeFile(this.fs.path.join(projectDir, "bindings_v2.json"), `${JSON.stringify(bindingsJson, null, 2)}
|
|
93
|
-
`);
|
|
94
|
-
await this.fs.writeFile(this.fs.path.join(projectDir, "case-plan.json"), `${JSON.stringify(casePlanJson, null, 2)}
|
|
95
|
-
`);
|
|
96
|
-
await this.fs.writeFile(this.fs.path.join(projectDir, `${name}.bpmn`), bpmnXml);
|
|
97
|
-
if (caseFileContent) {
|
|
98
|
-
await this.fs.writeFile(this.fs.path.join(projectDir, "caseplan.json"), caseFileContent);
|
|
99
|
-
}
|
|
100
|
-
return projectDir;
|
|
101
|
-
}
|
|
102
|
-
async generateBpmnProjectFiles(filePath) {
|
|
103
|
-
const bpmnXml = await this.readBpmnFile(filePath);
|
|
104
|
-
const startEventId = extractStartEventId(bpmnXml);
|
|
105
|
-
const displayName = this.fs.path.basename(filePath, ".bpmn");
|
|
106
|
-
const safeName = displayName.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
107
|
-
const projectDir = this.fs.path.join(this.fs.env.tmpdir(), `.case-debug-${safeName}-${Date.now()}`);
|
|
108
|
-
await this.fs.mkdir(projectDir);
|
|
109
|
-
const entryPointsJson = {
|
|
110
|
-
$schema: "https://cloud.uipath.com/draft/2024-12/entry-point",
|
|
111
|
-
$id: "entry-points.json",
|
|
112
|
-
entryPoints: [
|
|
113
|
-
{
|
|
114
|
-
filePath: `/${safeName}.bpmn#${startEventId}`,
|
|
115
|
-
uniqueId: crypto.randomUUID(),
|
|
116
|
-
type: "CaseManagement",
|
|
117
|
-
displayName
|
|
118
|
-
}
|
|
119
|
-
]
|
|
120
|
-
};
|
|
121
|
-
const bindingsJson = { version: "2.0", resources: [] };
|
|
122
|
-
const projectUiproj = {
|
|
123
|
-
Name: displayName,
|
|
124
|
-
ProjectType: "CaseManagement"
|
|
125
|
-
};
|
|
126
|
-
await this.fs.writeFile(this.fs.path.join(projectDir, "project.uiproj"), JSON.stringify(projectUiproj, null, 2));
|
|
127
|
-
await this.fs.writeFile(this.fs.path.join(projectDir, "entry-points.json"), JSON.stringify(entryPointsJson, null, 2));
|
|
128
|
-
await this.fs.writeFile(this.fs.path.join(projectDir, "bindings_v2.json"), JSON.stringify(bindingsJson, null, 2));
|
|
129
|
-
await this.fs.writeFile(this.fs.path.join(projectDir, `${safeName}.bpmn`), bpmnXml);
|
|
130
|
-
return {
|
|
131
|
-
projectDir,
|
|
132
|
-
projectName: safeName,
|
|
133
|
-
entryPointBpmnFile: `${safeName}.bpmn`,
|
|
134
|
-
startEventId
|
|
135
|
-
};
|
|
136
|
-
}
|
|
137
|
-
async executeProjectViaStudioWeb(projectPath, config, callbacks, pollInterval) {
|
|
138
|
-
const absoluteProjectPath = this.fs.path.resolve(projectPath);
|
|
139
|
-
const projectUiprojPath = this.fs.path.join(absoluteProjectPath, "project.uiproj");
|
|
140
|
-
if (!await this.fs.exists(projectUiprojPath)) {
|
|
141
|
-
throw new Error(`Not a valid case project directory: missing project.uiproj in ${absoluteProjectPath}`);
|
|
142
|
-
}
|
|
143
|
-
const projectUiprojContent = await this.fs.readFile(projectUiprojPath, "utf-8");
|
|
144
|
-
if (projectUiprojContent === null) {
|
|
145
|
-
throw new Error(`Could not read project.uiproj in ${absoluteProjectPath}`);
|
|
146
|
-
}
|
|
147
|
-
const projectUiproj = JSON.parse(projectUiprojContent);
|
|
148
|
-
const projectName = projectUiproj.Name;
|
|
149
|
-
const entryPointsPath = this.fs.path.join(absoluteProjectPath, "entry-points.json");
|
|
150
|
-
if (!await this.fs.exists(entryPointsPath)) {
|
|
151
|
-
throw new Error(`Not a valid case project directory: missing entry-points.json in ${absoluteProjectPath}`);
|
|
152
|
-
}
|
|
153
|
-
const entryPointsContent = await this.fs.readFile(entryPointsPath, "utf-8");
|
|
154
|
-
if (entryPointsContent === null) {
|
|
155
|
-
throw new Error(`Could not read entry-points.json in ${absoluteProjectPath}`);
|
|
156
|
-
}
|
|
157
|
-
const entryPointsJson = JSON.parse(entryPointsContent);
|
|
158
|
-
const rawEntryPoint = entryPointsJson.entryPoints?.[0]?.filePath ?? "";
|
|
159
|
-
const entryPoint = rawEntryPoint.replace(/^\/content/, "");
|
|
160
|
-
logger.info("Looking for .uipx solution file...");
|
|
161
|
-
const solutionInfo = await findSolutionFile(this.fs, absoluteProjectPath);
|
|
162
|
-
const existingSolutionId = solutionInfo?.solutionId;
|
|
163
|
-
logger.info("Reading case JSON file...");
|
|
164
|
-
const caseJsonPath = this.fs.path.join(absoluteProjectPath, "caseplan.json");
|
|
165
|
-
if (!await this.fs.exists(caseJsonPath)) {
|
|
166
|
-
throw new Error(`Not a valid case project directory: missing caseplan.json in ${absoluteProjectPath}`);
|
|
167
|
-
}
|
|
168
|
-
const caseFileContent = await this.fs.readFile(caseJsonPath, "utf-8");
|
|
169
|
-
if (caseFileContent === null) {
|
|
170
|
-
throw new Error(`Could not read file: ${caseJsonPath}`);
|
|
171
|
-
}
|
|
172
|
-
logger.info("Converting case JSON to BPMN and case plan JSON...");
|
|
173
|
-
const { serializeCaseDiskJsonToBpmnAndRulesJson } = await loadCaseSchemaAsync();
|
|
174
|
-
const { bpmnXml, rulesJson: casePlanJson } = await serializeCaseDiskJsonToBpmnAndRulesJson(caseFileContent);
|
|
175
|
-
await this.fs.writeFile(this.fs.path.join(absoluteProjectPath, "caseplan.json.bpmn"), bpmnXml);
|
|
176
|
-
await this.fs.writeFile(this.fs.path.join(absoluteProjectPath, "case-plan.json"), `${JSON.stringify(casePlanJson, null, 2)}
|
|
177
|
-
`);
|
|
178
|
-
logger.info("Building solution package from project...");
|
|
179
|
-
const solutionDir = this.fs.path.resolve(absoluteProjectPath, "..");
|
|
180
|
-
const uisPath = await buildSolutionPackageFromDir(this.fs, solutionDir);
|
|
181
|
-
const apiConfig = {
|
|
182
|
-
baseUrl: config.baseUrl,
|
|
183
|
-
organizationId: config.organizationId,
|
|
184
|
-
tenantName: config.tenantName,
|
|
185
|
-
tenantId: config.tenantId,
|
|
186
|
-
authToken: config.authToken,
|
|
187
|
-
organizationUnitId: config.organizationUnitId
|
|
188
|
-
};
|
|
189
|
-
return uploadAndDebugSolution({
|
|
190
|
-
upload: () => uploadOrOverwriteSolution(apiConfig, config.organizationName, uisPath, existingSolutionId, this.fs),
|
|
191
|
-
onSolutionId: (id) => updateSolutionFile(this.fs, absoluteProjectPath, id),
|
|
192
|
-
projectName,
|
|
193
|
-
entryPoint,
|
|
194
|
-
projectType: "CaseManagement",
|
|
195
|
-
apiConfig,
|
|
196
|
-
organizationName: config.organizationName,
|
|
197
|
-
callbacks,
|
|
198
|
-
pollInterval
|
|
199
|
-
});
|
|
200
|
-
}
|
|
201
|
-
async buildSolutionPackage(projectDir, projectName) {
|
|
202
|
-
const solutionId = crypto.randomUUID();
|
|
203
|
-
const projectId = crypto.randomUUID();
|
|
204
|
-
const stagingDir = this.fs.path.join(this.fs.env.tmpdir(), `.case-debug-solution-${Date.now()}`);
|
|
205
|
-
await this.fs.mkdir(stagingDir);
|
|
206
|
-
const solutionStorage = {
|
|
207
|
-
SolutionId: solutionId,
|
|
208
|
-
Projects: [
|
|
209
|
-
{
|
|
210
|
-
ProjectId: projectId,
|
|
211
|
-
ProjectRelativePath: `${projectName}/project.uiproj`
|
|
212
|
-
}
|
|
213
|
-
]
|
|
214
|
-
};
|
|
215
|
-
await this.fs.writeFile(this.fs.path.join(stagingDir, "SolutionStorage.json"), JSON.stringify(solutionStorage));
|
|
216
|
-
const uipx = {
|
|
217
|
-
SolutionId: solutionId,
|
|
218
|
-
Projects: [
|
|
219
|
-
{
|
|
220
|
-
Type: "CaseManagement",
|
|
221
|
-
ProjectRelativePath: `${projectName}/project.uiproj`,
|
|
222
|
-
Id: projectId
|
|
223
|
-
}
|
|
224
|
-
]
|
|
225
|
-
};
|
|
226
|
-
await this.fs.writeFile(this.fs.path.join(stagingDir, `${projectName}Solution.uipx`), JSON.stringify(uipx, null, 2));
|
|
227
|
-
const destProjectDir = this.fs.path.join(stagingDir, projectName);
|
|
228
|
-
await this.fs.mkdir(destProjectDir);
|
|
229
|
-
await this.flattenCopyToDir(projectDir, destProjectDir);
|
|
230
|
-
const uisPath = this.fs.path.join(this.fs.env.tmpdir(), `${projectName}Solution-${Date.now()}.uis`);
|
|
231
|
-
const zipData = await createZipFromDir(this.fs, stagingDir);
|
|
232
|
-
await this.fs.writeFile(uisPath, zipData);
|
|
233
|
-
await this.fs.rm(stagingDir).catch(() => {});
|
|
234
|
-
return uisPath;
|
|
235
|
-
}
|
|
236
|
-
async executeViaStudioWeb(filePath, config, callbacks, pollInterval) {
|
|
237
|
-
const dotIndex = filePath.lastIndexOf(".");
|
|
238
|
-
const ext = dotIndex >= 0 ? filePath.slice(dotIndex).toLowerCase() : "";
|
|
239
|
-
if (ext !== ".json" && ext !== ".bpmn") {
|
|
240
|
-
throw new Error(`Unsupported file type "${ext}". Only .json and .bpmn files are supported.`);
|
|
241
|
-
}
|
|
242
|
-
let projectDir;
|
|
243
|
-
let projectName;
|
|
244
|
-
let entryPointBpmnFile;
|
|
245
|
-
let startEventId;
|
|
246
|
-
if (ext === ".json") {
|
|
247
|
-
logger.info("Reading case JSON file...");
|
|
248
|
-
const absolutePath = this.fs.path.resolve(filePath);
|
|
249
|
-
if (!await this.fs.exists(absolutePath)) {
|
|
250
|
-
throw new Error(`File not found: ${absolutePath}`);
|
|
251
|
-
}
|
|
252
|
-
const rawContent = await this.fs.readFile(absolutePath, "utf-8");
|
|
253
|
-
if (rawContent === null) {
|
|
254
|
-
throw new Error(`Could not read file: ${absolutePath}`);
|
|
255
|
-
}
|
|
256
|
-
const caseData = JSON.parse(rawContent);
|
|
257
|
-
logger.info("Converting case JSON to BPMN and case plan JSON...");
|
|
258
|
-
const { serializeCaseDiskJsonToBpmnAndRulesJson } = await loadCaseSchemaAsync();
|
|
259
|
-
const { bpmnXml, rulesJson: casePlanJson } = await serializeCaseDiskJsonToBpmnAndRulesJson(rawContent);
|
|
260
|
-
startEventId = extractStartEventId(bpmnXml);
|
|
261
|
-
logger.info("Generating project files...");
|
|
262
|
-
projectDir = await this.generateProjectFiles(caseData, bpmnXml, casePlanJson, rawContent, startEventId);
|
|
263
|
-
const caseName = caseData.name ?? caseData.root?.name ?? "case";
|
|
264
|
-
projectName = caseName.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
265
|
-
entryPointBpmnFile = `${projectName}.bpmn`;
|
|
266
|
-
} else {
|
|
267
|
-
({ projectDir, projectName, entryPointBpmnFile, startEventId } = await this.generateBpmnProjectFiles(filePath));
|
|
268
|
-
}
|
|
269
|
-
logger.info("Building solution package...");
|
|
270
|
-
const uisPath = await this.buildSolutionPackage(projectDir, projectName);
|
|
271
|
-
const cleanupPaths = [projectDir, uisPath];
|
|
272
|
-
try {
|
|
273
|
-
const apiConfig = {
|
|
274
|
-
baseUrl: config.baseUrl,
|
|
275
|
-
organizationId: config.organizationId,
|
|
276
|
-
tenantName: config.tenantName,
|
|
277
|
-
tenantId: config.tenantId,
|
|
278
|
-
authToken: config.authToken,
|
|
279
|
-
organizationUnitId: config.organizationUnitId
|
|
280
|
-
};
|
|
281
|
-
const entryPoint = `/${entryPointBpmnFile}#${startEventId}`;
|
|
282
|
-
return await uploadAndDebugSolution({
|
|
283
|
-
upload: () => uploadOrOverwriteSolution(apiConfig, config.organizationName, uisPath, undefined, this.fs),
|
|
284
|
-
projectName,
|
|
285
|
-
entryPoint,
|
|
286
|
-
projectType: "CaseManagement",
|
|
287
|
-
apiConfig,
|
|
288
|
-
organizationName: config.organizationName,
|
|
289
|
-
callbacks,
|
|
290
|
-
pollInterval
|
|
291
|
-
});
|
|
292
|
-
} finally {
|
|
293
|
-
for (const p of cleanupPaths) {
|
|
294
|
-
this.fs.rm(p).catch(() => {});
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
async copyDirRecursive(src, dest) {
|
|
299
|
-
await this.fs.mkdir(dest);
|
|
300
|
-
const entries = await this.fs.readdir(src);
|
|
301
|
-
for (const entry of entries) {
|
|
302
|
-
const srcPath = this.fs.path.join(src, entry);
|
|
303
|
-
const destPath = this.fs.path.join(dest, entry);
|
|
304
|
-
const stats = await this.fs.stat(srcPath);
|
|
305
|
-
if (stats?.isDirectory()) {
|
|
306
|
-
await this.copyDirRecursive(srcPath, destPath);
|
|
307
|
-
} else {
|
|
308
|
-
const content = await this.fs.readFile(srcPath);
|
|
309
|
-
if (content !== null) {
|
|
310
|
-
await this.fs.writeFile(destPath, content);
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
async flattenCopyToDir(src, dest) {
|
|
316
|
-
const entries = await this.fs.readdir(src);
|
|
317
|
-
for (const entry of entries) {
|
|
318
|
-
const srcPath = this.fs.path.join(src, entry);
|
|
319
|
-
const stats = await this.fs.stat(srcPath);
|
|
320
|
-
if (stats?.isDirectory()) {
|
|
321
|
-
await this.copyDirRecursive(srcPath, this.fs.path.join(dest, entry));
|
|
322
|
-
} else {
|
|
323
|
-
const content = await this.fs.readFile(srcPath);
|
|
324
|
-
if (content !== null) {
|
|
325
|
-
await this.fs.writeFile(this.fs.path.join(dest, entry), content);
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
export {
|
|
332
|
-
CaseDebugStudioWebService
|
|
333
|
-
};
|
|
334
|
-
|
|
335
|
-
//# debugId=5431DE1BB4EFCF8F64756E2164756E21
|