@proofkit/fmodata
Version:
FileMaker OData API client
58 lines (57 loc) • 2.14 kB
TypeScript
import { FFetchOptions } from '@fetchkit/ffetch';
import { ExecutionContext } from '../types.js';
type GenericField = {
name: string;
nullable?: boolean;
primary?: boolean;
unique?: boolean;
global?: boolean;
repetitions?: number;
};
type StringField = GenericField & {
type: "string";
maxLength?: number;
default?: "USER" | "USERNAME" | "CURRENT_USER";
};
type NumericField = GenericField & {
type: "numeric";
};
type DateField = GenericField & {
type: "date";
default?: "CURRENT_DATE" | "CURDATE";
};
type TimeField = GenericField & {
type: "time";
default?: "CURRENT_TIME" | "CURTIME";
};
type TimestampField = GenericField & {
type: "timestamp";
default?: "CURRENT_TIMESTAMP" | "CURTIMESTAMP";
};
type ContainerField = GenericField & {
type: "container";
externalSecurePath?: string;
};
export type Field = StringField | NumericField | DateField | TimeField | TimestampField | ContainerField;
export type { StringField, NumericField, DateField, TimeField, TimestampField, ContainerField, };
type FileMakerField = Omit<Field, "type" | "repetitions" | "maxLength"> & {
type: string;
};
type TableDefinition = {
tableName: string;
fields: FileMakerField[];
};
export declare class SchemaManager {
private readonly databaseName;
private readonly context;
constructor(databaseName: string, context: ExecutionContext);
createTable(tableName: string, fields: Field[], options?: RequestInit & FFetchOptions): Promise<TableDefinition>;
addFields(tableName: string, fields: Field[], options?: RequestInit & FFetchOptions): Promise<TableDefinition>;
deleteTable(tableName: string, options?: RequestInit & FFetchOptions): Promise<void>;
deleteField(tableName: string, fieldName: string, options?: RequestInit & FFetchOptions): Promise<void>;
createIndex(tableName: string, fieldName: string, options?: RequestInit & FFetchOptions): Promise<{
indexName: string;
}>;
deleteIndex(tableName: string, fieldName: string, options?: RequestInit & FFetchOptions): Promise<void>;
private static compileFieldDefinition;
}