ah-sequelize-plugin
Advanced tools
Comparing version 0.7.5 to 0.8.0
@@ -29,2 +29,6 @@ var path = require('path'); | ||
}); | ||
function currySchemaFunc(SchemaExportFunc) { | ||
return function(a,b) { return SchemaExportFunc(a,b,api) } | ||
}; | ||
@@ -64,3 +68,4 @@ api.sequelize = { | ||
var name = nameParts[(nameParts.length - 1)].split(".")[0]; | ||
api.models[name] = api.sequelize.sequelize.import(dir + '/' + file); | ||
var modelFunc = currySchemaFunc(require(dir + '/' + file)); | ||
api.models[name] = api.sequelize.sequelize.import(name, modelFunc); | ||
}); | ||
@@ -67,0 +72,0 @@ |
@@ -5,3 +5,3 @@ { | ||
"description": "I use sequelize in actionhero as an ORM", | ||
"version": "0.7.5", | ||
"version": "0.8.0", | ||
"homepage": "http://actionherojs.com", | ||
@@ -8,0 +8,0 @@ "repository": { |
@@ -23,3 +23,3 @@ # ah-sequelize-plugin | ||
```javascript | ||
module.exports = function(sequelize, DataTypes) { | ||
module.exports = function(sequelize, DataTypes, api) { | ||
return sequelize.define("Project", { | ||
@@ -32,3 +32,3 @@ name: DataTypes.STRING, | ||
Models are loaded into `api.models`, so the example above would be `api.models.Project`. | ||
Models are loaded into `api.models`, so the example above would be `api.models.Project`. These module.exports allow for a third optional parameter "api" which is the ActionHero API object. This can be used to access configs and initializer functions, among other things. | ||
@@ -35,0 +35,0 @@ ## [Migrations](http://docs.sequelizejs.com/en/latest/api/migrations) |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
13689
211
3
1