@vitalyostanin/youtrack-mcp 0.13.1 → 0.13.2

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 (50) hide show
  1. package/LICENSE +21 -0
  2. package/dist/index.js +32 -3
  3. package/dist/package.json +80 -79
  4. package/package.json +15 -14
  5. package/dist/src/__tests__/config.test.d.ts +0 -2
  6. package/dist/src/__tests__/config.test.js +0 -47
  7. package/dist/src/__tests__/setup.d.ts +0 -2
  8. package/dist/src/__tests__/setup.js +0 -12
  9. package/dist/src/__tests__/smoke.test.d.ts +0 -2
  10. package/dist/src/__tests__/smoke.test.js +0 -7
  11. package/dist/src/__tests__/youtrack-client.delete-link.test.d.ts +0 -2
  12. package/dist/src/__tests__/youtrack-client.delete-link.test.js +0 -93
  13. package/dist/src/__tests__/youtrack-client.normalize-error.test.d.ts +0 -2
  14. package/dist/src/__tests__/youtrack-client.normalize-error.test.js +0 -71
  15. package/dist/src/__tests__/youtrack-client.process-batch.test.d.ts +0 -2
  16. package/dist/src/__tests__/youtrack-client.process-batch.test.js +0 -63
  17. package/dist/src/__tests__/youtrack-client.read-pagination.test.d.ts +0 -2
  18. package/dist/src/__tests__/youtrack-client.read-pagination.test.js +0 -75
  19. package/dist/src/__tests__/youtrack-client.resolve-id.test.d.ts +0 -2
  20. package/dist/src/__tests__/youtrack-client.resolve-id.test.js +0 -77
  21. package/dist/src/__tests__/youtrack-client.single-flight.test.d.ts +0 -2
  22. package/dist/src/__tests__/youtrack-client.single-flight.test.js +0 -82
  23. package/dist/src/__tests__/youtrack-client.timeouts.test.d.ts +0 -2
  24. package/dist/src/__tests__/youtrack-client.timeouts.test.js +0 -27
  25. package/dist/src/__tests__/youtrack-client.url-encoding.test.d.ts +0 -2
  26. package/dist/src/__tests__/youtrack-client.url-encoding.test.js +0 -60
  27. package/dist/src/tools/__tests__/article-search-tools.test.d.ts +0 -2
  28. package/dist/src/tools/__tests__/article-search-tools.test.js +0 -31
  29. package/dist/src/tools/__tests__/attachment-tools.test.d.ts +0 -2
  30. package/dist/src/tools/__tests__/attachment-tools.test.js +0 -94
  31. package/dist/src/tools/__tests__/destructive-confirmation.test.d.ts +0 -2
  32. package/dist/src/tools/__tests__/destructive-confirmation.test.js +0 -38
  33. package/dist/src/tools/__tests__/issue-activity-tools.test.d.ts +0 -2
  34. package/dist/src/tools/__tests__/issue-activity-tools.test.js +0 -69
  35. package/dist/src/tools/__tests__/issue-search-tools.test.d.ts +0 -2
  36. package/dist/src/tools/__tests__/issue-search-tools.test.js +0 -25
  37. package/dist/src/tools/__tests__/issue-status-tools.test.d.ts +0 -2
  38. package/dist/src/tools/__tests__/issue-status-tools.test.js +0 -98
  39. package/dist/src/tools/__tests__/workitem-tools.test.d.ts +0 -2
  40. package/dist/src/tools/__tests__/workitem-tools.test.js +0 -72
  41. package/dist/src/utils/__tests__/file-download.test.d.ts +0 -2
  42. package/dist/src/utils/__tests__/file-download.test.js +0 -77
  43. package/dist/src/utils/__tests__/file-storage.test.d.ts +0 -2
  44. package/dist/src/utils/__tests__/file-storage.test.js +0 -61
  45. package/dist/src/utils/__tests__/path-safety.test.d.ts +0 -2
  46. package/dist/src/utils/__tests__/path-safety.test.js +0 -49
  47. package/dist/src/utils/__tests__/streaming-client.test.d.ts +0 -2
  48. package/dist/src/utils/__tests__/streaming-client.test.js +0 -90
  49. package/dist/src/utils/__tests__/validators.test.d.ts +0 -2
  50. package/dist/src/utils/__tests__/validators.test.js +0 -65
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025-2026 Vitaly Ostanin
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/dist/index.js CHANGED
@@ -1,13 +1,42 @@
1
1
  #!/usr/bin/env node
