@uipath/maestro-sdk 1.207.0-preview.351 → 1.207.0-preview.353

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.
@@ -96517,6 +96517,8 @@ Consider installing the package or pass your own 'workerFactory' to ELK's constr
96517
96517
  var TEXT_ANNOTATION_PRESERVE_OFFSET_DISTANCE = 200;
96518
96518
  var DIRECTIONAL_COMPONENT_EDGE_PREFIX = "__layout-direction-component-edge__";
96519
96519
  var BOUNDARY_FLOW_PORT_PREFIX = "__layout-boundary-port__";
96520
+ var MAIN_PATH_EDGE_LAYOUT_OPTIONS = { "elk.layered.priority.straightness": "10" };
96521
+ var MAIN_PATH_ALIGNMENT_TOLERANCE = 10;
96520
96522
  var isTidyUpSelectedLayoutEligibleNode = (node) => {
96521
96523
  const type = node.type ?? "";
96522
96524
  return !FIXED_CONTAINER_TYPES.has(type) && !BOUNDARY_EVENT_TYPES.has(type) && !EXCLUDED_FROM_LAYOUT_TYPES.has(type);
@@ -96527,6 +96529,8 @@ Consider installing the package or pass your own 'workerFactory' to ELK's constr
96527
96529
  var LABEL_PADDING_Y = 4;
96528
96530
  var LABEL_MAX_WIDTH = 160;
96529
96531
  var ELK_PORT_SIDES = { top: "NORTH", right: "EAST", bottom: "SOUTH", left: "WEST" };
96532
+ var MAIN_PATH_PORT_PREFIX = "__layout-main-path-port__";
96533
+ var MAIN_PATH_PORT_SIDES = { RIGHT: { in: "left", out: "right" }, LEFT: { in: "right", out: "left" }, DOWN: { in: "top", out: "bottom" }, UP: { in: "bottom", out: "top" } };
96530
96534
  var ElkLayoutService = class {
96531
96535
  constructor(options = {}) {
96532
96536
  this.elk = new import_elk_bundled.default;
@@ -96727,15 +96731,20 @@ Consider installing the package or pass your own 'workerFactory' to ELK's constr
96727
96731
  const hasDirectedCycle = options.algorithm === "layered" && this.hasDirectedCycle(nodes, graphEdges);
96728
96732
  const orderedNodes = hasDirectedCycle ? this.sortNodesByFlowOrder(nodes, graphEdges) : nodes;
96729
96733
  const orderedEdges = hasDirectedCycle ? this.sortEdgesByFlowOrder(graphEdges, orderedNodes) : graphEdges;
96734
+ const mainPathEdgeIds = this.getMainPathEdgeIds(orderedNodes, orderedEdges);
96735
+ const mainPathPorts = this.getMainPathPorts(orderedEdges, mainPathEdgeIds, options.direction || "RIGHT", new Set);
96730
96736
  const elkChildren = orderedNodes.map((node) => {
96731
96737
  const dimensions = this.getNodeDimensions(node);
96732
- return { id: node.id, width: dimensions.width, height: dimensions.height };
96738
+ const ports = mainPathPorts.nodePorts.get(node.id);
96739
+ return { id: node.id, width: dimensions.width, height: dimensions.height, ...ports && { ports: this.toElkPorts(ports), layoutOptions: { "elk.portConstraints": "FIXED_SIDE" } } };
96733
96740
  });
96734
96741
  const elkEdges = orderedEdges.map((edge) => {
96735
- const elkEdge = { id: edge.id, sources: [edge.source], targets: [edge.target] };
96742
+ const elkEdge = { id: edge.id, sources: [mainPathPorts.sourcePortIds.get(edge.id) ?? edge.source], targets: [mainPathPorts.targetPortIds.get(edge.id) ?? edge.target] };
96736
96743
  const labels = this.getEdgeLabels(edge);
96737
96744
  if (labels)
96738
96745
  elkEdge.labels = labels;
96746
+ if (mainPathEdgeIds.has(edge.id))
96747
+ elkEdge.layoutOptions = MAIN_PATH_EDGE_LAYOUT_OPTIONS;
96739
96748
  return elkEdge;
96740
96749
  });
96741
96750
  elkEdges.push(...this.buildDirectionalComponentEdges(orderedNodes, orderedEdges, options));
@@ -97168,6 +97177,8 @@ Consider installing the package or pass your own 'workerFactory' to ELK's constr
97168
97177
  const levelHasDirectedCycle = options.algorithm === "layered" && this.hasDirectedCycle(layoutableChildren, levelEdges);
97169
97178
  const orderedChildren = levelHasDirectedCycle ? this.sortNodesByFlowOrder(layoutableChildren, levelEdges) : layoutableChildren;
97170
97179
  const orderedLevelEdges = levelHasDirectedCycle ? this.sortEdgesByFlowOrder(levelEdges, orderedChildren) : levelEdges;
97180
+ const mainPathEdgeIds = this.getMainPathEdgeIds(orderedChildren, orderedLevelEdges.filter((edge) => !boundaryFlowPorts.has(edge.id)));
97181
+ const mainPathPorts = this.getMainPathPorts(orderedLevelEdges, mainPathEdgeIds, options.direction || "RIGHT", new Set(boundaryFlowPorts.keys()));
97171
97182
  const elkChildren = orderedChildren.map((node) => {
97172
97183
  const dimensions = this.getNodeDimensions(node);
97173
97184
  const hasLayoutableChildren = this.hasLayoutableChildren(node.id, childrenMap);
@@ -97192,22 +97203,24 @@ Consider installing the package or pass your own 'workerFactory' to ELK's constr
97192
97203
  elkNode.layoutOptions = this.getLayoutOptions(options, true, childGraphHasDirectedCycle);
97193
97204
  }
97194
97205
  }
97195
- const ports = new Map;
97206
+ const ports = new Map(mainPathPorts.nodePorts.get(node.id) ?? []);
97196
97207
  for (const port of boundaryFlowPorts.values()) {
97197
97208
  if (port.hostId === node.id)
97198
97209
  ports.set(port.portId, port.side);
97199
97210
  }
97200
97211
  if (ports.size > 0) {
97201
- elkNode.ports = [...ports].map(([id2, side]) => ({ id: id2, layoutOptions: { "elk.port.side": ELK_PORT_SIDES[side] } }));
97212
+ elkNode.ports = this.toElkPorts(ports);
97202
97213
  elkNode.layoutOptions = { ...elkNode.layoutOptions, "elk.portConstraints": "FIXED_SIDE" };
97203
97214
  }
97204
97215
  return elkNode;
97205
97216
  });
97206
97217
  const elkEdges = orderedLevelEdges.map((edge) => {
97207
- const elkEdge = { id: edge.id, sources: [boundaryFlowPorts.get(edge.id)?.portId ?? edge.source], targets: [edge.target] };
97218
+ const elkEdge = { id: edge.id, sources: [boundaryFlowPorts.get(edge.id)?.portId ?? mainPathPorts.sourcePortIds.get(edge.id) ?? edge.source], targets: [mainPathPorts.targetPortIds.get(edge.id) ?? edge.target] };
97208
97219
  const labels = this.getEdgeLabels(edge);
97209
97220
  if (labels)
97210
97221
  elkEdge.labels = labels;
97222
+ if (mainPathEdgeIds.has(edge.id))
97223
+ elkEdge.layoutOptions = MAIN_PATH_EDGE_LAYOUT_OPTIONS;
97211
97224
  return elkEdge;
97212
97225
  });
97213
97226
  return { id: parentId ?? "root", layoutOptions: this.getLayoutOptions(options, parentId !== undefined, levelHasDirectedCycle), children: elkChildren, edges: elkEdges };
@@ -97219,7 +97232,8 @@ Consider installing the package or pass your own 'workerFactory' to ELK's constr
97219
97232
  for (const edge of edges) {
97220
97233
  const edgeSource = "source" in edge ? edge.source : edge.sources[0];
97221
97234
  const source = portOwnerIds.get(edgeSource) ?? edgeSource;
97222
- const target = "target" in edge ? edge.target : edge.targets[0];
97235
+ const edgeTarget = "target" in edge ? edge.target : edge.targets[0];
97236
+ const target = portOwnerIds.get(edgeTarget) ?? edgeTarget;
97223
97237
  if (!source || !target || !nodeIds.has(source) || !nodeIds.has(target))
97224
97238
  continue;
97225
97239
  outgoingNodeIds.get(source)?.push(target);
@@ -97242,6 +97256,103 @@ Consider installing the package or pass your own 'workerFactory' to ELK's constr
97242
97256
  };
97243
97257
  return [...nodeIds].some(visit);
97244
97258
  }
