@uipath/tasks-tool 1.201.0 → 1.202.0-preview.136

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.
Files changed (27) hide show
  1. package/dist/{folder-picker-interactive-2kj361mt.js → folder-picker-interactive-1j0ncph1.js} +6 -9
  2. package/dist/{folder-resolver-htdmzdhy.js → folder-resolver-6pbmf1am.js} +6 -9
  3. package/dist/{getMachineId-bsd-wfkxpxjv.js → getMachineId-bsd-67w37xtj.js} +5 -5
  4. package/dist/{getMachineId-darwin-9asn4zy6.js → getMachineId-darwin-4g3xfpfp.js} +5 -5
  5. package/dist/{getMachineId-linux-62t6m027.js → getMachineId-linux-a4p6fb9w.js} +4 -4
  6. package/dist/{getMachineId-unsupported-dfrzeqc3.js → getMachineId-unsupported-77w362eh.js} +4 -4
  7. package/dist/{getMachineId-win-zgvrp5q3.js → getMachineId-win-9cfxg9c8.js} +5 -5
  8. package/dist/{index-2fj08e7n.js → index-gpd94m28.js} +27 -27
  9. package/dist/{index-w03qc9m8.js → index-sby22td6.js} +4 -4
  10. package/dist/index.js +5 -8
  11. package/dist/{js-yaml-4ypbq2tt.js → js-yaml-88tdqrtd.js} +27 -19
  12. package/dist/{tool-0n9mj887.js → tool-1b723ek8.js} +3 -3
  13. package/dist/{tool-0v6na3yp.js → tool-1de529jm.js} +9 -7
  14. package/dist/{tool-h1k9mjs9.js → tool-2czkpqb0.js} +3 -3
  15. package/dist/{tool-r6rhp5ep.js → tool-bndhpxxj.js} +46 -46
  16. package/dist/{tool-mw0gkfep.js → tool-p1m6mq0e.js} +104 -119
  17. package/dist/{tool-rsk1xt86.js → tool-wfqnt43t.js} +1600 -504
  18. package/dist/tool.js +7 -10
  19. package/package.json +2 -2
  20. package/src/commands/catalogs.ts +25 -21
  21. package/src/commands/tasks.spec.ts +96 -66
  22. package/tests/catalogs.e2e.test.ts +25 -0
  23. package/dist/browser-strategy-yccf8mtd.js +0 -99
  24. package/dist/node-strategy-12qfy0nv.js +0 -348
  25. package/dist/tool-5arsyj36.js +0 -11
  26. package/dist/tool-7eva0peq.js +0 -265
  27. package/dist/tool-9qecd4wb.js +0 -14
package/dist/tool.js CHANGED
@@ -1,16 +1,13 @@
1
1
  import {
2
2
  metadata,
3
3
  registerCommands
4
- } from "./tool-mw0gkfep.js";
5
- import"./tool-rsk1xt86.js";
6
- import"./tool-9qecd4wb.js";
7
- import"./tool-7eva0peq.js";
8
- import"./tool-5arsyj36.js";
9
- import"./tool-r6rhp5ep.js";
10
- import"./tool-0v6na3yp.js";
4
+ } from "./tool-p1m6mq0e.js";
5
+ import"./tool-wfqnt43t.js";
6
+ import"./tool-bndhpxxj.js";
7
+ import"./tool-1de529jm.js";
11
8
  export {
12
- registerCommands,
13
- metadata
9
+ metadata,
10
+ registerCommands
14
11
  };
15
12
 
16
- //# debugId=106E34AF1A233DCE64756E2164756E21
13
+ //# debugId=6DFACACDB904CB6164756E2164756E21
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@uipath/tasks-tool",
3
3
  "license": "MIT",
4
- "version": "1.201.0",
4
+ "version": "1.202.0-preview.136",
5
5
  "description": "Manage Action Center tasks.",