2
- import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
3
- import { YoutrackServer } from "./src/server.js";
2
+ import { readFileSync } from 'node:fs';
3
+ import { dirname, resolve } from 'node:path';
4
+ import { fileURLToPath } from 'node:url';
5
+ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
6
+ import { YoutrackServer } from './src/server.js';
7
+ function readManifest() {
8
+ const here = dirname(fileURLToPath(import.meta.url));
9
+ const candidates = [
10
+ resolve(here, 'package.json'),
11
+ resolve(here, '..', 'package.json'),
12
+ ];
13
+ for (const path of candidates) {
14
+ try {
15
+ const raw = readFileSync(path, 'utf8');
16
+ return JSON.parse(raw);
17
+ }
18
+ catch {
19
+ // try next candidate
20
+ }
21
+ }
22
+ return { name: '@vitalyostanin/youtrack-mcp', version: 'unknown' };
23
+ }
24
+ function maybePrintVersionAndExit() {
25
+ const argv = process.argv.slice(2);
26
+ if (argv.includes('--version') || argv.includes('-v')) {
27
+ const manifest = readManifest();
28
+ console.log(`${manifest.name} ${manifest.version}`);
29
+ process.exit(0);
30
+ }
31
+ }
4
32
  async function main() {
33
+ maybePrintVersionAndExit();
5
34
  const transport = new StdioServerTransport();
6
35
  const server = new YoutrackServer();
7
36
  await server.connect(transport);
8
37
  }
9
38
  main().catch((error) => {
10
- console.error("YouTrack MCP server crashed", error);
39
+ console.error('YouTrack MCP server crashed', error);
11
40
  process.exit(1);
12
41
  });
13
42
  //# sourceMappingURL=index.js.map
