sh-mcp/packages/payments/src/index.ts

53 lines
1.4 KiB
TypeScript
Raw Normal View History

Phase 0b slice: monorepo scaffold + @sh-mcp/shared core + integration packages (#2) * Phase 0b slice: monorepo scaffold + shared core + integration packages The 0a-INDEPENDENT code slice (one-shot via af-0b-package-slice workflow: Haiku scaffold + Sonnet packages, Sonnet fix-to-green). Nothing deploys; no CDK/servers. - Monorepo scaffold: npm workspaces, strict TS (NodeNext), vitest (80% gate), eslint 9 flat config, prettier; ci.yaml/deploy.yaml callers (Node 24, enable-qemu). - @sh-mcp/shared: transport-agnostic core — Scope/AuthContext/ToolDef, ToolRegistry, redact()+maskValue() (PII), OpenAPI 3.1 generator. AUTH STUBBED behind an AuthProvider interface (TODO auth-layer-0a); JWT/aud/client_id/JWKS/deny-list deferred per design.md §2. - 9 integration packages (qbo, google-maps, internal-data, payments, knowledge-base, gmail, calendar, tasks, reminders): tools against shared, external deps mocked behind injected client interfaces; finance handlers call redact(). Verified green: tsc -b clean, vitest 245/245, eslint 0 errors. Auth mechanism intentionally deferred until the 0a spike resolves it (G16/§0.4). * Complete Cognito auth provider + Phase 1 build brief Finish the WIP CognitoAuthProvider (client_id allow-list as audience boundary, finance TTL ceiling, deny-list, scope-prefix stripping) with its test suite, and check in docs/build-plan-phase-1.md so the Phase 1 work has its governing brief in-tree (design.md §2.5). * ci: disable cdk synth for Phase 0b (no CDK app yet) The reusable ci-typescript-cdk workflow defaults run-cdk-synth: true, but the Phase 0b package scaffold has no cdk.json or stacks, so cdk synth fails with '--app is required'. Disable it here; Phase 1 re-enables it with the server CDK stubs.
2026-06-26 12:42:17 -04:00
/**
* @sh-mcp/payments public API
*
* Exports the payments tool factory functions and the tool array builder.
* The wire transport (OpenAPI / MCP) is generated from the registry; this
* package only defines tools.
*
* Usage:
* import { makePaymentsTools } from '@sh-mcp/payments';
* import { DynamoPaymentsClient } from '@sh-mcp/payments/client';
*
* const tools = makePaymentsTools(new DynamoPaymentsClient());
* // register tools with the server registry
*/
export type { PaymentsClient, Payment, PaymentsQueryOptions } from "./client.js";
export { DynamoPaymentsClient } from "./client.js";
export type {
LookupByVendorInput,
LookupByVendorOutput,
LookupByInvoiceInput,
LookupByInvoiceOutput,
LookupByCheckInput,
LookupByCheckOutput,
} from "./tools.js";
export {
makeLookupByVendorTool,
makeLookupByInvoiceTool,
makeLookupByCheckTool,
} from "./tools.js";
import type { PaymentsClient } from "./client.js";
import {
makeLookupByVendorTool,
makeLookupByInvoiceTool,
makeLookupByCheckTool,
} from "./tools.js";
/**
* Build the full payments tool array for a given client.
*
* @param client - A PaymentsClient implementation (real or mock).
* @returns Array of ToolDef objects ready for registration with the server.
*/
export function makePaymentsTools(client: PaymentsClient) {
return [
makeLookupByVendorTool(client),
makeLookupByInvoiceTool(client),
makeLookupByCheckTool(client),
] as const;
}