@dizzlkheinz/ynab-mcpb 0.18.3 → 0.18.4

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 (33) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/bundle/index.cjs +40 -40
  3. package/dist/tools/reconcileAdapter.js +3 -0
  4. package/dist/tools/reconciliation/analyzer.js +72 -7
  5. package/dist/tools/reconciliation/reportFormatter.js +26 -2
  6. package/dist/tools/reconciliation/types.d.ts +3 -0
  7. package/dist/tools/transactionSchemas.d.ts +309 -0
  8. package/dist/tools/transactionSchemas.js +215 -0
  9. package/dist/tools/transactionTools.d.ts +3 -281
  10. package/dist/tools/transactionTools.js +4 -559
  11. package/dist/tools/transactionUtils.d.ts +31 -0
  12. package/dist/tools/transactionUtils.js +349 -0
  13. package/docs/plans/2025-12-25-transaction-tools-refactor-design.md +211 -0
  14. package/docs/plans/2025-12-25-transaction-tools-refactor.md +905 -0
  15. package/package.json +4 -2
  16. package/scripts/run-all-tests.js +196 -0
  17. package/src/tools/__tests__/transactionSchemas.test.ts +1188 -0
  18. package/src/tools/__tests__/transactionUtils.test.ts +989 -0
  19. package/src/tools/reconcileAdapter.ts +6 -0
  20. package/src/tools/reconciliation/__tests__/adapter.causes.test.ts +22 -8
  21. package/src/tools/reconciliation/__tests__/adapter.test.ts +3 -0
  22. package/src/tools/reconciliation/__tests__/analyzer.test.ts +65 -0
  23. package/src/tools/reconciliation/__tests__/recommendationEngine.test.ts +3 -0
  24. package/src/tools/reconciliation/__tests__/reportFormatter.test.ts +4 -1
  25. package/src/tools/reconciliation/__tests__/scenarios/adapterCurrency.scenario.test.ts +3 -0
  26. package/src/tools/reconciliation/__tests__/scenarios/extremes.scenario.test.ts +5 -1
  27. package/src/tools/reconciliation/__tests__/schemaUrl.test.ts +22 -8
  28. package/src/tools/reconciliation/analyzer.ts +127 -11
  29. package/src/tools/reconciliation/reportFormatter.ts +39 -2
  30. package/src/tools/reconciliation/types.ts +6 -0
  31. package/src/tools/transactionSchemas.ts +453 -0
  32. package/src/tools/transactionTools.ts +102 -823
  33. package/src/tools/transactionUtils.ts +536 -0
