@uipath/maestro-builder-sdk 6.35.1 → 6.36.1

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.
@@ -641,12 +641,12 @@ export type Step = {
641
641
  };
642
642
  /** One node's designer layout: canvas position, and optionally size and collapsed state. */
643
643
  export interface NodeLayout {
644
- /** Absolute canvas position. */
644
+ /** Canvas position; relative to the container for a node inside one. */
645
645
  position: {
646
646
  x: number;
647
647
  y: number;
648
648
  };
649
- /** Node size; omit for the designer default. */
649
+ /** Node size; omit to keep compile's 96 × 96. */
650
650
  size?: {
651
651
  width: number;
652
652
  height: number;
@@ -654,6 +654,58 @@ export interface NodeLayout {
654
654
  /** Whether the node renders collapsed. */
655
655
  collapsed?: boolean;
656
656
  }
657
+ /**
658
+ * A node's layout at a canvas position — the short form of a {@link NodeLayout}
659
+ * for the `nodes` map of {@link FlowBuilder.layout}.
660
+ *
661
+ * @remarks
662
+ * Positions are canvas pixels. A child's position inside a container is relative
663
+ * to that container, as the designer stores it; the body of a loop starts inside
664
+ * the container's padding, at `at(144, 96)`. The size, {@link dim}, is needed by
665
+ * a container and by an inline agent; every other node is 96 × 96.
666
+ *
667
+ * @example
668
+ * **Lay out a main path on one row, with a side path below it**
669
+ * ```ts
670
+ * .layout({
671
+ * nodes: {
672
+ * start: at(256, 144), fetch: at(448, 144), eachItem: at(640, 144, dim(576, 320)),
673
+ * handle: at(144, 96), // inside eachItem, relative to it
674
+ * done: at(1312, 144),
675
+ * onFailure: at(448, 304),
676
+ * },
677
+ * })
678
+ * ```
679
+ *
680
+ * @param x - The node's left edge on the canvas.
681
+ * @param y - The node's top edge on the canvas.
682
+ * @param size - The node's size; omit to keep compile's 96 × 96.
683
+ * @returns A {@link NodeLayout} to put in `.layout({ nodes })`.
684
+ */
685
+ export declare function at(x: number, y: number, size?: NodeLayout['size']): NodeLayout;
686
+ /**
687
+ * A node's size on the canvas, in pixels — the third argument of {@link at}.
688
+ *
689
+ * @remarks
690
+ * Compile writes 96 × 96 on every node and the designer draws the persisted
691
+ * size, so a node whose canvas shape is larger needs one: a container (a loop
692
+ * or a do-while body, drawn as a box around its children; `format` makes it
693
+ * 560 × 320) and an inline agent (`dim(288, 96)`). Every other node is 96 × 96
694
+ * and needs none.
695
+ *
696
+ * @example
697
+ * **A loop wide enough for a three-step body, then an inline agent**
698
+ * ```ts
699
+ * .layout({
700
+ * nodes: { eachItem: at(640, 144, dim(768, 320)), review: at(1504, 144, dim(288, 96)) },
701
+ * })
702
+ * ```
703
+ *
704
+ * @param width - The node's width.
705
+ * @param height - The node's height.
706
+ * @returns The `size` of a {@link NodeLayout}.
707
+ */
708
+ export declare function dim(width: number, height: number): NonNullable<NodeLayout['size']>;
657
709
  /** One edge's route: user-dragged bends and/or the auto-router's waypoints. */
658
710
  export interface EdgeRoute {
659
711
  /** Manually placed bends, in canvas coordinates. Win over the routed set. */
@@ -1331,6 +1383,22 @@ declare class FlowBuilder extends StepList {
1331
1383
  * the serializer's default arrangement. Unknown keys fail compilation rather
1332
1384
  * than being dropped.
1333
1385
  *
1386
+ * Without a layout, compile places every node on one row in emission order,
1387
+ * which reads badly in the designer once a flow has a branch, an error path or
1388
+ * a loop. {@link at} writes a node's entry from two numbers, and {@link dim}
1389
+ * a container's size from two more.
1390
+ *
1391
+ * @example
1392
+ * **Main path on one row, the error handler on the row below**
1393
+ * ```ts
1394
+ * .layout({
1395
+ * nodes: {
1396
+ * start: at(256, 144), load: at(448, 144), save: at(640, 144), done: at(832, 144),
1397
+ * report: at(448, 304), end: at(640, 304),
1398
+ * },
1399
+ * })
1400
+ * ```
1401
+ *
1334
1402
  * @param layout - Node layout by step name, edge routes by `"from->to"`.
1335
1403
  * @returns This builder, so calls chain.
1336
1404
  */
package/dist/flow-sdk.js CHANGED
@@ -262,6 +262,62 @@ export function conversationTrigger() {
262
262
  export function voiceTrigger() {
263
263
  return builtinTriggerSpec({ kind: 'voice' });
264
264
  }
265
+ /**
266
+ * A node's layout at a canvas position — the short form of a {@link NodeLayout}
267
+ * for the `nodes` map of {@link FlowBuilder.layout}.
268
+ *
269
+ * @remarks
270
+ * Positions are canvas pixels. A child's position inside a container is relative
271
+ * to that container, as the designer stores it; the body of a loop starts inside
272
+ * the container's padding, at `at(144, 96)`. The size, {@link dim}, is needed by
273
+ * a container and by an inline agent; every other node is 96 × 96.
274
+ *
275
+ * @example
276
+ * **Lay out a main path on one row, with a side path below it**
277
+ * ```ts
278
+ * .layout({
279
+ * nodes: {
280
+ * start: at(256, 144), fetch: at(448, 144), eachItem: at(640, 144, dim(576, 320)),
281
+ * handle: at(144, 96), // inside eachItem, relative to it
282
+ * done: at(1312, 144),
283
+ * onFailure: at(448, 304),
284
+ * },
285
+ * })
286
+ * ```
287
+ *
288
+ * @param x - The node's left edge on the canvas.
289
+ * @param y - The node's top edge on the canvas.
290
+ * @param size - The node's size; omit to keep compile's 96 × 96.
291
+ * @returns A {@link NodeLayout} to put in `.layout({ nodes })`.
292
+ */
293
+ export function at(x, y, size) {
294
+ return size ? { position: { x, y }, size } : { position: { x, y } };
295
+ }
296
+ /**
297
+ * A node's size on the canvas, in pixels — the third argument of {@link at}.
298
+ *
299
+ * @remarks
300
+ * Compile writes 96 × 96 on every node and the designer draws the persisted
301
+ * size, so a node whose canvas shape is larger needs one: a container (a loop
302
+ * or a do-while body, drawn as a box around its children; `format` makes it
303
+ * 560 × 320) and an inline agent (`dim(288, 96)`). Every other node is 96 × 96
304
+ * and needs none.
305
+ *
306
+ * @example
307
+ * **A loop wide enough for a three-step body, then an inline agent**
308
+ * ```ts
309
+ * .layout({
310
+ * nodes: { eachItem: at(640, 144, dim(768, 320)), review: at(1504, 144, dim(288, 96)) },
311
+ * })
312
+ * ```
313
+ *
314
+ * @param width - The node's width.
315
+ * @param height - The node's height.
316
+ * @returns The `size` of a {@link NodeLayout}.
317
+ */
318
+ export function dim(width, height) {
319
+ return { width, height };
320
+ }
265
321
  /**
266
322
  * The designer's sticky-note palette. Any other string is passed through — the
267
323
  * `.flow` format stores `inputs.color` unvalidated — but these five are what the
@@ -952,6 +1008,22 @@ class FlowBuilder extends StepList {
952
1008
  * the serializer's default arrangement. Unknown keys fail compilation rather
953
1009
  * than being dropped.
954
1010
  *
1011
+ * Without a layout, compile places every node on one row in emission order,
1012
+ * which reads badly in the designer once a flow has a branch, an error path or
1013
+ * a loop. {@link at} writes a node's entry from two numbers, and {@link dim}
1014
+ * a container's size from two more.
1015
+ *
1016
+ * @example
1017
+ * **Main path on one row, the error handler on the row below**
1018
+ * ```ts
1019
+ * .layout({
1020
+ * nodes: {
1021
+ * start: at(256, 144), load: at(448, 144), save: at(640, 144), done: at(832, 144),
1022
+ * report: at(448, 304), end: at(640, 304),
1023
+ * },
1024
+ * })
1025
+ * ```
1026
+ *
955
1027
  * @param layout - Node layout by step name, edge routes by `"from->to"`.
956
1028
  * @returns This builder, so calls chain.
957
1029
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uipath/maestro-builder-sdk",
3
- "version": "6.35.1",
3
+ "version": "6.36.1",
4
4
  "description": "Build UiPath Flow, Case, and BPMN artifacts by writing TypeScript.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://docs.uipath.com/maestro",
@@ -93,5 +93,5 @@
93
93
  "@types/node": "^22.7.0",
94
94
  "esbuild": "^0.28.1"
95
95
  },
96
- "gitref": "cd7797fa2a6443158edfc8920b2e764e34ac6e71"
96
+ "gitref": "ede4fb3b6b1911bfc170114e086299b28a413d71"
97
97
  }