breeze-sequelize
Version:
Breeze Sequelize server implementation
26 lines (25 loc) • 1.33 kB
TypeScript
import { MetadataStore } from "breeze-client";
import { ModelType, Sequelize } from "sequelize";
/** Maps Sequelize model definitions to Breeze metadata */
export declare class ModelMapper {
readonly metadataStore: MetadataStore;
constructor(metadataStore: MetadataStore);
/** Load the sequelize instance with the model files from the directory */
static loadSequelizeModels(sequelize: Sequelize, modeldir: string): void;
/** Add all the Models in the Sequelize instance to the MetadataStore */
addModels(sequelize: Sequelize, namespace: string): void;
/** Convert the Sequelize Model to a Breeze EntityType and add it to the MetadataStore */
addModel(model: ModelType, namespace: string): void;
/** Create non-scalar navigation properties on the inverse side of the scalar properties,
* for all EntityTypes in the MetadataStore.
*/
private addInverseNavigations;
/** Make the first char of s match the case of the first char of the target string */
private matchCase;
/** Return the Breeze DataType for the given Sequelize DataType */
private mapDataType;
/** For string data types, return the length, else undefined */
private getLength;
/** Map from Sequelize DataTypes.DataType to Breeze DataType*/
private dataTypeMap;
}