EasyFM - v5.0.0-beta.8
    Preparing search index...

    TypeScript Layouts

    easy-fm becomes much easier to use when you describe your layout shape.

    import {
    Database,
    DataApiProvider,
    type Field,
    type LayoutInterface,
    type Portal,
    } from '@jd-data-limited/easy-fm';

    interface ContactsLayout extends LayoutInterface {
    fields: {
    FirstName: Field<string>;
    LastName: Field<string>;
    Status: Field<string>;
    };
    portals: {
    Notes: Portal<{
    Note: Field<string>;
    }>;
    };
    }

    const database = Database.create({
    provider: new DataApiProvider({
    hostname: 'https://example.com',
    database: 'Contacts',
    credentials: { method: 'filemaker', username: 'api-user', password: 'secret' },
    externalSources: [],
    }),
    });

    const layout = database.layout<ContactsLayout>('Contacts_API');
    • autocomplete for record.fields
    • autocomplete for record.portals
    • better compile-time feedback when field names are wrong
    • clearer intent in app code
    const records = await layout.records
    .list({
    portals: {
    Notes: {
    offset: 1,
    limit: 10,
    },
    },
    limit: 5,
    })
    .fetch();

    records[0].fields.FirstName.value = 'Ada';
    console.log(records[0].portals.Notes.records[0].fields.Note.value);
    • LayoutInterface
    • Portal
    • BaseField
    • PickPortals
    • RecordFieldsMap

    See the generated API docs for type details: ../docs_out/index.html