@uipath/case-tool 1.203.0-preview.205 → 1.204.0-preview.206

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.
Files changed (85) hide show
  1. package/README.md +6 -1
  2. package/dist/THIRD-PARTY-NOTICES.md +48 -9
  3. package/dist/authoring-0hr88kff.js +623 -0
  4. package/dist/{case-api-v6cjyrfw.js → case-api-gdaj9469.js} +5 -5
  5. package/dist/case-bindings-service-c2mze9vj.js +476 -0
  6. package/dist/{case-debug-studio-web-service-shg84pn8.js → case-debug-studio-web-service-cc0vj7md.js} +11 -10
  7. package/dist/case-described-io-service-cpe5h2ks.js +132 -0
  8. package/dist/{case-format-service-q345a2fd.js → case-format-service-qwyjyt0y.js} +2 -2
  9. package/dist/{case-pack-service-29rza2q2.js → case-pack-service-47yrvmg0.js} +11 -11
  10. package/dist/case-shape-reader-mw58avr0.js +13 -0
  11. package/dist/case-splice-service-9zvw19ca.js +312 -0
  12. package/dist/{case-validate-service-2n2bqc1g.js → case-validate-service-vrvx19c1.js} +415 -1449
  13. package/dist/{connector-enrichment-service-h662r92z.js → connector-enrichment-service-rg87npf0.js} +20 -18
  14. package/dist/{connector-lookup-service-y7x6xsc6.js → connector-lookup-service-c49pvfwb.js} +7 -7
  15. package/dist/{connector-task-spec-qm6q8qma.js → connector-task-spec-t3tjeeqt.js} +86 -26
  16. package/dist/{debug-service-8x087xxt.js → debug-service-vf5mw0nr.js} +3 -3
  17. package/dist/{embedded-file-reader-0sjt4nkj.js → embedded-file-reader-v8c2yj2a.js} +2 -2
  18. package/dist/{enrichment-service-7vbxcwge.js → enrichment-service-78b0gqck.js} +8 -7
  19. package/dist/index-hhsf00x8.js +15 -0
  20. package/dist/{index-fz4ttsde.js → index-j2r3jb6c.js} +5 -3
  21. package/dist/{index-jxj2jz45.js → index-rgw7caht.js} +416 -87
  22. package/dist/{index-k4xz16db.js → index-wmffgzmr.js} +12522 -7316
  23. package/dist/{index-va9sm89y.js → index-ynnr55wk.js} +59 -27
  24. package/dist/index.js +15 -11
  25. package/dist/{input-reader-pnh948bq.js → input-reader-bb0ptk2v.js} +2 -2
  26. package/dist/migration-diagnosis-ag2sgd1e.js +71 -0
  27. package/dist/{node-strategy-gc4sg6a2.js → node-strategy-5pz40tee.js} +1 -1
  28. package/dist/{node-sync-service-mehbp4qq.js → node-sync-service-xw3tpfj5.js} +6 -6
  29. package/dist/out-target-1f4n9vqb.js +70 -0
  30. package/dist/{packager-tool-wefb1zw3.js → packager-tool-0p3td5zv.js} +8 -7
  31. package/dist/packager-tool-21qfsbxn.js +17 -0
  32. package/dist/{strict-sdd-audit-8e2fh9jg.js → packager-tool-4e56rmwe.js} +2771 -1746
  33. package/dist/{packager-tool-sfkyb4kz.js → packager-tool-4rqd21wc.js} +194 -2
  34. package/dist/packager-tool-57pzrd0g.js +32 -0
  35. package/dist/{packager-tool-kpcjnxd1.js → packager-tool-58kx79ta.js} +586 -113
  36. package/dist/{packager-tool-hrdan5ms.js → packager-tool-5qghkdd0.js} +2 -2
  37. package/dist/packager-tool-5qp9xza1.js +10 -0
  38. package/dist/packager-tool-8a9yqfq7.js +76 -0
  39. package/dist/{packager-tool-40vq60aa.js → packager-tool-8mpxsyje.js} +4 -4
  40. package/dist/{packager-tool-e3k5gzd3.js → packager-tool-a6wztj6y.js} +669 -100
  41. package/dist/{packager-tool-p0zh9hw6.js → packager-tool-ayevyw80.js} +5 -5
  42. package/dist/packager-tool-b250k6w4.js +75 -0
  43. package/dist/packager-tool-bfgdz1zh.js +73 -0
  44. package/dist/{packager-tool-p7jgrm5r.js → packager-tool-cmwets3m.js} +1 -1
  45. package/dist/{packager-tool-d4sjk46c.js → packager-tool-cv05dwac.js} +18 -21
  46. package/dist/packager-tool-d7jjng8a.js +21 -0
  47. package/dist/packager-tool-dthjwajc.js +13 -0
  48. package/dist/{packager-tool-zcsm7dsj.js → packager-tool-e760vtgg.js} +4 -4
  49. package/dist/packager-tool-f78ntj5g.js +228 -0
  50. package/dist/{packager-tool-2xfyykm0.js → packager-tool-ggbvxvey.js} +320 -200
  51. package/dist/{packager-tool-6karkrc8.js → packager-tool-jx0yq0b5.js} +6 -6
  52. package/dist/{packager-tool-cg2j4rma.js → packager-tool-kacqd7h7.js} +4 -4
  53. package/dist/packager-tool-mknccck5.js +24 -0
  54. package/dist/{packager-tool-sv0d6wb6.js → packager-tool-nj4seavy.js} +7 -3
  55. package/dist/{packager-tool-adcaxdhs.js → packager-tool-paepfv5d.js} +1 -1
  56. package/dist/{packager-tool-052kvydg.js → packager-tool-pm646ag4.js} +1 -1
  57. package/dist/{packager-tool-dd8bq6az.js → packager-tool-rgpdaxbx.js} +548 -108
  58. package/dist/{packager-tool-8q7vzh65.js → packager-tool-s3e2kepj.js} +455 -13
  59. package/dist/{packager-tool-r84ng21s.js → packager-tool-sag9gz55.js} +3 -1
  60. package/dist/{packager-tool-0mj06yen.js → packager-tool-sq931c23.js} +5 -22
  61. package/dist/{packager-tool-yrsrzz1a.js → packager-tool-v99ygh9f.js} +23 -8
  62. package/dist/packager-tool-wj9d9mqe.js +267 -0
  63. package/dist/{packager-tool-hz1mz8fs.js → packager-tool-wjaya2k2.js} +2 -2
  64. package/dist/packager-tool-xcd87qyx.js +44 -0
  65. package/dist/{packager-tool-0v3s8r01.js → packager-tool-xdxr3ync.js} +4 -2
  66. package/dist/{packager-tool-61hxhgeg.js → packager-tool-xkgq5fkf.js} +3 -3
  67. package/dist/packager-tool.js +6 -6
  68. package/dist/{project-artifacts-8snev67g.js → project-artifacts-wzrhketn.js} +1 -1
  69. package/dist/resolved-check-p99hysaw.js +50 -0
  70. package/dist/{resourcesSyncService-pmfwz9cd.js → resourcesSyncService-1ezvhcbc.js} +25 -18
  71. package/dist/rule-group-members-zje7n3kf.js +76 -0
  72. package/dist/sdd-convert-service-gp9733qv.js +1962 -0
  73. package/dist/{sdd-lookup-x08j9g9m.js → sdd-lookup-vpjej1kt.js} +2 -2
  74. package/dist/sdd-resolve-service-4hx64x3z.js +288 -0
  75. package/dist/strict-case-rules-ksy8q7pg.js +731 -0
  76. package/dist/strict-entry-points-v14d7y50.js +124 -0
  77. package/dist/strict-sdd-audit-k6hh0mbr.js +23 -0
  78. package/dist/task-selector-8bjn35dv.js +57 -0
  79. package/dist/tool.js +15 -11
  80. package/dist/{trigger-enrichment-service-xexg7qbk.js → trigger-enrichment-service-pjw5ysny.js} +41 -23
  81. package/package.json +2 -2
  82. package/dist/authoring-kngaggwm.js +0 -360
  83. package/dist/case-bindings-service-1wxfghzd.js +0 -240
  84. package/dist/packager-tool-83qnybab.js +0 -1564
  85. package/dist/strict-case-rules-x6t0vb40.js +0 -409
