@uipath/maestro-builder-sdk 6.15.4 → 6.15.6

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/serialize.js CHANGED
@@ -16,7 +16,6 @@ import { connectorRawNodeRefusal } from './core/connector-raw-node.js';
16
16
  import { dataFabricUnknownInputs } from './core/typed-raw-node.js';
17
17
  import { isAnswerField } from './core/hitl-answers.js';
18
18
  import { connectionConnectors } from './bindings-v2.js';
19
- import { globalNameCollisionMessage, globalNameCollisions } from './core/global-names.js';
20
19
  import { BindingRefusal, GUID_RE, bindingMissingMessage, bindingSelfNameMessage, bindingUndeclaredMessage, missingBindingLabels, undeclaredBinding } from './core/binding-messages.js';
21
20
  import { ByoaRefusal, byoaUnverified } from './core/byoa.js';
22
21
  import { OUTCOME_HANDLE_NODE_TYPES, assertHitlExitInvariant, hitlExitModel, hitlExitViolation, outcomeSlug } from './core/hitl-routing.js';
@@ -46,6 +45,7 @@ import { declaredScriptShape, inferScriptShape } from './core/script-return.js';
46
45
  import { migrateToSchemaVersion } from './migrate.js';
47
46
  import { FLOW_SCHEMA_VERSIONS } from './format-profile.js';
48
47
  import { resolveSchemaVersion } from './schema-version.js';
48
+ import { planFlowGlobals } from './flow-variables.js';
49
49
  import { prepareCommand } from './core/cli-spelling.js';
50
50
  import { QUEUE_ITEM_RECORD_SCHEMA } from './core/queue-record.js';
51
51
  const HERE = dirname(fileURLToPath(import.meta.url));
@@ -3485,12 +3485,6 @@ function refuseUnverifiedByoa(opts, where, sub) {
3485
3485
  if (message)
3486
3486
  throw new ByoaRefusal(message);
3487
3487
  }
