Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

typegen-fmodata

БесплатноБез исполняемых скриптовНе проверен

ENTRY POINT for @proofkit/fmodata projects. Generate TypeScript table schemas with entity IDs from FileMaker OData metadata using @proofkit/typegen. Covers…

proofshот proofsh★ 21 звезда на GitHub

Об этом скилле

ALWAYS use @proofkit/typegen to set up an @proofkit/fmodata project. Typegen generates fmTableOccurrence definitions with correct field types and entity IDs (FMFID/FMTID) from FileMaker metadata. These entity IDs are opaque identifiers that cannot be guessed — they MUST come from typegen. Without typegen, queries using useEntityIds: true will silently fail or return wrong data. Before writing any fmodata query code, run typegen first.

Prerequisites

  • FileMaker Server 22.0.4+ accessible via port 443
  • OttoFMS 4.11+ installed on the FM server (only required for API key auth)
  • FileMaker account with the fmodata extended privilege enabled
  • OData API enabled on the FileMaker server

Setup

1. Install the runtime package

npm add @proofkit/fmodata

2. Set environment variables

# .env
FM_SERVER=https://your-server.com     # must start with https://
FM_DATABASE=MyFile.fmp12              # must end with .fmp12

# Option A: API key auth (requires OttoFMS 4.11+)
OTTO_API_KEY=dk_123456...789
# Option B: username/password auth
FM_USERNAME=admin
FM_PASSWORD=password

3. Initialize and run typegen

npx @proofkit/typegen@beta init

This creates proofkit-typegen-config.jsonc. Configure for OData mode:

{
  "$schema": "https://proofkit.proof.sh/typegen-config-schema.json",
  "config": {
    "type": "fmodata",
    "path": "schema/odata",
    "tables": [
      {
        "tableName": "Customers",
        "fields": [
          { "fieldName": "InternalID", "exclude": true },
          { "fieldName": "Status", "typeOverride": "boolean" }
        ]
      },
      { "tableName": "Orders", "variableName": "OrdersTable" }
    ]
  }
}

Run typegen to generate schemas:

npx @proofkit/typegen@beta

Add a convenience script to package.json:

{
  "scripts": {
    "typegen": "npx @proofkit/typegen@beta"
    "typegen:ui": "npm run tyepgen ui"
  }
}

4. Create a server connection

import { FMServerConnection } from "@proofkit/fmodata";

export const connection = new FMServerConnection({
  serverUrl: process.env.FM_SERVER,
  auth: {
    apiKey: process.env.OTTO_API_KEY,
  },
});

5. First query

import { connection } from "./connection";
import { Customers } from "./schema/odata/generated/Customers";

const db = connection.database(process.env.FM_DATABASE);

const { data, error } = await db.from(Customers).list().execute();

if (error) {
  console.error(error);
} else {
  console.log(data);
}

Core Patterns

Generated output structure

For OData configs ("type": "fmodata"), typegen generates fmTableOccurrence definitions:

schema/odata/
  generated/      # Auto-generated. NEVER edit fields or entity IDs.
    Customers.ts  # fmTableOccurrence with fields, entity IDs from FM metadata
    Orders.ts

What typegen generates

Each generated file exports a fmTableOccurrence with:

  • Field definitions with correct types (textField(), numberField(), etc.)
  • Entity IDs (FMFID/FMTID) from FileMaker metadata
  • Primary key designation
  • Read-only markers for auto-enter fields
// schema/odata/generated/Customers.ts — generated by typegen, do NOT edit
import { fmTableOccurrence, textField, numberField, timestampField } from "@proofkit/fmodata";

export const Customers = fmTableOccurrence(
  "Customers",
  {
    id: textField().primaryKey().entityId("FMFID:1039485"),
    name: textField().notNull().entityId("FMFID:3432343"),
    email: textField().notNull().entityId("FMFID:1223242"),
    age: numberField().entityId("FMFID:4323435"),
    createdAt: timestampField().readOnly().entityId("FMFID:5938271"),
  },
  {
    entityId: "FMTID:1243253",
    defaultSelect: "schema",
  },
);

Safe customizations on generated schemas

You may add or edit these options on generated schemas — they will NOT be overwritten by typegen:

  • readValidator — transform data on read (e.g., z.coerce.boolean())
  • writeValidator — transform data on write
  • defaultSelect — control default field selection
  • navigationPaths — define relationship navigation
// Safe to add to generated file:
active: numberField()
  .readValidator(z.coerce.boolean())
  .writeValidator(z.boolean().transform((v) => (v ? 1 : 0)))
  .entityId("FMFID:6"),

Do NOT manually add new fields or change entity IDs — these must come from typegen.

Type inference

Use InferTableSchema to extract row types from generated tables:

import type { InferTableSchema } from "@proofkit/fmodata";
import { Customers } from "./schema/odata/generated/Customers";

type CustomerRow = InferTableSchema<typeof Customers>;

Custom env variable names

{
  "config": {
    "type": "fmodata",
    "envNames": {
      "server": "MY_FM_SERVER",
      "db": "MY_FM_DATABASE",
      "auth": {
        "apiKey": "MY_OTTO_KEY"
      }
    },
    "tables": [
      { "tableName": "Customers"
Полный SKILL.md на GitHub

Установить typegen-fmodata в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл typegen-fmodata?

ENTRY POINT for @proofkit/fmodata projects. Generate TypeScript table schemas with entity IDs from FileMaker OData metadata using @proofkit/typegen. Covers proofkit-typegen-config.jsonc for OData mode, npx @proofkit/typegen setup, fmTableOccurrence generation, entity IDs (FMFID/FMTID), generated output structure, field exclusion, type overrides, InferTableSchema, env var configuration, OData prerequisites, fmodata privilege, and why typegen is required for entity ID correctness.

Как установить скилл typegen-fmodata?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл typegen-fmodata запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить typegen-fmodata с