97259
+ getMainPathEdgeIds(nodes, edges) {
97260
+ const centers = new Map(nodes.map((node) => {
97261
+ const { width, height } = this.getNodeDimensions(node);
97262
+ return [node.id, { x: node.position.x + width / 2, y: node.position.y + height / 2 }];
97263
+ }));
97264
+ const outgoingEdges = new Map(nodes.map((node) => [node.id, []]));
97265
+ const targetNodeIds = new Set;
97266
+ let flowSpanX = 0;
97267
+ let flowSpanY = 0;
97268
+ for (const edge2 of edges) {
97269
+ const source = centers.get(edge2.source);
97270
+ const target = centers.get(edge2.target);
97271
+ if (edge2.source === edge2.target || !source || !target)
97272
+ continue;
97273
+ outgoingEdges.get(edge2.source)?.push(edge2);
97274
+ targetNodeIds.add(edge2.target);
97275
+ flowSpanX += Math.abs(target.x - source.x);
97276
+ flowSpanY += Math.abs(target.y - source.y);
97277
+ }
97278
+ const crossAxis = flowSpanX >= flowSpanY ? "y" : "x";
97279
+ const hasLayout = nodes.some((node) => node.position.x !== nodes[0].position.x || node.position.y !== nodes[0].position.y);
97280
+ const getAlignment = (edge2) => {
97281
+ if (!hasLayout)
97282
+ return 0;
97283
+ const offset = Math.abs((centers.get(edge2.source)?.[crossAxis] ?? 0) - (centers.get(edge2.target)?.[crossAxis] ?? 0));
97284
+ return offset <= MAIN_PATH_ALIGNMENT_TOLERANCE ? 1 : 0;
97285
+ };
97286
+ const isBetter = (first, second) => first.alignment > second.alignment || first.alignment === second.alignment && first.length > second.length;
97287
+ const startNodes = nodes.filter((node) => node.type === "bpmn:StartEvent");
97288
+ const seedNodes = startNodes.length > 0 ? startNodes : nodes.filter((node) => !targetNodeIds.has(node.id));
97289
+ const visitingNodeIds = new Set;
97290
+ const scores = new Map;
97291
+ const nextEdges = new Map;
97292
+ const visit = (nodeId) => {
97293
+ visitingNodeIds.add(nodeId);
97294
+ let best;
97295
+ for (const edge2 of outgoingEdges.get(nodeId) ?? []) {
97296
+ if (visitingNodeIds.has(edge2.target))
97297
+ continue;
97298
+ if (!scores.has(edge2.target))
97299
+ visit(edge2.target);
97300
+ const next = scores.get(edge2.target) ?? { alignment: 0, length: 1 };
97301
+ const candidate = { alignment: next.alignment + getAlignment(edge2), length: next.length };
97302
+ if (!best || isBetter(candidate, best)) {
97303
+ best = candidate;
97304
+ nextEdges.set(nodeId, edge2);
97305
+ }
97306
+ }
97307
+ visitingNodeIds.delete(nodeId);
97308
+ scores.set(nodeId, { alignment: best?.alignment ?? 0, length: (best?.length ?? 0) + 1 });
97309
+ };
97310
+ let startNodeId;
97311
+ for (const node of seedNodes) {
97312
+ if (!scores.has(node.id))
97313
+ visit(node.id);
97314
+ const score = scores.get(node.id);
97315
+ const startScore = startNodeId === undefined ? undefined : scores.get(startNodeId);
97316
+ if (score && (!startScore || isBetter(score, startScore)))
97317
+ startNodeId = node.id;
97318
+ }
97319
+ const mainPathEdgeIds = new Set;
97320
+ let edge = startNodeId === undefined ? undefined : nextEdges.get(startNodeId);
97321
+ while (edge && !mainPathEdgeIds.has(edge.id)) {
97322
+ mainPathEdgeIds.add(edge.id);
97323
+ edge = nextEdges.get(edge.target);
97324
+ }
97325
+ return mainPathEdgeIds;
97326
+ }
97327
+ getMainPathPorts(edges, mainPathEdgeIds, direction, fixedSourceEdgeIds) {
97328
+ const sides = MAIN_PATH_PORT_SIDES[direction] ?? MAIN_PATH_PORT_SIDES.RIGHT;
97329
+ const mainPathNodeIds = new Set(edges.filter((edge) => mainPathEdgeIds.has(edge.id)).flatMap((edge) => [edge.source, edge.target]));
97330
+ const portedNodeIds = new Set;
97331
+ for (const edge of edges) {
97332
+ if (mainPathEdgeIds.has(edge.id))
97333
+ continue;
97334
+ if (!fixedSourceEdgeIds.has(edge.id) && mainPathNodeIds.has(edge.source))
97335
+ portedNodeIds.add(edge.source);
97336
+ if (mainPathNodeIds.has(edge.target))
97337
+ portedNodeIds.add(edge.target);
97338
+ }
97339
+ const ports = { nodePorts: new Map, sourcePortIds: new Map, targetPortIds: new Map };
97340
+ const getPortId = (nodeId, side) => {
97341
+ const portId = `${MAIN_PATH_PORT_PREFIX}${nodeId}:${side}`;
97342
+ ports.nodePorts.set(nodeId, (ports.nodePorts.get(nodeId) ?? new Map).set(portId, side));
97343
+ return portId;
97344
+ };
97345
+ for (const edge of edges) {
97346
+ if (!fixedSourceEdgeIds.has(edge.id) && portedNodeIds.has(edge.source))
97347
+ ports.sourcePortIds.set(edge.id, getPortId(edge.source, sides.out));
97348
+ if (portedNodeIds.has(edge.target))
97349
+ ports.targetPortIds.set(edge.id, getPortId(edge.target, sides.in));
97350
+ }
97351
+ return ports;
97352
+ }
97353
+ toElkPorts(ports) {
97354
+ return [...ports].map(([id2, side]) => ({ id: id2, layoutOptions: { "elk.port.side": ELK_PORT_SIDES[side] } }));
97355
+ }
97245
97356
  getBaseLayoutOptions(options) {
97246
97357
  return { "elk.algorithm": `org.eclipse.elk.${options.algorithm}`, "elk.direction": options.direction || "RIGHT", "elk.spacing.nodeNode": String(options.nodeSpacing), "elk.layered.spacing.nodeNodeBetweenLayers": String(options.layerSpacing), "elk.edgeRouting": options.edgeRouting || "ORTHOGONAL", "elk.edgeLabels.placement": "CENTER", "elk.spacing.edgeLabel": "10", "elk.spacing.edgeNode": String(EDGE_NODE_CLEARANCE), "elk.spacing.edgeEdge": String(EDGE_EDGE_CLEARANCE), "elk.spacing.portPort": String(EDGE_EDGE_CLEARANCE) };
97247
97358
  }