@@ -0,0 +1,476 @@
1
+ import {
2
+ byCodeUnit
3
+ } from "./packager-tool-5qp9xza1.js";
4
+ import {
5
+ catchError
6
+ } from "./packager-tool-58kx79ta.js";
7
+ import {
8
+ getFileSystem
9
+ } from "./packager-tool-xdxr3ync.js";
10
+ import"./packager-tool-1yh8g550.js";
11
+
12
+ // src/services/bindings-v2.ts
13
+ var BINDINGS_V2_FILE_NAME = "bindings_v2.json";
14
+ var BINDINGS_V2_VERSION = "2.0";
15
+ var CONNECTION_ID_PROPERTY = "ConnectionId";
16
+ var FOLDER_KEY_PROPERTY = "folderKey";
17
+ var RESOURCE_BINDINGS_VERSION = "2.2";
18
+ var sortBindingsV2Resources = (resources) => [...resources].sort((a, b) => byCodeUnit(a.resource, b.resource) || byCodeUnit(a.key, b.key));
19
+ var serializeBindingsV2File = (resources) => {
20
+ const file = {
21
+ version: BINDINGS_V2_VERSION,
22
+ resources: sortBindingsV2Resources(resources)
23
+ };
24
+ return `${JSON.stringify(file, null, 2)}
25
+ `;
26
+ };
27
+ var readBindingsV2Resources = (raw) => {
28
+ const [error, parsed] = catchError(() => JSON.parse(raw));
29
+ if (error)
30
+ return;
31
+ if (parsed === null || typeof parsed !== "object")
32
+ return;
33
+ const resources = parsed.resources;
34
+ if (!Array.isArray(resources))
35
+ return;
36
+ return resources.filter((entry) => entry !== null && typeof entry === "object" && typeof entry.key === "string");
37
+ };
38
+ var identity = (entry) => `${entry.resource}:${entry.key}`;
39
+ var diffBindingsV2 = (expected, actual) => {
40
+ const expectedByKey = new Map(expected.map((e) => [identity(e), e]));
41
+ const actualByKey = new Map(actual.map((e) => [identity(e), e]));
42
+ const missing = [];
43
+ const changed = [];
44
+ for (const [key, entry] of expectedByKey) {
45
+ const found = actualByKey.get(key);
46
+ if (found === undefined) {
47
+ missing.push(entry.key);
48
+ } else if (JSON.stringify(found) !== JSON.stringify(entry)) {
49
+ changed.push(entry.key);
50
+ }
51
+ }
52
+ const extra = [...actualByKey.values()].filter((entry) => !expectedByKey.has(identity(entry))).map((entry) => entry.key);
53
+ const alphabetically = (left, right) => left.localeCompare(right);
54
+ return {
55
+ missing: missing.sort(alphabetically),
56
+ extra: extra.sort(alphabetically),
57
+ changed: changed.sort(alphabetically)
58
+ };
59
+ };
60
+ var hasBindingsV2Difference = (difference) => difference.missing.length > 0 || difference.extra.length > 0 || difference.changed.length > 0;
61
+
62
+ // src/services/case-event-trigger-bindings.ts
63
+ var ENTRY_POINTS_FILE_NAME = "entry-points.json";
64
+ var EVENT_TRIGGER_SERVICE_TYPE = "Intsvc.EventTrigger";
65
+ var TRIGGER_NODE_TYPES = new Set([
66
+ "uipath.case.trigger",
67
+ "case-management:Trigger"
68
+ ]);
69
+ var PROPERTY_RESOURCE = "Property";
70
+ var BINDING_REFERENCE_PREFIX = "=bindings.";
71
+ var asRecord = (value) => value !== null && typeof value === "object" && !Array.isArray(value) ? value : undefined;
72
+ var asString = (value) => typeof value === "string" && value !== "" ? value : undefined;
73
+ var nonEmpty = (value) => {
74
+ const record = asRecord(value);
75
+ return record !== undefined && Object.keys(record).length > 0 ? record : undefined;
76
+ };
77
+ function entryPointIdsByNode(entryPoints) {
78
+ const ids = new Map;
79
+ const list = asRecord(entryPoints)?.entryPoints;
80
+ if (!Array.isArray(list))
81
+ return ids;
82
+ for (const item of list) {
83
+ const entry = asRecord(item);
84
+ const filePath = asString(entry?.filePath);
85
+ const uniqueId = asString(entry?.uniqueId);
86
+ const hash = filePath?.lastIndexOf("#") ?? -1;
87
+ if (filePath === undefined || uniqueId === undefined || hash < 0)
88
+ continue;
89
+ ids.set(filePath.slice(hash + 1), uniqueId);
90
+ }
91
+ return ids;
92
+ }
93
+ async function readEntryPointIds(casePlanPath) {
94
+ const fs = getFileSystem();
95
+ const path = fs.path.join(fs.path.dirname(fs.path.resolve(casePlanPath)), ENTRY_POINTS_FILE_NAME);
96
+ if (!await fs.exists(path))
97
+ return { ids: new Map };
98
+ const [readError, raw] = await catchError(fs.readFile(path, "utf-8"));
99
+ if (readError || raw == null) {
100
+ return {
101
+ error: `Could not read ${path}: ${readError?.message ?? "the file is no longer there"}`,
102
+ path
103
+ };
104
+ }
105
+ const [parseError, parsed] = catchError(() => JSON.parse(raw));
106
+ if (parseError) {
107
+ return {
108
+ error: `${path} is not valid JSON: ${parseError.message}`,
109
+ path
110
+ };
111
+ }
112
+ return { ids: entryPointIdsByNode(parsed) };
113
+ }
114
+ function readTrigger(node) {
115
+ const record = asRecord(node);
116
+ const nodeId = asString(record?.id);
117
+ if (nodeId === undefined || !TRIGGER_NODE_TYPES.has(String(record?.type)))
118
+ return;
119
+ const data = asRecord(record?.data);
120
+ const container = [asRecord(data?.inputs), asRecord(data?.uipath)].find((candidate) => candidate?.serviceType === EVENT_TRIGGER_SERVICE_TYPE);
121
+ if (container === undefined || !Array.isArray(container.context))
122
+ return;
123
+ const context = new Map;
124
+ for (const item of container.context) {
125
+ const entry = asRecord(item);
126
+ const name = asString(entry?.name);
127
+ if (name !== undefined)
128
+ context.set(name, entry?.value ?? entry?.body);
129
+ }
130
+ const bodyInput = Array.isArray(container.inputs) ? container.inputs.map(asRecord).find((input) => input?.name === "body") : undefined;
131
+ return {
132
+ nodeId,
133
+ activityName: asString(asRecord(data?.display)?.label) ?? asString(data?.label) ?? asString(context.get("operation")),
134
+ context,
135
+ body: asRecord(bodyInput?.body),
136
+ metadataBody: asRecord(context.get("metadata"))
137
+ };
138
+ }
139
+ function findConnectionBinding(trigger, bindings) {
140
+ const connections = bindings.filter((binding) => binding.resource === "Connection" && binding.propertyAttribute === CONNECTION_ID_PROPERTY);
141
+ const reference = asString(trigger.context.get("connection"));
142
+ if (reference?.startsWith(BINDING_REFERENCE_PREFIX)) {
143
+ const id = reference.slice(BINDING_REFERENCE_PREFIX.length);
144
+ const byId = connections.find((binding) => binding.id === id);
145
+ if (byId !== undefined)
146
+ return byId;
147
+ }
148
+ const resourceKey = asString(trigger.context.get("resourceKey"));
149
+ return connections.find((binding) => binding.resourceKey === resourceKey);
150
+ }
151
+ var optional = (key, value) => value === undefined ? {} : { [key]: value };
152
+ function eventTriggerResource(trigger, connectionId, key, entryPointId) {
153
+ const apc = asRecord(trigger.metadataBody?.activityPropertyConfiguration);
154
+ const filterExpression = asString(apc?.filterExpression) ?? asString(asRecord(trigger.body?.filters)?.expression) ?? "";
155
+ const value = {
156
+ ConnectionId: { defaultValue: connectionId, isExpression: false }
157
+ };
158
+ if (entryPointId !== undefined) {
159
+ value.EntryPointUniqueId = {
160
+ defaultValue: entryPointId,
161
+ isExpression: false
162
+ };
163
+ }
164
+ return {
165
+ resource: "EventTrigger",
166
+ key,
167
+ id: `EventTrigger${key}`,
168
+ value,
169
+ metadata: {
170
+ UseConnectionService: "true",
171
+ ...optional("Connector", asString(trigger.context.get("connectorKey"))),
172
+ ...optional("ActivityName", trigger.activityName),
173
+ BindingsVersion: RESOURCE_BINDINGS_VERSION,
174
+ ...optional("ObjectName", objectName(trigger)),
175
+ ...optional("Operation", asString(trigger.context.get("operation"))),
176
+ FilterExpression: filterExpression
177
+ }
178
+ };
179
+ }
180
+ var objectName = (trigger) => asString(trigger.context.get("objectName")) ?? asString(asRecord(trigger.metadataBody?.activityPropertyConfiguration)?.objectName);
181
+ function storedPropertyResources(trigger, parentResourceKey) {
182
+ const stored = trigger.metadataBody?.bindings;
183
+ if (!Array.isArray(stored) || stored.length === 0)
184
+ return;
185
+ return stored.flatMap((raw) => {
186
+ const entry = asRecord(raw);
187
+ if (typeof entry?.resource !== "string" || typeof entry.key !== "string")
188
+ return [];
189
+ const clone = structuredClone(entry);
190
+ clone.metadata = {
191
+ ...clone.metadata,
192
+ ...optional("ActivityName", trigger.activityName)
193
+ };
194
+ if (clone.resource === PROPERTY_RESOURCE) {
195
+ clone.id = `Property_${trigger.nodeId}`;
196
+ clone.metadata.ParentResourceKey = parentResourceKey;
197
+ }
198
+ return [clone];
199
+ });
200
+ }
201
+ function propertyResources(trigger, parentResourceKey) {
202
+ const stored = storedPropertyResources(trigger, parentResourceKey);
203
+ if (stored !== undefined)
204
+ return stored;
205
+ const parameters = nonEmpty(trigger.body?.queryParams) ?? nonEmpty(trigger.body?.parameters);
206
+ const operation = asString(trigger.context.get("operation"));
207
+ if (parameters === undefined || operation === undefined)
208
+ return [];
209
+ const value = {};
210
+ for (const [name, raw] of Object.entries(parameters)) {
211
+ value[name] = { defaultValue: String(raw), isExpression: false };
212
+ }
213
+ const names = Object.keys(parameters).join(",");
214
+ return [
215
+ {
216
+ resource: PROPERTY_RESOURCE,
217
+ key: operation,
218
+ id: `Property_${trigger.nodeId}`,
219
+ value,
220
+ metadata: {
221
+ TriggerCreateParameters: names,
222
+ DebugQueryParameters: names,
223
+ ...optional("ActivityName", trigger.activityName),
224
+ BindingsVersion: RESOURCE_BINDINGS_VERSION,
225
+ ...optional("ObjectName", objectName(trigger)),
226
+ ParentResourceKey: parentResourceKey
227
+ }
228
+ }
229
+ ];
230
+ }
231
+ function deriveEventTriggerResources(nodes, bindings, entryPointIds) {
232
+ if (!Array.isArray(nodes))
233
+ return [];
234
+ return nodes.flatMap((node) => {
235
+ const trigger = readTrigger(node);
236
+ if (trigger === undefined)
237
+ return [];
238
+ const binding = findConnectionBinding(trigger, bindings);
239
+ if (binding === undefined)
240
+ return [];
241
+ const connectionId = binding.default ?? binding.resourceKey;
242
+ const key = [connectionId, trigger.nodeId].filter(Boolean).join("_");
243
+ return [
244
+ eventTriggerResource(trigger, connectionId, key, entryPointIds.get(trigger.nodeId)),
245
+ ...propertyResources(trigger, `EventTrigger.${key}`)
246
+ ];
247
+ });
248
+ }
249
+
250
+ // src/services/case-bindings-service.ts
251
+ var asBinding = (value) => {
252
+ if (value === null || typeof value !== "object" || Array.isArray(value)) {
253
+ return;
254
+ }
255
+ const record = value;
256
+ 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;
257
+ };
258
+ var CONNECTION_RESOURCE = "Connection";
259
+ var NAME_ATTRIBUTE = "name";
260
+ var FOLDER_PATH_ATTRIBUTE = "folderPath";
261
+ var SOLUTION_FOLDER_PREFIX = "solution_folder.";
262
+ var SOLUTION_FOLDER_SENTINEL = "solution_folder";
263
+ var BINDING_REFERENCE_PREFIX2 = "=bindings.";
264
+ var CONNECTOR_KEY_ENTRY = "connectorKey";
265
+ var CONNECTION_ENTRY = "connection";
266
+ var readConnectorContext = (value) => {
267
+ if (!Array.isArray(value))
268
+ return;
269
+ const byName = new Map;
270
+ for (const entry of value) {
271
+ if (entry === null || typeof entry !== "object" || Array.isArray(entry))
272
+ return;
273
+ const { name, value: entryValue } = entry;
274
+ if (typeof name !== "string")
275
+ return;
276
+ if (typeof entryValue === "string")
277
+ byName.set(name, entryValue);
278
+ }
279
+ return byName.has(CONNECTOR_KEY_ENTRY) ? byName : undefined;
280
+ };
281
+ var ownLabel = (node) => {
282
+ const record = node;
283
+ for (const candidate of [
284
+ record.displayName,
285
+ record.display?.label,
286
+ record.label
287
+ ]) {
288
+ if (typeof candidate === "string" && candidate !== "")
289
+ return candidate;
290
+ }
291
+ return;
292
+ };
293
+ var collectConnectorKeys = (document) => {
294
+ const byBindingId = new Map;
295
+ const visit = (node, label) => {
296
+ if (Array.isArray(node)) {
297
+ const context = readConnectorContext(node);
298
+ const connection = context?.get(CONNECTION_ENTRY);
299
+ const connectorKey = context?.get(CONNECTOR_KEY_ENTRY);
300
+ const bindingId = connection?.startsWith(BINDING_REFERENCE_PREFIX2) ? connection.slice(BINDING_REFERENCE_PREFIX2.length) : undefined;
301
+ if (connectorKey !== undefined && bindingId !== undefined && !byBindingId.has(bindingId)) {
302
+ byBindingId.set(bindingId, {
303
+ connectorKey,
304
+ activityName: label
305
+ });
306
+ }
307
+ for (const item of node)
308
+ visit(item, label);
309
+ return;
310
+ }
311
+ if (node === null || typeof node !== "object")
312
+ return;
313
+ const scoped = ownLabel(node) ?? label;
314
+ for (const value of Object.values(node))
315
+ visit(value, scoped);
316
+ };
317
+ visit(document, undefined);
318
+ return byBindingId;
319
+ };
320
+ var attributeDefault = (group, attribute) => group.find((binding) => binding.propertyAttribute === attribute)?.default;
321
+ var connectionEntry = (group, connectorKeys) => {
322
+ const key = group[0].resourceKey;
323
+ const value = {
324
+ [CONNECTION_ID_PROPERTY]: {
325
+ defaultValue: attributeDefault(group, CONNECTION_ID_PROPERTY) ?? key
326
+ }
327
+ };
328
+ const folderKey = attributeDefault(group, FOLDER_KEY_PROPERTY);
329
+ if (folderKey !== undefined) {
330
+ value[FOLDER_KEY_PROPERTY] = { defaultValue: folderKey };
331
+ }
332
+ const use = group.map((binding) => connectorKeys.get(binding.id)).find((found) => found !== undefined);
333
+ const displayLabel = (group.find((binding) => binding.propertyAttribute === CONNECTION_ID_PROPERTY) ?? group[0]).name;
334
+ return {
335
+ resource: CONNECTION_RESOURCE,
336
+ key,
337
+ id: `${CONNECTION_RESOURCE}${key}`,
338
+ value,
339
+ metadata: {
340
+ ...use?.activityName !== undefined && {
341
+ ActivityName: use.activityName
342
+ },
343
+ BindingsVersion: RESOURCE_BINDINGS_VERSION,
344
+ ...typeof displayLabel === "string" && displayLabel !== "" && { DisplayLabel: displayLabel },
345
+ UseConnectionService: "true",
346
+ ...use !== undefined && { Connector: use.connectorKey }
347
+ }
348
+ };
349
+ };
350
+ var resourceEntry = (group) => {
351
+ const key = group[0].resourceKey;
352
+ const value = {};
353
+ const name = attributeDefault(group, NAME_ATTRIBUTE);
354
+ if (name !== undefined)
355
+ value.name = { defaultValue: name };
356
+ const folderPath = key.startsWith(SOLUTION_FOLDER_PREFIX) ? SOLUTION_FOLDER_SENTINEL : attributeDefault(group, FOLDER_PATH_ATTRIBUTE);
357
+ if (folderPath !== undefined) {
358
+ value.folderPath = { defaultValue: folderPath };
359
+ }
360
+ const subType = group.find((binding) => binding.resourceSubType !== undefined)?.resourceSubType;
361
+ return {
362
+ resource: group[0].resource,
363
+ key,
364
+ value,
365
+ ...subType !== undefined && { metadata: { subType } }
366
+ };
367
+ };
368
+ var deriveCaseBindingsV2 = (document, entryPointIds = new Map) => {
369
+ const connectorKeys = collectConnectorKeys(document);
370
+ const groups = new Map;
371
+ const bindings = [];
372
+ for (const entry of Array.isArray(document.bindings) ? document.bindings : []) {
373
+ const binding = asBinding(entry);
374
+ if (binding === undefined)
375
+ continue;
376
+ bindings.push(binding);
377
+ const groupKey = `${binding.resource}:${binding.resourceKey}`;
378
+ const group = groups.get(groupKey);
379
+ if (group === undefined)
380
+ groups.set(groupKey, [binding]);
381
+ else
382
+ group.push(binding);
383
+ }
384
+ return [
385
+ ...[...groups.values()].map((group) => group[0].resource === CONNECTION_RESOURCE ? connectionEntry(group, connectorKeys) : resourceEntry(group)),
386
+ ...deriveEventTriggerResources(document.nodes, bindings, entryPointIds)
387
+ ];
388
+ };
389
+ var bindingsV2PathFor = (casePlanPath) => {
390
+ const fs = getFileSystem();
391
+ return fs.path.join(fs.path.dirname(fs.path.resolve(casePlanPath)), BINDINGS_V2_FILE_NAME);
392
+ };
393
+ var compareCaseBindingsV2 = async (casePlanPath, document) => {
394
+ const fs = getFileSystem();
395
+ const path = bindingsV2PathFor(casePlanPath);
396
+ const entryPoints = await readEntryPointIds(casePlanPath);
397
+ if ("error" in entryPoints) {
398
+ return {
399
+ status: "entry-points-unreadable",
400
+ path: entryPoints.path,
401
+ expectedCount: 0,
402
+ reason: entryPoints.error
403
+ };
404
+ }
405
+ const expected = deriveCaseBindingsV2(document, entryPoints.ids);
406
+ const expectedCount = expected.length;
407
+ if (!await fs.exists(path))
408
+ return { status: "absent", path, expectedCount };
409
+ const [readError, raw] = await catchError(fs.readFile(path, "utf-8"));
410
+ if (readError || raw == null)
411
+ return { status: "unreadable", path, expectedCount };
412
+ const actual = readBindingsV2Resources(raw);
413
+ if (actual === undefined)
414
+ return { status: "unreadable", path, expectedCount };
415
+ const difference = diffBindingsV2(expected, actual);
416
+ return hasBindingsV2Difference(difference) ? { status: "differs", path, expectedCount, difference } : { status: "match", path, expectedCount };
417
+ };
418
+ var syncCaseBindings = async (casePlanPath) => {
419
+ const fs = getFileSystem();
420
+ const resolved = fs.path.resolve(casePlanPath);
421
+ if (!await fs.exists(resolved)) {
422
+ return {
423
+ ok: false,
424
+ message: `Case plan file not found: ${resolved}`,
425
+ instructions: "Pass the path to an existing caseplan JSON file, for example 'uip maestro case bindings sync case.json'."
426
+ };
427
+ }
428
+ const [readError, raw] = await catchError(fs.readFile(resolved, "utf-8"));
429
+ if (readError || raw == null) {
430
+ return {
431
+ ok: false,
432
+ message: `Failed to read case plan: ${readError?.message ?? "empty content"}`,
433
+ instructions: `Verify read permissions on ${resolved}.`
434
+ };
435
+ }
436
+ const [parseError, document] = catchError(() => JSON.parse(raw));
437
+ if (parseError || document == null || typeof document !== "object" || Array.isArray(document)) {
438
+ return {
439
+ ok: false,
440
+ message: `Case plan is not valid JSON: ${parseError?.message ?? "not a JSON object"}`,
441
+ instructions: `Verify the contents of ${resolved}.`
442
+ };
443
+ }
444
+ const entryPoints = await readEntryPointIds(resolved);
445
+ if ("error" in entryPoints) {
446
+ return {
447
+ ok: false,
448
+ message: entryPoints.error,
449
+ instructions: `Fix or remove ${entryPoints.path}, then run \`uip maestro case bindings sync\` again.`
450
+ };
451
+ }
452
+ const resources = deriveCaseBindingsV2(document, entryPoints.ids);
453
+ const path = bindingsV2PathFor(resolved);
454
+ const [writeError] = await catchError(fs.writeFile(path, serializeBindingsV2File(resources)));
455
+ if (writeError) {
456
+ return {
457
+ ok: false,
458
+ message: `Failed to write bindings file: ${writeError.message}`,
459
+ instructions: `Verify write permissions on ${fs.path.dirname(path)}.`
460
+ };
461
+ }
462
+ return {
463
+ ok: true,
464
+ path,
465
+ resourceCount: resources.length,
466
+ connectionCount: resources.filter((entry) => entry.resource === CONNECTION_RESOURCE).length
467
+ };
468
+ };
469
+ export {
470
+ bindingsV2PathFor,
471
+ compareCaseBindingsV2,
472
+ deriveCaseBindingsV2,
473
+ syncCaseBindings
474
+ };
475
+
476
+ //# debugId=DF4BCD662409114064756E2164756E21
@@ -1,14 +1,11 @@
1
- import {
2
- loadCaseSchemaAsync
3
- } from "./packager-tool-p7jgrm5r.js";
4
1
  import {
5
2
  buildSolutionPackageFromDir,
6
3
  uploadOrOverwriteSolution
7
- } from "./packager-tool-2xfyykm0.js";
4
+ } from "./packager-tool-ggbvxvey.js";
8
5
  import {
9
6
  findSolutionFile,
10
7
  updateSolutionFile
11
- } from "./packager-tool-052kvydg.js";
8
+ } from "./packager-tool-pm646ag4.js";
12
9
  import {
13
10
  CasePlanFileNames,
14
11
  buildCasePackageDescriptor,
@@ -18,17 +15,21 @@ import {
18
15
  misnamedEntryPointBpmn,
19
16
  normalizeEntryPointPath,
20
17
  resolveDeclaredFileName
21
- } from "./packager-tool-83qnybab.js";
18
+ } from "./packager-tool-wj9d9mqe.js";
19
+ import"./packager-tool-4rqd21wc.js";
22
20
  import"./packager-tool-b098y4a2.js";
