kandi background
Explore Kits

sequelize | An easytouse multi SQL dialect ORM tool for Node.js | SQL Database library

 by   sequelize JavaScript Version: v7.0.0-alpha.11 License: MIT

 by   sequelize JavaScript Version: v7.0.0-alpha.11 License: MIT

Download this library from

kandi X-RAY | sequelize Summary

sequelize is a JavaScript library typically used in Database, SQL Database, Nodejs applications. sequelize has no bugs, it has no vulnerabilities, it has a Permissive License and it has medium support. You can install using 'npm i findhit-sequelize' or download it from GitHub, npm.
Sequelize is an easy-to-use and promise-based Node.js ORM tool for Postgres, MySQL, MariaDB, SQLite, DB2, Microsoft SQL Server, and IBM i. It features solid transaction support, relations, eager and lazy loading, read replication and more. Sequelize follows Semantic Versioning and the official Node.js LTS schedule. Version 7 of Sequelize officially supports the Node.js versions ^12.22.0, ^14.17,0, ^16.0.0. Other versions might be working as well. New to Sequelize? Take a look at the Tutorials and Guides. You might also be interested in the API Reference. Would you like to contribute? Read our contribution guidelines to know more. There are many ways to help! 😃.
Support
Support
Quality
Quality
Security
Security
License
License
Reuse
Reuse

kandi-support Support

  • sequelize has a medium active ecosystem.
  • It has 26011 star(s) with 4006 fork(s). There are 433 watchers for this library.
  • There were 8 major release(s) in the last 6 months.
  • There are 734 open issues and 8937 have been closed. On average issues are closed in 904 days. There are 49 open pull requests and 0 closed requests.
  • It has a neutral sentiment in the developer community.
  • The latest version of sequelize is v7.0.0-alpha.11
sequelize Support
Best in #SQL Database
Average in #SQL Database
sequelize Support
Best in #SQL Database
Average in #SQL Database

quality kandi Quality

  • sequelize has 0 bugs and 0 code smells.
sequelize Quality
Best in #SQL Database
Average in #SQL Database
sequelize Quality
Best in #SQL Database
Average in #SQL Database

securitySecurity

  • sequelize has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
  • sequelize code analysis shows 0 unresolved vulnerabilities.
  • There are 0 security hotspots that need review.
sequelize Security
Best in #SQL Database
Average in #SQL Database
sequelize Security
Best in #SQL Database
Average in #SQL Database

license License

  • sequelize is licensed under the MIT License. This license is Permissive.
  • Permissive licenses have the least restrictions, and you can use them in most projects.
sequelize License
Best in #SQL Database
Average in #SQL Database
sequelize License
Best in #SQL Database
Average in #SQL Database

buildReuse

  • sequelize releases are available to install and integrate.
  • Deployable package is available in npm.
  • Installation instructions are not available. Examples and code snippets are available.
  • sequelize saves you 62 person hours of effort in developing the same functionality from scratch.
  • It has 169 lines of code, 0 functions and 400 files.
  • It has low code complexity. Code complexity directly impacts maintainability of the code.
sequelize Reuse
Best in #SQL Database
Average in #SQL Database
sequelize Reuse
Best in #SQL Database
Average in #SQL Database
Top functions reviewed by kandi - BETA

kandi has reviewed sequelize and discovered the below as its top functions. This is intended to give you an instant insight into sequelize implemented functionality, and help decide if they suit your requirements.

  • Escape a value in a given type .
  • Main compilation function
  • Parses the given value into an array .
  • Convert to a where key and value .
  • Combines two AND statements
  • Parses a float .
  • Parse a bound number and returns the bounding range .
  • Converts an array to a SQL string .
  • Applies all hooks
  • calculate the scale and return the scale

sequelize Key Features

Upgrade from v5 to v6

Upgrade from v6 to v7

Installation of v6 (current stable version)

copy iconCopydownload iconDownload
# using npm
npm i sequelize
# using yarn
yarn add sequelize

Installation of v7 (next-gen alpha version)

copy iconCopydownload iconDownload
# using npm
npm i @sequelize/core
# using yarn
yarn add @sequelize/core

Heroku Shopify Application Error 'npm ERR! ERESOLVE unable to resolve dependency tree'

copy iconCopydownload iconDownload
npm install react@latest react-dom@latest
-----------------------
  "engines": {
    "node": "14.17.0",
    "npm": "6.14.13"
  },
remote:        Installing node modules (package.json)                                                                                                                                                                                                                           
remote:        npm ERR! code ERESOLVE                                                                                                                                                                                                                                           
remote:        npm ERR! ERESOLVE unable to resolve dependency tree                                                                                                                                                                                                              
remote:        npm ERR!                                                                                                                                                                                                                                                         
remote:        npm ERR! While resolving: conduit-node@1.0.0                                                                                                                                                                                                                     
remote:        npm ERR! Found: react@17.0.2                                                                                                                                                                                                                                     
remote:        npm ERR! node_modules/react                                                                                                                                                                                                                                      
remote:        npm ERR!   react@"17.0.2" from the root project                                                                                                                                                                                                                  
remote:        npm ERR!                                                                                                                                                                                                                                                         
remote:        npm ERR! Could not resolve dependency:                                                                                                                                                                                                                           
remote:        npm ERR! peer react@"^16.11.0" from swr@0.3.0                                                                                                                                                                                                                    
remote:        npm ERR! node_modules/swr                                                                                                                                                                                                                                        
remote:        npm ERR!   swr@"0.3.0" from the root project
remote:        Downloading and installing node 16.14.0...                                                                                                                                                                                                                       
remote:        Using default npm version: 8.3.1
-----------------------
  "engines": {
    "node": "14.17.0",
    "npm": "6.14.13"
  },
remote:        Installing node modules (package.json)                                                                                                                                                                                                                           
remote:        npm ERR! code ERESOLVE                                                                                                                                                                                                                                           
remote:        npm ERR! ERESOLVE unable to resolve dependency tree                                                                                                                                                                                                              
remote:        npm ERR!                                                                                                                                                                                                                                                         
remote:        npm ERR! While resolving: conduit-node@1.0.0                                                                                                                                                                                                                     
remote:        npm ERR! Found: react@17.0.2                                                                                                                                                                                                                                     
remote:        npm ERR! node_modules/react                                                                                                                                                                                                                                      
remote:        npm ERR!   react@"17.0.2" from the root project                                                                                                                                                                                                                  
remote:        npm ERR!                                                                                                                                                                                                                                                         
remote:        npm ERR! Could not resolve dependency:                                                                                                                                                                                                                           
remote:        npm ERR! peer react@"^16.11.0" from swr@0.3.0                                                                                                                                                                                                                    
remote:        npm ERR! node_modules/swr                                                                                                                                                                                                                                        
remote:        npm ERR!   swr@"0.3.0" from the root project
remote:        Downloading and installing node 16.14.0...                                                                                                                                                                                                                       
remote:        Using default npm version: 8.3.1
-----------------------
  "engines": {
    "node": "14.17.0",
    "npm": "6.14.13"
  },
