@uipath/tasks-tool 1.200.0-preview.120 → 1.201.0-preview.121

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 (49) hide show
  1. package/browser.json +2 -1
  2. package/dist/{browser-strategy-brs3w53e.js → browser-strategy-yccf8mtd.js} +1 -1
  3. package/dist/folder-picker-interactive-2kj361mt.js +1850 -0
  4. package/dist/folder-resolver-htdmzdhy.js +92 -0
  5. package/dist/index-2fj08e7n.js +2058 -0
  6. package/dist/index-w03qc9m8.js +634 -0
  7. package/dist/index.js +7 -5
  8. package/dist/js-yaml-4ypbq2tt.js +3145 -0
  9. package/dist/node-strategy-12qfy0nv.js +348 -0
  10. package/dist/tool-0n9mj887.js +2448 -0
  11. package/dist/{tool-1ps2qeqg.js → tool-5arsyj36.js} +3 -2
  12. package/dist/tool-7eva0peq.js +265 -0
  13. package/dist/tool-rsk1xt86.js +6026 -0
  14. package/dist/{tool-nnna0e0h.js → tool-ww671age.js} +7774 -15738
  15. package/dist/tool.js +5 -4
  16. package/package.json +2 -2
  17. package/src/commands/_shared/catalog-options.spec.ts +114 -0
  18. package/src/commands/_shared/catalog-options.ts +122 -0
  19. package/src/commands/_shared/connect.spec.ts +52 -0
  20. package/src/commands/_shared/connect.ts +31 -0
  21. package/src/commands/_shared/constants.ts +1 -0
  22. package/src/commands/_shared/folder-picker-interactive.spec.ts +92 -0
  23. package/src/commands/_shared/folder-picker-interactive.ts +76 -0
  24. package/src/commands/_shared/folder-picker.spec.ts +159 -0
  25. package/src/commands/_shared/folder-picker.ts +113 -0
  26. package/src/commands/_shared/folder-resolver.spec.ts +152 -0
  27. package/src/commands/_shared/folder-resolver.ts +113 -0
  28. package/src/commands/_shared/parse.spec.ts +69 -0
  29. package/src/commands/_shared/parse.ts +43 -0
  30. package/src/commands/catalogs.ts +277 -0
  31. package/src/commands/comments.ts +160 -0
  32. package/src/commands/data.ts +137 -0
  33. package/src/commands/labels.ts +93 -0
  34. package/src/commands/metadata.ts +139 -0
  35. package/src/commands/tasks.spec.ts +1557 -2
  36. package/src/commands/tasks.ts +191 -280
  37. package/src/tool.ts +10 -0
  38. package/src/utils/sdk-client.ts +5 -0
  39. package/tests/assignable-users.e2e.test.ts +58 -4
  40. package/tests/catalogs.e2e.test.ts +393 -0
  41. package/tests/comments.e2e.test.ts +223 -0
  42. package/tests/complete.e2e.test.ts +9 -9
  43. package/tests/data.e2e.test.ts +187 -0
  44. package/tests/get.e2e.test.ts +4 -2
  45. package/tests/labels.e2e.test.ts +184 -0
  46. package/tests/list.e2e.test.ts +110 -0
  47. package/tests/metadata.e2e.test.ts +186 -0
  48. package/dist/node-strategy-a4n0d6dx.js +0 -63
  49. package/dist/tool-q90kqh83.js +0 -1161