@@ -0,0 +1,215 @@
1
+ import { z } from 'zod/v4';
2
+ export const ListTransactionsSchema = z
3
+ .object({
4
+ budget_id: z.string().min(1, 'Budget ID is required'),
5
+ account_id: z.string().optional(),
6
+ category_id: z.string().optional(),
7
+ since_date: z
8
+ .string()
9
+ .regex(/^\d{4}-\d{2}-\d{2}$/, 'Date must be in ISO format (YYYY-MM-DD)')
10
+ .optional(),
11
+ type: z.enum(['uncategorized', 'unapproved']).optional(),
12
+ })
13
+ .strict();
14
+ export const GetTransactionSchema = z
15
+ .object({
16
+ budget_id: z.string().min(1, 'Budget ID is required'),
17
+ transaction_id: z.string().min(1, 'Transaction ID is required'),
18
+ })
19
+ .strict();
20
+ export const CreateTransactionSchema = z
21
+ .object({
22
+ budget_id: z.string().min(1, 'Budget ID is required'),
23
+ account_id: z.string().min(1, 'Account ID is required'),
24
+ amount: z.number().int('Amount must be an integer in milliunits'),
25
+ date: z.string().regex(/^\d{4}-\d{2}-\d{2}$/, 'Date must be in ISO format (YYYY-MM-DD)'),
26
+ payee_name: z.string().optional(),
27
+ payee_id: z.string().optional(),
28
+ category_id: z.string().optional(),
29
+ memo: z.string().optional(),
30
+ cleared: z.enum(['cleared', 'uncleared', 'reconciled']).optional(),
31
+ approved: z.boolean().optional(),
32
+ flag_color: z.enum(['red', 'orange', 'yellow', 'green', 'blue', 'purple']).optional(),
33
+ import_id: z.string().min(1, 'Import ID cannot be empty').optional(),
34
+ dry_run: z.boolean().optional(),
35
+ subtransactions: z
36
+ .array(z
37
+ .object({
38
+ amount: z.number().int('Subtransaction amount must be an integer in milliunits'),
39
+ payee_name: z.string().optional(),
40
+ payee_id: z.string().optional(),
41
+ category_id: z.string().optional(),
42
+ memo: z.string().optional(),
43
+ })
44
+ .strict())
45
+ .min(1, 'At least one subtransaction is required when provided')
46
+ .optional(),
47
+ })
48
+ .strict()
49
+ .superRefine((data, ctx) => {
50
+ if (data.subtransactions && data.subtransactions.length > 0) {
51
+ const total = data.subtransactions.reduce((sum, sub) => sum + sub.amount, 0);
52
+ if (total !== data.amount) {
53
+ ctx.addIssue({
54
+ code: z.ZodIssueCode.custom,
55
+ message: 'Amount must equal the sum of subtransaction amounts',
56
+ path: ['amount'],
57
+ });
58
+ }
59
+ }
60
+ });
61
+ const BulkTransactionInputSchemaBase = CreateTransactionSchema.pick({
62
+ account_id: true,
63
+ amount: true,
64
+ date: true,
65
+ payee_name: true,
66
+ payee_id: true,
67
+ category_id: true,
68
+ memo: true,
69
+ cleared: true,
70
+ approved: true,
71
+ flag_color: true,
72
+ import_id: true,
73
+ });
74
+ const BulkTransactionInputSchema = BulkTransactionInputSchemaBase.strict();
75
+ export const CreateTransactionsSchema = z
76
+ .object({
77
+ budget_id: z.string().min(1, 'Budget ID is required'),
78
+ transactions: z
79
+ .array(BulkTransactionInputSchema)
80
+ .min(1, 'At least one transaction is required')
81
+ .max(100, 'A maximum of 100 transactions may be created at once'),
82
+ dry_run: z.boolean().optional(),
83
+ })
84
+ .strict();
85
+ const ReceiptSplitItemSchema = z
86
+ .object({
87
+ name: z.string().min(1, 'Item name is required'),
88
+ amount: z.number().finite('Item amount must be a finite number'),
89
+ quantity: z
90
+ .number()
91
+ .finite('Quantity must be a finite number')
92
+ .positive('Quantity must be greater than zero')
93
+ .optional(),
94
+ memo: z.string().optional(),
95
+ })
96
+ .strict();
97
+ const ReceiptSplitCategorySchema = z
98
+ .object({
99
+ category_id: z.string().min(1, 'Category ID is required'),
100
+ category_name: z.string().optional(),
101
+ items: z.array(ReceiptSplitItemSchema).min(1, 'Each category must include at least one item'),
102
+ })
103
+ .strict();
104
+ export const CreateReceiptSplitTransactionSchema = z
105
+ .object({
106
+ budget_id: z.string().min(1, 'Budget ID is required'),
107
+ account_id: z.string().min(1, 'Account ID is required'),
108
+ payee_name: z.string().min(1, 'Payee name is required'),
109
+ date: z
110
+ .string()
111
+ .regex(/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/, 'Date must be in ISO format (YYYY-MM-DD)')
112
+ .optional(),
113
+ memo: z.string().optional(),
114
+ receipt_subtotal: z
115
+ .number()
116
+ .finite('Receipt subtotal must be a finite number')
117
+ .refine((value) => value >= 0, 'Receipt subtotal must be zero or greater')
118
+ .optional(),
119
+ receipt_tax: z.number().finite('Receipt tax must be a finite number'),
120
+ receipt_total: z
121
+ .number()
122
+ .finite('Receipt total must be a finite number')
123
+ .refine((value) => value > 0, 'Receipt total must be greater than zero'),
124
+ categories: z
125
+ .array(ReceiptSplitCategorySchema)
126
+ .min(1, 'At least one categorized group is required to create a split transaction'),
127
+ cleared: z.enum(['cleared', 'uncleared', 'reconciled']).optional(),
128
+ approved: z.boolean().optional(),
129
+ flag_color: z.enum(['red', 'orange', 'yellow', 'green', 'blue', 'purple']).optional(),
130
+ dry_run: z.boolean().optional(),
131
+ })
132
+ .strict()
133
+ .superRefine((data, ctx) => {
134
+ const itemsSubtotal = data.categories
135
+ .flatMap((category) => category.items)
136
+ .reduce((sum, item) => sum + item.amount, 0);
137
+ if (data.receipt_subtotal !== undefined) {
138
+ const delta = Math.abs(data.receipt_subtotal - itemsSubtotal);
139
+ if (delta > 0.01) {
140
+ ctx.addIssue({
141
+ code: z.ZodIssueCode.custom,
142
+ message: `Receipt subtotal (${data.receipt_subtotal.toFixed(2)}) does not match categorized items total (${itemsSubtotal.toFixed(2)})`,
143
+ path: ['receipt_subtotal'],
144
+ });
145
+ }
146
+ }
147
+ const expectedTotal = itemsSubtotal + data.receipt_tax;
148
+ const deltaTotal = Math.abs(expectedTotal - data.receipt_total);
149
+ if (deltaTotal > 0.01) {
150
+ ctx.addIssue({
151
+ code: z.ZodIssueCode.custom,
152
+ message: `Receipt total (${data.receipt_total.toFixed(2)}) does not match subtotal plus tax (${expectedTotal.toFixed(2)})`,
153
+ path: ['receipt_total'],
154
+ });
155
+ }
156
+ });
157
+ export const UpdateTransactionSchema = z
158
+ .object({
159
+ budget_id: z.string().min(1, 'Budget ID is required'),
160
+ transaction_id: z.string().min(1, 'Transaction ID is required'),
161
+ account_id: z.string().optional(),
162
+ amount: z.number().int('Amount must be an integer in milliunits').optional(),
163
+ date: z
164
+ .string()
165
+ .regex(/^\d{4}-\d{2}-\d{2}$/, 'Date must be in ISO format (YYYY-MM-DD)')
166
+ .optional(),
167
+ payee_name: z.string().optional(),
168
+ payee_id: z.string().optional(),
169
+ category_id: z.string().optional(),
170
+ memo: z.string().optional(),
171
+ cleared: z.enum(['cleared', 'uncleared', 'reconciled']).optional(),
172
+ approved: z.boolean().optional(),
173
+ flag_color: z.enum(['red', 'orange', 'yellow', 'green', 'blue', 'purple']).optional(),
174
+ dry_run: z.boolean().optional(),
175
+ })
176
+ .strict();
177
+ const BulkUpdateTransactionInputSchema = z
178
+ .object({
179
+ id: z.string().min(1, 'Transaction ID is required'),
180
+ amount: z.number().int('Amount must be an integer in milliunits').optional(),
181
+ date: z
182
+ .string()
183
+ .regex(/^\d{4}-\d{2}-\d{2}$/, 'Date must be in ISO format (YYYY-MM-DD)')
184
+ .optional(),
185
+ payee_name: z.string().optional(),
186
+ payee_id: z.string().optional(),
187
+ category_id: z.string().optional(),
188
+ memo: z.string().optional(),
189
+ cleared: z.enum(['cleared', 'uncleared', 'reconciled']).optional(),
190
+ approved: z.boolean().optional(),
191
+ flag_color: z.enum(['red', 'orange', 'yellow', 'green', 'blue', 'purple']).optional(),
192
+ original_account_id: z.string().optional(),
193
+ original_date: z
194
+ .string()
195
+ .regex(/^\d{4}-\d{2}-\d{2}$/, 'Date must be in ISO format (YYYY-MM-DD)')
196
+ .optional(),
197
+ })
198
+ .strict();
199
+ export const UpdateTransactionsSchema = z
200
+ .object({
201
+ budget_id: z.string().min(1, 'Budget ID is required'),
202
+ transactions: z
203
+ .array(BulkUpdateTransactionInputSchema)
204
+ .min(1, 'At least one transaction is required')
205
+ .max(100, 'A maximum of 100 transactions may be updated at once'),
206
+ dry_run: z.boolean().optional(),
207
+ })
208
+ .strict();
209
+ export const DeleteTransactionSchema = z
210
+ .object({
211
+ budget_id: z.string().min(1, 'Budget ID is required'),
212
+ transaction_id: z.string().min(1, 'Transaction ID is required'),
213
+ dry_run: z.boolean().optional(),
214
+ })
215
+ .strict();
@@ -1,289 +1,10 @@
1
1
  import { CallToolResult } from '@modelcontextprotocol/sdk/types.js';
