@uipath/maestro-builder-sdk 6.82.1 → 6.82.3

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,5 +1,9 @@
1
1
  import type { BindingsV2Document, InlineAgentFiles } from './bindings-v2.js';
2
2
  /** Read a `bindings_v2.json`, or `undefined` when absent or unparseable. */
3
3
  export declare function readBindingsV2(path: string): BindingsV2Document | undefined;
4
- /** Read one inline agent's directory the way refresh does; `undefined` when it has no readable `agent.json`. */
4
+ /**
5
+ * Read one inline agent's directory the way refresh does; `undefined` when it has no readable `agent.json`.
6
+ * A resource with `isEnabled: false` is read too, as refresh reads it: its binding rows stay
7
+ * declared, which `uip agent validate` requires (see compile's `disableStaleResource`, #1380).
8
+ */
5
9
  export declare function readInlineAgentFiles(agentDir: string): InlineAgentFiles | undefined;
@@ -19,7 +19,11 @@ export function readBindingsV2(path) {
19
19
  return undefined;
20
20
  }
21
21
  }
22
- /** Read one inline agent's directory the way refresh does; `undefined` when it has no readable `agent.json`. */
22
+ /**
23
+ * Read one inline agent's directory the way refresh does; `undefined` when it has no readable `agent.json`.
24
+ * A resource with `isEnabled: false` is read too, as refresh reads it: its binding rows stay
25
+ * declared, which `uip agent validate` requires (see compile's `disableStaleResource`, #1380).
26
+ */
23
27
  export function readInlineAgentFiles(agentDir) {
24
28
  let agent;
25
29
  try {
@@ -2,8 +2,12 @@
2
2
  * What the rule families share: the CLI commit they were ported from, and the
3
3
  * next step for a field compile writes itself.
4
4
  */
5
- /** The `UiPath/cli` commit the rules in this directory were read from. */
6
- export declare const CLI_PORTED_FROM = "b37f32997c";
5
+ /**
6
+ * The `UiPath/cli` commit the rules in this directory were last read against.
7
+ * The first 19 were ported at b37f32997c; TIMER_TASK_OUTPUTS_IGNORED, and the
8
+ * not-ported list in `tests/_case-plan-not-ported.ts`, were read at this one.
9
+ */
10
+ export declare const CLI_PORTED_FROM = "7dbaa6b9e";
7
11
  /**
8
12
  * The next step for a field `serialize` writes itself. From a source alone it
9
13
  * is an SDK bug; from a decompiled source it can be the plan's preserved data,
@@ -2,8 +2,12 @@
2
2
  * What the rule families share: the CLI commit they were ported from, and the
3
3
  * next step for a field compile writes itself.
4
4
  */
5
- /** The `UiPath/cli` commit the rules in this directory were read from. */
6
- export const CLI_PORTED_FROM = 'b37f32997c';
5
+ /**
6
+ * The `UiPath/cli` commit the rules in this directory were last read against.
7
+ * The first 19 were ported at b37f32997c; TIMER_TASK_OUTPUTS_IGNORED, and the
8
+ * not-ported list in `tests/_case-plan-not-ported.ts`, were read at this one.
9
+ */
10
+ export const CLI_PORTED_FROM = '7dbaa6b9e';
7
11
  /**
8
12
  * The next step for a field `serialize` writes itself. From a source alone it
9
13
  * is an SDK bug; from a decompiled source it can be the plan's preserved data,
@@ -1,4 +1,5 @@
1
1
  import { asRecord, planTasks } from '../walk.js';
2
+ import { WRITTEN_BY_COMPILE } from './common.js';
2
3
  /** The CLI's `RECIPIENT_PREFIXES`: a value still carrying one is `STRICT_RECIPIENT_PREFIX_LEFT`'s, not ported. */
3
4
  const RECIPIENT_PREFIXES = ['User:', 'UserGroup:', 'Role:', 'Email:', 'Expression:'];
4
5
  const recipientExpressionType = {
@@ -57,4 +58,53 @@ const actionCatalogNamed = {
57
58
  return found;
58
59
  },
59
60
  };
60
- export const TASK_RULES = [recipientExpressionType, actionCatalogNamed];
61
+ const timerOutputsIgnored = {
62
+ code: 'TIMER_TASK_OUTPUTS_IGNORED',
63
+ class: 'lint',
64
+ why: 'A timer task carries outputs only when the source gives it a custom `.outputs({ v: { assign } })`, written as authored.',
65
+ level: 'warning',
66
+ cli: 'case-validators/timer-validator.ts:77',
67
+ find(plan) {
68
+ const found = [];
69
+ for (const t of planTasks(plan)) {
70
+ if (t.task.type !== 'wait-for-timer')
71
+ continue;
72
+ if (!Array.isArray(t.data?.outputs) || t.data.outputs.length === 0)
73
+ continue;
74
+ found.push({
75
+ path: `nodes[${t.stageId}].data.tasks[${t.taskId}].data`,
76
+ message: `Timer task "${t.taskLabel}" declares "data.outputs", but pack drops them on a wait-for-timer task, so no variable is written.`,
77
+ fix: 'Drop `.outputs()` from the `.waitForTimer()` task and set the variable from a script task placed after the timer.',
78
+ where: t.taskLabel,
79
+ nodeId: t.taskId,
80
+ });
81
+ }
82
+ return found;
83
+ },
84
+ };
85
+ const taskMissingElementId = {
86
+ code: 'TASK_MISSING_ELEMENT_ID',
87
+ class: 'lint',
88
+ why: "Compile stamps every task's elementId, but a decompiled plan that omitted it records the omission and compile drops it again; until the contract decides the preserved case (D6), only check reports it.",
89
+ level: 'warning',
90
+ cli: 'case-validators/task-hygiene-validator.ts:18',
91
+ find(plan) {
92
+ const found = [];
93
+ for (const t of planTasks(plan)) {
94
+ if (t.task.elementId !== undefined)
95
+ continue;
96
+ const hasRows = (key) => Array.isArray(t.data?.[key]) && t.data[key].length > 0;
97
+ if (!hasRows('inputs') && !hasRows('outputs'))
98
+ continue;
99
+ found.push({
100
+ path: `nodes[${t.stageId}].data.tasks[${t.taskId}]`,
101
+ message: `Task "${t.taskLabel}" carries inputs or outputs but has no "elementId", so those variables do not resolve to it.`,
102
+ fix: `The elementId is "${t.stageId}-${t.taskId}"; ${WRITTEN_BY_COMPILE}`,
103
+ where: t.taskLabel,
104
+ nodeId: t.taskId,
105
+ });
106
+ }
107
+ return found;
108
+ },
109
+ };
110
+ export const TASK_RULES = [recipientExpressionType, actionCatalogNamed, timerOutputsIgnored, taskMissingElementId];
@@ -279,8 +279,7 @@ export async function run(argv) {
279
279
  catch (error) {
280
280
  // Studio Web's project file system refuses deletes. Only a surviving file keeps its row: a later compile skips a folder with no resource.json.
281
281
  if (existsSync(file)) {
282
- console.error(`compile: could not remove stale ${relative(outDir, file)} (${error instanceof Error ? error.message : String(error)}); `
283
- + 'it is still declared as a resource of this agent until it is deleted.');
282
+ disableStaleResource(file, body, relative(outDir, file), error);
284
283
  continue;
285
284
  }
286
285
  }
@@ -345,6 +344,33 @@ function draftWarning(d) {
345
344
  };
346
345
  }
347
346
  runWhenInvokedDirectly(import.meta.url, 'compile', run);
347
+ /**
348
+ * Turn off a stale agent tool the host would not delete (#1380) by rewriting it
349
+ * with `isEnabled: false`; adding the tool back writes `isEnabled: true` again.
350
+ *
351
+ * A context is only warned about: its storage schema drops `isEnabled`, so the
352
+ * context would stay active. The resource's `bindings_v2.json` rows stay either
353
+ * way: `uip agent validate --inline-in-flow` requires them.
354
+ */
355
+ function disableStaleResource(file, body, shown, refused) {
356
+ const reason = refused instanceof Error ? refused.message : String(refused);
357
+ const stillActive = (why) => console.error(`compile: could not remove stale ${shown} (${reason})${why}; `
358
+ + 'it is still an active resource of this agent until it is deleted.');
359
+ if (body.$resourceType !== 'tool')
360
+ return stillActive('');
361
+ if (body.isEnabled === false) {
362
+ console.log(`compile: kept stale ${shown} disabled (isEnabled: false); it could not be removed (${reason})`);
363
+ return;
364
+ }
365
+ try {
366
+ writeJsonFile(file, { ...body, isEnabled: false });
367
+ }
368
+ catch (error) {
369
+ return stillActive(` or disable it (${error instanceof Error ? error.message : String(error)})`);
370
+ }
371
+ console.log(`compile: disabled stale ${shown} (isEnabled: false): it could not be removed (${reason}). `
372
+ + 'The agent no longer calls it; delete its folder to drop it for good.');
373
+ }
348
374
  /** A JSON file's contents, or `undefined` when it is missing or unreadable. */
349
375
  function readJsonOrUndefined(path) {
350
376
  try {
@@ -204,6 +204,8 @@ export declare const REFUSALS: {
204
204
  readonly STRICT_JS_EXPRESSION_INVALID: "lint";
205
205
  readonly STRICT_RECIPIENT_EXPRESSION_TYPE: "lint";
206
206
  readonly STRICT_ACTION_CATALOG_NAMED: "lint";
207
+ readonly TIMER_TASK_OUTPUTS_IGNORED: "lint";
208
+ readonly TASK_MISSING_ELEMENT_ID: "lint";
207
209
  readonly CASE_NO_DEFAULT_EXPORT: "lowering";
208
210
  readonly CASE_SOURCE_NOT_FOUND: "lowering";
209
211
  readonly CASE_TRIGGER_OBJECT_AND_SUBSCRIPTION: "lowering";
@@ -274,6 +274,8 @@ export const REFUSALS = {
274
274
  STRICT_JS_EXPRESSION_INVALID: 'lint',
275
275
  STRICT_RECIPIENT_EXPRESSION_TYPE: 'lint',
276
276
  STRICT_ACTION_CATALOG_NAMED: 'lint',
277
+ TIMER_TASK_OUTPUTS_IGNORED: 'lint',
278
+ TASK_MISSING_ELEMENT_ID: 'lint',
277
279
  CASE_NO_DEFAULT_EXPORT: 'lowering',
278
280
  CASE_SOURCE_NOT_FOUND: 'lowering',
279
281
  CASE_TRIGGER_OBJECT_AND_SUBSCRIPTION: 'lowering',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uipath/maestro-builder-sdk",
3
- "version": "6.82.1",
3
+ "version": "6.82.3",
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": "cd9e43c9e5505bd7691f83cf7cce2283a190ec7b"
106
+ "gitref": "e0b86864208ddfdb8a4694661944938cfe588fe7"
107
107
  }