remote:        Installing node modules (package.json)                                                                                                                                                                                                                           
remote:        npm ERR! code ERESOLVE                                                                                                                                                                                                                                           
remote:        npm ERR! ERESOLVE unable to resolve dependency tree                                                                                                                                                                                                              
remote:        npm ERR!                                                                                                                                                                                                                                                         
remote:        npm ERR! While resolving: conduit-node@1.0.0                                                                                                                                                                                                                     
remote:        npm ERR! Found: react@17.0.2                                                                                                                                                                                                                                     
remote:        npm ERR! node_modules/react                                                                                                                                                                                                                                      
remote:        npm ERR!   react@"17.0.2" from the root project                                                                                                                                                                                                                  
remote:        npm ERR!                                                                                                                                                                                                                                                         
remote:        npm ERR! Could not resolve dependency:                                                                                                                                                                                                                           
remote:        npm ERR! peer react@"^16.11.0" from swr@0.3.0                                                                                                                                                                                                                    
remote:        npm ERR! node_modules/swr                                                                                                                                                                                                                                        
remote:        npm ERR!   swr@"0.3.0" from the root project
remote:        Downloading and installing node 16.14.0...                                                                                                                                                                                                                       
remote:        Using default npm version: 8.3.1

Webpack not including all dependencies on deploying serveless application

copy iconCopydownload iconDownload
throw new Error(`Please install ${moduleName} package manually`);
Error: Please install pg package manually
npm install --save-dev webpack-node-externals
const nodeExternals = require('webpack-node-externals');
externals: [
    nodeExternals(),
],
-----------------------
throw new Error(`Please install ${moduleName} package manually`);
Error: Please install pg package manually
npm install --save-dev webpack-node-externals
const nodeExternals = require('webpack-node-externals');
externals: [
    nodeExternals(),
],
-----------------------
throw new Error(`Please install ${moduleName} package manually`);
Error: Please install pg package manually
npm install --save-dev webpack-node-externals
const nodeExternals = require('webpack-node-externals');
externals: [
    nodeExternals(),
],
-----------------------
throw new Error(`Please install ${moduleName} package manually`);
Error: Please install pg package manually
npm install --save-dev webpack-node-externals
const nodeExternals = require('webpack-node-externals');
externals: [
    nodeExternals(),
],

How to save values in column type range in postgres using Sequelize?

copy iconCopydownload iconDownload
const TABLE = sequelize.define(
    "table",
    {
      data_numbers: DataTypes.RANGE(sequelize.INTEGER),
    },
    {
      underscored: true,
      paranoid: true,
      defaultScope: {
        attributes: [
          "id", 
          "data_numbers",
        ],
      },
    }
  );
models.TABLE.create({
    data_numbers: [1, 199]
})
-----------------------
const TABLE = sequelize.define(
    "table",
    {
      data_numbers: DataTypes.RANGE(sequelize.INTEGER),
    },
    {
      underscored: true,
      paranoid: true,
      defaultScope: {
        attributes: [
          "id", 
          "data_numbers",
        ],
      },
    }
  );
models.TABLE.create({
    data_numbers: [1, 199]
})

Sequelize use output of one function into another (date_trunc into literal)

copy iconCopydownload iconDownload
const truncWithIntervalLiteral = literal("date_trunc('week', date::date),  - Interval '4 days'");

const result = await Employee.findAll({
    attributes: [
        [truncWithIntervalLiteral , "weekly"],
        [literal("COUNT(DISTINCT(date))"), "working_days"],
    ],
    group: ["weekly"],
    raw: true,
});

sequelize not Include all children if any one matches