2
2
  import * as ynab from 'ynab';
3
- import type { SaveTransactionsResponseData } from 'ynab/dist/models/SaveTransactionsResponseData.js';
4
- import { z } from 'zod/v4';
5
3
  import type { ToolFactory } from '../types/toolRegistration.js';
6
4
  import type { DeltaFetcher } from './deltaFetcher.js';
7
5
  import type { DeltaCache } from '../server/deltaCache.js';
8
6
  import type { ServerKnowledgeStore } from '../server/serverKnowledgeStore.js';
9
- export declare const ListTransactionsSchema: z.ZodObject<{
10
- budget_id: z.ZodString;
11
- account_id: z.ZodOptional<z.ZodString>;
12
- category_id: z.ZodOptional<z.ZodString>;
13
- since_date: z.ZodOptional<z.ZodString>;
14
- type: z.ZodOptional<z.ZodEnum<{
15
- uncategorized: "uncategorized";
16
- unapproved: "unapproved";
17
- }>>;
18
- }, z.core.$strict>;
19
- export type ListTransactionsParams = z.infer<typeof ListTransactionsSchema>;
20
- export declare const GetTransactionSchema: z.ZodObject<{
21
- budget_id: z.ZodString;
22
- transaction_id: z.ZodString;
23
- }, z.core.$strict>;
24
- export type GetTransactionParams = z.infer<typeof GetTransactionSchema>;
25
- export declare const CreateTransactionSchema: z.ZodObject<{
26
- budget_id: z.ZodString;
27
- account_id: z.ZodString;
28
- amount: z.ZodNumber;
29
- date: z.ZodString;
30
- payee_name: z.ZodOptional<z.ZodString>;
31
- payee_id: z.ZodOptional<z.ZodString>;
32
- category_id: z.ZodOptional<z.ZodString>;
33
- memo: z.ZodOptional<z.ZodString>;
34
- cleared: z.ZodOptional<z.ZodEnum<{
35
- cleared: "cleared";
36
- uncleared: "uncleared";
37
- reconciled: "reconciled";
38
- }>>;
39
- approved: z.ZodOptional<z.ZodBoolean>;
40
- flag_color: z.ZodOptional<z.ZodEnum<{
41
- red: "red";
42
- orange: "orange";
43
- yellow: "yellow";
44
- green: "green";
45
- blue: "blue";
46
- purple: "purple";
47
- }>>;
48
- import_id: z.ZodOptional<z.ZodString>;
49
- dry_run: z.ZodOptional<z.ZodBoolean>;
50
- subtransactions: z.ZodOptional<z.ZodArray<z.ZodObject<{
51
- amount: z.ZodNumber;
52
- payee_name: z.ZodOptional<z.ZodString>;
53
- payee_id: z.ZodOptional<z.ZodString>;
54
- category_id: z.ZodOptional<z.ZodString>;
55
- memo: z.ZodOptional<z.ZodString>;
56
- }, z.core.$strict>>>;
57
- }, z.core.$strict>;
58
- export type CreateTransactionParams = z.infer<typeof CreateTransactionSchema>;
59
- type BulkTransactionInput = Omit<CreateTransactionParams, 'budget_id' | 'dry_run' | 'subtransactions'>;
60
- export declare const CreateTransactionsSchema: z.ZodObject<{
61
- budget_id: z.ZodString;
62
- transactions: z.ZodArray<z.ZodObject<{
63
- date: z.ZodString;
64
- cleared: z.ZodOptional<z.ZodEnum<{
65
- cleared: "cleared";
66
- uncleared: "uncleared";
67
- reconciled: "reconciled";
68
- }>>;
69
- amount: z.ZodNumber;
70
- memo: z.ZodOptional<z.ZodString>;
71
- approved: z.ZodOptional<z.ZodBoolean>;
72
- flag_color: z.ZodOptional<z.ZodEnum<{
73
- red: "red";
74
- orange: "orange";
75
- yellow: "yellow";
76
- green: "green";
77
- blue: "blue";
78
- purple: "purple";
79
- }>>;
80
- account_id: z.ZodString;
81
- payee_id: z.ZodOptional<z.ZodString>;
82
- category_id: z.ZodOptional<z.ZodString>;
83
- import_id: z.ZodOptional<z.ZodString>;
84
- payee_name: z.ZodOptional<z.ZodString>;
85
- }, z.core.$strict>>;
86
- dry_run: z.ZodOptional<z.ZodBoolean>;
87
- }, z.core.$strict>;
88
- export type CreateTransactionsParams = z.infer<typeof CreateTransactionsSchema>;
89
- export interface BulkTransactionResult {
90
- request_index: number;
91
- status: 'created' | 'duplicate' | 'failed';
92
- transaction_id?: string | undefined;
93
- correlation_key: string;
94
- error_code?: string | undefined;
95
- error?: string | undefined;
96
- }
97
- export interface BulkCreateResponse {
98
- success: boolean;
99
- server_knowledge?: number;
100
- summary: {
101
- total_requested: number;
102
- created: number;
103
- duplicates: number;
104
- failed: number;
105
- };
106
- results: BulkTransactionResult[];
107
- transactions?: ynab.TransactionDetail[];
108
- duplicate_import_ids?: string[];
109
- message?: string;
110
- mode?: 'full' | 'summary' | 'ids_only';
111
- }
112
- export declare function generateCorrelationKey(transaction: {
113
- account_id?: string;
114
- date?: string;
115
- amount?: number;
116
- payee_id?: string | null;
117
- payee_name?: string | null;
118
- category_id?: string | null;
119
- memo?: string | null;
120
- cleared?: ynab.TransactionClearedStatus;
121
- approved?: boolean;
122
- flag_color?: ynab.TransactionFlagColor | null;
123
- import_id?: string | null;
124
- }): string;
125
- type CorrelationPayload = Parameters<typeof generateCorrelationKey>[0];
126
- interface CorrelationPayloadInput {
127
- account_id?: string | undefined;
128
- date?: string | undefined;
129
- amount?: number | undefined;
130
- payee_id?: string | null | undefined;
131
- payee_name?: string | null | undefined;
132
- category_id?: string | null | undefined;
133
- memo?: string | null | undefined;
134
- cleared?: ynab.TransactionClearedStatus | undefined;
135
- approved?: boolean | undefined;
136
- flag_color?: ynab.TransactionFlagColor | null | undefined;
137
- import_id?: string | null | undefined;
138
- }
139
- export declare function toCorrelationPayload(transaction: CorrelationPayloadInput): CorrelationPayload;
140
- export declare function correlateResults(requests: BulkTransactionInput[], responseData: SaveTransactionsResponseData, duplicateImportIds: Set<string>): BulkTransactionResult[];
141
- export declare const CreateReceiptSplitTransactionSchema: z.ZodObject<{
142
- budget_id: z.ZodString;
143
- account_id: z.ZodString;
144
- payee_name: z.ZodString;
145
- date: z.ZodOptional<z.ZodString>;
146
- memo: z.ZodOptional<z.ZodString>;
147
- receipt_subtotal: z.ZodOptional<z.ZodNumber>;
148
- receipt_tax: z.ZodNumber;
149
- receipt_total: z.ZodNumber;
150
- categories: z.ZodArray<z.ZodObject<{
151
- category_id: z.ZodString;
152
- category_name: z.ZodOptional<z.ZodString>;
153
- items: z.ZodArray<z.ZodObject<{
154
- name: z.ZodString;
155
- amount: z.ZodNumber;
156
- quantity: z.ZodOptional<z.ZodNumber>;
157
- memo: z.ZodOptional<z.ZodString>;
158
- }, z.core.$strict>>;
159
- }, z.core.$strict>>;
160
- cleared: z.ZodOptional<z.ZodEnum<{
161
- cleared: "cleared";
162
- uncleared: "uncleared";
163
- reconciled: "reconciled";
164
- }>>;
165
- approved: z.ZodOptional<z.ZodBoolean>;
166
- flag_color: z.ZodOptional<z.ZodEnum<{
167
- red: "red";
168
- orange: "orange";
169
- yellow: "yellow";
170
- green: "green";
171
- blue: "blue";
172
- purple: "purple";
173
- }>>;
174
- dry_run: z.ZodOptional<z.ZodBoolean>;
175
- }, z.core.$strict>;
176
- export type CreateReceiptSplitTransactionParams = z.infer<typeof CreateReceiptSplitTransactionSchema>;
177
- export declare const UpdateTransactionSchema: z.ZodObject<{
178
- budget_id: z.ZodString;
179
- transaction_id: z.ZodString;
180
- account_id: z.ZodOptional<z.ZodString>;
181
- amount: z.ZodOptional<z.ZodNumber>;
182
- date: z.ZodOptional<z.ZodString>;
183
- payee_name: z.ZodOptional<z.ZodString>;
184
- payee_id: z.ZodOptional<z.ZodString>;
185
- category_id: z.ZodOptional<z.ZodString>;
186
- memo: z.ZodOptional<z.ZodString>;
187
- cleared: z.ZodOptional<z.ZodEnum<{
188
- cleared: "cleared";
189
- uncleared: "uncleared";
190
- reconciled: "reconciled";
191
- }>>;
192
- approved: z.ZodOptional<z.ZodBoolean>;
193
- flag_color: z.ZodOptional<z.ZodEnum<{
194
- red: "red";
195
- orange: "orange";
196
- yellow: "yellow";
197
- green: "green";
198
- blue: "blue";
199
- purple: "purple";
200
- }>>;
201
- dry_run: z.ZodOptional<z.ZodBoolean>;
202
- }, z.core.$strict>;
203
- export type UpdateTransactionParams = z.infer<typeof UpdateTransactionSchema>;
204
- declare const BulkUpdateTransactionInputSchema: z.ZodObject<{
205
- id: z.ZodString;
206
- amount: z.ZodOptional<z.ZodNumber>;
207
- date: z.ZodOptional<z.ZodString>;
208
- payee_name: z.ZodOptional<z.ZodString>;
209
- payee_id: z.ZodOptional<z.ZodString>;
210
- category_id: z.ZodOptional<z.ZodString>;
211
- memo: z.ZodOptional<z.ZodString>;
212
- cleared: z.ZodOptional<z.ZodEnum<{
213
- cleared: "cleared";
214
- uncleared: "uncleared";
215
- reconciled: "reconciled";
216
- }>>;
217
- approved: z.ZodOptional<z.ZodBoolean>;
218
- flag_color: z.ZodOptional<z.ZodEnum<{
219
- red: "red";
220
- orange: "orange";
221
- yellow: "yellow";
222
- green: "green";
223
- blue: "blue";
224
- purple: "purple";
225
- }>>;
226
- original_account_id: z.ZodOptional<z.ZodString>;
227
- original_date: z.ZodOptional<z.ZodString>;
228
- }, z.core.$strict>;
229
- export type BulkUpdateTransactionInput = z.infer<typeof BulkUpdateTransactionInputSchema>;
230
- export declare const UpdateTransactionsSchema: z.ZodObject<{
231
- budget_id: z.ZodString;
232
- transactions: z.ZodArray<z.ZodObject<{
233
- id: z.ZodString;
234
- amount: z.ZodOptional<z.ZodNumber>;
235
- date: z.ZodOptional<z.ZodString>;
236
- payee_name: z.ZodOptional<z.ZodString>;
237
- payee_id: z.ZodOptional<z.ZodString>;
238
- category_id: z.ZodOptional<z.ZodString>;
239
- memo: z.ZodOptional<z.ZodString>;
240
- cleared: z.ZodOptional<z.ZodEnum<{
241
- cleared: "cleared";
242
- uncleared: "uncleared";
243
- reconciled: "reconciled";
244
- }>>;
245
- approved: z.ZodOptional<z.ZodBoolean>;
246
- flag_color: z.ZodOptional<z.ZodEnum<{
247
- red: "red";
248
- orange: "orange";
249
- yellow: "yellow";
250
- green: "green";
251
- blue: "blue";
252
- purple: "purple";
253
- }>>;
254
- original_account_id: z.ZodOptional<z.ZodString>;
255
- original_date: z.ZodOptional<z.ZodString>;
256
- }, z.core.$strict>>;
257
- dry_run: z.ZodOptional<z.ZodBoolean>;
258
- }, z.core.$strict>;
259
- export type UpdateTransactionsParams = z.infer<typeof UpdateTransactionsSchema>;
260
- export interface BulkUpdateResult {
261
- request_index: number;
262
- status: 'updated' | 'failed';
263
- transaction_id: string;
264
- correlation_key: string;
265
- error_code?: string;
266
- error?: string;
267
- }
268
- export interface BulkUpdateResponse {
269
- success: boolean;
270
- server_knowledge?: number;
271
- summary: {
272
- total_requested: number;
273
- updated: number;
274
- failed: number;
275
- };
276
- results: BulkUpdateResult[];
277
- transactions?: ynab.TransactionDetail[];
278
- message?: string;
279
- mode?: 'full' | 'summary' | 'ids_only';
280
- }
281
- export declare const DeleteTransactionSchema: z.ZodObject<{
282
- budget_id: z.ZodString;
283
- transaction_id: z.ZodString;
284
- dry_run: z.ZodOptional<z.ZodBoolean>;
285
- }, z.core.$strict>;
286
- export type DeleteTransactionParams = z.infer<typeof DeleteTransactionSchema>;
7
+ import { ListTransactionsParams, GetTransactionParams, CreateTransactionParams, CreateTransactionsParams, CreateReceiptSplitTransactionParams, UpdateTransactionParams, UpdateTransactionsParams, DeleteTransactionParams } from './transactionSchemas.js';
287
8
  export declare function handleListTransactions(ynabAPI: ynab.API, deltaFetcher: DeltaFetcher, params: ListTransactionsParams): Promise<CallToolResult>;
