@levinariy.fedorov/youtrack-mcp 0.3.0 → 0.3.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.
- package/dist/write.js +17 -6
- package/package.json +1 -1
package/dist/write.js
CHANGED
|
@@ -16,12 +16,23 @@ async function resolveAudience(client, audience) {
|
|
|
16
16
|
groups.push({ id: group.id });
|
|
17
17
|
continue;
|
|
18
18
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
19
|
+
if (target.toLowerCase() === "me") {
|
|
20
|
+
users.push({ id: (await client.get("/api/users/me", { fields: "id" })).id });
|
|
21
|
+
continue;
|
|
22
|
+
}
|
|
23
|
+
// Только точное совпадение логина. Поиск YouTrack нечёткий, и первый
|
|
24
|
+
// попавшийся из выдачи — это чужой человек, которому опечатка откроет
|
|
25
|
+
// заметку, писавшуюся не для него.
|
|
26
|
+
const found = await client.get("/api/users", {
|
|
27
|
+
fields: "id,login",
|
|
28
|
+
query: target,
|
|
29
|
+
$top: 50
|
|
30
|
+
});
|
|
31
|
+
const user = found.find((item) => item.login === target);
|
|
32
|
+
if (!user) {
|
|
33
|
+
const near = found.map((item) => item.login).slice(0, 5);
|
|
34
|
+
throw new YouTrackError(`Логина «${target}» в YouTrack нет.${near.length > 0 ? ` Похожие: ${near.join(", ")}.` : ""}`, 404);
|
|
35
|
+
}
|
|
25
36
|
users.push({ id: user.id });
|
|
26
37
|
}
|
|
27
38
|
if (groups.length === 0 && users.length === 0)
|
package/package.json
CHANGED