@uipath/maestro-builder-sdk 6.66.12 → 6.66.13
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/case/serialize.d.ts +7 -0
- package/dist/case/serialize.js +52 -14
- package/package.json +2 -2
package/dist/case/serialize.d.ts
CHANGED
|
@@ -48,3 +48,10 @@ export declare function applyPreservation(result: Record<string, unknown>, prese
|
|
|
48
48
|
* the payload does not.
|
|
49
49
|
*/
|
|
50
50
|
export declare function followRenames(result: Record<string, unknown>, preservation: CaseJsonPreservation): CaseJsonPreservation;
|
|
51
|
+
/**
|
|
52
|
+
* Rename ids in one string: the whole value, or a whole id inside it, bounded
|
|
53
|
+
* by characters that cannot be part of an id (`"Stage_A-tB"`, `"=vars.vSlot"`).
|
|
54
|
+
* `trigger_1` does not match inside `trigger_10` or `trigger_1_x`. One pass, so
|
|
55
|
+
* a replacement is never replaced again.
|
|
56
|
+
*/
|
|
57
|
+
export declare function idRenamer(renames: ReadonlyMap<string, string>): (value: string) => string;
|
package/dist/case/serialize.js
CHANGED
|
@@ -711,6 +711,15 @@ function applyPreservedIdentities(result, preservation) {
|
|
|
711
711
|
const identities = preservation.identities;
|
|
712
712
|
if (!identities)
|
|
713
713
|
return;
|
|
714
|
+
// Two kinds of id are restored:
|
|
715
|
+
// - an ELEMENT id (case, trigger, stage, task, condition, rule, SLA,
|
|
716
|
+
// escalation, root variable) is unique in the plan and other elements point
|
|
717
|
+
// at it (`elementId: "<stageId>-<taskId>"`, `exitToStageId`). `take` records
|
|
718
|
+
// the rename and `rewrite` follows it through the plan.
|
|
719
|
+
// - an io ROW id (a task's or a rule's `inputs[]` / `outputs[]` row) is only
|
|
720
|
+
// spelled by its own row, and the generated value repeats across owners:
|
|
721
|
+
// every subscription body row is `vbody`. `takeRow` renames inside that one
|
|
722
|
+
// row and never adds to the plan-wide map.
|
|
714
723
|
const replacements = new Map();
|
|
715
724
|
const take = (current, wanted) => {
|
|
716
725
|
if (!current || !wanted || typeof current.id !== 'string')
|
|
@@ -718,6 +727,25 @@ function applyPreservedIdentities(result, preservation) {
|
|
|
718
727
|
replacements.set(current.id, wanted);
|
|
719
728
|
current.id = wanted;
|
|
720
729
|
};
|
|
730
|
+
// Applied after `rewrite`, so a preserved row id is never itself rewritten.
|
|
731
|
+
const rowRenames = [];
|
|
732
|
+
const takeRow = (row, wanted, output) => {
|
|
733
|
+
if (!row || !wanted || typeof row.id !== 'string' || row.id === wanted)
|
|
734
|
+
return;
|
|
735
|
+
const was = row.id;
|
|
736
|
+
row.id = wanted;
|
|
737
|
+
rowRenames.push(() => {
|
|
738
|
+
if (row.var === was)
|
|
739
|
+
row.var = wanted;
|
|
740
|
+
if (row.originalVar === was)
|
|
741
|
+
row.originalVar = wanted;
|
|
742
|
+
if (row.target === `=${was}`)
|
|
743
|
+
row.target = `=${wanted}`;
|
|
744
|
+
// An input row's `value` is the value passed in, never its own id.
|
|
745
|
+
if (output && row.value === was)
|
|
746
|
+
row.value = wanted;
|
|
747
|
+
});
|
|
748
|
+
};
|
|
721
749
|
const nodes = result.nodes;
|
|
722
750
|
const stages = nodes.filter((node) => String(node.type).endsWith('Stage'));
|
|
723
751
|
const bagField = CASE_FORMAT_PROFILE.waitConnectorRuleBagField;
|
|
@@ -762,14 +790,11 @@ function applyPreservedIdentities(result, preservation) {
|
|
|
762
790
|
return;
|
|
763
791
|
if (target && typeof row.id === 'string' && row.id !== currentId && heldOutputIds.has(row.id))
|
|
764
792
|
return;
|
|
765
|
-
|
|
793
|
+
takeRow(target, row.id, true);
|
|
766
794
|
if (target && typeof row.id === 'string' && typeof currentId === 'string') {
|
|
767
795
|
heldOutputIds.delete(currentId);
|
|
768
796
|
heldOutputIds.add(row.id);
|
|
769
797
|
}
|
|
770
|
-
if (typeof currentId === 'string' && typeof row.id === 'string' && target?.value === currentId) {
|
|
771
|
-
target.value = row.id;
|
|
772
|
-
}
|
|
773
798
|
});
|
|
774
799
|
};
|
|
775
800
|
const takeConditions = (current, wanted) => {
|
|
@@ -804,7 +829,7 @@ function applyPreservedIdentities(result, preservation) {
|
|
|
804
829
|
const task = stageTask(stage, taskIdentity.name);
|
|
805
830
|
take(task, taskIdentity.id);
|
|
806
831
|
takeConditions(task?.entryConditions, taskIdentity.entryConditions);
|
|
807
|
-
(taskIdentity.inputs ?? []).forEach((row, index) =>
|
|
832
|
+
(taskIdentity.inputs ?? []).forEach((row, index) => takeRow(task?.data?.inputs?.[index], row.id, false));
|
|
808
833
|
takeOutputRows(task?.data?.outputs ?? [], taskIdentity.outputs ?? []);
|
|
809
834
|
}));
|
|
810
835
|
}
|
|
@@ -818,15 +843,7 @@ function applyPreservedIdentities(result, preservation) {
|
|
|
818
843
|
return;
|
|
819
844
|
take(variables[lane]?.find((candidate) => candidate.name === row.name), row.id);
|
|
820
845
|
});
|
|
821
|
-
const
|
|
822
|
-
const replace = (value) => {
|
|
823
|
-
if (replacements.has(value))
|
|
824
|
-
return replacements.get(value);
|
|
825
|
-
let replaced = value;
|
|
826
|
-
for (const [current, wanted] of longestFirst)
|
|
827
|
-
replaced = replaced.replaceAll(current, wanted);
|
|
828
|
-
return replaced;
|
|
829
|
-
};
|
|
846
|
+
const replace = idRenamer(replacements);
|
|
830
847
|
// Every field that carries an id GENERATED by this serialize pass has to be
|
|
831
848
|
// rewritten when preservation renames the node that id belongs to. Missing one
|
|
832
849
|
// leaves a reference pointing at an id nothing has any more.
|
|
@@ -888,6 +905,8 @@ function applyPreservedIdentities(result, preservation) {
|
|
|
888
905
|
rewrite(result);
|
|
889
906
|
for (const { row, source } of preservedOutputSources)
|
|
890
907
|
row.source = source;
|
|
908
|
+
for (const rename of rowRenames)
|
|
909
|
+
rename();
|
|
891
910
|
// An id hashed from a generated element id is re-minted from the preserved one,
|
|
892
911
|
// wherever it is spelled, including inside a `=jsonString:` configuration.
|
|
893
912
|
const reseeded = new Map();
|
|
@@ -899,6 +918,25 @@ function applyPreservedIdentities(result, preservation) {
|
|
|
899
918
|
if (reseeded.size)
|
|
900
919
|
reseed(result, reseeded);
|
|
901
920
|
}
|
|
921
|
+
/**
|
|
922
|
+
* Rename ids in one string: the whole value, or a whole id inside it, bounded
|
|
923
|
+
* by characters that cannot be part of an id (`"Stage_A-tB"`, `"=vars.vSlot"`).
|
|
924
|
+
* `trigger_1` does not match inside `trigger_10` or `trigger_1_x`. One pass, so
|
|
925
|
+
* a replacement is never replaced again.
|
|
926
|
+
*/
|
|
927
|
+
export function idRenamer(renames) {
|
|
928
|
+
const longestFirst = [...renames.keys()].sort((a, b) => b.length - a.length);
|
|
929
|
+
const asPattern = (id) => id.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
930
|
+
const token = longestFirst.length
|
|
931
|
+
? new RegExp(`(?<![\\w$])(?:${longestFirst.map(asPattern).join('|')})(?![\\w$])`, 'g')
|
|
932
|
+
: undefined;
|
|
933
|
+
return (value) => {
|
|
934
|
+
const whole = renames.get(value);
|
|
935
|
+
if (whole !== undefined)
|
|
936
|
+
return whole;
|
|
937
|
+
return token ? value.replace(token, (id) => renames.get(id)) : value;
|
|
938
|
+
};
|
|
939
|
+
}
|
|
902
940
|
function reseed(value, ids) {
|
|
903
941
|
if (!value || typeof value !== 'object')
|
|
904
942
|
return;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uipath/maestro-builder-sdk",
|
|
3
|
-
"version": "6.66.
|
|
3
|
+
"version": "6.66.13",
|
|
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",
|
|
@@ -100,5 +100,5 @@
|
|
|
100
100
|
"@types/node": "^22.7.0",
|
|
101
101
|
"esbuild": "^0.28.1"
|
|
102
102
|
},
|
|
103
|
-
"gitref": "
|
|
103
|
+
"gitref": "5d85b66f664b911c9c92a92e66a50abcc022da3b"
|
|
104
104
|
}
|