@lerianstudio/matcher-mcp 1.0.0 → 1.1.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/config.js +33 -0
- package/dist/config.js.map +1 -1
- package/dist/matcher/client.js +13 -4
- package/dist/matcher/client.js.map +1 -1
- package/dist/server.js +7 -0
- package/dist/server.js.map +1 -1
- package/dist/spec/curated-operations.js +14 -9
- package/dist/spec/curated-operations.js.map +1 -1
- package/dist/spec/index.js +15 -0
- package/dist/spec/index.js.map +1 -1
- package/dist/spec/openapi.yaml +22 -4
- package/dist/tools/context/index.js +17 -10
- package/dist/tools/context/index.js.map +1 -1
- package/dist/tools/context/setup-progress.js +56 -0
- package/dist/tools/context/setup-progress.js.map +1 -0
- package/dist/tools/dashboard/aggregates.js +5 -2
- package/dist/tools/dashboard/aggregates.js.map +1 -1
- package/dist/tools/dashboard/cash-impact.js +4 -3
- package/dist/tools/dashboard/cash-impact.js.map +1 -1
- package/dist/tools/dashboard/match-rate.js +4 -2
- package/dist/tools/dashboard/match-rate.js.map +1 -1
- package/dist/tools/dashboard/metrics.js +4 -3
- package/dist/tools/dashboard/metrics.js.map +1 -1
- package/dist/tools/dashboard/shared.js +16 -4
- package/dist/tools/dashboard/shared.js.map +1 -1
- package/dist/tools/dashboard/sla.js +4 -3
- package/dist/tools/dashboard/sla.js.map +1 -1
- package/dist/tools/dashboard/source-breakdown.js +4 -3
- package/dist/tools/dashboard/source-breakdown.js.map +1 -1
- package/dist/tools/dashboard/volume.js +5 -3
- package/dist/tools/dashboard/volume.js.map +1 -1
- package/dist/tools/fee-schedule/create.js +17 -6
- package/dist/tools/fee-schedule/create.js.map +1 -1
- package/dist/tools/field-map/create.js +62 -0
- package/dist/tools/field-map/create.js.map +1 -0
- package/dist/tools/field-map/delete.js +35 -0
- package/dist/tools/field-map/delete.js.map +1 -0
- package/dist/tools/field-map/get.js +43 -0
- package/dist/tools/field-map/get.js.map +1 -0
- package/dist/tools/field-map/index.js +31 -0
- package/dist/tools/field-map/index.js.map +1 -0
- package/dist/tools/field-map/list.js +64 -0
- package/dist/tools/field-map/list.js.map +1 -0
- package/dist/tools/field-map/shared.js +114 -0
- package/dist/tools/field-map/shared.js.map +1 -0
- package/dist/tools/field-map/update.js +46 -0
- package/dist/tools/field-map/update.js.map +1 -0
- package/dist/tools/generic/describe-operation.js +40 -0
- package/dist/tools/generic/describe-operation.js.map +1 -1
- package/dist/tools/generic/invoke.js +95 -7
- package/dist/tools/generic/invoke.js.map +1 -1
- package/dist/tools/ingestion/fetch-source.js +105 -0
- package/dist/tools/ingestion/fetch-source.js.map +1 -0
- package/dist/tools/ingestion/index.js +10 -8
- package/dist/tools/ingestion/index.js.map +1 -1
- package/dist/tools/ingestion/shared.js +8 -3
- package/dist/tools/ingestion/shared.js.map +1 -1
- package/dist/tools/ingestion/upload.js +166 -0
- package/dist/tools/ingestion/upload.js.map +1 -0
- package/dist/tools/match-rule/create.js +13 -10
- package/dist/tools/match-rule/create.js.map +1 -1
- package/dist/tools/match-rule/list.js +2 -2
- package/dist/tools/match-rule/list.js.map +1 -1
- package/dist/tools/match-rule/shared.js +23 -0
- package/dist/tools/match-rule/shared.js.map +1 -1
- package/dist/tools/match-rule/update.js +6 -6
- package/dist/tools/match-rule/update.js.map +1 -1
- package/dist/tools/matching/get.js +38 -15
- package/dist/tools/matching/get.js.map +1 -1
- package/dist/tools/matching/shared.js +33 -3
- package/dist/tools/matching/shared.js.map +1 -1
- package/dist/tools/matching/start.js +38 -12
- package/dist/tools/matching/start.js.map +1 -1
- package/dist/tools/report/count-exceptions.js +3 -2
- package/dist/tools/report/count-exceptions.js.map +1 -1
- package/dist/tools/report/count-matched.js +3 -2
- package/dist/tools/report/count-matched.js.map +1 -1
- package/dist/tools/report/count-transactions.js +3 -2
- package/dist/tools/report/count-transactions.js.map +1 -1
- package/dist/tools/report/count-unmatched.js +3 -2
- package/dist/tools/report/count-unmatched.js.map +1 -1
- package/dist/tools/report/export-exceptions.js +6 -4
- package/dist/tools/report/export-exceptions.js.map +1 -1
- package/dist/tools/report/export-matched.js +3 -1
- package/dist/tools/report/export-matched.js.map +1 -1
- package/dist/tools/report/export-summary.js +3 -1
- package/dist/tools/report/export-summary.js.map +1 -1
- package/dist/tools/report/export-unmatched.js +5 -3
- package/dist/tools/report/export-unmatched.js.map +1 -1
- package/dist/tools/report/export-variance.js +3 -1
- package/dist/tools/report/export-variance.js.map +1 -1
- package/dist/tools/report/matched.js +5 -3
- package/dist/tools/report/matched.js.map +1 -1
- package/dist/tools/report/shared.js +16 -4
- package/dist/tools/report/shared.js.map +1 -1
- package/dist/tools/report/summary.js +5 -3
- package/dist/tools/report/summary.js.map +1 -1
- package/dist/tools/report/unmatched.js +5 -3
- package/dist/tools/report/unmatched.js.map +1 -1
- package/dist/tools/report/variance.js +5 -3
- package/dist/tools/report/variance.js.map +1 -1
- package/package.json +1 -1
|
@@ -42,6 +42,13 @@ export function contextDashboardSlicePath(contextId, slice) {
|
|
|
42
42
|
* verbatim and let matcher own that validation (a 90-day breach surfaces as a
|
|
43
43
|
* structured RFC 9457 error). contextId and source_id are routing/data params,
|
|
44
44
|
* NOT tenant fields.
|
|
45
|
+
*
|
|
46
|
+
* F4: the 30-day default is a silent clip, not a "no data" signal — a caller
|
|
47
|
+
* with no UI date-picker (an LLM operator) gets a real, well-formed payload
|
|
48
|
+
* back that simply excludes older data, with nothing in the response marking
|
|
49
|
+
* it as partial. The field descriptions below call this out explicitly so a
|
|
50
|
+
* model reads the warning before it reports a windowed number as the whole
|
|
51
|
+
* reconciliation result.
|
|
45
52
|
*/
|
|
46
53
|
export const dashboardQueryInputShape = {
|
|
47
54
|
contextId: z
|
|
@@ -52,13 +59,18 @@ export const dashboardQueryInputShape = {
|
|
|
52
59
|
date_from: z
|
|
53
60
|
.string()
|
|
54
61
|
.optional()
|
|
55
|
-
.describe('Start date (YYYY-MM-DD), inclusive. Optional —
|
|
56
|
-
'
|
|
62
|
+
.describe('Start date (YYYY-MM-DD), inclusive. Optional — if omitted (with ' +
|
|
63
|
+
'date_to), matcher defaults to the last ~30 days, SILENTLY EXCLUDING ' +
|
|
64
|
+
'everything older. A windowed result is NOT "the reconciliation ' +
|
|
65
|
+
'result" — for a complete picture, pass an explicit date_from/date_to ' +
|
|
66
|
+
'(max 90-day span).'),
|
|
57
67
|
date_to: z
|
|
58
68
|
.string()
|
|
59
69
|
.optional()
|
|
60
|
-
.describe('End date (YYYY-MM-DD), inclusive. Optional —
|
|
61
|
-
'tomorrow (UTC).
|
|
70
|
+
.describe('End date (YYYY-MM-DD), inclusive. Optional — if omitted, matcher ' +
|
|
71
|
+
'defaults to tomorrow (UTC). Combined with an omitted date_from this ' +
|
|
72
|
+
'silently clips the window to the last ~30 days; pass an explicit ' +
|
|
73
|
+
'date_from/date_to (max 90-day span) for the full picture.'),
|
|
62
74
|
source_id: z
|
|
63
75
|
.string()
|
|
64
76
|
.optional()
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../../../src/tools/dashboard/shared.ts"],"names":[],"mappings":"AAAA,mDAAmD;AACnD,EAAE;AACF,+EAA+E;AAC/E,kFAAkF;AAClF,gFAAgF;AAChF,gFAAgF;AAChF,wEAAwE;AACxE,6EAA6E;AAC7E,yEAAyE;AACzE,+EAA+E;AAC/E,+EAA+E;AAC/E,gCAAgC;AAChC,EAAE;AACF,gFAAgF;AAChF,+EAA+E;AAC/E,gFAAgF;AAChF,8EAA8E;AAC9E,iFAAiF;AACjF,qCAAqC;AAErC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB,OAAO,EACL,oBAAoB,EACpB,oBAAoB,GAErB,MAAM,6BAA6B,CAAA;AAEpC,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAEjE,iFAAiF;AACjF,MAAM,UAAU,oBAAoB,CAAC,SAAiB;IACpD,OAAO,wBAAwB,kBAAkB,CAAC,SAAS,CAAC,YAAY,CAAA;AAC1E,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,yBAAyB,CACvC,SAAiB,EACjB,KAAa;IAEb,OAAO,GAAG,oBAAoB,CAAC,SAAS,CAAC,IAAI,KAAK,EAAE,CAAA;AACtD,CAAC;AAED
|
|
1
|
+
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../../../src/tools/dashboard/shared.ts"],"names":[],"mappings":"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"}
|
|
@@ -17,9 +17,10 @@ export function registerDashboardSlaTool(server) {
|
|
|
17
17
|
server.registerTool('dashboard_sla', {
|
|
18
18
|
description: 'Get the SLA compliance statistics for a reconciliation context. Pass ' +
|
|
19
19
|
'contextId (UUID path param — not a tenant field), and optionally ' +
|
|
20
|
-
'date_from/date_to (YYYY-MM-DD; matcher defaults to the last 30 days
|
|
21
|
-
'
|
|
22
|
-
'
|
|
20
|
+
'date_from/date_to (YYYY-MM-DD; matcher defaults to the last ~30 days ' +
|
|
21
|
+
'and SILENTLY EXCLUDES older exceptions — for a full picture pass an ' +
|
|
22
|
+
'explicit date_from/date_to, max 90-day span) and/or source_id (UUID ' +
|
|
23
|
+
'data filter). No tenant field is accepted.',
|
|
23
24
|
inputSchema: dashboardSlaInputShape,
|
|
24
25
|
}, async (args, extra) => {
|
|
25
26
|
const query = buildDashboardQuery(args);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sla.js","sourceRoot":"","sources":["../../../src/tools/dashboard/sla.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,gFAAgF;AAChF,+EAA+E;AAC/E,eAAe;AAIf,OAAO,EACL,mBAAmB,EACnB,yBAAyB,EACzB,wBAAwB,EACxB,iBAAiB,GAClB,MAAM,aAAa,CAAA;AAEpB,4EAA4E;AAC5E,MAAM,CAAC,MAAM,sBAAsB,GAAG,wBAAwB,CAAA;AAE9D;;;;GAIG;AACH,MAAM,UAAU,wBAAwB,CAAC,MAAiB;IACxD,MAAM,CAAC,YAAY,CACjB,eAAe,EACf;QACE,WAAW,EACT,uEAAuE;YACvE,mEAAmE;YACnE,
|
|
1
|
+
{"version":3,"file":"sla.js","sourceRoot":"","sources":["../../../src/tools/dashboard/sla.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,gFAAgF;AAChF,+EAA+E;AAC/E,eAAe;AAIf,OAAO,EACL,mBAAmB,EACnB,yBAAyB,EACzB,wBAAwB,EACxB,iBAAiB,GAClB,MAAM,aAAa,CAAA;AAEpB,4EAA4E;AAC5E,MAAM,CAAC,MAAM,sBAAsB,GAAG,wBAAwB,CAAA;AAE9D;;;;GAIG;AACH,MAAM,UAAU,wBAAwB,CAAC,MAAiB;IACxD,MAAM,CAAC,YAAY,CACjB,eAAe,EACf;QACE,WAAW,EACT,uEAAuE;YACvE,mEAAmE;YACnE,uEAAuE;YACvE,sEAAsE;YACtE,sEAAsE;YACtE,4CAA4C;QAC9C,WAAW,EAAE,sBAAsB;KACpC,EACD,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE;QACpB,MAAM,KAAK,GAAG,mBAAmB,CAAC,IAAI,CAAC,CAAA;QACvC,OAAO,iBAAiB,CACtB;YACE,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,yBAAyB,CAAC,IAAI,CAAC,SAAS,EAAE,KAAK,CAAC;YACtD,GAAG,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAC1C,EACD,KAAK,CACN,CAAA;IACH,CAAC,CACF,CAAA;AACH,CAAC"}
|
|
@@ -20,9 +20,10 @@ export function registerDashboardSourceBreakdownTool(server) {
|
|
|
20
20
|
description: 'Get the per-source reconciliation breakdown for a context (statistics ' +
|
|
21
21
|
'grouped by source). Pass contextId (UUID path param — not a tenant ' +
|
|
22
22
|
'field), and optionally date_from/date_to (YYYY-MM-DD; matcher defaults ' +
|
|
23
|
-
'to the last 30 days and
|
|
24
|
-
'
|
|
25
|
-
'
|
|
23
|
+
'to the last ~30 days and SILENTLY EXCLUDES older data — for a full ' +
|
|
24
|
+
'picture pass an explicit date_from/date_to, max 90-day span) and/or ' +
|
|
25
|
+
'source_id (UUID data filter, to narrow to a single source). No tenant ' +
|
|
26
|
+
'field is accepted.',
|
|
26
27
|
inputSchema: dashboardSourceBreakdownInputShape,
|
|
27
28
|
}, async (args, extra) => {
|
|
28
29
|
const query = buildDashboardQuery(args);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"source-breakdown.js","sourceRoot":"","sources":["../../../src/tools/dashboard/source-breakdown.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,+DAA+D;AAC/D,EAAE;AACF,6EAA6E;AAC7E,iFAAiF;AACjF,2EAA2E;AAC3E,+EAA+E;AAC/E,iDAAiD;AAIjD,OAAO,EACL,mBAAmB,EACnB,yBAAyB,EACzB,wBAAwB,EACxB,iBAAiB,GAClB,MAAM,aAAa,CAAA;AAEpB,yFAAyF;AACzF,MAAM,CAAC,MAAM,kCAAkC,GAAG,wBAAwB,CAAA;AAE1E;;;;;GAKG;AACH,MAAM,UAAU,oCAAoC,CAAC,MAAiB;IACpE,MAAM,CAAC,YAAY,CACjB,4BAA4B,EAC5B;QACE,WAAW,EACT,wEAAwE;YACxE,qEAAqE;YACrE,yEAAyE;YACzE,
|
|
1
|
+
{"version":3,"file":"source-breakdown.js","sourceRoot":"","sources":["../../../src/tools/dashboard/source-breakdown.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,+DAA+D;AAC/D,EAAE;AACF,6EAA6E;AAC7E,iFAAiF;AACjF,2EAA2E;AAC3E,+EAA+E;AAC/E,iDAAiD;AAIjD,OAAO,EACL,mBAAmB,EACnB,yBAAyB,EACzB,wBAAwB,EACxB,iBAAiB,GAClB,MAAM,aAAa,CAAA;AAEpB,yFAAyF;AACzF,MAAM,CAAC,MAAM,kCAAkC,GAAG,wBAAwB,CAAA;AAE1E;;;;;GAKG;AACH,MAAM,UAAU,oCAAoC,CAAC,MAAiB;IACpE,MAAM,CAAC,YAAY,CACjB,4BAA4B,EAC5B;QACE,WAAW,EACT,wEAAwE;YACxE,qEAAqE;YACrE,yEAAyE;YACzE,qEAAqE;YACrE,sEAAsE;YACtE,wEAAwE;YACxE,oBAAoB;QACtB,WAAW,EAAE,kCAAkC;KAChD,EACD,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE;QACpB,MAAM,KAAK,GAAG,mBAAmB,CAAC,IAAI,CAAC,CAAA;QACvC,OAAO,iBAAiB,CACtB;YACE,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,yBAAyB,CAAC,IAAI,CAAC,SAAS,EAAE,kBAAkB,CAAC;YACnE,GAAG,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAC1C,EACD,KAAK,CACN,CAAA;IACH,CAAC,CACF,CAAA;AACH,CAAC"}
|
|
@@ -19,9 +19,11 @@ export function registerDashboardVolumeTool(server) {
|
|
|
19
19
|
server.registerTool('dashboard_volume', {
|
|
20
20
|
description: 'Get the transaction volume statistics for a reconciliation context. ' +
|
|
21
21
|
'Pass contextId (UUID path param — not a tenant field), and optionally ' +
|
|
22
|
-
'date_from/date_to (YYYY-MM-DD; matcher defaults to the last 30 days
|
|
23
|
-
'
|
|
24
|
-
'
|
|
22
|
+
'date_from/date_to (YYYY-MM-DD; matcher defaults to the last ~30 days ' +
|
|
23
|
+
'and SILENTLY EXCLUDES older volume — for a full picture pass an ' +
|
|
24
|
+
'explicit date_from/date_to, max 90-day span). The response echoes the ' +
|
|
25
|
+
'resolved window in periodStart/periodEnd. Optionally also pass ' +
|
|
26
|
+
'source_id (UUID data filter). No tenant field is accepted.',
|
|
25
27
|
inputSchema: dashboardVolumeInputShape,
|
|
26
28
|
}, async (args, extra) => {
|
|
27
29
|
const query = buildDashboardQuery(args);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"volume.js","sourceRoot":"","sources":["../../../src/tools/dashboard/volume.ts"],"names":[],"mappings":"AAAA,mCAAmC;AACnC,qDAAqD;AACrD,EAAE;AACF,kEAAkE;AAClE,4EAA4E;AAC5E,+EAA+E;AAC/E,8EAA8E;AAC9E,mCAAmC;AAInC,OAAO,EACL,mBAAmB,EACnB,yBAAyB,EACzB,wBAAwB,EACxB,iBAAiB,GAClB,MAAM,aAAa,CAAA;AAEpB,+EAA+E;AAC/E,MAAM,CAAC,MAAM,yBAAyB,GAAG,wBAAwB,CAAA;AAEjE;;;;;GAKG;AACH,MAAM,UAAU,2BAA2B,CAAC,MAAiB;IAC3D,MAAM,CAAC,YAAY,CACjB,kBAAkB,EAClB;QACE,WAAW,EACT,sEAAsE;YACtE,wEAAwE;YACxE,
|
|
1
|
+
{"version":3,"file":"volume.js","sourceRoot":"","sources":["../../../src/tools/dashboard/volume.ts"],"names":[],"mappings":"AAAA,mCAAmC;AACnC,qDAAqD;AACrD,EAAE;AACF,kEAAkE;AAClE,4EAA4E;AAC5E,+EAA+E;AAC/E,8EAA8E;AAC9E,mCAAmC;AAInC,OAAO,EACL,mBAAmB,EACnB,yBAAyB,EACzB,wBAAwB,EACxB,iBAAiB,GAClB,MAAM,aAAa,CAAA;AAEpB,+EAA+E;AAC/E,MAAM,CAAC,MAAM,yBAAyB,GAAG,wBAAwB,CAAA;AAEjE;;;;;GAKG;AACH,MAAM,UAAU,2BAA2B,CAAC,MAAiB;IAC3D,MAAM,CAAC,YAAY,CACjB,kBAAkB,EAClB;QACE,WAAW,EACT,sEAAsE;YACtE,wEAAwE;YACxE,uEAAuE;YACvE,kEAAkE;YAClE,wEAAwE;YACxE,iEAAiE;YACjE,4DAA4D;QAC9D,WAAW,EAAE,yBAAyB;KACvC,EACD,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE;QACpB,MAAM,KAAK,GAAG,mBAAmB,CAAC,IAAI,CAAC,CAAA;QACvC,OAAO,iBAAiB,CACtB;YACE,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,yBAAyB,CAAC,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC;YACzD,GAAG,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAC1C,EACD,KAAK,CACN,CAAA;IACH,CAAC,CACF,CAAA;AACH,CAAC"}
|
|
@@ -22,8 +22,13 @@ export const ROUNDING_MODES = [
|
|
|
22
22
|
'CEIL',
|
|
23
23
|
'TRUNCATE',
|
|
24
24
|
];
|
|
25
|
-
/** Shape of a single fee item's structure (
|
|
26
|
-
export const FEE_STRUCTURE_TYPES = [
|
|
25
|
+
/** Shape of a single fee item's structure (spec enum). */
|
|
26
|
+
export const FEE_STRUCTURE_TYPES = [
|
|
27
|
+
'FLAT',
|
|
28
|
+
'PERCENTAGE',
|
|
29
|
+
'TIERED',
|
|
30
|
+
'EXPRESSION',
|
|
31
|
+
];
|
|
27
32
|
/**
|
|
28
33
|
* One fee item. Typed-but-permissive: the named fields mirror the spec's
|
|
29
34
|
* CreateFeeScheduleItemRequest, but `structure` is left as an open record
|
|
@@ -38,19 +43,25 @@ export const feeScheduleItemShape = z
|
|
|
38
43
|
priority: z
|
|
39
44
|
.number()
|
|
40
45
|
.int()
|
|
41
|
-
.optional()
|
|
42
46
|
.describe('Application order within the schedule (relevant for CASCADING ' +
|
|
43
|
-
'applicationOrder); lower runs first.'
|
|
47
|
+
'applicationOrder); lower runs first. Required — the backend rejects ' +
|
|
48
|
+
'an item without it (422 "expected required property priority").'),
|
|
44
49
|
structureType: z
|
|
45
50
|
.enum(FEE_STRUCTURE_TYPES)
|
|
46
51
|
.describe('Shape of the fee structure. FLAT is a fixed amount; PERCENTAGE is a ' +
|
|
47
|
-
'rate of the base; TIERED applies different rates per amount tier
|
|
52
|
+
'rate of the base; TIERED applies different rates per amount tier; ' +
|
|
53
|
+
'EXPRESSION computes the fee from a bounded arithmetic formula over ' +
|
|
54
|
+
'transaction metadata.'),
|
|
48
55
|
structure: z
|
|
49
56
|
.record(z.string(), z.unknown())
|
|
50
57
|
.describe('Type-specific structure object. FLAT: {"amount":"1.50"}. PERCENTAGE: ' +
|
|
51
58
|
'{"rate":"0.029"} where rate is a 0..1 fraction (0.029 = 2.9%), not a ' +
|
|
52
59
|
'percent value. TIERED: {"tiers":[{"rate":"0.01","upTo":"1000"},...]} ' +
|
|
53
|
-
'with the same 0..1 fraction semantics per tier rate.'
|
|
60
|
+
'with the same 0..1 fraction semantics per tier rate. EXPRESSION: ' +
|
|
61
|
+
'{"expression":"gross - desconto + multa + juros_dia * ' +
|
|
62
|
+
'days_late(due_date, pay_date)"} — a bounded formula over metadata ' +
|
|
63
|
+
'fields (operators + - * /, parentheses, and functions days_late, ' +
|
|
64
|
+
'days_between, max, min, abs, clamp).'),
|
|
54
65
|
})
|
|
55
66
|
.describe('A single fee item making up the schedule.');
|
|
56
67
|
/** Zod raw shape for `fee_schedule_create` input — mirrors CreateFeeScheduleRequest. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.js","sourceRoot":"","sources":["../../../src/tools/fee-schedule/create.ts"],"names":[],"mappings":"AAAA,0DAA0D;AAC1D,EAAE;AACF,iFAAiF;AACjF,8EAA8E;AAC9E,4EAA4E;AAC5E,4EAA4E;AAC5E,2EAA2E;AAC3E,+EAA+E;AAC/E,+DAA+D;AAC/D,EAAE;AACF,+EAA+E;AAC/E,iEAAiE;AAEjE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAErE,2DAA2D;AAC3D,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,UAAU,EAAE,WAAW,CAAU,CAAA;AAEpE,4DAA4D;AAC5D,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,SAAS;IACT,SAAS;IACT,OAAO;IACP,MAAM;IACN,UAAU;CACF,CAAA;AAEV,
|
|
1
|
+
{"version":3,"file":"create.js","sourceRoot":"","sources":["../../../src/tools/fee-schedule/create.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
// `field_map_create` — curated POST
|
|
2
|
+
// /v1/contexts/{contextId}/sources/{sourceId}/field-maps.
|
|
3
|
+
//
|
|
4
|
+
// A typed front door to creating a field map for a source, mirroring the
|
|
5
|
+
// spec's CreateFieldMapRequest. `mapping` is left an open record (per the
|
|
6
|
+
// established pattern) — its KEYS form a closed vocabulary matcher validates
|
|
7
|
+
// server-side — but its description teaches that vocabulary faithfully
|
|
8
|
+
// (shared.ts MAPPING_DESCRIPTION) so an operator-driving LLM does not have to
|
|
9
|
+
// discover it by triggering a 400.
|
|
10
|
+
//
|
|
11
|
+
// Both contextId and sourceId are path params; no tenant field is accepted
|
|
12
|
+
// (matcher scopes to the relayed token's tenant).
|
|
13
|
+
import { z } from 'zod';
|
|
14
|
+
import { dispatchFieldMap, MAPPING_DESCRIPTION, sourceFieldMapPath } from './shared.js';
|
|
15
|
+
/** Zod raw shape for `field_map_create` input — path ids + mapping body. */
|
|
16
|
+
export const createFieldMapInputShape = {
|
|
17
|
+
contextId: z
|
|
18
|
+
.string()
|
|
19
|
+
.min(1)
|
|
20
|
+
.describe('The reconciliation context id (UUID) the source belongs to. Routing ' +
|
|
21
|
+
'path param, not a tenant field.'),
|
|
22
|
+
sourceId: z
|
|
23
|
+
.string()
|
|
24
|
+
.min(1)
|
|
25
|
+
.describe('The reconciliation source id (UUID) this field map maps.'),
|
|
26
|
+
mapping: z.record(z.string(), z.unknown()).describe(MAPPING_DESCRIPTION),
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Build the POST body from the input minus the path-only ids. Only the
|
|
30
|
+
* CreateFieldMapRequest field (`mapping`) is sent; contextId/sourceId travel
|
|
31
|
+
* in the path.
|
|
32
|
+
*/
|
|
33
|
+
export function buildCreateFieldMapBody(args) {
|
|
34
|
+
return { mapping: args.mapping };
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Register `field_map_create`. Substitutes both ids into the path, builds the
|
|
38
|
+
* body from `mapping`, and dispatches a POST through the shared fail-closed
|
|
39
|
+
* relay; a matcher error (e.g. 400 on an invalid mapping) surfaces via the
|
|
40
|
+
* shared toToolError.
|
|
41
|
+
*/
|
|
42
|
+
export function registerFieldMapCreateTool(server) {
|
|
43
|
+
server.registerTool('field_map_create', {
|
|
44
|
+
description: 'Create a field map for a source within a context — binds the ' +
|
|
45
|
+
"source's raw column names to matcher's canonical reconciliation " +
|
|
46
|
+
'vocabulary. Provide contextId, sourceId (UUID path params — neither ' +
|
|
47
|
+
'is a tenant field), and mapping (see field description for the ' +
|
|
48
|
+
'required/optional keys and the critical external_id join-key rule). ' +
|
|
49
|
+
"A source must be mapped (or be self-mapping, e.g. camt053) before a " +
|
|
50
|
+
'context can be activated — see context_setup_progress to check ' +
|
|
51
|
+
'readiness. Returns the created field map, or a structured RFC 9457 ' +
|
|
52
|
+
'error naming every invalid/missing/unknown key.',
|
|
53
|
+
inputSchema: createFieldMapInputShape,
|
|
54
|
+
}, async (args, extra) => {
|
|
55
|
+
return dispatchFieldMap({
|
|
56
|
+
method: 'POST',
|
|
57
|
+
path: sourceFieldMapPath(args.contextId, args.sourceId),
|
|
58
|
+
body: buildCreateFieldMapBody(args),
|
|
59
|
+
}, extra);
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=create.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create.js","sourceRoot":"","sources":["../../../src/tools/field-map/create.ts"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,0DAA0D;AAC1D,EAAE;AACF,yEAAyE;AACzE,0EAA0E;AAC1E,6EAA6E;AAC7E,uEAAuE;AACvE,8EAA8E;AAC9E,mCAAmC;AACnC,EAAE;AACF,2EAA2E;AAC3E,kDAAkD;AAElD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAEvF,4EAA4E;AAC5E,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,SAAS,EAAE,CAAC;SACT,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,CACP,sEAAsE;QACpE,iCAAiC,CACpC;IACH,QAAQ,EAAE,CAAC;SACR,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,CAAC,0DAA0D,CAAC;IACvE,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,QAAQ,CAAC,mBAAmB,CAAC;CACzE,CAAA;AAOD;;;;GAIG;AACH,MAAM,UAAU,uBAAuB,CACrC,IAAyB;IAEzB,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,CAAA;AAClC,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,0BAA0B,CAAC,MAAiB;IAC1D,MAAM,CAAC,YAAY,CACjB,kBAAkB,EAClB;QACE,WAAW,EACT,+DAA+D;YAC/D,kEAAkE;YAClE,sEAAsE;YACtE,iEAAiE;YACjE,sEAAsE;YACtE,sEAAsE;YACtE,iEAAiE;YACjE,qEAAqE;YACrE,iDAAiD;QACnD,WAAW,EAAE,wBAAwB;KACtC,EACD,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE;QACpB,OAAO,gBAAgB,CACrB;YACE,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,kBAAkB,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,QAAQ,CAAC;YACvD,IAAI,EAAE,uBAAuB,CAAC,IAAI,CAAC;SACpC,EACD,KAAK,CACN,CAAA;IACH,CAAC,CACF,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// `field_map_delete` — curated DELETE /v1/field-maps/{fieldMapId}.
|
|
2
|
+
//
|
|
3
|
+
// Removes a field map by id. fieldMapId is a flat path param (the spec does
|
|
4
|
+
// not nest delete under context+source); no tenant field is accepted (matcher
|
|
5
|
+
// scopes to the relayed token's tenant). A 204 response surfaces as `null`
|
|
6
|
+
// (see dispatchFieldMap), matching the other curated families' delete
|
|
7
|
+
// behavior. Deleting a source's only field map will reopen the
|
|
8
|
+
// `field_maps` readiness gap reported by context_setup_progress.
|
|
9
|
+
import { z } from 'zod';
|
|
10
|
+
import { dispatchFieldMap, fieldMapPath } from './shared.js';
|
|
11
|
+
/** Zod raw shape for `field_map_delete` input — just the flat id. */
|
|
12
|
+
export const deleteFieldMapInputShape = {
|
|
13
|
+
fieldMapId: z
|
|
14
|
+
.string()
|
|
15
|
+
.min(1)
|
|
16
|
+
.describe('The field map id (UUID) to delete.'),
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Register `field_map_delete`. Substitutes the id into the path and dispatches
|
|
20
|
+
* a DELETE through the shared fail-closed relay; a matcher error surfaces via
|
|
21
|
+
* the shared toToolError.
|
|
22
|
+
*/
|
|
23
|
+
export function registerFieldMapDeleteTool(server) {
|
|
24
|
+
server.registerTool('field_map_delete', {
|
|
25
|
+
description: 'Delete a field map by id (UUID path param, not a tenant field). ' +
|
|
26
|
+
"Removing a source's only field map reopens the field_maps " +
|
|
27
|
+
'activation-readiness gap (see context_setup_progress) and an ACTIVE ' +
|
|
28
|
+
"context's matching/ingestion against that source will be affected. " +
|
|
29
|
+
'Returns null on success (204), or a structured RFC 9457 error.',
|
|
30
|
+
inputSchema: deleteFieldMapInputShape,
|
|
31
|
+
}, async (args, extra) => {
|
|
32
|
+
return dispatchFieldMap({ method: 'DELETE', path: fieldMapPath(args.fieldMapId) }, extra);
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=delete.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete.js","sourceRoot":"","sources":["../../../src/tools/field-map/delete.ts"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,2EAA2E;AAC3E,sEAAsE;AACtE,+DAA+D;AAC/D,iEAAiE;AAEjE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE5D,qEAAqE;AACrE,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,UAAU,EAAE,CAAC;SACV,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,CAAC,oCAAoC,CAAC;CAClD,CAAA;AAOD;;;;GAIG;AACH,MAAM,UAAU,0BAA0B,CAAC,MAAiB;IAC1D,MAAM,CAAC,YAAY,CACjB,kBAAkB,EAClB;QACE,WAAW,EACT,kEAAkE;YAClE,4DAA4D;YAC5D,sEAAsE;YACtE,qEAAqE;YACrE,gEAAgE;QAClE,WAAW,EAAE,wBAAwB;KACtC,EACD,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE;QACpB,OAAO,gBAAgB,CACrB,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,EACzD,KAAK,CACN,CAAA;IACH,CAAC,CACF,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// `field_map_get` — curated GET
|
|
2
|
+
// /v1/contexts/{contextId}/sources/{sourceId}/field-maps.
|
|
3
|
+
//
|
|
4
|
+
// Reads the field map bound to one source (getFieldMapBySource in the spec —
|
|
5
|
+
// a source has at most one field map, so this is a singular fetch, not a
|
|
6
|
+
// list). Both contextId and sourceId are path params; the source must belong
|
|
7
|
+
// to a context owned by the relayed token's tenant — matcher enforces that;
|
|
8
|
+
// no tenant field is accepted.
|
|
9
|
+
import { z } from 'zod';
|
|
10
|
+
import { dispatchFieldMap, sourceFieldMapPath } from './shared.js';
|
|
11
|
+
/** Zod raw shape for `field_map_get` input — both path ids. */
|
|
12
|
+
export const getFieldMapInputShape = {
|
|
13
|
+
contextId: z
|
|
14
|
+
.string()
|
|
15
|
+
.min(1)
|
|
16
|
+
.describe('The reconciliation context id (UUID). Routing path param, not a tenant ' +
|
|
17
|
+
'field.'),
|
|
18
|
+
sourceId: z
|
|
19
|
+
.string()
|
|
20
|
+
.min(1)
|
|
21
|
+
.describe('The reconciliation source id (UUID) whose field map to fetch.'),
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Register `field_map_get`. Substitutes both ids into the path and dispatches
|
|
25
|
+
* a GET through the shared fail-closed relay; a matcher error (e.g. 404 when
|
|
26
|
+
* the source has no field map yet) surfaces via the shared toToolError.
|
|
27
|
+
*/
|
|
28
|
+
export function registerFieldMapGetTool(server) {
|
|
29
|
+
server.registerTool('field_map_get', {
|
|
30
|
+
description: 'Fetch the field map bound to a source (a source has at most one). ' +
|
|
31
|
+
'Provide both contextId and sourceId (UUID path params; contextId is ' +
|
|
32
|
+
"not a tenant field). The source must belong to your token's tenant. " +
|
|
33
|
+
'Returns the field map, or a structured RFC 9457 error (e.g. 404 if ' +
|
|
34
|
+
'the source has no field map yet).',
|
|
35
|
+
inputSchema: getFieldMapInputShape,
|
|
36
|
+
}, async (args, extra) => {
|
|
37
|
+
return dispatchFieldMap({
|
|
38
|
+
method: 'GET',
|
|
39
|
+
path: sourceFieldMapPath(args.contextId, args.sourceId),
|
|
40
|
+
}, extra);
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=get.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get.js","sourceRoot":"","sources":["../../../src/tools/field-map/get.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,0DAA0D;AAC1D,EAAE;AACF,6EAA6E;AAC7E,yEAAyE;AACzE,6EAA6E;AAC7E,4EAA4E;AAC5E,+BAA+B;AAE/B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAElE,+DAA+D;AAC/D,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,SAAS,EAAE,CAAC;SACT,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,CACP,yEAAyE;QACvE,QAAQ,CACX;IACH,QAAQ,EAAE,CAAC;SACR,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,CAAC,+DAA+D,CAAC;CAC7E,CAAA;AAKD;;;;GAIG;AACH,MAAM,UAAU,uBAAuB,CAAC,MAAiB;IACvD,MAAM,CAAC,YAAY,CACjB,eAAe,EACf;QACE,WAAW,EACT,oEAAoE;YACpE,sEAAsE;YACtE,sEAAsE;YACtE,qEAAqE;YACrE,mCAAmC;QACrC,WAAW,EAAE,qBAAqB;KACnC,EACD,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE;QACpB,OAAO,gBAAgB,CACrB;YACE,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,kBAAkB,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,QAAQ,CAAC;SACxD,EACD,KAAK,CACN,CAAA;IACH,CAAC,CACF,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// Curated field-map vertical: five typed tools over the matcher field-map
|
|
2
|
+
// resource — create, list, get, update, delete. Field maps bind a source's
|
|
3
|
+
// raw column names to matcher's canonical reconciliation vocabulary and gate
|
|
4
|
+
// context activation (the `field_maps` readiness slug — see
|
|
5
|
+
// context_setup_progress). Closes findings N3 (field-map shape undiscoverable)
|
|
6
|
+
// and N4/F6 (createFieldMap generic-only, ingestion read/write asymmetry):
|
|
7
|
+
// before this family, all five operations were UNCOVERED (neither curated nor
|
|
8
|
+
// generic-only).
|
|
9
|
+
//
|
|
10
|
+
// Path shape is mixed, unlike sources: create/get are source-nested
|
|
11
|
+
// (/v1/contexts/{contextId}/sources/{sourceId}/field-maps), list is
|
|
12
|
+
// context-nested (/v1/contexts/{contextId}/field-maps), and update/delete are
|
|
13
|
+
// flat (/v1/field-maps/{fieldMapId}) — the spec does not nest them under
|
|
14
|
+
// context+source. Each tool shares the fail-closed relay (shared.ts) and the
|
|
15
|
+
// RFC 9457 → tool-error mapping (toToolError) with the generic surface, so
|
|
16
|
+
// curated and generic map matcher errors identically. No tool carries a
|
|
17
|
+
// tenant field.
|
|
18
|
+
import { registerFieldMapCreateTool } from './create.js';
|
|
19
|
+
import { registerFieldMapDeleteTool } from './delete.js';
|
|
20
|
+
import { registerFieldMapGetTool } from './get.js';
|
|
21
|
+
import { registerFieldMapListTool } from './list.js';
|
|
22
|
+
import { registerFieldMapUpdateTool } from './update.js';
|
|
23
|
+
/** Register all five curated field-map tools on the given server. */
|
|
24
|
+
export function registerFieldMapTools(server) {
|
|
25
|
+
registerFieldMapCreateTool(server);
|
|
26
|
+
registerFieldMapListTool(server);
|
|
27
|
+
registerFieldMapGetTool(server);
|
|
28
|
+
registerFieldMapUpdateTool(server);
|
|
29
|
+
registerFieldMapDeleteTool(server);
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tools/field-map/index.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,2EAA2E;AAC3E,6EAA6E;AAC7E,4DAA4D;AAC5D,+EAA+E;AAC/E,2EAA2E;AAC3E,8EAA8E;AAC9E,iBAAiB;AACjB,EAAE;AACF,oEAAoE;AACpE,oEAAoE;AACpE,8EAA8E;AAC9E,yEAAyE;AACzE,6EAA6E;AAC7E,2EAA2E;AAC3E,wEAAwE;AACxE,gBAAgB;AAIhB,OAAO,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAA;AACxD,OAAO,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAA;AACxD,OAAO,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAA;AAClD,OAAO,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAA;AACpD,OAAO,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAA;AAExD,qEAAqE;AACrE,MAAM,UAAU,qBAAqB,CAAC,MAAiB;IACrD,0BAA0B,CAAC,MAAM,CAAC,CAAA;IAClC,wBAAwB,CAAC,MAAM,CAAC,CAAA;IAChC,uBAAuB,CAAC,MAAM,CAAC,CAAA;IAC/B,0BAA0B,CAAC,MAAM,CAAC,CAAA;IAClC,0BAA0B,CAAC,MAAM,CAAC,CAAA;AACpC,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
// `field_map_list` — curated GET /v1/contexts/{contextId}/field-maps.
|
|
2
|
+
//
|
|
3
|
+
// Cursor-paginated list of every field map under a context (listContextFieldMaps
|
|
4
|
+
// in the spec) — replaces per-source probing via field_map_get. limit/cursor
|
|
5
|
+
// pass through untouched and matcher's { items, nextCursor, ... } envelope is
|
|
6
|
+
// returned as-is — no auto-pagination (the model re-calls with the returned
|
|
7
|
+
// cursor). contextId is a routing path param, not a tenant field; no tenant
|
|
8
|
+
// field is accepted.
|
|
9
|
+
import { z } from 'zod';
|
|
10
|
+
import { contextFieldMapsPath, dispatchFieldMap } from './shared.js';
|
|
11
|
+
/** Zod raw shape for `field_map_list` input — contextId path + pagination. */
|
|
12
|
+
export const listFieldMapsInputShape = {
|
|
13
|
+
contextId: z
|
|
14
|
+
.string()
|
|
15
|
+
.min(1)
|
|
16
|
+
.describe('The reconciliation context id (UUID) whose field maps to list. Routing ' +
|
|
17
|
+
'path param, not a tenant field.'),
|
|
18
|
+
limit: z
|
|
19
|
+
.number()
|
|
20
|
+
.int()
|
|
21
|
+
.min(1)
|
|
22
|
+
.max(200)
|
|
23
|
+
.optional()
|
|
24
|
+
.describe('Maximum number of records to return (1–200, default 20).'),
|
|
25
|
+
cursor: z
|
|
26
|
+
.string()
|
|
27
|
+
.optional()
|
|
28
|
+
.describe('Opaque pagination cursor from a prior response. Re-call with the ' +
|
|
29
|
+
'returned nextCursor to page forward (there is no auto-pagination).'),
|
|
30
|
+
};
|
|
31
|
+
/** Build the list query, omitting unset knobs so the request stays minimal. */
|
|
32
|
+
function buildListQuery(args) {
|
|
33
|
+
const query = {};
|
|
34
|
+
if (args.limit !== undefined) {
|
|
35
|
+
query.limit = args.limit;
|
|
36
|
+
}
|
|
37
|
+
if (args.cursor !== undefined) {
|
|
38
|
+
query.cursor = args.cursor;
|
|
39
|
+
}
|
|
40
|
+
return Object.keys(query).length > 0 ? query : undefined;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Register `field_map_list`. Passes limit/cursor through and returns matcher's
|
|
44
|
+
* pagination envelope verbatim; a matcher error surfaces via the shared
|
|
45
|
+
* toToolError.
|
|
46
|
+
*/
|
|
47
|
+
export function registerFieldMapListTool(server) {
|
|
48
|
+
server.registerTool('field_map_list', {
|
|
49
|
+
description: 'List every field map under a context (cursor-paginated) — replaces ' +
|
|
50
|
+
'probing field_map_get per source. Pass contextId (UUID path param — ' +
|
|
51
|
+
'not a tenant field), and optionally limit (1–200) and/or cursor. The ' +
|
|
52
|
+
'response carries { items, nextCursor } — paginate by re-calling with ' +
|
|
53
|
+
'the returned nextCursor. No tenant field is accepted.',
|
|
54
|
+
inputSchema: listFieldMapsInputShape,
|
|
55
|
+
}, async (args, extra) => {
|
|
56
|
+
const query = buildListQuery(args);
|
|
57
|
+
return dispatchFieldMap({
|
|
58
|
+
method: 'GET',
|
|
59
|
+
path: contextFieldMapsPath(args.contextId),
|
|
60
|
+
...(query !== undefined ? { query } : {}),
|
|
61
|
+
}, extra);
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../../src/tools/field-map/list.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,EAAE;AACF,iFAAiF;AACjF,6EAA6E;AAC7E,8EAA8E;AAC9E,4EAA4E;AAC5E,4EAA4E;AAC5E,qBAAqB;AAErB,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAKvB,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAEpE,8EAA8E;AAC9E,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,SAAS,EAAE,CAAC;SACT,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,CACP,yEAAyE;QACvE,iCAAiC,CACpC;IACH,KAAK,EAAE,CAAC;SACL,MAAM,EAAE;SACR,GAAG,EAAE;SACL,GAAG,CAAC,CAAC,CAAC;SACN,GAAG,CAAC,GAAG,CAAC;SACR,QAAQ,EAAE;SACV,QAAQ,CAAC,0DAA0D,CAAC;IACvE,MAAM,EAAE,CAAC;SACN,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CACP,mEAAmE;QACjE,oEAAoE,CACvE;CACJ,CAAA;AAOD,+EAA+E;AAC/E,SAAS,cAAc,CAAC,IAAwB;IAC9C,MAAM,KAAK,GAAoC,EAAE,CAAA;IACjD,IAAI,IAAI,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;QAC7B,KAAK,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAA;IAC1B,CAAC;IACD,IAAI,IAAI,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;QAC9B,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAA;IAC5B,CAAC;IACD,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAA;AAC1D,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,wBAAwB,CAAC,MAAiB;IACxD,MAAM,CAAC,YAAY,CACjB,gBAAgB,EAChB;QACE,WAAW,EACT,qEAAqE;YACrE,sEAAsE;YACtE,uEAAuE;YACvE,uEAAuE;YACvE,uDAAuD;QACzD,WAAW,EAAE,uBAAuB;KACrC,EACD,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE;QACpB,MAAM,KAAK,GAAG,cAAc,CAAC,IAAI,CAAC,CAAA;QAClC,OAAO,gBAAgB,CACrB;YACE,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,oBAAoB,CAAC,IAAI,CAAC,SAAS,CAAC;YAC1C,GAAG,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAC1C,EACD,KAAK,CACN,CAAA;IACH,CAAC,CACF,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
// Shared plumbing for the curated field-map tools.
|
|
2
|
+
//
|
|
3
|
+
// A field map binds a source's raw column names to matcher's canonical
|
|
4
|
+
// reconciliation vocabulary. Like sources, field-map single-resource ops are
|
|
5
|
+
// reached two different ways: create/get hang off
|
|
6
|
+
// /v1/contexts/{contextId}/sources/{sourceId}/field-maps (source-nested),
|
|
7
|
+
// list hangs off /v1/contexts/{contextId}/field-maps (context-nested), and
|
|
8
|
+
// update/delete hang off /v1/field-maps/{fieldMapId} (flat — the spec does not
|
|
9
|
+
// nest them under context+source). This module factors all three path
|
|
10
|
+
// helpers plus the relay boilerplate exactly once so the five tools stay thin
|
|
11
|
+
// and so curated + generic surfaces map matcher errors through the identical
|
|
12
|
+
// path (toToolError).
|
|
13
|
+
//
|
|
14
|
+
// Security: the bearer token is never read here directly — requireMatcherClient
|
|
15
|
+
// owns the request-scoped relay and fails closed when no usable credential was
|
|
16
|
+
// provided. contextId/sourceId/fieldMapId are routing identifiers (matcher
|
|
17
|
+
// validates ownership against the relayed token's tenant); no field-map tool
|
|
18
|
+
// input carries a tenant field.
|
|
19
|
+
import { requireMatcherClient, UnauthenticatedError, } from '../../auth/request-token.js';
|
|
20
|
+
import { isMatcherApiError, toToolError } from '../tool-error.js';
|
|
21
|
+
/** Build the context-scoped field-maps collection path (list). */
|
|
22
|
+
export function contextFieldMapsPath(contextId) {
|
|
23
|
+
return `/v1/contexts/${encodeURIComponent(contextId)}/field-maps`;
|
|
24
|
+
}
|
|
25
|
+
/** Build the source-nested field-map path (create/get). */
|
|
26
|
+
export function sourceFieldMapPath(contextId, sourceId) {
|
|
27
|
+
return `/v1/contexts/${encodeURIComponent(contextId)}/sources/${encodeURIComponent(sourceId)}/field-maps`;
|
|
28
|
+
}
|
|
29
|
+
/** Build the flat single-field-map path (update/delete). */
|
|
30
|
+
export function fieldMapPath(fieldMapId) {
|
|
31
|
+
return `/v1/field-maps/${encodeURIComponent(fieldMapId)}`;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Run one assembled request through the relay: fail-closed auth, dispatch, and
|
|
35
|
+
* RFC 9457 → tool-error mapping — identical to the generic invoke's dispatch so
|
|
36
|
+
* both surfaces produce the same structured error shape.
|
|
37
|
+
*
|
|
38
|
+
* `clientFor` is injectable for tests; production callers pass nothing and get
|
|
39
|
+
* the request-scoped, fail-closed `requireMatcherClient`.
|
|
40
|
+
*/
|
|
41
|
+
export async function dispatchFieldMap(request, extra, clientFor = requireMatcherClient) {
|
|
42
|
+
let client;
|
|
43
|
+
try {
|
|
44
|
+
// Fail-closed on a missing / empty / non-Bearer credential.
|
|
45
|
+
client = clientFor(extra);
|
|
46
|
+
}
|
|
47
|
+
catch (err) {
|
|
48
|
+
if (err instanceof UnauthenticatedError) {
|
|
49
|
+
return { isError: true, content: [{ type: 'text', text: err.message }] };
|
|
50
|
+
}
|
|
51
|
+
throw err;
|
|
52
|
+
}
|
|
53
|
+
try {
|
|
54
|
+
const result = await client.request(request);
|
|
55
|
+
// Success → matcher's JSON returned as-is (incl. pagination envelopes and
|
|
56
|
+
// 204 → null for delete).
|
|
57
|
+
return { content: [{ type: 'text', text: JSON.stringify(result ?? null) }] };
|
|
58
|
+
}
|
|
59
|
+
catch (err) {
|
|
60
|
+
// RFC 9457 problem → the SHARED structured tool error (status/title/detail/
|
|
61
|
+
// code preserved). A non-matcher error is a bug, not a matcher failure, and
|
|
62
|
+
// is re-thrown rather than masqueraded as one.
|
|
63
|
+
if (isMatcherApiError(err)) {
|
|
64
|
+
return toToolError(err);
|
|
65
|
+
}
|
|
66
|
+
throw err;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Canonical field-map mapping vocabulary — mirrors the matcher backend's
|
|
71
|
+
* single authority (internal/shared/domain/field_map.go:42-52), shared there
|
|
72
|
+
* by the Configuration and Ingestion contexts so the two never drift. The key
|
|
73
|
+
* space is CLOSED: mapping VALUES name arbitrary source columns, but KEYS are
|
|
74
|
+
* fixed to this list.
|
|
75
|
+
*/
|
|
76
|
+
export const REQUIRED_MAPPING_KEYS = [
|
|
77
|
+
'external_id',
|
|
78
|
+
'amount',
|
|
79
|
+
'currency',
|
|
80
|
+
'date',
|
|
81
|
+
];
|
|
82
|
+
/** Optional canonical keys a field map MAY declare, in addition to the required ones. */
|
|
83
|
+
export const OPTIONAL_MAPPING_KEYS = [
|
|
84
|
+
'description',
|
|
85
|
+
'fee_amount',
|
|
86
|
+
'fee_currency',
|
|
87
|
+
];
|
|
88
|
+
/**
|
|
89
|
+
* The mapping description shared by `field_map_create` and `field_map_update`
|
|
90
|
+
* so the canonical shape — and its single most common failure mode — is
|
|
91
|
+
* taught identically wherever a mapping body is accepted.
|
|
92
|
+
*
|
|
93
|
+
* `external_id` is called out explicitly: the matching engine joins the two
|
|
94
|
+
* sides of a reconciliation by comparing `external_id` across LEFT and RIGHT.
|
|
95
|
+
* It MUST carry the cross-side join key (e.g. the bank reference / ledger
|
|
96
|
+
* transaction id that BOTH sides agree on) — never a side-local primary key.
|
|
97
|
+
* Mapping a side-local id into `external_id` silently imports rows that can
|
|
98
|
+
* never match anything on the other side; this is the single most common
|
|
99
|
+
* setup mistake and produces no error, just permanent unmatched exceptions.
|
|
100
|
+
*/
|
|
101
|
+
export const MAPPING_DESCRIPTION = 'Field-to-column mapping (open object; keys form a CLOSED canonical ' +
|
|
102
|
+
'vocabulary, values are this source\'s raw column names as non-empty ' +
|
|
103
|
+
'strings). Required keys: external_id, amount, currency, date. Optional ' +
|
|
104
|
+
'keys: description, fee_amount, fee_currency (fee_amount/fee_currency feed ' +
|
|
105
|
+
"fee verification when this source's column carries a per-row fee). " +
|
|
106
|
+
'CRITICAL: external_id MUST be the CROSS-SIDE JOIN KEY — the matching ' +
|
|
107
|
+
"engine compares external_id across LEFT and RIGHT sources, so it has to " +
|
|
108
|
+
'be a value BOTH sides agree on (e.g. a shared bank reference or ledger ' +
|
|
109
|
+
'transaction id), never a side-local row id / primary key. Mapping a ' +
|
|
110
|
+
'side-local id into external_id imports rows that can never match the ' +
|
|
111
|
+
'other side — no error is raised, the rows just sit as permanent unmatched ' +
|
|
112
|
+
'exceptions. Any key outside the vocabulary, a missing required key, or a ' +
|
|
113
|
+
'non-string/empty value is rejected by matcher with every offender named.';
|
|
114
|
+
//# sourceMappingURL=shared.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../../../src/tools/field-map/shared.ts"],"names":[],"mappings":"AAAA,mDAAmD;AACnD,EAAE;AACF,uEAAuE;AACvE,6EAA6E;AAC7E,kDAAkD;AAClD,0EAA0E;AAC1E,2EAA2E;AAC3E,+EAA+E;AAC/E,sEAAsE;AACtE,8EAA8E;AAC9E,6EAA6E;AAC7E,sBAAsB;AACtB,EAAE;AACF,gFAAgF;AAChF,+EAA+E;AAC/E,2EAA2E;AAC3E,6EAA6E;AAC7E,gCAAgC;AAIhC,OAAO,EACL,oBAAoB,EACpB,oBAAoB,GAErB,MAAM,6BAA6B,CAAA;AAEpC,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAEjE,kEAAkE;AAClE,MAAM,UAAU,oBAAoB,CAAC,SAAiB;IACpD,OAAO,gBAAgB,kBAAkB,CAAC,SAAS,CAAC,aAAa,CAAA;AACnE,CAAC;AAED,2DAA2D;AAC3D,MAAM,UAAU,kBAAkB,CAAC,SAAiB,EAAE,QAAgB;IACpE,OAAO,gBAAgB,kBAAkB,CAAC,SAAS,CAAC,YAAY,kBAAkB,CAAC,QAAQ,CAAC,aAAa,CAAA;AAC3G,CAAC;AAED,4DAA4D;AAC5D,MAAM,UAAU,YAAY,CAAC,UAAkB;IAC7C,OAAO,kBAAkB,kBAAkB,CAAC,UAAU,CAAC,EAAE,CAAA;AAC3D,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,OAAuB,EACvB,KAAmC,EACnC,YAAyD,oBAAoB;IAE7E,IAAI,MAAqB,CAAA;IACzB,IAAI,CAAC;QACH,4DAA4D;QAC5D,MAAM,GAAG,SAAS,CAAC,KAAK,CAAC,CAAA;IAC3B,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAI,GAAG,YAAY,oBAAoB,EAAE,CAAC;YACxC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,CAAC,OAAO,EAAE,CAAC,EAAE,CAAA;QAC1E,CAAC;QACD,MAAM,GAAG,CAAA;IACX,CAAC;IAED,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;QAC5C,0EAA0E;QAC1E,0BAA0B;QAC1B,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,IAAI,IAAI,CAAC,EAAE,CAAC,EAAE,CAAA;IAC9E,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,4EAA4E;QAC5E,4EAA4E;QAC5E,+CAA+C;QAC/C,IAAI,iBAAiB,CAAC,GAAG,CAAC,EAAE,CAAC;YAC3B,OAAO,WAAW,CAAC,GAAG,CAAC,CAAA;QACzB,CAAC;QACD,MAAM,GAAG,CAAA;IACX,CAAC;AACH,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,aAAa;IACb,QAAQ;IACR,UAAU;IACV,MAAM;CACE,CAAA;AAEV,yFAAyF;AACzF,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,aAAa;IACb,YAAY;IACZ,cAAc;CACN,CAAA;AAEV;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAC9B,qEAAqE;IACrE,sEAAsE;IACtE,yEAAyE;IACzE,4EAA4E;IAC5E,qEAAqE;IACrE,uEAAuE;IACvE,0EAA0E;IAC1E,yEAAyE;IACzE,sEAAsE;IACtE,uEAAuE;IACvE,4EAA4E;IAC5E,2EAA2E;IAC3E,0EAA0E,CAAA"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// `field_map_update` — curated PATCH /v1/field-maps/{fieldMapId}.
|
|
2
|
+
//
|
|
3
|
+
// Replaces a field map's mapping by id, mirroring the spec's
|
|
4
|
+
// UpdateFieldMapRequest. Unlike context/source updates, the spec's
|
|
5
|
+
// UpdateFieldMapRequest carries only `mapping` (no other field is
|
|
6
|
+
// independently patchable), so this tool's body is not optional-everything —
|
|
7
|
+
// `mapping` is required, same vocabulary as create. fieldMapId is a flat path
|
|
8
|
+
// param (the spec does not nest update under context+source); no tenant field
|
|
9
|
+
// is accepted (matcher scopes to the relayed token's tenant).
|
|
10
|
+
import { z } from 'zod';
|
|
11
|
+
import { dispatchFieldMap, fieldMapPath, MAPPING_DESCRIPTION } from './shared.js';
|
|
12
|
+
/** Zod raw shape for `field_map_update` input — flat id + mapping body. */
|
|
13
|
+
export const updateFieldMapInputShape = {
|
|
14
|
+
fieldMapId: z
|
|
15
|
+
.string()
|
|
16
|
+
.min(1)
|
|
17
|
+
.describe('The field map id (UUID) to update.'),
|
|
18
|
+
mapping: z.record(z.string(), z.unknown()).describe(MAPPING_DESCRIPTION),
|
|
19
|
+
};
|
|
20
|
+
/** Build the PATCH body from the input minus the path-only `fieldMapId`. */
|
|
21
|
+
export function buildUpdateFieldMapBody(args) {
|
|
22
|
+
return { mapping: args.mapping };
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Register `field_map_update`. Substitutes the id into the path and dispatches
|
|
26
|
+
* a PATCH through the shared fail-closed relay; a matcher error surfaces via
|
|
27
|
+
* the shared toToolError.
|
|
28
|
+
*/
|
|
29
|
+
export function registerFieldMapUpdateTool(server) {
|
|
30
|
+
server.registerTool('field_map_update', {
|
|
31
|
+
description: 'Replace the mapping of a field map by id (UUID path param, not a ' +
|
|
32
|
+
'tenant field). mapping is required (see field description for the ' +
|
|
33
|
+
'required/optional keys and the critical external_id join-key rule) ' +
|
|
34
|
+
'— this REPLACES the existing mapping, it is not a partial merge. ' +
|
|
35
|
+
'Returns the updated field map, or a structured RFC 9457 error naming ' +
|
|
36
|
+
'every invalid/missing/unknown key.',
|
|
37
|
+
inputSchema: updateFieldMapInputShape,
|
|
38
|
+
}, async (args, extra) => {
|
|
39
|
+
return dispatchFieldMap({
|
|
40
|
+
method: 'PATCH',
|
|
41
|
+
path: fieldMapPath(args.fieldMapId),
|
|
42
|
+
body: buildUpdateFieldMapBody(args),
|
|
43
|
+
}, extra);
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=update.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update.js","sourceRoot":"","sources":["../../../src/tools/field-map/update.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,EAAE;AACF,6DAA6D;AAC7D,mEAAmE;AACnE,kEAAkE;AAClE,6EAA6E;AAC7E,8EAA8E;AAC9E,8EAA8E;AAC9E,8DAA8D;AAE9D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA;AAEjF,2EAA2E;AAC3E,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,UAAU,EAAE,CAAC;SACV,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,CAAC,oCAAoC,CAAC;IACjD,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,QAAQ,CAAC,mBAAmB,CAAC;CACzE,CAAA;AAOD,4EAA4E;AAC5E,MAAM,UAAU,uBAAuB,CACrC,IAAyB;IAEzB,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,CAAA;AAClC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,0BAA0B,CAAC,MAAiB;IAC1D,MAAM,CAAC,YAAY,CACjB,kBAAkB,EAClB;QACE,WAAW,EACT,mEAAmE;YACnE,oEAAoE;YACpE,qEAAqE;YACrE,mEAAmE;YACnE,uEAAuE;YACvE,oCAAoC;QACtC,WAAW,EAAE,wBAAwB;KACtC,EACD,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE;QACpB,OAAO,gBAAgB,CACrB;YACE,MAAM,EAAE,OAAO;YACf,IAAI,EAAE,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC;YACnC,IAAI,EAAE,uBAAuB,CAAC,IAAI,CAAC;SACpC,EACD,KAAK,CACN,CAAA;IACH,CAAC,CACF,CAAA;AACH,CAAC"}
|