@@ -0,0 +1,186 @@
1
+ import { RESULTS } from "@uipath/common";
2
+ import { describe, expect, it } from "vitest";
3
+ import {
4
+ type E2EManifest,
5
+ MANIFEST_PATH,
6
+ } from "../../../tests/e2e-shared/global-setup";
7
+ import {
8
+ EXEC_TIMEOUT,
9
+ localCliRaw,
10
+ localCliRawWithArgs,
11
+ parseOutput,
12
+ readManifest,
13
+ } from "../../../tests/e2e-shared/helpers";
14
+
15
+ interface Envelope {
16
+ Result: string;
17
+ Code?: string;
18
+ Message?: string;
19
+ Instructions?: string;
20
+ }
21
+
22
+ interface TaskRow {
23
+ Id?: number;
24
+ IsDeleted?: boolean;
25
+ Status?: string;
26
+ Type?: string;
27
+ FolderId?: number;
28
+ }
29
+
30
+ const { tempDir } = readManifest<E2EManifest>(MANIFEST_PATH).sharedInstall;
31
+
32
+ function listTasks(asAdmin: boolean): TaskRow[] {
33
+ const flag = asAdmin ? "--as-admin " : "";
34
+ const raw = localCliRaw(
35
+ tempDir,
36
+ `tasks list ${flag}--limit 200 --output json`,
37
+ );
38
+ if (raw.exitCode !== 0) return [];
39
+ return (parseOutput(raw.stdout, "json") as { Data?: TaskRow[] }).Data ?? [];
40
+ }
41
+
42
+ function discoverTask(): { taskId: string; folderId: string } | null {
43
+ const envFolder = process.env.TASKS_TOOL_E2E_FOLDER_ID;
44
+ const envTask =
45
+ process.env.TASKS_TOOL_E2E_TASK_ID_METADATA ??
46
+ process.env.TASKS_TOOL_E2E_TASK_ID;
47
+ if (envFolder && envTask) {
48
+ return { taskId: envTask, folderId: envFolder };
49
+ }
50
+ for (const asAdmin of [false, true]) {
51
+ const task = listTasks(asAdmin).find(
52
+ (t) =>
53
+ !t.IsDeleted &&
54
+ t.Status !== "Completed" &&
55
+ t.Type === "ExternalTask" &&
56
+ typeof t.Id === "number" &&
57
+ typeof t.FolderId === "number",
58
+ );
59
+ if (task) {
60
+ return {
61
+ taskId: String(task.Id),
62
+ folderId: String(envFolder ?? task.FolderId),
63
+ };
64
+ }
65
+ }
66
+ // No actionable ExternalTask on this tenant; skip the live suite (guarded by describe.skipIf below).
67
+ return null;
68
+ }
69
+
70
+ const discovered = discoverTask();
71
+ const taskId = discovered?.taskId ?? "";
72
+ const folderId = discovered?.folderId ?? "";
73
+
74
+ function editMetadata(id: string, flags: string[]): Envelope {
75
+ const raw = localCliRawWithArgs(tempDir, [
76
+ "tasks",
77
+ "metadata",
78
+ id,
79
+ "--folder-id",
80
+ folderId,
81
+ ...flags,
82
+ "--output",
83
+ "json",
84
+ ]);
85
+ return parseOutput(raw.stdout, "json") as Envelope;
86
+ }
87
+
88
+ describe.skipIf(!discovered)("tasks metadata e2e", () => {
89
+ it(
90
+ "S1: edit title and priority together",
91
+ () => {
92
+ const res = editMetadata(taskId, [
93
+ "--title",
94
+ "Review invoice",
95
+ "--priority",
96
+ "High",
97
+ ]);
98
+ expect(res.Result).toBe(RESULTS.Success);
99
+ expect(res.Code).toBe("TaskMetadataEdited");
100
+ },
101
+ EXEC_TIMEOUT,
102
+ );
103
+
104
+ it(
105
+ "S2: invalid task id reports a validation error",
106
+ () => {
107
+ const res = editMetadata("not-a-number", ["--title", "x"]);
108
+ expect(res.Result).toBe(RESULTS.Failure);
109
+ expect(res.Message).toMatch(/^Invalid <task-id>/);
110
+ expect(res.Instructions).toBe("Must be a positive integer.");
111
+ },
112
+ EXEC_TIMEOUT,
113
+ );
114
+
115
+ it(
116
+ "S3: invalid priority reports a validation error",
117
+ () => {
118
+ const res = editMetadata(taskId, ["--priority", "Urgent"]);
119
+ expect(res.Result).toBe(RESULTS.Failure);
120
+ expect(res.Message).toMatch(/^Invalid priority/);
121
+ },
122
+ EXEC_TIMEOUT,
123
+ );
124
+
125
+ it(
126
+ "S4: edit a non-existent task reports a failure",
127
+ () => {
128
+ const res = editMetadata("999999999", ["--title", "x"]);
129
+ expect(res.Result).toBe(RESULTS.Failure);
130
+ expect(res.Message).toMatch(/^Error editing metadata on task/);
131
+ },
132
+ EXEC_TIMEOUT,
133
+ );
134
+
135
+ it(
136
+ "S5: edit only the title",
137
+ () => {
138
+ const res = editMetadata(taskId, [
139
+ "--title",
140
+ `sdk-cli-e2e-title-${Date.now()}`,
141
+ ]);
142
+ expect(res.Result).toBe(RESULTS.Success);
143
+ expect(res.Code).toBe("TaskMetadataEdited");
144
+ },
145
+ EXEC_TIMEOUT,
146
+ );
147
+
148
+ it(
149
+ "S6: edit only the priority",
150
+ () => {
151
+ const res = editMetadata(taskId, ["--priority", "Low"]);
152
+ expect(res.Result).toBe(RESULTS.Success);
153
+ expect(res.Code).toBe("TaskMetadataEdited");
154
+ },
155
+ EXEC_TIMEOUT,
156
+ );
157
+
158
+ it(
159
+ "S7: attach an edit note",
160
+ () => {
161
+ const res = editMetadata(taskId, ["--note", "reclassified"]);
162
+ expect(res.Result).toBe(RESULTS.Success);
163
+ expect(res.Code).toBe("TaskMetadataEdited");
164
+ },
165
+ EXEC_TIMEOUT,
166
+ );
167
+
168
+ it(
169
+ "S8: a retitle is reflected on the task",
170
+ () => {
171
+ const title = `sdk-cli-e2e-retitle-${Date.now()}`;
172
+ const edit = editMetadata(taskId, ["--title", title]);
173
+ expect(edit.Result).toBe(RESULTS.Success);
174
+
175
+ const getRaw = localCliRaw(
176
+ tempDir,
177
+ `tasks get ${taskId} --output json`,
178
+ );
179
+ const task = parseOutput(getRaw.stdout, "json") as {
180
+ Data?: { Title?: string };
181
+ };
182
+ expect(task.Data?.Title).toBe(title);
183
+ },
184
+ EXEC_TIMEOUT,
185
+ );
186
+ });
@@ -1,63 +0,0 @@
1
- import {
2
- catchError,
3
- getFileSystem,
4
- startServer
5
- } from "./tool-q90kqh83.js";
6
- import"./tool-1ps2qeqg.js";
7
- import"./tool-0v6na3yp.js";
8
-
9
- // ../auth/src/strategies/node-strategy.ts
10
- class NodeAuthStrategy {
11
- async execute(url, redirectUri, expectedState, opts) {
12
- const fs = getFileSystem();
13
- const callbackUrl = await startServer({
14
- redirectUri,
15
- timeoutMs: opts?.timeoutMs,
16
- signal: opts?.signal,
17
- onListening: async () => {
18
- let safeUrl = "";
19
- for (const ch of url) {
20
- const c = ch.charCodeAt(0);
21
- if (c > 31 && (c < 128 || c > 159))
22
- safeUrl += ch;
23
- }
24
- if (opts?.noBrowser) {
25
- if (!opts.onAuthUrl) {
26
- throw new Error("Headless login (noBrowser) requires an onAuthUrl handler " + "to surface the authorize URL, but none was provided.");
27
- }
28
- opts.onAuthUrl(safeUrl);
29
- return;
30
- }
31
- const [openError] = await catchError(fs.utils.open(url));
32
- if (!openError)
33
- return;
34
- const isSpawnError = "code" in openError && openError.code === "ENOENT";
35
- if (isSpawnError) {
36
- throw new Error("Could not open a browser. No supported browser launcher was found. " + `On a headless or minimal system, use non-interactive login instead:
37
-
38
- ` + ` uip login --client-id <id> --client-secret <secret> -t <tenant>
39
-
40
- ` + "Or install a browser opener for your OS (e.g. xdg-utils on Linux).", { cause: openError });
41
- }
42
- throw new Error("Could not open the browser automatically. " + `Visit this URL to authenticate:
43
-
44
- ${safeUrl}
45
- `, { cause: openError });
46
- }
47
- });
48
- const returnedState = callbackUrl.searchParams.get("state");
49
- if (returnedState !== expectedState) {
50
- throw 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.");
51
- }
52
- const code = callbackUrl.searchParams.get("code");
53
- if (!code) {
54
- throw new Error("No authorization code received");
55
- }
56
- return code;
57
- }
58
- }
59
- export {
60
- NodeAuthStrategy
61
- };
62
-
63
- //# debugId=E5B2BD2B3B179D3D64756E2164756E21