webviewer-integration
БесплатноБез исполняемых скриптовНе проверенwebviewer fmFetch callFMScript WebViewerAdapter globalSettings setWebViewerName SendCallback window.FileMaker browser-only FileMaker Web Viewer script…
от proofsh★ 21 звезда на GitHubОб этом скилле
Setup
This package assumes the user has already added specific layouts, scripts, etc into their FileMaker file. This is accomplished using a FileMaker add-on, downloaded during the setup process if the project was created using @proofkit/cli, but the user must still manually install the add-on in their FileMaker file.
To download the latest version of the add-on to the user's computer, run npx -y @proofkit/cli@beta add addon webviewer in any directory.
Install the package and set the webviewer name before calling any scripts.
import { fmFetch, globalSettings } from "@proofkit/webviewer";
// Must match the Layout Object Name of the Web Viewer in FileMaker
globalSettings.setWebViewerName("web");
// Call a FM script and await the result
const result = await fmFetch("MyScript", { key: "value" });
To generate @proofkit/fmdapi clients that work with WebViewerAdapter, run typegen with FM MCP mode enabled (see the typegen-fmdapi skill in @proofkit/fmdapi):
npx @proofkit/typegen@beta
The setWebViewerName call is required for fmFetch to work. It tells the FM SendCallback script which webviewer to call back into. Set it once at app initialization.
Core Patterns
fmFetch -- call script, await result
fmFetch calls a FileMaker script via window.FileMaker.PerformScript and returns a Promise that resolves when the FM script calls SendCallback with the matching fetchId.
import { fmFetch } from "@proofkit/webviewer";
// With type parameter (unsafe cast -- validate with zod if needed)
type Customer = { id: string; name: string };
const customer = await fmFetch<Customer>("GetCustomer", { id: "123" });
The FM script receives a JSON parameter with two keys:
data-- whatever you passed as the second argumentcallback-- object containingfetchId,fn, andwebViewerName
The FM script must extract callback, attach the result, and call SendCallback:
Set Variable [ $json ; Get(ScriptParameter) ]
Set Variable [ $callback ; JSONGetElement($json ; "callback") ]
Set Variable [ $data ; JSONGetElement($json ; "data") ]
# ... do work, build $result ...
Set Variable [ $callback ; JSONSetElement($callback ;
["result"; $result; JSONObject];
["webViewerName"; "web"; JSONString])
]
Perform Script [ "SendCallBack" ; $callback ]
callFMScript -- fire-and-forget
callFMScript calls a FileMaker script with no callback. Use when you don't need a return value.
import { callFMScript, FMScriptOption } from "@proofkit/webviewer";
// Basic call
callFMScript("NavigateToLayout", { layout: "Customers" });
// With script execution option
callFMScript("RunReport", { id: "42" }, FMScriptOption.HALT);
FMScriptOption values: CONTINUE ("0"), HALT ("1"), EXIT ("2"), RESUME ("3"), PAUSE ("4"), SUSPEND_AND_RESUME ("5").
WebViewerAdapter -- Data API via local scripts
WebViewerAdapter implements the @proofkit/fmdapi Adapter interface, routing Data API calls through a FM script that uses the Execute FileMaker Data API script step. No network auth needed.
import { DataApi } from "@proofkit/fmdapi";
import { WebViewerAdapter } from "@proofkit/webviewer/adapter";
const client = DataApi({
adapter: new WebViewerAdapter({ scriptName: "PK_execute_data_api" }),
layout: "API_Customers",
});
// Now use standard fmdapi methods
const records = await client.list();
const found = await client.findOne({ query: { id: "===1234" } });
The adapter supports: list, find, get, create, update, delete, layoutMetadata. It does NOT support executeScript or containerUpload -- these throw.
FM script callback setup
For fmFetch to resolve, the FM side needs two scripts:
- Your script -- receives the parameter, does work, attaches result to callback, calls
SendCallback - SendCallback -- provided by the ProofKit addon. Calls
Perform JavaScript in Web Viewertargeting the webviewer named in the callback, invokinghandleFmWVFetchCallback(result, fetchId).
The JS side registers callbacks in a map keyed by UUID (fetchId). When handleFmWVFetchCallback fires, it looks up and invokes the matching callback, resolving the Promise.
Common Mistakes
[CRITICAL] Importing webviewer package in server-side code
Wrong:
// app/api/route.ts (Next.js API route -- runs on server)
import { fmFetch } from "@proofkit/webviewer";
export async function GET() {
const data = await fmFetch("GetData", {});
return Response.json(data);
}
Correct:
// components/DataLoader.tsx (client component -- runs in Web Viewer)
"use client";
import { fmFetch } from "@proofkit/webviewer";
export function DataLoader() {
const load = async () => {
const data = await fmFetch("GetData", {});
};
// ...
}
@proofkit/webviewer depends on window.FileMaker, which is only injected by FileMaker into Web Viewer contexts. Importing it in server code or standard browsers will fail at
Установить webviewer-integration в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл webviewer-integration?
webviewer fmFetch callFMScript WebViewerAdapter globalSettings setWebViewerName SendCallback window.FileMaker browser-only FileMaker Web Viewer script execution fire-and-forget FMScriptOption PerformScript callback fetchId handleFmWVFetchCallback
Как установить скилл webviewer-integration?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл webviewer-integration запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic