quantix-mcp 0.3.6 → 0.3.9
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/.github/agents/copilot-instructions.md +32 -32
- package/.github/copilot-instructions.md +17 -17
- package/.github/workflows/publish.yaml +28 -28
- package/.opencode/command/speckit.analyze.md +184 -184
- package/.opencode/command/speckit.checklist.md +294 -294
- package/.opencode/command/speckit.clarify.md +181 -181
- package/.opencode/command/speckit.constitution.md +84 -84
- package/.opencode/command/speckit.implement.md +135 -135
- package/.opencode/command/speckit.plan.md +89 -89
- package/.opencode/command/speckit.specify.md +258 -258
- package/.opencode/command/speckit.tasks.md +137 -137
- package/.opencode/command/speckit.taskstoissues.md +30 -30
- package/.specify/memory/constitution.md +58 -58
- package/.specify/templates/constitution-template.md +50 -50
- package/.vscode/launch.json +14 -14
- package/CLAUDE.md +64 -64
- package/README.md +176 -176
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -5
- package/dist/index.js.map +1 -1
- package/dist/tools/accounts.d.ts.map +1 -1
- package/dist/tools/accounts.js +64 -28
- package/dist/tools/accounts.js.map +1 -1
- package/dist/tools/categories.d.ts.map +1 -1
- package/dist/tools/categories.js +46 -20
- package/dist/tools/categories.js.map +1 -1
- package/dist/tools/credit-cards.d.ts.map +1 -1
- package/dist/tools/credit-cards.js +89 -33
- package/dist/tools/credit-cards.js.map +1 -1
- package/dist/tools/data.d.ts.map +1 -1
- package/dist/tools/data.js +19 -8
- package/dist/tools/data.js.map +1 -1
- package/dist/tools/settings.d.ts.map +1 -1
- package/dist/tools/settings.js +28 -12
- package/dist/tools/settings.js.map +1 -1
- package/dist/tools/summary.d.ts.map +1 -1
- package/dist/tools/summary.js +17 -11
- package/dist/tools/summary.js.map +1 -1
- package/dist/tools/transactions.d.ts.map +1 -1
- package/dist/tools/transactions.js +86 -50
- package/dist/tools/transactions.js.map +1 -1
- package/dist/tools/transfers.d.ts +3 -0
- package/dist/tools/transfers.d.ts.map +1 -0
- package/dist/tools/transfers.js +107 -0
- package/dist/tools/transfers.js.map +1 -0
- package/dist/types/schemas.d.ts +25 -0
- package/dist/types/schemas.d.ts.map +1 -1
- package/dist/types/schemas.js +28 -2
- package/dist/types/schemas.js.map +1 -1
- package/dist/utils/toolHelpers.d.ts +7 -0
- package/dist/utils/toolHelpers.d.ts.map +1 -0
- package/dist/utils/toolHelpers.js +11 -0
- package/dist/utils/toolHelpers.js.map +1 -0
- package/openapi.yaml +2045 -1786
- package/package.json +41 -41
- package/specs/001-mcp-api-integration/checklists/requirements.md +34 -34
- package/specs/001-mcp-api-integration/contracts/openapi.yaml +635 -635
- package/specs/001-mcp-api-integration/data-model.md +106 -106
- package/specs/001-mcp-api-integration/plan.md +73 -73
- package/specs/001-mcp-api-integration/quickstart.md +74 -74
- package/specs/001-mcp-api-integration/research.md +58 -58
- package/specs/001-mcp-api-integration/spec.md +119 -119
- package/specs/001-mcp-api-integration/tasks.md +64 -64
- package/src/config.ts +36 -36
- package/src/index.ts +49 -47
- package/src/services/apiClient.ts +49 -49
- package/src/tools/accounts.ts +140 -111
- package/src/tools/categories.ts +102 -81
- package/src/tools/credit-cards.ts +184 -132
- package/src/tools/data.ts +45 -36
- package/src/tools/settings.ts +64 -51
- package/src/tools/summary.ts +29 -24
- package/src/tools/transactions.ts +157 -128
- package/src/tools/transfers.ts +122 -0
- package/src/types/schemas.ts +260 -230
- package/src/utils/toolHelpers.ts +11 -0
- package/tests/benchmark.test.d.ts +1 -1
- package/tests/benchmark.test.js +32 -32
- package/tests/benchmark.test.ts +38 -38
- package/tests/server.test.d.ts +1 -1
- package/tests/server.test.js +12 -12
- package/tests/server.test.ts +14 -14
- package/tests/setup.d.ts +3 -3
- package/tests/setup.js +16 -16
- package/tests/setup.ts +20 -20
- package/tests/tools/accounts.test.ts +159 -118
- package/tests/tools/categories.test.d.ts +1 -1
- package/tests/tools/categories.test.js +62 -62
- package/tests/tools/categories.test.ts +120 -78
- package/tests/tools/credit-cards.test.d.ts +1 -1
- package/tests/tools/credit-cards.test.js +70 -70
- package/tests/tools/credit-cards.test.ts +131 -89
- package/tests/tools/data.test.ts +100 -0
- package/tests/tools/settings.test.ts +116 -0
- package/tests/tools/summary.test.d.ts +1 -1
- package/tests/tools/summary.test.js +35 -35
- package/tests/tools/summary.test.ts +63 -42
- package/tests/tools/transactions.test.d.ts +1 -1
- package/tests/tools/transactions.test.js +66 -66
- package/tests/tools/transactions.test.ts +133 -82
- package/tests/tools/transfers.test.ts +141 -0
- package/tsconfig.json +52 -52
- package/vitest.config.d.ts +2 -2
- package/vitest.config.js +13 -13
- package/vitest.config.ts +14 -14
package/src/types/schemas.ts
CHANGED
|
@@ -1,230 +1,260 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
|
|
3
|
-
// ---
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
createdAt: z.string().datetime().optional()
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
amount: z.number().min(0),
|
|
18
|
-
date: z.string().regex(/^\d{4}-\d{2}-\d{2}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
// --- Transfer Entities ---
|
|
4
|
+
export const TransferSchema = z.object({
|
|
5
|
+
id: z.string(),
|
|
6
|
+
sourceAccountId: z.string(),
|
|
7
|
+
destinationAccountId: z.string(),
|
|
8
|
+
amount: z.number().min(0.01),
|
|
9
|
+
date: z.string().regex(/^\d{4}-\d{2}-\d{2}$/),
|
|
10
|
+
createdAt: z.string().datetime().optional(),
|
|
11
|
+
updatedAt: z.string().datetime().optional(),
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
export const CreateTransferRequestSchema = z.object({
|
|
15
|
+
sourceAccountId: z.string().describe("Source account ID (required — must ask the user if not provided, do not assume or default)"),
|
|
16
|
+
destinationAccountId: z.string().describe("Destination account ID (required — must ask the user if not provided, do not assume or default)"),
|
|
17
|
+
amount: z.number().min(0.01).describe("Transfer amount (required — must ask the user if not provided, do not assume or default)"),
|
|
18
|
+
date: z.string().regex(/^\d{4}-\d{2}-\d{2}$/).describe("Transfer date (required — must ask the user if not provided, do not assume or default)"),
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
export const UpdateTransferRequestSchema = z.object({
|
|
22
|
+
sourceAccountId: z.string().optional(),
|
|
23
|
+
destinationAccountId: z.string().optional(),
|
|
24
|
+
amount: z.number().min(0.01).optional(),
|
|
25
|
+
date: z.string().regex(/^\d{4}-\d{2}-\d{2}$/).optional(),
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
// --- Domain Entities ---
|
|
29
|
+
|
|
30
|
+
export const CategorySchema = z.object({
|
|
31
|
+
id: z.string(),
|
|
32
|
+
name: z.string(),
|
|
33
|
+
type: z.enum(["INCOME", "EXPENSE"]),
|
|
34
|
+
color: z.string().optional(),
|
|
35
|
+
createdAt: z.string().datetime().optional()
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
export const TransactionSchema = z.object({
|
|
39
|
+
id: z.string(),
|
|
40
|
+
type: z.enum(["INCOME", "EXPENSE"]),
|
|
41
|
+
name: z.string(),
|
|
42
|
+
amount: z.number().min(0),
|
|
43
|
+
date: z.string().regex(/^\d{4}-\d{2}-\d{2}$/, "Invalid date format YYYY-MM-DD"),
|
|
44
|
+
categoryId: z.string().optional(),
|
|
45
|
+
paymentMethod: z.enum(["CASH", "PIX", "DEBIT", "CREDIT"]).optional(),
|
|
46
|
+
creditCardId: z.string().optional(),
|
|
47
|
+
installmentGroupId: z.string().optional(),
|
|
48
|
+
installmentNumber: z.number().int().optional(),
|
|
49
|
+
installmentTotal: z.number().int().optional(),
|
|
50
|
+
recurrenceRuleId: z.string().optional(),
|
|
51
|
+
accountId: z.string().optional(),
|
|
52
|
+
paid: z.boolean().default(false),
|
|
53
|
+
createdAt: z.string().datetime().optional()
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
export const CreditCardSchema = z.object({
|
|
57
|
+
id: z.string(),
|
|
58
|
+
name: z.string(),
|
|
59
|
+
brand: z.string().optional(),
|
|
60
|
+
limitAmount: z.number().min(0),
|
|
61
|
+
closingDay: z.number().int().min(1).max(31),
|
|
62
|
+
dueDay: z.number().int().min(1).max(31),
|
|
63
|
+
createdAt: z.string().datetime().optional()
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
export const AccountSchema = z.object({
|
|
67
|
+
id: z.string(),
|
|
68
|
+
name: z.string(),
|
|
69
|
+
type: z.enum(["BANK_ACCOUNT", "WALLET", "SAVINGS_ACCOUNT", "INVESTMENT_ACCOUNT", "OTHER"]),
|
|
70
|
+
initialBalance: z.number(),
|
|
71
|
+
currentBalance: z.number().optional(),
|
|
72
|
+
createdAt: z.string().datetime().optional(),
|
|
73
|
+
updatedAt: z.string().datetime().optional()
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
export const AccountBalanceSchema = z.object({
|
|
77
|
+
accountId: z.string(),
|
|
78
|
+
currentBalance: z.number(),
|
|
79
|
+
calculatedAt: z.string().datetime()
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
export const StatementSchema = z.object({
|
|
83
|
+
cardId: z.string(),
|
|
84
|
+
periodStart: z.string(),
|
|
85
|
+
periodEnd: z.string(),
|
|
86
|
+
dueDate: z.string(),
|
|
87
|
+
transactions: z.array(TransactionSchema).optional(),
|
|
88
|
+
total: z.number(),
|
|
89
|
+
availableLimit: z.number()
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
export const StatementStatusSchema = z.object({
|
|
93
|
+
cardId: z.string(),
|
|
94
|
+
month: z.string(),
|
|
95
|
+
isPaid: z.boolean()
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
export const SummarySchema = z.object({
|
|
99
|
+
period: z.object({
|
|
100
|
+
month: z.string().optional(),
|
|
101
|
+
startDate: z.string().optional(),
|
|
102
|
+
endDate: z.string().optional()
|
|
103
|
+
}).optional(),
|
|
104
|
+
income: z.number(),
|
|
105
|
+
expenses: z.number(),
|
|
106
|
+
pendingIncome: z.number().optional(),
|
|
107
|
+
pendingExpenses: z.number().optional(),
|
|
108
|
+
balance: z.number(),
|
|
109
|
+
creditCardExpenses: z.array(z.any()).optional(),
|
|
110
|
+
expensesByCategory: z.array(z.any()).optional(),
|
|
111
|
+
incomeByCategory: z.array(z.any()).optional(),
|
|
112
|
+
accounts: z.array(z.any()).optional(),
|
|
113
|
+
totalBalance: z.number().optional()
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
export const SettingsSchema = z.object({
|
|
117
|
+
userName: z.string(),
|
|
118
|
+
language: z.enum(["pt-BR", "en-US"]),
|
|
119
|
+
currency: z.enum(["BRL", "USD", "EUR", "GBP", "JPY", "CAD", "AUD", "CHF"]),
|
|
120
|
+
createdAt: z.string().datetime().optional(),
|
|
121
|
+
updatedAt: z.string().datetime().optional()
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
// --- Tool Inputs ---
|
|
125
|
+
|
|
126
|
+
export const CreateCategoryInput = z.object({
|
|
127
|
+
name: z.string(),
|
|
128
|
+
type: z.enum(["INCOME", "EXPENSE"]),
|
|
129
|
+
color: z.string().regex(/^#[0-9A-Fa-f]{6}$/, "Invalid hex color").optional()
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
export const UpdateCategoryInput = z.object({
|
|
133
|
+
id: z.string(),
|
|
134
|
+
name: z.string().optional(),
|
|
135
|
+
color: z.string().regex(/^#[0-9A-Fa-f]{6}$/, "Invalid hex color").optional()
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
export const CreateCreditCardInput = z.object({
|
|
139
|
+
name: z.string(),
|
|
140
|
+
brand: z.string().optional(),
|
|
141
|
+
limitAmount: z.number().min(0),
|
|
142
|
+
closingDay: z.number().int().min(1).max(31),
|
|
143
|
+
dueDay: z.number().int().min(1).max(31)
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
export const UpdateCreditCardInput = z.object({
|
|
147
|
+
id: z.string(),
|
|
148
|
+
name: z.string().optional(),
|
|
149
|
+
brand: z.string().optional(),
|
|
150
|
+
limitAmount: z.number().min(0).optional(),
|
|
151
|
+
closingDay: z.number().int().min(1).max(31).optional(),
|
|
152
|
+
dueDay: z.number().int().min(1).max(31).optional()
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
export const CreateTransactionInput = z.object({
|
|
156
|
+
type: z.enum(["INCOME", "EXPENSE"]),
|
|
157
|
+
name: z.string(),
|
|
158
|
+
amount: z.number().nonnegative().describe("Transaction amount (required — must ask the user if not provided, do not assume or default)"),
|
|
159
|
+
date: z.string().describe("ISO date string YYYY-MM-DD"),
|
|
160
|
+
categoryId: z.string().optional(),
|
|
161
|
+
paymentMethod: z.enum(["CASH", "PIX", "DEBIT", "CREDIT"]).optional(),
|
|
162
|
+
creditCardId: z.string().optional(),
|
|
163
|
+
accountId: z.string().optional(),
|
|
164
|
+
installments: z.number().int().min(1).optional(),
|
|
165
|
+
targetDueMonth: z.string().regex(/^\d{4}-\d{2}$/).optional(),
|
|
166
|
+
purchaseDate: z.string().regex(/^\d{4}-\d{2}-\d{2}$/).describe("Actual purchase date (credit card only), YYYY-MM-DD").optional(),
|
|
167
|
+
isPaid: z.boolean().describe("Whether the transaction is already paid at creation time").optional(),
|
|
168
|
+
recurrence: z.object({
|
|
169
|
+
frequency: z.enum(["MONTHLY", "WEEKLY", "YEARLY"]),
|
|
170
|
+
interval: z.number().int().min(1).optional(),
|
|
171
|
+
endDate: z.string().optional(),
|
|
172
|
+
occurrences: z.number().int().min(2).describe("Number of occurrences (mutually exclusive with endDate)").optional()
|
|
173
|
+
}).optional()
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
export const UpdateTransactionInput = z.object({
|
|
177
|
+
id: z.string(),
|
|
178
|
+
mode: z.enum(["SINGLE", "PENDING", "ALL"]).default("SINGLE").optional(),
|
|
179
|
+
type: z.enum(["INCOME", "EXPENSE"]).optional(),
|
|
180
|
+
name: z.string().optional(),
|
|
181
|
+
amount: z.number().nonnegative().optional(),
|
|
182
|
+
date: z.string().describe("ISO date string YYYY-MM-DD").optional(),
|
|
183
|
+
categoryId: z.string().optional(),
|
|
184
|
+
paymentMethod: z.enum(["CASH", "PIX", "DEBIT", "CREDIT"]).optional(),
|
|
185
|
+
creditCardId: z.string().optional(),
|
|
186
|
+
accountId: z.string().optional(),
|
|
187
|
+
targetDueMonth: z.string().regex(/^\d{4}-\d{2}$/).optional(),
|
|
188
|
+
recurrence: z.object({
|
|
189
|
+
frequency: z.enum(["MONTHLY", "WEEKLY", "YEARLY"]).optional(),
|
|
190
|
+
interval: z.number().int().min(1).optional(),
|
|
191
|
+
endDate: z.string().optional(),
|
|
192
|
+
occurrences: z.number().int().min(2).describe("Number of occurrences (mutually exclusive with endDate)").optional()
|
|
193
|
+
}).optional()
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
export const CreateAccountInput = z.object({
|
|
197
|
+
name: z.string(),
|
|
198
|
+
type: z.enum(["BANK_ACCOUNT", "WALLET", "SAVINGS_ACCOUNT", "INVESTMENT_ACCOUNT", "OTHER"]),
|
|
199
|
+
initialBalance: z.number().optional()
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
export const UpdateAccountInput = z.object({
|
|
203
|
+
id: z.string(),
|
|
204
|
+
name: z.string().optional(),
|
|
205
|
+
type: z.enum(["BANK_ACCOUNT", "WALLET", "SAVINGS_ACCOUNT", "INVESTMENT_ACCOUNT", "OTHER"]).optional()
|
|
206
|
+
});
|
|
207
|
+
|
|
208
|
+
export const GetTransactionsInput = z.object({
|
|
209
|
+
month: z.string().regex(/^\d{4}-\d{2}$/, "Format: YYYY-MM").describe("Filter by month, format: YYYY-MM").optional(),
|
|
210
|
+
accountId: z.string().describe("Filter by account ID").optional(),
|
|
211
|
+
categoryId: z.string().describe("Filter by category ID").optional(),
|
|
212
|
+
creditCardId: z.string().describe("Filter by credit card ID").optional(),
|
|
213
|
+
type: z.enum(["INCOME", "EXPENSE"]).describe("Filter by transaction type").optional(),
|
|
214
|
+
startDate: z.string().regex(/^\d{4}-\d{2}-\d{2}$/).describe("Filter from this date (inclusive), YYYY-MM-DD").optional(),
|
|
215
|
+
endDate: z.string().regex(/^\d{4}-\d{2}-\d{2}$/).describe("Filter up to this date (inclusive), YYYY-MM-DD").optional(),
|
|
216
|
+
paid: z.boolean().describe("Filter by payment status (true = paid, false = unpaid)").optional()
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
export const PayStatementInput = z.object({
|
|
220
|
+
cardId: z.string(),
|
|
221
|
+
month: z.string().regex(/^\d{4}-\d{2}$/, "Format: YYYY-MM"),
|
|
222
|
+
paymentAccountId: z.string()
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
export const ReopenStatementInput = z.object({
|
|
226
|
+
cardId: z.string().describe('Credit card ID'),
|
|
227
|
+
month: z.string().regex(/^\d{4}-\d{2}$/, "Format: YYYY-MM").describe('Month in YYYY-MM format')
|
|
228
|
+
});
|
|
229
|
+
|
|
230
|
+
export const GetSummaryInput = z.object({
|
|
231
|
+
month: z.string().regex(/^\d{4}-\d{2}$/, "Format: YYYY-MM").describe("Month in YYYY-MM format (use this OR startDate+endDate)").optional(),
|
|
232
|
+
startDate: z.string().regex(/^\d{4}-\d{2}-\d{2}$/).describe("Start date for custom range, YYYY-MM-DD (use with endDate)").optional(),
|
|
233
|
+
endDate: z.string().regex(/^\d{4}-\d{2}-\d{2}$/).describe("End date for custom range, YYYY-MM-DD (use with startDate)").optional()
|
|
234
|
+
});
|
|
235
|
+
|
|
236
|
+
export const CreateSettingsInput = z.object({
|
|
237
|
+
userName: z.string(),
|
|
238
|
+
language: z.enum(["pt-BR", "en-US"]),
|
|
239
|
+
currency: z.enum(["BRL", "USD", "EUR", "GBP", "JPY", "CAD", "AUD", "CHF"])
|
|
240
|
+
});
|
|
241
|
+
|
|
242
|
+
export const UpdateSettingsInput = z.object({
|
|
243
|
+
userName: z.string().optional(),
|
|
244
|
+
language: z.enum(["pt-BR", "en-US"]).optional(),
|
|
245
|
+
currency: z.enum(["BRL", "USD", "EUR", "GBP", "JPY", "CAD", "AUD", "CHF"]).optional()
|
|
246
|
+
});
|
|
247
|
+
|
|
248
|
+
export const ImportDataInput = z.object({
|
|
249
|
+
mode: z.enum(["reset", "increment"]).describe("reset: clears all data before import; increment: adds new records, skipping existing IDs"),
|
|
250
|
+
version: z.string().describe('Export format version, must be "1.0"'),
|
|
251
|
+
exportedAt: z.string().datetime().describe("ISO timestamp of when the data was exported"),
|
|
252
|
+
data: z.object({
|
|
253
|
+
settings: z.any().nullable().optional(),
|
|
254
|
+
categories: z.array(z.any()).optional(),
|
|
255
|
+
accounts: z.array(z.any()).optional(),
|
|
256
|
+
creditCards: z.array(z.any()).optional(),
|
|
257
|
+
recurrenceRules: z.array(z.any()).optional(),
|
|
258
|
+
transactions: z.array(z.any()).optional()
|
|
259
|
+
})
|
|
260
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ApiClientError } from '../services/apiClient.js';
|
|
2
|
+
|
|
3
|
+
export function handleToolError(error: unknown): { content: [{ type: 'text'; text: string }] } {
|
|
4
|
+
if (error instanceof ApiClientError) {
|
|
5
|
+
return { content: [{ type: 'text', text: `API error ${error.status}: ${error.statusText}` }] };
|
|
6
|
+
}
|
|
7
|
+
if (error instanceof Error) {
|
|
8
|
+
return { content: [{ type: 'text', text: `Error: ${error.message}` }] };
|
|
9
|
+
}
|
|
10
|
+
return { content: [{ type: 'text', text: 'An unexpected error occurred.' }] };
|
|
11
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
|
2
2
|
//# sourceMappingURL=benchmark.test.d.ts.map
|
package/tests/benchmark.test.js
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import { describe, it, expect, vi } from 'vitest';
|
|
2
|
-
import { registerCategoryTools } from '../src/tools/categories.js';
|
|
3
|
-
import { apiClient } from '../src/services/apiClient.js';
|
|
4
|
-
vi.mock('../src/services/apiClient.js', () => ({
|
|
5
|
-
apiClient: {
|
|
6
|
-
get: vi.fn(),
|
|
7
|
-
}
|
|
8
|
-
}));
|
|
9
|
-
describe('Performance Benchmark', () => {
|
|
10
|
-
// This is a rough benchmark, mostly verifying it's not super slow due to overhead
|
|
11
|
-
it('should execute tool handler with low overhead (<20ms)', async () => {
|
|
12
|
-
const registeredTools = {};
|
|
13
|
-
const mockServer = {
|
|
14
|
-
registerTool: (name, def, handler) => {
|
|
15
|
-
registeredTools[name] = handler;
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
// Setup
|
|
19
|
-
registerCategoryTools(mockServer);
|
|
20
|
-
const handler = registeredTools['get_categories'];
|
|
21
|
-
apiClient.get.mockResolvedValue([]);
|
|
22
|
-
// Warmup
|
|
23
|
-
await handler({});
|
|
24
|
-
// Measure
|
|
25
|
-
const start = performance.now();
|
|
26
|
-
await handler({});
|
|
27
|
-
const end = performance.now();
|
|
28
|
-
const duration = end - start;
|
|
29
|
-
console.log(`Tool execution overhead: ${duration.toFixed(3)}ms`);
|
|
30
|
-
expect(duration).toBeLessThan(20);
|
|
31
|
-
});
|
|
32
|
-
});
|
|
1
|
+
import { describe, it, expect, vi } from 'vitest';
|
|
2
|
+
import { registerCategoryTools } from '../src/tools/categories.js';
|
|
3
|
+
import { apiClient } from '../src/services/apiClient.js';
|
|
4
|
+
vi.mock('../src/services/apiClient.js', () => ({
|
|
5
|
+
apiClient: {
|
|
6
|
+
get: vi.fn(),
|
|
7
|
+
}
|
|
8
|
+
}));
|
|
9
|
+
describe('Performance Benchmark', () => {
|
|
10
|
+
// This is a rough benchmark, mostly verifying it's not super slow due to overhead
|
|
11
|
+
it('should execute tool handler with low overhead (<20ms)', async () => {
|
|
12
|
+
const registeredTools = {};
|
|
13
|
+
const mockServer = {
|
|
14
|
+
registerTool: (name, def, handler) => {
|
|
15
|
+
registeredTools[name] = handler;
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
// Setup
|
|
19
|
+
registerCategoryTools(mockServer);
|
|
20
|
+
const handler = registeredTools['get_categories'];
|
|
21
|
+
apiClient.get.mockResolvedValue([]);
|
|
22
|
+
// Warmup
|
|
23
|
+
await handler({});
|
|
24
|
+
// Measure
|
|
25
|
+
const start = performance.now();
|
|
26
|
+
await handler({});
|
|
27
|
+
const end = performance.now();
|
|
28
|
+
const duration = end - start;
|
|
29
|
+
console.log(`Tool execution overhead: ${duration.toFixed(3)}ms`);
|
|
30
|
+
expect(duration).toBeLessThan(20);
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
33
|
//# sourceMappingURL=benchmark.test.js.map
|