21
+ import {
22
+ loadCaseSchemaAsync
23
+ } from "./packager-tool-cmwets3m.js";
23
24
  import {
24
25
  uploadAndDebugSolution
25
- } from "./packager-tool-adcaxdhs.js";
26
+ } from "./packager-tool-paepfv5d.js";
26
27
  import {
27
28
  logger
28
- } from "./packager-tool-kpcjnxd1.js";
29
+ } from "./packager-tool-58kx79ta.js";
29
30
  import {
30
31
  getFileSystem
31
- } from "./packager-tool-0v3s8r01.js";
32
+ } from "./packager-tool-xdxr3ync.js";
32
33
  import"./packager-tool-1yh8g550.js";
33
34
 
34
35
  // src/services/case-debug-studio-web-service.ts
@@ -130,4 +131,4 @@ export {
130
131
  CaseDebugStudioWebService
131
132
  };
132
133
 
133
- //# debugId=BA02F2B9880B270D64756E2164756E21
134
+ //# debugId=0DC6729E8C8F178464756E2164756E21
@@ -0,0 +1,132 @@
1
+ import {
2
+ readIoRows
3
+ } from "./packager-tool-8a9yqfq7.js";
4
+ import {
5
+ NAME_BOUND_TASK_TYPES
6
+ } from "./packager-tool-d7jjng8a.js";
7
+ import"./packager-tool-1yh8g550.js";
8
+
9
+ // src/services/case-described-io-service.ts
10
+ var RESOURCE_FIELDS = [
11
+ "type",
12
+ "subType",
13
+ "_jsonSchema",
14
+ "displayName",
15
+ "options",
16
+ "required"
17
+ ];
18
+ var CLEARED_ON_REFRESH = [
19
+ "body",
20
+ "_jsonSchema",
21
+ "options",
22
+ "subType",
23
+ "required"
24
+ ];
25
+ var AUTHORED_FIELDS = ["value", "source", "target"];
26
+ var bodyOwner = (direction) => direction === "outputs" ? "resource" : "authored";
27
+ var carriesValue = (value) => value !== undefined && value !== null && !(typeof value === "string" && value.trim() === "");
28
+ var asRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value) ? value : undefined;
29
+ var asArray = (value) => Array.isArray(value) ? value : [];
30
+ var findTask = (document, taskId) => {
31
+ for (const rawNode of asArray(document.nodes)) {
32
+ const data = asRecord(asRecord(rawNode)?.data);
33
+ for (const lane of asArray(data?.tasks)) {
34
+ for (const rawTask of asArray(lane)) {
35
+ const task = asRecord(rawTask);
36
+ if (task?.id === taskId)
37
+ return task;
38
+ }
39
+ }
40
+ }
41
+ return;
42
+ };
43
+ var mergeRows = (existing, described, elementId, direction) => {
44
+ const byName = new Map;
45
+ for (const raw of described) {
46
+ const row = asRecord(raw);
47
+ if (row === undefined)
48
+ continue;
49
+ const name = row.name;
50
+ if (typeof name === "string" && name !== "")
51
+ byName.set(name, row);
52
+ }
53
+ const updated = [];
54
+ const rows = existing.map((raw) => {
55
+ const row = asRecord(raw);
56
+ const name = typeof row?.name === "string" ? row.name : "";
57
+ const source = byName.get(name);
58
+ if (row === undefined || source === undefined)
59
+ return raw;
60
+ updated.push(name);
61
+ const merged = { ...row };
62
+ for (const field of RESOURCE_FIELDS) {
63
+ if (source[field] !== undefined)
64
+ merged[field] = source[field];
65
+ }
66
+ if (bodyOwner(direction) === "resource") {
67
+ for (const field of CLEARED_ON_REFRESH) {
68
+ if (source[field] !== undefined)
69
+ merged[field] = source[field];
70
+ else
71
+ delete merged[field];
72
+ }
73
+ } else if (!carriesValue(merged.body) && carriesValue(source.body)) {
74
+ merged.body = source.body;
75
+ }
76
+ for (const field of AUTHORED_FIELDS) {
77
+ if (carriesValue(merged[field]))
78
+ continue;
79
+ if (!carriesValue(source[field]))
80
+ continue;
81
+ merged[field] = source[field];
82
+ }
83
+ merged.elementId = elementId;
84
+ return merged;
85
+ });
86
+ const unmatched = [...byName.keys()].filter((name) => !updated.includes(name));
87
+ return { rows, updated, unmatched };
88
+ };
89
+ var applyDescribedIo = (document, describeDocument, options) => {
90
+ const task = findTask(document, options.taskId);
91
+ if (task === undefined) {
92
+ return {
93
+ message: `No task with id "${options.taskId}" in this case plan`,
94
+ instructions: "Pass the task's `id` from `nodes[].data.tasks[][]`."
95
+ };
96
+ }
97
+ const taskType = typeof task.type === "string" ? task.type : "";
98
+ if (!NAME_BOUND_TASK_TYPES.has(taskType)) {
99
+ return {
100
+ message: `Task "${options.taskId}" is a \`${taskType || "(untyped)"}\` task, and \`--described\` writes a resource task's own contract`,
101
+ instructions: `A described result belongs on ${[...NAME_BOUND_TASK_TYPES].map((type) => `\`${type}\``).join(", ")}. For a connector task use \`--spec\` with a \`case spec\` result instead.`
102
+ };
103
+ }
104
+ const described = readIoRows(describeDocument);
105
+ if (described === undefined) {
106
+ return {
107
+ message: "This file carries no described inputs or outputs",
108
+ instructions: "Save the result of `uip maestro case tasks describe --type <type> --id <id> --output json` and pass that."
109
+ };
110
+ }
111
+ const data = asRecord(task.data) ?? {};
112
+ const elementId = typeof task.elementId === "string" && task.elementId !== "" ? task.elementId : options.taskId;
113
+ const inputs = mergeRows(asArray(data.inputs), described.inputs, elementId, "inputs");
114
+ const outputs = mergeRows(asArray(data.outputs), described.outputs, elementId, "outputs");
115
+ task.data = { ...data, inputs: inputs.rows, outputs: outputs.rows };
116
+ return {
117
+ document,
118
+ summary: {
119
+ taskId: options.taskId,
120
+ inputsUpdated: inputs.updated,
121
+ outputsUpdated: outputs.updated,
122
+ unmatched: [...inputs.unmatched, ...outputs.unmatched]
123
+ }
124
+ };
125
+ };
126
+ var isDescribedIoFailure = (value) => ("message" in value);
127
+ export {
128
+ applyDescribedIo,
129
+ isDescribedIoFailure
130
+ };
131
+
132
+ //# debugId=68B2D7B3821D688864756E2164756E21
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  catchError
3
- } from "./packager-tool-kpcjnxd1.js";
3
+ } from "./packager-tool-58kx79ta.js";
4
4
  import {
5
5
  getFileSystem
6
- } from "./packager-tool-0v3s8r01.js";
6
+ } from "./packager-tool-xdxr3ync.js";
7
7
  import"./packager-tool-1yh8g550.js";
8
8
 
9
9
  // src/services/case-format-service.ts