copy iconCopydownload iconDownload
const itemsLevel2 = await db.item_level_2.findAll(
    {           
        attributes: [Sequelize.col("item_level_2.id"), 'id2'],
        where: 
        {[Sequelize.Op.and]: [
            Sequelize.where(Sequelize.fn('lower', Sequelize.col("item_level_2.item_level_3.name")), Sequelize.Op.like, '%' + searchText + '%'), 
            Sequelize.where(Sequelize.col("item_level_2.status"), Sequelize.Op.eq, body.status)
        ]},
        include: [{
            model: db.item_level_3,
            as: 'item_level_3',
            where: {
                status: body.status
            },
            required: true,
            attributes: ['name']
        }]
    }
)
ids = itemsLevel2.map(item => item.id);
exports.searchItems = (body) => {
    return new Promise((resolve, reject) => {
        let searchText = body.searchText.toLowerCase();
        let limit = body.limit;
        let offset = body.offset;
        
        db.item_level_1.findAndCountAll({
            where: {
                [Sequelize.Op.or]: [
                    Sequelize.where(Sequelize.fn('lower', Sequelize.col("item_level_1.name")), Sequelize.Op.like, '%' + searchText + '%'),
                    Sequelize.where(Sequelize.fn('lower', Sequelize.col("item_level_2.name")), Sequelize.Op.like, '%' + searchText + '%'),
                    Sequelize.where(Sequelize.col("item_level_2.id"), Sequelize.Op.in, ids),
                ],

                [Sequelize.Op.and]: [
                    Sequelize.where(Sequelize.col("item_level_1.status"), Sequelize.Op.eq, body.status)
                ]
            },
            offset: offset,
            limit: limit,
            distinct: true,
            subQuery: false,
            attributes: ['id', 'name'],
            include: [
                {
                    model: db.item_level_2,
                    as: 'item_level_2',
                    where: {
                        status: body.status
                    },
                    attributes: ['id', 'name'],
                    required: true,
                    include: [{
                        model: db.item_level_3,
                        as: 'item_level_3',
                        where: {
                            status: body.status
                        },
                        required: true,
                        attributes: ['id', 'name']
                    }]
                }
        ]
        }).then(result => {
            resolve({ [KEY_STATUS]: 1, [KEY_MESSAGE]: "items listed successfully", [KEY_DATA]: result.rows, [KEY_TOTAL_COUNT]: result.count });
        }).catch(error => {
            reject({ [KEY_STATUS]: 0, [KEY_MESSAGE]: "items list failed", [KEY_ERROR]: error });
        });
    })
}
-----------------------
const itemsLevel2 = await db.item_level_2.findAll(
    {           
        attributes: [Sequelize.col("item_level_2.id"), 'id2'],
        where: 
        {[Sequelize.Op.and]: [
            Sequelize.where(Sequelize.fn('lower', Sequelize.col("item_level_2.item_level_3.name")), Sequelize.Op.like, '%' + searchText + '%'), 
            Sequelize.where(Sequelize.col("item_level_2.status"), Sequelize.Op.eq, body.status)
        ]},
        include: [{
            model: db.item_level_3,
            as: 'item_level_3',
            where: {
                status: body.status
            },
            required: true,
            attributes: ['name']
        }]
    }
)
ids = itemsLevel2.map(item => item.id);
exports.searchItems = (body) => {
    return new Promise((resolve, reject) => {
        let searchText = body.searchText.toLowerCase();
        let limit = body.limit;
        let offset = body.offset;
        
        db.item_level_1.findAndCountAll({
            where: {
                [Sequelize.Op.or]: [
                    Sequelize.where(Sequelize.fn('lower', Sequelize.col("item_level_1.name")), Sequelize.Op.like, '%' + searchText + '%'),
                    Sequelize.where(Sequelize.fn('lower', Sequelize.col("item_level_2.name")), Sequelize.Op.like, '%' + searchText + '%'),
                    Sequelize.where(Sequelize.col("item_level_2.id"), Sequelize.Op.in, ids),
                ],

                [Sequelize.Op.and]: [
                    Sequelize.where(Sequelize.col("item_level_1.status"), Sequelize.Op.eq, body.status)
                ]
            },
            offset: offset,
            limit: limit,
            distinct: true,
            subQuery: false,
            attributes: ['id', 'name'],
            include: [
                {
                    model: db.item_level_2,
                    as: 'item_level_2',
                    where: {
                        status: body.status
                    },
                    attributes: ['id', 'name'],
                    required: true,
                    include: [{
                        model: db.item_level_3,
                        as: 'item_level_3',
                        where: {
                            status: body.status
                        },
                        required: true,
                        attributes: ['id', 'name']
                    }]
                }
        ]
        }).then(result => {
            resolve({ [KEY_STATUS]: 1, [KEY_MESSAGE]: "items listed successfully", [KEY_DATA]: result.rows, [KEY_TOTAL_COUNT]: result.count });
        }).catch(error => {
            reject({ [KEY_STATUS]: 0, [KEY_MESSAGE]: "items list failed", [KEY_ERROR]: error });
        });
    })
}
-----------------------
item_level_2.hasMany(item_level_3, { as: 'item_level_3' });
// This extra association will be used only for filtering.
item_level_2.hasMany(item_level_3, { as: 'filter' }); 
db.item_level_1.findAndCountAll({
    where: {
        [Sequelize.Op.or]: [
             Sequelize.where(Sequelize.fn('lower', Sequelize.col("item_level_1.name")), Sequelize.Op.like, '%' + searchText + '%'),
             Sequelize.where(Sequelize.fn('lower', Sequelize.col("item_level_2.name")), Sequelize.Op.like, '%' + searchText + '%'),
             // Use the filter association to filter data.
             Sequelize.where(Sequelize.fn('lower', Sequelize.col("item_level_2.filter.name")), Sequelize.Op.like, '%' + searchText + '%'),
        ],
        ...
        include: [
            {
                model: db.item_level_2,
                as: 'item_level_2',
                where: {
                    status: body.status
                },
                attributes: ['id', 'name'],
                required: true,
                include: [
                    {
                        model: db.item_level_3,
                        as: 'item_level_3',
                        where: {
                            status: body.status
                        },
                        required: false,
                        attributes: ['id', 'name']  // This should fetch all associated data. 
                    },
                    {
                        model: db.item_level_3,
                        as: 'filter',
                        where: {
                            status: body.status
                        },
                        required: false,
                        attributes: []  // Do not fetch any data from this association. This is only for filtering.
                    }
                ]
            }
        ]
    }
})
const escapedSearchText = sequelize.escape(`%${searchText}%`);
const inQueryOptions = {
    attributes: ['itemLevel1Id'],  // This attribute name and the one in group could be different for your table.
    include: [{
        attributes: [],
        model: db.item_level_3,
        as: 'item_level_3',
        where: {
            name: {
                [Sequelize.Op.like]: escapedSearchText
            }
        }
    }],
    group: 'itemLevel1Id',
    having: Sequelize.literal('COUNT(*) > 0')
};
const Model = require("sequelize/lib/model");
// This is required when the inline query has `include` options, this 1 line make sure to serialize the query correctly.
Model._validateIncludedElements.bind(db.item_level_2)(inQueryOptions);
  
// Then, pass the query options to queryGenerator.
// slice(0, -1) is to remove the last ";" as I will use this query inline of the main query.
const inQuery = db.sequelize.getQueryInterface().queryGenerator.selectQuery('item_level_2', inQueryOptions, db.item_level_2).slice(0, -1);
SELECT `item_level_2`.`itemLevel1Id` 
FROM `item_level_2` AS `item_level_2` 
INNER JOIN `item_level_3` AS `item_level_3` 
    ON `item_level_2`.`itemLevel3Id` = `item_level_3`.`id` 
    AND `item_level_3`.`name` LIKE '%def%' 
GROUP BY `itemLevel1Id` 
HAVING COUNT(*) > 0
db.item_level_1.findAndCountAll({
    subQuery: false,
    distinct: true,
    where: {
        [Op.or]: [
            Sequelize.where(Sequelize.fn('lower', Sequelize.col("item_level_1.name")), Sequelize.Op.like, '%' + searchText + '%'),
            Sequelize.where(Sequelize.fn('lower', Sequelize.col("item_level_2.name")), Sequelize.Op.like, '%' + searchText + '%'),
            {
                id: {
                    // This is where I am inserting the inline query.
                    [Op.in]: Sequelize.literal(`(${inQuery})`)
                }
            }
        ]
    },
    attributes: ['id', 'name'],
    include: [{
        attributes: ['id', 'name'],
        model: db.item_level_2,
        as: 'item_level_2',
        required: true,
        include: [{
            attributes: ['id', 'name'],
            model: db.item_level_3,
            as: 'item_level_3',
            required: false,
        }]
    }]
});
-----------------------
item_level_2.hasMany(item_level_3, { as: 'item_level_3' });
// This extra association will be used only for filtering.
item_level_2.hasMany(item_level_3, { as: 'filter' }); 
db.item_level_1.findAndCountAll({
    where: {
        [Sequelize.Op.or]: [
             Sequelize.where(Sequelize.fn('lower', Sequelize.col("item_level_1.name")), Sequelize.Op.like, '%' + searchText + '%'),
             Sequelize.where(Sequelize.fn('lower', Sequelize.col("item_level_2.name")), Sequelize.Op.like, '%' + searchText + '%'),
             // Use the filter association to filter data.
             Sequelize.where(Sequelize.fn('lower', Sequelize.col("item_level_2.filter.name")), Sequelize.Op.like, '%' + searchText + '%'),
        ],
        ...
        include: [
            {
                model: db.item_level_2,
                as: 'item_level_2',
                where: {
                    status: body.status
                },
                attributes: ['id', 'name'],
                required: true,
                include: [
                    {
                        model: db.item_level_3,
                        as: 'item_level_3',
                        where: {
                            status: body.status
                        },
                        required: false,
                        attributes: ['id', 'name']  // This should fetch all associated data. 
                    },
                    {
                        model: db.item_level_3,
                        as: 'filter',
                        where: {
                            status: body.status
                        },
                        required: false,
                        attributes: []  // Do not fetch any data from this association. This is only for filtering.
                    }
                ]
            }
        ]
    }
})
const escapedSearchText = sequelize.escape(`%${searchText}%`);
const inQueryOptions = {
    attributes: ['itemLevel1Id'],  // This attribute name and the one in group could be different for your table.
    include: [{
        attributes: [],
        model: db.item_level_3,
        as: 'item_level_3',
        where: {
            name: {
                [Sequelize.Op.like]: escapedSearchText
            }
        }
    }],
    group: 'itemLevel1Id',
    having: Sequelize.literal('COUNT(*) > 0')
};
const Model = require("sequelize/lib/model");
// This is required when the inline query has `include` options, this 1 line make sure to serialize the query correctly.
Model._validateIncludedElements.bind(db.item_level_2)(inQueryOptions);
  
