JavaScript reference (@adk/fmdapi)
@adk/fmdapi is the client library Web Viewer applications use to communicate with FileMaker. It integrates three primary subsystems:
-
A Data API client (
DataApi) providing typed CRUD methods (find,get,list,create,update,delete) and runtime validation of field names. -
A Web Viewer bridge adapter (
WebViewerAdapter) that routes queries through FileMaker scripts rather than network requests, plusfmFetchandcallFMScriptfor calling FileMaker scripts directly and a command registry for FileMaker-to-JavaScript communication. -
A suite of agent skills that guide coding agents on proper library usage and transactional design.
Note Vendored dependency: @adk/fmdapi is not installed from the npm registry. Running adk app add vendors the library into your project at vendor/@adk/fmdapi as a shared copy across all workspace applications.
Because the library is vendored, pnpm install does not update it. Prompt your coding agent to update it when upgrading ADK. The library is committed project source, so updates appear in Git diffs.
The export surface
The package provides a root entry point and four subpath exports defined in vendor/@adk/fmdapi/package.json:
| Import path | Exported members |
|---|---|
@adk/fmdapi
|
Root exports: DataApi, WebViewerAdapter, fmFetch, callFMScript, FMScriptOption, globalSettings, FileMakerError, command-registry functions, and shared response types (GetResponse, CreateResponse, FieldMetaData). |
@adk/fmdapi/adapter
|
WebViewerAdapter, WebViewerAdapterOptions, and ExecuteScriptOptions for lightweight adapter imports. |
@adk/fmdapi/commands
|
Command registry functions: initWebViewerCommands, registerWebViewerCommand, unregisterWebViewerCommand, and getWebViewerCommandRegistry. |
@adk/fmdapi/react
|
useWebViewerCommand hook for React components. |
@adk/fmdapi/vite (aliased as @adk/fmdapi/vite-plugins) |
fmBridge() development plugin for Vite. |
Bundled agent skills
Vendored copies of @adk/fmdapi bundle agent skills alongside source files:
-
type-safe-data-api—Record CRUD operations with generated Typegen clients,DataApi, andWebViewerAdapter; TanStack Query integration; array return handling. -
webviewer-runtime—Runtime execution in Web Viewers and WebDirect,fmBridge()development forwarding, command registration, and initial prop hydration. -
script-actions—Executing FileMaker scripts withfmFetchandcallFMScript, script parameter envelopes, and multi-record transactional design.
Direct library usage
Typegen generates configured layout clients automatically. See Generate types with Typegen. Import library members directly when:
-
Calling custom FileMaker scripts for complex business logic, transactions, or navigation using
fmFetchorcallFMScript. -
Handling incoming calls from FileMaker using
registerWebViewerCommandoruseWebViewerCommand. -
Configuring browser dev-mode forwarding in
vite.config.tswithfmBridge(). -
Constructing manual
DataApiclients for dynamic layouts.
Related topics
-
Record methods and pagination—Full DataApi method reference.
-
WebViewerAdapter—Bridge routing, batching, and container uploads.
-
Script calls—Execute FileMaker scripts from JavaScript.
-
Web Viewer commands and React hooks—Handle FileMaker-to-JavaScript execution.
-
Validation and transformation—Schema validation with Zod.
-
Generate types with Typegen—Generate layout clients.