@centry-digital/bukku-mcp 1.1.0 → 2.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/build/config/env.d.ts +1 -0
- package/build/config/env.d.ts.map +1 -0
- package/build/config/env.js +2 -1
- package/build/index.d.ts +1 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +1813 -44
- package/build/tools/custom/account-tools.d.ts +2 -1
- package/build/tools/custom/account-tools.d.ts.map +1 -0
- package/build/tools/custom/account-tools.js +2 -2
- package/build/tools/custom/contact-archive.d.ts +2 -1
- package/build/tools/custom/contact-archive.d.ts.map +1 -0
- package/build/tools/custom/contact-archive.js +2 -2
- package/build/tools/custom/control-panel-archive.d.ts +2 -1
- package/build/tools/custom/control-panel-archive.d.ts.map +1 -0
- package/build/tools/custom/control-panel-archive.js +2 -2
- package/build/tools/custom/file-upload.d.ts +2 -1
- package/build/tools/custom/file-upload.d.ts.map +1 -0
- package/build/tools/custom/file-upload.js +2 -2
- package/build/tools/custom/journal-entry-tools.d.ts +2 -1
- package/build/tools/custom/journal-entry-tools.d.ts.map +1 -0
- package/build/tools/custom/journal-entry-tools.js +2 -3
- package/build/tools/custom/location-tools.d.ts +2 -1
- package/build/tools/custom/location-tools.d.ts.map +1 -0
- package/build/tools/custom/location-tools.js +2 -2
- package/build/tools/custom/product-archive.d.ts +2 -1
- package/build/tools/custom/product-archive.d.ts.map +1 -0
- package/build/tools/custom/product-archive.js +2 -2
- package/build/tools/custom/reference-data.d.ts +3 -2
- package/build/tools/custom/reference-data.d.ts.map +1 -0
- package/build/tools/custom/reference-data.js +2 -2
- package/build/tools/factory.d.ts +2 -2
- package/build/tools/factory.d.ts.map +1 -0
- package/build/tools/factory.js +2 -2
- package/build/tools/registry.d.ts +2 -1
- package/build/tools/registry.d.ts.map +1 -0
- package/build/tools/registry.js +3 -41
- package/package.json +9 -22
- package/LICENSE +0 -21
- package/README.md +0 -269
- package/build/client/bukku-client.d.ts +0 -62
- package/build/client/bukku-client.js +0 -195
- package/build/errors/transform.d.ts +0 -14
- package/build/errors/transform.js +0 -141
- package/build/errors/transform.test.d.ts +0 -1
- package/build/errors/transform.test.js +0 -101
- package/build/tools/cache/reference-cache.d.ts +0 -42
- package/build/tools/cache/reference-cache.js +0 -63
- package/build/tools/configs/account.d.ts +0 -17
- package/build/tools/configs/account.js +0 -28
- package/build/tools/configs/bank-money-in.d.ts +0 -10
- package/build/tools/configs/bank-money-in.js +0 -22
- package/build/tools/configs/bank-money-out.d.ts +0 -10
- package/build/tools/configs/bank-money-out.js +0 -22
- package/build/tools/configs/bank-transfer.d.ts +0 -11
- package/build/tools/configs/bank-transfer.js +0 -23
- package/build/tools/configs/contact-group.d.ts +0 -11
- package/build/tools/configs/contact-group.js +0 -19
- package/build/tools/configs/contact.d.ts +0 -14
- package/build/tools/configs/contact.js +0 -25
- package/build/tools/configs/delivery-order.d.ts +0 -8
- package/build/tools/configs/delivery-order.js +0 -20
- package/build/tools/configs/file.d.ts +0 -18
- package/build/tools/configs/file.js +0 -26
- package/build/tools/configs/goods-received-note.d.ts +0 -8
- package/build/tools/configs/goods-received-note.js +0 -20
- package/build/tools/configs/journal-entry.d.ts +0 -14
- package/build/tools/configs/journal-entry.js +0 -26
- package/build/tools/configs/location.d.ts +0 -20
- package/build/tools/configs/location.js +0 -28
- package/build/tools/configs/product-bundle.d.ts +0 -18
- package/build/tools/configs/product-bundle.js +0 -29
- package/build/tools/configs/product-group.d.ts +0 -14
- package/build/tools/configs/product-group.js +0 -22
- package/build/tools/configs/product.d.ts +0 -24
- package/build/tools/configs/product.js +0 -35
- package/build/tools/configs/purchase-bill.d.ts +0 -9
- package/build/tools/configs/purchase-bill.js +0 -21
- package/build/tools/configs/purchase-credit-note.d.ts +0 -8
- package/build/tools/configs/purchase-credit-note.js +0 -20
- package/build/tools/configs/purchase-order.d.ts +0 -8
- package/build/tools/configs/purchase-order.js +0 -20
- package/build/tools/configs/purchase-payment.d.ts +0 -8
- package/build/tools/configs/purchase-payment.js +0 -20
- package/build/tools/configs/purchase-refund.d.ts +0 -8
- package/build/tools/configs/purchase-refund.js +0 -20
- package/build/tools/configs/sales-credit-note.d.ts +0 -8
- package/build/tools/configs/sales-credit-note.js +0 -20
- package/build/tools/configs/sales-invoice.d.ts +0 -8
- package/build/tools/configs/sales-invoice.js +0 -20
- package/build/tools/configs/sales-order.d.ts +0 -8
- package/build/tools/configs/sales-order.js +0 -20
- package/build/tools/configs/sales-payment.d.ts +0 -8
- package/build/tools/configs/sales-payment.js +0 -20
- package/build/tools/configs/sales-quote.d.ts +0 -8
- package/build/tools/configs/sales-quote.js +0 -20
- package/build/tools/configs/sales-refund.d.ts +0 -8
- package/build/tools/configs/sales-refund.js +0 -20
- package/build/tools/configs/tag-group.d.ts +0 -11
- package/build/tools/configs/tag-group.js +0 -22
- package/build/tools/configs/tag.d.ts +0 -11
- package/build/tools/configs/tag.js +0 -22
- package/build/tools/validation/double-entry.d.ts +0 -46
- package/build/tools/validation/double-entry.js +0 -66
- package/build/types/api-responses.d.ts +0 -21
- package/build/types/api-responses.js +0 -6
- package/build/types/bukku.d.ts +0 -93
- package/build/types/bukku.js +0 -11
- package/build/utils/logger.d.ts +0 -6
- package/build/utils/logger.js +0 -8
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import { describe, test } from 'node:test';
|
|
2
|
-
import assert from 'node:assert';
|
|
3
|
-
import { transformHttpError, transformNetworkError } from './transform.ts';
|
|
4
|
-
describe('transformHttpError', () => {
|
|
5
|
-
test('401 error produces auth failure message mentioning BUKKU_API_TOKEN', () => {
|
|
6
|
-
const result = transformHttpError(401, { message: 'Unauthorized' }, 'create invoice');
|
|
7
|
-
assert.strictEqual(result.isError, true);
|
|
8
|
-
assert.ok(Array.isArray(result.content));
|
|
9
|
-
assert.strictEqual(result.content.length, 1);
|
|
10
|
-
assert.strictEqual(result.content[0].type, 'text');
|
|
11
|
-
const text = result.content[0].text;
|
|
12
|
-
assert.ok(text.includes('Bukku') || text.includes('token'), 'Should mention Bukku or token');
|
|
13
|
-
assert.ok(text.includes('BUKKU_API_TOKEN'), 'Should mention BUKKU_API_TOKEN');
|
|
14
|
-
assert.ok(text.length > 20, 'Should suggest next step');
|
|
15
|
-
});
|
|
16
|
-
test('403 error produces permission error with suggestion', () => {
|
|
17
|
-
const result = transformHttpError(403, { message: 'Forbidden' }, 'list contacts');
|
|
18
|
-
assert.strictEqual(result.isError, true);
|
|
19
|
-
assert.strictEqual(result.content[0].type, 'text');
|
|
20
|
-
const text = result.content[0].text;
|
|
21
|
-
assert.ok(text.toLowerCase().includes('permission') || text.toLowerCase().includes('access'), 'Should mention permission or access');
|
|
22
|
-
assert.ok(text.length > 20, 'Should suggest next step');
|
|
23
|
-
});
|
|
24
|
-
test('404 error suggests listing available items', () => {
|
|
25
|
-
const result = transformHttpError(404, { message: 'Not found' }, 'get sales invoice');
|
|
26
|
-
assert.strictEqual(result.isError, true);
|
|
27
|
-
assert.strictEqual(result.content[0].type, 'text');
|
|
28
|
-
const text = result.content[0].text;
|
|
29
|
-
assert.ok(text.toLowerCase().includes("couldn't find") || text.toLowerCase().includes('not found'), 'Should indicate not found');
|
|
30
|
-
assert.ok(text.toLowerCase().includes('list') || text.toLowerCase().includes('available'), 'Should suggest listing items');
|
|
31
|
-
});
|
|
32
|
-
test('400 error shows all validation errors at once', () => {
|
|
33
|
-
const result = transformHttpError(400, {
|
|
34
|
-
message: 'Validation failed',
|
|
35
|
-
errors: {
|
|
36
|
-
contact_id: ['required'],
|
|
37
|
-
date: ['invalid format'],
|
|
38
|
-
},
|
|
39
|
-
}, 'create invoice');
|
|
40
|
-
assert.strictEqual(result.isError, true);
|
|
41
|
-
assert.strictEqual(result.content[0].type, 'text');
|
|
42
|
-
const text = result.content[0].text;
|
|
43
|
-
assert.ok(text.includes('contact_id'), 'Should include contact_id error');
|
|
44
|
-
assert.ok(text.includes('date'), 'Should include date error');
|
|
45
|
-
assert.ok(text.length > 20, 'Should suggest next step');
|
|
46
|
-
});
|
|
47
|
-
test('400 error without errors field shows message', () => {
|
|
48
|
-
const result = transformHttpError(400, { message: 'Something wrong' }, 'update order');
|
|
49
|
-
assert.strictEqual(result.isError, true);
|
|
50
|
-
assert.strictEqual(result.content[0].type, 'text');
|
|
51
|
-
const text = result.content[0].text;
|
|
52
|
-
assert.ok(text.includes('Something wrong'), 'Should include error message');
|
|
53
|
-
assert.ok(text.length > 20, 'Should suggest next step');
|
|
54
|
-
});
|
|
55
|
-
test('422 validation error handled like 400', () => {
|
|
56
|
-
const result = transformHttpError(422, {
|
|
57
|
-
message: 'Unprocessable',
|
|
58
|
-
errors: {
|
|
59
|
-
items: ['at least one item required'],
|
|
60
|
-
},
|
|
61
|
-
}, 'create invoice');
|
|
62
|
-
assert.strictEqual(result.isError, true);
|
|
63
|
-
assert.strictEqual(result.content[0].type, 'text');
|
|
64
|
-
const text = result.content[0].text;
|
|
65
|
-
assert.ok(text.includes('items'), 'Should include items error');
|
|
66
|
-
assert.ok(text.length > 20, 'Should suggest next step');
|
|
67
|
-
});
|
|
68
|
-
test('500 error produces helpful fallback with retry suggestion', () => {
|
|
69
|
-
const result = transformHttpError(500, { message: 'Internal error' }, 'list invoices');
|
|
70
|
-
assert.strictEqual(result.isError, true);
|
|
71
|
-
assert.strictEqual(result.content[0].type, 'text');
|
|
72
|
-
const text = result.content[0].text;
|
|
73
|
-
assert.ok(text.toLowerCase().includes('unexpected') || text.toLowerCase().includes('error'), 'Should indicate unexpected error');
|
|
74
|
-
assert.ok(text.toLowerCase().includes('try') || text.toLowerCase().includes('again'), 'Should suggest trying again');
|
|
75
|
-
});
|
|
76
|
-
test('503 error suggests trying later', () => {
|
|
77
|
-
const result = transformHttpError(503, { message: 'Service unavailable' }, 'create payment');
|
|
78
|
-
assert.strictEqual(result.isError, true);
|
|
79
|
-
assert.strictEqual(result.content[0].type, 'text');
|
|
80
|
-
const text = result.content[0].text;
|
|
81
|
-
assert.ok(text.toLowerCase().includes('unavailable') || text.toLowerCase().includes('temporarily'), 'Should indicate service unavailable');
|
|
82
|
-
assert.ok(text.toLowerCase().includes('later') || text.toLowerCase().includes('try'), 'Should suggest trying later');
|
|
83
|
-
});
|
|
84
|
-
});
|
|
85
|
-
describe('transformNetworkError', () => {
|
|
86
|
-
test('network error suggests checking connection', () => {
|
|
87
|
-
const networkError = new TypeError('Failed to fetch');
|
|
88
|
-
const result = transformNetworkError(networkError, 'list contacts');
|
|
89
|
-
assert.strictEqual(result.isError, true);
|
|
90
|
-
assert.strictEqual(result.content[0].type, 'text');
|
|
91
|
-
const text = result.content[0].text;
|
|
92
|
-
assert.ok(text.toLowerCase().includes('connect') || text.toLowerCase().includes('network'), 'Should mention connection or network');
|
|
93
|
-
assert.ok(text.length > 20, 'Should suggest next step');
|
|
94
|
-
});
|
|
95
|
-
test('handles unknown error gracefully', () => {
|
|
96
|
-
const result = transformNetworkError('unknown error', 'create invoice');
|
|
97
|
-
assert.strictEqual(result.isError, true);
|
|
98
|
-
assert.strictEqual(result.content[0].type, 'text');
|
|
99
|
-
assert.ok(result.content[0].text.length > 10, 'Should provide some error message');
|
|
100
|
-
});
|
|
101
|
-
});
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Reference Data Cache
|
|
3
|
-
*
|
|
4
|
-
* Transparent in-memory cache for Bukku reference data (tax codes, currencies, etc.)
|
|
5
|
-
* with 5-minute TTL per roadmap requirement LIST-02.
|
|
6
|
-
*
|
|
7
|
-
* Features:
|
|
8
|
-
* - In-memory Map-based storage
|
|
9
|
-
* - 5-minute TTL (configurable for testing)
|
|
10
|
-
* - Lazy deletion: expired entries removed on access
|
|
11
|
-
* - Cache key = reference data type name (e.g., "tax_codes", "currencies")
|
|
12
|
-
*/
|
|
13
|
-
export declare class ReferenceDataCache {
|
|
14
|
-
private cache;
|
|
15
|
-
private readonly ttlMs;
|
|
16
|
-
/**
|
|
17
|
-
* Create a new reference data cache
|
|
18
|
-
* @param ttlMs Time-to-live in milliseconds (default: 5 minutes)
|
|
19
|
-
*/
|
|
20
|
-
constructor(ttlMs?: number);
|
|
21
|
-
/**
|
|
22
|
-
* Get cached data by key
|
|
23
|
-
* @param key Cache key (reference data type name)
|
|
24
|
-
* @returns Cached data or undefined if not found or expired
|
|
25
|
-
*/
|
|
26
|
-
get<T>(key: string): T | undefined;
|
|
27
|
-
/**
|
|
28
|
-
* Store data in cache with TTL
|
|
29
|
-
* @param key Cache key (reference data type name)
|
|
30
|
-
* @param data Data to cache
|
|
31
|
-
*/
|
|
32
|
-
set<T>(key: string, data: T): void;
|
|
33
|
-
/**
|
|
34
|
-
* Invalidate a specific cache entry
|
|
35
|
-
* @param key Cache key to invalidate
|
|
36
|
-
*/
|
|
37
|
-
invalidate(key: string): void;
|
|
38
|
-
/**
|
|
39
|
-
* Clear all cached entries
|
|
40
|
-
*/
|
|
41
|
-
clear(): void;
|
|
42
|
-
}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Reference Data Cache
|
|
3
|
-
*
|
|
4
|
-
* Transparent in-memory cache for Bukku reference data (tax codes, currencies, etc.)
|
|
5
|
-
* with 5-minute TTL per roadmap requirement LIST-02.
|
|
6
|
-
*
|
|
7
|
-
* Features:
|
|
8
|
-
* - In-memory Map-based storage
|
|
9
|
-
* - 5-minute TTL (configurable for testing)
|
|
10
|
-
* - Lazy deletion: expired entries removed on access
|
|
11
|
-
* - Cache key = reference data type name (e.g., "tax_codes", "currencies")
|
|
12
|
-
*/
|
|
13
|
-
export class ReferenceDataCache {
|
|
14
|
-
cache = new Map();
|
|
15
|
-
ttlMs;
|
|
16
|
-
/**
|
|
17
|
-
* Create a new reference data cache
|
|
18
|
-
* @param ttlMs Time-to-live in milliseconds (default: 5 minutes)
|
|
19
|
-
*/
|
|
20
|
-
constructor(ttlMs = 5 * 60 * 1000) {
|
|
21
|
-
this.ttlMs = ttlMs;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Get cached data by key
|
|
25
|
-
* @param key Cache key (reference data type name)
|
|
26
|
-
* @returns Cached data or undefined if not found or expired
|
|
27
|
-
*/
|
|
28
|
-
get(key) {
|
|
29
|
-
const entry = this.cache.get(key);
|
|
30
|
-
if (!entry)
|
|
31
|
-
return undefined;
|
|
32
|
-
// Check expiration (lazy deletion)
|
|
33
|
-
if (Date.now() > entry.expiresAt) {
|
|
34
|
-
this.cache.delete(key);
|
|
35
|
-
return undefined;
|
|
36
|
-
}
|
|
37
|
-
return entry.data;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Store data in cache with TTL
|
|
41
|
-
* @param key Cache key (reference data type name)
|
|
42
|
-
* @param data Data to cache
|
|
43
|
-
*/
|
|
44
|
-
set(key, data) {
|
|
45
|
-
this.cache.set(key, {
|
|
46
|
-
data,
|
|
47
|
-
expiresAt: Date.now() + this.ttlMs,
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Invalidate a specific cache entry
|
|
52
|
-
* @param key Cache key to invalidate
|
|
53
|
-
*/
|
|
54
|
-
invalidate(key) {
|
|
55
|
-
this.cache.delete(key);
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Clear all cached entries
|
|
59
|
-
*/
|
|
60
|
-
clear() {
|
|
61
|
-
this.cache.clear();
|
|
62
|
-
}
|
|
63
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { CrudEntityConfig } from "../../types/bukku.js";
|
|
2
|
-
/**
|
|
3
|
-
* Account Entity Configuration
|
|
4
|
-
*
|
|
5
|
-
* API: /accounts
|
|
6
|
-
* Response keys: account (singular), accounts (plural)
|
|
7
|
-
* Operations: get, create, update, delete ONLY — NO list operation
|
|
8
|
-
* - List omitted because Phase 5's list-accounts reference data tool already
|
|
9
|
-
* occupies that tool name (provides cached quick lookup)
|
|
10
|
-
* - Use search-accounts (custom tool in account-tools.ts) for filtered search
|
|
11
|
-
* of the chart of accounts
|
|
12
|
-
* - Archive/unarchive handled by custom tools (account-tools.ts), not status
|
|
13
|
-
* update, because API expects { is_archived: boolean }
|
|
14
|
-
* Delete constraint: Only accounts with no children, not in locked system type,
|
|
15
|
-
* and not used in transactions can be deleted
|
|
16
|
-
*/
|
|
17
|
-
export declare const accountConfig: CrudEntityConfig;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Account Entity Configuration
|
|
3
|
-
*
|
|
4
|
-
* API: /accounts
|
|
5
|
-
* Response keys: account (singular), accounts (plural)
|
|
6
|
-
* Operations: get, create, update, delete ONLY — NO list operation
|
|
7
|
-
* - List omitted because Phase 5's list-accounts reference data tool already
|
|
8
|
-
* occupies that tool name (provides cached quick lookup)
|
|
9
|
-
* - Use search-accounts (custom tool in account-tools.ts) for filtered search
|
|
10
|
-
* of the chart of accounts
|
|
11
|
-
* - Archive/unarchive handled by custom tools (account-tools.ts), not status
|
|
12
|
-
* update, because API expects { is_archived: boolean }
|
|
13
|
-
* Delete constraint: Only accounts with no children, not in locked system type,
|
|
14
|
-
* and not used in transactions can be deleted
|
|
15
|
-
*/
|
|
16
|
-
export const accountConfig = {
|
|
17
|
-
entity: "account",
|
|
18
|
-
apiBasePath: "/accounts",
|
|
19
|
-
singularKey: "account",
|
|
20
|
-
pluralKey: "accounts",
|
|
21
|
-
description: "account",
|
|
22
|
-
operations: ["get", "create", "update", "delete"],
|
|
23
|
-
hasStatusUpdate: false,
|
|
24
|
-
listFilters: [],
|
|
25
|
-
businessRules: {
|
|
26
|
-
delete: "Only accounts that are not assigned to locked system type, have no children, and are not used in transactions can be deleted. Use archive-account instead if the account has transaction history.",
|
|
27
|
-
},
|
|
28
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { CrudEntityConfig } from "../../types/bukku.js";
|
|
2
|
-
/**
|
|
3
|
-
* Bank Money In Entity Configuration
|
|
4
|
-
*
|
|
5
|
-
* API: /banking/incomes
|
|
6
|
-
* Response keys: transaction (singular), transactions (plural)
|
|
7
|
-
* Money In represents incoming cash transactions (deposits, receipts, etc.)
|
|
8
|
-
* Shares the same status lifecycle as sales/purchase transactions.
|
|
9
|
-
*/
|
|
10
|
-
export declare const bankMoneyInConfig: CrudEntityConfig;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Bank Money In Entity Configuration
|
|
3
|
-
*
|
|
4
|
-
* API: /banking/incomes
|
|
5
|
-
* Response keys: transaction (singular), transactions (plural)
|
|
6
|
-
* Money In represents incoming cash transactions (deposits, receipts, etc.)
|
|
7
|
-
* Shares the same status lifecycle as sales/purchase transactions.
|
|
8
|
-
*/
|
|
9
|
-
export const bankMoneyInConfig = {
|
|
10
|
-
entity: "bank-money-in",
|
|
11
|
-
apiBasePath: "/banking/incomes",
|
|
12
|
-
singularKey: "transaction",
|
|
13
|
-
pluralKey: "transactions",
|
|
14
|
-
description: "bank money in transaction",
|
|
15
|
-
operations: ["list", "get", "create", "update", "delete"],
|
|
16
|
-
hasStatusUpdate: true,
|
|
17
|
-
listFilters: ["contact_id", "account_id", "email_status"],
|
|
18
|
-
businessRules: {
|
|
19
|
-
delete: "Only draft and void money in transactions can be deleted. Ready or pending approval transactions cannot be deleted — use update-bank-money-in-status to void a ready transaction instead.",
|
|
20
|
-
statusTransitions: "Valid transitions: draft -> pending_approval, draft -> ready, pending_approval -> ready, ready -> void. A void transaction is final and cannot be changed. There is no way to revert from ready, pending_approval, or void back to draft.",
|
|
21
|
-
},
|
|
22
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { CrudEntityConfig } from "../../types/bukku.js";
|
|
2
|
-
/**
|
|
3
|
-
* Bank Money Out Entity Configuration
|
|
4
|
-
*
|
|
5
|
-
* API: /banking/expenses
|
|
6
|
-
* Response keys: transaction (singular), transactions (plural)
|
|
7
|
-
* Money Out represents outgoing cash transactions (payments, disbursements, etc.)
|
|
8
|
-
* Shares the same status lifecycle as sales/purchase transactions.
|
|
9
|
-
*/
|
|
10
|
-
export declare const bankMoneyOutConfig: CrudEntityConfig;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Bank Money Out Entity Configuration
|
|
3
|
-
*
|
|
4
|
-
* API: /banking/expenses
|
|
5
|
-
* Response keys: transaction (singular), transactions (plural)
|
|
6
|
-
* Money Out represents outgoing cash transactions (payments, disbursements, etc.)
|
|
7
|
-
* Shares the same status lifecycle as sales/purchase transactions.
|
|
8
|
-
*/
|
|
9
|
-
export const bankMoneyOutConfig = {
|
|
10
|
-
entity: "bank-money-out",
|
|
11
|
-
apiBasePath: "/banking/expenses",
|
|
12
|
-
singularKey: "transaction",
|
|
13
|
-
pluralKey: "transactions",
|
|
14
|
-
description: "bank money out transaction",
|
|
15
|
-
operations: ["list", "get", "create", "update", "delete"],
|
|
16
|
-
hasStatusUpdate: true,
|
|
17
|
-
listFilters: ["contact_id", "account_id", "email_status"],
|
|
18
|
-
businessRules: {
|
|
19
|
-
delete: "Only draft and void money out transactions can be deleted. Ready or pending approval transactions cannot be deleted — use update-bank-money-out-status to void a ready transaction instead.",
|
|
20
|
-
statusTransitions: "Valid transitions: draft -> pending_approval, draft -> ready, pending_approval -> ready, ready -> void. A void transaction is final and cannot be changed. There is no way to revert from ready, pending_approval, or void back to draft.",
|
|
21
|
-
},
|
|
22
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { CrudEntityConfig } from "../../types/bukku.js";
|
|
2
|
-
/**
|
|
3
|
-
* Bank Transfer Entity Configuration
|
|
4
|
-
*
|
|
5
|
-
* API: /banking/transfers
|
|
6
|
-
* Response keys: transaction (singular), transactions (plural)
|
|
7
|
-
* Transfers are account-to-account movements (no contact involved).
|
|
8
|
-
* Has fewer list filters than money in/out — only account_id (no contact_id, no email_status).
|
|
9
|
-
* Shares the same status lifecycle as other banking/sales/purchase transactions.
|
|
10
|
-
*/
|
|
11
|
-
export declare const bankTransferConfig: CrudEntityConfig;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Bank Transfer Entity Configuration
|
|
3
|
-
*
|
|
4
|
-
* API: /banking/transfers
|
|
5
|
-
* Response keys: transaction (singular), transactions (plural)
|
|
6
|
-
* Transfers are account-to-account movements (no contact involved).
|
|
7
|
-
* Has fewer list filters than money in/out — only account_id (no contact_id, no email_status).
|
|
8
|
-
* Shares the same status lifecycle as other banking/sales/purchase transactions.
|
|
9
|
-
*/
|
|
10
|
-
export const bankTransferConfig = {
|
|
11
|
-
entity: "bank-transfer",
|
|
12
|
-
apiBasePath: "/banking/transfers",
|
|
13
|
-
singularKey: "transaction",
|
|
14
|
-
pluralKey: "transactions",
|
|
15
|
-
description: "bank transfer",
|
|
16
|
-
operations: ["list", "get", "create", "update", "delete"],
|
|
17
|
-
hasStatusUpdate: true,
|
|
18
|
-
listFilters: ["account_id"],
|
|
19
|
-
businessRules: {
|
|
20
|
-
delete: "Only draft and void transfers can be deleted. Ready or pending approval transfers cannot be deleted — use update-bank-transfer-status to void a ready transfer instead.",
|
|
21
|
-
statusTransitions: "Valid transitions: draft -> pending_approval, draft -> ready, pending_approval -> ready, ready -> void. A void transfer is final and cannot be changed. There is no way to revert from ready, pending_approval, or void back to draft.",
|
|
22
|
-
},
|
|
23
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { CrudEntityConfig } from "../../types/bukku.js";
|
|
2
|
-
/**
|
|
3
|
-
* Contact Group Entity Configuration
|
|
4
|
-
*
|
|
5
|
-
* API: /contacts/groups
|
|
6
|
-
* Response keys: group (singular), groups (plural)
|
|
7
|
-
* Groups organize contacts into categories.
|
|
8
|
-
* Simplest entity config — no status operations, no entity-specific filters,
|
|
9
|
-
* no business rules. Factory provides base pagination parameters.
|
|
10
|
-
*/
|
|
11
|
-
export declare const contactGroupConfig: CrudEntityConfig;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Contact Group Entity Configuration
|
|
3
|
-
*
|
|
4
|
-
* API: /contacts/groups
|
|
5
|
-
* Response keys: group (singular), groups (plural)
|
|
6
|
-
* Groups organize contacts into categories.
|
|
7
|
-
* Simplest entity config — no status operations, no entity-specific filters,
|
|
8
|
-
* no business rules. Factory provides base pagination parameters.
|
|
9
|
-
*/
|
|
10
|
-
export const contactGroupConfig = {
|
|
11
|
-
entity: "contact-group",
|
|
12
|
-
apiBasePath: "/contacts/groups",
|
|
13
|
-
singularKey: "group",
|
|
14
|
-
pluralKey: "groups",
|
|
15
|
-
description: "contact group",
|
|
16
|
-
operations: ["list", "get", "create", "update", "delete"],
|
|
17
|
-
hasStatusUpdate: false,
|
|
18
|
-
listFilters: [],
|
|
19
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { CrudEntityConfig } from "../../types/bukku.js";
|
|
2
|
-
/**
|
|
3
|
-
* Contact Entity Configuration
|
|
4
|
-
*
|
|
5
|
-
* API: /contacts
|
|
6
|
-
* Response keys: contact (singular), contacts (plural) — NOT transaction/transactions
|
|
7
|
-
* This is the first non-transaction entity; uses custom wrapper keys.
|
|
8
|
-
* Archive/unarchive is handled by separate custom tools (contact-archive.ts),
|
|
9
|
-
* NOT the factory status tool, because the API expects { is_archived: boolean }
|
|
10
|
-
* instead of { status: string }.
|
|
11
|
-
* List filter: status accepts ALL, ACTIVE, or INACTIVE values.
|
|
12
|
-
* List filter: type accepts customer, supplier, or employee values.
|
|
13
|
-
*/
|
|
14
|
-
export declare const contactConfig: CrudEntityConfig;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Contact Entity Configuration
|
|
3
|
-
*
|
|
4
|
-
* API: /contacts
|
|
5
|
-
* Response keys: contact (singular), contacts (plural) — NOT transaction/transactions
|
|
6
|
-
* This is the first non-transaction entity; uses custom wrapper keys.
|
|
7
|
-
* Archive/unarchive is handled by separate custom tools (contact-archive.ts),
|
|
8
|
-
* NOT the factory status tool, because the API expects { is_archived: boolean }
|
|
9
|
-
* instead of { status: string }.
|
|
10
|
-
* List filter: status accepts ALL, ACTIVE, or INACTIVE values.
|
|
11
|
-
* List filter: type accepts customer, supplier, or employee values.
|
|
12
|
-
*/
|
|
13
|
-
export const contactConfig = {
|
|
14
|
-
entity: "contact",
|
|
15
|
-
apiBasePath: "/contacts",
|
|
16
|
-
singularKey: "contact",
|
|
17
|
-
pluralKey: "contacts",
|
|
18
|
-
description: "contact",
|
|
19
|
-
operations: ["list", "get", "create", "update", "delete"],
|
|
20
|
-
hasStatusUpdate: false,
|
|
21
|
-
listFilters: ["group_id", "status", "type", "is_myinvois_ready"],
|
|
22
|
-
businessRules: {
|
|
23
|
-
delete: "Only contacts with no linked transactions can be deleted. Archive instead if the contact has transaction history.",
|
|
24
|
-
},
|
|
25
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { CrudEntityConfig } from "../../types/bukku.js";
|
|
2
|
-
/**
|
|
3
|
-
* Delivery Order Entity Configuration
|
|
4
|
-
*
|
|
5
|
-
* API: /sales/delivery_orders
|
|
6
|
-
* Response keys: transaction (singular), transactions (plural)
|
|
7
|
-
*/
|
|
8
|
-
export declare const deliveryOrderConfig: CrudEntityConfig;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Delivery Order Entity Configuration
|
|
3
|
-
*
|
|
4
|
-
* API: /sales/delivery_orders
|
|
5
|
-
* Response keys: transaction (singular), transactions (plural)
|
|
6
|
-
*/
|
|
7
|
-
export const deliveryOrderConfig = {
|
|
8
|
-
entity: "delivery-order",
|
|
9
|
-
apiBasePath: "/sales/delivery_orders",
|
|
10
|
-
singularKey: "transaction",
|
|
11
|
-
pluralKey: "transactions",
|
|
12
|
-
description: "delivery order",
|
|
13
|
-
operations: ["list", "get", "create", "update", "delete"],
|
|
14
|
-
hasStatusUpdate: true,
|
|
15
|
-
listFilters: ["contact_id", "email_status", "transfer_status"],
|
|
16
|
-
businessRules: {
|
|
17
|
-
delete: "Only draft and void delivery orders can be deleted. Ready or pending approval delivery orders cannot be deleted — use update-delivery-order-status to void a ready delivery order instead.",
|
|
18
|
-
statusTransitions: "Valid transitions: draft -> pending_approval, draft -> ready, pending_approval -> ready, ready -> void. A void delivery order is final and cannot be changed. There is no way to revert from ready, pending_approval, or void back to draft.",
|
|
19
|
-
},
|
|
20
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { CrudEntityConfig } from "../../types/bukku.js";
|
|
2
|
-
/**
|
|
3
|
-
* File Entity Configuration
|
|
4
|
-
*
|
|
5
|
-
* API: /files
|
|
6
|
-
* Response keys: file (singular), files (plural)
|
|
7
|
-
*
|
|
8
|
-
* Files are typically attached to sales and purchase transactions using file_ids arrays.
|
|
9
|
-
* The create operation is handled by a custom upload-file tool (not the factory create tool)
|
|
10
|
-
* because file upload requires multipart/form-data, not JSON.
|
|
11
|
-
*
|
|
12
|
-
* API limitations:
|
|
13
|
-
* - No delete endpoint (files are permanent once uploaded)
|
|
14
|
-
* - No update endpoint (files are immutable)
|
|
15
|
-
* - No pagination support for list (returns ALL files)
|
|
16
|
-
* - No list filters (API spec shows no query parameters)
|
|
17
|
-
*/
|
|
18
|
-
export declare const fileConfig: CrudEntityConfig;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* File Entity Configuration
|
|
3
|
-
*
|
|
4
|
-
* API: /files
|
|
5
|
-
* Response keys: file (singular), files (plural)
|
|
6
|
-
*
|
|
7
|
-
* Files are typically attached to sales and purchase transactions using file_ids arrays.
|
|
8
|
-
* The create operation is handled by a custom upload-file tool (not the factory create tool)
|
|
9
|
-
* because file upload requires multipart/form-data, not JSON.
|
|
10
|
-
*
|
|
11
|
-
* API limitations:
|
|
12
|
-
* - No delete endpoint (files are permanent once uploaded)
|
|
13
|
-
* - No update endpoint (files are immutable)
|
|
14
|
-
* - No pagination support for list (returns ALL files)
|
|
15
|
-
* - No list filters (API spec shows no query parameters)
|
|
16
|
-
*/
|
|
17
|
-
export const fileConfig = {
|
|
18
|
-
entity: "file",
|
|
19
|
-
apiBasePath: "/files",
|
|
20
|
-
singularKey: "file",
|
|
21
|
-
pluralKey: "files",
|
|
22
|
-
description: "file. Files are typically attached to sales and purchase transactions using file_ids arrays. Use upload-file to add new files.",
|
|
23
|
-
operations: ["list", "get"],
|
|
24
|
-
hasStatusUpdate: false,
|
|
25
|
-
listFilters: [],
|
|
26
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { CrudEntityConfig } from "../../types/bukku.js";
|
|
2
|
-
/**
|
|
3
|
-
* Goods Received Note Entity Configuration
|
|
4
|
-
*
|
|
5
|
-
* API: /purchases/goods_received_notes
|
|
6
|
-
* Response keys: transaction (singular), transactions (plural)
|
|
7
|
-
*/
|
|
8
|
-
export declare const goodsReceivedNoteConfig: CrudEntityConfig;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Goods Received Note Entity Configuration
|
|
3
|
-
*
|
|
4
|
-
* API: /purchases/goods_received_notes
|
|
5
|
-
* Response keys: transaction (singular), transactions (plural)
|
|
6
|
-
*/
|
|
7
|
-
export const goodsReceivedNoteConfig = {
|
|
8
|
-
entity: "goods-received-note",
|
|
9
|
-
apiBasePath: "/purchases/goods_received_notes",
|
|
10
|
-
singularKey: "transaction",
|
|
11
|
-
pluralKey: "transactions",
|
|
12
|
-
description: "goods received note",
|
|
13
|
-
operations: ["list", "get", "create", "update", "delete"],
|
|
14
|
-
hasStatusUpdate: true,
|
|
15
|
-
listFilters: ["contact_id", "email_status", "transfer_status"],
|
|
16
|
-
businessRules: {
|
|
17
|
-
delete: "Only draft and void goods received notes can be deleted. Ready or pending approval goods received notes cannot be deleted — use update-goods-received-note-status to void a ready goods received note instead.",
|
|
18
|
-
statusTransitions: "Valid transitions: draft -> pending_approval, draft -> ready, pending_approval -> ready, ready -> void. A void goods received note is final and cannot be changed. There is no way to revert from ready, pending_approval, or void back to draft.",
|
|
19
|
-
},
|
|
20
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { CrudEntityConfig } from "../../types/bukku.js";
|
|
2
|
-
/**
|
|
3
|
-
* Journal Entry Entity Configuration
|
|
4
|
-
*
|
|
5
|
-
* API: /journal_entries
|
|
6
|
-
* Response keys: transaction (singular), transactions (plural)
|
|
7
|
-
* Operations: list, get, delete ONLY
|
|
8
|
-
* - Create and update are handled by custom tools (journal-entry-tools.ts)
|
|
9
|
-
* because they require double-entry validation (debits == credits)
|
|
10
|
-
* - Status updates use standard factory pattern (hasStatusUpdate: true)
|
|
11
|
-
* Status lifecycle: draft -> ready (posted), ready -> void (final)
|
|
12
|
-
* Delete constraint: Only draft and void entries can be deleted
|
|
13
|
-
*/
|
|
14
|
-
export declare const journalEntryConfig: CrudEntityConfig;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Journal Entry Entity Configuration
|
|
3
|
-
*
|
|
4
|
-
* API: /journal_entries
|
|
5
|
-
* Response keys: transaction (singular), transactions (plural)
|
|
6
|
-
* Operations: list, get, delete ONLY
|
|
7
|
-
* - Create and update are handled by custom tools (journal-entry-tools.ts)
|
|
8
|
-
* because they require double-entry validation (debits == credits)
|
|
9
|
-
* - Status updates use standard factory pattern (hasStatusUpdate: true)
|
|
10
|
-
* Status lifecycle: draft -> ready (posted), ready -> void (final)
|
|
11
|
-
* Delete constraint: Only draft and void entries can be deleted
|
|
12
|
-
*/
|
|
13
|
-
export const journalEntryConfig = {
|
|
14
|
-
entity: "journal-entry",
|
|
15
|
-
apiBasePath: "/journal_entries",
|
|
16
|
-
singularKey: "transaction",
|
|
17
|
-
pluralKey: "transactions",
|
|
18
|
-
description: "journal entry",
|
|
19
|
-
operations: ["list", "get", "delete"],
|
|
20
|
-
hasStatusUpdate: true,
|
|
21
|
-
listFilters: [],
|
|
22
|
-
businessRules: {
|
|
23
|
-
delete: "Only draft and void journal entries can be deleted. Ready journal entries cannot be deleted -- use update-journal-entry-status to void a ready entry instead.",
|
|
24
|
-
statusTransitions: "Valid transitions: draft -> ready, ready -> void. A void entry is final and cannot be changed.",
|
|
25
|
-
},
|
|
26
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { CrudEntityConfig } from "../../types/bukku.js";
|
|
2
|
-
/**
|
|
3
|
-
* Location Entity Configuration
|
|
4
|
-
*
|
|
5
|
-
* API: /locations (list, create) and /location/{id} (get, update, delete)
|
|
6
|
-
* Response keys: location (singular), locations (plural)
|
|
7
|
-
*
|
|
8
|
-
* API PATH INCONSISTENCY:
|
|
9
|
-
* - List/create use /locations (plural)
|
|
10
|
-
* - Get/update/delete use /location/{id} (singular)
|
|
11
|
-
*
|
|
12
|
-
* The factory generates tools based on apiBasePath, which would produce:
|
|
13
|
-
* - /locations for list/create ✓
|
|
14
|
-
* - /locations/{id} for get/update/delete ✗ (incorrect)
|
|
15
|
-
*
|
|
16
|
-
* Therefore, this config only enables list and create operations.
|
|
17
|
-
* Get/update/delete operations are handled by custom tools in location-tools.ts
|
|
18
|
-
* which use the correct /location/{id} singular path.
|
|
19
|
-
*/
|
|
20
|
-
export declare const locationConfig: CrudEntityConfig;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Location Entity Configuration
|
|
3
|
-
*
|
|
4
|
-
* API: /locations (list, create) and /location/{id} (get, update, delete)
|
|
5
|
-
* Response keys: location (singular), locations (plural)
|
|
6
|
-
*
|
|
7
|
-
* API PATH INCONSISTENCY:
|
|
8
|
-
* - List/create use /locations (plural)
|
|
9
|
-
* - Get/update/delete use /location/{id} (singular)
|
|
10
|
-
*
|
|
11
|
-
* The factory generates tools based on apiBasePath, which would produce:
|
|
12
|
-
* - /locations for list/create ✓
|
|
13
|
-
* - /locations/{id} for get/update/delete ✗ (incorrect)
|
|
14
|
-
*
|
|
15
|
-
* Therefore, this config only enables list and create operations.
|
|
16
|
-
* Get/update/delete operations are handled by custom tools in location-tools.ts
|
|
17
|
-
* which use the correct /location/{id} singular path.
|
|
18
|
-
*/
|
|
19
|
-
export const locationConfig = {
|
|
20
|
-
entity: "location",
|
|
21
|
-
apiBasePath: "/locations",
|
|
22
|
-
singularKey: "location",
|
|
23
|
-
pluralKey: "locations",
|
|
24
|
-
description: "location for multi-branch accounting. Use locations to track which branch or office a transaction belongs to.",
|
|
25
|
-
operations: ["list", "create"],
|
|
26
|
-
hasStatusUpdate: false,
|
|
27
|
-
listFilters: ["include_archived"],
|
|
28
|
-
};
|