Nurturing Palpable Magnificence

    TypeScript icon, indicating that this package has built-in type declarations

    7.0.2 • Public • Published


    This is the official plugin from @automapper to work with Sequelize enabled projects. sequelize is essentially extending from classes with some modification to work with Sequelize#Model type.


    npm i @automapper/sequelize

    or with yarn:

    yarn add @automapper/sequelize


    @automapper/sequelize depends on sequelize, @automapper/classes, and all of @automapper/classes peerDependencies

    npm i sequelize @automapper/{core,classes} reflect-metadata
    npm i --save-dev @types/sequelize @automapper/types

    or with yarn:

    yarn add sequelize @automapper/{core,classes} reflect-metadata
    yarn add --dev @types/sequelize @automapper/types


    • @automapper/sequelize provides sequelize as a (options: SequelizeInitializerOptions) => MapPluginInitializer. Pass sequelize() to createMapper to create a Mapper that uses sequelize plugin.
    export interface SequelizeInitializerOptions {
      valueGetter?: <
        TGetterResult extends Record<string, unknown> = any,
        TModel extends Model<TGetterResult> = Model<TGetterResult>
        model: TModel
      ) => TGetterResult;
      init?: <
        TDestination extends Dictionary<TDestination> = any,
        TModel extends Model<TDestination> = Model<TDestination>
        destination: TModel,
        destinationObj: TDestination
      ) => TDestination;
    • valueGetter is an optional getter that, if passed in, will be used to extract the value of the model after instantiation. By default, it will use sequelize#Model.get() if it's available.
    • init is an optional init function that, if passed in, will be used to instantiate a Sequelize#Model after map. By default, it will use new Model(mapResult)
    import { sequelize } from '@automapper/sequelize';
    import { Model } from 'sequelize-typescript';
    const mapper = createMapper({
      pluginInitializer: sequelize()
       * or
       * sequelize({
       *   valueGetter: model => model.get(getterOptions),
       *   init: (model, mapResult) => model.init(mapResult, initOptions)
       * })
    class User extends Model {}
    mapper.createMap(UserVm, User);, User, UserVm);

    Read more about this plugin on sequelize documentation


    npm i @automapper/sequelize

    DownloadsWeekly Downloads






    Unpacked Size

    6.82 kB

    Total Files


    Last publish


    • nartc