// Then, pass the query options to queryGenerator.
// slice(0, -1) is to remove the last ";" as I will use this query inline of the main query.
const inQuery = db.sequelize.getQueryInterface().queryGenerator.selectQuery('item_level_2', inQueryOptions, db.item_level_2).slice(0, -1);
SELECT `item_level_2`.`itemLevel1Id` 
FROM `item_level_2` AS `item_level_2` 
INNER JOIN `item_level_3` AS `item_level_3` 
    ON `item_level_2`.`itemLevel3Id` = `item_level_3`.`id` 
    AND `item_level_3`.`name` LIKE '%def%' 
GROUP BY `itemLevel1Id` 
HAVING COUNT(*) > 0
db.item_level_1.findAndCountAll({
    subQuery: false,
    distinct: true,
    where: {
        [Op.or]: [
            Sequelize.where(Sequelize.fn('lower', Sequelize.col("item_level_1.name")), Sequelize.Op.like, '%' + searchText + '%'),
            Sequelize.where(Sequelize.fn('lower', Sequelize.col("item_level_2.name")), Sequelize.Op.like, '%' + searchText + '%'),
            {
                id: {
                    // This is where I am inserting the inline query.
                    [Op.in]: Sequelize.literal(`(${inQuery})`)
                }
            }
        ]
    },
    attributes: ['id', 'name'],
    include: [{
        attributes: ['id', 'name'],
        model: db.item_level_2,
        as: 'item_level_2',
        required: true,
        include: [{
            attributes: ['id', 'name'],
            model: db.item_level_3,
            as: 'item_level_3',
            required: false,
        }]
    }]
});
-----------------------
item_level_2.hasMany(item_level_3, { as: 'item_level_3' });
// This extra association will be used only for filtering.
item_level_2.hasMany(item_level_3, { as: 'filter' }); 
db.item_level_1.findAndCountAll({
    where: {
        [Sequelize.Op.or]: [
             Sequelize.where(Sequelize.fn('lower', Sequelize.col("item_level_1.name")), Sequelize.Op.like, '%' + searchText + '%'),
             Sequelize.where(Sequelize.fn('lower', Sequelize.col("item_level_2.name")), Sequelize.Op.like, '%' + searchText + '%'),
             // Use the filter association to filter data.
             Sequelize.where(Sequelize.fn('lower', Sequelize.col("item_level_2.filter.name")), Sequelize.Op.like, '%' + searchText + '%'),
        ],
        ...
        include: [
            {
                model: db.item_level_2,
                as: 'item_level_2',
                where: {
                    status: body.status
                },
                attributes: ['id', 'name'],
                required: true,
                include: [
                    {
                        model: db.item_level_3,
                        as: 'item_level_3',
                        where: {
                            status: body.status
                        },
                        required: false,
                        attributes: ['id', 'name']  // This should fetch all associated data. 
                    },
                    {
                        model: db.item_level_3,
                        as: 'filter',
                        where: {
                            status: body.status
                        },
                        required: false,
                        attributes: []  // Do not fetch any data from this association. This is only for filtering.
                    }
                ]
            }
        ]
    }
})
const escapedSearchText = sequelize.escape(`%${searchText}%`);
const inQueryOptions = {
    attributes: ['itemLevel1Id'],  // This attribute name and the one in group could be different for your table.
    include: [{
        attributes: [],
        model: db.item_level_3,
        as: 'item_level_3',
        where: {
            name: {
                [Sequelize.Op.like]: escapedSearchText
            }
        }
    }],
    group: 'itemLevel1Id',
    having: Sequelize.literal('COUNT(*) > 0')
};
const Model = require("sequelize/lib/model");
// This is required when the inline query has `include` options, this 1 line make sure to serialize the query correctly.
Model._validateIncludedElements.bind(db.item_level_2)(inQueryOptions);
  
// Then, pass the query options to queryGenerator.
// slice(0, -1) is to remove the last ";" as I will use this query inline of the main query.
const inQuery = db.sequelize.getQueryInterface().queryGenerator.selectQuery('item_level_2', inQueryOptions, db.item_level_2).slice(0, -1);
SELECT `item_level_2`.`itemLevel1Id` 
FROM `item_level_2` AS `item_level_2` 
INNER JOIN `item_level_3` AS `item_level_3` 
    ON `item_level_2`.`itemLevel3Id` = `item_level_3`.`id` 
    AND `item_level_3`.`name` LIKE '%def%' 
