@uipath/maestro-builder-sdk 6.120.33 → 6.121.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.
@@ -1,3 +1,22 @@
1
1
  #!/usr/bin/env node
2
+ import { type CaseCheckOpts, type Diagnostic } from './check.js';
3
+ import type { BuiltCase } from './case-sdk.js';
2
4
  import { type CliExitCode } from '../cli-run.js';
3
5
  export declare function run(argv: string[]): Promise<CliExitCode>;
6
+ /**
7
+ * Check `built` and scope its findings to the edit (`scopeToEdit`): the
8
+ * original at `originalPath` (parsed as `original`) is decompiled as `case
9
+ * decompile` does, with the same library, loaded, and checked with the same
10
+ * options. A plan decompile refuses (the canvas form, a pre-V20 plan) comes
11
+ * back as the usage error to refuse `--baseline` with, worded as decompile
12
+ * words it. The caller has already called `ensureTypeScriptRuntime()`.
13
+ *
14
+ * `editedSource`, the text `built` was loaded from, carries the stamp `case
15
+ * decompile` writes (`./decompile-stamp.ts`). A baseline that is not the plan
16
+ * the stamp names is the usage error too (see {@link wrongBaseline}).
17
+ *
18
+ * For instance, for an edit that only renamed one task, every TASK_NO_ENTRY on
19
+ * the other tasks, which the original has too, comes back as a pre-existing
20
+ * warning.
21
+ */
22
+ export declare function checkAgainstBaseline(built: BuiltCase, originalPath: string, original: unknown, opts?: CaseCheckOpts, editedSource?: string): Promise<Diagnostic[] | Error>;
@@ -4,25 +4,42 @@
4
4
  *
5
5
  * Usage: node --experimental-strip-types check-cli.js <case.ts | BaseName> \
6
6
  * [--library <library-json dir>] [--connectors-local <overlay dir>] [--bindings <bindings.json>] \
7
- * [-o <the plan compile writes>] [--resources <resources.json>]
8
- * Exits 0 when clean (warnings allowed), 1 on any error.
7
+ * [-o <the plan compile writes>] [--resources <resources.json>] [--baseline <original caseplan.json>]
8
+ * Exits 0 when clean (warnings allowed), 1 on any error, 2 on a usage error.
9
+ *
10
+ * `--baseline <original caseplan.json>` scopes the findings to the edit, as
11
+ * `flow check --baseline` does: the original is decompiled and checked in
12
+ * memory the same way, and each finding is marked `(edited)` or
13
+ * `(pre-existing)`. A pre-existing finding (on a stage, task or trigger the
14
+ * edit left unchanged, which the original reports too) is a warning, so only
15
+ * the edit's errors fail the check; a pre-existing lowering one is printed as
16
+ * a probable SDK defect. See `./edit-scope.ts`.
9
17
  *
10
18
  * The library is opened exactly as `compile-cli` opens it (`openCliLibrary`), so
