bkper 3.8.0 → 4.0.0
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/CHANGELOG.md +20 -1
- package/README.md +217 -183
- package/lib/auth/auth-page.d.ts +14 -0
- package/lib/auth/auth-page.d.ts.map +1 -0
- package/lib/auth/auth-page.js +110 -0
- package/lib/auth/auth-page.js.map +1 -0
- package/lib/auth/local-auth-service.d.ts.map +1 -1
- package/lib/auth/local-auth-service.js +135 -17
- package/lib/auth/local-auth-service.js.map +1 -1
- package/lib/bkper-factory.d.ts.map +1 -0
- package/lib/{mcp/bkper-factory.js → bkper-factory.js} +5 -2
- package/lib/bkper-factory.js.map +1 -0
- package/lib/cli.d.ts +1 -1
- package/lib/cli.d.ts.map +1 -1
- package/lib/cli.js +839 -67
- package/lib/cli.js.map +1 -1
- package/lib/commands/accounts/create.d.ts +10 -0
- package/lib/commands/accounts/create.d.ts.map +1 -0
- package/lib/commands/accounts/create.js +42 -0
- package/lib/commands/accounts/create.js.map +1 -0
- package/lib/commands/accounts/delete.d.ts +3 -0
- package/lib/commands/accounts/delete.d.ts.map +1 -0
- package/lib/commands/accounts/delete.js +22 -0
- package/lib/commands/accounts/delete.js.map +1 -0
- package/lib/commands/accounts/get.d.ts +3 -0
- package/lib/commands/accounts/get.d.ts.map +1 -0
- package/lib/commands/accounts/get.js +22 -0
- package/lib/commands/accounts/get.js.map +1 -0
- package/lib/commands/accounts/index.d.ts +6 -0
- package/lib/commands/accounts/index.d.ts.map +1 -0
- package/lib/commands/accounts/index.js +6 -0
- package/lib/commands/accounts/index.js.map +1 -0
- package/lib/commands/accounts/list.d.ts +3 -0
- package/lib/commands/accounts/list.d.ts.map +1 -0
- package/lib/commands/accounts/list.js +19 -0
- package/lib/commands/accounts/list.js.map +1 -0
- package/lib/commands/accounts/update.d.ts +9 -0
- package/lib/commands/accounts/update.d.ts.map +1 -0
- package/lib/commands/accounts/update.js +40 -0
- package/lib/commands/accounts/update.js.map +1 -0
- package/lib/commands/apps/build.d.ts +11 -0
- package/lib/commands/apps/build.d.ts.map +1 -0
- package/lib/commands/apps/build.js +144 -0
- package/lib/commands/apps/build.js.map +1 -0
- package/lib/commands/apps/bundler.d.ts +34 -0
- package/lib/commands/apps/bundler.d.ts.map +1 -0
- package/lib/commands/apps/bundler.js +112 -0
- package/lib/commands/apps/bundler.js.map +1 -0
- package/lib/commands/apps/config.d.ts +51 -0
- package/lib/commands/apps/config.d.ts.map +1 -0
- package/lib/commands/apps/config.js +146 -0
- package/lib/commands/apps/config.js.map +1 -0
- package/lib/commands/apps/deploy.d.ts +23 -0
- package/lib/commands/apps/deploy.d.ts.map +1 -0
- package/lib/commands/apps/deploy.js +344 -0
- package/lib/commands/apps/deploy.js.map +1 -0
- package/lib/commands/apps/dev.d.ts +28 -0
- package/lib/commands/apps/dev.d.ts.map +1 -0
- package/lib/commands/apps/dev.js +393 -0
- package/lib/commands/apps/dev.js.map +1 -0
- package/lib/commands/apps/index.d.ts +12 -0
- package/lib/commands/apps/index.d.ts.map +1 -0
- package/lib/commands/apps/index.js +24 -0
- package/lib/commands/apps/index.js.map +1 -0
- package/lib/commands/apps/init.d.ts +7 -0
- package/lib/commands/apps/init.d.ts.map +1 -0
- package/lib/commands/apps/init.js +249 -0
- package/lib/commands/apps/init.js.map +1 -0
- package/lib/commands/apps/install.d.ts +3 -0
- package/lib/commands/apps/install.d.ts.map +1 -0
- package/lib/commands/apps/install.js +18 -0
- package/lib/commands/apps/install.js.map +1 -0
- package/lib/commands/apps/list.d.ts +7 -0
- package/lib/commands/apps/list.d.ts.map +1 -0
- package/lib/commands/apps/list.js +23 -0
- package/lib/commands/apps/list.js.map +1 -0
- package/lib/commands/apps/secrets.d.ts +22 -0
- package/lib/commands/apps/secrets.d.ts.map +1 -0
- package/lib/commands/apps/secrets.js +209 -0
- package/lib/commands/apps/secrets.js.map +1 -0
- package/lib/commands/{apps.d.ts → apps/sync.d.ts} +8 -7
- package/lib/commands/apps/sync.d.ts.map +1 -0
- package/lib/commands/apps/sync.js +76 -0
- package/lib/commands/apps/sync.js.map +1 -0
- package/lib/commands/apps/types.d.ts +54 -0
- package/lib/commands/apps/types.d.ts.map +1 -0
- package/lib/commands/apps/types.js +2 -0
- package/lib/commands/apps/types.js.map +1 -0
- package/lib/commands/apps/uninstall.d.ts +3 -0
- package/lib/commands/apps/uninstall.d.ts.map +1 -0
- package/lib/commands/apps/uninstall.js +23 -0
- package/lib/commands/apps/uninstall.js.map +1 -0
- package/lib/commands/balances/get.d.ts +12 -0
- package/lib/commands/balances/get.d.ts.map +1 -0
- package/lib/commands/balances/get.js +32 -0
- package/lib/commands/balances/get.js.map +1 -0
- package/lib/commands/balances/index.d.ts +2 -0
- package/lib/commands/balances/index.d.ts.map +1 -0
- package/lib/commands/balances/index.js +2 -0
- package/lib/commands/balances/index.js.map +1 -0
- package/lib/commands/books/create.d.ts +12 -0
- package/lib/commands/books/create.d.ts.map +1 -0
- package/lib/commands/books/create.js +37 -0
- package/lib/commands/books/create.js.map +1 -0
- package/lib/commands/books/get.d.ts +3 -0
- package/lib/commands/books/get.d.ts.map +1 -0
- package/lib/commands/books/get.js +17 -0
- package/lib/commands/books/get.js.map +1 -0
- package/lib/commands/books/index.d.ts +5 -0
- package/lib/commands/books/index.d.ts.map +1 -0
- package/lib/commands/books/index.js +5 -0
- package/lib/commands/books/index.js.map +1 -0
- package/lib/commands/books/list.d.ts +3 -0
- package/lib/commands/books/list.d.ts.map +1 -0
- package/lib/commands/books/list.js +17 -0
- package/lib/commands/books/list.js.map +1 -0
- package/lib/commands/books/update.d.ts +14 -0
- package/lib/commands/books/update.d.ts.map +1 -0
- package/lib/commands/books/update.js +46 -0
- package/lib/commands/books/update.js.map +1 -0
- package/lib/commands/collections/add-book.d.ts +3 -0
- package/lib/commands/collections/add-book.d.ts.map +1 -0
- package/lib/commands/collections/add-book.js +27 -0
- package/lib/commands/collections/add-book.js.map +1 -0
- package/lib/commands/collections/create.d.ts +6 -0
- package/lib/commands/collections/create.d.ts.map +1 -0
- package/lib/commands/collections/create.js +19 -0
- package/lib/commands/collections/create.js.map +1 -0
- package/lib/commands/collections/delete.d.ts +3 -0
- package/lib/commands/collections/delete.d.ts.map +1 -0
- package/lib/commands/collections/delete.js +22 -0
- package/lib/commands/collections/delete.js.map +1 -0
- package/lib/commands/collections/get.d.ts +3 -0
- package/lib/commands/collections/get.d.ts.map +1 -0
- package/lib/commands/collections/get.js +22 -0
- package/lib/commands/collections/get.js.map +1 -0
- package/lib/commands/collections/index.d.ts +8 -0
- package/lib/commands/collections/index.d.ts.map +1 -0
- package/lib/commands/collections/index.js +8 -0
- package/lib/commands/collections/index.js.map +1 -0
- package/lib/commands/collections/list.d.ts +3 -0
- package/lib/commands/collections/list.d.ts.map +1 -0
- package/lib/commands/collections/list.js +18 -0
- package/lib/commands/collections/list.js.map +1 -0
- package/lib/commands/collections/remove-book.d.ts +3 -0
- package/lib/commands/collections/remove-book.d.ts.map +1 -0
- package/lib/commands/collections/remove-book.js +27 -0
- package/lib/commands/collections/remove-book.js.map +1 -0
- package/lib/commands/collections/update.d.ts +6 -0
- package/lib/commands/collections/update.d.ts.map +1 -0
- package/lib/commands/collections/update.js +24 -0
- package/lib/commands/collections/update.js.map +1 -0
- package/lib/commands/groups/create.d.ts +9 -0
- package/lib/commands/groups/create.d.ts.map +1 -0
- package/lib/commands/groups/create.js +40 -0
- package/lib/commands/groups/create.js.map +1 -0
- package/lib/commands/groups/delete.d.ts +3 -0
- package/lib/commands/groups/delete.d.ts.map +1 -0
- package/lib/commands/groups/delete.js +22 -0
- package/lib/commands/groups/delete.js.map +1 -0
- package/lib/commands/groups/get.d.ts +3 -0
- package/lib/commands/groups/get.d.ts.map +1 -0
- package/lib/commands/groups/get.js +22 -0
- package/lib/commands/groups/get.js.map +1 -0
- package/lib/commands/groups/index.d.ts +6 -0
- package/lib/commands/groups/index.d.ts.map +1 -0
- package/lib/commands/groups/index.js +6 -0
- package/lib/commands/groups/index.js.map +1 -0
- package/lib/commands/groups/list.d.ts +3 -0
- package/lib/commands/groups/list.d.ts.map +1 -0
- package/lib/commands/groups/list.js +19 -0
- package/lib/commands/groups/list.js.map +1 -0
- package/lib/commands/groups/update.d.ts +8 -0
- package/lib/commands/groups/update.d.ts.map +1 -0
- package/lib/commands/groups/update.js +38 -0
- package/lib/commands/groups/update.js.map +1 -0
- package/lib/commands/skills.d.ts +17 -0
- package/lib/commands/skills.d.ts.map +1 -0
- package/lib/commands/skills.js +248 -0
- package/lib/commands/skills.js.map +1 -0
- package/lib/commands/transactions/check.d.ts +3 -0
- package/lib/commands/transactions/check.d.ts.map +1 -0
- package/lib/commands/transactions/check.js +22 -0
- package/lib/commands/transactions/check.js.map +1 -0
- package/lib/commands/transactions/create.d.ts +13 -0
- package/lib/commands/transactions/create.d.ts.map +1 -0
- package/lib/commands/transactions/create.js +55 -0
- package/lib/commands/transactions/create.js.map +1 -0
- package/lib/commands/transactions/index.d.ts +8 -0
- package/lib/commands/transactions/index.d.ts.map +1 -0
- package/lib/commands/transactions/index.js +8 -0
- package/lib/commands/transactions/index.js.map +1 -0
- package/lib/commands/transactions/list.d.ts +14 -0
- package/lib/commands/transactions/list.d.ts.map +1 -0
- package/lib/commands/transactions/list.js +26 -0
- package/lib/commands/transactions/list.js.map +1 -0
- package/lib/commands/transactions/merge.d.ts +8 -0
- package/lib/commands/transactions/merge.d.ts.map +1 -0
- package/lib/commands/transactions/merge.js +44 -0
- package/lib/commands/transactions/merge.js.map +1 -0
- package/lib/commands/transactions/post.d.ts +3 -0
- package/lib/commands/transactions/post.d.ts.map +1 -0
- package/lib/commands/transactions/post.js +22 -0
- package/lib/commands/transactions/post.js.map +1 -0
- package/lib/commands/transactions/trash.d.ts +3 -0
- package/lib/commands/transactions/trash.d.ts.map +1 -0
- package/lib/commands/transactions/trash.js +22 -0
- package/lib/commands/transactions/trash.js.map +1 -0
- package/lib/commands/transactions/update.d.ts +12 -0
- package/lib/commands/transactions/update.d.ts.map +1 -0
- package/lib/commands/transactions/update.js +53 -0
- package/lib/commands/transactions/update.js.map +1 -0
- package/lib/dev/auth-middleware.d.ts +18 -0
- package/lib/dev/auth-middleware.d.ts.map +1 -0
- package/lib/dev/auth-middleware.js +113 -0
- package/lib/dev/auth-middleware.js.map +1 -0
- package/lib/dev/cleanup.d.ts +10 -0
- package/lib/dev/cleanup.d.ts.map +1 -0
- package/lib/dev/cleanup.js +36 -0
- package/lib/dev/cleanup.js.map +1 -0
- package/lib/dev/cloudflared/constants.d.ts +35 -0
- package/lib/dev/cloudflared/constants.d.ts.map +1 -0
- package/lib/dev/cloudflared/constants.js +48 -0
- package/lib/dev/cloudflared/constants.js.map +1 -0
- package/lib/dev/cloudflared/index.d.ts +11 -0
- package/lib/dev/cloudflared/index.d.ts.map +1 -0
- package/lib/dev/cloudflared/index.js +10 -0
- package/lib/dev/cloudflared/index.js.map +1 -0
- package/lib/dev/cloudflared/install.d.ts +15 -0
- package/lib/dev/cloudflared/install.d.ts.map +1 -0
- package/lib/dev/cloudflared/install.js +140 -0
- package/lib/dev/cloudflared/install.js.map +1 -0
- package/lib/dev/cloudflared/tunnel.d.ts +64 -0
- package/lib/dev/cloudflared/tunnel.d.ts.map +1 -0
- package/lib/dev/cloudflared/tunnel.js +109 -0
- package/lib/dev/cloudflared/tunnel.js.map +1 -0
- package/lib/dev/esbuild.d.ts +28 -0
- package/lib/dev/esbuild.d.ts.map +1 -0
- package/lib/dev/esbuild.js +83 -0
- package/lib/dev/esbuild.js.map +1 -0
- package/lib/dev/logger.d.ts +51 -0
- package/lib/dev/logger.d.ts.map +1 -0
- package/lib/dev/logger.js +102 -0
- package/lib/dev/logger.js.map +1 -0
- package/lib/dev/miniflare.d.ts +32 -0
- package/lib/dev/miniflare.d.ts.map +1 -0
- package/lib/dev/miniflare.js +111 -0
- package/lib/dev/miniflare.js.map +1 -0
- package/lib/dev/preflight.d.ts +7 -0
- package/lib/dev/preflight.d.ts.map +1 -0
- package/lib/dev/preflight.js +61 -0
- package/lib/dev/preflight.js.map +1 -0
- package/lib/dev/shared.d.ts +7 -0
- package/lib/dev/shared.d.ts.map +1 -0
- package/lib/dev/shared.js +99 -0
- package/lib/dev/shared.js.map +1 -0
- package/lib/dev/tunnel.d.ts +31 -0
- package/lib/dev/tunnel.d.ts.map +1 -0
- package/lib/dev/tunnel.js +110 -0
- package/lib/dev/tunnel.js.map +1 -0
- package/lib/dev/types.d.ts +53 -0
- package/lib/dev/types.d.ts.map +1 -0
- package/lib/dev/types.js +223 -0
- package/lib/dev/types.js.map +1 -0
- package/lib/dev/vite.d.ts +50 -0
- package/lib/dev/vite.d.ts.map +1 -0
- package/lib/dev/vite.js +114 -0
- package/lib/dev/vite.js.map +1 -0
- package/lib/dev/webhook-dev.d.ts +9 -0
- package/lib/dev/webhook-dev.d.ts.map +1 -0
- package/lib/dev/webhook-dev.js +28 -0
- package/lib/dev/webhook-dev.js.map +1 -0
- package/lib/domain/transaction/merge-operation.d.ts.map +1 -0
- package/lib/{mcp/domain → domain}/transaction/merge-operation.js +10 -11
- package/lib/domain/transaction/merge-operation.js.map +1 -0
- package/lib/domain/transaction/merge-types.d.ts.map +1 -0
- package/lib/domain/transaction/merge-types.js.map +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/platform/client.d.ts +37 -0
- package/lib/platform/client.d.ts.map +1 -0
- package/lib/platform/client.js +37 -0
- package/lib/platform/client.js.map +1 -0
- package/lib/render/index.d.ts +3 -0
- package/lib/render/index.d.ts.map +1 -0
- package/lib/render/index.js +3 -0
- package/lib/render/index.js.map +1 -0
- package/lib/render/output.d.ts +15 -0
- package/lib/render/output.d.ts.map +1 -0
- package/lib/render/output.js +30 -0
- package/lib/render/output.js.map +1 -0
- package/lib/render/table-formatter.d.ts +34 -0
- package/lib/render/table-formatter.d.ts.map +1 -0
- package/lib/render/table-formatter.js +221 -0
- package/lib/render/table-formatter.js.map +1 -0
- package/lib/utils/properties.d.ts +12 -0
- package/lib/utils/properties.d.ts.map +1 -0
- package/lib/utils/properties.js +23 -0
- package/lib/utils/properties.js.map +1 -0
- package/package.json +23 -22
- package/lib/auth/keys.json +0 -12
- package/lib/commands/apps.d.ts.map +0 -1
- package/lib/commands/apps.js +0 -93
- package/lib/commands/apps.js.map +0 -1
- package/lib/mcp/bkper-factory.d.ts.map +0 -1
- package/lib/mcp/bkper-factory.js.map +0 -1
- package/lib/mcp/domain/transaction/merge-operation.d.ts.map +0 -1
- package/lib/mcp/domain/transaction/merge-operation.js.map +0 -1
- package/lib/mcp/domain/transaction/merge-types.d.ts.map +0 -1
- package/lib/mcp/domain/transaction/merge-types.js.map +0 -1
- package/lib/mcp/server.d.ts +0 -13
- package/lib/mcp/server.d.ts.map +0 -1
- package/lib/mcp/server.js +0 -161
- package/lib/mcp/server.js.map +0 -1
- package/lib/mcp/system-prompt.md +0 -192
- package/lib/mcp/tools/create_transactions.d.ts +0 -59
- package/lib/mcp/tools/create_transactions.d.ts.map +0 -1
- package/lib/mcp/tools/create_transactions.js +0 -163
- package/lib/mcp/tools/create_transactions.js.map +0 -1
- package/lib/mcp/tools/get_balances.d.ts +0 -26
- package/lib/mcp/tools/get_balances.d.ts.map +0 -1
- package/lib/mcp/tools/get_balances.js +0 -106
- package/lib/mcp/tools/get_balances.js.map +0 -1
- package/lib/mcp/tools/get_book.d.ts +0 -21
- package/lib/mcp/tools/get_book.d.ts.map +0 -1
- package/lib/mcp/tools/get_book.js +0 -126
- package/lib/mcp/tools/get_book.js.map +0 -1
- package/lib/mcp/tools/list_books.d.ts +0 -21
- package/lib/mcp/tools/list_books.d.ts.map +0 -1
- package/lib/mcp/tools/list_books.js +0 -67
- package/lib/mcp/tools/list_books.js.map +0 -1
- package/lib/mcp/tools/list_transactions.d.ts +0 -38
- package/lib/mcp/tools/list_transactions.d.ts.map +0 -1
- package/lib/mcp/tools/list_transactions.js +0 -109
- package/lib/mcp/tools/list_transactions.js.map +0 -1
- package/lib/mcp/tools/merge_transactions.d.ts +0 -40
- package/lib/mcp/tools/merge_transactions.d.ts.map +0 -1
- package/lib/mcp/tools/merge_transactions.js +0 -120
- package/lib/mcp/tools/merge_transactions.js.map +0 -1
- /package/lib/{mcp/bkper-factory.d.ts → bkper-factory.d.ts} +0 -0
- /package/lib/{mcp/domain → domain}/transaction/merge-operation.d.ts +0 -0
- /package/lib/{mcp/domain → domain}/transaction/merge-types.d.ts +0 -0
- /package/lib/{mcp/domain → domain}/transaction/merge-types.js +0 -0
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* MCP Tool: merge_transactions
|
|
3
|
-
*
|
|
4
|
-
* Thin adapter that handles MCP protocol concerns (validation, error handling, response formatting)
|
|
5
|
-
* and delegates business logic to the domain layer.
|
|
6
|
-
*/
|
|
7
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
8
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
9
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
10
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
11
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
12
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
13
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
14
|
-
});
|
|
15
|
-
};
|
|
16
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
17
|
-
var t = {};
|
|
18
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
19
|
-
t[p] = s[p];
|
|
20
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
21
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
22
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
23
|
-
t[p[i]] = s[p[i]];
|
|
24
|
-
}
|
|
25
|
-
return t;
|
|
26
|
-
};
|
|
27
|
-
import { ErrorCode, McpError } from '@modelcontextprotocol/sdk/types.js';
|
|
28
|
-
import { getBkperInstance } from '../bkper-factory.js';
|
|
29
|
-
import { TransactionMergeOperation } from '../domain/transaction/merge-operation.js';
|
|
30
|
-
export function handleMergeTransactions(params) {
|
|
31
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
32
|
-
try {
|
|
33
|
-
// Validate required parameters
|
|
34
|
-
if (!params.bookId) {
|
|
35
|
-
throw new McpError(ErrorCode.InvalidParams, 'Missing required parameter: bookId');
|
|
36
|
-
}
|
|
37
|
-
if (!params.transactionId1) {
|
|
38
|
-
throw new McpError(ErrorCode.InvalidParams, 'Missing required parameter: transactionId1');
|
|
39
|
-
}
|
|
40
|
-
if (!params.transactionId2) {
|
|
41
|
-
throw new McpError(ErrorCode.InvalidParams, 'Missing required parameter: transactionId2');
|
|
42
|
-
}
|
|
43
|
-
// Get configured Bkper instance
|
|
44
|
-
const bkperInstance = getBkperInstance();
|
|
45
|
-
// Get the book
|
|
46
|
-
const book = yield bkperInstance.getBook(params.bookId);
|
|
47
|
-
if (!book) {
|
|
48
|
-
throw new McpError(ErrorCode.InvalidParams, `Book not found: ${params.bookId}`);
|
|
49
|
-
}
|
|
50
|
-
// Fetch both transactions
|
|
51
|
-
const transaction1 = yield book.getTransaction(params.transactionId1);
|
|
52
|
-
if (!transaction1) {
|
|
53
|
-
throw new McpError(ErrorCode.InvalidParams, `Transaction not found: ${params.transactionId1}`);
|
|
54
|
-
}
|
|
55
|
-
const transaction2 = yield book.getTransaction(params.transactionId2);
|
|
56
|
-
if (!transaction2) {
|
|
57
|
-
throw new McpError(ErrorCode.InvalidParams, `Transaction not found: ${params.transactionId2}`);
|
|
58
|
-
}
|
|
59
|
-
// Perform merge operation
|
|
60
|
-
const mergeOperation = new TransactionMergeOperation(book, transaction1, transaction2);
|
|
61
|
-
// Execute the merge: trash the revert transaction
|
|
62
|
-
yield mergeOperation.revertTransaction.trash();
|
|
63
|
-
// Apply merged data to edit transaction (only needed for real API, not mocks)
|
|
64
|
-
if (typeof mergeOperation.editTransaction.setDescription === 'function') {
|
|
65
|
-
mergeOperation.applyMergedData();
|
|
66
|
-
// Update the edit transaction with merged data
|
|
67
|
-
yield mergeOperation.editTransaction.update();
|
|
68
|
-
}
|
|
69
|
-
// Return the merged data
|
|
70
|
-
const _a = mergeOperation.mergedData, { agentId, agentName, agentLogo, agentLogoDark, createdAt, createdBy, updatedAt, dateValue } = _a, cleanTransaction = __rest(_a, ["agentId", "agentName", "agentLogo", "agentLogoDark", "createdAt", "createdBy", "updatedAt", "dateValue"]);
|
|
71
|
-
// Build response
|
|
72
|
-
const response = {
|
|
73
|
-
mergedTransaction: JSON.parse(JSON.stringify(cleanTransaction)),
|
|
74
|
-
revertedTransactionId: mergeOperation.revertTransaction.getId() || '',
|
|
75
|
-
auditRecord: null // Always null - we throw error if amounts differ
|
|
76
|
-
};
|
|
77
|
-
const responseText = JSON.stringify(response, null, 2);
|
|
78
|
-
return {
|
|
79
|
-
content: [
|
|
80
|
-
{
|
|
81
|
-
type: 'text',
|
|
82
|
-
text: responseText,
|
|
83
|
-
},
|
|
84
|
-
],
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
catch (error) {
|
|
88
|
-
// Re-throw MCP errors as-is
|
|
89
|
-
if (error instanceof McpError) {
|
|
90
|
-
throw error;
|
|
91
|
-
}
|
|
92
|
-
// Handle other errors
|
|
93
|
-
console.error('Merge transactions error details:', error);
|
|
94
|
-
throw new McpError(ErrorCode.InternalError, `Failed to merge transactions: ${error instanceof Error ? error.message : JSON.stringify(error)}`);
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
export const mergeTransactionsToolDefinition = {
|
|
99
|
-
name: 'merge_transactions',
|
|
100
|
-
description: 'Merge two duplicate or related transactions into a single consolidated transaction. Intelligently combines descriptions, attachments, amounts, and metadata while marking one transaction as reverted.',
|
|
101
|
-
inputSchema: {
|
|
102
|
-
type: 'object',
|
|
103
|
-
properties: {
|
|
104
|
-
bookId: {
|
|
105
|
-
type: 'string',
|
|
106
|
-
description: 'The unique identifier of the book'
|
|
107
|
-
},
|
|
108
|
-
transactionId1: {
|
|
109
|
-
type: 'string',
|
|
110
|
-
description: 'The ID of the first transaction to merge'
|
|
111
|
-
},
|
|
112
|
-
transactionId2: {
|
|
113
|
-
type: 'string',
|
|
114
|
-
description: 'The ID of the second transaction to merge'
|
|
115
|
-
}
|
|
116
|
-
},
|
|
117
|
-
required: ['bookId', 'transactionId1', 'transactionId2']
|
|
118
|
-
}
|
|
119
|
-
};
|
|
120
|
-
//# sourceMappingURL=merge_transactions.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"merge_transactions.js","sourceRoot":"","sources":["../../../src/mcp/tools/merge_transactions.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;;;;;;;;;;;;;;;;;;;;AAEH,OAAO,EAAkB,SAAS,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AACzF,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,yBAAyB,EAAE,MAAM,0CAA0C,CAAC;AAqBrF,MAAM,UAAgB,uBAAuB,CAAC,MAA+B;;QACzE,IAAI,CAAC;YACD,+BAA+B;YAC/B,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;gBACjB,MAAM,IAAI,QAAQ,CACd,SAAS,CAAC,aAAa,EACvB,oCAAoC,CACvC,CAAC;YACN,CAAC;YAED,IAAI,CAAC,MAAM,CAAC,cAAc,EAAE,CAAC;gBACzB,MAAM,IAAI,QAAQ,CACd,SAAS,CAAC,aAAa,EACvB,4CAA4C,CAC/C,CAAC;YACN,CAAC;YAED,IAAI,CAAC,MAAM,CAAC,cAAc,EAAE,CAAC;gBACzB,MAAM,IAAI,QAAQ,CACd,SAAS,CAAC,aAA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