@uipath/maestro-builder-sdk 6.124.18 → 6.125.0

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.
@@ -518,12 +518,16 @@ export interface CaseJsonPreservation {
518
518
  omitInputDefaults?: string[];
519
519
  /**
520
520
  * Metadata keys the serializer always writes that the source document did not
521
- * carry (only `caseAppEnabled`, `caseIdentifierType`, `publishVersion`,
522
- * `intsvcActivityConfig`).
523
- * Compile drops such a key while it still holds what the platform reads for
524
- * an absent one: the Case Designer's in-memory to canvas converter fills
521
+ * carry (`caseAppEnabled`, `caseIdentifierType`, `publishVersion`,
522
+ * `intsvcActivityConfig`), and the two task-exit flags of a document that has
523
+ * a `task-exited` rule without them. Compile drops such a key while it still
524
+ * holds what the platform reads for an absent one: the Case Designer's
525
+ * in-memory to canvas converter fills
525
526
  * `caseAppEnabled ?? true` and `caseIdentifierType ?? "constant"`, and
526
527
  * `publishVersion` is not authorable. A value the author changed is kept.
528
+ * The platform reads an absent task-exit flag as off, so the serializer does
529
+ * not imply a flag recorded here (`taskExitFlags`): the rule stays ignored
530
+ * until the source calls `.exitOnTaskFailure()` / `.taskExitRules()`.
527
531
  */
528
532
  omitMetadata?: PreservedMetadataKey[];
529
533
  /**
@@ -807,7 +811,7 @@ export declare function caseJsonPreservation(built: BuiltCase): CaseJsonPreserva
807
811
  export declare function preservedBindings(bindings: Bindings | undefined, payload: CaseJsonPreservation | undefined): Bindings | undefined;
808
812
  export declare function preservedBindings(bindings: BindingsView | undefined, payload: CaseJsonPreservation | undefined): BindingsView | undefined;
809
813
  /** A metadata key whose absence {@link CaseJsonPreservation.omitMetadata} records. */
810
- export type PreservedMetadataKey = 'caseAppEnabled' | 'caseIdentifierType' | 'publishVersion' | 'intsvcActivityConfig';
814
+ export type PreservedMetadataKey = 'caseAppEnabled' | 'caseIdentifierType' | 'publishVersion' | 'intsvcActivityConfig' | 'caseExecutionExitsOnTaskFailure' | 'caseExecutionUsesTaskExitRules';
811
815
  /**
812
816
  * @internal
813
817
  * What the platform reads for each {@link PreservedMetadataKey} the document
@@ -213,6 +213,8 @@ export const METADATA_ABSENT_READING = {
213
213
  // writes "v2" on a new case (intsvc-activity-config.ts): a plan saved with
214
214
  // none keeps none.
215
215
  intsvcActivityConfig: undefined,
216
+ caseExecutionExitsOnTaskFailure: false,
217
+ caseExecutionUsesTaskExitRules: false,
216
218
  };
217
219
  const TOP_LEVEL_KEYS = new Set([
218
220
  'id', 'name', 'description', 'version', 'bindings', 'variables', 'metadata', 'nodes', 'edges', 'layout',
@@ -221,6 +223,7 @@ const METADATA_KEYS = new Set([
221
223
  'caseIdentifier', 'caseIdentifierType', 'caseAppEnabled', 'publishVersion', 'caseExitRules', 'slaRules',
222
224
  'caseAppConfig', 'adhocCaseEndData',
223
225
  'allowAdhocOptionalStageTasks', 'waitForHumanSelectNextStageDFConnector', 'businessEvents',
226
+ 'caseExecutionExitsOnTaskFailure', 'caseExecutionUsesTaskExitRules',
224
227
  ]);
225
228
  const VARIABLE_KEYS = new Set([
226
229
  'id', 'name', 'type', 'default', 'body', '_jsonSchema', 'elementId', 'var',
@@ -22,6 +22,7 @@ const RULE_OPTIONS = {
22
22
  'wait-for-connector': ['connector'],
23
23
  'sla-status-change': ['sla', 'escalation'],
24
24
  'api-event': ['businessEvent'],
25
+ 'task-exited': ['tasks', 'exitReasons', 'errorCategories'],
25
26
  };
26
27
  /**
27
28
  * Report an unknown rule kind, or each option the rule's kind does not read.
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Every rule of a built case with the condition slot it sits in, in document
3
+ * order: each stage's entry conditions, exit conditions and its tasks' entry
4
+ * conditions, then the case exits. One traversal for the rules that need the
5
+ * slot (`check-task-exit.ts`) and for the serializer's flag resolution
6
+ * (`task-exit.ts`), so the two cannot disagree on what a case contains.
7
+ */
8
+ import type { BuiltCase, BuiltExitCondition, BuiltStage, BuiltTask, CaseRule } from './case-sdk.js';
9
+ export type RuleSlot = 'stage-entry' | 'stage-exit' | 'task-entry' | 'case-exit';
10
+ export interface RuleSite {
11
+ rule: CaseRule;
12
+ slot: RuleSlot;
13
+ /** Where `check` says it is: `stage "S" entry`, `stage "S" exit`, `task "T" entry` or `case-exit`. */
14
+ where: string;
15
+ stage?: BuiltStage;
16
+ /** The task whose entry holds the rule. */
17
+ task?: BuiltTask;
18
+ /** For a stage exit, the condition, whose `marksStageComplete` and `type` decide what the platform compiles there. */
19
+ exit?: BuiltExitCondition;
20
+ }
21
+ /** Every rule of `built`, with its slot. */
22
+ export declare function ruleSites(built: BuiltCase): Generator<RuleSite>;
@@ -0,0 +1,19 @@
1
+ /** Every rule of `built`, with its slot. */
2
+ export function* ruleSites(built) {
3
+ for (const stage of built.stages) {
4
+ const at = `stage "${stage.label}"`;
5
+ for (const c of stage.entry)
6
+ for (const rule of c.rules.flat())
7
+ yield { rule, slot: 'stage-entry', where: `${at} entry`, stage };
8
+ for (const c of stage.exit)
9
+ for (const rule of c.rules.flat())
10
+ yield { rule, slot: 'stage-exit', where: `${at} exit`, stage, exit: c };
11
+ for (const task of stage.lanes.flat())
12
+ for (const c of task.entry)
13
+ for (const rule of c.rules.flat())
14
+ yield { rule, slot: 'task-entry', where: `task "${task.name}" entry`, stage, task };
15
+ }
16
+ for (const c of built.caseExit)
17
+ for (const rule of c.rules.flat())
18
+ yield { rule, slot: 'case-exit', where: 'case-exit' };
19
+ }
@@ -33,6 +33,8 @@ import { ownEntry } from '../core/own-entry.js';
33
33
  import { stableId } from '../core/stable-id.js';
34
34
  import { resolveSchemaVersion } from '../schema-version.js';
35
35
  import { CASE_NODE_LAYOUT_FIELDS, caseJsonPreservation, caseJsonPreservationErrors, filterLeafKey, preservedBindings, preservedLeafKey, } from './preserve.js';
36
+ import { TASK_ERROR_CATEGORIES, TASK_EXIT_REASONS } from './case-sdk.js';
37
+ import { taskExitFlags } from './task-exit.js';
36
38
  import { businessEventProblems } from './business-event-shape.js';
37
39
  import { eventFiltersNotArray, readEventFilter, readEventFilterLeaf, eventFilterTreeLeaf } from '../core/event-filters.js';
38
40
  import { responseJsonSchema } from '../core/connector-response-schema.js';
@@ -332,6 +334,12 @@ function serializeCase(built, opts) {
332
334
  if (built.allowAdhocOptionalStageTasks !== undefined) {
333
335
  metadata.allowAdhocOptionalStageTasks = built.allowAdhocOptionalStageTasks;
334
336
  }
337
+ // A `task-exited` rule turns both flags on unless the author set one (task-exit.ts).
338
+ const taskExit = taskExitFlags(built);
339
+ if (taskExit.exitOnTaskFailure !== undefined)
340
+ metadata.caseExecutionExitsOnTaskFailure = taskExit.exitOnTaskFailure;
341
+ if (taskExit.taskExitRules !== undefined)
342
+ metadata.caseExecutionUsesTaskExitRules = taskExit.taskExitRules;
335
343
  const selectNextStage = built.stages.flatMap((stage) => stage.exit)
336
344
  .filter((exit) => exit.selectNextStage !== undefined);
337
345
  if (selectNextStage.length > 1)
@@ -4400,14 +4408,30 @@ function emitRule(r, seed, ownerId, ids, resolver, site) {
4400
4408
  // No `tasks` writes no `selectedTasksIds`, as Studio Web saves a rule gated
4401
4409
  // by its expression alone; the platform reads an absent list as an empty one
4402
4410
  // (its converter takes `selectedTasksIds ?? []`). `tasks: []` writes `[]`.
4403
- if (r.rule === 'selected-tasks-completed' && r.tasks !== undefined) {
4411
+ if ((r.rule === 'selected-tasks-completed' || r.rule === 'task-exited') && r.tasks !== undefined) {
4404
4412
  out.selectedTasksIds = r.tasks.map((n) => {
4405
4413
  const tid = resolver.taskIdByKey.get(n);
4406
4414
  if (!tid)
4407
- throw new CompileRefusal('UNKNOWN_TASK_REF', `rule "selected-tasks-completed" references unknown task "${n}".`);
4415
+ throw new CompileRefusal('UNKNOWN_TASK_REF', `rule "${r.rule}" references unknown task "${n}".`);
4408
4416
  return tid;
4409
4417
  });
4410
4418
  }
4419
+ if (r.rule === 'task-exited') {
4420
+ // Both filters are closed enums in the schema; a value outside them fails
4421
+ // `validate` as an invalid enum value, so refuse it with the vocabulary.
4422
+ const closed = (values, allowed, field, code) => {
4423
+ const unknown = (values ?? []).find((value) => !allowed.includes(value));
4424
+ if (unknown !== undefined)
4425
+ throw new CompileRefusal(code, `rule "task-exited" in ${site} has ${field} ${JSON.stringify(unknown)}; the ${field} are ${allowed.map((v) => `'${v}'`).join(', ')}.`);
4426
+ };
4427
+ closed(r.exitReasons, TASK_EXIT_REASONS, 'exitReasons', 'TASK_EXITED_REASON_UNKNOWN');
4428
+ closed(r.errorCategories, TASK_ERROR_CATEGORIES, 'errorCategories', 'TASK_EXITED_CATEGORY_UNKNOWN');
4429
+ // Written as authored, an empty list included, so a decompiled rule compiles back to the same bytes.
4430
+ if (r.exitReasons !== undefined)
4431
+ out.exitReasons = [...r.exitReasons];
4432
+ if (r.errorCategories !== undefined)
4433
+ out.errorCategories = [...r.errorCategories];
4434
+ }
4411
4435
  if (r.rule === 'case-entered' && r.triggers !== undefined) {
4412
4436
  // Absent means any trigger; a list narrows the rule to those triggers.
4413
4437
  out.selectedTriggerIds = r.triggers.map((t, i) => {
@@ -0,0 +1,32 @@
1
+ /**
2
+ * The task-exit feature's case flags, resolved in one place for `serialize`
3
+ * (which writes them) and `check` (which reads them).
4
+ *
5
+ * A `task-exited` rule reacts to a task ending without completing. The
6
+ * platform's converter lowers it only when the case root carries BOTH
7
+ * `caseExecutionExitsOnTaskFailure: true` (a failing task exits instead of
8
+ * faulting the case) and `caseExecutionUsesTaskExitRules: true` (the rules
9
+ * react to exits); with either off the rule is written and silently ignored
10
+ * (`uip maestro case validate` warns CASE_MGMT_CASE_CONDITION_RULE_TASK_EXITED_IGNORED).
11
+ * So a case that has such a rule gets both flags unless the author set one
12
+ * explicitly ({@link CaseBuilder.exitOnTaskFailure}, {@link CaseBuilder.taskExitRules}).
13
+ */
14
+ import type { BuiltCase } from './case-sdk.js';
15
+ /** True when any condition of the case holds a `task-exited` rule. */
16
+ export declare function usesTaskExitRules(built: BuiltCase): boolean;
17
+ /** The two flags as the caseplan carries them; an absent key is not written. */
18
+ export interface TaskExitFlags {
19
+ exitOnTaskFailure?: boolean;
20
+ taskExitRules?: boolean;
21
+ }
22
+ /**
23
+ * The flags the caseplan gets: what the author declared, else `true` for both
24
+ * when the case has a `task-exited` rule, else nothing. A decompiled source
25
+ * whose document had the rule without a flag records that
26
+ * (`CaseJsonPreservation.omitMetadata`), and the flag is then not implied: the
27
+ * platform read it as off, so compile does not turn the rule on.
28
+ *
29
+ * @param built - The case as built.
30
+ * @returns The flags to write, each present only when it has a value.
31
+ */
32
+ export declare function taskExitFlags(built: BuiltCase): TaskExitFlags;
@@ -0,0 +1,29 @@
1
+ import { caseJsonPreservation } from './preserve.js';
2
+ import { ruleSites } from './rule-sites.js';
3
+ /** True when any condition of the case holds a `task-exited` rule. */
4
+ export function usesTaskExitRules(built) {
5
+ for (const { rule } of ruleSites(built))
6
+ if (rule.rule === 'task-exited')
7
+ return true;
8
+ return false;
9
+ }
10
+ /**
11
+ * The flags the caseplan gets: what the author declared, else `true` for both
12
+ * when the case has a `task-exited` rule, else nothing. A decompiled source
13
+ * whose document had the rule without a flag records that
14
+ * (`CaseJsonPreservation.omitMetadata`), and the flag is then not implied: the
15
+ * platform read it as off, so compile does not turn the rule on.
16
+ *
17
+ * @param built - The case as built.
18
+ * @returns The flags to write, each present only when it has a value.
19
+ */
20
+ export function taskExitFlags(built) {
21
+ const absent = caseJsonPreservation(built)?.omitMetadata ?? [];
22
+ const implied = (key) => usesTaskExitRules(built) && !absent.includes(key) ? true : undefined;
23
+ const exitOnTaskFailure = built.exitOnTaskFailure ?? implied('caseExecutionExitsOnTaskFailure');
24
+ const taskExitRules = built.taskExitRules ?? implied('caseExecutionUsesTaskExitRules');
25
+ return {
26
+ ...(exitOnTaskFailure !== undefined ? { exitOnTaskFailure } : {}),
27
+ ...(taskExitRules !== undefined ? { taskExitRules } : {}),
28
+ };
29
+ }
@@ -817,6 +817,13 @@ export declare const REFUSALS: {
817
817
  readonly SWITCH_NO_CASES: "lint";
818
818
  readonly SWITCH_ON_UNUSED: "lint";
819
819
  readonly TASK_ENTRY_POINT_INCOMPLETE: "lowering";
820
+ readonly TASK_EXITED_CATEGORY_UNKNOWN: "lowering";
821
+ readonly TASK_EXITED_FILTER_IGNORED: "lint";
822
+ readonly TASK_EXITED_IGNORED: "lint";
823
+ readonly TASK_EXITED_PLACEMENT: "lint";
824
+ readonly TASK_EXITED_REASON_UNKNOWN: "lowering";
825
+ readonly TASK_EXITED_SELF_RERUN: "lint";
826
+ readonly TASK_EXITED_TASK_OUTSIDE_STAGE: "lint";
820
827
  readonly TASK_INPUTS_UNSUPPORTED: "lowering";
821
828
  readonly TASK_IO_TYPE: "lint";
822
829
  readonly TASK_IO_UNRESOLVED_REFERENCE: "lowering";
@@ -895,6 +895,13 @@ export const REFUSALS = {
895
895
  SWITCH_NO_CASES: 'lint',
896
896
  SWITCH_ON_UNUSED: 'lint',
897
897
  TASK_ENTRY_POINT_INCOMPLETE: 'lowering',
898
+ TASK_EXITED_CATEGORY_UNKNOWN: 'lowering',
899
+ TASK_EXITED_FILTER_IGNORED: 'lint',
900
+ TASK_EXITED_IGNORED: 'lint',
901
+ TASK_EXITED_PLACEMENT: 'lint',
902
+ TASK_EXITED_REASON_UNKNOWN: 'lowering',
903
+ TASK_EXITED_SELF_RERUN: 'lint',
904
+ TASK_EXITED_TASK_OUTSIDE_STAGE: 'lint',
898
905
  TASK_INPUTS_UNSUPPORTED: 'lowering',
899
906
  TASK_IO_TYPE: 'lint',
900
907
  TASK_IO_UNRESOLVED_REFERENCE: 'lowering',
@@ -33,7 +33,7 @@ interface RtFlow {
33
33
  /** One difference, or one inconsistency in the merged file. */
34
34
  export interface MergeFinding {
35
35
  /** Which comparison found it. */
36
- kind: 'node-removed' | 'node-added' | 'node-type' | 'implicit-end' | 'edge-handle-renamed' | 'edge-rewired' | 'edge-removed' | 'edge-added' | 'handle-ids' | 'binding-removed' | 'binding-added' | 'variable-added' | 'variable-changed' | 'undeclared-handle' | 'duplicate-binding' | 'agent-sidecar' | 'agent-storage' | 'agent-prompt-input' | 'agent-embedded-edit' | 'outputs-superseded' | 'entry-point-repaired' | 'extract-draft' | 'processor-provisioned' | 'taxonomy-ids-minted';
36
+ kind: 'node-removed' | 'node-added' | 'node-type' | 'implicit-end' | 'edge-handle-renamed' | 'edge-rewired' | 'edge-removed' | 'edge-added' | 'handle-ids' | 'binding-removed' | 'binding-added' | 'binding-closed' | 'variable-added' | 'variable-changed' | 'undeclared-handle' | 'duplicate-binding' | 'agent-sidecar' | 'agent-storage' | 'agent-prompt-input' | 'agent-embedded-edit' | 'outputs-superseded' | 'entry-point-repaired' | 'extract-draft' | 'processor-provisioned' | 'taxonomy-ids-minted';
37
37
  /** The finding, phrased for the author, naming the node, edge or row. */
38
38
  message: string;
39
39
  /**
@@ -41,8 +41,8 @@ export interface MergeFinding {
41
41
  * `binding-removed`, which leave the merged file doing what the original does,
42
42
  * for `agent-embedded-edit`, which reports what merge did not carry, for
43
43
  * `outputs-superseded`, which reports a declaration merge corrected, and for
44
- * `entry-point-repaired`, `processor-provisioned` and `taxonomy-ids-minted`,
45
- * which report a fix merge made.
44
+ * `entry-point-repaired`, `processor-provisioned`, `taxonomy-ids-minted` and
45
+ * `binding-closed`, which report a fix merge made.
46
46
  */
47
47
  refuses: boolean;
48
48
  /**
@@ -76,7 +76,7 @@ export interface MergeFinding {
76
76
  * `correctedVariables` are root `variables.nodes` ids merge rewrote on purpose
77
77
  * (merge-superseded-outputs.ts), so they are not reported as a rewrite here.
78
78
  */
79
- export declare function roundTripFindings(original: RtFlow, baseline: RtFlow, merged: RtFlow, correctedVariables?: ReadonlySet<string>): MergeFinding[];
79
+ export declare function roundTripFindings(original: RtFlow, baseline: RtFlow, merged: RtFlow, correctedVariables?: ReadonlySet<string>, closedBindings?: ReadonlySet<string>): MergeFinding[];
80
80
  /**
81
81
  * Inconsistencies in the merged file that come from mixing its sources: a root
82
82
  * edge leaving a handle its source node does not declare, and two binding rows
@@ -114,7 +114,7 @@ function bindingText(b) {
114
114
  * `correctedVariables` are root `variables.nodes` ids merge rewrote on purpose
115
115
  * (merge-superseded-outputs.ts), so they are not reported as a rewrite here.
116
116
  */
117
- export function roundTripFindings(original, baseline, merged, correctedVariables = new Set()) {
117
+ export function roundTripFindings(original, baseline, merged, correctedVariables = new Set(), closedBindings = new Set()) {
118
118
  const out = [];
119
119
  const origDefs = defsOf(original);
120
120
  const baseDefs = defsOf(baseline);
@@ -291,7 +291,7 @@ export function roundTripFindings(original, baseline, merged, correctedVariables
291
291
  }
292
292
  }
293
293
  for (const [k, r] of bRows) {
294
- if (!oRows.has(k) && mRows.has(k)) {
294
+ if (!oRows.has(k) && mRows.has(k) && !closedBindings.has(k)) {
295
295
  out.push({ kind: 'binding-added', refuses: true, message: `the round trip adds a binding row for ${bindingText(r)}; merge will write it.` });
296
296
  }
297
297
  }
package/dist/merge.d.ts CHANGED
@@ -131,6 +131,8 @@ export interface MergeOptions {
131
131
  * - a node output declaration or definition an older SDK wrote wrongly, which
132
132
  * merge replaced with the edited compile's (merge-superseded-outputs.ts);
133
133
  * never refused;
134
+ * - a connection binding row merge wrote for a node whose `<bindings.NAME>`
135
+ * the original left with no row (`binding-closed`); never refused;
134
136
  * - an edited agent whose original carries its prompts and model on the node
135
137
  * (embedded): merge keeps them and applies only the node change, so a prompt
136
138
  * or model edit in the source is not carried. Under `strict` it refuses a
package/dist/merge.js CHANGED
@@ -676,11 +676,15 @@ function mergeFlowFindings(original, edited, options) {
676
676
  // newly-added nodes come from `edited` while the original's stay intact.
677
677
  // A row the no-edit recompile minted only for nodes the merge kept from the
678
678
  // original, or for fields of an edited node the edit did not change, is
679
- // not carried (#1133). ──
679
+ // not carried (#1133), unless it closes a placeholder the original left
680
+ // open (UV-18367). ──
680
681
  result.bindings = mergeBindings(original.bindings, edited.bindings);
681
- result.bindings = withoutRowsMintedForKeptNodes(result.bindings, original, edited, options.baseline, keptFromOriginal, fieldwise);
682
+ const closedRows = new Map();
683
+ result.bindings = withoutRowsMintedForKeptNodes(result.bindings, original, edited, options.baseline, keptFromOriginal, fieldwise, closedRows);
682
684
  result.bindings = withoutSupersededAppRows(result.bindings, originalNodes, allNodes);
683
685
  result.bindings = withoutStaleConnectionRows(result.bindings, originalNodes, allNodes);
686
+ const writtenRows = new Set((result.bindings ?? []).map(bindingIdentity));
687
+ const bindingRepairs = [...closedRows].filter(([identity]) => writtenRows.has(identity)).map(([, f]) => f);
684
688
  // metadata / solutionId / projectId / layout / runtime were carried by the
685
689
  // initial clone of `original` and are intentionally left untouched, apart
686
690
  // from the `layout.nodes` entries of removed nodes (dropped above) and added
@@ -710,8 +714,9 @@ function mergeFlowFindings(original, edited, options) {
710
714
  const findings = [
711
715
  ...drafts.discarded,
712
716
  ...superseded.findings,
713
- ...(options.baseline ? roundTripFindings(original, options.baseline, result, superseded.rootVariables) : []),
717
+ ...(options.baseline ? roundTripFindings(original, options.baseline, result, superseded.rootVariables, new Set(closedRows.keys())) : []),
714
718
  ...entryPointRepairs,
719
+ ...bindingRepairs,
715
720
  ...processorRepairs,
716
721
  ...taxonomyRepairs,
717
722
  ...mergedFileFindings(result, original),
@@ -1106,6 +1111,14 @@ function withoutStaleConnectionRows(rows, originalNodes, mergedNodes) {
1106
1111
  * which is in `keptFromOriginal`: the kept node is the original's, which reaches
1107
1112
  * its resource without that row.
1108
1113
  *
1114
+ * Except a keyed connection row whose `<bindings.NAME>` the original node itself
1115
+ * spells (in the node, or in the original's definition of its type) when no
1116
+ * original row of that name closes it, by the same key or by a key the original
1117
+ * node spells: the original left the placeholder open, and dropping the row
1118
+ * would leave it open (UV-18367). A `""`-keyed row binds nothing, so it is
1119
+ * still dropped. Each row kept this way goes into `closed` as a
1120
+ * `binding-closed` finding.
1121
+ *
1109
1122
  * Examples:
1110
1123
  * - A classic-CLI IxP extract carries its model inline and has no rows. It
1111
1124
  * decompiles to `ixpExtract(...)`, whose compile mints `ixpDeployment` rows
@@ -1134,7 +1147,7 @@ function withoutStaleConnectionRows(rows, originalNodes, mergedNodes) {
1134
1147
  * with its id is referenced by a kept node (the recompile resolved a label stub
1135
1148
  * for a node the merge discarded).
1136
1149
  */
1137
- function withoutRowsMintedForKeptNodes(rows, original, edited, baseline, keptFromOriginal, fieldwise) {
1150
+ function withoutRowsMintedForKeptNodes(rows, original, edited, baseline, keptFromOriginal, fieldwise, closed) {
1138
1151
  if (!baseline || !rows || (keptFromOriginal.size === 0 && fieldwise.size === 0))
1139
1152
  return rows;
1140
1153
  const contextByType = new Map();
@@ -1143,7 +1156,17 @@ function withoutRowsMintedForKeptNodes(rows, original, edited, baseline, keptFro
1143
1156
  continue;
1144
1157
  contextByType.set(d.nodeType, (contextByType.get(d.nodeType) ?? '') + JSON.stringify(d.model.context));
1145
1158
  }
1146
- const describe = (n, kept, changed) => ({ kept, changed, text: JSON.stringify(n) + (contextByType.get(n.type) ?? '') });
1159
+ const describe = (n, kept, changed) => ({ id: n.id, kept, changed, text: JSON.stringify(n) + (contextByType.get(n.type) ?? '') });
1160
+ const originalContextByType = new Map();
1161
+ for (const d of (original.definitions ?? [])) {
1162
+ if (typeof d?.nodeType !== 'string' || d.model?.context === undefined)
1163
+ continue;
1164
+ originalContextByType.set(d.nodeType, (originalContextByType.get(d.nodeType) ?? '') + JSON.stringify(d.model.context));
1165
+ }
1166
+ const originalText = new Map();
1167
+ for (const n of original.nodes ?? []) {
1168
+ originalText.set(n.id, JSON.stringify(n) + (originalContextByType.get(n.type) ?? ''));
1169
+ }
1147
1170
  const nodes = [
1148
1171
  ...(edited.nodes ?? []).map((n) => describe(n, keptFromOriginal.has(n.id), fieldwise.has(n.id) ? JSON.stringify(fieldwise.get(n.id) ?? {}) : undefined)),
1149
1172
  ...Object.values(edited.subflows ?? {}).flatMap((sf) => (sf?.nodes ?? []).map((n) => describe(n, false))),
@@ -1181,6 +1204,24 @@ function withoutRowsMintedForKeptNodes(rows, original, edited, baseline, keptFro
1181
1204
  return !counterpart || !nodes.some((n) => n.kept && refersTo(counterpart, originalRows, n.text));
1182
1205
  }
1183
1206
  const needs = (n) => !n.kept && (n.changed === undefined || references(n.changed));
1184
- return !(referencers.length > 0 && !referencers.some(needs));
1207
+ const openInOriginal = (n) => {
1208
+ const text = originalText.get(n.id);
1209
+ if (b.resource !== 'connection' || keyOf(b) === '' || text === undefined || typeof b.name !== 'string')
1210
+ return false;
1211
+ if (!text.includes(spelled(`<bindings.${b.name}>`)))
1212
+ return false;
1213
+ return !originalRows.some((o) => o.name === b.name
1214
+ && (keyOf(o) === keyOf(b) || (keyOf(o) !== '' && text.includes(spelled(keyOf(o))))));
1215
+ };
1216
+ if (referencers.length === 0 || referencers.some(needs))
1217
+ return true;
1218
+ const opener = referencers.find(openInOriginal);
1219
+ if (!opener)
1220
+ return false;
1221
+ closed.set(identity, {
1222
+ kind: 'binding-closed', refuses: false,
1223
+ message: `node "${opener.id}" spells <bindings.${String(b.name)}> but the original has no binding row for it, so Studio Web refuses to publish the flow; merge writes the row for connection "${keyOf(b)}" ${String(b.propertyAttribute ?? b.name)}.`,
1224
+ });
1225
+ return true;
1185
1226
  });
1186
1227
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uipath/maestro-builder-sdk",
3
- "version": "6.124.18",
3
+ "version": "6.125.0",
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",
@@ -128,5 +128,5 @@
128
128
  "@types/node": "^22.7.0",
129
129
  "esbuild": "^0.28.1"
130
130
  },
131
- "gitref": "ee27233f8a6142eb8d89ce7c3824aa8c0697fe5f"
131
+ "gitref": "a7c0d60ab1441707d26a15b4c491b12fac27467a"
132
132
  }