@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
138 lines (137 loc) • 3.89 kB
TypeScript
import type * as http from 'http';
import { type FMError } from './FMError.js';
import { type LayoutInterface } from './layouts/layoutInterface.js';
export type PickPortals<LAYOUT extends LayoutInterface, PORTALS extends string | number | symbol = ''> = Omit<LAYOUT, 'portals'> & {
portals: Pick<LAYOUT['portals'], PORTALS>;
};
export interface databaseOptionsBase {
database: string;
debug?: boolean;
credentials: loginOptionsOAuth | loginOptionsFileMaker | loginOptionsClaris | loginOptionsToken;
}
export interface databaseOptionsWithExternalSources extends databaseOptionsBase {
database: string;
debug?: boolean;
credentials: loginOptionsOAuth | loginOptionsFileMaker | loginOptionsClaris | loginOptionsToken;
externalSources: databaseOptionsBase[];
}
export interface loginOptionsToken {
method: 'token';
token: string;
}
export interface loginOptionsOAuth {
method: 'oauth';
oauth: {
requestId: string;
requestIdentifier: string;
};
}
export interface loginOptionsFileMaker {
method: 'filemaker';
username: string;
password: string;
}
export interface loginOptionsClaris {
method: 'claris';
claris: {
fmid: string;
};
}
export interface portalFetchData<T = string> {
portalName: T;
offset: number;
limit: number;
}
export interface ScriptRequestData {
prerequest?: Script;
presort?: Script;
after?: Script;
}
export interface extraBodyOptions {
scripts?: ScriptRequestData;
options?: {
/**
* Defines what entry mode to use (FileMaker Server 2024 and newer)
* user (default) - Field validation occurs as per normal. Request is blocked if validation failed.
* script - Field validation is overridden/ignored when allowed in the database schema.
*/
entrymode?: 'user' | 'script';
/**
* Overrides the 'prohibit modification of this field during data entry' property (FileMaker Server 2024 - 21.1.1 and newer)
* user (default) - Follow this rule
* script - Ignore this rule
*/
prohibitmode?: 'user' | 'script';
} & Record<string, any>;
deleteRelatedRecords?: Array<{
table: string;
recordId: number;
}>;
}
export interface Script {
name: string;
parameter: string;
}
export interface recordObject {
recordId: number;
modId: number;
fieldData: any;
portalData?: portalDataObject;
}
export type portalDataObject = Record<string, recordObject>;
export interface FieldMetaData {
name: string;
type: string;
displayType: string;
result: string;
global: boolean;
autoEnter: boolean;
fourDigitYear: boolean;
maxRepeat: number;
maxCharacters: number;
notEmpty: boolean;
numeric: boolean;
timeOfDay: false;
repetitionStart: number;
repetitionEnd: number;
}
export interface LayoutMetaData {
fieldMetaData: FieldMetaData[];
portalMetaData?: Record<string, FieldMetaData[]>;
}
export interface FMHostMetadata {
productInfo: {
buildDate: Date;
name: string;
version: string;
dateFormat: string;
timeFormat: string;
timeStampFormat: string;
};
}
export interface ScriptResult {
scriptError?: FMError;
scriptResult?: string;
}
export interface ContainerBufferResult {
buffer: Buffer;
mime?: string;
request: http.IncomingMessage;
}
export interface AuthorizationHeaders {
'Content-Type': 'application/json';
Authorization: string;
}
export interface AuthorizationHeadersOAuth {
'Content-Type': 'application/json';
'X-FM-Data-OAuth-RequestId': string;
'X-FM-Data-OAuth-Identifier': string;
}
export interface RecordFetchOptions {
readonly portals: readonly string[];
}
export declare enum RecordTypes {
UNKNOWN = 0,
LAYOUT = 1,
PORTAL = 2
}