quantix-mcp 0.4.9 → 0.5.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.
- package/README.md +12 -1
- package/dist/index.js +20 -5
- package/dist/index.js.map +1 -1
- package/dist/tools/subscriptions.d.ts.map +1 -1
- package/dist/tools/subscriptions.js +46 -1
- package/dist/tools/subscriptions.js.map +1 -1
- package/dist/tools/transactions.d.ts.map +1 -1
- package/dist/tools/transactions.js +5 -5
- package/dist/tools/transactions.js.map +1 -1
- package/dist/types/schemas.d.ts +17 -0
- package/dist/types/schemas.d.ts.map +1 -1
- package/dist/types/schemas.js +21 -4
- package/dist/types/schemas.js.map +1 -1
- package/package.json +9 -4
- package/.claude/commands/opsx/apply.md +0 -152
- package/.claude/commands/opsx/archive.md +0 -157
- package/.claude/commands/opsx/bulk-archive.md +0 -242
- package/.claude/commands/opsx/continue.md +0 -114
- package/.claude/commands/opsx/explore.md +0 -174
- package/.claude/commands/opsx/ff.md +0 -94
- package/.claude/commands/opsx/new.md +0 -69
- package/.claude/commands/opsx/onboard.md +0 -525
- package/.claude/commands/opsx/sync.md +0 -134
- package/.claude/commands/opsx/verify.md +0 -164
- package/.claude/settings.local.json +0 -9
- package/.claude/skills/openspec-apply-change/SKILL.md +0 -156
- package/.claude/skills/openspec-archive-change/SKILL.md +0 -114
- package/.claude/skills/openspec-bulk-archive-change/SKILL.md +0 -246
- package/.claude/skills/openspec-continue-change/SKILL.md +0 -118
- package/.claude/skills/openspec-explore/SKILL.md +0 -290
- package/.claude/skills/openspec-ff-change/SKILL.md +0 -101
- package/.claude/skills/openspec-new-change/SKILL.md +0 -74
- package/.claude/skills/openspec-onboard/SKILL.md +0 -529
- package/.claude/skills/openspec-sync-specs/SKILL.md +0 -138
- package/.claude/skills/openspec-verify-change/SKILL.md +0 -168
- package/.dockerignore +0 -8
- package/.gemini/commands/opsx/apply.toml +0 -149
- package/.gemini/commands/opsx/archive.toml +0 -154
- package/.gemini/commands/opsx/bulk-archive.toml +0 -239
- package/.gemini/commands/opsx/continue.toml +0 -111
- package/.gemini/commands/opsx/explore.toml +0 -171
- package/.gemini/commands/opsx/ff.toml +0 -91
- package/.gemini/commands/opsx/new.toml +0 -66
- package/.gemini/commands/opsx/onboard.toml +0 -522
- package/.gemini/commands/opsx/sync.toml +0 -131
- package/.gemini/commands/opsx/verify.toml +0 -161
- package/.gemini/skills/openspec-apply-change/SKILL.md +0 -156
- package/.gemini/skills/openspec-archive-change/SKILL.md +0 -114
- package/.gemini/skills/openspec-bulk-archive-change/SKILL.md +0 -246
- package/.gemini/skills/openspec-continue-change/SKILL.md +0 -118
- package/.gemini/skills/openspec-explore/SKILL.md +0 -290
- package/.gemini/skills/openspec-ff-change/SKILL.md +0 -101
- package/.gemini/skills/openspec-new-change/SKILL.md +0 -74
- package/.gemini/skills/openspec-onboard/SKILL.md +0 -529
- package/.gemini/skills/openspec-sync-specs/SKILL.md +0 -138
- package/.gemini/skills/openspec-verify-change/SKILL.md +0 -168
- package/.github/agents/copilot-instructions.md +0 -32
- package/.github/agents/speckit.analyze.agent.md +0 -184
- package/.github/agents/speckit.checklist.agent.md +0 -294
- package/.github/agents/speckit.clarify.agent.md +0 -181
- package/.github/agents/speckit.constitution.agent.md +0 -82
- package/.github/agents/speckit.implement.agent.md +0 -135
- package/.github/agents/speckit.plan.agent.md +0 -89
- package/.github/agents/speckit.specify.agent.md +0 -258
- package/.github/agents/speckit.tasks.agent.md +0 -137
- package/.github/agents/speckit.taskstoissues.agent.md +0 -30
- package/.github/copilot-instructions.md +0 -17
- package/.github/prompts/speckit.analyze.prompt.md +0 -3
- package/.github/prompts/speckit.checklist.prompt.md +0 -3
- package/.github/prompts/speckit.clarify.prompt.md +0 -3
- package/.github/prompts/speckit.constitution.prompt.md +0 -3
- package/.github/prompts/speckit.implement.prompt.md +0 -3
- package/.github/prompts/speckit.plan.prompt.md +0 -3
- package/.github/prompts/speckit.specify.prompt.md +0 -3
- package/.github/prompts/speckit.tasks.prompt.md +0 -3
- package/.github/prompts/speckit.taskstoissues.prompt.md +0 -3
- package/.github/workflows/publish.yaml +0 -29
- package/.opencode/command/speckit.analyze.md +0 -184
- package/.opencode/command/speckit.checklist.md +0 -294
- package/.opencode/command/speckit.clarify.md +0 -181
- package/.opencode/command/speckit.constitution.md +0 -84
- package/.opencode/command/speckit.implement.md +0 -135
- package/.opencode/command/speckit.plan.md +0 -89
- package/.opencode/command/speckit.specify.md +0 -258
- package/.opencode/command/speckit.tasks.md +0 -137
- package/.opencode/command/speckit.taskstoissues.md +0 -30
- package/.qwen/commands/opsx-apply.toml +0 -149
- package/.qwen/commands/opsx-archive.toml +0 -154
- package/.qwen/commands/opsx-bulk-archive.toml +0 -239
- package/.qwen/commands/opsx-continue.toml +0 -111
- package/.qwen/commands/opsx-explore.toml +0 -171
- package/.qwen/commands/opsx-ff.toml +0 -91
- package/.qwen/commands/opsx-new.toml +0 -66
- package/.qwen/commands/opsx-onboard.toml +0 -522
- package/.qwen/commands/opsx-sync.toml +0 -131
- package/.qwen/commands/opsx-verify.toml +0 -161
- package/.qwen/skills/openspec-apply-change/SKILL.md +0 -156
- package/.qwen/skills/openspec-archive-change/SKILL.md +0 -114
- package/.qwen/skills/openspec-bulk-archive-change/SKILL.md +0 -246
- package/.qwen/skills/openspec-continue-change/SKILL.md +0 -118
- package/.qwen/skills/openspec-explore/SKILL.md +0 -290
- package/.qwen/skills/openspec-ff-change/SKILL.md +0 -101
- package/.qwen/skills/openspec-new-change/SKILL.md +0 -74
- package/.qwen/skills/openspec-onboard/SKILL.md +0 -529
- package/.qwen/skills/openspec-sync-specs/SKILL.md +0 -138
- package/.qwen/skills/openspec-verify-change/SKILL.md +0 -168
- package/.specify/memory/constitution.md +0 -58
- package/.specify/scripts/powershell/check-prerequisites.ps1 +0 -148
- package/.specify/scripts/powershell/common.ps1 +0 -137
- package/.specify/scripts/powershell/create-new-feature.ps1 +0 -283
- package/.specify/scripts/powershell/setup-plan.ps1 +0 -61
- package/.specify/scripts/powershell/update-agent-context.ps1 +0 -448
- package/.specify/templates/agent-file-template.md +0 -28
- package/.specify/templates/checklist-template.md +0 -40
- package/.specify/templates/constitution-template.md +0 -50
- package/.specify/templates/plan-template.md +0 -104
- package/.specify/templates/spec-template.md +0 -115
- package/.specify/templates/tasks-template.md +0 -251
- package/.vscode/launch.json +0 -14
- package/.vscode/settings.json +0 -14
- package/.vscode/tasks.json +0 -15
- package/AGENTS.md +0 -117
- package/CLAUDE.md +0 -70
- package/Dockerfile +0 -30
- package/GEMINI.md +0 -117
- package/QWEN.md +0 -117
- package/docker-compose.yml +0 -15
- package/openapi.yaml +0 -3127
- package/openspec/README.md +0 -33
- package/openspec/changes/archive/2026-04-03-separate-credit-card-transaction-tools/.openspec.yaml +0 -2
- package/openspec/changes/archive/2026-04-03-separate-credit-card-transaction-tools/design.md +0 -60
- package/openspec/changes/archive/2026-04-03-separate-credit-card-transaction-tools/proposal.md +0 -25
- package/openspec/changes/archive/2026-04-03-separate-credit-card-transaction-tools/specs/credit-card-transactions/spec.md +0 -46
- package/openspec/changes/archive/2026-04-03-separate-credit-card-transaction-tools/specs/transactions/spec.md +0 -42
- package/openspec/changes/archive/2026-04-03-separate-credit-card-transaction-tools/tasks.md +0 -22
- package/openspec/config.yaml +0 -20
- package/openspec/specs/accounts/spec.md +0 -86
- package/openspec/specs/categories/spec.md +0 -78
- package/openspec/specs/credit-card-transactions/spec.md +0 -64
- package/openspec/specs/credit-cards/spec.md +0 -109
- package/openspec/specs/data/spec.md +0 -49
- package/openspec/specs/settings/spec.md +0 -48
- package/openspec/specs/subscriptions/spec.md +0 -85
- package/openspec/specs/summary/spec.md +0 -49
- package/openspec/specs/transactions/spec.md +0 -113
- package/openspec/specs/transfers/spec.md +0 -74
- package/specs/001-mcp-api-integration/checklists/requirements.md +0 -34
- package/specs/001-mcp-api-integration/contracts/openapi.yaml +0 -636
- package/specs/001-mcp-api-integration/data-model.md +0 -106
- package/specs/001-mcp-api-integration/plan.md +0 -73
- package/specs/001-mcp-api-integration/quickstart.md +0 -74
- package/specs/001-mcp-api-integration/research.md +0 -58
- package/specs/001-mcp-api-integration/spec.md +0 -119
- package/specs/001-mcp-api-integration/tasks.md +0 -64
- package/src/config.ts +0 -39
- package/src/index.ts +0 -99
- package/src/services/apiClient.ts +0 -55
- package/src/services/requestContext.ts +0 -11
- package/src/tools/accounts.ts +0 -122
- package/src/tools/categories.ts +0 -102
- package/src/tools/credit-cards.ts +0 -203
- package/src/tools/data.ts +0 -45
- package/src/tools/settings.ts +0 -64
- package/src/tools/subscriptions.ts +0 -159
- package/src/tools/summary.ts +0 -29
- package/src/tools/transactions.ts +0 -200
- package/src/tools/transfers.ts +0 -122
- package/src/types/schemas.ts +0 -333
- package/src/utils/toolHelpers.ts +0 -11
- package/tests/benchmark.test.d.ts +0 -2
- package/tests/benchmark.test.d.ts.map +0 -1
- package/tests/benchmark.test.js +0 -33
- package/tests/benchmark.test.js.map +0 -1
- package/tests/benchmark.test.ts +0 -38
- package/tests/server.test.d.ts +0 -2
- package/tests/server.test.d.ts.map +0 -1
- package/tests/server.test.js +0 -13
- package/tests/server.test.js.map +0 -1
- package/tests/server.test.ts +0 -14
- package/tests/setup.d.ts +0 -4
- package/tests/setup.d.ts.map +0 -1
- package/tests/setup.js +0 -17
- package/tests/setup.js.map +0 -1
- package/tests/setup.ts +0 -20
- package/tests/tools/accounts.test.ts +0 -159
- package/tests/tools/categories.test.d.ts +0 -2
- package/tests/tools/categories.test.d.ts.map +0 -1
- package/tests/tools/categories.test.js +0 -63
- package/tests/tools/categories.test.js.map +0 -1
- package/tests/tools/categories.test.ts +0 -120
- package/tests/tools/credit-cards.test.d.ts +0 -2
- package/tests/tools/credit-cards.test.d.ts.map +0 -1
- package/tests/tools/credit-cards.test.js +0 -71
- package/tests/tools/credit-cards.test.js.map +0 -1
- package/tests/tools/credit-cards.test.ts +0 -131
- package/tests/tools/data.test.ts +0 -100
- package/tests/tools/settings.test.ts +0 -116
- package/tests/tools/subscriptions.test.ts +0 -173
- package/tests/tools/summary.test.d.ts +0 -2
- package/tests/tools/summary.test.d.ts.map +0 -1
- package/tests/tools/summary.test.js +0 -36
- package/tests/tools/summary.test.js.map +0 -1
- package/tests/tools/summary.test.ts +0 -63
- package/tests/tools/transactions.test.d.ts +0 -2
- package/tests/tools/transactions.test.d.ts.map +0 -1
- package/tests/tools/transactions.test.js +0 -67
- package/tests/tools/transactions.test.js.map +0 -1
- package/tests/tools/transactions.test.ts +0 -133
- package/tests/tools/transfers.test.ts +0 -141
- package/tsconfig.json +0 -52
- package/vitest.config.d.ts +0 -3
- package/vitest.config.d.ts.map +0 -1
- package/vitest.config.js +0 -14
- package/vitest.config.js.map +0 -1
- package/vitest.config.ts +0 -14
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
|
2
|
-
import { registerTransactionTools } from '../../src/tools/transactions.js';
|
|
3
|
-
import { apiClient } from '../../src/services/apiClient.js';
|
|
4
|
-
vi.mock('../../src/services/apiClient.js', () => ({
|
|
5
|
-
apiClient: {
|
|
6
|
-
get: vi.fn(),
|
|
7
|
-
post: vi.fn(),
|
|
8
|
-
patch: vi.fn(),
|
|
9
|
-
delete: vi.fn(),
|
|
10
|
-
}
|
|
11
|
-
}));
|
|
12
|
-
describe('Transaction Tools', () => {
|
|
13
|
-
let mockServer;
|
|
14
|
-
let registeredTools = {};
|
|
15
|
-
beforeEach(() => {
|
|
16
|
-
registeredTools = {};
|
|
17
|
-
mockServer = {
|
|
18
|
-
registerTool: vi.fn((name, def, handler) => {
|
|
19
|
-
registeredTools[name] = handler;
|
|
20
|
-
})
|
|
21
|
-
};
|
|
22
|
-
vi.clearAllMocks();
|
|
23
|
-
});
|
|
24
|
-
it('should register transaction tools', () => {
|
|
25
|
-
registerTransactionTools(mockServer);
|
|
26
|
-
expect(mockServer.registerTool).toHaveBeenCalledTimes(4); // create, get, pay, delete
|
|
27
|
-
});
|
|
28
|
-
describe('create_transaction', () => {
|
|
29
|
-
it('should create transaction', async () => {
|
|
30
|
-
registerTransactionTools(mockServer);
|
|
31
|
-
const handler = registeredTools['create_transaction'];
|
|
32
|
-
apiClient.post.mockResolvedValue({ id: 'tx_1' });
|
|
33
|
-
const input = { type: 'EXPENSE', name: 'Lunch', amount: 20, date: '2026-03-01' };
|
|
34
|
-
const result = await handler(input);
|
|
35
|
-
expect(apiClient.post).toHaveBeenCalledWith('/transactions', expect.objectContaining(input));
|
|
36
|
-
expect(result.content[0].text).toContain('Transaction created');
|
|
37
|
-
});
|
|
38
|
-
});
|
|
39
|
-
describe('get_transactions', () => {
|
|
40
|
-
it('should get transactions list', async () => {
|
|
41
|
-
registerTransactionTools(mockServer);
|
|
42
|
-
const handler = registeredTools['get_transactions'];
|
|
43
|
-
apiClient.get.mockResolvedValue([]);
|
|
44
|
-
await handler({ month: '2026-03' });
|
|
45
|
-
expect(apiClient.get).toHaveBeenCalledWith('/transactions?month=2026-03');
|
|
46
|
-
});
|
|
47
|
-
});
|
|
48
|
-
describe('pay_transaction', () => {
|
|
49
|
-
it('should pay transaction', async () => {
|
|
50
|
-
registerTransactionTools(mockServer);
|
|
51
|
-
const handler = registeredTools['pay_transaction'];
|
|
52
|
-
apiClient.patch.mockResolvedValue({});
|
|
53
|
-
await handler({ id: 'tx_1' });
|
|
54
|
-
expect(apiClient.patch).toHaveBeenCalledWith('/transactions/tx_1/pay');
|
|
55
|
-
});
|
|
56
|
-
});
|
|
57
|
-
describe('delete_transaction', () => {
|
|
58
|
-
it('should delete transaction', async () => {
|
|
59
|
-
registerTransactionTools(mockServer);
|
|
60
|
-
const handler = registeredTools['delete_transaction'];
|
|
61
|
-
apiClient.delete.mockResolvedValue({});
|
|
62
|
-
await handler({ id: 'tx_1' });
|
|
63
|
-
expect(apiClient.delete).toHaveBeenCalledWith('/transactions/tx_1');
|
|
64
|
-
});
|
|
65
|
-
});
|
|
66
|
-
});
|
|
67
|
-
//# sourceMappingURL=transactions.test.js.map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B,EAAE,CAAC,wBAAwB,EAAE,KAAK,IAAI,EAAE;YACtC,wBAAwB,CAAC,UAAU,CAAC,CAAC;YACrC,MAAM,OAAO,GAAG,eAAe,CAAC,iBAAiB,CAAC,CAAC;YAClD,SAAS,CAAC,KAAa,CAAC,iBAAiB,CAAC,EAAE,CAAC,CAAC;YAE/C,MAAM,OAAO,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;YAE9B,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,oBAAoB,CAAC,wBAAwB,CAAC,CAAC;QACzE,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,oBAAoB,EAAE,GAAG,EAAE;QAClC,EAAE,CAAC,2BAA2B,EAAE,KAAK,IAAI,EAAE;YACzC,wBAAwB,CAAC,UAAU,CAAC,CAAC;YACrC,MAAM,OAAO,GAAG,eAAe,CAAC,oBAAoB,CAAC,CAAC;YACrD,SAAS,CAAC,MAAc,CAAC,iBAAiB,CAAC,EAAE,CAAC,CAAC;YAEhD,MAAM,OAAO,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;YAE9B,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,oBAAoB,CAAC,oBAAoB,CAAC,CAAC;QACtE,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
|
2
|
-
import { registerTransactionTools } from '../../src/tools/transactions.js';
|
|
3
|
-
import { apiClient } from '../../src/services/apiClient.js';
|
|
4
|
-
import { ApiClientError } from '../../src/services/apiClient.js';
|
|
5
|
-
|
|
6
|
-
vi.mock('../../src/services/apiClient.js', () => ({
|
|
7
|
-
apiClient: {
|
|
8
|
-
get: vi.fn(),
|
|
9
|
-
post: vi.fn(),
|
|
10
|
-
patch: vi.fn(),
|
|
11
|
-
delete: vi.fn(),
|
|
12
|
-
},
|
|
13
|
-
ApiClientError: class ApiClientError extends Error {
|
|
14
|
-
status: number;
|
|
15
|
-
statusText: string;
|
|
16
|
-
constructor(message: string, status: number, statusText: string) {
|
|
17
|
-
super(message);
|
|
18
|
-
this.name = 'ApiClientError';
|
|
19
|
-
this.status = status;
|
|
20
|
-
this.statusText = statusText;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}));
|
|
24
|
-
|
|
25
|
-
describe('Transaction Tools', () => {
|
|
26
|
-
let mockServer: any;
|
|
27
|
-
let registeredTools: Record<string, Function> = {};
|
|
28
|
-
|
|
29
|
-
beforeEach(() => {
|
|
30
|
-
registeredTools = {};
|
|
31
|
-
mockServer = {
|
|
32
|
-
registerTool: vi.fn((name, def, handler) => {
|
|
33
|
-
registeredTools[name] = handler;
|
|
34
|
-
})
|
|
35
|
-
};
|
|
36
|
-
vi.clearAllMocks();
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
it('should register transaction tools', () => {
|
|
40
|
-
registerTransactionTools(mockServer);
|
|
41
|
-
expect(mockServer.registerTool).toHaveBeenCalledTimes(9); // create, get_all, get_one, update, pay, unpay, delete, create_credit, update_credit
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
describe('create_transaction', () => {
|
|
45
|
-
it('should create transaction', async () => {
|
|
46
|
-
registerTransactionTools(mockServer);
|
|
47
|
-
const handler = registeredTools['create_transaction'];
|
|
48
|
-
(apiClient.post as any).mockResolvedValue({ id: 'tx_1' });
|
|
49
|
-
|
|
50
|
-
const input = { type: 'EXPENSE', name: 'Lunch', amount: 20, date: '2026-03-01' };
|
|
51
|
-
const result = await handler(input);
|
|
52
|
-
|
|
53
|
-
expect(apiClient.post).toHaveBeenCalledWith('/transactions', expect.objectContaining(input));
|
|
54
|
-
expect(result.content[0].text).toContain('Transaction created');
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
it('should return API error on failure', async () => {
|
|
58
|
-
registerTransactionTools(mockServer);
|
|
59
|
-
const handler = registeredTools['create_transaction'];
|
|
60
|
-
(apiClient.post as any).mockRejectedValue(new ApiClientError('fail', 422, 'Unprocessable Entity'));
|
|
61
|
-
|
|
62
|
-
const result = await handler({ type: 'EXPENSE', name: 'Lunch', amount: 0, date: '2026-03-01' });
|
|
63
|
-
|
|
64
|
-
expect(result.content[0].text).toMatch(/^API error 422/);
|
|
65
|
-
});
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
describe('get_transactions', () => {
|
|
69
|
-
it('should get transactions list', async () => {
|
|
70
|
-
registerTransactionTools(mockServer);
|
|
71
|
-
const handler = registeredTools['get_transactions'];
|
|
72
|
-
(apiClient.get as any).mockResolvedValue([]);
|
|
73
|
-
|
|
74
|
-
await handler({ month: '2026-03' });
|
|
75
|
-
|
|
76
|
-
expect(apiClient.get).toHaveBeenCalledWith('/transactions?month=2026-03');
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
it('should return API error on failure', async () => {
|
|
80
|
-
registerTransactionTools(mockServer);
|
|
81
|
-
const handler = registeredTools['get_transactions'];
|
|
82
|
-
(apiClient.get as any).mockRejectedValue(new ApiClientError('fail', 500, 'Internal Server Error'));
|
|
83
|
-
|
|
84
|
-
const result = await handler({});
|
|
85
|
-
|
|
86
|
-
expect(result.content[0].text).toMatch(/^API error 500/);
|
|
87
|
-
});
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
describe('pay_transaction', () => {
|
|
91
|
-
it('should pay transaction', async () => {
|
|
92
|
-
registerTransactionTools(mockServer);
|
|
93
|
-
const handler = registeredTools['pay_transaction'];
|
|
94
|
-
(apiClient.patch as any).mockResolvedValue({});
|
|
95
|
-
|
|
96
|
-
await handler({ id: 'tx_1' });
|
|
97
|
-
|
|
98
|
-
expect(apiClient.patch).toHaveBeenCalledWith('/transactions/tx_1/pay');
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
it('should return API error on failure', async () => {
|
|
102
|
-
registerTransactionTools(mockServer);
|
|
103
|
-
const handler = registeredTools['pay_transaction'];
|
|
104
|
-
(apiClient.patch as any).mockRejectedValue(new ApiClientError('fail', 404, 'Not Found'));
|
|
105
|
-
|
|
106
|
-
const result = await handler({ id: 'tx_1' });
|
|
107
|
-
|
|
108
|
-
expect(result.content[0].text).toMatch(/^API error 404/);
|
|
109
|
-
});
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
describe('delete_transaction', () => {
|
|
113
|
-
it('should delete transaction', async () => {
|
|
114
|
-
registerTransactionTools(mockServer);
|
|
115
|
-
const handler = registeredTools['delete_transaction'];
|
|
116
|
-
(apiClient.delete as any).mockResolvedValue({});
|
|
117
|
-
|
|
118
|
-
await handler({ id: 'tx_1' });
|
|
119
|
-
|
|
120
|
-
expect(apiClient.delete).toHaveBeenCalledWith('/transactions/tx_1');
|
|
121
|
-
});
|
|
122
|
-
|
|
123
|
-
it('should return API error on failure', async () => {
|
|
124
|
-
registerTransactionTools(mockServer);
|
|
125
|
-
const handler = registeredTools['delete_transaction'];
|
|
126
|
-
(apiClient.delete as any).mockRejectedValue(new ApiClientError('fail', 404, 'Not Found'));
|
|
127
|
-
|
|
128
|
-
const result = await handler({ id: 'tx_1' });
|
|
129
|
-
|
|
130
|
-
expect(result.content[0].text).toMatch(/^API error 404/);
|
|
131
|
-
});
|
|
132
|
-
});
|
|
133
|
-
});
|
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
|
2
|
-
import { registerTransferTools } from '../../src/tools/transfers.js';
|
|
3
|
-
import { apiClient } from '../../src/services/apiClient.js';
|
|
4
|
-
import { ApiClientError } from '../../src/services/apiClient.js';
|
|
5
|
-
|
|
6
|
-
vi.mock('../../src/services/apiClient.js', () => ({
|
|
7
|
-
apiClient: {
|
|
8
|
-
get: vi.fn(),
|
|
9
|
-
post: vi.fn(),
|
|
10
|
-
patch: vi.fn(),
|
|
11
|
-
delete: vi.fn(),
|
|
12
|
-
},
|
|
13
|
-
ApiClientError: class ApiClientError extends Error {
|
|
14
|
-
status: number;
|
|
15
|
-
statusText: string;
|
|
16
|
-
constructor(message: string, status: number, statusText: string) {
|
|
17
|
-
super(message);
|
|
18
|
-
this.name = 'ApiClientError';
|
|
19
|
-
this.status = status;
|
|
20
|
-
this.statusText = statusText;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}));
|
|
24
|
-
|
|
25
|
-
describe('Transfer Tools', () => {
|
|
26
|
-
let mockServer: any;
|
|
27
|
-
let registeredTools: Record<string, Function> = {};
|
|
28
|
-
|
|
29
|
-
beforeEach(() => {
|
|
30
|
-
registeredTools = {};
|
|
31
|
-
mockServer = {
|
|
32
|
-
registerTool: vi.fn((name, def, handler) => {
|
|
33
|
-
registeredTools[name] = handler;
|
|
34
|
-
})
|
|
35
|
-
};
|
|
36
|
-
vi.clearAllMocks();
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
it('should register all transfer tools', () => {
|
|
40
|
-
registerTransferTools(mockServer);
|
|
41
|
-
expect(mockServer.registerTool).toHaveBeenCalledTimes(5);
|
|
42
|
-
expect(registeredTools['create_transfer']).toBeDefined();
|
|
43
|
-
expect(registeredTools['get_transfers']).toBeDefined();
|
|
44
|
-
expect(registeredTools['get_transfer']).toBeDefined();
|
|
45
|
-
expect(registeredTools['update_transfer']).toBeDefined();
|
|
46
|
-
expect(registeredTools['delete_transfer']).toBeDefined();
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
describe('create_transfer', () => {
|
|
50
|
-
it('should create a transfer', async () => {
|
|
51
|
-
registerTransferTools(mockServer);
|
|
52
|
-
const handler = registeredTools['create_transfer'];
|
|
53
|
-
(apiClient.post as any).mockResolvedValue({ id: 'tr_1' });
|
|
54
|
-
|
|
55
|
-
const input = {
|
|
56
|
-
sourceAccountId: 'acc_1',
|
|
57
|
-
destinationAccountId: 'acc_2',
|
|
58
|
-
amount: 100,
|
|
59
|
-
date: '2026-03-01'
|
|
60
|
-
};
|
|
61
|
-
const result = await handler(input);
|
|
62
|
-
|
|
63
|
-
expect(apiClient.post).toHaveBeenCalledWith('/transfers', input);
|
|
64
|
-
expect(result.content[0].text).toContain('Transfer created');
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
it('should return API error on failure', async () => {
|
|
68
|
-
registerTransferTools(mockServer);
|
|
69
|
-
const handler = registeredTools['create_transfer'];
|
|
70
|
-
(apiClient.post as any).mockRejectedValue(new ApiClientError('fail', 400, 'Bad Request'));
|
|
71
|
-
|
|
72
|
-
const result = await handler({
|
|
73
|
-
sourceAccountId: 'acc_1',
|
|
74
|
-
destinationAccountId: 'acc_2',
|
|
75
|
-
amount: 100,
|
|
76
|
-
date: '2026-03-01'
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
expect(result.content[0].text).toMatch(/^API error 400/);
|
|
80
|
-
});
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
describe('get_transfers', () => {
|
|
84
|
-
it('should list transfers', async () => {
|
|
85
|
-
registerTransferTools(mockServer);
|
|
86
|
-
const handler = registeredTools['get_transfers'];
|
|
87
|
-
(apiClient.get as any).mockResolvedValue([{ id: 'tr_1' }]);
|
|
88
|
-
|
|
89
|
-
const result = await handler({ month: '2026-03' });
|
|
90
|
-
|
|
91
|
-
expect(apiClient.get).toHaveBeenCalledWith('/transfers?month=2026-03');
|
|
92
|
-
expect(result.content[0].text).toContain('Transfers');
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
it('should return API error on failure', async () => {
|
|
96
|
-
registerTransferTools(mockServer);
|
|
97
|
-
const handler = registeredTools['get_transfers'];
|
|
98
|
-
(apiClient.get as any).mockRejectedValue(new ApiClientError('fail', 500, 'Internal Server Error'));
|
|
99
|
-
|
|
100
|
-
const result = await handler({});
|
|
101
|
-
|
|
102
|
-
expect(result.content[0].text).toMatch(/^API error 500/);
|
|
103
|
-
});
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
describe('get_transfer', () => {
|
|
107
|
-
it('should get a transfer by ID', async () => {
|
|
108
|
-
registerTransferTools(mockServer);
|
|
109
|
-
const handler = registeredTools['get_transfer'];
|
|
110
|
-
(apiClient.get as any).mockResolvedValue({ id: 'tr_1', amount: 100 });
|
|
111
|
-
|
|
112
|
-
const result = await handler({ id: 'tr_1' });
|
|
113
|
-
|
|
114
|
-
expect(apiClient.get).toHaveBeenCalledWith('/transfers/tr_1');
|
|
115
|
-
expect(result.content[0].text).toContain('tr_1');
|
|
116
|
-
});
|
|
117
|
-
});
|
|
118
|
-
|
|
119
|
-
describe('delete_transfer', () => {
|
|
120
|
-
it('should delete a transfer', async () => {
|
|
121
|
-
registerTransferTools(mockServer);
|
|
122
|
-
const handler = registeredTools['delete_transfer'];
|
|
123
|
-
(apiClient.delete as any).mockResolvedValue({});
|
|
124
|
-
|
|
125
|
-
const result = await handler({ id: 'tr_1' });
|
|
126
|
-
|
|
127
|
-
expect(apiClient.delete).toHaveBeenCalledWith('/transfers/tr_1');
|
|
128
|
-
expect(result.content[0].text).toContain('tr_1');
|
|
129
|
-
});
|
|
130
|
-
|
|
131
|
-
it('should return API error on failure', async () => {
|
|
132
|
-
registerTransferTools(mockServer);
|
|
133
|
-
const handler = registeredTools['delete_transfer'];
|
|
134
|
-
(apiClient.delete as any).mockRejectedValue(new ApiClientError('fail', 404, 'Not Found'));
|
|
135
|
-
|
|
136
|
-
const result = await handler({ id: 'tr_1' });
|
|
137
|
-
|
|
138
|
-
expect(result.content[0].text).toMatch(/^API error 404/);
|
|
139
|
-
});
|
|
140
|
-
});
|
|
141
|
-
});
|
package/tsconfig.json
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
// Visit https://aka.ms/tsconfig to read more about this file
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
// File Layout
|
|
5
|
-
"rootDir": "./src",
|
|
6
|
-
"outDir": "./dist",
|
|
7
|
-
|
|
8
|
-
// Environment Settings
|
|
9
|
-
// See also https://aka.ms/tsconfig/module
|
|
10
|
-
"module": "nodenext",
|
|
11
|
-
"target": "esnext",
|
|
12
|
-
// "types": [],
|
|
13
|
-
// For nodejs:
|
|
14
|
-
// "lib": ["esnext"],
|
|
15
|
-
// "types": ["node"],
|
|
16
|
-
// and npm install -D @types/node
|
|
17
|
-
|
|
18
|
-
// Other Outputs
|
|
19
|
-
"sourceMap": true,
|
|
20
|
-
"declaration": true,
|
|
21
|
-
"declarationMap": true,
|
|
22
|
-
|
|
23
|
-
// Stricter Typechecking Options
|
|
24
|
-
"noUncheckedIndexedAccess": true,
|
|
25
|
-
"exactOptionalPropertyTypes": true,
|
|
26
|
-
|
|
27
|
-
// Style Options
|
|
28
|
-
// "noImplicitReturns": true,
|
|
29
|
-
// "noImplicitOverride": true,
|
|
30
|
-
// "noUnusedLocals": true,
|
|
31
|
-
// "noUnusedParameters": true,
|
|
32
|
-
// "noFallthroughCasesInSwitch": true,
|
|
33
|
-
// "noPropertyAccessFromIndexSignature": true,
|
|
34
|
-
|
|
35
|
-
// Recommended Options
|
|
36
|
-
"strict": true,
|
|
37
|
-
"jsx": "react-jsx",
|
|
38
|
-
"verbatimModuleSyntax": true,
|
|
39
|
-
"isolatedModules": true,
|
|
40
|
-
"noUncheckedSideEffectImports": true,
|
|
41
|
-
"moduleDetection": "force",
|
|
42
|
-
"skipLibCheck": true,
|
|
43
|
-
},
|
|
44
|
-
"include": [
|
|
45
|
-
"src/**/*"
|
|
46
|
-
],
|
|
47
|
-
"exclude": [
|
|
48
|
-
"node_modules",
|
|
49
|
-
"tests",
|
|
50
|
-
"vitest.config.ts"
|
|
51
|
-
]
|
|
52
|
-
}
|
package/vitest.config.d.ts
DELETED
package/vitest.config.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"vitest.config.d.ts","sourceRoot":"","sources":["vitest.config.ts"],"names":[],"mappings":";AAEA,wBAWG"}
|
package/vitest.config.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { defineConfig } from 'vitest/config';
|
|
2
|
-
export default defineConfig({
|
|
3
|
-
test: {
|
|
4
|
-
globals: true,
|
|
5
|
-
environment: 'node',
|
|
6
|
-
setupFiles: ['tests/setup.ts'],
|
|
7
|
-
include: ['tests/**/*.test.ts'],
|
|
8
|
-
coverage: {
|
|
9
|
-
provider: 'v8',
|
|
10
|
-
reporter: ['text', 'json', 'html'],
|
|
11
|
-
},
|
|
12
|
-
},
|
|
13
|
-
});
|
|
14
|
-
//# sourceMappingURL=vitest.config.js.map
|
package/vitest.config.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"vitest.config.js","sourceRoot":"","sources":["vitest.config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7C,eAAe,YAAY,CAAC;IAC1B,IAAI,EAAE;QACJ,OAAO,EAAE,IAAI;QACb,WAAW,EAAE,MAAM;QACnB,UAAU,EAAE,CAAC,gBAAgB,CAAC;QAC9B,OAAO,EAAE,CAAC,oBAAoB,CAAC;QAC/B,QAAQ,EAAE;YACR,QAAQ,EAAE,IAAI;YACd,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;SACnC;KACF;CACF,CAAC,CAAC"}
|
package/vitest.config.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { defineConfig } from 'vitest/config';
|
|
2
|
-
|
|
3
|
-
export default defineConfig({
|
|
4
|
-
test: {
|
|
5
|
-
globals: true,
|
|
6
|
-
environment: 'node',
|
|
7
|
-
setupFiles: ['tests/setup.ts'],
|
|
8
|
-
include: ['tests/**/*.test.ts'],
|
|
9
|
-
coverage: {
|
|
10
|
-
provider: 'v8',
|
|
11
|
-
reporter: ['text', 'json', 'html'],
|
|
12
|
-
},
|
|
13
|
-
},
|
|
14
|
-
});
|