diff --git a/.travis.yml b/.travis.yml index a821c44..d9fece1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,8 +2,8 @@ sudo: false language: node_js node_js: - '6' -- '5' -- '4' +- '8' +- node os: - osx - linux @@ -12,6 +12,6 @@ cache: directories: - $HOME/.npm before_install: -- npm config set spin false -script: npm run test:cover +- yarn config set spin false +script: yarn cover after_script: cat coverage/lcov.info | node_modules/coveralls/bin/coveralls.js diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..a67eb43 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,16 @@ + +# 0.1.0 (2017-10-24) + + +### Bug Fixes + +* **query:** add fallback name if no records exist ([1253d50](https://github.com/parch-js/rest-serializer/commit/1253d50)) + + +### Features + +* **serializer:** extend JSONSerializer ([83a8aa0](https://github.com/parch-js/rest-serializer/commit/83a8aa0)) +* **serializer:** remove associations argument from normalizeRelationships ([032e27f](https://github.com/parch-js/rest-serializer/commit/032e27f)) + + + diff --git a/docs/classes/RestSerializer.html b/docs/classes/RestSerializer.html index e8451e2..228d770 100644 --- a/docs/classes/RestSerializer.html +++ b/docs/classes/RestSerializer.html @@ -21,7 +21,7 @@

  • @@ -75,6 +75,11 @@

    RestSerializer

    +
    +
    + Extends JSONSerializer +
    +
    @@ -88,12 +93,13 @@

    Table of Contents

  • Methods
  • @@ -123,7 +129,7 @@

    Constructor

    Defined in - src/serializer.js:3 + src/serializer.js:7

    @@ -140,6 +146,234 @@

    Constructor

    Methods

    +
    +
    + _defineArrayResponse + +
    + (
      +
    • + key +
    • +
    • + records +
    • +
    ) +
    + + Object + +
    + + + private + + + + +
    +

    + Defined in + src/serializer.js:212 +

    + + + +
    + +

    Reformats the record into a RESTful object with the record name as the key. +In addition, this will add a custom toJSON method on the response object +that will serialize the response when sent through something like +express#res.send, retaining the relationships on the instance, but removing +all other extraneous data (see Sequelize instance#toJSON)

    +
    + +
    +

    Parameters:

    + +
      +
    • + key + String + + +

      the name of the record (e.g. users)

      +
      + +
    • +
    • + records + Array + + +

      Array of sequelize instances

      +
      + + + + + +
      +

      Returns:

      + +
      + Object +
      +
      + +
      +

      Example:

      + +
      +
      serializer._defineArrayResponse("users", [{
      +  dataValues: {
      +    firstName: "Hank",
      +    lastName: "Hill",
      +    projects: [1, 2]
      +  },
      +  someExtraneousProp: "foo"
      +}]);
      +
      +/**
      + * {
      + *   users: [{
      + *     dataValues: {
      + *       firstName: "Hank",
      + *       lastName: "Hill",
      + *       projects: [1, 2],
      + *     },
      + *     someExtraneousProp: "foo",
      + *     toJSON() {
      + *     }
      + *   }]
      + * }
      + *
      + * response.toJSON()
      + *
      + * {
      + *   "users": [{
      + *     firstName: "Hank",
      + *     lastName: "Hill",
      + *     projects: [1, 2],
      + *   }]
      + * }
      +
      + +
      +
      + +
      +
      + _defineSingularResponse + +
      + (
        +
      • + key +
      • +
      • + record +
      • +
      ) +
      + + Object + +
      + + + private + + + + +
      +

      + Defined in + src/serializer.js:303 +

      + + + +
      + +

      Similar to _defineArrayResponse, +the difference being that this takes a single record and returns a singular response

      +
      + +
      +

      Parameters:

      + +
        +
      • + key + String + + +

        the name of the record (e.g. users)

        +
        + +
      • +
      • + record + Object + + +

        Sequelize instance

        +
        + +
      • +
      +
      + +
      +

      Returns:

      + +
      + Object +
      +
      + +
      +

      Example:

      + +
      +
      serializer._defineSingularResponse("user", {
      +  dataValues: {
      +    firstName: "Hank",
      +    lastName: "Hill",
      +    projects: [1, 2]
      +  },
      +  someExtraneousProp: "foo",
      +});
      +
      +/**
      + * {
      + *   user: {
      + *     dataValues: {
      + *       firstName: "Hank",
      + *       lastName: "Hill",
      + *       projects: [1, 2],
      + *     someExtraneousProp: "foo",
      + *     toJSON() {
      + *     }
      + *   }
      + * }
      + *
      + * response.toJSON()
      + *
      + * {
      + *   "user": [{
      + *     "firstName": "Hank",
      + *     "lastName": "Hill",
      + *     "projects": [1, 2],
      + *   }]
      + * }
      +
      + +
      +
      +
      getRelationships @@ -167,7 +401,7 @@

      Methods

      Defined in - src/serializer.js:8 + src/serializer.js:13

      @@ -253,7 +487,7 @@

      Example:

      Defined in - src/serializer.js:47 + src/serializer.js:56

      @@ -339,7 +573,7 @@

      Example:

      Defined in - src/serializer.js:76 + src/serializer.js:85

      @@ -411,7 +645,7 @@

      Example:

      Defined in - src/serializer.js:94 + src/serializer.js:103

      @@ -493,7 +727,7 @@

      Example:

      Defined in - src/serializer.js:201 + src/serializer.js:171

      @@ -555,93 +789,6 @@

      Example:

      -
      -
      - normalizeResponse - -
      - (
        -
      • - instance -
      • -
      • - method -
      • -
      ) -
      - - Promise - -
      - - - - - - -
      -

      - Defined in - src/serializer.js:137 -

      - - - -
      - -

      Takes a single Sequelize instance and returns an object with a root key based -on the model name and a pojo record

      -
      - -
      -

      Parameters:

      - -
        -
      • - instance - Object - - - -
      • -
      • - method - String - - - -
      • -
      -
      - -
      -

      Returns:

      - -
      - Promise: -

      <Object, Error>

      - -
      -
      - -
      -

      Example:

      - -
      -
      return orm.findOne("user", 1).then(user => {
      -  return serializer.normalizeResponse(instance, "findOne");
      -}).then(response => {
      -  /**
      -   * {
      -   *   user: {
      -   *   }
      -   * }
      -})
      -
      - -
      -
      -
      normalizeSingularResponse @@ -666,7 +813,7 @@

      Example:

      Defined in - src/serializer.js:170 + src/serializer.js:142

      diff --git a/docs/data.json b/docs/data.json index 2363f55..c569b38 100644 --- a/docs/data.json +++ b/docs/data.json @@ -2,7 +2,7 @@ "project": { "name": "@parch-js/orm", "url": "https://github.com/parch-js/orm", - "version": "0.0.1", + "version": "0.1.0", "description": "RestSerializer for parch to normalize request/response" }, "files": { @@ -34,7 +34,8 @@ "plugin_for": [], "extension_for": [], "file": "src/serializer.js", - "line": 3, + "line": 7, + "extends": "JSONSerializer", "is_constructor": 1 } }, @@ -48,7 +49,7 @@ }, { "file": "src/serializer.js", - "line": 8, + "line": 13, "description": "Returns an array of ids for a give hasMany/belongsToMany relatioship", "itemtype": "method", "name": "getRelationships", @@ -75,7 +76,7 @@ }, { "file": "src/serializer.js", - "line": 47, + "line": 56, "description": "Returns the name string for the record", "itemtype": "method", "name": "keyForRecord", @@ -102,7 +103,7 @@ }, { "file": "src/serializer.js", - "line": 76, + "line": 85, "description": "Return the object key for a relationship", "itemtype": "method", "name": "keyForRelationship", @@ -124,7 +125,7 @@ }, { "file": "src/serializer.js", - "line": 94, + "line": 103, "description": "Takes an array of Sequelize instances and returns an object with a root key\nbased on the model name and an array of pojo records", "itemtype": "method", "name": "normalizeArrayResponse", @@ -146,20 +147,15 @@ }, { "file": "src/serializer.js", - "line": 137, + "line": 142, "description": "Takes a single Sequelize instance and returns an object with a root key based\non the model name and a pojo record", "itemtype": "method", - "name": "normalizeResponse", + "name": "normalizeSingularResponse", "params": [ { "name": "instance", - "description": "", + "description": "Sequelize model instance", "type": "Object" - }, - { - "name": "method", - "description": "", - "type": "String" } ], "return": { @@ -167,60 +163,104 @@ "type": "Promise" }, "example": [ - "\n```javascript\nreturn orm.findOne(\"user\", 1).then(user => {\n return serializer.normalizeResponse(instance, \"findOne\");\n}).then(response => {\n /**\n * {\n * user: {\n * }\n * }\n})\n```" + "\n```javascript\nreturn orm.findOne(\"user\", 1).then(user => {\n return serializer.normalizeSingularResponse(instance, \"findOne\");\n}).then(response => {\n /**\n * {\n * user: {\n * }\n * }\n});\n```" ], "class": "RestSerializer" }, { "file": "src/serializer.js", - "line": 170, - "description": "Takes a single Sequelize instance and returns an object with a root key based\non the model name and a pojo record", + "line": 171, "itemtype": "method", - "name": "normalizeSingularResponse", + "name": "normalizeRelationships", "params": [ { "name": "instance", "description": "Sequelize model instance", "type": "Object" + }, + { + "name": "payload", + "description": "Pojo representation of Sequelize model instance", + "type": "Object" } ], "return": { "description": "", - "type": "Promise" + "type": "Promis" }, "example": [ - "\n```javascript\nreturn orm.findOne(\"user\", 1).then(user => {\n return serializer.normalizeSingularResponse(instance, \"findOne\");\n}).then(response => {\n /**\n * {\n * user: {\n * }\n * }\n});\n```" + "\n```javascript\nreturn store.findOne(\"user\", 1).then(user => {\n return serializer.normalizeRelationships(user, user.toJSON());\n}).then(response => {\n /**\n * {\n * user: {\n * projects: [1, 2, 3]\n * }\n * }\n});\n```" ], "class": "RestSerializer" }, { "file": "src/serializer.js", - "line": 201, + "line": 212, + "description": "Reformats the record into a RESTful object with the record name as the key.\nIn addition, this will add a custom toJSON method on the response object\nthat will serialize the response when sent through something like\nexpress#res.send, retaining the relationships on the instance, but removing\nall other extraneous data (see Sequelize instance#toJSON)", "itemtype": "method", - "name": "normalizeRelationships", + "name": "_defineArrayResponse", + "access": "private", + "tagname": "", "params": [ { - "name": "instance", - "description": "Sequelize model instance", - "type": "Object" + "name": "key", + "description": "the name of the record (e.g. users)", + "type": "String" }, { - "name": "payload", - "description": "Pojo representation of Sequelize model instance", + "name": "records", + "description": "Array of sequelize instances", + "type": "Array" + } + ], + "return": { + "description": "", + "type": "Object" + }, + "example": [ + "\n```javascript\nserializer._defineArrayResponse(\"users\", [{\n dataValues: {\n firstName: \"Hank\",\n lastName: \"Hill\",\n projects: [1, 2]\n },\n someExtraneousProp: \"foo\"\n}]);\n\n/**\n * {\n * users: [{\n * dataValues: {\n * firstName: \"Hank\",\n * lastName: \"Hill\",\n * projects: [1, 2],\n * },\n * someExtraneousProp: \"foo\",\n * toJSON() {\n * }\n * }]\n * }\n *\n * response.toJSON()\n *\n * {\n * \"users\": [{\n * firstName: \"Hank\",\n * lastName: \"Hill\",\n * projects: [1, 2],\n * }]\n * }\n```" + ], + "class": "RestSerializer" + }, + { + "file": "src/serializer.js", + "line": 303, + "description": "Similar to {{#crossLink \"RestSerializer/_defineArrayResponse:method\"}}_defineArrayResponse{{/crossLink}},\nthe difference being that this takes a single record and returns a singular response", + "itemtype": "method", + "name": "_defineSingularResponse", + "access": "private", + "tagname": "", + "params": [ + { + "name": "key", + "description": "the name of the record (e.g. users)", + "type": "String" + }, + { + "name": "record", + "description": "Sequelize instance", "type": "Object" } ], "return": { - "description": "", - "type": "Promis" + "description": "", + "type": "Object" }, "example": [ - "\n```javascript\nreturn store.findOne(\"user\", 1).then(user => {\n return serializer.normalizeRelationships(user, user.toJSON());\n}).then(response => {\n /**\n * {\n * user: {\n * projects: [1, 2, 3]\n * }\n * }\n});\n```" + "\n```javascript\nserializer._defineSingularResponse(\"user\", {\n dataValues: {\n firstName: \"Hank\",\n lastName: \"Hill\",\n projects: [1, 2]\n },\n someExtraneousProp: \"foo\",\n});\n\n/**\n * {\n * user: {\n * dataValues: {\n * firstName: \"Hank\",\n * lastName: \"Hill\",\n * projects: [1, 2],\n * someExtraneousProp: \"foo\",\n * toJSON() {\n * }\n * }\n * }\n *\n * response.toJSON()\n *\n * {\n * \"user\": [{\n * \"firstName\": \"Hank\",\n * \"lastName\": \"Hill\",\n * \"projects\": [1, 2],\n * }]\n * }\n```" ], "class": "RestSerializer" } ], "warnings": [ + { + "message": "replacing incorrect tag: returns with return", + "line": " src/serializer.js:212" + }, + { + "message": "replacing incorrect tag: returns with return", + "line": " src/serializer.js:303" + }, { "message": "Missing item type\nBootstrap.js by @fat & @mdo\nplugins: bootstrap-transition.js, bootstrap-modal.js, bootstrap-dropdown.js, bootstrap-scrollspy.js, bootstrap-tab.js, bootstrap-tooltip.js, bootstrap-popover.js, bootstrap-affix.js, bootstrap-alert.js, bootstrap-button.js, bootstrap-collapse.js, bootstrap-carousel.js, bootstrap-typeahead.js\nCopyright 2012 Twitter, Inc.\nhttp://www.apache.org/licenses/LICENSE-2.0.txt", "line": " docs/assets/vendor/bootstrap/js/bootstrap.min.js:1" diff --git a/docs/files/docs_assets_vendor_bootstrap_js_bootstrap.min.js.html b/docs/files/docs_assets_vendor_bootstrap_js_bootstrap.min.js.html index 7be4ddc..5411d18 100644 --- a/docs/files/docs_assets_vendor_bootstrap_js_bootstrap.min.js.html +++ b/docs/files/docs_assets_vendor_bootstrap_js_bootstrap.min.js.html @@ -21,7 +21,7 @@

    • diff --git a/docs/files/src_serializer.js.html b/docs/files/src_serializer.js.html index 011fb10..743dda1 100644 --- a/docs/files/src_serializer.js.html +++ b/docs/files/src_serializer.js.html @@ -21,7 +21,7 @@

    • @@ -76,13 +76,18 @@

      src/serializer.js File

      +"use strict";
      +
       import inflect from "inflect";
       
      +import JSONSerializer from "@parch-js/json-serializer";
      +
       /**
        * @class RestSerializer
      + * @extends <a href="https://github.com/parch-js/json-serializer" target="_blank">JSONSerializer</a>
        * @constructor
        */
      -export default class RestSerializer {
      +export default class RestSerializer extends JSONSerializer {
         /**
          * Returns an array of ids for a give hasMany/belongsToMany relatioship
          *
      @@ -102,10 +107,10 @@ 

      src/serializer.js File

      * }); * ``` */ - async getRelationships(instance, association) { + getRelationships(instance, association) { const accessors = association.accessors; const isManyRelationship = Object.keys(accessors).some(accessor => { - return [ + const hasManyRelationshipAccessor = [ "add", "addMultiple", "count", @@ -113,12 +118,16 @@

      src/serializer.js File

      "hasAll", "removeMultiple" ].some(valid => valid === accessor); + + return hasManyRelationshipAccessor; }); if (isManyRelationship) { - const relationships = await instance[association.accessors.get](); - - return relationships.map(relationship => relationship.id); + return instance[accessors.get]().then(relationships => + relationships.map(relationship => relationship.id) + ); + } else { + return Promise.resolve(); } } @@ -190,59 +199,22 @@

      src/serializer.js File

      * }); * ``` */ - async normalizeArrayResponse(instances) { - const records = []; - const response = {}; + normalizeArrayResponse(instances, fallbackName) { let key; - for (const instance of instances) { - const json = instance.toJSON(); - - await this.normalizeRelationships(instance, json); - - records.push(json); + if (!instances || !instances.length) { + key = inflect.camelize(inflect.pluralize(fallbackName), false); - if (!key) { - key = this.keyForRecord(instance, false); - } + return Promise.resolve({ + [key]: [] + }); } - response[key] = records; - - return response; - } + return Promise.all(instances.map(instance => { + key = key || this.keyForRecord(instance, false); - /** - * Takes a single Sequelize instance and returns an object with a root key based - * on the model name and a pojo record - * - * @method normalizeResponse - * @param {Object} instance - * @param {String} method - * @return {Promise}<Object, Error> - * - * @example - * ```javascript - * return orm.findOne("user", 1).then(user => { - * return serializer.normalizeResponse(instance, "findOne"); - * }).then(response => { - * /** - * * { - * * user: { - * * } - * * } - * }) - * ``` - */ - async normalizeResponse(instance, method) { - switch (method) { - case "createRecord": - case "findOne": - case "updateRecord": - return this.normalizeSingularResponse(instance); - case "findAll": - return this.normalizeArrayResponse(instance); - } + return this.normalizeRelationships(instance, instance); + })).then(records => this._defineArrayResponse(key, records)); } /** @@ -266,14 +238,12 @@

      src/serializer.js File

      * }); * ``` */ - async normalizeSingularResponse(instance) { - const json = instance.toJSON(); + normalizeSingularResponse(instance) { const key = this.keyForRecord(instance, true); - const response = { [key]: json } - await this.normalizeRelationships(instance, response[key]); - - return response; + return this.normalizeRelationships(instance, instance).then(newRecord => + this._defineSingularResponse(key, newRecord) + ); } /** @@ -296,22 +266,199 @@

      src/serializer.js File

      * }); * ``` */ - async normalizeRelationships(instance, payload) { + normalizeRelationships(instance, payload) { const associations = instance.Model.associations; - for (const association in associations) { - const relationship = await this.getRelationships( - instance, - associations[association] - ); - const relationshipKey = this.keyForRelationship(association); + return Promise.all(Object.keys(associations).map(association => + this.getRelationships(instance, associations[association]).then(relationships => { + return { + key: this.keyForRelationship(association), + records: relationships + }; + }) + )).then(relationships => { + relationships.forEach(relationship => { + if (relationship.records) { + payload[relationship.key] = relationship.records; + } + }); + + return payload; + }); + } - if (relationship) { - payload[relationshipKey] = relationship; + /** + * Reformats the record into a RESTful object with the record name as the key. + * In addition, this will add a custom toJSON method on the response object + * that will serialize the response when sent through something like + * express#res.send, retaining the relationships on the instance, but removing + * all other extraneous data (see <a href="https://github.com/sequelize/sequelize/blob/16864699e0cc4b5fbc5bbf742b7a15eea9948e77/lib/model.js#L4005" target="_bank">Sequelize instance#toJSON</a>) + * + * @method _defineArrayResponse + * @private + * @param {String} key the name of the record (e.g. users) + * @param {Array<Object>} records Array of sequelize instances + * @returns {Object} + * + * @example + * ```javascript + * serializer._defineArrayResponse("users", [{ + * dataValues: { + * firstName: "Hank", + * lastName: "Hill", + * projects: [1, 2] + * }, + * someExtraneousProp: "foo" + * }]); + * + * /** + * * { + * * users: [{ + * * dataValues: { + * * firstName: "Hank", + * * lastName: "Hill", + * * projects: [1, 2], + * * }, + * * someExtraneousProp: "foo", + * * toJSON() { + * * } + * * }] + * * } + * * + * * response.toJSON() + * * + * * { + * * "users": [{ + * * firstName: "Hank", + * * lastName: "Hill", + * * projects: [1, 2], + * * }] + * * } + * ``` + */ + _defineArrayResponse(key, records) { + const response = {}; + + Object.defineProperty(response, key, { + configurable: false, + enumerable: true, + value: records + }); + + Object.defineProperty(response, "toJSON", { + configurable: false, + enumerable: false, + value() { + const recordArray = this[key]; + const newRecords = recordArray.map(record => { + const associations = record.Model.associations; + const newRecord = {}; + + Object.keys(associations).forEach(association => { + if (record[association]) { + newRecord[association] = record[association]; + } + }); + + const plainInstance = record.toJSON(); + + Object.keys(plainInstance).forEach(property => { + newRecord[property] = plainInstance[property]; + }); + + return newRecord; + }); + + return { + [key]: newRecords + }; } - } + }); - return payload; + return response; + } + + /** + * Similar to {{#crossLink "RestSerializer/_defineArrayResponse:method"}}_defineArrayResponse{{/crossLink}}, + * the difference being that this takes a single record and returns a singular response + * + * @method _defineSingularResponse + * @private + * @param {String} key the name of the record (e.g. users) + * @param {Object} record Sequelize instance + * @returns {Object} + * + * @example + * ```javascript + * serializer._defineSingularResponse("user", { + * dataValues: { + * firstName: "Hank", + * lastName: "Hill", + * projects: [1, 2] + * }, + * someExtraneousProp: "foo", + * }); + * + * /** + * * { + * * user: { + * * dataValues: { + * * firstName: "Hank", + * * lastName: "Hill", + * * projects: [1, 2], + * * someExtraneousProp: "foo", + * * toJSON() { + * * } + * * } + * * } + * * + * * response.toJSON() + * * + * * { + * * "user": [{ + * * "firstName": "Hank", + * * "lastName": "Hill", + * * "projects": [1, 2], + * * }] + * * } + * ``` + */ + _defineSingularResponse(key, record) { + const response = {}; + + Object.defineProperty(response, key, { + configurable: false, + enumerable: true, + value: record + }); + + Object.defineProperty(response, "toJSON", { + configurable: false, + enumerable: false, + value() { + const instance = this[key]; + const associations = instance.Model.associations; + const newRecord = {}; + + Object.keys(associations).forEach(association => { + if (instance[association]) { + newRecord[association] = instance[association]; + } + }); + + const plainInstance = instance.toJSON(); + + Object.keys(plainInstance).forEach(property => { + newRecord[property] = plainInstance[property]; + }); + + return { + [key]: newRecord + }; + } + }); + + return response; } } diff --git a/docs/index.html b/docs/index.html index 6a6faf3..3fa1ef9 100644 --- a/docs/index.html +++ b/docs/index.html @@ -21,7 +21,7 @@

    • diff --git a/index.js b/index.js index 52de6eb..985329e 100644 --- a/index.js +++ b/index.js @@ -1,6 +1,5 @@ "use strict"; -require("regenerator-runtime/runtime"); const RestSerializer = require("./lib/serializer"); module.exports = RestSerializer; diff --git a/package.json b/package.json index 6a1c8d5..6ee07da 100644 --- a/package.json +++ b/package.json @@ -1,9 +1,9 @@ { "name": "@parch-js/rest-serializer", - "version": "0.0.1", + "version": "0.1.0", "description": "RestSerializer for parch to normalize request/response", "main": "index.js", - "repository": "https://github.com/parch-js/rest-serializer", + "repository": "parch-js/rest-serializer", "author": "Dylan Foster ", "license": "MIT", "keywords": [ @@ -14,8 +14,7 @@ ], "scripts": { "build": "babel src -d lib", - "build:watch": "chokidar 'src/**' 'test/**/*.js' -c 'yarn build' --initial", - "coverage": "nyc yarn test", + "cover": "nyc yarn test", "changelog": "conventional-changelog -s -p angular -i CHANGELOG.md", "docs": "yuidoc . -o docs", "lint": "eslint ./src ./test", @@ -23,14 +22,14 @@ "prepublish": "yarn build", "pretest": "yarn build", "test": "NO_DEPRECATION=parch NODE_ENV=test mocha --recursive --compilers js:babel-register --timeout 5000", - "test:cover": "yarn coverage", - "watch": "chokidar 'src/**' 'test/**/*.js' -c 'yarn test' --initial" + "watch:build": "chokidar 'src/**' 'test/**/*.js' -c 'yarn build' --initial", + "watch:cover": "chokidar 'src/**' 'test/**/*.js' -c 'yarn cover' --initial", + "watch:test": "chokidar 'src/**' 'test/**/*.js' -c 'yarn test' --initial" }, "devDependencies": { "babel-cli": "^6.10.1", "babel-eslint": "^7.2.1", "babel-plugin-add-module-exports": "^0.2.1", - "babel-plugin-transform-async-to-generator": "^6.22.0", "babel-preset-es2015": "^6.9.0", "babel-register": "^6.9.0", "chai": "^3.5.0", @@ -40,6 +39,7 @@ "eslint": "^3.11.1", "eslint-config-unstandard": "^1.4.0", "mocha": "^3.2.0", + "nyc": "^11.2.1", "sinon": "^1.17.4", "sinon-chai": "^2.8.0", "sqlite3": "^3.1.4", @@ -47,8 +47,8 @@ "yuidocjs": "^0.10.2" }, "dependencies": { + "@parch-js/json-serializer": "^0.0.1", "inflect": "^0.3.0", - "nyc": "^10.2.0", "restify-errors": "^4.3.0", "sequelize": "^3.30.4" }, @@ -84,13 +84,10 @@ "es2015" ], "plugins": [ - "babel-plugin-add-module-exports", - "transform-regenerator", - "transform-async-to-generator" + "babel-plugin-add-module-exports" ] }, "nyc": { - "require": "regenerator-runtime/runtime", "reporter": [ "text", "lcov", diff --git a/src/serializer.js b/src/serializer.js index 3ecfb4f..e0dc220 100644 --- a/src/serializer.js +++ b/src/serializer.js @@ -2,11 +2,14 @@ import inflect from "inflect"; +import JSONSerializer from "@parch-js/json-serializer"; + /** * @class RestSerializer + * @extends JSONSerializer * @constructor */ -export default class RestSerializer { +export default class RestSerializer extends JSONSerializer { /** * Returns an array of ids for a give hasMany/belongsToMany relatioship * @@ -26,10 +29,10 @@ export default class RestSerializer { * }); * ``` */ - async getRelationships(instance, association) { + getRelationships(instance, association) { const accessors = association.accessors; const isManyRelationship = Object.keys(accessors).some(accessor => { - return [ + const hasManyRelationshipAccessor = [ "add", "addMultiple", "count", @@ -37,12 +40,16 @@ export default class RestSerializer { "hasAll", "removeMultiple" ].some(valid => valid === accessor); + + return hasManyRelationshipAccessor; }); if (isManyRelationship) { - const relationships = await instance[accessors.get](); - - return relationships.map(relationship => relationship.id); + return instance[accessors.get]().then(relationships => + relationships.map(relationship => relationship.id) + ); + } else { + return Promise.resolve(); } } @@ -114,68 +121,22 @@ export default class RestSerializer { * }); * ``` */ - async normalizeArrayResponse(instances, fallbackName) { - const records = []; - const response = {}; + normalizeArrayResponse(instances, fallbackName) { let key; if (!instances || !instances.length) { - const key = inflect.camelize(inflect.pluralize(fallbackName), false); - - response[key] = []; + key = inflect.camelize(inflect.pluralize(fallbackName), false); - return response; + return Promise.resolve({ + [key]: [] + }); } - for (const instance of instances) { - const json = instance.toJSON(); - - await this.normalizeRelationships(instance, json); - - records.push(json); - - if (!key) { - key = this.keyForRecord(instance, false); - } - } + return Promise.all(instances.map(instance => { + key = key || this.keyForRecord(instance, false); - response[key] = records; - - return response; - } - - /** - * Takes a single Sequelize instance and returns an object with a root key based - * on the model name and a pojo record - * - * @method normalizeResponse - * @param {Object} instance - * @param {String} method - * @return {Promise} - * - * @example - * ```javascript - * return orm.findOne("user", 1).then(user => { - * return serializer.normalizeResponse(instance, "findOne"); - * }).then(response => { - * /** - * * { - * * user: { - * * } - * * } - * }) - * ``` - */ - async normalizeResponse(instance, method, fallbackName) { - switch (method) { - case "createRecord": - case "findOne": - case "queryRecord": - case "updateRecord": - return this.normalizeSingularResponse(instance, fallbackName); - case "findAll": - return this.normalizeArrayResponse(instance, fallbackName); - } + return this.normalizeRelationships(instance, instance); + })).then(records => this._defineArrayResponse(key, records)); } /** @@ -199,14 +160,12 @@ export default class RestSerializer { * }); * ``` */ - async normalizeSingularResponse(instance) { - const json = instance.toJSON(); + normalizeSingularResponse(instance) { const key = this.keyForRecord(instance, true); - const response = { [key]: json } - - await this.normalizeRelationships(instance, response[key]); - return response; + return this.normalizeRelationships(instance, instance).then(newRecord => + this._defineSingularResponse(key, newRecord) + ); } /** @@ -229,21 +188,198 @@ export default class RestSerializer { * }); * ``` */ - async normalizeRelationships(instance, payload) { + normalizeRelationships(instance, payload) { const associations = instance.Model.associations; - for (const association in associations) { - const relationship = await this.getRelationships( - instance, - associations[association] - ); - const relationshipKey = this.keyForRelationship(association); + return Promise.all(Object.keys(associations).map(association => + this.getRelationships(instance, associations[association]).then(relationships => { + return { + key: this.keyForRelationship(association), + records: relationships + }; + }) + )).then(relationships => { + relationships.forEach(relationship => { + if (relationship.records) { + payload[relationship.key] = relationship.records; + } + }); + + return payload; + }); + } + + /** + * Reformats the record into a RESTful object with the record name as the key. + * In addition, this will add a custom toJSON method on the response object + * that will serialize the response when sent through something like + * express#res.send, retaining the relationships on the instance, but removing + * all other extraneous data (see Sequelize instance#toJSON) + * + * @method _defineArrayResponse + * @private + * @param {String} key the name of the record (e.g. users) + * @param {Array} records Array of sequelize instances + * @returns {Object} + * + * @example + * ```javascript + * serializer._defineArrayResponse("users", [{ + * dataValues: { + * firstName: "Hank", + * lastName: "Hill", + * projects: [1, 2] + * }, + * someExtraneousProp: "foo" + * }]); + * + * /** + * * { + * * users: [{ + * * dataValues: { + * * firstName: "Hank", + * * lastName: "Hill", + * * projects: [1, 2], + * * }, + * * someExtraneousProp: "foo", + * * toJSON() { + * * } + * * }] + * * } + * * + * * response.toJSON() + * * + * * { + * * "users": [{ + * * firstName: "Hank", + * * lastName: "Hill", + * * projects: [1, 2], + * * }] + * * } + * ``` + */ + _defineArrayResponse(key, records) { + const response = {}; + + Object.defineProperty(response, key, { + configurable: false, + enumerable: true, + value: records + }); + + Object.defineProperty(response, "toJSON", { + configurable: false, + enumerable: false, + value() { + const recordArray = this[key]; + const newRecords = recordArray.map(record => { + const associations = record.Model.associations; + const newRecord = {}; - if (relationship) { - payload[relationshipKey] = relationship; + Object.keys(associations).forEach(association => { + if (record[association]) { + newRecord[association] = record[association]; + } + }); + + const plainInstance = record.toJSON(); + + Object.keys(plainInstance).forEach(property => { + newRecord[property] = plainInstance[property]; + }); + + return newRecord; + }); + + return { + [key]: newRecords + }; } - } + }); - return payload; + return response; + } + + /** + * Similar to {{#crossLink "RestSerializer/_defineArrayResponse:method"}}_defineArrayResponse{{/crossLink}}, + * the difference being that this takes a single record and returns a singular response + * + * @method _defineSingularResponse + * @private + * @param {String} key the name of the record (e.g. users) + * @param {Object} record Sequelize instance + * @returns {Object} + * + * @example + * ```javascript + * serializer._defineSingularResponse("user", { + * dataValues: { + * firstName: "Hank", + * lastName: "Hill", + * projects: [1, 2] + * }, + * someExtraneousProp: "foo", + * }); + * + * /** + * * { + * * user: { + * * dataValues: { + * * firstName: "Hank", + * * lastName: "Hill", + * * projects: [1, 2], + * * someExtraneousProp: "foo", + * * toJSON() { + * * } + * * } + * * } + * * + * * response.toJSON() + * * + * * { + * * "user": [{ + * * "firstName": "Hank", + * * "lastName": "Hill", + * * "projects": [1, 2], + * * }] + * * } + * ``` + */ + _defineSingularResponse(key, record) { + const response = {}; + + Object.defineProperty(response, key, { + configurable: false, + enumerable: true, + value: record + }); + + Object.defineProperty(response, "toJSON", { + configurable: false, + enumerable: false, + value() { + const instance = this[key]; + const associations = instance.Model.associations; + const newRecord = {}; + + Object.keys(associations).forEach(association => { + if (instance[association]) { + newRecord[association] = instance[association]; + } + }); + + const plainInstance = instance.toJSON(); + + Object.keys(plainInstance).forEach(property => { + newRecord[property] = plainInstance[property]; + }); + + return { + [key]: newRecord + }; + } + }); + + return response; } } diff --git a/test/serializer_tests.js b/test/serializer_tests.js index 5f872b2..bcbabfd 100644 --- a/test/serializer_tests.js +++ b/test/serializer_tests.js @@ -20,6 +20,12 @@ describe("RestSerializer", function () { it("formats a model instance for a findAll request", function () { return serializer.normalizeResponse([user], "findAll").then(response => { expect(response.users[0].firstName).to.eql("John"); + + const res = response.toJSON(); + + Object.keys(res.users[0]).forEach(property => { + expect(response.users[0]).to.have.property(property); + }); }); }); @@ -32,6 +38,12 @@ describe("RestSerializer", function () { it("formats a model instance for a findOne request", function () { return serializer.normalizeResponse(user, "findOne").then(response => { expect(response.user.firstName).to.eql("John"); + + const res = response.toJSON(); + + Object.keys(res.user).forEach(property => { + expect(response.user).to.have.property(property); + }); }); }); @@ -87,6 +99,7 @@ describe("RestSerializer", function () { it("includes relationships for a findOne request", function () { return serializer.normalizeResponse(user, "findOne").then(response => { expect(response.user.projects[0]).to.eql(project.id); + expect(response.user.groups[0]).to.eql(group.id); }); }); }); @@ -99,11 +112,13 @@ describe("RestSerializer", function () { return Promise.all([ fixtures.GroupModel.create({ name: "awesomeness" }), fixtures.ProjectModel.create({ name: "test" }), - fixtures.UserModel.create({ firstName: "jane" }) + fixtures.UserModel.create({ firstName: "jane" }), + fixtures.ProjectModel.create({ name: "test2" }) ]).then(response => { const awesomeness = response[0]; const test = response[1]; const jane = response[2]; + const test2 = response[3]; group = awesomeness; parent = jane; @@ -112,7 +127,7 @@ describe("RestSerializer", function () { return Promise.all([ user.setParent(parent), user.setGroups([group]), - user.setProjects([project]) + user.setProjects([project, test2]) ]); }); }); @@ -121,8 +136,9 @@ describe("RestSerializer", function () { const associations = user.Model.associations; return serializer - .normalizeRelationships(user, user.toJSON()) + .normalizeRelationships(user, user) .then(res => { + expect(res.groups[0]).to.eql(group.id); expect(res.projects[0]).to.eql(project.id); }); }); diff --git a/yarn.lock b/yarn.lock index b5f8197..d8459d3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,6 +2,14 @@ # yarn lockfile v1 +"@parch-js/json-serializer@^0.0.1": + version "0.0.1" + resolved "https://registry.yarnpkg.com/@parch-js/json-serializer/-/json-serializer-0.0.1.tgz#2cb7cf85ab21ed7fcdb4145c8bfd6e1e36194ccd" + dependencies: + inflect "^0.3.0" + restify-errors "^4.3.0" + sequelize "^3.30.4" + JSONStream@^1.0.4: version "1.3.1" resolved "https://registry.yarnpkg.com/JSONStream/-/JSONStream-1.3.1.tgz#707f761e01dae9e16f1bcf93703b78c70966579a" @@ -240,6 +248,14 @@ babel-code-frame@^6.16.0, babel-code-frame@^6.22.0: esutils "^2.0.2" js-tokens "^3.0.0" +babel-code-frame@^6.26.0: + version "6.26.0" + resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.26.0.tgz#63fd43f7dc1e3bb7ce35947db8fe369a3f58c74b" + dependencies: + chalk "^1.1.3" + esutils "^2.0.2" + js-tokens "^3.0.2" + babel-core@^6.24.0: version "6.24.0" resolved "https://registry.yarnpkg.com/babel-core/-/babel-core-6.24.0.tgz#8f36a0a77f5c155aed6f920b844d23ba56742a02" @@ -273,7 +289,20 @@ babel-eslint@^7.2.1: babel-types "^6.23.0" babylon "^6.16.1" -babel-generator@^6.18.0, babel-generator@^6.24.0: +babel-generator@^6.18.0: + version "6.26.0" + resolved "https://registry.yarnpkg.com/babel-generator/-/babel-generator-6.26.0.tgz#ac1ae20070b79f6e3ca1d3269613053774f20dc5" + dependencies: + babel-messages "^6.23.0" + babel-runtime "^6.26.0" + babel-types "^6.26.0" + detect-indent "^4.0.0" + jsesc "^1.3.0" + lodash "^4.17.4" + source-map "^0.5.6" + trim-right "^1.0.1" + +babel-generator@^6.24.0: version "6.24.0" resolved "https://registry.yarnpkg.com/babel-generator/-/babel-generator-6.24.0.tgz#eba270a8cc4ce6e09a61be43465d7c62c1f87c56" dependencies: @@ -343,16 +372,6 @@ babel-helper-regex@^6.22.0: babel-types "^6.22.0" lodash "^4.2.0" -babel-helper-remap-async-to-generator@^6.22.0: - version "6.22.0" - resolved "https://registry.yarnpkg.com/babel-helper-remap-async-to-generator/-/babel-helper-remap-async-to-generator-6.22.0.tgz#2186ae73278ed03b8b15ced089609da981053383" - dependencies: - babel-helper-function-name "^6.22.0" - babel-runtime "^6.22.0" - babel-template "^6.22.0" - babel-traverse "^6.22.0" - babel-types "^6.22.0" - babel-helper-replace-supers@^6.22.0, babel-helper-replace-supers@^6.23.0: version "6.23.0" resolved "https://registry.yarnpkg.com/babel-helper-replace-supers/-/babel-helper-replace-supers-6.23.0.tgz#eeaf8ad9b58ec4337ca94223bacdca1f8d9b4bfd" @@ -387,18 +406,6 @@ babel-plugin-check-es2015-constants@^6.22.0: dependencies: babel-runtime "^6.22.0" -babel-plugin-syntax-async-functions@^6.8.0: - version "6.13.0" - resolved "https://registry.yarnpkg.com/babel-plugin-syntax-async-functions/-/babel-plugin-syntax-async-functions-6.13.0.tgz#cad9cad1191b5ad634bf30ae0872391e0647be95" - -babel-plugin-transform-async-to-generator@^6.22.0: - version "6.22.0" - resolved "https://registry.yarnpkg.com/babel-plugin-transform-async-to-generator/-/babel-plugin-transform-async-to-generator-6.22.0.tgz#194b6938ec195ad36efc4c33a971acf00d8cd35e" - dependencies: - babel-helper-remap-async-to-generator "^6.22.0" - babel-plugin-syntax-async-functions "^6.8.0" - babel-runtime "^6.22.0" - babel-plugin-transform-es2015-arrow-functions@^6.22.0: version "6.22.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-arrow-functions/-/babel-plugin-transform-es2015-arrow-functions-6.22.0.tgz#452692cb711d5f79dc7f85e440ce41b9f244d221" @@ -636,7 +643,24 @@ babel-runtime@^6.18.0, babel-runtime@^6.22.0: core-js "^2.4.0" regenerator-runtime "^0.10.0" -babel-template@^6.16.0, babel-template@^6.22.0, babel-template@^6.23.0: +babel-runtime@^6.26.0: + version "6.26.0" + resolved "https://registry.yarnpkg.com/babel-runtime/-/babel-runtime-6.26.0.tgz#965c7058668e82b55d7bfe04ff2337bc8b5647fe" + dependencies: + core-js "^2.4.0" + regenerator-runtime "^0.11.0" + +babel-template@^6.16.0: + version "6.26.0" + resolved "https://registry.yarnpkg.com/babel-template/-/babel-template-6.26.0.tgz#de03e2d16396b069f46dd9fff8521fb1a0e35e02" + dependencies: + babel-runtime "^6.26.0" + babel-traverse "^6.26.0" + babel-types "^6.26.0" + babylon "^6.18.0" + lodash "^4.17.4" + +babel-template@^6.22.0, babel-template@^6.23.0: version "6.23.0" resolved "https://registry.yarnpkg.com/babel-template/-/babel-template-6.23.0.tgz#04d4f270adbb3aa704a8143ae26faa529238e638" dependencies: @@ -646,7 +670,21 @@ babel-template@^6.16.0, babel-template@^6.22.0, babel-template@^6.23.0: babylon "^6.11.0" lodash "^4.2.0" -babel-traverse@^6.18.0, babel-traverse@^6.22.0, babel-traverse@^6.23.0, babel-traverse@^6.23.1: +babel-traverse@^6.18.0, babel-traverse@^6.26.0: + version "6.26.0" + resolved "https://registry.yarnpkg.com/babel-traverse/-/babel-traverse-6.26.0.tgz#46a9cbd7edcc62c8e5c064e2d2d8d0f4035766ee" + dependencies: + babel-code-frame "^6.26.0" + babel-messages "^6.23.0" + babel-runtime "^6.26.0" + babel-types "^6.26.0" + babylon "^6.18.0" + debug "^2.6.8" + globals "^9.18.0" + invariant "^2.2.2" + lodash "^4.17.4" + +babel-traverse@^6.22.0, babel-traverse@^6.23.0, babel-traverse@^6.23.1: version "6.23.1" resolved "https://registry.yarnpkg.com/babel-traverse/-/babel-traverse-6.23.1.tgz#d3cb59010ecd06a97d81310065f966b699e14f48" dependencies: @@ -660,7 +698,16 @@ babel-traverse@^6.18.0, babel-traverse@^6.22.0, babel-traverse@^6.23.0, babel-tr invariant "^2.2.0" lodash "^4.2.0" -babel-types@^6.18.0, babel-types@^6.19.0, babel-types@^6.22.0, babel-types@^6.23.0: +babel-types@^6.18.0, babel-types@^6.26.0: + version "6.26.0" + resolved "https://registry.yarnpkg.com/babel-types/-/babel-types-6.26.0.tgz#a3b073f94ab49eb6fa55cd65227a334380632497" + dependencies: + babel-runtime "^6.26.0" + esutils "^2.0.2" + lodash "^4.17.4" + to-fast-properties "^1.0.3" + +babel-types@^6.19.0, babel-types@^6.22.0, babel-types@^6.23.0: version "6.23.0" resolved "https://registry.yarnpkg.com/babel-types/-/babel-types-6.23.0.tgz#bb17179d7538bad38cd0c9e115d340f77e7e9acf" dependencies: @@ -669,14 +716,22 @@ babel-types@^6.18.0, babel-types@^6.19.0, babel-types@^6.22.0, babel-types@^6.23 lodash "^4.2.0" to-fast-properties "^1.0.1" -babylon@^6.11.0, babylon@^6.13.0, babylon@^6.15.0, babylon@^6.16.1: +babylon@^6.11.0, babylon@^6.15.0, babylon@^6.16.1: version "6.16.1" resolved "https://registry.yarnpkg.com/babylon/-/babylon-6.16.1.tgz#30c5a22f481978a9e7f8cdfdf496b11d94b404d3" +babylon@^6.18.0: + version "6.18.0" + resolved "https://registry.yarnpkg.com/babylon/-/babylon-6.18.0.tgz#af2f3b88fa6f5c1e4c634d1a0f8eac4f55b395e3" + balanced-match@^0.4.1: version "0.4.2" resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-0.4.2.tgz#cb3f3e3c732dc0f01ee70b403f302e61d7709838" +balanced-match@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" + bcrypt-pbkdf@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.1.tgz#63bc5dcb61331b92bc05fd528953c33462a06f8d" @@ -720,6 +775,13 @@ brace-expansion@^1.0.0: balanced-match "^0.4.1" concat-map "0.0.1" +brace-expansion@^1.1.7: + version "1.1.8" + resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.8.tgz#c07b211c7c952ec1f8efd51a77ef0d1d3990a292" + dependencies: + balanced-match "^1.0.0" + concat-map "0.0.1" + braces@^1.8.2: version "1.8.5" resolved "https://registry.yarnpkg.com/braces/-/braces-1.8.5.tgz#ba77962e12dff969d6b76711e914b737857bf6a7" @@ -777,6 +839,10 @@ camelcase@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-3.0.0.tgz#32fc4b9fcdaf845fcdf7e73bb97cac2261f0ab0a" +camelcase@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-4.1.0.tgz#d545635be1e33c542649c69173e5de6acfae34dd" + caseless@~0.11.0: version "0.11.0" resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.11.0.tgz#715b96ea9841593cc33067923f5ec60ebda4f7d7" @@ -1105,7 +1171,7 @@ cross-spawn@^4: lru-cache "^4.0.1" which "^1.2.9" -cross-spawn@^5.1.0: +cross-spawn@^5.0.1, cross-spawn@^5.1.0: version "5.1.0" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-5.1.0.tgz#e8bd0efee58fcff6f8f94510a0a554bbfa235449" dependencies: @@ -1182,6 +1248,18 @@ debug@2.6.3, debug@^2.1.1, debug@^2.2.0: dependencies: ms "0.7.2" +debug@^2.6.8: + version "2.6.9" + resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" + dependencies: + ms "2.0.0" + +debug@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261" + dependencies: + ms "2.0.0" + decamelize@^1.0.0, decamelize@^1.1.1, decamelize@^1.1.2: version "1.2.0" resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" @@ -1449,6 +1527,18 @@ event-emitter@~0.3.5: d "1" es5-ext "~0.10.14" +execa@^0.7.0: + version "0.7.0" + resolved "https://registry.yarnpkg.com/execa/-/execa-0.7.0.tgz#944becd34cc41ee32a63a9faf27ad5a65fc59777" + dependencies: + cross-spawn "^5.0.1" + get-stream "^3.0.0" + is-stream "^1.1.0" + npm-run-path "^2.0.0" + p-finally "^1.0.0" + signal-exit "^3.0.0" + strip-eof "^1.0.0" + exit-hook@^1.0.0: version "1.1.1" resolved "https://registry.yarnpkg.com/exit-hook/-/exit-hook-1.1.1.tgz#f05ca233b48c05d54fff07765df8507e95c02ff8" @@ -1568,13 +1658,19 @@ find-cache-dir@^0.1.1: mkdirp "^0.5.1" pkg-dir "^1.0.0" -find-up@^1.0.0, find-up@^1.1.2: +find-up@^1.0.0: version "1.1.2" resolved "https://registry.yarnpkg.com/find-up/-/find-up-1.1.2.tgz#6b2e9822b1a2ce0a60ab64d610eccad53cb24d0f" dependencies: path-exists "^2.0.0" pinkie-promise "^2.0.0" +find-up@^2.0.0, find-up@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-2.1.0.tgz#45d1b7e506c717ddd482775a2b77920a3c0c57a7" + dependencies: + locate-path "^2.0.0" + flat-cache@^1.2.1: version "1.2.2" resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-1.2.2.tgz#fa86714e72c21db88601761ecf2f555d1abc6b96" @@ -1594,7 +1690,7 @@ for-own@^0.1.4: dependencies: for-in "^1.0.1" -foreground-child@^1.3.3, foreground-child@^1.5.3: +foreground-child@^1.5.3, foreground-child@^1.5.6: version "1.5.6" resolved "https://registry.yarnpkg.com/foreground-child/-/foreground-child-1.5.6.tgz#4fd71ad2dfde96789b980a5c0a295937cb2f5ce9" dependencies: @@ -1716,6 +1812,10 @@ get-stdin@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-4.0.1.tgz#b968c6b0a04384324902e8bf1a5df32579a450fe" +get-stream@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-3.0.0.tgz#8e943d1358dc37555054ecbe2edb05aa174ede14" + getpass@^0.1.1: version "0.1.6" resolved "https://registry.yarnpkg.com/getpass/-/getpass-0.1.6.tgz#283ffd9fc1256840875311c1b60e8c40187110e6" @@ -1780,7 +1880,7 @@ glob@7.0.5: once "^1.3.0" path-is-absolute "^1.0.0" -glob@^7.0.0, glob@^7.0.3, glob@^7.0.5, glob@^7.0.6: +glob@^7.0.0, glob@^7.0.3, glob@^7.0.5: version "7.1.1" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.1.tgz#805211df04faaf1c63a3600306cdf5ade50b2ec8" dependencies: @@ -1791,10 +1891,25 @@ glob@^7.0.0, glob@^7.0.3, glob@^7.0.5, glob@^7.0.6: once "^1.3.0" path-is-absolute "^1.0.0" +glob@^7.0.6: + version "7.1.2" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.2.tgz#c19c9df9a028702d678612384a6552404c636d15" + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^3.0.4" + once "^1.3.0" + path-is-absolute "^1.0.0" + globals@^9.0.0, globals@^9.14.0: version "9.17.0" resolved "https://registry.yarnpkg.com/globals/-/globals-9.17.0.tgz#0c0ca696d9b9bb694d2e5470bd37777caad50286" +globals@^9.18.0: + version "9.18.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-9.18.0.tgz#aa3896b3e69b487f17e31ed2143d69a8e30c2d8a" + globby@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/globby/-/globby-5.0.0.tgz#ebd84667ca0dbb330b99bcfc68eac2bc54370e0d" @@ -1818,7 +1933,7 @@ growl@1.9.2: version "1.9.2" resolved "https://registry.yarnpkg.com/growl/-/growl-1.9.2.tgz#0ea7743715db8d8de2c5ede1775e1b45ac85c02f" -handlebars@^4.0.2, handlebars@^4.0.3: +handlebars@^4.0.2: version "4.0.6" resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.0.6.tgz#2ce4484850537f9c97a8026d5399b935c4ed4ed7" dependencies: @@ -1828,6 +1943,16 @@ handlebars@^4.0.2, handlebars@^4.0.3: optionalDependencies: uglify-js "^2.6" +handlebars@^4.0.3: + version "4.0.11" + resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.0.11.tgz#630a35dfe0294bc281edae6ffc5d329fc7982dcc" + dependencies: + async "^1.4.0" + optimist "^0.6.1" + source-map "^0.4.4" + optionalDependencies: + uglify-js "^2.6" + har-schema@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/har-schema/-/har-schema-1.0.5.tgz#d263135f43307c02c602afc8fe95970c0151369e" @@ -1987,7 +2112,7 @@ interpret@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.0.2.tgz#f4f623f0bb7122f15f5717c8e254b8161b5c5b2d" -invariant@^2.2.0: +invariant@^2.2.0, invariant@^2.2.2: version "2.2.2" resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.2.tgz#9e1f56ac0acdb6bf303306f338be3b204ae60360" dependencies: @@ -2114,6 +2239,10 @@ is-resolvable@^1.0.0: dependencies: tryit "^1.0.1" +is-stream@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" + is-subset@^0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/is-subset/-/is-subset-0.1.1.tgz#8a59117d932de1de00f245fcdd39ce43f1e939a6" @@ -2154,49 +2283,50 @@ isstream@~0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a" -istanbul-lib-coverage@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/istanbul-lib-coverage/-/istanbul-lib-coverage-1.0.2.tgz#87a0c015b6910651cb3b184814dfb339337e25e1" +istanbul-lib-coverage@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/istanbul-lib-coverage/-/istanbul-lib-coverage-1.1.1.tgz#73bfb998885299415c93d38a3e9adf784a77a9da" -istanbul-lib-hook@^1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/istanbul-lib-hook/-/istanbul-lib-hook-1.0.5.tgz#6ca3d16d60c5f4082da39f7c5cd38ea8a772b88e" +istanbul-lib-hook@^1.0.7: + version "1.1.0" + resolved "https://registry.yarnpkg.com/istanbul-lib-hook/-/istanbul-lib-hook-1.1.0.tgz#8538d970372cb3716d53e55523dd54b557a8d89b" dependencies: append-transform "^0.4.0" -istanbul-lib-instrument@^1.7.0: - version "1.7.0" - resolved "https://registry.yarnpkg.com/istanbul-lib-instrument/-/istanbul-lib-instrument-1.7.0.tgz#b8e0dc25709bb44e17336ab47b7bb5c97c23f659" +istanbul-lib-instrument@^1.8.0: + version "1.9.0" + resolved "https://registry.yarnpkg.com/istanbul-lib-instrument/-/istanbul-lib-instrument-1.9.0.tgz#e5ffbbec250091ba15b3ae71b517d1200af3ba04" dependencies: babel-generator "^6.18.0" babel-template "^6.16.0" babel-traverse "^6.18.0" babel-types "^6.18.0" - babylon "^6.13.0" - istanbul-lib-coverage "^1.0.2" + babylon "^6.18.0" + istanbul-lib-coverage "^1.1.1" semver "^5.3.0" -istanbul-lib-report@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/istanbul-lib-report/-/istanbul-lib-report-1.0.0.tgz#d83dac7f26566b521585569367fe84ccfc7aaecb" +istanbul-lib-report@^1.1.1: + version "1.1.2" + resolved "https://registry.yarnpkg.com/istanbul-lib-report/-/istanbul-lib-report-1.1.2.tgz#922be27c13b9511b979bd1587359f69798c1d425" dependencies: - istanbul-lib-coverage "^1.0.2" + istanbul-lib-coverage "^1.1.1" mkdirp "^0.5.1" path-parse "^1.0.5" supports-color "^3.1.2" -istanbul-lib-source-maps@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/istanbul-lib-source-maps/-/istanbul-lib-source-maps-1.1.1.tgz#f8c8c2e8f2160d1d91526d97e5bd63b2079af71c" +istanbul-lib-source-maps@^1.2.1: + version "1.2.2" + resolved "https://registry.yarnpkg.com/istanbul-lib-source-maps/-/istanbul-lib-source-maps-1.2.2.tgz#750578602435f28a0c04ee6d7d9e0f2960e62c1c" dependencies: - istanbul-lib-coverage "^1.0.2" + debug "^3.1.0" + istanbul-lib-coverage "^1.1.1" mkdirp "^0.5.1" - rimraf "^2.4.4" + rimraf "^2.6.1" source-map "^0.5.3" -istanbul-reports@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/istanbul-reports/-/istanbul-reports-1.0.2.tgz#4e8366abe6fa746cc1cd6633f108de12cc6ac6fa" +istanbul-reports@^1.1.1: + version "1.1.3" + resolved "https://registry.yarnpkg.com/istanbul-reports/-/istanbul-reports-1.1.3.tgz#3b9e1e8defb6d18b1d425da8e8b32c5a163f2d10" dependencies: handlebars "^4.0.3" @@ -2210,6 +2340,10 @@ js-tokens@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.1.tgz#08e9f132484a2c45a30907e9dc4d5567b7f114d7" +js-tokens@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.2.tgz#9866df395102130e38f7f996bceb65443209c25b" + js-yaml@3.6.1, js-yaml@^3.5.1: version "3.6.1" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.6.1.tgz#6e5fe67d8b205ce4d22fad05b7781e8dadcc4b30" @@ -2315,6 +2449,22 @@ load-json-file@^1.0.0: pinkie-promise "^2.0.0" strip-bom "^2.0.0" +load-json-file@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-2.0.0.tgz#7947e42149af80d696cbf797bcaabcfe1fe29ca8" + dependencies: + graceful-fs "^4.1.2" + parse-json "^2.2.0" + pify "^2.0.0" + strip-bom "^3.0.0" + +locate-path@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-2.0.0.tgz#2b568b265eec944c6d9c0de9c3dbbbca0354cd8e" + dependencies: + p-locate "^2.0.0" + path-exists "^3.0.0" + lodash._baseassign@^3.0.0: version "3.2.0" resolved "https://registry.yarnpkg.com/lodash._baseassign/-/lodash._baseassign-3.2.0.tgz#8c38a099500f215ad09e59f1722fd0c52bfe0a4e" @@ -2387,7 +2537,7 @@ lodash@^3.7.0: version "3.10.1" resolved "https://registry.yarnpkg.com/lodash/-/lodash-3.10.1.tgz#5bf45e8e49ba4189e17d482789dfd15bd140b7b6" -lodash@^4.0.0, lodash@^4.1.0, lodash@^4.2.0, lodash@^4.2.1, lodash@^4.3.0: +lodash@^4.0.0, lodash@^4.1.0, lodash@^4.17.4, lodash@^4.2.0, lodash@^4.2.1, lodash@^4.3.0: version "4.17.4" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae" @@ -2459,6 +2609,12 @@ media-typer@0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/media-typer/-/media-typer-0.3.0.tgz#8710d7af0aa626f8fffa1ce00168545263255748" +mem@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/mem/-/mem-1.1.0.tgz#5edd52b485ca1d900fe64895505399a0dfa45f76" + dependencies: + mimic-fn "^1.0.0" + meow@^3.3.0, meow@^3.7.0: version "3.7.0" resolved "https://registry.yarnpkg.com/meow/-/meow-3.7.0.tgz#72cb668b425228290abbfa856892587308a801fb" @@ -2479,10 +2635,10 @@ merge-descriptors@1.0.1: resolved "https://registry.yarnpkg.com/merge-descriptors/-/merge-descriptors-1.0.1.tgz#b00aaa556dd8b44568150ec9d1b953f3f90cbb61" merge-source-map@^1.0.2: - version "1.0.3" - resolved "https://registry.yarnpkg.com/merge-source-map/-/merge-source-map-1.0.3.tgz#da1415f2722a5119db07b14c4f973410863a2abf" + version "1.0.4" + resolved "https://registry.yarnpkg.com/merge-source-map/-/merge-source-map-1.0.4.tgz#a5de46538dae84d4114cc5ea02b4772a6346701f" dependencies: - source-map "^0.5.3" + source-map "^0.5.6" methods@~1.1.2: version "1.1.2" @@ -2528,12 +2684,22 @@ mime@~1.2.11: version "1.2.11" resolved "https://registry.yarnpkg.com/mime/-/mime-1.2.11.tgz#58203eed86e3a5ef17aed2b7d9ebd47f0a60dd10" +mimic-fn@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-1.1.0.tgz#e667783d92e89dbd342818b5230b9d62a672ad18" + minimatch@^3.0.0, minimatch@^3.0.2: version "3.0.3" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.3.tgz#2a4e4090b96b2db06a9d7df01055a62a77c9b774" dependencies: brace-expansion "^1.0.0" +minimatch@^3.0.4: + version "3.0.4" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" + dependencies: + brace-expansion "^1.1.7" + minimist@0.0.8, minimist@~0.0.1: version "0.0.8" resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" @@ -2586,6 +2752,10 @@ ms@0.7.2: version "0.7.2" resolved "https://registry.yarnpkg.com/ms/-/ms-0.7.2.tgz#ae25cf2512b3885a1d95d7f037868d8431124765" +ms@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" + mute-stream@0.0.5: version "0.0.5" resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.5.tgz#8fbfabb0a98a253d3184331f9e8deb7372fac6c0" @@ -2642,6 +2812,12 @@ normalize-path@^2.0.1: dependencies: remove-trailing-separator "^1.0.1" +npm-run-path@^2.0.0: + version "2.0.2" + resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-2.0.2.tgz#35a9232dfa35d7067b4cb2ddf2357b1871536c5f" + dependencies: + path-key "^2.0.0" + npmlog@^4.0.2: version "4.0.2" resolved "https://registry.yarnpkg.com/npmlog/-/npmlog-4.0.2.tgz#d03950e0e78ce1527ba26d2a7592e9348ac3e75f" @@ -2655,9 +2831,9 @@ number-is-nan@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/number-is-nan/-/number-is-nan-1.0.1.tgz#097b602b53422a522c1afb8790318336941a011d" -nyc@^10.2.0: - version "10.2.0" - resolved "https://registry.yarnpkg.com/nyc/-/nyc-10.2.0.tgz#facd90240600c9aa4dd81ea99c2fb6a85c53de0c" +nyc@^11.2.1: + version "11.2.1" + resolved "https://registry.yarnpkg.com/nyc/-/nyc-11.2.1.tgz#ad850afe9dbad7f4970728b4b2e47fed1c38721c" dependencies: archy "^1.0.0" arrify "^1.0.1" @@ -2666,15 +2842,15 @@ nyc@^10.2.0: debug-log "^1.0.1" default-require-extensions "^1.0.0" find-cache-dir "^0.1.1" - find-up "^1.1.2" + find-up "^2.1.0" foreground-child "^1.5.3" glob "^7.0.6" - istanbul-lib-coverage "^1.0.2" - istanbul-lib-hook "^1.0.5" - istanbul-lib-instrument "^1.7.0" - istanbul-lib-report "^1.0.0" - istanbul-lib-source-maps "^1.1.1" - istanbul-reports "^1.0.2" + istanbul-lib-coverage "^1.1.1" + istanbul-lib-hook "^1.0.7" + istanbul-lib-instrument "^1.8.0" + istanbul-lib-report "^1.1.1" + istanbul-lib-source-maps "^1.2.1" + istanbul-reports "^1.1.1" md5-hex "^1.2.0" merge-source-map "^1.0.2" micromatch "^2.3.11" @@ -2682,10 +2858,10 @@ nyc@^10.2.0: resolve-from "^2.0.0" rimraf "^2.5.4" signal-exit "^3.0.1" - spawn-wrap "1.2.4" - test-exclude "^4.0.0" - yargs "^7.0.2" - yargs-parser "^4.0.2" + spawn-wrap "^1.3.8" + test-exclude "^4.1.1" + yargs "^8.0.1" + yargs-parser "^5.0.0" oauth-sign@~0.3.0: version "0.3.0" @@ -2750,6 +2926,14 @@ os-locale@^1.4.0: dependencies: lcid "^1.0.0" +os-locale@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/os-locale/-/os-locale-2.1.0.tgz#42bc2900a6b5b8bd17376c8e882b65afccf24bf2" + dependencies: + execa "^0.7.0" + lcid "^1.0.0" + mem "^1.1.0" + os-tmpdir@^1.0.0, os-tmpdir@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274" @@ -2769,6 +2953,20 @@ output-file-sync@^1.1.0: mkdirp "^0.5.1" object-assign "^4.1.0" +p-finally@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/p-finally/-/p-finally-1.0.0.tgz#3fbcfb15b899a44123b34b6dcc18b724336a2cae" + +p-limit@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-1.1.0.tgz#b07ff2d9a5d88bec806035895a2bab66a27988bc" + +p-locate@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-2.0.0.tgz#20a0103b222a70c8fd39cc2e580680f3dde5ec43" + dependencies: + p-limit "^1.1.0" + parse-github-repo-url@^1.3.0: version "1.4.0" resolved "https://registry.yarnpkg.com/parse-github-repo-url/-/parse-github-repo-url-1.4.0.tgz#286c53e2c9962e0641649ee3ac9508fca4dd959c" @@ -2798,6 +2996,10 @@ path-exists@^2.0.0: dependencies: pinkie-promise "^2.0.0" +path-exists@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-3.0.0.tgz#ce0ebeaa5f78cb18925ea7d810d7b59b010fd515" + path-is-absolute@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" @@ -2806,6 +3008,10 @@ path-is-inside@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/path-is-inside/-/path-is-inside-1.0.2.tgz#365417dede44430d1c11af61027facf074bdfc53" +path-key@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40" + path-parse@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.5.tgz#3c1adf871ea9cd6c9431b6ea2bd74a0ff055c4c1" @@ -2822,6 +3028,12 @@ path-type@^1.0.0: pify "^2.0.0" pinkie-promise "^2.0.0" +path-type@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/path-type/-/path-type-2.0.0.tgz#f012ccb8415b7096fc2daa1054c3d72389594c73" + dependencies: + pify "^2.0.0" + performance-now@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-0.2.0.tgz#33ef30c5c77d4ea21c5a53869d91b56d8f2555e5" @@ -2928,6 +3140,13 @@ read-pkg-up@^1.0.1: find-up "^1.0.0" read-pkg "^1.0.0" +read-pkg-up@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-2.0.0.tgz#6b72a8048984e0c41e79510fd5e9fa99b3b549be" + dependencies: + find-up "^2.0.0" + read-pkg "^2.0.0" + read-pkg@^1.0.0, read-pkg@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-1.1.0.tgz#f5ffaa5ecd29cb31c0474bca7d756b6bb29e3f28" @@ -2936,6 +3155,14 @@ read-pkg@^1.0.0, read-pkg@^1.1.0: normalize-package-data "^2.3.2" path-type "^1.0.0" +read-pkg@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-2.0.0.tgz#8ef1c0623c6a6db0dc6713c4bfac46332b2368f8" + dependencies: + load-json-file "^2.0.0" + normalize-package-data "^2.3.2" + path-type "^2.0.0" + "readable-stream@^2.0.0 || ^1.1.13", readable-stream@^2.0.2, readable-stream@^2.1.4, readable-stream@^2.1.5, readable-stream@^2.2.2: version "2.2.6" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.2.6.tgz#8b43aed76e71483938d12a8d46c6cf1a00b1f816" @@ -2986,6 +3213,10 @@ regenerator-runtime@^0.10.0: version "0.10.3" resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.10.3.tgz#8c4367a904b51ea62a908ac310bf99ff90a82a3e" +regenerator-runtime@^0.11.0: + version "0.11.0" + resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.11.0.tgz#7e54fe5b5ccd5d6624ea6255c3473be090b802e1" + regenerator-transform@0.9.8: version "0.9.8" resolved "https://registry.yarnpkg.com/regenerator-transform/-/regenerator-transform-0.9.8.tgz#0f88bb2bc03932ddb7b6b7312e68078f01026d6c" @@ -3168,12 +3399,18 @@ right-align@^0.1.1: dependencies: align-text "^0.1.1" -rimraf@2, rimraf@^2.2.8, rimraf@^2.3.3, rimraf@^2.4.1, rimraf@^2.4.4, rimraf@^2.5.1, rimraf@^2.5.4, rimraf@^2.6.1: +rimraf@2, rimraf@^2.2.8, rimraf@^2.4.1, rimraf@^2.5.1, rimraf@^2.6.1: version "2.6.1" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.1.tgz#c2338ec643df7a1b7fe5c54fa86f57428a55f33d" dependencies: glob "^7.0.5" +rimraf@^2.3.3, rimraf@^2.5.4: + version "2.6.2" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.2.tgz#2ed8150d24a16ea8651e6d6ef0f47c4158ce7a36" + dependencies: + glob "^7.0.5" + run-async@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/run-async/-/run-async-0.1.0.tgz#c8ad4a5e110661e402a7d21b530e009f25f8e389" @@ -3291,11 +3528,7 @@ shimmer@1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/shimmer/-/shimmer-1.1.0.tgz#97d7377137ffbbab425522e429fe0aa89a488b35" -signal-exit@^2.0.0: - version "2.1.2" - resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-2.1.2.tgz#375879b1f92ebc3b334480d038dc546a6d558564" - -signal-exit@^3.0.0, signal-exit@^3.0.1: +signal-exit@^3.0.0, signal-exit@^3.0.1, signal-exit@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d" @@ -3348,19 +3581,23 @@ source-map@^0.4.4: dependencies: amdefine ">=0.0.4" -source-map@^0.5.0, source-map@^0.5.3, source-map@^0.5.6, source-map@~0.5.1: +source-map@^0.5.0, source-map@^0.5.6, source-map@~0.5.1: version "0.5.6" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.6.tgz#75ce38f52bf0733c5a7f0c118d81334a2bb5f412" -spawn-wrap@1.2.4: - version "1.2.4" - resolved "https://registry.yarnpkg.com/spawn-wrap/-/spawn-wrap-1.2.4.tgz#920eb211a769c093eebfbd5b0e7a5d2e68ab2e40" +source-map@^0.5.3: + version "0.5.7" + resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc" + +spawn-wrap@^1.3.8: + version "1.4.0" + resolved "https://registry.yarnpkg.com/spawn-wrap/-/spawn-wrap-1.4.0.tgz#1e9f4061edc4ea37464ff28f6ef5c0f541f9f978" dependencies: - foreground-child "^1.3.3" + foreground-child "^1.5.6" mkdirp "^0.5.0" os-homedir "^1.0.1" rimraf "^2.3.3" - signal-exit "^2.0.0" + signal-exit "^3.0.2" which "^1.2.4" spdx-correct@~1.0.0: @@ -3419,7 +3656,7 @@ sshpk@^1.7.0: version "1.3.1" resolved "https://registry.yarnpkg.com/statuses/-/statuses-1.3.1.tgz#faf51b9eb74aaef3b3acf4ad5f61abf24cb7b93e" -string-width@^1.0.1, string-width@^1.0.2: +string-width@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/string-width/-/string-width-1.0.2.tgz#118bdf5b8cdc51a2a7e70d211e07e2b0b9b107d3" dependencies: @@ -3458,6 +3695,10 @@ strip-bom@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-3.0.0.tgz#2334c18e9c759f7bdd56fdef7e9ae3d588e68ed3" +strip-eof@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/strip-eof/-/strip-eof-1.0.0.tgz#bb43ff5598a6eb05d89b59fcd129c983313606bf" + strip-indent@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/strip-indent/-/strip-indent-1.0.1.tgz#0c7962a6adefa7bbd4ac366460a638552ae1a0a2" @@ -3468,7 +3709,7 @@ strip-json-comments@~2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" -supports-color@3.1.2, supports-color@^3.1.2: +supports-color@3.1.2: version "3.1.2" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-3.1.2.tgz#72a262894d9d408b956ca05ff37b2ed8a6e2a2d5" dependencies: @@ -3478,6 +3719,12 @@ supports-color@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7" +supports-color@^3.1.2: + version "3.2.3" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-3.2.3.tgz#65ac0504b3954171d8a64946b2ae3cbb8a5f54f6" + dependencies: + has-flag "^1.0.0" + table@^3.7.8: version "3.8.3" resolved "https://registry.yarnpkg.com/table/-/table-3.8.3.tgz#2bbc542f0fda9861a755d3947fefd8b3f513855f" @@ -3527,9 +3774,9 @@ terraformer@~1.0.5: version "1.0.7" resolved "https://registry.yarnpkg.com/terraformer/-/terraformer-1.0.7.tgz#d8a19a56fbf25966ea062d21f515b93589702d69" -test-exclude@^4.0.0: - version "4.0.3" - resolved "https://registry.yarnpkg.com/test-exclude/-/test-exclude-4.0.3.tgz#86a13ce3effcc60e6c90403cf31a27a60ac6c4e7" +test-exclude@^4.1.1: + version "4.1.1" + resolved "https://registry.yarnpkg.com/test-exclude/-/test-exclude-4.1.1.tgz#4d84964b0966b0087ecc334a2ce002d3d9341e26" dependencies: arrify "^1.0.1" micromatch "^2.3.11" @@ -3560,6 +3807,10 @@ to-fast-properties@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-1.0.2.tgz#f3f5c0c3ba7299a7ef99427e44633257ade43320" +to-fast-properties@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-1.0.3.tgz#b83571fa4d8c25b82e231b06e3a3055de4ca1a47" + toposort-class@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/toposort-class/-/toposort-class-1.0.1.tgz#7ffd1f78c8be28c3ba45cd4e1a3f5ee193bd9988" @@ -3717,11 +3968,17 @@ verror@^1.8.1: core-util-is "1.0.2" extsprintf "^1.2.0" -which-module@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/which-module/-/which-module-1.0.0.tgz#bba63ca861948994ff307736089e3b96026c2a4f" +which-module@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/which-module/-/which-module-2.0.0.tgz#d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a" -which@^1.2.4, which@^1.2.9: +which@^1.2.4: + version "1.3.0" + resolved "https://registry.yarnpkg.com/which/-/which-1.3.0.tgz#ff04bdfc010ee547d780bec38e1ac1c2777d253a" + dependencies: + isexe "^2.0.0" + +which@^1.2.9: version "1.2.14" resolved "https://registry.yarnpkg.com/which/-/which-1.2.14.tgz#9a87c4378f03e827cecaf1acdf56c736c01c14e5" dependencies: @@ -3769,8 +4026,8 @@ wrappy@1: resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" write-file-atomic@^1.1.4: - version "1.3.1" - resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-1.3.1.tgz#7d45ba32316328dd1ec7d90f60ebc0d845bb759a" + version "1.3.4" + resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-1.3.4.tgz#f807a4f0b1d9e913ae7a48112e6cc3af1991b45f" dependencies: graceful-fs "^4.1.11" imurmurhash "^0.1.4" @@ -3794,18 +4051,18 @@ yallist@^2.0.0: version "2.1.2" resolved "https://registry.yarnpkg.com/yallist/-/yallist-2.1.2.tgz#1c11f9218f076089a47dd512f93c6699a6a81d52" -yargs-parser@^4.0.2: - version "4.2.1" - resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-4.2.1.tgz#29cceac0dc4f03c6c87b4a9f217dd18c9f74871c" - dependencies: - camelcase "^3.0.0" - yargs-parser@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-5.0.0.tgz#275ecf0d7ffe05c77e64e7c86e4cd94bf0e1228a" dependencies: camelcase "^3.0.0" +yargs-parser@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-7.0.0.tgz#8d0ac42f16ea55debd332caf4c4038b3e3f5dfd9" + dependencies: + camelcase "^4.1.0" + yargs@^3.7.2: version "3.32.0" resolved "https://registry.yarnpkg.com/yargs/-/yargs-3.32.0.tgz#03088e9ebf9e756b69751611d2a5ef591482c995" @@ -3818,23 +4075,23 @@ yargs@^3.7.2: window-size "^0.1.4" y18n "^3.2.0" -yargs@^7.0.2: - version "7.1.0" - resolved "https://registry.yarnpkg.com/yargs/-/yargs-7.1.0.tgz#6ba318eb16961727f5d284f8ea003e8d6154d0c8" +yargs@^8.0.1: + version "8.0.2" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-8.0.2.tgz#6299a9055b1cefc969ff7e79c1d918dceb22c360" dependencies: - camelcase "^3.0.0" + camelcase "^4.1.0" cliui "^3.2.0" decamelize "^1.1.1" get-caller-file "^1.0.1" - os-locale "^1.4.0" - read-pkg-up "^1.0.1" + os-locale "^2.0.0" + read-pkg-up "^2.0.0" require-directory "^2.1.1" require-main-filename "^1.0.1" set-blocking "^2.0.0" - string-width "^1.0.2" - which-module "^1.0.0" + string-width "^2.0.0" + which-module "^2.0.0" y18n "^3.2.1" - yargs-parser "^5.0.0" + yargs-parser "^7.0.0" yargs@~3.10.0: version "3.10.0" diff --git a/yuidoc.json b/yuidoc.json index f8a3cee..d9c8279 100644 --- a/yuidoc.json +++ b/yuidoc.json @@ -1,7 +1,7 @@ { "name": "@parch-js/orm", "url": "https://github.com/parch-js/orm", - "version": "0.0.1", + "version": "0.1.0", "options": { "exclude": "lib", "helpers": ["node_modules/yuidoc-lucid-theme/helpers/helpers.js"],