adonis-odm
Version:
A comprehensive MongoDB ODM for AdonisJS with Lucid-style API, type-safe relationships, embedded documents, and transaction support
45 lines • 1.25 kB
TypeScript
import { WithId, Document } from 'mongodb';
import type { BaseModel } from './base_model.js';
/**
* SerializationManager - Handles model serialization and deserialization
*
* This class encapsulates all the logic for converting models to/from
* different formats like JSON, MongoDB documents, etc.
*/
export declare class SerializationManager {
private model;
constructor(model: BaseModel);
/**
* Convert model to MongoDB document format
*/
toDocument(): Record<string, any>;
/**
* Convert model to JSON format
*/
toJSON(): Record<string, unknown>;
/**
* Hydrate model from MongoDB document
*/
hydrateFromDocument(document: WithId<Document>): void;
/**
* Get attribute value (similar to AttributeManager but for internal use)
*/
private getAttributeValue;
/**
* Serialize value for MongoDB storage
*/
private serializeValue;
/**
* Serialize value for JSON output
*/
private serializeValueForJSON;
/**
* Process value for JSON output
*/
private processValueForJSON;
/**
* Sync original values with current values
*/
private syncOriginal;
}
//# sourceMappingURL=serialization_manager.d.ts.map