6
6
  "publishConfig": {
7
7
  "registry": "https://registry.npmjs.org/"
@@ -14,5 +14,5 @@
14
14
  "bin": {
15
15
  "tasks-tool": "./dist/index.js"
16
16
  },
17
- "gitHead": "7933378ad5276ac369900293a1447474dcec6826"
17
+ "gitHead": "f6270de2c7c04f4c43b2f5187b0c3d3c314c2610"
18
18
  }
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  catchError,
3
- extractErrorMessage,
3
+ classifiedFailure,
4
4
  OutputFormatter,
5
5
  processContext,
6
6
  RESULTS,
@@ -67,11 +67,12 @@ export const registerCatalogsCommand = (program: Command) => {
67
67
  taskCatalogs.getAll(getOptions),
68
68
  );
69
69
  if (listError) {
70
- OutputFormatter.error({
71
- Result: RESULTS.Failure,
72
- Message: "Error listing task catalogs",
73
- Instructions: await extractErrorMessage(listError),
74
- });
70
+ OutputFormatter.error(
71
+ await classifiedFailure(
72
+ "Error listing task catalogs",
73
+ listError,
74
+ ),
75
+ );
75
76
  processContext.exit(1);
76
77
  return;
77
78
  }
@@ -121,11 +122,12 @@ export const registerCatalogsCommand = (program: Command) => {
121
122
  taskCatalogs.getById(parsedId, { folderId }),
122
123
  );
123
124
  if (getError) {
124
- OutputFormatter.error({
125
- Result: RESULTS.Failure,
126
- Message: `Error getting task catalog '${id}'`,
127
- Instructions: await extractErrorMessage(getError),
128
- });
125
+ OutputFormatter.error(
126
+ await classifiedFailure(
127
+ `Error getting task catalog '${id}'`,
128
+ getError,
129
+ ),
130
+ );
129
131
  processContext.exit(1);
130
132
  return;
131
133
  }
@@ -177,11 +179,12 @@ export const registerCatalogsCommand = (program: Command) => {
177
179
  taskCatalogs.create(options.name, writeOptions),
178
180
  );
179
181
  if (createError) {
180
- OutputFormatter.error({
181
- Result: RESULTS.Failure,
182
- Message: `Error creating task catalog '${options.name}'`,
183
- Instructions: await extractErrorMessage(createError),
184
- });
182
+ OutputFormatter.error(
183
+ await classifiedFailure(
184
+ `Error creating task catalog '${options.name}'`,
185
+ createError,
186
+ ),
187
+ );
185
188
  processContext.exit(1);
186
189
  return;
187
190
  }
@@ -253,11 +256,12 @@ export const registerCatalogsCommand = (program: Command) => {
253
256
  taskCatalogs.updateById(parsedId, writeOptions),
254
257
  );
255
258
  if (updateError) {
256
- OutputFormatter.error({
257
- Result: RESULTS.Failure,
258
- Message: `Error updating task catalog '${id}'`,
259
- Instructions: await extractErrorMessage(updateError),
260
- });
259
+ OutputFormatter.error(
260
+ await classifiedFailure(
261
+ `Error updating task catalog '${id}'`,
262
+ updateError,
263
+ ),
264
+ );
261
265
  processContext.exit(1);
262
266
  return;
263
267
  }
@@ -1020,30 +1020,6 @@ describe("tasks catalogs list", () => {
1020
1020
  }),
1021
1021
  );
1022
1022
  });
1023
-
1024
- it("should propagate API errors", async () => {
1025
- mockSdk();
1026
- mockCatalogs({
1027
- getAll: vi.fn().mockRejectedValue(new Error("boom")),
1028
- });
1029
-
1030
- const program = buildProgram();
1031
- await program.parseAsync([
1032
- "node",
1033
- "test",
1034
- "catalogs",
1035
- "list",
1036
- "--folder-id",
1037
- "42",
1038
- ]);
1039
-
1040
- expect(OutputFormatter.error).toHaveBeenCalledWith(
1041
- expect.objectContaining({
1042
- Result: "Failure",
1043
- Message: "Error listing task catalogs",
1044
- }),
1045
- );
1046
- });
1047
1023
  });
1048
1024
 