288
9
  export declare function handleListTransactions(ynabAPI: ynab.API, params: ListTransactionsParams): Promise<CallToolResult>;
289
10
  export declare function handleGetTransaction(ynabAPI: ynab.API, params: GetTransactionParams): Promise<CallToolResult>;
@@ -300,4 +21,5 @@ export declare function handleCreateTransactions(ynabAPI: ynab.API, params: Crea
300
21
  export declare function handleUpdateTransactions(ynabAPI: ynab.API, deltaCache: DeltaCache, knowledgeStore: ServerKnowledgeStore, params: UpdateTransactionsParams): Promise<CallToolResult>;
301
22
  export declare function handleUpdateTransactions(ynabAPI: ynab.API, params: UpdateTransactionsParams): Promise<CallToolResult>;
302
23
  export declare const registerTransactionTools: ToolFactory;
303
- export {};
24
+ export { ListTransactionsSchema, type ListTransactionsParams, GetTransactionSchema, type GetTransactionParams, CreateTransactionSchema, type CreateTransactionParams, CreateTransactionsSchema, type CreateTransactionsParams, CreateReceiptSplitTransactionSchema, type CreateReceiptSplitTransactionParams, UpdateTransactionSchema, type UpdateTransactionParams, UpdateTransactionsSchema, type UpdateTransactionsParams, type BulkUpdateTransactionInput, DeleteTransactionSchema, type DeleteTransactionParams, type BulkTransactionResult, type BulkCreateResponse, type BulkUpdateResult, type BulkUpdateResponse, type CorrelationPayload, type CorrelationPayloadInput, type CategorySource, type TransactionCacheInvalidationOptions, type ReceiptCategoryCalculation, type SubtransactionInput, type BulkTransactionInput, } from './transactionSchemas.js';
25
+ export { generateCorrelationKey, toCorrelationPayload, correlateResults, estimatePayloadSize, finalizeResponse, finalizeBulkUpdateResponse, handleTransactionError, toMonthKey, ensureTransaction, appendCategoryIds, collectCategoryIdsFromSources, setsEqual, invalidateTransactionCaches, } from './transactionUtils.js';