@ztimson/momentum
Version:
Client library for momentum
39 lines • 1.11 kB
TypeScript
import { Cache, PathEventEmitter } from '@ztimson/utils';
import { Api } from './api';
import { Meta, TreeNode } from './core';
export type Form<T = any> = Meta & {
path: string;
collection: string;
description?: string;
schema: {
type: string;
label?: string;
prop?: string;
default?: any;
required?: boolean;
options?: {
choices?: string[];
placeholder?: string;
min?: number;
max?: number;
step?: number;
};
style?: {
inline?: boolean;
width?: string;
};
}[];
data?: T;
};
export declare class Forms extends PathEventEmitter {
readonly api: Api;
cache: Cache<string, Form<any>>;
constructor(api: Api | string);
all(tree?: false): Promise<string[]>;
all(tree: true): Promise<TreeNode<Form>[]>;
all(path: string): Promise<Form>;
delete(key: string): Promise<void>;
read(path: string, reload?: boolean): Promise<Form | null>;
update(form: Form): Promise<Form>;
}
//# sourceMappingURL=forms.d.ts.map