@uipath/maestro-builder-sdk 6.86.14 → 6.86.16
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/case-expr-check.d.ts +24 -0
- package/dist/case/case-expr-check.js +15 -4
- package/dist/case/decompile-cli.js +20 -10
- package/dist/case/decompile.d.ts +1 -1
- package/dist/case/decompile.js +87 -0
- package/dist/case/serialize.js +11 -1
- package/dist/cli/commands/case.js +3 -0
- package/dist/core/library.d.ts +6 -0
- package/dist/core/library.js +35 -21
- package/package.json +2 -2
|
@@ -22,12 +22,36 @@ import type { BuiltCase } from './case-sdk.js';
|
|
|
22
22
|
export interface CaseLocatedDiagnostic extends ExprDiagnostic {
|
|
23
23
|
where: string;
|
|
24
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* The undeclared `vars.<root>` names `expr` reads, as `build()` reports them
|
|
27
|
+
* (`EXPR_UNDECLARED_REF`). A task-output reference stands in as a declared root.
|
|
28
|
+
* For decompile, which refuses such a gate by name rather than writing source
|
|
29
|
+
* compile refuses.
|
|
30
|
+
*/
|
|
31
|
+
export declare function undeclaredVarReads(expr: string, roots: ReadonlySet<string>): string[];
|
|
25
32
|
/**
|
|
26
33
|
* The platform variable that says whether the stage labelled `label` has run
|
|
27
34
|
* (case-schema `baseLocalStageHasRunVariableInfoForStage`): `Stage 1` ->
|
|
28
35
|
* `stageHasRun_Stage_1`. Exported for the Case fuzzer's stage renames.
|
|
29
36
|
*/
|
|
30
37
|
export declare function stageHasRunVariable(label: string): string;
|
|
38
|
+
/**
|
|
39
|
+
* Variables the platform declares for every case, which a plan's gates may read
|
|
40
|
+
* though no row of the plan declares them. `uip maestro case validate` adds the
|
|
41
|
+
* same set to the variables it checks against (case-schema
|
|
42
|
+
* `validateCaseManagementVariables`), and the BPMN converter writes each one:
|
|
43
|
+
*
|
|
44
|
+
* - `stageHasRun_<stage label>` per stage (`getCaseStateVariables`), set in the
|
|
45
|
+
* initial variables setup and updated when the stage exits or completes. The
|
|
46
|
+
* platform's own V11->V12 migration writes gates on it:
|
|
47
|
+
* `=js:(vars.stageHasRun_Review != true)` for "first time this stage runs";
|
|
48
|
+
* - the hidden event-subprocess rows `tasksEventSubprocessResponse`,
|
|
49
|
+
* `mainEventSubprocessResponse`, `connectorResponse` and `eventMetadata`.
|
|
50
|
+
*
|
|
51
|
+
* Not here: the per-SLA `stageSla_<stage>_<sla id>` rows, whose ids compile
|
|
52
|
+
* mints after this check runs.
|
|
53
|
+
*/
|
|
54
|
+
export declare function platformVariables(stageLabels: readonly string[]): string[];
|
|
31
55
|
/** Every first-level expression problem in a built case, each stamped with its location. */
|
|
32
56
|
export declare function checkCaseExpressions(built: BuiltCase): CaseLocatedDiagnostic[];
|
|
33
57
|
/**
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* (`rule.stage` / `rule.tasks`) are a different thing and are checked by
|
|
16
16
|
* `case/check.ts`, not here.
|
|
17
17
|
*/
|
|
18
|
-
import { checkExpression } from '../core/expr-check.js';
|
|
18
|
+
import { checkExpression, extractRefs } from '../core/expr-check.js';
|
|
19
19
|
import { CompileRefusal } from '../core/compile-refusal.js';
|
|
20
20
|
import { readEventFilter } from '../core/event-filters.js';
|
|
21
21
|
import { defaultActionOutputVar } from './action-output-var.js';
|
|
@@ -77,6 +77,17 @@ function checkTaskOutputRefs(built, value, where, out) {
|
|
|
77
77
|
out.push({ level: 'error', code: 'TASK_OUTPUT_REF_UNRESOLVED', message: unresolvedTaskOutputRef(ref, why), where });
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
|
+
/**
|
|
81
|
+
* The undeclared `vars.<root>` names `expr` reads, as `build()` reports them
|
|
82
|
+
* (`EXPR_UNDECLARED_REF`). A task-output reference stands in as a declared root.
|
|
83
|
+
* For decompile, which refuses such a gate by name rather than writing source
|
|
84
|
+
* compile refuses.
|
|
85
|
+
*/
|
|
86
|
+
export function undeclaredVarReads(expr, roots) {
|
|
87
|
+
const lowered = lowerTaskOutputRefs(expr, () => TASK_OUTPUT_ROOT);
|
|
88
|
+
const scope = new Set([...roots, TASK_OUTPUT_ROOT]);
|
|
89
|
+
return [...new Set(extractRefs(lowered, NAMESPACE).map((ref) => ref.root).filter((root) => !scope.has(root)))];
|
|
90
|
+
}
|
|
80
91
|
function checkExpr(built, expr, where, roots, out) {
|
|
81
92
|
if (!expr)
|
|
82
93
|
return;
|
|
@@ -147,9 +158,9 @@ export function stageHasRunVariable(label) {
|
|
|
147
158
|
* Not here: the per-SLA `stageSla_<stage>_<sla id>` rows, whose ids compile
|
|
148
159
|
* mints after this check runs.
|
|
149
160
|
*/
|
|
150
|
-
function platformVariables(
|
|
161
|
+
export function platformVariables(stageLabels) {
|
|
151
162
|
return [
|
|
152
|
-
...
|
|
163
|
+
...stageLabels.map((label) => stageHasRunVariable(label)),
|
|
153
164
|
'tasksEventSubprocessResponse',
|
|
154
165
|
'mainEventSubprocessResponse',
|
|
155
166
|
'connectorResponse',
|
|
@@ -159,7 +170,7 @@ function platformVariables(built) {
|
|
|
159
170
|
/** Every first-level expression problem in a built case, each stamped with its location. */
|
|
160
171
|
export function checkCaseExpressions(built) {
|
|
161
172
|
const roots = new Set(built.vars.map((v) => v.name));
|
|
162
|
-
for (const name of platformVariables(built))
|
|
173
|
+
for (const name of platformVariables(built.stages.map((s) => s.label)))
|
|
163
174
|
roots.add(name);
|
|
164
175
|
// Task output bindings declare readable case variables too (`=vars.<var>`),
|
|
165
176
|
// via a root `inputOutputs` companion — include them so a gate that reads a
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* decompile-cli — caseplan.json → <Name>.case.ts
|
|
4
4
|
*
|
|
5
5
|
* Usage:
|
|
6
|
-
* node --experimental-strip-types decompile-cli.js <caseplan.json> [-o Name.case.ts] [--import <specifier>] [--library <dir>] [--best-effort] [--no-pipeline]
|
|
6
|
+
* node --experimental-strip-types decompile-cli.js <caseplan.json> [-o Name.case.ts] [--import <specifier>] [--library <dir>] [--connectors-local <dir>] [--best-effort] [--no-pipeline]
|
|
7
7
|
*
|
|
8
8
|
* The reverse of compile-cli: reads a V20-V32 caseplan and emits builder source whose
|
|
9
9
|
* default export re-serializes to the same caseplan (structurally). `--import`
|
|
@@ -14,14 +14,21 @@
|
|
|
14
14
|
* mirroring how the Flow arm's decompile-cli overrides it. By default the
|
|
15
15
|
* command also emits a `<Name>.pipeline.mjs` helper that recompiles edits
|
|
16
16
|
* through the public Case CLI. Pass `--no-pipeline` to skip it.
|
|
17
|
+
*
|
|
18
|
+
* The library is opened as `case compile` and `case check` open it
|
|
19
|
+
* (`openCliLibrary`): `--library`, and the `connectors-local` overlay `registry
|
|
20
|
+
* prepare` writes (`--connectors-local`, else `.flow-sdk/connectors-local`). A
|
|
21
|
+
* plan whose connector is one only a tenant has (a Data Service entity, a custom
|
|
22
|
+
* connector) is decompiled after `registry prepare` has described it, as it is
|
|
23
|
+
* compiled.
|
|
17
24
|
*/
|
|
18
25
|
import { reportResult } from '../cli-result.js';
|
|
19
|
-
import { mkdirSync,
|
|
26
|
+
import { mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
27
|
+
import { openCliLibrary } from '../core/cli-library.js';
|
|
20
28
|
import { resolveLibraryDir } from '../core/library-cache.js';
|
|
21
29
|
import { basename, join, resolve } from 'node:path';
|
|
22
|
-
import { defaultSourceOut, workDirBeside, writeSource } from '../workdir.js';
|
|
30
|
+
import { defaultOverlayDir, defaultSourceOut, workDirBeside, writeSource } from '../workdir.js';
|
|
23
31
|
import { flagValue, runWhenInvokedDirectly } from '../cli-run.js';
|
|
24
|
-
import { Library } from '../core/library.js';
|
|
25
32
|
import { decompileWithDiagnostics } from './decompile.js';
|
|
26
33
|
import { CASE_IMPORT } from '../package-name.js';
|
|
27
34
|
import { commentText } from '../core/comment-text.js';
|
|
@@ -44,10 +51,10 @@ function baseName(plan) {
|
|
|
44
51
|
*/
|
|
45
52
|
export function run(argv) {
|
|
46
53
|
if (argv.length === 0 || argv[0] === '-h' || argv[0] === '--help') {
|
|
47
|
-
console.error('usage: decompile <caseplan.json> [-o Name.case.ts] [--import <specifier>] [--library <dir>] [--best-effort] [--no-pipeline]');
|
|
54
|
+
console.error('usage: decompile <caseplan.json> [-o Name.case.ts] [--import <specifier>] [--library <dir>] [--connectors-local <dir>] [--best-effort] [--no-pipeline]');
|
|
48
55
|
return 2;
|
|
49
56
|
}
|
|
50
|
-
const flags = new Set(['-o', '--import', '--library']);
|
|
57
|
+
const flags = new Set(['-o', '--import', '--library', '--connectors-local']);
|
|
51
58
|
const pos = argv.find((a, i) => !flags.has(a) && !flags.has(argv[i - 1]) && !a.startsWith('-'));
|
|
52
59
|
if (!pos) {
|
|
53
60
|
console.error('decompile: missing <caseplan.json>');
|
|
@@ -55,7 +62,9 @@ export function run(argv) {
|
|
|
55
62
|
}
|
|
56
63
|
const plan = JSON.parse(readFileSync(pos, 'utf8'));
|
|
57
64
|
const libraryDir = resolveLibraryDir(flagValue(argv, '--library'));
|
|
58
|
-
|
|
65
|
+
// The overlay the library opened, flag or auto-detected, so the helper reads it from any directory.
|
|
66
|
+
const overlayDir = flagValue(argv, '--connectors-local') ?? defaultOverlayDir();
|
|
67
|
+
const library = openCliLibrary(argv);
|
|
59
68
|
const importSpecifier = flagValue(argv, '--import') ?? CASE_IMPORT;
|
|
60
69
|
const bestEffort = argv.includes('--best-effort');
|
|
61
70
|
const result = decompileWithDiagnostics(plan, {
|
|
@@ -75,7 +84,7 @@ export function run(argv) {
|
|
|
75
84
|
const workDir = workDirBeside(out);
|
|
76
85
|
mkdirSync(workDir, { recursive: true });
|
|
77
86
|
const pipelinePath = join(workDir, basename(out).replace(/\.case\.ts$|\.ts$/, '') + '.pipeline.mjs');
|
|
78
|
-
writeFileSync(pipelinePath, pipelineScript(resolve(pos), resolve(out), resolve(pipelinePath), importSpecifier, bestEffort, libraryDir ? resolve(libraryDir) : undefined));
|
|
87
|
+
writeFileSync(pipelinePath, pipelineScript(resolve(pos), resolve(out), resolve(pipelinePath), importSpecifier, bestEffort, libraryDir ? resolve(libraryDir) : undefined, overlayDir ? resolve(overlayDir) : undefined));
|
|
79
88
|
console.log(`decompile: wrote ${basename(pipelinePath)}`);
|
|
80
89
|
reportResult({ pipeline: resolve(pipelinePath) });
|
|
81
90
|
}
|
|
@@ -87,7 +96,7 @@ export function run(argv) {
|
|
|
87
96
|
* feeding the original caseplan back as the binding registry; this preserves
|
|
88
97
|
* the resource keys that the typed source deliberately names symbolically.
|
|
89
98
|
*/
|
|
90
|
-
function pipelineScript(originalPath, tsPath, pipelinePath, importSpecifier, bestEffort, libraryDir) {
|
|
99
|
+
function pipelineScript(originalPath, tsPath, pipelinePath, importSpecifier, bestEffort, libraryDir, overlayDir) {
|
|
91
100
|
const base = pipelinePath.replace(/\.pipeline\.mjs$/, '');
|
|
92
101
|
return `#!/usr/bin/env node
|
|
93
102
|
// Generated by case decompile — edit ${commentText(basename(tsPath))}, then run this file.
|
|
@@ -98,9 +107,10 @@ const TS = ${JSON.stringify(tsPath)};
|
|
|
98
107
|
const OUTPUT = ${JSON.stringify(base + '.caseplan.json')};
|
|
99
108
|
const IMPORT = ${JSON.stringify(importSpecifier)};
|
|
100
109
|
const LIBRARY = ${JSON.stringify(libraryDir)};
|
|
110
|
+
const OVERLAY = ${JSON.stringify(overlayDir)};
|
|
101
111
|
const BEST_EFFORT = ${JSON.stringify(bestEffort)};
|
|
102
112
|
|
|
103
|
-
const withLibrary = (args) => LIBRARY ? [
|
|
113
|
+
const withLibrary = (args) => [...args, ...(LIBRARY ? ['--library', LIBRARY] : []), ...(OVERLAY ? ['--connectors-local', OVERLAY] : [])];
|
|
104
114
|
|
|
105
115
|
if (!existsSync(TS)) {
|
|
106
116
|
const decompileArgs = [ORIGINAL, '-o', TS, '--import', IMPORT, '--no-pipeline'];
|
package/dist/case/decompile.d.ts
CHANGED
|
@@ -186,7 +186,7 @@ export interface DecompileOptions {
|
|
|
186
186
|
bestEffort?: boolean;
|
|
187
187
|
}
|
|
188
188
|
export interface CaseDecompileDiagnostic {
|
|
189
|
-
code: 'UNSUPPORTED_TASK_KIND' | 'UNKNOWN_STAGE_REFERENCE' | 'UNKNOWN_TASK_REFERENCE' | 'UNKNOWN_EXIT_TARGET';
|
|
189
|
+
code: 'UNSUPPORTED_TASK_KIND' | 'UNKNOWN_STAGE_REFERENCE' | 'UNKNOWN_TASK_REFERENCE' | 'UNKNOWN_EXIT_TARGET' | 'UNDECLARED_VARIABLE_REFERENCE';
|
|
190
190
|
message: string;
|
|
191
191
|
location: string;
|
|
192
192
|
}
|
package/dist/case/decompile.js
CHANGED
|
@@ -25,6 +25,8 @@ import { bindingIdCandidates, offlineBindingLabel } from './ids.js';
|
|
|
25
25
|
import { bindingRefId, isLiftFailure, isMintedWire, liftResourceFolder, liftResourceName, readBindingIds, resourceBindingOf, typedFolder, wireRows, } from './resource-wire.js';
|
|
26
26
|
import { connectorPlaceholderKindOf } from './connector-placeholder.js';
|
|
27
27
|
import { raiseTaskOutputReads, referableOutputIds } from './task-output-ref.js';
|
|
28
|
+
import { defaultActionOutputVar } from './action-output-var.js';
|
|
29
|
+
import { platformVariables, undeclaredVarReads } from './case-expr-check.js';
|
|
28
30
|
const TASK_KIND_METHOD = {
|
|
29
31
|
process: 'process',
|
|
30
32
|
agent: 'agent',
|
|
@@ -2771,6 +2773,7 @@ export function decompileWithDiagnostics(plan, options = {}) {
|
|
|
2771
2773
|
const diagnostics = [];
|
|
2772
2774
|
refuseUnsupportedAuthoring(plan);
|
|
2773
2775
|
plan = raiseTaskOutputRefs(plan);
|
|
2776
|
+
refuseUndeclaredGateReads(plan, options.bestEffort ? diagnostics : undefined);
|
|
2774
2777
|
const preservation = collectPreservation(plan);
|
|
2775
2778
|
const refs = buildRefs(plan, options.library, options.bestEffort ? diagnostics : undefined);
|
|
2776
2779
|
const selectNextStage = selectNextStageByExit(plan, refs);
|
|
@@ -2861,6 +2864,90 @@ export function decompileWithDiagnostics(plan, options = {}) {
|
|
|
2861
2864
|
const source = `import { ${imports.join(', ')} } from ${tsLiteral(options.importSpecifier ?? './case-sdk.js')};\n\n${diagnosticHeader}${out.toString()}\n`;
|
|
2862
2865
|
return { source, diagnostics };
|
|
2863
2866
|
}
|
|
2867
|
+
/**
|
|
2868
|
+
* Every name a `vars.<name>` gate of `plan` may read without `build()` calling
|
|
2869
|
+
* it undeclared: what the plan's rows declare (each `id` / `var` / `name`, a
|
|
2870
|
+
* literal `value` / `target`), an action form field's default variable, and the
|
|
2871
|
+
* variables the platform declares for every case. It is a superset of the roots
|
|
2872
|
+
* `build()` checks the decompiled source against, so decompile never refuses a
|
|
2873
|
+
* gate compile accepts.
|
|
2874
|
+
*/
|
|
2875
|
+
function gateRoots(plan) {
|
|
2876
|
+
const roots = new Set(platformVariables((plan.nodes ?? []).filter(isStage).map((s) => String(s.data?.label ?? ''))));
|
|
2877
|
+
const walk = (value, inAction) => {
|
|
2878
|
+
if (Array.isArray(value)) {
|
|
2879
|
+
for (const item of value)
|
|
2880
|
+
walk(item, inAction);
|
|
2881
|
+
return;
|
|
2882
|
+
}
|
|
2883
|
+
if (!value || typeof value !== 'object')
|
|
2884
|
+
return;
|
|
2885
|
+
const row = value;
|
|
2886
|
+
const action = inAction || row.type === 'action';
|
|
2887
|
+
for (const [key, field] of Object.entries(row)) {
|
|
2888
|
+
if (typeof field === 'string') {
|
|
2889
|
+
if (key === 'id' || key === 'var' || key === 'name')
|
|
2890
|
+
roots.add(field);
|
|
2891
|
+
if ((key === 'value' || key === 'target') && !field.startsWith('='))
|
|
2892
|
+
roots.add(field);
|
|
2893
|
+
if ((key === 'value' || key === 'target') && /^=[\w$]+$/.test(field))
|
|
2894
|
+
roots.add(field.slice(1));
|
|
2895
|
+
if (key === 'name' && action)
|
|
2896
|
+
roots.add(defaultActionOutputVar(field));
|
|
2897
|
+
}
|
|
2898
|
+
else
|
|
2899
|
+
walk(field, action);
|
|
2900
|
+
}
|
|
2901
|
+
};
|
|
2902
|
+
walk({ ...plan, metadata: undefined }, false);
|
|
2903
|
+
walk(plan.metadata, false);
|
|
2904
|
+
return roots;
|
|
2905
|
+
}
|
|
2906
|
+
/**
|
|
2907
|
+
* Refuse a gate that reads a variable the plan does not declare. `build()`
|
|
2908
|
+
* rejects such a reference (`EXPR_UNDECLARED_REF`: `vars.` is a closed
|
|
2909
|
+
* namespace, and the runtime reads the name as `undefined`), so writing the
|
|
2910
|
+
* gate into the source would only hand the author source compile refuses.
|
|
2911
|
+
* Names the platform declares for every case (`stageHasRun_<stage>`, ...) are
|
|
2912
|
+
* not refused; see `platformVariables`.
|
|
2913
|
+
*/
|
|
2914
|
+
function refuseUndeclaredGateReads(plan, diagnostics) {
|
|
2915
|
+
const roots = gateRoots(plan);
|
|
2916
|
+
const check = (expr, where) => {
|
|
2917
|
+
if (typeof expr !== 'string' || !expr)
|
|
2918
|
+
return;
|
|
2919
|
+
const missing = undeclaredVarReads(expr, roots);
|
|
2920
|
+
if (!missing.length)
|
|
2921
|
+
return;
|
|
2922
|
+
const reads = `reads ${missing.map((name) => `\`vars.${name}\``).join(', ')}, which no variable of the plan declares `
|
|
2923
|
+
+ '(compile refuses it: EXPR_UNDECLARED_REF; at runtime it reads as undefined)';
|
|
2924
|
+
// Best effort keeps the gate and marks the source as needing this repair.
|
|
2925
|
+
if (diagnostics) {
|
|
2926
|
+
diagnostics.push({ code: 'UNDECLARED_VARIABLE_REFERENCE', location: where, message: `${reads}. Declare the variable, or fix the expression.` });
|
|
2927
|
+
return;
|
|
2928
|
+
}
|
|
2929
|
+
throw new Error(`${where} ${reads}. Declare the variable, or fix the expression to read one the case declares, then decompile again.`);
|
|
2930
|
+
};
|
|
2931
|
+
const rules = (conditions, where) => {
|
|
2932
|
+
for (const condition of conditions ?? [])
|
|
2933
|
+
for (const group of condition.rules ?? [])
|
|
2934
|
+
for (const r of group ?? [])
|
|
2935
|
+
check(r?.conditionExpression, where);
|
|
2936
|
+
};
|
|
2937
|
+
(plan.metadata?.slaRules ?? []).forEach((sla, i) => check(sla?.expression, `case SLA #${i + 1}`));
|
|
2938
|
+
rules(plan.metadata?.caseExitRules, 'case completion rule');
|
|
2939
|
+
for (const stage of (plan.nodes ?? []).filter(isStage)) {
|
|
2940
|
+
const at = `stage "${stage.data?.label ?? stage.id ?? '?'}"`;
|
|
2941
|
+
rules(stage.data?.entryConditions, `${at} entry rule`);
|
|
2942
|
+
rules(stage.data?.exitConditions, `${at} exit rule`);
|
|
2943
|
+
(stage.data?.slaRules ?? []).forEach((sla, i) => check(sla?.expression, `${at} SLA #${i + 1}`));
|
|
2944
|
+
for (const task of (stage.data?.tasks ?? []).flat()) {
|
|
2945
|
+
const tat = `task "${task?.displayName ?? task?.id ?? '?'}" in ${at}`;
|
|
2946
|
+
check(task?.skipCondition, `${tat} skip condition`);
|
|
2947
|
+
rules(task?.entryConditions, `${tat} entry rule`);
|
|
2948
|
+
}
|
|
2949
|
+
}
|
|
2950
|
+
}
|
|
2864
2951
|
/**
|
|
2865
2952
|
* The plan with each read of a task output that recompiling could not keep,
|
|
2866
2953
|
* `vars.<output id>`, written as the task-output reference that names the same
|
package/dist/case/serialize.js
CHANGED
|
@@ -1088,7 +1088,17 @@ export function followRenames(result, preservation) {
|
|
|
1088
1088
|
const unpairedCompiled = unmatchedCompiled.filter((stage) => !paired.has(stage));
|
|
1089
1089
|
if (unpairedWanted.length === unpairedCompiled.length)
|
|
1090
1090
|
unpairedWanted.forEach((stage, index) => stageLabels.set(stage.label, labelOf(unpairedCompiled[index])));
|
|
1091
|
-
|
|
1091
|
+
// A custom (`{ assign }`) output row reads as the name of the variable it
|
|
1092
|
+
// assigns. Compile names the row by the variable's id and the payload
|
|
1093
|
+
// restores the label later; the names come from the payload's variable
|
|
1094
|
+
// identities.
|
|
1095
|
+
const variableNames = new Map();
|
|
1096
|
+
for (const lane of Object.values(preservation.identities?.variables ?? {}))
|
|
1097
|
+
for (const row of lane ?? [])
|
|
1098
|
+
if (typeof row?.id === 'string' && !variableNames.has(row.id))
|
|
1099
|
+
variableNames.set(row.id, row.name);
|
|
1100
|
+
const rowName = (row) => row?.custom === true && typeof row.var === 'string' ? variableNames.get(row.var) ?? row.var : String(row?.name ?? '');
|
|
1101
|
+
const rowNames = (inputs, outputs) => JSON.stringify([inputs, outputs].map((rows) => (Array.isArray(rows) ? rows : []).map(rowName)));
|
|
1092
1102
|
const nameOf = (task) => String(task.displayName ?? '');
|
|
1093
1103
|
const stageSides = wanted.map((stage) => {
|
|
1094
1104
|
const target = compiled.find((candidate) => labelOf(candidate) === (stageLabels.get(stage.label) ?? stage.label));
|
|
@@ -57,6 +57,8 @@ export function registerCaseCommands(program) {
|
|
|
57
57
|
.option('-o, --output <file>', 'output .case.ts path')
|
|
58
58
|
.option('--import <specifier>', 'SDK import specifier in generated source')
|
|
59
59
|
.option('--library <dir>', 'connector library directory')
|
|
60
|
+
// Decompile reads the overlay `registry prepare` writes, as compile and check do.
|
|
61
|
+
.option('--connectors-local <dir>', 'connection-resolved connector overlay')
|
|
60
62
|
.option('--best-effort', 'emit a marked repair scaffold for unsupported constructs')
|
|
61
63
|
.option('--no-pipeline', 'do not emit a brownfield pipeline helper')
|
|
62
64
|
.action(async (input, options) => {
|
|
@@ -64,6 +66,7 @@ export function registerCaseCommands(program) {
|
|
|
64
66
|
addValue(argv, '-o', options.output);
|
|
65
67
|
addValue(argv, '--import', options.import);
|
|
66
68
|
addValue(argv, '--library', options.library);
|
|
69
|
+
addValue(argv, '--connectors-local', options.connectorsLocal);
|
|
67
70
|
if (options.bestEffort === true)
|
|
68
71
|
argv.push('--best-effort');
|
|
69
72
|
if (options.pipeline === false)
|
package/dist/core/library.d.ts
CHANGED
|
@@ -330,6 +330,12 @@ export declare class Library {
|
|
|
330
330
|
* Reverse a resolved connector activity back to the symbolic authoring key.
|
|
331
331
|
* Case decompile uses the same library that compile will use, so it never has
|
|
332
332
|
* to guess an action name from a display label.
|
|
333
|
+
*
|
|
334
|
+
* The wire's `method` is the TRANSPORT verb compile writes
|
|
335
|
+
* (`transportHttpMethod`): a curated Retrieve the library records as
|
|
336
|
+
* `GETBYID` goes on the wire as `GET`. So an entry matches on its transport
|
|
337
|
+
* verb too, after an exact match: Outlook `download-email-attachment`
|
|
338
|
+
* (`GETBYID /DownloadAttachment`) is saved as `GET /DownloadAttachment`.
|
|
333
339
|
*/
|
|
334
340
|
identifyAction(wire: {
|
|
335
341
|
connectorKey: string;
|
package/dist/core/library.js
CHANGED
|
@@ -15,6 +15,7 @@ import { loadByoaLedger, loadInvariantCollections, loadLookupResolutions } from
|
|
|
15
15
|
import { ownEntry } from './own-entry.js';
|
|
16
16
|
import { ConnectorResolveError } from './connector-resolve-error.js';
|
|
17
17
|
import { CompileRefusal } from './compile-refusal.js';
|
|
18
|
+
import { transportHttpMethod } from './connector-inputs.js';
|
|
18
19
|
export { ConnectorResolveError } from './connector-resolve-error.js';
|
|
19
20
|
export class Library {
|
|
20
21
|
layers = [];
|
|
@@ -265,30 +266,43 @@ export class Library {
|
|
|
265
266
|
* Reverse a resolved connector activity back to the symbolic authoring key.
|
|
266
267
|
* Case decompile uses the same library that compile will use, so it never has
|
|
267
268
|
* to guess an action name from a display label.
|
|
269
|
+
*
|
|
270
|
+
* The wire's `method` is the TRANSPORT verb compile writes
|
|
271
|
+
* (`transportHttpMethod`): a curated Retrieve the library records as
|
|
272
|
+
* `GETBYID` goes on the wire as `GET`. So an entry matches on its transport
|
|
273
|
+
* verb too, after an exact match: Outlook `download-email-attachment`
|
|
274
|
+
* (`GETBYID /DownloadAttachment`) is saved as `GET /DownloadAttachment`.
|
|
268
275
|
*/
|
|
269
276
|
identifyAction(wire) {
|
|
270
277
|
const prefix = `uipath.connector.${wire.connectorKey}.`;
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
const
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
278
|
+
const verb = (method, transport) => {
|
|
279
|
+
const upper = String(method ?? '').toUpperCase();
|
|
280
|
+
return transport ? transportHttpMethod(upper) : upper;
|
|
281
|
+
};
|
|
282
|
+
// Exact verbs first, so an entry the wire names exactly wins over a transport twin.
|
|
283
|
+
for (const transport of [false, true]) {
|
|
284
|
+
for (const layer of this.layers) {
|
|
285
|
+
for (const indexed of layer.entries) {
|
|
286
|
+
if (indexed.connectorKey !== wire.connectorKey || !String(indexed.nodeType ?? '').startsWith(prefix))
|
|
287
|
+
continue;
|
|
288
|
+
if (wire.version && indexed.version !== wire.version)
|
|
289
|
+
continue;
|
|
290
|
+
const entry = readJson(this.read, libraryPath(layer.dir, indexed.path));
|
|
291
|
+
const operation = entry.operation ?? {};
|
|
292
|
+
if (wire.httpMethod && verb(operation.httpMethod, transport) !== verb(wire.httpMethod, transport))
|
|
293
|
+
continue;
|
|
294
|
+
if (wire.endpoint && operation.path !== wire.endpoint)
|
|
295
|
+
continue;
|
|
296
|
+
if (wire.objectName && operation.objectName !== wire.objectName)
|
|
297
|
+
continue;
|
|
298
|
+
const siblings = layer.entries.filter((candidate) => candidate.nodeType === indexed.nodeType);
|
|
299
|
+
return {
|
|
300
|
+
key: wire.connectorKey,
|
|
301
|
+
action: String(indexed.nodeType).slice(prefix.length),
|
|
302
|
+
version: String(indexed.version),
|
|
303
|
+
...(siblings.length > 1 && operation.objectName ? { object: String(operation.objectName) } : {}),
|
|
304
|
+
};
|
|
305
|
+
}
|
|
292
306
|
}
|
|
293
307
|
}
|
|
294
308
|
throw new CompileRefusal('CONNECTOR_NOT_IN_LIBRARY', `connector activity not found in library: ${wire.connectorKey} ${wire.httpMethod ?? '?'} ${wire.endpoint ?? '?'}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uipath/maestro-builder-sdk",
|
|
3
|
-
"version": "6.86.
|
|
3
|
+
"version": "6.86.16",
|
|
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",
|
|
@@ -103,5 +103,5 @@
|
|
|
103
103
|
"@types/node": "^22.7.0",
|
|
104
104
|
"esbuild": "^0.28.1"
|
|
105
105
|
},
|
|
106
|
-
"gitref": "
|
|
106
|
+
"gitref": "3e9aa039200cbae561c1da363d34a4cbc4e6320c"
|
|
107
107
|
}
|