@uipath/maestro-builder-sdk 6.69.1 → 6.70.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.
@@ -5,7 +5,7 @@
5
5
  * the library does not carry passed `check` and failed at `compile` (#1014).
6
6
  * Flow and BPMN read their connector facts from `connectorCheckOpts`
7
7
  * (`core/cli-library.ts`); Case now does too, through this one builder, which
8
- * both `case check` and `case compile`'s check pass call.
8
+ * `case check` calls.
9
9
  */
10
10
  import { connectorCheckOpts } from '../core/cli-library.js';
11
11
  /**
@@ -5,22 +5,24 @@
5
5
  * Usage:
6
6
  * node --experimental-strip-types compile-cli.js <case.ts | BaseName> [-o out.json]
7
7
  *
8
- * Runs the fast static check first; if it passes, serializes to a V32
9
- * caseplan.json. The authoritative deploy gate is `uip maestro case validate`.
8
+ * Only serializes, to a V32 caseplan.json (docs/CHECK_COMPILE_CONTRACT_DESIGN.md
9
+ * D1, phase 8). It does not run `check()`'s lint rules: run `case check` first
10
+ * for those. It stops only when it cannot write a correct plan, a refusal the
11
+ * serializer throws, printed in `check`'s `✗ [CODE]` shape (and `case check`
12
+ * reports the same refusal, from the same code). The authoritative deploy gate
13
+ * is `uip maestro case validate`.
10
14
  * Output defaults to the plan file the project in the working directory ships
11
15
  * (`caseplan.case` for a project `uip maestro case init` scaffolded), else
12
16
  * `caseplan.json`. An `-o` that names a different plan file than the project
13
17
  * ships is refused (CASE_OUTPUT_NOT_SHIPPED), and so is a plan file written into
14
18
  * a solution directory above its Case project (CASE_OUTPUT_OUTSIDE_PROJECT).
15
19
  */
16
- import { reportDiagnostics, reportResult, thrownDiagnostic } from '../cli-result.js';
20
+ import { diagnosticLine, reportDiagnostics, reportResult, thrownDiagnostic } from '../cli-result.js';
17
21
  import { writeJsonFile } from '../core/json-file.js';
18
22
  import { readFileSync, existsSync, readdirSync } from 'node:fs';
19
23
  import { join, dirname, basename, resolve } from 'node:path';
20
24
  import { resolveCaseFile, loadBuiltCase } from './load.js';
21
25
  import { serialize } from './serialize.js';
22
- import { check } from './check.js';
23
- import { caseCheckOpts } from './cli-library.js';
24
26
  import { entryPointIO } from './entry-points.js';
25
27
  import { Bindings } from '../core/bindings.js';
26
28
  import { offlineBindingLabel } from './ids.js';
@@ -32,6 +34,7 @@ import { CASE_FORMAT_PROFILE } from './format-profile.js';
32
34
  import { deriveCaseBindingsV2 } from './bindings-v2.js';
33
35
  import { BINDINGS_V2_DOCUMENT_VERSION } from '../core/bindings-v2-resource.js';
34
36
  import { sha256Uuid } from '../core/stable-id.js';
37
+ import { CompileRefusal } from '../core/compile-refusal.js';
35
38
  export async function run(argv) {
36
39
  if (argv.length === 0 || argv[0] === '-h' || argv[0] === '--help') {
37
40
  console.error('usage: compile <case.ts | BaseName> [-o <project>/caseplan.case]');
@@ -53,23 +56,13 @@ export async function run(argv) {
53
56
  // fine right after a pull on Flow failed here for no visible reason. The helper
54
57
  // also auto-detects the `connectors-local/` overlay `registry prepare` writes,
55
58
  // which is what the three copies of these lines used to each decide for itself.
56
- // Opened BEFORE the check pass, which reads the same library (#1014).
59
+ // `case check` opens it the same way (#1014).
57
60
  const library = openCliLibrary(argv);
58
61
  const { out, bindings } = caseCompileTarget(argv);
59
- const diags = check(built, caseCheckOpts(library, bindings));
60
- for (const d of diags)
61
- console.error(` ${d.level === 'error' ? '✗' : '⚠'} [${d.code}] ${d.message}`);
62
- // Reported before serialize, so every exit path carries what stderr printed.
63
- reportDiagnostics(diags);
64
- const errors = diags.filter((d) => d.level === 'error');
65
- if (errors.length) {
66
- console.error(`compile: ${errors.length} error(s); not emitting.`);
67
- return 1;
68
- }
69
62
  const shadow = shadowedOutputDiagnostic(out);
70
63
  if (shadow) {
71
64
  console.error(` ✗ [${shadow.code}] ${shadow.message} Fix: ${shadow.suggestion}.`);
72
- reportDiagnostics([...diags, shadow]);
65
+ reportDiagnostics([shadow]);
73
66
  console.error('compile: 1 error(s); not emitting.');
74
67
  return 1;
75
68
  }
@@ -78,9 +71,28 @@ export async function run(argv) {
78
71
  caseplan = serialize(built, { library, bindings });
79
72
  }
80
73
  catch (error) {
81
- reportDiagnostics([...diags, thrownDiagnostic(error)]);
82
- throw error;
74
+ if (!(error instanceof Error) || (!(error instanceof CompileRefusal) && error.message.startsWith('internal SDK error:'))) {
75
+ // A broken SDK invariant still ends the run through the caller (exit 1,
76
+ // `--json` `error`); the diagnostic is reported first.
77
+ reportDiagnostics([thrownDiagnostic(error)]);
78
+ throw error;
79
+ }
80
+ // The serializer cannot write a correct plan: a coded refusal, or a throw
81
+ // it has no refusal for (a `TypeError` on a malformed spec), which is
82
+ // COMPILE_FAILED, as `case check` reports it (`refusalOf`, serialize.ts).
83
+ const refused = error instanceof CompileRefusal
84
+ ? {
85
+ level: 'error', code: error.code, message: error.message,
86
+ ...(error.suggestion !== undefined ? { suggestion: error.suggestion } : {}),
87
+ }
88
+ : { level: 'error', code: 'COMPILE_FAILED', message: error.message };
89
+ console.error(` ${diagnosticLine(refused)}`);
90
+ reportDiagnostics([refused]);
91
+ console.error('compile: 1 error(s); not emitting.');
92
+ return 1;
83
93
  }
94
+ // Reported before the first write, so a write that throws still carries it.
95
+ reportDiagnostics([]);
84
96
  // Entry points first: each trigger carries its entry point's `uniqueId` as
85
97
  // `data.inputs.entryPointId`, so the plan is written after the ids are known.
86
98
  const triggers = syncEntryPoints(caseplan, out);
@@ -21,10 +21,10 @@
21
21
  * they get different codes, so one code never both stops compile and lets it
22
22
  * write.
23
23
  *
24
- * Since `compile` no longer runs `check` (#1497), a `lint` code is only right
24
+ * Since `compile` no longer runs `check` (Flow #1497, Case #1446), a `lint` code is only right
25
25
  * when the serializer still writes what the source says while the rule fires:
26
- * otherwise `compile` writes a wrong `.flow` without a word, and the code is
27
- * `lowering` (the serializer must refuse it). Every Flow `lint` code has a row
26
+ * otherwise `compile` writes a wrong `.flow` (or caseplan) without a word, and the code is
27
+ * `lowering` (the serializer must refuse it). Every Flow, Case and BPMN `lint` code has a row
28
28
  * in `tests/lint-lossless/` (#1518): a round-trip fixture, a fixture the
29
29
  * serializer refuses, or a written reason. The round trip shows the rule's
30
30
  * condition survives compile -> decompile -> compile and that compile is
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uipath/maestro-builder-sdk",
3
- "version": "6.69.1",
3
+ "version": "6.70.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",
@@ -100,5 +100,5 @@
100
100
  "@types/node": "^22.7.0",
101
101
  "esbuild": "^0.28.1"
102
102
  },
103
- "gitref": "f2e643fd7aeb11ab748bb281be50d24fe339bf52"
103
+ "gitref": "990446f9254b96a4cb0cbfc1a3ec7f99deaabe5e"
104
104
  }