GROUP BY `itemLevel1Id` 
HAVING COUNT(*) > 0
db.item_level_1.findAndCountAll({
    subQuery: false,
    distinct: true,
    where: {
        [Op.or]: [
            Sequelize.where(Sequelize.fn('lower', Sequelize.col("item_level_1.name")), Sequelize.Op.like, '%' + searchText + '%'),
            Sequelize.where(Sequelize.fn('lower', Sequelize.col("item_level_2.name")), Sequelize.Op.like, '%' + searchText + '%'),
            {
                id: {
                    // This is where I am inserting the inline query.
                    [Op.in]: Sequelize.literal(`(${inQuery})`)
                }
            }
        ]
    },
    attributes: ['id', 'name'],
    include: [{
        attributes: ['id', 'name'],
        model: db.item_level_2,
        as: 'item_level_2',
        required: true,
        include: [{
            attributes: ['id', 'name'],
            model: db.item_level_3,
            as: 'item_level_3',
            required: false,
        }]
    }]
});
-----------------------
item_level_2.hasMany(item_level_3, { as: 'item_level_3' });
// This extra association will be used only for filtering.
item_level_2.hasMany(item_level_3, { as: 'filter' }); 
db.item_level_1.findAndCountAll({
    where: {
        [Sequelize.Op.or]: [
             Sequelize.where(Sequelize.fn('lower', Sequelize.col("item_level_1.name")), Sequelize.Op.like, '%' + searchText + '%'),
             Sequelize.where(Sequelize.fn('lower', Sequelize.col("item_level_2.name")), Sequelize.Op.like, '%' + searchText + '%'),
             // Use the filter association to filter data.
             Sequelize.where(Sequelize.fn('lower', Sequelize.col("item_level_2.filter.name")), Sequelize.Op.like, '%' + searchText + '%'),
        ],
        ...
        include: [
            {
                model: db.item_level_2,
                as: 'item_level_2',
                where: {
                    status: body.status
                },
                attributes: ['id', 'name'],
                required: true,
                include: [
                    {
                        model: db.item_level_3,
                        as: 'item_level_3',
                        where: {
                            status: body.status
                        },
                        required: false,
                        attributes: ['id', 'name']  // This should fetch all associated data. 
                    },
                    {
                        model: db.item_level_3,
                        as: 'filter',
                        where: {
                            status: body.status
                        },
                        required: false,
                        attributes: []  // Do not fetch any data from this association. This is only for filtering.
                    }
                ]
            }
        ]
    }
})
const escapedSearchText = sequelize.escape(`%${searchText}%`);
const inQueryOptions = {
    attributes: ['itemLevel1Id'],  // This attribute name and the one in group could be different for your table.
    include: [{
        attributes: [],
        model: db.item_level_3,
        as: 'item_level_3',
        where: {
            name: {
                [Sequelize.Op.like]: escapedSearchText
            }
        }
    }],
    group: 'itemLevel1Id',
    having: Sequelize.literal('COUNT(*) > 0')
};
const Model = require("sequelize/lib/model");
// This is required when the inline query has `include` options, this 1 line make sure to serialize the query correctly.
Model._validateIncludedElements.bind(db.item_level_2)(inQueryOptions);
  
// Then, pass the query options to queryGenerator.
// slice(0, -1) is to remove the last ";" as I will use this query inline of the main query.
const inQuery = db.sequelize.getQueryInterface().queryGenerator.selectQuery('item_level_2', inQueryOptions, db.item_level_2).slice(0, -1);
SELECT `item_level_2`.`itemLevel1Id` 
FROM `item_level_2` AS `item_level_2` 
INNER JOIN `item_level_3` AS `item_level_3` 
    ON `item_level_2`.`itemLevel3Id` = `item_level_3`.`id` 
    AND `item_level_3`.`name` LIKE '%def%' 
GROUP BY `itemLevel1Id` 
HAVING COUNT(*) > 0
db.item_level_1.findAndCountAll({
    subQuery: false,
    distinct: true,
    where: {
        [Op.or]: [
            Sequelize.where(Sequelize.fn('lower', Sequelize.col("item_level_1.name")), Sequelize.Op.like, '%' + searchText + '%'),
            Sequelize.where(Sequelize.fn('lower', Sequelize.col("item_level_2.name")), Sequelize.Op.like, '%' + searchText + '%'),
            {
                id: {
                    // This is where I am inserting the inline query.
                    [Op.in]: Sequelize.literal(`(${inQuery})`)
                }
            }
        ]
    },
    attributes: ['id', 'name'],
    include: [{
        attributes: ['id', 'name'],
        model: db.item_level_2,
        as: 'item_level_2',
        required: true,
        include: [{
            attributes: ['id', 'name'],
            model: db.item_level_3,
            as: 'item_level_3',
            required: false,
        }]
    }]
});
-----------------------
item_level_2.hasMany(item_level_3, { as: 'item_level_3' });
// This extra association will be used only for filtering.
item_level_2.hasMany(item_level_3, { as: 'filter' }); 
db.item_level_1.findAndCountAll({
    where: {
        [Sequelize.Op.or]: [
             Sequelize.where(Sequelize.fn('lower', Sequelize.col("item_level_1.name")), Sequelize.Op.like, '%' + searchText + '%'),
             Sequelize.where(Sequelize.fn('lower', Sequelize.col("item_level_2.name")), Sequelize.Op.like, '%' + searchText + '%'),
             // Use the filter association to filter data.
             Sequelize.where(Sequelize.fn('lower', Sequelize.col("item_level_2.filter.name")), Sequelize.Op.like, '%' + searchText + '%'),
        ],
        ...
        include: [
            {
                model: db.item_level_2,
                as: 'item_level_2',
                where: {
                    status: body.status
                },
                attributes: ['id', 'name'],
                required: true,
                include: [
                    {
                        model: db.item_level_3,
                        as: 'item_level_3',
                        where: {
                            status: body.status
                        },
                        required: false,
                        attributes: ['id', 'name']  // This should fetch all associated data. 
                    },
                    {
                        model: db.item_level_3,
                        as: 'filter',
                        where: {
                            status: body.status
                        },
                        required: false,
                        attributes: []  // Do not fetch any data from this association. This is only for filtering.
                    }
                ]
            }
        ]
    }
})
const escapedSearchText = sequelize.escape(`%${searchText}%`);
const inQueryOptions = {
    attributes: ['itemLevel1Id'],  // This attribute name and the one in group could be different for your table.
    include: [{
        attributes: [],
        model: db.item_level_3,
        as: 'item_level_3',
        where: {
            name: {
                [Sequelize.Op.like]: escapedSearchText
            }
        }
    }],
    group: 'itemLevel1Id',
    having: Sequelize.literal('COUNT(*) > 0')
};
const Model = require("sequelize/lib/model");
// This is required when the inline query has `include` options, this 1 line make sure to serialize the query correctly.
Model._validateIncludedElements.bind(db.item_level_2)(inQueryOptions);
  
// Then, pass the query options to queryGenerator.
// slice(0, -1) is to remove the last ";" as I will use this query inline of the main query.
const inQuery = db.sequelize.getQueryInterface().queryGenerator.selectQuery('item_level_2', inQueryOptions, db.item_level_2).slice(0, -1);
SELECT `item_level_2`.`itemLevel1Id` 
FROM `item_level_2` AS `item_level_2` 
INNER JOIN `item_level_3` AS `item_level_3` 
    ON `item_level_2`.`itemLevel3Id` = `item_level_3`.`id` 
    AND `item_level_3`.`name` LIKE '%def%' 