1049
1025
  describe("tasks catalogs get", () => {
@@ -1103,31 +1079,6 @@ describe("tasks catalogs get", () => {
1103
1079
  }),
1104
1080
  );
1105
1081
  });
1106
-
1107
- it("should propagate API errors", async () => {
1108
- mockSdk();
1109
- mockCatalogs({
1110
- getById: vi.fn().mockRejectedValue(new Error("not found")),
1111
- });
1112
-
1113
- const program = buildProgram();
1114
- await program.parseAsync([
1115
- "node",
1116
- "test",
1117
- "catalogs",
1118
- "get",
1119
- "7",
1120
- "--folder-id",
1121
- "42",
1122
- ]);
1123
-
1124
- expect(OutputFormatter.error).toHaveBeenCalledWith(
1125
- expect.objectContaining({
1126
- Result: "Failure",
1127
- Message: "Error getting task catalog '7'",
1128
- }),
1129
- );
1130
- });
1131
1082
  });
1132
1083
 
1133
1084
  describe("tasks catalogs create", () => {
@@ -1322,30 +1273,109 @@ describe("tasks catalogs update", () => {
1322
1273
  }),
1323
1274
  );
1324
1275
  });
1276
+ });
1325
1277
 
1326
- it("should propagate API errors", async () => {
1278
+ // Every catalogs handler must classify a backend failure, so an agent can tell
1279
+ // "retry this" from "this will never work". Table-driven because the four
1280
+ // handlers differ only in the SDK method and the message they wrap it in.
1281
+ describe("tasks catalogs error classification", () => {
1282
+ beforeEach(() => {
1283
+ vi.resetAllMocks();
1284
+ process.exitCode = undefined;
1285
+ });
1286
+
1287
+ const HANDLERS = [
1288
+ {
1289
+ name: "list",
1290
+ method: "getAll",
1291
+ argv: ["catalogs", "list", "--folder-id", "42"],
1292
+ message: "Error listing task catalogs",
1293
+ },
1294
+ {
1295
+ name: "get",
1296
+ method: "getById",
1297
+ argv: ["catalogs", "get", "9", "--folder-id", "42"],
1298
+ message: "Error getting task catalog '9'",
1299
+ },
1300
+ {
1301
+ name: "create",
1302
+ method: "create",
1303
+ argv: [
1304
+ "catalogs",
1305
+ "create",
1306
+ "--folder-id",
1307
+ "42",
1308
+ "--name",
1309
+ "Invoices",
1310
+ ],
1311
+ message: "Error creating task catalog 'Invoices'",
1312
+ },
1313
+ {
1314
+ name: "update",
1315
+ method: "updateById",
1316
+ argv: [
1317
+ "catalogs",
1318
+ "update",
1319
+ "9",
1320
+ "--folder-id",
1321
+ "42",
1322
+ "--name",
1323
+ "Renamed",
1324
+ ],
1325
+ message: "Error updating task catalog '9'",
1326
+ },
1327
+ ];
1328
+
1329
+ async function runFailing(
1330
+ method: string,
1331
+ argv: string[],
1332
+ error: unknown,
1333
+ ): Promise<void> {
1327
1334
  mockSdk();
1328
- mockCatalogs({
1329
- updateById: vi.fn().mockRejectedValue(new Error("nope")),
1330
- });
1335
+ mockCatalogs({ [method]: vi.fn().mockRejectedValue(error) });
1336
+ const program = buildProgram();
1337
+ await program.parseAsync(["node", "test", ...argv]);
1338
+ }
1339
+
1340
+ it.each(HANDLERS)("$name reports a transient 5xx as retryable", async ({
1341
+ method,
1342
+ argv,
1343
+ message,
1344
+ }) => {
1345
+ await runFailing(
1346
+ method,
1347
+ argv,
1348
+ Object.assign(new Error("Service Unavailable"), {
1349
+ status: 503,
1350
+ }),
1351
+ );
1331
1352
 
1332
- const program = buildProgram();
1333
- await program.parseAsync([
1334
- "node",
1335
- "test",
1336
- "catalogs",
1337
- "update",
1338
- "9",
1339
- "--folder-id",
1340
- "42",
1341
- "--name",
1342
- "Renamed",
1343
- ]);
1353
+ expect(OutputFormatter.error).toHaveBeenCalledWith(
1354
+ expect.objectContaining({
1355
+ Result: "Failure",
1356
+ Message: message,
1357
+ ErrorCode: "server_error",
1358
+ Retry: "RetryLater",
1359
+ Context: { httpStatus: 503 },
1360
+ }),
1361
+ );
1362
+ });
1363
+
1364
+ // A non-HTTP failure carries no Context, which also exercises the other
1365
+ // side of the `context ? { Context } : {}` spread in each handler.
1366
+ it.each(HANDLERS)("$name reports a plain failure as non-retryable", async ({
1367
+ method,
1368
+ argv,
1369
+ message,
1370
+ }) => {
1371
+ await runFailing(method, argv, new Error("boom"));
1344
1372
 
1345
1373
  expect(OutputFormatter.error).toHaveBeenCalledWith(
1346
1374
  expect.objectContaining({
1347
1375
  Result: "Failure",
1348
- Message: "Error updating task catalog '9'",
1376
+ Message: message,
1377
+ ErrorCode: "unknown_error",
1378
+ Retry: "RetryWillNotFix",
1349
1379
  }),
1350
1380
  );
1351
1381
  });
@@ -18,6 +18,9 @@ interface Envelope {
18
18
  Data?: unknown;
19
19
  Message?: string;
20
20
  Instructions?: string;
21
+ ErrorCode?: string;
22
+ Retry?: string;
23
+ Context?: { httpStatus?: number };
21
24
  }
22
25
 
23
26
  interface Catalog {
@@ -90,6 +93,20 @@ function getCatalog(id: number): Envelope {
90
93
  return parseOutput(raw.stdout, "json") as Envelope;
91
94
  }
92
95
 
96
+ /**
97
+ * A failure envelope built by `classifiedFailure()` carries the backend status
98
+ * through, so the error code comes from that status instead of falling back to
99
+ * the `unknown_error` default. The code is only asserted when the failure
100
+ * actually had an HTTP status — a network blip on the way to the tenant has
101
+ * none, and that is not what these scenarios pin.
102
+ */
103
+ function expectClassified(res: Envelope): void {
104
+ expect(res.Retry).toBeDefined();
105
+ if (res.Context?.httpStatus !== undefined) {
106
+ expect(res.ErrorCode).not.toBe("unknown_error");
107
+ }
108
+ }
109
+
93
110
  describe("tasks catalogs e2e", () => {
94
111
  it(
95
112
  "S1: list catalogs in a folder",
@@ -159,6 +176,7 @@ describe("tasks catalogs e2e", () => {
159
176
  expect(raw.exitCode).not.toBe(0);
160
177
  expect(res.Result).toBe(RESULTS.Failure);
161
178
  expect(res.Message).toMatch(/^Error getting task catalog/);
179
+ expectClassified(res);
162
180
  },
163
181
  EXEC_TIMEOUT,
164
182
  );
@@ -324,6 +342,7 @@ describe("tasks catalogs e2e", () => {
324
342
  expect(raw.exitCode).not.toBe(0);
325
343
  expect(res.Result).toBe(RESULTS.Failure);
326
344
  expect(res.Message).toMatch(/^Error updating task catalog/);
345
+ expectClassified(res);
327
346
  },
328
347
  EXEC_TIMEOUT,
329
348
  );
@@ -390,4 +409,10 @@ describe("tasks catalogs e2e", () => {
390
409
  },
391
410
  EXEC_TIMEOUT,
392
411
  );
412
+
413
+ // A 5xx from the catalogs endpoint cannot be induced against a live tenant,
414
+ // so the RetryLater classification is unit-covered in tasks.spec.ts instead.
415
+ // Expected envelope on an HTTP 5xx from any catalogs call: Result: Failure,
416
+ // ErrorCode: server_error, Retry: RetryLater, Context.httpStatus: 5xx.
417
+ it.skip("S15: a transient catalogs failure is reported as retryable", () => {});
393
418
  });
@@ -1,99 +0,0 @@
1
- import {
2
- getGlobalThis
3
- } from "./tool-9qecd4wb.js";
4
- import {
5
- AUTH_CANCELLED_ERROR_CODE
6
- } from "./tool-5arsyj36.js";
7
- import"./tool-0v6na3yp.js";
8
-
9
- // ../auth/src/strategies/browser-strategy.ts
10
- class BrowserAuthStrategy {
11
- async execute(url, _redirectUri, expectedState, opts) {
12
- const global = getGlobalThis();
13
- if (!global?.window) {
14
- throw new Error("Browser environment required for authentication");
15
- }
16
- const screenWidth = global.window.screen?.width ?? 1024;
17
- const screenHeight = global.window.screen?.height ?? 768;
18
- const width = 600;
19
- const height = 700;
20
- const left = screenWidth / 2 - width / 2;
21
- const top = screenHeight / 2 - height / 2;
22
- if (!global.window.open) {
23
- throw new Error("window.open is not available");
24
- }
25
- const popupResult = global.window.open(url, "uip_auth", `width=${width},height=${height},left=${left},top=${top},resizable=yes,scrollbars=yes,status=yes`);
26
- const popup = popupResult;
27
- if (!popup) {
28
- throw new Error(`Authentication popup was blocked by your browser.
29
-
30
- ` + `To continue:
31
- ` + `1. Look for a popup blocker icon in your address bar
32
- ` + `2. Allow popups for this site
33
- ` + `3. Try logging in again
34
-
35
- ` + "If using an ad blocker, you may need to temporarily disable it.");
36
- }
37
- return new Promise((resolve, reject) => {
38
- let timer;
39
- const messageHandler = (event) => {
40
- if (event.data?.type === "UIP_AUTH_CODE" && event.data.code) {
41
- if (event.data.state !== expectedState) {
42
- cleanup();
43
- reject(new Error("OAuth state mismatch — the callback state does not match the expected value. " + "This may indicate a CSRF attack. Please try signing in again."));
44
- popup.close();
45
- return;
46
- }
47
- cleanup();
48
- resolve(event.data.code);
49
- popup.close();
50
- } else if (event.data?.type === "UIP_AUTH_ERROR") {
51
- cleanup();
52
- const errorMsg = event.data.error || "Authentication failed";
53
- reject(new Error(`Authentication failed: ${errorMsg}
54
-
55
- ` + "Please check your credentials and try again. " + "If the problem persists, verify your UiPath account is active."));
56
- popup.close();
57
- }
58
- };
59
- const cleanup = () => {
60
- global.window?.removeEventListener?.("message", messageHandler);
61
- opts?.signal?.removeEventListener("abort", onAbort);
62
- if (timer)
63
- clearInterval(timer);
64
- };
65
- const onAbort = () => {
66
- cleanup();
67
- const err = new Error(`Authentication was cancelled.
68
-
69
- ` + "The sign-in was cancelled before completing the login process. " + "Please try again and complete the authentication flow.");
70
- err.code = AUTH_CANCELLED_ERROR_CODE;
71
- reject(err);
72
- popup.close();
73
- };
74
- if (opts?.signal) {
75
- if (opts.signal.aborted) {
76
- onAbort();
77
- return;
78
- }
79
- opts.signal.addEventListener("abort", onAbort, { once: true });
80
- }
81
- if (global.window?.addEventListener) {
82
- global.window.addEventListener("message", messageHandler);
83
- }
84
- timer = setInterval(() => {
85
- if (popup.closed) {
86
- cleanup();
87
- reject(new Error(`Authentication was cancelled.
88
-
89
- ` + "The authentication popup was closed before completing the login process. " + "Please try again and complete the authentication flow."));
90
- }
91
- }, 1000);
92
- });
93
- }
94
- }
95
- export {
96
- BrowserAuthStrategy
97
- };
98
-
99
- //# debugId=B13A3005E9EE6C6564756E2164756E21