export interface ActiveRecordOptions { /** * On each model, defines a property name that reference the {@link ResourceControl} * instance for that model. * * Note that the string value is the property name on the model instance at runtime. * At design time this property is not known to the type system (TypeScript), to attach the * property to the type system extend {@link TDMModel} and {@link TDMModelCollection}. * * For example, attaching the property name '$rc', use a module to init the plugin: * ```ts * import { TDMModel, TDMCollection } from '@tdm/core/tdm'; * import { ResourceControl, plugins } from '@tdm/data'; * import '@tdm/data/plugin/active-record'; * * plugins.ActiveRecord.init({ resourceControl: '$rc' }); * * // Now, teach TypeScript about the new property: * declare module '@tdm/core/tdm/src/model/tdm-model' { * interface TDMModel { * readonly $rc: ResourceControl; * } * * interface TDMModelBase { * readonly $rc: ResourceControl; * } * } * * export interface StatefulActiveRecordCollection extends TDMCollection, TDMModel> { } * * declare module '@tdm/core/tdm/src/model/tdm-collection' { * interface TDMCollection { * readonly $rc: ResourceControl>; * } * } * ``` * * If not set (falsy expression) the resource control instance can not be accessed directly from the model instance. * > It is still accessible through ResourceControl.get(modelInstance); * * @default undefined */ resourceControl?: string | false | undefined | null; /** * Enable active record actions on each model (save, delete, update etc..) * * @default true */ enableActions?: boolean; } export declare class ActiveRecordPlugin { /** * Init the plugin * @param options ActiveRecordOptions */ init(options: ActiveRecordOptions): void; } declare module '@tdm/data/lib/fw/plugin' { interface PluginStore { /** * @extension '@tdm/data/plugin/active-record' */ readonly ActiveRecord: ActiveRecordPlugin; } }