@raytio/mcp-server 9.3.0 → 9.4.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/dist/authorization.d.ts.map +1 -1
- package/dist/authorization.js +2 -0
- package/dist/authorization.js.map +1 -1
- package/dist/tools/_shared/finance-idempotency.d.ts +52 -0
- package/dist/tools/_shared/finance-idempotency.d.ts.map +1 -0
- package/dist/tools/_shared/finance-idempotency.js +79 -0
- package/dist/tools/_shared/finance-idempotency.js.map +1 -0
- package/dist/tools/_shared/money.d.ts +10 -0
- package/dist/tools/_shared/money.d.ts.map +1 -0
- package/dist/tools/_shared/money.js +90 -0
- package/dist/tools/_shared/money.js.map +1 -0
- package/dist/tools/_shared/soft-deactivate.d.ts +2 -1
- package/dist/tools/_shared/soft-deactivate.d.ts.map +1 -1
- package/dist/tools/_shared/soft-deactivate.js +2 -1
- package/dist/tools/_shared/soft-deactivate.js.map +1 -1
- package/dist/tools/domains.d.ts.map +1 -1
- package/dist/tools/domains.js +18 -0
- package/dist/tools/domains.js.map +1 -1
- package/dist/tools/fap/fap-invoice-hold-place.d.ts +14 -0
- package/dist/tools/fap/fap-invoice-hold-place.d.ts.map +1 -0
- package/dist/tools/fap/fap-invoice-hold-place.js +62 -0
- package/dist/tools/fap/fap-invoice-hold-place.js.map +1 -0
- package/dist/tools/fap/fap-invoice-hold-release.d.ts +19 -0
- package/dist/tools/fap/fap-invoice-hold-release.d.ts.map +1 -0
- package/dist/tools/fap/fap-invoice-hold-release.js +65 -0
- package/dist/tools/fap/fap-invoice-hold-release.js.map +1 -0
- package/dist/tools/fap/fap-supplier-bill-create.d.ts +14 -0
- package/dist/tools/fap/fap-supplier-bill-create.d.ts.map +1 -0
- package/dist/tools/fap/fap-supplier-bill-create.js +90 -0
- package/dist/tools/fap/fap-supplier-bill-create.js.map +1 -0
- package/dist/tools/fap/fap-supplier-bill-line-add.d.ts +8 -0
- package/dist/tools/fap/fap-supplier-bill-line-add.d.ts.map +1 -0
- package/dist/tools/fap/fap-supplier-bill-line-add.js +75 -0
- package/dist/tools/fap/fap-supplier-bill-line-add.js.map +1 -0
- package/dist/tools/fap/fap-supplier-create.d.ts +9 -0
- package/dist/tools/fap/fap-supplier-create.d.ts.map +1 -0
- package/dist/tools/fap/fap-supplier-create.js +53 -0
- package/dist/tools/fap/fap-supplier-create.js.map +1 -0
- package/dist/tools/fap/fap-supplier-status-set.d.ts +8 -0
- package/dist/tools/fap/fap-supplier-status-set.d.ts.map +1 -0
- package/dist/tools/fap/fap-supplier-status-set.js +62 -0
- package/dist/tools/fap/fap-supplier-status-set.js.map +1 -0
- package/dist/tools/fap/fap-supplier-update.d.ts +8 -0
- package/dist/tools/fap/fap-supplier-update.d.ts.map +1 -0
- package/dist/tools/fap/fap-supplier-update.js +51 -0
- package/dist/tools/fap/fap-supplier-update.js.map +1 -0
- package/dist/tools/fap/generated-reads.d.ts +5 -0
- package/dist/tools/fap/generated-reads.d.ts.map +1 -0
- package/dist/tools/fap/generated-reads.js +19 -0
- package/dist/tools/fap/generated-reads.js.map +1 -0
- package/dist/tools/fap/index.d.ts +5 -0
- package/dist/tools/fap/index.d.ts.map +1 -0
- package/dist/tools/fap/index.js +21 -0
- package/dist/tools/fap/index.js.map +1 -0
- package/dist/tools/far/far-cash-receipt-record.d.ts +27 -0
- package/dist/tools/far/far-cash-receipt-record.d.ts.map +1 -0
- package/dist/tools/far/far-cash-receipt-record.js +101 -0
- package/dist/tools/far/far-cash-receipt-record.js.map +1 -0
- package/dist/tools/far/far-customer-create.d.ts +12 -0
- package/dist/tools/far/far-customer-create.d.ts.map +1 -0
- package/dist/tools/far/far-customer-create.js +54 -0
- package/dist/tools/far/far-customer-create.js.map +1 -0
- package/dist/tools/far/far-customer-invoice-create.d.ts +13 -0
- package/dist/tools/far/far-customer-invoice-create.d.ts.map +1 -0
- package/dist/tools/far/far-customer-invoice-create.js +76 -0
- package/dist/tools/far/far-customer-invoice-create.js.map +1 -0
- package/dist/tools/far/far-customer-invoice-line-add.d.ts +10 -0
- package/dist/tools/far/far-customer-invoice-line-add.d.ts.map +1 -0
- package/dist/tools/far/far-customer-invoice-line-add.js +77 -0
- package/dist/tools/far/far-customer-invoice-line-add.js.map +1 -0
- package/dist/tools/far/far-customer-status-set.d.ts +15 -0
- package/dist/tools/far/far-customer-status-set.d.ts.map +1 -0
- package/dist/tools/far/far-customer-status-set.js +70 -0
- package/dist/tools/far/far-customer-status-set.js.map +1 -0
- package/dist/tools/far/far-customer-update.d.ts +10 -0
- package/dist/tools/far/far-customer-update.d.ts.map +1 -0
- package/dist/tools/far/far-customer-update.js +51 -0
- package/dist/tools/far/far-customer-update.js.map +1 -0
- package/dist/tools/far/generated-reads.d.ts +5 -0
- package/dist/tools/far/generated-reads.d.ts.map +1 -0
- package/dist/tools/far/generated-reads.js +25 -0
- package/dist/tools/far/generated-reads.js.map +1 -0
- package/dist/tools/far/index.d.ts +5 -0
- package/dist/tools/far/index.d.ts.map +1 -0
- package/dist/tools/far/index.js +19 -0
- package/dist/tools/far/index.js.map +1 -0
- package/dist/tools/role-mapping.d.ts.map +1 -1
- package/dist/tools/role-mapping.js +12 -0
- package/dist/tools/role-mapping.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"far-cash-receipt-record.js","sourceRoot":"","sources":["../../../src/tools/far/far-cash-receipt-record.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACxE,OAAO,EAAE,GAAG,EAAE,MAAM,uCAAuC,CAAC;AAC5D,OAAO,EACL,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,mCAAmC,CAAC;AAE3C;;;;;;;;;;;;;;;;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C,GAAG,GAAG,CAAC,SAAS,CAAC,UAAU,6BAA6B,EACxD,IAAI,EACJ,EAAE,OAAO,EAAE,mBAAmB,CAAC,KAAK,CAAC,eAAe,CAAC,EAAE,CACxD,CAAC;YACF,OAAO,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QAClC,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,OAAO,aAAa,CAClB,SAAS,EACT,sCAAsC,KAAK,CAAC,OAAO,EAAE,CACtD,CAAC;QACJ,CAAC;IACH,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Tool } from '../registry.js';
|
|
2
|
+
/**
|
|
3
|
+
* Explicit-schema create for `far_customers`. The generated bounded
|
|
4
|
+
* read framework refuses to auto-generate mutations for FAR/FAP
|
|
5
|
+
* resources (WI-0003501 / WI-0003504), so every writeable field is
|
|
6
|
+
* spelled out here and consequential defaults (approval status,
|
|
7
|
+
* status) are OMITTED — the backend applies its own initial state,
|
|
8
|
+
* which prevents a caller from provisioning an already-approved
|
|
9
|
+
* customer via MCP.
|
|
10
|
+
*/
|
|
11
|
+
export declare const farCustomerCreateTool: Tool;
|
|
12
|
+
//# sourceMappingURL=far-customer-create.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"far-customer-create.d.ts","sourceRoot":"","sources":["../../../src/tools/far/far-customer-create.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAQtC;;;;;;;;GAQG;AACH,eAAO,MAAM,qBAAqB,EAAE,IA0CnC,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { API_ERROR, errorResponse, successResponse } from '../types.js';
|
|
3
|
+
import { cap } from '../../capabilities/tool-capability.js';
|
|
4
|
+
import { financeWriteHeaders, idempotencyKeySchema, } from '../_shared/finance-idempotency.js';
|
|
5
|
+
/**
|
|
6
|
+
* Explicit-schema create for `far_customers`. The generated bounded
|
|
7
|
+
* read framework refuses to auto-generate mutations for FAR/FAP
|
|
8
|
+
* resources (WI-0003501 / WI-0003504), so every writeable field is
|
|
9
|
+
* spelled out here and consequential defaults (approval status,
|
|
10
|
+
* status) are OMITTED — the backend applies its own initial state,
|
|
11
|
+
* which prevents a caller from provisioning an already-approved
|
|
12
|
+
* customer via MCP.
|
|
13
|
+
*/
|
|
14
|
+
export const farCustomerCreateTool = {
|
|
15
|
+
name: 'far_customer_create',
|
|
16
|
+
description: 'Create a new FAR customer with an explicit safe field set. Approval/status ' +
|
|
17
|
+
'fields are intentionally excluded — the persist layer assigns the initial ' +
|
|
18
|
+
'lifecycle state. One customer per party, and customer_code is unique, within the ' +
|
|
19
|
+
'tenant: a retry fails with a duplicate-key error instead of creating a second customer.',
|
|
20
|
+
inputSchema: z.object({
|
|
21
|
+
party_id: z.string().min(1).describe('UUID of the PRM party this customer represents'),
|
|
22
|
+
customer_code: z.string().min(1).max(64).optional().describe('Optional stable code'),
|
|
23
|
+
customer_class_code: z.string().max(64).optional(),
|
|
24
|
+
customer_type_code: z.string().max(64).optional(),
|
|
25
|
+
payment_term_id: z.string().min(1).optional(),
|
|
26
|
+
idempotency_key: idempotencyKeySchema,
|
|
27
|
+
}),
|
|
28
|
+
capabilities: [cap('far_customers', 'INSERT')],
|
|
29
|
+
sideEffect: 'state_change',
|
|
30
|
+
confirmation: 'none',
|
|
31
|
+
idempotency: 'natural_key',
|
|
32
|
+
handler: async (args, ctx) => {
|
|
33
|
+
const input = args;
|
|
34
|
+
const body = { party_id: input.party_id };
|
|
35
|
+
const optional = [
|
|
36
|
+
'customer_code',
|
|
37
|
+
'customer_class_code',
|
|
38
|
+
'customer_type_code',
|
|
39
|
+
'payment_term_id',
|
|
40
|
+
];
|
|
41
|
+
for (const field of optional) {
|
|
42
|
+
if (input[field] !== undefined)
|
|
43
|
+
body[field] = input[field];
|
|
44
|
+
}
|
|
45
|
+
try {
|
|
46
|
+
const rows = await ctx.apiClient.post(`${ctx.apiClient.dbBasePath}/far_customers?select=*`, body, { headers: financeWriteHeaders(input.idempotency_key) });
|
|
47
|
+
return successResponse(rows[0]);
|
|
48
|
+
}
|
|
49
|
+
catch (error) {
|
|
50
|
+
return errorResponse(API_ERROR, `Failed to create FAR customer: ${error.message}`);
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
//# sourceMappingURL=far-customer-create.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"far-customer-create.js","sourceRoot":"","sources":["../../../src/tools/far/far-customer-create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACxE,OAAO,EAAE,GAAG,EAAE,MAAM,uCAAuC,CAAC;AAC5D,OAAO,EACL,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,mCAAmC,CAAC;AAE3C;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAS;IACzC,IAAI,EAAE,qBAAqB;IAC3B,WAAW,EACT,6EAA6E;QAC7E,4EAA4E;QAC5E,mFAAmF;QACjF,yFAAyF;IAC7F,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC;QACpB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,gDAAgD,CAAC;QACtF,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,sBAAsB,CAAC;QACpF,mBAAmB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,QAAQ,EAAE;QAClD,kBAAkB,EAAE,CAAC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-0,0 +1,13 @@
|
|
|
1
|
+
import { Tool } from '../registry.js';
|
|
2
|
+
/**
|
|
3
|
+
* Explicit-schema create for an FAR customer invoice (transaction
|
|
4
|
+
* header). The `transaction_status` column is read-only per the pinned
|
|
5
|
+
* contract — the persist layer assigns the initial state — so we omit
|
|
6
|
+
* every lifecycle-transition column from this generic path.
|
|
7
|
+
*
|
|
8
|
+
* Unique key: `t_far_cust_tx_headers_uk` (transaction_code, org_id,
|
|
9
|
+
* tenant_id), so a retry with the same transaction_code fails with a
|
|
10
|
+
* duplicate-key error.
|
|
11
|
+
*/
|
|
12
|
+
export declare const farCustomerInvoiceCreateTool: Tool;
|
|
13
|
+
//# sourceMappingURL=far-customer-invoice-create.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"far-customer-invoice-create.d.ts","sourceRoot":"","sources":["../../../src/tools/far/far-customer-invoice-create.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAStC;;;;;;;;;GASG;AACH,eAAO,MAAM,4BAA4B,EAAE,IAmE1C,CAAC"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { API_ERROR, errorResponse, successResponse } from '../types.js';
|
|
3
|
+
import { cap } from '../../capabilities/tool-capability.js';
|
|
4
|
+
import { currencyCodeSchema } from '../_shared/money.js';
|
|
5
|
+
import { financeWriteHeaders, idempotencyKeySchema, } from '../_shared/finance-idempotency.js';
|
|
6
|
+
/**
|
|
7
|
+
* Explicit-schema create for an FAR customer invoice (transaction
|
|
8
|
+
* header). The `transaction_status` column is read-only per the pinned
|
|
9
|
+
* contract — the persist layer assigns the initial state — so we omit
|
|
10
|
+
* every lifecycle-transition column from this generic path.
|
|
11
|
+
*
|
|
12
|
+
* Unique key: `t_far_cust_tx_headers_uk` (transaction_code, org_id,
|
|
13
|
+
* tenant_id), so a retry with the same transaction_code fails with a
|
|
14
|
+
* duplicate-key error.
|
|
15
|
+
*/
|
|
16
|
+
export const farCustomerInvoiceCreateTool = {
|
|
17
|
+
name: 'far_customer_invoice_create',
|
|
18
|
+
description: 'Create a customer invoice (far_customer_transaction_headers). transaction_status ' +
|
|
19
|
+
'is read-only and assigned by persist. transaction_code is unique within the ' +
|
|
20
|
+
'organisation: a retry with the same transaction_code fails with a duplicate-key ' +
|
|
21
|
+
'error instead of creating a second invoice.',
|
|
22
|
+
inputSchema: z.object({
|
|
23
|
+
sold_to_customer_id: z.string().min(1).describe('UUID of the customer being billed'),
|
|
24
|
+
sold_to_customer_site_id: z.string().min(1).optional(),
|
|
25
|
+
transaction_code: z
|
|
26
|
+
.string()
|
|
27
|
+
.min(1)
|
|
28
|
+
.max(64)
|
|
29
|
+
.describe('Business invoice/transaction reference (natural key column)'),
|
|
30
|
+
transaction_date: z.string().min(1).describe('ISO 8601 date (YYYY-MM-DD)'),
|
|
31
|
+
transaction_currency_code: currencyCodeSchema,
|
|
32
|
+
transaction_type: z
|
|
33
|
+
.string()
|
|
34
|
+
.max(32)
|
|
35
|
+
.optional()
|
|
36
|
+
.describe('Transaction type from the FAR_CUSTOMER_TRANSACTION_HEADERS_TRANSACTION_TYPE lookup ' +
|
|
37
|
+
'(INVOICE, CREDIT_MEMO, DEBIT_MEMO). Defaults to INVOICE.'),
|
|
38
|
+
payment_term_id: z.string().min(1).optional(),
|
|
39
|
+
payment_method_id: z.string().min(1).optional(),
|
|
40
|
+
customer_po_number: z.string().max(64).optional(),
|
|
41
|
+
customer_reference: z.string().max(255).optional(),
|
|
42
|
+
idempotency_key: idempotencyKeySchema,
|
|
43
|
+
}),
|
|
44
|
+
capabilities: [cap('far_customer_transaction_headers', 'INSERT')],
|
|
45
|
+
sideEffect: 'state_change',
|
|
46
|
+
confirmation: 'none',
|
|
47
|
+
idempotency: 'natural_key',
|
|
48
|
+
handler: async (args, ctx) => {
|
|
49
|
+
const input = args;
|
|
50
|
+
const body = {
|
|
51
|
+
sold_to_customer_id: input.sold_to_customer_id,
|
|
52
|
+
transaction_code: input.transaction_code,
|
|
53
|
+
transaction_date: input.transaction_date,
|
|
54
|
+
transaction_currency_code: input.transaction_currency_code,
|
|
55
|
+
};
|
|
56
|
+
for (const field of [
|
|
57
|
+
'sold_to_customer_site_id',
|
|
58
|
+
'transaction_type',
|
|
59
|
+
'payment_term_id',
|
|
60
|
+
'payment_method_id',
|
|
61
|
+
'customer_po_number',
|
|
62
|
+
'customer_reference',
|
|
63
|
+
]) {
|
|
64
|
+
if (input[field] !== undefined)
|
|
65
|
+
body[field] = input[field];
|
|
66
|
+
}
|
|
67
|
+
try {
|
|
68
|
+
const rows = await ctx.apiClient.post(`${ctx.apiClient.dbBasePath}/far_customer_transaction_headers?select=*`, body, { headers: financeWriteHeaders(input.idempotency_key) });
|
|
69
|
+
return successResponse(rows[0]);
|
|
70
|
+
}
|
|
71
|
+
catch (error) {
|
|
72
|
+
return errorResponse(API_ERROR, `Failed to create FAR customer invoice: ${error.message}`);
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
//# sourceMappingURL=far-customer-invoice-create.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"far-customer-invoice-create.js","sourceRoot":"","sources":["../../../src/tools/far/far-customer-invoice-create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACxE,OAAO,EAAE,GAAG,EAAE,MAAM,uCAAuC,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EACL,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,mCAAmC,CAAC;AAE3C;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAS;IAChD,IAAI,EAAE,6BAA6B;IACnC,WAAW,EACT,mFAAmF;QACnF,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B,WAAW,EAAE,aAAa;IAC1B,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE;QAC3B,MAAM,KAAK,GAAG,IAA2B,CAAC;QAC1C,MAAM,IAAI,GAAwB;YAChC,mBAAmB,EAAE,KAAK,CAAC,mBAAmB;YAC9C,gBAAgB,EAAE,KAAK,CAAC,gBAAgB;YACxC,gBAAgB,EAAE,KAAK,CAAC,gBAAgB;YACxC,yBAAyB,EAAE,KAAK,CAAC,yBAAyB;SAC3D,CAAC;QACF,KAAK,MAAM,KAAK,IAAI;YAClB,0BAA0B;YAC1B,kBAAkB;YAClB,iBAAiB;YACjB,mBAAmB;YACnB,oBAAoB;YACpB,oBAAoB;SACrB,EAAE,CAAC;YACF,IAAI,KAAK,CAAC,KAAK,CAAC,KAAK,SAAS;gBAAE,IAAI,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC;QAC7D,CAAC;QACD,IAAI,CAAC;YACH,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,SAAS,CAAC,IAAI,CACnC,GAAG,GAAG,CAAC,SAAS,CAAC,UAAU,4CAA4C,EACvE,IAAI,EACJ,EAAE,OAAO,EAAE,mBAAmB,CAAC,KAAK,CAAC,eAAe,CAAC,EAAE,CACxD,CAAC;YACF,OAAO,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QAClC,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,OAAO,aAAa,CAClB,SAAS,EACT,0CAA0C,KAAK,CAAC,OAAO,EAAE,CAC1D,CAAC;QACJ,CAAC;IACH,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Tool } from '../registry.js';
|
|
2
|
+
/**
|
|
3
|
+
* Explicit-schema tool for adding a line to a FAR customer invoice.
|
|
4
|
+
* The invoice header must already exist and be in a modifiable state —
|
|
5
|
+
* the persist layer enforces the guard; MCP does not need to
|
|
6
|
+
* pre-check it. Retry-safe via
|
|
7
|
+
* (customer_transaction_header_id, customer_transaction_line_number).
|
|
8
|
+
*/
|
|
9
|
+
export declare const farCustomerInvoiceLineAddTool: Tool;
|
|
10
|
+
//# sourceMappingURL=far-customer-invoice-line-add.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"far-customer-invoice-line-add.d.ts","sourceRoot":"","sources":["../../../src/tools/far/far-customer-invoice-line-add.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAYtC;;;;;;GAMG;AACH,eAAO,MAAM,6BAA6B,EAAE,IA2E3C,CAAC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { API_ERROR, errorResponse, successResponse } from '../types.js';
|
|
3
|
+
import { cap } from '../../capabilities/tool-capability.js';
|
|
4
|
+
import { positiveMoneySchema, signedMoneySchema, } from '../_shared/money.js';
|
|
5
|
+
import { financeWriteHeaders, idempotencyKeySchema, } from '../_shared/finance-idempotency.js';
|
|
6
|
+
/**
|
|
7
|
+
* Explicit-schema tool for adding a line to a FAR customer invoice.
|
|
8
|
+
* The invoice header must already exist and be in a modifiable state —
|
|
9
|
+
* the persist layer enforces the guard; MCP does not need to
|
|
10
|
+
* pre-check it. Retry-safe via
|
|
11
|
+
* (customer_transaction_header_id, customer_transaction_line_number).
|
|
12
|
+
*/
|
|
13
|
+
export const farCustomerInvoiceLineAddTool = {
|
|
14
|
+
name: 'far_customer_invoice_line_add',
|
|
15
|
+
description: 'Append a line to an existing customer invoice. Amount/qty validated at the ' +
|
|
16
|
+
'MCP boundary. Natural key: (customer_transaction_header_id, customer_transaction_line_number). ' +
|
|
17
|
+
'Retry-safe.',
|
|
18
|
+
inputSchema: z.object({
|
|
19
|
+
customer_transaction_header_id: z
|
|
20
|
+
.string()
|
|
21
|
+
.min(1)
|
|
22
|
+
.describe('UUID of the invoice header this line belongs to'),
|
|
23
|
+
sold_to_customer_id: z
|
|
24
|
+
.string()
|
|
25
|
+
.min(1)
|
|
26
|
+
.describe('UUID of the customer (must match the header)'),
|
|
27
|
+
customer_transaction_line_number: z
|
|
28
|
+
.number()
|
|
29
|
+
.int()
|
|
30
|
+
.positive()
|
|
31
|
+
.describe('1-based line number, unique within the header'),
|
|
32
|
+
customer_transaction_line_qty: signedMoneySchema.describe('Line quantity — signed to permit credit-note negative lines'),
|
|
33
|
+
extended_transaction_price: positiveMoneySchema.describe('Line total (qty × unit_transaction_price) — must be > 0'),
|
|
34
|
+
unit_transaction_price: positiveMoneySchema.describe('Unit price at the invoice currency — must be > 0'),
|
|
35
|
+
unit_list_price: positiveMoneySchema.optional(),
|
|
36
|
+
extended_list_price: positiveMoneySchema.optional(),
|
|
37
|
+
customer_transaction_line_item_id: z.string().min(1).optional(),
|
|
38
|
+
customer_transaction_line_item_description: z.string().max(255).optional(),
|
|
39
|
+
customer_transaction_line_uom: z.string().max(32).optional(),
|
|
40
|
+
customer_transaction_line_reference: z.string().max(255).optional(),
|
|
41
|
+
idempotency_key: idempotencyKeySchema,
|
|
42
|
+
}),
|
|
43
|
+
capabilities: [cap('far_customer_transaction_lines', 'INSERT')],
|
|
44
|
+
sideEffect: 'state_change',
|
|
45
|
+
confirmation: 'none',
|
|
46
|
+
idempotency: 'natural_key',
|
|
47
|
+
handler: async (args, ctx) => {
|
|
48
|
+
const input = args;
|
|
49
|
+
const body = {
|
|
50
|
+
customer_transaction_header_id: input.customer_transaction_header_id,
|
|
51
|
+
sold_to_customer_id: input.sold_to_customer_id,
|
|
52
|
+
customer_transaction_line_number: input.customer_transaction_line_number,
|
|
53
|
+
customer_transaction_line_qty: input.customer_transaction_line_qty,
|
|
54
|
+
extended_transaction_price: input.extended_transaction_price,
|
|
55
|
+
unit_transaction_price: input.unit_transaction_price,
|
|
56
|
+
};
|
|
57
|
+
for (const field of [
|
|
58
|
+
'unit_list_price',
|
|
59
|
+
'extended_list_price',
|
|
60
|
+
'customer_transaction_line_item_id',
|
|
61
|
+
'customer_transaction_line_item_description',
|
|
62
|
+
'customer_transaction_line_uom',
|
|
63
|
+
'customer_transaction_line_reference',
|
|
64
|
+
]) {
|
|
65
|
+
if (input[field] !== undefined)
|
|
66
|
+
body[field] = input[field];
|
|
67
|
+
}
|
|
68
|
+
try {
|
|
69
|
+
const rows = await ctx.apiClient.post(`${ctx.apiClient.dbBasePath}/far_customer_transaction_lines?select=*`, body, { headers: financeWriteHeaders(input.idempotency_key) });
|
|
70
|
+
return successResponse(rows[0]);
|
|
71
|
+
}
|
|
72
|
+
catch (error) {
|
|
73
|
+
return errorResponse(API_ERROR, `Failed to add FAR customer invoice line: ${error.message}`);
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
//# sourceMappingURL=far-customer-invoice-line-add.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"far-customer-invoice-line-add.js","sourceRoot":"","sources":["../../../src/tools/far/far-customer-invoice-line-add.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACxE,OAAO,EAAE,GAAG,EAAE,MAAM,uCAAuC,CAAC;AAC5D,OAAO,EACL,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,mCAAmC,CAAC;AAE3C;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAS;IACjD,IAAI,EAAE,+BAA+B;IACrC,WAAW,EACT,6EAA6E;QAC7E,iGAAiG;QACjG,aAAa;IACf,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC;QACpB,8BAA8B,EAAE,CAAC;aAC9B,MAAM,EAAE;aACR,GAAG,CAAC,CAAC,CAAC;aACN,QAAQ,CAAC,iDAAiD,CAAC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YACpE,mBAAmB,EAAE,KAAK,CAAC,mBAAmB;YAC9C,gCAAgC,EAAE,KAAK,CAAC,gCAAgC;YACxE,6BAA6B,EAAE,KAAK,CAAC,6BAA6B;YAClE,0BAA0B,EAAE,KAAK,CAAC,0BAA0B;YAC5D,sBAAsB,EAAE,KAAK,CAAC,sBAAsB;SACrD,CAAC;QACF,KAAK,MAAM,KAAK,IAAI;YAClB,iBAAiB;YACjB,qBAAqB;YACrB,mCAAmC;YACnC,4CAA4C;YAC5C,+BAA+B;YAC/B,qCAAqC;SACtC,EAAE,CAAC;YACF,IAAI,KAAK,CAAC,KAAK,CAAC,KAAK,SAAS;gBAAE,IAAI,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC;QAC7D,CAAC;QACD,IAAI,CAAC;YACH,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,SAAS,CAAC,IAAI,CACnC,GAAG,GAAG,CAAC,SAAS,CAAC,UAAU,0CAA0C,EACrE,IAAI,EACJ,EAAE,OAAO,EAAE,mBAAmB,CAAC,KAAK,CAAC,eAAe,CAAC,EAAE,CACxD,CAAC;YACF,OAAO,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QAClC,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,OAAO,aAAa,CAClB,SAAS,EACT,4CAA4C,KAAK,CAAC,OAAO,EAAE,CAC5D,CAAC;QACJ,CAAC;IACH,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Tool } from '../registry.js';
|
|
2
|
+
/**
|
|
3
|
+
* Semantic tool for a customer lifecycle transition. Wrapping this as a
|
|
4
|
+
* dedicated tool (rather than exposing status columns on the generic
|
|
5
|
+
* update path) records a reason and gives the caller a single fact to
|
|
6
|
+
* reason about ("set status to A") rather than a bag of columns.
|
|
7
|
+
*
|
|
8
|
+
* Callers must supply a target `customer_status_code` OR
|
|
9
|
+
* `customer_approval_status_code`; both may be supplied together.
|
|
10
|
+
* The tool reads the row first: the reason is merged into the existing
|
|
11
|
+
* `metadata`, and a customer already in the target state is returned
|
|
12
|
+
* unchanged, so a retry keeps the original reason.
|
|
13
|
+
*/
|
|
14
|
+
export declare const farCustomerStatusSetTool: Tool;
|
|
15
|
+
//# sourceMappingURL=far-customer-status-set.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"far-customer-status-set.d.ts","sourceRoot":"","sources":["../../../src/tools/far/far-customer-status-set.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAKtC;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,wBAAwB,EAAE,IAoEtC,CAAC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { cap } from '../../capabilities/tool-capability.js';
|
|
3
|
+
import { idempotencyKeySchema, reasonSchema } from '../_shared/finance-idempotency.js';
|
|
4
|
+
import { softDeactivate } from '../_shared/soft-deactivate.js';
|
|
5
|
+
/**
|
|
6
|
+
* Semantic tool for a customer lifecycle transition. Wrapping this as a
|
|
7
|
+
* dedicated tool (rather than exposing status columns on the generic
|
|
8
|
+
* update path) records a reason and gives the caller a single fact to
|
|
9
|
+
* reason about ("set status to A") rather than a bag of columns.
|
|
10
|
+
*
|
|
11
|
+
* Callers must supply a target `customer_status_code` OR
|
|
12
|
+
* `customer_approval_status_code`; both may be supplied together.
|
|
13
|
+
* The tool reads the row first: the reason is merged into the existing
|
|
14
|
+
* `metadata`, and a customer already in the target state is returned
|
|
15
|
+
* unchanged, so a retry keeps the original reason.
|
|
16
|
+
*/
|
|
17
|
+
export const farCustomerStatusSetTool = {
|
|
18
|
+
name: 'far_customer_status_set',
|
|
19
|
+
description: 'Transition an FAR customer lifecycle status. Accepts customer_status_code and/or ' +
|
|
20
|
+
'customer_approval_status_code; requires a `reason`, merged into the customer metadata. ' +
|
|
21
|
+
'A customer already in the target state is returned unchanged, so retries are safe.',
|
|
22
|
+
inputSchema: z
|
|
23
|
+
.object({
|
|
24
|
+
id: z.string().min(1).describe('UUID of the customer'),
|
|
25
|
+
customer_status_code: z
|
|
26
|
+
.string()
|
|
27
|
+
.max(64)
|
|
28
|
+
.optional()
|
|
29
|
+
.describe('Target status from the FAR_CUSTOMERS_CUSTOMER_STATUS lookup ' +
|
|
30
|
+
'(e.g. A = Active, I = Inactive, P = Pending)'),
|
|
31
|
+
customer_approval_status_code: z
|
|
32
|
+
.string()
|
|
33
|
+
.max(64)
|
|
34
|
+
.optional()
|
|
35
|
+
.describe('Target approval status from the FAR_CUSTOMERS_CUSTOMER_APPROVAL_STATUS lookup ' +
|
|
36
|
+
'(e.g. A = Approved, P = Pending, R = Rejected)'),
|
|
37
|
+
reason: reasonSchema.describe('Human-readable justification, stored in metadata'),
|
|
38
|
+
idempotency_key: idempotencyKeySchema,
|
|
39
|
+
})
|
|
40
|
+
.refine((v) => v.customer_status_code !== undefined ||
|
|
41
|
+
v.customer_approval_status_code !== undefined, {
|
|
42
|
+
message: 'supply customer_status_code and/or customer_approval_status_code — at least one is required.',
|
|
43
|
+
}),
|
|
44
|
+
capabilities: [cap('far_customers', 'UPDATE')],
|
|
45
|
+
sideEffect: 'state_change',
|
|
46
|
+
confirmation: 'caller_provides_reason',
|
|
47
|
+
idempotency: 'natural_key',
|
|
48
|
+
handler: async (args, ctx) => {
|
|
49
|
+
const input = args;
|
|
50
|
+
const target = {};
|
|
51
|
+
if (input.customer_status_code !== undefined) {
|
|
52
|
+
target.customer_status_code = input.customer_status_code;
|
|
53
|
+
}
|
|
54
|
+
if (input.customer_approval_status_code !== undefined) {
|
|
55
|
+
target.customer_approval_status_code = input.customer_approval_status_code;
|
|
56
|
+
}
|
|
57
|
+
return softDeactivate(ctx, {
|
|
58
|
+
table: 'far_customers',
|
|
59
|
+
id: input.id,
|
|
60
|
+
label: 'FAR customer',
|
|
61
|
+
verb: 'set status of',
|
|
62
|
+
isDone: (row) => Object.entries(target).every(([k, v]) => row[k] === v),
|
|
63
|
+
changes: () => target,
|
|
64
|
+
reasonKey: 'status_change_reason',
|
|
65
|
+
reason: input.reason,
|
|
66
|
+
idempotencyKey: input.idempotency_key,
|
|
67
|
+
});
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
//# sourceMappingURL=far-customer-status-set.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"far-customer-status-set.js","sourceRoot":"","sources":["../../../src/tools/far/far-customer-status-set.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,GAAG,EAAE,MAAM,uCAAuC,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AACvF,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAS;IAC5C,IAAI,EAAE,yBAAyB;IAC/B,WAAW,EACT,mFAAmF;QACnF,yFAAyF;QACzF,oFAAoF;IACtF,WAAW,EAAE,CAAC;SACX,MAAM,CAAC;QACN,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,sBAAsB,CAAC;QACtD,oBAAoB,EAAE,CAAC;aACpB,MAAM,EAAE;aACR,GAAG,CAAC,EAAE,CAAC;aACP,QAAQ,EAAE;aACV,QAAQ,CACP,8DAA8D;YAC5D,8CAA8C,CACjD;QACH,6BAA6B,EAAE,CAAC;aAC7B,MAAM,EAAE;aACR,GAAG,CAAC,EAAE,CAAC;aACP,QAAQ,EAAE;aACV,QAAQ,CACP,gFAAgF;YAC9E,gDAAgD,CACnD;QACH,MAAM,EAAE,YAAY,CAAC,QAAQ,CAAC,kDAAkD,CAAC;QACjF,eAAe,EAAE,oBAAoB;KACtC,CAAC;SACD,MA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 @@
|
|
|
1
|
+
import { Tool } from '../registry.js';
|
|
2
|
+
/**
|
|
3
|
+
* Explicit-schema update for `far_customers`. Approval status,
|
|
4
|
+
* customer status, and lifecycle-transition fields are DELIBERATELY
|
|
5
|
+
* excluded from this generic update — a status transition is a
|
|
6
|
+
* dedicated tool (`far_customer_status_set`) so it carries a reason
|
|
7
|
+
* and a confirmation semantic.
|
|
8
|
+
*/
|
|
9
|
+
export declare const farCustomerUpdateTool: Tool;
|
|
10
|
+
//# sourceMappingURL=far-customer-update.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"far-customer-update.d.ts","sourceRoot":"","sources":["../../../src/tools/far/far-customer-update.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAQtC;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,EAAE,IA+CnC,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { API_ERROR, errorResponse, successResponse } from '../types.js';
|
|
3
|
+
import { cap } from '../../capabilities/tool-capability.js';
|
|
4
|
+
import { financeWriteHeaders, idempotencyKeySchema, } from '../_shared/finance-idempotency.js';
|
|
5
|
+
/**
|
|
6
|
+
* Explicit-schema update for `far_customers`. Approval status,
|
|
7
|
+
* customer status, and lifecycle-transition fields are DELIBERATELY
|
|
8
|
+
* excluded from this generic update — a status transition is a
|
|
9
|
+
* dedicated tool (`far_customer_status_set`) so it carries a reason
|
|
10
|
+
* and a confirmation semantic.
|
|
11
|
+
*/
|
|
12
|
+
export const farCustomerUpdateTool = {
|
|
13
|
+
name: 'far_customer_update',
|
|
14
|
+
description: 'Update an FAR customer with an explicit safe field set. Status/approval ' +
|
|
15
|
+
'columns are excluded from this generic path — use far_customer_status_set for ' +
|
|
16
|
+
'lifecycle transitions. Retry-safe (converges on the same target state).',
|
|
17
|
+
inputSchema: z.object({
|
|
18
|
+
id: z.string().min(1).describe('UUID of the customer'),
|
|
19
|
+
customer_code: z.string().max(64).nullable().optional(),
|
|
20
|
+
customer_class_code: z.string().max(64).nullable().optional(),
|
|
21
|
+
customer_type_code: z.string().max(64).nullable().optional(),
|
|
22
|
+
payment_term_id: z.string().nullable().optional(),
|
|
23
|
+
idempotency_key: idempotencyKeySchema,
|
|
24
|
+
}),
|
|
25
|
+
capabilities: [cap('far_customers', 'UPDATE')],
|
|
26
|
+
sideEffect: 'state_change',
|
|
27
|
+
confirmation: 'none',
|
|
28
|
+
idempotency: 'natural_key',
|
|
29
|
+
handler: async (args, ctx) => {
|
|
30
|
+
const { id, idempotency_key, ...rest } = args;
|
|
31
|
+
const body = {};
|
|
32
|
+
for (const [k, v] of Object.entries(rest)) {
|
|
33
|
+
if (v !== undefined)
|
|
34
|
+
body[k] = v;
|
|
35
|
+
}
|
|
36
|
+
if (Object.keys(body).length === 0) {
|
|
37
|
+
return errorResponse(API_ERROR, 'Update payload is empty — supply at least one field to change.');
|
|
38
|
+
}
|
|
39
|
+
try {
|
|
40
|
+
const rows = await ctx.apiClient.patch(`${ctx.apiClient.dbBasePath}/far_customers?id=eq.${id}&select=*`, body, { headers: financeWriteHeaders(idempotency_key) });
|
|
41
|
+
if (!rows || rows.length === 0) {
|
|
42
|
+
return errorResponse(API_ERROR, `FAR customer ${id} not found or not accessible`);
|
|
43
|
+
}
|
|
44
|
+
return successResponse(rows[0]);
|
|
45
|
+
}
|
|
46
|
+
catch (error) {
|
|
47
|
+
return errorResponse(API_ERROR, `Failed to update FAR customer: ${error.message}`);
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
//# sourceMappingURL=far-customer-update.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"far-customer-update.js","sourceRoot":"","sources":["../../../src/tools/far/far-customer-update.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,SAAS,E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QACzC,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;YAC1C,IAAI,CAAC,KAAK,SAAS;gBAAE,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QACnC,CAAC;QACD,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACnC,OAAO,aAAa,CAClB,SAAS,EACT,gEAAgE,CACjE,CAAC;QACJ,CAAC;QACD,IAAI,CAAC;YACH,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,SAAS,CAAC,KAAK,CACpC,GAAG,GAAG,CAAC,SAAS,CAAC,UAAU,wBAAwB,EAAE,WAAW,EAChE,IAAI,EACJ,EAAE,OAAO,EAAE,mBAAmB,CAAC,eAAe,CAAC,EAAE,CAClD,CAAC;YACF,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBAC/B,OAAO,aAAa,CAAC,SAAS,EAAE,gBAAgB,EAAE,8BAA8B,CAAC,CAAC;YACpF,CAAC;YACD,OAAO,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QAClC,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,OAAO,aAAa,CAAC,SAAS,EAAE,kCAAkC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;QACrF,CAAC;IACH,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Tool } from '../registry.js';
|
|
2
|
+
import { CatalogueReport } from '../../generated-reads/index.js';
|
|
3
|
+
export declare const farGeneratedReadReport: CatalogueReport;
|
|
4
|
+
export declare const farGeneratedReadTools: Tool[];
|
|
5
|
+
//# sourceMappingURL=generated-reads.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-reads.d.ts","sourceRoot":"","sources":["../../../src/tools/far/generated-reads.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAGL,eAAe,EAChB,MAAM,gCAAgC,CAAC;AAsBxC,eAAO,MAAM,sBAAsB,EAAE,eAIjC,CAAC;AAEL,eAAO,MAAM,qBAAqB,EAAE,IAAI,EAGvC,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { buildGeneratedReadCatalogue, buildGeneratedReadCatalogueReport, } from '../../generated-reads/index.js';
|
|
2
|
+
import { loadPersistResourceContract } from '../../contracts/persist-resource-contract.js';
|
|
3
|
+
/**
|
|
4
|
+
* Bounded read tools for the FAR module (WI-0003504).
|
|
5
|
+
*
|
|
6
|
+
* The schema-driven catalogue (WI-0003500) emits describe/list/get for
|
|
7
|
+
* every `normal`-sensitivity FAR resource that declares a read operation
|
|
8
|
+
* and has no side effects. Sensitive resources — `far_cash_receipts`,
|
|
9
|
+
* `far_payment_terms`, `far_payment_term_lines`, `far_receipt_schedules`
|
|
10
|
+
* — are explicitly included per the acceptance criterion for this WI
|
|
11
|
+
* (receipts and payment-schedule reads are in scope). The guardrails
|
|
12
|
+
* redact any credential-shaped column, but these tables do not carry
|
|
13
|
+
* password/token fields.
|
|
14
|
+
*
|
|
15
|
+
* The catalogue emits `_describe` / `_list` / `_get` tools; every write
|
|
16
|
+
* on these tables lives in a dedicated hand-written tool (see
|
|
17
|
+
* `far-customer-*`, `far-cash-receipt-*`).
|
|
18
|
+
*/
|
|
19
|
+
const contract = loadPersistResourceContract();
|
|
20
|
+
export const farGeneratedReadReport = buildGeneratedReadCatalogueReport(contract, {
|
|
21
|
+
modules: ['far'],
|
|
22
|
+
includeSensitive: true,
|
|
23
|
+
});
|
|
24
|
+
export const farGeneratedReadTools = buildGeneratedReadCatalogue(contract, { modules: ['far'], includeSensitive: true });
|
|
25
|
+
//# sourceMappingURL=generated-reads.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-reads.js","sourceRoot":"","sources":["../../../src/tools/far/generated-reads.ts"],"names":[],"mappings":"AACA,OAAO,EACL,2BAA2B,EAC3B,iCAAiC,GAElC,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,2BAA2B,EAAE,MAAM,8CAA8C,CAAC;AAE3F;;;;;;;;;;;;;;;GAeG;AAEH,MAAM,QAAQ,GAAG,2BAA2B,EAAE,CAAC;AAE/C,MAAM,CAAC,MAAM,sBAAsB,GACjC,iCAAiC,CAAC,QAAQ,EAAE;IAC1C,OAAO,EAAE,CAAC,KAAK,CAAC;IAChB,gBAAgB,EAAE,IAAI;CACvB,CAAC,CAAC;AAEL,MAAM,CAAC,MAAM,qBAAqB,GAAW,2BAA2B,CACtE,QAAQ,EACR,EAAE,OAAO,EAAE,CAAC,KAAK,CAAC,EAAE,gBAAgB,EAAE,IAAI,EAAE,CAC7C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/far/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAkBtC,eAAO,MAAM,QAAQ,EAAE,IAAI,EAAiD,CAAC;AAE7E,wEAAwE;AACxE,eAAO,MAAM,gBAAgB,EAAE,IAAI,EAA0B,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { farGeneratedReadTools } from './generated-reads.js';
|
|
2
|
+
import { farCustomerCreateTool } from './far-customer-create.js';
|
|
3
|
+
import { farCustomerUpdateTool } from './far-customer-update.js';
|
|
4
|
+
import { farCustomerStatusSetTool } from './far-customer-status-set.js';
|
|
5
|
+
import { farCustomerInvoiceCreateTool } from './far-customer-invoice-create.js';
|
|
6
|
+
import { farCustomerInvoiceLineAddTool } from './far-customer-invoice-line-add.js';
|
|
7
|
+
import { farCashReceiptRecordTool } from './far-cash-receipt-record.js';
|
|
8
|
+
const farWriteTools = [
|
|
9
|
+
farCustomerCreateTool,
|
|
10
|
+
farCustomerUpdateTool,
|
|
11
|
+
farCustomerStatusSetTool,
|
|
12
|
+
farCustomerInvoiceCreateTool,
|
|
13
|
+
farCustomerInvoiceLineAddTool,
|
|
14
|
+
farCashReceiptRecordTool,
|
|
15
|
+
];
|
|
16
|
+
export const farTools = [...farGeneratedReadTools, ...farWriteTools];
|
|
17
|
+
/** Read-only slice used by the `far-readonly` selectable sub-domain. */
|
|
18
|
+
export const farReadOnlyTools = farGeneratedReadTools;
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tools/far/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EAAE,4BAA4B,EAAE,MAAM,kCAAkC,CAAC;AAChF,OAAO,EAAE,6BAA6B,EAAE,MAAM,oCAAoC,CAAC;AACnF,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AAExE,MAAM,aAAa,GAAW;IAC5B,qBAAqB;IACrB,qBAAqB;IACrB,wBAAwB;IACxB,4BAA4B;IAC5B,6BAA6B;IAC7B,wBAAwB;CACzB,CAAC;AAEF,MAAM,CAAC,MAAM,QAAQ,GAAW,CAAC,GAAG,qBAAqB,EAAE,GAAG,aAAa,CAAC,CAAC;AAE7E,wEAAwE;AACxE,MAAM,CAAC,MAAM,gBAAgB,GAAW,qBAAqB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"role-mapping.d.ts","sourceRoot":"","sources":["../../src/tools/role-mapping.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE1D;;;;;;;;GAQG;AACH,MAAM,WAAW,SAAS;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;
|
|
1
|
+
{"version":3,"file":"role-mapping.d.ts","sourceRoot":"","sources":["../../src/tools/role-mapping.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE1D;;;;;;;;GAQG;AACH,MAAM,WAAW,SAAS;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAuCD;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAiChE;AAED;;;GAGG;AACH,wBAAsB,eAAe,CACnC,SAAS,EAAE,eAAe,GACzB,OAAO,CAAC,SAAS,EAAE,CAAC,CAEtB;AAED;;;;;;;;GAQG;AACH,wBAAsB,kBAAkB,CACtC,SAAS,EAAE,eAAe,GACzB,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAO7B"}
|
|
@@ -27,6 +27,12 @@ const ROLE_TO_DOMAINS = {
|
|
|
27
27
|
'Bank account administrator': ['cmm'],
|
|
28
28
|
'Bank account user': ['cmm'],
|
|
29
29
|
'Bank account viewer': ['cmm-readonly'],
|
|
30
|
+
'Accounts receivable administrator': ['far'],
|
|
31
|
+
'Accounts receivable user': ['far'],
|
|
32
|
+
'Accounts receivable viewer': ['far-readonly'],
|
|
33
|
+
'Accounts payable administrator': ['fap'],
|
|
34
|
+
'Accounts payable user': ['fap'],
|
|
35
|
+
'Accounts payable viewer': ['fap-readonly'],
|
|
30
36
|
};
|
|
31
37
|
/**
|
|
32
38
|
* Given a list of user group names, resolve the set of tool domain IDs
|
|
@@ -60,6 +66,12 @@ export function mapRolesToDomains(groupNames) {
|
|
|
60
66
|
if (domains.has('cmm') && domains.has('cmm-readonly')) {
|
|
61
67
|
domains.delete('cmm-readonly');
|
|
62
68
|
}
|
|
69
|
+
if (domains.has('far') && domains.has('far-readonly')) {
|
|
70
|
+
domains.delete('far-readonly');
|
|
71
|
+
}
|
|
72
|
+
if (domains.has('fap') && domains.has('fap-readonly')) {
|
|
73
|
+
domains.delete('fap-readonly');
|
|
74
|
+
}
|
|
63
75
|
return [...domains];
|
|
64
76
|
}
|
|
65
77
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"role-mapping.js","sourceRoot":"","sources":["../../src/tools/role-mapping.ts"],"names":[],"mappings":"AAgBA;;;;GAIG;AACH,MAAM,eAAe,GAA6B;IAChD,uBAAuB,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC;IAC9C,cAAc,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC;IAC9B,gBAAgB,EAAE,CAAC,cAAc,EAAE,cAAc,CAAC;IAClD,4BAA4B,EAAE,CAAC,KAAK,CAAC;IACrC,mBAAmB,EAAE,CAAC,KAAK,CAAC;IAC5B,qBAAqB,EAAE,CAAC,KAAK,CAAC;IAC9B,sBAAsB,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC;IACtC,aAAa,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC;IAC7B,eAAe,EAAE,CAAC,cAAc,CAAC;IACjC,qBAAqB,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC;IACrC,YAAY,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC;IAC5B,cAAc,EAAE,CAAC,cAAc,CAAC;IAChC,yEAAyE;IACzE,2EAA2E;IAC3E,0EAA0E;IAC1E,uBAAuB,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC;IACvC,YAAY,EAAE,CAAC,KAAK,CAAC;IACrB,qBAAqB,EAAE,CAAC,KAAK,CAAC;IAC9B,YAAY,EAAE,CAAC,KAAK,CAAC;IACrB,cAAc,EAA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