UNPKG

@jd-data-limited/easy-fm

Version:

easy-fm is a Node.js module that allows you to interact with a [FileMaker database stored](https://www.claris.com/filemaker/) on a [FileMaker server](https://www.claris.com/filemaker/server/). This module interacts with your server using the [FileMaker

37 lines (36 loc) 966 B
/* * Copyright (c) 2023-2024. See LICENSE file for more information */ import { PortalRecord } from './portalRecord.js'; /** * Represents a portal. * * @template T - The type of RecordFieldsMap. * @class * @implements {PortalBase<T>} */ export class Portal { record; name; records = []; constructor(record, name) { this.record = record; this.name = name; } /** * Add a new record to the portal * @function create * @async * @summary Creates a new record. * @returns {Promise<PortalRecord<T>>} A Promise that resolves to the newly created record. */ async create() { const fields = {}; for (const _field of (await this.record.layout.getLayoutMeta()).portalMetaData[this.name]) { fields[_field.name] = ''; } const record = new PortalRecord(this.record, this, -1, -1, fields); this.records.push(record); return record; } }