adonis-odm
Version:
A comprehensive MongoDB ODM for AdonisJS with Lucid-style API, type-safe relationships, embedded documents, and transaction support
55 lines • 2.54 kB
TypeScript
import type { ColumnOptions, DateColumnOptions } from '../types/index.js';
export { beforeSave, afterSave, beforeCreate, afterCreate, beforeUpdate, afterUpdate, beforeDelete, afterDelete, beforeFind, afterFind, beforeFetch, afterFetch, } from './hooks.js';
/**
* Base column decorator
*/
export declare function column(options?: ColumnOptions): (target: any, propertyKey: string) => void;
export declare namespace column {
var date: (options?: DateColumnOptions) => (target: any, propertyKey: string) => void;
var dateTime: (options?: DateColumnOptions) => (target: any, propertyKey: string) => void;
var decimal: (options?: DateColumnOptions) => (target: any, propertyKey: string) => void;
var embedded: (modelOrOptions?: (() => typeof import("../base_model/base_model.js").BaseModel) | ColumnOptions, typeOrOptions?: "single" | "many" | ColumnOptions, options?: ColumnOptions) => (target: any, propertyKey: string) => void;
}
/**
* Brand type to mark computed properties at the type level
*/
declare const ComputedBrand: unique symbol;
export type ComputedProperty<T = any> = T & {
readonly [ComputedBrand]: true;
};
/**
* Computed property decorator - marks properties as computed (getter-only)
* Similar to AdonisJS Lucid's @computed decorator
* These properties are excluded from create/update operations but included in serialization
*/
export declare function computed(options?: {
serializeAs?: string | null;
}): (target: any, propertyKey: string, descriptor?: PropertyDescriptor) => PropertyDescriptor | undefined;
/**
* Lucid-style relationship decorators
*/
/**
* HasOne relationship decorator
* Similar to Lucid's @hasOne decorator
*/
export declare function hasOne(relatedModel: () => typeof import('../base_model/base_model.js').BaseModel, options?: {
localKey?: string;
foreignKey?: string;
}): (target: any, propertyKey: string) => void;
/**
* HasMany relationship decorator
* Similar to Lucid's @hasMany decorator
*/
export declare function hasMany(relatedModel: () => typeof import('../base_model/base_model.js').BaseModel, options?: {
localKey?: string;
foreignKey?: string;
}): (target: any, propertyKey: string) => void;
/**
* BelongsTo relationship decorator
* Similar to Lucid's @belongsTo decorator
*/
export declare function belongsTo(relatedModel: () => typeof import('../base_model/base_model.js').BaseModel, options?: {
localKey?: string;
foreignKey?: string;
}): (target: any, propertyKey: string) => void;
//# sourceMappingURL=column.d.ts.map