3488
- /** Refuse a name declared twice across `.input()` / `.output()` / `.var()` — one `variables.globals[]` id each. */
3489
- function refuseGlobalNameCollisions(inputs, outputs, vars) {
3490
- const [first] = globalNameCollisions(inputs, outputs, vars);
3491
- if (first)
3492
- throw new Error(globalNameCollisionMessage(first));
3493
- }
3494
3488
  /**
3495
3489
  * Refuse a connector-bound node (connector step, event trigger, `.entryPoint`
3496
3490
  * onEvent, `waitForEvent`) that names no `connection` or no `folder` label.
@@ -3957,6 +3951,24 @@ function misplacedLookupMessage(token) {
3957
3951
  `a lookup() must be the whole value of a connector input, or an element of an array input. ` +
3958
3952
  `Emitting it here would send a raw {"__lookup": …} object where the connector expects an id.`);
3959
3953
  }
3954
+ /**
3955
+ * The flow's declarations as the globals it will emit: a same-named `.output()`
3956
+ * and `.var()` folded into one `out` global (flow-builder-sdk#899), every other
3957
+ * repeated name refused. `check()` reports the same problems as
3958
+ * VARIABLE_NAME_COLLISION / OUTPUT_VAR_MISMATCH; this throws too, so a path that skips the static pass
3959
+ * (`compile --no-check`, `emitFlow`, a direct `serialize()`) cannot write a
3960
+ * file `flow validate` rejects for a duplicate variable id.
3961
+ */
3962
+ function emittableGlobals(built, where) {
3963
+ // Entry-point inputs are rows of the same globals[], so they share the
3964
+ // namespace; `check` reports those as ENTRY_POINT_INPUT_COLLISION.
3965
+ const inputs = [...built.inputs, ...(built.entryPoints ?? []).flatMap((ep) => ep.inputs)];
3966
+ const plan = planFlowGlobals({ inputs, outputs: built.outputs, vars: built.vars });
3967
+ if (plan.problems.length) {
3968
+ throw new Error(`${where}: ${plan.problems.map((p) => `[${p.code}] ${p.message}`).join(' ')}`);
3969
+ }
3970
+ return plan;
3971
+ }
3960
3972
  function newScope(outputs, vars = []) {
3961
3973
  return {
3962
3974
  nodes: [],
@@ -4280,7 +4292,8 @@ export function serialize(built, opts = {}) {
4280
4292
  */
4281
4293
  const sidecars = opts.sidecars ?? [];
4282
4294
  const subflows = {};
4283
- const root = newScope(built.outputs, built.vars);
4295
+ const rootGlobals = emittableGlobals(built, `flow "${built.id}"`);
4296
+ const root = newScope(rootGlobals.outputs, rootGlobals.vars);
4284
4297
  // `input('x')` lowers eagerly to `$vars.start.output.x` — `start` being the
4285
4298
  // trigger node's default id. When the flow renames the trigger, register that
4286
4299
  // rename so the SAME pass that rewrites step-name references rewrites these
@@ -4404,7 +4417,8 @@ export function serialize(built, opts = {}) {
4404
4417
  * a null. It is emitted here, always, so it cannot be forgotten.
4405
4418
  */
4406
4419
  function emitSubflowBody(child, nodeId) {
4407
- const scope = newScope(child.outputs, child.vars);
4420
+ const childGlobals = emittableGlobals(child, `subflow "${nodeId}"`);
4421
+ const scope = newScope(childGlobals.outputs, childGlobals.vars);
4408
4422
  // Claim this copy's node ids UP FRONT, so the rename map is complete before
4409
4423
  // the first expression renders. A child's step names are free the first
4410
4424
  // time it runs; if any of them is already taken — which is what a second
@@ -4443,13 +4457,12 @@ export function serialize(built, opts = {}) {
4443
4457
  for (const t of tails)
4444
4458
  addEdge(scope, t, endId);
4445
4459
  }
4446
- refuseGlobalNameCollisions(child.inputs, child.outputs, child.vars);
4447
4460
  const globals = [];
4448
4461
  for (const inp of child.inputs)
4449
4462
  globals.push({ id: inp.name, name: inp.name, direction: 'in', type: inp.type, triggerNodeId: startId, ...varMeta(inp) });
4450
- for (const o of child.outputs)
4463
+ for (const o of childGlobals.outputs)
4451
4464
  globals.push({ id: o.name, name: o.name, direction: 'out', type: o.type, ...varMeta(o) });
4452
- for (const vd of child.vars)
4465
+ for (const vd of childGlobals.vars)
4453
4466
  globals.push({ id: vd.name, name: vd.name, direction: 'inout', type: vd.type, ...varMeta(vd) });
4454
4467
  resolveRejoins(scope);
4455
4468
  assertHitlExitInvariant(scope.nodes, scope.edges);
@@ -6531,16 +6544,13 @@ export function serialize(built, opts = {}) {
6531
6544
  }
6532
6545
  }
6533
6546
  }
6534
- // Entry-point inputs are rows of the same globals[] (pushed below), so they
6535
- // share the namespace; `check` reports these as ENTRY_POINT_INPUT_COLLISION.
6536
- refuseGlobalNameCollisions([...built.inputs, ...entryPoints.flatMap((ep) => ep.inputs)], built.outputs, built.vars);
6537
6547
  const globals = [];
6538
6548
  const triggerNodeId = built.triggerId ?? 'start';
6539
6549
  for (const inp of built.inputs)
6540
6550
  globals.push({ id: inp.name, name: inp.name, direction: 'in', type: inp.type, triggerNodeId, ...varMeta(inp) });
6541
- for (const o of built.outputs)
6551
+ for (const o of rootGlobals.outputs)
6542
6552
  globals.push({ id: o.name, name: o.name, direction: 'out', type: o.type, ...varMeta(o) });
6543
- for (const vd of built.vars)
6553
+ for (const vd of rootGlobals.vars)
6544
6554
  globals.push({ id: vd.name, name: vd.name, direction: 'inout', type: vd.type, ...varMeta(vd) });
6545
6555
  for (const ep of entryPoints) {
6546
6556
  for (const inp of ep.inputs) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uipath/maestro-builder-sdk",
3
- "version": "6.15.4",
3
+ "version": "6.15.6",
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",
@@ -92,5 +92,5 @@
92
92
  "@types/node": "^22.7.0",
93
93
  "esbuild": "^0.28.1"
94
94
  },
95
- "gitref": "37cc4f8cdcd0cfae5ec65c17d389c762e74f4a7c"
95
+ "gitref": "d8d72580682f02833d28d720ee382ffe9d346f6e"
96
96
  }