@@ -97255,6 +97366,7 @@ Consider installing the package or pass your own 'workerFactory' to ELK's constr
97255
97366
  elkOptions["elk.layered.crossingMinimization.forceNodeModelOrder"] = "true";
97256
97367
  }
97257
97368
  elkOptions["elk.layered.crossingMinimization.strategy"] = "LAYER_SWEEP";
97369
+ elkOptions["elk.layered.crossingMinimization.greedySwitchHierarchical.type"] = "TWO_SIDED";
97258
97370
  elkOptions["elk.layered.nodePlacement.strategy"] = options.nodePlacementStrategy ?? "BRANDES_KOEPF";
97259
97371
  elkOptions["elk.hierarchyHandling"] = "INCLUDE_CHILDREN";
97260
97372
  elkOptions["elk.layered.spacing.edgeNodeBetweenLayers"] = String(EDGE_NODE_CLEARANCE);
@@ -105686,4 +105798,4 @@ export {
105686
105798
  updateBpmnLayout
105687
105799
  };
105688
105800
 
105689
- //# debugId=B12334F7EF644BEB64756E2164756E21
105801
+ //# debugId=F2107C24FEF32E9E64756E2164756E21
@@ -1121,7 +1121,7 @@ var init_package = __esm(() => {
1121
1121
  name: "@uipath/integrationservice-sdk",
1122
1122
  author: "UiPath",
1123
1123
  license: "SEE LICENSE IN LICENSE.txt",
1124
- version: "1.207.0-preview.351",
1124
+ version: "1.207.0-preview.353",
1125
1125
  repository: {
1126
1126
  type: "git",
1127
1127
  url: "https://github.com/UiPath/cli.git",
@@ -265517,4 +265517,4 @@ export {
265517
265517
  studioCatalogTypeCache
265518
265518
  };
265519
265519
 
265520
- //# debugId=806E5A0B0BE9159564756E2164756E21
265520
+ //# debugId=C7499BD70A5449F464756E2164756E21
package/dist/index.js CHANGED
@@ -144977,7 +144977,7 @@ var init_package = __esm(() => {
144977
144977
  name: "@uipath/integrationservice-sdk",
144978
144978
  author: "UiPath",
144979
144979
  license: "SEE LICENSE IN LICENSE.txt",
144980
- version: "1.207.0-preview.351",
144980
+ version: "1.207.0-preview.353",
144981
144981
  repository: {
144982
144982
  type: "git",
144983
144983
  url: "https://github.com/UiPath/cli.git",
@@ -289238,4 +289238,4 @@ export {
289238
289238
  withPimsCall
289239
289239
  };
289240
289240
 
289241
- //# debugId=64BD4A9817B5243264756E2164756E21
289241
+ //# debugId=E0898A7AB34895A464756E2164756E21
@@ -144813,7 +144813,7 @@ var init_package = __esm(() => {
144813
144813
  name: "@uipath/integrationservice-sdk",
144814
144814
  author: "UiPath",
144815
144815
  license: "SEE LICENSE IN LICENSE.txt",
144816
- version: "1.207.0-preview.351",
144816
+ version: "1.207.0-preview.353",
144817
144817
  repository: {
144818
144818
  type: "git",
144819
144819
  url: "https://github.com/UiPath/cli.git",
@@ -265093,4 +265093,4 @@ export {
265093
265093
  shownRows
265094
265094
  };
265095
265095
 
265096
- //# debugId=C0280389839BE9DB64756E2164756E21
265096
+ //# debugId=34527079C47A325564756E2164756E21
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@uipath/maestro-sdk",
3
3
  "author": "UiPath",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
- "version": "1.207.0-preview.351",
5
+ "version": "1.207.0-preview.353",
6
6
  "description": "SDK for the UiPath Maestro (PIMS) API — process instance management.",
7
7
  "repository": {
8
8
  "type": "git",
@@ -113,5 +113,5 @@
113
113
  "files": [
114
114
  "dist"
115
115
  ],
116
- "gitHead": "ddae25f846066672dc81635a8efa8d81f9362562"
116
+ "gitHead": "feb91bdc860a4396d9366e023ef9086795d63621"
117
117
  }