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');
record.fieldsrecord.portalsconst 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);
LayoutInterfacePortalBaseFieldPickPortalsRecordFieldsMapSee the generated API docs for type details:
../docs_out/index.html