@proofkit/fmdapi
Version:
FileMaker Data API client
63 lines (62 loc) • 3.13 kB
TypeScript
import { CreateResponse, DeleteResponse, GetResponse, LayoutMetadataResponse, ScriptResponse, UpdateResponse } from '../client-types.js';
import { Adapter, CreateOptions, DeleteOptions, ExecuteScriptOptions, FindOptions, GetOptions, LayoutMetadataOptions, ListOptions, UpdateOptions } from './core.js';
export interface FmMcpAdapterOptions {
/** Base URL of the local FM MCP server (e.g. "http://localhost:3000") */
baseUrl: string;
/** Name of the connected FileMaker file */
connectedFileName: string;
/** Name of the FM script that executes Data API calls. Defaults to "PK_execute_data_api" */
scriptName?: string;
/** Session ID sent to the bridge. Defaults to FM_MCP_SESSION_ID or a random ID. */
sessionId?: string;
/** Client name shown in FileMaker authorization prompts. Defaults to FM_MCP_CLIENT_NAME or "ProofKit Typegen". */
clientName?: string;
/** Client description shown in FileMaker authorization prompts. */
clientDescription?: string;
/** Idle timeout requested for authorized sessions. Defaults to 3600 seconds. */
idleTimeoutSeconds?: number;
/** Timeout for /authorizeSession. Defaults to 125 seconds. */
authorizationTimeoutMs?: number;
/** If true, do not open FileMaker interactive authorization after a 401. */
disableInteractiveAuthorization?: boolean;
}
export declare class FmMcpAdapter implements Adapter {
protected baseUrl: string;
protected connectedFileName: string;
protected scriptName: string;
protected sessionId: string;
protected clientName: string;
protected clientDescription: string;
protected idleTimeoutSeconds: number;
protected authorizationTimeoutMs: number;
protected disableInteractiveAuthorization: boolean;
protected pendingAuthorization?: Promise<void>;
constructor(options: FmMcpAdapterOptions);
protected sessionHeaders: () => Headers;
protected ensureAuthorized: () => Promise<void>;
protected requestAuthorization: () => Promise<void>;
protected isUnauthorizedSession: (res: Response) => Promise<boolean>;
protected request: (params: {
layout: string;
body: object;
action?: "read" | "metaData" | "create" | "update" | "delete";
timeout?: number;
fetchOptions?: RequestInit;
}) => Promise<unknown>;
protected postCallScript: (params: {
data: string | undefined;
errorMessage: string;
fetchOptions?: RequestInit;
scriptName: string;
timeout?: number;
}) => Promise<Record<string, unknown>>;
list: (opts: ListOptions) => Promise<GetResponse>;
get: (opts: GetOptions) => Promise<GetResponse>;
find: (opts: FindOptions) => Promise<GetResponse>;
create: (opts: CreateOptions) => Promise<CreateResponse>;
update: (opts: UpdateOptions) => Promise<UpdateResponse>;
delete: (opts: DeleteOptions) => Promise<DeleteResponse>;
layoutMetadata: (opts: LayoutMetadataOptions) => Promise<LayoutMetadataResponse>;
executeScript: (opts: ExecuteScriptOptions) => Promise<ScriptResponse>;
containerUpload: () => Promise<never>;
}