npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

sails-hook-sequeliz-blueprints

v1.3.5

Published

Sails V1.5 blueprints with sequelize V6

Downloads

24

Readme

sails-hook-sequeliz-blueprints

Sails V1.5 blueprints for sequelize ORM V6 To be used with sails-hook-sequeliz

The blueprints waterline replaced with Sequelize.

Install

Install sails-hook-sequeliz first:

$ npm install sails-hook-sequeliz --save

Install this hook with:

$ npm install sails-hook-sequeliz-blueprints --save

Sequelize dependencies:

$ npm install --save sequelize
$ npm install --save cls-hooked

Configuration

.sailsrc

"hooks": {
  "blueprints": false,
  "orm": false,
  "pubsub": false
}

Blueprints

Default blueprints configurations config/blueprints.js

module.exports.blueprints = {
  actions: true,
  shortcuts: true,
  rest: true,
  autoWatch: true,
}

Package.json

Include in package.json git reference to this package (see following example)

{
  "name": "test",
  "private": true,
  "version": "0.0.0",
  "description": "application",
  "keywords": [],
  "dependencies": {
    "@babel/preset-env": "7.15.6",
  
    "sails": "^1.5.0",
    "sails-disk": "~2.1.0",
    "sails-hook-cron": "^3.2.0",
    "sails-hook-grunt": "^5.0.0",
    "sails-hook-sequelize": "git://github.com/aristot/sails-hook-sequeliz",
    "sails-hook-sequeliz-blueprints": "git://github.com/aristot/sails-hook-sequeliz-blueprints",
    "sails-hook-sockets": "2.0.1",
    "sails-hook-validation": "^0.4.7",
    "sequelize": "^6.6.5",
    "sequelize-cli": "^6.2.0",
    "tedious": "^12.2.0",
  },
  "repository": {
    
  },
  
  "devDependencies": {
  },
  "config": {
    "grunt": "./node_modules/sails/node_modules/.bin/grunt"
  },
  "main": "app.js",
  "license": "MIT",
  "engines": {
    "node": "~14.17.x",
    "npm": "~7.20.x"
  }
}

Connections

Sequelize connection with sqlserver 2019 Express

Models

Sequelize model definition models/user.js

module.exports = {
  attributes: {
    name: {
      type: Sequelize.STRING,
      allowNull: false
    },
    age: {
      type: Sequelize.INTEGER
    }
  },
  associations: function() {
    user.hasMany(image, {
      foreignKey: {
        name: 'owner',
        allowNull: false
      }
    });
    user.belongsToMany(affiliation, {
      as: 'affiliations',
      to: 'users', // must be named as the alias in the related Model
      through: 'UserAffiliation',
      foreignKey: {
        name: 'userId',
        as: 'affiliations'
      }
    });
  },
  options: {
    tableName: 'user',
    classMethods: {},
    instanceMethods: {},
    hooks: {}
  }
};

New version 2021 customized for new Sail V1.5 version and Sequelize V6 version

This is an experimental hook developed by Raymond FEST from ARISTOT compagny and tested with sqlServer 2019 database populate is disabled reduce usage of lodash

2020 03 05 fix bug with util objCompact

Credits

A big thanks to festo/sailsjs-sequelize-example and Manuel Darveau's answer that turn this possible with thier sequelize implementations.

Munkacsy.me

Contributions

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -m 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request

License

MIT