GROUP BY `itemLevel1Id` 
HAVING COUNT(*) > 0
db.item_level_1.findAndCountAll({
    subQuery: false,
    distinct: true,
    where: {
        [Op.or]: [
            Sequelize.where(Sequelize.fn('lower', Sequelize.col("item_level_1.name")), Sequelize.Op.like, '%' + searchText + '%'),
            Sequelize.where(Sequelize.fn('lower', Sequelize.col("item_level_2.name")), Sequelize.Op.like, '%' + searchText + '%'),
            {
                id: {
                    // This is where I am inserting the inline query.
                    [Op.in]: Sequelize.literal(`(${inQuery})`)
                }
            }
        ]
    },
    attributes: ['id', 'name'],
    include: [{
        attributes: ['id', 'name'],
        model: db.item_level_2,
        as: 'item_level_2',
        required: true,
        include: [{
            attributes: ['id', 'name'],
            model: db.item_level_3,
            as: 'item_level_3',
            required: false,
        }]
    }]
});
-----------------------
item_level_2.hasMany(item_level_3, { as: 'item_level_3' });
// This extra association will be used only for filtering.
item_level_2.hasMany(item_level_3, { as: 'filter' }); 
db.item_level_1.findAndCountAll({
    where: {
        [Sequelize.Op.or]: [
             Sequelize.where(Sequelize.fn('lower', Sequelize.col("item_level_1.name")), Sequelize.Op.like, '%' + searchText + '%'),
             Sequelize.where(Sequelize.fn('lower', Sequelize.col("item_level_2.name")), Sequelize.Op.like, '%' + searchText + '%'),
             // Use the filter association to filter data.
             Sequelize.where(Sequelize.fn('lower', Sequelize.col("item_level_2.filter.name")), Sequelize.Op.like, '%' + searchText + '%'),
        ],
        ...
        include: [
            {
                model: db.item_level_2,
                as: 'item_level_2',
                where: {
                    status: body.status
                },
                attributes: ['id', 'name'],
                required: true,
                include: [
                    {
                        model: db.item_level_3,
                        as: 'item_level_3',
                        where: {
                            status: body.status
                        },
                        required: false,
                        attributes: ['id', 'name']  // This should fetch all associated data. 
                    },
                    {
                        model: db.item_level_3,
                        as: 'filter',
                        where: {
                            status: body.status
                        },
                        required: false,
                        attributes: []  // Do not fetch any data from this association. This is only for filtering.
                    }
                ]
            }
        ]
    }
})
const escapedSearchText = sequelize.escape(`%${searchText}%`);
const inQueryOptions = {
    attributes: ['itemLevel1Id'],  // This attribute name and the one in group could be different for your table.
    include: [{
        attributes: [],
        model: db.item_level_3,
        as: 'item_level_3',
        where: {
            name: {
                [Sequelize.Op.like]: escapedSearchText
            }
        }
    }],
    group: 'itemLevel1Id',
    having: Sequelize.literal('COUNT(*) > 0')
};
const Model = require("sequelize/lib/model");
// This is required when the inline query has `include` options, this 1 line make sure to serialize the query correctly.
Model._validateIncludedElements.bind(db.item_level_2)(inQueryOptions);
  
// Then, pass the query options to queryGenerator.
// slice(0, -1) is to remove the last ";" as I will use this query inline of the main query.
const inQuery = db.sequelize.getQueryInterface().queryGenerator.selectQuery('item_level_2', inQueryOptions, db.item_level_2).slice(0, -1);
SELECT `item_level_2`.`itemLevel1Id` 
FROM `item_level_2` AS `item_level_2` 
INNER JOIN `item_level_3` AS `item_level_3` 
    ON `item_level_2`.`itemLevel3Id` = `item_level_3`.`id` 
    AND `item_level_3`.`name` LIKE '%def%' 
GROUP BY `itemLevel1Id` 
HAVING COUNT(*) > 0
db.item_level_1.findAndCountAll({
    subQuery: false,
    distinct: true,
    where: {
        [Op.or]: [
            Sequelize.where(Sequelize.fn('lower', Sequelize.col("item_level_1.name")), Sequelize.Op.like, '%' + searchText + '%'),
            Sequelize.where(Sequelize.fn('lower', Sequelize.col("item_level_2.name")), Sequelize.Op.like, '%' + searchText + '%'),
            {
                id: {
                    // This is where I am inserting the inline query.
                    [Op.in]: Sequelize.literal(`(${inQuery})`)
                }
            }
        ]
    },
    attributes: ['id', 'name'],
    include: [{
        attributes: ['id', 'name'],
        model: db.item_level_2,
        as: 'item_level_2',
        required: true,
        include: [{
            attributes: ['id', 'name'],
            model: db.item_level_3,
            as: 'item_level_3',
            required: false,
        }]
    }]
});
-----------------------
item_level_2.hasMany(item_level_3, { as: 'item_level_3' });
// This extra association will be used only for filtering.
item_level_2.hasMany(item_level_3, { as: 'filter' }); 
db.item_level_1.findAndCountAll({
    where: {
        [Sequelize.Op.or]: [
             Sequelize.where(Sequelize.fn('lower', Sequelize.col("item_level_1.name")), Sequelize.Op.like, '%' + searchText + '%'),
             Sequelize.where(Sequelize.fn('lower', Sequelize.col("item_level_2.name")), Sequelize.Op.like, '%' + searchText + '%'),
             // Use the filter association to filter data.
             Sequelize.where(Sequelize.fn('lower', Sequelize.col("item_level_2.filter.name")), Sequelize.Op.like, '%' + searchText + '%'),
        ],
        ...
        include: [
            {
                model: db.item_level_2,
                as: 'item_level_2',
                where: {
                    status: body.status
                },
                attributes: ['id', 'name'],
                required: true,
                include: [
                    {
                        model: db.item_level_3,
                        as: 'item_level_3',
                        where: {
                            status: body.status
                        },
                        required: false,
                        attributes: ['id', 'name']  // This should fetch all associated data. 
                    },
                    {
                        model: db.item_level_3,
                        as: 'filter',
                        where: {
                            status: body.status
                        },
                        required: false,
                        attributes: []  // Do not fetch any data from this association. This is only for filtering.
                    }
                ]
            }
        ]
    }
})
const escapedSearchText = sequelize.escape(`%${searchText}%`);
const inQueryOptions = {
    attributes: ['itemLevel1Id'],  // This attribute name and the one in group could be different for your table.
    include: [{
        attributes: [],
        model: db.item_level_3,
        as: 'item_level_3',
        where: {
            name: {
                [Sequelize.Op.like]: escapedSearchText
            }
        }
    }],
    group: 'itemLevel1Id',
    having: Sequelize.literal('COUNT(*) > 0')
};
const Model = require("sequelize/lib/model");
// This is required when the inline query has `include` options, this 1 line make sure to serialize the query correctly.
Model._validateIncludedElements.bind(db.item_level_2)(inQueryOptions);
  
// Then, pass the query options to queryGenerator.
// slice(0, -1) is to remove the last ";" as I will use this query inline of the main query.
const inQuery = db.sequelize.getQueryInterface().queryGenerator.selectQuery('item_level_2', inQueryOptions, db.item_level_2).slice(0, -1);
SELECT `item_level_2`.`itemLevel1Id` 
FROM `item_level_2` AS `item_level_2` 
INNER JOIN `item_level_3` AS `item_level_3` 
    ON `item_level_2`.`itemLevel3Id` = `item_level_3`.`id` 
    AND `item_level_3`.`name` LIKE '%def%' 
