@uipath/case-tool 1.202.1 → 1.203.0-preview.180
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 +75 -251
- package/dist/{authoring-vpa82rhb.js → authoring-kngaggwm.js} +42 -4
- package/dist/{case-api-63ncrr7n.js → case-api-v6cjyrfw.js} +8 -8
- package/dist/case-bindings-service-1wxfghzd.js +240 -0
- package/dist/case-debug-studio-web-service-tpfm4r66.js +133 -0
- package/dist/case-format-service-q345a2fd.js +84 -0
- package/dist/{case-pack-service-72ymxkvq.js → case-pack-service-29rza2q2.js} +61 -11
- package/dist/{case-validate-service-4fzrq8ee.js → case-validate-service-cqw3tz9y.js} +1422 -40
- package/dist/{connector-enrichment-service-wqdd0561.js → connector-enrichment-service-qa26zsjg.js} +20 -20
- package/dist/{connector-lookup-service-cwm3bk3a.js → connector-lookup-service-8v4qawd5.js} +7 -7
- package/dist/{connector-task-spec-pn5vqw89.js → connector-task-spec-q9v9vjd2.js} +24 -24
- package/dist/{de-MUJPA4EB-209jpeqe.js → de-MUJPA4EB-dpg7t2rw.js} +3 -3
- package/dist/{debug-service-rgh5q6v7.js → debug-service-8x087xxt.js} +2 -2
- package/dist/{index-71zc7k6y.js → embedded-file-reader-0sjt4nkj.js} +96 -16641
- package/dist/{en-TBNO2WUV-rfe87pgh.js → en-BWGKA5OE-1qkvb9rn.js} +2 -2
- package/dist/{en-GN2ZGWUE-03z2df4k.js → en-FBPVNKFN-dqt573xn.js} +5 -3
- package/dist/{enrichment-service-6qd2ekgp.js → enrichment-service-7vbxcwge.js} +7 -7
- package/dist/{es-7SE7HX2X-qda7whn6.js → es-7SE7HX2X-8yh1aj2y.js} +3 -3
- package/dist/{es-MX-2MYFZU7X-6v0q5rbn.js → es-MX-2MYFZU7X-3rek4r73.js} +3 -3
- package/dist/first-party-service-srxaftkn.js +27 -0
- package/dist/{fr-MDFKNZ4C-qmypp92m.js → fr-MDFKNZ4C-h4a122k9.js} +3 -3
- package/dist/{index-j63n7z6x.js → index-38apv2p1.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-8kdvqfaf.js → input-reader-pnh948bq.js} +1 -1
- package/dist/{ja-UTQEAP34-hvyf683h.js → ja-UTQEAP34-8e0q6swp.js} +3 -3
- package/dist/{known-types-dec5kvwh.js → known-types-mn8xn36b.js} +4 -4
- package/dist/{ko-AXCHW2OK-pkwdcbmx.js → ko-AXCHW2OK-askct7f6.js} +3 -3
- package/dist/{node-strategy-0267x5e5.js → node-strategy-gc4sg6a2.js} +4 -4
- package/dist/{node-sync-service-nyzvsxte.js → node-sync-service-y471a8jm.js} +11 -11
- package/dist/{packager-tool-2rqwt6k1.js → packager-tool-052kvydg.js} +1 -1
- package/dist/packager-tool-53w8skv5.js +262 -0
- package/dist/{packager-tool-gqa97ecv.js → packager-tool-61hxhgeg.js} +1 -1
- package/dist/{packager-tool-11x9d29d.js → packager-tool-6vm5fd0w.js} +6 -6
- package/dist/{packager-tool-r87gxwqa.js → packager-tool-7q6z6npd.js} +12 -12
- package/dist/packager-tool-83qnybab.js +1564 -0
- package/dist/{packager-tool-ph7m6q8q.js → packager-tool-8q7vzh65.js} +5 -4
- package/dist/{packager-tool-g27rwyhq.js → packager-tool-adcaxdhs.js} +15 -5
- package/dist/{packager-tool-6q9vpaye.js → packager-tool-cg2j4rma.js} +8 -8
- package/dist/{packager-tool-e65xt669.js → packager-tool-cr03q3q4.js} +213 -51
- package/dist/packager-tool-d4sjk46c.js +88 -0
- package/dist/{packager-tool-4mna26cc.js → packager-tool-d88rqwk8.js} +5 -3
- package/dist/packager-tool-dd8bq6az.js +8462 -0
- package/dist/packager-tool-gdtpsdn7.js +342 -0
- package/dist/{packager-tool-k4edys72.js → packager-tool-hrdan5ms.js} +1 -1
- package/dist/{packager-tool-73266j0h.js → packager-tool-hz1mz8fs.js} +1 -1
- package/dist/{packager-tool-c23zrhj8.js → packager-tool-jysvpt8p.js} +2 -2
- package/dist/{packager-tool-m9yxkjc5.js → packager-tool-kkxhc0fp.js} +2905 -817
- package/dist/{packager-tool-8m22sr4j.js → packager-tool-kpcjnxd1.js} +269 -23
- package/dist/{packager-tool-s44cpykq.js → packager-tool-n6vfz7c3.js} +22 -16
- package/dist/{packager-tool-axgsbgv9.js → packager-tool-sqd89cn1.js} +10 -13
- package/dist/{packager-tool-fh1f8bv4.js → packager-tool-tatg1kz2.js} +10 -9
- package/dist/{packager-tool-51a9f6yz.js → packager-tool-wefb1zw3.js} +1 -1
- package/dist/{packager-tool-3fm9yhgv.js → packager-tool-x2hktw5m.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-a69j3g1q.js → project-artifacts-8snev67g.js} +1 -1
- package/dist/{pt-3DIO5QWG-hb763vct.js → pt-3DIO5QWG-59b3f4bc.js} +3 -3
- package/dist/{pt-BR-Y6K6XHXK-37a932vp.js → pt-BR-Y6K6XHXK-mp3hwhw1.js} +3 -3
- package/dist/{resourcesSyncService-gnmpre85.js → resourcesSyncService-8t5qdtvt.js} +20 -20
- package/dist/{ro-BWR3ONRR-jmap5ajd.js → ro-BWR3ONRR-vzx3hy8a.js} +3 -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-5IIHSFW5-stsb3dar.js → tr-5IIHSFW5-hw4cewew.js} +3 -3
- package/dist/{trigger-enrichment-service-52h9fjqd.js → trigger-enrichment-service-n622a230.js} +24 -24
- package/dist/{zh-CN-R2KU4U5L-q4yhc33t.js → zh-CN-R2KU4U5L-tc1hat59.js} +3 -3
- package/dist/{zh-TW-GNKMELBF-r4ay2475.js → zh-TW-GNKMELBF-j674515r.js} +3 -3
- package/package.json +3 -2
- package/dist/case-debug-studio-web-service-45rb4ej9.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,240 @@
|
|
|
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/bindings-v2.ts
|
|
10
|
+
var BINDINGS_V2_FILE_NAME = "bindings_v2.json";
|
|
11
|
+
var BINDINGS_V2_VERSION = "2.0";
|
|
12
|
+
var CONNECTION_ID_PROPERTY = "ConnectionId";
|
|
13
|
+
var FOLDER_KEY_PROPERTY = "folderKey";
|
|
14
|
+
var byCodeUnit = (left, right) => {
|
|
15
|
+
if (left < right)
|
|
16
|
+
return -1;
|
|
17
|
+
return left > right ? 1 : 0;
|
|
18
|
+
};
|
|
19
|
+
var sortBindingsV2Resources = (resources) => [...resources].sort((a, b) => byCodeUnit(a.resource, b.resource) || byCodeUnit(a.key, b.key));
|
|
20
|
+
var serializeBindingsV2File = (resources) => {
|
|
21
|
+
const file = {
|
|
22
|
+
version: BINDINGS_V2_VERSION,
|
|
23
|
+
resources: sortBindingsV2Resources(resources)
|
|
24
|
+
};
|
|
25
|
+
return `${JSON.stringify(file, null, 2)}
|
|
26
|
+
`;
|
|
27
|
+
};
|
|
28
|
+
var readBindingsV2Resources = (raw) => {
|
|
29
|
+
const [error, parsed] = catchError(() => JSON.parse(raw));
|
|
30
|
+
if (error)
|
|
31
|
+
return;
|
|
32
|
+
if (parsed === null || typeof parsed !== "object")
|
|
33
|
+
return;
|
|
34
|
+
const resources = parsed.resources;
|
|
35
|
+
if (!Array.isArray(resources))
|
|
36
|
+
return;
|
|
37
|
+
return resources.filter((entry) => entry !== null && typeof entry === "object" && typeof entry.key === "string");
|
|
38
|
+
};
|
|
39
|
+
var identity = (entry) => `${entry.resource}:${entry.key}`;
|
|
40
|
+
var diffBindingsV2 = (expected, actual) => {
|
|
41
|
+
const expectedByKey = new Map(expected.map((e) => [identity(e), e]));
|
|
42
|
+
const actualByKey = new Map(actual.map((e) => [identity(e), e]));
|
|
43
|
+
const missing = [];
|
|
44
|
+
const changed = [];
|
|
45
|
+
for (const [key, entry] of expectedByKey) {
|
|
46
|
+
const found = actualByKey.get(key);
|
|
47
|
+
if (found === undefined) {
|
|
48
|
+
missing.push(entry.key);
|
|
49
|
+
} else if (JSON.stringify(found) !== JSON.stringify(entry)) {
|
|
50
|
+
changed.push(entry.key);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
const extra = [...actualByKey.values()].filter((entry) => !expectedByKey.has(identity(entry))).map((entry) => entry.key);
|
|
54
|
+
const alphabetically = (left, right) => left.localeCompare(right);
|
|
55
|
+
return {
|
|
56
|
+
missing: missing.sort(alphabetically),
|
|
57
|
+
extra: extra.sort(alphabetically),
|
|
58
|
+
changed: changed.sort(alphabetically)
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
var hasBindingsV2Difference = (difference) => difference.missing.length > 0 || difference.extra.length > 0 || difference.changed.length > 0;
|
|
62
|
+
|
|
63
|
+
// src/services/case-bindings-service.ts
|
|
64
|
+
var asBinding = (value) => {
|
|
65
|
+
if (value === null || typeof value !== "object" || Array.isArray(value)) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
const record = value;
|
|
69
|
+
return typeof record.id === "string" && typeof record.resource === "string" && typeof record.resourceKey === "string" && record.resourceKey !== "" && typeof record.propertyAttribute === "string" && (record.default === undefined || typeof record.default === "string") ? value : undefined;
|
|
70
|
+
};
|
|
71
|
+
var CONNECTION_RESOURCE = "Connection";
|
|
72
|
+
var NAME_ATTRIBUTE = "name";
|
|
73
|
+
var FOLDER_PATH_ATTRIBUTE = "folderPath";
|
|
74
|
+
var SOLUTION_FOLDER_PREFIX = "solution_folder.";
|
|
75
|
+
var SOLUTION_FOLDER_SENTINEL = "solution_folder";
|
|
76
|
+
var BINDING_REFERENCE_PREFIX = "=bindings.";
|
|
77
|
+
var CONNECTOR_KEY_ENTRY = "connectorKey";
|
|
78
|
+
var CONNECTION_ENTRY = "connection";
|
|
79
|
+
var readConnectorContext = (value) => {
|
|
80
|
+
if (!Array.isArray(value))
|
|
81
|
+
return;
|
|
82
|
+
const byName = new Map;
|
|
83
|
+
for (const entry of value) {
|
|
84
|
+
if (entry === null || typeof entry !== "object" || Array.isArray(entry))
|
|
85
|
+
return;
|
|
86
|
+
const { name, value: entryValue } = entry;
|
|
87
|
+
if (typeof name !== "string")
|
|
88
|
+
return;
|
|
89
|
+
if (typeof entryValue === "string")
|
|
90
|
+
byName.set(name, entryValue);
|
|
91
|
+
}
|
|
92
|
+
return byName.has(CONNECTOR_KEY_ENTRY) ? byName : undefined;
|
|
93
|
+
};
|
|
94
|
+
var collectConnectorKeys = (document) => {
|
|
95
|
+
const byBindingId = new Map;
|
|
96
|
+
const visit = (node) => {
|
|
97
|
+
if (Array.isArray(node)) {
|
|
98
|
+
const context = readConnectorContext(node);
|
|
99
|
+
const connection = context?.get(CONNECTION_ENTRY);
|
|
100
|
+
const connectorKey = context?.get(CONNECTOR_KEY_ENTRY);
|
|
101
|
+
if (connectorKey !== undefined && connection?.startsWith(BINDING_REFERENCE_PREFIX) === true) {
|
|
102
|
+
byBindingId.set(connection.slice(BINDING_REFERENCE_PREFIX.length), connectorKey);
|
|
103
|
+
}
|
|
104
|
+
for (const item of node)
|
|
105
|
+
visit(item);
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
if (node === null || typeof node !== "object")
|
|
109
|
+
return;
|
|
110
|
+
for (const value of Object.values(node))
|
|
111
|
+
visit(value);
|
|
112
|
+
};
|
|
113
|
+
visit(document);
|
|
114
|
+
return byBindingId;
|
|
115
|
+
};
|
|
116
|
+
var attributeDefault = (group, attribute) => group.find((binding) => binding.propertyAttribute === attribute)?.default;
|
|
117
|
+
var connectionEntry = (group, connectorKeys) => {
|
|
118
|
+
const key = group[0].resourceKey;
|
|
119
|
+
const value = {
|
|
120
|
+
[CONNECTION_ID_PROPERTY]: {
|
|
121
|
+
defaultValue: attributeDefault(group, CONNECTION_ID_PROPERTY) ?? key
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
const folderKey = attributeDefault(group, FOLDER_KEY_PROPERTY);
|
|
125
|
+
if (folderKey !== undefined) {
|
|
126
|
+
value[FOLDER_KEY_PROPERTY] = { defaultValue: folderKey };
|
|
127
|
+
}
|
|
128
|
+
const connector = group.map((binding) => connectorKeys.get(binding.id)).find((found) => found !== undefined);
|
|
129
|
+
return {
|
|
130
|
+
resource: CONNECTION_RESOURCE,
|
|
131
|
+
key,
|
|
132
|
+
value,
|
|
133
|
+
...connector !== undefined && { metadata: { connector } }
|
|
134
|
+
};
|
|
135
|
+
};
|
|
136
|
+
var resourceEntry = (group) => {
|
|
137
|
+
const key = group[0].resourceKey;
|
|
138
|
+
const value = {};
|
|
139
|
+
const name = attributeDefault(group, NAME_ATTRIBUTE);
|
|
140
|
+
if (name !== undefined)
|
|
141
|
+
value.name = { defaultValue: name };
|
|
142
|
+
const folderPath = key.startsWith(SOLUTION_FOLDER_PREFIX) ? SOLUTION_FOLDER_SENTINEL : attributeDefault(group, FOLDER_PATH_ATTRIBUTE);
|
|
143
|
+
if (folderPath !== undefined) {
|
|
144
|
+
value.folderPath = { defaultValue: folderPath };
|
|
145
|
+
}
|
|
146
|
+
const subType = group.find((binding) => binding.resourceSubType !== undefined)?.resourceSubType;
|
|
147
|
+
return {
|
|
148
|
+
resource: group[0].resource,
|
|
149
|
+
key,
|
|
150
|
+
value,
|
|
151
|
+
...subType !== undefined && { metadata: { subType } }
|
|
152
|
+
};
|
|
153
|
+
};
|
|
154
|
+
var deriveCaseBindingsV2 = (document) => {
|
|
155
|
+
const connectorKeys = collectConnectorKeys(document);
|
|
156
|
+
const groups = new Map;
|
|
157
|
+
for (const entry of Array.isArray(document.bindings) ? document.bindings : []) {
|
|
158
|
+
const binding = asBinding(entry);
|
|
159
|
+
if (binding === undefined)
|
|
160
|
+
continue;
|
|
161
|
+
const groupKey = `${binding.resource}:${binding.resourceKey}`;
|
|
162
|
+
const group = groups.get(groupKey);
|
|
163
|
+
if (group === undefined)
|
|
164
|
+
groups.set(groupKey, [binding]);
|
|
165
|
+
else
|
|
166
|
+
group.push(binding);
|
|
167
|
+
}
|
|
168
|
+
return [...groups.values()].map((group) => group[0].resource === CONNECTION_RESOURCE ? connectionEntry(group, connectorKeys) : resourceEntry(group));
|
|
169
|
+
};
|
|
170
|
+
var bindingsV2PathFor = (casePlanPath) => {
|
|
171
|
+
const fs = getFileSystem();
|
|
172
|
+
return fs.path.join(fs.path.dirname(fs.path.resolve(casePlanPath)), BINDINGS_V2_FILE_NAME);
|
|
173
|
+
};
|
|
174
|
+
var compareCaseBindingsV2 = async (casePlanPath, document) => {
|
|
175
|
+
const fs = getFileSystem();
|
|
176
|
+
const path = bindingsV2PathFor(casePlanPath);
|
|
177
|
+
const expected = deriveCaseBindingsV2(document);
|
|
178
|
+
const expectedCount = expected.length;
|
|
179
|
+
if (!await fs.exists(path))
|
|
180
|
+
return { status: "absent", path, expectedCount };
|
|
181
|
+
const [readError, raw] = await catchError(fs.readFile(path, "utf-8"));
|
|
182
|
+
if (readError || raw == null)
|
|
183
|
+
return { status: "unreadable", path, expectedCount };
|
|
184
|
+
const actual = readBindingsV2Resources(raw);
|
|
185
|
+
if (actual === undefined)
|
|
186
|
+
return { status: "unreadable", path, expectedCount };
|
|
187
|
+
const difference = diffBindingsV2(expected, actual);
|
|
188
|
+
return hasBindingsV2Difference(difference) ? { status: "differs", path, expectedCount, difference } : { status: "match", path, expectedCount };
|
|
189
|
+
};
|
|
190
|
+
var syncCaseBindings = async (casePlanPath) => {
|
|
191
|
+
const fs = getFileSystem();
|
|
192
|
+
const resolved = fs.path.resolve(casePlanPath);
|
|
193
|
+
if (!await fs.exists(resolved)) {
|
|
194
|
+
return {
|
|
195
|
+
ok: false,
|
|
196
|
+
message: `Case plan file not found: ${resolved}`,
|
|
197
|
+
instructions: "Pass the path to an existing caseplan JSON file, for example 'uip maestro case bindings sync case.json'."
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
const [readError, raw] = await catchError(fs.readFile(resolved, "utf-8"));
|
|
201
|
+
if (readError || raw == null) {
|
|
202
|
+
return {
|
|
203
|
+
ok: false,
|
|
204
|
+
message: `Failed to read case plan: ${readError?.message ?? "empty content"}`,
|
|
205
|
+
instructions: `Verify read permissions on ${resolved}.`
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
const [parseError, document] = catchError(() => JSON.parse(raw));
|
|
209
|
+
if (parseError || document == null || typeof document !== "object" || Array.isArray(document)) {
|
|
210
|
+
return {
|
|
211
|
+
ok: false,
|
|
212
|
+
message: `Case plan is not valid JSON: ${parseError?.message ?? "not a JSON object"}`,
|
|
213
|
+
instructions: `Verify the contents of ${resolved}.`
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
const resources = deriveCaseBindingsV2(document);
|
|
217
|
+
const path = bindingsV2PathFor(resolved);
|
|
218
|
+
const [writeError] = await catchError(fs.writeFile(path, serializeBindingsV2File(resources)));
|
|
219
|
+
if (writeError) {
|
|
220
|
+
return {
|
|
221
|
+
ok: false,
|
|
222
|
+
message: `Failed to write bindings file: ${writeError.message}`,
|
|
223
|
+
instructions: `Verify write permissions on ${fs.path.dirname(path)}.`
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
return {
|
|
227
|
+
ok: true,
|
|
228
|
+
path,
|
|
229
|
+
resourceCount: resources.length,
|
|
230
|
+
connectionCount: resources.filter((entry) => entry.resource === CONNECTION_RESOURCE).length
|
|
231
|
+
};
|
|
232
|
+
};
|
|
233
|
+
export {
|
|
234
|
+
bindingsV2PathFor,
|
|
235
|
+
compareCaseBindingsV2,
|
|
236
|
+
deriveCaseBindingsV2,
|
|
237
|
+
syncCaseBindings
|
|
238
|
+
};
|
|
239
|
+
|
|
240
|
+
//# debugId=45E172EC16BB003D64756E2164756E21
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import {
|
|
2
|
+
loadCaseSchemaAsync
|
|
3
|
+
} from "./packager-tool-p7jgrm5r.js";
|
|
4
|
+
import {
|
|
5
|
+
buildSolutionPackageFromDir,
|
|
6
|
+
uploadOrOverwriteSolution
|
|
7
|
+
} from "./packager-tool-sqd89cn1.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
|