package/dist/package.json CHANGED
@@ -1,81 +1,82 @@
1
1
  {
2
- "name": "@vitalyostanin/youtrack-mcp",
3
- "version": "0.13.1",
4
- "scripts": {
5
- "build": "tsc -p tsconfig.json",
6
- "postbuild": "chmod +x dist/index.js",
7
- "dev": "tsc -p tsconfig.json --watch",
8
- "start": "node dist/index.js",
9
- "dev:watch": "tsc -p tsconfig.json --watch",
10
- "lint": "eslint . --cache --cache-location node_modules/.cache/eslint/",
11
- "lint:fix": "eslint . --fix --cache --cache-location node_modules/.cache/eslint/",
12
- "format": "eslint . --fix --cache --cache-location node_modules/.cache/eslint/",
13
- "typecheck": "tsc -p tsconfig.json --noEmit",
14
- "test": "vitest run",
15
- "test:watch": "vitest",
16
- "test:coverage": "vitest run --coverage",
17
- "prepublishOnly": "npm run lint && npm test && npm run build"
18
- },
19
- "keywords": [
20
- "mcp",
21
- "model-context-protocol",
22
- "youtrack",
23
- "jetbrains",
24
- "issue-tracking",
25
- "work-items",
26
- "time-tracking",
27
- "claude"
28
- ],
29
- "author": "Vitaly Ostanin <vitaly.ostanin@mail.ru>",
30
- "license": "MIT",
31
- "description": "MCP server for comprehensive YouTrack integration: issues, work items with reports, user activity search, knowledge base, projects and users",
32
- "type": "module",
33
- "engines": {
34
- "node": ">=22.13.0"
35
- },
36
- "bin": {
37
- "youtrack-mcp": "dist/index.js"
38
- },
39
- "homepage": "https://github.com/VitalyOstanin/youtrack-mcp#readme",
40
- "repository": {
41
- "type": "git",
42
- "url": "git+https://github.com/VitalyOstanin/youtrack-mcp.git"
43
- },
44
- "bugs": {
45
- "url": "https://github.com/VitalyOstanin/youtrack-mcp/issues"
46
- },
47
- "files": [
48
- "dist/**/*.js",
49
- "dist/**/*.d.ts",
50
- "dist/**/*.json",
51
- "README.md",
52
- "README-ru.md"
53
- ],
54
- "publishConfig": {
55
- "access": "public"
56
- },
57
- "overrides": {
58
- "ip-address": "^10.2.0"
59
- },
60
- "dependencies": {
61
- "@modelcontextprotocol/sdk": "^1.29.0",
62
- "@vitalyostanin/mutex-pool": "^0.0.3",
63
- "axios": "^1.16.0",
64
- "form-data": "^4.0.1",
65
- "luxon": "^3.5.0",
66
- "stream-json": "^2.1.0",
67
- "zod": "^4.4.3"
68
- },
69
- "devDependencies": {
70
- "@eslint/js": "^10.0.1",
71
- "@types/luxon": "^3.7.1",
72
- "@types/node": "^25.6.0",
73
- "@vitest/coverage-v8": "^4.1.5",
74
- "eslint": "^10.3.0",
75
- "nock": "^14.0.14",
76
- "typescript": "^6.0.3",
77
- "typescript-eslint": "^8.59.2",
78
- "vitest": "^4.1.5",
79
- "zod-to-json-schema": "^3.25.2"
80
- }
2
+ "name": "@vitalyostanin/youtrack-mcp",
3
+ "version": "0.13.2",
4
+ "scripts": {
5
+ "build": "tsc -p tsconfig.build.json",
6
+ "postbuild": "chmod +x dist/index.js && cp package.json dist/package.json",
7
+ "dev": "tsc -p tsconfig.build.json --watch",
8
+ "start": "node dist/index.js",
9
+ "typecheck": "tsc -p tsconfig.json",
10
+ "lint": "eslint . --cache --cache-location node_modules/.cache/eslint/",
11
+ "lint:fix": "eslint . --fix --cache --cache-location node_modules/.cache/eslint/",
12
+ "format": "npm run --silent lint:fix",
13
+ "test": "timeout 600 vitest run",
14
+ "test:watch": "vitest",
15
+ "test:coverage": "timeout 600 vitest run --coverage",
16
+ "prepublishOnly": "npm run lint && npm run typecheck && npm run test && npm audit --omit=dev --audit-level=high && npm run build"
17
+ },
18
+ "keywords": [
19
+ "mcp",
20
+ "model-context-protocol",
21
+ "youtrack",
22
+ "jetbrains",
23
+ "issue-tracking",
24
+ "work-items",
25
+ "time-tracking",
26
+ "claude"
27
+ ],
28
+ "author": "Vitaly Ostanin <vitaly.ostanin@mail.ru>",
29
+ "license": "MIT",
30
+ "description": "MCP server for comprehensive YouTrack integration: issues, work items with reports, user activity search, knowledge base, projects and users",
31
+ "type": "module",
32
+ "engines": {
33
+ "node": ">=22.13.0",
34
+ "npm": ">=10.0.0"
35
+ },
36
+ "packageManager": "npm@11.12.1",
37
+ "bin": {
38
+ "youtrack-mcp": "dist/index.js"
39
+ },
40
+ "homepage": "https://github.com/VitalyOstanin/youtrack-mcp#readme",
41
+ "repository": {
42
+ "type": "git",
43
+ "url": "git+https://github.com/VitalyOstanin/youtrack-mcp.git"
44
+ },
45
+ "bugs": {
46
+ "url": "https://github.com/VitalyOstanin/youtrack-mcp/issues"
47
+ },
48
+ "files": [
49
+ "dist/**/*.js",
50
+ "dist/**/*.d.ts",
51
+ "dist/**/*.json",
52
+ "README.md",
53
+ "README-ru.md",
54
+ "LICENSE"
55
+ ],
56
+ "publishConfig": {
57
+ "access": "public"
58
+ },
59
+ "overrides": {
60
+ "ip-address": "^10.2.0"
61
+ },
62
+ "dependencies": {
63
+ "@modelcontextprotocol/sdk": "^1.29.0",
64
+ "@vitalyostanin/mutex-pool": "^0.0.3",
65
+ "axios": "^1.16.0",
66
+ "form-data": "^4.0.1",
67
+ "luxon": "^3.5.0",
68
+ "stream-json": "^2.1.0",
69
+ "zod": "^4.4.3"
70
+ },
71
+ "devDependencies": {
72
+ "@eslint/js": "^10.0.1",
73
+ "@types/luxon": "^3.7.1",
74
+ "@types/node": "^25.6.0",
75
+ "@vitest/coverage-v8": "^4.1.5",
76
+ "eslint": "^10.3.0",
77
+ "nock": "^14.0.14",
78
+ "typescript": "^6.0.3",
79
+ "typescript-eslint": "^8.59.2",
80
+ "vitest": "^4.1.5"
81
+ }
81
82
  }