GROUP BY `itemLevel1Id` 
HAVING COUNT(*) > 0
db.item_level_1.findAndCountAll({
    subQuery: false,
    distinct: true,
    where: {
        [Op.or]: [
            Sequelize.where(Sequelize.fn('lower', Sequelize.col("item_level_1.name")), Sequelize.Op.like, '%' + searchText + '%'),
            Sequelize.where(Sequelize.fn('lower', Sequelize.col("item_level_2.name")), Sequelize.Op.like, '%' + searchText + '%'),
            {
                id: {
                    // This is where I am inserting the inline query.
                    [Op.in]: Sequelize.literal(`(${inQuery})`)
                }
            }
        ]
    },
    attributes: ['id', 'name'],
    include: [{
        attributes: ['id', 'name'],
        model: db.item_level_2,
        as: 'item_level_2',
        required: true,
        include: [{
            attributes: ['id', 'name'],
            model: db.item_level_3,
            as: 'item_level_3',
            required: false,
        }]
    }]
});

Express + Sequelize: hanging the app on connection

copy iconCopydownload iconDownload
services:
  postgres:
    container_name: app-database
    network: postgres
    image: postgres
    ...

  express:
    container_name: app-backend
    network: postgres
    environment:
      DATABASE_URL: "postgresql://postgres:postgres@app-database:5432/postgres"

  networks:
    postgres:
      driver: bridge

    ...
-----------------------
yarn add pg@"8.7.1"

What is the use of defining a mixin instead of a instance method in sequilizejs?

copy iconCopydownload iconDownload
instance_methods.myNewMethod = function () { ... }
function with_my_new_method () {
    this.myNewMethod = function () { ... }
} 
// Model1.js:
var instance_methods = get_instance_methods(sequelize);
var Model1 = sequelize.define("Model1", {
  ...
}, {
  instanceMethods: instance_methods
});

// Model2.js:
var instance_methods = get_instance_methods(sequelize);
with_my_new_method.call(instance_methods)
var Model2 = sequelize.define("Model2", {
  ...
}, {
  instanceMethods: instance_methods
});

// Model3.js:
var instance_methods = get_instance_methods(sequelize);
with_my_new_method.call(instance_methods)
var Model3 = sequelize.define("Model3", {
  ...
}, {
  instanceMethods: instance_methods
});
-----------------------
instance_methods.myNewMethod = function () { ... }
function with_my_new_method () {
    this.myNewMethod = function () { ... }
} 
// Model1.js:
var instance_methods = get_instance_methods(sequelize);
var Model1 = sequelize.define("Model1", {
  ...
}, {
  instanceMethods: instance_methods
});

// Model2.js:
var instance_methods = get_instance_methods(sequelize);
with_my_new_method.call(instance_methods)
var Model2 = sequelize.define("Model2", {
  ...
}, {
  instanceMethods: instance_methods
});

// Model3.js:
var instance_methods = get_instance_methods(sequelize);
with_my_new_method.call(instance_methods)
var Model3 = sequelize.define("Model3", {
  ...
}, {
  instanceMethods: instance_methods
});
-----------------------
instance_methods.myNewMethod = function () { ... }
function with_my_new_method () {
    this.myNewMethod = function () { ... }
} 
// Model1.js:
var instance_methods = get_instance_methods(sequelize);
var Model1 = sequelize.define("Model1", {
  ...
}, {
  instanceMethods: instance_methods
});

// Model2.js:
var instance_methods = get_instance_methods(sequelize);
with_my_new_method.call(instance_methods)
var Model2 = sequelize.define("Model2", {
  ...
}, {
  instanceMethods: instance_methods
});

// Model3.js:
var instance_methods = get_instance_methods(sequelize);
with_my_new_method.call(instance_methods)
var Model3 = sequelize.define("Model3", {
  ...
}, {
  instanceMethods: instance_methods
});

Custom data type not getting assigned values for record creation

copy iconCopydownload iconDownload
Profile.belongsTo(User) // This will add userId to the profile table
This is almost the same as belongsTo with one exception - The foreign key will be defined on the target model.
-----------------------
Profile.belongsTo(User) // This will add userId to the profile table
This is almost the same as belongsTo with one exception - The foreign key will be defined on the target model.

Method set/add is not a function sequelize node js

copy iconCopydownload iconDownload
not confirmend but i think you are using Order.addProducts() instead of order.addProduts();
-----------------------
Order.create({
   name,
   Product: {...}
},{
   include: Product
})

How to perform a three table join using Sequelize in NodeJS

copy iconCopydownload iconDownload
rptDB.tblAccess.hasMany(rptDB.tblHeadings, { foreignKey: Heading, targetKey: id });
    rptDB.tblHeadings.belongsTo(rptDB.tblAccess, { foreignKey: id, targetKey: Heading })

rptDB.tblAccess.hasMany(rptDB.tblHeadings, { foreignKey: rptDB.tblAccess.Heading, targetKey: rptDB.tblHeadings.id });
    rptDB.tblHeadings.belongsTo(rptDB.tblAccess, { foreignKey: rptDB.tblHeadings.id, targetKey: rptDB.tblAccess.Heading })
-----------------------
rptDB.tblAccess.hasMany(rptDB.tblHeadings, { foreignKey: Heading, targetKey: id });
    rptDB.tblHeadings.belongsTo(rptDB.tblAccess, { foreignKey: id, targetKey: Heading })

rptDB.tblAccess.hasMany(rptDB.tblHeadings, { foreignKey: rptDB.tblAccess.Heading, targetKey: rptDB.tblHeadings.id });
    rptDB.tblHeadings.belongsTo(rptDB.tblAccess, { foreignKey: rptDB.tblHeadings.id, targetKey: rptDB.tblAccess.Heading })

Community Discussions

Trending Discussions on sequelize
  • Heroku Shopify Application Error 'npm ERR! ERESOLVE unable to resolve dependency tree'
  • How can I have my composite primar key in a junction table using sequelize?
  • Webpack not including all dependencies on deploying serveless application
  • How to save values in column type range in postgres using Sequelize?
  • proxy server working in one case and failed in another case
  • Sequelize use output of one function into another (date_trunc into literal)
  • sequelize not Include all children if any one matches
  • Express + Sequelize: hanging the app on connection
  • What is the use of defining a mixin instead of a instance method in sequilizejs?
  • Custom data type not getting assigned values for record creation
Trending Discussions on sequelize

QUESTION

Heroku Shopify Application Error 'npm ERR! ERESOLVE unable to resolve dependency tree'

Asked 2022-Apr-03 at 07:31

Greetings I have a problem with Heroku because it's don't want to install legacy packages for my Shopify app, my Shopify app is on Github and I just set up everything that my application needs, but when I deploy the main branch on Heroku I get this error in Heroku console below, can someone help me fix this?

-----> Building on the Heroku-20 stack
-----> Using buildpack: heroku/nodejs
-----> Node.js app detected
       