11
19
  * a connector task `compile` cannot resolve fails here first (#1014).
12
20
  */
13
- import { reportDiagnostics } from '../cli-result.js';
21
+ import { existsSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
22
+ import { tmpdir } from 'node:os';
23
+ import { dirname, join, resolve } from 'node:path';
24
+ import { reportDiagnostics, reportResult, withOrigin } from '../cli-result.js';
14
25
  import { resolveCaseFile, loadBuiltCase } from './load.js';
15
- import { check } from './check.js';
26
+ import { check, checkCompiled } from './check.js';
27
+ import { scopeToEdit } from './edit-scope.js';
28
+ import { decompileWithDiagnostics } from './decompile.js';
29
+ import { baselineSummary } from '../core/baseline-scope.js';
30
+ import { CASE_IMPORT } from '../package-name.js';
31
+ import { caseJsonPreservation } from './preserve.js';
32
+ import { canonicalJson, planDigest, readCaseStamp, sourceDigest } from './decompile-stamp.js';
16
33
  import { caseCheckOpts } from './cli-library.js';
17
34
  import { withFetchedDefinitions } from '../registry/fetch/with-fetched-definitions.js';
18
35
  import { caseCompileTarget } from './compile-cli.js';
19
- import { runWhenInvokedDirectly } from '../cli-run.js';
36
+ import { flagValue, runWhenInvokedDirectly } from '../cli-run.js';
20
37
  import { ensureTypeScriptRuntime } from '../node-runtime.js';
21
38
  import { defaultResourcesFile } from '../workdir.js';
22
39
  import { readCliResources } from '../registry/prepare/resources.js';
23
40
  /** Flags that take a value: their argument is never the source positional. */
24
- const VALUE_FLAGS = new Set(['--library', '--connectors-local', '--bindings', '--resources', '-o']);
25
- const USAGE = 'usage: check <case.ts | BaseName> [--library <dir>] [--connectors-local <dir>] [--bindings <file>] [--resources <file>] [-o <plan>]';
41
+ const VALUE_FLAGS = new Set(['--library', '--connectors-local', '--bindings', '--resources', '-o', '--baseline']);
42
+ const USAGE = 'usage: check <case.ts | BaseName> [--library <dir>] [--connectors-local <dir>] [--bindings <file>] [--resources <file>] [-o <plan>] [--baseline <original caseplan.json>]';
26
43
  export async function run(argv) {
27
44
  if (argv.length === 0 || argv[0] === '-h' || argv[0] === '--help') {
28
45
  console.error(USAGE);
@@ -33,7 +50,16 @@ export async function run(argv) {
33
50
  console.error(USAGE);
34
51
  return 2;
35
52
  }
53
+ const baselinePath = flagValue(argv, '--baseline');
54
+ const original = baselinePath !== undefined ? readBaseline(baselinePath) : undefined;
55
+ if (original instanceof Error) {
56
+ console.error(`check: ${original.message}`);
57
+ reportResult({ error: original.message });
58
+ return 2;
59
+ }
36
60
  const file = resolveCaseFile(input);
61
+ // Read before anything runs: the stamp names the plan the source came from.
62
+ const editedSource = baselinePath !== undefined ? readFileSync(file, 'utf8') : undefined;
37
63
  ensureTypeScriptRuntime();
38
64
  const built = await loadBuiltCase(file);
39
65
  // The bindings `case compile` reads, plan fallback included, for the
@@ -41,12 +67,24 @@ export async function run(argv) {
41
67
  const { bindings } = caseCompileTarget(argv);
42
68
  const resources = readCliResources(argv, defaultResourcesFile());
43
69
  // A connector operation no layer carries is fetched through `uip` and the check
44
- // runs again, as `compile` does (docs/CONNECTOR_LIBRARY_OPTIONAL_DESIGN.md).
45
- const diags = await withFetchedDefinitions(argv, (library) => check(built, { ...caseCheckOpts(library, bindings), ...(resources ? { resources } : {}) }), { who: 'check' });
70
+ // runs again, as `compile` does (docs/CONNECTOR_LIBRARY_OPTIONAL_DESIGN.md);
71
+ // with a baseline, the original is checked against the same library.
72
+ const result = await withFetchedDefinitions(argv, (library) => {
73
+ const opts = { ...caseCheckOpts(library, bindings), ...(resources ? { resources } : {}) };
74
+ return baselinePath !== undefined ? checkAgainstBaseline(built, baselinePath, original, opts, editedSource) : check(built, opts);
75
+ }, { who: 'check' });
76
+ if (result instanceof Error) {
77
+ console.error(`check: ${result.message}`);
78
+ reportResult({ error: result.message });
79
+ return 2;
80
+ }
81
+ const diags = result;
46
82
  reportDiagnostics(diags);
47
83
  for (const d of diags)
48
- console.error(` ${d.level === 'error' ? '✗' : '⚠'} [${d.code}] ${d.message}`);
84
+ console.error(` ${withOrigin(`${d.level === 'error' ? '✗' : '⚠'} [${d.code}]`, d)}`);
49
85
  const errors = diags.filter((d) => d.level === 'error');
86
+ if (baselinePath !== undefined && diags.length)
87
+ console.error(`check: ${baselineSummary(diags, 'parts of the case')}.`);
50
88
  if (errors.length) {
51
89
  console.error(`check: ${errors.length} error(s).`);
52
90
  return 1;
@@ -54,4 +92,129 @@ export async function run(argv) {
54
92
  console.log(`check: OK${diags.length ? ` (${diags.length} warning(s))` : ''}`);
55
93
  return 0;
56
94
  }
95
+ /**
96
+ * Check `built` and scope its findings to the edit (`scopeToEdit`): the
97
+ * original at `originalPath` (parsed as `original`) is decompiled as `case
98
+ * decompile` does, with the same library, loaded, and checked with the same
99
+ * options. A plan decompile refuses (the canvas form, a pre-V20 plan) comes
100
+ * back as the usage error to refuse `--baseline` with, worded as decompile
101
+ * words it. The caller has already called `ensureTypeScriptRuntime()`.
102
+ *
103
+ * `editedSource`, the text `built` was loaded from, carries the stamp `case
104
+ * decompile` writes (`./decompile-stamp.ts`). A baseline that is not the plan
105
+ * the stamp names is the usage error too (see {@link wrongBaseline}).
106
+ *
107
+ * For instance, for an edit that only renamed one task, every TASK_NO_ENTRY on
108
+ * the other tasks, which the original has too, comes back as a pre-existing
109
+ * warning.
110
+ */
111
+ export async function checkAgainstBaseline(built, originalPath, original, opts = {}, editedSource) {
112
+ const stamp = editedSource !== undefined ? readCaseStamp(editedSource) : undefined;
113
+ if (stamp !== undefined && 'error' in stamp)
114
+ return new Error(`the source's @decompiled-from stamp line does not read (${stamp.error}); decompile ${originalPath} again, or delete the line`);
115
+ const edited = checkCompiled(built, opts);
116
+ let source;
117
+ try {
118
+ const result = decompileWithDiagnostics(original, { importSpecifier: CASE_IMPORT, bestEffort: true, ...(opts.library ? { library: opts.library } : {}) });
119
+ for (const d of result.diagnostics)
120
+ console.error(`check: baseline decompile: [${d.code}] ${d.location}: ${d.message}`);
121
+ source = result.source;
122
+ }
123
+ catch (error) {
124
+ return new Error(`--baseline ${originalPath} does not decompile: ${error instanceof Error ? error.message : String(error)}`);
125
+ }
126
+ // Beside the original, not in the system temp dir, as `flow check --baseline`
127
+ // writes it: the source then resolves what the author's project resolves.
128
+ const dir = baselineDirectory(originalPath);
129
+ try {
130
+ writeFileSync(join(dir, 'package.json'), '{"type":"module"}\n');
131
+ const file = join(dir, 'Baseline.case.ts');
132
+ writeFileSync(file, source);
133
+ // A best-effort decompile of a broken plan is a repair scaffold
134
+ // (`.__UNRESOLVED_TASK_KIND__(...)`), which does not build: that is a
135
+ // problem with the baseline, not with the edit, so it is the usage error.
136
+ let baseline;
137
+ let baselineBuilt;
138
+ try {
139
+ baselineBuilt = await loadBuiltCase(file);
140
+ baseline = checkCompiled(baselineBuilt, opts);
141
+ }
142
+ catch (error) {
143
+ return new Error(`--baseline ${originalPath} decompiles but does not build (${error instanceof Error ? error.message : String(error)}); `
144
+ + 'repair the original first, or run check without --baseline');
145
+ }
146
+ const wrong = wrongBaseline(built, baselineBuilt, original, source, stamp);
147
+ if (wrong !== undefined)
148
+ return new Error(`--baseline ${originalPath} is not the plan this source was decompiled from: ${wrong}. Pass the original plan as `
149
+ + 'it was before the first compile (a plan compile wrote over holds the edit, and checking the edit against itself hides '
150
+ + 'its errors), or decompile again.');
151
+ return scopeToEdit(edited, baseline);
152
+ }
153
+ finally {
154
+ rmSync(dir, { recursive: true, force: true });
155
+ }
156
+ }
157
+ /**
158
+ * Why the baseline is not the plan the source was decompiled from, or `undefined`
159
+ * when it is (or nothing says otherwise). Against a plan compile has already written
160
+ * the edit over, every finding of the edit reads as pre-existing, so this is checked
161
+ * before any finding is scoped.
162
+ *
163
+ * - A stamped source (`case decompile` writes the stamp): the baseline matches when
164
+ * its {@link planDigest} is the stamp's `plan=`, which no SDK version changes; or,
165
+ * when the plan changed only where decompile does not read (the stamp's `sha256:`
166
+ * is the source this SDK decompiles it to), the edit's units are still the ones
167
+ * the source started from.
168
+ * - An unstamped source decompiled before the stamp: the `preserveCaseJson(...)`
169
+ * payload, which decompile owns and the author never edits, must equal the one the
170
+ * baseline's decompile carries. This catches an edit that added or removed an id,
171
+ * not one made in place to a stage or a condition.
172
+ * - A hand-written source (no stamp, no payload): nothing to compare.
173
+ *
174
+ * For instance, an edit that adds `marksCaseComplete: false` to `.completeWhen(...)`,
175
+ * compiled over the plan and the plan then passed, comes back `the plan's content
176
+ * changed since the decompile (plan=<recorded> recorded, <now> now)`.
177
+ */
178
+ function wrongBaseline(built, baselineBuilt, original, baselineSource, stamp) {
179
+ if (stamp !== undefined && !('error' in stamp)) {
180
+ const now = planDigest(original);
181
+ if (now === stamp.plan || sourceDigest(baselineSource) === stamp.sha256)
182
+ return undefined;
183
+ return `the plan's content changed since the decompile (plan=${stamp.plan} recorded, ${now} now)`;
184
+ }
185
+ const ownPayload = caseJsonPreservation(built);
186
+ if (ownPayload !== undefined && canonicalJson(ownPayload) !== canonicalJson(caseJsonPreservation(baselineBuilt)))
187
+ return 'its decompile carries different preserveCaseJson(...) data';
188
+ return undefined;
189
+ }
190
+ function baselineDirectory(originalPath) {
191
+ try {
192
+ return mkdtempSync(join(dirname(resolve(originalPath)), '.case-check-baseline-'));
193
+ }
194
+ catch {
195
+ return mkdtempSync(join(tmpdir(), 'case-check-baseline-'));
196
+ }
197
+ }
198
+ /**
199
+ * The `--baseline` file, parsed, or the usage error to refuse it with: a path
200
+ * that does not exist, or a file that is not a caseplan (JSON with `nodes`),
201
+ * such as the `.case.ts` source passed by mistake. Refused before anything is
202
+ * loaded, with the usage exit code, so a bad flag never reads as a failed check.
203
+ */
204
+ function readBaseline(path) {
205
+ const usage = `--baseline must be the original caseplan.json (JSON) the source was decompiled from: ${path}`;
206
+ if (!existsSync(path))
207
+ return new Error(`${usage} (no such file)`);
208
+ let parsed;
209
+ try {
210
+ parsed = JSON.parse(readFileSync(path, 'utf8'));
211
+ }
212
+ catch (error) {
213
+ return new Error(`${usage} (not JSON: ${error instanceof Error ? error.message : String(error)})`);
214
+ }
215
+ if (!parsed || typeof parsed !== 'object' || !Array.isArray(parsed.nodes)) {
216
+ return new Error(`${usage} (no "nodes" array)`);
217
+ }
218
+ return parsed;
219
+ }
57
220
  runWhenInvokedDirectly(import.meta.url, 'check', run);
@@ -14,6 +14,7 @@
14
14
  import type { BuiltCase } from './case-sdk.js';
15
15
  import { type ConnectorCheckOpts } from '../core/connector-checks.js';
16
16
  import type { Library } from '../core/library.js';
17
+ import type { RefusalClass } from '../core/refusals.js';
17
18
  export interface Diagnostic {
18
19
  level: 'error' | 'warning';
19
20
  code: string;
@@ -21,8 +22,40 @@ export interface Diagnostic {
21
22
  /** What the finding is about: a task's name, a stage's label, a trigger's label. */
22
23
  where?: string;
23
24
  suggestion?: string;
24
- /** The id of the node `where` names, for a refusal the serializer placed on one (`serializerRefusals`). */
25
+ /**
26
+ * The id of the stage, task or trigger `where` names: set by a refusal the
27
+ * serializer placed on one (`serializerRefusals`); with a baseline
28
+ * (`case check --baseline`, `scopeToEdit` in `./edit-scope.ts`), on every
29
+ * finding that names one.
30
+ */
25
31
  nodeId?: string;
32
+ /** Only with a baseline: the code's class (`core/refusals.ts`), `lint`, `lowering` or `draft`. */
33
+ class?: RefusalClass;
34
+ /**
35
+ * Only with a baseline: `pre-existing` when the finding's stage, task or
36
+ * trigger is unchanged from the original and the original reports the same
37
+ * code there, so the edit did not cause it (such a finding is a warning);
38
+ * `edited` for every other finding.
39
+ */
40
+ origin?: 'edited' | 'pre-existing';
41
+ }
42
+ /**
43
+ * What {@link checkCompiled} found, with the plan its serializer pass built,
44
+ * which `scopeToEdit` (`./edit-scope.ts`) compares against a baseline.
45
+ */
46
+ export interface CheckedCase {
47
+ diagnostics: Diagnostic[];
48
+ /**
49
+ * The collect-mode plan, stand-ins and all (`CaseSerializeOpts.collect`);
50
+ * nothing writes it. `undefined` when the serializer threw, so no finding
51
+ * past that point was reported.
52
+ */
53
+ plan: Record<string, unknown> | undefined;
54
+ /** When the serializer threw past collect mode: the throw, after which nothing was judged. */
55
+ stoppedAt?: {
56
+ code?: string;
57
+ message: string;
58
+ };
26
59
  }
27
60
  /**
28
61
  * The connector-library facts Case `check` reads, from the same `Library`
@@ -53,3 +86,5 @@ export type CaseCheckOpts = Pick<ConnectorCheckOpts, 'lookups' | 'resolutions' |
53
86
  * @returns Every diagnostic found. An `error` fails `check`; only a `lowering` error stops `compile`.
54
87
  */
55
88
  export declare function check(built: BuiltCase, opts?: CaseCheckOpts): Diagnostic[];
89
+ /** {@link check}, keeping the plan its serializer pass built ({@link CheckedCase}). */
90
+ export declare function checkCompiled(built: BuiltCase, opts?: CaseCheckOpts): CheckedCase;
@@ -28,6 +28,10 @@ const ILLEGAL = [];
28
28
  * @returns Every diagnostic found. An `error` fails `check`; only a `lowering` error stops `compile`.
29
29
  */
30
30
  export function check(built, opts = {}) {
31
+ return checkCompiled(built, opts).diagnostics;
32
+ }
33
+ /** {@link check}, keeping the plan its serializer pass built ({@link CheckedCase}). */
34
+ export function checkCompiled(built, opts = {}) {
31
35
  // Which steps share a recorded lookup row across connections (LOOKUP_CONNECTION_MISMATCH), file-wide.
32
36
  if (opts.resolutions && !opts.lookupConnections)
33
37
  opts = { ...opts, lookupConnections: lookupConnectionIndex(built, opts.resolutions, opts.bindings) };
@@ -254,8 +258,9 @@ export function check(built, opts = {}) {
254
258
  checkTaskRetry(built, diags);
255
259
  checkRuleSemantics(built, diags);
256
260
  checkLibraryConnectors(built, opts, diags);
257
- diags.push(...serializerRefusals(built, opts, diags, reportedReads));
258
- return diags;
261
+ const serialized = serializerRefusals(built, opts, diags, reportedReads);
262
+ diags.push(...serialized.diagnostics);
263
+ return { diagnostics: diags, plan: serialized.plan, ...(serialized.stoppedAt ? { stoppedAt: serialized.stoppedAt } : {}) };
259
264
  }
260
265
  /**
261
266
  * Task types whose retry policy the platform drops (`caseTaskTypeSupportsErrorHandling`
@@ -330,6 +335,7 @@ function serializerRefusals(built, opts, found, reportedReads = []) {
330
335
  const collected = [];
331
336
  const warned = [];
332
337
  let plan;
338
+ let stoppedAt;
333
339
  try {
334
340
  plan = serialize(built, {
335
341
  ...(opts.library ? { library: opts.library } : {}),
@@ -342,6 +348,8 @@ function serializerRefusals(built, opts, found, reportedReads = []) {
342
348
  catch (error) {
343
349
  if (!found.some((d) => d.level === 'error') && !collected.some((r) => r.code !== 'LIBRARY_REQUIRED'))
344
350
  throw error;
351
+ const code = error?.code;
352
+ stoppedAt = { ...(typeof code === 'string' ? { code } : {}), message: error instanceof Error ? error.message : String(error) };
345
353
  }
346
354
  const out = [];
347
355
  const seen = new Set();
@@ -387,7 +395,7 @@ function serializerRefusals(built, opts, found, reportedReads = []) {
387
395
  seen.add(key);
388
396
  out.push({ level: 'warning', code: w.code, message: w.message });
389
397
  }
390
- return out;
398
+ return { diagnostics: out, plan, ...(stoppedAt ? { stoppedAt } : {}) };
391
399
  }
392
400
  /** The value at a plan-check path (`nodes[1].data.tasks[0][0].skipCondition`). */
393
401
  function valueAtPlanPath(plan, path) {
@@ -35,6 +35,7 @@ import { defaultOverlayDir, defaultSourceOut, workDirBeside, workPath, writeSour
35
35
  import { flagValue, runWhenInvokedDirectly } from '../cli-run.js';
36
36
  import { decompileWithDiagnostics } from './decompile.js';
37
37
  import { decompileWithPlanConnectors } from './plan-connectors.js';
38
+ import { stampCaseSource } from './decompile-stamp.js';
38
39
  import { CASE_IMPORT } from '../package-name.js';
39
40
  import { commentText } from '../core/comment-text.js';
40
41
  import { pipelineFrontDoor } from '../registry/uip/pipeline-front-door.js';
@@ -101,7 +102,9 @@ export async function run(argv) {
101
102
  reportResult({ connectorsFromPlan: { overlay: resolve(overlayDir), nodeTypes: carried.written.map((c) => c.entry.nodeType) } });
102
103
  }
103
104
  const out = flagValue(argv, '-o') ?? defaultSourceOut(`${baseName(plan)}.case.ts`);
104
- writeSource(out, result.source);
105
+ // The stamp names the plan this came from, so `case check --baseline` can
106
+ // refuse a baseline that is not it (decompile-stamp.ts).
107
+ writeSource(out, stampCaseSource(result.source, plan, basename(pos)));
105
108
  console.log(`decompile: wrote ${basename(out)}`);
106
109
  reportResult({ path: resolve(out), diagnostics: result.diagnostics.map((d) => ({ code: d.code, location: d.location, message: d.message })) });
107
110
  for (const diagnostic of result.diagnostics) {
@@ -0,0 +1,35 @@
1
+ export { sourceDigest, STAMP_MARKER } from '../core/decompile-stamp.js';
2
+ /** What `case decompile` records about the decompile, and `case check --baseline` reads back. */
3
+ export interface CaseDecompileStamp {
4
+ /** The original's base name. */
5
+ file: string;
6
+ /** `sourceDigest` of the source decompile made of the original, lowercase hex. */
7
+ sha256: string;
8
+ /** {@link planDigest} of the original, lowercase hex. */
9
+ plan: string;
10
+ }
11
+ /**
12
+ * `value` as JSON with every object's keys sorted and `undefined` fields left out, so
13
+ * two values with the same content compare equal whatever their key order.
14
+ *
15
+ * @example canonicalJson({ b: 1, a: [true] }) === canonicalJson({ a: [true], b: 1 }) // '{"a":[true],"b":1}'
16
+ */
17
+ export declare function canonicalJson(value: unknown): string;
18
+ /** SHA-256, lowercase hex, of a parsed plan as {@link canonicalJson}: what `plan=` records. */
19
+ export declare function planDigest(plan: unknown): string;
20
+ /** The stamp line for `source`, decompiled from `plan` read from the file named `file`, without a terminator. */
21
+ export declare function formatCaseStamp(stamp: CaseDecompileStamp): string;
22
+ /**
23
+ * `source`, decompiled from `plan` (read from the file whose base name is `file`), with
24
+ * its stamp line in front.
25
+ */
26
+ export declare function stampCaseSource(source: string, plan: unknown, file: string): string;
27
+ /**
28
+ * Read the stamp from a `.case.ts` source.
29
+ *
30
+ * @returns The stamp; `undefined` when the source has no stamp line (decompiled before
31
+ * the stamp existed, or written by hand); or `{ error }` when the line does not parse.
32
+ */
33
+ export declare function readCaseStamp(source: string): CaseDecompileStamp | {
34
+ error: string;
35
+ } | undefined;
@@ -0,0 +1,81 @@
1
+ /**
2
+ * decompile-stamp — the line `case decompile` writes at the top of a `.case.ts` to say
3
+ * which plan it came from, and the reader `case check --baseline` uses to check that
4
+ * the baseline it is given is that plan. The line's shape and the source digest are
5
+ * shared with Flow and BPMN (`core/decompile-stamp.ts`); the option is Case's:
6
+ *
7
+ * // @decompiled-from <file name> sha256:<64 hex> plan=<64 hex>
8
+ *
9
+ * - `sha256:` is the shared source digest: SHA-256 of the source decompile wrote,
10
+ * without the stamp line and with the import specifier normalized.
11
+ * - `plan=` is SHA-256 of the plan decompile read, as key-order-free JSON
12
+ * ({@link planDigest}). It does not depend on what this SDK's decompile makes of the
13
+ * plan, so a source decompiled with an older SDK still matches its original. It
14
+ * changes with any change to the plan's content, whitespace and key order aside.
15
+ *
16
+ * Why (UiPath/builder-sdk#1962): `case check --baseline` decompiles the baseline and
17
+ * scopes the edit's findings against it. Passed the plan `compile` has already written
18
+ * the edit over, every finding of the edit reads as pre-existing and the check passes.
19
+ * The `preserveCaseJson(...)` payload catches that only when the edit changed an id or
20
+ * a task fingerprint; an edit made in place to a stage or a case condition does not.
21
+ *
22
+ * `--import`, `--no-pipeline` and `--best-effort` are not recorded: none changes which
23
+ * plan the source came from.
24
+ *
25
+ * Nothing here prints; the CLIs do.
26
+ */
27
+ import { formatStampLine, readStampLine, sourceDigest } from '../core/decompile-stamp.js';
28
+ import { bytesToHex, sha256 } from '../core/sha.js';
29
+ export { sourceDigest, STAMP_MARKER } from '../core/decompile-stamp.js';
30
+ /**
31
+ * `value` as JSON with every object's keys sorted and `undefined` fields left out, so
32
+ * two values with the same content compare equal whatever their key order.
33
+ *
34
+ * @example canonicalJson({ b: 1, a: [true] }) === canonicalJson({ a: [true], b: 1 }) // '{"a":[true],"b":1}'
35
+ */
36
+ export function canonicalJson(value) {
37
+ if (Array.isArray(value))
38
+ return `[${value.map(canonicalJson).join(',')}]`;
39
+ if (value !== null && typeof value === 'object') {
40
+ const o = value;
41
+ return `{${Object.keys(o).sort().filter((k) => o[k] !== undefined).map((k) => `${JSON.stringify(k)}:${canonicalJson(o[k])}`).join(',')}}`;
42
+ }
43
+ return JSON.stringify(value) ?? 'null';
44
+ }
45
+ /** SHA-256, lowercase hex, of a parsed plan as {@link canonicalJson}: what `plan=` records. */
46
+ export function planDigest(plan) {
47
+ return bytesToHex(sha256(canonicalJson(plan)));
48
+ }
49
+ /** The stamp line for `source`, decompiled from `plan` read from the file named `file`, without a terminator. */
50
+ export function formatCaseStamp(stamp) {
51
+ return formatStampLine({ file: stamp.file, sha256: stamp.sha256, options: [`plan=${stamp.plan}`] });
52
+ }
53
+ /**
54
+ * `source`, decompiled from `plan` (read from the file whose base name is `file`), with
55
+ * its stamp line in front.
56
+ */
57
+ export function stampCaseSource(source, plan, file) {
58
+ return `${formatCaseStamp({ file, sha256: sourceDigest(source), plan: planDigest(plan) })}\n${source}`;
59
+ }
60
+ /**
61
+ * Read the stamp from a `.case.ts` source.
62
+ *
63
+ * @returns The stamp; `undefined` when the source has no stamp line (decompiled before
64
+ * the stamp existed, or written by hand); or `{ error }` when the line does not parse.
65
+ */
66
+ export function readCaseStamp(source) {
67
+ const read = readStampLine(source);
68
+ if (read === undefined || 'error' in read)
69
+ return read;
70
+ let plan;
71
+ for (const token of read.options) {
72
+ const [key, value] = token.split('=', 2);
73
+ if (key === 'plan' && plan === undefined && value !== undefined && /^[0-9a-f]{64}$/.test(value))
74
+ plan = value;
75
+ else
76
+ return { error: `unknown or repeated option \`${token}\`: ${read.line}` };
77
+ }
78
+ if (plan === undefined)
79
+ return { error: `\`plan=\` is missing: ${read.line}` };
80
+ return { file: read.file, sha256: read.sha256, plan };
81
+ }
@@ -0,0 +1,77 @@
1
+ /**
2
+ * case/edit-scope — which stages, tasks and triggers of a case the author
3
+ * edited, and which `check` findings the edit did not cause
4
+ * (`case check --baseline <original caseplan.json>`).
5
+ *
6
+ * The brownfield loop decompiles an existing plan, edits the source, checks
7
+ * it and compiles it. Without a baseline, `check` judges the whole case, so a
8
+ * defect the original already had on a task the edit never touched (a task
9
+ * with no entry rule, say) fails every edit. With one, the original is
10
+ * decompiled and checked the same way, and a finding is `pre-existing` when:
11
+ *
12
+ * - it is on a stage, task or trigger (a "unit", by id) that is unchanged
13
+ * from the original, and the original reports the same code there; or
14
+ * - it names no unit, and the original reports the same code and message.
15
+ *
16
+ * Every other finding is `edited`: one on a unit the edit changed, on a new
17
+ * unit, or a new finding on an untouched unit (an edit elsewhere caused it).
18
+ *
19
+ * "Unchanged" compares the two collect-mode plans `check` builds (the edited
20
+ * source's, and the decompiled original's), unit by unit:
21
+ *
22
+ * - a task: its object in the plan (name, type, inputs, outputs, entry
23
+ * rules, ...) and the stage that holds it;
24
+ * - a stage or trigger: its node, with each task in it replaced by the
25
+ * task's id (a task's content is its own unit), and the edges into and
26
+ * out of it. Canvas layout fields are ignored.
27
+ *
28
+ * Ids are stable here because decompile carries the original's ids into the
29
+ * source (`preserveCaseJson`), so the original's round trip and an edit that
30
+ * leaves a task alone give that task the same id and the same content. A
31
+ * renamed task keeps its id but not its content, so it is edited; a deleted
32
+ * one has no findings left; a new one has an id the original lacks.
33
+ *
34
+ * Messages are compared with each stage, task and trigger name replaced by its
35
+ * id, since a task's finding names its stage (`Task "Wrap" in stage "Close"`):
36
+ * renaming the stage changes neither the task nor what its finding is about.
37
+ *
38
+ * For instance, TASK_NO_ENTRY on task "Approved Record Task", which the edit
39
+ * did not touch and the original reports too, is a pre-existing warning; the
40
+ * same finding after the edit gave that task a new input is an edited error.
41
+ *
42
+ * Pure: no file access. Reading and decompiling the original is check-cli's.
43
+ */
44
+ import type { CheckedCase, Diagnostic } from './check.js';
45
+ type Json = Record<string, unknown>;
46
+ /** One unit of a plan: what kind it is, its name as `check` words it, and its content. */
47
+ export interface CaseUnit {
48
+ kind: 'stage' | 'task' | 'trigger';
49
+ name: string;
50
+ content: string;
51
+ }
52
+ /**
53
+ * The plan's stages, tasks and triggers by id ({@link CaseUnit}). A node that
54
+ * is no stage (a trigger, or any other node with an id) counts as a trigger.
55
+ */
56
+ export declare function caseUnits(plan: Json | undefined): Map<string, CaseUnit>;
57
+ /**
58
+ * The id of the unit a finding is on: its `nodeId` when the serializer placed
59
+ * it, else the unit its `where` names. `check` words `where` as a task's name,
60
+ * a stage's or trigger's label, or a phrase that starts with one
61
+ * (`task "Review" in stage "Intake" entry`, `stage "Intake" exit`). Undefined
62
+ * when it names none, or a name two units share.
63
+ */
64
+ export declare function unitOf(d: Pick<Diagnostic, 'where' | 'nodeId'>, units: ReadonlyMap<string, CaseUnit>): string | undefined;
65
+ /**
66
+ * Scope `edited`'s findings to the edit, against `baseline`: the original
67
+ * caseplan decompiled and checked the same way (the module doc says which
68
+ * finding is which). Every finding gets an `origin`, its `class`, and the
69
+ * `nodeId` of the unit it is on when it names one. A pre-existing finding is a
70
+ * warning; a pre-existing `lowering` one also says it is probably an SDK defect.
71
+ *
72
+ * When the edited case's serializer threw past collect mode, the rest of the
73
+ * case was never judged, so one more error, CHECK_INCOMPLETE, says so: passing
74
+ * never means "not checked".
75
+ */
76
+ export declare function scopeToEdit(edited: CheckedCase, baseline: CheckedCase): Diagnostic[];
77
+ export {};
@@ -0,0 +1,141 @@
1
+ import { refusalClass } from '../core/refusals.js';
2
+ import { preExistingFindings, scopeFindings } from '../core/baseline-scope.js';
3
+ const isObj = (v) => v !== null && typeof v === 'object' && !Array.isArray(v);
4
+ /** Key-order-free JSON, so two units compare by content. */
5
+ function stableJson(v) {
6
+ if (Array.isArray(v))
7
+ return `[${v.map(stableJson).join(',')}]`;
8
+ if (isObj(v))
9
+ return `{${Object.keys(v).sort().filter((k) => v[k] !== undefined).map((k) => `${JSON.stringify(k)}:${stableJson(v[k])}`).join(',')}}`;
10
+ return JSON.stringify(v) ?? 'null';
11
+ }
12
+ /** A node's canvas layout fields: where it is drawn, not what it does. */
13
+ const LAYOUT_FIELDS = new Set(['position', 'style', 'measured', 'width', 'height', 'zIndex', 'selected', 'dragging']);
14
+ /**
15
+ * The plan's stages, tasks and triggers by id ({@link CaseUnit}). A node that
16
+ * is no stage (a trigger, or any other node with an id) counts as a trigger.
17
+ */
18
+ export function caseUnits(plan) {
19
+ const units = new Map();
20
+ if (!plan)
21
+ return units;
22
+ const edges = (Array.isArray(plan.edges) ? plan.edges : []).filter(isObj);
23
+ for (const node of (Array.isArray(plan.nodes) ? plan.nodes : []).filter(isObj)) {
24
+ if (typeof node.id !== 'string')
25
+ continue;
26
+ const data = isObj(node.data) ? node.data : {};
27
+ const lanes = Array.isArray(data.tasks) ? data.tasks : [];
28
+ const isStage = String(node.type ?? '').endsWith('Stage');
29
+ for (const lane of lanes)
30
+ for (const task of Array.isArray(lane) ? lane.filter(isObj) : [])
31
+ if (typeof task.id === 'string')
32
+ units.set(task.id, { kind: 'task', name: String(task.displayName ?? ''), content: stableJson({ stage: node.id, task }) });
33
+ const shell = Object.fromEntries(Object.entries(node).filter(([k]) => !LAYOUT_FIELDS.has(k)));
34
+ shell.data = { ...data, ...(lanes.length ? { tasks: lanes.map((lane) => (Array.isArray(lane) ? lane.map((t) => (isObj(t) ? t.id : t)) : lane)) } : {}) };
35
+ const touching = edges.filter((e) => e.source === node.id || e.target === node.id).map(stableJson).sort();
36
+ const display = isObj(data.display) ? data.display : {};
37
+ units.set(node.id, {
38
+ kind: isStage ? 'stage' : 'trigger',
39
+ name: String(data.label ?? display.label ?? ''),
40
+ content: stableJson({ node: shell, edges: touching }),
41
+ });
42
+ }
43
+ return units;
44
+ }
45
+ /**
46
+ * The id of the unit a finding is on: its `nodeId` when the serializer placed
47
+ * it, else the unit its `where` names. `check` words `where` as a task's name,
48
+ * a stage's or trigger's label, or a phrase that starts with one
49
+ * (`task "Review" in stage "Intake" entry`, `stage "Intake" exit`). Undefined
50
+ * when it names none, or a name two units share.
51
+ */
52
+ export function unitOf(d, units) {
53
+ if (d.nodeId !== undefined && units.has(d.nodeId))
54
+ return d.nodeId;
55
+ const where = d.where;
56
+ if (where === undefined)
57
+ return undefined;
58
+ const named = (name, kinds) => {
59
+ const ids = [...units].filter(([, u]) => u.name === name && kinds.includes(u.kind)).map(([id]) => id);
60
+ return ids.length === 1 ? ids[0] : undefined;
61
+ };
62
+ const exact = named(where, ['stage', 'task', 'trigger']);
63
+ if (exact !== undefined)
64
+ return exact;
65
+ const task = /^task "(.*?)"(?= |$)/.exec(where);
66
+ if (task)
67
+ return named(task[1], ['task']);
68
+ const stage = /^stage "(.*?)"(?= |$)/.exec(where);
69
+ if (stage)
70
+ return named(stage[1], ['stage']);
71
+ return undefined;
72
+ }
73
+ /** Each unit name that names one unit, to that unit's id. A name two units share is left out. */
74
+ function namesToIds(units) {
75
+ const ids = new Map();
76
+ for (const [id, u] of units)
77
+ if (u.name)
78
+ ids.set(u.name, [...(ids.get(u.name) ?? []), id]);
79
+ return new Map([...ids].filter(([, list]) => list.length === 1).map(([name, [id]]) => [name, id]));
80
+ }
81
+ /**
82
+ * `message` with every `"quoted"` unit name replaced by `"#<id>"`, for
83
+ * comparing findings across a rename. For instance `Task "Wrap" in stage
84
+ * "Closing" has no entry rule` and the original's `Task "Wrap" in stage
85
+ * "Close" has no entry rule` both read `Task "#t1" in stage "#Stage_a" ...`.
86
+ */
87
+ function byId(message, names) {
88
+ return message.replace(/"([^"]*)"/g, (quoted, name) => {
89
+ const id = names.get(name);
90
+ return id === undefined ? quoted : `"#${id}"`;
91
+ });
92
+ }
93
+ /** What a pre-existing lowering error on a `kind` unit adds to its message ({@link scopeToEdit}). */
94
+ const loweringNote = (kind) => `This ${kind} is unchanged from the baseline, so this is probably an SDK defect: the SDK cannot read what the designer wrote. `
95
+ + `\`compile\` still refuses this ${kind}, so the case does not compile until the SDK reads it. `
96
+ + 'Report it: https://github.com/UiPath/builder-sdk/issues';
97
+ /**
98
+ * Scope `edited`'s findings to the edit, against `baseline`: the original
99
+ * caseplan decompiled and checked the same way (the module doc says which
100
+ * finding is which). Every finding gets an `origin`, its `class`, and the
101
+ * `nodeId` of the unit it is on when it names one. A pre-existing finding is a
102
+ * warning; a pre-existing `lowering` one also says it is probably an SDK defect.
103
+ *
104
+ * When the edited case's serializer threw past collect mode, the rest of the
105
+ * case was never judged, so one more error, CHECK_INCOMPLETE, says so: passing
106
+ * never means "not checked".
107
+ */
108
+ export function scopeToEdit(edited, baseline) {
109
+ const editedUnits = caseUnits(edited.plan);
110
+ const baselineUnits = caseUnits(baseline.plan);
111
+ // Messages are compared with each unit's name replaced by its id, so a
112
+ // renamed stage does not change the findings of the untouched tasks in it.
113
+ const editedNames = namesToIds(editedUnits);
114
+ const baselineNames = namesToIds(baselineUnits);
115
+ const scoped = edited.diagnostics.map((d) => {
116
+ const message = byId(d.message, editedNames);
117
+ const unit = unitOf(d, editedUnits);
118
+ if (unit === undefined)
119
+ return { level: d.level, code: d.code, message, place: '', unchanged: false };
120
+ const before = baselineUnits.get(unit);
121
+ return { level: d.level, code: d.code, message, place: unit, unchanged: before !== undefined && before.content === editedUnits.get(unit).content };
122
+ });
123
+ const preExisting = preExistingFindings(scoped, baseline.diagnostics.map((d) => ({ level: d.level, code: d.code, message: byId(d.message, baselineNames), place: unitOf(d, baselineUnits) ?? '' })));
124
+ const placed = edited.diagnostics.map((d, i) => {
125
+ const unit = scoped[i].place;
126
+ const cls = refusalClass(d.code);
127
+ return { ...d, ...(unit !== '' ? { nodeId: unit } : {}), ...(cls !== undefined ? { class: cls } : {}) };
128
+ });
129
+ // The lowering note names the unit, so each finding is scoped with its own.
130
+ const out = placed.map((d, i) => scopeFindings([d], preExisting.has(i) ? new Set([0]) : new Set(), loweringNote(scoped[i].place !== '' ? editedUnits.get(scoped[i].place).kind : 'part of the case'))[0]);
131
+ if (edited.stoppedAt) {
132
+ const at = edited.stoppedAt.code !== undefined ? `[${edited.stoppedAt.code}] ` : '';
133
+ out.push({
134
+ level: 'error', code: 'CHECK_INCOMPLETE',
135
+ message: `check stopped at ${at}${edited.stoppedAt.message} Nothing after it was checked, so the edit is not judged. `
136
+ + 'Fix it, even if the original has it too, and run check again.',
137
+ class: refusalClass('CHECK_INCOMPLETE'), origin: 'edited',
138
+ });
139
+ }
140
+ return out;
141
+ }
@@ -1,4 +1,4 @@
1
- import { asArray, asRecord, text } from '../walk.js';
1
+ import { asArray, asRecord, planTasks, text } from '../walk.js';
2
2
  import { WRITTEN_BY_COMPILE } from './common.js';
3
3
  /** The CLI's exemption: an in-solution resource's key and folderPath are decoupled by design (`../../resource-identity.ts`). */
4
4
  const SOLUTION_FOLDER_KEY_PREFIX = 'solution_folder.';
@@ -113,4 +113,66 @@ const bindingKeyShared = {
113
113
  return found;
114
114
  },
115
115
  };
116
- export const BINDING_RULES = [bindingKeyMismatch, bindingKeyShared];
116
+ /** The CLI's `NAME_BOUND_TASK_TYPES` (`resource-task-binding.ts`): the task types that bind a `name`/`folderPath` pair. */
117
+ const NAME_BOUND_TASK_TYPES = new Set([
118
+ 'action', 'agent', 'api-workflow', 'business-rule', 'case-management', 'flow-process', 'function', 'process', 'rpa',
119
+ ]);
120
+ /** The CLI's `RESOLVED_IDENTITY_KEYS`: a raw id, which is `STRICT_BINDINGS_TASK_UNBOUND`'s (not ported), not this rule's. */
121
+ const RESOLVED_IDENTITY_KEYS = ['resourceId', 'typeId', 'actionAppId', 'actionDefinitionId'];
122
+ /** A Studio Web quick form: an action task whose `data.context` marks it `hitlType: 'quick'` (`../../action-settings.ts`). */
123
+ function isQuickForm(data) {
124
+ return asArray(data.context).some((row) => {
125
+ const r = asRecord(row);
126
+ return r?.name === 'hitlType' && r.value === 'quick';
127
+ });
128
+ }
129
+ const taskBindingAbsent = {
130
+ code: 'STRICT_BINDINGS_TASK_ABSENT',
131
+ class: 'lint',
132
+ why: "The task's resource is the source's (`.action({ app })`, `.process(name)` and the rest); a task that names none is written as authored.",
133
+ level: 'warning',
134
+ cli: 'strict-case-rules.ts:620',
135
+ find(plan) {
136
+ // The CLI runs this only once the root bindings array holds an entry: a
137
+ // plan that binds nothing yet gets one plan-wide warning instead
138
+ // (STRICT_BINDINGS_ABSENT, not ported).
139
+ if (!asArray(plan.bindings).some((b) => asRecord(b) !== undefined))
140
+ return [];
141
+ const found = [];
142
+ for (const t of planTasks(plan)) {
143
+ const type = t.task.type;
144
+ const data = t.data;
145
+ if (typeof type !== 'string' || !NAME_BOUND_TASK_TYPES.has(type) || data === undefined)
146
+ continue;
147
+ if (RESOLVED_IDENTITY_KEYS.some((key) => data[key] !== undefined))
148
+ continue;
149
+ if (['name', 'folderPath'].some((field) => typeof data[field] === 'string' && data[field] !== ''))
150
+ continue;
151
+ // `data: {}` is an unresolved skeleton (`t.unresolved(kind)`), not a task that forgot its resource.
152
+ if (Object.keys(data).length === 0)
153
+ continue;
154
+ // Not in the CLI, on purpose: a quick form is the human task with an
155
+ // inline form and no Action App, and Studio Web saves it with no
156
+ // name/folderPath. The CLI reports it here anyway (a false positive);
157
+ // the SDK does not repeat it.
158
+ if (type === 'action' && isQuickForm(data))
159
+ continue;
160
+ const stageLabel = typeof asRecord(t.stage.data)?.label === 'string' ? String(asRecord(t.stage.data)?.label) : '';
161
+ const taskName = typeof t.task.displayName === 'string' ? t.task.displayName : type;
162
+ found.push({
163
+ path: `nodes[${stageLabel}].data.tasks[${taskName}].data`,
164
+ message: `Task "${taskName}" (${type}) names no resource at all: no \`name\`, no \`folderPath\` and no resolved id, `
165
+ + 'in a plan that binds its other resources. The task cannot run: nothing tells the platform which '
166
+ + (type === 'action' ? 'Action App it opens.' : 'resource it starts.'),
167
+ fix: type === 'action'
168
+ ? "Name the Action App the task opens: `.action({ ..., app: { name: '<App>', folder: '<Folder>' } })`. "
169
+ + "If the app is not published yet, write `t.unresolved('action')` instead and fill the task in once it is."
170
+ : `Name the ${type} the task runs and its folder: the first argument of its builder call and \`{ folder }\`.`,
171
+ where: t.taskLabel,
172
+ nodeId: t.taskId,
173
+ });
174
+ }
175
+ return found;
176
+ },
177
+ };
178
+ export const BINDING_RULES = [bindingKeyMismatch, bindingKeyShared, taskBindingAbsent];
@@ -30,6 +30,7 @@ export function registerCaseCommands(program) {
30
30
  .option('--connectors-local <dir>', 'connection-resolved connector overlay')
31
31
  .option('--bindings <file>', 'bindings.json, for the connection/folder label rules')
32
32
  .option('--resources <file>', 'resource ledger that registry prepare writes (default .flow-sdk/resources.json)')
33
+ .option('--baseline <file>', 'the original caseplan.json the source was decompiled from: findings on stages, tasks and triggers the edit did not touch, which the original has too, become warnings')
33
34
  .addOption(retiredCompiledOption())
34
35
  .action(async (input, options) => {
35
36
  let mode;
@@ -49,6 +50,7 @@ export function registerCaseCommands(program) {
49
50
  addValue(argv, '--connectors-local', options.connectorsLocal);
50
51
  addValue(argv, '--bindings', options.bindings);
51
52
  addValue(argv, '--resources', options.resources);
53
+ addValue(argv, '--baseline', options.baseline);
52
54
  await invoke('case check', () => import('../../case/check-cli.js'), argv);
53
55
  });
54
56
  family.command('decompile')
@@ -53,6 +53,13 @@ export declare function reportDiagnostics(diags: ReadonlyArray<ReportedDiagnosti
53
53
  * the origin ends.
54
54
  */
55
55
  export declare function diagnosticLine(d: ReportedDiagnostic): string;
56
+ /**
57
+ * `mark`, `d`'s message and `suffix`, with `check --baseline`'s origin ending
58
+ * the message's first line, where it is seen: ` (edited)`, ` (pre-existing)`
59
+ * for a lowering finding (its note follows on the next line), else
60
+ * ` (pre-existing, not counted)`. Without an origin, just the three.
61
+ */
62
+ export declare function withOrigin(mark: string, d: Pick<ReportedDiagnostic, 'message' | 'class' | 'origin'>, suffix?: string): string;
56
63
  /**
57
64
  * The error diagnostic for a throw that ends a compile: the error's own string
58
65
  * `code` when it carries one, else `COMPILE_FAILED`.
@@ -78,10 +78,17 @@ export function diagnosticLine(d) {
78
78
  const named = d.step !== undefined && d.message.includes(`"${d.step.split(' › ').pop()}"`);
79
79
  const suffix = (d.step !== undefined && !named ? ` (step "${d.step}")` : '')
80
80
  + (d.suggestion ? ` (did you mean "${d.suggestion}"?)` : '');
81
- const mark = `${d.level === 'error' ? '✗' : '⚠'} [${d.code}]`;
81
+ return withOrigin(`${d.level === 'error' ? '✗' : '⚠'} [${d.code}]`, d, suffix);
82
+ }
83
+ /**
84
+ * `mark`, `d`'s message and `suffix`, with `check --baseline`'s origin ending
85
+ * the message's first line, where it is seen: ` (edited)`, ` (pre-existing)`
86
+ * for a lowering finding (its note follows on the next line), else
87
+ * ` (pre-existing, not counted)`. Without an origin, just the three.
88
+ */
89
+ export function withOrigin(mark, d, suffix = '') {
82
90
  if (d.origin === undefined)
83
91
  return `${mark} ${d.message}${suffix}`;
84
- // With a baseline the origin ends the finding's first line, where it is seen.
85
92
  const origin = d.origin === 'edited' ? ' (edited)'
86
93
  : d.class === 'lowering' ? ' (pre-existing)' : ' (pre-existing, not counted)';
87
94
  const [first, ...rest] = d.message.split('\n');
@@ -216,6 +216,7 @@ export declare const REFUSALS: {
216
216
  readonly STRICT_JS_EXPRESSION_INVALID: "lint";
217
217
  readonly STRICT_RECIPIENT_EXPRESSION_TYPE: "lint";
218
218
  readonly STRICT_ACTION_CATALOG_NAMED: "lint";
219
+ readonly STRICT_BINDINGS_TASK_ABSENT: "lint";
219
220
  readonly TIMER_TASK_OUTPUTS_IGNORED: "lint";
220
221
  readonly TASK_MISSING_ELEMENT_ID: "lint";
221
222
  readonly CASE_NO_DEFAULT_EXPORT: "lowering";
@@ -287,6 +287,7 @@ export const REFUSALS = {
287
287
  STRICT_JS_EXPRESSION_INVALID: 'lint',
288
288
  STRICT_RECIPIENT_EXPRESSION_TYPE: 'lint',
289
289
  STRICT_ACTION_CATALOG_NAMED: 'lint',
290
+ STRICT_BINDINGS_TASK_ABSENT: 'lint',
290
291
  TIMER_TASK_OUTPUTS_IGNORED: 'lint',
291
292
  TASK_MISSING_ELEMENT_ID: 'lint',
292
293
  CASE_NO_DEFAULT_EXPORT: 'lowering',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uipath/maestro-builder-sdk",
3
- "version": "6.120.33",
3
+ "version": "6.121.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",
@@ -86,7 +86,8 @@
86
86
  "flow-decompile-scripts",
87
87
  "flow-script-metadata",
88
88
  "flow-pipeline-strict",
89
- "flow-build"
89
+ "flow-build",
90
+ "case-check-baseline"
90
91
  ],
91
92
  "files": [
92
93
  "dist",
@@ -124,5 +125,5 @@
124
125
  "@types/node": "^22.7.0",
125
126
  "esbuild": "^0.28.1"
126
127
  },
127
- "gitref": "5da397eb5e83bdd6f38bdbc72b4f63f572170647"
128
+ "gitref": "21e2eeafbe84a29c52703bb50aa5a06a642209cf"
128
129
  }