package/package.json CHANGED
@@ -1,20 +1,19 @@
1
1
  {
2
2
  "name": "@vitalyostanin/youtrack-mcp",
3
- "version": "0.13.1",
3
+ "version": "0.13.2",
4
4
  "scripts": {
5
- "build": "tsc -p tsconfig.json",
6
- "postbuild": "chmod +x dist/index.js",
7
- "dev": "tsc -p tsconfig.json --watch",
5
+ "build": "tsc -p tsconfig.build.json",
6
+ "postbuild": "chmod +x dist/index.js && cp package.json dist/package.json",
7
+ "dev": "tsc -p tsconfig.build.json --watch",
8
8
  "start": "node dist/index.js",
9
- "dev:watch": "tsc -p tsconfig.json --watch",
9
+ "typecheck": "tsc -p tsconfig.json",
10
10
  "lint": "eslint . --cache --cache-location node_modules/.cache/eslint/",
11
11
  "lint:fix": "eslint . --fix --cache --cache-location node_modules/.cache/eslint/",
12
- "format": "eslint . --fix --cache --cache-location node_modules/.cache/eslint/",
13
- "typecheck": "tsc -p tsconfig.json --noEmit",
14
- "test": "vitest run",
12
+ "format": "npm run --silent lint:fix",
13
+ "test": "timeout 600 vitest run",
15
14
  "test:watch": "vitest",
16
- "test:coverage": "vitest run --coverage",
17
- "prepublishOnly": "npm run lint && npm test && npm run build"
15
+ "test:coverage": "timeout 600 vitest run --coverage",
16
+ "prepublishOnly": "npm run lint && npm run typecheck && npm run test && npm audit --omit=dev --audit-level=high && npm run build"
18
17
  },
19
18
  "keywords": [
20
19
  "mcp",
@@ -31,8 +30,10 @@
31
30
  "description": "MCP server for comprehensive YouTrack integration: issues, work items with reports, user activity search, knowledge base, projects and users",
32
31
  "type": "module",
33
32
  "engines": {
34
- "node": ">=22.13.0"
33
+ "node": ">=22.13.0",
34
+ "npm": ">=10.0.0"
35
35
  },
36
+ "packageManager": "npm@11.12.1",
36
37
  "bin": {
37
38
  "youtrack-mcp": "dist/index.js"
38
39
  },
@@ -49,7 +50,8 @@
49
50
  "dist/**/*.d.ts",
50
51
  "dist/**/*.json",
51
52
  "README.md",
52
- "README-ru.md"
53
+ "README-ru.md",
54
+ "LICENSE"
53
55
  ],
54
56
  "publishConfig": {
55
57
  "access": "public"
@@ -75,7 +77,6 @@
75
77
  "nock": "^14.0.14",
76
78
  "typescript": "^6.0.3",
77
79
  "typescript-eslint": "^8.59.2",
78
- "vitest": "^4.1.5",
79
- "zod-to-json-schema": "^3.25.2"
80
+ "vitest": "^4.1.5"
80
81
  }
81
82
  }
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=config.test.d.ts.map
@@ -1,47 +0,0 @@
1
- import { describe, it, expect, beforeEach, afterEach } from "vitest";
2
- import { mkdtempSync, rmSync, existsSync } from "node:fs";
3
- import { tmpdir } from "node:os";
4
- import { join, resolve } from "node:path";
5
- import { loadConfig, enrichConfigWithRedaction } from "../config.js";
6
- describe("loadConfig", () => {
7
- let tmp;
8
- const oldEnv = { ...process.env };
9
- beforeEach(() => {
10
- tmp = mkdtempSync(join(tmpdir(), "yt-cfg-"));
11
- process.env = {
12
- YOUTRACK_URL: "https://yt.example.com",
13
- YOUTRACK_TOKEN: "perm:test-token",
14
- };
15
- });
16
- afterEach(() => {
17
- rmSync(tmp, { recursive: true, force: true });
18
- process.env = { ...oldEnv };
19
- });
20
- it("uses cwd by default for outputDir", () => {
21
- const cfg = loadConfig();
22
- expect(cfg.outputDir).toBe(resolve(process.cwd()));
23
- });
24
- it("honors YOUTRACK_OUTPUT_DIR", () => {
25
- process.env.YOUTRACK_OUTPUT_DIR = tmp;
26
- const cfg = loadConfig();
27
- expect(cfg.outputDir).toBe(resolve(tmp));
28
- });
29
- it("creates outputDir if missing", () => {
30
- const sub = join(tmp, "missing-subdir");
31
- process.env.YOUTRACK_OUTPUT_DIR = sub;
32
- loadConfig();
33
- expect(existsSync(sub)).toBe(true);
34
- });
35
- it("throws when YOUTRACK_TOKEN is missing", () => {
36
- delete process.env.YOUTRACK_TOKEN;
37
- expect(() => loadConfig()).toThrow();
38
- });
39
- it("redacts token via enrichConfigWithRedaction", () => {
40
- const cfg = loadConfig();
41
- const redacted = enrichConfigWithRedaction(cfg);
42
- expect(redacted.hasToken).toBe(true);
43
- expect(redacted.token).toBeUndefined();
44
- expect(redacted.outputDir).toBe(cfg.outputDir);
45
- });
46
- });
47
- //# sourceMappingURL=config.test.js.map
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=setup.d.ts.map
@@ -1,12 +0,0 @@
1
- import { afterAll, afterEach, beforeAll } from "vitest";
2
- import nock from "nock";
3
- beforeAll(() => {
4
- nock.disableNetConnect();
5
- });
6
- afterEach(() => {
7
- nock.cleanAll();
8
- });
9
- afterAll(() => {
10
- nock.enableNetConnect();
11
- });
12
- //# sourceMappingURL=setup.js.map
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=smoke.test.d.ts.map
@@ -1,7 +0,0 @@
1
- import { describe, it, expect } from "vitest";
2
- describe("smoke", () => {
3
- it("vitest is wired", () => {
4
- expect(1 + 1).toBe(2);
5
- });
6
- });
7
- //# sourceMappingURL=smoke.test.js.map
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=youtrack-client.delete-link.test.d.ts.map
@@ -1,93 +0,0 @@
1
- import { describe, it, expect, vi } from "vitest";
2
- import { YoutrackClient } from "../youtrack-client.js";
3
- const config = {
4
- baseUrl: "https://yt.test",
5
- token: "perm:test",
6
- defaultProject: "BC",
7
- outputDir: "/tmp",
8
- timezone: "UTC",
9
- };
10
- function getHttp(client) {
11
- return client.http;
12
- }
13
- function methodNotAllowed() {
14
- return {
15
- isAxiosError: true,
16
- message: "Request failed with status code 405",
17
- response: { status: 405, data: { error: "method_not_allowed" } },
18
- };
19
- }
20
- describe("deleteIssueLink subtask fallback", () => {
21
- it("uses linkToDelete.issue.idReadable when targetId is missing", async () => {
22
- const client = new YoutrackClient(config);
23
- const http = getHttp(client);
24
- vi.spyOn(http, "delete").mockRejectedValue(methodNotAllowed());
25
- vi.spyOn(client, "getIssueLinks").mockResolvedValue({
26
- issueId: "BC-1",
27
- links: [
28
- {
29
- id: "L1",
30
- direction: "OUTWARD",
31
- linkType: { name: "Subtask", id: "lt-sub" },
32
- issue: { idReadable: "BC-99", id: "1-99", summary: "s" },
33
- },
34
- ],
35
- });
36
- let captured;
37
- vi.spyOn(http, "post").mockImplementation((...args) => {
38
- captured = { url: String(args[0]), body: args[1] };
39
- return Promise.resolve({ data: {} });
40
- });
41
- await client.deleteIssueLink({ issueId: "BC-1", linkId: "L1" });
42
- expect(captured?.url).toBe("/api/commands");
43
- expect(captured?.body.query).toBe("remove subtask of BC-99");
44
- const issues = captured?.body.issues;
45
- expect(issues[0].idReadable).toBe("BC-1");
46
- });
47
- it("uses provided targetId when given (regular link)", async () => {
48
- const client = new YoutrackClient(config);
49
- const http = getHttp(client);
50
- vi.spyOn(http, "delete").mockRejectedValue(methodNotAllowed());
51
- vi.spyOn(client, "getIssueLinks").mockResolvedValue({
52
- issueId: "BC-1",
53
- links: [
54
- {
55
- id: "L1",
56
- direction: "OUTWARD",
57
- linkType: {
58
- name: "Relates",
59
- id: "lt-rel",
60
- outwardName: "relates to",
61
- inwardName: "relates to",
62
- },
63
- issue: { idReadable: "BC-99", id: "1-99", summary: "s" },
64
- },
65
- ],
66
- });
67
- let captured;
68
- vi.spyOn(http, "post").mockImplementation((...args) => {
69
- captured = { body: args[1] };
70
- return Promise.resolve({ data: {} });
71
- });
72
- await client.deleteIssueLink({ issueId: "BC-1", linkId: "L1", targetId: "BC-7" });
73
- expect(String(captured?.body.query)).toContain("BC-7");
74
- });
75
- it("throws when neither input.targetId nor link payload provide a target", async () => {
76
- const client = new YoutrackClient(config);
77
- const http = getHttp(client);
78
- vi.spyOn(http, "delete").mockRejectedValue(methodNotAllowed());
79
- vi.spyOn(client, "getIssueLinks").mockResolvedValue({
80
- issueId: "BC-1",
81
- links: [
82
- {
83
- id: "L1",
84
- direction: "OUTWARD",
85
- linkType: { name: "Subtask", id: "lt-sub" },
86
- issue: { idReadable: "", id: "1-99", summary: "s" },
87
- },
88
- ],
89
- });
90
- await expect(client.deleteIssueLink({ issueId: "BC-1", linkId: "L1" })).rejects.toThrow(/Cannot determine target issue id/);
91
- });
92
- });
93
- //# sourceMappingURL=youtrack-client.delete-link.test.js.map
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=youtrack-client.normalize-error.test.d.ts.map
@@ -1,71 +0,0 @@
1
- import { describe, it, expect, vi } from "vitest";
2
- import { YoutrackClient } from "../youtrack-client.js";
3
- const config = {
4
- baseUrl: "https://yt.test",
5
- token: "perm:test",
6
- defaultProject: "BC",
7
- outputDir: "/tmp",
8
- timezone: "UTC",
9
- };
10
- function getHttp(client) {
11
- return client.http;
12
- }
13
- function makeAxiosError(status, data) {
14
- return {
15
- isAxiosError: true,
16
- message: `Request failed with status code ${status}`,
17
- response: { status, data },
18
- };
19
- }
20
- describe("normalizeError details whitelist", () => {
21
- it("strips unknown keys (stack, pii) from response.data", async () => {
22
- const client = new YoutrackClient(config);
23
- vi.spyOn(getHttp(client), "get").mockRejectedValue(makeAxiosError(400, {
24
- error: "bad_request",
25
- error_description: "issue not found",
26
- stack: "internal: org.youtrack...",
27
- pii: "user@example.com",
28
- }));
29
- let captured;
30
- try {
31
- await client.getIssue("BC-1");
32
- throw new Error("expected failure");
33
- }
34
- catch (err) {
35
- captured = err;
36
- }
37
- expect(captured?.status).toBe(400);
38
- expect(captured?.details).toEqual({
39
- error: "bad_request",
40
- error_description: "issue not found",
41
- });
42
- expect(captured?.details).not.toHaveProperty("stack");
43
- expect(captured?.details).not.toHaveProperty("pii");
44
- });
45
- it("returns undefined details when nothing in the whitelist matches", async () => {
46
- const client = new YoutrackClient(config);
47
- vi.spyOn(getHttp(client), "get").mockRejectedValue(makeAxiosError(500, { stack: "x", trace: "y" }));
48
- try {
49
- await client.getIssue("BC-1");
50
- throw new Error("expected failure");
51
- }
52
- catch (err) {
53
- const e = err;
54
- expect(e.status).toBe(500);
55
- expect(e.details).toBeUndefined();
56
- }
57
- });
58
- it("keeps numeric code and message strings", async () => {
59
- const client = new YoutrackClient(config);
60
- vi.spyOn(getHttp(client), "get").mockRejectedValue(makeAxiosError(403, { code: 403, message: "forbidden", debug: { ip: "1.2.3.4" } }));
61
- try {
62
- await client.getIssue("BC-1");
63
- throw new Error("expected failure");
64
- }
65
- catch (err) {
66
- const e = err;
67
- expect(e.details).toEqual({ code: 403, message: "forbidden" });
68
- }
69
- });
70
- });
71
- //# sourceMappingURL=youtrack-client.normalize-error.test.js.map
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=youtrack-client.process-batch.test.d.ts.map
@@ -1,63 +0,0 @@
1
- import { describe, it, expect } from "vitest";
2
- import { YoutrackClient } from "../youtrack-client.js";
3
- function asPrivate(c) {
4
- return c;
5
- }
6
- const config = {
7
- baseUrl: "https://yt.test",
8
- token: "perm:test-token",
9
- timezone: "UTC",
10
- outputDir: "/tmp",
11
- };
12
- describe("processBatch", () => {
13
- it("returns results in original order", async () => {
14
- const c = asPrivate(new YoutrackClient(config));
15
- const results = await c.processBatch([1, 2, 3], async (n) => n * 10);
16
- expect(results).toEqual([10, 20, 30]);
17
- });
18
- it("respects concurrency limit", async () => {
19
- const c = asPrivate(new YoutrackClient(config));
20
- let inFlight = 0;
21
- let maxInFlight = 0;
22
- await c.processBatch(Array.from({ length: 12 }, (_, i) => i), async () => {
23
- inFlight += 1;
24
- maxInFlight = Math.max(maxInFlight, inFlight);
25
- await new Promise((r) => setTimeout(r, 5));
26
- inFlight -= 1;
27
- }, 3);
28
- expect(maxInFlight).toBeLessThanOrEqual(3);
29
- });
30
- it("rethrows a single error directly", async () => {
31
- const c = asPrivate(new YoutrackClient(config));
32
- const err = new Error("boom");
33
- await expect(c.processBatch([1], async () => {
34
- throw err;
35
- })).rejects.toBe(err);
36
- });
37
- it("aggregates multiple errors into AggregateError", async () => {
38
- const c = asPrivate(new YoutrackClient(config));
39
- let i = 0;
40
- let caught;
41
- try {
42
- await c.processBatch([1, 2, 3], async () => {
43
- i += 1;
44
- throw new Error(`fail ${i}`);
45
- });
46
- }
47
- catch (e) {
48
- caught = e;
49
- }
50
- expect(caught).toBeInstanceOf(AggregateError);
51
- expect(caught.errors).toHaveLength(3);
52
- });
53
- it("does not return partial results when one job fails", async () => {
54
- const c = asPrivate(new YoutrackClient(config));
55
- await expect(c.processBatch([1, 2, 3], async (n) => {
56
- if (n === 2) {
57
- throw new Error("middle failure");
58
- }
59
- return n;
60
- })).rejects.toThrow(/middle failure/);
61
- });
62
- });
63
- //# sourceMappingURL=youtrack-client.process-batch.test.js.map
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=youtrack-client.read-pagination.test.d.ts.map