-----> Creating runtime environment
       
       NPM_CONFIG_LOGLEVEL=error
       USE_NPM_INSTALL=true
       NODE_VERBOSE=false
       NODE_ENV=production
       NODE_MODULES_CACHE=false
       
-----> Installing binaries
       engines.node (package.json):  unspecified
       engines.npm (package.json):   unspecified (use default)
       
       Resolving node version 16.x...
       Downloading and installing node 16.14.0...
       Using default npm version: 8.3.1
       
-----> Restoring cache
       Caching has been disabled because NODE_MODULES_CACHE=false
       
-----> Installing dependencies
       Installing node modules (package.json + package-lock)
       npm ERR! code ERESOLVE
       npm ERR! ERESOLVE unable to resolve dependency tree
       npm ERR! 
       npm ERR! While resolving: shopify-app-node@1.0.0
       npm ERR! Found: react@16.14.0
       npm ERR! node_modules/react
       npm ERR!   react@"^16.10.1" from the root project
       npm ERR! 
       npm ERR! Could not resolve dependency:
       npm ERR! peer react@"^17.0.2 || ^18.0.0-0" from next@12.0.10
       npm ERR! node_modules/next
       npm ERR!   next@"^12.0.2" from the root project
       npm ERR! 
       npm ERR! Fix the upstream dependency conflict, or retry
       npm ERR! this command with --force, or --legacy-peer-deps
       npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
       npm ERR! 
       npm ERR! See /tmp/npmcache.CTfHl/eresolve-report.txt for a full report.
       
       npm ERR! A complete log of this run can be found in:
       npm ERR!     /tmp/npmcache.CTfHl/_logs/2022-02-10T12_18_50_156Z-debug-0.log
-----> Build failed
       
       We're sorry this build is failing! You can troubleshoot common issues here:
       https://devcenter.heroku.com/articles/troubleshooting-node-deploys
       
       Some possible problems:
       
       - Node version not specified in package.json
         https://devcenter.heroku.com/articles/nodejs-support#specifying-a-node-js-version
       
       Love,
       Heroku
       
 !     Push rejected, failed to compile Node.js app.
 !     Push failed

My package.json

{
  "name": "shopify-app-node",
  "version": "1.0.0",
  "description": "Shopify's node app for CLI tool",
  "scripts": {
    "test": "jest",
    "dev": "cross-env NODE_ENV=development nodemon ./server/index.js --watch ./server/index.js",
    "build": "NEXT_TELEMETRY_DISABLED=1 next build",
    "start": "cross-env NODE_ENV=production node ./server/index.js"
  },
  "engines": {
    "node": "16.14.0",
    "npm": "8.4.1"
  },
  "repository": {
    "type": "git",
    "url": "git+https://github.com/Shopify/shopify-app-node.git"
  },
  "author": "Shopify Inc.",
  "license": "MIT",
  "bugs": {
    "url": "https://github.com/shopify/shopify-app-node/issues"
  },
  "dependencies": {
    "@babel/core": "7.12.10",
    "@babel/polyfill": "^7.6.0",
    "@babel/preset-env": "^7.12.11",
    "@babel/register": "^7.12.10",
    "@shopify/app-bridge-react": "^2.0.2",
    "@shopify/app-bridge-utils": "^2.0.2",
    "@shopify/koa-shopify-auth": "^4.1.2",
    "@shopify/polaris": "^6.2.0",
    "apollo-boost": "^0.4.9",
    "axios": "^0.25.0",
    "cross-env": "^7.0.3",
    "dotenv": "^8.2.0",
    "graphql": "^14.5.8",
    "isomorphic-fetch": "^3.0.0",
    "koa": "^2.13.1",
    "koa-bodyparser": "^4.3.0",
    "koa-compress": "^5.1.0",
    "koa-cors": "0.0.16",
    "koa-logger": "^3.2.1",
    "koa-router": "^10.0.0",
    "koa-session": "^6.1.0",
    "mysql2": "^2.3.3",
    "next": "^12.0.2",
    "next-env": "^1.1.0",
    "node-fetch": "^2.6.7",
    "react": "^16.10.1",
    "react-apollo": "^3.1.3",
    "react-dom": "^16.10.1",
    "sequelize": "^6.13.0",
    "slugify": "^1.6.5",
    "validator": "^13.7.0",
    "webpack": "^4.44.1"
  },
  "devDependencies": {
    "@babel/plugin-transform-runtime": "^7.12.10",
    "@babel/preset-stage-3": "^7.0.0",
    "babel-jest": "26.6.3",
    "babel-register": "^6.26.0",
    "enzyme": "3.11.0",
    "enzyme-adapter-react-16": "1.15.6",
    "husky": "^4.3.6",
    "jest": "26.6.3",
    "lint-staged": "^10.5.4",
    "nodemon": "^2.0.7",
    "prettier": "2.2.1",
    "react-addons-test-utils": "15.6.2",
    "react-test-renderer": "16.14.0"
  },
  "husky": {
    "hooks": {
      "pre-commit": "lint-staged"
    }
  },
  "lint-staged": {
    "*.{js,css,json,md}": [
      "prettier --write"
    ]
  }
}

ANSWER

Answered 2022-Feb-10 at 13:23

Your lock file contains conflicting dependencies. Since you were able to reproduce the error locally using npm ci we have a good way to test a fix locally.

It looks like you are depending directly on React 16. Is that something that you need directly, or is it just a dependency for Next.js?

If it's not something you need directly, upgrade it per the Next.js docs:

npm install react@latest react-dom@latest

That should modify your package-lock.json. Then try installing from the lock file again with npm ci. If that fixes things, commit the change and redeploy.

On the other hand, if you are directly depending on React 16 and cannot upgrade you'll have to consider rolling back to an earlier version of Next.js.

Source https://stackoverflow.com/questions/71065040

Community Discussions, Code Snippets contain sources that include Stack Exchange Network

Vulnerabilities

No vulnerabilities reported

Install sequelize

You can install using 'npm i findhit-sequelize' or download it from GitHub, npm.

Support

Do you like Sequelize and would like to give back to the engineering team behind it?. We have recently created an OpenCollective based money pool which is shared amongst all core maintainers based on their contributions. Every support is wholeheartedly welcome. ❤️.

DOWNLOAD this Library from

Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
over 430 million Knowledge Items
Find more libraries
Reuse Solution Kits and Libraries Curated by Popular Use Cases

Save this library and start creating your kit

Explore Related Topics

Share this Page

share link
Consider Popular SQL Database Libraries
Compare SQL Database Libraries with Highest Support
Compare SQL Database Libraries with Highest Quality
Compare SQL Database Libraries with Highest Security
Compare SQL Database Libraries with Permissive License
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
over 430 million Knowledge Items
Find more libraries
Reuse Solution Kits and Libraries Curated by Popular Use Cases

Save this library and start creating your kit

  • © 2022 Open Weaver Inc.