From cd584da5cfdccc7440288759b1cb14e20175a7d9 Mon Sep 17 00:00:00 2001 From: Jori Lallo Date: Wed, 12 Jul 2017 00:28:18 -0700 Subject: [PATCH] Upgrade sequelize and remove unique email constraints --- package.json | 4 +- .../20170712055148-non-unique-email.js | 19 ++ .../20170712072234-uniq-slack-id.js | 13 + server/models/Collection.js | 250 +++++++++--------- server/models/Document.js | 161 +++++------ server/models/Star.js | 28 +- server/models/Team.js | 36 ++- server/models/User.js | 71 ++--- server/models/View.js | 29 +- yarn.lock | 241 +++++++++-------- 10 files changed, 452 insertions(+), 400 deletions(-) create mode 100644 server/migrations/20170712055148-non-unique-email.js create mode 100644 server/migrations/20170712072234-uniq-slack-id.js diff --git a/package.json b/package.json index 1cc41cb3..5071b870 100644 --- a/package.json +++ b/package.json @@ -150,8 +150,8 @@ "rimraf": "^2.5.4", "safestart": "1.1.0", "sass-loader": "4.0.0", - "sequelize": "3.24.1", - "sequelize-cli": "2.4.0", + "sequelize": "^4.3.1", + "sequelize-cli": "^2.7.0", "sequelize-encrypted": "0.1.0", "slate": "^0.19.30", "slate-collapse-on-escape": "^0.2.1", diff --git a/server/migrations/20170712055148-non-unique-email.js b/server/migrations/20170712055148-non-unique-email.js new file mode 100644 index 00000000..61615b93 --- /dev/null +++ b/server/migrations/20170712055148-non-unique-email.js @@ -0,0 +1,19 @@ +module.exports = { + up: (queryInterface, Sequelize) => { + queryInterface.removeConstraint('users', 'email_unique_idx'); + queryInterface.removeConstraint('users', 'username_unique_idx'); + }, + + down: (queryInterface, Sequelize) => { + queryInterface.changeColumn('users', 'email', { + type: Sequelize.STRING, + unique: true, + allowNull: false, + }); + queryInterface.changeColumn('users', 'username', { + type: Sequelize.STRING, + unique: true, + allowNull: false, + }); + }, +}; diff --git a/server/migrations/20170712072234-uniq-slack-id.js b/server/migrations/20170712072234-uniq-slack-id.js new file mode 100644 index 00000000..2b0c37be --- /dev/null +++ b/server/migrations/20170712072234-uniq-slack-id.js @@ -0,0 +1,13 @@ +module.exports = { + up: (queryInterface, Sequelize) => { + queryInterface.changeColumn('users', 'slackId', { + type: Sequelize.STRING, + unique: true, + allowNull: false, + }); + }, + + down: (queryInterface, Sequelize) => { + queryInterface.removeConstraint('users', 'users_slack_id_idx'); + }, +}; diff --git a/server/models/Collection.js b/server/models/Collection.js index ab4222ed..762b3542 100644 --- a/server/models/Collection.js +++ b/server/models/Collection.js @@ -55,131 +55,133 @@ const Collection = sequelize.define( await collection.save(); }, }, - classMethods: { - associate: models => { - Collection.hasMany(models.Document, { - as: 'documents', - foreignKey: 'atlasId', - }); - Collection.addScope('withRecentDocuments', { - include: [ - { - as: 'documents', - limit: 10, - model: models.Document, - order: [['updatedAt', 'DESC']], - }, - ], - }); - }, - }, - instanceMethods: { - getUrl() { - // const slugifiedName = slug(this.name); - // return `/${slugifiedName}-c${this.urlId}`; - return `/collections/${this.id}`; - }, - - async getDocumentsStructure() { - // Lazy fill this.documentStructure - if (!this.documentStructure) { - this.documentStructure = this.navigationTree.children; - - // Remove parent references from all root documents - await this.navigationTree.children.forEach(async ({ id }) => { - const document = await Document.findById(id); - document.parentDocumentId = null; - await document.save(); - }); - - // Remove root document - const rootDocument = await Document.findById(this.navigationTree.id); - await rootDocument.destroy(); - - await this.save(); - } - - return this.documentStructure; - }, - - async addDocumentToStructure(document, index) { - if (!this.documentStructure) return; - - if (!document.parentDocumentId) { - this.documentStructure.splice( - index || this.documentStructure.length, - 0, - document.toJSON() - ); - // Sequelize doesn't seem to set the value with splice on JSONB field - this.documentStructure = this.documentStructure; - } else { - this.documentStructure = this.documentStructure.map(childDocument => { - if (document.parentDocumentId === childDocument.id) { - childDocument.children.splice( - index || childDocument.children.length, - 0, - document.toJSON() - ); - } - return childDocument; - }); - } - - await this.save(); - return this; - }, - - async updateDocument(updatedDocument) { - if (!this.documentStructure) return; - const { id } = updatedDocument; - - const updateChildren = documents => { - return documents.map(document => { - if (document.id === id) { - document = { - ...updatedDocument.toJSON(), - children: document.children, - }; - } else { - document.children = updateChildren(document.children); - } - return document; - }); - }; - - this.documentStructure = updateChildren(this.documentStructure); - await this.save(); - return this; - }, - - async deleteDocument(document) { - if (!this.documentStructure) return; - - const deleteFromChildren = (children, id) => { - if (_.find(children, { id })) { - _.remove(children, { id }); - } else { - children = children.map(childDocument => { - return { - ...childDocument, - children: deleteFromChildren(childDocument.children, id), - }; - }); - } - return children; - }; - - this.documentStructure = deleteFromChildren( - this.documentStructure, - document.id - ); - - await this.save(); - return this; - }, - }, } ); +// Class methods + +Collection.associate = models => { + Collection.hasMany(models.Document, { + as: 'documents', + foreignKey: 'atlasId', + }); + Collection.addScope('withRecentDocuments', { + include: [ + { + as: 'documents', + limit: 10, + model: models.Document, + order: [['updatedAt', 'DESC']], + }, + ], + }); +}; + +// Instance methods + +Collection.prototype.getUrl = function() { + // const slugifiedName = slug(this.name); + // return `/${slugifiedName}-c${this.urlId}`; + return `/collections/${this.id}`; +}; + +Collection.prototype.getDocumentsStructure = async function() { + // Lazy fill this.documentStructure + if (!this.documentStructure) { + this.documentStructure = this.navigationTree.children; + + // Remove parent references from all root documents + await this.navigationTree.children.forEach(async ({ id }) => { + const document = await Document.findById(id); + document.parentDocumentId = null; + await document.save(); + }); + + // Remove root document + const rootDocument = await Document.findById(this.navigationTree.id); + await rootDocument.destroy(); + + await this.save(); + } + + return this.documentStructure; +}; + +Collection.prototype.addDocumentToStructure = async function(document, index) { + if (!this.documentStructure) return; + + if (!document.parentDocumentId) { + this.documentStructure.splice( + index || this.documentStructure.length, + 0, + document.toJSON() + ); + // Sequelize doesn't seem to set the value with splice on JSONB field + this.documentStructure = this.documentStructure; + } else { + this.documentStructure = this.documentStructure.map(childDocument => { + if (document.parentDocumentId === childDocument.id) { + childDocument.children.splice( + index || childDocument.children.length, + 0, + document.toJSON() + ); + } + return childDocument; + }); + } + + await this.save(); + return this; +}; + +Collection.prototype.updateDocument = async function(updatedDocument) { + if (!this.documentStructure) return; + const { id } = updatedDocument; + + const updateChildren = documents => { + return documents.map(document => { + if (document.id === id) { + document = { + ...updatedDocument.toJSON(), + children: document.children, + }; + } else { + document.children = updateChildren(document.children); + } + return document; + }); + }; + + this.documentStructure = updateChildren(this.documentStructure); + await this.save(); + return this; +}; + +Collection.prototype.deleteDocument = async function(document) { + if (!this.documentStructure) return; + + const deleteFromChildren = (children, id) => { + if (_.find(children, { id })) { + _.remove(children, { id }); + } else { + children = children.map(childDocument => { + return { + ...childDocument, + children: deleteFromChildren(childDocument.children, id), + }; + }); + } + return children; + }; + + this.documentStructure = deleteFromChildren( + this.documentStructure, + document.id + ); + + await this.save(); + return this; +}; + export default Collection; diff --git a/server/models/Document.js b/server/models/Document.js index d4917756..1cf4a5b9 100644 --- a/server/models/Document.js +++ b/server/models/Document.js @@ -98,69 +98,59 @@ const Document = sequelize.define( afterCreate: createRevision, afterUpdate: createRevision, }, - instanceMethods: { - getUrl() { - const slugifiedTitle = slugify(this.title); - return `/doc/${slugifiedTitle}-${this.urlId}`; - }, - toJSON() { - // Warning: only use for new documents as order of children is - // handled in the collection's documentStructure - return { - id: this.id, - title: this.title, - url: this.getUrl(), - children: [], - }; - }, - }, - classMethods: { - associate: models => { - Document.belongsTo(models.Collection, { - as: 'collection', - foreignKey: 'atlasId', - }); - Document.belongsTo(models.User, { - as: 'createdBy', - foreignKey: 'createdById', - }); - Document.belongsTo(models.User, { - as: 'updatedBy', - foreignKey: 'lastModifiedById', - }); - Document.hasMany(models.Star, { - as: 'starred', - }); - Document.addScope( - 'defaultScope', - { - include: [ - { model: models.Collection, as: 'collection' }, - { model: models.User, as: 'createdBy' }, - { model: models.User, as: 'updatedBy' }, - ], - }, - { override: true } - ); - }, - findById: async id => { - if (isUUID(id)) { - return Document.findOne({ - where: { id }, - }); - } else if (id.match(URL_REGEX)) { - return Document.findOne({ - where: { - urlId: id.match(URL_REGEX)[1], - }, - }); - } - }, - searchForUser: async (user, query, options = {}) => { - const limit = options.limit || 15; - const offset = options.offset || 0; + } +); - const sql = ` +// Class methods + +Document.associate = models => { + Document.belongsTo(models.Collection, { + as: 'collection', + foreignKey: 'atlasId', + }); + Document.belongsTo(models.User, { + as: 'createdBy', + foreignKey: 'createdById', + }); + Document.belongsTo(models.User, { + as: 'updatedBy', + foreignKey: 'lastModifiedById', + }); + Document.hasMany(models.Star, { + as: 'starred', + }); + Document.addScope( + 'defaultScope', + { + include: [ + { model: models.Collection, as: 'collection' }, + { model: models.User, as: 'createdBy' }, + { model: models.User, as: 'updatedBy' }, + ], + }, + { override: true } + ); +}; + +Document.findById = async id => { + if (isUUID(id)) { + return Document.findOne({ + where: { id }, + }); + } else if (id.match(URL_REGEX)) { + return Document.findOne({ + where: { + urlId: id.match(URL_REGEX)[1], + }, + }); + } +}; + +Document.searchForUser = async (user, query, options = {}) => { + const limit = options.limit || 15; + const offset = options.offset || 0; + + const sql = ` SELECT * FROM documents WHERE "searchVector" @@ plainto_tsquery('english', :query) AND "teamId" = '${user.teamId}'::uuid AND @@ -169,22 +159,37 @@ const Document = sequelize.define( LIMIT :limit OFFSET :offset; `; - const ids = await sequelize - .query(sql, { - replacements: { - query, - limit, - offset, - }, - model: Document, - }) - .map(document => document.id); - return Document.findAll({ - where: { id: ids }, - }); + const ids = await sequelize + .query(sql, { + replacements: { + query, + limit, + offset, }, - }, - } -); + model: Document, + }) + .map(document => document.id); + return Document.findAll({ + where: { id: ids }, + }); +}; + +// Instance methods + +Document.prototype.getUrl = function() { + const slugifiedTitle = slugify(this.title); + return `/doc/${slugifiedTitle}-${this.urlId}`; +}; + +Document.prototype.toJSON = function() { + // Warning: only use for new documents as order of children is + // handled in the collection's documentStructure + return { + id: this.id, + title: this.title, + url: this.getUrl(), + children: [], + }; +}; export default Document; diff --git a/server/models/Star.js b/server/models/Star.js index c3ce354d..43d40452 100644 --- a/server/models/Star.js +++ b/server/models/Star.js @@ -1,23 +1,17 @@ // @flow import { DataTypes, sequelize } from '../sequelize'; -const Star = sequelize.define( - 'star', - { - id: { - type: DataTypes.UUID, - defaultValue: DataTypes.UUIDV4, - primaryKey: true, - }, +const Star = sequelize.define('star', { + id: { + type: DataTypes.UUID, + defaultValue: DataTypes.UUIDV4, + primaryKey: true, }, - { - classMethods: { - associate: models => { - Star.belongsTo(models.Document); - Star.belongsTo(models.User); - }, - }, - } -); +}); + +Star.associate = models => { + Star.belongsTo(models.Document); + Star.belongsTo(models.User); +}; export default Star; diff --git a/server/models/Team.js b/server/models/Team.js index 2d9e976e..5841c0da 100644 --- a/server/models/Team.js +++ b/server/models/Team.js @@ -14,25 +14,6 @@ const Team = sequelize.define( slackData: DataTypes.JSONB, }, { - classMethods: { - associate: models => { - Team.hasMany(models.Collection, { as: 'atlases' }); - Team.hasMany(models.Document, { as: 'documents' }); - Team.hasMany(models.User, { as: 'users' }); - }, - }, - instanceMethods: { - async createFirstCollection(userId) { - const atlas = await Collection.create({ - name: this.name, - description: 'Your first Collection', - type: 'atlas', - teamId: this.id, - creatorId: userId, - }); - return atlas; - }, - }, indexes: [ { unique: true, @@ -42,4 +23,21 @@ const Team = sequelize.define( } ); +Team.associate = models => { + Team.hasMany(models.Collection, { as: 'atlases' }); + Team.hasMany(models.Document, { as: 'documents' }); + Team.hasMany(models.User, { as: 'users' }); +}; + +Team.prototype.createFirstCollection = async function(userId) { + const atlas = await Collection.create({ + name: this.name, + description: 'Your first Collection', + type: 'atlas', + teamId: this.id, + creatorId: userId, + }); + return atlas; +}; + export default Team; diff --git a/server/models/User.js b/server/models/User.js index 2b09a268..69158780 100644 --- a/server/models/User.js +++ b/server/models/User.js @@ -1,3 +1,4 @@ +// @flow import crypto from 'crypto'; import bcrypt from 'bcrypt'; import { DataTypes, sequelize, encryptedFields } from '../sequelize'; @@ -14,50 +15,18 @@ const User = sequelize.define( defaultValue: DataTypes.UUIDV4, primaryKey: true, }, - email: { type: DataTypes.STRING, unique: true }, - username: { type: DataTypes.STRING, unique: true }, + email: { type: DataTypes.STRING }, + username: { type: DataTypes.STRING }, name: DataTypes.STRING, password: DataTypes.VIRTUAL, passwordDigest: DataTypes.STRING, isAdmin: DataTypes.BOOLEAN, slackAccessToken: encryptedFields.vault('slackAccessToken'), - slackId: { type: DataTypes.STRING, allowNull: true }, + slackId: { type: DataTypes.STRING, allowNull: true, unique: true }, slackData: DataTypes.JSONB, jwtSecret: encryptedFields.vault('jwtSecret'), }, { - classMethods: { - associate: models => { - User.hasMany(models.ApiKey, { as: 'apiKeys' }); - User.hasMany(models.Document, { as: 'documents' }); - User.hasMany(models.View, { as: 'views' }); - }, - }, - instanceMethods: { - getJwtToken() { - return JWT.sign({ id: this.id }, this.jwtSecret); - }, - async getTeam() { - return this.team; - }, - verifyPassword(password) { - return new Promise((resolve, reject) => { - if (!this.passwordDigest) { - resolve(false); - return; - } - - bcrypt.compare(password, this.passwordDigest, (err, ok) => { - if (err) { - reject(err); - return; - } - - resolve(ok); - }); - }); - }, - }, indexes: [ { fields: ['email'], @@ -66,6 +35,38 @@ const User = sequelize.define( } ); +// Class methods +User.associate = models => { + User.hasMany(models.ApiKey, { as: 'apiKeys' }); + User.hasMany(models.Document, { as: 'documents' }); + User.hasMany(models.View, { as: 'views' }); +}; + +// Instance methods +User.prototype.getJwtToken = function() { + return JWT.sign({ id: this.id }, this.jwtSecret); +}; +User.prototype.getTeam = async function() { + return this.team; +}; +User.prototype.verifyPassword = function(password) { + return new Promise((resolve, reject) => { + if (!this.passwordDigest) { + resolve(false); + return; + } + + bcrypt.compare(password, this.passwordDigest, (err, ok) => { + if (err) { + reject(err); + return; + } + + resolve(ok); + }); + }); +}; + const setRandomJwtSecret = model => { model.jwtSecret = crypto.randomBytes(64).toString('hex'); }; diff --git a/server/models/View.js b/server/models/View.js index 80d6b212..840f3a55 100644 --- a/server/models/View.js +++ b/server/models/View.js @@ -15,21 +15,22 @@ const View = sequelize.define( }, }, { - classMethods: { - associate: models => { - View.belongsTo(models.Document); - View.belongsTo(models.User); - }, - increment: async where => { - const [model, created] = await View.findOrCreate({ where }); - if (!created) { - model.count += 1; - model.save(); - } - return model; - }, - }, + classMethods: {}, } ); +View.associate = models => { + View.belongsTo(models.Document); + View.belongsTo(models.User); +}; + +View.increment = async where => { + const [model, created] = await View.findOrCreate({ where }); + if (!created) { + model.count += 1; + model.save(); + } + return model; +}; + export default View; diff --git a/yarn.lock b/yarn.lock index b58e8cbc..d76cbf87 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,6 +2,10 @@ # yarn lockfile v1 +"@types/node@^6.0.48": + version "6.0.80" + resolved "https://registry.yarnpkg.com/@types/node/-/node-6.0.80.tgz#914a75799605b4609bd9a2918c865ba3c4141367" + Base64@~0.2.0: version "0.2.1" resolved "https://registry.yarnpkg.com/Base64/-/Base64-0.2.1.tgz#ba3a4230708e186705065e66babdd4c35cf60028" @@ -1060,7 +1064,11 @@ block-stream@*: dependencies: inherits "~2.0.0" -bluebird@^3.0.1, bluebird@^3.0.5, bluebird@^3.1.1, bluebird@^3.3.4, bluebird@^3.3.5: +bluebird@^3.0.5, bluebird@^3.1.1, bluebird@^3.4.1, bluebird@^3.5.0: + version "3.5.0" + resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.5.0.tgz#791420d7f551eea2897453a8a77653f96606d67c" + +bluebird@^3.3.5, bluebird@^3.4.6: version "3.4.6" resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.4.6.tgz#01da8d821d87813d158967e743d5fe6c62cf8c0f" @@ -1497,13 +1505,15 @@ clean-css@3.4.x: commander "2.8.x" source-map "0.4.x" -cli-color@~0.3.2: - version "0.3.3" - resolved "https://registry.yarnpkg.com/cli-color/-/cli-color-0.3.3.tgz#12d5bdd158ff8a0b0db401198913c03df069f6f5" +cli-color@~1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/cli-color/-/cli-color-1.2.0.tgz#3a5ae74fd76b6267af666e69e2afbbd01def34d1" dependencies: - d "~0.1.1" - es5-ext "~0.10.6" - memoizee "~0.3.8" + ansi-regex "^2.1.1" + d "1" + es5-ext "^0.10.12" + es6-iterator "2" + memoizee "^0.4.3" timers-ext "0.1" cli-cursor@^1.0.1, cli-cursor@^1.0.2: @@ -1576,6 +1586,13 @@ clone@^1.0.0, clone@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/clone/-/clone-1.0.2.tgz#260b7a99ebb1edfe247538175f783243cb19d149" +cls-bluebird@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/cls-bluebird/-/cls-bluebird-2.0.1.tgz#c259a480ae02c0e506134307bb13db30446ee2e7" + dependencies: + is-bluebird "^1.0.2" + shimmer "^1.1.0" + co-body@^5.1.0: version "5.1.1" resolved "https://registry.yarnpkg.com/co-body/-/co-body-5.1.1.tgz#d97781d1e3344ba4a820fd1806bddf8341505236" @@ -2091,6 +2108,12 @@ currently-unhandled@^0.4.1: dependencies: array-find-index "^1.0.1" +d@1: + version "1.0.0" + resolved "https://registry.yarnpkg.com/d/-/d-1.0.0.tgz#754bb5bfe55451da69a58b94d45f4c5b0462d58f" + dependencies: + es5-ext "^0.10.9" + d@^0.1.1, d@~0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/d/-/d-0.1.1.tgz#da184c535d18d8ee7ba2aa229b914009fae11309" @@ -2160,7 +2183,7 @@ debug@2.6.7: dependencies: ms "2.0.0" -debug@^2.3.2, debug@^2.6.1, debug@^2.6.3: +debug@^2.3.0, debug@^2.3.2, debug@^2.6.1, debug@^2.6.3: version "2.6.4" resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.4.tgz#7586a9b3c39741c0282ae33445c4e8ac74734fe0" dependencies: @@ -2370,9 +2393,9 @@ dotenv@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-4.0.0.tgz#864ef1379aced55ce6f95debecdce179f7a0cd1d" -dottie@^1.0.0: - version "1.1.1" - resolved "https://registry.yarnpkg.com/dottie/-/dottie-1.1.1.tgz#45c2a3f48bd6528eeed267a69a848eaaca6faa6a" +dottie@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/dottie/-/dottie-2.0.0.tgz#da191981c8b8d713ca0115d5898cf397c2f0ddd0" double-ended-queue@^2.1.0-0: version "2.1.0-0" @@ -2510,6 +2533,12 @@ entities@^1.1.1, entities@~1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/entities/-/entities-1.1.1.tgz#6e5c2d0a5621b5dadaecef80b90edfb5cd7772f0" +env-cmd@^5.0.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/env-cmd/-/env-cmd-5.1.0.tgz#0236db393c3f033005204fcd0a92ee40723a9c9e" + dependencies: + cross-spawn "^5.0.1" + enzyme-to-json@^1.5.1: version "1.5.1" resolved "https://registry.yarnpkg.com/enzyme-to-json/-/enzyme-to-json-1.5.1.tgz#e34f4d126bb3f4696ce3800b51f9ed83df708799" @@ -2583,13 +2612,20 @@ es-to-primitive@^1.1.1: is-date-object "^1.0.1" is-symbol "^1.0.1" -es5-ext@^0.10.7, es5-ext@^0.10.8, es5-ext@~0.10.11, es5-ext@~0.10.2, es5-ext@~0.10.5, es5-ext@~0.10.6, es5-ext@~0.10.7: +es5-ext@^0.10.12, es5-ext@^0.10.7, es5-ext@^0.10.8, es5-ext@^0.10.9, es5-ext@~0.10.11: version "0.10.12" resolved "https://registry.yarnpkg.com/es5-ext/-/es5-ext-0.10.12.tgz#aa84641d4db76b62abba5e45fd805ecbab140047" dependencies: es6-iterator "2" es6-symbol "~3.1" +es5-ext@^0.10.13, es5-ext@~0.10.2, es5-ext@~0.10.7: + version "0.10.24" + resolved "https://registry.yarnpkg.com/es5-ext/-/es5-ext-0.10.24.tgz#a55877c9924bc0c8d9bd3c2cbe17495ac1709b14" + dependencies: + es6-iterator "2" + es6-symbol "~3.1" + es6-iterator@2: version "2.0.0" resolved "https://registry.yarnpkg.com/es6-iterator/-/es6-iterator-2.0.0.tgz#bd968567d61635e33c0b80727613c9cb4b096bac" @@ -2598,14 +2634,6 @@ es6-iterator@2: es5-ext "^0.10.7" es6-symbol "3" -es6-iterator@~0.1.3: - version "0.1.3" - resolved "https://registry.yarnpkg.com/es6-iterator/-/es6-iterator-0.1.3.tgz#d6f58b8c4fc413c249b4baa19768f8e4d7c8944e" - dependencies: - d "~0.1.1" - es5-ext "~0.10.5" - es6-symbol "~2.0.1" - es6-map@^0.1.3, es6-map@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/es6-map/-/es6-map-0.1.4.tgz#a34b147be224773a4d7da8072794cefa3632b897" @@ -2642,13 +2670,6 @@ es6-symbol@3, es6-symbol@^3.0.2, es6-symbol@~3.1, es6-symbol@~3.1.0: d "~0.1.1" es5-ext "~0.10.11" -es6-symbol@~2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/es6-symbol/-/es6-symbol-2.0.1.tgz#761b5c67cfd4f1d18afb234f691d678682cb3bf3" - dependencies: - d "~0.1.1" - es5-ext "~0.10.5" - es6-weak-map@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/es6-weak-map/-/es6-weak-map-2.0.1.tgz#0d2bbd8827eb5fb4ba8f97fbfea50d43db21ea81" @@ -2658,15 +2679,6 @@ es6-weak-map@^2.0.1: es6-iterator "2" es6-symbol "3" -es6-weak-map@~0.1.4: - version "0.1.4" - resolved "https://registry.yarnpkg.com/es6-weak-map/-/es6-weak-map-0.1.4.tgz#706cef9e99aa236ba7766c239c8b9e286ea7d228" - dependencies: - d "~0.1.1" - es5-ext "~0.10.6" - es6-iterator "~0.1.3" - es6-symbol "~2.0.1" - escape-html@1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/escape-html/-/escape-html-1.0.2.tgz#d77d32fa98e38c2f41ae85e9278e0e0e6ba1022c" @@ -2871,7 +2883,7 @@ etag@^1.5.1, etag@~1.7.0: version "1.7.0" resolved "https://registry.yarnpkg.com/etag/-/etag-1.7.0.tgz#03d30b5f67dd6e632d2945d30d6652731a34d5d8" -event-emitter@~0.3.4: +event-emitter@^0.3.4, event-emitter@~0.3.4: version "0.3.4" resolved "https://registry.yarnpkg.com/event-emitter/-/event-emitter-0.3.4.tgz#8d63ddfb4cfe1fae3b32ca265c4c720222080bb5" dependencies: @@ -3270,16 +3282,6 @@ fs-exists-sync@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/fs-exists-sync/-/fs-exists-sync-0.1.0.tgz#982d6893af918e72d08dec9e8673ff2b5a8d6add" -fs-extra@^0.28.0: - version "0.28.0" - resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-0.28.0.tgz#9a1c0708ea8c5169297ab06fd8cb914f5647b272" - dependencies: - graceful-fs "^4.1.2" - jsonfile "^2.1.0" - klaw "^1.0.0" - path-is-absolute "^1.0.0" - rimraf "^2.2.8" - fs-extra@^2.0.0: version "2.1.2" resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-2.1.2.tgz#046c70163cef9aad46b0e4a7fa467fb22d71de35" @@ -3376,6 +3378,10 @@ generic-pool@2.4.2: version "2.4.2" resolved "https://registry.yarnpkg.com/generic-pool/-/generic-pool-2.4.2.tgz#886bc5bf0beb7db96e81bcbba078818de5a62683" +generic-pool@^3.1.6: + version "3.1.7" + resolved "https://registry.yarnpkg.com/generic-pool/-/generic-pool-3.1.7.tgz#dac22b2c7a7a04e41732f7d8d2d25a303c88f662" + get-caller-file@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-1.0.2.tgz#f702e63127e7e231c160a80c1554acb70d5047e5" @@ -4027,7 +4033,7 @@ inflation@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/inflation/-/inflation-2.0.0.tgz#8b417e47c28f925a45133d914ca1fd389107f30f" -inflection@^1.6.0: +inflection@1.10.0: version "1.10.0" resolved "https://registry.yarnpkg.com/inflection/-/inflection-1.10.0.tgz#5bffcb1197ad3e81050f8e17e21668087ee9eb2f" @@ -4118,6 +4124,10 @@ is-binary-path@^1.0.0: dependencies: binary-extensions "^1.0.0" +is-bluebird@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/is-bluebird/-/is-bluebird-1.0.2.tgz#096439060f4aa411abee19143a84d6a55346d6e2" + is-buffer@^1.0.2, is-buffer@~1.1.1: version "1.1.4" resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.4.tgz#cfc86ccd5dc5a52fa80489111c6920c457e2d98b" @@ -4269,7 +4279,7 @@ is-primitive@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/is-primitive/-/is-primitive-2.0.0.tgz#207bab91638499c07b2adf240a41a87210034575" -is-promise@^2.1.0: +is-promise@^2.1, is-promise@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/is-promise/-/is-promise-2.1.0.tgz#79a2a9ece7f096e80f36d2b2f3bc16c1ff4bf3fa" @@ -4703,9 +4713,9 @@ js-base64@^2.1.9: version "2.1.9" resolved "https://registry.yarnpkg.com/js-base64/-/js-base64-2.1.9.tgz#f0e80ae039a4bd654b5f281fc93f04a914a7fcce" -js-beautify@^1.5.4: - version "1.6.4" - resolved "https://registry.yarnpkg.com/js-beautify/-/js-beautify-1.6.4.tgz#a9af79699742ac9a1b6fddc1fdbc78bc4d515fc3" +js-beautify@^1.6.11: + version "1.6.14" + resolved "https://registry.yarnpkg.com/js-beautify/-/js-beautify-1.6.14.tgz#d3b8f7322d02b9277d58bd238264c327e58044cd" dependencies: config-chain "~1.1.5" editorconfig "^0.13.2" @@ -4894,10 +4904,6 @@ kind-of@^3.0.2: dependencies: is-buffer "^1.0.2" -klaw@^1.0.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/klaw/-/klaw-1.3.0.tgz#8857bfbc1d824badf13d3d0241d8bbe46fb12f73" - koa-bodyparser@4.2.0: version "4.2.0" resolved "https://registry.yarnpkg.com/koa-bodyparser/-/koa-bodyparser-4.2.0.tgz#bce6e08bc65f8709b6d1faa9411c7f0d8938aa54" @@ -5480,11 +5486,7 @@ lodash.words@^3.0.0: dependencies: lodash._root "^3.0.0" -lodash@4.12.0: - version "4.12.0" - resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.12.0.tgz#2bd6dc46a040f59e686c972ed21d93dc59053258" - -lodash@^4.0.0, lodash@^4.10.0, lodash@^4.11.1, lodash@^4.14.0, lodash@^4.15.0, lodash@^4.17.2, lodash@^4.17.4, lodash@^4.2.0, lodash@^4.3.0, lodash@^4.6.1: +lodash@^4.0.0, lodash@^4.11.1, lodash@^4.14.0, lodash@^4.15.0, lodash@^4.17.0, lodash@^4.17.1, lodash@^4.17.2, lodash@^4.17.4, lodash@^4.2.0, lodash@^4.3.0, lodash@^4.6.1: version "4.17.4" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae" @@ -5642,16 +5644,17 @@ media-typer@0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/media-typer/-/media-typer-0.3.0.tgz#8710d7af0aa626f8fffa1ce00168545263255748" -memoizee@~0.3.8: - version "0.3.10" - resolved "https://registry.yarnpkg.com/memoizee/-/memoizee-0.3.10.tgz#4eca0d8aed39ec9d017f4c5c2f2f6432f42e5c8f" +memoizee@^0.4.3: + version "0.4.5" + resolved "https://registry.yarnpkg.com/memoizee/-/memoizee-0.4.5.tgz#1bc3ea1e4be056dd475d521979d7be3d5e5b21c8" dependencies: - d "~0.1.1" - es5-ext "~0.10.11" - es6-weak-map "~0.1.4" - event-emitter "~0.3.4" + d "1" + es5-ext "^0.10.13" + es6-weak-map "^2.0.1" + event-emitter "^0.3.4" + is-promise "^2.1" lru-queue "0.1" - next-tick "~0.2.2" + next-tick "1" timers-ext "0.1" memory-fs@^0.2.0: @@ -5829,10 +5832,14 @@ moment-timezone@^0.5.4: dependencies: moment ">= 2.6.0" -moment@2.13.0, moment@2.x.x, "moment@>= 2.6.0", moment@^2.12.0, moment@^2.13.0, moment@^2.8.3: +moment@2.13.0, moment@^2.13.0: version "2.13.0" resolved "https://registry.yarnpkg.com/moment/-/moment-2.13.0.tgz#24162d99521e6d40f99ae6939e806d2139eaac52" +moment@2.x.x, "moment@>= 2.6.0", moment@^2.16.0, moment@^2.17.1: + version "2.18.1" + resolved "https://registry.yarnpkg.com/moment/-/moment-2.18.1.tgz#c36193dd3ce1c2eed2adb7c802dbbc77a81b1c0f" + morgan@~1.6.1: version "1.6.1" resolved "https://registry.yarnpkg.com/morgan/-/morgan-1.6.1.tgz#5fd818398c6819cba28a7cd6664f292fe1c0bbf2" @@ -5912,6 +5919,10 @@ nested-error-stacks@^1.0.0: dependencies: inherits "~2.0.1" +next-tick@1: + version "1.0.0" + resolved "https://registry.yarnpkg.com/next-tick/-/next-tick-1.0.0.tgz#ca86d1fe8828169b0120208e3dc8424b9db8342c" + next-tick@~0.2.2: version "0.2.2" resolved "https://registry.yarnpkg.com/next-tick/-/next-tick-0.2.2.tgz#75da4a927ee5887e39065880065b7336413b310d" @@ -6087,7 +6098,7 @@ node-sass@^4.5.2: sass-graph "^2.1.1" stdout-stream "^1.4.0" -node-uuid@~1.4.4, node-uuid@~1.4.7: +node-uuid@~1.4.7: version "1.4.7" resolved "https://registry.yarnpkg.com/node-uuid/-/node-uuid-1.4.7.tgz#6da5a17668c4b3dd59623bda11cf7fa4c1f60a6f" @@ -7585,11 +7596,11 @@ resolve-pathname@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/resolve-pathname/-/resolve-pathname-2.1.0.tgz#e8358801b86b83b17560d4e3c382d7aef2100944" -resolve@1.1.7, resolve@^1.0.0, resolve@^1.1.6, resolve@^1.1.7: +resolve@1.1.7, resolve@^1.0.0: version "1.1.7" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b" -resolve@^1.3.2: +resolve@^1.1.6, resolve@^1.1.7, resolve@^1.3.2: version "1.3.3" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.3.3.tgz#655907c3469a8680dc2de3a275a8fdd69691f0e5" dependencies: @@ -7759,47 +7770,49 @@ sentence-case@^2.1.0: no-case "^2.2.0" upper-case-first "^1.1.2" -sequelize-cli@2.4.0: - version "2.4.0" - resolved "https://registry.yarnpkg.com/sequelize-cli/-/sequelize-cli-2.4.0.tgz#b82e02708c7cdf628e9e6de4176f1adcd6ecdd8b" +sequelize-cli@^2.7.0: + version "2.7.0" + resolved "https://registry.yarnpkg.com/sequelize-cli/-/sequelize-cli-2.7.0.tgz#122c26bf46609001fbc158404529f795f3950ea2" dependencies: - bluebird "^3.3.4" - cli-color "~0.3.2" + bluebird "^3.5.0" + cli-color "~1.2.0" findup-sync "^0.4.0" - fs-extra "^0.28.0" + fs-extra "^2.0.0" gulp "^3.9.1" gulp-help "~1.6.1" - js-beautify "^1.5.4" - lodash "^4.10.0" - moment "^2.12.0" - resolve "^1.0.0" - umzug "^1.9.1" - yargs "^4.2.0" + js-beautify "^1.6.11" + lodash "^4.17.4" + moment "^2.17.1" + resolve "^1.3.2" + umzug "^1.11.0" + yargs "^7.0.1" sequelize-encrypted@0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/sequelize-encrypted/-/sequelize-encrypted-0.1.0.tgz#f9c7a94dc1b4413e1347a49f06cd07b7f3bf9916" -sequelize@3.24.1: - version "3.24.1" - resolved "https://registry.yarnpkg.com/sequelize/-/sequelize-3.24.1.tgz#d92903bf1ba4ab0cd138edb15a6c42078fd3db69" +sequelize@^4.3.1: + version "4.3.1" + resolved "https://registry.yarnpkg.com/sequelize/-/sequelize-4.3.1.tgz#cd735f1a0267e4fa1d8d22756d02f4e963b808d0" dependencies: - bluebird "^3.3.4" + bluebird "^3.4.6" + cls-bluebird "^2.0.1" + debug "^2.3.0" depd "^1.1.0" - dottie "^1.0.0" - generic-pool "2.4.2" - inflection "^1.6.0" - lodash "4.12.0" + dottie "^2.0.0" + env-cmd "^5.0.0" + generic-pool "^3.1.6" + inflection "1.10.0" + lodash "^4.17.1" moment "^2.13.0" moment-timezone "^0.5.4" - node-uuid "~1.4.4" retry-as-promised "^2.0.0" semver "^5.0.1" - shimmer "1.1.0" - terraformer-wkt-parser "^1.1.0" + terraformer-wkt-parser "^1.1.2" toposort-class "^1.0.1" - validator "^5.2.0" - wkx "0.2.0" + uuid "^3.0.0" + validator "^6.3.0" + wkx "^0.4.1" sequencify@~0.0.7: version "0.0.7" @@ -7884,7 +7897,7 @@ shellwords@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/shellwords/-/shellwords-0.1.0.tgz#66afd47b6a12932d9071cbfd98a52e785cd0ba14" -shimmer@1.1.0: +shimmer@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/shimmer/-/shimmer-1.1.0.tgz#97d7377137ffbbab425522e429fe0aa89a488b35" @@ -8342,7 +8355,7 @@ tar@^2.0.0, tar@~2.2.0, tar@~2.2.1: fstream "^1.0.2" inherits "2" -terraformer-wkt-parser@^1.1.0: +terraformer-wkt-parser@^1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/terraformer-wkt-parser/-/terraformer-wkt-parser-1.1.2.tgz#336a0c8fc82094a5aff83288f69aedecd369bf0c" dependencies: @@ -8602,13 +8615,13 @@ uid-safe@~2.0.0: dependencies: base64-url "1.2.1" -umzug@^1.9.1: - version "1.11.0" - resolved "https://registry.yarnpkg.com/umzug/-/umzug-1.11.0.tgz#6531ad4b5b650957d1791f98189f435235d07cce" +umzug@^1.11.0: + version "1.12.0" + resolved "https://registry.yarnpkg.com/umzug/-/umzug-1.12.0.tgz#a79c91f2862eee3130c6c347f2b90ad68a66e8b8" dependencies: - bluebird "^3.0.1" - lodash "^4.3.0" - moment "^2.8.3" + bluebird "^3.4.1" + lodash "^4.17.0" + moment "^2.16.0" redefine "^0.2.0" resolve "^1.0.0" @@ -8763,10 +8776,14 @@ validate-npm-package-license@^3.0.1: spdx-correct "~1.0.0" spdx-expression-parse "~1.0.0" -validator@5.2.0, validator@^5.2.0: +validator@5.2.0: version "5.2.0" resolved "https://registry.yarnpkg.com/validator/-/validator-5.2.0.tgz#e66fb3ec352348c1f7232512328738d8d66a9689" +validator@^6.3.0: + version "6.3.0" + resolved "https://registry.yarnpkg.com/validator/-/validator-6.3.0.tgz#47ce23ed8d4eaddfa9d4b8ef0071b6cf1078d7c8" + value-equal@^0.2.0: version "0.2.1" resolved "https://registry.yarnpkg.com/value-equal/-/value-equal-0.2.1.tgz#c220a304361fce6994dbbedaa3c7e1a1b895871d" @@ -8972,9 +8989,11 @@ window-size@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/window-size/-/window-size-0.2.0.tgz#b4315bb4214a3d7058ebeee892e13fa24d98b075" -wkx@0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/wkx/-/wkx-0.2.0.tgz#76c24f16acd0cd8f93cd34aa331e0f7961256e84" +wkx@^0.4.1: + version "0.4.1" + resolved "https://registry.yarnpkg.com/wkx/-/wkx-0.4.1.tgz#2fc171b5e9cb55c6256fef4bde1f21be413befee" + dependencies: + "@types/node" "^6.0.48" wordwrap@0.0.2: version "0.0.2" @@ -9088,7 +9107,7 @@ yargs@^4.2.0, yargs@^4.7.1: y18n "^3.2.1" yargs-parser "^2.4.1" -yargs@^7.0.2: +yargs@^7.0.1, yargs@^7.0.2: version "7.1.0" resolved "https://registry.yarnpkg.com/yargs/-/yargs-7.1.0.tgz#6ba318eb16961727f5d284f8ea003e8d6154d0c8" dependencies: