From fba3858c5063bb4d737dc15ef63a3564cb767c59 Mon Sep 17 00:00:00 2001 From: baranga Date: Mon, 15 Apr 2019 08:46:44 +0200 Subject: [PATCH 01/61] Fix typo in release notes --- release-notes.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release-notes.yml b/release-notes.yml index 54f250e..176533f 100644 --- a/release-notes.yml +++ b/release-notes.yml @@ -4,7 +4,7 @@ description: > document level (for now...). It creates a tenant-reference field and takes care of unique indexes. Also it provides access to tenant-bound model-classes, that prohibit the exploid of the given tenant scope. Last but not least the "MAGIC" can be disabled so that shipping of the same code in single- and - multi-tenancy environment (on premis vs. cloud hosted) is a question of a single line of config. + multi-tenancy environment (on premise vs. cloud hosted) is a question of a single line of config. releases: - version: 1.6.0 From 8113b3fb49c79f11510e2f0c3c32190e9301b737 Mon Sep 17 00:00:00 2001 From: baranga Date: Mon, 27 May 2019 08:33:54 +0200 Subject: [PATCH 02/61] Replace mocha by jest --- package.json | 10 +- yarn.lock | 2473 ++++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 2384 insertions(+), 99 deletions(-) diff --git a/package.json b/package.json index 3ba0900..3e2a76e 100644 --- a/package.json +++ b/package.json @@ -18,9 +18,9 @@ ], "scripts": { "hint": "jshint .", - "test": "mocha --exit", - "test-and-cover": "nyc --reporter=html --reporter=text npm run test", - "coveralls": "nyc report --reporter=text-lcov | coveralls", + "test": "jest", + "test-and-cover": "jest --coverage", + "coveralls": "coveralls < ./coverage/lcov.info", "validate-release-notes": "release-notes validate" }, "main": "index.js", @@ -33,11 +33,9 @@ "license": "MIT", "devDependencies": { "@release-notes/cli": "^0.1.0", - "chai": "^4.1.2", "coveralls": "^3.0.0", + "jest": "^24.8.0", "jshint": "^2.9.5", - "mocha": "^5.0.4", - "mocha-mongoose": "^1.2.0", "mongodb": "^2.2.35", "mongoose": "^5.0.11", "nyc": "^11.6.0" diff --git a/yarn.lock b/yarn.lock index 2e4fcb9..04bc29d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,6 +2,289 @@ # yarn lockfile v1 +"@babel/code-frame@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.0.0.tgz#06e2ab19bdb535385559aabb5ba59729482800f8" + integrity sha512-OfC2uemaknXr87bdLUkWog7nYuliM9Ij5HUcajsVcMCpQrcLmtxRbVFTIqmcSkSeYRBFBRxs2FiUqFJDLdiebA== + dependencies: + "@babel/highlight" "^7.0.0" + +"@babel/core@^7.1.0": + version "7.4.5" + resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.4.5.tgz#081f97e8ffca65a9b4b0fdc7e274e703f000c06a" + integrity sha512-OvjIh6aqXtlsA8ujtGKfC7LYWksYSX8yQcM8Ay3LuvVeQ63lcOKgoZWVqcpFwkd29aYU9rVx7jxhfhiEDV9MZA== + dependencies: + "@babel/code-frame" "^7.0.0" + "@babel/generator" "^7.4.4" + "@babel/helpers" "^7.4.4" + "@babel/parser" "^7.4.5" + "@babel/template" "^7.4.4" + "@babel/traverse" "^7.4.5" + "@babel/types" "^7.4.4" + convert-source-map "^1.1.0" + debug "^4.1.0" + json5 "^2.1.0" + lodash "^4.17.11" + resolve "^1.3.2" + semver "^5.4.1" + source-map "^0.5.0" + +"@babel/generator@^7.4.0", "@babel/generator@^7.4.4": + version "7.4.4" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.4.4.tgz#174a215eb843fc392c7edcaabeaa873de6e8f041" + integrity sha512-53UOLK6TVNqKxf7RUh8NE851EHRxOOeVXKbK2bivdb+iziMyk03Sr4eaE9OELCbyZAAafAKPDwF2TPUES5QbxQ== + dependencies: + "@babel/types" "^7.4.4" + jsesc "^2.5.1" + lodash "^4.17.11" + source-map "^0.5.0" + trim-right "^1.0.1" + +"@babel/helper-function-name@^7.1.0": + version "7.1.0" + resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.1.0.tgz#a0ceb01685f73355d4360c1247f582bfafc8ff53" + integrity sha512-A95XEoCpb3TO+KZzJ4S/5uW5fNe26DjBGqf1o9ucyLyCmi1dXq/B3c8iaWTfBk3VvetUxl16e8tIrd5teOCfGw== + dependencies: + "@babel/helper-get-function-arity" "^7.0.0" + "@babel/template" "^7.1.0" + "@babel/types" "^7.0.0" + +"@babel/helper-get-function-arity@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.0.0.tgz#83572d4320e2a4657263734113c42868b64e49c3" + integrity sha512-r2DbJeg4svYvt3HOS74U4eWKsUAMRH01Z1ds1zx8KNTPtpTL5JAsdFv8BNyOpVqdFhHkkRDIg5B4AsxmkjAlmQ== + dependencies: + "@babel/types" "^7.0.0" + +"@babel/helper-plugin-utils@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.0.0.tgz#bbb3fbee98661c569034237cc03967ba99b4f250" + integrity sha512-CYAOUCARwExnEixLdB6sDm2dIJ/YgEAKDM1MOeMeZu9Ld/bDgVo8aiWrXwcY7OBh+1Ea2uUcVRcxKk0GJvW7QA== + +"@babel/helper-split-export-declaration@^7.4.4": + version "7.4.4" + resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.4.4.tgz#ff94894a340be78f53f06af038b205c49d993677" + integrity sha512-Ro/XkzLf3JFITkW6b+hNxzZ1n5OQ80NvIUdmHspih1XAhtN3vPTuUFT4eQnela+2MaZ5ulH+iyP513KJrxbN7Q== + dependencies: + "@babel/types" "^7.4.4" + +"@babel/helpers@^7.4.4": + version "7.4.4" + resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.4.4.tgz#868b0ef59c1dd4e78744562d5ce1b59c89f2f2a5" + integrity sha512-igczbR/0SeuPR8RFfC7tGrbdTbFL3QTvH6D+Z6zNxnTe//GyqmtHmDkzrqDmyZ3eSwPqB/LhyKoU5DXsp+Vp2A== + dependencies: + "@babel/template" "^7.4.4" + "@babel/traverse" "^7.4.4" + "@babel/types" "^7.4.4" + +"@babel/highlight@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.0.0.tgz#f710c38c8d458e6dd9a201afb637fcb781ce99e4" + integrity sha512-UFMC4ZeFC48Tpvj7C8UgLvtkaUuovQX+5xNWrsIoMG8o2z+XFKjKaN9iVmS84dPwVN00W4wPmqvYoZF3EGAsfw== + dependencies: + chalk "^2.0.0" + esutils "^2.0.2" + js-tokens "^4.0.0" + +"@babel/parser@^7.1.0", "@babel/parser@^7.4.3", "@babel/parser@^7.4.4", "@babel/parser@^7.4.5": + version "7.4.5" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.4.5.tgz#04af8d5d5a2b044a2a1bffacc1e5e6673544e872" + integrity sha512-9mUqkL1FF5T7f0WDFfAoDdiMVPWsdD1gZYzSnaXsxUCUqzuch/8of9G3VUSNiZmMBoRxT3neyVsqeiL/ZPcjew== + +"@babel/plugin-syntax-object-rest-spread@^7.0.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.2.0.tgz#3b7a3e733510c57e820b9142a6579ac8b0dfad2e" + integrity sha512-t0JKGgqk2We+9may3t0xDdmneaXmyxq0xieYcKHxIsrJO64n1OiMWNUtc5gQK1PA0NpdCRrtZp4z+IUaKugrSA== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/template@^7.1.0", "@babel/template@^7.4.0", "@babel/template@^7.4.4": + version "7.4.4" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.4.4.tgz#f4b88d1225689a08f5bc3a17483545be9e4ed237" + integrity sha512-CiGzLN9KgAvgZsnivND7rkA+AeJ9JB0ciPOD4U59GKbQP2iQl+olF1l76kJOupqidozfZ32ghwBEJDhnk9MEcw== + dependencies: + "@babel/code-frame" "^7.0.0" + "@babel/parser" "^7.4.4" + "@babel/types" "^7.4.4" + +"@babel/traverse@^7.1.0", "@babel/traverse@^7.4.3", "@babel/traverse@^7.4.4", "@babel/traverse@^7.4.5": + version "7.4.5" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.4.5.tgz#4e92d1728fd2f1897dafdd321efbff92156c3216" + integrity sha512-Vc+qjynwkjRmIFGxy0KYoPj4FdVDxLej89kMHFsWScq999uX+pwcX4v9mWRjW0KcAYTPAuVQl2LKP1wEVLsp+A== + dependencies: + "@babel/code-frame" "^7.0.0" + "@babel/generator" "^7.4.4" + "@babel/helper-function-name" "^7.1.0" + "@babel/helper-split-export-declaration" "^7.4.4" + "@babel/parser" "^7.4.5" + "@babel/types" "^7.4.4" + debug "^4.1.0" + globals "^11.1.0" + lodash "^4.17.11" + +"@babel/types@^7.0.0", "@babel/types@^7.3.0", "@babel/types@^7.4.0", "@babel/types@^7.4.4": + version "7.4.4" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.4.4.tgz#8db9e9a629bb7c29370009b4b779ed93fe57d5f0" + integrity sha512-dOllgYdnEFOebhkKCjzSVFqw/PmmB8pH6RGOWkY4GsboQNd47b1fBThBSwlHAq9alF9vc1M3+6oqR47R50L0tQ== + dependencies: + esutils "^2.0.2" + lodash "^4.17.11" + to-fast-properties "^2.0.0" + +"@cnakazawa/watch@^1.0.3": + version "1.0.3" + resolved "https://registry.yarnpkg.com/@cnakazawa/watch/-/watch-1.0.3.tgz#099139eaec7ebf07a27c1786a3ff64f39464d2ef" + integrity sha512-r5160ogAvGyHsal38Kux7YYtodEKOj89RGb28ht1jh3SJb08VwRwAKKJL0bGb04Zd/3r9FL3BFIc3bBidYffCA== + dependencies: + exec-sh "^0.3.2" + minimist "^1.2.0" + +"@jest/console@^24.7.1": + version "24.7.1" + resolved "https://registry.yarnpkg.com/@jest/console/-/console-24.7.1.tgz#32a9e42535a97aedfe037e725bd67e954b459545" + integrity sha512-iNhtIy2M8bXlAOULWVTUxmnelTLFneTNEkHCgPmgd+zNwy9zVddJ6oS5rZ9iwoscNdT5mMwUd0C51v/fSlzItg== + dependencies: + "@jest/source-map" "^24.3.0" + chalk "^2.0.1" + slash "^2.0.0" + +"@jest/core@^24.8.0": + version "24.8.0" + resolved "https://registry.yarnpkg.com/@jest/core/-/core-24.8.0.tgz#fbbdcd42a41d0d39cddbc9f520c8bab0c33eed5b" + integrity sha512-R9rhAJwCBQzaRnrRgAdVfnglUuATXdwTRsYqs6NMdVcAl5euG8LtWDe+fVkN27YfKVBW61IojVsXKaOmSnqd/A== + dependencies: + "@jest/console" "^24.7.1" + "@jest/reporters" "^24.8.0" + "@jest/test-result" "^24.8.0" + "@jest/transform" "^24.8.0" + "@jest/types" "^24.8.0" + ansi-escapes "^3.0.0" + chalk "^2.0.1" + exit "^0.1.2" + graceful-fs "^4.1.15" + jest-changed-files "^24.8.0" + jest-config "^24.8.0" + jest-haste-map "^24.8.0" + jest-message-util "^24.8.0" + jest-regex-util "^24.3.0" + jest-resolve-dependencies "^24.8.0" + jest-runner "^24.8.0" + jest-runtime "^24.8.0" + jest-snapshot "^24.8.0" + jest-util "^24.8.0" + jest-validate "^24.8.0" + jest-watcher "^24.8.0" + micromatch "^3.1.10" + p-each-series "^1.0.0" + pirates "^4.0.1" + realpath-native "^1.1.0" + rimraf "^2.5.4" + strip-ansi "^5.0.0" + +"@jest/environment@^24.8.0": + version "24.8.0" + resolved "https://registry.yarnpkg.com/@jest/environment/-/environment-24.8.0.tgz#0342261383c776bdd652168f68065ef144af0eac" + integrity sha512-vlGt2HLg7qM+vtBrSkjDxk9K0YtRBi7HfRFaDxoRtyi+DyVChzhF20duvpdAnKVBV6W5tym8jm0U9EfXbDk1tw== + dependencies: + "@jest/fake-timers" "^24.8.0" + "@jest/transform" "^24.8.0" + "@jest/types" "^24.8.0" + jest-mock "^24.8.0" + +"@jest/fake-timers@^24.8.0": + version "24.8.0" + resolved "https://registry.yarnpkg.com/@jest/fake-timers/-/fake-timers-24.8.0.tgz#2e5b80a4f78f284bcb4bd5714b8e10dd36a8d3d1" + integrity sha512-2M4d5MufVXwi6VzZhJ9f5S/wU4ud2ck0kxPof1Iz3zWx6Y+V2eJrES9jEktB6O3o/oEyk+il/uNu9PvASjWXQw== + dependencies: + "@jest/types" "^24.8.0" + jest-message-util "^24.8.0" + jest-mock "^24.8.0" + +"@jest/reporters@^24.8.0": + version "24.8.0" + resolved "https://registry.yarnpkg.com/@jest/reporters/-/reporters-24.8.0.tgz#075169cd029bddec54b8f2c0fc489fd0b9e05729" + integrity sha512-eZ9TyUYpyIIXfYCrw0UHUWUvE35vx5I92HGMgS93Pv7du+GHIzl+/vh8Qj9MCWFK/4TqyttVBPakWMOfZRIfxw== + dependencies: + "@jest/environment" "^24.8.0" + "@jest/test-result" "^24.8.0" + "@jest/transform" "^24.8.0" + "@jest/types" "^24.8.0" + chalk "^2.0.1" + exit "^0.1.2" + glob "^7.1.2" + istanbul-lib-coverage "^2.0.2" + istanbul-lib-instrument "^3.0.1" + istanbul-lib-report "^2.0.4" + istanbul-lib-source-maps "^3.0.1" + istanbul-reports "^2.1.1" + jest-haste-map "^24.8.0" + jest-resolve "^24.8.0" + jest-runtime "^24.8.0" + jest-util "^24.8.0" + jest-worker "^24.6.0" + node-notifier "^5.2.1" + slash "^2.0.0" + source-map "^0.6.0" + string-length "^2.0.0" + +"@jest/source-map@^24.3.0": + version "24.3.0" + resolved "https://registry.yarnpkg.com/@jest/source-map/-/source-map-24.3.0.tgz#563be3aa4d224caf65ff77edc95cd1ca4da67f28" + integrity sha512-zALZt1t2ou8le/crCeeiRYzvdnTzaIlpOWaet45lNSqNJUnXbppUUFR4ZUAlzgDmKee4Q5P/tKXypI1RiHwgag== + dependencies: + callsites "^3.0.0" + graceful-fs "^4.1.15" + source-map "^0.6.0" + +"@jest/test-result@^24.8.0": + version "24.8.0" + resolved "https://registry.yarnpkg.com/@jest/test-result/-/test-result-24.8.0.tgz#7675d0aaf9d2484caa65e048d9b467d160f8e9d3" + integrity sha512-+YdLlxwizlfqkFDh7Mc7ONPQAhA4YylU1s529vVM1rsf67vGZH/2GGm5uO8QzPeVyaVMobCQ7FTxl38QrKRlng== + dependencies: + "@jest/console" "^24.7.1" + "@jest/types" "^24.8.0" + "@types/istanbul-lib-coverage" "^2.0.0" + +"@jest/test-sequencer@^24.8.0": + version "24.8.0" + resolved "https://registry.yarnpkg.com/@jest/test-sequencer/-/test-sequencer-24.8.0.tgz#2f993bcf6ef5eb4e65e8233a95a3320248cf994b" + integrity sha512-OzL/2yHyPdCHXEzhoBuq37CE99nkme15eHkAzXRVqthreWZamEMA0WoetwstsQBCXABhczpK03JNbc4L01vvLg== + dependencies: + "@jest/test-result" "^24.8.0" + jest-haste-map "^24.8.0" + jest-runner "^24.8.0" + jest-runtime "^24.8.0" + +"@jest/transform@^24.8.0": + version "24.8.0" + resolved "https://registry.yarnpkg.com/@jest/transform/-/transform-24.8.0.tgz#628fb99dce4f9d254c6fd9341e3eea262e06fef5" + integrity sha512-xBMfFUP7TortCs0O+Xtez2W7Zu1PLH9bvJgtraN1CDST6LBM/eTOZ9SfwS/lvV8yOfcDpFmwf9bq5cYbXvqsvA== + dependencies: + "@babel/core" "^7.1.0" + "@jest/types" "^24.8.0" + babel-plugin-istanbul "^5.1.0" + chalk "^2.0.1" + convert-source-map "^1.4.0" + fast-json-stable-stringify "^2.0.0" + graceful-fs "^4.1.15" + jest-haste-map "^24.8.0" + jest-regex-util "^24.3.0" + jest-util "^24.8.0" + micromatch "^3.1.10" + realpath-native "^1.1.0" + slash "^2.0.0" + source-map "^0.6.1" + write-file-atomic "2.4.1" + +"@jest/types@^24.8.0": + version "24.8.0" + resolved "https://registry.yarnpkg.com/@jest/types/-/types-24.8.0.tgz#f31e25948c58f0abd8c845ae26fcea1491dea7ad" + integrity sha512-g17UxVr2YfBtaMUxn9u/4+siG1ptg9IGYAYwvpwn61nBg779RXnjE/m7CxYcIzEt0AbHZZAHSEZNhkE2WxURVg== + dependencies: + "@types/istanbul-lib-coverage" "^2.0.0" + "@types/istanbul-reports" "^1.1.1" + "@types/yargs" "^12.0.9" + "@release-notes/cli@^0.1.0": version "0.1.0" resolved "https://registry.yarnpkg.com/@release-notes/cli/-/cli-0.1.0.tgz#9f457562955b4ce90af0f22bb49a48bcea815169" @@ -21,6 +304,102 @@ version "0.1.0" resolved "https://registry.yarnpkg.com/@release-notes/schema/-/schema-0.1.0.tgz#bbe101987966295ec1eab1eab1e6fcd99bd93436" +"@types/babel__core@^7.1.0": + version "7.1.2" + resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.1.2.tgz#608c74f55928033fce18b99b213c16be4b3d114f" + integrity sha512-cfCCrFmiGY/yq0NuKNxIQvZFy9kY/1immpSpTngOnyIbD4+eJOG5mxphhHDv3CHL9GltO4GcKr54kGBg3RNdbg== + dependencies: + "@babel/parser" "^7.1.0" + "@babel/types" "^7.0.0" + "@types/babel__generator" "*" + "@types/babel__template" "*" + "@types/babel__traverse" "*" + +"@types/babel__generator@*": + version "7.0.2" + resolved "https://registry.yarnpkg.com/@types/babel__generator/-/babel__generator-7.0.2.tgz#d2112a6b21fad600d7674274293c85dce0cb47fc" + integrity sha512-NHcOfab3Zw4q5sEE2COkpfXjoE7o+PmqD9DQW4koUT3roNxwziUdXGnRndMat/LJNUtePwn1TlP4do3uoe3KZQ== + dependencies: + "@babel/types" "^7.0.0" + +"@types/babel__template@*": + version "7.0.2" + resolved "https://registry.yarnpkg.com/@types/babel__template/-/babel__template-7.0.2.tgz#4ff63d6b52eddac1de7b975a5223ed32ecea9307" + integrity sha512-/K6zCpeW7Imzgab2bLkLEbz0+1JlFSrUMdw7KoIIu+IUdu51GWaBZpd3y1VXGVXzynvGa4DaIaxNZHiON3GXUg== + dependencies: + "@babel/parser" "^7.1.0" + "@babel/types" "^7.0.0" + +"@types/babel__traverse@*", "@types/babel__traverse@^7.0.6": + version "7.0.6" + resolved "https://registry.yarnpkg.com/@types/babel__traverse/-/babel__traverse-7.0.6.tgz#328dd1a8fc4cfe3c8458be9477b219ea158fd7b2" + integrity sha512-XYVgHF2sQ0YblLRMLNPB3CkFMewzFmlDsH/TneZFHUXDlABQgh88uOxuez7ZcXxayLFrqLwtDH1t+FmlFwNZxw== + dependencies: + "@babel/types" "^7.3.0" + +"@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.1.tgz#42995b446db9a48a11a07ec083499a860e9138ff" + integrity sha512-hRJD2ahnnpLgsj6KWMYSrmXkM3rm2Dl1qkx6IOFD5FnuNPXJIG5L0dhgKXCYTRMGzU4n0wImQ/xfmRc4POUFlg== + +"@types/istanbul-lib-report@*": + version "1.1.1" + resolved "https://registry.yarnpkg.com/@types/istanbul-lib-report/-/istanbul-lib-report-1.1.1.tgz#e5471e7fa33c61358dd38426189c037a58433b8c" + integrity sha512-3BUTyMzbZa2DtDI2BkERNC6jJw2Mr2Y0oGI7mRxYNBPxppbtEK1F66u3bKwU2g+wxwWI7PAoRpJnOY1grJqzHg== + dependencies: + "@types/istanbul-lib-coverage" "*" + +"@types/istanbul-reports@^1.1.1": + version "1.1.1" + resolved "https://registry.yarnpkg.com/@types/istanbul-reports/-/istanbul-reports-1.1.1.tgz#7a8cbf6a406f36c8add871625b278eaf0b0d255a" + integrity sha512-UpYjBi8xefVChsCoBpKShdxTllC9pwISirfoZsUa2AAdQg/Jd2KQGtSbw+ya7GPo7x/wAPlH6JBhKhAsXUEZNA== + dependencies: + "@types/istanbul-lib-coverage" "*" + "@types/istanbul-lib-report" "*" + +"@types/stack-utils@^1.0.1": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-1.0.1.tgz#0a851d3bd96498fa25c33ab7278ed3bd65f06c3e" + integrity sha512-l42BggppR6zLmpfU6fq9HEa2oGPEI8yrSPL3GITjfRInppYFahObbIQOQK3UGxEnyQpltZLaPe75046NOZQikw== + +"@types/yargs@^12.0.2", "@types/yargs@^12.0.9": + version "12.0.12" + resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-12.0.12.tgz#45dd1d0638e8c8f153e87d296907659296873916" + integrity sha512-SOhuU4wNBxhhTHxYaiG5NY4HBhDIDnJF60GU+2LqHAdKKer86//e4yg69aENCtQ04n0ovz+tq2YPME5t5yp4pw== + +abab@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/abab/-/abab-2.0.0.tgz#aba0ab4c5eee2d4c79d3487d85450fb2376ebb0f" + integrity sha512-sY5AXXVZv4Y1VACTtR11UJCPHHudgY5i26Qj5TypE6DKlIApbwb5uqhXcJ5UUGbvZNRh7EeIoW+LrJumBsKp7w== + +abbrev@1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.1.1.tgz#f8f2c887ad10bf67f634f005b6987fed3179aac8" + integrity sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q== + +acorn-globals@^4.1.0: + version "4.3.2" + resolved "https://registry.yarnpkg.com/acorn-globals/-/acorn-globals-4.3.2.tgz#4e2c2313a597fd589720395f6354b41cd5ec8006" + integrity sha512-BbzvZhVtZP+Bs1J1HcwrQe8ycfO0wStkSGxuul3He3GkHOIZ6eTqOkPuw9IP1X3+IkOo4wiJmwkobzXYz4wewQ== + dependencies: + acorn "^6.0.1" + acorn-walk "^6.0.1" + +acorn-walk@^6.0.1: + version "6.1.1" + resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-6.1.1.tgz#d363b66f5fac5f018ff9c3a1e7b6f8e310cc3913" + integrity sha512-OtUw6JUTgxA2QoqqmrmQ7F2NYqiBPi/L2jqHyFtllhOUvXYQXf0Z1CYUinIfyT4bTCGmrA7gX9FvHA81uzCoVw== + +acorn@^5.5.3: + version "5.7.3" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.7.3.tgz#67aa231bf8812974b85235a96771eb6bd07ea279" + integrity sha512-T/zvzYRfbVojPWahDsE5evJdHb3oJoQfFbsrKM7w5Zcs++Tr257tia3BmMP8XYVjp1S9RZXQMh7gao96BlqZOw== + +acorn@^6.0.1: + version "6.1.1" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.1.1.tgz#7d25ae05bb8ad1f9b699108e1094ecd7884adc1f" + integrity sha512-jPTiwtOxaHNaAPg/dmrJ/beuzLRnXtB0kQPQ8JpotKJgTB6rX6c8mlf315941pyjBSaPg8NHXS9fhP4u17DpGA== + ajv@^5.1.0, ajv@^5.2.2: version "5.5.2" resolved "https://registry.yarnpkg.com/ajv/-/ajv-5.5.2.tgz#73b5eeca3fab653e3d3f9422b341ad42205dc965" @@ -30,6 +409,16 @@ ajv@^5.1.0, ajv@^5.2.2: fast-json-stable-stringify "^2.0.0" json-schema-traverse "^0.3.0" +ajv@^6.5.5: + version "6.10.0" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.10.0.tgz#90d0d54439da587cd7e843bfb7045f50bd22bdf1" + integrity sha512-nffhOpkymDECQyR0mnsUtoCE8RlX38G0rYP+wgLWFyZuUyuuojSSvi/+euOiQBIn63whYwYVIIH1TvE3tu4OEg== + dependencies: + fast-deep-equal "^2.0.1" + fast-json-stable-stringify "^2.0.0" + json-schema-traverse "^0.4.1" + uri-js "^4.2.2" + align-text@^0.1.1, align-text@^0.1.3: version "0.1.4" resolved "https://registry.yarnpkg.com/align-text/-/align-text-0.1.4.tgz#0cd90a561093f35d0a99256c22b7069433fad117" @@ -42,6 +431,11 @@ amdefine@>=0.0.4: version "1.0.1" resolved "https://registry.yarnpkg.com/amdefine/-/amdefine-1.0.1.tgz#4a5282ac164729e93619bcfd3ad151f817ce91f5" +ansi-escapes@^3.0.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-3.2.0.tgz#8780b98ff9dbf5638152d1f1fe5c1d7b4442976b" + integrity sha512-cBhpre4ma+U0T1oM5fXg7Dy1Jw7zzwv7lt/GoCpr+hDQJoYnKVPLL4dCvSEFMmQurOQvSrwT7SL/DAlhBI97RQ== + ansi-regex@^2.0.0: version "2.1.1" resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df" @@ -50,20 +444,53 @@ ansi-regex@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-3.0.0.tgz#ed0317c322064f79466c02966bddb605ab37d998" +ansi-regex@^4.0.0, ansi-regex@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-4.1.0.tgz#8b9f8f08cf1acb843756a839ca8c7e3168c51997" + integrity sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg== + ansi-styles@^2.2.1: version "2.2.1" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe" +ansi-styles@^3.2.0, ansi-styles@^3.2.1: + version "3.2.1" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" + integrity sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA== + dependencies: + color-convert "^1.9.0" + +anymatch@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-2.0.0.tgz#bcb24b4f37934d9aa7ac17b4adaf89e7c76ef2eb" + integrity sha512-5teOsQWABXHHBFP9y3skS5P3d/WfWXpv3FUpy+LorMrNYaT9pI4oLMQX7jzQ2KklNpGpWHzdCXTDT2Y3XGlZBw== + dependencies: + micromatch "^3.1.4" + normalize-path "^2.1.1" + append-transform@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/append-transform/-/append-transform-0.4.0.tgz#d76ebf8ca94d276e247a36bad44a4b74ab611991" dependencies: default-require-extensions "^1.0.0" +aproba@^1.0.3: + version "1.2.0" + resolved "https://registry.yarnpkg.com/aproba/-/aproba-1.2.0.tgz#6802e6264efd18c790a1b0d517f0f2627bf2c94a" + integrity sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw== + archy@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/archy/-/archy-1.0.0.tgz#f9c8c13757cc1dd7bc379ac77b2c62a5c2868c40" +are-we-there-yet@~1.1.2: + version "1.1.5" + resolved "https://registry.yarnpkg.com/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz#4b35c2944f062a8bfcda66410760350fe9ddfc21" + integrity sha512-5hYdAkZlcG8tOLujVDTgCT+uPX0VnpAH28gWsLfzpXYm7wP6mp5Q/gYyR7YQ0cKVJcXJnl3j2kpBan13PtQf6w== + dependencies: + delegates "^1.0.0" + readable-stream "^2.0.6" + argparse@^1.0.7: version "1.0.10" resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" @@ -88,6 +515,11 @@ arr-union@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/arr-union/-/arr-union-3.1.0.tgz#e39b09aea9def866a8f206e288af63919bae39c4" +array-equal@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/array-equal/-/array-equal-1.0.0.tgz#8c2a5ef2472fd9ea742b04c77a75093ba2757c93" + integrity sha1-jCpe8kcv2ep0KwTHenUJO6J1fJM= + array-unique@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/array-unique/-/array-unique-0.2.1.tgz#a1d97ccafcbc2625cc70fadceb36a50c58b01a53" @@ -108,14 +540,20 @@ assert-plus@1.0.0, assert-plus@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/assert-plus/-/assert-plus-1.0.0.tgz#f12e0f3c5d77b0b1cdd9146942e4e96c1e4dd525" -assertion-error@^1.0.1: - version "1.1.0" - resolved "https://registry.yarnpkg.com/assertion-error/-/assertion-error-1.1.0.tgz#e60b6b0e8f301bd97e5375215bda406c85118c0b" - assign-symbols@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/assign-symbols/-/assign-symbols-1.0.0.tgz#59667f41fadd4f20ccbc2bb96b8d4f7f78ec0367" +astral-regex@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-1.0.0.tgz#6c8c3fb827dd43ee3918f27b82782ab7658a6fd9" + integrity sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg== + +async-limiter@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/async-limiter/-/async-limiter-1.0.0.tgz#78faed8c3d074ab81f22b4e985d79e8738f720f8" + integrity sha512-jp/uFnooOiO+L211eZOoSyzpOITMXx1rBITauYykG3BRYPu8h0UcxsPNB04RR5vo4Tyz3+ay17tR6JVf9qzYWg== + async@2.1.4: version "2.1.4" resolved "https://registry.yarnpkg.com/async/-/async-2.1.4.tgz#2d2160c7788032e4dd6cbe2502f1f9a2c8f6cde4" @@ -142,6 +580,11 @@ aws4@^1.6.0: version "1.6.0" resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.6.0.tgz#83ef5ca860b2b32e4a0deedee8c771b9db57471e" +aws4@^1.8.0: + version "1.8.0" + resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.8.0.tgz#f0e003d9ca9e7f59c7a508945d7b2ef9a04a542f" + integrity sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ== + 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" @@ -163,12 +606,49 @@ babel-generator@^6.18.0: source-map "^0.5.7" trim-right "^1.0.1" +babel-jest@^24.8.0: + version "24.8.0" + resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-24.8.0.tgz#5c15ff2b28e20b0f45df43fe6b7f2aae93dba589" + integrity sha512-+5/kaZt4I9efoXzPlZASyK/lN9qdRKmmUav9smVc0ruPQD7IsfucQ87gpOE8mn2jbDuS6M/YOW6n3v9ZoIfgnw== + dependencies: + "@jest/transform" "^24.8.0" + "@jest/types" "^24.8.0" + "@types/babel__core" "^7.1.0" + babel-plugin-istanbul "^5.1.0" + babel-preset-jest "^24.6.0" + chalk "^2.4.2" + slash "^2.0.0" + babel-messages@^6.23.0: version "6.23.0" resolved "https://registry.yarnpkg.com/babel-messages/-/babel-messages-6.23.0.tgz#f3cdf4703858035b2a2951c6ec5edf6c62f2630e" dependencies: babel-runtime "^6.22.0" +babel-plugin-istanbul@^5.1.0: + version "5.1.4" + resolved "https://registry.yarnpkg.com/babel-plugin-istanbul/-/babel-plugin-istanbul-5.1.4.tgz#841d16b9a58eeb407a0ddce622ba02fe87a752ba" + integrity sha512-dySz4VJMH+dpndj0wjJ8JPs/7i1TdSPb1nRrn56/92pKOF9VKC1FMFJmMXjzlGGusnCAqujP6PBCiKq0sVA+YQ== + dependencies: + find-up "^3.0.0" + istanbul-lib-instrument "^3.3.0" + test-exclude "^5.2.3" + +babel-plugin-jest-hoist@^24.6.0: + version "24.6.0" + resolved "https://registry.yarnpkg.com/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-24.6.0.tgz#f7f7f7ad150ee96d7a5e8e2c5da8319579e78019" + integrity sha512-3pKNH6hMt9SbOv0F3WVmy5CWQ4uogS3k0GY5XLyQHJ9EGpAT9XWkFd2ZiXXtkwFHdAHa5j7w7kfxSP5lAIwu7w== + dependencies: + "@types/babel__traverse" "^7.0.6" + +babel-preset-jest@^24.6.0: + version "24.6.0" + resolved "https://registry.yarnpkg.com/babel-preset-jest/-/babel-preset-jest-24.6.0.tgz#66f06136eefce87797539c0d63f1769cc3915984" + integrity sha512-pdZqLEdmy1ZK5kyRUfvBb2IfTPb2BUvIJczlPspS8fWmBQslNNDBqVfh7BW5leOVJMDZKzjD8XEyABTk6gQ5yw== + dependencies: + "@babel/plugin-syntax-object-rest-spread" "^7.0.0" + babel-plugin-jest-hoist "^24.6.0" + babel-runtime@^6.22.0, babel-runtime@^6.26.0: version "6.26.0" resolved "https://registry.yarnpkg.com/babel-runtime/-/babel-runtime-6.26.0.tgz#965c7058668e82b55d7bfe04ff2337bc8b5647fe" @@ -283,14 +763,34 @@ braces@^2.3.1: split-string "^3.0.2" to-regex "^3.0.1" -browser-stdout@1.3.1: - version "1.3.1" - resolved "https://registry.yarnpkg.com/browser-stdout/-/browser-stdout-1.3.1.tgz#baa559ee14ced73452229bad7326467c61fabd60" +browser-process-hrtime@^0.1.2: + version "0.1.3" + resolved "https://registry.yarnpkg.com/browser-process-hrtime/-/browser-process-hrtime-0.1.3.tgz#616f00faef1df7ec1b5bf9cfe2bdc3170f26c7b4" + integrity sha512-bRFnI4NnjO6cnyLmOV/7PVoDEMJChlcfN0z4s1YMBY989/SvlfMI1lgCnkFUs53e9gQF+w7qu7XdllSTiSl8Aw== + +browser-resolve@^1.11.3: + version "1.11.3" + resolved "https://registry.yarnpkg.com/browser-resolve/-/browser-resolve-1.11.3.tgz#9b7cbb3d0f510e4cb86bdbd796124d28b5890af6" + integrity sha512-exDi1BYWB/6raKHmDTCicQfTkqwN5fioMFV4j8BsfMU4R2DK/QfZfK7kOVkmWCNANf0snkBzqGqAJBao9gZMdQ== + dependencies: + resolve "1.1.7" + +bser@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/bser/-/bser-2.0.0.tgz#9ac78d3ed5d915804fd87acb158bc797147a1719" + integrity sha1-mseNPtXZFYBP2HrLFYvHlxR6Fxk= + dependencies: + node-int64 "^0.4.0" bson@~1.0.4: version "1.0.5" resolved "https://registry.yarnpkg.com/bson/-/bson-1.0.5.tgz#34563b73ff1fde9387c1b9fb5afd845ecc4ba623" +buffer-from@^1.0.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef" + integrity sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A== + buffer-shims@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/buffer-shims/-/buffer-shims-1.0.0.tgz#9978ce317388c649ad8793028c3477ef044a8b51" @@ -321,6 +821,11 @@ caching-transform@^1.0.0: mkdirp "^0.5.1" write-file-atomic "^1.1.4" +callsites@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73" + integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ== + camelcase@^1.0.2: version "1.2.1" resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-1.2.1.tgz#9bb5304d2e0b56698b2c758b08a3eaa9daa58a39" @@ -329,6 +834,18 @@ camelcase@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-4.1.0.tgz#d545635be1e33c542649c69173e5de6acfae34dd" +camelcase@^5.0.0: + version "5.3.1" + resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320" + integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg== + +capture-exit@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/capture-exit/-/capture-exit-2.0.0.tgz#fb953bfaebeb781f62898239dabb426d08a509a4" + integrity sha512-PiT/hQmTonHhl/HFGN+Lx3JJUznrVYJ3+AQsnthneZbvW7x+f08Tk7yLJTLEOUvBTbduLeeBkxEaYXUOUrRq6g== + dependencies: + rsvp "^4.8.4" + caseless@~0.12.0: version "0.12.0" resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc" @@ -340,17 +857,6 @@ center-align@^0.1.1: align-text "^0.1.3" lazy-cache "^1.0.3" -chai@^4.1.2: - version "4.1.2" - resolved "https://registry.yarnpkg.com/chai/-/chai-4.1.2.tgz#0f64584ba642f0f2ace2806279f4f06ca23ad73c" - dependencies: - assertion-error "^1.0.1" - check-error "^1.0.1" - deep-eql "^3.0.0" - get-func-name "^2.0.0" - pathval "^1.0.0" - type-detect "^4.0.0" - chalk@^1.1.3: version "1.1.3" resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98" @@ -361,9 +867,24 @@ chalk@^1.1.3: strip-ansi "^3.0.0" supports-color "^2.0.0" -check-error@^1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/check-error/-/check-error-1.0.2.tgz#574d312edd88bb5dd8912e9286dd6c0aed4aac82" +chalk@^2.0.0, chalk@^2.0.1, chalk@^2.4.2: + version "2.4.2" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" + integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== + dependencies: + ansi-styles "^3.2.1" + escape-string-regexp "^1.0.5" + supports-color "^5.3.0" + +chownr@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/chownr/-/chownr-1.1.1.tgz#54726b8b8fff4df053c42187e801fb4412df1494" + integrity sha512-j38EvO5+LHX84jlo6h4UzmOwi0UgW61WRyPtJz4qaadK5eY3BTS5TY/S1Stc3Uk2lIM6TPevAlULiEJwie860g== + +ci-info@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-2.0.0.tgz#67a9e964be31a51e15e5010d58e6f12834002f46" + integrity sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ== class-utils@^0.3.5: version "0.3.6" @@ -420,15 +941,35 @@ collection-visit@^1.0.0: map-visit "^1.0.0" object-visit "^1.0.0" +color-convert@^1.9.0: + version "1.9.3" + resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8" + integrity sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg== + dependencies: + color-name "1.1.3" + +color-name@1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" + integrity sha1-p9BVi9icQveV3UIyj3QIMcpTvCU= + combined-stream@1.0.6, combined-stream@~1.0.5: version "1.0.6" resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.6.tgz#723e7df6e801ac5613113a7e445a9b69cb632818" dependencies: delayed-stream "~1.0.0" -commander@2.11.0: - version "2.11.0" - resolved "https://registry.yarnpkg.com/commander/-/commander-2.11.0.tgz#157152fd1e7a6c8d98a5b715cf376df928004563" +combined-stream@^1.0.6, combined-stream@~1.0.6: + version "1.0.8" + resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f" + integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg== + dependencies: + delayed-stream "~1.0.0" + +commander@~2.20.0: + version "2.20.0" + resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.0.tgz#d58bb2b5c1ee8f87b0d340027e9e94e222c5a422" + integrity sha512-7j2y+40w61zy6YC2iRNpUe/NwhNyoXrYpHMrSunaMG64nRnaf96zO/KMQR4OyN/UnE5KLyEBnKHd4aG3rskjpQ== commondir@^1.0.1: version "1.0.1" @@ -448,6 +989,18 @@ console-browserify@1.1.x: dependencies: date-now "^0.1.4" +console-control-strings@^1.0.0, console-control-strings@~1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/console-control-strings/-/console-control-strings-1.1.0.tgz#3d7cf4464db6446ea644bf4b39507f9851008e8e" + integrity sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4= + +convert-source-map@^1.1.0, convert-source-map@^1.4.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.6.0.tgz#51b537a8c43e0f04dec1993bffcdd504e758ac20" + integrity sha512-eFu7XigvxdZ1ETfbgPBohgyQ/Z++C0eEhTor0qRwBw9unw+L0/6V8wkSuGgzdThkiS5lSpdptOQPD8Ak40a+7A== + dependencies: + safe-buffer "~5.1.1" + convert-source-map@^1.5.1: version "1.5.1" resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.5.1.tgz#b8278097b9bc229365de5c62cf5fcaed8b5599e5" @@ -489,18 +1042,50 @@ cross-spawn@^5.0.1: shebang-command "^1.2.0" which "^1.2.9" +cross-spawn@^6.0.0: + version "6.0.5" + resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4" + integrity sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ== + dependencies: + nice-try "^1.0.4" + path-key "^2.0.1" + semver "^5.5.0" + shebang-command "^1.2.0" + which "^1.2.9" + cryptiles@3.x.x: version "3.1.2" resolved "https://registry.yarnpkg.com/cryptiles/-/cryptiles-3.1.2.tgz#a89fbb220f5ce25ec56e8c4aa8a4fd7b5b0d29fe" dependencies: boom "5.x.x" +cssom@0.3.x, "cssom@>= 0.3.2 < 0.4.0": + version "0.3.6" + resolved "https://registry.yarnpkg.com/cssom/-/cssom-0.3.6.tgz#f85206cee04efa841f3c5982a74ba96ab20d65ad" + integrity sha512-DtUeseGk9/GBW0hl0vVPpU22iHL6YB5BUX7ml1hB+GMpo0NX5G4voX3kdWiMSEguFtcW3Vh3djqNF4aIe6ne0A== + +cssstyle@^1.0.0: + version "1.2.2" + resolved "https://registry.yarnpkg.com/cssstyle/-/cssstyle-1.2.2.tgz#427ea4d585b18624f6fdbf9de7a2a1a3ba713077" + integrity sha512-43wY3kl1CVQSvL7wUY1qXkxVGkStjpkDmVjiIKX8R97uhajy8Bybay78uOtqvh7Q5GK75dNPfW0geWjE6qQQow== + dependencies: + cssom "0.3.x" + dashdash@^1.12.0: version "1.14.1" resolved "https://registry.yarnpkg.com/dashdash/-/dashdash-1.14.1.tgz#853cfa0f7cbe2fed5de20326b8dd581035f6e2f0" dependencies: assert-plus "^1.0.0" +data-urls@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/data-urls/-/data-urls-1.1.0.tgz#15ee0582baa5e22bb59c77140da8f9c76963bbfe" + integrity sha512-YTWYI9se1P55u58gL5GkQHW4P6VJBJ5iBT+B5a7i2Tjadhv52paJG0qHX4A0OR6/t52odI64KP2YvFpkDOi3eQ== + dependencies: + abab "^2.0.0" + whatwg-mimetype "^2.2.0" + whatwg-url "^7.0.0" + date-now@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/date-now/-/date-now-0.1.4.tgz#eaf439fd4d4848ad74e5cc7dbef200672b9e345b" @@ -515,13 +1100,27 @@ debug@2.6.9, debug@^2.2.0, debug@^2.3.3, debug@^2.6.8: dependencies: ms "2.0.0" -debug@3.1.0, debug@^3.1.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: +debug@^3.2.6: + version "3.2.6" + resolved "https://registry.yarnpkg.com/debug/-/debug-3.2.6.tgz#e83d17de16d8a7efb7717edbe5fb10135eee629b" + integrity sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ== + dependencies: + ms "^2.1.1" + +debug@^4.1.0, debug@^4.1.1: + version "4.1.1" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.1.1.tgz#3b72260255109c6b589cee050f1d516139664791" + integrity sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw== + dependencies: + ms "^2.1.1" + +decamelize@^1.0.0, decamelize@^1.1.1, decamelize@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" @@ -529,11 +1128,15 @@ decode-uri-component@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/decode-uri-component/-/decode-uri-component-0.2.0.tgz#eb3913333458775cb84cd1a1fae062106bb87545" -deep-eql@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/deep-eql/-/deep-eql-3.0.1.tgz#dfc9404400ad1c8fe023e7da1df1c147c4b444df" - dependencies: - type-detect "^4.0.0" +deep-extend@^0.6.0: + version "0.6.0" + resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.6.0.tgz#c4fa7c95404a17a9c3e8ca7e1537312b736330ac" + integrity sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA== + +deep-is@~0.1.3: + version "0.1.3" + resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34" + integrity sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ= default-require-extensions@^1.0.0: version "1.0.0" @@ -541,6 +1144,13 @@ default-require-extensions@^1.0.0: dependencies: strip-bom "^2.0.0" +define-properties@^1.1.2: + version "1.1.3" + resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.1.3.tgz#cf88da6cbee26fe6db7094f61d870cbd84cee9f1" + integrity sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ== + dependencies: + object-keys "^1.0.12" + define-property@^0.2.5: version "0.2.5" resolved "https://registry.yarnpkg.com/define-property/-/define-property-0.2.5.tgz#c35b1ef918ec3c990f9a5bc57be04aacec5c8116" @@ -564,15 +1174,31 @@ delayed-stream@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" +delegates@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/delegates/-/delegates-1.0.0.tgz#84c6e159b81904fdca59a0ef44cd870d31250f9a" + integrity sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o= + detect-indent@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/detect-indent/-/detect-indent-4.0.0.tgz#f76d064352cdf43a1cb6ce619c4ee3a9475de208" dependencies: repeating "^2.0.0" -diff@3.5.0: - version "3.5.0" - resolved "https://registry.yarnpkg.com/diff/-/diff-3.5.0.tgz#800c0dd1e0a8bfbc95835c202ad220fe317e5a12" +detect-libc@^1.0.2: + version "1.0.3" + resolved "https://registry.yarnpkg.com/detect-libc/-/detect-libc-1.0.3.tgz#fa137c4bd698edf55cd5cd02ac559f91a4c4ba9b" + integrity sha1-+hN8S9aY7fVc1c0CrFWfkaTEups= + +detect-newline@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/detect-newline/-/detect-newline-2.1.0.tgz#f41f1c10be4b00e87b5f13da680759f2c5bfd3e2" + integrity sha1-9B8cEL5LAOh7XxPaaAdZ8sW/0+I= + +diff-sequences@^24.3.0: + version "24.3.0" + resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-24.3.0.tgz#0f20e8a1df1abddaf4d9c226680952e64118b975" + integrity sha512-xLqpez+Zj9GKSnPWS0WZw1igGocZ+uua8+y+5dDNTT934N3QuY1sp2LkHzwiaYQGz60hMq0pjAshdeXm5VUOEw== dom-serializer@0: version "0.1.0" @@ -589,6 +1215,13 @@ domelementtype@~1.1.1: version "1.1.3" resolved "https://registry.yarnpkg.com/domelementtype/-/domelementtype-1.1.3.tgz#bd28773e2642881aec51544924299c5cd822185b" +domexception@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/domexception/-/domexception-1.0.1.tgz#937442644ca6a31261ef36e3ec677fe805582c90" + integrity sha512-raigMkn7CJNNo6Ihro1fzG7wr3fHuYVytzquZKX5n0yizGsTcYgzdIUwj1X9pK0VvjeihV+XiclP+DjwbsSKug== + dependencies: + webidl-conversions "^4.0.2" + domhandler@2.3: version "2.3.0" resolved "https://registry.yarnpkg.com/domhandler/-/domhandler-2.3.0.tgz#2de59a0822d5027fabff6f032c2b25a2a8abe738" @@ -608,6 +1241,13 @@ ecc-jsbn@~0.1.1: dependencies: jsbn "~0.1.0" +end-of-stream@^1.1.0: + version "1.4.1" + resolved "https://registry.yarnpkg.com/end-of-stream/-/end-of-stream-1.4.1.tgz#ed29634d19baba463b6ce6b80a37213eab71ec43" + integrity sha512-1MkrZNvWTKCaigbn+W15elq2BB/L22nqrSY5DKlo3X6+vclJm8Bb5djXJBmEX6fS3+zCh/F4VBK5Z2KxJt4s2Q== + dependencies: + once "^1.4.0" + entities@1.0: version "1.0.0" resolved "https://registry.yarnpkg.com/entities/-/entities-1.0.0.tgz#b2987aa3821347fcde642b24fdfc9e4fb712bf26" @@ -622,22 +1262,78 @@ error-ex@^1.2.0: dependencies: is-arrayish "^0.2.1" +error-ex@^1.3.1: + version "1.3.2" + resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.2.tgz#b4ac40648107fdcdcfae242f428bea8a14d4f1bf" + integrity sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g== + dependencies: + is-arrayish "^0.2.1" + +es-abstract@^1.5.1: + version "1.13.0" + resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.13.0.tgz#ac86145fdd5099d8dd49558ccba2eaf9b88e24e9" + integrity sha512-vDZfg/ykNxQVwup/8E1BZhVzFfBxs9NqMzGcvIJrqg5k2/5Za2bWo40dK2J1pgLngZ7c+Shh8lwYtLGyrwPutg== + dependencies: + es-to-primitive "^1.2.0" + function-bind "^1.1.1" + has "^1.0.3" + is-callable "^1.1.4" + is-regex "^1.0.4" + object-keys "^1.0.12" + +es-to-primitive@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/es-to-primitive/-/es-to-primitive-1.2.0.tgz#edf72478033456e8dda8ef09e00ad9650707f377" + integrity sha512-qZryBOJjV//LaxLTV6UC//WewneB3LcXOL9NP++ozKVXsIIIpm/2c13UDiD9Jp2eThsecw9m3jPqDwTyobcdbg== + dependencies: + is-callable "^1.1.4" + is-date-object "^1.0.1" + is-symbol "^1.0.2" + es6-promise@3.2.1: version "3.2.1" resolved "https://registry.yarnpkg.com/es6-promise/-/es6-promise-3.2.1.tgz#ec56233868032909207170c39448e24449dd1fc4" -escape-string-regexp@1.0.5, escape-string-regexp@^1.0.2: +escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" + integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ= + +escodegen@^1.9.1: + version "1.11.1" + resolved "https://registry.yarnpkg.com/escodegen/-/escodegen-1.11.1.tgz#c485ff8d6b4cdb89e27f4a856e91f118401ca510" + integrity sha512-JwiqFD9KdGVVpeuRa68yU3zZnBEOcPs0nKW7wZzXky8Z7tffdYUHbe11bPCV5jYlK6DVdKLWLm0f5I/QlL0Kmw== + dependencies: + esprima "^3.1.3" + estraverse "^4.2.0" + esutils "^2.0.2" + optionator "^0.8.1" + optionalDependencies: + source-map "~0.6.1" + +esprima@^3.1.3: + version "3.1.3" + resolved "https://registry.yarnpkg.com/esprima/-/esprima-3.1.3.tgz#fdca51cee6133895e3c88d535ce49dbff62a4633" + integrity sha1-/cpRzuYTOJXjyI1TXOSdv/YqRjM= esprima@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.0.tgz#4499eddcd1110e0b218bacf2fa7f7f59f55ca804" +estraverse@^4.2.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.2.0.tgz#0dee3fed31fcd469618ce7342099fc1afa0bdb13" + integrity sha1-De4/7TH81GlhjOc0IJn8GvoL2xM= + esutils@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.2.tgz#0abf4f1caa5bcb1f7a9d8acc6dea4faaa04bac9b" +exec-sh@^0.3.2: + version "0.3.2" + resolved "https://registry.yarnpkg.com/exec-sh/-/exec-sh-0.3.2.tgz#6738de2eb7c8e671d0366aea0b0db8c6f7d7391b" + integrity sha512-9sLAvzhI5nc8TpuQUh4ahMdCrWT00wPWz7j47/emR5+2qEfoZP5zzUXvx+vdx+H6ohhnsYC31iX04QLYJK8zTg== + execa@^0.7.0: version "0.7.0" resolved "https://registry.yarnpkg.com/execa/-/execa-0.7.0.tgz#944becd34cc41ee32a63a9faf27ad5a65fc59777" @@ -650,9 +1346,23 @@ execa@^0.7.0: signal-exit "^3.0.0" strip-eof "^1.0.0" -exit@0.1.2, exit@0.1.x: +execa@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/execa/-/execa-1.0.0.tgz#c6236a5bb4df6d6f15e88e7f017798216749ddd8" + integrity sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA== + dependencies: + cross-spawn "^6.0.0" + get-stream "^4.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@0.1.2, exit@0.1.x, exit@^0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/exit/-/exit-0.1.2.tgz#0632638f8d877cc82107d30a0fff1a17cba1cd0c" + integrity sha1-BjJjj42HfMghB9MKD/8aF8uhzQw= expand-brackets@^0.1.4: version "0.1.5" @@ -678,6 +1388,18 @@ expand-range@^1.8.1: dependencies: fill-range "^2.1.0" +expect@^24.8.0: + version "24.8.0" + resolved "https://registry.yarnpkg.com/expect/-/expect-24.8.0.tgz#471f8ec256b7b6129ca2524b2a62f030df38718d" + integrity sha512-/zYvP8iMDrzaaxHVa724eJBCKqSHmO0FA7EDkBiRHxg6OipmMn1fN+C8T9L9K8yr7UONkOifu6+LLH+z76CnaA== + dependencies: + "@jest/types" "^24.8.0" + ansi-styles "^3.2.0" + jest-get-type "^24.8.0" + jest-matcher-utils "^24.8.0" + jest-message-util "^24.8.0" + jest-regex-util "^24.3.0" + extend-shallow@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/extend-shallow/-/extend-shallow-2.0.1.tgz#51af7d614ad9a9f610ea1bafbb989d6b1c56890f" @@ -695,6 +1417,11 @@ extend@~3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.1.tgz#a755ea7bc1adfcc5a31ce7e762dbaadc5e636444" +extend@~3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.2.tgz#f8b1136b4071fbd8eb140aff858b1019ec2915fa" + integrity sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g== + extglob@^0.3.1: version "0.3.2" resolved "https://registry.yarnpkg.com/extglob/-/extglob-0.3.2.tgz#2e18ff3d2f49ab2765cec9023f011daa8d8349a1" @@ -726,10 +1453,27 @@ fast-deep-equal@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz#c053477817c86b51daa853c81e059b733d023614" +fast-deep-equal@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz#7b05218ddf9667bf7f370bf7fdb2cb15fdd0aa49" + integrity sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk= + fast-json-stable-stringify@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz#d5142c0caee6b1189f87d3a76111064f86c8bbf2" +fast-levenshtein@~2.0.4: + version "2.0.6" + resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" + integrity sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc= + +fb-watchman@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/fb-watchman/-/fb-watchman-2.0.0.tgz#54e9abf7dfa2f26cd9b1636c588c1afc05de5d58" + integrity sha1-VOmr99+i8mzZsWNsWIwa/AXeXVg= + dependencies: + bser "^2.0.0" + filename-regex@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/filename-regex/-/filename-regex-2.0.1.tgz#c1c4b9bee3e09725ddb106b75c1e301fe2f18b26" @@ -774,6 +1518,13 @@ find-up@^2.0.0, find-up@^2.1.0: dependencies: locate-path "^2.0.0" +find-up@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-3.0.0.tgz#49169f1d7993430646da61ecc5ae355c21c97b73" + integrity sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg== + dependencies: + locate-path "^3.0.0" + for-in@^1.0.1, for-in@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/for-in/-/for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80" @@ -803,28 +1554,74 @@ form-data@~2.3.1: combined-stream "1.0.6" mime-types "^2.1.12" +form-data@~2.3.2: + version "2.3.3" + resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.3.3.tgz#dcce52c05f644f298c6a7ab936bd724ceffbf3a6" + integrity sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ== + dependencies: + asynckit "^0.4.0" + combined-stream "^1.0.6" + mime-types "^2.1.12" + fragment-cache@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/fragment-cache/-/fragment-cache-0.2.1.tgz#4290fad27f13e89be7f33799c6bc5a0abfff0d19" dependencies: map-cache "^0.2.2" +fs-minipass@^1.2.5: + version "1.2.6" + resolved "https://registry.yarnpkg.com/fs-minipass/-/fs-minipass-1.2.6.tgz#2c5cc30ded81282bfe8a0d7c7c1853ddeb102c07" + integrity sha512-crhvyXcMejjv3Z5d2Fa9sf5xLYVCF5O1c71QxbVnbLsmYMBEvDAftewesN/HhY03YRoA7zOMxjNGrF5svGaaeQ== + dependencies: + minipass "^2.2.1" + fs.realpath@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" +fsevents@^1.2.7: + version "1.2.9" + resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-1.2.9.tgz#3f5ed66583ccd6f400b5a00db6f7e861363e388f" + integrity sha512-oeyj2H3EjjonWcFjD5NvZNE9Rqe4UW+nQBU2HNeKw0koVLEFIhtyETyAakeAM3de7Z/SW5kcA+fZUait9EApnw== + dependencies: + nan "^2.12.1" + node-pre-gyp "^0.12.0" + +function-bind@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" + integrity sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A== + +gauge@~2.7.3: + version "2.7.4" + resolved "https://registry.yarnpkg.com/gauge/-/gauge-2.7.4.tgz#2c03405c7538c39d7eb37b317022e325fb018bf7" + integrity sha1-LANAXHU4w51+s3sxcCLjJfsBi/c= + dependencies: + aproba "^1.0.3" + console-control-strings "^1.0.0" + has-unicode "^2.0.0" + object-assign "^4.1.0" + signal-exit "^3.0.0" + string-width "^1.0.1" + strip-ansi "^3.0.1" + wide-align "^1.1.0" + 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" -get-func-name@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/get-func-name/-/get-func-name-2.0.0.tgz#ead774abee72e20409433a066366023dd6887a41" - get-stream@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-3.0.0.tgz#8e943d1358dc37555054ecbe2edb05aa174ede14" +get-stream@^4.0.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-4.1.0.tgz#c1b255575f3dc21d59bfc79cd3d2b46b1c3a54b5" + integrity sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w== + dependencies: + pump "^3.0.0" + get-value@^2.0.3, get-value@^2.0.6: version "2.0.6" resolved "https://registry.yarnpkg.com/get-value/-/get-value-2.0.6.tgz#dc15ca1c672387ca76bd37ac0a395ba2042a2c28" @@ -848,7 +1645,7 @@ glob-parent@^2.0.0: dependencies: is-glob "^2.0.0" -glob@7.1.2, glob@^7.0.5, glob@^7.0.6, glob@^7.1.1: +glob@^7.0.5, glob@^7.0.6, glob@^7.1.1: version "7.1.2" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.2.tgz#c19c9df9a028702d678612384a6552404c636d15" dependencies: @@ -859,6 +1656,23 @@ glob@7.1.2, glob@^7.0.5, glob@^7.0.6, glob@^7.1.1: once "^1.3.0" path-is-absolute "^1.0.0" +glob@^7.1.2, glob@^7.1.3: + version "7.1.4" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.4.tgz#aa608a2f6c577ad357e1ae5a5c26d9a8d1969255" + integrity sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A== + 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@^11.1.0: + version "11.12.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-11.12.0.tgz#ab8795338868a0babd8525758018c2a7eb95c42e" + integrity sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA== + globals@^9.18.0: version "9.18.0" resolved "https://registry.yarnpkg.com/globals/-/globals-9.18.0.tgz#aa3896b3e69b487f17e31ed2143d69a8e30c2d8a" @@ -867,9 +1681,15 @@ graceful-fs@^4.1.11, graceful-fs@^4.1.2: version "4.1.11" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.11.tgz#0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658" -growl@1.10.3: - version "1.10.3" - resolved "https://registry.yarnpkg.com/growl/-/growl-1.10.3.tgz#1926ba90cf3edfe2adb4927f5880bc22c66c790f" +graceful-fs@^4.1.15: + version "4.1.15" + resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.15.tgz#ffb703e1066e8a0eeaa4c8b80ba9253eeefbfb00" + integrity sha512-6uHUhOPEBgQ24HM+r6b/QwWfZq+yiFcipKFrOFiBEnWdy5sdzYoi+pJeQaPI5qOLRFqWmAXUPQNsielzdLoecA== + +growly@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/growly/-/growly-1.3.0.tgz#f10748cbe76af964b7c96c93c6bcc28af120c081" + integrity sha1-8QdIy+dq+WS3yWyTxrzCivEgwIE= handlebars@^4.0.3: version "4.0.11" @@ -881,6 +1701,17 @@ handlebars@^4.0.3: optionalDependencies: uglify-js "^2.6" +handlebars@^4.1.2: + version "4.1.2" + resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.1.2.tgz#b6b37c1ced0306b221e094fc7aca3ec23b131b67" + integrity sha512-nvfrjqvt9xQ8Z/w0ijewdD/vvWDTOweBUm96NTr66Wfvo1mJenBLwcYmPs3TIBP5ruzYGD7Hx/DaM9RmhroGPw== + dependencies: + neo-async "^2.6.0" + optimist "^0.6.1" + source-map "^0.6.1" + optionalDependencies: + uglify-js "^3.1.4" + har-schema@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/har-schema/-/har-schema-2.0.0.tgz#a94c2224ebcac04782a0d9035521f24735b7ec92" @@ -892,6 +1723,14 @@ har-validator@~5.0.3: ajv "^5.1.0" har-schema "^2.0.0" +har-validator@~5.1.0: + version "5.1.3" + resolved "https://registry.yarnpkg.com/har-validator/-/har-validator-5.1.3.tgz#1ef89ebd3e4996557675eed9893110dc350fa080" + integrity sha512-sNvOCzEQNr/qrvJgc3UG/kD4QtlHycrzwS+6mfTrrSq97BvaYcPZZI1ZSqGSPR73Cxn4LKTD4PttRwfU7jWq5g== + dependencies: + ajv "^6.5.5" + har-schema "^2.0.0" + has-ansi@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/has-ansi/-/has-ansi-2.0.0.tgz#34f5049ce1ecdf2b0649af3ef24e45ed35416d91" @@ -902,9 +1741,20 @@ has-flag@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-1.0.0.tgz#9d9e793165ce017a00f00418c43f942a7b1d11fa" -has-flag@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-2.0.0.tgz#e8207af1cc7b30d446cc70b734b5e8be18f88d51" +has-flag@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" + integrity sha1-tdRU3CGZriJWmfNGfloH87lVuv0= + +has-symbols@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.0.tgz#ba1a8f1af2a0fc39650f5c850367704122063b44" + integrity sha1-uhqPGvKg/DllD1yFA2dwQSIGO0Q= + +has-unicode@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/has-unicode/-/has-unicode-2.0.1.tgz#e0e6fe6a28cf51138855e086d1691e771de2a8b9" + integrity sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk= has-value@^0.3.1: version "0.3.1" @@ -933,6 +1783,13 @@ has-values@^1.0.0: is-number "^3.0.0" kind-of "^4.0.0" +has@^1.0.1, has@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/has/-/has-1.0.3.tgz#722d7cbfc1f6aa8241f16dd814e011e1f41e8796" + integrity sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw== + dependencies: + function-bind "^1.1.1" + hawk@~6.0.2: version "6.0.2" resolved "https://registry.yarnpkg.com/hawk/-/hawk-6.0.2.tgz#af4d914eb065f9b5ce4d9d11c1cb2126eecc3038" @@ -942,10 +1799,6 @@ hawk@~6.0.2: hoek "4.x.x" sntp "2.x.x" -he@1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/he/-/he-1.1.1.tgz#93410fd21b009735151f8868c2f271f3427e23fd" - hoek@4.x.x: version "4.2.1" resolved "https://registry.yarnpkg.com/hoek/-/hoek-4.2.1.tgz#9634502aa12c445dd5a7c5734b572bb8738aacbb" @@ -954,6 +1807,13 @@ hosted-git-info@^2.1.4: version "2.6.0" resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.6.0.tgz#23235b29ab230c576aab0d4f13fc046b0b038222" +html-encoding-sniffer@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/html-encoding-sniffer/-/html-encoding-sniffer-1.0.2.tgz#e70d84b94da53aa375e11fe3a351be6642ca46f8" + integrity sha512-71lZziiDnsuabfdYiUeWdCVyKuqwWi23L8YeIgV9jSSZHCtb6wB1BKWooH7L3tn4/FuZJMVWyNaIDr4RGmaSYw== + dependencies: + whatwg-encoding "^1.0.1" + htmlparser2@3.8.x: version "3.8.3" resolved "https://registry.yarnpkg.com/htmlparser2/-/htmlparser2-3.8.3.tgz#996c28b191516a8be86501a7d79757e5c70c1068" @@ -972,6 +1832,28 @@ http-signature@~1.2.0: jsprim "^1.2.2" sshpk "^1.7.0" +iconv-lite@0.4.24, iconv-lite@^0.4.4: + version "0.4.24" + resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" + integrity sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA== + dependencies: + safer-buffer ">= 2.1.2 < 3" + +ignore-walk@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/ignore-walk/-/ignore-walk-3.0.1.tgz#a83e62e7d272ac0e3b551aaa82831a19b69f82f8" + integrity sha512-DTVlMx3IYPe0/JJcYP7Gxg7ttZZu3IInhuEhbchuqneY9wWe5Ojy2mXLBaQFUQmo0AW2r3qG7m1mg86js+gnlQ== + dependencies: + minimatch "^3.0.4" + +import-local@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/import-local/-/import-local-2.0.0.tgz#55070be38a5993cf18ef6db7e961f5bee5c5a09d" + integrity sha512-b6s04m3O+s3CGSbqDIyP4R6aAwAeYlVq9+WUWep6iHa8ETRf9yei1U48C5MmfJmV9AiLYYBKPMq/W+/WRpQmCQ== + dependencies: + pkg-dir "^3.0.0" + resolve-cwd "^2.0.0" + imurmurhash@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" @@ -983,20 +1865,37 @@ inflight@^1.0.4: once "^1.3.0" wrappy "1" -inherits@2, inherits@~2.0.1: +inherits@2, inherits@~2.0.1, inherits@~2.0.3: version "2.0.3" resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" +ini@~1.3.0: + version "1.3.5" + resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.5.tgz#eee25f56db1c9ec6085e0c22778083f596abf927" + integrity sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw== + invariant@^2.2.2: version "2.2.3" resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.3.tgz#1a827dfde7dcbd7c323f0ca826be8fa7c5e9d688" dependencies: loose-envify "^1.0.0" +invariant@^2.2.4: + version "2.2.4" + resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.4.tgz#610f3c92c9359ce1db616e538008d23ff35158e6" + integrity sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA== + dependencies: + loose-envify "^1.0.0" + invert-kv@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/invert-kv/-/invert-kv-1.0.0.tgz#104a8e4aaca6d3d8cd157a8ef8bfab2d7a3ffdb6" +invert-kv@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/invert-kv/-/invert-kv-2.0.0.tgz#7393f5afa59ec9ff5f67a27620d11c226e3eec02" + integrity sha512-wPVv/y/QQ/Uiirj/vh3oP+1Ww+AWehmi1g5fFWGPF6IpCBCDVrhgHRMvrLfdYcwDh3QJbGXDW4JAuzxElLSqKA== + is-accessor-descriptor@^0.1.6: version "0.1.6" resolved "https://registry.yarnpkg.com/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz#a9e12cb3ae8d876727eeef3843f8a0897b5c98d6" @@ -1023,6 +1922,18 @@ is-builtin-module@^1.0.0: dependencies: builtin-modules "^1.0.0" +is-callable@^1.1.4: + version "1.1.4" + resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.1.4.tgz#1e1adf219e1eeb684d691f9d6a05ff0d30a24d75" + integrity sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA== + +is-ci@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/is-ci/-/is-ci-2.0.0.tgz#6bc6334181810e04b5c22b3d589fdca55026404c" + integrity sha512-YfJT7rkpQB0updsdHLGWrvhBJfcfzNNawYDNIyQXJz0IViGf75O8EBPKSdvw2rF+LGCsX4FZ8tcr3b19LcZq4w== + dependencies: + ci-info "^2.0.0" + is-data-descriptor@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz#0b5ee648388e2c860282e793f1856fec3f301b56" @@ -1035,6 +1946,11 @@ is-data-descriptor@^1.0.0: dependencies: kind-of "^6.0.0" +is-date-object@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/is-date-object/-/is-date-object-1.0.1.tgz#9aa20eb6aeebbff77fbd33e74ca01b33581d3a16" + integrity sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY= + is-descriptor@^0.1.0: version "0.1.6" resolved "https://registry.yarnpkg.com/is-descriptor/-/is-descriptor-0.1.6.tgz#366d8240dde487ca51823b1ab9f07a10a78251ca" @@ -1091,6 +2007,11 @@ is-fullwidth-code-point@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f" +is-generator-fn@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/is-generator-fn/-/is-generator-fn-2.1.0.tgz#7d140adc389aaf3011a8f2a2a4cfa6faadffb118" + integrity sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ== + is-glob@^2.0.0, is-glob@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-2.0.1.tgz#d096f926a3ded5600f3fdfd91198cb0888c2d863" @@ -1133,10 +2054,24 @@ is-primitive@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/is-primitive/-/is-primitive-2.0.0.tgz#207bab91638499c07b2adf240a41a87210034575" +is-regex@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.0.4.tgz#5517489b547091b0930e095654ced25ee97e9491" + integrity sha1-VRdIm1RwkbCTDglWVM7SXul+lJE= + dependencies: + has "^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-symbol@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/is-symbol/-/is-symbol-1.0.2.tgz#a055f6ae57192caee329e7a860118b497a950f38" + integrity sha512-HS8bZ9ox60yCJLH9snBpIwv9pYUAkcuLhSA1oero1UB5y9aiQpRA8y2ex945AOtCZL1lJDeIk3G5LthswI46Lw== + dependencies: + has-symbols "^1.0.0" + is-typedarray@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a" @@ -1149,6 +2084,11 @@ is-windows@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/is-windows/-/is-windows-1.0.2.tgz#d1850eb9791ecd18e6182ce12a30f396634bb19d" +is-wsl@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/is-wsl/-/is-wsl-1.1.0.tgz#1f16e4aa22b04d1336b66188a66af3c600c3a66d" + integrity sha1-HxbkqiKwTRM2tmGIpmrzxgDDpm0= + isarray@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/isarray/-/isarray-0.0.1.tgz#8a18acfca9a8f4177e09abfc6038939b05d1eedf" @@ -1179,6 +2119,11 @@ istanbul-lib-coverage@^1.1.2, istanbul-lib-coverage@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/istanbul-lib-coverage/-/istanbul-lib-coverage-1.2.0.tgz#f7d8f2e42b97e37fe796114cb0f9d68b5e3a4341" +istanbul-lib-coverage@^2.0.2, istanbul-lib-coverage@^2.0.5: + version "2.0.5" + resolved "https://registry.yarnpkg.com/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.5.tgz#675f0ab69503fad4b1d849f736baaca803344f49" + integrity sha512-8aXznuEPCJvGnMSRft4udDRDtb1V3pkQkMMI5LI+6HuQz5oQ4J2UFn1H82raA3qJtyOLkkwVqICBQkjnGtn5mA== + istanbul-lib-hook@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/istanbul-lib-hook/-/istanbul-lib-hook-1.1.0.tgz#8538d970372cb3716d53e55523dd54b557a8d89b" @@ -1197,6 +2142,19 @@ istanbul-lib-instrument@^1.10.0: istanbul-lib-coverage "^1.2.0" semver "^5.3.0" +istanbul-lib-instrument@^3.0.1, istanbul-lib-instrument@^3.3.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/istanbul-lib-instrument/-/istanbul-lib-instrument-3.3.0.tgz#a5f63d91f0bbc0c3e479ef4c5de027335ec6d630" + integrity sha512-5nnIN4vo5xQZHdXno/YDXJ0G+I3dAm4XgzfSVTPLQpj/zAV2dV6Juy0yaf10/zrJOJeHoN3fraFe+XRq2bFVZA== + dependencies: + "@babel/generator" "^7.4.0" + "@babel/parser" "^7.4.3" + "@babel/template" "^7.4.0" + "@babel/traverse" "^7.4.3" + "@babel/types" "^7.4.0" + istanbul-lib-coverage "^2.0.5" + semver "^6.0.0" + istanbul-lib-report@^1.1.3: version "1.1.3" resolved "https://registry.yarnpkg.com/istanbul-lib-report/-/istanbul-lib-report-1.1.3.tgz#2df12188c0fa77990c0d2176d2d0ba3394188259" @@ -1206,6 +2164,15 @@ istanbul-lib-report@^1.1.3: path-parse "^1.0.5" supports-color "^3.1.2" +istanbul-lib-report@^2.0.4: + version "2.0.8" + resolved "https://registry.yarnpkg.com/istanbul-lib-report/-/istanbul-lib-report-2.0.8.tgz#5a8113cd746d43c4889eba36ab10e7d50c9b4f33" + integrity sha512-fHBeG573EIihhAblwgxrSenp0Dby6tJMFR/HvlerBsrCTD5bkUuoNtn3gVh29ZCS824cGGBPn7Sg7cNk+2xUsQ== + dependencies: + istanbul-lib-coverage "^2.0.5" + make-dir "^2.1.0" + supports-color "^6.1.0" + istanbul-lib-source-maps@^1.2.3: version "1.2.3" resolved "https://registry.yarnpkg.com/istanbul-lib-source-maps/-/istanbul-lib-source-maps-1.2.3.tgz#20fb54b14e14b3fb6edb6aca3571fd2143db44e6" @@ -1216,16 +2183,391 @@ istanbul-lib-source-maps@^1.2.3: rimraf "^2.6.1" source-map "^0.5.3" +istanbul-lib-source-maps@^3.0.1: + version "3.0.6" + resolved "https://registry.yarnpkg.com/istanbul-lib-source-maps/-/istanbul-lib-source-maps-3.0.6.tgz#284997c48211752ec486253da97e3879defba8c8" + integrity sha512-R47KzMtDJH6X4/YW9XTx+jrLnZnscW4VpNN+1PViSYTejLVPWv7oov+Duf8YQSPyVRUvueQqz1TcsC6mooZTXw== + dependencies: + debug "^4.1.1" + istanbul-lib-coverage "^2.0.5" + make-dir "^2.1.0" + rimraf "^2.6.3" + source-map "^0.6.1" + istanbul-reports@^1.1.4: version "1.3.0" resolved "https://registry.yarnpkg.com/istanbul-reports/-/istanbul-reports-1.3.0.tgz#2f322e81e1d9520767597dca3c20a0cce89a3554" dependencies: handlebars "^4.0.3" +istanbul-reports@^2.1.1: + version "2.2.6" + resolved "https://registry.yarnpkg.com/istanbul-reports/-/istanbul-reports-2.2.6.tgz#7b4f2660d82b29303a8fe6091f8ca4bf058da1af" + integrity sha512-SKi4rnMyLBKe0Jy2uUdx28h8oG7ph2PPuQPvIAh31d+Ci+lSiEu4C+h3oBPuJ9+mPKhOyW0M8gY4U5NM1WLeXA== + dependencies: + handlebars "^4.1.2" + +jest-changed-files@^24.8.0: + version "24.8.0" + resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-24.8.0.tgz#7e7eb21cf687587a85e50f3d249d1327e15b157b" + integrity sha512-qgANC1Yrivsq+UrLXsvJefBKVoCsKB0Hv+mBb6NMjjZ90wwxCDmU3hsCXBya30cH+LnPYjwgcU65i6yJ5Nfuug== + dependencies: + "@jest/types" "^24.8.0" + execa "^1.0.0" + throat "^4.0.0" + +jest-cli@^24.8.0: + version "24.8.0" + resolved "https://registry.yarnpkg.com/jest-cli/-/jest-cli-24.8.0.tgz#b075ac914492ed114fa338ade7362a301693e989" + integrity sha512-+p6J00jSMPQ116ZLlHJJvdf8wbjNbZdeSX9ptfHX06/MSNaXmKihQzx5vQcw0q2G6JsdVkUIdWbOWtSnaYs3yA== + dependencies: + "@jest/core" "^24.8.0" + "@jest/test-result" "^24.8.0" + "@jest/types" "^24.8.0" + chalk "^2.0.1" + exit "^0.1.2" + import-local "^2.0.0" + is-ci "^2.0.0" + jest-config "^24.8.0" + jest-util "^24.8.0" + jest-validate "^24.8.0" + prompts "^2.0.1" + realpath-native "^1.1.0" + yargs "^12.0.2" + +jest-config@^24.8.0: + version "24.8.0" + resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-24.8.0.tgz#77db3d265a6f726294687cbbccc36f8a76ee0f4f" + integrity sha512-Czl3Nn2uEzVGsOeaewGWoDPD8GStxCpAe0zOYs2x2l0fZAgPbCr3uwUkgNKV3LwE13VXythM946cd5rdGkkBZw== + dependencies: + "@babel/core" "^7.1.0" + "@jest/test-sequencer" "^24.8.0" + "@jest/types" "^24.8.0" + babel-jest "^24.8.0" + chalk "^2.0.1" + glob "^7.1.1" + jest-environment-jsdom "^24.8.0" + jest-environment-node "^24.8.0" + jest-get-type "^24.8.0" + jest-jasmine2 "^24.8.0" + jest-regex-util "^24.3.0" + jest-resolve "^24.8.0" + jest-util "^24.8.0" + jest-validate "^24.8.0" + micromatch "^3.1.10" + pretty-format "^24.8.0" + realpath-native "^1.1.0" + +jest-diff@^24.8.0: + version "24.8.0" + resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-24.8.0.tgz#146435e7d1e3ffdf293d53ff97e193f1d1546172" + integrity sha512-wxetCEl49zUpJ/bvUmIFjd/o52J+yWcoc5ZyPq4/W1LUKGEhRYDIbP1KcF6t+PvqNrGAFk4/JhtxDq/Nnzs66g== + dependencies: + chalk "^2.0.1" + diff-sequences "^24.3.0" + jest-get-type "^24.8.0" + pretty-format "^24.8.0" + +jest-docblock@^24.3.0: + version "24.3.0" + resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-24.3.0.tgz#b9c32dac70f72e4464520d2ba4aec02ab14db5dd" + integrity sha512-nlANmF9Yq1dufhFlKG9rasfQlrY7wINJbo3q01tu56Jv5eBU5jirylhF2O5ZBnLxzOVBGRDz/9NAwNyBtG4Nyg== + dependencies: + detect-newline "^2.1.0" + +jest-each@^24.8.0: + version "24.8.0" + resolved "https://registry.yarnpkg.com/jest-each/-/jest-each-24.8.0.tgz#a05fd2bf94ddc0b1da66c6d13ec2457f35e52775" + integrity sha512-NrwK9gaL5+XgrgoCsd9svsoWdVkK4gnvyhcpzd6m487tXHqIdYeykgq3MKI1u4I+5Zf0tofr70at9dWJDeb+BA== + dependencies: + "@jest/types" "^24.8.0" + chalk "^2.0.1" + jest-get-type "^24.8.0" + jest-util "^24.8.0" + pretty-format "^24.8.0" + +jest-environment-jsdom@^24.8.0: + version "24.8.0" + resolved "https://registry.yarnpkg.com/jest-environment-jsdom/-/jest-environment-jsdom-24.8.0.tgz#300f6949a146cabe1c9357ad9e9ecf9f43f38857" + integrity sha512-qbvgLmR7PpwjoFjM/sbuqHJt/NCkviuq9vus9NBn/76hhSidO+Z6Bn9tU8friecegbJL8gzZQEMZBQlFWDCwAQ== + dependencies: + "@jest/environment" "^24.8.0" + "@jest/fake-timers" "^24.8.0" + "@jest/types" "^24.8.0" + jest-mock "^24.8.0" + jest-util "^24.8.0" + jsdom "^11.5.1" + +jest-environment-node@^24.8.0: + version "24.8.0" + resolved "https://registry.yarnpkg.com/jest-environment-node/-/jest-environment-node-24.8.0.tgz#d3f726ba8bc53087a60e7a84ca08883a4c892231" + integrity sha512-vIGUEScd1cdDgR6sqn2M08sJTRLQp6Dk/eIkCeO4PFHxZMOgy+uYLPMC4ix3PEfM5Au/x3uQ/5Tl0DpXXZsJ/Q== + dependencies: + "@jest/environment" "^24.8.0" + "@jest/fake-timers" "^24.8.0" + "@jest/types" "^24.8.0" + jest-mock "^24.8.0" + jest-util "^24.8.0" + +jest-get-type@^24.8.0: + version "24.8.0" + resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-24.8.0.tgz#a7440de30b651f5a70ea3ed7ff073a32dfe646fc" + integrity sha512-RR4fo8jEmMD9zSz2nLbs2j0zvPpk/KCEz3a62jJWbd2ayNo0cb+KFRxPHVhE4ZmgGJEQp0fosmNz84IfqM8cMQ== + +jest-haste-map@^24.8.0: + version "24.8.0" + resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-24.8.0.tgz#51794182d877b3ddfd6e6d23920e3fe72f305800" + integrity sha512-ZBPRGHdPt1rHajWelXdqygIDpJx8u3xOoLyUBWRW28r3tagrgoepPrzAozW7kW9HrQfhvmiv1tncsxqHJO1onQ== + dependencies: + "@jest/types" "^24.8.0" + anymatch "^2.0.0" + fb-watchman "^2.0.0" + graceful-fs "^4.1.15" + invariant "^2.2.4" + jest-serializer "^24.4.0" + jest-util "^24.8.0" + jest-worker "^24.6.0" + micromatch "^3.1.10" + sane "^4.0.3" + walker "^1.0.7" + optionalDependencies: + fsevents "^1.2.7" + +jest-jasmine2@^24.8.0: + version "24.8.0" + resolved "https://registry.yarnpkg.com/jest-jasmine2/-/jest-jasmine2-24.8.0.tgz#a9c7e14c83dd77d8b15e820549ce8987cc8cd898" + integrity sha512-cEky88npEE5LKd5jPpTdDCLvKkdyklnaRycBXL6GNmpxe41F0WN44+i7lpQKa/hcbXaQ+rc9RMaM4dsebrYong== + dependencies: + "@babel/traverse" "^7.1.0" + "@jest/environment" "^24.8.0" + "@jest/test-result" "^24.8.0" + "@jest/types" "^24.8.0" + chalk "^2.0.1" + co "^4.6.0" + expect "^24.8.0" + is-generator-fn "^2.0.0" + jest-each "^24.8.0" + jest-matcher-utils "^24.8.0" + jest-message-util "^24.8.0" + jest-runtime "^24.8.0" + jest-snapshot "^24.8.0" + jest-util "^24.8.0" + pretty-format "^24.8.0" + throat "^4.0.0" + +jest-leak-detector@^24.8.0: + version "24.8.0" + resolved "https://registry.yarnpkg.com/jest-leak-detector/-/jest-leak-detector-24.8.0.tgz#c0086384e1f650c2d8348095df769f29b48e6980" + integrity sha512-cG0yRSK8A831LN8lIHxI3AblB40uhv0z+SsQdW3GoMMVcK+sJwrIIyax5tu3eHHNJ8Fu6IMDpnLda2jhn2pD/g== + dependencies: + pretty-format "^24.8.0" + +jest-matcher-utils@^24.8.0: + version "24.8.0" + resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-24.8.0.tgz#2bce42204c9af12bde46f83dc839efe8be832495" + integrity sha512-lex1yASY51FvUuHgm0GOVj7DCYEouWSlIYmCW7APSqB9v8mXmKSn5+sWVF0MhuASG0bnYY106/49JU1FZNl5hw== + dependencies: + chalk "^2.0.1" + jest-diff "^24.8.0" + jest-get-type "^24.8.0" + pretty-format "^24.8.0" + +jest-message-util@^24.8.0: + version "24.8.0" + resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-24.8.0.tgz#0d6891e72a4beacc0292b638685df42e28d6218b" + integrity sha512-p2k71rf/b6ns8btdB0uVdljWo9h0ovpnEe05ZKWceQGfXYr4KkzgKo3PBi8wdnd9OtNh46VpNIJynUn/3MKm1g== + dependencies: + "@babel/code-frame" "^7.0.0" + "@jest/test-result" "^24.8.0" + "@jest/types" "^24.8.0" + "@types/stack-utils" "^1.0.1" + chalk "^2.0.1" + micromatch "^3.1.10" + slash "^2.0.0" + stack-utils "^1.0.1" + +jest-mock@^24.8.0: + version "24.8.0" + resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-24.8.0.tgz#2f9d14d37699e863f1febf4e4d5a33b7fdbbde56" + integrity sha512-6kWugwjGjJw+ZkK4mDa0Df3sDlUTsV47MSrT0nGQ0RBWJbpODDQ8MHDVtGtUYBne3IwZUhtB7elxHspU79WH3A== + dependencies: + "@jest/types" "^24.8.0" + +jest-pnp-resolver@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/jest-pnp-resolver/-/jest-pnp-resolver-1.2.1.tgz#ecdae604c077a7fbc70defb6d517c3c1c898923a" + integrity sha512-pgFw2tm54fzgYvc/OHrnysABEObZCUNFnhjoRjaVOCN8NYc032/gVjPaHD4Aq6ApkSieWtfKAFQtmDKAmhupnQ== + +jest-regex-util@^24.3.0: + version "24.3.0" + resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-24.3.0.tgz#d5a65f60be1ae3e310d5214a0307581995227b36" + integrity sha512-tXQR1NEOyGlfylyEjg1ImtScwMq8Oh3iJbGTjN7p0J23EuVX1MA8rwU69K4sLbCmwzgCUbVkm0FkSF9TdzOhtg== + +jest-resolve-dependencies@^24.8.0: + version "24.8.0" + resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-24.8.0.tgz#19eec3241f2045d3f990dba331d0d7526acff8e0" + integrity sha512-hyK1qfIf/krV+fSNyhyJeq3elVMhK9Eijlwy+j5jqmZ9QsxwKBiP6qukQxaHtK8k6zql/KYWwCTQ+fDGTIJauw== + dependencies: + "@jest/types" "^24.8.0" + jest-regex-util "^24.3.0" + jest-snapshot "^24.8.0" + +jest-resolve@^24.8.0: + version "24.8.0" + resolved "https://registry.yarnpkg.com/jest-resolve/-/jest-resolve-24.8.0.tgz#84b8e5408c1f6a11539793e2b5feb1b6e722439f" + integrity sha512-+hjSzi1PoRvnuOICoYd5V/KpIQmkAsfjFO71458hQ2Whi/yf1GDeBOFj8Gxw4LrApHsVJvn5fmjcPdmoUHaVKw== + dependencies: + "@jest/types" "^24.8.0" + browser-resolve "^1.11.3" + chalk "^2.0.1" + jest-pnp-resolver "^1.2.1" + realpath-native "^1.1.0" + +jest-runner@^24.8.0: + version "24.8.0" + resolved "https://registry.yarnpkg.com/jest-runner/-/jest-runner-24.8.0.tgz#4f9ae07b767db27b740d7deffad0cf67ccb4c5bb" + integrity sha512-utFqC5BaA3JmznbissSs95X1ZF+d+4WuOWwpM9+Ak356YtMhHE/GXUondZdcyAAOTBEsRGAgH/0TwLzfI9h7ow== + dependencies: + "@jest/console" "^24.7.1" + "@jest/environment" "^24.8.0" + "@jest/test-result" "^24.8.0" + "@jest/types" "^24.8.0" + chalk "^2.4.2" + exit "^0.1.2" + graceful-fs "^4.1.15" + jest-config "^24.8.0" + jest-docblock "^24.3.0" + jest-haste-map "^24.8.0" + jest-jasmine2 "^24.8.0" + jest-leak-detector "^24.8.0" + jest-message-util "^24.8.0" + jest-resolve "^24.8.0" + jest-runtime "^24.8.0" + jest-util "^24.8.0" + jest-worker "^24.6.0" + source-map-support "^0.5.6" + throat "^4.0.0" + +jest-runtime@^24.8.0: + version "24.8.0" + resolved "https://registry.yarnpkg.com/jest-runtime/-/jest-runtime-24.8.0.tgz#05f94d5b05c21f6dc54e427cd2e4980923350620" + integrity sha512-Mq0aIXhvO/3bX44ccT+czU1/57IgOMyy80oM0XR/nyD5zgBcesF84BPabZi39pJVA6UXw+fY2Q1N+4BiVUBWOA== + dependencies: + "@jest/console" "^24.7.1" + "@jest/environment" "^24.8.0" + "@jest/source-map" "^24.3.0" + "@jest/transform" "^24.8.0" + "@jest/types" "^24.8.0" + "@types/yargs" "^12.0.2" + chalk "^2.0.1" + exit "^0.1.2" + glob "^7.1.3" + graceful-fs "^4.1.15" + jest-config "^24.8.0" + jest-haste-map "^24.8.0" + jest-message-util "^24.8.0" + jest-mock "^24.8.0" + jest-regex-util "^24.3.0" + jest-resolve "^24.8.0" + jest-snapshot "^24.8.0" + jest-util "^24.8.0" + jest-validate "^24.8.0" + realpath-native "^1.1.0" + slash "^2.0.0" + strip-bom "^3.0.0" + yargs "^12.0.2" + +jest-serializer@^24.4.0: + version "24.4.0" + resolved "https://registry.yarnpkg.com/jest-serializer/-/jest-serializer-24.4.0.tgz#f70c5918c8ea9235ccb1276d232e459080588db3" + integrity sha512-k//0DtglVstc1fv+GY/VHDIjrtNjdYvYjMlbLUed4kxrE92sIUewOi5Hj3vrpB8CXfkJntRPDRjCrCvUhBdL8Q== + +jest-snapshot@^24.8.0: + version "24.8.0" + resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-24.8.0.tgz#3bec6a59da2ff7bc7d097a853fb67f9d415cb7c6" + integrity sha512-5ehtWoc8oU9/cAPe6fez6QofVJLBKyqkY2+TlKTOf0VllBB/mqUNdARdcjlZrs9F1Cv+/HKoCS/BknT0+tmfPg== + dependencies: + "@babel/types" "^7.0.0" + "@jest/types" "^24.8.0" + chalk "^2.0.1" + expect "^24.8.0" + jest-diff "^24.8.0" + jest-matcher-utils "^24.8.0" + jest-message-util "^24.8.0" + jest-resolve "^24.8.0" + mkdirp "^0.5.1" + natural-compare "^1.4.0" + pretty-format "^24.8.0" + semver "^5.5.0" + +jest-util@^24.8.0: + version "24.8.0" + resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-24.8.0.tgz#41f0e945da11df44cc76d64ffb915d0716f46cd1" + integrity sha512-DYZeE+XyAnbNt0BG1OQqKy/4GVLPtzwGx5tsnDrFcax36rVE3lTA5fbvgmbVPUZf9w77AJ8otqR4VBbfFJkUZA== + dependencies: + "@jest/console" "^24.7.1" + "@jest/fake-timers" "^24.8.0" + "@jest/source-map" "^24.3.0" + "@jest/test-result" "^24.8.0" + "@jest/types" "^24.8.0" + callsites "^3.0.0" + chalk "^2.0.1" + graceful-fs "^4.1.15" + is-ci "^2.0.0" + mkdirp "^0.5.1" + slash "^2.0.0" + source-map "^0.6.0" + +jest-validate@^24.8.0: + version "24.8.0" + resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-24.8.0.tgz#624c41533e6dfe356ffadc6e2423a35c2d3b4849" + integrity sha512-+/N7VOEMW1Vzsrk3UWBDYTExTPwf68tavEPKDnJzrC6UlHtUDU/fuEdXqFoHzv9XnQ+zW6X3qMZhJ3YexfeLDA== + dependencies: + "@jest/types" "^24.8.0" + camelcase "^5.0.0" + chalk "^2.0.1" + jest-get-type "^24.8.0" + leven "^2.1.0" + pretty-format "^24.8.0" + +jest-watcher@^24.8.0: + version "24.8.0" + resolved "https://registry.yarnpkg.com/jest-watcher/-/jest-watcher-24.8.0.tgz#58d49915ceddd2de85e238f6213cef1c93715de4" + integrity sha512-SBjwHt5NedQoVu54M5GEx7cl7IGEFFznvd/HNT8ier7cCAx/Qgu9ZMlaTQkvK22G1YOpcWBLQPFSImmxdn3DAw== + dependencies: + "@jest/test-result" "^24.8.0" + "@jest/types" "^24.8.0" + "@types/yargs" "^12.0.9" + ansi-escapes "^3.0.0" + chalk "^2.0.1" + jest-util "^24.8.0" + string-length "^2.0.0" + +jest-worker@^24.6.0: + version "24.6.0" + resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-24.6.0.tgz#7f81ceae34b7cde0c9827a6980c35b7cdc0161b3" + integrity sha512-jDwgW5W9qGNvpI1tNnvajh0a5IE/PuGLFmHk6aR/BZFz8tSgGw17GsDPXAJ6p91IvYDjOw8GpFbvvZGAK+DPQQ== + dependencies: + merge-stream "^1.0.1" + supports-color "^6.1.0" + +jest@^24.8.0: + version "24.8.0" + resolved "https://registry.yarnpkg.com/jest/-/jest-24.8.0.tgz#d5dff1984d0d1002196e9b7f12f75af1b2809081" + integrity sha512-o0HM90RKFRNWmAWvlyV8i5jGZ97pFwkeVoGvPW1EtLTgJc2+jcuqcbbqcSZLE/3f2S5pt0y2ZBETuhpWNl1Reg== + dependencies: + import-local "^2.0.0" + jest-cli "^24.8.0" + js-tokens@^3.0.0, js-tokens@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.2.tgz#9866df395102130e38f7f996bceb65443209c25b" +js-tokens@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" + integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== + js-yaml@^3.6.1, js-yaml@^3.9.0: version "3.11.0" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.11.0.tgz#597c1a8bd57152f26d622ce4117851a51f5ebaef" @@ -1237,10 +2579,47 @@ jsbn@~0.1.0: version "0.1.1" resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513" +jsdom@^11.5.1: + version "11.12.0" + resolved "https://registry.yarnpkg.com/jsdom/-/jsdom-11.12.0.tgz#1a80d40ddd378a1de59656e9e6dc5a3ba8657bc8" + integrity sha512-y8Px43oyiBM13Zc1z780FrfNLJCXTL40EWlty/LXUtcjykRBNgLlCjWXpfSPBl2iv+N7koQN+dvqszHZgT/Fjw== + dependencies: + abab "^2.0.0" + acorn "^5.5.3" + acorn-globals "^4.1.0" + array-equal "^1.0.0" + cssom ">= 0.3.2 < 0.4.0" + cssstyle "^1.0.0" + data-urls "^1.0.0" + domexception "^1.0.1" + escodegen "^1.9.1" + html-encoding-sniffer "^1.0.2" + left-pad "^1.3.0" + nwsapi "^2.0.7" + parse5 "4.0.0" + pn "^1.1.0" + request "^2.87.0" + request-promise-native "^1.0.5" + sax "^1.2.4" + symbol-tree "^3.2.2" + tough-cookie "^2.3.4" + w3c-hr-time "^1.0.1" + webidl-conversions "^4.0.2" + whatwg-encoding "^1.0.3" + whatwg-mimetype "^2.1.0" + whatwg-url "^6.4.1" + ws "^5.2.0" + xml-name-validator "^3.0.0" + jsesc@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-1.3.0.tgz#46c3fec8c1892b12b0833db9bc7622176dbab34b" +jsesc@^2.5.1: + version "2.5.2" + resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-2.5.2.tgz#80564d2e483dacf6e8ef209650a67df3f0c283a4" + integrity sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA== + jshint@^2.9.5: version "2.9.5" resolved "https://registry.yarnpkg.com/jshint/-/jshint-2.9.5.tgz#1e7252915ce681b40827ee14248c46d34e9aa62c" @@ -1254,10 +2633,20 @@ jshint@^2.9.5: shelljs "0.3.x" strip-json-comments "1.0.x" +json-parse-better-errors@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz#bb867cfb3450e69107c131d1c514bab3dc8bcaa9" + integrity sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw== + json-schema-traverse@^0.3.0: version "0.3.1" resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz#349a6d44c53a51de89b40805c5d5e59b417d3340" +json-schema-traverse@^0.4.1: + version "0.4.1" + resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660" + integrity sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg== + json-schema@0.2.3: version "0.2.3" resolved "https://registry.yarnpkg.com/json-schema/-/json-schema-0.2.3.tgz#b480c892e59a2f05954ce727bd3f2a4e882f9e13" @@ -1266,6 +2655,13 @@ json-stringify-safe@~5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" +json5@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/json5/-/json5-2.1.0.tgz#e7a0c62c48285c628d20a10b85c89bb807c32850" + integrity sha512-8Mh9h6xViijj36g7Dxi+Y4S6hNGV96vcJZr/SrlHh1LR/pEn/8j/+qIBbs44YKl69Lrfctp4QD+AdWLTMqEZAQ== + dependencies: + minimist "^1.2.0" + jsprim@^1.2.2: version "1.4.1" resolved "https://registry.yarnpkg.com/jsprim/-/jsprim-1.4.1.tgz#313e66bc1e5cc06e438bc1b7499c2e5c56acb6a2" @@ -1299,6 +2695,11 @@ kind-of@^6.0.0, kind-of@^6.0.2: version "6.0.2" resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-6.0.2.tgz#01146b36a6218e64e58f3a8d66de5d7fc6f6d051" +kleur@^3.0.2: + version "3.0.3" + resolved "https://registry.yarnpkg.com/kleur/-/kleur-3.0.3.tgz#a79c9ecc86ee1ce3fa6206d1216c501f147fc07e" + integrity sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w== + lazy-cache@^1.0.3: version "1.0.4" resolved "https://registry.yarnpkg.com/lazy-cache/-/lazy-cache-1.0.4.tgz#a1d78fc3a50474cb80845d3b3b6e1da49a446e8e" @@ -1309,10 +2710,35 @@ lcid@^1.0.0: dependencies: invert-kv "^1.0.0" +lcid@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/lcid/-/lcid-2.0.0.tgz#6ef5d2df60e52f82eb228a4c373e8d1f397253cf" + integrity sha512-avPEb8P8EGnwXKClwsNUgryVjllcRqtMYa49NTsbQagYuT1DcXnl1915oxWjoyGrXR6zH/Y0Zc96xWsPcoDKeA== + dependencies: + invert-kv "^2.0.0" + lcov-parse@^0.0.10: version "0.0.10" resolved "https://registry.yarnpkg.com/lcov-parse/-/lcov-parse-0.0.10.tgz#1b0b8ff9ac9c7889250582b70b71315d9da6d9a3" +left-pad@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/left-pad/-/left-pad-1.3.0.tgz#5b8a3a7765dfe001261dde915589e782f8c94d1e" + integrity sha512-XI5MPzVNApjAyhQzphX8BkmKsKUxD4LdyK24iZeQGinBN9yTQT3bFlCBy/aVx2HrNcqQGsdot8ghrjyrvMCoEA== + +leven@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/leven/-/leven-2.1.0.tgz#c2e7a9f772094dee9d34202ae8acce4687875580" + integrity sha1-wuep93IJTe6dNCAq6KzORoeHVYA= + +levn@~0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/levn/-/levn-0.3.0.tgz#3b09924edf9f083c0490fdd4c0bc4421e04764ee" + integrity sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4= + dependencies: + prelude-ls "~1.1.2" + type-check "~0.3.2" + load-json-file@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-1.1.0.tgz#956905708d58b4bab4c2261b04f59f31c99374c0" @@ -1332,6 +2758,16 @@ load-json-file@^2.0.0: pify "^2.0.0" strip-bom "^3.0.0" +load-json-file@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-4.0.0.tgz#2f5f45ab91e33216234fd53adab668eb4ec0993b" + integrity sha1-L19Fq5HjMhYjT9U62rZo607AmTs= + dependencies: + graceful-fs "^4.1.2" + parse-json "^4.0.0" + pify "^3.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" @@ -1339,10 +2775,23 @@ locate-path@^2.0.0: p-locate "^2.0.0" path-exists "^3.0.0" +locate-path@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-3.0.0.tgz#dbec3b3ab759758071b58fe59fc41871af21400e" + integrity sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A== + dependencies: + p-locate "^3.0.0" + path-exists "^3.0.0" + lodash.get@4.4.2: version "4.4.2" resolved "https://registry.yarnpkg.com/lodash.get/-/lodash.get-4.4.2.tgz#2d177f652fa31e939b4438d5341499dfa3825e99" +lodash.sortby@^4.7.0: + version "4.7.0" + resolved "https://registry.yarnpkg.com/lodash.sortby/-/lodash.sortby-4.7.0.tgz#edd14c824e2cc9c1e0b0a1b42bb5210516a42438" + integrity sha1-7dFMgk4sycHgsKG0K7UhBRakJDg= + lodash@3.7.x: version "3.7.0" resolved "https://registry.yarnpkg.com/lodash/-/lodash-3.7.0.tgz#3678bd8ab995057c07ade836ed2ef087da811d45" @@ -1351,6 +2800,11 @@ lodash@^4.14.0, lodash@^4.17.4: version "4.17.5" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.5.tgz#99a92d65c0272debe8c96b6057bc8fbfa3bed511" +lodash@^4.17.11: + version "4.17.11" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.11.tgz#b39ea6229ef607ecd89e2c8df12536891cac9b8d" + integrity sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg== + log-driver@^1.2.5: version "1.2.7" resolved "https://registry.yarnpkg.com/log-driver/-/log-driver-1.2.7.tgz#63b95021f0702fedfa2c9bb0a24e7797d71871d8" @@ -1372,6 +2826,28 @@ lru-cache@^4.0.1: pseudomap "^1.0.2" yallist "^2.1.2" +make-dir@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-2.1.0.tgz#5f0310e18b8be898cc07009295a30ae41e91e6f5" + integrity sha512-LS9X+dc8KLxXCb8dni79fLIIUA5VyZoyjSMCwTluaXA0o27cCK0bhXkpgw+sTXVpPy/lSO57ilRixqk0vDmtRA== + dependencies: + pify "^4.0.1" + semver "^5.6.0" + +makeerror@1.0.x: + version "1.0.11" + resolved "https://registry.yarnpkg.com/makeerror/-/makeerror-1.0.11.tgz#e01a5c9109f2af79660e4e8b9587790184f5a96c" + integrity sha1-4BpckQnyr3lmDk6LlYd5AYT1qWw= + dependencies: + tmpl "1.0.x" + +map-age-cleaner@^0.1.1: + version "0.1.3" + resolved "https://registry.yarnpkg.com/map-age-cleaner/-/map-age-cleaner-0.1.3.tgz#7d583a7306434c055fe474b0f45078e6e1b4b92a" + integrity sha512-bJzx6nMoP6PDLPBFmg7+xRKeFZvFboMrGlxmNj9ClvX53KrmvM5bXFXEWjbz4cz1AFn+jWJ9z/DJSz7hrs0w3w== + dependencies: + p-defer "^1.0.0" + map-cache@^0.2.2: version "0.2.2" resolved "https://registry.yarnpkg.com/map-cache/-/map-cache-0.2.2.tgz#c32abd0bd6525d9b051645bb4f26ac5dc98a0dbf" @@ -1398,12 +2874,28 @@ mem@^1.1.0: dependencies: mimic-fn "^1.0.0" +mem@^4.0.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/mem/-/mem-4.3.0.tgz#461af497bc4ae09608cdb2e60eefb69bff744178" + integrity sha512-qX2bG48pTqYRVmDB37rn/6PT7LcR8T7oAX3bf99u1Tt1nzxYfxkgqDwUwolPlXweM0XzBOBFzSx4kfp7KP1s/w== + dependencies: + map-age-cleaner "^0.1.1" + mimic-fn "^2.0.0" + p-is-promise "^2.0.0" + merge-source-map@^1.0.2: version "1.1.0" resolved "https://registry.yarnpkg.com/merge-source-map/-/merge-source-map-1.1.0.tgz#2fdde7e6020939f70906a68f2d7ae685e4c8c646" dependencies: source-map "^0.6.1" +merge-stream@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-1.0.1.tgz#4041202d508a342ba00174008df0c251b8c135e1" + integrity sha1-QEEgLVCKNCugAXQAjfDCUbjBNeE= + dependencies: + readable-stream "^2.0.1" + micromatch@^2.3.11: version "2.3.11" resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-2.3.11.tgz#86677c97d1720b363431d04d0d15293bd38c1565" @@ -1422,6 +2914,25 @@ micromatch@^2.3.11: parse-glob "^3.0.4" regex-cache "^0.4.2" +micromatch@^3.1.10, micromatch@^3.1.4: + version "3.1.10" + resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-3.1.10.tgz#70859bc95c9840952f359a068a3fc49f9ecfac23" + integrity sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg== + dependencies: + arr-diff "^4.0.0" + array-unique "^0.3.2" + braces "^2.3.1" + define-property "^2.0.2" + extend-shallow "^3.0.2" + extglob "^2.0.4" + fragment-cache "^0.2.1" + kind-of "^6.0.2" + nanomatch "^1.2.9" + object.pick "^1.3.0" + regex-not "^1.0.0" + snapdragon "^0.8.1" + to-regex "^3.0.2" + micromatch@^3.1.8: version "3.1.9" resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-3.1.9.tgz#15dc93175ae39e52e93087847096effc73efcf89" @@ -1440,6 +2951,11 @@ micromatch@^3.1.8: snapdragon "^0.8.1" to-regex "^3.0.1" +mime-db@1.40.0: + version "1.40.0" + resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.40.0.tgz#a65057e998db090f732a68f6c276d387d4126c32" + integrity sha512-jYdeOMPy9vnxEqFRRo6ZvTZ8d9oPb+k18PKoYNYUe2stVEBPPwsln/qWzdbmaIvnhZ9v2P+CuecK+fpUfsV2mA== + mime-db@~1.33.0: version "1.33.0" resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.33.0.tgz#a3492050a5cb9b63450541e39d9788d2272783db" @@ -1450,10 +2966,22 @@ mime-types@^2.1.12, mime-types@~2.1.17: dependencies: mime-db "~1.33.0" +mime-types@~2.1.19: + version "2.1.24" + resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.24.tgz#b6f8d0b3e951efb77dedeca194cff6d16f676f81" + integrity sha512-WaFHS3MCl5fapm3oLxU4eYDw77IQM2ACcxQ9RIxfaC3ooc6PFuBMGZZsYpvoXS5D5QTWPieo1jjLdAm3TBP3cQ== + dependencies: + mime-db "1.40.0" + mimic-fn@^1.0.0: version "1.2.0" resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-1.2.0.tgz#820c86a39334640e99516928bd03fca88057d022" +mimic-fn@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b" + integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg== + minimatch@^3.0.4, minimatch@~3.0.2: version "3.0.4" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" @@ -1464,7 +2992,7 @@ minimist@0.0.8: version "0.0.8" resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" -minimist@^1.2.0: +minimist@^1.1.1, minimist@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" @@ -1472,6 +3000,21 @@ minimist@~0.0.1: version "0.0.10" resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.10.tgz#de3f98543dbf96082be48ad1a0c7cda836301dcf" +minipass@^2.2.1, minipass@^2.3.4: + version "2.3.5" + resolved "https://registry.yarnpkg.com/minipass/-/minipass-2.3.5.tgz#cacebe492022497f656b0f0f51e2682a9ed2d848" + integrity sha512-Gi1W4k059gyRbyVUZQ4mEqLm0YIUiGYfvxhF6SIlk3ui1WVxMTGfGdQ2SInh3PDrRTVvPKgULkpJtT4RH10+VA== + dependencies: + safe-buffer "^5.1.2" + yallist "^3.0.0" + +minizlib@^1.1.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/minizlib/-/minizlib-1.2.1.tgz#dd27ea6136243c7c880684e8672bb3a45fd9b614" + integrity sha512-7+4oTUOWKg7AuL3vloEWekXY2/D20cevzsrNT2kGWm+39J9hGTCBv8VI5Pm5lXZ/o3/mdR4f8rflAPhnQb8mPA== + dependencies: + minipass "^2.2.1" + mixin-deep@^1.2.0: version "1.3.1" resolved "https://registry.yarnpkg.com/mixin-deep/-/mixin-deep-1.3.1.tgz#a49e7268dce1a0d9698e45326c5626df3543d0fe" @@ -1479,31 +3022,12 @@ mixin-deep@^1.2.0: for-in "^1.0.2" is-extendable "^1.0.1" -mkdirp@0.5.1, mkdirp@^0.5.0, mkdirp@^0.5.1: +mkdirp@^0.5.0, mkdirp@^0.5.1: version "0.5.1" resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" dependencies: minimist "0.0.8" -mocha-mongoose@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/mocha-mongoose/-/mocha-mongoose-1.2.0.tgz#d07066262668864c304e348b1670bc52ba25cdf3" - -mocha@^5.0.4: - version "5.0.4" - resolved "https://registry.yarnpkg.com/mocha/-/mocha-5.0.4.tgz#6b7aa328472da1088e69d47e75925fd3a3bb63c6" - dependencies: - browser-stdout "1.3.1" - commander "2.11.0" - debug "3.1.0" - diff "3.5.0" - escape-string-regexp "1.0.5" - glob "7.1.2" - growl "1.10.3" - he "1.1.1" - mkdirp "0.5.1" - supports-color "4.4.0" - mongodb-core@2.1.19: version "2.1.19" resolved "https://registry.yarnpkg.com/mongodb-core/-/mongodb-core-2.1.19.tgz#00fbd5e5a3573763b9171cfd844e60a8f2a3a18b" @@ -1569,6 +3093,16 @@ ms@2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" +ms@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.1.tgz#30a5864eb3ebb0a66f2ebe6d727af06a09d86e0a" + integrity sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg== + +nan@^2.12.1: + version "2.14.0" + resolved "https://registry.yarnpkg.com/nan/-/nan-2.14.0.tgz#7818f722027b2459a86f0295d434d1fc2336c52c" + integrity sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg== + nanomatch@^1.2.9: version "1.2.9" resolved "https://registry.yarnpkg.com/nanomatch/-/nanomatch-1.2.9.tgz#879f7150cb2dab7a471259066c104eee6e0fa7c2" @@ -1586,6 +3120,75 @@ nanomatch@^1.2.9: snapdragon "^0.8.1" to-regex "^3.0.1" +natural-compare@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" + integrity sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc= + +needle@^2.2.1: + version "2.4.0" + resolved "https://registry.yarnpkg.com/needle/-/needle-2.4.0.tgz#6833e74975c444642590e15a750288c5f939b57c" + integrity sha512-4Hnwzr3mi5L97hMYeNl8wRW/Onhy4nUKR/lVemJ8gJedxxUyBLm9kkrDColJvoSfwi0jCNhD+xCdOtiGDQiRZg== + dependencies: + debug "^3.2.6" + iconv-lite "^0.4.4" + sax "^1.2.4" + +neo-async@^2.6.0: + version "2.6.1" + resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.1.tgz#ac27ada66167fa8849a6addd837f6b189ad2081c" + integrity sha512-iyam8fBuCUpWeKPGpaNMetEocMt364qkCsfL9JuhjXX6dRnguRVOfk2GZaDpPjcOKiiXCPINZC1GczQ7iTq3Zw== + +nice-try@^1.0.4: + version "1.0.5" + resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366" + integrity sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ== + +node-int64@^0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/node-int64/-/node-int64-0.4.0.tgz#87a9065cdb355d3182d8f94ce11188b825c68a3b" + integrity sha1-h6kGXNs1XTGC2PlM4RGIuCXGijs= + +node-modules-regexp@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/node-modules-regexp/-/node-modules-regexp-1.0.0.tgz#8d9dbe28964a4ac5712e9131642107c71e90ec40" + integrity sha1-jZ2+KJZKSsVxLpExZCEHxx6Q7EA= + +node-notifier@^5.2.1: + version "5.4.0" + resolved "https://registry.yarnpkg.com/node-notifier/-/node-notifier-5.4.0.tgz#7b455fdce9f7de0c63538297354f3db468426e6a" + integrity sha512-SUDEb+o71XR5lXSTyivXd9J7fCloE3SyP4lSgt3lU2oSANiox+SxlNRGPjDKrwU1YN3ix2KN/VGGCg0t01rttQ== + dependencies: + growly "^1.3.0" + is-wsl "^1.1.0" + semver "^5.5.0" + shellwords "^0.1.1" + which "^1.3.0" + +node-pre-gyp@^0.12.0: + version "0.12.0" + resolved "https://registry.yarnpkg.com/node-pre-gyp/-/node-pre-gyp-0.12.0.tgz#39ba4bb1439da030295f899e3b520b7785766149" + integrity sha512-4KghwV8vH5k+g2ylT+sLTjy5wmUOb9vPhnM8NHvRf9dHmnW/CndrFXy2aRPaPST6dugXSdHXfeaHQm77PIz/1A== + dependencies: + detect-libc "^1.0.2" + mkdirp "^0.5.1" + needle "^2.2.1" + nopt "^4.0.1" + npm-packlist "^1.1.6" + npmlog "^4.0.2" + rc "^1.2.7" + rimraf "^2.6.1" + semver "^5.3.0" + tar "^4" + +nopt@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/nopt/-/nopt-4.0.1.tgz#d0d4685afd5415193c8c7505602d0d17cd64474d" + integrity sha1-0NRoWv1UFRk8jHUFYC0NF81kR00= + dependencies: + abbrev "1" + osenv "^0.1.4" + normalize-package-data@^2.3.2: version "2.4.0" resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-2.4.0.tgz#12f95a307d58352075a04907b84ac8be98ac012f" @@ -1595,22 +3198,51 @@ normalize-package-data@^2.3.2: semver "2 || 3 || 4 || 5" validate-npm-package-license "^3.0.1" -normalize-path@^2.0.1: +normalize-path@^2.0.1, normalize-path@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-2.1.1.tgz#1ab28b556e198363a8c1a6f7e6fa20137fe6aed9" + integrity sha1-GrKLVW4Zg2Oowab35vogE3/mrtk= dependencies: remove-trailing-separator "^1.0.1" +npm-bundled@^1.0.1: + version "1.0.6" + resolved "https://registry.yarnpkg.com/npm-bundled/-/npm-bundled-1.0.6.tgz#e7ba9aadcef962bb61248f91721cd932b3fe6bdd" + integrity sha512-8/JCaftHwbd//k6y2rEWp6k1wxVfpFzB6t1p825+cUb7Ym2XQfhwIC5KwhrvzZRJu+LtDE585zVaS32+CGtf0g== + +npm-packlist@^1.1.6: + version "1.4.1" + resolved "https://registry.yarnpkg.com/npm-packlist/-/npm-packlist-1.4.1.tgz#19064cdf988da80ea3cee45533879d90192bbfbc" + integrity sha512-+TcdO7HJJ8peiiYhvPxsEDhF3PJFGUGRcFsGve3vxvxdcpO2Z4Z7rkosRM0kWj6LfbK/P0gu3dzk5RU1ffvFcw== + dependencies: + ignore-walk "^3.0.1" + npm-bundled "^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.1.2" + resolved "https://registry.yarnpkg.com/npmlog/-/npmlog-4.1.2.tgz#08a7f2a8bf734604779a9efa4ad5cc717abb954b" + integrity sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg== + dependencies: + are-we-there-yet "~1.1.2" + console-control-strings "~1.1.0" + gauge "~2.7.3" + set-blocking "~2.0.0" + 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" +nwsapi@^2.0.7: + version "2.1.4" + resolved "https://registry.yarnpkg.com/nwsapi/-/nwsapi-2.1.4.tgz#e006a878db23636f8e8a67d33ca0e4edf61a842f" + integrity sha512-iGfd9Y6SFdTNldEy2L0GUhcarIutFmk+MPWIn9dmj8NMIup03G08uUF2KGbbmv/Ux4RT0VZJoP/sVbWA6d/VIw== + nyc@^11.6.0: version "11.6.0" resolved "https://registry.yarnpkg.com/nyc/-/nyc-11.6.0.tgz#d9c7b51ffceb6bba099a4683a6adc1b331b98853" @@ -1647,6 +3279,11 @@ oauth-sign@~0.8.2: version "0.8.2" resolved "https://registry.yarnpkg.com/oauth-sign/-/oauth-sign-0.8.2.tgz#46a6ab7f0aead8deae9ec0565780b7d4efeb9d43" +oauth-sign@~0.9.0: + version "0.9.0" + resolved "https://registry.yarnpkg.com/oauth-sign/-/oauth-sign-0.9.0.tgz#47a7b016baa68b5fa0ecf3dee08a85c679ac6455" + integrity sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ== + object-assign@^4.1.0: version "4.1.1" resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" @@ -1659,12 +3296,25 @@ object-copy@^0.1.0: define-property "^0.2.5" kind-of "^3.0.3" +object-keys@^1.0.12: + version "1.1.1" + resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.1.1.tgz#1c47f272df277f3b1daf061677d9c82e2322c60e" + integrity sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA== + object-visit@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/object-visit/-/object-visit-1.0.1.tgz#f79c4493af0c5377b59fe39d395e41042dd045bb" dependencies: isobject "^3.0.0" +object.getownpropertydescriptors@^2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.0.3.tgz#8758c846f5b407adab0f236e0986f14b051caa16" + integrity sha1-h1jIRvW0B62rDyNuCYbxSwUcqhY= + dependencies: + define-properties "^1.1.2" + es-abstract "^1.5.1" + object.omit@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/object.omit/-/object.omit-2.0.1.tgz#1a9c744829f39dbb858c76ca3579ae2a54ebd1fa" @@ -1678,7 +3328,7 @@ object.pick@^1.3.0: dependencies: isobject "^3.0.1" -once@^1.3.0: +once@^1.3.0, once@^1.3.1, once@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" dependencies: @@ -1691,9 +3341,22 @@ optimist@^0.6.1: minimist "~0.0.1" wordwrap "~0.0.2" -os-homedir@^1.0.1: +optionator@^0.8.1: + version "0.8.2" + resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.8.2.tgz#364c5e409d3f4d6301d6c0b4c05bba50180aeb64" + integrity sha1-NkxeQJ0/TWMB1sC0wFu6UBgK62Q= + dependencies: + deep-is "~0.1.3" + fast-levenshtein "~2.0.4" + levn "~0.3.0" + prelude-ls "~1.1.2" + type-check "~0.3.2" + wordwrap "~1.0.0" + +os-homedir@^1.0.0, os-homedir@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/os-homedir/-/os-homedir-1.0.2.tgz#ffbc4988336e0e833de0c168c7ef152121aa7fb3" + integrity sha1-/7xJiDNuDoM94MFox+8VISGqf7M= os-locale@^2.0.0: version "2.1.0" @@ -1703,26 +3366,89 @@ os-locale@^2.0.0: lcid "^1.0.0" mem "^1.1.0" +os-locale@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/os-locale/-/os-locale-3.1.0.tgz#a802a6ee17f24c10483ab9935719cef4ed16bf1a" + integrity sha512-Z8l3R4wYWM40/52Z+S265okfFj8Kt2cC2MKY+xNi3kFs+XGI7WXu/I309QQQYbRW4ijiZ+yxs9pqEhJh0DqW3Q== + dependencies: + execa "^1.0.0" + lcid "^2.0.0" + mem "^4.0.0" + +os-tmpdir@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274" + integrity sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ= + +osenv@^0.1.4: + version "0.1.5" + resolved "https://registry.yarnpkg.com/osenv/-/osenv-0.1.5.tgz#85cdfafaeb28e8677f416e287592b5f3f49ea410" + integrity sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g== + dependencies: + os-homedir "^1.0.0" + os-tmpdir "^1.0.0" + +p-defer@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/p-defer/-/p-defer-1.0.0.tgz#9f6eb182f6c9aa8cd743004a7d4f96b196b0fb0c" + integrity sha1-n26xgvbJqozXQwBKfU+WsZaw+ww= + +p-each-series@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/p-each-series/-/p-each-series-1.0.0.tgz#930f3d12dd1f50e7434457a22cd6f04ac6ad7f71" + integrity sha1-kw89Et0fUOdDRFeiLNbwSsatf3E= + dependencies: + p-reduce "^1.0.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-is-promise@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/p-is-promise/-/p-is-promise-2.1.0.tgz#918cebaea248a62cf7ffab8e3bca8c5f882fc42e" + integrity sha512-Y3W0wlRPK8ZMRbNq97l4M5otioeA5lm1z7bkNkxCka8HSPjR0xRWmpCmc9utiaLP9Jb1eD8BgeIxTW4AIF45Pg== + p-limit@^1.1.0: version "1.2.0" resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-1.2.0.tgz#0e92b6bedcb59f022c13d0f1949dc82d15909f1c" dependencies: p-try "^1.0.0" +p-limit@^2.0.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.2.0.tgz#417c9941e6027a9abcba5092dd2904e255b5fbc2" + integrity sha512-pZbTJpoUsCzV48Mc9Nh51VbwO0X9cuPFE8gYwx9BTCt9SF8/b7Zljd2fVgOxhIF/HDTKgpVzs+GPhyKfjLLFRQ== + dependencies: + p-try "^2.0.0" + 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" +p-locate@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-3.0.0.tgz#322d69a05c0264b25997d9f40cd8a891ab0064a4" + integrity sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ== + dependencies: + p-limit "^2.0.0" + +p-reduce@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/p-reduce/-/p-reduce-1.0.0.tgz#18c2b0dd936a4690a529f8231f58a0fdb6a47dfa" + integrity sha1-GMKw3ZNqRpClKfgjH1ig/bakffo= + p-try@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/p-try/-/p-try-1.0.0.tgz#cbc79cdbaf8fd4228e13f621f2b1a237c1b207b3" +p-try@^2.0.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.2.0.tgz#cb2868540e313d61de58fafbe35ce9004d5540e6" + integrity sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ== + parse-glob@^3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/parse-glob/-/parse-glob-3.0.4.tgz#b2c376cfb11f35513badd173ef0bb6e3a388391c" @@ -1738,6 +3464,19 @@ parse-json@^2.2.0: dependencies: error-ex "^1.2.0" +parse-json@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-4.0.0.tgz#be35f5425be1f7f6c747184f98a788cb99477ee0" + integrity sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA= + dependencies: + error-ex "^1.3.1" + json-parse-better-errors "^1.0.1" + +parse5@4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/parse5/-/parse5-4.0.0.tgz#6d78656e3da8d78b4ec0b906f7c08ef1dfe3f608" + integrity sha512-VrZ7eOd3T1Fk4XWNXMgiGBK/z0MG48BWG2uQNU4I72fkQuKUTZpl+u9k+CxEG0twMVzSmXEEz12z5Fnw1jIQFA== + pascalcase@^0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/pascalcase/-/pascalcase-0.1.1.tgz#b363e55e8006ca6fe21784d2db22bd15d7917f14" @@ -1756,7 +3495,7 @@ 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" -path-key@^2.0.0: +path-key@^2.0.0, path-key@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40" @@ -1764,6 +3503,11 @@ path-parse@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.5.tgz#3c1adf871ea9cd6c9431b6ea2bd74a0ff055c4c1" +path-parse@^1.0.6: + version "1.0.6" + resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.6.tgz#d62dbb5679405d72c4737ec58600e9ddcf06d24c" + integrity sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw== + path-type@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/path-type/-/path-type-1.1.0.tgz#59c44f7ee491da704da415da5a4070ba4f8fe441" @@ -1778,9 +3522,12 @@ path-type@^2.0.0: dependencies: pify "^2.0.0" -pathval@^1.0.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/pathval/-/pathval-1.1.0.tgz#b942e6d4bde653005ef6b71361def8727d0645e0" +path-type@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/path-type/-/path-type-3.0.0.tgz#cef31dc8e0a1a3bb0d105c0cd97cf3bf47f4e36f" + integrity sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg== + dependencies: + pify "^3.0.0" performance-now@^2.1.0: version "2.1.0" @@ -1790,6 +3537,16 @@ pify@^2.0.0: version "2.3.0" resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c" +pify@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/pify/-/pify-3.0.0.tgz#e5a4acd2c101fdf3d9a4d07f0dbc4db49dd28176" + integrity sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY= + +pify@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/pify/-/pify-4.0.1.tgz#4b2cd25c50d598735c50292224fd8c6df41e3231" + integrity sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g== + pinkie-promise@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/pinkie-promise/-/pinkie-promise-2.0.1.tgz#2135d6dfa7a358c069ac9b178776288228450ffa" @@ -1800,36 +3557,106 @@ pinkie@^2.0.0: version "2.0.4" resolved "https://registry.yarnpkg.com/pinkie/-/pinkie-2.0.4.tgz#72556b80cfa0d48a974e80e77248e80ed4f7f870" +pirates@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/pirates/-/pirates-4.0.1.tgz#643a92caf894566f91b2b986d2c66950a8e2fb87" + integrity sha512-WuNqLTbMI3tmfef2TKxlQmAiLHKtFhlsCZnPIpuv2Ow0RDVO8lfy1Opf4NUzlMXLjPl+Men7AuVdX6TA+s+uGA== + dependencies: + node-modules-regexp "^1.0.0" + pkg-dir@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-1.0.0.tgz#7a4b508a8d5bb2d629d447056ff4e9c9314cf3d4" dependencies: find-up "^1.0.0" +pkg-dir@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-3.0.0.tgz#2749020f239ed990881b1f71210d51eb6523bea3" + integrity sha512-/E57AYkoeQ25qkxMj5PBOVgF8Kiu/h7cYS30Z5+R7WaiCCBfLq58ZI/dSeaEKb9WVJV5n/03QwrN3IeWIFllvw== + dependencies: + find-up "^3.0.0" + +pn@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/pn/-/pn-1.1.0.tgz#e2f4cef0e219f463c179ab37463e4e1ecdccbafb" + integrity sha512-2qHaIQr2VLRFoxe2nASzsV6ef4yOOH+Fi9FBOVH6cqeSgUnoyySPZkxzLuzd+RYOQTRpROA0ztTMqxROKSb/nA== + posix-character-classes@^0.1.0: version "0.1.1" resolved "https://registry.yarnpkg.com/posix-character-classes/-/posix-character-classes-0.1.1.tgz#01eac0fe3b5af71a2a6c02feabb8c1fef7e00eab" +prelude-ls@~1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" + integrity sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ= + preserve@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b" +pretty-format@^24.8.0: + version "24.8.0" + resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-24.8.0.tgz#8dae7044f58db7cb8be245383b565a963e3c27f2" + integrity sha512-P952T7dkrDEplsR+TuY7q3VXDae5Sr7zmQb12JU/NDQa/3CH7/QW0yvqLcGN6jL+zQFKaoJcPc+yJxMTGmosqw== + dependencies: + "@jest/types" "^24.8.0" + ansi-regex "^4.0.0" + ansi-styles "^3.2.0" + react-is "^16.8.4" + process-nextick-args@~1.0.6: version "1.0.7" resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-1.0.7.tgz#150e20b756590ad3f91093f25a4f2ad8bff30ba3" +process-nextick-args@~2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.0.tgz#a37d732f4271b4ab1ad070d35508e8290788ffaa" + integrity sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw== + +prompts@^2.0.1: + version "2.1.0" + resolved "https://registry.yarnpkg.com/prompts/-/prompts-2.1.0.tgz#bf90bc71f6065d255ea2bdc0fe6520485c1b45db" + integrity sha512-+x5TozgqYdOwWsQFZizE/Tra3fKvAoy037kOyU6cgz84n8f6zxngLOV4O32kTwt9FcLCxAqw0P/c8rOr9y+Gfg== + dependencies: + kleur "^3.0.2" + sisteransi "^1.0.0" + pseudomap@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/pseudomap/-/pseudomap-1.0.2.tgz#f052a28da70e618917ef0a8ac34c1ae5a68286b3" +psl@^1.1.24, psl@^1.1.28: + version "1.1.32" + resolved "https://registry.yarnpkg.com/psl/-/psl-1.1.32.tgz#3f132717cf2f9c169724b2b6caf373cf694198db" + integrity sha512-MHACAkHpihU/REGGPLj4sEfc/XKW2bheigvHO1dUqjaKigMp1C8+WLQYRGgeKFMsw5PMfegZcaN8IDXK/cD0+g== + +pump@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/pump/-/pump-3.0.0.tgz#b4a2116815bde2f4e1ea602354e8c75565107a64" + integrity sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww== + dependencies: + end-of-stream "^1.1.0" + once "^1.3.1" + punycode@^1.4.1: version "1.4.1" resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e" +punycode@^2.1.0, punycode@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" + integrity sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A== + qs@~6.5.1: version "6.5.1" resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.1.tgz#349cdf6eef89ec45c12d7d5eb3fc0c870343a6d8" +qs@~6.5.2: + version "6.5.2" + resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.2.tgz#cb3ae806e8740444584ef154ce8ee98d403f3e36" + integrity sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA== + randomatic@^1.1.3: version "1.1.7" resolved "https://registry.yarnpkg.com/randomatic/-/randomatic-1.1.7.tgz#c7abe9cc8b87c0baa876b19fde83fd464797e38c" @@ -1837,6 +3664,21 @@ randomatic@^1.1.3: is-number "^3.0.0" kind-of "^4.0.0" +rc@^1.2.7: + version "1.2.8" + resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.8.tgz#cd924bf5200a075b83c188cd6b9e211b7fc0d3ed" + integrity sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw== + dependencies: + deep-extend "^0.6.0" + ini "~1.3.0" + minimist "^1.2.0" + strip-json-comments "~2.0.1" + +react-is@^16.8.4: + version "16.8.6" + resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.8.6.tgz#5bbc1e2d29141c9fbdfed456343fe2bc430a6a16" + integrity sha512-aUk3bHfZ2bRSVFFbbeVS4i+lNPZr3/WM5jT2J5omUVV1zzcs1nAaf3l51ctA5FFvCRbhrH0bdAsRRQddFJZPtA== + read-pkg-up@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-1.0.1.tgz#9d63c13276c065918d57f002a57f40a1b643fb02" @@ -1851,6 +3693,14 @@ read-pkg-up@^2.0.0: find-up "^2.0.0" read-pkg "^2.0.0" +read-pkg-up@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-4.0.0.tgz#1b221c6088ba7799601c808f91161c66e58f8978" + integrity sha512-6etQSH7nJGsK0RbG/2TeDzZFa8shjQ1um+SwQQ5cwKy0dhSXdOncEhb1CPpvQG4h7FyOV6EB6YlV0yJvZQNAkA== + dependencies: + find-up "^3.0.0" + read-pkg "^3.0.0" + read-pkg@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-1.1.0.tgz#f5ffaa5ecd29cb31c0474bca7d756b6bb29e3f28" @@ -1867,6 +3717,15 @@ read-pkg@^2.0.0: normalize-package-data "^2.3.2" path-type "^2.0.0" +read-pkg@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-3.0.0.tgz#9cbc686978fee65d16c00e2b19c237fcf6e38389" + integrity sha1-nLxoaXj+5l0WwA4rGcI3/Pbjg4k= + dependencies: + load-json-file "^4.0.0" + normalize-package-data "^2.3.2" + path-type "^3.0.0" + readable-stream@1.1: version "1.1.13" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-1.1.13.tgz#f6eef764f514c89e2b9e23146a75ba106756d23e" @@ -1888,6 +3747,26 @@ readable-stream@2.2.7: string_decoder "~1.0.0" util-deprecate "~1.0.1" +readable-stream@^2.0.1, readable-stream@^2.0.6: + version "2.3.6" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.6.tgz#b11c27d88b8ff1fbe070643cf94b0c79ae1b0aaf" + integrity sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw== + dependencies: + core-util-is "~1.0.0" + inherits "~2.0.3" + isarray "~1.0.0" + process-nextick-args "~2.0.0" + safe-buffer "~5.1.1" + string_decoder "~1.1.1" + util-deprecate "~1.0.1" + +realpath-native@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/realpath-native/-/realpath-native-1.1.0.tgz#2003294fea23fb0672f2476ebe22fcf498a2d65c" + integrity sha512-wlgPA6cCIIg9gKz0fgAPjnzh4yR/LnXovwuo9hvyGvx3h8nX4+/iLZplfUWasXpqD8BdnGnP5njOFjkUwPzvjA== + dependencies: + util.promisify "^1.0.0" + regenerator-runtime@^0.11.0: version "0.11.1" resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz#be05ad7f9bf7d22e056f9726cee5017fbf19e2e9" @@ -1927,6 +3806,22 @@ repeating@^2.0.0: dependencies: is-finite "^1.0.0" +request-promise-core@1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/request-promise-core/-/request-promise-core-1.1.2.tgz#339f6aababcafdb31c799ff158700336301d3346" + integrity sha512-UHYyq1MO8GsefGEt7EprS8UrXsm1TxEvFUX1IMTuSLU2Rh7fTIdFtl8xD7JiEYiWU2dl+NYAjCTksTehQUxPag== + dependencies: + lodash "^4.17.11" + +request-promise-native@^1.0.5: + version "1.0.7" + resolved "https://registry.yarnpkg.com/request-promise-native/-/request-promise-native-1.0.7.tgz#a49868a624bdea5069f1251d0a836e0d89aa2c59" + integrity sha512-rIMnbBdgNViL37nZ1b3L/VfPOpSi0TqVDQPAvO6U14lMzOLrt5nilxCQqtDKhZeDiW0/hkCXGoQjhgJd/tCh6w== + dependencies: + request-promise-core "1.1.2" + stealthy-require "^1.1.1" + tough-cookie "^2.3.3" + request@^2.79.0: version "2.83.0" resolved "https://registry.yarnpkg.com/request/-/request-2.83.0.tgz#ca0b65da02ed62935887808e6f510381034e3356" @@ -1954,6 +3849,32 @@ request@^2.79.0: tunnel-agent "^0.6.0" uuid "^3.1.0" +request@^2.87.0: + version "2.88.0" + resolved "https://registry.yarnpkg.com/request/-/request-2.88.0.tgz#9c2fca4f7d35b592efe57c7f0a55e81052124fef" + integrity sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg== + dependencies: + aws-sign2 "~0.7.0" + aws4 "^1.8.0" + caseless "~0.12.0" + combined-stream "~1.0.6" + extend "~3.0.2" + forever-agent "~0.6.1" + form-data "~2.3.2" + har-validator "~5.1.0" + http-signature "~1.2.0" + is-typedarray "~1.0.0" + isstream "~0.1.2" + json-stringify-safe "~5.0.1" + mime-types "~2.1.19" + oauth-sign "~0.9.0" + performance-now "^2.1.0" + qs "~6.5.2" + safe-buffer "^5.1.2" + tough-cookie "~2.4.3" + tunnel-agent "^0.6.0" + uuid "^3.3.2" + require-directory@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" @@ -1962,6 +3883,11 @@ require-main-filename@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-1.0.1.tgz#97f717b69d48784f5f526a6c5aa8ffdda055a4d1" +require-main-filename@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-2.0.0.tgz#d0b329ecc7cc0f61649f62215be69af54aa8989b" + integrity sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg== + require_optional@^1.0.1, require_optional@~1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/require_optional/-/require_optional-1.0.1.tgz#4cf35a4247f64ca3df8c2ef208cc494b1ca8fc2e" @@ -1969,14 +3895,38 @@ require_optional@^1.0.1, require_optional@~1.0.0: resolve-from "^2.0.0" semver "^5.1.0" +resolve-cwd@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/resolve-cwd/-/resolve-cwd-2.0.0.tgz#00a9f7387556e27038eae232caa372a6a59b665a" + integrity sha1-AKn3OHVW4nA46uIyyqNypqWbZlo= + dependencies: + resolve-from "^3.0.0" + resolve-from@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-2.0.0.tgz#9480ab20e94ffa1d9e80a804c7ea147611966b57" +resolve-from@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-3.0.0.tgz#b22c7af7d9d6881bc8b6e653335eebcb0a188748" + integrity sha1-six699nWiBvItuZTM17rywoYh0g= + resolve-url@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/resolve-url/-/resolve-url-0.2.1.tgz#2c637fe77c893afd2a663fe21aa9080068e2052a" +resolve@1.1.7: + version "1.1.7" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b" + integrity sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs= + +resolve@^1.3.2: + version "1.11.0" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.11.0.tgz#4014870ba296176b86343d50b60f3b50609ce232" + integrity sha512-WL2pBDjqT6pGUNSUzMw00o4T7If+z4H2x3Gz893WoUQ5KW8Vr9txp00ykiP16VBaZF5+j/OcXJHZ9+PCvdiDKw== + dependencies: + path-parse "^1.0.6" + ret@~0.1.10: version "0.1.15" resolved "https://registry.yarnpkg.com/ret/-/ret-0.1.15.tgz#b8a4825d5bdb1fc3f6f53c2bc33f81388681c7bc" @@ -1993,21 +3943,73 @@ rimraf@^2.5.4, rimraf@^2.6.1, rimraf@^2.6.2: dependencies: glob "^7.0.5" +rimraf@^2.6.3: + version "2.6.3" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.3.tgz#b2d104fe0d8fb27cf9e0a1cda8262dd3833c6cab" + integrity sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA== + dependencies: + glob "^7.1.3" + +rsvp@^4.8.4: + version "4.8.4" + resolved "https://registry.yarnpkg.com/rsvp/-/rsvp-4.8.4.tgz#b50e6b34583f3dd89329a2f23a8a2be072845911" + integrity sha512-6FomvYPfs+Jy9TfXmBpBuMWNH94SgCsZmJKcanySzgNNP6LjWxBvyLTa9KaMfDDM5oxRfrKDB0r/qeRsLwnBfA== + safe-buffer@^5.0.1, safe-buffer@^5.1.1, safe-buffer@~5.1.0: version "5.1.1" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.1.tgz#893312af69b2123def71f57889001671eeb2c853" +safe-buffer@^5.1.2, safe-buffer@~5.1.1: + version "5.1.2" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" + integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g== + safe-regex@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/safe-regex/-/safe-regex-1.1.0.tgz#40a3669f3b077d1e943d44629e157dd48023bf2e" dependencies: ret "~0.1.10" +"safer-buffer@>= 2.1.2 < 3": + version "2.1.2" + resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" + integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== + +sane@^4.0.3: + version "4.1.0" + resolved "https://registry.yarnpkg.com/sane/-/sane-4.1.0.tgz#ed881fd922733a6c461bc189dc2b6c006f3ffded" + integrity sha512-hhbzAgTIX8O7SHfp2c8/kREfEn4qO/9q8C9beyY6+tvZ87EpoZ3i1RIEvp27YBswnNbY9mWd6paKVmKbAgLfZA== + dependencies: + "@cnakazawa/watch" "^1.0.3" + anymatch "^2.0.0" + capture-exit "^2.0.0" + exec-sh "^0.3.2" + execa "^1.0.0" + fb-watchman "^2.0.0" + micromatch "^3.1.4" + minimist "^1.1.1" + walker "~1.0.5" + +sax@^1.2.4: + version "1.2.4" + resolved "https://registry.yarnpkg.com/sax/-/sax-1.2.4.tgz#2816234e2378bddc4e5354fab5caa895df7100d9" + integrity sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw== + "semver@2 || 3 || 4 || 5", semver@^5.1.0, semver@^5.3.0: version "5.5.0" resolved "https://registry.yarnpkg.com/semver/-/semver-5.5.0.tgz#dc4bbc7a6ca9d916dee5d43516f0092b58f7b8ab" -set-blocking@^2.0.0: +semver@^5.4.1, semver@^5.5.0, semver@^5.6.0: + version "5.7.0" + resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.0.tgz#790a7cf6fea5459bac96110b29b60412dc8ff96b" + integrity sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA== + +semver@^6.0.0: + version "6.1.0" + resolved "https://registry.yarnpkg.com/semver/-/semver-6.1.0.tgz#e95dc415d45ecf03f2f9f83b264a6b11f49c0cca" + integrity sha512-kCqEOOHoBcFs/2Ccuk4Xarm/KiWRSLEX9CAZF8xkJ6ZPlIoTZ8V5f7J16vYLJqDbR7KrxTJpR2lqjIEm2Qx9cQ== + +set-blocking@^2.0.0, set-blocking@~2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" @@ -2043,10 +4045,25 @@ shelljs@0.3.x: version "0.3.0" resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.3.0.tgz#3596e6307a781544f591f37da618360f31db57b1" +shellwords@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/shellwords/-/shellwords-0.1.1.tgz#d6b9181c1a48d397324c84871efbcfc73fc0654b" + integrity sha512-vFwSUfQvqybiICwZY5+DAWIPLKsWO31Q91JSKl3UYv+K5c2QRPzn0qzec6QPu1Qc9eHYItiP3NdJqNVqetYAww== + 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" +sisteransi@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/sisteransi/-/sisteransi-1.0.0.tgz#77d9622ff909080f1c19e5f4a1df0c1b0a27b88c" + integrity sha512-N+z4pHB4AmUv0SjveWRd6q1Nj5w62m5jodv+GD8lvmbY/83T/rpbJGZOnK5T149OldDj4Db07BSv9xY4K6NTPQ== + +slash@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/slash/-/slash-2.0.0.tgz#de552851a1759df3a8f206535442f5ec4ddeab44" + integrity sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A== + sliced@0.0.5: version "0.0.5" resolved "https://registry.yarnpkg.com/sliced/-/sliced-0.0.5.tgz#5edc044ca4eb6f7816d50ba2fc63e25d8fe4707f" @@ -2102,6 +4119,14 @@ source-map-resolve@^0.5.0: source-map-url "^0.4.0" urix "^0.1.0" +source-map-support@^0.5.6: + version "0.5.12" + resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.12.tgz#b4f3b10d51857a5af0138d3ce8003b201613d599" + integrity sha512-4h2Pbvyy15EE02G+JOZpUCmqWJuqrs+sEkzewTm++BPi7Hvn/HwcqLAcNxYAyI0x13CpPPn+kMjl+hplXMHITQ== + dependencies: + buffer-from "^1.0.0" + source-map "^0.6.0" + source-map-url@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/source-map-url/-/source-map-url-0.4.0.tgz#3e935d7ddd73631b97659956d55128e87b5084a3" @@ -2112,13 +4137,15 @@ source-map@^0.4.4: dependencies: amdefine ">=0.0.4" -source-map@^0.5.3, source-map@^0.5.6, source-map@^0.5.7, source-map@~0.5.1: +source-map@^0.5.0, source-map@^0.5.3, source-map@^0.5.6, source-map@^0.5.7, source-map@~0.5.1: version "0.5.7" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc" + integrity sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w= -source-map@^0.6.1: +source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" + integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== spawn-wrap@^1.4.2: version "1.4.2" @@ -2177,6 +4204,11 @@ sshpk@^1.7.0: jsbn "~0.1.0" tweetnacl "~0.14.0" +stack-utils@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/stack-utils/-/stack-utils-1.0.2.tgz#33eba3897788558bebfc2db059dc158ec36cebb8" + integrity sha512-MTX+MeG5U994cazkjd/9KNAapsHnibjMLnfXodlkXw76JEea0UiNzrqidzo1emMwk7w5Qhc9jd4Bn9TBb1MFwA== + static-extend@^0.1.1: version "0.1.2" resolved "https://registry.yarnpkg.com/static-extend/-/static-extend-0.1.2.tgz#60809c39cbff55337226fd5e0b520f341f1fb5c6" @@ -2184,6 +4216,19 @@ static-extend@^0.1.1: define-property "^0.2.5" object-copy "^0.1.0" +stealthy-require@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/stealthy-require/-/stealthy-require-1.1.1.tgz#35b09875b4ff49f26a777e509b3090a3226bf24b" + integrity sha1-NbCYdbT/SfJqd35QmzCQoyJr8ks= + +string-length@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/string-length/-/string-length-2.0.0.tgz#d40dbb686a3ace960c1cffca562bf2c45f8363ed" + integrity sha1-1A27aGo6zpYMHP/KVivyxF+DY+0= + dependencies: + astral-regex "^1.0.0" + strip-ansi "^4.0.0" + string-width@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/string-width/-/string-width-1.0.2.tgz#118bdf5b8cdc51a2a7e70d211e07e2b0b9b107d3" @@ -2192,7 +4237,7 @@ string-width@^1.0.1: is-fullwidth-code-point "^1.0.0" strip-ansi "^3.0.0" -string-width@^2.0.0, string-width@^2.1.1: +"string-width@^1.0.2 || 2", string-width@^2.0.0, string-width@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e" dependencies: @@ -2209,6 +4254,13 @@ string_decoder@~1.0.0: dependencies: safe-buffer "~5.1.0" +string_decoder@~1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.1.1.tgz#9cf1611ba62685d7030ae9e4ba34149c3af03fc8" + integrity sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg== + dependencies: + safe-buffer "~5.1.0" + stringstream@~0.0.5: version "0.0.5" resolved "https://registry.yarnpkg.com/stringstream/-/stringstream-0.0.5.tgz#4e484cd4de5a0bbbee18e46307710a8a81621878" @@ -2225,6 +4277,13 @@ strip-ansi@^4.0.0: dependencies: ansi-regex "^3.0.0" +strip-ansi@^5.0.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-5.2.0.tgz#8c9a536feb6afc962bdfa5b104a5091c1ad9c0ae" + integrity sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA== + dependencies: + ansi-regex "^4.1.0" + strip-bom@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-2.0.0.tgz#6219a85616520491f35788bdbf1447a99c7e6b0e" @@ -2243,11 +4302,10 @@ strip-json-comments@1.0.x: version "1.0.4" resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-1.0.4.tgz#1e15fbcac97d3ee99bf2d73b4c656b082bbafb91" -supports-color@4.4.0: - version "4.4.0" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-4.4.0.tgz#883f7ddabc165142b2a61427f3352ded195d1a3e" - dependencies: - has-flag "^2.0.0" +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" + integrity sha1-PFMZQukIwml8DsNEhYwobHygpgo= supports-color@^2.0.0: version "2.0.0" @@ -2259,6 +4317,38 @@ supports-color@^3.1.2: dependencies: has-flag "^1.0.0" +supports-color@^5.3.0: + version "5.5.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" + integrity sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow== + dependencies: + has-flag "^3.0.0" + +supports-color@^6.1.0: + version "6.1.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-6.1.0.tgz#0764abc69c63d5ac842dd4867e8d025e880df8f3" + integrity sha512-qe1jfm1Mg7Nq/NSh6XE24gPXROEVsWHxC1LIx//XNlD9iw7YZQGjZNjYN7xGaEG6iKdA8EtNFW6R0gjnVXp+wQ== + dependencies: + has-flag "^3.0.0" + +symbol-tree@^3.2.2: + version "3.2.2" + resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.2.tgz#ae27db38f660a7ae2e1c3b7d1bc290819b8519e6" + integrity sha1-rifbOPZgp64uHDt9G8KQgZuFGeY= + +tar@^4: + version "4.4.8" + resolved "https://registry.yarnpkg.com/tar/-/tar-4.4.8.tgz#b19eec3fde2a96e64666df9fdb40c5ca1bc3747d" + integrity sha512-LzHF64s5chPQQS0IYBn9IN5h3i98c12bo4NCO7e0sGM2llXQ3p2FGC5sdENN4cTW48O915Sh+x+EXx7XW96xYQ== + dependencies: + chownr "^1.1.1" + fs-minipass "^1.2.5" + minipass "^2.3.4" + minizlib "^1.1.1" + mkdirp "^0.5.0" + safe-buffer "^5.1.2" + yallist "^3.0.2" + test-exclude@^4.2.0: version "4.2.1" resolved "https://registry.yarnpkg.com/test-exclude/-/test-exclude-4.2.1.tgz#dfa222f03480bca69207ca728b37d74b45f724fa" @@ -2269,10 +4359,35 @@ test-exclude@^4.2.0: read-pkg-up "^1.0.1" require-main-filename "^1.0.1" +test-exclude@^5.2.3: + version "5.2.3" + resolved "https://registry.yarnpkg.com/test-exclude/-/test-exclude-5.2.3.tgz#c3d3e1e311eb7ee405e092dac10aefd09091eac0" + integrity sha512-M+oxtseCFO3EDtAaGH7iiej3CBkzXqFMbzqYAACdzKui4eZA+pq3tZEwChvOdNfa7xxy8BfbmgJSIr43cC/+2g== + dependencies: + glob "^7.1.3" + minimatch "^3.0.4" + read-pkg-up "^4.0.0" + require-main-filename "^2.0.0" + +throat@^4.0.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/throat/-/throat-4.1.0.tgz#89037cbc92c56ab18926e6ba4cbb200e15672a6a" + integrity sha1-iQN8vJLFarGJJua6TLsgDhVnKmo= + +tmpl@1.0.x: + version "1.0.4" + resolved "https://registry.yarnpkg.com/tmpl/-/tmpl-1.0.4.tgz#23640dd7b42d00433911140820e5cf440e521dd1" + integrity sha1-I2QN17QtAEM5ERQIIOXPRA5SHdE= + 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" +to-fast-properties@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-2.0.0.tgz#dc5e698cbd079265bc73e0377681a4e4e83f616e" + integrity sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4= + to-object-path@^0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/to-object-path/-/to-object-path-0.3.0.tgz#297588b7b0e7e0ac08e04e672f85c1f4999e17af" @@ -2286,7 +4401,7 @@ to-regex-range@^2.1.0: is-number "^3.0.0" repeat-string "^1.6.1" -to-regex@^3.0.1: +to-regex@^3.0.1, to-regex@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/to-regex/-/to-regex-3.0.2.tgz#13cfdd9b336552f30b51f33a8ae1b42a7a7599ce" dependencies: @@ -2295,12 +4410,35 @@ to-regex@^3.0.1: regex-not "^1.0.2" safe-regex "^1.1.0" +tough-cookie@^2.3.3, tough-cookie@^2.3.4: + version "2.5.0" + resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.5.0.tgz#cd9fb2a0aa1d5a12b473bd9fb96fa3dcff65ade2" + integrity sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g== + dependencies: + psl "^1.1.28" + punycode "^2.1.1" + tough-cookie@~2.3.3: version "2.3.4" resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.3.4.tgz#ec60cee38ac675063ffc97a5c18970578ee83655" dependencies: punycode "^1.4.1" +tough-cookie@~2.4.3: + version "2.4.3" + resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.4.3.tgz#53f36da3f47783b0925afa06ff9f3b165280f781" + integrity sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ== + dependencies: + psl "^1.1.24" + punycode "^1.4.1" + +tr46@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/tr46/-/tr46-1.0.1.tgz#a8b13fd6bfd2489519674ccde55ba3693b706d09" + integrity sha1-qLE/1r/SSJUZZ0zN5VujaTtwbQk= + dependencies: + punycode "^2.1.0" + trim-right@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/trim-right/-/trim-right-1.0.1.tgz#cb2e1203067e0c8de1f614094b9fe45704ea6003" @@ -2315,9 +4453,12 @@ tweetnacl@^0.14.3, tweetnacl@~0.14.0: version "0.14.5" resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-0.14.5.tgz#5ae68177f192d4456269d108afa93ff8743f4f64" -type-detect@^4.0.0: - version "4.0.8" - resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-4.0.8.tgz#7646fb5f18871cfbb7749e69bd39a6388eb7450c" +type-check@~0.3.2: + version "0.3.2" + resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.3.2.tgz#5884cab512cf1d355e3fb784f30804b2b520db72" + integrity sha1-WITKtRLPHTVeP7eE8wgEsrUg23I= + dependencies: + prelude-ls "~1.1.2" uglify-js@^2.6: version "2.8.29" @@ -2328,6 +4469,14 @@ uglify-js@^2.6: optionalDependencies: uglify-to-browserify "~1.0.0" +uglify-js@^3.1.4: + version "3.5.15" + resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.5.15.tgz#fe2b5378fd0b09e116864041437bff889105ce24" + integrity sha512-fe7aYFotptIddkwcm6YuA0HmknBZ52ZzOsUxZEdhhkSsz7RfjHDX2QDxwKTiv4JQ5t5NhfmpgAK+J7LiDhKSqg== + dependencies: + commander "~2.20.0" + source-map "~0.6.1" + uglify-to-browserify@~1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz#6e0924d6bda6b5afe349e39a6d632850a0f882b7" @@ -2348,6 +4497,13 @@ unset-value@^1.0.0: has-value "^0.3.1" isobject "^3.0.0" +uri-js@^4.2.2: + version "4.2.2" + resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.2.2.tgz#94c540e1ff772956e2299507c010aea6c8838eb0" + integrity sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ== + dependencies: + punycode "^2.1.0" + urix@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/urix/-/urix-0.1.0.tgz#da937f7a62e21fec1fd18d49b35c2935067a6c72" @@ -2362,10 +4518,23 @@ util-deprecate@~1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" +util.promisify@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/util.promisify/-/util.promisify-1.0.0.tgz#440f7165a459c9a16dc145eb8e72f35687097030" + integrity sha512-i+6qA2MPhvoKLuxnJNpXAGhg7HphQOSUq2LKMZD0m15EiskXUkMvKdF4Uui0WYeCUGea+o2cw/ZuwehtfsrNkA== + dependencies: + define-properties "^1.1.2" + object.getownpropertydescriptors "^2.0.3" + uuid@^3.1.0: version "3.2.1" resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.2.1.tgz#12c528bb9d58d0b9265d9a2f6f0fe8be17ff1f14" +uuid@^3.3.2: + version "3.3.2" + resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.3.2.tgz#1b4af4955eb3077c501c23872fc6513811587131" + integrity sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA== + validate-npm-package-license@^3.0.1: version "3.0.3" resolved "https://registry.yarnpkg.com/validate-npm-package-license/-/validate-npm-package-license-3.0.3.tgz#81643bcbef1bdfecd4623793dc4648948ba98338" @@ -2381,6 +4550,55 @@ verror@1.10.0: core-util-is "1.0.2" extsprintf "^1.2.0" +w3c-hr-time@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/w3c-hr-time/-/w3c-hr-time-1.0.1.tgz#82ac2bff63d950ea9e3189a58a65625fedf19045" + integrity sha1-gqwr/2PZUOqeMYmlimViX+3xkEU= + dependencies: + browser-process-hrtime "^0.1.2" + +walker@^1.0.7, walker@~1.0.5: + version "1.0.7" + resolved "https://registry.yarnpkg.com/walker/-/walker-1.0.7.tgz#2f7f9b8fd10d677262b18a884e28d19618e028fb" + integrity sha1-L3+bj9ENZ3JisYqITijRlhjgKPs= + dependencies: + makeerror "1.0.x" + +webidl-conversions@^4.0.2: + version "4.0.2" + resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-4.0.2.tgz#a855980b1f0b6b359ba1d5d9fb39ae941faa63ad" + integrity sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg== + +whatwg-encoding@^1.0.1, whatwg-encoding@^1.0.3: + version "1.0.5" + resolved "https://registry.yarnpkg.com/whatwg-encoding/-/whatwg-encoding-1.0.5.tgz#5abacf777c32166a51d085d6b4f3e7d27113ddb0" + integrity sha512-b5lim54JOPN9HtzvK9HFXvBma/rnfFeqsic0hSpjtDbVxR3dJKLc+KB4V6GgiGOvl7CY/KNh8rxSo9DKQrnUEw== + dependencies: + iconv-lite "0.4.24" + +whatwg-mimetype@^2.1.0, whatwg-mimetype@^2.2.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/whatwg-mimetype/-/whatwg-mimetype-2.3.0.tgz#3d4b1e0312d2079879f826aff18dbeeca5960fbf" + integrity sha512-M4yMwr6mAnQz76TbJm914+gPpB/nCwvZbJU28cUD6dR004SAxDLOOSUaB1JDRqLtaOV/vi0IC5lEAGFgrjGv/g== + +whatwg-url@^6.4.1: + version "6.5.0" + resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-6.5.0.tgz#f2df02bff176fd65070df74ad5ccbb5a199965a8" + integrity sha512-rhRZRqx/TLJQWUpQ6bmrt2UV4f0HCQ463yQuONJqC6fO2VoEb1pTYddbe59SkYq87aoM5A3bdhMZiUiVws+fzQ== + dependencies: + lodash.sortby "^4.7.0" + tr46 "^1.0.1" + webidl-conversions "^4.0.2" + +whatwg-url@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-7.0.0.tgz#fde926fa54a599f3adf82dff25a9f7be02dc6edd" + integrity sha512-37GeVSIJ3kn1JgKyjiYNmSLP1yzbpb29jdmwBSgkD9h40/hyrR/OifpVUndji3tmwGgD8qpw7iQu3RSbCrBpsQ== + dependencies: + lodash.sortby "^4.7.0" + tr46 "^1.0.1" + webidl-conversions "^4.0.2" + which-module@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/which-module/-/which-module-2.0.0.tgz#d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a" @@ -2391,6 +4609,13 @@ which@^1.2.9, which@^1.3.0: dependencies: isexe "^2.0.0" +wide-align@^1.1.0: + version "1.1.3" + resolved "https://registry.yarnpkg.com/wide-align/-/wide-align-1.1.3.tgz#ae074e6bdc0c14a431e804e624549c633b000457" + integrity sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA== + dependencies: + string-width "^1.0.2 || 2" + window-size@0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/window-size/-/window-size-0.1.0.tgz#5438cd2ea93b202efa3a19fe8887aee7c94f9c9d" @@ -2403,6 +4628,11 @@ wordwrap@~0.0.2: version "0.0.3" resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.3.tgz#a3d5da6cd5c0bc0008d37234bbaf1bed63059107" +wordwrap@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb" + integrity sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus= + wrap-ansi@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-2.1.0.tgz#d8fc3d284dd05794fe84973caecdd1cf824fdd85" @@ -2414,6 +4644,15 @@ wrappy@1: version "1.0.2" resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" +write-file-atomic@2.4.1: + version "2.4.1" + resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-2.4.1.tgz#d0b05463c188ae804396fd5ab2a370062af87529" + integrity sha512-TGHFeZEZMnv+gBFRfjAcxL5bPHrsGKtnb4qsFAws7/vlh+QfwAaySIw4AXP9ZskTTh5GWu3FLuJhsWVdiJPGvg== + dependencies: + graceful-fs "^4.1.11" + imurmurhash "^0.1.4" + signal-exit "^3.0.2" + write-file-atomic@^1.1.4: version "1.3.4" resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-1.3.4.tgz#f807a4f0b1d9e913ae7a48112e6cc3af1991b45f" @@ -2422,14 +4661,44 @@ write-file-atomic@^1.1.4: imurmurhash "^0.1.4" slide "^1.1.5" +ws@^5.2.0: + version "5.2.2" + resolved "https://registry.yarnpkg.com/ws/-/ws-5.2.2.tgz#dffef14866b8e8dc9133582514d1befaf96e980f" + integrity sha512-jaHFD6PFv6UgoIVda6qZllptQsMlDEJkTQcybzzXDYM1XO9Y8em691FGMPmM46WGyLU4z9KMgQN+qrux/nhlHA== + dependencies: + async-limiter "~1.0.0" + +xml-name-validator@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/xml-name-validator/-/xml-name-validator-3.0.0.tgz#6ae73e06de4d8c6e47f9fb181f78d648ad457c6a" + integrity sha512-A5CUptxDsvxKJEU3yO6DuWBSJz/qizqzJKOMIfUJHETbBw/sFaDxgd6fxm1ewUaM0jZ444Fc5vC5ROYurg/4Pw== + y18n@^3.2.1: version "3.2.1" resolved "https://registry.yarnpkg.com/y18n/-/y18n-3.2.1.tgz#6d15fba884c08679c0d77e88e7759e811e07fa41" +"y18n@^3.2.1 || ^4.0.0": + version "4.0.0" + resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.0.tgz#95ef94f85ecc81d007c264e190a120f0a3c8566b" + integrity sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w== + yallist@^2.1.2: version "2.1.2" resolved "https://registry.yarnpkg.com/yallist/-/yallist-2.1.2.tgz#1c11f9218f076089a47dd512f93c6699a6a81d52" +yallist@^3.0.0, yallist@^3.0.2: + version "3.0.3" + resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.0.3.tgz#b4b049e314be545e3ce802236d6cd22cd91c3de9" + integrity sha512-S+Zk8DEWE6oKpV+vI3qWkaK+jSbIK86pCwe2IF/xwIpQ8jEuxpw9NyaGjmp9+BoJv5FV2piqCDcoCtStppiq2A== + +yargs-parser@^11.1.1: + version "11.1.1" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-11.1.1.tgz#879a0865973bca9f6bab5cbdf3b1c67ec7d3bcf4" + integrity sha512-C6kB/WJDiaxONLJQnF8ccx9SEeoTTLek8RVbaOIsrAUS8VrBEXfmeSnCZxygc+XC2sNMBIwOOnfcxiynjHsVSQ== + dependencies: + camelcase "^5.0.0" + decamelize "^1.2.0" + yargs-parser@^7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-7.0.0.tgz#8d0ac42f16ea55debd332caf4c4038b3e3f5dfd9" @@ -2465,6 +4734,24 @@ yargs@11.1.0: y18n "^3.2.1" yargs-parser "^9.0.2" +yargs@^12.0.2: + version "12.0.5" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-12.0.5.tgz#05f5997b609647b64f66b81e3b4b10a368e7ad13" + integrity sha512-Lhz8TLaYnxq/2ObqHDql8dX8CJi97oHxrjUcYtzKbbykPtVW9WB+poxI+NM2UIzsMgNCZTIf0AQwsjK5yMAqZw== + dependencies: + cliui "^4.0.0" + decamelize "^1.2.0" + find-up "^3.0.0" + get-caller-file "^1.0.1" + os-locale "^3.0.0" + require-directory "^2.1.1" + require-main-filename "^1.0.1" + set-blocking "^2.0.0" + string-width "^2.0.0" + which-module "^2.0.0" + y18n "^3.2.1 || ^4.0.0" + yargs-parser "^11.1.1" + yargs@^8.0.2: version "8.0.2" resolved "https://registry.yarnpkg.com/yargs/-/yargs-8.0.2.tgz#6299a9055b1cefc969ff7e79c1d918dceb22c360" From f14d9f3b06d8ff811085747c1658af37d641511d Mon Sep 17 00:00:00 2001 From: baranga Date: Mon, 27 May 2019 10:17:37 +0200 Subject: [PATCH 03/61] Rewrite middleware layer --- src/middleware/document/add-tenant-id.js | 9 ++ src/middleware/document/add-tenant-id.test.js | 50 ++++++++++ src/middleware/index.js | 38 +++++++ .../query/protect-against-tenant-overwrite.js | 18 ++++ .../protect-against-tenant-overwrite.test.js | 99 +++++++++++++++++++ src/middleware/query/restrict-to-tenant.js | 7 ++ .../query/restrict-to-tenant.test.js | 58 +++++++++++ 7 files changed, 279 insertions(+) create mode 100644 src/middleware/document/add-tenant-id.js create mode 100644 src/middleware/document/add-tenant-id.test.js create mode 100644 src/middleware/index.js create mode 100644 src/middleware/query/protect-against-tenant-overwrite.js create mode 100644 src/middleware/query/protect-against-tenant-overwrite.test.js create mode 100644 src/middleware/query/restrict-to-tenant.js create mode 100644 src/middleware/query/restrict-to-tenant.test.js diff --git a/src/middleware/document/add-tenant-id.js b/src/middleware/document/add-tenant-id.js new file mode 100644 index 0000000..dc2998b --- /dev/null +++ b/src/middleware/document/add-tenant-id.js @@ -0,0 +1,9 @@ +// we need to return `function () {}` here so injection of `this` works +// properly +module.exports = ({tenantIdKey, tenantIdGetter}) => function (next) { + if (this.constructor.hasTenantContext) { + this[tenantIdKey] = this.constructor[tenantIdGetter](); + } + + next(); +}; diff --git a/src/middleware/document/add-tenant-id.test.js b/src/middleware/document/add-tenant-id.test.js new file mode 100644 index 0000000..272d8e3 --- /dev/null +++ b/src/middleware/document/add-tenant-id.test.js @@ -0,0 +1,50 @@ +const addTenantId = require('./add-tenant-id'); + +describe('add-tenant-id', () => { + const tenantId = '23'; + const tenantIdKey = 'tenantId'; + const tenantIdGetter = 'getTenantId'; + const options = { + tenantIdKey: 'tenantId', + tenantIdGetter: 'getTenantId', + }; + const middleware = addTenantId(options); + + describe('builds a document middleware', () => { + + describe('when called', () => { + it('calls back next', () => { + const next = jest.fn(); + middleware.call({}, next); + + expect(next).toHaveBeenCalled(); + }); + + describe('on schema with tenant context', () => { + const Schema = function () {}; + Schema.hasTenantContext = true; + Schema[tenantIdGetter] = () => tenantId; + + it('modifies the subject', () => { + const entity = new Schema(); + middleware.call(entity, () => {}); + + expect(entity).toHaveProperty(tenantIdKey, tenantId); + }); + }); + + describe('on schema without tenant context', () => { + const Schema = function () {}; + + it('doesn\'t modify the subject', () => { + const entity = new Schema(); + const snapshot = JSON.stringify(entity); + + middleware.call(entity, () => {}); + + expect(JSON.stringify(entity)).toBe(snapshot); + }); + }); + }); + }); +}); diff --git a/src/middleware/index.js b/src/middleware/index.js new file mode 100644 index 0000000..07e5e1b --- /dev/null +++ b/src/middleware/index.js @@ -0,0 +1,38 @@ +const buildAddTenantId = require('./document/add-tenant-id'); +const buildProtectAgainstTenantOverwrite = require('./query/protect-against-tenant-overwrite') +const buildRestrictToTenant = require('./query/restrict-to-tenant'); + +/** + * + * @param {object} schema + * @param {MongoTenantOptions} options + */ +const middleware = ({schema, options}) => { + const {tenantIdKey, tenantIdGetter} = options; + + const restrictToTenant = buildRestrictToTenant({tenantIdKey, tenantIdGetter}); + [ + 'count', + 'deleteMany', + 'deleteOne', + 'find', + 'findOne', + 'findOneAndDelete', + 'findOneAndRemove', + 'findOneAndUpdate', + 'remove', + 'update', + 'updateOne', + 'updateMany', + ].forEach((operation) => schema.pre(operation, restrictToTenant)); + + const protectedAgainstOverwrite = buildProtectAgainstTenantOverwrite({tenantIdKey, tenantIdGetter}); + [ + 'findOneAndUpdate', + 'update', + ].forEach((operation) => schema.pre(operation, protectedAgainstOverwrite)); + + schema.pre('save', buildAddTenantId({tenantIdKey, tenantIdGetter})); +}; + +module.exports = middleware; diff --git a/src/middleware/query/protect-against-tenant-overwrite.js b/src/middleware/query/protect-against-tenant-overwrite.js new file mode 100644 index 0000000..143fa36 --- /dev/null +++ b/src/middleware/query/protect-against-tenant-overwrite.js @@ -0,0 +1,18 @@ +module.exports = ({tenantIdKey, tenantIdGetter}) => function (next) { + if (this.model.hasTenantContext) { + const tenantId = this.model[tenantIdGetter](); + + // avoid jumping tenant context when overwriting a model. + if ((tenantIdKey in this._update) || this.options.overwrite) { + this._update[tenantIdKey] = tenantId; + } + + // avoid jumping tenant context from $set operations + const $set = this._update.$set; + if ($set && (tenantIdKey in $set) && $set[tenantIdKey] !== tenantId) { + $set[tenantIdKey] = tenantId; + } + } + + next(); +}; diff --git a/src/middleware/query/protect-against-tenant-overwrite.test.js b/src/middleware/query/protect-against-tenant-overwrite.test.js new file mode 100644 index 0000000..c8f2db3 --- /dev/null +++ b/src/middleware/query/protect-against-tenant-overwrite.test.js @@ -0,0 +1,99 @@ +const protectAgainstTenantOverwrite = require('./protect-against-tenant-overwrite'); + +const buildQuery = ({ + hasTenantContext, + tenantId, + tenantIdKey, + tenantIdGetter, + tenantIdUpdateValue, + isOverwrite = false +}) => ({ + _update: tenantIdUpdateValue + ? { [tenantIdKey]: tenantIdUpdateValue } + : {}, + options: { + overwrite: isOverwrite + }, + model: hasTenantContext + ? { + hasTenantContext, + [tenantIdGetter]: () => tenantId, + } + : {} +}); + +describe('protect-against-tenant-overwrite', () => { + describe('builds a query middleware', () => { + const tenantId = '23'; + const tenantIdKey = 'tenantId'; + const tenantIdGetter = 'getTenantId'; + const options = { + tenantIdKey: 'tenantId', + tenantIdGetter: 'getTenantId', + }; + const middleware = protectAgainstTenantOverwrite(options); + + let query; + beforeEach(() => { + query = buildQuery({ + hasTenantContext: true, + tenantId, + tenantIdKey, + tenantIdGetter, + }); + }); + + describe('when called', () => { + it('calls back next', () => { + const next = jest.fn(); + middleware.call(query, next); + + expect(next).toHaveBeenCalled(); + }); + + describe('on schema with tenant context', () => { + it('leaves query untouched when tenantId is not part of change', () => { + const query = buildQuery({hasTenantContext: false}); + const snapshot = JSON.stringify(query); + middleware.call(query, () => {}); + expect(JSON.stringify(query)).toBe(snapshot); + }); + + it('leaves query untouched when tenantId is part of change but has same value', () => { + const query = buildQuery({hasTenantContext: false}); + const snapshot = JSON.stringify(query); + middleware.call(query, () => {}); + expect(JSON.stringify(query)).toBe(snapshot); + }); + + it('updates tenantId value if it is part of change with different value', () => { + query = buildQuery({hasTenantContext: true, tenantId, tenantIdKey, tenantIdGetter, tenantIdUpdateValue: '42'}); + middleware.call(query, () => {}); + expect(query).toHaveProperty(`_update.${tenantIdKey}`, tenantId); + }); + + it('updates tenantId value if it is part of change with different value ($set)', () => { + query = buildQuery({hasTenantContext: true, tenantId, tenantIdKey, tenantIdGetter}); + query._update.$set = { [tenantIdKey]: '42' }; + middleware.call(query, () => {}); + expect(query).toHaveProperty(`_update.$set.${tenantIdKey}`, tenantId); + }); + + it('sets tenantId value if it is missing in an overwrite', () => { + query = buildQuery({hasTenantContext: true, tenantId, tenantIdKey, tenantIdGetter, isOverwrite: true}); + middleware.call(query, () => {}); + expect(query).toHaveProperty(`_update.${tenantIdKey}`, tenantId); + }); + }); + + describe('on schema without tenant context', () => { + it('doesn\'t modifies the query', () => { + const query = buildQuery({hasTenantContext: false}); + const snapshot = JSON.stringify(query); + middleware.call(query, () => {}); + expect(JSON.stringify(query)).toBe(snapshot); + }); + }); + }); + }); +}); diff --git a/src/middleware/query/restrict-to-tenant.js b/src/middleware/query/restrict-to-tenant.js new file mode 100644 index 0000000..d267caf --- /dev/null +++ b/src/middleware/query/restrict-to-tenant.js @@ -0,0 +1,7 @@ +module.exports = ({tenantIdKey, tenantIdGetter}) => function (next) { + if (this.model.hasTenantContext) { + this._conditions[tenantIdKey] = this.model[tenantIdGetter](); + } + + next(); +}; diff --git a/src/middleware/query/restrict-to-tenant.test.js b/src/middleware/query/restrict-to-tenant.test.js new file mode 100644 index 0000000..95a2d21 --- /dev/null +++ b/src/middleware/query/restrict-to-tenant.test.js @@ -0,0 +1,58 @@ +const restrictToTenant = require('./restrict-to-tenant'); + +const buildQuery = ({hasTenantContext, tenantIdGetter, tenantId}) => ({ + _conditions: {}, + model: hasTenantContext + ? { + hasTenantContext, + [tenantIdGetter]: () => tenantId, + } + : {} +}); + +describe('restrict-to-tenant', () => { + describe('builds a query middleware', () => { + const tenantId = '23'; + const tenantIdKey = 'tenantId'; + const tenantIdGetter = 'getTenantId'; + const options = { + tenantIdKey: 'tenantId', + tenantIdGetter: 'getTenantId', + }; + const middleware = restrictToTenant(options); + + let query; + beforeEach(() => { + query = buildQuery({ + hasTenantContext: true, + tenantIdGetter, + tenantId + }); + }); + + describe('when called', () => { + it('calls back next', () => { + const next = jest.fn(); + middleware.call(query, next); + + expect(next).toHaveBeenCalled(); + }); + + describe('on schema with tenant context', () => { + it('adds the tenant id to the query conditions', () => { + middleware.call(query, () => {}); + expect(query).toHaveProperty(`_conditions.${tenantIdKey}`, tenantId); + }); + }); + + describe('on schema without tenant context', () => { + it('doesn\'t modifies the query', () => { + const query = buildQuery({hasTenantContext: false}); + const snapshot = JSON.stringify(query); + middleware.call(query, () => {}); + expect(JSON.stringify(query)).toBe(snapshot); + }); + }); + }); + }); +}); From c1e2d156e1c2e90354fc780ccf9b1203bc565153 Mon Sep 17 00:00:00 2001 From: baranga Date: Tue, 4 Jun 2019 09:34:15 +0200 Subject: [PATCH 04/61] Rewrite api middleware layer --- src/api/are-plugins-compatible.js | 29 +++ src/api/are-plugins-compatible.test.js | 27 +++ src/api/index.js | 27 +++ src/api/tenant-aware-db.js | 25 +++ src/api/tenant-aware-db.test.js | 57 ++++++ src/api/tenant-aware-model-cache.js | 13 ++ src/api/tenant-aware-model-cache.test.js | 44 +++++ src/api/tenant-aware-model.js | 177 ++++++++++++++++++ src/api/tenant-aware-model.test.js | 220 +++++++++++++++++++++++ 9 files changed, 619 insertions(+) create mode 100644 src/api/are-plugins-compatible.js create mode 100644 src/api/are-plugins-compatible.test.js create mode 100644 src/api/index.js create mode 100644 src/api/tenant-aware-db.js create mode 100644 src/api/tenant-aware-db.test.js create mode 100644 src/api/tenant-aware-model-cache.js create mode 100644 src/api/tenant-aware-model-cache.test.js create mode 100644 src/api/tenant-aware-model.js create mode 100644 src/api/tenant-aware-model.test.js diff --git a/src/api/are-plugins-compatible.js b/src/api/are-plugins-compatible.js new file mode 100644 index 0000000..eed5023 --- /dev/null +++ b/src/api/are-plugins-compatible.js @@ -0,0 +1,29 @@ +/** + * Check if something looks like options + * @param {MongoTenantOptions} options + * @returns {boolean} + */ +const isPluginOptions = (options) => ( + options && + options.accessorMethod && + options.tenantIdKey && + true +); +/** + * Checks if instance is compatible to other plugin instance + * + * For population of referenced models it's necessary to detect if the tenant + * plugin installed in these models is compatible to the plugin of the host + * model. If they are compatible they are one the same "level". + * + * @param {MongoTenantOptions} a + * @param {MongoTenantOptions} b + * @returns {boolean} + */ +module.exports = (a, b) => { + return ( + isPluginOptions(a) && + isPluginOptions(b) && + a.tenantIdKey === b.tenantIdKey + ); +}; diff --git a/src/api/are-plugins-compatible.test.js b/src/api/are-plugins-compatible.test.js new file mode 100644 index 0000000..a6467ad --- /dev/null +++ b/src/api/are-plugins-compatible.test.js @@ -0,0 +1,27 @@ +const arePluginsCompatible = require('./are-plugins-compatible'); + +describe('are-plugins-compatible', () => { + describe('when called with proper plugin options', () => { + const options = { + accessorMethod: 'byTenant', + tenantIdKey: 'tenantId', + }; + + it('returns true if they have equal tenantIdKey\'s', () => { + const a = {...options}; + const b = {...options}; + const result = arePluginsCompatible(a, b); + expect(result).toBe(true); + }); + + it('returns false if they have different tenantIdKey\'s', () => { + const a = {...options}; + const b = { + ...options, + tenantIdKey: 'dimensionId', + }; + const result = arePluginsCompatible(a, b); + expect(result).toBe(false,); + }); + }); +}); diff --git a/src/api/index.js b/src/api/index.js new file mode 100644 index 0000000..274372d --- /dev/null +++ b/src/api/index.js @@ -0,0 +1,27 @@ +const buildModelCache = require('./tenant-aware-model-cache'); +const createTenantAwareModel = require('./tenant-aware-model'); + +/** + * @param schema + * @param {MongoTenantOptions} options + */ +module.exports = ({schema, options}) => { + const {accessorMethod} = options; + const cache = buildModelCache(); + + Object.assign(schema.statics, { + [accessorMethod]: function (tenantId) { + if (!cache.has(this.modelName, tenantId)) { + const base = this.model(this.modelName); + const model = createTenantAwareModel({base, tenantId}); + cache.set(this.modelName, tenantId, model); + } + return cache.get(this.modelName, tenantId); + }, + get mongoTenant() { + return {...options}; + } + }); + + return this; +}; diff --git a/src/api/tenant-aware-db.js b/src/api/tenant-aware-db.js new file mode 100644 index 0000000..5e1cbdd --- /dev/null +++ b/src/api/tenant-aware-db.js @@ -0,0 +1,25 @@ +const arePluginsCompatible = require('./are-plugins-compatible'); + +/** + * Create db connection bound to a specific tenant + * + * @param {Connection} db + * @param {*} tenantId + * @param {MongoTenantOptions} options + * @returns {Connection} + */ +module.exports = ({db, tenantId, options}) => { + const awareDb = Object.create(db); + awareDb.model = (name) => { + const unawareModel = db.model(name); + /** @type MongoTenantOptions */ + const otherPluginOptions = unawareModel.mongoTenant; + + if (!arePluginsCompatible(options, otherPluginOptions)) { + return unawareModel; + } + + return unawareModel[otherPluginOptions.accessorMethod](tenantId); + }; + return awareDb; +}; diff --git a/src/api/tenant-aware-db.test.js b/src/api/tenant-aware-db.test.js new file mode 100644 index 0000000..0bd579f --- /dev/null +++ b/src/api/tenant-aware-db.test.js @@ -0,0 +1,57 @@ +const createTenantAwareDb = require('./tenant-aware-db'); +const buildOptions = require('../options'); + +describe('tenant-aware-db', () => { + describe('when called with proper parameters', () => { + const tenantId = '23'; + const options = buildOptions(); + + it('overwrites the model method', () => { + const db = { + model: () => {}, + }; + const result = createTenantAwareDb({db, tenantId, options}); + expect(result).toHaveProperty('model'); + expect(result.model).toBeInstanceOf(Function); + expect(result.model).not.toBe(db.model); + }); + + it('returns a tenant aware model if compatible', () => { + const awareModel = { + hasTenantContext: true, + mongoTenant: {...options}, + }; + const unawareModel = { + [options.accessorMethod]: () => awareModel, + mongoTenant: {...options}, + }; + const db = { + model: () => unawareModel, + }; + + const awareDb = createTenantAwareDb({db, tenantId, options}); + const result = awareDb.model('test'); + + expect(result).toBe(awareModel); + }); + + it('returns a tenant unaware model if not compatible', () => { + const unawareModel = { + [options.accessorMethod]: () => { throw new Error; }, + mongoTenant: { + ...options, + tenantIdKey: 'dimension', + }, + }; + const db = { + model: () => unawareModel, + }; + + const awareDb = createTenantAwareDb({db, tenantId, options}); + const result = awareDb.model('test'); + + expect(result).toBe(unawareModel); + }); + }); +}); + diff --git a/src/api/tenant-aware-model-cache.js b/src/api/tenant-aware-model-cache.js new file mode 100644 index 0000000..f3d1428 --- /dev/null +++ b/src/api/tenant-aware-model-cache.js @@ -0,0 +1,13 @@ +module.exports = () => { + const cache = {}; + return { + has: (name, id) => (cache[name] && cache[name][id] && true || false), + get: (name, id) => (cache[name] && cache[name][id]), + set: (name, id, value) => { + cache[name] = { + ...(cache[name] || {}), + [id]: value, + }; + } + }; +}; diff --git a/src/api/tenant-aware-model-cache.test.js b/src/api/tenant-aware-model-cache.test.js new file mode 100644 index 0000000..f3a684d --- /dev/null +++ b/src/api/tenant-aware-model-cache.test.js @@ -0,0 +1,44 @@ +const buildTenantAwareModelCache = require('./tenant-aware-model-cache'); + +describe('tenant-aware-model-cache', () => { + describe('builds a cache that', () => { + it('returns a cached model', () => { + const model = {}; + const cache = buildTenantAwareModelCache(); + + cache.set('test', '23', model); + const result = cache.get('test', '23'); + + expect(result).toBe(model); + }); + + it('reports a stored model as cached', () => { + const model = {}; + const cache = buildTenantAwareModelCache(); + + cache.set('test', '23', model); + const result = cache.has('test', '23'); + + expect(result).toBe(true); + }); + + it('reports a unknown model as not cached', () => { + const cache = buildTenantAwareModelCache(); + + const result = cache.has('test', '23'); + + expect(result).toBe(false); + }); + + it('reports a unknown tenant as not cached', () => { + const model = {}; + const cache = buildTenantAwareModelCache(); + + cache.set('test', '23', model); + const result = cache.has('test', '42'); + + expect(result).toBe(false); + }); + }); +}); + diff --git a/src/api/tenant-aware-model.js b/src/api/tenant-aware-model.js new file mode 100644 index 0000000..fa5f1cd --- /dev/null +++ b/src/api/tenant-aware-model.js @@ -0,0 +1,177 @@ +const createTenantAwareDb = require('./tenant-aware-db'); + +const createPlainModel = ({ + base, + db, + tenantId, + tenantIdGetter, + tenantIdKey, +}) => (class extends base { + static get hasTenantContext() { + return true; + } + + static [tenantIdGetter]() { + return tenantId; + } + + /** + * @see Mongoose.Model.aggregate + * @param {...Object|Array} [operations] aggregation pipeline operator(s) or operator array + * @param {Function} [callback] + * @return {Mongoose.Aggregate|Promise} + */ + static aggregate() { + // possible structure of arguments: + // - [] - nothing + // - [{...}] - single pipeline (4.x) + // - [{...}, fn] - single pipeline with callback (4.x) + // - [{...}, {...}] - multiple pipelines (4.x) + // - [{...}, {...}, fn] - multiple pipelines with callback (4.x) + // - [[{...}]] - list of pipelines + // - [[{...}], fn] - list of pipelines with callback + + const argumentsAsArray = Array.prototype.slice.call(arguments); + + let callback = undefined; + if (typeof argumentsAsArray[argumentsAsArray.length - 1] === 'function') { + callback = argumentsAsArray.pop(); + } + + const pipeline = + argumentsAsArray.length === 1 && Array.isArray(argumentsAsArray[0]) + ? argumentsAsArray[0] + : argumentsAsArray; + + pipeline.unshift({ + $match: { + [tenantIdKey]: this[tenantIdGetter]() + } + }); + + return super.aggregate.call(this, pipeline, callback); + } + + static deleteOne(conditions, callback) { + conditions[tenantIdKey] = this[tenantIdGetter](); + + return super.deleteOne(conditions, callback); + } + + static deleteMany(conditions, options, callback) { + conditions[tenantIdKey] = this[tenantIdGetter](); + + return super.deleteMany(conditions, options, callback); + } + + static remove(conditions, callback) { + if (arguments.length === 1 && typeof conditions === 'function') { + callback = conditions; + conditions = {}; + } + + if (conditions) { + conditions[tenantIdKey] = this[tenantIdGetter](); + } + + return super.remove(conditions, callback); + } + + static insertMany(docs, callback) { + const self = this; + const tenantId = this[tenantIdGetter](); + + // Model.inserMany supports a single document as parameter + if (!Array.isArray(docs)) { + docs[tenantIdKey] = tenantId; + } else { + docs.forEach((doc) => { + doc[tenantIdKey] = tenantId; + }); + } + + // ensure the returned docs are instanced of the bound multi tenant model + return super.insertMany(docs, (err, docs) => { + if (err) { + return callback && callback(err); + } + + return callback && callback(null, docs.map(doc => new self(doc))); + }); + } + + static get db() { + return db; + } + + get hasTenantContext() { + return true; + } + + [tenantIdGetter]() { + return tenantId; + } +}); + +const inheritOtherStatics = ({model, base}) => { + Object.getOwnPropertyNames(base) + .filter((staticProperty) => ( + !model.hasOwnProperty(staticProperty) && + !['arguments', 'caller'].includes(staticProperty) + )) + .forEach((staticProperty) => { + const descriptor = Object.getOwnPropertyDescriptor(base, staticProperty); + Object.defineProperty(model, staticProperty, descriptor); + }); +}; + +const createDiscriminatorModels = ({model, base, createModel}) => { + if (!base.discriminators) { + return; + } + + model.discriminators = Object.entries(base.discriminators).reduce( + (discriminators, [key, discriminatorModel]) => { + discriminators[key] = createModel(discriminatorModel); + return discriminators; + }, + {} + ); +}; + +const createModel = ({base, db, tenantId, tenantIdGetter, tenantIdKey, createModel}) => { + const model = createPlainModel({ + base, + db, + tenantId, + tenantIdGetter, + tenantIdKey, + }); + + inheritOtherStatics({model, base}); + createDiscriminatorModels({model, base, createModel}); + + return model; +}; + +module.exports = ({base, tenantId, tenantIdGetter, tenantIdKey }) => { + const db = createTenantAwareDb({ + db: base.db, + tenantId, + options: {tenantIdGetter, tenantIdKey}, + }); + + const config = { + db, + tenantId, + tenantIdGetter, + tenantIdKey + }; + const create = (base) => createModel({ + base, + ...config, + }); + config.createModel = create; + + return create(base); +}; diff --git a/src/api/tenant-aware-model.test.js b/src/api/tenant-aware-model.test.js new file mode 100644 index 0000000..86fe0c7 --- /dev/null +++ b/src/api/tenant-aware-model.test.js @@ -0,0 +1,220 @@ +const tenantAwareModel = require('./tenant-aware-model'); +const options = require('../options'); + +describe('tenant-aware-model', () => { + + describe('when called with valid parameters', () => { + const tenantId = '23'; + const tenantIdGetter = 'getTenantId'; + const tenantIdKey = 'tenantId'; + + const buildBaseModel = () => { + const base = class {}; + base.db = {}; + return base; + }; + + let base; + let model; + beforeEach(() => { + base = buildBaseModel(); + model = tenantAwareModel({base, tenantId, tenantIdGetter, tenantIdKey}); + }); + + it('builds a model', () => { + expect(model).toBeTruthy(); + expect(model).not.toBe(base); + }); + + it('builds discriminator models', () => { + base.discriminators = { + 'test': class {}, + }; + model = tenantAwareModel({base, tenantId, tenantIdGetter, tenantIdKey}); + expect(model).toHaveProperty('discriminators.test'); + expect(model.discriminators.test).not.toBe(base.discriminators.test); + }); + + describe('returns a model that', () => { + const callback = () => {}; + + it('reports having a tenant context', () => { + const result = model.hasTenantContext; + + expect(result).toBe(true); + }); + + it('reports bound tenant id', () => { + const result = model[tenantIdGetter](); + + expect(result).toBe(tenantId); + }); + + it('has a tenant aware db model', () => { + expect(model.db).not.toBe(base.db); + }); + + describe('overrides static aggregate which', () => { + beforeEach(() => { + base.aggregate = jest.fn(); + }); + + // mongoose 4.x + it('applies tenant context to single pipeline', () => { + model.aggregate({$project: {a: 1}}); + expect(base.aggregate).toHaveBeenCalled(); + expect(base.aggregate.mock.calls[0][0]).toEqual([ + {$match: {[tenantIdKey]: tenantId}}, + {$project: {a: 1}}, + ]); + }); + + // mongoose 4.x + it('applies tenant context to multi pipeline', () => { + model.aggregate({$project: {a: 1}}, {$skip: 5}); + expect(base.aggregate).toHaveBeenCalled(); + expect(base.aggregate.mock.calls[0][0]).toEqual([ + {$match: {[tenantIdKey]: tenantId}}, + {$project: {a: 1}}, + {$skip: 5}, + ]); + }); + + it('applies tenant context to pipeline list', () => { + model.aggregate([{$project: {a: 1}}, {$skip: 5}]); + expect(base.aggregate).toHaveBeenCalled(); + expect(base.aggregate.mock.calls[0][0]).toEqual([ + {$match: {[tenantIdKey]: tenantId}}, + {$project: {a: 1}}, + {$skip: 5}, + ]); + }); + + it('applies tenant context to aggregate builder', () => { + model.aggregate(); + expect(base.aggregate).toHaveBeenCalled(); + expect(base.aggregate.mock.calls[0][0]).toEqual([ + {$match: {[tenantIdKey]: tenantId}} + ]); + }); + + it('forwards given callback', () => { + const callback = () => {}; + model.aggregate([], callback); + expect(base.aggregate).toHaveBeenCalled(); + expect(base.aggregate.mock.calls[0][1]).toBe(callback); + }); + }); + + it('applies tenant context in deleteOne', () => { + base.deleteOne = jest.fn(); + model.deleteOne({}, undefined); + + expect(base.deleteOne).toHaveBeenCalledWith( + {[tenantIdKey]: tenantId}, + undefined + ); + }); + + it('applies tenant context in deleteMany', () => { + base.deleteMany = jest.fn(); + model.deleteMany({}, {}, undefined); + + expect(base.deleteMany).toHaveBeenCalledWith( + {[tenantIdKey]: tenantId}, + {}, + undefined + ); + }); + + describe('overrides static remove which', () => { + it.each([ + ['just with conditions', [{foo: 'bar'}], [{foo: 'bar', [tenantIdKey]: tenantId}, undefined]], + ['with conditions and callback', [{foo: 'bar'}, callback], [{foo: 'bar', [tenantIdKey]: tenantId}, callback]], + ])('applies tenant context when called %s', (name, args, expectedBaseArgs) => { + base.remove = jest.fn(); + model.remove(...args); + + expect(base.remove).toHaveBeenCalledWith(...expectedBaseArgs); + }); + + it.each([ + ['without any arguments', [], [undefined, undefined]], + ['just with callback', [callback], [{[tenantIdKey]: tenantId}, callback]], + ])('does not apply tenant context when called %s', (name, args, expectedBaseArgs) => { + base.remove = jest.fn(); + model.remove(...args); + + expect(base.remove).toHaveBeenCalledWith(...expectedBaseArgs); + }); + }); + + describe('overrides static insertMany which', () => { + it('applies tenant context on single document', () => { + base.insertMany = jest.fn(); + model.insertMany({}, undefined); + + expect(base.insertMany).toHaveBeenCalledTimes(1); + expect(base.insertMany.mock.calls[0][0]).toEqual({[tenantIdKey]: tenantId}); + }); + + it('applies tenant context on multiple documents', () => { + base.insertMany = jest.fn(); + model.insertMany([{}], undefined); + + expect(base.insertMany).toHaveBeenCalledTimes(1); + expect(base.insertMany.mock.calls[0][0]).toEqual([{[tenantIdKey]: tenantId}]); + }); + + it('builds tenant aware models for callback', done => { + base.insertMany = (docs, callback) => { + callback(null, docs); + }; + const newDoc = new model(); + model.insertMany([newDoc], (err, docs) => { + expect(err).toBe(null); + expect(docs).toHaveLength(1); + + const savedDoc = docs[0]; + expect(savedDoc).toBeInstanceOf(model); + expect(savedDoc.hasTenantContext).toBe(true); + expect(savedDoc[tenantIdGetter]()).toBe(tenantId); + + done(); + }); + }); + + it('forwards errors', (done) => { + const expectedError = new Error('test'); + base.insertMany = (docs, callback) => { + callback(expectedError); + }; + model.insertMany([], (err, docs) => { + expect(err).toBe(expectedError); + expect(docs).toBe(undefined); + done(); + }); + }); + }); + + describe('when instanciated', () => { + let instance; + beforeEach(() => { + instance = new model(); + }); + + it('reports having a tenant context', () => { + const result = instance.hasTenantContext; + + expect(result).toBe(true); + }); + + it('reports bound tenant id', () => { + const result = instance[tenantIdGetter](); + + expect(result).toBe(tenantId); + }); + }); + }); + }); +}); From f4758d8a76c09d78c5273117f8d1eabd5bc56a8e Mon Sep 17 00:00:00 2001 From: baranga Date: Tue, 4 Jun 2019 09:39:00 +0200 Subject: [PATCH 05/61] Add options builder --- src/options.js | 28 ++++++++++++++++++++++++++++ src/options.test.js | 21 +++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 src/options.js create mode 100644 src/options.test.js diff --git a/src/options.js b/src/options.js new file mode 100644 index 0000000..2d1f8fa --- /dev/null +++ b/src/options.js @@ -0,0 +1,28 @@ +/** + * @typedef MongoTenantOptions + * @property {string} tenantIdGetter + * @property {string} accessorMethod + * @property {*} tenantIdType + * @property {string} tenantIdKey + * @property {boolean} requireTenantId + */ + +/** + * Sanitize plugin options + * @param {object} [input] + * @param {string} [input.tenantIdGetter=tenantId] + * @param {string} [input.accessorMethod=String] + * @param {*} [input.tenantIdType=byTenant] + * @param {string} [input.tenantIdKey=getTenantId] + * @param {string} [input.requireTenantId=true] + * @returns {MongoTenantOptions} + */ +const options = (input = {}) => ({ + tenantIdKey: input.tenantIdKey || 'tenantId', + tenantIdType: input.tenantIdType || String, + accessorMethod: input.accessorMethod || 'byTenant', + tenantIdGetter: input.tenantIdGetter || 'getTenantId', + requireTenantId: input.requireTenantId === true, +}); + +module.exports = options; diff --git a/src/options.test.js b/src/options.test.js new file mode 100644 index 0000000..6081339 --- /dev/null +++ b/src/options.test.js @@ -0,0 +1,21 @@ +const options = require('./options'); + +describe('options', () => { + const assertCompleteOptions = (value) => { + expect(value).toHaveProperty('tenantIdKey'); + expect(value).toHaveProperty('tenantIdType'); + expect(value).toHaveProperty('accessorMethod'); + expect(value).toHaveProperty('tenantIdGetter'); + expect(value).toHaveProperty('requireTenantId'); + }; + + it('creates default options', () => { + const result = options(); + assertCompleteOptions(result); + }); + + it('adds default option values', () => { + const result = options({tenantIdKey: 'tenant_id'}); + assertCompleteOptions(result); + }); +}); From 749ac46c0acaca3c79fafec1dbf2248d61a7324c Mon Sep 17 00:00:00 2001 From: baranga Date: Wed, 19 Jun 2019 09:36:03 +0200 Subject: [PATCH 06/61] Rewrite schema middleware layer --- src/schema/add-tenant-id-field.js | 11 ++ src/schema/add-tenant-id-field.test.js | 19 ++++ src/schema/compound-indexes.js | 66 ++++++++++++ src/schema/compound-indexes.test.js | 137 +++++++++++++++++++++++++ src/schema/index.js | 20 ++++ 5 files changed, 253 insertions(+) create mode 100644 src/schema/add-tenant-id-field.js create mode 100644 src/schema/add-tenant-id-field.test.js create mode 100644 src/schema/compound-indexes.js create mode 100644 src/schema/compound-indexes.test.js create mode 100644 src/schema/index.js diff --git a/src/schema/add-tenant-id-field.js b/src/schema/add-tenant-id-field.js new file mode 100644 index 0000000..e6aac5c --- /dev/null +++ b/src/schema/add-tenant-id-field.js @@ -0,0 +1,11 @@ +module.exports = ({schema, key, type, required}) => { + const field = { + [key]: { + index: true, + type: type, + required: required, + } + }; + + schema.add(field); +}; diff --git a/src/schema/add-tenant-id-field.test.js b/src/schema/add-tenant-id-field.test.js new file mode 100644 index 0000000..c70ade7 --- /dev/null +++ b/src/schema/add-tenant-id-field.test.js @@ -0,0 +1,19 @@ +const addTenantIdField = require('./add-tenant-id-field'); + +describe('add-tenant-id-field', () => { + describe('when called with valid parameters', () => { + it('adds a field for tenant id', () => { + const schema = { + add: jest.fn(), + }; + addTenantIdField({schema, key: 'tenantId', type: String, required: true}); + expect(schema.add).toBeCalledWith({ + tenantId: { + index: true, + type: String, + required: true, + } + }); + }); + }); +}); diff --git a/src/schema/compound-indexes.js b/src/schema/compound-indexes.js new file mode 100644 index 0000000..0352674 --- /dev/null +++ b/src/schema/compound-indexes.js @@ -0,0 +1,66 @@ +/** + * Apply tenancy awareness to schema level unique indexes + * @param {object} schema + * @param {string} tenantIdKey + */ +const compoundSchemaLevelUniqueIndexes = ({schema, tenantIdKey}) => { + schema._indexes.forEach((index) => { + // extend uniqueness of indexes by tenant id field + // skip if perserveUniqueKey of the index is set to true + if (index[1].unique === true && index[1].preserveUniqueKey !== true) { + const tenantAwareIndex = { + [tenantIdKey]: 1 + }; + + for (let indexedField in index[0]) { + tenantAwareIndex[indexedField] = index[0][indexedField]; + } + + index[0] = tenantAwareIndex; + } + }); +}; + +/** + * Apply tenancy awareness to field level unique indexes + * @param {object} schema + * @param {string} tenantIdKey + */ +const compoundFieldLevelUniqueIndexes = ({schema, tenantIdKey}) => { + schema.eachPath((key, path) => { + const pathOptions = path.options; + + // skip if preserveUniqueKey of an unique field is set to true + if (pathOptions.unique === true && pathOptions.preserveUniqueKey !== true) { + // delete the old index + path._index = null; + delete path.options.unique; + + // prepare new options + let indexOptions = { + unique: true + }; + + // add sparse option if set in options + if (pathOptions.sparse) { + indexOptions.sparse = true; + } + + // add partialFilterExpression option if set in options + if (pathOptions.partialFilterExpression) { + indexOptions.partialFilterExpression = pathOptions.partialFilterExpression; + } + + // create a new one that includes the tenant id field + schema.index({ + [tenantIdKey]: 1, + [key]: 1 + }, indexOptions); + } + }); +}; + +module.exports = ({schema, tenantIdKey}) => { + compoundSchemaLevelUniqueIndexes({schema, tenantIdKey}); + compoundFieldLevelUniqueIndexes({schema, tenantIdKey}); +}; diff --git a/src/schema/compound-indexes.test.js b/src/schema/compound-indexes.test.js new file mode 100644 index 0000000..5f4368e --- /dev/null +++ b/src/schema/compound-indexes.test.js @@ -0,0 +1,137 @@ +const compoundIndexes = require('./compound-indexes'); +const {Schema} = require('mongoose'); + +describe('compound-indexes', () => { + describe('when called with valid parameters', () => { + const tenantIdKey = 'tenantId'; + + describe('where schema has schema level index', () => { + let schema; + beforeEach(() => { + schema = new Schema({ + id: String, + }); + }); + + describe('and index is unique', () => { + + describe('with unique key preservation disabled', () => { + it('compounds the index', () => { + schema.index({id: 1}, {unique: true, preserveUniqueKey: false}); + compoundIndexes({schema, tenantIdKey}); + expect(schema.indexes()).toEqual([ + [ + {id: 1, [tenantIdKey]: 1}, + {unique: true, preserveUniqueKey: false, background: true}, + ], + ]); + }); + }); + + describe('with unique key preservation enabled', () => { + it('does NOT compound the index', () => { + schema.index({id: 1}, {unique: true, preserveUniqueKey: true}); + compoundIndexes({schema, tenantIdKey}); + expect(schema.indexes()).toEqual([ + [ + {id: 1}, + {unique: true, preserveUniqueKey: true, background: true}, + ], + ]); + }); + }); + }); + + describe('and index is NOT unique', () => { + it('does NOT compounds the index', () => { + schema.index({id: 1}); + compoundIndexes({schema, tenantIdKey}); + expect(schema.indexes()).toEqual([ + [ + {id: 1}, + {background: true}, + ], + ]); + }); + }); + }); + + describe('where schema has field level index', () => { + describe('and index is unique', () => { + describe('with unique key preservation disabled', () => { + it('compounds the index', () => { + const schema = new Schema({ + id: { + type: String, + unique: true, + preserveUniqueKey: false, + }, + }); + compoundIndexes({schema, tenantIdKey}); + expect(schema.indexes()).toEqual([ + [ + {id: 1, [tenantIdKey]: 1}, + {unique: true, background: true}, + ], + ]); + }); + + it('adds other options to compound index', () => { + const schema = new Schema({ + id: { + type: String, + unique: true, + preserveUniqueKey: false, + sparse: true, + partialFilterExpression: {}, + }, + }); + compoundIndexes({schema, tenantIdKey}); + expect(schema.indexes()).toEqual([ + [ + {id: 1, [tenantIdKey]: 1}, + {unique: true, sparse: true, partialFilterExpression: {}, background: true}, + ], + ]); + }); + }); + + describe('with unique key preservation enabled', () => { + it('does NOT compound the index', () => { + const schema = new Schema({ + id: { + type: String, + unique: true, + preserveUniqueKey: true, + }, + }); + compoundIndexes({schema, tenantIdKey}); + expect(schema.indexes()).toEqual([ + [ + {id: 1}, + {unique: true, background: true}, + ], + ]); + }); + }); + }); + describe('and index is NOT unique', () => { + it('does NOT compound the index', () => { + const schema = new Schema({ + id: { + type: String, + index: true, + }, + }); + compoundIndexes({schema, tenantIdKey}); + expect(schema.indexes()).toEqual([ + [ + {id: 1}, + {background: true}, + ], + ]); + }); + }); + }); + }); +}); diff --git a/src/schema/index.js b/src/schema/index.js new file mode 100644 index 0000000..89d4dea --- /dev/null +++ b/src/schema/index.js @@ -0,0 +1,20 @@ +const addTenantIdField = require('./add-tenant-id-field'); +const compoundIndexes = require('./compound-indexes'); + +/** + * + * @param {object} schema + * @param {MongoTenantOptions} options + */ +const schema = ({schema, options}) => { + const {tenantIdKey, tenantIdType, requireTenantId} = options; + addTenantIdField({ + schema, + key: tenantIdKey, + type: tenantIdType, + required: requireTenantId, + }); + compoundIndexes({schema, tenantIdKey}); +}; + +module.exports = schema; From fa908493ac2187d719942c546b21cd2616c68c97 Mon Sep 17 00:00:00 2001 From: baranga Date: Wed, 19 Jun 2019 09:58:26 +0200 Subject: [PATCH 07/61] Add new entrypoint --- package.json | 2 +- src/index.js | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 src/index.js diff --git a/package.json b/package.json index 3e2a76e..4e8af7a 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ "coveralls": "coveralls < ./coverage/lcov.info", "validate-release-notes": "release-notes validate" }, - "main": "index.js", + "main": "src/index.js", "bugs": { "url": "https://github.com/craftup/node-mongo-tenant/issues" }, diff --git a/src/index.js b/src/index.js new file mode 100644 index 0000000..199b9d4 --- /dev/null +++ b/src/index.js @@ -0,0 +1,13 @@ +const sanitizeOptions = require('./options'); + +const extendSchema = require('./schema'); +const injectApi = require('./api'); +const installMiddleware = require('./middleware'); + +module.exports = function nodeMongoTenant(schema, options = {}) { + const sanitizedOptions = sanitizeOptions(options); + + extendSchema({schema, options: sanitizedOptions}); + injectApi({schema, options: sanitizedOptions}); + installMiddleware({schema, options: sanitizedOptions}); +}; From e5b59317c99db5f2f6dcd82ce62b1a43bb89e1e6 Mon Sep 17 00:00:00 2001 From: baranga Date: Wed, 19 Jun 2019 10:40:20 +0200 Subject: [PATCH 08/61] Add more api middleware layer tests --- src/api/index.test.js | 50 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 src/api/index.test.js diff --git a/src/api/index.test.js b/src/api/index.test.js new file mode 100644 index 0000000..f03608d --- /dev/null +++ b/src/api/index.test.js @@ -0,0 +1,50 @@ +const api = require('./index'); +const buildOptions = require('../options'); +const Mongoose = require('mongoose').Mongoose; +const Schema = require('mongoose').Schema; + +describe('api', () => { + describe('when called with valid params', () => { + let schema; + const options = buildOptions({accessorMethod: 'byTenant'}); + beforeEach(() => { + schema = new Schema({}); + api({schema, options}); + }); + + describe('adds static accessor method which', () => { + let model; + beforeEach(() => { + const mongoose = new Mongoose(); + model = mongoose.model('model', schema); + }); + + it('exists', () => { + expect(schema).toHaveProperty('statics.byTenant'); + expect(model).toHaveProperty('byTenant'); + }); + + it('when called returns new model which is not identical to base model', () => { + const tenantAwareModel = model.byTenant(1); + expect(tenantAwareModel).not.toBe(model); + }); + + it('when called twice for same tenant returns identical new models', () => { + const firstTenantAwareModel = model.byTenant(1); + const secondTenantAwareModel = model.byTenant(1); + expect(secondTenantAwareModel).toBe(firstTenantAwareModel); + }); + + it('when called for differen tenants returns different new models', () => { + const firstTenantAwareModel = model.byTenant(1); + const secondTenantAwareModel = model.byTenant(2); + expect(secondTenantAwareModel).not.toBe(firstTenantAwareModel); + }); + }); + + it('reports plugin options', () => { + expect(schema).toHaveProperty('statics.mongoTenant'); + expect(schema.statics.mongoTenant).toEqual(options) + }); + }); +}); From dedb56486c1412f03abf7f7c18e4e664f04d8eb8 Mon Sep 17 00:00:00 2001 From: baranga Date: Wed, 19 Jun 2019 10:40:48 +0200 Subject: [PATCH 09/61] Add some plugin level tests --- src/index.test.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 src/index.test.js diff --git a/src/index.test.js b/src/index.test.js new file mode 100644 index 0000000..ef55bbf --- /dev/null +++ b/src/index.test.js @@ -0,0 +1,23 @@ +const plugin = require('./index'); +const Schema = require('mongoose').Schema; + +describe('plugin', () => { + describe('applied to schema', () => { + let schema; + beforeEach(() => { + schema = new Schema({}); + }); + + describe('with options', () => { + it('does not fail', () => { + schema.plugin(plugin, {}); + }); + }); + + describe('without options', () => { + it('does not fail', () => { + schema.plugin(plugin); + }); + }); + }); +}); From 58e88cb82cab634998c343126709d1dd1dd0716d Mon Sep 17 00:00:00 2001 From: baranga Date: Wed, 19 Jun 2019 10:42:04 +0200 Subject: [PATCH 10/61] Add empty unit test suites to include all files in coverage --- src/middleware/index.test.js | 5 +++++ src/schema/index.test.js | 5 +++++ 2 files changed, 10 insertions(+) create mode 100644 src/middleware/index.test.js create mode 100644 src/schema/index.test.js diff --git a/src/middleware/index.test.js b/src/middleware/index.test.js new file mode 100644 index 0000000..cd971a0 --- /dev/null +++ b/src/middleware/index.test.js @@ -0,0 +1,5 @@ +const middleware = require('./index'); + +describe('middleware', () => { + it.skip('needs tests', () => {}); +}); diff --git a/src/schema/index.test.js b/src/schema/index.test.js new file mode 100644 index 0000000..a4ec250 --- /dev/null +++ b/src/schema/index.test.js @@ -0,0 +1,5 @@ +const schema = require('./index'); + +describe('schema', () => { + it.skip('needs tests', () => {}); +}); From af75cb90f66bf0bec491f7647271e002ba58cdde Mon Sep 17 00:00:00 2001 From: baranga Date: Wed, 19 Jun 2019 10:43:03 +0200 Subject: [PATCH 11/61] Fix documentation of default value --- src/options.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/options.js b/src/options.js index 2d1f8fa..6d75576 100644 --- a/src/options.js +++ b/src/options.js @@ -11,7 +11,7 @@ * Sanitize plugin options * @param {object} [input] * @param {string} [input.tenantIdGetter=tenantId] - * @param {string} [input.accessorMethod=String] + * @param {string} [input.accessorMethod=byTenant] * @param {*} [input.tenantIdType=byTenant] * @param {string} [input.tenantIdKey=getTenantId] * @param {string} [input.requireTenantId=true] From 9eed2cea61f1ffd93e39c95a3205896fb63363e8 Mon Sep 17 00:00:00 2001 From: baranga Date: Wed, 19 Jun 2019 12:03:13 +0200 Subject: [PATCH 12/61] Fix hinting --- .jshintrc | 2 +- package.json | 2 +- yarn.lock | 15 ++++++--------- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/.jshintrc b/.jshintrc index fdbab86..e54a7d0 100644 --- a/.jshintrc +++ b/.jshintrc @@ -1,5 +1,5 @@ { - "esversion": 6, + "esversion": 9, "node": true, "laxbreak": true } diff --git a/package.json b/package.json index 4e8af7a..db6ce12 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ "@release-notes/cli": "^0.1.0", "coveralls": "^3.0.0", "jest": "^24.8.0", - "jshint": "^2.9.5", + "jshint": "^2.10.2", "mongodb": "^2.2.35", "mongoose": "^5.0.11", "nyc": "^11.6.0" diff --git a/yarn.lock b/yarn.lock index 04bc29d..d97ef52 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2620,15 +2620,16 @@ jsesc@^2.5.1: resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-2.5.2.tgz#80564d2e483dacf6e8ef209650a67df3f0c283a4" integrity sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA== -jshint@^2.9.5: - version "2.9.5" - resolved "https://registry.yarnpkg.com/jshint/-/jshint-2.9.5.tgz#1e7252915ce681b40827ee14248c46d34e9aa62c" +jshint@^2.10.2: + version "2.10.2" + resolved "https://registry.yarnpkg.com/jshint/-/jshint-2.10.2.tgz#ed6626c4f8223c98e94aaea62767435427a49a3d" + integrity sha512-e7KZgCSXMJxznE/4WULzybCMNXNAd/bf5TSrvVEq78Q/K8ZwFpmBqQeDtNiHc3l49nV4E/+YeHU/JZjSUIrLAA== dependencies: cli "~1.0.0" console-browserify "1.1.x" exit "0.1.x" htmlparser2 "3.8.x" - lodash "3.7.x" + lodash "~4.17.11" minimatch "~3.0.2" shelljs "0.3.x" strip-json-comments "1.0.x" @@ -2792,15 +2793,11 @@ lodash.sortby@^4.7.0: resolved "https://registry.yarnpkg.com/lodash.sortby/-/lodash.sortby-4.7.0.tgz#edd14c824e2cc9c1e0b0a1b42bb5210516a42438" integrity sha1-7dFMgk4sycHgsKG0K7UhBRakJDg= -lodash@3.7.x: - version "3.7.0" - resolved "https://registry.yarnpkg.com/lodash/-/lodash-3.7.0.tgz#3678bd8ab995057c07ade836ed2ef087da811d45" - lodash@^4.14.0, lodash@^4.17.4: version "4.17.5" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.5.tgz#99a92d65c0272debe8c96b6057bc8fbfa3bed511" -lodash@^4.17.11: +lodash@^4.17.11, lodash@~4.17.11: version "4.17.11" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.11.tgz#b39ea6229ef607ecd89e2c8df12536891cac9b8d" integrity sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg== From 6c05e160334f9ea0bc352166cd7e719aa7b0a258 Mon Sep 17 00:00:00 2001 From: baranga Date: Wed, 19 Jun 2019 12:06:44 +0200 Subject: [PATCH 13/61] Fix jshint issues --- src/api/index.test.js | 2 +- src/api/tenant-aware-db.test.js | 2 +- src/api/tenant-aware-model.js | 2 +- src/middleware/index.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/api/index.test.js b/src/api/index.test.js index f03608d..4a4f86e 100644 --- a/src/api/index.test.js +++ b/src/api/index.test.js @@ -44,7 +44,7 @@ describe('api', () => { it('reports plugin options', () => { expect(schema).toHaveProperty('statics.mongoTenant'); - expect(schema.statics.mongoTenant).toEqual(options) + expect(schema.statics.mongoTenant).toEqual(options); }); }); }); diff --git a/src/api/tenant-aware-db.test.js b/src/api/tenant-aware-db.test.js index 0bd579f..706c479 100644 --- a/src/api/tenant-aware-db.test.js +++ b/src/api/tenant-aware-db.test.js @@ -37,7 +37,7 @@ describe('tenant-aware-db', () => { it('returns a tenant unaware model if not compatible', () => { const unawareModel = { - [options.accessorMethod]: () => { throw new Error; }, + [options.accessorMethod]: () => { throw new Error(); }, mongoTenant: { ...options, tenantIdKey: 'dimension', diff --git a/src/api/tenant-aware-model.js b/src/api/tenant-aware-model.js index fa5f1cd..f712bec 100644 --- a/src/api/tenant-aware-model.js +++ b/src/api/tenant-aware-model.js @@ -33,7 +33,7 @@ const createPlainModel = ({ const argumentsAsArray = Array.prototype.slice.call(arguments); - let callback = undefined; + let callback; if (typeof argumentsAsArray[argumentsAsArray.length - 1] === 'function') { callback = argumentsAsArray.pop(); } diff --git a/src/middleware/index.js b/src/middleware/index.js index 07e5e1b..6d75ac7 100644 --- a/src/middleware/index.js +++ b/src/middleware/index.js @@ -1,5 +1,5 @@ const buildAddTenantId = require('./document/add-tenant-id'); -const buildProtectAgainstTenantOverwrite = require('./query/protect-against-tenant-overwrite') +const buildProtectAgainstTenantOverwrite = require('./query/protect-against-tenant-overwrite'); const buildRestrictToTenant = require('./query/restrict-to-tenant'); /** From 3c69811bbc566226ebfd15668029717ca13b8c1c Mon Sep 17 00:00:00 2001 From: baranga Date: Wed, 19 Jun 2019 12:22:51 +0200 Subject: [PATCH 14/61] Replace jshint with prettier --- .jshintignore | 2 - .jshintrc | 5 - .prettierrc | 5 + package.json | 6 +- src/api/are-plugins-compatible.js | 12 +- src/api/are-plugins-compatible.test.js | 6 +- src/api/index.js | 4 +- src/api/tenant-aware-db.js | 2 +- src/api/tenant-aware-db.test.js | 5 +- src/api/tenant-aware-model-cache.js | 6 +- src/api/tenant-aware-model-cache.test.js | 1 - src/api/tenant-aware-model.js | 206 ++++++++++++----------- src/api/tenant-aware-model.test.js | 63 ++++--- src/middleware/index.js | 14 +- src/schema/add-tenant-id-field.js | 2 +- src/schema/add-tenant-id-field.test.js | 2 +- src/schema/compound-indexes.js | 20 ++- src/schema/compound-indexes.test.js | 32 ++-- yarn.lock | 113 +------------ 19 files changed, 210 insertions(+), 296 deletions(-) delete mode 100644 .jshintignore delete mode 100644 .jshintrc create mode 100644 .prettierrc diff --git a/.jshintignore b/.jshintignore deleted file mode 100644 index 62562b7..0000000 --- a/.jshintignore +++ /dev/null @@ -1,2 +0,0 @@ -coverage -node_modules diff --git a/.jshintrc b/.jshintrc deleted file mode 100644 index e54a7d0..0000000 --- a/.jshintrc +++ /dev/null @@ -1,5 +0,0 @@ -{ - "esversion": 9, - "node": true, - "laxbreak": true -} diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..c0d494b --- /dev/null +++ b/.prettierrc @@ -0,0 +1,5 @@ +{ + "bracketSpacing": false, + "singleQuote": true, + "trailingComma": "es5" +} diff --git a/package.json b/package.json index db6ce12..99ef065 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "mongo" ], "scripts": { - "hint": "jshint .", + "hint": "prettier -c src/**/*.js", "test": "jest", "test-and-cover": "jest --coverage", "coveralls": "coveralls < ./coverage/lcov.info", @@ -35,10 +35,10 @@ "@release-notes/cli": "^0.1.0", "coveralls": "^3.0.0", "jest": "^24.8.0", - "jshint": "^2.10.2", "mongodb": "^2.2.35", "mongoose": "^5.0.11", - "nyc": "^11.6.0" + "nyc": "^11.6.0", + "prettier": "^1.18.2" }, "peerDependencies": { "mongoose": ">=4.3.0 <=4.8.0 || >=4.8.3" diff --git a/src/api/are-plugins-compatible.js b/src/api/are-plugins-compatible.js index eed5023..6c5a614 100644 --- a/src/api/are-plugins-compatible.js +++ b/src/api/are-plugins-compatible.js @@ -3,12 +3,8 @@ * @param {MongoTenantOptions} options * @returns {boolean} */ -const isPluginOptions = (options) => ( - options && - options.accessorMethod && - options.tenantIdKey && - true -); +const isPluginOptions = options => + options && options.accessorMethod && options.tenantIdKey && true; /** * Checks if instance is compatible to other plugin instance * @@ -22,8 +18,6 @@ const isPluginOptions = (options) => ( */ module.exports = (a, b) => { return ( - isPluginOptions(a) && - isPluginOptions(b) && - a.tenantIdKey === b.tenantIdKey + isPluginOptions(a) && isPluginOptions(b) && a.tenantIdKey === b.tenantIdKey ); }; diff --git a/src/api/are-plugins-compatible.test.js b/src/api/are-plugins-compatible.test.js index a6467ad..7b4acbc 100644 --- a/src/api/are-plugins-compatible.test.js +++ b/src/api/are-plugins-compatible.test.js @@ -7,21 +7,21 @@ describe('are-plugins-compatible', () => { tenantIdKey: 'tenantId', }; - it('returns true if they have equal tenantIdKey\'s', () => { + it("returns true if they have equal tenantIdKey's", () => { const a = {...options}; const b = {...options}; const result = arePluginsCompatible(a, b); expect(result).toBe(true); }); - it('returns false if they have different tenantIdKey\'s', () => { + it("returns false if they have different tenantIdKey's", () => { const a = {...options}; const b = { ...options, tenantIdKey: 'dimensionId', }; const result = arePluginsCompatible(a, b); - expect(result).toBe(false,); + expect(result).toBe(false); }); }); }); diff --git a/src/api/index.js b/src/api/index.js index 274372d..7c973d5 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -10,7 +10,7 @@ module.exports = ({schema, options}) => { const cache = buildModelCache(); Object.assign(schema.statics, { - [accessorMethod]: function (tenantId) { + [accessorMethod]: function(tenantId) { if (!cache.has(this.modelName, tenantId)) { const base = this.model(this.modelName); const model = createTenantAwareModel({base, tenantId}); @@ -20,7 +20,7 @@ module.exports = ({schema, options}) => { }, get mongoTenant() { return {...options}; - } + }, }); return this; diff --git a/src/api/tenant-aware-db.js b/src/api/tenant-aware-db.js index 5e1cbdd..712ee6b 100644 --- a/src/api/tenant-aware-db.js +++ b/src/api/tenant-aware-db.js @@ -10,7 +10,7 @@ const arePluginsCompatible = require('./are-plugins-compatible'); */ module.exports = ({db, tenantId, options}) => { const awareDb = Object.create(db); - awareDb.model = (name) => { + awareDb.model = name => { const unawareModel = db.model(name); /** @type MongoTenantOptions */ const otherPluginOptions = unawareModel.mongoTenant; diff --git a/src/api/tenant-aware-db.test.js b/src/api/tenant-aware-db.test.js index 706c479..26c4b04 100644 --- a/src/api/tenant-aware-db.test.js +++ b/src/api/tenant-aware-db.test.js @@ -37,7 +37,9 @@ describe('tenant-aware-db', () => { it('returns a tenant unaware model if not compatible', () => { const unawareModel = { - [options.accessorMethod]: () => { throw new Error(); }, + [options.accessorMethod]: () => { + throw new Error(); + }, mongoTenant: { ...options, tenantIdKey: 'dimension', @@ -54,4 +56,3 @@ describe('tenant-aware-db', () => { }); }); }); - diff --git a/src/api/tenant-aware-model-cache.js b/src/api/tenant-aware-model-cache.js index f3d1428..bfae541 100644 --- a/src/api/tenant-aware-model-cache.js +++ b/src/api/tenant-aware-model-cache.js @@ -1,13 +1,13 @@ module.exports = () => { const cache = {}; return { - has: (name, id) => (cache[name] && cache[name][id] && true || false), - get: (name, id) => (cache[name] && cache[name][id]), + has: (name, id) => (cache[name] && cache[name][id] && true) || false, + get: (name, id) => cache[name] && cache[name][id], set: (name, id, value) => { cache[name] = { ...(cache[name] || {}), [id]: value, }; - } + }, }; }; diff --git a/src/api/tenant-aware-model-cache.test.js b/src/api/tenant-aware-model-cache.test.js index f3a684d..91d298d 100644 --- a/src/api/tenant-aware-model-cache.test.js +++ b/src/api/tenant-aware-model-cache.test.js @@ -41,4 +41,3 @@ describe('tenant-aware-model-cache', () => { }); }); }); - diff --git a/src/api/tenant-aware-model.js b/src/api/tenant-aware-model.js index f712bec..281bb75 100644 --- a/src/api/tenant-aware-model.js +++ b/src/api/tenant-aware-model.js @@ -1,125 +1,121 @@ const createTenantAwareDb = require('./tenant-aware-db'); -const createPlainModel = ({ - base, - db, - tenantId, - tenantIdGetter, - tenantIdKey, -}) => (class extends base { - static get hasTenantContext() { - return true; - } - - static [tenantIdGetter]() { - return tenantId; - } - - /** - * @see Mongoose.Model.aggregate - * @param {...Object|Array} [operations] aggregation pipeline operator(s) or operator array - * @param {Function} [callback] - * @return {Mongoose.Aggregate|Promise} - */ - static aggregate() { - // possible structure of arguments: - // - [] - nothing - // - [{...}] - single pipeline (4.x) - // - [{...}, fn] - single pipeline with callback (4.x) - // - [{...}, {...}] - multiple pipelines (4.x) - // - [{...}, {...}, fn] - multiple pipelines with callback (4.x) - // - [[{...}]] - list of pipelines - // - [[{...}], fn] - list of pipelines with callback - - const argumentsAsArray = Array.prototype.slice.call(arguments); - - let callback; - if (typeof argumentsAsArray[argumentsAsArray.length - 1] === 'function') { - callback = argumentsAsArray.pop(); +const createPlainModel = ({base, db, tenantId, tenantIdGetter, tenantIdKey}) => + class extends base { + static get hasTenantContext() { + return true; } - const pipeline = - argumentsAsArray.length === 1 && Array.isArray(argumentsAsArray[0]) - ? argumentsAsArray[0] - : argumentsAsArray; + static [tenantIdGetter]() { + return tenantId; + } - pipeline.unshift({ - $match: { - [tenantIdKey]: this[tenantIdGetter]() + /** + * @see Mongoose.Model.aggregate + * @param {...Object|Array} [operations] aggregation pipeline operator(s) or operator array + * @param {Function} [callback] + * @return {Mongoose.Aggregate|Promise} + */ + static aggregate() { + // possible structure of arguments: + // - [] - nothing + // - [{...}] - single pipeline (4.x) + // - [{...}, fn] - single pipeline with callback (4.x) + // - [{...}, {...}] - multiple pipelines (4.x) + // - [{...}, {...}, fn] - multiple pipelines with callback (4.x) + // - [[{...}]] - list of pipelines + // - [[{...}], fn] - list of pipelines with callback + + const argumentsAsArray = Array.prototype.slice.call(arguments); + + let callback; + if (typeof argumentsAsArray[argumentsAsArray.length - 1] === 'function') { + callback = argumentsAsArray.pop(); } - }); - return super.aggregate.call(this, pipeline, callback); - } - - static deleteOne(conditions, callback) { - conditions[tenantIdKey] = this[tenantIdGetter](); + const pipeline = + argumentsAsArray.length === 1 && Array.isArray(argumentsAsArray[0]) + ? argumentsAsArray[0] + : argumentsAsArray; - return super.deleteOne(conditions, callback); - } + pipeline.unshift({ + $match: { + [tenantIdKey]: this[tenantIdGetter](), + }, + }); - static deleteMany(conditions, options, callback) { - conditions[tenantIdKey] = this[tenantIdGetter](); + return super.aggregate.call(this, pipeline, callback); + } - return super.deleteMany(conditions, options, callback); - } + static deleteOne(conditions, callback) { + conditions[tenantIdKey] = this[tenantIdGetter](); - static remove(conditions, callback) { - if (arguments.length === 1 && typeof conditions === 'function') { - callback = conditions; - conditions = {}; + return super.deleteOne(conditions, callback); } - if (conditions) { + static deleteMany(conditions, options, callback) { conditions[tenantIdKey] = this[tenantIdGetter](); + + return super.deleteMany(conditions, options, callback); } - return super.remove(conditions, callback); - } + static remove(conditions, callback) { + if (arguments.length === 1 && typeof conditions === 'function') { + callback = conditions; + conditions = {}; + } - static insertMany(docs, callback) { - const self = this; - const tenantId = this[tenantIdGetter](); + if (conditions) { + conditions[tenantIdKey] = this[tenantIdGetter](); + } - // Model.inserMany supports a single document as parameter - if (!Array.isArray(docs)) { - docs[tenantIdKey] = tenantId; - } else { - docs.forEach((doc) => { - doc[tenantIdKey] = tenantId; - }); + return super.remove(conditions, callback); } - // ensure the returned docs are instanced of the bound multi tenant model - return super.insertMany(docs, (err, docs) => { - if (err) { - return callback && callback(err); + static insertMany(docs, callback) { + const self = this; + const tenantId = this[tenantIdGetter](); + + // Model.inserMany supports a single document as parameter + if (!Array.isArray(docs)) { + docs[tenantIdKey] = tenantId; + } else { + docs.forEach(doc => { + doc[tenantIdKey] = tenantId; + }); } - return callback && callback(null, docs.map(doc => new self(doc))); - }); - } + // ensure the returned docs are instanced of the bound multi tenant model + return super.insertMany(docs, (err, docs) => { + if (err) { + return callback && callback(err); + } - static get db() { - return db; - } + return callback && callback(null, docs.map(doc => new self(doc))); + }); + } - get hasTenantContext() { - return true; - } + static get db() { + return db; + } - [tenantIdGetter]() { - return tenantId; - } -}); + get hasTenantContext() { + return true; + } + + [tenantIdGetter]() { + return tenantId; + } + }; const inheritOtherStatics = ({model, base}) => { Object.getOwnPropertyNames(base) - .filter((staticProperty) => ( - !model.hasOwnProperty(staticProperty) && - !['arguments', 'caller'].includes(staticProperty) - )) - .forEach((staticProperty) => { + .filter( + staticProperty => + !model.hasOwnProperty(staticProperty) && + !['arguments', 'caller'].includes(staticProperty) + ) + .forEach(staticProperty => { const descriptor = Object.getOwnPropertyDescriptor(base, staticProperty); Object.defineProperty(model, staticProperty, descriptor); }); @@ -139,7 +135,14 @@ const createDiscriminatorModels = ({model, base, createModel}) => { ); }; -const createModel = ({base, db, tenantId, tenantIdGetter, tenantIdKey, createModel}) => { +const createModel = ({ + base, + db, + tenantId, + tenantIdGetter, + tenantIdKey, + createModel, +}) => { const model = createPlainModel({ base, db, @@ -154,7 +157,7 @@ const createModel = ({base, db, tenantId, tenantIdGetter, tenantIdKey, createMod return model; }; -module.exports = ({base, tenantId, tenantIdGetter, tenantIdKey }) => { +module.exports = ({base, tenantId, tenantIdGetter, tenantIdKey}) => { const db = createTenantAwareDb({ db: base.db, tenantId, @@ -165,12 +168,13 @@ module.exports = ({base, tenantId, tenantIdGetter, tenantIdKey }) => { db, tenantId, tenantIdGetter, - tenantIdKey + tenantIdKey, }; - const create = (base) => createModel({ - base, - ...config, - }); + const create = base => + createModel({ + base, + ...config, + }); config.createModel = create; return create(base); diff --git a/src/api/tenant-aware-model.test.js b/src/api/tenant-aware-model.test.js index 86fe0c7..6ae7358 100644 --- a/src/api/tenant-aware-model.test.js +++ b/src/api/tenant-aware-model.test.js @@ -2,7 +2,6 @@ const tenantAwareModel = require('./tenant-aware-model'); const options = require('../options'); describe('tenant-aware-model', () => { - describe('when called with valid parameters', () => { const tenantId = '23'; const tenantIdGetter = 'getTenantId'; @@ -28,7 +27,7 @@ describe('tenant-aware-model', () => { it('builds discriminator models', () => { base.discriminators = { - 'test': class {}, + test: class {}, }; model = tenantAwareModel({base, tenantId, tenantIdGetter, tenantIdKey}); expect(model).toHaveProperty('discriminators.test'); @@ -94,7 +93,7 @@ describe('tenant-aware-model', () => { model.aggregate(); expect(base.aggregate).toHaveBeenCalled(); expect(base.aggregate.mock.calls[0][0]).toEqual([ - {$match: {[tenantIdKey]: tenantId}} + {$match: {[tenantIdKey]: tenantId}}, ]); }); @@ -129,24 +128,42 @@ describe('tenant-aware-model', () => { describe('overrides static remove which', () => { it.each([ - ['just with conditions', [{foo: 'bar'}], [{foo: 'bar', [tenantIdKey]: tenantId}, undefined]], - ['with conditions and callback', [{foo: 'bar'}, callback], [{foo: 'bar', [tenantIdKey]: tenantId}, callback]], - ])('applies tenant context when called %s', (name, args, expectedBaseArgs) => { - base.remove = jest.fn(); - model.remove(...args); - - expect(base.remove).toHaveBeenCalledWith(...expectedBaseArgs); - }); + [ + 'just with conditions', + [{foo: 'bar'}], + [{foo: 'bar', [tenantIdKey]: tenantId}, undefined], + ], + [ + 'with conditions and callback', + [{foo: 'bar'}, callback], + [{foo: 'bar', [tenantIdKey]: tenantId}, callback], + ], + ])( + 'applies tenant context when called %s', + (name, args, expectedBaseArgs) => { + base.remove = jest.fn(); + model.remove(...args); + + expect(base.remove).toHaveBeenCalledWith(...expectedBaseArgs); + } + ); it.each([ ['without any arguments', [], [undefined, undefined]], - ['just with callback', [callback], [{[tenantIdKey]: tenantId}, callback]], - ])('does not apply tenant context when called %s', (name, args, expectedBaseArgs) => { - base.remove = jest.fn(); - model.remove(...args); - - expect(base.remove).toHaveBeenCalledWith(...expectedBaseArgs); - }); + [ + 'just with callback', + [callback], + [{[tenantIdKey]: tenantId}, callback], + ], + ])( + 'does not apply tenant context when called %s', + (name, args, expectedBaseArgs) => { + base.remove = jest.fn(); + model.remove(...args); + + expect(base.remove).toHaveBeenCalledWith(...expectedBaseArgs); + } + ); }); describe('overrides static insertMany which', () => { @@ -155,7 +172,9 @@ describe('tenant-aware-model', () => { model.insertMany({}, undefined); expect(base.insertMany).toHaveBeenCalledTimes(1); - expect(base.insertMany.mock.calls[0][0]).toEqual({[tenantIdKey]: tenantId}); + expect(base.insertMany.mock.calls[0][0]).toEqual({ + [tenantIdKey]: tenantId, + }); }); it('applies tenant context on multiple documents', () => { @@ -163,7 +182,9 @@ describe('tenant-aware-model', () => { model.insertMany([{}], undefined); expect(base.insertMany).toHaveBeenCalledTimes(1); - expect(base.insertMany.mock.calls[0][0]).toEqual([{[tenantIdKey]: tenantId}]); + expect(base.insertMany.mock.calls[0][0]).toEqual([ + {[tenantIdKey]: tenantId}, + ]); }); it('builds tenant aware models for callback', done => { @@ -184,7 +205,7 @@ describe('tenant-aware-model', () => { }); }); - it('forwards errors', (done) => { + it('forwards errors', done => { const expectedError = new Error('test'); base.insertMany = (docs, callback) => { callback(expectedError); diff --git a/src/middleware/index.js b/src/middleware/index.js index 6d75ac7..e3fd682 100644 --- a/src/middleware/index.js +++ b/src/middleware/index.js @@ -24,13 +24,15 @@ const middleware = ({schema, options}) => { 'update', 'updateOne', 'updateMany', - ].forEach((operation) => schema.pre(operation, restrictToTenant)); + ].forEach(operation => schema.pre(operation, restrictToTenant)); - const protectedAgainstOverwrite = buildProtectAgainstTenantOverwrite({tenantIdKey, tenantIdGetter}); - [ - 'findOneAndUpdate', - 'update', - ].forEach((operation) => schema.pre(operation, protectedAgainstOverwrite)); + const protectedAgainstOverwrite = buildProtectAgainstTenantOverwrite({ + tenantIdKey, + tenantIdGetter, + }); + ['findOneAndUpdate', 'update'].forEach(operation => + schema.pre(operation, protectedAgainstOverwrite) + ); schema.pre('save', buildAddTenantId({tenantIdKey, tenantIdGetter})); }; diff --git a/src/schema/add-tenant-id-field.js b/src/schema/add-tenant-id-field.js index e6aac5c..98d48b6 100644 --- a/src/schema/add-tenant-id-field.js +++ b/src/schema/add-tenant-id-field.js @@ -4,7 +4,7 @@ module.exports = ({schema, key, type, required}) => { index: true, type: type, required: required, - } + }, }; schema.add(field); diff --git a/src/schema/add-tenant-id-field.test.js b/src/schema/add-tenant-id-field.test.js index c70ade7..6c39ed8 100644 --- a/src/schema/add-tenant-id-field.test.js +++ b/src/schema/add-tenant-id-field.test.js @@ -12,7 +12,7 @@ describe('add-tenant-id-field', () => { index: true, type: String, required: true, - } + }, }); }); }); diff --git a/src/schema/compound-indexes.js b/src/schema/compound-indexes.js index 0352674..b88c8bb 100644 --- a/src/schema/compound-indexes.js +++ b/src/schema/compound-indexes.js @@ -4,12 +4,12 @@ * @param {string} tenantIdKey */ const compoundSchemaLevelUniqueIndexes = ({schema, tenantIdKey}) => { - schema._indexes.forEach((index) => { + schema._indexes.forEach(index => { // extend uniqueness of indexes by tenant id field // skip if perserveUniqueKey of the index is set to true if (index[1].unique === true && index[1].preserveUniqueKey !== true) { const tenantAwareIndex = { - [tenantIdKey]: 1 + [tenantIdKey]: 1, }; for (let indexedField in index[0]) { @@ -38,7 +38,7 @@ const compoundFieldLevelUniqueIndexes = ({schema, tenantIdKey}) => { // prepare new options let indexOptions = { - unique: true + unique: true, }; // add sparse option if set in options @@ -48,14 +48,18 @@ const compoundFieldLevelUniqueIndexes = ({schema, tenantIdKey}) => { // add partialFilterExpression option if set in options if (pathOptions.partialFilterExpression) { - indexOptions.partialFilterExpression = pathOptions.partialFilterExpression; + indexOptions.partialFilterExpression = + pathOptions.partialFilterExpression; } // create a new one that includes the tenant id field - schema.index({ - [tenantIdKey]: 1, - [key]: 1 - }, indexOptions); + schema.index( + { + [tenantIdKey]: 1, + [key]: 1, + }, + indexOptions + ); } }); }; diff --git a/src/schema/compound-indexes.test.js b/src/schema/compound-indexes.test.js index 5f4368e..1fe9ae9 100644 --- a/src/schema/compound-indexes.test.js +++ b/src/schema/compound-indexes.test.js @@ -14,7 +14,6 @@ describe('compound-indexes', () => { }); describe('and index is unique', () => { - describe('with unique key preservation disabled', () => { it('compounds the index', () => { schema.index({id: 1}, {unique: true, preserveUniqueKey: false}); @@ -46,12 +45,7 @@ describe('compound-indexes', () => { it('does NOT compounds the index', () => { schema.index({id: 1}); compoundIndexes({schema, tenantIdKey}); - expect(schema.indexes()).toEqual([ - [ - {id: 1}, - {background: true}, - ], - ]); + expect(schema.indexes()).toEqual([[{id: 1}, {background: true}]]); }); }); }); @@ -69,10 +63,7 @@ describe('compound-indexes', () => { }); compoundIndexes({schema, tenantIdKey}); expect(schema.indexes()).toEqual([ - [ - {id: 1, [tenantIdKey]: 1}, - {unique: true, background: true}, - ], + [{id: 1, [tenantIdKey]: 1}, {unique: true, background: true}], ]); }); @@ -90,7 +81,12 @@ describe('compound-indexes', () => { expect(schema.indexes()).toEqual([ [ {id: 1, [tenantIdKey]: 1}, - {unique: true, sparse: true, partialFilterExpression: {}, background: true}, + { + unique: true, + sparse: true, + partialFilterExpression: {}, + background: true, + }, ], ]); }); @@ -107,10 +103,7 @@ describe('compound-indexes', () => { }); compoundIndexes({schema, tenantIdKey}); expect(schema.indexes()).toEqual([ - [ - {id: 1}, - {unique: true, background: true}, - ], + [{id: 1}, {unique: true, background: true}], ]); }); }); @@ -124,12 +117,7 @@ describe('compound-indexes', () => { }, }); compoundIndexes({schema, tenantIdKey}); - expect(schema.indexes()).toEqual([ - [ - {id: 1}, - {background: true}, - ], - ]); + expect(schema.indexes()).toEqual([[{id: 1}, {background: true}]]); }); }); }); diff --git a/yarn.lock b/yarn.lock index d97ef52..df7702b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -895,13 +895,6 @@ class-utils@^0.3.5: isobject "^3.0.0" static-extend "^0.1.1" -cli@~1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/cli/-/cli-1.0.1.tgz#22817534f24bfa4950c34d532d48ecbc621b8c14" - dependencies: - exit "0.1.2" - glob "^7.1.1" - cliui@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/cliui/-/cliui-2.1.0.tgz#4b475760ff80264c762c3a1719032e91c7fea0d1" @@ -983,12 +976,6 @@ concat-map@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" -console-browserify@1.1.x: - version "1.1.0" - resolved "https://registry.yarnpkg.com/console-browserify/-/console-browserify-1.1.0.tgz#f0241c45730a9fc6323b206dbf38edc741d0bb10" - dependencies: - date-now "^0.1.4" - console-control-strings@^1.0.0, console-control-strings@~1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/console-control-strings/-/console-control-strings-1.1.0.tgz#3d7cf4464db6446ea644bf4b39507f9851008e8e" @@ -1086,10 +1073,6 @@ data-urls@^1.0.0: whatwg-mimetype "^2.2.0" whatwg-url "^7.0.0" -date-now@^0.1.4: - version "0.1.4" - resolved "https://registry.yarnpkg.com/date-now/-/date-now-0.1.4.tgz#eaf439fd4d4848ad74e5cc7dbef200672b9e345b" - debug-log@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/debug-log/-/debug-log-1.0.1.tgz#2307632d4c04382b8df8a32f70b895046d52745f" @@ -1200,21 +1183,6 @@ diff-sequences@^24.3.0: resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-24.3.0.tgz#0f20e8a1df1abddaf4d9c226680952e64118b975" integrity sha512-xLqpez+Zj9GKSnPWS0WZw1igGocZ+uua8+y+5dDNTT934N3QuY1sp2LkHzwiaYQGz60hMq0pjAshdeXm5VUOEw== -dom-serializer@0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/dom-serializer/-/dom-serializer-0.1.0.tgz#073c697546ce0780ce23be4a28e293e40bc30c82" - dependencies: - domelementtype "~1.1.1" - entities "~1.1.1" - -domelementtype@1: - version "1.3.0" - resolved "https://registry.yarnpkg.com/domelementtype/-/domelementtype-1.3.0.tgz#b17aed82e8ab59e52dd9c19b1756e0fc187204c2" - -domelementtype@~1.1.1: - version "1.1.3" - resolved "https://registry.yarnpkg.com/domelementtype/-/domelementtype-1.1.3.tgz#bd28773e2642881aec51544924299c5cd822185b" - domexception@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/domexception/-/domexception-1.0.1.tgz#937442644ca6a31261ef36e3ec677fe805582c90" @@ -1222,19 +1190,6 @@ domexception@^1.0.1: dependencies: webidl-conversions "^4.0.2" -domhandler@2.3: - version "2.3.0" - resolved "https://registry.yarnpkg.com/domhandler/-/domhandler-2.3.0.tgz#2de59a0822d5027fabff6f032c2b25a2a8abe738" - dependencies: - domelementtype "1" - -domutils@1.5: - version "1.5.1" - resolved "https://registry.yarnpkg.com/domutils/-/domutils-1.5.1.tgz#dcd8488a26f563d61079e48c9f7b7e32373682cf" - dependencies: - dom-serializer "0" - domelementtype "1" - ecc-jsbn@~0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz#0fc73a9ed5f0d53c38193398523ef7e543777505" @@ -1248,14 +1203,6 @@ end-of-stream@^1.1.0: dependencies: once "^1.4.0" -entities@1.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/entities/-/entities-1.0.0.tgz#b2987aa3821347fcde642b24fdfc9e4fb712bf26" - -entities@~1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/entities/-/entities-1.1.1.tgz#6e5c2d0a5621b5dadaecef80b90edfb5cd7772f0" - error-ex@^1.2.0: version "1.3.1" resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.1.tgz#f855a86ce61adc4e8621c3cda21e7a7612c3a8dc" @@ -1359,7 +1306,7 @@ execa@^1.0.0: signal-exit "^3.0.0" strip-eof "^1.0.0" -exit@0.1.2, exit@0.1.x, exit@^0.1.2: +exit@^0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/exit/-/exit-0.1.2.tgz#0632638f8d877cc82107d30a0fff1a17cba1cd0c" integrity sha1-BjJjj42HfMghB9MKD/8aF8uhzQw= @@ -1814,16 +1761,6 @@ html-encoding-sniffer@^1.0.2: dependencies: whatwg-encoding "^1.0.1" -htmlparser2@3.8.x: - version "3.8.3" - resolved "https://registry.yarnpkg.com/htmlparser2/-/htmlparser2-3.8.3.tgz#996c28b191516a8be86501a7d79757e5c70c1068" - dependencies: - domelementtype "1" - domhandler "2.3" - domutils "1.5" - entities "1.0" - readable-stream "1.1" - http-signature@~1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/http-signature/-/http-signature-1.2.0.tgz#9aecd925114772f3d95b65a60abb8f7c18fbace1" @@ -2089,10 +2026,6 @@ is-wsl@^1.1.0: resolved "https://registry.yarnpkg.com/is-wsl/-/is-wsl-1.1.0.tgz#1f16e4aa22b04d1336b66188a66af3c600c3a66d" integrity sha1-HxbkqiKwTRM2tmGIpmrzxgDDpm0= -isarray@0.0.1: - version "0.0.1" - resolved "https://registry.yarnpkg.com/isarray/-/isarray-0.0.1.tgz#8a18acfca9a8f4177e09abfc6038939b05d1eedf" - isarray@1.0.0, isarray@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" @@ -2620,20 +2553,6 @@ jsesc@^2.5.1: resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-2.5.2.tgz#80564d2e483dacf6e8ef209650a67df3f0c283a4" integrity sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA== -jshint@^2.10.2: - version "2.10.2" - resolved "https://registry.yarnpkg.com/jshint/-/jshint-2.10.2.tgz#ed6626c4f8223c98e94aaea62767435427a49a3d" - integrity sha512-e7KZgCSXMJxznE/4WULzybCMNXNAd/bf5TSrvVEq78Q/K8ZwFpmBqQeDtNiHc3l49nV4E/+YeHU/JZjSUIrLAA== - dependencies: - cli "~1.0.0" - console-browserify "1.1.x" - exit "0.1.x" - htmlparser2 "3.8.x" - lodash "~4.17.11" - minimatch "~3.0.2" - shelljs "0.3.x" - strip-json-comments "1.0.x" - json-parse-better-errors@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz#bb867cfb3450e69107c131d1c514bab3dc8bcaa9" @@ -2797,7 +2716,7 @@ lodash@^4.14.0, lodash@^4.17.4: version "4.17.5" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.5.tgz#99a92d65c0272debe8c96b6057bc8fbfa3bed511" -lodash@^4.17.11, lodash@~4.17.11: +lodash@^4.17.11: version "4.17.11" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.11.tgz#b39ea6229ef607ecd89e2c8df12536891cac9b8d" integrity sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg== @@ -2979,7 +2898,7 @@ mimic-fn@^2.0.0: resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b" integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg== -minimatch@^3.0.4, minimatch@~3.0.2: +minimatch@^3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" dependencies: @@ -3592,6 +3511,11 @@ preserve@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b" +prettier@^1.18.2: + version "1.18.2" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.18.2.tgz#6823e7c5900017b4bd3acf46fe9ac4b4d7bda9ea" + integrity sha512-OeHeMc0JhFE9idD4ZdtNibzY0+TPHSpSSb9h8FqtP+YnoZZ1sl8Vc9b1sasjfymH3SonAF4QcA2+mzHPhMvIiw== + pretty-format@^24.8.0: version "24.8.0" resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-24.8.0.tgz#8dae7044f58db7cb8be245383b565a963e3c27f2" @@ -3723,15 +3647,6 @@ read-pkg@^3.0.0: normalize-package-data "^2.3.2" path-type "^3.0.0" -readable-stream@1.1: - version "1.1.13" - resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-1.1.13.tgz#f6eef764f514c89e2b9e23146a75ba106756d23e" - dependencies: - core-util-is "~1.0.0" - inherits "~2.0.1" - isarray "0.0.1" - string_decoder "~0.10.x" - readable-stream@2.2.7: version "2.2.7" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.2.7.tgz#07057acbe2467b22042d36f98c5ad507054e95b1" @@ -4038,10 +3953,6 @@ shebang-regex@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3" -shelljs@0.3.x: - version "0.3.0" - resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.3.0.tgz#3596e6307a781544f591f37da618360f31db57b1" - shellwords@^0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/shellwords/-/shellwords-0.1.1.tgz#d6b9181c1a48d397324c84871efbcfc73fc0654b" @@ -4241,10 +4152,6 @@ string-width@^1.0.1: is-fullwidth-code-point "^2.0.0" strip-ansi "^4.0.0" -string_decoder@~0.10.x: - version "0.10.31" - resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-0.10.31.tgz#62e203bc41766c6c28c9fc84301dab1c5310fa94" - string_decoder@~1.0.0: version "1.0.3" resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.0.3.tgz#0fc67d7c141825de94282dd536bec6b9bce860ab" @@ -4295,10 +4202,6 @@ strip-eof@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/strip-eof/-/strip-eof-1.0.0.tgz#bb43ff5598a6eb05d89b59fcd129c983313606bf" -strip-json-comments@1.0.x: - version "1.0.4" - resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-1.0.4.tgz#1e15fbcac97d3ee99bf2d73b4c656b082bbafb91" - 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" From d8b91a1ae74942c0d46fd155c1893a4edfe6a44b Mon Sep 17 00:00:00 2001 From: baranga Date: Wed, 19 Jun 2019 12:27:31 +0200 Subject: [PATCH 15/61] Update nodejs version to test for to currently supported ones --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8f7fd2b..55af638 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,8 @@ language: node_js node_js: + - "12" + - "10" - "8" - - "6" - - "4" env: - MONGOOSE_VERSION=5 - MONGOOSE_VERSION=4 @@ -22,7 +22,7 @@ jobs: include: - stage: deploy if: env(MONGOOSE_VERSION) = 5 - node_js: "8" + node_js: "12" script: - yarn test-and-cover - yarn coveralls From be4a53dab047f6f63dfd629edc5adfeb1f7823b8 Mon Sep 17 00:00:00 2001 From: baranga Date: Wed, 19 Jun 2019 12:30:25 +0200 Subject: [PATCH 16/61] Specify jest test env to get rid of mongoose warnings --- jest.config.js | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 jest.config.js diff --git a/jest.config.js b/jest.config.js new file mode 100644 index 0000000..25c9bac --- /dev/null +++ b/jest.config.js @@ -0,0 +1,3 @@ +module.exports = { + testEnvironment: 'node', +}; From 859236384f5a66c420d095520625a3fa39c274bf Mon Sep 17 00:00:00 2001 From: baranga Date: Wed, 19 Jun 2019 12:51:48 +0200 Subject: [PATCH 17/61] Improve travis runtime by separating integration testing --- .travis.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 55af638..033fc2d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,6 @@ node_js: env: - MONGOOSE_VERSION=5 - MONGOOSE_VERSION=4 -services: mongodb cache: yarn git: depth: 3 @@ -17,9 +16,14 @@ install: - yarn add --dev mongoose@^$MONGOOSE_VERSION script: - yarn hint - - yarn test-and-cover + - yarn test jobs: include: + - stage: test integration + if: false + services: mongodb + script: + - yarn test-integration - stage: deploy if: env(MONGOOSE_VERSION) = 5 node_js: "12" From 5e9fd49ff333cf2fc47b613c66f0ddb32276bd57 Mon Sep 17 00:00:00 2001 From: baranga Date: Wed, 19 Jun 2019 12:57:30 +0200 Subject: [PATCH 18/61] Revert "Improve travis runtime by separating integration testing" This reverts commit 859236384f5a66c420d095520625a3fa39c274bf. --- .travis.yml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 033fc2d..55af638 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,6 +6,7 @@ node_js: env: - MONGOOSE_VERSION=5 - MONGOOSE_VERSION=4 +services: mongodb cache: yarn git: depth: 3 @@ -16,14 +17,9 @@ install: - yarn add --dev mongoose@^$MONGOOSE_VERSION script: - yarn hint - - yarn test + - yarn test-and-cover jobs: include: - - stage: test integration - if: false - services: mongodb - script: - - yarn test-integration - stage: deploy if: env(MONGOOSE_VERSION) = 5 node_js: "12" From d8d623559736bbead1fb7f85adddbfb298456b77 Mon Sep 17 00:00:00 2001 From: baranga Date: Wed, 19 Jun 2019 15:39:27 +0200 Subject: [PATCH 19/61] Implement missing tests --- src/middleware/index.test.js | 9 +++++++-- src/schema/index.test.js | 9 +++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/middleware/index.test.js b/src/middleware/index.test.js index cd971a0..b399480 100644 --- a/src/middleware/index.test.js +++ b/src/middleware/index.test.js @@ -1,5 +1,10 @@ -const middleware = require('./index'); +const installMiddleware = require('./index'); +const buildOptions = require('../options'); +const {Schema} = require('mongoose'); describe('middleware', () => { - it.skip('needs tests', () => {}); + it('does not fail', () => { + const schema = new Schema({}); + installMiddleware({schema, options: buildOptions()}); + }); }); diff --git a/src/schema/index.test.js b/src/schema/index.test.js index a4ec250..ec25a5c 100644 --- a/src/schema/index.test.js +++ b/src/schema/index.test.js @@ -1,5 +1,10 @@ -const schema = require('./index'); +const extendSchema = require('./index'); +const buildOptions = require('../options'); +const {Schema} = require('mongoose'); describe('schema', () => { - it.skip('needs tests', () => {}); + it('does not fail', () => { + const schema = new Schema({}); + extendSchema({schema, options: buildOptions()}); + }); }); From 61922b204a1a58bc1dcaca130041d78d0a956b95 Mon Sep 17 00:00:00 2001 From: baranga Date: Fri, 21 Jun 2019 13:17:53 +0200 Subject: [PATCH 20/61] Add first integration tests for rewrite --- jest.config.integration.js | 5 + package.json | 9 +- src/index.test.integration.js | 372 ++++++++++++++++++++++++++++++++++ 3 files changed, 383 insertions(+), 3 deletions(-) create mode 100644 jest.config.integration.js create mode 100644 src/index.test.integration.js diff --git a/jest.config.integration.js b/jest.config.integration.js new file mode 100644 index 0000000..eee3491 --- /dev/null +++ b/jest.config.integration.js @@ -0,0 +1,5 @@ +const testConfig = require('./jest.config'); +module.exports = { + ...testConfig, + testMatch: ['**/?(*.)+(test.integration).js'], +}; diff --git a/package.json b/package.json index 99ef065..643b2ab 100644 --- a/package.json +++ b/package.json @@ -17,9 +17,12 @@ "mongo" ], "scripts": { - "hint": "prettier -c src/**/*.js", - "test": "jest", - "test-and-cover": "jest --coverage", + "test": "yarn test:all", + "test:all": "yarn test:style && yarn test:coverage && yarn test:integration", + "test:style": "prettier -c src/**/*.js", + "test:unit": "jest", + "test:coverage": "jest --coverage", + "test:integration": "jest --config ./jest.config.integration.js", "coveralls": "coveralls < ./coverage/lcov.info", "validate-release-notes": "release-notes validate" }, diff --git a/src/index.test.integration.js b/src/index.test.integration.js new file mode 100644 index 0000000..c4978d0 --- /dev/null +++ b/src/index.test.integration.js @@ -0,0 +1,372 @@ +const {Mongoose, Schema, version: mongooseVersion} = require('mongoose'); +const MongoClient = require('mongodb').MongoClient; +const plugin = require('./index'); + +const MONGO_URI = + process.env.MONGO_URI || 'mongodb://localhost/mongo-tenant-test'; + +const sleep = milliseconds => + new Promise(resolve => setTimeout(resolve, milliseconds)); +const resetDb = async () => { + const db = await MongoClient.connect(MONGO_URI); + const collections = await db.collections(); + await Promise.all( + collections + .filter( + collection => collection.collectionName.startsWith('system.') === false + ) + .map(collection => collection.drop()) + ); + await db.close(); +}; + +describe('plugin', () => { + describe('with real connection', () => { + let mongoose; + + const buildModel = (schemaSpec = {}, options = {}) => { + const schema = new Schema(schemaSpec); + schema.plugin(plugin, options); + const model = mongoose.model('model', schema); + return {schema, model}; + }; + + beforeEach(async () => { + await resetDb(); + + mongoose = new Mongoose(); + if (mongooseVersion < '5.0.0') { + await mongoose.connect(MONGO_URI, {useMongoClient: true}); + } else { + await mongoose.connect(MONGO_URI); + } + }); + + afterEach(async () => { + await sleep(25); + await mongoose.disconnect(); + }); + + it.each([ + ['default', {}, 'byTenant'], + ['custom', {accessorMethod: 'by_tenant'}, 'by_tenant'], + ])('injects accessor method (%s)', (name, options, accessorMethod) => { + const schema = new Schema({}); + schema.plugin(plugin, options); + const model = mongoose.model('model', schema); + + expect(model).toHaveProperty(accessorMethod); + expect(model[accessorMethod]).toBeInstanceOf(Function); + }); + + describe('when applied to a schema witch is used to build a model', () => { + let schema; + let model; + + beforeEach(() => { + schema = new Schema({}); + schema.plugin(plugin); + model = mongoose.model('model', schema); + }); + + describe('which produces sub models that', () => { + let modelT1; + let modelT2; + beforeEach(() => { + modelT1 = model.byTenant(1); + modelT2 = model.byTenant(2); + }); + + it('report having a tenant context', () => { + expect(modelT1).toHaveProperty('hasTenantContext', true); + }); + + it('report the right tenant id', () => { + expect(modelT1.getTenantId()).toBe(1); + expect(modelT2.getTenantId()).toBe(2); + }); + + describe('which when instanciated create documents that', () => { + let docT1; + let docT2; + beforeEach(() => { + docT1 = new modelT1(); + docT2 = new modelT2(); + }); + + it('report having a tenant context', () => { + expect(docT1).toHaveProperty('hasTenantContext', true); + }); + + it('report the right tenant id', () => { + expect(docT1.getTenantId()).toBe(1); + expect(docT2.getTenantId()).toBe(2); + }); + }); + }); + }); + + it('binds Model.aggregate() to tenant context', async () => { + const {model} = buildModel({num: Number}); + await model.create( + {tenantId: 'tenant1', num: 10}, + {tenantId: 'tenant1', num: 12}, + {tenantId: 'tenant2', num: 20} + ); + + const results = await model + .byTenant('tenant1') + .aggregate({$group: {_id: '$tenantId', sum: {$sum: '$num'}}}); + + expect(results).toEqual([{_id: 'tenant1', sum: 22}]); + }); + + it.skip('binds Model.bulkWrite() to tenant context - not implemented', async () => { + const {model} = buildModel({k: Number, v: Number}); + await model.create( + {tenantId: 'a', k: 1, v: 1}, + {tenantId: 'a', k: 2, v: 1}, + {tenantId: 'b', k: 1, v: 1} + ); + + await model.byTenant('a').bulkWrite([ + { + insertOne: { + document: { + k: 3, + v: 1, + }, + }, + }, + { + updateOne: { + filter: { + k: 2, + }, + update: { + v: 2, + }, + }, + }, + { + deleteOne: { + filter: { + k: 1, + }, + }, + }, + // {replaceOne: {}}, + // {updateMany: {}}, + // {deleteMany: {}}, + ]); + + const docs = await model.find(); + + const objects = docs.map(doc => doc.toObject()); + expect(objects).toMatchObject([ + { + tenantId: 'a', + k: 2, + v: 2, + }, + { + tenantId: 'a', + k: 3, + v: 1, + }, + { + tenantId: 'b', + k: 1, + v: 1, + }, + ]); + }); + + it('binds Model.count() to tenant context', async () => { + const {model} = buildModel(); + await model.create({tenantId: 1}, {tenantId: 1}, {tenantId: 2}); + + const [t1Count, t2Count] = await Promise.all([ + model.byTenant(1).count(), + model.byTenant(2).count(), + ]); + + expect(t1Count).toBe(2); + expect(t2Count).toBe(1); + }); + + it('binds Model.deleteMany() to tenant context', async () => { + const {model} = buildModel(); + await model.create({tenantId: 1}, {tenantId: 2}); + + await model.byTenant(1).deleteMany({}); + const total = await model.count(); + + expect(total).toBe(1); + }); + + it('binds Model.deleteOne() to tenant context', async () => { + const {model} = buildModel(); + await model.create({tenantId: 'a'}, {tenantId: 'a'}, {tenantId: 'b'}); + + await model.byTenant('a').deleteOne({}); + const total = await model.count(); + + expect(total).toBe(2); + }); + + it('binds Model.find() to tenant context', async () => { + const {model} = buildModel(); + await model.create({tenantId: 'a'}, {tenantId: 'a'}, {tenantId: 'b'}); + + const docs = await model.byTenant('a').find({}); + + expect(docs).toHaveLength(2); + expect(docs[0]).toHaveProperty('tenantId', 'a'); + expect(docs[1]).toHaveProperty('tenantId', 'a'); + }); + + it('binds Model.findOne() to tenant context', async () => { + const {model} = buildModel(); + await model.create({tenantId: 'a'}, {tenantId: 'a'}, {tenantId: 'b'}); + + const doc = await model.byTenant('b').findOne({}); + + expect(doc).toHaveProperty('tenantId', 'b'); + }); + + if (mongooseVersion >= '5.1.0') { + it('binds Model.findOneAndDelete() to tenant context', async () => { + const {model} = buildModel(); + await model.create({tenantId: 'a'}, {tenantId: 'a'}, {tenantId: 'b'}); + + await model.byTenant('a').findOneAndDelete({}); + const remainingDocs = await model.find({}); + + expect(remainingDocs).toHaveLength(2); + expect(docs[0]).toHaveProperty('tenantId', 'a'); + expect(docs[1]).toHaveProperty('tenantId', 'b'); + }); + } + + it('binds Model.findOneAndRemove() to tenant context', async () => { + const {model} = buildModel(); + await model.create({tenantId: 'a'}, {tenantId: 'a'}, {tenantId: 'b'}); + + await model.byTenant('a').findOneAndRemove({}); + const remainingDocs = await model.find({}); + + expect(remainingDocs).toHaveLength(2); + expect(remainingDocs[0]).toHaveProperty('tenantId', 'a'); + expect(remainingDocs[1]).toHaveProperty('tenantId', 'b'); + }); + + if (mongooseVersion > '5.4.0') { + it.skip('binds Model.findOneAndReplace() to tenant context', () => {}); + } + + it('binds Model.findOneAndUpdate() to tenant context', async () => { + const {model} = buildModel({k: Number, v: Number}); + await model.create( + {tenantId: 'a', k: 1, v: 1}, + {tenantId: 'a', k: 2, v: 1}, + {tenantId: 'b', k: 3, v: 1} + ); + + const originalDoc = await model + .byTenant('a') + .findOneAndUpdate({k: 1}, {v: 2}); + const modifiedDoc = await model.findOne({k: 1}); + + expect(originalDoc.toObject()).toMatchObject({ + tenantId: 'a', + k: 1, + v: 1, + }); + expect(modifiedDoc.toObject()).toMatchObject({ + tenantId: 'a', + k: 1, + v: 2, + }); + }); + + it('binds Model.remove() to tenant context', async () => { + const {model} = buildModel({t: Number}); + await model.create( + {tenantId: 'a', t: 1}, + {tenantId: 'a', t: 2}, + {tenantId: 'b', t: 1} + ); + + await model.byTenant('a').remove({t: 1}); + const remainingDocs = await model.find(); + + expect(remainingDocs).toHaveLength(2); + expect(remainingDocs[0].toObject()).toMatchObject({tenantId: 'a', t: 2}); + expect(remainingDocs[1].toObject()).toMatchObject({tenantId: 'b', t: 1}); + }); + + it('binds Model.update() to tenant context', async () => { + const {model} = buildModel({t: Number}); + await model.create({tenantId: 'a', t: 1}, {tenantId: 'b', t: 1}); + + await model.byTenant('b').update({t: 2}); + const docs = await model.find(); + const sortedDocs = docs.sort((a, b) => + a.tenantId.localeCompare(b.tenantId) + ); + + expect(sortedDocs).toHaveLength(2); + expect(sortedDocs[0].toObject()).toMatchObject({tenantId: 'a', t: 1}); + expect(sortedDocs[1].toObject()).toMatchObject({tenantId: 'b', t: 2}); + }); + + it('binds Model.updateOne() to tenant context', async () => { + const {model} = buildModel({t: Number}); + await model.create({tenantId: 'a', t: 1}, {tenantId: 'b', t: 1}); + + await model.byTenant('b').updateOne({t: 2}); + const docs = await model.find(); + const sortedDocs = docs.sort((a, b) => + a.tenantId.localeCompare(b.tenantId) + ); + + expect(sortedDocs).toHaveLength(2); + expect(sortedDocs[0].toObject()).toMatchObject({tenantId: 'a', t: 1}); + expect(sortedDocs[1].toObject()).toMatchObject({tenantId: 'b', t: 2}); + }); + + it('binds Model.updateMany() to tenant context', async () => { + const {model} = buildModel({t: Number}); + await model.create( + {tenantId: 'a', t: 1}, + {tenantId: 'a', t: 1}, + {tenantId: 'b', t: 1} + ); + + await model.byTenant('a').updateMany({t: 2}); + const docs = await model.find(); + const sortedDocs = docs.sort((a, b) => + a.tenantId.localeCompare(b.tenantId) + ); + + expect(sortedDocs).toHaveLength(3); + expect(sortedDocs[0].toObject()).toMatchObject({tenantId: 'a', t: 2}); + expect(sortedDocs[1].toObject()).toMatchObject({tenantId: 'a', t: 2}); + expect(sortedDocs[2].toObject()).toMatchObject({tenantId: 'b', t: 1}); + }); + + it.skip('protects against override of tenant id in Model.bulkWrite()', async () => {}); + it.skip('protects against override of tenant id in Model.findOneAndUpdate()', async () => {}); + if (mongooseVersion > '5.4.0') { + it.skip('binds protects against override of tenant id in Model.findOneAndReplace()', () => {}); + } + it.skip('protects against override of tenant id in Model.update()', async () => {}); + it.skip('protects against override of tenant id in Model.updateOne()', async () => {}); + it.skip('protects against override of tenant id in Model.updateMany()', async () => {}); + + it.skip('inserts tenant id on save of new document', async () => {}); + it.skip('protects against removal of tenant id on save', async () => {}); + it.skip('protects against override of tenant id on save', async () => {}); + }); +}); From 528fa317f298c729b30ee9f05b6c900df939af9a Mon Sep 17 00:00:00 2001 From: baranga Date: Fri, 21 Jun 2019 13:20:18 +0200 Subject: [PATCH 21/61] Adjust travis to change test commands --- .travis.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 55af638..2382c32 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,13 +16,12 @@ install: - yarn - yarn add --dev mongoose@^$MONGOOSE_VERSION script: - - yarn hint - - yarn test-and-cover + - yarn test:all jobs: include: - stage: deploy if: env(MONGOOSE_VERSION) = 5 node_js: "12" script: - - yarn test-and-cover + - yarn test:coverage - yarn coveralls From f8054c11d31b4633a24f0a9f107bd4b7be461f6c Mon Sep 17 00:00:00 2001 From: baranga Date: Fri, 21 Jun 2019 13:20:52 +0200 Subject: [PATCH 22/61] Fix issue with tenant id getter --- src/api/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/api/index.js b/src/api/index.js index 7c973d5..8626599 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -6,14 +6,14 @@ const createTenantAwareModel = require('./tenant-aware-model'); * @param {MongoTenantOptions} options */ module.exports = ({schema, options}) => { - const {accessorMethod} = options; + const {accessorMethod, tenantIdGetter, tenantIdKey} = options; const cache = buildModelCache(); Object.assign(schema.statics, { [accessorMethod]: function(tenantId) { if (!cache.has(this.modelName, tenantId)) { const base = this.model(this.modelName); - const model = createTenantAwareModel({base, tenantId}); + const model = createTenantAwareModel({base, tenantId, tenantIdGetter, tenantIdKey}); cache.set(this.modelName, tenantId, model); } return cache.get(this.modelName, tenantId); From 1cbbe821d250bca0054ec6546c68f2eff4c62967 Mon Sep 17 00:00:00 2001 From: baranga Date: Fri, 21 Jun 2019 13:21:24 +0200 Subject: [PATCH 23/61] Reformat code --- src/middleware/query/restrict-to-tenant.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/middleware/query/restrict-to-tenant.js b/src/middleware/query/restrict-to-tenant.js index d267caf..3d6fb02 100644 --- a/src/middleware/query/restrict-to-tenant.js +++ b/src/middleware/query/restrict-to-tenant.js @@ -1,7 +1,8 @@ -module.exports = ({tenantIdKey, tenantIdGetter}) => function (next) { - if (this.model.hasTenantContext) { - this._conditions[tenantIdKey] = this.model[tenantIdGetter](); - } +module.exports = ({tenantIdKey, tenantIdGetter}) => + function(next) { + if (this.model.hasTenantContext) { + this._conditions[tenantIdKey] = this.model[tenantIdGetter](); + } - next(); -}; + next(); + }; From 3e081b83a3e3b8088f5924b99f1740f7752f7cb1 Mon Sep 17 00:00:00 2001 From: baranga Date: Fri, 21 Jun 2019 13:21:59 +0200 Subject: [PATCH 24/61] Add findOneAndReplace middleware guards --- src/middleware/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/middleware/index.js b/src/middleware/index.js index e3fd682..eeddf37 100644 --- a/src/middleware/index.js +++ b/src/middleware/index.js @@ -19,6 +19,7 @@ const middleware = ({schema, options}) => { 'findOne', 'findOneAndDelete', 'findOneAndRemove', + 'findOneAndReplace', 'findOneAndUpdate', 'remove', 'update', @@ -30,7 +31,7 @@ const middleware = ({schema, options}) => { tenantIdKey, tenantIdGetter, }); - ['findOneAndUpdate', 'update'].forEach(operation => + ['findOneAndReplace', 'findOneAndUpdate', 'update'].forEach(operation => schema.pre(operation, protectedAgainstOverwrite) ); From 6fb5075591a4da77973189f05f8866ba6ca7da08 Mon Sep 17 00:00:00 2001 From: baranga Date: Fri, 21 Jun 2019 13:23:08 +0200 Subject: [PATCH 25/61] Extend code doc --- src/schema/compound-indexes.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/schema/compound-indexes.js b/src/schema/compound-indexes.js index b88c8bb..179a0ca 100644 --- a/src/schema/compound-indexes.js +++ b/src/schema/compound-indexes.js @@ -46,7 +46,7 @@ const compoundFieldLevelUniqueIndexes = ({schema, tenantIdKey}) => { indexOptions.sparse = true; } - // add partialFilterExpression option if set in options + // add partialFilterExpression option if set in options (see issue #21) if (pathOptions.partialFilterExpression) { indexOptions.partialFilterExpression = pathOptions.partialFilterExpression; From 3c793d36f39d9037bc3edf163f89d8e852d64cd6 Mon Sep 17 00:00:00 2001 From: baranga Date: Fri, 21 Jun 2019 13:25:56 +0200 Subject: [PATCH 26/61] Fix code style issue --- src/api/index.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/api/index.js b/src/api/index.js index 8626599..92b5a8a 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -13,7 +13,12 @@ module.exports = ({schema, options}) => { [accessorMethod]: function(tenantId) { if (!cache.has(this.modelName, tenantId)) { const base = this.model(this.modelName); - const model = createTenantAwareModel({base, tenantId, tenantIdGetter, tenantIdKey}); + const model = createTenantAwareModel({ + base, + tenantId, + tenantIdGetter, + tenantIdKey, + }); cache.set(this.modelName, tenantId, model); } return cache.get(this.modelName, tenantId); From d9b35c53fcedab89cf4dcf77f016fd839cf1e35f Mon Sep 17 00:00:00 2001 From: baranga Date: Fri, 21 Jun 2019 13:35:26 +0200 Subject: [PATCH 27/61] Stabilize some integration tests --- src/index.test.integration.js | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/index.test.integration.js b/src/index.test.integration.js index c4978d0..2da128a 100644 --- a/src/index.test.integration.js +++ b/src/index.test.integration.js @@ -241,11 +241,10 @@ describe('plugin', () => { await model.create({tenantId: 'a'}, {tenantId: 'a'}, {tenantId: 'b'}); await model.byTenant('a').findOneAndDelete({}); - const remainingDocs = await model.find({}); + const remainingDocs = await model.find().sort({tenantId: 1}); - expect(remainingDocs).toHaveLength(2); - expect(docs[0]).toHaveProperty('tenantId', 'a'); - expect(docs[1]).toHaveProperty('tenantId', 'b'); + const objects = remainingDocs.map(doc => doc.toObject()); + expect(objects).toMatchObject([{tenantId: 'a'}, {tenantId: 'b'}]); }); } @@ -254,11 +253,10 @@ describe('plugin', () => { await model.create({tenantId: 'a'}, {tenantId: 'a'}, {tenantId: 'b'}); await model.byTenant('a').findOneAndRemove({}); - const remainingDocs = await model.find({}); + const remainingDocs = await model.find().sort({tenantId: 1}); - expect(remainingDocs).toHaveLength(2); - expect(remainingDocs[0]).toHaveProperty('tenantId', 'a'); - expect(remainingDocs[1]).toHaveProperty('tenantId', 'b'); + const objects = remainingDocs.map(doc => doc.toObject()); + expect(objects).toMatchObject([{tenantId: 'a'}, {tenantId: 'b'}]); }); if (mongooseVersion > '5.4.0') { @@ -299,11 +297,13 @@ describe('plugin', () => { ); await model.byTenant('a').remove({t: 1}); - const remainingDocs = await model.find(); + const remainingDocs = await model.find().sort({tenantId: 1}); - expect(remainingDocs).toHaveLength(2); - expect(remainingDocs[0].toObject()).toMatchObject({tenantId: 'a', t: 2}); - expect(remainingDocs[1].toObject()).toMatchObject({tenantId: 'b', t: 1}); + const objects = remainingDocs.map(doc => doc.toObject()); + expect(objects).toMatchObject([ + {tenantId: 'a', t: 2}, + {tenantId: 'b', t: 1}, + ]); }); it('binds Model.update() to tenant context', async () => { From d5bc4c7c1bc7603f7113d787cf68442cd4c7c075 Mon Sep 17 00:00:00 2001 From: baranga Date: Fri, 21 Jun 2019 13:54:37 +0200 Subject: [PATCH 28/61] Fix issue with mongoose 4 aggregate --- src/api/tenant-aware-model.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/api/tenant-aware-model.js b/src/api/tenant-aware-model.js index 281bb75..a8c8cd5 100644 --- a/src/api/tenant-aware-model.js +++ b/src/api/tenant-aware-model.js @@ -44,7 +44,10 @@ const createPlainModel = ({base, db, tenantId, tenantIdGetter, tenantIdKey}) => }, }); - return super.aggregate.call(this, pipeline, callback); + return super.aggregate.apply( + this, + callback ? [pipeline, callback] : [pipeline] + ); } static deleteOne(conditions, callback) { From 53d47318da68ff7a0cdb17bb42e7b6084d4548f9 Mon Sep 17 00:00:00 2001 From: baranga Date: Sat, 22 Jun 2019 13:58:32 +0200 Subject: [PATCH 29/61] Extract aggregate argument parsing into dedicated module for better testability --- .../index.js} | 26 ++------ .../index.test.js} | 3 +- .../parse-aggregate-arguments.js | 41 +++++++++++++ .../parse-aggregate-arguments.test.js | 61 +++++++++++++++++++ 4 files changed, 108 insertions(+), 23 deletions(-) rename src/api/{tenant-aware-model.js => tenant-aware-model/index.js} (81%) rename src/api/{tenant-aware-model.test.js => tenant-aware-model/index.test.js} (98%) create mode 100644 src/api/tenant-aware-model/parse-aggregate-arguments.js create mode 100644 src/api/tenant-aware-model/parse-aggregate-arguments.test.js diff --git a/src/api/tenant-aware-model.js b/src/api/tenant-aware-model/index.js similarity index 81% rename from src/api/tenant-aware-model.js rename to src/api/tenant-aware-model/index.js index a8c8cd5..a23b928 100644 --- a/src/api/tenant-aware-model.js +++ b/src/api/tenant-aware-model/index.js @@ -1,4 +1,5 @@ -const createTenantAwareDb = require('./tenant-aware-db'); +const createTenantAwareDb = require('../tenant-aware-db'); +const parseAggregateArguments = require('./parse-aggregate-arguments'); const createPlainModel = ({base, db, tenantId, tenantIdGetter, tenantIdKey}) => class extends base { @@ -17,26 +18,7 @@ const createPlainModel = ({base, db, tenantId, tenantIdGetter, tenantIdKey}) => * @return {Mongoose.Aggregate|Promise} */ static aggregate() { - // possible structure of arguments: - // - [] - nothing - // - [{...}] - single pipeline (4.x) - // - [{...}, fn] - single pipeline with callback (4.x) - // - [{...}, {...}] - multiple pipelines (4.x) - // - [{...}, {...}, fn] - multiple pipelines with callback (4.x) - // - [[{...}]] - list of pipelines - // - [[{...}], fn] - list of pipelines with callback - - const argumentsAsArray = Array.prototype.slice.call(arguments); - - let callback; - if (typeof argumentsAsArray[argumentsAsArray.length - 1] === 'function') { - callback = argumentsAsArray.pop(); - } - - const pipeline = - argumentsAsArray.length === 1 && Array.isArray(argumentsAsArray[0]) - ? argumentsAsArray[0] - : argumentsAsArray; + const {pipeline, callback} = parseAggregateArguments(arguments); pipeline.unshift({ $match: { @@ -44,6 +26,8 @@ const createPlainModel = ({base, db, tenantId, tenantIdGetter, tenantIdKey}) => }, }); + // due to 4.x overloading of aggregate it's necessary to be very careful + // what to pass as arguments so we pass callback only if its not empty return super.aggregate.apply( this, callback ? [pipeline, callback] : [pipeline] diff --git a/src/api/tenant-aware-model.test.js b/src/api/tenant-aware-model/index.test.js similarity index 98% rename from src/api/tenant-aware-model.test.js rename to src/api/tenant-aware-model/index.test.js index 6ae7358..a30b68f 100644 --- a/src/api/tenant-aware-model.test.js +++ b/src/api/tenant-aware-model/index.test.js @@ -1,5 +1,4 @@ -const tenantAwareModel = require('./tenant-aware-model'); -const options = require('../options'); +const tenantAwareModel = require('./index'); describe('tenant-aware-model', () => { describe('when called with valid parameters', () => { diff --git a/src/api/tenant-aware-model/parse-aggregate-arguments.js b/src/api/tenant-aware-model/parse-aggregate-arguments.js new file mode 100644 index 0000000..f9aa3a6 --- /dev/null +++ b/src/api/tenant-aware-model/parse-aggregate-arguments.js @@ -0,0 +1,41 @@ +const convertArgumentsToArray = args => [].slice.call(args); + +const extractCallback = args => { + const lastIndex = args.length - 1; + const lastElement = args[lastIndex]; + return typeof lastElement === 'function' + ? { + arguments: args.slice(0, lastIndex), + callback: lastElement, + } + : {arguments: [...args], callback: undefined}; +}; + +/** + * Parse arguments of Model.aggregate + * + * Model.aggregate accepts a wide range of possible arguments: + * - [] - nothing + * - [{...}] - single pipeline element (4.x) + * - [{...}, fn] - single pipeline with callback (4.x) + * - [{...}, {...}] - multiple pipeline elements (4.x) + * - [{...}, {...}, fn] - multiple pipelines elements with callback (4.x) + * - [[{...}]] - list of pipeline elements + * - [[{...}], fn] - list of pipeline elements with callback + * + * @param {(array|arguments)} args + * @returns {{pipeline: array, callback: ?function}} + */ +module.exports = args => { + const argsAsArray = convertArgumentsToArray(args); + const {arguments: argsWithoutCallback, callback} = extractCallback( + argsAsArray + ); + + const pipeline = + argsWithoutCallback.length === 1 && Array.isArray(argsWithoutCallback[0]) + ? argsWithoutCallback[0] + : argsWithoutCallback; + + return {pipeline, callback}; +}; diff --git a/src/api/tenant-aware-model/parse-aggregate-arguments.test.js b/src/api/tenant-aware-model/parse-aggregate-arguments.test.js new file mode 100644 index 0000000..0992120 --- /dev/null +++ b/src/api/tenant-aware-model/parse-aggregate-arguments.test.js @@ -0,0 +1,61 @@ +const parse = require('./parse-aggregate-arguments'); + +describe('parse-aggregate-arguments', () => { + const callback = () => {}; + + it('parses empty argument list', () => { + const result = parse([]); + expect(result).toEqual({ + pipeline: [], + callback: undefined, + }); + }); + + it('parses single pipeline element (4.x compatibility)', () => { + const result = parse([{}]); + expect(result).toEqual({ + pipeline: [{}], + callback: undefined, + }); + }); + + it('parses single pipeline element and callback (4.x compatibility)', () => { + const result = parse([{}, callback]); + expect(result).toEqual({ + pipeline: [{}], + callback, + }); + }); + + it('parses multiple pipeline elements (4.x compatibility)', () => { + const result = parse([{a: 1}, {b: 2}]); + expect(result).toEqual({ + pipeline: [{a: 1}, {b: 2}], + callback: undefined, + }); + }); + + it('parses multiple pipeline elements and callback (4.x compatibility)', () => { + const result = parse([{a: 1}, {b: 2}, callback]); + expect(result).toEqual({ + pipeline: [{a: 1}, {b: 2}], + callback, + }); + }); + + it('parses pipeline list', () => { + const result = parse([[{a: 1}, {b: 2}]]); + expect(result).toEqual({ + pipeline: [{a: 1}, {b: 2}], + callback: undefined, + }); + }); + + it('parses pipeline list and callback', () => { + const result = parse([[{a: 1}, {b: 2}], callback]); + expect(result).toEqual({ + pipeline: [{a: 1}, {b: 2}], + callback, + }); + }); +}); From 7fe1786434f7921a32b9901e8846f786ee7a81b8 Mon Sep 17 00:00:00 2001 From: baranga Date: Sat, 22 Jun 2019 14:15:49 +0200 Subject: [PATCH 30/61] Add some tenant id override protection integration tests --- src/index.test.integration.js | 49 ++++++++++++++++++++++++++++++++--- 1 file changed, 45 insertions(+), 4 deletions(-) diff --git a/src/index.test.integration.js b/src/index.test.integration.js index 2da128a..2bf19bd 100644 --- a/src/index.test.integration.js +++ b/src/index.test.integration.js @@ -357,13 +357,54 @@ describe('plugin', () => { }); it.skip('protects against override of tenant id in Model.bulkWrite()', async () => {}); - it.skip('protects against override of tenant id in Model.findOneAndUpdate()', async () => {}); + + it('protects against override of tenant id in Model.findOneAndUpdate()', async () => { + const {model} = buildModel({}); + await model.create({tenantId: 'a'}); + + await model.byTenant('a').findOneAndUpdate({}, {tenantId: 'b'}); + + const docs = await model.find(); + const objects = docs.map(doc => doc.toObject()); + expect(objects).toMatchObject([{tenantId: 'a'}]); + }); + if (mongooseVersion > '5.4.0') { it.skip('binds protects against override of tenant id in Model.findOneAndReplace()', () => {}); } - it.skip('protects against override of tenant id in Model.update()', async () => {}); - it.skip('protects against override of tenant id in Model.updateOne()', async () => {}); - it.skip('protects against override of tenant id in Model.updateMany()', async () => {}); + + it('protects against override of tenant id in Model.update()', async () => { + const {model} = buildModel({}); + await model.create({tenantId: 'a'}); + + await model.byTenant('a').update({}, {tenantId: 'b'}); + + const docs = await model.find(); + const objects = docs.map(doc => doc.toObject()); + expect(objects).toMatchObject([{tenantId: 'a'}]); + }); + + it('protects against override of tenant id in Model.updateOne()', async () => { + const {model} = buildModel({}); + await model.create({tenantId: 'a'}); + + await model.byTenant('a').updateOne({}, {tenantId: 'b'}); + + const docs = await model.find(); + const objects = docs.map(doc => doc.toObject()); + expect(objects).toMatchObject([{tenantId: 'a'}]); + }); + + it('protects against override of tenant id in Model.updateMany()', async () => { + const {model} = buildModel({}); + await model.create({tenantId: 'a'}); + + await model.byTenant('a').updateMany({}, {tenantId: 'b'}); + + const docs = await model.find(); + const objects = docs.map(doc => doc.toObject()); + expect(objects).toMatchObject([{tenantId: 'a'}]); + }); it.skip('inserts tenant id on save of new document', async () => {}); it.skip('protects against removal of tenant id on save', async () => {}); From 64f20452f8caf1f31d9619b824875792af8f155f Mon Sep 17 00:00:00 2001 From: baranga Date: Sat, 22 Jun 2019 14:21:28 +0200 Subject: [PATCH 31/61] Add skiped tests for missing methods --- src/index.test.integration.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/index.test.integration.js b/src/index.test.integration.js index 2bf19bd..b635672 100644 --- a/src/index.test.integration.js +++ b/src/index.test.integration.js @@ -226,6 +226,13 @@ describe('plugin', () => { expect(docs[1]).toHaveProperty('tenantId', 'a'); }); + it.skip('binds Model.findById() to tenant context', async () => {}); + if (mongooseVersion >= '5.1.0') { + it.skip('binds Model.findByIdAndDelete() to tenant context', async () => {}); + } + it.skip('binds Model.findByIdAndRemove() to tenant context', async () => {}); + it.skip('binds Model.findByIdAndUpdate() to tenant context', async () => {}); + it('binds Model.findOne() to tenant context', async () => { const {model} = buildModel(); await model.create({tenantId: 'a'}, {tenantId: 'a'}, {tenantId: 'b'}); @@ -306,6 +313,10 @@ describe('plugin', () => { ]); }); + if (mongooseVersion >= '4.9.0') { + it.skip('binds Model.replaceOne() to tenant context', async () => {}); + } + it('binds Model.update() to tenant context', async () => { const {model} = buildModel({t: Number}); await model.create({tenantId: 'a', t: 1}, {tenantId: 'b', t: 1}); From 85eba555009ac3c2efaae410df6e15db0bedfe1d Mon Sep 17 00:00:00 2001 From: baranga Date: Sat, 22 Jun 2019 14:23:52 +0200 Subject: [PATCH 32/61] Fix missing protection against tenant id override for `updateOne` and `updateMany` --- src/middleware/index.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/middleware/index.js b/src/middleware/index.js index eeddf37..a5b8a24 100644 --- a/src/middleware/index.js +++ b/src/middleware/index.js @@ -31,9 +31,13 @@ const middleware = ({schema, options}) => { tenantIdKey, tenantIdGetter, }); - ['findOneAndReplace', 'findOneAndUpdate', 'update'].forEach(operation => - schema.pre(operation, protectedAgainstOverwrite) - ); + [ + 'findOneAndReplace', + 'findOneAndUpdate', + 'update', + 'updateOne', + 'updateMany', + ].forEach(operation => schema.pre(operation, protectedAgainstOverwrite)); schema.pre('save', buildAddTenantId({tenantIdKey, tenantIdGetter})); }; From d6e03f3bfbae48e21d4a94c9dd78b39473fce04d Mon Sep 17 00:00:00 2001 From: baranga Date: Sun, 23 Jun 2019 13:13:47 +0200 Subject: [PATCH 33/61] Add experimental handling of bulkWrite --- src/api/tenant-aware-model/index.js | 12 ++ .../modify-bulk-write-operations.js | 110 +++++++++++++++ .../modify-bulk-write-operations.test.js | 133 ++++++++++++++++++ src/index.test.integration.js | 59 +++++++- 4 files changed, 307 insertions(+), 7 deletions(-) create mode 100644 src/api/tenant-aware-model/modify-bulk-write-operations.js create mode 100644 src/api/tenant-aware-model/modify-bulk-write-operations.test.js diff --git a/src/api/tenant-aware-model/index.js b/src/api/tenant-aware-model/index.js index a23b928..d8e9bec 100644 --- a/src/api/tenant-aware-model/index.js +++ b/src/api/tenant-aware-model/index.js @@ -1,5 +1,6 @@ const createTenantAwareDb = require('../tenant-aware-db'); const parseAggregateArguments = require('./parse-aggregate-arguments'); +const modifyBulkWriteOpertations = require('./modify-bulk-write-operations'); const createPlainModel = ({base, db, tenantId, tenantIdGetter, tenantIdKey}) => class extends base { @@ -82,6 +83,17 @@ const createPlainModel = ({base, db, tenantId, tenantIdGetter, tenantIdKey}) => }); } + static bulkWrite(ops, options, callback) { + const tenantId = this[tenantIdGetter](); + const modifiedOps = modifyBulkWriteOpertations({ + ops, + tenantId, + tenantIdKey, + }); + + return super.bulkWrite(modifiedOps, options, callback); + } + static get db() { return db; } diff --git a/src/api/tenant-aware-model/modify-bulk-write-operations.js b/src/api/tenant-aware-model/modify-bulk-write-operations.js new file mode 100644 index 0000000..cd82ce3 --- /dev/null +++ b/src/api/tenant-aware-model/modify-bulk-write-operations.js @@ -0,0 +1,110 @@ +const patchDocument = ({document, tenantId, tenantIdKey}) => ({ + ...document, + [tenantIdKey]: tenantId, +}); + +const patchFilter = ({filter, tenantId, tenantIdKey}) => ({ + ...(filter || {}), + [tenantIdKey]: tenantId, +}); + +const forbiddenUpdateOperations = [ + '$bit', + '$currentDate', + '$inc', + '$min', + '$max', + '$mul', + '$rename', + '$unset', +]; +const patchableUpdateOperations = ['$set', '$setOnInsert']; +const patchUpdate = ({update, tenantId, tenantIdKey}) => { + const forbiddenOpsUsed = Object.entries(update).reduce( + (ops, [op, fields]) => { + if ( + forbiddenUpdateOperations.includes(op) && + Object.keys(fields).includes(tenantIdKey) + ) { + ops.push(op); + } + return ops; + }, + [] + ); + if (forbiddenOpsUsed.length > 0) { + throw new Error( + `Modification of ${tenantIdKey} via bulkInsert update (${forbiddenOpsUsed.join( + ', ' + )}` + ); + } + + const patchedUpdate = {...update}; + patchableUpdateOperations.forEach(op => { + if ( + patchedUpdate[op] && + Object.keys(patchedUpdate[op]).includes(tenantIdKey) + ) { + patchedUpdate[op][tenantIdKey] = tenantId; + } + }); + + return patchedUpdate; +}; + +const modifyInsert = ({tenantId, tenantIdKey, op: {document, ...rest}}) => ({ + document: patchDocument({document, tenantId, tenantIdKey}), + ...rest, +}); + +const modifyUpdate = ({ + tenantId, + tenantIdKey, + op: {filter, update, ...rest}, +}) => ({ + filter: patchFilter({filter, tenantId, tenantIdKey}), + update: patchUpdate({update, tenantId, tenantIdKey}), + ...rest, +}); + +const modifyReplace = ({ + tenantId, + tenantIdKey, + op: {filter, replacement, ...rest}, +}) => ({ + filter: patchFilter({filter, tenantId, tenantIdKey}), + replacement: patchDocument({document: replacement, tenantId, tenantIdKey}), + ...rest, +}); + +const modifyDelete = ({tenantId, tenantIdKey, op: {filter, ...rest}}) => ({ + filter: patchFilter({filter, tenantId, tenantIdKey}), + ...rest, +}); + +const opToModifierMap = { + insertOne: modifyInsert, + updateOne: modifyUpdate, + updateMany: modifyUpdate, + replaceOne: modifyReplace, + deleteOne: modifyDelete, + deleteMany: modifyDelete, +}; + +module.exports = ({ops, tenantId, tenantIdKey}) => { + return (ops || []).map(op => { + const modifiedOp = {...op}; + + Object.entries(modifiedOp).forEach(([opKey, op]) => { + if (opToModifierMap[opKey]) { + modifiedOp[opKey] = opToModifierMap[opKey]({ + tenantId, + tenantIdKey, + op, + }); + } + }); + return modifiedOp; + }); +}; diff --git a/src/api/tenant-aware-model/modify-bulk-write-operations.test.js b/src/api/tenant-aware-model/modify-bulk-write-operations.test.js new file mode 100644 index 0000000..53f8f99 --- /dev/null +++ b/src/api/tenant-aware-model/modify-bulk-write-operations.test.js @@ -0,0 +1,133 @@ +const modifyBulkWriteOperations = require('./modify-bulk-write-operations'); + +describe('modify-bulk-write-operations', () => { + const tenantId = 't'; + const tenantIdKey = 'tenantId'; + + it.each([ + ['tenantId present', {[tenantIdKey]: 'a'}, {[tenantIdKey]: 't'}], + ['tenantId absent', {}, {[tenantIdKey]: 't'}], + ])('modifies insertOne (%s)', (name, document, expectedDocument) => { + const ops = [{insertOne: {document}}]; + const result = modifyBulkWriteOperations({ops, tenantId, tenantIdKey}); + expect(result).toEqual([{insertOne: {document: expectedDocument}}]); + }); + + it.each([ + [ + 'updateOne', + 'tenantId in filter present', + {tenantId: 'a'}, + {tenantId: 't'}, + ], + ['updateOne', 'tenantId in filter absent', {}, {tenantId: 't'}], + [ + 'updateMany', + 'tenantId in filter present', + {tenantId: 'a'}, + {tenantId: 't'}, + ], + ['updateMany', 'tenantId in filter absent', {}, {tenantId: 't'}], + ])('modifies filter of %s (%s)', (op, name, filter, expectedFilter) => { + const ops = [{[op]: {filter, update: {}}}]; + const result = modifyBulkWriteOperations({ops, tenantId, tenantIdKey}); + expect(result).toEqual([{[op]: {filter: expectedFilter, update: {}}}]); + }); + + it.each([ + [ + 'updateOne', + 'tenantId in $set', + {$set: {tenantId: 'a'}}, + {$set: {tenantId: 't'}}, + ], + [ + 'updateOne', + 'tenantId in $setOnInsert', + {$set: {tenantId: 'a'}}, + {$set: {tenantId: 't'}}, + ], + [ + 'updateMany', + 'tenantId in $set', + {$set: {tenantId: 'a'}}, + {$set: {tenantId: 't'}}, + ], + [ + 'updateMany', + 'tenantId in $setOnInsert', + {$set: {tenantId: 'a'}}, + {$set: {tenantId: 't'}}, + ], + ])('modifies update of %s (%s)', (op, name, update, expectedUpdate) => { + const ops = [{[op]: {filter: {}, update}}]; + const result = modifyBulkWriteOperations({ops, tenantId, tenantIdKey}); + expect(result).toEqual([ + {[op]: {filter: {tenantId: 't'}, update: expectedUpdate}}, + ]); + }); + + it.each([ + ['updateOne', '$bit'], + ['updateOne', '$currentDate'], + ['updateOne', '$inc'], + ['updateOne', '$min'], + ['updateOne', '$max'], + ['updateOne', '$mul'], + ['updateOne', '$rename'], + ['updateOne', '$unset'], + ['updateMany', '$bit'], + ['updateMany', '$currentDate'], + ['updateMany', '$inc'], + ['updateMany', '$min'], + ['updateMany', '$max'], + ['updateMany', '$mul'], + ['updateMany', '$rename'], + ['updateMany', '$unset'], + ])('throws on tenant id modification in %s (%s)', (op, updateOp) => { + const ops = [{[op]: {filter: {}, update: {[updateOp]: {tenantId: 1}}}}]; + const fn = () => modifyBulkWriteOperations({ops, tenantId, tenantIdKey}); + expect(fn).toThrow(); + }); + + it.each([ + ['tenantId present', {tenantId: 'a'}, {tenantId: 't'}], + ['tenantId absent', {}, {tenantId: 't'}], + ])('modifies filter of replaceOne (%s)', (name, filter, expectedFilter) => { + const ops = [{replaceOne: {filter, replacement: {tenantId: 't'}}}]; + const result = modifyBulkWriteOperations({ops, tenantId, tenantIdKey}); + expect(result).toEqual([ + {replaceOne: {filter: expectedFilter, replacement: {tenantId: 't'}}}, + ]); + }); + + it.each([ + ['tenantId present', {tenantId: 'a'}, {tenantId: 't'}], + ['tenantId absent', {}, {tenantId: 't'}], + ])( + 'modifies document of replaceOne (%s)', + (name, replacement, expectedReplacement) => { + const ops = [{replaceOne: {filter: {tenantId: 't'}, replacement}}]; + const result = modifyBulkWriteOperations({ops, tenantId, tenantIdKey}); + expect(result).toEqual([ + { + replaceOne: { + filter: {tenantId: 't'}, + replacement: expectedReplacement, + }, + }, + ]); + } + ); + + it.each([ + ['deleteOne', 'tenantId present', {tenantId: 'a'}, {tenantId: 't'}], + ['deleteOne', 'tenantId absent', {}, {tenantId: 't'}], + ['deleteMany', 'tenantId present', {tenantId: 'a'}, {tenantId: 't'}], + ['deleteMany', 'tenantId absent', {}, {tenantId: 't'}], + ])('modifies filter of %s (%s)', (op, name, filter, expectedFilter) => { + const ops = [{[op]: {filter}}]; + const result = modifyBulkWriteOperations({ops, tenantId, tenantIdKey}); + expect(result).toEqual([{[op]: {filter: expectedFilter}}]); + }); +}); diff --git a/src/index.test.integration.js b/src/index.test.integration.js index b635672..54f6322 100644 --- a/src/index.test.integration.js +++ b/src/index.test.integration.js @@ -121,11 +121,16 @@ describe('plugin', () => { expect(results).toEqual([{_id: 'tenant1', sum: 22}]); }); - it.skip('binds Model.bulkWrite() to tenant context - not implemented', async () => { + it('binds Model.bulkWrite() to tenant context - experimental', async () => { const {model} = buildModel({k: Number, v: Number}); await model.create( {tenantId: 'a', k: 1, v: 1}, {tenantId: 'a', k: 2, v: 1}, + {tenantId: 'a', k: 3, v: 1}, + {tenantId: 'a', k: 4, v: 10}, + {tenantId: 'a', k: 5, v: 10}, + {tenantId: 'a', k: 6, v: 3}, + {tenantId: 'a', k: 7, v: 3}, {tenantId: 'b', k: 1, v: 1} ); @@ -133,7 +138,7 @@ describe('plugin', () => { { insertOne: { document: { - k: 3, + k: 8, v: 1, }, }, @@ -144,7 +149,17 @@ describe('plugin', () => { k: 2, }, update: { - v: 2, + $set: {v: 2}, + }, + }, + }, + { + updateMany: { + filter: { + v: 10, + }, + update: { + $set: {v: 20}, }, }, }, @@ -155,12 +170,27 @@ describe('plugin', () => { }, }, }, - // {replaceOne: {}}, - // {updateMany: {}}, - // {deleteMany: {}}, + { + deleteMany: { + filter: { + v: 3, + }, + }, + }, + { + replaceOne: { + filter: { + k: 3, + }, + replacement: { + k: 3, + v: 2, + }, + }, + }, ]); - const docs = await model.find(); + const docs = await model.find().sort({tenantId: 1, k: 1}); const objects = docs.map(doc => doc.toObject()); expect(objects).toMatchObject([ @@ -172,6 +202,21 @@ describe('plugin', () => { { tenantId: 'a', k: 3, + v: 2, + }, + { + tenantId: 'a', + k: 4, + v: 20, + }, + { + tenantId: 'a', + k: 5, + v: 20, + }, + { + tenantId: 'a', + k: 8, v: 1, }, { From 495fab32d4450f18cae58b037b5d62a9c0f47d72 Mon Sep 17 00:00:00 2001 From: baranga Date: Sun, 23 Jun 2019 13:42:49 +0200 Subject: [PATCH 34/61] Implement missing tests for findById and findByIdAnd* --- src/index.test.integration.js | 80 ++++++++++++++++++++++++++++++++--- 1 file changed, 75 insertions(+), 5 deletions(-) diff --git a/src/index.test.integration.js b/src/index.test.integration.js index 54f6322..c83288f 100644 --- a/src/index.test.integration.js +++ b/src/index.test.integration.js @@ -1,5 +1,5 @@ const {Mongoose, Schema, version: mongooseVersion} = require('mongoose'); -const MongoClient = require('mongodb').MongoClient; +const {MongoClient, ObjectId} = require('mongodb'); const plugin = require('./index'); const MONGO_URI = @@ -271,12 +271,82 @@ describe('plugin', () => { expect(docs[1]).toHaveProperty('tenantId', 'a'); }); - it.skip('binds Model.findById() to tenant context', async () => {}); + it('binds Model.findById() to tenant context', async () => { + const {model} = buildModel(); + const idA = new ObjectId('5d0f607b30ace3beef0beed0'); + const idB = new ObjectId('5d0f607d30ace3beef0beed1'); + await model.create({_id: idA, tenantId: 'a'}, {_id: idB, tenantId: 'b'}); + + const [docA, docB] = await Promise.all([ + model.byTenant('a').findById(idA), + model.byTenant('b').findById(idA), + ]); + + expect(docA).toBeTruthy(); + expect(docB).toBeNull(); + }); + if (mongooseVersion >= '5.1.0') { - it.skip('binds Model.findByIdAndDelete() to tenant context', async () => {}); + it('binds Model.findByIdAndDelete() to tenant context', async () => { + const {model} = buildModel(); + const idA = new ObjectId('5d0f607b30ace3beef0beed0'); + const idB = new ObjectId('5d0f607d30ace3beef0beed1'); + await model.create( + {_id: idA, tenantId: 'a'}, + {_id: idB, tenantId: 'b'} + ); + + await Promise.all([ + model.byTenant('a').findByIdAndDelete(idA), + model.byTenant('a').findByIdAndDelete(idB), + ]); + + const docs = await model.find(); + const objects = docs.map(doc => doc.toObject()); + + expect(objects).toMatchObject([{_id: idB, tenantId: 'b'}]); + }); } - it.skip('binds Model.findByIdAndRemove() to tenant context', async () => {}); - it.skip('binds Model.findByIdAndUpdate() to tenant context', async () => {}); + + it('binds Model.findByIdAndRemove() to tenant context', async () => { + const {model} = buildModel(); + const idA = new ObjectId('5d0f607b30ace3beef0beed0'); + const idB = new ObjectId('5d0f607d30ace3beef0beed1'); + await model.create({_id: idA, tenantId: 'a'}, {_id: idB, tenantId: 'b'}); + + await Promise.all([ + model.byTenant('a').findByIdAndRemove(idA), + model.byTenant('a').findByIdAndRemove(idB), + ]); + + const docs = await model.find(); + const objects = docs.map(doc => doc.toObject()); + + expect(objects).toMatchObject([{_id: idB, tenantId: 'b'}]); + }); + + it('binds Model.findByIdAndUpdate() to tenant context', async () => { + const {model} = buildModel({t: Number}); + const idA = new ObjectId('5d0f607b30ace3beef0beed0'); + const idB = new ObjectId('5d0f607d30ace3beef0beed1'); + await model.create( + {_id: idA, tenantId: 'a', t: 1}, + {_id: idB, tenantId: 'b', t: 1} + ); + + await Promise.all([ + model.byTenant('a').findByIdAndUpdate(idA, {t: 2}), + model.byTenant('a').findByIdAndUpdate(idB, {t: 2}), + ]); + + const docs = await model.find().sort({tenantId: 1}); + const objects = docs.map(doc => doc.toObject()); + + expect(objects).toMatchObject([ + {_id: idA, tenantId: 'a', t: 2}, + {_id: idB, tenantId: 'b', t: 1}, + ]); + }); it('binds Model.findOne() to tenant context', async () => { const {model} = buildModel(); From e04e49cec0462be914afdb52f2c7ec8194b3eae0 Mon Sep 17 00:00:00 2001 From: baranga Date: Sun, 23 Jun 2019 13:44:10 +0200 Subject: [PATCH 35/61] Fix typo in comment --- src/api/tenant-aware-model/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/api/tenant-aware-model/index.js b/src/api/tenant-aware-model/index.js index d8e9bec..1652745 100644 --- a/src/api/tenant-aware-model/index.js +++ b/src/api/tenant-aware-model/index.js @@ -64,7 +64,7 @@ const createPlainModel = ({base, db, tenantId, tenantIdGetter, tenantIdKey}) => const self = this; const tenantId = this[tenantIdGetter](); - // Model.inserMany supports a single document as parameter + // Model.insertMany supports a single document as parameter if (!Array.isArray(docs)) { docs[tenantIdKey] = tenantId; } else { From 8f4ae65779c02bd3306617f4a02217e57a8a0320 Mon Sep 17 00:00:00 2001 From: baranga Date: Sun, 23 Jun 2019 13:51:04 +0200 Subject: [PATCH 36/61] Implement missing tests for save middleware --- src/index.test.integration.js | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/src/index.test.integration.js b/src/index.test.integration.js index c83288f..86293fe 100644 --- a/src/index.test.integration.js +++ b/src/index.test.integration.js @@ -532,8 +532,35 @@ describe('plugin', () => { expect(objects).toMatchObject([{tenantId: 'a'}]); }); - it.skip('inserts tenant id on save of new document', async () => {}); - it.skip('protects against removal of tenant id on save', async () => {}); - it.skip('protects against override of tenant id on save', async () => {}); + it('inserts tenant id on save of new document', async () => { + const {model} = buildModel({}); + const modelA = model.byTenant('a'); + const doc = new modelA(); + await doc.save(); + + expect(doc.toObject()).toMatchObject({tenantId: 'a'}); + }); + + it('protects against removal of tenant id on save', async () => { + const {model} = buildModel({}); + const modelA = model.byTenant('a'); + const doc = new modelA(); + await doc.save(); + doc.tenantId = undefined; + await doc.save(); + + expect(doc.toObject()).toMatchObject({tenantId: 'a'}); + }); + + it('protects against override of tenant id on save', async () => { + const {model} = buildModel({}); + const modelA = model.byTenant('a'); + const doc = new modelA(); + await doc.save(); + doc.tenantId = 'b'; + await doc.save(); + + expect(doc.toObject()).toMatchObject({tenantId: 'a'}); + }); }); }); From 92bb63298510565dba6162b22bc85909f39017cf Mon Sep 17 00:00:00 2001 From: baranga Date: Tue, 25 Jun 2019 12:05:01 +0200 Subject: [PATCH 37/61] Add integtration tests for compounded indexes --- src/index.test.integration.js | 262 ++++++++++++++++++++++++++++++++++ 1 file changed, 262 insertions(+) diff --git a/src/index.test.integration.js b/src/index.test.integration.js index 86293fe..17ec90d 100644 --- a/src/index.test.integration.js +++ b/src/index.test.integration.js @@ -20,6 +20,18 @@ const resetDb = async () => { await db.close(); }; +const waitForEvent = ({subject, event, timeout = 250}) => + new Promise((resolve, reject) => { + const handle = setTimeout( + () => reject(new Error(`Wait for event timed out`)), + timeout + ); + subject.on(event, () => { + clearTimeout(handle); + resolve(); + }); + }); + describe('plugin', () => { describe('with real connection', () => { let mongoose; @@ -562,5 +574,255 @@ describe('plugin', () => { expect(doc.toObject()).toMatchObject({tenantId: 'a'}); }); + + describe('applied on schema with unique index', () => { + describe('on schema level', () => { + describe('without preserveUniqueKey option', () => { + let schema; + let model; + + beforeEach(async () => { + schema = new Schema({id: Number}); + schema.index({id: 1}, {unique: true}); + schema.plugin(plugin); + model = mongoose.model('model', schema); + + await waitForEvent({subject: model, event: 'index'}); + }); + + it('modifies index properly', async () => { + const indexes = schema.indexes(); + expect(indexes).toContainEqual([ + {id: 1, tenantId: 1}, + {unique: true, background: true}, + ]); + }); + + it('allows inserting same unique value for different tenants', async () => { + const docs = await model.create([ + {id: 1, tenantId: 'a'}, + {id: 1, tenantId: 'b'}, + ]); + expect(docs).toHaveLength(2); + }); + + it('prevents inserting same unique value for same tenant', () => { + const promise = model.create([ + {id: 1, tenantId: 'a'}, + {id: 1, tenantId: 'a'}, + ]); + return expect(promise).rejects.toThrow(); + }); + }); + + describe('with preserveUniqueKey set to `true`', () => { + let schema; + let model; + + beforeEach(async () => { + schema = new Schema({id: Number}); + schema.index({id: 1}, {unique: true, preserveUniqueKey: true}); + schema.plugin(plugin); + model = mongoose.model('model', schema); + + await waitForEvent({subject: model, event: 'index'}); + }); + + it('keeps index intact', () => { + const indexes = schema.indexes(); + expect(indexes).toContainEqual([ + {id: 1}, + {unique: true, preserveUniqueKey: true, background: true}, + ]); + }); + + it('prevents inserting same unique value for different tenants', () => { + const promise = model.create([ + {id: 1, tenantId: 'a'}, + {id: 1, tenantId: 'b'}, + ]); + return expect(promise).rejects.toThrow(); + }); + + it('prevents inserting same unique value for same tenant', () => { + const promise = model.create([ + {id: 1, tenantId: 'a'}, + {id: 1, tenantId: 'a'}, + ]); + return expect(promise).rejects.toThrow(); + }); + }); + + describe('with all known mongodb index options set', () => { + let schema; + let indexes; + let idIndex; + let idIndexOptions; + + beforeEach(async () => { + schema = new Schema({id: Number}); + schema.index( + {id: 1}, + { + background: false, + expireAfterSeconds: 600, + dropDups: true, + min: 5, + max: 23, + name: 'id_with_options', + partialFilterExpression: {id: {$gt: 0}}, + sparse: true, + v: 1, + } + ); + schema.plugin(plugin); + indexes = schema.indexes(); + idIndex = indexes.reduce( + (matchedIndex, currentIndex) => + matchedIndex || + (currentIndex[0].id === 1 ? currentIndex : null), + null + ); + idIndexOptions = idIndex[1]; + }); + + it.each([ + ['background', false], + ['expireAfterSeconds', 600], + ['dropDups', true], + ['min', 5], + ['max', 23], + ['name', 'id_with_options'], + ['partialFilterExpression', {id: {$gt: 0}}], + ['sparse', true], + ['v', 1], + ])('preserves the %s option', (key, value) => { + expect(idIndexOptions).toHaveProperty(key, value); + }); + }); + }); + + describe('on field level', () => { + describe('without preserveUniqueKey option', () => { + let schema; + let model; + + beforeEach(async () => { + ({schema, model} = buildModel({id: {type: Number, unique: true}})); + await waitForEvent({subject: model, event: 'index'}); + }); + + it('modifies index properly', () => { + const indexes = schema.indexes(); + expect(indexes).toContainEqual([ + {id: 1, tenantId: 1}, + {unique: true, background: true}, + ]); + }); + + it('allows inserting same unique value for different tenants', async () => { + const docs = await model.create([ + {id: 1, tenantId: 'a'}, + {id: 1, tenantId: 'b'}, + ]); + expect(docs).toHaveLength(2); + }); + + it('prevents inserting same unique value for same tenant', () => { + const promise = model.create([ + {id: 1, tenantId: 'a'}, + {id: 1, tenantId: 'a'}, + ]); + return expect(promise).rejects.toThrow(); + }); + }); + + describe('with preserveUniqueKey set to `true`', () => { + let schema; + let model; + + beforeEach(async () => { + ({schema, model} = buildModel({ + id: {type: Number, unique: true, preserveUniqueKey: true}, + })); + await waitForEvent({subject: model, event: 'index'}); + }); + + it('keeps index intact', () => { + const indexes = schema.indexes(); + expect(indexes).toContainEqual([ + {id: 1}, + {unique: true, background: true}, + ]); + }); + + it('prevents inserting same unique value for different tenants', () => { + const promise = model.create([ + {id: 1, tenantId: 'a'}, + {id: 1, tenantId: 'b'}, + ]); + return expect(promise).rejects.toThrow(); + }); + + it('prevents inserting same unique value for same tenant', () => { + const promise = model.create([ + {id: 1, tenantId: 'a'}, + {id: 1, tenantId: 'a'}, + ]); + return expect(promise).rejects.toThrow(); + }); + }); + }); + + describe('with all known mongodb index options set', () => { + let schema; + let indexes; + let idIndex; + let idIndexOptions; + + beforeEach(async () => { + schema = new Schema({ + id: { + type: Number, + index: { + background: false, + expireAfterSeconds: 600, + dropDups: true, + min: 5, + max: 23, + name: 'id_with_options', + partialFilterExpression: {id: {$gt: 0}}, + sparse: true, + v: 1, + }, + }, + }); + schema.plugin(plugin); + indexes = schema.indexes(); + idIndex = indexes.reduce( + (matchedIndex, currentIndex) => + matchedIndex || (currentIndex[0].id === 1 ? currentIndex : null), + null + ); + idIndexOptions = idIndex[1]; + }); + + it.each([ + ['background', false], + ['expireAfterSeconds', 600], + ['dropDups', true], + ['min', 5], + ['max', 23], + ['name', 'id_with_options'], + ['partialFilterExpression', {id: {$gt: 0}}], + ['sparse', true], + ['v', 1], + ])('preserves the %s option', (key, value) => { + expect(idIndexOptions).toHaveProperty(key, value); + }); + }); + }); + + it.skip('it properly binds populated sub models', () => {}); }); }); From adf082b4bdff6ef17d4a1d253886851a9da069ac Mon Sep 17 00:00:00 2001 From: baranga Date: Tue, 25 Jun 2019 12:05:35 +0200 Subject: [PATCH 38/61] Fix field level compound index creation --- src/index.test.integration.js | 1 + src/schema/compound-indexes.js | 27 ++++++++++----------------- 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/src/index.test.integration.js b/src/index.test.integration.js index 17ec90d..89260f4 100644 --- a/src/index.test.integration.js +++ b/src/index.test.integration.js @@ -7,6 +7,7 @@ const MONGO_URI = const sleep = milliseconds => new Promise(resolve => setTimeout(resolve, milliseconds)); + const resetDb = async () => { const db = await MongoClient.connect(MONGO_URI); const collections = await db.collections(); diff --git a/src/schema/compound-indexes.js b/src/schema/compound-indexes.js index 179a0ca..38e7269 100644 --- a/src/schema/compound-indexes.js +++ b/src/schema/compound-indexes.js @@ -21,6 +21,11 @@ const compoundSchemaLevelUniqueIndexes = ({schema, tenantIdKey}) => { }); }; +const removeFieldLevelIndex = path => { + path._index = null; + delete path.options.unique; +}; + /** * Apply tenancy awareness to field level unique indexes * @param {object} schema @@ -32,34 +37,22 @@ const compoundFieldLevelUniqueIndexes = ({schema, tenantIdKey}) => { // skip if preserveUniqueKey of an unique field is set to true if (pathOptions.unique === true && pathOptions.preserveUniqueKey !== true) { - // delete the old index - path._index = null; - delete path.options.unique; - // prepare new options - let indexOptions = { + const options = { + ...(path._index || {}), unique: true, }; - // add sparse option if set in options - if (pathOptions.sparse) { - indexOptions.sparse = true; - } - - // add partialFilterExpression option if set in options (see issue #21) - if (pathOptions.partialFilterExpression) { - indexOptions.partialFilterExpression = - pathOptions.partialFilterExpression; - } - // create a new one that includes the tenant id field schema.index( { [tenantIdKey]: 1, [key]: 1, }, - indexOptions + options ); + + removeFieldLevelIndex(path); } }); }; From 43ce13e18daae27accd42daaecb1e17ba0d7a46c Mon Sep 17 00:00:00 2001 From: baranga Date: Tue, 25 Jun 2019 12:48:32 +0200 Subject: [PATCH 39/61] Document first breaking changes to keep track of them --- release-notes.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/release-notes.yml b/release-notes.yml index 176533f..3897a97 100644 --- a/release-notes.yml +++ b/release-notes.yml @@ -7,6 +7,13 @@ description: > multi-tenancy environment (on premise vs. cloud hosted) is a question of a single line of config. releases: +- version: Unreleased + added: + - 'Full support of path level index options (`new Schema({t: {type: String, index: {...}})`).' + removed: + - 'Schema types no longer support the shorthand `partialFilterExpression` option. That shorthand option was never + supported by mongoose in the first place. If that option is needed please use + `{..., index: { partialFilterExpression: ...}}` instead.' - version: 1.6.0 date: 2019-03-21 fixed: From 889e7b88c1de98884679b5bae41eabaf33a055ae Mon Sep 17 00:00:00 2001 From: baranga Date: Tue, 25 Jun 2019 12:49:38 +0200 Subject: [PATCH 40/61] Update release-notes cli dependency --- package.json | 2 +- yarn.lock | 313 +++++++++++++++++++++++++++------------------------ 2 files changed, 167 insertions(+), 148 deletions(-) diff --git a/package.json b/package.json index 643b2ab..cc4ac01 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ }, "license": "MIT", "devDependencies": { - "@release-notes/cli": "^0.1.0", + "@release-notes/cli": "^0.3.0", "coveralls": "^3.0.0", "jest": "^24.8.0", "mongodb": "^2.2.35", diff --git a/yarn.lock b/yarn.lock index df7702b..989a8e5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -285,24 +285,36 @@ "@types/istanbul-reports" "^1.1.1" "@types/yargs" "^12.0.9" -"@release-notes/cli@^0.1.0": - version "0.1.0" - resolved "https://registry.yarnpkg.com/@release-notes/cli/-/cli-0.1.0.tgz#9f457562955b4ce90af0f22bb49a48bcea815169" +"@release-notes/changelog-parser@^0.1.2": + version "0.1.2" + resolved "https://registry.yarnpkg.com/@release-notes/changelog-parser/-/changelog-parser-0.1.2.tgz#15fe8ae9b103b4890e370b1a5a2f0e735d992667" + integrity sha512-sDV94jlAM4JHAmL9tTCf+6XN9to7G17HX8sKO/KTkQP4kbQiPlyzlIHLk+8dqMehDmRTmyGB6i5+1b9sgLNRtg== dependencies: - "@release-notes/node" "^0.2.0" - yargs "^8.0.2" + "@release-notes/node" "^0.3.0" -"@release-notes/node@^0.2.0": - version "0.2.0" - resolved "https://registry.yarnpkg.com/@release-notes/node/-/node-0.2.0.tgz#8f941197b9db5c8b668ae0ed3e6ecb6fb49a8678" +"@release-notes/cli@^0.3.0": + version "0.3.0" + resolved "https://registry.yarnpkg.com/@release-notes/cli/-/cli-0.3.0.tgz#ace2c434273420ecb32b3cfc56880a0782792be3" + integrity sha512-LDvKdyW7X2Luxlk6MFcIOfWQCTpaXGtOg/0WfI9oK523nJ0Jv0cbC36nR3CPHifZBZ6waREt4cJea7o+rOmZlg== dependencies: - "@release-notes/schema" "^0.1.0" - ajv "^5.2.2" - js-yaml "^3.9.0" + "@release-notes/changelog-parser" "^0.1.2" + "@release-notes/node" "^0.3.0" + request "^2.83.0" + yargs "^10.0.3" -"@release-notes/schema@^0.1.0": - version "0.1.0" - resolved "https://registry.yarnpkg.com/@release-notes/schema/-/schema-0.1.0.tgz#bbe101987966295ec1eab1eab1e6fcd99bd93436" +"@release-notes/node@^0.3.0": + version "0.3.0" + resolved "https://registry.yarnpkg.com/@release-notes/node/-/node-0.3.0.tgz#7c833c9916ac3ae414e46c9bd983e0c42b867fab" + integrity sha1-fIM8mRasOuQU5Gyb2YPgxCuGf6s= + dependencies: + "@release-notes/schema" "^0.2.0" + ajv "^5.5.2" + js-yaml "^3.10.0" + +"@release-notes/schema@^0.2.0": + version "0.2.0" + resolved "https://registry.yarnpkg.com/@release-notes/schema/-/schema-0.2.0.tgz#16b7f551f3f09397cec5b432a1e357334f986fe2" + integrity sha512-E9GX7w9Xd2kflVxwdKSZf/n+7lSJt9Uyuv2wxl9oai35MzqMNRlk86t5NYoIat7zt43HUlQIauAw0JFukIEFlw== "@types/babel__core@^7.1.0": version "7.1.2" @@ -400,7 +412,7 @@ acorn@^6.0.1: resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.1.1.tgz#7d25ae05bb8ad1f9b699108e1094ecd7884adc1f" integrity sha512-jPTiwtOxaHNaAPg/dmrJ/beuzLRnXtB0kQPQ8JpotKJgTB6rX6c8mlf315941pyjBSaPg8NHXS9fhP4u17DpGA== -ajv@^5.1.0, ajv@^5.2.2: +ajv@^5.1.0, ajv@^5.5.2: version "5.5.2" resolved "https://registry.yarnpkg.com/ajv/-/ajv-5.5.2.tgz#73b5eeca3fab653e3d3f9422b341ad42205dc965" dependencies: @@ -554,11 +566,12 @@ async-limiter@~1.0.0: resolved "https://registry.yarnpkg.com/async-limiter/-/async-limiter-1.0.0.tgz#78faed8c3d074ab81f22b4e985d79e8738f720f8" integrity sha512-jp/uFnooOiO+L211eZOoSyzpOITMXx1rBITauYykG3BRYPu8h0UcxsPNB04RR5vo4Tyz3+ay17tR6JVf9qzYWg== -async@2.1.4: - version "2.1.4" - resolved "https://registry.yarnpkg.com/async/-/async-2.1.4.tgz#2d2160c7788032e4dd6cbe2502f1f9a2c8f6cde4" +async@2.6.2: + version "2.6.2" + resolved "https://registry.yarnpkg.com/async/-/async-2.6.2.tgz#18330ea7e6e313887f5d2f2a904bac6fe4dd5381" + integrity sha512-H1qVYh1MYhEEFLsP97cVKqCGo7KfCyTt6uEWqsTBr9SO84oK9Uwbyd/yCW+6rKJLHksBNUVWZDAjfS+Ccx0Bbg== dependencies: - lodash "^4.14.0" + lodash "^4.17.11" async@^1.4.0: version "1.5.2" @@ -715,9 +728,10 @@ bcrypt-pbkdf@^1.0.0: dependencies: tweetnacl "^0.14.3" -bluebird@3.5.0: - version "3.5.0" - resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.5.0.tgz#791420d7f551eea2897453a8a77653f96606d67c" +bluebird@3.5.1: + version "3.5.1" + resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.5.1.tgz#d9551f9de98f1fcda1e683d17ee91a0602ee2eb9" + integrity sha512-MKiLiV+I1AA596t9w1sQJ8jkiSr5+ZKi0WKrYGUn6d1Fx+Ij4tIj+m2WMQSGczs5jZVxV339chE8iwk6F64wjA== boom@4.x.x: version "4.3.1" @@ -782,6 +796,11 @@ bser@^2.0.0: dependencies: node-int64 "^0.4.0" +bson@^1.1.1, bson@~1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/bson/-/bson-1.1.1.tgz#4330f5e99104c4e751e7351859e2d408279f2f13" + integrity sha512-jCGVYLoYMHDkOsbwJZBCqwMHyH4c+wzgI9hG7Z6SZJRXWr+x58pdIbm2i9a/jFGCkRJqRUr8eoI7lDWa0hTkxg== + bson@~1.0.4: version "1.0.5" resolved "https://registry.yarnpkg.com/bson/-/bson-1.0.5.tgz#34563b73ff1fde9387c1b9fb5afd845ecc4ba623" @@ -903,14 +922,6 @@ cliui@^2.1.0: right-align "^0.1.1" wordwrap "0.0.2" -cliui@^3.2.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/cliui/-/cliui-3.2.0.tgz#120601537a916d29940f934da3b48d585a39213d" - dependencies: - string-width "^1.0.1" - strip-ansi "^3.0.1" - wrap-ansi "^2.0.0" - cliui@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/cliui/-/cliui-4.0.0.tgz#743d4650e05f36d1ed2575b59638d87322bfbbcc" @@ -1077,15 +1088,15 @@ debug-log@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/debug-log/-/debug-log-1.0.1.tgz#2307632d4c04382b8df8a32f70b895046d52745f" -debug@2.6.9, debug@^2.2.0, debug@^2.3.3, debug@^2.6.8: - version "2.6.9" - resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" +debug@3.1.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" -debug@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261" +debug@^2.2.0, debug@^2.3.3, 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" @@ -1459,7 +1470,7 @@ find-up@^1.0.0: path-exists "^2.0.0" pinkie-promise "^2.0.0" -find-up@^2.0.0, find-up@^2.1.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: @@ -2501,7 +2512,15 @@ js-tokens@^4.0.0: resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== -js-yaml@^3.6.1, js-yaml@^3.9.0: +js-yaml@^3.10.0: + version "3.13.1" + resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.13.1.tgz#aff151b30bfdfa8e49e05da22e7415e9dfa37847" + integrity sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw== + dependencies: + argparse "^1.0.7" + esprima "^4.0.0" + +js-yaml@^3.6.1: version "3.11.0" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.11.0.tgz#597c1a8bd57152f26d622ce4117851a51f5ebaef" dependencies: @@ -2591,9 +2610,10 @@ jsprim@^1.2.2: json-schema "0.2.3" verror "1.10.0" -kareem@2.0.5: - version "2.0.5" - resolved "https://registry.yarnpkg.com/kareem/-/kareem-2.0.5.tgz#437e1e40f1be304ee21b3e4790eb3a05418b35ca" +kareem@2.3.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/kareem/-/kareem-2.3.0.tgz#ef33c42e9024dce511eeaf440cd684f3af1fc769" + integrity sha512-6hHxsp9e6zQU8nXsP+02HGWXwTkOEw6IROhF2ZA28cYbUk4eJ6QbtZvdqZOdD9YPKghG3apk5eOCvs+tLl3lRg== kind-of@^3.0.2, kind-of@^3.0.3, kind-of@^3.2.0: version "3.2.2" @@ -2669,15 +2689,6 @@ 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" - load-json-file@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-4.0.0.tgz#2f5f45ab91e33216234fd53adab668eb4ec0993b" @@ -2703,24 +2714,20 @@ locate-path@^3.0.0: p-locate "^3.0.0" path-exists "^3.0.0" -lodash.get@4.4.2: - version "4.4.2" - resolved "https://registry.yarnpkg.com/lodash.get/-/lodash.get-4.4.2.tgz#2d177f652fa31e939b4438d5341499dfa3825e99" - lodash.sortby@^4.7.0: version "4.7.0" resolved "https://registry.yarnpkg.com/lodash.sortby/-/lodash.sortby-4.7.0.tgz#edd14c824e2cc9c1e0b0a1b42bb5210516a42438" integrity sha1-7dFMgk4sycHgsKG0K7UhBRakJDg= -lodash@^4.14.0, lodash@^4.17.4: - version "4.17.5" - resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.5.tgz#99a92d65c0272debe8c96b6057bc8fbfa3bed511" - lodash@^4.17.11: version "4.17.11" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.11.tgz#b39ea6229ef607ecd89e2c8df12536891cac9b8d" integrity sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg== +lodash@^4.17.4: + version "4.17.5" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.5.tgz#99a92d65c0272debe8c96b6057bc8fbfa3bed511" + log-driver@^1.2.5: version "1.2.7" resolved "https://registry.yarnpkg.com/log-driver/-/log-driver-1.2.7.tgz#63b95021f0702fedfa2c9bb0a24e7797d71871d8" @@ -2799,6 +2806,11 @@ mem@^4.0.0: mimic-fn "^2.0.0" p-is-promise "^2.0.0" +memory-pager@^1.0.2: + version "1.5.0" + resolved "https://registry.yarnpkg.com/memory-pager/-/memory-pager-1.5.0.tgz#d8751655d22d384682741c972f2c3d6dfa3e66b5" + integrity sha512-ZS4Bp4r/Zoeq6+NLJpP+0Zzm0pR8whtGPf1XExKLJBAczGMnSi3It14OiNCStjQjM6NU1okjQGSxgEZN8eBYKg== + merge-source-map@^1.0.2: version "1.1.0" resolved "https://registry.yarnpkg.com/merge-source-map/-/merge-source-map-1.1.0.tgz#2fdde7e6020939f70906a68f2d7ae685e4c8c646" @@ -2951,18 +2963,24 @@ mongodb-core@2.1.19: bson "~1.0.4" require_optional "~1.0.0" -mongodb-core@3.0.4: - version "3.0.4" - resolved "https://registry.yarnpkg.com/mongodb-core/-/mongodb-core-3.0.4.tgz#a3fdf466e697a2f1df87e458e5e2df1c26cc654b" +mongodb-core@3.2.7: + version "3.2.7" + resolved "https://registry.yarnpkg.com/mongodb-core/-/mongodb-core-3.2.7.tgz#a8ef1fe764a192c979252dacbc600dc88d77e28f" + integrity sha512-WypKdLxFNPOH/Jy6i9z47IjG2wIldA54iDZBmHMINcgKOUcWJh8og+Wix76oGd7EyYkHJKssQ2FAOw5Su/n4XQ== dependencies: - bson "~1.0.4" + bson "^1.1.1" require_optional "^1.0.1" + safe-buffer "^5.1.2" + optionalDependencies: + saslprep "^1.0.0" -mongodb@3.0.4: - version "3.0.4" - resolved "https://registry.yarnpkg.com/mongodb/-/mongodb-3.0.4.tgz#ee0c0f7bc565edc5f40ee2d23170e522a8ad2286" +mongodb@3.2.7: + version "3.2.7" + resolved "https://registry.yarnpkg.com/mongodb/-/mongodb-3.2.7.tgz#8ba149e4be708257cad0dea72aebb2bbb311a7ac" + integrity sha512-2YdWrdf1PJgxcCrT1tWoL6nHuk6hCxhddAAaEh8QJL231ci4+P9FLyqopbTm2Z2sAU6mhCri+wd9r1hOcHdoMw== dependencies: - mongodb-core "3.0.4" + mongodb-core "3.2.7" + safe-buffer "^5.1.2" mongodb@^2.2.35: version "2.2.35" @@ -2975,40 +2993,52 @@ mongodb@^2.2.35: mongoose-legacy-pluralize@1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/mongoose-legacy-pluralize/-/mongoose-legacy-pluralize-1.0.2.tgz#3ba9f91fa507b5186d399fb40854bff18fb563e4" + integrity sha512-Yo/7qQU4/EyIS8YDFSeenIvXxZN+ld7YdV9LqFVQJzTLye8unujAWPZ4NWKfFA+RNjh+wvTWKY9Z3E5XM6ZZiQ== mongoose@^5.0.11: - version "5.0.11" - resolved "https://registry.yarnpkg.com/mongoose/-/mongoose-5.0.11.tgz#bb31a98591cd2377312ded28155281110a9e1da0" - dependencies: - async "2.1.4" - bson "~1.0.4" - kareem "2.0.5" - lodash.get "4.4.2" - mongodb "3.0.4" + version "5.6.1" + resolved "https://registry.yarnpkg.com/mongoose/-/mongoose-5.6.1.tgz#4efc3373b8121fdac4192896e303bb8cc572907b" + integrity sha512-/EBoXS+fZv8dYf0VKMXwhTEVYUI+6EbmVhmV2DzO9BGacTSgStQprU09rZYfVxe8EmLhmTrSV5eCIRLBYuXGag== + dependencies: + async "2.6.2" + bson "~1.1.1" + kareem "2.3.0" + mongodb "3.2.7" + mongodb-core "3.2.7" mongoose-legacy-pluralize "1.0.2" - mpath "0.3.0" - mquery "3.0.0" - ms "2.0.0" - regexp-clone "0.0.1" + mpath "0.6.0" + mquery "3.2.1" + ms "2.1.2" + regexp-clone "1.0.0" + safe-buffer "5.1.2" + sift "7.0.1" sliced "1.0.1" -mpath@0.3.0: - version "0.3.0" - resolved "https://registry.yarnpkg.com/mpath/-/mpath-0.3.0.tgz#7a58f789e9b5fd3c94520634157960f26bd5ef44" +mpath@0.6.0: + version "0.6.0" + resolved "https://registry.yarnpkg.com/mpath/-/mpath-0.6.0.tgz#aa922029fca4f0f641f360e74c5c1b6a4c47078e" + integrity sha512-i75qh79MJ5Xo/sbhxrDrPSEG0H/mr1kcZXJ8dH6URU5jD/knFxCVqVC/gVSW7GIXL/9hHWlT9haLbCXWOll3qw== -mquery@3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/mquery/-/mquery-3.0.0.tgz#e5f387dbabc0b9b69859e550e810faabe0ceabb0" +mquery@3.2.1: + version "3.2.1" + resolved "https://registry.yarnpkg.com/mquery/-/mquery-3.2.1.tgz#8b059a49cdae0a8a9e804284ef64c2f58d3ac05d" + integrity sha512-kY/K8QToZWTTocm0U+r8rqcJCp5PRl6e8tPmoDs5OeSO3DInZE2rAL6AYH+V406JTo8305LdASOQcxRDqHojyw== dependencies: - bluebird "3.5.0" - debug "2.6.9" - regexp-clone "0.0.1" - sliced "0.0.5" + bluebird "3.5.1" + debug "3.1.0" + regexp-clone "^1.0.0" + safe-buffer "5.1.2" + sliced "1.0.1" ms@2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" +ms@2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" + integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== + ms@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.1.tgz#30a5864eb3ebb0a66f2ebe6d727af06a09d86e0a" @@ -3432,12 +3462,6 @@ 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" - path-type@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/path-type/-/path-type-3.0.0.tgz#cef31dc8e0a1a3bb0d105c0cd97cf3bf47f4e36f" @@ -3607,13 +3631,6 @@ 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-up@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-4.0.0.tgz#1b221c6088ba7799601c808f91161c66e58f8978" @@ -3630,14 +3647,6 @@ read-pkg@^1.0.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" - read-pkg@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-3.0.0.tgz#9cbc686978fee65d16c00e2b19c237fcf6e38389" @@ -3696,9 +3705,10 @@ regex-not@^1.0.0, regex-not@^1.0.2: extend-shallow "^3.0.2" safe-regex "^1.1.0" -regexp-clone@0.0.1: - version "0.0.1" - resolved "https://registry.yarnpkg.com/regexp-clone/-/regexp-clone-0.0.1.tgz#a7c2e09891fdbf38fbb10d376fb73003e68ac589" +regexp-clone@1.0.0, regexp-clone@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/regexp-clone/-/regexp-clone-1.0.0.tgz#222db967623277056260b992626354a04ce9bf63" + integrity sha512-TuAasHQNamyyJ2hb97IuBEif4qBHGjPHBS64sZwytpLEqtBQ1gPJTnOaQ6qmpET16cK14kkjbazl6+p0RRv0yw== remove-trailing-separator@^1.0.1: version "1.1.0" @@ -3761,7 +3771,7 @@ request@^2.79.0: tunnel-agent "^0.6.0" uuid "^3.1.0" -request@^2.87.0: +request@^2.83.0, request@^2.87.0: version "2.88.0" resolved "https://registry.yarnpkg.com/request/-/request-2.88.0.tgz#9c2fca4f7d35b592efe57c7f0a55e81052124fef" integrity sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg== @@ -3867,15 +3877,15 @@ rsvp@^4.8.4: resolved "https://registry.yarnpkg.com/rsvp/-/rsvp-4.8.4.tgz#b50e6b34583f3dd89329a2f23a8a2be072845911" integrity sha512-6FomvYPfs+Jy9TfXmBpBuMWNH94SgCsZmJKcanySzgNNP6LjWxBvyLTa9KaMfDDM5oxRfrKDB0r/qeRsLwnBfA== -safe-buffer@^5.0.1, safe-buffer@^5.1.1, safe-buffer@~5.1.0: - version "5.1.1" - resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.1.tgz#893312af69b2123def71f57889001671eeb2c853" - -safe-buffer@^5.1.2, safe-buffer@~5.1.1: +safe-buffer@5.1.2, safe-buffer@^5.1.2, safe-buffer@~5.1.1: version "5.1.2" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g== +safe-buffer@^5.0.1, safe-buffer@^5.1.1, safe-buffer@~5.1.0: + version "5.1.1" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.1.tgz#893312af69b2123def71f57889001671eeb2c853" + safe-regex@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/safe-regex/-/safe-regex-1.1.0.tgz#40a3669f3b077d1e943d44629e157dd48023bf2e" @@ -3902,6 +3912,13 @@ sane@^4.0.3: minimist "^1.1.1" walker "~1.0.5" +saslprep@^1.0.0: + version "1.0.3" + resolved "https://registry.yarnpkg.com/saslprep/-/saslprep-1.0.3.tgz#4c02f946b56cf54297e347ba1093e7acac4cf226" + integrity sha512-/MY/PEMbk2SuY5sScONwhUDsV2p77Znkb/q3nSVstq/yQzYJOH/Azh29p9oJLsl3LnQwSvZDKagDGBsBwSooag== + dependencies: + sparse-bitfield "^3.0.3" + sax@^1.2.4: version "1.2.4" resolved "https://registry.yarnpkg.com/sax/-/sax-1.2.4.tgz#2816234e2378bddc4e5354fab5caa895df7100d9" @@ -3958,6 +3975,11 @@ shellwords@^0.1.1: resolved "https://registry.yarnpkg.com/shellwords/-/shellwords-0.1.1.tgz#d6b9181c1a48d397324c84871efbcfc73fc0654b" integrity sha512-vFwSUfQvqybiICwZY5+DAWIPLKsWO31Q91JSKl3UYv+K5c2QRPzn0qzec6QPu1Qc9eHYItiP3NdJqNVqetYAww== +sift@7.0.1: + version "7.0.1" + resolved "https://registry.yarnpkg.com/sift/-/sift-7.0.1.tgz#47d62c50b159d316f1372f8b53f9c10cd21a4b08" + integrity sha512-oqD7PMJ+uO6jV9EQCl0LrRw1OwsiPsiFQR5AR30heR+4Dl7jBBbDLnNvWiak20tzZlSE1H7RB30SX/1j/YYT7g== + 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" @@ -3972,10 +3994,6 @@ slash@^2.0.0: resolved "https://registry.yarnpkg.com/slash/-/slash-2.0.0.tgz#de552851a1759df3a8f206535442f5ec4ddeab44" integrity sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A== -sliced@0.0.5: - version "0.0.5" - resolved "https://registry.yarnpkg.com/sliced/-/sliced-0.0.5.tgz#5edc044ca4eb6f7816d50ba2fc63e25d8fe4707f" - sliced@1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/sliced/-/sliced-1.0.1.tgz#0b3a662b5d04c3177b1926bea82b03f837a2ef41" @@ -4055,6 +4073,13 @@ source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.1: resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== +sparse-bitfield@^3.0.3: + version "3.0.3" + resolved "https://registry.yarnpkg.com/sparse-bitfield/-/sparse-bitfield-3.0.3.tgz#ff4ae6e68656056ba4b3e792ab3334d38273ca11" + integrity sha1-/0rm5oZWBWuks+eSqzM004JzyhE= + dependencies: + memory-pager "^1.0.2" + spawn-wrap@^1.4.2: version "1.4.2" resolved "https://registry.yarnpkg.com/spawn-wrap/-/spawn-wrap-1.4.2.tgz#cff58e73a8224617b6561abdc32586ea0c82248c" @@ -4599,13 +4624,7 @@ yargs-parser@^11.1.1: camelcase "^5.0.0" decamelize "^1.2.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-parser@^8.0.0: +yargs-parser@^8.0.0, yargs-parser@^8.1.0: version "8.1.0" resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-8.1.0.tgz#f1376a33b6629a5d063782944da732631e966950" dependencies: @@ -4634,6 +4653,24 @@ yargs@11.1.0: y18n "^3.2.1" yargs-parser "^9.0.2" +yargs@^10.0.3: + version "10.1.2" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-10.1.2.tgz#454d074c2b16a51a43e2fb7807e4f9de69ccb5c5" + integrity sha512-ivSoxqBGYOqQVruxD35+EyCFDYNEFL/Uo6FcOnz+9xZdZzK0Zzw4r4KhbrME1Oo2gOggwJod2MnsdamSG7H9ig== + dependencies: + cliui "^4.0.0" + decamelize "^1.1.1" + find-up "^2.1.0" + get-caller-file "^1.0.1" + os-locale "^2.0.0" + require-directory "^2.1.1" + require-main-filename "^1.0.1" + set-blocking "^2.0.0" + string-width "^2.0.0" + which-module "^2.0.0" + y18n "^3.2.1" + yargs-parser "^8.1.0" + yargs@^12.0.2: version "12.0.5" resolved "https://registry.yarnpkg.com/yargs/-/yargs-12.0.5.tgz#05f5997b609647b64f66b81e3b4b10a368e7ad13" @@ -4652,24 +4689,6 @@ yargs@^12.0.2: y18n "^3.2.1 || ^4.0.0" yargs-parser "^11.1.1" -yargs@^8.0.2: - version "8.0.2" - resolved "https://registry.yarnpkg.com/yargs/-/yargs-8.0.2.tgz#6299a9055b1cefc969ff7e79c1d918dceb22c360" - dependencies: - camelcase "^4.1.0" - cliui "^3.2.0" - decamelize "^1.1.1" - get-caller-file "^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 "^2.0.0" - which-module "^2.0.0" - y18n "^3.2.1" - yargs-parser "^7.0.0" - yargs@~3.10.0: version "3.10.0" resolved "https://registry.yarnpkg.com/yargs/-/yargs-3.10.0.tgz#f7ee7bd857dd7c1d2d38c0e74efbd681d1431fd1" From c8811ddee59ef74b07d613e4ed6256c8e265cd53 Mon Sep 17 00:00:00 2001 From: baranga Date: Tue, 25 Jun 2019 13:02:28 +0200 Subject: [PATCH 41/61] Fix issue with field level indexes --- src/schema/compound-indexes.js | 4 +++- src/schema/compound-indexes.test.js | 11 ++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/schema/compound-indexes.js b/src/schema/compound-indexes.js index 38e7269..a3e9265 100644 --- a/src/schema/compound-indexes.js +++ b/src/schema/compound-indexes.js @@ -36,7 +36,9 @@ const compoundFieldLevelUniqueIndexes = ({schema, tenantIdKey}) => { const pathOptions = path.options; // skip if preserveUniqueKey of an unique field is set to true - if (pathOptions.unique === true && pathOptions.preserveUniqueKey !== true) { + const isUniqueIndex = + pathOptions.unique || (pathOptions.index && pathOptions.index.unique); + if (isUniqueIndex && pathOptions.preserveUniqueKey !== true) { // prepare new options const options = { ...(path._index || {}), diff --git a/src/schema/compound-indexes.test.js b/src/schema/compound-indexes.test.js index 1fe9ae9..83ad758 100644 --- a/src/schema/compound-indexes.test.js +++ b/src/schema/compound-indexes.test.js @@ -71,21 +71,22 @@ describe('compound-indexes', () => { const schema = new Schema({ id: { type: String, - unique: true, + index: { + unique: true, + sparse: true, + partialFilterExpression: {}, + }, preserveUniqueKey: false, - sparse: true, - partialFilterExpression: {}, }, }); compoundIndexes({schema, tenantIdKey}); - expect(schema.indexes()).toEqual([ + expect(schema.indexes()).toMatchObject([ [ {id: 1, [tenantIdKey]: 1}, { unique: true, sparse: true, partialFilterExpression: {}, - background: true, }, ], ]); From e5e81ce13f9b9963caccc94cf1d6df407d5abc6f Mon Sep 17 00:00:00 2001 From: baranga Date: Tue, 25 Jun 2019 13:02:55 +0200 Subject: [PATCH 42/61] Upgrade mongoose and mongodb dev dependencies --- package.json | 4 +- yarn.lock | 1045 +++++++++++++++++++++++--------------------------- 2 files changed, 486 insertions(+), 563 deletions(-) diff --git a/package.json b/package.json index cc4ac01..7d9bfc2 100644 --- a/package.json +++ b/package.json @@ -38,8 +38,8 @@ "@release-notes/cli": "^0.3.0", "coveralls": "^3.0.0", "jest": "^24.8.0", - "mongodb": "^2.2.35", - "mongoose": "^5.0.11", + "mongodb": "^3.2.7", + "mongoose": "^5.6.1", "nyc": "^11.6.0", "prettier": "^1.18.2" }, diff --git a/yarn.lock b/yarn.lock index 989a8e5..efe2888 100644 --- a/yarn.lock +++ b/yarn.lock @@ -343,9 +343,9 @@ "@babel/types" "^7.0.0" "@types/babel__traverse@*", "@types/babel__traverse@^7.0.6": - version "7.0.6" - resolved "https://registry.yarnpkg.com/@types/babel__traverse/-/babel__traverse-7.0.6.tgz#328dd1a8fc4cfe3c8458be9477b219ea158fd7b2" - integrity sha512-XYVgHF2sQ0YblLRMLNPB3CkFMewzFmlDsH/TneZFHUXDlABQgh88uOxuez7ZcXxayLFrqLwtDH1t+FmlFwNZxw== + version "7.0.7" + resolved "https://registry.yarnpkg.com/@types/babel__traverse/-/babel__traverse-7.0.7.tgz#2496e9ff56196cc1429c72034e07eab6121b6f3f" + integrity sha512-CeBpmX1J8kWLcDEnI3Cl2Eo6RfbGvzUctA+CjZUhOKDFbLfcr7fc4usEqLNWetrlJd7RhAkyYe2czXop4fICpw== dependencies: "@babel/types" "^7.3.0" @@ -412,9 +412,10 @@ acorn@^6.0.1: resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.1.1.tgz#7d25ae05bb8ad1f9b699108e1094ecd7884adc1f" integrity sha512-jPTiwtOxaHNaAPg/dmrJ/beuzLRnXtB0kQPQ8JpotKJgTB6rX6c8mlf315941pyjBSaPg8NHXS9fhP4u17DpGA== -ajv@^5.1.0, ajv@^5.5.2: +ajv@^5.5.2: version "5.5.2" resolved "https://registry.yarnpkg.com/ajv/-/ajv-5.5.2.tgz#73b5eeca3fab653e3d3f9422b341ad42205dc965" + integrity sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU= dependencies: co "^4.6.0" fast-deep-equal "^1.0.0" @@ -431,18 +432,6 @@ ajv@^6.5.5: json-schema-traverse "^0.4.1" uri-js "^4.2.2" -align-text@^0.1.1, align-text@^0.1.3: - version "0.1.4" - resolved "https://registry.yarnpkg.com/align-text/-/align-text-0.1.4.tgz#0cd90a561093f35d0a99256c22b7069433fad117" - dependencies: - kind-of "^3.0.2" - longest "^1.0.1" - repeat-string "^1.5.2" - -amdefine@>=0.0.4: - version "1.0.1" - resolved "https://registry.yarnpkg.com/amdefine/-/amdefine-1.0.1.tgz#4a5282ac164729e93619bcfd3ad151f817ce91f5" - ansi-escapes@^3.0.0: version "3.2.0" resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-3.2.0.tgz#8780b98ff9dbf5638152d1f1fe5c1d7b4442976b" @@ -451,10 +440,12 @@ ansi-escapes@^3.0.0: ansi-regex@^2.0.0: version "2.1.1" resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df" + integrity sha1-w7M6te42DYbg5ijwRorn7yfWVN8= ansi-regex@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-3.0.0.tgz#ed0317c322064f79466c02966bddb605ab37d998" + integrity sha1-7QMXwyIGT3lGbAKWa922Bas32Zg= ansi-regex@^4.0.0, ansi-regex@^4.1.0: version "4.1.0" @@ -464,6 +455,7 @@ ansi-regex@^4.0.0, ansi-regex@^4.1.0: ansi-styles@^2.2.1: version "2.2.1" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe" + integrity sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4= ansi-styles@^3.2.0, ansi-styles@^3.2.1: version "3.2.1" @@ -483,6 +475,7 @@ anymatch@^2.0.0: append-transform@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/append-transform/-/append-transform-0.4.0.tgz#d76ebf8ca94d276e247a36bad44a4b74ab611991" + integrity sha1-126/jKlNJ24keja61EpLdKthGZE= dependencies: default-require-extensions "^1.0.0" @@ -494,6 +487,7 @@ aproba@^1.0.3: archy@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/archy/-/archy-1.0.0.tgz#f9c8c13757cc1dd7bc379ac77b2c62a5c2868c40" + integrity sha1-+cjBN1fMHde8N5rHeyxipcKGjEA= are-we-there-yet@~1.1.2: version "1.1.5" @@ -506,26 +500,31 @@ are-we-there-yet@~1.1.2: argparse@^1.0.7: version "1.0.10" resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" + integrity sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg== dependencies: sprintf-js "~1.0.2" arr-diff@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/arr-diff/-/arr-diff-2.0.0.tgz#8f3b827f955a8bd669697e4a4256ac3ceae356cf" + integrity sha1-jzuCf5Vai9ZpaX5KQlasPOrjVs8= dependencies: arr-flatten "^1.0.1" arr-diff@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/arr-diff/-/arr-diff-4.0.0.tgz#d6461074febfec71e7e15235761a329a5dc7c520" + integrity sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA= arr-flatten@^1.0.1, arr-flatten@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/arr-flatten/-/arr-flatten-1.1.0.tgz#36048bbff4e7b47e136644316c99669ea5ae91f1" + integrity sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg== arr-union@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/arr-union/-/arr-union-3.1.0.tgz#e39b09aea9def866a8f206e288af63919bae39c4" + integrity sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ= array-equal@^1.0.0: version "1.0.0" @@ -535,26 +534,34 @@ array-equal@^1.0.0: array-unique@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/array-unique/-/array-unique-0.2.1.tgz#a1d97ccafcbc2625cc70fadceb36a50c58b01a53" + integrity sha1-odl8yvy8JiXMcPrc6zalDFiwGlM= array-unique@^0.3.2: version "0.3.2" resolved "https://registry.yarnpkg.com/array-unique/-/array-unique-0.3.2.tgz#a894b75d4bc4f6cd679ef3244a9fd8f46ae2d428" + integrity sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg= arrify@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d" + integrity sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0= asn1@~0.2.3: - version "0.2.3" - resolved "https://registry.yarnpkg.com/asn1/-/asn1-0.2.3.tgz#dac8787713c9966849fc8180777ebe9c1ddf3b86" + version "0.2.4" + resolved "https://registry.yarnpkg.com/asn1/-/asn1-0.2.4.tgz#8d2475dfab553bb33e77b54e59e880bb8ce23136" + integrity sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg== + dependencies: + safer-buffer "~2.1.0" assert-plus@1.0.0, assert-plus@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/assert-plus/-/assert-plus-1.0.0.tgz#f12e0f3c5d77b0b1cdd9146942e4e96c1e4dd525" + integrity sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU= assign-symbols@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/assign-symbols/-/assign-symbols-1.0.0.tgz#59667f41fadd4f20ccbc2bb96b8d4f7f78ec0367" + integrity sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c= astral-regex@^1.0.0: version "1.0.0" @@ -573,25 +580,20 @@ async@2.6.2: dependencies: lodash "^4.17.11" -async@^1.4.0: - version "1.5.2" - resolved "https://registry.yarnpkg.com/async/-/async-1.5.2.tgz#ec6a61ae56480c0c3cb241c95618e20892f9672a" - asynckit@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" + integrity sha1-x57Zf380y48robyXkLzDZkdLS3k= -atob@^2.0.0: - version "2.0.3" - resolved "https://registry.yarnpkg.com/atob/-/atob-2.0.3.tgz#19c7a760473774468f20b2d2d03372ad7d4cbf5d" +atob@^2.1.1: + version "2.1.2" + resolved "https://registry.yarnpkg.com/atob/-/atob-2.1.2.tgz#6d9517eb9e030d2436666651e86bd9f6f13533c9" + integrity sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg== aws-sign2@~0.7.0: version "0.7.0" resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.7.0.tgz#b46e890934a9591f2d2f6f86d7e6a9f1b3fe76a8" - -aws4@^1.6.0: - version "1.6.0" - resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.6.0.tgz#83ef5ca860b2b32e4a0deedee8c771b9db57471e" + integrity sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg= aws4@^1.8.0: version "1.8.0" @@ -601,6 +603,7 @@ aws4@^1.8.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" + integrity sha1-Y/1D99weO7fONZR9uP42mj9Yx0s= dependencies: chalk "^1.1.3" esutils "^2.0.2" @@ -609,6 +612,7 @@ babel-code-frame@^6.26.0: babel-generator@^6.18.0: version "6.26.1" resolved "https://registry.yarnpkg.com/babel-generator/-/babel-generator-6.26.1.tgz#1844408d3b8f0d35a404ea7ac180f087a601bd90" + integrity sha512-HyfwY6ApZj7BYTcJURpM5tznulaBvyio7/0d4zFOeMPUmfxkCjHocCuoLa2SAGzBI8AREcH3eP3758F672DppA== dependencies: babel-messages "^6.23.0" babel-runtime "^6.26.0" @@ -635,6 +639,7 @@ babel-jest@^24.8.0: babel-messages@^6.23.0: version "6.23.0" resolved "https://registry.yarnpkg.com/babel-messages/-/babel-messages-6.23.0.tgz#f3cdf4703858035b2a2951c6ec5edf6c62f2630e" + integrity sha1-8830cDhYA1sqKVHG7F7fbGLyYw4= dependencies: babel-runtime "^6.22.0" @@ -665,6 +670,7 @@ babel-preset-jest@^24.6.0: babel-runtime@^6.22.0, babel-runtime@^6.26.0: version "6.26.0" resolved "https://registry.yarnpkg.com/babel-runtime/-/babel-runtime-6.26.0.tgz#965c7058668e82b55d7bfe04ff2337bc8b5647fe" + integrity sha1-llxwWGaOgrVde/4E/yM3vItWR/4= dependencies: core-js "^2.4.0" regenerator-runtime "^0.11.0" @@ -672,6 +678,7 @@ babel-runtime@^6.22.0, babel-runtime@^6.26.0: babel-template@^6.16.0: version "6.26.0" resolved "https://registry.yarnpkg.com/babel-template/-/babel-template-6.26.0.tgz#de03e2d16396b069f46dd9fff8521fb1a0e35e02" + integrity sha1-3gPi0WOWsGn0bdn/+FIfsaDjXgI= dependencies: babel-runtime "^6.26.0" babel-traverse "^6.26.0" @@ -682,6 +689,7 @@ babel-template@^6.16.0: 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" + integrity sha1-RqnL1+3MYsjlwGTi0tjQ9ANXZu4= dependencies: babel-code-frame "^6.26.0" babel-messages "^6.23.0" @@ -696,6 +704,7 @@ babel-traverse@^6.18.0, babel-traverse@^6.26.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" + integrity sha1-o7Bz+Uq0nrb6Vc1lInozQ4BjJJc= dependencies: babel-runtime "^6.26.0" esutils "^2.0.2" @@ -705,14 +714,17 @@ babel-types@^6.18.0, babel-types@^6.26.0: babylon@^6.18.0: version "6.18.0" resolved "https://registry.yarnpkg.com/babylon/-/babylon-6.18.0.tgz#af2f3b88fa6f5c1e4c634d1a0f8eac4f55b395e3" + integrity sha512-q/UEjfGJ2Cm3oKV71DJz9d25TPnq5rhBVL2Q4fA5wcC3jcrdn7+SssEybFIxwAvvP+YCsCYNKughoF33GxgycQ== balanced-match@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" + integrity sha1-ibTRmasr7kneFk6gK4nORi1xt2c= base@^0.11.1: version "0.11.2" resolved "https://registry.yarnpkg.com/base/-/base-0.11.2.tgz#7bde5ced145b6d551a90db87f83c558b4eb48a8f" + integrity sha512-5T6P4xPgpp0YDFvSWwEZ4NoE3aM4QBQXDzmVbraCkFj8zHM+mba8SyqB5DbZWyR7mYHo6Y7BdQo3MoA4m0TeQg== dependencies: cache-base "^1.0.1" class-utils "^0.3.5" @@ -723,8 +735,9 @@ base@^0.11.1: pascalcase "^0.1.1" bcrypt-pbkdf@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.1.tgz#63bc5dcb61331b92bc05fd528953c33462a06f8d" + version "1.0.2" + resolved "https://registry.yarnpkg.com/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz#a4301d389b6a43f9b67ff3ca11a3f6637e360e9e" + integrity sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4= dependencies: tweetnacl "^0.14.3" @@ -733,21 +746,10 @@ bluebird@3.5.1: resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.5.1.tgz#d9551f9de98f1fcda1e683d17ee91a0602ee2eb9" integrity sha512-MKiLiV+I1AA596t9w1sQJ8jkiSr5+ZKi0WKrYGUn6d1Fx+Ij4tIj+m2WMQSGczs5jZVxV339chE8iwk6F64wjA== -boom@4.x.x: - version "4.3.1" - resolved "https://registry.yarnpkg.com/boom/-/boom-4.3.1.tgz#4f8a3005cb4a7e3889f749030fd25b96e01d2e31" - dependencies: - hoek "4.x.x" - -boom@5.x.x: - version "5.2.0" - resolved "https://registry.yarnpkg.com/boom/-/boom-5.2.0.tgz#5dd9da6ee3a5f302077436290cb717d3f4a54e02" - dependencies: - hoek "4.x.x" - brace-expansion@^1.1.7: version "1.1.11" resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" + integrity sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA== dependencies: balanced-match "^1.0.0" concat-map "0.0.1" @@ -755,22 +757,22 @@ brace-expansion@^1.1.7: braces@^1.8.2: version "1.8.5" resolved "https://registry.yarnpkg.com/braces/-/braces-1.8.5.tgz#ba77962e12dff969d6b76711e914b737857bf6a7" + integrity sha1-uneWLhLf+WnWt2cR6RS3N4V79qc= dependencies: expand-range "^1.8.1" preserve "^0.2.0" repeat-element "^1.1.2" braces@^2.3.1: - version "2.3.1" - resolved "https://registry.yarnpkg.com/braces/-/braces-2.3.1.tgz#7086c913b4e5a08dbe37ac0ee6a2500c4ba691bb" + version "2.3.2" + resolved "https://registry.yarnpkg.com/braces/-/braces-2.3.2.tgz#5979fd3f14cd531565e5fa2df1abfff1dfaee729" + integrity sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w== dependencies: arr-flatten "^1.1.0" array-unique "^0.3.2" - define-property "^1.0.0" extend-shallow "^2.0.1" fill-range "^4.0.0" isobject "^3.0.1" - kind-of "^6.0.2" repeat-element "^1.1.2" snapdragon "^0.8.1" snapdragon-node "^2.0.1" @@ -790,9 +792,9 @@ browser-resolve@^1.11.3: resolve "1.1.7" bser@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/bser/-/bser-2.0.0.tgz#9ac78d3ed5d915804fd87acb158bc797147a1719" - integrity sha1-mseNPtXZFYBP2HrLFYvHlxR6Fxk= + version "2.1.0" + resolved "https://registry.yarnpkg.com/bser/-/bser-2.1.0.tgz#65fc784bf7f87c009b973c12db6546902fa9c7b5" + integrity sha512-8zsjWrQkkBoLK6uxASk1nJ2SKv97ltiGDo6A3wA0/yRPz+CwmEyDo0hUrhIuukG2JHpAl3bvFIixw2/3Hi0DOg== dependencies: node-int64 "^0.4.0" @@ -801,26 +803,15 @@ bson@^1.1.1, bson@~1.1.1: resolved "https://registry.yarnpkg.com/bson/-/bson-1.1.1.tgz#4330f5e99104c4e751e7351859e2d408279f2f13" integrity sha512-jCGVYLoYMHDkOsbwJZBCqwMHyH4c+wzgI9hG7Z6SZJRXWr+x58pdIbm2i9a/jFGCkRJqRUr8eoI7lDWa0hTkxg== -bson@~1.0.4: - version "1.0.5" - resolved "https://registry.yarnpkg.com/bson/-/bson-1.0.5.tgz#34563b73ff1fde9387c1b9fb5afd845ecc4ba623" - buffer-from@^1.0.0: version "1.1.1" resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef" integrity sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A== -buffer-shims@~1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/buffer-shims/-/buffer-shims-1.0.0.tgz#9978ce317388c649ad8793028c3477ef044a8b51" - -builtin-modules@^1.0.0: - version "1.1.1" - resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-1.1.1.tgz#270f076c5a72c02f5b65a47df94c5fe3a278892f" - cache-base@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/cache-base/-/cache-base-1.0.1.tgz#0a7f46416831c8b662ee36fe4e7c59d76f666ab2" + integrity sha512-AKcdTnFSWATd5/GCPRxr2ChwIJ85CeyrEyjRHlKxQ56d4XJMGym0uAiKn0xbLOGOl3+yRpOTi484dVCEc5AUzQ== dependencies: collection-visit "^1.0.0" component-emitter "^1.2.1" @@ -835,6 +826,7 @@ cache-base@^1.0.1: caching-transform@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/caching-transform/-/caching-transform-1.0.1.tgz#6dbdb2f20f8d8fbce79f3e94e9d1742dcdf5c0a1" + integrity sha1-bb2y8g+Nj7znnz6U6dF0Lc31wKE= dependencies: md5-hex "^1.2.0" mkdirp "^0.5.1" @@ -845,13 +837,10 @@ callsites@^3.0.0: resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73" integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ== -camelcase@^1.0.2: - version "1.2.1" - resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-1.2.1.tgz#9bb5304d2e0b56698b2c758b08a3eaa9daa58a39" - camelcase@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-4.1.0.tgz#d545635be1e33c542649c69173e5de6acfae34dd" + integrity sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0= camelcase@^5.0.0: version "5.3.1" @@ -868,17 +857,12 @@ capture-exit@^2.0.0: caseless@~0.12.0: version "0.12.0" resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc" - -center-align@^0.1.1: - version "0.1.3" - resolved "https://registry.yarnpkg.com/center-align/-/center-align-0.1.3.tgz#aa0d32629b6ee972200411cbd4461c907bc2b7ad" - dependencies: - align-text "^0.1.3" - lazy-cache "^1.0.3" + integrity sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw= chalk@^1.1.3: version "1.1.3" resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98" + integrity sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg= dependencies: ansi-styles "^2.2.1" escape-string-regexp "^1.0.2" @@ -908,23 +892,17 @@ ci-info@^2.0.0: class-utils@^0.3.5: version "0.3.6" resolved "https://registry.yarnpkg.com/class-utils/-/class-utils-0.3.6.tgz#f93369ae8b9a7ce02fd41faad0ca83033190c463" + integrity sha512-qOhPa/Fj7s6TY8H8esGu5QNpMMQxz79h+urzrNYN6mn+9BnxlDGf5QZ+XeCDsxSjPqsSR56XOZOJmpeurnLMeg== dependencies: arr-union "^3.1.0" define-property "^0.2.5" isobject "^3.0.0" static-extend "^0.1.1" -cliui@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/cliui/-/cliui-2.1.0.tgz#4b475760ff80264c762c3a1719032e91c7fea0d1" - dependencies: - center-align "^0.1.1" - right-align "^0.1.1" - wordwrap "0.0.2" - cliui@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/cliui/-/cliui-4.0.0.tgz#743d4650e05f36d1ed2575b59638d87322bfbbcc" + version "4.1.0" + resolved "https://registry.yarnpkg.com/cliui/-/cliui-4.1.0.tgz#348422dbe82d800b3022eef4f6ac10bf2e4d1b49" + integrity sha512-4FG+RSG9DL7uEwRUZXZn3SS34DiDPfzP0VOiEwtUWlE+AR2EIg+hSyvrIgUUfhdgR/UkAeW2QHgeP+hWrXs7jQ== dependencies: string-width "^2.1.1" strip-ansi "^4.0.0" @@ -933,14 +911,17 @@ cliui@^4.0.0: co@^4.6.0: version "4.6.0" resolved "https://registry.yarnpkg.com/co/-/co-4.6.0.tgz#6ea6bdf3d853ae54ccb8e47bfa0bf3f9031fb184" + integrity sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ= code-point-at@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77" + integrity sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c= collection-visit@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/collection-visit/-/collection-visit-1.0.0.tgz#4bc0373c164bc3291b4d368c829cf1a80a59dca0" + integrity sha1-S8A3PBZLwykbTTaMgpzxqApZ3KA= dependencies: map-visit "^1.0.0" object-visit "^1.0.0" @@ -957,12 +938,6 @@ color-name@1.1.3: resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" integrity sha1-p9BVi9icQveV3UIyj3QIMcpTvCU= -combined-stream@1.0.6, combined-stream@~1.0.5: - version "1.0.6" - resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.6.tgz#723e7df6e801ac5613113a7e445a9b69cb632818" - dependencies: - delayed-stream "~1.0.0" - combined-stream@^1.0.6, combined-stream@~1.0.6: version "1.0.8" resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f" @@ -978,56 +953,61 @@ commander@~2.20.0: commondir@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/commondir/-/commondir-1.0.1.tgz#ddd800da0c66127393cca5950ea968a3aaf1253b" + integrity sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs= component-emitter@^1.2.1: - version "1.2.1" - resolved "https://registry.yarnpkg.com/component-emitter/-/component-emitter-1.2.1.tgz#137918d6d78283f7df7a6b7c5a63e140e69425e6" + version "1.3.0" + resolved "https://registry.yarnpkg.com/component-emitter/-/component-emitter-1.3.0.tgz#16e4070fba8ae29b679f2215853ee181ab2eabc0" + integrity sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg== concat-map@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" + integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s= console-control-strings@^1.0.0, console-control-strings@~1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/console-control-strings/-/console-control-strings-1.1.0.tgz#3d7cf4464db6446ea644bf4b39507f9851008e8e" integrity sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4= -convert-source-map@^1.1.0, convert-source-map@^1.4.0: +convert-source-map@^1.1.0, convert-source-map@^1.4.0, convert-source-map@^1.5.1: version "1.6.0" resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.6.0.tgz#51b537a8c43e0f04dec1993bffcdd504e758ac20" integrity sha512-eFu7XigvxdZ1ETfbgPBohgyQ/Z++C0eEhTor0qRwBw9unw+L0/6V8wkSuGgzdThkiS5lSpdptOQPD8Ak40a+7A== dependencies: safe-buffer "~5.1.1" -convert-source-map@^1.5.1: - version "1.5.1" - resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.5.1.tgz#b8278097b9bc229365de5c62cf5fcaed8b5599e5" - copy-descriptor@^0.1.0: version "0.1.1" resolved "https://registry.yarnpkg.com/copy-descriptor/-/copy-descriptor-0.1.1.tgz#676f6eb3c39997c2ee1ac3a924fd6124748f578d" + integrity sha1-Z29us8OZl8LuGsOpJP1hJHSPV40= core-js@^2.4.0: - version "2.5.3" - resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.5.3.tgz#8acc38345824f16d8365b7c9b4259168e8ed603e" + version "2.6.9" + resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.6.9.tgz#6b4b214620c834152e179323727fc19741b084f2" + integrity sha512-HOpZf6eXmnl7la+cUdMnLvUxKNqLUzJvgIziQ0DiF3JwSImNphIqdGqzj6hIKyX04MmV0poclQ7+wjWvxQyR2A== core-util-is@1.0.2, core-util-is@~1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" + integrity sha1-tf1UIgqivFq1eqtxQMlAdUUDwac= coveralls@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/coveralls/-/coveralls-3.0.0.tgz#22ef730330538080d29b8c151dc9146afde88a99" + version "3.0.4" + resolved "https://registry.yarnpkg.com/coveralls/-/coveralls-3.0.4.tgz#f50233c9c62fd0973f710fce85fd19dba24cff4b" + integrity sha512-eyqUWA/7RT0JagiL0tThVhjbIjoiEUyWCjtUJoOPcWoeofP5WK/jb2OJYoBFrR6DvplR+AxOyuBqk4JHkk5ykA== dependencies: - js-yaml "^3.6.1" + growl "~> 1.10.0" + js-yaml "^3.11.0" lcov-parse "^0.0.10" - log-driver "^1.2.5" + log-driver "^1.2.7" minimist "^1.2.0" - request "^2.79.0" + request "^2.86.0" cross-spawn@^4: version "4.0.2" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-4.0.2.tgz#7b9247621c23adfdd3856004a823cbe397424d41" + integrity sha1-e5JHYhwjrf3ThWAEqCPL45dCTUE= dependencies: lru-cache "^4.0.1" which "^1.2.9" @@ -1035,6 +1015,7 @@ cross-spawn@^4: cross-spawn@^5.0.1: version "5.1.0" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-5.1.0.tgz#e8bd0efee58fcff6f8f94510a0a554bbfa235449" + integrity sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk= dependencies: lru-cache "^4.0.1" shebang-command "^1.2.0" @@ -1051,12 +1032,6 @@ cross-spawn@^6.0.0: shebang-command "^1.2.0" which "^1.2.9" -cryptiles@3.x.x: - version "3.1.2" - resolved "https://registry.yarnpkg.com/cryptiles/-/cryptiles-3.1.2.tgz#a89fbb220f5ce25ec56e8c4aa8a4fd7b5b0d29fe" - dependencies: - boom "5.x.x" - cssom@0.3.x, "cssom@>= 0.3.2 < 0.4.0": version "0.3.6" resolved "https://registry.yarnpkg.com/cssom/-/cssom-0.3.6.tgz#f85206cee04efa841f3c5982a74ba96ab20d65ad" @@ -1072,6 +1047,7 @@ cssstyle@^1.0.0: dashdash@^1.12.0: version "1.14.1" resolved "https://registry.yarnpkg.com/dashdash/-/dashdash-1.14.1.tgz#853cfa0f7cbe2fed5de20326b8dd581035f6e2f0" + integrity sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA= dependencies: assert-plus "^1.0.0" @@ -1087,20 +1063,23 @@ data-urls@^1.0.0: debug-log@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/debug-log/-/debug-log-1.0.1.tgz#2307632d4c04382b8df8a32f70b895046d52745f" + integrity sha1-IwdjLUwEOCuN+KMvcLiVBG1SdF8= -debug@3.1.0, debug@^3.1.0: +debug@3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261" + integrity sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g== dependencies: ms "2.0.0" debug@^2.2.0, debug@^2.3.3, debug@^2.6.8: version "2.6.9" resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" + integrity sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA== dependencies: ms "2.0.0" -debug@^3.2.6: +debug@^3.1.0, debug@^3.2.6: version "3.2.6" resolved "https://registry.yarnpkg.com/debug/-/debug-3.2.6.tgz#e83d17de16d8a7efb7717edbe5fb10135eee629b" integrity sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ== @@ -1114,13 +1093,15 @@ debug@^4.1.0, debug@^4.1.1: dependencies: ms "^2.1.1" -decamelize@^1.0.0, decamelize@^1.1.1, decamelize@^1.2.0: +decamelize@^1.1.1, decamelize@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" + integrity sha1-9lNNFRSCabIDUue+4m9QH5oZEpA= decode-uri-component@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/decode-uri-component/-/decode-uri-component-0.2.0.tgz#eb3913333458775cb84cd1a1fae062106bb87545" + integrity sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU= deep-extend@^0.6.0: version "0.6.0" @@ -1135,6 +1116,7 @@ deep-is@~0.1.3: default-require-extensions@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/default-require-extensions/-/default-require-extensions-1.0.0.tgz#f37ea15d3e13ffd9b437d33e1a75b5fb97874cb8" + integrity sha1-836hXT4T/9m0N9M+GnW1+5eHTLg= dependencies: strip-bom "^2.0.0" @@ -1148,18 +1130,21 @@ define-properties@^1.1.2: define-property@^0.2.5: version "0.2.5" resolved "https://registry.yarnpkg.com/define-property/-/define-property-0.2.5.tgz#c35b1ef918ec3c990f9a5bc57be04aacec5c8116" + integrity sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY= dependencies: is-descriptor "^0.1.0" define-property@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/define-property/-/define-property-1.0.0.tgz#769ebaaf3f4a63aad3af9e8d304c9bbe79bfb0e6" + integrity sha1-dp66rz9KY6rTr56NMEybvnm/sOY= dependencies: is-descriptor "^1.0.0" define-property@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/define-property/-/define-property-2.0.2.tgz#d459689e8d654ba77e02a817f8710d702cb16e9d" + integrity sha512-jwK2UV4cnPpbcG7+VRARKTZPUWowwXA8bzH5NP6ud0oeAxyYPuGZUAC7hMugpCdz4BeSZl2Dl9k66CHJ/46ZYQ== dependencies: is-descriptor "^1.0.2" isobject "^3.0.1" @@ -1167,6 +1152,7 @@ define-property@^2.0.2: delayed-stream@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" + integrity sha1-3zrhmayt+31ECqrgsp4icrJOxhk= delegates@^1.0.0: version "1.0.0" @@ -1176,6 +1162,7 @@ delegates@^1.0.0: detect-indent@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/detect-indent/-/detect-indent-4.0.0.tgz#f76d064352cdf43a1cb6ce619c4ee3a9475de208" + integrity sha1-920GQ1LN9Docts5hnE7jqUdd4gg= dependencies: repeating "^2.0.0" @@ -1202,10 +1189,12 @@ domexception@^1.0.1: webidl-conversions "^4.0.2" ecc-jsbn@~0.1.1: - version "0.1.1" - resolved "https://registry.yarnpkg.com/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz#0fc73a9ed5f0d53c38193398523ef7e543777505" + version "0.1.2" + resolved "https://registry.yarnpkg.com/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz#3a83a904e54353287874c564b7549386849a98c9" + integrity sha1-OoOpBOVDUyh4dMVkt1SThoSamMk= dependencies: jsbn "~0.1.0" + safer-buffer "^2.1.0" end-of-stream@^1.1.0: version "1.4.1" @@ -1214,13 +1203,7 @@ end-of-stream@^1.1.0: dependencies: once "^1.4.0" -error-ex@^1.2.0: - version "1.3.1" - resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.1.tgz#f855a86ce61adc4e8621c3cda21e7a7612c3a8dc" - dependencies: - is-arrayish "^0.2.1" - -error-ex@^1.3.1: +error-ex@^1.2.0, error-ex@^1.3.1: version "1.3.2" resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.2.tgz#b4ac40648107fdcdcfae242f428bea8a14d4f1bf" integrity sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g== @@ -1248,10 +1231,6 @@ es-to-primitive@^1.2.0: is-date-object "^1.0.1" is-symbol "^1.0.2" -es6-promise@3.2.1: - version "3.2.1" - resolved "https://registry.yarnpkg.com/es6-promise/-/es6-promise-3.2.1.tgz#ec56233868032909207170c39448e24449dd1fc4" - escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" @@ -1275,8 +1254,9 @@ esprima@^3.1.3: integrity sha1-/cpRzuYTOJXjyI1TXOSdv/YqRjM= esprima@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.0.tgz#4499eddcd1110e0b218bacf2fa7f7f59f55ca804" + version "4.0.1" + resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" + integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== estraverse@^4.2.0: version "4.2.0" @@ -1286,6 +1266,7 @@ estraverse@^4.2.0: esutils@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.2.tgz#0abf4f1caa5bcb1f7a9d8acc6dea4faaa04bac9b" + integrity sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs= exec-sh@^0.3.2: version "0.3.2" @@ -1295,6 +1276,7 @@ exec-sh@^0.3.2: execa@^0.7.0: version "0.7.0" resolved "https://registry.yarnpkg.com/execa/-/execa-0.7.0.tgz#944becd34cc41ee32a63a9faf27ad5a65fc59777" + integrity sha1-lEvs00zEHuMqY6n68nrVpl/Fl3c= dependencies: cross-spawn "^5.0.1" get-stream "^3.0.0" @@ -1325,12 +1307,14 @@ exit@^0.1.2: expand-brackets@^0.1.4: version "0.1.5" resolved "https://registry.yarnpkg.com/expand-brackets/-/expand-brackets-0.1.5.tgz#df07284e342a807cd733ac5af72411e581d1177b" + integrity sha1-3wcoTjQqgHzXM6xa9yQR5YHRF3s= dependencies: is-posix-bracket "^0.1.0" expand-brackets@^2.1.4: version "2.1.4" resolved "https://registry.yarnpkg.com/expand-brackets/-/expand-brackets-2.1.4.tgz#b77735e315ce30f6b6eff0f83b04151a22449622" + integrity sha1-t3c14xXOMPa27/D4OwQVGiJEliI= dependencies: debug "^2.3.3" define-property "^0.2.5" @@ -1343,6 +1327,7 @@ expand-brackets@^2.1.4: expand-range@^1.8.1: version "1.8.2" resolved "https://registry.yarnpkg.com/expand-range/-/expand-range-1.8.2.tgz#a299effd335fe2721ebae8e257ec79644fc85337" + integrity sha1-opnv/TNf4nIeuujiV+x5ZE/IUzc= dependencies: fill-range "^2.1.0" @@ -1361,20 +1346,18 @@ expect@^24.8.0: extend-shallow@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/extend-shallow/-/extend-shallow-2.0.1.tgz#51af7d614ad9a9f610ea1bafbb989d6b1c56890f" + integrity sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8= dependencies: is-extendable "^0.1.0" extend-shallow@^3.0.0, extend-shallow@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/extend-shallow/-/extend-shallow-3.0.2.tgz#26a71aaf073b39fb2127172746131c2704028db8" + integrity sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg= dependencies: assign-symbols "^1.0.0" is-extendable "^1.0.1" -extend@~3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.1.tgz#a755ea7bc1adfcc5a31ce7e762dbaadc5e636444" - extend@~3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.2.tgz#f8b1136b4071fbd8eb140aff858b1019ec2915fa" @@ -1383,12 +1366,14 @@ extend@~3.0.2: extglob@^0.3.1: version "0.3.2" resolved "https://registry.yarnpkg.com/extglob/-/extglob-0.3.2.tgz#2e18ff3d2f49ab2765cec9023f011daa8d8349a1" + integrity sha1-Lhj/PS9JqydlzskCPwEdqo2DSaE= dependencies: is-extglob "^1.0.0" extglob@^2.0.4: version "2.0.4" resolved "https://registry.yarnpkg.com/extglob/-/extglob-2.0.4.tgz#ad00fe4dc612a9232e8718711dc5cb5ab0285543" + integrity sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw== dependencies: array-unique "^0.3.2" define-property "^1.0.0" @@ -1402,14 +1387,17 @@ extglob@^2.0.4: extsprintf@1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.3.0.tgz#96918440e3041a7a414f8c52e3c574eb3c3e1e05" + integrity sha1-lpGEQOMEGnpBT4xS48V06zw+HgU= extsprintf@^1.2.0: version "1.4.0" resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.4.0.tgz#e2689f8f356fad62cca65a3a91c5df5f9551692f" + integrity sha1-4mifjzVvrWLMplo6kcXfX5VRaS8= fast-deep-equal@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz#c053477817c86b51daa853c81e059b733d023614" + integrity sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ= fast-deep-equal@^2.0.1: version "2.0.1" @@ -1419,6 +1407,7 @@ fast-deep-equal@^2.0.1: fast-json-stable-stringify@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz#d5142c0caee6b1189f87d3a76111064f86c8bbf2" + integrity sha1-1RQsDK7msRifh9OnYREGT4bIu/I= fast-levenshtein@~2.0.4: version "2.0.6" @@ -1435,20 +1424,23 @@ fb-watchman@^2.0.0: filename-regex@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/filename-regex/-/filename-regex-2.0.1.tgz#c1c4b9bee3e09725ddb106b75c1e301fe2f18b26" + integrity sha1-wcS5vuPglyXdsQa3XB4wH+LxiyY= fill-range@^2.1.0: - version "2.2.3" - resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-2.2.3.tgz#50b77dfd7e469bc7492470963699fe7a8485a723" + version "2.2.4" + resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-2.2.4.tgz#eb1e773abb056dcd8df2bfdf6af59b8b3a936565" + integrity sha512-cnrcCbj01+j2gTG921VZPnHbjmdAf8oQV/iGeV2kZxGSyfYjjTyY79ErsK1WJWMpw6DaApEX72binqJE+/d+5Q== dependencies: is-number "^2.1.0" isobject "^2.0.0" - randomatic "^1.1.3" + randomatic "^3.0.0" repeat-element "^1.1.2" repeat-string "^1.5.2" fill-range@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-4.0.0.tgz#d544811d428f98eb06a63dc402d2403c328c38f7" + integrity sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc= dependencies: extend-shallow "^2.0.1" is-number "^3.0.0" @@ -1458,6 +1450,7 @@ fill-range@^4.0.0: find-cache-dir@^0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/find-cache-dir/-/find-cache-dir-0.1.1.tgz#c8defae57c8a52a8a784f9e31c57c742e993a0b9" + integrity sha1-yN765XyKUqinhPnjHFfHQumToLk= dependencies: commondir "^1.0.1" mkdirp "^0.5.1" @@ -1466,6 +1459,7 @@ find-cache-dir@^0.1.1: find-up@^1.0.0: version "1.1.2" resolved "https://registry.yarnpkg.com/find-up/-/find-up-1.1.2.tgz#6b2e9822b1a2ce0a60ab64d610eccad53cb24d0f" + integrity sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8= dependencies: path-exists "^2.0.0" pinkie-promise "^2.0.0" @@ -1473,6 +1467,7 @@ find-up@^1.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" + integrity sha1-RdG35QbHF93UgndaK3eSCjwMV6c= dependencies: locate-path "^2.0.0" @@ -1486,16 +1481,19 @@ find-up@^3.0.0: for-in@^1.0.1, for-in@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/for-in/-/for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80" + integrity sha1-gQaNKVqBQuwKxybG4iAMMPttXoA= for-own@^0.1.4: version "0.1.5" resolved "https://registry.yarnpkg.com/for-own/-/for-own-0.1.5.tgz#5265c681a4f294dabbf17c9509b6763aa84510ce" + integrity sha1-UmXGgaTylNq78XyVCbZ2OqhFEM4= dependencies: for-in "^1.0.1" 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" + integrity sha1-T9ca0t/elnibmApcCilZN8svXOk= dependencies: cross-spawn "^4" signal-exit "^3.0.0" @@ -1503,14 +1501,7 @@ foreground-child@^1.5.3, foreground-child@^1.5.6: forever-agent@~0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91" - -form-data@~2.3.1: - version "2.3.2" - resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.3.2.tgz#4970498be604c20c005d4f5c23aecd21d6b49099" - dependencies: - asynckit "^0.4.0" - combined-stream "1.0.6" - mime-types "^2.1.12" + integrity sha1-+8cfDEGt6zf5bFd60e1C2P2sypE= form-data@~2.3.2: version "2.3.3" @@ -1524,6 +1515,7 @@ form-data@~2.3.2: fragment-cache@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/fragment-cache/-/fragment-cache-0.2.1.tgz#4290fad27f13e89be7f33799c6bc5a0abfff0d19" + integrity sha1-QpD60n8T6Jvn8zeZxrxaCr//DRk= dependencies: map-cache "^0.2.2" @@ -1537,6 +1529,7 @@ fs-minipass@^1.2.5: fs.realpath@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" + integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8= fsevents@^1.2.7: version "1.2.9" @@ -1566,12 +1559,14 @@ gauge@~2.7.3: wide-align "^1.1.0" 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" + version "1.0.3" + resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-1.0.3.tgz#f978fa4c90d1dfe7ff2d6beda2a515e713bdcf4a" + integrity sha512-3t6rVToeoZfYSGd8YoLFR2DJkiQrIiUrGcjvFX2mDw3bn6k2OtwHN0TNCLbBO+w8qTvimhDkv+LSscbJY1vE6w== get-stream@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-3.0.0.tgz#8e943d1358dc37555054ecbe2edb05aa174ede14" + integrity sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ= get-stream@^4.0.0: version "4.1.0" @@ -1583,16 +1578,19 @@ get-stream@^4.0.0: get-value@^2.0.3, get-value@^2.0.6: version "2.0.6" resolved "https://registry.yarnpkg.com/get-value/-/get-value-2.0.6.tgz#dc15ca1c672387ca76bd37ac0a395ba2042a2c28" + integrity sha1-3BXKHGcjh8p2vTesCjlbogQqLCg= getpass@^0.1.1: version "0.1.7" resolved "https://registry.yarnpkg.com/getpass/-/getpass-0.1.7.tgz#5eff8e3e684d569ae4cb2b1282604e8ba62149fa" + integrity sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo= dependencies: assert-plus "^1.0.0" glob-base@^0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/glob-base/-/glob-base-0.3.0.tgz#dbb164f6221b1c0b1ccf82aea328b497df0ea3c4" + integrity sha1-27Fk9iIbHAscz4Kuoyi0l98Oo8Q= dependencies: glob-parent "^2.0.0" is-glob "^2.0.0" @@ -1600,21 +1598,11 @@ glob-base@^0.3.0: glob-parent@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-2.0.0.tgz#81383d72db054fcccf5336daa902f182f6edbb28" + integrity sha1-gTg9ctsFT8zPUzbaqQLxgvbtuyg= dependencies: is-glob "^2.0.0" -glob@^7.0.5, glob@^7.0.6, glob@^7.1.1: - 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" - -glob@^7.1.2, glob@^7.1.3: +glob@^7.0.6, glob@^7.1.1, glob@^7.1.2, glob@^7.1.3: version "7.1.4" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.4.tgz#aa608a2f6c577ad357e1ae5a5c26d9a8d1969255" integrity sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A== @@ -1634,32 +1622,24 @@ globals@^11.1.0: globals@^9.18.0: version "9.18.0" resolved "https://registry.yarnpkg.com/globals/-/globals-9.18.0.tgz#aa3896b3e69b487f17e31ed2143d69a8e30c2d8a" + integrity sha512-S0nG3CLEQiY/ILxqtztTWH/3iRRdyBLw6KMDxnKMchrtbj2OFmehVh0WUCfW3DUrIgx/qFrJPICrq4Z4sTR9UQ== -graceful-fs@^4.1.11, graceful-fs@^4.1.2: - version "4.1.11" - resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.11.tgz#0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658" - -graceful-fs@^4.1.15: +graceful-fs@^4.1.11, graceful-fs@^4.1.15, graceful-fs@^4.1.2: version "4.1.15" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.15.tgz#ffb703e1066e8a0eeaa4c8b80ba9253eeefbfb00" integrity sha512-6uHUhOPEBgQ24HM+r6b/QwWfZq+yiFcipKFrOFiBEnWdy5sdzYoi+pJeQaPI5qOLRFqWmAXUPQNsielzdLoecA== +"growl@~> 1.10.0": + version "1.10.5" + resolved "https://registry.yarnpkg.com/growl/-/growl-1.10.5.tgz#f2735dc2283674fa67478b10181059355c369e5e" + integrity sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA== + growly@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/growly/-/growly-1.3.0.tgz#f10748cbe76af964b7c96c93c6bcc28af120c081" integrity sha1-8QdIy+dq+WS3yWyTxrzCivEgwIE= -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" - -handlebars@^4.1.2: +handlebars@^4.0.3, handlebars@^4.1.2: version "4.1.2" resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.1.2.tgz#b6b37c1ced0306b221e094fc7aca3ec23b131b67" integrity sha512-nvfrjqvt9xQ8Z/w0ijewdD/vvWDTOweBUm96NTr66Wfvo1mJenBLwcYmPs3TIBP5ruzYGD7Hx/DaM9RmhroGPw== @@ -1673,13 +1653,7 @@ handlebars@^4.1.2: har-schema@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/har-schema/-/har-schema-2.0.0.tgz#a94c2224ebcac04782a0d9035521f24735b7ec92" - -har-validator@~5.0.3: - version "5.0.3" - resolved "https://registry.yarnpkg.com/har-validator/-/har-validator-5.0.3.tgz#ba402c266194f15956ef15e0fcf242993f6a7dfd" - dependencies: - ajv "^5.1.0" - har-schema "^2.0.0" + integrity sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI= har-validator@~5.1.0: version "5.1.3" @@ -1692,12 +1666,14 @@ har-validator@~5.1.0: has-ansi@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/has-ansi/-/has-ansi-2.0.0.tgz#34f5049ce1ecdf2b0649af3ef24e45ed35416d91" + integrity sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE= dependencies: ansi-regex "^2.0.0" has-flag@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-1.0.0.tgz#9d9e793165ce017a00f00418c43f942a7b1d11fa" + integrity sha1-nZ55MWXOAXoA8AQYxD+UKnsdEfo= has-flag@^3.0.0: version "3.0.0" @@ -1717,6 +1693,7 @@ has-unicode@^2.0.0: has-value@^0.3.1: version "0.3.1" resolved "https://registry.yarnpkg.com/has-value/-/has-value-0.3.1.tgz#7b1f58bada62ca827ec0a2078025654845995e1f" + integrity sha1-ex9YutpiyoJ+wKIHgCVlSEWZXh8= dependencies: get-value "^2.0.3" has-values "^0.1.4" @@ -1725,6 +1702,7 @@ has-value@^0.3.1: has-value@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/has-value/-/has-value-1.0.0.tgz#18b281da585b1c5c51def24c930ed29a0be6b177" + integrity sha1-GLKB2lhbHFxR3vJMkw7SmgvmsXc= dependencies: get-value "^2.0.6" has-values "^1.0.0" @@ -1733,10 +1711,12 @@ has-value@^1.0.0: has-values@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/has-values/-/has-values-0.1.4.tgz#6d61de95d91dfca9b9a02089ad384bff8f62b771" + integrity sha1-bWHeldkd/Km5oCCJrThL/49it3E= has-values@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/has-values/-/has-values-1.0.0.tgz#95b0b63fec2146619a6fe57fe75628d5a39efe4f" + integrity sha1-lbC2P+whRmGab+V/51Yo1aOe/k8= dependencies: is-number "^3.0.0" kind-of "^4.0.0" @@ -1748,22 +1728,10 @@ has@^1.0.1, has@^1.0.3: dependencies: function-bind "^1.1.1" -hawk@~6.0.2: - version "6.0.2" - resolved "https://registry.yarnpkg.com/hawk/-/hawk-6.0.2.tgz#af4d914eb065f9b5ce4d9d11c1cb2126eecc3038" - dependencies: - boom "4.x.x" - cryptiles "3.x.x" - hoek "4.x.x" - sntp "2.x.x" - -hoek@4.x.x: - version "4.2.1" - resolved "https://registry.yarnpkg.com/hoek/-/hoek-4.2.1.tgz#9634502aa12c445dd5a7c5734b572bb8738aacbb" - hosted-git-info@^2.1.4: - version "2.6.0" - resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.6.0.tgz#23235b29ab230c576aab0d4f13fc046b0b038222" + version "2.7.1" + resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.7.1.tgz#97f236977bd6e125408930ff6de3eec6281ec047" + integrity sha512-7T/BxH19zbcCTa8XkMlbK5lTo1WtgkFi3GvdWEyNuc4Vex7/9Dqbnpsf4JMydcfj9HCg4zUWFTL3Za6lapg5/w== html-encoding-sniffer@^1.0.2: version "1.0.2" @@ -1775,6 +1743,7 @@ html-encoding-sniffer@^1.0.2: http-signature@~1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/http-signature/-/http-signature-1.2.0.tgz#9aecd925114772f3d95b65a60abb8f7c18fbace1" + integrity sha1-muzZJRFHcvPZW2WmCruPfBj7rOE= dependencies: assert-plus "^1.0.0" jsprim "^1.2.2" @@ -1805,30 +1774,27 @@ import-local@^2.0.0: imurmurhash@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" + integrity sha1-khi5srkoojixPcT7a21XbyMUU+o= inflight@^1.0.4: version "1.0.6" resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" + integrity sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk= dependencies: once "^1.3.0" wrappy "1" -inherits@2, inherits@~2.0.1, inherits@~2.0.3: - version "2.0.3" - resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" +inherits@2, inherits@~2.0.3: + version "2.0.4" + resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" + integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== ini@~1.3.0: version "1.3.5" resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.5.tgz#eee25f56db1c9ec6085e0c22778083f596abf927" integrity sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw== -invariant@^2.2.2: - version "2.2.3" - resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.3.tgz#1a827dfde7dcbd7c323f0ca826be8fa7c5e9d688" - dependencies: - loose-envify "^1.0.0" - -invariant@^2.2.4: +invariant@^2.2.2, invariant@^2.2.4: version "2.2.4" resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.4.tgz#610f3c92c9359ce1db616e538008d23ff35158e6" integrity sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA== @@ -1838,6 +1804,7 @@ invariant@^2.2.4: invert-kv@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/invert-kv/-/invert-kv-1.0.0.tgz#104a8e4aaca6d3d8cd157a8ef8bfab2d7a3ffdb6" + integrity sha1-EEqOSqym09jNFXqO+L+rLXo//bY= invert-kv@^2.0.0: version "2.0.0" @@ -1847,28 +1814,26 @@ invert-kv@^2.0.0: is-accessor-descriptor@^0.1.6: version "0.1.6" resolved "https://registry.yarnpkg.com/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz#a9e12cb3ae8d876727eeef3843f8a0897b5c98d6" + integrity sha1-qeEss66Nh2cn7u84Q/igiXtcmNY= dependencies: kind-of "^3.0.2" is-accessor-descriptor@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz#169c2f6d3df1f992618072365c9b0ea1f6878656" + integrity sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ== dependencies: kind-of "^6.0.0" is-arrayish@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" + integrity sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0= is-buffer@^1.1.5: version "1.1.6" resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be" - -is-builtin-module@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-builtin-module/-/is-builtin-module-1.0.0.tgz#540572d34f7ac3119f8f76c30cbc1b1e037affbe" - dependencies: - builtin-modules "^1.0.0" + integrity sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w== is-callable@^1.1.4: version "1.1.4" @@ -1885,12 +1850,14 @@ is-ci@^2.0.0: is-data-descriptor@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz#0b5ee648388e2c860282e793f1856fec3f301b56" + integrity sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y= dependencies: kind-of "^3.0.2" is-data-descriptor@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz#d84876321d0e7add03990406abbbbd36ba9268c7" + integrity sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ== dependencies: kind-of "^6.0.0" @@ -1902,6 +1869,7 @@ is-date-object@^1.0.1: is-descriptor@^0.1.0: version "0.1.6" resolved "https://registry.yarnpkg.com/is-descriptor/-/is-descriptor-0.1.6.tgz#366d8240dde487ca51823b1ab9f07a10a78251ca" + integrity sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg== dependencies: is-accessor-descriptor "^0.1.6" is-data-descriptor "^0.1.4" @@ -1910,6 +1878,7 @@ is-descriptor@^0.1.0: is-descriptor@^1.0.0, is-descriptor@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/is-descriptor/-/is-descriptor-1.0.2.tgz#3b159746a66604b04f8c81524ba365c5f14d86ec" + integrity sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg== dependencies: is-accessor-descriptor "^1.0.0" is-data-descriptor "^1.0.0" @@ -1918,42 +1887,50 @@ is-descriptor@^1.0.0, is-descriptor@^1.0.2: is-dotfile@^1.0.0: version "1.0.3" resolved "https://registry.yarnpkg.com/is-dotfile/-/is-dotfile-1.0.3.tgz#a6a2f32ffd2dfb04f5ca25ecd0f6b83cf798a1e1" + integrity sha1-pqLzL/0t+wT1yiXs0Pa4PPeYoeE= is-equal-shallow@^0.1.3: version "0.1.3" resolved "https://registry.yarnpkg.com/is-equal-shallow/-/is-equal-shallow-0.1.3.tgz#2238098fc221de0bcfa5d9eac4c45d638aa1c534" + integrity sha1-IjgJj8Ih3gvPpdnqxMRdY4qhxTQ= dependencies: is-primitive "^2.0.0" is-extendable@^0.1.0, is-extendable@^0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/is-extendable/-/is-extendable-0.1.1.tgz#62b110e289a471418e3ec36a617d472e301dfc89" + integrity sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik= is-extendable@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/is-extendable/-/is-extendable-1.0.1.tgz#a7470f9e426733d81bd81e1155264e3a3507cab4" + integrity sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA== dependencies: is-plain-object "^2.0.4" is-extglob@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-1.0.0.tgz#ac468177c4943405a092fc8f29760c6ffc6206c0" + integrity sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA= is-finite@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/is-finite/-/is-finite-1.0.2.tgz#cc6677695602be550ef11e8b4aa6305342b6d0aa" + integrity sha1-zGZ3aVYCvlUO8R6LSqYwU0K20Ko= dependencies: number-is-nan "^1.0.0" is-fullwidth-code-point@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz#ef9e31386f031a7f0d643af82fde50c457ef00cb" + integrity sha1-754xOG8DGn8NZDr4L95QxFfvAMs= dependencies: number-is-nan "^1.0.0" is-fullwidth-code-point@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f" + integrity sha1-o7MKXE8ZkYMWeqq5O+764937ZU8= is-generator-fn@^2.0.0: version "2.1.0" @@ -1963,44 +1940,45 @@ is-generator-fn@^2.0.0: is-glob@^2.0.0, is-glob@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-2.0.1.tgz#d096f926a3ded5600f3fdfd91198cb0888c2d863" + integrity sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM= dependencies: is-extglob "^1.0.0" is-number@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/is-number/-/is-number-2.1.0.tgz#01fcbbb393463a548f2f466cce16dece49db908f" + integrity sha1-Afy7s5NGOlSPL0ZszhbezknbkI8= dependencies: kind-of "^3.0.2" is-number@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/is-number/-/is-number-3.0.0.tgz#24fd6201a4782cf50561c810276afc7d12d71195" + integrity sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU= dependencies: kind-of "^3.0.2" is-number@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/is-number/-/is-number-4.0.0.tgz#0026e37f5454d73e356dfe6564699867c6a7f0ff" + integrity sha512-rSklcAIlf1OmFdyAqbnWTLVelsQ58uvZ66S/ZyawjWqIviTWCjg2PzVGw8WUA+nNuPTqb4wgA+NszrJ+08LlgQ== -is-odd@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/is-odd/-/is-odd-2.0.0.tgz#7646624671fd7ea558ccd9a2795182f2958f1b24" - dependencies: - is-number "^4.0.0" - -is-plain-object@^2.0.1, is-plain-object@^2.0.3, is-plain-object@^2.0.4: +is-plain-object@^2.0.3, is-plain-object@^2.0.4: version "2.0.4" resolved "https://registry.yarnpkg.com/is-plain-object/-/is-plain-object-2.0.4.tgz#2c163b3fafb1b606d9d17928f05c2a1c38e07677" + integrity sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og== dependencies: isobject "^3.0.1" is-posix-bracket@^0.1.0: version "0.1.1" resolved "https://registry.yarnpkg.com/is-posix-bracket/-/is-posix-bracket-0.1.1.tgz#3334dc79774368e92f016e6fbc0a88f5cd6e6bc4" + integrity sha1-MzTceXdDaOkvAW5vvAqI9c1ua8Q= is-primitive@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/is-primitive/-/is-primitive-2.0.0.tgz#207bab91638499c07b2adf240a41a87210034575" + integrity sha1-IHurkWOEmcB7Kt8kCkGochADRXU= is-regex@^1.0.4: version "1.0.4" @@ -2012,6 +1990,7 @@ is-regex@^1.0.4: is-stream@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" + integrity sha1-EtSj3U5o4Lec6428hBc66A2RykQ= is-symbol@^1.0.2: version "1.0.2" @@ -2023,14 +2002,17 @@ is-symbol@^1.0.2: is-typedarray@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a" + integrity sha1-5HnICFjfDBsR3dppQPlgEfzaSpo= is-utf8@^0.2.0: version "0.2.1" resolved "https://registry.yarnpkg.com/is-utf8/-/is-utf8-0.2.1.tgz#4b0da1442104d1b336340e80797e865cf39f7d72" + integrity sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI= is-windows@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/is-windows/-/is-windows-1.0.2.tgz#d1850eb9791ecd18e6182ce12a30f396634bb19d" + integrity sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA== is-wsl@^1.1.0: version "1.1.0" @@ -2040,28 +2022,34 @@ is-wsl@^1.1.0: isarray@1.0.0, isarray@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" + integrity sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE= isexe@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" + integrity sha1-6PvzdNxVb/iUehDcsFctYz8s+hA= isobject@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/isobject/-/isobject-2.1.0.tgz#f065561096a3f1da2ef46272f815c840d87e0c89" + integrity sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk= dependencies: isarray "1.0.0" isobject@^3.0.0, isobject@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/isobject/-/isobject-3.0.1.tgz#4e431e92b11a9731636aa1f9c8d1ccbcfdab78df" + integrity sha1-TkMekrEalzFjaqH5yNHMvP2reN8= isstream@~0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a" + integrity sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo= -istanbul-lib-coverage@^1.1.2, istanbul-lib-coverage@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/istanbul-lib-coverage/-/istanbul-lib-coverage-1.2.0.tgz#f7d8f2e42b97e37fe796114cb0f9d68b5e3a4341" +istanbul-lib-coverage@^1.1.2, istanbul-lib-coverage@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/istanbul-lib-coverage/-/istanbul-lib-coverage-1.2.1.tgz#ccf7edcd0a0bb9b8f729feeb0930470f9af664f0" + integrity sha512-PzITeunAgyGbtY1ibVIUiV679EFChHjoMNRibEIobvmrCRaIgwLxNucOSimtNWUhEib/oO7QY2imD75JVgCJWQ== istanbul-lib-coverage@^2.0.2, istanbul-lib-coverage@^2.0.5: version "2.0.5" @@ -2069,21 +2057,23 @@ istanbul-lib-coverage@^2.0.2, istanbul-lib-coverage@^2.0.5: integrity sha512-8aXznuEPCJvGnMSRft4udDRDtb1V3pkQkMMI5LI+6HuQz5oQ4J2UFn1H82raA3qJtyOLkkwVqICBQkjnGtn5mA== istanbul-lib-hook@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/istanbul-lib-hook/-/istanbul-lib-hook-1.1.0.tgz#8538d970372cb3716d53e55523dd54b557a8d89b" + version "1.2.2" + resolved "https://registry.yarnpkg.com/istanbul-lib-hook/-/istanbul-lib-hook-1.2.2.tgz#bc6bf07f12a641fbf1c85391d0daa8f0aea6bf86" + integrity sha512-/Jmq7Y1VeHnZEQ3TL10VHyb564mn6VrQXHchON9Jf/AEcmQ3ZIiyD1BVzNOKTZf/G3gE+kiGK6SmpF9y3qGPLw== dependencies: append-transform "^0.4.0" istanbul-lib-instrument@^1.10.0: - version "1.10.1" - resolved "https://registry.yarnpkg.com/istanbul-lib-instrument/-/istanbul-lib-instrument-1.10.1.tgz#724b4b6caceba8692d3f1f9d0727e279c401af7b" + version "1.10.2" + resolved "https://registry.yarnpkg.com/istanbul-lib-instrument/-/istanbul-lib-instrument-1.10.2.tgz#1f55ed10ac3c47f2bdddd5307935126754d0a9ca" + integrity sha512-aWHxfxDqvh/ZlxR8BBaEPVSWDPUkGD63VjGQn3jcw8jCp7sHEMKcrj4xfJn/ABzdMEHiQNyvDQhqm5o8+SQg7A== dependencies: babel-generator "^6.18.0" babel-template "^6.16.0" babel-traverse "^6.18.0" babel-types "^6.18.0" babylon "^6.18.0" - istanbul-lib-coverage "^1.2.0" + istanbul-lib-coverage "^1.2.1" semver "^5.3.0" istanbul-lib-instrument@^3.0.1, istanbul-lib-instrument@^3.3.0: @@ -2100,10 +2090,11 @@ istanbul-lib-instrument@^3.0.1, istanbul-lib-instrument@^3.3.0: semver "^6.0.0" istanbul-lib-report@^1.1.3: - version "1.1.3" - resolved "https://registry.yarnpkg.com/istanbul-lib-report/-/istanbul-lib-report-1.1.3.tgz#2df12188c0fa77990c0d2176d2d0ba3394188259" + version "1.1.5" + resolved "https://registry.yarnpkg.com/istanbul-lib-report/-/istanbul-lib-report-1.1.5.tgz#f2a657fc6282f96170aaf281eb30a458f7f4170c" + integrity sha512-UsYfRMoi6QO/doUshYNqcKJqVmFe9w51GZz8BS3WB0lYxAllQYklka2wP9+dGZeHYaWIdcXUx8JGdbqaoXRXzw== dependencies: - istanbul-lib-coverage "^1.1.2" + istanbul-lib-coverage "^1.2.1" mkdirp "^0.5.1" path-parse "^1.0.5" supports-color "^3.1.2" @@ -2118,11 +2109,12 @@ istanbul-lib-report@^2.0.4: supports-color "^6.1.0" istanbul-lib-source-maps@^1.2.3: - version "1.2.3" - resolved "https://registry.yarnpkg.com/istanbul-lib-source-maps/-/istanbul-lib-source-maps-1.2.3.tgz#20fb54b14e14b3fb6edb6aca3571fd2143db44e6" + version "1.2.6" + resolved "https://registry.yarnpkg.com/istanbul-lib-source-maps/-/istanbul-lib-source-maps-1.2.6.tgz#37b9ff661580f8fca11232752ee42e08c6675d8f" + integrity sha512-TtbsY5GIHgbMsMiRw35YBHGpZ1DVFEO19vxxeiDMYaeOFOCzfnYVxvl6pOUIZR4dtPhAGpSMup8OyF8ubsaqEg== dependencies: debug "^3.1.0" - istanbul-lib-coverage "^1.1.2" + istanbul-lib-coverage "^1.2.1" mkdirp "^0.5.1" rimraf "^2.6.1" source-map "^0.5.3" @@ -2138,9 +2130,10 @@ istanbul-lib-source-maps@^3.0.1: rimraf "^2.6.3" source-map "^0.6.1" -istanbul-reports@^1.1.4: - version "1.3.0" - resolved "https://registry.yarnpkg.com/istanbul-reports/-/istanbul-reports-1.3.0.tgz#2f322e81e1d9520767597dca3c20a0cce89a3554" +istanbul-reports@^1.4.0: + version "1.5.1" + resolved "https://registry.yarnpkg.com/istanbul-reports/-/istanbul-reports-1.5.1.tgz#97e4dbf3b515e8c484caea15d6524eebd3ff4e1a" + integrity sha512-+cfoZ0UXzWjhAdzosCPP3AN8vvef8XDkWtTfgaN+7L3YTpNYITnCaEkceo5SEYy644VkHka/P1FvkWvrG/rrJw== dependencies: handlebars "^4.0.3" @@ -2259,9 +2252,9 @@ jest-get-type@^24.8.0: integrity sha512-RR4fo8jEmMD9zSz2nLbs2j0zvPpk/KCEz3a62jJWbd2ayNo0cb+KFRxPHVhE4ZmgGJEQp0fosmNz84IfqM8cMQ== jest-haste-map@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-24.8.0.tgz#51794182d877b3ddfd6e6d23920e3fe72f305800" - integrity sha512-ZBPRGHdPt1rHajWelXdqygIDpJx8u3xOoLyUBWRW28r3tagrgoepPrzAozW7kW9HrQfhvmiv1tncsxqHJO1onQ== + version "24.8.1" + resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-24.8.1.tgz#f39cc1d2b1d907e014165b4bd5a957afcb992982" + integrity sha512-SwaxMGVdAZk3ernAx2Uv2sorA7jm3Kx+lR0grp6rMmnY06Kn/urtKx1LPN2mGTea4fCT38impYT28FfcLUhX0g== dependencies: "@jest/types" "^24.8.0" anymatch "^2.0.0" @@ -2503,16 +2496,17 @@ jest@^24.8.0: import-local "^2.0.0" jest-cli "^24.8.0" -js-tokens@^3.0.0, js-tokens@^3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.2.tgz#9866df395102130e38f7f996bceb65443209c25b" - -js-tokens@^4.0.0: +"js-tokens@^3.0.0 || ^4.0.0", js-tokens@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== -js-yaml@^3.10.0: +js-tokens@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.2.tgz#9866df395102130e38f7f996bceb65443209c25b" + integrity sha1-mGbfOVECEw449/mWvOtlRDIJwls= + +js-yaml@^3.10.0, js-yaml@^3.11.0: version "3.13.1" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.13.1.tgz#aff151b30bfdfa8e49e05da22e7415e9dfa37847" integrity sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw== @@ -2520,16 +2514,10 @@ js-yaml@^3.10.0: argparse "^1.0.7" esprima "^4.0.0" -js-yaml@^3.6.1: - version "3.11.0" - resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.11.0.tgz#597c1a8bd57152f26d622ce4117851a51f5ebaef" - dependencies: - argparse "^1.0.7" - esprima "^4.0.0" - jsbn@~0.1.0: version "0.1.1" resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513" + integrity sha1-peZUwuWi3rXyAdls77yoDA7y9RM= jsdom@^11.5.1: version "11.12.0" @@ -2566,6 +2554,7 @@ jsdom@^11.5.1: jsesc@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-1.3.0.tgz#46c3fec8c1892b12b0833db9bc7622176dbab34b" + integrity sha1-RsP+yMGJKxKwgz25vHYiF226s0s= jsesc@^2.5.1: version "2.5.2" @@ -2580,6 +2569,7 @@ json-parse-better-errors@^1.0.1: json-schema-traverse@^0.3.0: version "0.3.1" resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz#349a6d44c53a51de89b40805c5d5e59b417d3340" + integrity sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A= json-schema-traverse@^0.4.1: version "0.4.1" @@ -2589,10 +2579,12 @@ json-schema-traverse@^0.4.1: json-schema@0.2.3: version "0.2.3" resolved "https://registry.yarnpkg.com/json-schema/-/json-schema-0.2.3.tgz#b480c892e59a2f05954ce727bd3f2a4e882f9e13" + integrity sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM= json-stringify-safe@~5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" + integrity sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus= json5@^2.1.0: version "2.1.0" @@ -2604,6 +2596,7 @@ json5@^2.1.0: jsprim@^1.2.2: version "1.4.1" resolved "https://registry.yarnpkg.com/jsprim/-/jsprim-1.4.1.tgz#313e66bc1e5cc06e438bc1b7499c2e5c56acb6a2" + integrity sha1-MT5mvB5cwG5Di8G3SZwuXFastqI= dependencies: assert-plus "1.0.0" extsprintf "1.3.0" @@ -2618,35 +2611,36 @@ kareem@2.3.0: kind-of@^3.0.2, kind-of@^3.0.3, kind-of@^3.2.0: version "3.2.2" resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-3.2.2.tgz#31ea21a734bab9bbb0f32466d893aea51e4a3c64" + integrity sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ= dependencies: is-buffer "^1.1.5" kind-of@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-4.0.0.tgz#20813df3d712928b207378691a45066fae72dd57" + integrity sha1-IIE989cSkosgc3hpGkUGb65y3Vc= dependencies: is-buffer "^1.1.5" kind-of@^5.0.0: version "5.1.0" resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-5.1.0.tgz#729c91e2d857b7a419a1f9aa65685c4c33f5845d" + integrity sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw== kind-of@^6.0.0, kind-of@^6.0.2: version "6.0.2" resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-6.0.2.tgz#01146b36a6218e64e58f3a8d66de5d7fc6f6d051" + integrity sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA== kleur@^3.0.2: version "3.0.3" resolved "https://registry.yarnpkg.com/kleur/-/kleur-3.0.3.tgz#a79c9ecc86ee1ce3fa6206d1216c501f147fc07e" integrity sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w== -lazy-cache@^1.0.3: - version "1.0.4" - resolved "https://registry.yarnpkg.com/lazy-cache/-/lazy-cache-1.0.4.tgz#a1d78fc3a50474cb80845d3b3b6e1da49a446e8e" - lcid@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/lcid/-/lcid-1.0.0.tgz#308accafa0bc483a3867b4b6f2b9506251d1b835" + integrity sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU= dependencies: invert-kv "^1.0.0" @@ -2660,6 +2654,7 @@ lcid@^2.0.0: lcov-parse@^0.0.10: version "0.0.10" resolved "https://registry.yarnpkg.com/lcov-parse/-/lcov-parse-0.0.10.tgz#1b0b8ff9ac9c7889250582b70b71315d9da6d9a3" + integrity sha1-GwuP+ayceIklBYK3C3ExXZ2m2aM= left-pad@^1.3.0: version "1.3.0" @@ -2682,6 +2677,7 @@ levn@~0.3.0: load-json-file@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-1.1.0.tgz#956905708d58b4bab4c2261b04f59f31c99374c0" + integrity sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA= dependencies: graceful-fs "^4.1.2" parse-json "^2.2.0" @@ -2702,6 +2698,7 @@ load-json-file@^4.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" + integrity sha1-K1aLJl7slExtnA3pw9u7ygNUzY4= dependencies: p-locate "^2.0.0" path-exists "^3.0.0" @@ -2719,32 +2716,27 @@ lodash.sortby@^4.7.0: resolved "https://registry.yarnpkg.com/lodash.sortby/-/lodash.sortby-4.7.0.tgz#edd14c824e2cc9c1e0b0a1b42bb5210516a42438" integrity sha1-7dFMgk4sycHgsKG0K7UhBRakJDg= -lodash@^4.17.11: +lodash@^4.17.11, lodash@^4.17.4: version "4.17.11" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.11.tgz#b39ea6229ef607ecd89e2c8df12536891cac9b8d" integrity sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg== -lodash@^4.17.4: - version "4.17.5" - resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.5.tgz#99a92d65c0272debe8c96b6057bc8fbfa3bed511" - -log-driver@^1.2.5: +log-driver@^1.2.7: version "1.2.7" resolved "https://registry.yarnpkg.com/log-driver/-/log-driver-1.2.7.tgz#63b95021f0702fedfa2c9bb0a24e7797d71871d8" - -longest@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/longest/-/longest-1.0.1.tgz#30a0b2da38f73770e8294a0d22e6625ed77d0097" + integrity sha512-U7KCmLdqsGHBLeWqYlFA0V0Sl6P08EE1ZrmA9cxjUE0WVqT9qnyVDPz1kzpFEP0jdJuFnasWIfSd7fsaNXkpbg== loose-envify@^1.0.0: - version "1.3.1" - resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.3.1.tgz#d1a8ad33fa9ce0e713d65fdd0ac8b748d478c848" + version "1.4.0" + resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf" + integrity sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q== dependencies: - js-tokens "^3.0.0" + js-tokens "^3.0.0 || ^4.0.0" lru-cache@^4.0.1: - version "4.1.2" - resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-4.1.2.tgz#45234b2e6e2f2b33da125624c4664929a0224c3f" + version "4.1.5" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-4.1.5.tgz#8bbe50ea85bed59bc9e33dcab8235ee9bcf443cd" + integrity sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g== dependencies: pseudomap "^1.0.2" yallist "^2.1.2" @@ -2774,26 +2766,36 @@ map-age-cleaner@^0.1.1: map-cache@^0.2.2: version "0.2.2" resolved "https://registry.yarnpkg.com/map-cache/-/map-cache-0.2.2.tgz#c32abd0bd6525d9b051645bb4f26ac5dc98a0dbf" + integrity sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8= map-visit@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/map-visit/-/map-visit-1.0.0.tgz#ecdca8f13144e660f1b5bd41f12f3479d98dfb8f" + integrity sha1-7Nyo8TFE5mDxtb1B8S80edmN+48= dependencies: object-visit "^1.0.0" +math-random@^1.0.1: + version "1.0.4" + resolved "https://registry.yarnpkg.com/math-random/-/math-random-1.0.4.tgz#5dd6943c938548267016d4e34f057583080c514c" + integrity sha512-rUxjysqif/BZQH2yhd5Aaq7vXMSx9NdEsQcyA07uEzIvxgI7zIr33gGsh+RU0/XjmQpCW7RsVof1vlkvQVCK5A== + md5-hex@^1.2.0: version "1.3.0" resolved "https://registry.yarnpkg.com/md5-hex/-/md5-hex-1.3.0.tgz#d2c4afe983c4370662179b8cad145219135046c4" + integrity sha1-0sSv6YPENwZiF5uMrRRSGRNQRsQ= dependencies: md5-o-matic "^0.1.1" md5-o-matic@^0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/md5-o-matic/-/md5-o-matic-0.1.1.tgz#822bccd65e117c514fab176b25945d54100a03c3" + integrity sha1-givM1l4RfFFPqxdrJZRdVBAKA8M= mem@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/mem/-/mem-1.1.0.tgz#5edd52b485ca1d900fe64895505399a0dfa45f76" + integrity sha1-Xt1StIXKHZAP5kiVUFOZoN+kX3Y= dependencies: mimic-fn "^1.0.0" @@ -2811,9 +2813,10 @@ memory-pager@^1.0.2: resolved "https://registry.yarnpkg.com/memory-pager/-/memory-pager-1.5.0.tgz#d8751655d22d384682741c972f2c3d6dfa3e66b5" integrity sha512-ZS4Bp4r/Zoeq6+NLJpP+0Zzm0pR8whtGPf1XExKLJBAczGMnSi3It14OiNCStjQjM6NU1okjQGSxgEZN8eBYKg== -merge-source-map@^1.0.2: +merge-source-map@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/merge-source-map/-/merge-source-map-1.1.0.tgz#2fdde7e6020939f70906a68f2d7ae685e4c8c646" + integrity sha512-Qkcp7P2ygktpMPh2mCQZaf3jhN6D3Z/qVZHSdWvQ+2Ef5HgRAPBO57A77+ENm0CPx2+1Ce/MYKi3ymqdfuqibw== dependencies: source-map "^0.6.1" @@ -2827,6 +2830,7 @@ merge-stream@^1.0.1: micromatch@^2.3.11: version "2.3.11" resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-2.3.11.tgz#86677c97d1720b363431d04d0d15293bd38c1565" + integrity sha1-hmd8l9FyCzY0MdBNDRUpO9OMFWU= dependencies: arr-diff "^2.0.0" array-unique "^0.2.1" @@ -2861,40 +2865,12 @@ micromatch@^3.1.10, micromatch@^3.1.4: snapdragon "^0.8.1" to-regex "^3.0.2" -micromatch@^3.1.8: - version "3.1.9" - resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-3.1.9.tgz#15dc93175ae39e52e93087847096effc73efcf89" - dependencies: - arr-diff "^4.0.0" - array-unique "^0.3.2" - braces "^2.3.1" - define-property "^2.0.2" - extend-shallow "^3.0.2" - extglob "^2.0.4" - fragment-cache "^0.2.1" - kind-of "^6.0.2" - nanomatch "^1.2.9" - object.pick "^1.3.0" - regex-not "^1.0.0" - snapdragon "^0.8.1" - to-regex "^3.0.1" - mime-db@1.40.0: version "1.40.0" resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.40.0.tgz#a65057e998db090f732a68f6c276d387d4126c32" integrity sha512-jYdeOMPy9vnxEqFRRo6ZvTZ8d9oPb+k18PKoYNYUe2stVEBPPwsln/qWzdbmaIvnhZ9v2P+CuecK+fpUfsV2mA== -mime-db@~1.33.0: - version "1.33.0" - resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.33.0.tgz#a3492050a5cb9b63450541e39d9788d2272783db" - -mime-types@^2.1.12, mime-types@~2.1.17: - version "2.1.18" - resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.18.tgz#6f323f60a83d11146f831ff11fd66e2fe5503bb8" - dependencies: - mime-db "~1.33.0" - -mime-types@~2.1.19: +mime-types@^2.1.12, mime-types@~2.1.19: version "2.1.24" resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.24.tgz#b6f8d0b3e951efb77dedeca194cff6d16f676f81" integrity sha512-WaFHS3MCl5fapm3oLxU4eYDw77IQM2ACcxQ9RIxfaC3ooc6PFuBMGZZsYpvoXS5D5QTWPieo1jjLdAm3TBP3cQ== @@ -2904,6 +2880,7 @@ mime-types@~2.1.19: mimic-fn@^1.0.0: version "1.2.0" resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-1.2.0.tgz#820c86a39334640e99516928bd03fca88057d022" + integrity sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ== mimic-fn@^2.0.0: version "2.1.0" @@ -2913,22 +2890,26 @@ mimic-fn@^2.0.0: minimatch@^3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" + integrity sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA== dependencies: brace-expansion "^1.1.7" minimist@0.0.8: version "0.0.8" resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" + integrity sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0= minimist@^1.1.1, minimist@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" + integrity sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ= minimist@~0.0.1: version "0.0.10" resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.10.tgz#de3f98543dbf96082be48ad1a0c7cda836301dcf" + integrity sha1-3j+YVD2/lggr5IrRoMfNqDYwHc8= -minipass@^2.2.1, minipass@^2.3.4: +minipass@^2.2.1, minipass@^2.3.5: version "2.3.5" resolved "https://registry.yarnpkg.com/minipass/-/minipass-2.3.5.tgz#cacebe492022497f656b0f0f51e2682a9ed2d848" integrity sha512-Gi1W4k059gyRbyVUZQ4mEqLm0YIUiGYfvxhF6SIlk3ui1WVxMTGfGdQ2SInh3PDrRTVvPKgULkpJtT4RH10+VA== @@ -2936,7 +2917,7 @@ minipass@^2.2.1, minipass@^2.3.4: safe-buffer "^5.1.2" yallist "^3.0.0" -minizlib@^1.1.1: +minizlib@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/minizlib/-/minizlib-1.2.1.tgz#dd27ea6136243c7c880684e8672bb3a45fd9b614" integrity sha512-7+4oTUOWKg7AuL3vloEWekXY2/D20cevzsrNT2kGWm+39J9hGTCBv8VI5Pm5lXZ/o3/mdR4f8rflAPhnQb8mPA== @@ -2944,8 +2925,9 @@ minizlib@^1.1.1: minipass "^2.2.1" mixin-deep@^1.2.0: - version "1.3.1" - resolved "https://registry.yarnpkg.com/mixin-deep/-/mixin-deep-1.3.1.tgz#a49e7268dce1a0d9698e45326c5626df3543d0fe" + version "1.3.2" + resolved "https://registry.yarnpkg.com/mixin-deep/-/mixin-deep-1.3.2.tgz#1120b43dc359a785dce65b55b82e257ccf479566" + integrity sha512-WRoDn//mXBiJ1H40rqa3vH0toePwSsGb45iInWlTySa+Uu4k3tYUSxa2v1KqAiLtvlrSzaExqS1gtk96A9zvEA== dependencies: for-in "^1.0.2" is-extendable "^1.0.1" @@ -2953,16 +2935,10 @@ mixin-deep@^1.2.0: mkdirp@^0.5.0, mkdirp@^0.5.1: version "0.5.1" resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" + integrity sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM= dependencies: minimist "0.0.8" -mongodb-core@2.1.19: - version "2.1.19" - resolved "https://registry.yarnpkg.com/mongodb-core/-/mongodb-core-2.1.19.tgz#00fbd5e5a3573763b9171cfd844e60a8f2a3a18b" - dependencies: - bson "~1.0.4" - require_optional "~1.0.0" - mongodb-core@3.2.7: version "3.2.7" resolved "https://registry.yarnpkg.com/mongodb-core/-/mongodb-core-3.2.7.tgz#a8ef1fe764a192c979252dacbc600dc88d77e28f" @@ -2974,7 +2950,7 @@ mongodb-core@3.2.7: optionalDependencies: saslprep "^1.0.0" -mongodb@3.2.7: +mongodb@3.2.7, mongodb@^3.2.7: version "3.2.7" resolved "https://registry.yarnpkg.com/mongodb/-/mongodb-3.2.7.tgz#8ba149e4be708257cad0dea72aebb2bbb311a7ac" integrity sha512-2YdWrdf1PJgxcCrT1tWoL6nHuk6hCxhddAAaEh8QJL231ci4+P9FLyqopbTm2Z2sAU6mhCri+wd9r1hOcHdoMw== @@ -2982,20 +2958,12 @@ mongodb@3.2.7: mongodb-core "3.2.7" safe-buffer "^5.1.2" -mongodb@^2.2.35: - version "2.2.35" - resolved "https://registry.yarnpkg.com/mongodb/-/mongodb-2.2.35.tgz#cd1b5af8a9463e3f9a787fa5b3d05565579730f9" - dependencies: - es6-promise "3.2.1" - mongodb-core "2.1.19" - readable-stream "2.2.7" - mongoose-legacy-pluralize@1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/mongoose-legacy-pluralize/-/mongoose-legacy-pluralize-1.0.2.tgz#3ba9f91fa507b5186d399fb40854bff18fb563e4" integrity sha512-Yo/7qQU4/EyIS8YDFSeenIvXxZN+ld7YdV9LqFVQJzTLye8unujAWPZ4NWKfFA+RNjh+wvTWKY9Z3E5XM6ZZiQ== -mongoose@^5.0.11: +mongoose@^5.6.1: version "5.6.1" resolved "https://registry.yarnpkg.com/mongoose/-/mongoose-5.6.1.tgz#4efc3373b8121fdac4192896e303bb8cc572907b" integrity sha512-/EBoXS+fZv8dYf0VKMXwhTEVYUI+6EbmVhmV2DzO9BGacTSgStQprU09rZYfVxe8EmLhmTrSV5eCIRLBYuXGag== @@ -3033,32 +3001,28 @@ mquery@3.2.1: ms@2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" + integrity sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g= -ms@2.1.2: +ms@2.1.2, ms@^2.1.1: version "2.1.2" resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== -ms@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.1.tgz#30a5864eb3ebb0a66f2ebe6d727af06a09d86e0a" - integrity sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg== - nan@^2.12.1: version "2.14.0" resolved "https://registry.yarnpkg.com/nan/-/nan-2.14.0.tgz#7818f722027b2459a86f0295d434d1fc2336c52c" integrity sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg== nanomatch@^1.2.9: - version "1.2.9" - resolved "https://registry.yarnpkg.com/nanomatch/-/nanomatch-1.2.9.tgz#879f7150cb2dab7a471259066c104eee6e0fa7c2" + version "1.2.13" + resolved "https://registry.yarnpkg.com/nanomatch/-/nanomatch-1.2.13.tgz#b87a8aa4fc0de8fe6be88895b38983ff265bd119" + integrity sha512-fpoe2T0RbHwBTBUOftAfBPaDEi06ufaUai0mE6Yn1kacc3SnTErfb/h+X94VXzI64rKFHYImXSvdwGGCmwOqCA== dependencies: arr-diff "^4.0.0" array-unique "^0.3.2" define-property "^2.0.2" extend-shallow "^3.0.2" fragment-cache "^0.2.1" - is-odd "^2.0.0" is-windows "^1.0.2" kind-of "^6.0.2" object.pick "^1.3.0" @@ -3136,11 +3100,12 @@ nopt@^4.0.1: osenv "^0.1.4" normalize-package-data@^2.3.2: - version "2.4.0" - resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-2.4.0.tgz#12f95a307d58352075a04907b84ac8be98ac012f" + version "2.5.0" + resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-2.5.0.tgz#e66db1838b200c1dfc233225d12cb36520e234a8" + integrity sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA== dependencies: hosted-git-info "^2.1.4" - is-builtin-module "^1.0.0" + resolve "^1.10.0" semver "2 || 3 || 4 || 5" validate-npm-package-license "^3.0.1" @@ -3167,6 +3132,7 @@ npm-packlist@^1.1.6: 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" + integrity sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8= dependencies: path-key "^2.0.0" @@ -3183,6 +3149,7 @@ npmlog@^4.0.2: 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" + integrity sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0= nwsapi@^2.0.7: version "2.1.4" @@ -3190,8 +3157,9 @@ nwsapi@^2.0.7: integrity sha512-iGfd9Y6SFdTNldEy2L0GUhcarIutFmk+MPWIn9dmj8NMIup03G08uUF2KGbbmv/Ux4RT0VZJoP/sVbWA6d/VIw== nyc@^11.6.0: - version "11.6.0" - resolved "https://registry.yarnpkg.com/nyc/-/nyc-11.6.0.tgz#d9c7b51ffceb6bba099a4683a6adc1b331b98853" + version "11.9.0" + resolved "https://registry.yarnpkg.com/nyc/-/nyc-11.9.0.tgz#4106e89e8fbe73623a1fc8b6ecb7abaa271ae1e4" + integrity sha512-w8OdJAhXL5izerzZMdqzYKMj/pgHJyY3qEPYBjLLxrhcVoHEY9pU5ENIiZyCgG9OR7x3VcUMoD40o6PtVpfR4g== dependencies: archy "^1.0.0" arrify "^1.0.1" @@ -3208,23 +3176,19 @@ nyc@^11.6.0: istanbul-lib-instrument "^1.10.0" istanbul-lib-report "^1.1.3" istanbul-lib-source-maps "^1.2.3" - istanbul-reports "^1.1.4" + istanbul-reports "^1.4.0" md5-hex "^1.2.0" - merge-source-map "^1.0.2" - micromatch "^2.3.11" + merge-source-map "^1.1.0" + micromatch "^3.1.10" mkdirp "^0.5.0" resolve-from "^2.0.0" - rimraf "^2.5.4" + rimraf "^2.6.2" signal-exit "^3.0.1" spawn-wrap "^1.4.2" test-exclude "^4.2.0" yargs "11.1.0" yargs-parser "^8.0.0" -oauth-sign@~0.8.2: - version "0.8.2" - resolved "https://registry.yarnpkg.com/oauth-sign/-/oauth-sign-0.8.2.tgz#46a6ab7f0aead8deae9ec0565780b7d4efeb9d43" - oauth-sign@~0.9.0: version "0.9.0" resolved "https://registry.yarnpkg.com/oauth-sign/-/oauth-sign-0.9.0.tgz#47a7b016baa68b5fa0ecf3dee08a85c679ac6455" @@ -3233,10 +3197,12 @@ oauth-sign@~0.9.0: object-assign@^4.1.0: version "4.1.1" resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" + integrity sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM= object-copy@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/object-copy/-/object-copy-0.1.0.tgz#7e7d858b781bd7c991a41ba975ed3812754e998c" + integrity sha1-fn2Fi3gb18mRpBupde04EnVOmYw= dependencies: copy-descriptor "^0.1.0" define-property "^0.2.5" @@ -3250,6 +3216,7 @@ object-keys@^1.0.12: object-visit@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/object-visit/-/object-visit-1.0.1.tgz#f79c4493af0c5377b59fe39d395e41042dd045bb" + integrity sha1-95xEk68MU3e1n+OdOV5BBC3QRbs= dependencies: isobject "^3.0.0" @@ -3264,6 +3231,7 @@ object.getownpropertydescriptors@^2.0.3: object.omit@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/object.omit/-/object.omit-2.0.1.tgz#1a9c744829f39dbb858c76ca3579ae2a54ebd1fa" + integrity sha1-Gpx0SCnznbuFjHbKNXmuKlTr0fo= dependencies: for-own "^0.1.4" is-extendable "^0.1.1" @@ -3271,18 +3239,21 @@ object.omit@^2.0.0: object.pick@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/object.pick/-/object.pick-1.3.0.tgz#87a10ac4c1694bd2e1cbf53591a66141fb5dd747" + integrity sha1-h6EKxMFpS9Lhy/U1kaZhQftd10c= dependencies: isobject "^3.0.1" once@^1.3.0, once@^1.3.1, once@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" + integrity sha1-WDsap3WWHUsROsF9nFC6753Xa9E= dependencies: wrappy "1" optimist@^0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/optimist/-/optimist-0.6.1.tgz#da3ea74686fa21a19a111c326e90eb15a0196686" + integrity sha1-2j6nRob6IaGaERwybpDrFaAZZoY= dependencies: minimist "~0.0.1" wordwrap "~0.0.2" @@ -3307,6 +3278,7 @@ os-homedir@^1.0.0, os-homedir@^1.0.1: os-locale@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/os-locale/-/os-locale-2.1.0.tgz#42bc2900a6b5b8bd17376c8e882b65afccf24bf2" + integrity sha512-3sslG3zJbEYcaC4YVAvDorjGxc7tv6KVATnLPZONiljsUncvihe9BQoVCEs0RZ1kmf4Hk9OBqlZfJZWI4GanKA== dependencies: execa "^0.7.0" lcid "^1.0.0" @@ -3349,6 +3321,7 @@ p-each-series@^1.0.0: p-finally@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/p-finally/-/p-finally-1.0.0.tgz#3fbcfb15b899a44123b34b6dcc18b724336a2cae" + integrity sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4= p-is-promise@^2.0.0: version "2.1.0" @@ -3356,8 +3329,9 @@ p-is-promise@^2.0.0: integrity sha512-Y3W0wlRPK8ZMRbNq97l4M5otioeA5lm1z7bkNkxCka8HSPjR0xRWmpCmc9utiaLP9Jb1eD8BgeIxTW4AIF45Pg== p-limit@^1.1.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-1.2.0.tgz#0e92b6bedcb59f022c13d0f1949dc82d15909f1c" + version "1.3.0" + resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-1.3.0.tgz#b86bd5f0c25690911c7590fcbfc2010d54b3ccb8" + integrity sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q== dependencies: p-try "^1.0.0" @@ -3371,6 +3345,7 @@ p-limit@^2.0.0: p-locate@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-2.0.0.tgz#20a0103b222a70c8fd39cc2e580680f3dde5ec43" + integrity sha1-IKAQOyIqcMj9OcwuWAaA893l7EM= dependencies: p-limit "^1.1.0" @@ -3389,6 +3364,7 @@ p-reduce@^1.0.0: p-try@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/p-try/-/p-try-1.0.0.tgz#cbc79cdbaf8fd4228e13f621f2b1a237c1b207b3" + integrity sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M= p-try@^2.0.0: version "2.2.0" @@ -3398,6 +3374,7 @@ p-try@^2.0.0: parse-glob@^3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/parse-glob/-/parse-glob-3.0.4.tgz#b2c376cfb11f35513badd173ef0bb6e3a388391c" + integrity sha1-ssN2z7EfNVE7rdFz7wu246OIORw= dependencies: glob-base "^0.3.0" is-dotfile "^1.0.0" @@ -3407,6 +3384,7 @@ parse-glob@^3.0.4: parse-json@^2.2.0: version "2.2.0" resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-2.2.0.tgz#f480f40434ef80741f8469099f8dea18f55a4dc9" + integrity sha1-9ID0BDTvgHQfhGkJn43qGPVaTck= dependencies: error-ex "^1.2.0" @@ -3426,30 +3404,31 @@ parse5@4.0.0: pascalcase@^0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/pascalcase/-/pascalcase-0.1.1.tgz#b363e55e8006ca6fe21784d2db22bd15d7917f14" + integrity sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ= path-exists@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-2.1.0.tgz#0feb6c64f0fc518d9a754dd5efb62c7022761f4b" + integrity sha1-D+tsZPD8UY2adU3V77YscCJ2H0s= 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" + integrity sha1-zg6+ql94yxiSXqfYENe1mwEP1RU= 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" + integrity sha1-F0uSaHNVNP+8es5r9TpanhtcX18= path-key@^2.0.0, path-key@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40" + integrity sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A= -path-parse@^1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.5.tgz#3c1adf871ea9cd6c9431b6ea2bd74a0ff055c4c1" - -path-parse@^1.0.6: +path-parse@^1.0.5, path-parse@^1.0.6: version "1.0.6" resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.6.tgz#d62dbb5679405d72c4737ec58600e9ddcf06d24c" integrity sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw== @@ -3457,6 +3436,7 @@ path-parse@^1.0.6: path-type@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/path-type/-/path-type-1.1.0.tgz#59c44f7ee491da704da415da5a4070ba4f8fe441" + integrity sha1-WcRPfuSR2nBNpBXaWkBwuk+P5EE= dependencies: graceful-fs "^4.1.2" pify "^2.0.0" @@ -3472,10 +3452,12 @@ path-type@^3.0.0: performance-now@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b" + integrity sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns= pify@^2.0.0: version "2.3.0" resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c" + integrity sha1-7RQaasBDqEnqWISY59yosVMw6Qw= pify@^3.0.0: version "3.0.0" @@ -3490,12 +3472,14 @@ pify@^4.0.1: pinkie-promise@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/pinkie-promise/-/pinkie-promise-2.0.1.tgz#2135d6dfa7a358c069ac9b178776288228450ffa" + integrity sha1-ITXW36ejWMBprJsXh3YogihFD/o= dependencies: pinkie "^2.0.0" pinkie@^2.0.0: version "2.0.4" resolved "https://registry.yarnpkg.com/pinkie/-/pinkie-2.0.4.tgz#72556b80cfa0d48a974e80e77248e80ed4f7f870" + integrity sha1-clVrgM+g1IqXToDnckjoDtT3+HA= pirates@^4.0.1: version "4.0.1" @@ -3507,6 +3491,7 @@ pirates@^4.0.1: pkg-dir@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-1.0.0.tgz#7a4b508a8d5bb2d629d447056ff4e9c9314cf3d4" + integrity sha1-ektQio1bstYp1EcFb/TpyTFM89Q= dependencies: find-up "^1.0.0" @@ -3525,6 +3510,7 @@ pn@^1.1.0: posix-character-classes@^0.1.0: version "0.1.1" resolved "https://registry.yarnpkg.com/posix-character-classes/-/posix-character-classes-0.1.1.tgz#01eac0fe3b5af71a2a6c02feabb8c1fef7e00eab" + integrity sha1-AerA/jta9xoqbAL+q7jB/vfgDqs= prelude-ls@~1.1.2: version "1.1.2" @@ -3534,6 +3520,7 @@ prelude-ls@~1.1.2: preserve@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b" + integrity sha1-gV7R9uvGWSb4ZbMQwHE7yzMVzks= prettier@^1.18.2: version "1.18.2" @@ -3550,14 +3537,10 @@ pretty-format@^24.8.0: ansi-styles "^3.2.0" react-is "^16.8.4" -process-nextick-args@~1.0.6: - version "1.0.7" - resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-1.0.7.tgz#150e20b756590ad3f91093f25a4f2ad8bff30ba3" - process-nextick-args@~2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.0.tgz#a37d732f4271b4ab1ad070d35508e8290788ffaa" - integrity sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw== + version "2.0.1" + resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2" + integrity sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag== prompts@^2.0.1: version "2.1.0" @@ -3570,11 +3553,12 @@ prompts@^2.0.1: pseudomap@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/pseudomap/-/pseudomap-1.0.2.tgz#f052a28da70e618917ef0a8ac34c1ae5a68286b3" + integrity sha1-8FKijacOYYkX7wqKw0wa5aaChrM= psl@^1.1.24, psl@^1.1.28: - version "1.1.32" - resolved "https://registry.yarnpkg.com/psl/-/psl-1.1.32.tgz#3f132717cf2f9c169724b2b6caf373cf694198db" - integrity sha512-MHACAkHpihU/REGGPLj4sEfc/XKW2bheigvHO1dUqjaKigMp1C8+WLQYRGgeKFMsw5PMfegZcaN8IDXK/cD0+g== + version "1.1.33" + resolved "https://registry.yarnpkg.com/psl/-/psl-1.1.33.tgz#5533d9384ca7aab86425198e10e8053ebfeab661" + integrity sha512-LTDP2uSrsc7XCb5lO7A8BI1qYxRe/8EqlRvMeEl6rsnYAqDOl8xHR+8lSAIVfrNaSAlTPTNOCgNjWcoUL3AZsw== pump@^3.0.0: version "3.0.0" @@ -3587,27 +3571,26 @@ pump@^3.0.0: punycode@^1.4.1: version "1.4.1" resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e" + integrity sha1-wNWmOycYgArY4esPpSachN1BhF4= punycode@^2.1.0, punycode@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" integrity sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A== -qs@~6.5.1: - version "6.5.1" - resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.1.tgz#349cdf6eef89ec45c12d7d5eb3fc0c870343a6d8" - qs@~6.5.2: version "6.5.2" resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.2.tgz#cb3ae806e8740444584ef154ce8ee98d403f3e36" integrity sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA== -randomatic@^1.1.3: - version "1.1.7" - resolved "https://registry.yarnpkg.com/randomatic/-/randomatic-1.1.7.tgz#c7abe9cc8b87c0baa876b19fde83fd464797e38c" +randomatic@^3.0.0: + version "3.1.1" + resolved "https://registry.yarnpkg.com/randomatic/-/randomatic-3.1.1.tgz#b776efc59375984e36c537b2f51a1f0aff0da1ed" + integrity sha512-TuDE5KxZ0J461RVjrJZCJc+J+zCkTb1MbH9AQUq68sMhOMcy9jLcb3BrZKgp9q9Ncltdg4QVqWrH02W2EFFVYw== dependencies: - is-number "^3.0.0" - kind-of "^4.0.0" + is-number "^4.0.0" + kind-of "^6.0.0" + math-random "^1.0.1" rc@^1.2.7: version "1.2.8" @@ -3627,6 +3610,7 @@ react-is@^16.8.4: read-pkg-up@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-1.0.1.tgz#9d63c13276c065918d57f002a57f40a1b643fb02" + integrity sha1-nWPBMnbAZZGNV/ACpX9AobZD+wI= dependencies: find-up "^1.0.0" read-pkg "^1.0.0" @@ -3642,6 +3626,7 @@ read-pkg-up@^4.0.0: read-pkg@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-1.1.0.tgz#f5ffaa5ecd29cb31c0474bca7d756b6bb29e3f28" + integrity sha1-9f+qXs0pyzHAR0vKfXVra7KePyg= dependencies: load-json-file "^1.0.0" normalize-package-data "^2.3.2" @@ -3656,18 +3641,6 @@ read-pkg@^3.0.0: normalize-package-data "^2.3.2" path-type "^3.0.0" -readable-stream@2.2.7: - version "2.2.7" - resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.2.7.tgz#07057acbe2467b22042d36f98c5ad507054e95b1" - dependencies: - buffer-shims "~1.0.0" - core-util-is "~1.0.0" - inherits "~2.0.1" - isarray "~1.0.0" - process-nextick-args "~1.0.6" - string_decoder "~1.0.0" - util-deprecate "~1.0.1" - readable-stream@^2.0.1, readable-stream@^2.0.6: version "2.3.6" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.6.tgz#b11c27d88b8ff1fbe070643cf94b0c79ae1b0aaf" @@ -3691,16 +3664,19 @@ realpath-native@^1.1.0: regenerator-runtime@^0.11.0: version "0.11.1" resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz#be05ad7f9bf7d22e056f9726cee5017fbf19e2e9" + integrity sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg== regex-cache@^0.4.2: version "0.4.4" resolved "https://registry.yarnpkg.com/regex-cache/-/regex-cache-0.4.4.tgz#75bdc58a2a1496cec48a12835bc54c8d562336dd" + integrity sha512-nVIZwtCjkC9YgvWkpM55B5rBhBYRZhAaJbgcFYXXsHnbZ9UZI9nnVWYZpBlCqv9ho2eZryPnWrZGsOdPwVWXWQ== dependencies: is-equal-shallow "^0.1.3" regex-not@^1.0.0, regex-not@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/regex-not/-/regex-not-1.0.2.tgz#1f4ece27e00b0b65e0247a6810e6a85d83a5752c" + integrity sha512-J6SDjUgDxQj5NusnOtdFxDwN/+HWykR8GELwctJ7mdqhcyy1xEc4SRFHUXvxTp661YaVKAjfRLZ9cCqS6tn32A== dependencies: extend-shallow "^3.0.2" safe-regex "^1.1.0" @@ -3713,18 +3689,22 @@ regexp-clone@1.0.0, regexp-clone@^1.0.0: remove-trailing-separator@^1.0.1: version "1.1.0" resolved "https://registry.yarnpkg.com/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz#c24bce2a283adad5bc3f58e0d48249b92379d8ef" + integrity sha1-wkvOKig62tW8P1jg1IJJuSN52O8= repeat-element@^1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/repeat-element/-/repeat-element-1.1.2.tgz#ef089a178d1483baae4d93eb98b4f9e4e11d990a" + version "1.1.3" + resolved "https://registry.yarnpkg.com/repeat-element/-/repeat-element-1.1.3.tgz#782e0d825c0c5a3bb39731f84efee6b742e6b1ce" + integrity sha512-ahGq0ZnV5m5XtZLMb+vP76kcAM5nkLqk0lpqAuojSKGgQtn4eRi4ZZGm2olo2zKFH+sMsWaqOCW1dqAnOru72g== repeat-string@^1.5.2, repeat-string@^1.6.1: version "1.6.1" resolved "https://registry.yarnpkg.com/repeat-string/-/repeat-string-1.6.1.tgz#8dcae470e1c88abc2d600fff4a776286da75e637" + integrity sha1-jcrkcOHIirwtYA//Sndihtp15jc= repeating@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/repeating/-/repeating-2.0.1.tgz#5214c53a926d3552707527fbab415dbc08d06dda" + integrity sha1-UhTFOpJtNVJwdSf7q0FdvAjQbdo= dependencies: is-finite "^1.0.0" @@ -3744,34 +3724,7 @@ request-promise-native@^1.0.5: stealthy-require "^1.1.1" tough-cookie "^2.3.3" -request@^2.79.0: - version "2.83.0" - resolved "https://registry.yarnpkg.com/request/-/request-2.83.0.tgz#ca0b65da02ed62935887808e6f510381034e3356" - dependencies: - aws-sign2 "~0.7.0" - aws4 "^1.6.0" - caseless "~0.12.0" - combined-stream "~1.0.5" - extend "~3.0.1" - forever-agent "~0.6.1" - form-data "~2.3.1" - har-validator "~5.0.3" - hawk "~6.0.2" - http-signature "~1.2.0" - is-typedarray "~1.0.0" - isstream "~0.1.2" - json-stringify-safe "~5.0.1" - mime-types "~2.1.17" - oauth-sign "~0.8.2" - performance-now "^2.1.0" - qs "~6.5.1" - safe-buffer "^5.1.1" - stringstream "~0.0.5" - tough-cookie "~2.3.3" - tunnel-agent "^0.6.0" - uuid "^3.1.0" - -request@^2.83.0, request@^2.87.0: +request@^2.83.0, request@^2.86.0, request@^2.87.0: version "2.88.0" resolved "https://registry.yarnpkg.com/request/-/request-2.88.0.tgz#9c2fca4f7d35b592efe57c7f0a55e81052124fef" integrity sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg== @@ -3800,19 +3753,22 @@ request@^2.83.0, request@^2.87.0: require-directory@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" + integrity sha1-jGStX9MNqxyXbiNE/+f3kqam30I= require-main-filename@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-1.0.1.tgz#97f717b69d48784f5f526a6c5aa8ffdda055a4d1" + integrity sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE= require-main-filename@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-2.0.0.tgz#d0b329ecc7cc0f61649f62215be69af54aa8989b" integrity sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg== -require_optional@^1.0.1, require_optional@~1.0.0: +require_optional@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/require_optional/-/require_optional-1.0.1.tgz#4cf35a4247f64ca3df8c2ef208cc494b1ca8fc2e" + integrity sha512-qhM/y57enGWHAe3v/NcwML6a3/vfESLe/sGM2dII+gEO0BpKRUkWZow/tyloNqJyN6kXSl3RyyM8Ll5D/sJP8g== dependencies: resolve-from "^2.0.0" semver "^5.1.0" @@ -3827,6 +3783,7 @@ resolve-cwd@^2.0.0: resolve-from@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-2.0.0.tgz#9480ab20e94ffa1d9e80a804c7ea147611966b57" + integrity sha1-lICrIOlP+h2egKgEx+oUdhGWa1c= resolve-from@^3.0.0: version "3.0.0" @@ -3836,36 +3793,26 @@ resolve-from@^3.0.0: resolve-url@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/resolve-url/-/resolve-url-0.2.1.tgz#2c637fe77c893afd2a663fe21aa9080068e2052a" + integrity sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo= resolve@1.1.7: version "1.1.7" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b" integrity sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs= -resolve@^1.3.2: - version "1.11.0" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.11.0.tgz#4014870ba296176b86343d50b60f3b50609ce232" - integrity sha512-WL2pBDjqT6pGUNSUzMw00o4T7If+z4H2x3Gz893WoUQ5KW8Vr9txp00ykiP16VBaZF5+j/OcXJHZ9+PCvdiDKw== +resolve@^1.10.0, resolve@^1.3.2: + version "1.11.1" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.11.1.tgz#ea10d8110376982fef578df8fc30b9ac30a07a3e" + integrity sha512-vIpgF6wfuJOZI7KKKSP+HmiKggadPQAdsp5HiC1mvqnfp0gF1vdwgBWZIdrVft9pgqoMFQN+R7BSWZiBxx+BBw== dependencies: path-parse "^1.0.6" ret@~0.1.10: version "0.1.15" resolved "https://registry.yarnpkg.com/ret/-/ret-0.1.15.tgz#b8a4825d5bdb1fc3f6f53c2bc33f81388681c7bc" + integrity sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg== -right-align@^0.1.1: - version "0.1.3" - resolved "https://registry.yarnpkg.com/right-align/-/right-align-0.1.3.tgz#61339b722fe6a3515689210d24e14c96148613ef" - dependencies: - align-text "^0.1.1" - -rimraf@^2.5.4, rimraf@^2.6.1, rimraf@^2.6.2: - version "2.6.2" - resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.2.tgz#2ed8150d24a16ea8651e6d6ef0f47c4158ce7a36" - dependencies: - glob "^7.0.5" - -rimraf@^2.6.3: +rimraf@^2.5.4, rimraf@^2.6.1, rimraf@^2.6.2, rimraf@^2.6.3: version "2.6.3" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.3.tgz#b2d104fe0d8fb27cf9e0a1cda8262dd3833c6cab" integrity sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA== @@ -3873,26 +3820,23 @@ rimraf@^2.6.3: glob "^7.1.3" rsvp@^4.8.4: - version "4.8.4" - resolved "https://registry.yarnpkg.com/rsvp/-/rsvp-4.8.4.tgz#b50e6b34583f3dd89329a2f23a8a2be072845911" - integrity sha512-6FomvYPfs+Jy9TfXmBpBuMWNH94SgCsZmJKcanySzgNNP6LjWxBvyLTa9KaMfDDM5oxRfrKDB0r/qeRsLwnBfA== + version "4.8.5" + resolved "https://registry.yarnpkg.com/rsvp/-/rsvp-4.8.5.tgz#c8f155311d167f68f21e168df71ec5b083113734" + integrity sha512-nfMOlASu9OnRJo1mbEk2cz0D56a1MBNrJ7orjRZQG10XDyuvwksKbuXNp6qa+kbn839HwjwhBzhFmdsaEAfauA== -safe-buffer@5.1.2, safe-buffer@^5.1.2, safe-buffer@~5.1.1: +safe-buffer@5.1.2, safe-buffer@^5.0.1, safe-buffer@^5.1.2, safe-buffer@~5.1.0, safe-buffer@~5.1.1: version "5.1.2" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g== -safe-buffer@^5.0.1, safe-buffer@^5.1.1, safe-buffer@~5.1.0: - version "5.1.1" - resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.1.tgz#893312af69b2123def71f57889001671eeb2c853" - safe-regex@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/safe-regex/-/safe-regex-1.1.0.tgz#40a3669f3b077d1e943d44629e157dd48023bf2e" + integrity sha1-QKNmnzsHfR6UPURinhV91IAjvy4= dependencies: ret "~0.1.10" -"safer-buffer@>= 2.1.2 < 3": +"safer-buffer@>= 2.1.2 < 3", safer-buffer@^2.0.2, safer-buffer@^2.1.0, safer-buffer@~2.1.0: version "2.1.2" resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== @@ -3924,36 +3868,25 @@ sax@^1.2.4: resolved "https://registry.yarnpkg.com/sax/-/sax-1.2.4.tgz#2816234e2378bddc4e5354fab5caa895df7100d9" integrity sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw== -"semver@2 || 3 || 4 || 5", semver@^5.1.0, semver@^5.3.0: - version "5.5.0" - resolved "https://registry.yarnpkg.com/semver/-/semver-5.5.0.tgz#dc4bbc7a6ca9d916dee5d43516f0092b58f7b8ab" - -semver@^5.4.1, semver@^5.5.0, semver@^5.6.0: +"semver@2 || 3 || 4 || 5", semver@^5.1.0, semver@^5.3.0, semver@^5.4.1, semver@^5.5.0, semver@^5.6.0: version "5.7.0" resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.0.tgz#790a7cf6fea5459bac96110b29b60412dc8ff96b" integrity sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA== semver@^6.0.0: - version "6.1.0" - resolved "https://registry.yarnpkg.com/semver/-/semver-6.1.0.tgz#e95dc415d45ecf03f2f9f83b264a6b11f49c0cca" - integrity sha512-kCqEOOHoBcFs/2Ccuk4Xarm/KiWRSLEX9CAZF8xkJ6ZPlIoTZ8V5f7J16vYLJqDbR7KrxTJpR2lqjIEm2Qx9cQ== + version "6.1.2" + resolved "https://registry.yarnpkg.com/semver/-/semver-6.1.2.tgz#079960381376a3db62eb2edc8a3bfb10c7cfe318" + integrity sha512-z4PqiCpomGtWj8633oeAdXm1Kn1W++3T8epkZYnwiVgIYIJ0QHszhInYSJTYxebByQH7KVCEAn8R9duzZW2PhQ== set-blocking@^2.0.0, set-blocking@~2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" + integrity sha1-BF+XgtARrppoA93TgrJDkrPYkPc= -set-value@^0.4.3: - version "0.4.3" - resolved "https://registry.yarnpkg.com/set-value/-/set-value-0.4.3.tgz#7db08f9d3d22dc7f78e53af3c3bf4666ecdfccf1" - dependencies: - extend-shallow "^2.0.1" - is-extendable "^0.1.1" - is-plain-object "^2.0.1" - to-object-path "^0.3.0" - -set-value@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/set-value/-/set-value-2.0.0.tgz#71ae4a88f0feefbbf52d1ea604f3fb315ebb6274" +set-value@^2.0.0, set-value@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/set-value/-/set-value-2.0.1.tgz#a18d40530e6f07de4228c7defe4227af8cad005b" + integrity sha512-JxHc1weCN68wRY0fhCoXpyK55m/XPHafOmK4UWD7m2CI14GMcFypt4w/0+NV5f/ZMby2F6S2wwA7fgynh9gWSw== dependencies: extend-shallow "^2.0.1" is-extendable "^0.1.1" @@ -3963,12 +3896,14 @@ set-value@^2.0.0: shebang-command@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-1.2.0.tgz#44aac65b695b03398968c39f363fee5deafdf1ea" + integrity sha1-RKrGW2lbAzmJaMOfNj/uXer98eo= dependencies: shebang-regex "^1.0.0" shebang-regex@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3" + integrity sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM= shellwords@^0.1.1: version "0.1.1" @@ -3983,6 +3918,7 @@ sift@7.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" + integrity sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0= sisteransi@^1.0.0: version "1.0.0" @@ -3997,14 +3933,17 @@ slash@^2.0.0: sliced@1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/sliced/-/sliced-1.0.1.tgz#0b3a662b5d04c3177b1926bea82b03f837a2ef41" + integrity sha1-CzpmK10Ewxd7GSa+qCsD+Dei70E= slide@^1.1.5: version "1.1.6" resolved "https://registry.yarnpkg.com/slide/-/slide-1.1.6.tgz#56eb027d65b4d2dce6cb2e2d32c4d4afc9e1d707" + integrity sha1-VusCfWW00tzmyy4tMsTUr8nh1wc= snapdragon-node@^2.0.1: version "2.1.1" resolved "https://registry.yarnpkg.com/snapdragon-node/-/snapdragon-node-2.1.1.tgz#6c175f86ff14bdb0724563e8f3c1b021a286853b" + integrity sha512-O27l4xaMYt/RSQ5TR3vpWCAB5Kb/czIcqUFOM/C4fYcLnbZUc1PkjTAMjof2pBWaSTwOUd6qUHcFGVGj7aIwnw== dependencies: define-property "^1.0.0" isobject "^3.0.0" @@ -4013,12 +3952,14 @@ snapdragon-node@^2.0.1: snapdragon-util@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/snapdragon-util/-/snapdragon-util-3.0.1.tgz#f956479486f2acd79700693f6f7b805e45ab56e2" + integrity sha512-mbKkMdQKsjX4BAL4bRYTj21edOf8cN7XHdYUJEe+Zn99hVEYcMvKPct1IqNe7+AZPirn8BCDOQBHQZknqmKlZQ== dependencies: kind-of "^3.2.0" snapdragon@^0.8.1: version "0.8.2" resolved "https://registry.yarnpkg.com/snapdragon/-/snapdragon-0.8.2.tgz#64922e7c565b0e14204ba1aa7d6964278d25182d" + integrity sha512-FtyOnWN/wCHTVXOMwvSv26d+ko5vWlIDD6zoUJ7LW8vh+ZBC8QdljveRP+crNrtBwioEUWy/4dMtbBjA4ioNlg== dependencies: base "^0.11.1" debug "^2.2.0" @@ -4029,17 +3970,12 @@ snapdragon@^0.8.1: source-map-resolve "^0.5.0" use "^3.1.0" -sntp@2.x.x: - version "2.1.0" - resolved "https://registry.yarnpkg.com/sntp/-/sntp-2.1.0.tgz#2c6cec14fedc2222739caf9b5c3d85d1cc5a2cc8" - dependencies: - hoek "4.x.x" - source-map-resolve@^0.5.0: - version "0.5.1" - resolved "https://registry.yarnpkg.com/source-map-resolve/-/source-map-resolve-0.5.1.tgz#7ad0f593f2281598e854df80f19aae4b92d7a11a" + version "0.5.2" + resolved "https://registry.yarnpkg.com/source-map-resolve/-/source-map-resolve-0.5.2.tgz#72e2cc34095543e43b2c62b2c4c10d4a9054f259" + integrity sha512-MjqsvNwyz1s0k81Goz/9vRBe9SZdB09Bdw+/zYyO+3CuPk6fouTaxscHkgtE8jKvf01kVfl8riHzERQ/kefaSA== dependencies: - atob "^2.0.0" + atob "^2.1.1" decode-uri-component "^0.2.0" resolve-url "^0.2.1" source-map-url "^0.4.0" @@ -4056,14 +3992,9 @@ source-map-support@^0.5.6: source-map-url@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/source-map-url/-/source-map-url-0.4.0.tgz#3e935d7ddd73631b97659956d55128e87b5084a3" + integrity sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM= -source-map@^0.4.4: - version "0.4.4" - resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.4.4.tgz#eba4f5da9c0dc999de68032d8b4f76173652036b" - dependencies: - amdefine ">=0.0.4" - -source-map@^0.5.0, source-map@^0.5.3, source-map@^0.5.6, source-map@^0.5.7, source-map@~0.5.1: +source-map@^0.5.0, source-map@^0.5.3, source-map@^0.5.6, source-map@^0.5.7: version "0.5.7" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc" integrity sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w= @@ -4083,6 +4014,7 @@ sparse-bitfield@^3.0.3: spawn-wrap@^1.4.2: version "1.4.2" resolved "https://registry.yarnpkg.com/spawn-wrap/-/spawn-wrap-1.4.2.tgz#cff58e73a8224617b6561abdc32586ea0c82248c" + integrity sha512-vMwR3OmmDhnxCVxM8M+xO/FtIp6Ju/mNaDfCMMW7FDcLRTPFWUswec4LXJHTJE2hwTI9O0YBfygu4DalFl7Ylg== dependencies: foreground-child "^1.5.6" mkdirp "^0.5.0" @@ -4092,49 +4024,56 @@ spawn-wrap@^1.4.2: which "^1.3.0" spdx-correct@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-3.0.0.tgz#05a5b4d7153a195bc92c3c425b69f3b2a9524c82" + version "3.1.0" + resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-3.1.0.tgz#fb83e504445268f154b074e218c87c003cd31df4" + integrity sha512-lr2EZCctC2BNR7j7WzJ2FpDznxky1sjfxvvYEyzxNyb6lZXHODmEoJeFu4JupYlkfha1KZpJyoqiJ7pgA1qq8Q== dependencies: spdx-expression-parse "^3.0.0" spdx-license-ids "^3.0.0" spdx-exceptions@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/spdx-exceptions/-/spdx-exceptions-2.1.0.tgz#2c7ae61056c714a5b9b9b2b2af7d311ef5c78fe9" + version "2.2.0" + resolved "https://registry.yarnpkg.com/spdx-exceptions/-/spdx-exceptions-2.2.0.tgz#2ea450aee74f2a89bfb94519c07fcd6f41322977" + integrity sha512-2XQACfElKi9SlVb1CYadKDXvoajPgBVPn/gOQLrTvHdElaVhr7ZEbqJaRnJLVNeaI4cMEAgVCeBMKF6MWRDCRA== spdx-expression-parse@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/spdx-expression-parse/-/spdx-expression-parse-3.0.0.tgz#99e119b7a5da00e05491c9fa338b7904823b41d0" + integrity sha512-Yg6D3XpRD4kkOmTpdgbUiEJFKghJH03fiC1OPll5h/0sO6neh2jqRDVHOQ4o/LMea0tgCkbMgea5ip/e+MkWyg== dependencies: spdx-exceptions "^2.1.0" spdx-license-ids "^3.0.0" spdx-license-ids@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/spdx-license-ids/-/spdx-license-ids-3.0.0.tgz#7a7cd28470cc6d3a1cfe6d66886f6bc430d3ac87" + version "3.0.4" + resolved "https://registry.yarnpkg.com/spdx-license-ids/-/spdx-license-ids-3.0.4.tgz#75ecd1a88de8c184ef015eafb51b5b48bfd11bb1" + integrity sha512-7j8LYJLeY/Yb6ACbQ7F76qy5jHkp0U6jgBfJsk97bwWlVUnUWsAgpyaCvo17h0/RQGnQ036tVDomiwoI4pDkQA== split-string@^3.0.1, split-string@^3.0.2: version "3.1.0" resolved "https://registry.yarnpkg.com/split-string/-/split-string-3.1.0.tgz#7cb09dda3a86585705c64b39a6466038682e8fe2" + integrity sha512-NzNVhJDYpwceVVii8/Hu6DKfD2G+NrQHlS/V/qgv763EYudVwEcMQNxd2lh+0VrUByXN/oJkl5grOhYWvQUYiw== dependencies: extend-shallow "^3.0.0" sprintf-js@~1.0.2: version "1.0.3" resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" + integrity sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw= sshpk@^1.7.0: - version "1.13.1" - resolved "https://registry.yarnpkg.com/sshpk/-/sshpk-1.13.1.tgz#512df6da6287144316dc4c18fe1cf1d940739be3" + version "1.16.1" + resolved "https://registry.yarnpkg.com/sshpk/-/sshpk-1.16.1.tgz#fb661c0bef29b39db40769ee39fa70093d6f6877" + integrity sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg== dependencies: asn1 "~0.2.3" assert-plus "^1.0.0" - dashdash "^1.12.0" - getpass "^0.1.1" - optionalDependencies: bcrypt-pbkdf "^1.0.0" + dashdash "^1.12.0" ecc-jsbn "~0.1.1" + getpass "^0.1.1" jsbn "~0.1.0" + safer-buffer "^2.0.2" tweetnacl "~0.14.0" stack-utils@^1.0.1: @@ -4145,6 +4084,7 @@ stack-utils@^1.0.1: static-extend@^0.1.1: version "0.1.2" resolved "https://registry.yarnpkg.com/static-extend/-/static-extend-0.1.2.tgz#60809c39cbff55337226fd5e0b520f341f1fb5c6" + integrity sha1-YICcOcv/VTNyJv1eC1IPNB8ftcY= dependencies: define-property "^0.2.5" object-copy "^0.1.0" @@ -4165,6 +4105,7 @@ string-length@^2.0.0: string-width@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/string-width/-/string-width-1.0.2.tgz#118bdf5b8cdc51a2a7e70d211e07e2b0b9b107d3" + integrity sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M= dependencies: code-point-at "^1.0.0" is-fullwidth-code-point "^1.0.0" @@ -4173,16 +4114,11 @@ string-width@^1.0.1: "string-width@^1.0.2 || 2", string-width@^2.0.0, string-width@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e" + integrity sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw== dependencies: is-fullwidth-code-point "^2.0.0" strip-ansi "^4.0.0" -string_decoder@~1.0.0: - version "1.0.3" - resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.0.3.tgz#0fc67d7c141825de94282dd536bec6b9bce860ab" - dependencies: - safe-buffer "~5.1.0" - string_decoder@~1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.1.1.tgz#9cf1611ba62685d7030ae9e4ba34149c3af03fc8" @@ -4190,19 +4126,17 @@ string_decoder@~1.1.1: dependencies: safe-buffer "~5.1.0" -stringstream@~0.0.5: - version "0.0.5" - resolved "https://registry.yarnpkg.com/stringstream/-/stringstream-0.0.5.tgz#4e484cd4de5a0bbbee18e46307710a8a81621878" - strip-ansi@^3.0.0, strip-ansi@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf" + integrity sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8= dependencies: ansi-regex "^2.0.0" strip-ansi@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-4.0.0.tgz#a8479022eb1ac368a871389b635262c505ee368f" + integrity sha1-qEeQIusaw2iocTibY1JixQXuNo8= dependencies: ansi-regex "^3.0.0" @@ -4216,16 +4150,19 @@ strip-ansi@^5.0.0: strip-bom@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-2.0.0.tgz#6219a85616520491f35788bdbf1447a99c7e6b0e" + integrity sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4= dependencies: is-utf8 "^0.2.0" strip-bom@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-3.0.0.tgz#2334c18e9c759f7bdd56fdef7e9ae3d588e68ed3" + integrity sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM= strip-eof@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/strip-eof/-/strip-eof-1.0.0.tgz#bb43ff5598a6eb05d89b59fcd129c983313606bf" + integrity sha1-u0P/VZim6wXYm1n80SnJgzE2Br8= strip-json-comments@~2.0.1: version "2.0.1" @@ -4235,10 +4172,12 @@ strip-json-comments@~2.0.1: supports-color@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7" + integrity sha1-U10EXOa2Nj+kARcIRimZXp3zJMc= supports-color@^3.1.2: version "3.2.3" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-3.2.3.tgz#65ac0504b3954171d8a64946b2ae3cbb8a5f54f6" + integrity sha1-ZawFBLOVQXHYpklGsq48u4pfVPY= dependencies: has-flag "^1.0.0" @@ -4257,29 +4196,30 @@ supports-color@^6.1.0: has-flag "^3.0.0" symbol-tree@^3.2.2: - version "3.2.2" - resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.2.tgz#ae27db38f660a7ae2e1c3b7d1bc290819b8519e6" - integrity sha1-rifbOPZgp64uHDt9G8KQgZuFGeY= + version "3.2.4" + resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.4.tgz#430637d248ba77e078883951fb9aa0eed7c63fa2" + integrity sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw== tar@^4: - version "4.4.8" - resolved "https://registry.yarnpkg.com/tar/-/tar-4.4.8.tgz#b19eec3fde2a96e64666df9fdb40c5ca1bc3747d" - integrity sha512-LzHF64s5chPQQS0IYBn9IN5h3i98c12bo4NCO7e0sGM2llXQ3p2FGC5sdENN4cTW48O915Sh+x+EXx7XW96xYQ== + version "4.4.10" + resolved "https://registry.yarnpkg.com/tar/-/tar-4.4.10.tgz#946b2810b9a5e0b26140cf78bea6b0b0d689eba1" + integrity sha512-g2SVs5QIxvo6OLp0GudTqEf05maawKUxXru104iaayWA09551tFCTI8f1Asb4lPfkBr91k07iL4c11XO3/b0tA== dependencies: chownr "^1.1.1" fs-minipass "^1.2.5" - minipass "^2.3.4" - minizlib "^1.1.1" + minipass "^2.3.5" + minizlib "^1.2.1" mkdirp "^0.5.0" safe-buffer "^5.1.2" - yallist "^3.0.2" + yallist "^3.0.3" test-exclude@^4.2.0: - version "4.2.1" - resolved "https://registry.yarnpkg.com/test-exclude/-/test-exclude-4.2.1.tgz#dfa222f03480bca69207ca728b37d74b45f724fa" + version "4.2.3" + resolved "https://registry.yarnpkg.com/test-exclude/-/test-exclude-4.2.3.tgz#a9a5e64474e4398339245a0a769ad7c2f4a97c20" + integrity sha512-SYbXgY64PT+4GAL2ocI3HwPa4Q4TBKm0cwAVeKOt/Aoc0gSpNRjJX8w0pA1LMKZ3LBmd8pYBqApFNQLII9kavA== dependencies: arrify "^1.0.1" - micromatch "^3.1.8" + micromatch "^2.3.11" object-assign "^4.1.0" read-pkg-up "^1.0.1" require-main-filename "^1.0.1" @@ -4307,6 +4247,7 @@ tmpl@1.0.x: 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" + integrity sha1-uDVx+k2MJbguIxsG46MFXeTKGkc= to-fast-properties@^2.0.0: version "2.0.0" @@ -4316,12 +4257,14 @@ to-fast-properties@^2.0.0: to-object-path@^0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/to-object-path/-/to-object-path-0.3.0.tgz#297588b7b0e7e0ac08e04e672f85c1f4999e17af" + integrity sha1-KXWIt7Dn4KwI4E5nL4XB9JmeF68= dependencies: kind-of "^3.0.2" to-regex-range@^2.1.0: version "2.1.1" resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-2.1.1.tgz#7c80c17b9dfebe599e27367e0d4dd5590141db38" + integrity sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg= dependencies: is-number "^3.0.0" repeat-string "^1.6.1" @@ -4329,6 +4272,7 @@ to-regex-range@^2.1.0: to-regex@^3.0.1, to-regex@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/to-regex/-/to-regex-3.0.2.tgz#13cfdd9b336552f30b51f33a8ae1b42a7a7599ce" + integrity sha512-FWtleNAtZ/Ki2qtqej2CXTOayOH9bHDQF+Q48VpWyDXjbYxA4Yz8iDB31zXOBUlOHHKidDbqGVrTUvQMPmBGBw== dependencies: define-property "^2.0.2" extend-shallow "^3.0.2" @@ -4343,12 +4287,6 @@ tough-cookie@^2.3.3, tough-cookie@^2.3.4: psl "^1.1.28" punycode "^2.1.1" -tough-cookie@~2.3.3: - version "2.3.4" - resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.3.4.tgz#ec60cee38ac675063ffc97a5c18970578ee83655" - dependencies: - punycode "^1.4.1" - tough-cookie@~2.4.3: version "2.4.3" resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.4.3.tgz#53f36da3f47783b0925afa06ff9f3b165280f781" @@ -4367,16 +4305,19 @@ tr46@^1.0.1: trim-right@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/trim-right/-/trim-right-1.0.1.tgz#cb2e1203067e0c8de1f614094b9fe45704ea6003" + integrity sha1-yy4SAwZ+DI3h9hQJS5/kVwTqYAM= tunnel-agent@^0.6.0: version "0.6.0" resolved "https://registry.yarnpkg.com/tunnel-agent/-/tunnel-agent-0.6.0.tgz#27a5dea06b36b04a0a9966774b290868f0fc40fd" + integrity sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0= dependencies: safe-buffer "^5.0.1" tweetnacl@^0.14.3, tweetnacl@~0.14.0: version "0.14.5" resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-0.14.5.tgz#5ae68177f192d4456269d108afa93ff8743f4f64" + integrity sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q= type-check@~0.3.2: version "0.3.2" @@ -4385,39 +4326,28 @@ type-check@~0.3.2: dependencies: prelude-ls "~1.1.2" -uglify-js@^2.6: - version "2.8.29" - resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-2.8.29.tgz#29c5733148057bb4e1f75df35b7a9cb72e6a59dd" - dependencies: - source-map "~0.5.1" - yargs "~3.10.0" - optionalDependencies: - uglify-to-browserify "~1.0.0" - uglify-js@^3.1.4: - version "3.5.15" - resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.5.15.tgz#fe2b5378fd0b09e116864041437bff889105ce24" - integrity sha512-fe7aYFotptIddkwcm6YuA0HmknBZ52ZzOsUxZEdhhkSsz7RfjHDX2QDxwKTiv4JQ5t5NhfmpgAK+J7LiDhKSqg== + version "3.6.0" + resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.6.0.tgz#704681345c53a8b2079fb6cec294b05ead242ff5" + integrity sha512-W+jrUHJr3DXKhrsS7NUVxn3zqMOFn0hL/Ei6v0anCIMoKC93TjcflTagwIHLW7SfMFfiQuktQyFVCFHGUE0+yg== dependencies: commander "~2.20.0" source-map "~0.6.1" -uglify-to-browserify@~1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz#6e0924d6bda6b5afe349e39a6d632850a0f882b7" - union-value@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/union-value/-/union-value-1.0.0.tgz#5c71c34cb5bad5dcebe3ea0cd08207ba5aa1aea4" + version "1.0.1" + resolved "https://registry.yarnpkg.com/union-value/-/union-value-1.0.1.tgz#0b6fe7b835aecda61c6ea4d4f02c14221e109847" + integrity sha512-tJfXmxMeWYnczCVs7XAEvIV7ieppALdyepWMkHkwciRpZraG/xwT+s2JN8+pr1+8jCRf80FFzvr+MpQeeoF4Xg== dependencies: arr-union "^3.1.0" get-value "^2.0.6" is-extendable "^0.1.1" - set-value "^0.4.3" + set-value "^2.0.1" unset-value@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/unset-value/-/unset-value-1.0.0.tgz#8376873f7d2335179ffb1e6fc3a8ed0dfc8ab559" + integrity sha1-g3aHP30jNRef+x5vw6jtDfyKtVk= dependencies: has-value "^0.3.1" isobject "^3.0.0" @@ -4432,16 +4362,17 @@ uri-js@^4.2.2: urix@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/urix/-/urix-0.1.0.tgz#da937f7a62e21fec1fd18d49b35c2935067a6c72" + integrity sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI= use@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/use/-/use-3.1.0.tgz#14716bf03fdfefd03040aef58d8b4b85f3a7c544" - dependencies: - kind-of "^6.0.2" + version "3.1.1" + resolved "https://registry.yarnpkg.com/use/-/use-3.1.1.tgz#d50c8cac79a19fbc20f2911f56eb973f4e10070f" + integrity sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ== util-deprecate@~1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" + integrity sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8= util.promisify@^1.0.0: version "1.0.0" @@ -4451,18 +4382,15 @@ util.promisify@^1.0.0: define-properties "^1.1.2" object.getownpropertydescriptors "^2.0.3" -uuid@^3.1.0: - version "3.2.1" - resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.2.1.tgz#12c528bb9d58d0b9265d9a2f6f0fe8be17ff1f14" - uuid@^3.3.2: version "3.3.2" resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.3.2.tgz#1b4af4955eb3077c501c23872fc6513811587131" integrity sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA== validate-npm-package-license@^3.0.1: - version "3.0.3" - resolved "https://registry.yarnpkg.com/validate-npm-package-license/-/validate-npm-package-license-3.0.3.tgz#81643bcbef1bdfecd4623793dc4648948ba98338" + version "3.0.4" + resolved "https://registry.yarnpkg.com/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz#fc91f6b9c7ba15c857f4cb2c5defeec39d4f410a" + integrity sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew== dependencies: spdx-correct "^3.0.0" spdx-expression-parse "^3.0.0" @@ -4470,6 +4398,7 @@ validate-npm-package-license@^3.0.1: verror@1.10.0: version "1.10.0" resolved "https://registry.yarnpkg.com/verror/-/verror-1.10.0.tgz#3a105ca17053af55d6e270c1f8288682e18da400" + integrity sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA= dependencies: assert-plus "^1.0.0" core-util-is "1.0.2" @@ -4527,10 +4456,12 @@ whatwg-url@^7.0.0: which-module@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/which-module/-/which-module-2.0.0.tgz#d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a" + integrity sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho= which@^1.2.9, which@^1.3.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/which/-/which-1.3.0.tgz#ff04bdfc010ee547d780bec38e1ac1c2777d253a" + version "1.3.1" + resolved "https://registry.yarnpkg.com/which/-/which-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a" + integrity sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ== dependencies: isexe "^2.0.0" @@ -4541,17 +4472,10 @@ wide-align@^1.1.0: dependencies: string-width "^1.0.2 || 2" -window-size@0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/window-size/-/window-size-0.1.0.tgz#5438cd2ea93b202efa3a19fe8887aee7c94f9c9d" - -wordwrap@0.0.2: - version "0.0.2" - resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.2.tgz#b79669bb42ecb409f83d583cad52ca17eaa1643f" - wordwrap@~0.0.2: version "0.0.3" resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.3.tgz#a3d5da6cd5c0bc0008d37234bbaf1bed63059107" + integrity sha1-o9XabNXAvAAI03I0u68b7WMFkQc= wordwrap@~1.0.0: version "1.0.0" @@ -4561,6 +4485,7 @@ wordwrap@~1.0.0: wrap-ansi@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-2.1.0.tgz#d8fc3d284dd05794fe84973caecdd1cf824fdd85" + integrity sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU= dependencies: string-width "^1.0.1" strip-ansi "^3.0.1" @@ -4568,6 +4493,7 @@ wrap-ansi@^2.0.0: wrappy@1: version "1.0.2" resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" + integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= write-file-atomic@2.4.1: version "2.4.1" @@ -4581,6 +4507,7 @@ write-file-atomic@2.4.1: write-file-atomic@^1.1.4: version "1.3.4" resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-1.3.4.tgz#f807a4f0b1d9e913ae7a48112e6cc3af1991b45f" + integrity sha1-+Aek8LHZ6ROuekgRLmzDrxmRtF8= dependencies: graceful-fs "^4.1.11" imurmurhash "^0.1.4" @@ -4601,6 +4528,7 @@ xml-name-validator@^3.0.0: y18n@^3.2.1: version "3.2.1" resolved "https://registry.yarnpkg.com/y18n/-/y18n-3.2.1.tgz#6d15fba884c08679c0d77e88e7759e811e07fa41" + integrity sha1-bRX7qITAhnnA136I53WegR4H+kE= "y18n@^3.2.1 || ^4.0.0": version "4.0.0" @@ -4610,8 +4538,9 @@ y18n@^3.2.1: yallist@^2.1.2: version "2.1.2" resolved "https://registry.yarnpkg.com/yallist/-/yallist-2.1.2.tgz#1c11f9218f076089a47dd512f93c6699a6a81d52" + integrity sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI= -yallist@^3.0.0, yallist@^3.0.2: +yallist@^3.0.0, yallist@^3.0.3: version "3.0.3" resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.0.3.tgz#b4b049e314be545e3ce802236d6cd22cd91c3de9" integrity sha512-S+Zk8DEWE6oKpV+vI3qWkaK+jSbIK86pCwe2IF/xwIpQ8jEuxpw9NyaGjmp9+BoJv5FV2piqCDcoCtStppiq2A== @@ -4627,18 +4556,21 @@ yargs-parser@^11.1.1: yargs-parser@^8.0.0, yargs-parser@^8.1.0: version "8.1.0" resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-8.1.0.tgz#f1376a33b6629a5d063782944da732631e966950" + integrity sha512-yP+6QqN8BmrgW2ggLtTbdrOyBNSI7zBa4IykmiV5R1wl1JWNxQvWhMfMdmzIYtKU7oP3OOInY/tl2ov3BDjnJQ== dependencies: camelcase "^4.1.0" yargs-parser@^9.0.2: version "9.0.2" resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-9.0.2.tgz#9ccf6a43460fe4ed40a9bb68f48d43b8a68cc077" + integrity sha1-nM9qQ0YP5O1Aqbto9I1DuKaMwHc= dependencies: camelcase "^4.1.0" yargs@11.1.0: version "11.1.0" resolved "https://registry.yarnpkg.com/yargs/-/yargs-11.1.0.tgz#90b869934ed6e871115ea2ff58b03f4724ed2d77" + integrity sha512-NwW69J42EsCSanF8kyn5upxvjp5ds+t3+udGBeTbFnERA+lF541DDpMawzo4z6W/QrzNM18D+BPMiOBibnFV5A== dependencies: cliui "^4.0.0" decamelize "^1.1.1" @@ -4688,12 +4620,3 @@ yargs@^12.0.2: which-module "^2.0.0" y18n "^3.2.1 || ^4.0.0" yargs-parser "^11.1.1" - -yargs@~3.10.0: - version "3.10.0" - resolved "https://registry.yarnpkg.com/yargs/-/yargs-3.10.0.tgz#f7ee7bd857dd7c1d2d38c0e74efbd681d1431fd1" - dependencies: - camelcase "^1.0.2" - cliui "^2.1.0" - decamelize "^1.0.0" - window-size "0.1.0" From 81be9df962e4572d1f5b43062753cf6896867fc6 Mon Sep 17 00:00:00 2001 From: baranga Date: Tue, 25 Jun 2019 13:11:28 +0200 Subject: [PATCH 43/61] Port integration tests to mongodb 3.x client --- src/index.test.integration.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/index.test.integration.js b/src/index.test.integration.js index 89260f4..9a64a88 100644 --- a/src/index.test.integration.js +++ b/src/index.test.integration.js @@ -9,7 +9,8 @@ const sleep = milliseconds => new Promise(resolve => setTimeout(resolve, milliseconds)); const resetDb = async () => { - const db = await MongoClient.connect(MONGO_URI); + const client = await MongoClient.connect(MONGO_URI); + const db = client.db(); const collections = await db.collections(); await Promise.all( collections @@ -18,7 +19,7 @@ const resetDb = async () => { ) .map(collection => collection.drop()) ); - await db.close(); + await client.close(); }; const waitForEvent = ({subject, event, timeout = 250}) => From aab34812f0dab6d9fedc3beab965a9e4ad825b04 Mon Sep 17 00:00:00 2001 From: baranga Date: Tue, 25 Jun 2019 13:19:31 +0200 Subject: [PATCH 44/61] Prevent long running failed integration tests on ci --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 7d9bfc2..6d52bdd 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ "test:style": "prettier -c src/**/*.js", "test:unit": "jest", "test:coverage": "jest --coverage", - "test:integration": "jest --config ./jest.config.integration.js", + "test:integration": "jest --config ./jest.config.integration.js --forceExit", "coveralls": "coveralls < ./coverage/lcov.info", "validate-release-notes": "release-notes validate" }, From d6372baf40c35f0014cc4e91ae9dce90ea5039cc Mon Sep 17 00:00:00 2001 From: baranga Date: Tue, 25 Jun 2019 13:54:51 +0200 Subject: [PATCH 45/61] Consider index options of field level indexes as well --- src/index.test.integration.js | 92 ++++++++++++++++++---------------- src/schema/compound-indexes.js | 26 ++++++++-- 2 files changed, 70 insertions(+), 48 deletions(-) diff --git a/src/index.test.integration.js b/src/index.test.integration.js index 9a64a88..a147a2d 100644 --- a/src/index.test.integration.js +++ b/src/index.test.integration.js @@ -774,53 +774,59 @@ describe('plugin', () => { return expect(promise).rejects.toThrow(); }); }); - }); - describe('with all known mongodb index options set', () => { - let schema; - let indexes; - let idIndex; - let idIndexOptions; - - beforeEach(async () => { - schema = new Schema({ - id: { - type: Number, - index: { - background: false, - expireAfterSeconds: 600, - dropDups: true, - min: 5, - max: 23, - name: 'id_with_options', - partialFilterExpression: {id: {$gt: 0}}, - sparse: true, - v: 1, + describe('with all known mongodb index options set', () => { + let schema; + let indexes; + let idIndex; + let idIndexOptions; + + beforeEach(async () => { + schema = new Schema({ + id: { + type: Number, + index: { + background: false, + expireAfterSeconds: 600, + dropDups: true, + min: 5, + max: 23, + name: 'id_with_options', + partialFilterExpression: {id: {$gt: 0}}, + sparse: true, + unique: true, + v: 1, + }, }, - }, + }); + schema.plugin(plugin); + indexes = schema.indexes(); + idIndex = indexes.reduce( + (matchedIndex, currentIndex) => + matchedIndex || + (currentIndex[0].id === 1 ? currentIndex : null), + null + ); + idIndexOptions = idIndex[1]; + + if (!idIndex || !idIndexOptions) { + throw new Error('Unexpected setup result'); + } }); - schema.plugin(plugin); - indexes = schema.indexes(); - idIndex = indexes.reduce( - (matchedIndex, currentIndex) => - matchedIndex || (currentIndex[0].id === 1 ? currentIndex : null), - null - ); - idIndexOptions = idIndex[1]; - }); - it.each([ - ['background', false], - ['expireAfterSeconds', 600], - ['dropDups', true], - ['min', 5], - ['max', 23], - ['name', 'id_with_options'], - ['partialFilterExpression', {id: {$gt: 0}}], - ['sparse', true], - ['v', 1], - ])('preserves the %s option', (key, value) => { - expect(idIndexOptions).toHaveProperty(key, value); + it.each([ + ['background', false], + ['expireAfterSeconds', 600], + ['dropDups', true], + ['min', 5], + ['max', 23], + ['name', 'id_with_options'], + ['partialFilterExpression', {id: {$gt: 0}}], + ['sparse', true], + ['v', 1], + ])('preserves the %s option', (key, value) => { + expect(idIndexOptions).toHaveProperty(key, value); + }); }); }); }); diff --git a/src/schema/compound-indexes.js b/src/schema/compound-indexes.js index a3e9265..7d50eac 100644 --- a/src/schema/compound-indexes.js +++ b/src/schema/compound-indexes.js @@ -21,6 +21,21 @@ const compoundSchemaLevelUniqueIndexes = ({schema, tenantIdKey}) => { }); }; +const shouldPreserveUniqueIndex = options => { + if ( + options && + options.index && + options.index.preserveUniqueKey !== undefined + ) { + return options.index.preserveUniqueKey === true; + } + if (options && options.preserveUniqueKey !== undefined) { + return options.preserveUniqueKey === true; + } + + return false; +}; + const removeFieldLevelIndex = path => { path._index = null; delete path.options.unique; @@ -34,14 +49,15 @@ const removeFieldLevelIndex = path => { const compoundFieldLevelUniqueIndexes = ({schema, tenantIdKey}) => { schema.eachPath((key, path) => { const pathOptions = path.options; + const indexOptions = path._index; // skip if preserveUniqueKey of an unique field is set to true const isUniqueIndex = - pathOptions.unique || (pathOptions.index && pathOptions.index.unique); - if (isUniqueIndex && pathOptions.preserveUniqueKey !== true) { + (indexOptions && indexOptions.unique) || pathOptions.unique; + if (isUniqueIndex && !shouldPreserveUniqueIndex(pathOptions)) { // prepare new options - const options = { - ...(path._index || {}), + const schemaIndexOptions = { + ...(indexOptions || {}), unique: true, }; @@ -51,7 +67,7 @@ const compoundFieldLevelUniqueIndexes = ({schema, tenantIdKey}) => { [tenantIdKey]: 1, [key]: 1, }, - options + schemaIndexOptions ); removeFieldLevelIndex(path); From 815ea668f28f72f6e008b4096a2a40b61f6b5578 Mon Sep 17 00:00:00 2001 From: baranga Date: Tue, 25 Jun 2019 14:00:33 +0200 Subject: [PATCH 46/61] Fix potenttial mongodb / mongodb driver issue --- src/schema/compound-indexes.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/schema/compound-indexes.js b/src/schema/compound-indexes.js index 7d50eac..f538aad 100644 --- a/src/schema/compound-indexes.js +++ b/src/schema/compound-indexes.js @@ -18,6 +18,8 @@ const compoundSchemaLevelUniqueIndexes = ({schema, tenantIdKey}) => { index[0] = tenantAwareIndex; } + // remove preserveUniqueKey field to avoid confusing mongodb driver + delete index[1].preserveUniqueKey; }); }; From f0f4ee2b6628e3e8dea882be003018689ed8225c Mon Sep 17 00:00:00 2001 From: baranga Date: Tue, 25 Jun 2019 14:06:14 +0200 Subject: [PATCH 47/61] Fix broken tests --- src/index.test.integration.js | 2 +- src/schema/compound-indexes.js | 2 +- src/schema/compound-indexes.test.js | 10 ++-------- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/index.test.integration.js b/src/index.test.integration.js index a147a2d..0a10250 100644 --- a/src/index.test.integration.js +++ b/src/index.test.integration.js @@ -634,7 +634,7 @@ describe('plugin', () => { const indexes = schema.indexes(); expect(indexes).toContainEqual([ {id: 1}, - {unique: true, preserveUniqueKey: true, background: true}, + {unique: true, background: true}, ]); }); diff --git a/src/schema/compound-indexes.js b/src/schema/compound-indexes.js index f538aad..d884791 100644 --- a/src/schema/compound-indexes.js +++ b/src/schema/compound-indexes.js @@ -18,7 +18,7 @@ const compoundSchemaLevelUniqueIndexes = ({schema, tenantIdKey}) => { index[0] = tenantAwareIndex; } - // remove preserveUniqueKey field to avoid confusing mongodb driver + // remove preserveUniqueKey field to avoid confusing mongodb 3.x delete index[1].preserveUniqueKey; }); }; diff --git a/src/schema/compound-indexes.test.js b/src/schema/compound-indexes.test.js index 83ad758..38b9b54 100644 --- a/src/schema/compound-indexes.test.js +++ b/src/schema/compound-indexes.test.js @@ -19,10 +19,7 @@ describe('compound-indexes', () => { schema.index({id: 1}, {unique: true, preserveUniqueKey: false}); compoundIndexes({schema, tenantIdKey}); expect(schema.indexes()).toEqual([ - [ - {id: 1, [tenantIdKey]: 1}, - {unique: true, preserveUniqueKey: false, background: true}, - ], + [{id: 1, [tenantIdKey]: 1}, {unique: true, background: true}], ]); }); }); @@ -32,10 +29,7 @@ describe('compound-indexes', () => { schema.index({id: 1}, {unique: true, preserveUniqueKey: true}); compoundIndexes({schema, tenantIdKey}); expect(schema.indexes()).toEqual([ - [ - {id: 1}, - {unique: true, preserveUniqueKey: true, background: true}, - ], + [{id: 1}, {unique: true, background: true}], ]); }); }); From 76bb24209c858464e00894b872c71915a7e4cfeb Mon Sep 17 00:00:00 2001 From: baranga Date: Wed, 26 Jun 2019 09:37:14 +0200 Subject: [PATCH 48/61] Add integration test for subschemas and discriminators --- src/api/index.js | 5 +- src/api/tenant-aware-model/index.js | 5 +- src/index.test.integration.js | 167 +++++++++++++++++++++++++++- 3 files changed, 170 insertions(+), 7 deletions(-) diff --git a/src/api/index.js b/src/api/index.js index 92b5a8a..fbd60c7 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -6,7 +6,7 @@ const createTenantAwareModel = require('./tenant-aware-model'); * @param {MongoTenantOptions} options */ module.exports = ({schema, options}) => { - const {accessorMethod, tenantIdGetter, tenantIdKey} = options; + const {accessorMethod} = options; const cache = buildModelCache(); Object.assign(schema.statics, { @@ -16,8 +16,7 @@ module.exports = ({schema, options}) => { const model = createTenantAwareModel({ base, tenantId, - tenantIdGetter, - tenantIdKey, + options, }); cache.set(this.modelName, tenantId, model); } diff --git a/src/api/tenant-aware-model/index.js b/src/api/tenant-aware-model/index.js index 1652745..e7e0396 100644 --- a/src/api/tenant-aware-model/index.js +++ b/src/api/tenant-aware-model/index.js @@ -156,11 +156,12 @@ const createModel = ({ return model; }; -module.exports = ({base, tenantId, tenantIdGetter, tenantIdKey}) => { +module.exports = ({base, options, tenantId}) => { + const {tenantIdGetter, tenantIdKey} = options; const db = createTenantAwareDb({ db: base.db, tenantId, - options: {tenantIdGetter, tenantIdKey}, + options, }); const config = { diff --git a/src/index.test.integration.js b/src/index.test.integration.js index 0a10250..7142f70 100644 --- a/src/index.test.integration.js +++ b/src/index.test.integration.js @@ -37,11 +37,13 @@ const waitForEvent = ({subject, event, timeout = 250}) => describe('plugin', () => { describe('with real connection', () => { let mongoose; + let modelCounter; const buildModel = (schemaSpec = {}, options = {}) => { const schema = new Schema(schemaSpec); schema.plugin(plugin, options); - const model = mongoose.model('model', schema); + const model = mongoose.model(`model${modelCounter}`, schema); + modelCounter += 1; return {schema, model}; }; @@ -49,6 +51,8 @@ describe('plugin', () => { await resetDb(); mongoose = new Mongoose(); + modelCounter = 0; + if (mongooseVersion < '5.0.0') { await mongoose.connect(MONGO_URI, {useMongoClient: true}); } else { @@ -831,6 +835,165 @@ describe('plugin', () => { }); }); - it.skip('it properly binds populated sub models', () => {}); + describe('applied on schema with sub schema', () => { + describe('where sub schema is without tenant level', () => { + it('should pass down tenant context on Model.find().populate()', async () => { + const subModel = mongoose.model( + 'subModel', + new Schema({tenantId: String}) + ); + const {model} = buildModel({ + children: [{type: Schema.Types.ObjectId, ref: subModel.modelName}], + }); + + const subDocs = await subModel.create([ + {tenantId: 'a'}, + {tenantId: 'b'}, + ]); + await model.create({ + tenantId: 'a', + children: subDocs.map(doc => doc._id), + }); + const docs = await model + .byTenant('a') + .find() + .populate({path: 'children', options: {sort: {tenantId: 1}}}); + const objects = docs.map(doc => doc.toObject()); + + expect(objects).toHaveLength(1); + expect(objects[0]).toMatchObject({ + tenantId: 'a', + children: [ + { + tenantId: 'a', + }, + { + tenantId: 'b', + }, + ], + }); + expect(docs[0].children[0].hasTenantContext).toBeUndefined(); + expect(docs[0].children[1].hasTenantContext).toBeUndefined(); + }); + }); + + describe('where sub schema has same tenant level', () => { + it('should pass down tenant context on Model.find().populate()', async () => { + const {model: subModel} = buildModel({}); + const {model} = buildModel({ + children: [{type: Schema.Types.ObjectId, ref: subModel.modelName}], + }); + + const subDocs = await subModel.create([ + {tenantId: 'a'}, + {tenantId: 'b'}, + ]); + await model.create({ + tenantId: 'a', + children: subDocs.map(doc => doc._id), + }); + const docs = await model + .byTenant('a') + .find() + .populate({path: 'children', options: {sort: {tenantId: 1}}}); + const objects = docs.map(doc => doc.toObject()); + + expect(objects).toHaveLength(1); + expect(objects[0].children).toHaveLength(1); + expect(objects[0]).toMatchObject({ + tenantId: 'a', + children: [ + { + tenantId: 'a', + }, + ], + }); + expect(docs[0].children[0].hasTenantContext).toBeTruthy(); + }); + }); + + describe('where sub schema has different tenant level', () => { + it('should not pass down tenant context on Model.find().populate()', async () => { + const {model: subModel} = buildModel( + {}, + { + tenantIdKey: 'dimension', + tenantIdGetter: 'getDimension', + accessorMethod: 'byDimension', + } + ); + const {model} = buildModel({ + children: [{type: Schema.Types.ObjectId, ref: subModel.modelName}], + }); + + const subDocs = await subModel.create([ + {dimension: 'a'}, + {dimension: 'b'}, + ]); + await model.create({ + tenantId: 'a', + children: subDocs.map(doc => doc._id), + }); + const docs = await model + .byTenant('a') + .find() + .populate({path: 'children', options: {sort: {dimension: 1}}}); + const objects = docs.map(doc => doc.toObject()); + + expect(objects).toHaveLength(1); + expect(objects[0].children).toHaveLength(2); + expect(objects[0]).toMatchObject({ + tenantId: 'a', + children: [ + { + dimension: 'a', + }, + { + dimension: 'b', + }, + ], + }); + expect(docs[0].children[0].hasTenantContext).toBeUndefined(); + expect(docs[0].children[1].hasTenantContext).toBeUndefined(); + }); + }); + }); + + describe('applied on schema with discriminators', () => { + let schema; + let model; + + beforeEach(() => { + ({model, schema} = buildModel({kind: String})); + schema = new Schema({kind: String}, {discriminatorKey: 'kind'}); + schema.plugin(plugin); + model = mongoose.model(`discModel`, schema); + }); + + it('adds tenant to all discriminators of a model', async () => { + model.discriminator('test', new Schema({inherit: Boolean})); + const doc = await model + .byTenant('a') + .create({kind: 'test', inherit: true}); + + expect(doc.toObject()).toMatchObject({ + tenantId: 'a', + kind: 'test', + inherit: true, + }); + }); + + it('inherit properties from Model when using discriminator', async () => { + const {model: testModel} = buildModel({inherit: Boolean}); + model.discriminator('test', testModel.schema); + + const doc = await testModel.byTenant('a').create({inherit: true}); + expect(doc.toObject()).toMatchObject({ + tenantId: 'a', + kind: 'test', + inherit: true, + }); + }); + }); }); }); From 7217431455d2f41e3f1ecd80b932f5dd9e2b6437 Mon Sep 17 00:00:00 2001 From: baranga Date: Wed, 26 Jun 2019 10:09:04 +0200 Subject: [PATCH 49/61] Fix broken unit tests --- src/api/tenant-aware-model/index.test.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/api/tenant-aware-model/index.test.js b/src/api/tenant-aware-model/index.test.js index a30b68f..3ebbca8 100644 --- a/src/api/tenant-aware-model/index.test.js +++ b/src/api/tenant-aware-model/index.test.js @@ -1,4 +1,5 @@ const tenantAwareModel = require('./index'); +const buildOptions = require('../../options'); describe('tenant-aware-model', () => { describe('when called with valid parameters', () => { @@ -16,7 +17,11 @@ describe('tenant-aware-model', () => { let model; beforeEach(() => { base = buildBaseModel(); - model = tenantAwareModel({base, tenantId, tenantIdGetter, tenantIdKey}); + model = tenantAwareModel({ + base, + options: buildOptions({tenantIdGetter, tenantIdKey}), + tenantId, + }); }); it('builds a model', () => { @@ -28,7 +33,11 @@ describe('tenant-aware-model', () => { base.discriminators = { test: class {}, }; - model = tenantAwareModel({base, tenantId, tenantIdGetter, tenantIdKey}); + model = tenantAwareModel({ + base, + options: buildOptions({tenantIdGetter, tenantIdKey}), + tenantId, + }); expect(model).toHaveProperty('discriminators.test'); expect(model.discriminators.test).not.toBe(base.discriminators.test); }); From efd0886c9b4b5824f7532b4175a3fa97567d066e Mon Sep 17 00:00:00 2001 From: baranga Date: Wed, 26 Jun 2019 10:40:42 +0200 Subject: [PATCH 50/61] Implement missing handling of findOneAndReplace and replaceOne --- src/index.test.integration.js | 74 +++++++++++++++++-- src/middleware/index.js | 2 + .../query/protect-against-tenant-overwrite.js | 36 +++++---- 3 files changed, 93 insertions(+), 19 deletions(-) diff --git a/src/index.test.integration.js b/src/index.test.integration.js index 7142f70..f9d72a5 100644 --- a/src/index.test.integration.js +++ b/src/index.test.integration.js @@ -399,8 +399,24 @@ describe('plugin', () => { expect(objects).toMatchObject([{tenantId: 'a'}, {tenantId: 'b'}]); }); - if (mongooseVersion > '5.4.0') { - it.skip('binds Model.findOneAndReplace() to tenant context', () => {}); + if (mongooseVersion >= '5.4.0') { + it('binds Model.findOneAndReplace() to tenant context', async () => { + const {model} = buildModel({k: Number, v: Number}); + await model.create( + {tenantId: 'a', k: 1, v: 1}, + {tenantId: 'b', k: 1, v: 1} + ); + + await model + .byTenant('b') + .findOneAndReplace({k: 1}, {tenantId: 'b', k: 2, v: 2}); + const docs = await model.find().sort({tenantId: 1}); + + expect(docs).toMatchObject([ + {tenantId: 'a', k: 1, v: 1}, + {tenantId: 'b', k: 2, v: 2}, + ]); + }); } it('binds Model.findOneAndUpdate() to tenant context', async () => { @@ -447,7 +463,23 @@ describe('plugin', () => { }); if (mongooseVersion >= '4.9.0') { - it.skip('binds Model.replaceOne() to tenant context', async () => {}); + it('binds Model.replaceOne() to tenant context', async () => { + const {model} = buildModel({k: Number, v: Number}); + await model.create( + {tenantId: 'a', k: 1, v: 1}, + {tenantId: 'b', k: 1, v: 1} + ); + + await model + .byTenant('b') + .replaceOne({k: 1}, {tenantId: 'b', k: 2, v: 2}); + const docs = await model.find().sort({tenantId: 1}); + + expect(docs).toMatchObject([ + {tenantId: 'a', k: 1, v: 1}, + {tenantId: 'b', k: 2, v: 2}, + ]); + }); } it('binds Model.update() to tenant context', async () => { @@ -513,8 +545,40 @@ describe('plugin', () => { expect(objects).toMatchObject([{tenantId: 'a'}]); }); - if (mongooseVersion > '5.4.0') { - it.skip('binds protects against override of tenant id in Model.findOneAndReplace()', () => {}); + if (mongooseVersion >= '5.4.0') { + it('protects against override of tenant id in Model.findOneAndReplace()', async () => { + const {model} = buildModel({k: Number, v: Number}); + await model.create( + {tenantId: 'a', k: 1, v: 1}, + {tenantId: 'b', k: 1, v: 1} + ); + + await model.byTenant('b').findOneAndReplace({k: 1}, {k: 2, v: 2}); + const docs = await model.find().sort({tenantId: 1}); + + expect(docs).toMatchObject([ + {tenantId: 'a', k: 1, v: 1}, + {tenantId: 'b', k: 2, v: 2}, + ]); + }); + } + + if (mongooseVersion >= '4.9.0') { + it('protects against override of tenant id in Model.replaceOne()', async () => { + const {model} = buildModel({k: Number, v: Number}); + await model.create( + {tenantId: 'a', k: 1, v: 1}, + {tenantId: 'b', k: 1, v: 1} + ); + + await model.byTenant('b').replaceOne({k: 1}, {k: 2, v: 2}); + const docs = await model.find().sort({tenantId: 1}); + + expect(docs).toMatchObject([ + {tenantId: 'a', k: 1, v: 1}, + {tenantId: 'b', k: 2, v: 2}, + ]); + }); } it('protects against override of tenant id in Model.update()', async () => { diff --git a/src/middleware/index.js b/src/middleware/index.js index a5b8a24..d12febb 100644 --- a/src/middleware/index.js +++ b/src/middleware/index.js @@ -22,6 +22,7 @@ const middleware = ({schema, options}) => { 'findOneAndReplace', 'findOneAndUpdate', 'remove', + 'replaceOne', 'update', 'updateOne', 'updateMany', @@ -34,6 +35,7 @@ const middleware = ({schema, options}) => { [ 'findOneAndReplace', 'findOneAndUpdate', + 'replaceOne', 'update', 'updateOne', 'updateMany', diff --git a/src/middleware/query/protect-against-tenant-overwrite.js b/src/middleware/query/protect-against-tenant-overwrite.js index 143fa36..30747f4 100644 --- a/src/middleware/query/protect-against-tenant-overwrite.js +++ b/src/middleware/query/protect-against-tenant-overwrite.js @@ -1,18 +1,26 @@ -module.exports = ({tenantIdKey, tenantIdGetter}) => function (next) { - if (this.model.hasTenantContext) { - const tenantId = this.model[tenantIdGetter](); +const replacementOperations = ['findOneAndReplace', 'replaceOne']; +const isReplacementOperation = value => replacementOperations.includes(value); - // avoid jumping tenant context when overwriting a model. - if ((tenantIdKey in this._update) || this.options.overwrite) { - this._update[tenantIdKey] = tenantId; - } +module.exports = ({tenantIdKey, tenantIdGetter}) => + function(next) { + if (this.model.hasTenantContext) { + const tenantId = this.model[tenantIdGetter](); + + // avoid jumping tenant context when overwriting a model. + if ( + tenantIdKey in this._update || + this.options.overwrite || + isReplacementOperation(this.op) + ) { + this._update[tenantIdKey] = tenantId; + } - // avoid jumping tenant context from $set operations - const $set = this._update.$set; - if ($set && (tenantIdKey in $set) && $set[tenantIdKey] !== tenantId) { - $set[tenantIdKey] = tenantId; + // avoid jumping tenant context from $set operations + const $set = this._update.$set; + if ($set && tenantIdKey in $set && $set[tenantIdKey] !== tenantId) { + $set[tenantIdKey] = tenantId; + } } - } - next(); -}; + next(); + }; From df2c51de2a23c858494089301ebbcdb76c3b5d99 Mon Sep 17 00:00:00 2001 From: baranga Date: Wed, 26 Jun 2019 10:54:53 +0200 Subject: [PATCH 51/61] Add integration test for insertMany --- src/api/tenant-aware-model/index.js | 20 +++++++++++++------- src/index.test.integration.js | 11 +++++++++++ 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/src/api/tenant-aware-model/index.js b/src/api/tenant-aware-model/index.js index e7e0396..4f1b190 100644 --- a/src/api/tenant-aware-model/index.js +++ b/src/api/tenant-aware-model/index.js @@ -60,7 +60,12 @@ const createPlainModel = ({base, db, tenantId, tenantIdGetter, tenantIdKey}) => return super.remove(conditions, callback); } - static insertMany(docs, callback) { + static insertMany(docs, options, callback) { + if (typeof options === 'function') { + callback = options; + options = null; + } + const self = this; const tenantId = this[tenantIdGetter](); @@ -73,14 +78,15 @@ const createPlainModel = ({base, db, tenantId, tenantIdGetter, tenantIdKey}) => }); } + const promise = super.insertMany(docs, options); // ensure the returned docs are instanced of the bound multi tenant model - return super.insertMany(docs, (err, docs) => { - if (err) { - return callback && callback(err); - } + promise.then(docs => docs.map(doc => new self(doc))); - return callback && callback(null, docs.map(doc => new self(doc))); - }); + if (!callback) { + return promise; + } + + promise.then(docs => callback(null, docs), err => callback(err)); } static bulkWrite(ops, options, callback) { diff --git a/src/index.test.integration.js b/src/index.test.integration.js index f9d72a5..3a22e09 100644 --- a/src/index.test.integration.js +++ b/src/index.test.integration.js @@ -444,6 +444,17 @@ describe('plugin', () => { }); }); + it('binds Model.insertMany() to tenant context', async () => { + const {model} = buildModel({t: Number}); + await model.byTenant('a').insertMany([{t: 1}, {t: 2}]); + + const docs = await model.find().sort({t: 1}); + expect(docs).toMatchObject([ + {tenantId: 'a', t: 1}, + {tenantId: 'a', t: 2}, + ]); + }); + it('binds Model.remove() to tenant context', async () => { const {model} = buildModel({t: Number}); await model.create( From 8721d04883be7ed21c7260cd2bfb85c39b63a4b2 Mon Sep 17 00:00:00 2001 From: baranga Date: Wed, 26 Jun 2019 10:58:16 +0200 Subject: [PATCH 52/61] Improve insertMany integration test --- src/index.test.integration.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/index.test.integration.js b/src/index.test.integration.js index 3a22e09..ae1695c 100644 --- a/src/index.test.integration.js +++ b/src/index.test.integration.js @@ -446,10 +446,19 @@ describe('plugin', () => { it('binds Model.insertMany() to tenant context', async () => { const {model} = buildModel({t: Number}); - await model.byTenant('a').insertMany([{t: 1}, {t: 2}]); + const insertedDocs = await model + .byTenant('a') + .insertMany([{t: 1}, {t: 2}]); + const allDocs = await model.find().sort({t: 1}); - const docs = await model.find().sort({t: 1}); - expect(docs).toMatchObject([ + expect(insertedDocs).toHaveLength(2); + expect(insertedDocs[0].hasTenantContext).toBeTruthy(); + expect(insertedDocs[1].hasTenantContext).toBeTruthy(); + expect(insertedDocs.map(doc => doc.toObject())).toMatchObject([ + {tenantId: 'a', t: 1}, + {tenantId: 'a', t: 2}, + ]); + expect(allDocs).toMatchObject([ {tenantId: 'a', t: 1}, {tenantId: 'a', t: 2}, ]); From 6e16c99d5ed8432219d10fe3af058cde912a2538 Mon Sep 17 00:00:00 2001 From: baranga Date: Thu, 27 Jun 2019 09:53:43 +0200 Subject: [PATCH 53/61] Fix insertMany --- src/api/tenant-aware-model/index.js | 12 +++++++++--- src/api/tenant-aware-model/index.test.js | 20 ++++++++------------ 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/src/api/tenant-aware-model/index.js b/src/api/tenant-aware-model/index.js index 4f1b190..476357a 100644 --- a/src/api/tenant-aware-model/index.js +++ b/src/api/tenant-aware-model/index.js @@ -78,15 +78,21 @@ const createPlainModel = ({base, db, tenantId, tenantIdGetter, tenantIdKey}) => }); } - const promise = super.insertMany(docs, options); + const promise = options + ? super.insertMany(docs, options) + : super.insertMany(docs); // ensure the returned docs are instanced of the bound multi tenant model - promise.then(docs => docs.map(doc => new self(doc))); + promise.then(result => + Array.isArray(result) + ? result.map(doc => new self(doc)) + : new self(result) + ); if (!callback) { return promise; } - promise.then(docs => callback(null, docs), err => callback(err)); + promise.then(result => callback(null, result), err => callback(err)); } static bulkWrite(ops, options, callback) { diff --git a/src/api/tenant-aware-model/index.test.js b/src/api/tenant-aware-model/index.test.js index 3ebbca8..434f4f3 100644 --- a/src/api/tenant-aware-model/index.test.js +++ b/src/api/tenant-aware-model/index.test.js @@ -175,9 +175,9 @@ describe('tenant-aware-model', () => { }); describe('overrides static insertMany which', () => { - it('applies tenant context on single document', () => { - base.insertMany = jest.fn(); - model.insertMany({}, undefined); + it('applies tenant context on single document', async () => { + base.insertMany = jest.fn(() => Promise.resolve({})); + await model.insertMany({}, undefined); expect(base.insertMany).toHaveBeenCalledTimes(1); expect(base.insertMany.mock.calls[0][0]).toEqual({ @@ -185,9 +185,9 @@ describe('tenant-aware-model', () => { }); }); - it('applies tenant context on multiple documents', () => { - base.insertMany = jest.fn(); - model.insertMany([{}], undefined); + it('applies tenant context on multiple documents', async () => { + base.insertMany = jest.fn(() => Promise.resolve([{}])); + await model.insertMany([{}], undefined); expect(base.insertMany).toHaveBeenCalledTimes(1); expect(base.insertMany.mock.calls[0][0]).toEqual([ @@ -196,9 +196,7 @@ describe('tenant-aware-model', () => { }); it('builds tenant aware models for callback', done => { - base.insertMany = (docs, callback) => { - callback(null, docs); - }; + base.insertMany = docs => Promise.resolve(docs); const newDoc = new model(); model.insertMany([newDoc], (err, docs) => { expect(err).toBe(null); @@ -215,9 +213,7 @@ describe('tenant-aware-model', () => { it('forwards errors', done => { const expectedError = new Error('test'); - base.insertMany = (docs, callback) => { - callback(expectedError); - }; + base.insertMany = () => Promise.reject(expectedError); model.insertMany([], (err, docs) => { expect(err).toBe(expectedError); expect(docs).toBe(undefined); From b9f05167703f715cefcb74a2c1fc526277de67ba Mon Sep 17 00:00:00 2001 From: baranga Date: Fri, 28 Jun 2019 09:04:05 +0200 Subject: [PATCH 54/61] Fix casting of result of insertMany --- src/api/tenant-aware-model/index.js | 11 +++++++---- src/api/tenant-aware-model/index.test.js | 13 ++++++++++++- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/src/api/tenant-aware-model/index.js b/src/api/tenant-aware-model/index.js index 476357a..2d594f3 100644 --- a/src/api/tenant-aware-model/index.js +++ b/src/api/tenant-aware-model/index.js @@ -78,21 +78,24 @@ const createPlainModel = ({base, db, tenantId, tenantIdGetter, tenantIdKey}) => }); } - const promise = options + const promisedResult = options ? super.insertMany(docs, options) : super.insertMany(docs); // ensure the returned docs are instanced of the bound multi tenant model - promise.then(result => + const promisedMapped = promisedResult.then(result => Array.isArray(result) ? result.map(doc => new self(doc)) : new self(result) ); if (!callback) { - return promise; + return promisedMapped; } - promise.then(result => callback(null, result), err => callback(err)); + promisedMapped.then( + result => callback(null, result), + err => callback(err) + ); } static bulkWrite(ops, options, callback) { diff --git a/src/api/tenant-aware-model/index.test.js b/src/api/tenant-aware-model/index.test.js index 434f4f3..f65f06c 100644 --- a/src/api/tenant-aware-model/index.test.js +++ b/src/api/tenant-aware-model/index.test.js @@ -195,9 +195,20 @@ describe('tenant-aware-model', () => { ]); }); + it('builds tenant aware models for promise', async () => { + base.insertMany = docs => Promise.resolve(docs); + const newDocs = [{}]; + const insertedDocs = await model.insertMany(newDocs); + + expect(insertedDocs).toHaveLength(1); + expect(insertedDocs[0]).toBeInstanceOf(model); + expect(insertedDocs[0].hasTenantContext).toBe(true); + expect(insertedDocs[0][tenantIdGetter]()).toBe(tenantId); + }); + it('builds tenant aware models for callback', done => { base.insertMany = docs => Promise.resolve(docs); - const newDoc = new model(); + const newDoc = {}; model.insertMany([newDoc], (err, docs) => { expect(err).toBe(null); expect(docs).toHaveLength(1); From 23db6b28a479975c90404ce003c683835ea7624b Mon Sep 17 00:00:00 2001 From: baranga Date: Fri, 28 Jun 2019 10:09:48 +0200 Subject: [PATCH 55/61] Improve robustness of integration testing index handling --- src/index.test.integration.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/index.test.integration.js b/src/index.test.integration.js index ae1695c..6c0d70b 100644 --- a/src/index.test.integration.js +++ b/src/index.test.integration.js @@ -678,6 +678,7 @@ describe('plugin', () => { model = mongoose.model('model', schema); await waitForEvent({subject: model, event: 'index'}); + await sleep(10); }); it('modifies index properly', async () => { From 29f99bc27a0a9f343d625a9e2e7ee1f52743d069 Mon Sep 17 00:00:00 2001 From: baranga Date: Sat, 29 Jun 2019 12:19:38 +0200 Subject: [PATCH 56/61] Modify signature of sub components to be plugin compatible --- src/api/index.js | 15 +++++++++------ src/api/index.test.js | 2 +- src/index.js | 15 ++++++++------- src/middleware/index.js | 12 +++++++----- src/middleware/index.test.js | 3 +-- src/schema/index.js | 12 +++++++----- src/schema/index.test.js | 3 +-- 7 files changed, 34 insertions(+), 28 deletions(-) diff --git a/src/api/index.js b/src/api/index.js index fbd60c7..5a7f54a 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -1,12 +1,15 @@ const buildModelCache = require('./tenant-aware-model-cache'); const createTenantAwareModel = require('./tenant-aware-model'); +const sanitizeOptions = require('../options'); /** - * @param schema - * @param {MongoTenantOptions} options + * Tenant api plugin + * @param {Mongoose.Schema} schema Schema to extend + * @param {MongoTenantOptions} [options] Options (optional) */ -module.exports = ({schema, options}) => { - const {accessorMethod} = options; +module.exports = (schema, options) => { + const sanitizedOptions = sanitizeOptions(options || {}); + const {accessorMethod} = sanitizedOptions; const cache = buildModelCache(); Object.assign(schema.statics, { @@ -16,14 +19,14 @@ module.exports = ({schema, options}) => { const model = createTenantAwareModel({ base, tenantId, - options, + options: sanitizedOptions, }); cache.set(this.modelName, tenantId, model); } return cache.get(this.modelName, tenantId); }, get mongoTenant() { - return {...options}; + return {...sanitizedOptions}; }, }); diff --git a/src/api/index.test.js b/src/api/index.test.js index 4a4f86e..5ac4734 100644 --- a/src/api/index.test.js +++ b/src/api/index.test.js @@ -9,7 +9,7 @@ describe('api', () => { const options = buildOptions({accessorMethod: 'byTenant'}); beforeEach(() => { schema = new Schema({}); - api({schema, options}); + api(schema, options); }); describe('adds static accessor method which', () => { diff --git a/src/index.js b/src/index.js index 199b9d4..aeea3f3 100644 --- a/src/index.js +++ b/src/index.js @@ -1,13 +1,14 @@ -const sanitizeOptions = require('./options'); - const extendSchema = require('./schema'); const injectApi = require('./api'); const installMiddleware = require('./middleware'); +/** + * Tenant plugin + * @param {Mongoose.Schema} schema + * @param {MongoTenantOptions} options + */ module.exports = function nodeMongoTenant(schema, options = {}) { - const sanitizedOptions = sanitizeOptions(options); - - extendSchema({schema, options: sanitizedOptions}); - injectApi({schema, options: sanitizedOptions}); - installMiddleware({schema, options: sanitizedOptions}); + extendSchema(schema, options); + injectApi(schema, options); + installMiddleware(schema, options); }; diff --git a/src/middleware/index.js b/src/middleware/index.js index d12febb..872d48f 100644 --- a/src/middleware/index.js +++ b/src/middleware/index.js @@ -1,14 +1,16 @@ const buildAddTenantId = require('./document/add-tenant-id'); const buildProtectAgainstTenantOverwrite = require('./query/protect-against-tenant-overwrite'); const buildRestrictToTenant = require('./query/restrict-to-tenant'); +const sanitizeOptions = require('../options'); /** - * - * @param {object} schema - * @param {MongoTenantOptions} options + * Tenant middleware plugin + * @param {Mongoose.Schema} schema Schema to extend + * @param {MongoTenantOptions} [options] Options (optional) */ -const middleware = ({schema, options}) => { - const {tenantIdKey, tenantIdGetter} = options; +const middleware = (schema, options) => { + const sanitizedOptions = sanitizeOptions(options || {}); + const {tenantIdKey, tenantIdGetter} = sanitizedOptions; const restrictToTenant = buildRestrictToTenant({tenantIdKey, tenantIdGetter}); [ diff --git a/src/middleware/index.test.js b/src/middleware/index.test.js index b399480..31fc2bc 100644 --- a/src/middleware/index.test.js +++ b/src/middleware/index.test.js @@ -1,10 +1,9 @@ const installMiddleware = require('./index'); -const buildOptions = require('../options'); const {Schema} = require('mongoose'); describe('middleware', () => { it('does not fail', () => { const schema = new Schema({}); - installMiddleware({schema, options: buildOptions()}); + installMiddleware(schema); }); }); diff --git a/src/schema/index.js b/src/schema/index.js index 89d4dea..9e601fa 100644 --- a/src/schema/index.js +++ b/src/schema/index.js @@ -1,13 +1,15 @@ const addTenantIdField = require('./add-tenant-id-field'); const compoundIndexes = require('./compound-indexes'); +const sanitizeOptions = require('../options'); /** - * - * @param {object} schema - * @param {MongoTenantOptions} options + * Tenant middleware plugin + * @param {Mongoose.Schema} schema Schema to extend + * @param {MongoTenantOptions} [options] Options (optional) */ -const schema = ({schema, options}) => { - const {tenantIdKey, tenantIdType, requireTenantId} = options; +const schema = (schema, options) => { + const sanitizedOptions = sanitizeOptions(options || {}); + const {tenantIdKey, tenantIdType, requireTenantId} = sanitizedOptions; addTenantIdField({ schema, key: tenantIdKey, diff --git a/src/schema/index.test.js b/src/schema/index.test.js index ec25a5c..62ef7c1 100644 --- a/src/schema/index.test.js +++ b/src/schema/index.test.js @@ -1,10 +1,9 @@ const extendSchema = require('./index'); -const buildOptions = require('../options'); const {Schema} = require('mongoose'); describe('schema', () => { it('does not fail', () => { const schema = new Schema({}); - extendSchema({schema, options: buildOptions()}); + extendSchema(schema); }); }); From 8d7fadd3442bb918f03bf3aab95a70f3db2dfba0 Mon Sep 17 00:00:00 2001 From: baranga Date: Mon, 1 Jul 2019 13:11:09 +0200 Subject: [PATCH 57/61] Make tenantId required by default and fix issue with save revealed by that change --- release-notes.yml | 11 ++++++++--- src/middleware/index.js | 6 +++++- src/options.js | 3 ++- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/release-notes.yml b/release-notes.yml index 3897a97..4a006a6 100644 --- a/release-notes.yml +++ b/release-notes.yml @@ -10,10 +10,15 @@ releases: - version: Unreleased added: - 'Full support of path level index options (`new Schema({t: {type: String, index: {...}})`).' + changed: + - > + **BREAKING** Default value of option to make tenant id required is now `true` instead of `false`. This changes the + default behaviour. removed: - - 'Schema types no longer support the shorthand `partialFilterExpression` option. That shorthand option was never - supported by mongoose in the first place. If that option is needed please use - `{..., index: { partialFilterExpression: ...}}` instead.' + - > + **BREAKING** Schema types no longer support the shorthand `partialFilterExpression` option. That shorthand option + was never supported by mongoose in the first place. If that option is needed please use + `{..., index: { partialFilterExpression: ...}}` instead. - version: 1.6.0 date: 2019-03-21 fixed: diff --git a/src/middleware/index.js b/src/middleware/index.js index 872d48f..9261996 100644 --- a/src/middleware/index.js +++ b/src/middleware/index.js @@ -43,7 +43,11 @@ const middleware = (schema, options) => { 'updateMany', ].forEach(operation => schema.pre(operation, protectedAgainstOverwrite)); - schema.pre('save', buildAddTenantId({tenantIdKey, tenantIdGetter})); + // First `save` pre hook fired will be the mongoose default validation plugin. + // So if we add `tenantId` on a subsequent `save` pre hook the validation will + // always fail (given `tenantId` is required but not set). So we have to + // ensure right `tenantId` on validate. + schema.pre('validate', buildAddTenantId({tenantIdKey, tenantIdGetter})); }; module.exports = middleware; diff --git a/src/options.js b/src/options.js index 6d75576..bd8cd28 100644 --- a/src/options.js +++ b/src/options.js @@ -22,7 +22,8 @@ const options = (input = {}) => ({ tenantIdType: input.tenantIdType || String, accessorMethod: input.accessorMethod || 'byTenant', tenantIdGetter: input.tenantIdGetter || 'getTenantId', - requireTenantId: input.requireTenantId === true, + requireTenantId: + input.requireTenantId === undefined ? true : input.requireTenantId && true, }); module.exports = options; From bcdd565694c1e9b439e6181cfb0cbc54e5922a1b Mon Sep 17 00:00:00 2001 From: baranga Date: Wed, 3 Jul 2019 11:01:50 +0200 Subject: [PATCH 58/61] Rework plugin to allow multi dimensional setups --- release-notes.yml | 9 + src/api/are-plugins-compatible.js | 11 +- src/api/are-plugins-compatible.test.js | 11 +- ...nant-aware-db.js => dimension-aware-db.js} | 14 +- ...-db.test.js => dimension-aware-db.test.js} | 36 ++-- .../index.js | 94 +++++----- .../index.test.js | 117 ++++++------ .../modify-bulk-write-operations.js | 60 +++--- .../modify-bulk-write-operations.test.js | 145 +++++++++++++++ .../parse-aggregate-arguments.js | 0 .../parse-aggregate-arguments.test.js | 0 src/api/index.js | 28 +-- src/api/index.test.js | 14 +- src/api/tenant-aware-model-cache.js | 13 -- src/api/tenant-aware-model-cache.test.js | 43 ----- .../modify-bulk-write-operations.test.js | 133 ------------- src/dimension-interface.js | 45 +++++ src/dimension-interface.test.js | 50 +++++ src/index.test.integration.js | 176 ++++++++++++++---- src/middleware/document/add-dimension-id.js | 12 ++ .../document/add-dimension-id.test.js | 52 ++++++ src/middleware/document/add-tenant-id.js | 9 - src/middleware/document/add-tenant-id.test.js | 50 ----- src/middleware/index.js | 36 ++-- .../protect-against-dimension-overwrite.js | 32 ++++ ...rotect-against-dimension-overwrite.test.js | 135 ++++++++++++++ .../query/protect-against-tenant-overwrite.js | 26 --- .../protect-against-tenant-overwrite.test.js | 99 ---------- src/middleware/query/restrict-to-dimension.js | 10 + .../query/restrict-to-dimension.test.js | 66 +++++++ src/middleware/query/restrict-to-tenant.js | 8 - .../query/restrict-to-tenant.test.js | 58 ------ src/options.js | 55 ++++-- src/options.test.js | 41 +++- ...-id-field.js => add-dimension-id-field.js} | 0 ...test.js => add-dimension-id-field.test.js} | 2 +- src/schema/compound-indexes.js | 32 ++-- src/schema/compound-indexes.test.js | 22 +-- src/schema/index.js | 20 +- src/symbol-dimensions.js | 1 + 40 files changed, 1042 insertions(+), 723 deletions(-) rename src/api/{tenant-aware-db.js => dimension-aware-db.js} (51%) rename src/api/{tenant-aware-db.test.js => dimension-aware-db.test.js} (50%) rename src/api/{tenant-aware-model => dimension-aware-model}/index.js (68%) rename src/api/{tenant-aware-model => dimension-aware-model}/index.test.js (63%) rename src/api/{tenant-aware-model => dimension-aware-model}/modify-bulk-write-operations.js (51%) create mode 100644 src/api/dimension-aware-model/modify-bulk-write-operations.test.js rename src/api/{tenant-aware-model => dimension-aware-model}/parse-aggregate-arguments.js (100%) rename src/api/{tenant-aware-model => dimension-aware-model}/parse-aggregate-arguments.test.js (100%) delete mode 100644 src/api/tenant-aware-model-cache.js delete mode 100644 src/api/tenant-aware-model-cache.test.js delete mode 100644 src/api/tenant-aware-model/modify-bulk-write-operations.test.js create mode 100644 src/dimension-interface.js create mode 100644 src/dimension-interface.test.js create mode 100644 src/middleware/document/add-dimension-id.js create mode 100644 src/middleware/document/add-dimension-id.test.js delete mode 100644 src/middleware/document/add-tenant-id.js delete mode 100644 src/middleware/document/add-tenant-id.test.js create mode 100644 src/middleware/query/protect-against-dimension-overwrite.js create mode 100644 src/middleware/query/protect-against-dimension-overwrite.test.js delete mode 100644 src/middleware/query/protect-against-tenant-overwrite.js delete mode 100644 src/middleware/query/protect-against-tenant-overwrite.test.js create mode 100644 src/middleware/query/restrict-to-dimension.js create mode 100644 src/middleware/query/restrict-to-dimension.test.js delete mode 100644 src/middleware/query/restrict-to-tenant.js delete mode 100644 src/middleware/query/restrict-to-tenant.test.js rename src/schema/{add-tenant-id-field.js => add-dimension-id-field.js} (100%) rename src/schema/{add-tenant-id-field.test.js => add-dimension-id-field.test.js} (87%) create mode 100644 src/symbol-dimensions.js diff --git a/release-notes.yml b/release-notes.yml index 4a006a6..1332142 100644 --- a/release-notes.yml +++ b/release-notes.yml @@ -9,12 +9,21 @@ description: > releases: - version: Unreleased added: + - > + Plugin can now be applied multiple times on single schema to achieve multi dimensional setups. + + To achieve this a new config option named `dimension` is available. This is the prime indicator for compatibility + between two different plugin instances. That option is optional with `tenant` as default so backward compatibility + is guaranteed. - 'Full support of path level index options (`new Schema({t: {type: String, index: {...}})`).' changed: - > **BREAKING** Default value of option to make tenant id required is now `true` instead of `false`. This changes the default behaviour. removed: + - > + **BREAKING** Schemas, Models and Documents no longer expose `hasTenantContext` to indicate if the plugin is + applied to them. - > **BREAKING** Schema types no longer support the shorthand `partialFilterExpression` option. That shorthand option was never supported by mongoose in the first place. If that option is needed please use diff --git a/src/api/are-plugins-compatible.js b/src/api/are-plugins-compatible.js index 6c5a614..bb437c8 100644 --- a/src/api/are-plugins-compatible.js +++ b/src/api/are-plugins-compatible.js @@ -4,13 +4,18 @@ * @returns {boolean} */ const isPluginOptions = options => - options && options.accessorMethod && options.tenantIdKey && true; + (options && + options.dimension && + options.accessorMethod && + options.dimensionIdKey && + true) || + false; /** * Checks if instance is compatible to other plugin instance * * For population of referenced models it's necessary to detect if the tenant * plugin installed in these models is compatible to the plugin of the host - * model. If they are compatible they are one the same "level". + * model. This is done by comparing the dimension key. * * @param {MongoTenantOptions} a * @param {MongoTenantOptions} b @@ -18,6 +23,6 @@ const isPluginOptions = options => */ module.exports = (a, b) => { return ( - isPluginOptions(a) && isPluginOptions(b) && a.tenantIdKey === b.tenantIdKey + isPluginOptions(a) && isPluginOptions(b) && a.dimension === b.dimension ); }; diff --git a/src/api/are-plugins-compatible.test.js b/src/api/are-plugins-compatible.test.js index 7b4acbc..6b6872c 100644 --- a/src/api/are-plugins-compatible.test.js +++ b/src/api/are-plugins-compatible.test.js @@ -3,22 +3,23 @@ const arePluginsCompatible = require('./are-plugins-compatible'); describe('are-plugins-compatible', () => { describe('when called with proper plugin options', () => { const options = { - accessorMethod: 'byTenant', - tenantIdKey: 'tenantId', + dimension: 'dim', + accessorMethod: 'byDim', + dimensionIdKey: 'dimId', }; - it("returns true if they have equal tenantIdKey's", () => { + it("returns true if they have equal dimension's", () => { const a = {...options}; const b = {...options}; const result = arePluginsCompatible(a, b); expect(result).toBe(true); }); - it("returns false if they have different tenantIdKey's", () => { + it("returns false if they have different dimension's", () => { const a = {...options}; const b = { ...options, - tenantIdKey: 'dimensionId', + dimension: 'universe', }; const result = arePluginsCompatible(a, b); expect(result).toBe(false); diff --git a/src/api/tenant-aware-db.js b/src/api/dimension-aware-db.js similarity index 51% rename from src/api/tenant-aware-db.js rename to src/api/dimension-aware-db.js index 712ee6b..32868ff 100644 --- a/src/api/tenant-aware-db.js +++ b/src/api/dimension-aware-db.js @@ -1,25 +1,27 @@ const arePluginsCompatible = require('./are-plugins-compatible'); +const dimensionInterface = require('../dimension-interface'); /** - * Create db connection bound to a specific tenant + * Create db connection bound to a specific dimension * * @param {Connection} db - * @param {*} tenantId + * @param {*} dimensionId * @param {MongoTenantOptions} options * @returns {Connection} */ -module.exports = ({db, tenantId, options}) => { +module.exports = ({db, dimensionId, options}) => { const awareDb = Object.create(db); awareDb.model = name => { const unawareModel = db.model(name); - /** @type MongoTenantOptions */ - const otherPluginOptions = unawareModel.mongoTenant; + const otherPluginOptions = dimensionInterface(unawareModel.schema).get( + options.dimension + ); if (!arePluginsCompatible(options, otherPluginOptions)) { return unawareModel; } - return unawareModel[otherPluginOptions.accessorMethod](tenantId); + return unawareModel[otherPluginOptions.accessorMethod](dimensionId); }; return awareDb; }; diff --git a/src/api/tenant-aware-db.test.js b/src/api/dimension-aware-db.test.js similarity index 50% rename from src/api/tenant-aware-db.test.js rename to src/api/dimension-aware-db.test.js index 26c4b04..29d1529 100644 --- a/src/api/tenant-aware-db.test.js +++ b/src/api/dimension-aware-db.test.js @@ -1,55 +1,49 @@ -const createTenantAwareDb = require('./tenant-aware-db'); const buildOptions = require('../options'); +const createDimensionAwareDb = require('./dimension-aware-db'); +const dimensionInterface = require('../dimension-interface'); -describe('tenant-aware-db', () => { +describe('dimension-aware-db', () => { describe('when called with proper parameters', () => { - const tenantId = '23'; - const options = buildOptions(); + const dimension = 'dim'; + const dimensionId = '23'; + const options = buildOptions({dimension}); it('overwrites the model method', () => { const db = { model: () => {}, }; - const result = createTenantAwareDb({db, tenantId, options}); + const result = createDimensionAwareDb({db, dimensionId, options}); expect(result).toHaveProperty('model'); expect(result.model).toBeInstanceOf(Function); expect(result.model).not.toBe(db.model); }); - it('returns a tenant aware model if compatible', () => { - const awareModel = { - hasTenantContext: true, - mongoTenant: {...options}, - }; + it('returns a dimension aware model if compatible', () => { + const awareModel = {}; const unawareModel = { + schema: {}, [options.accessorMethod]: () => awareModel, - mongoTenant: {...options}, }; + dimensionInterface(unawareModel.schema).add(dimension, options); const db = { model: () => unawareModel, }; - const awareDb = createTenantAwareDb({db, tenantId, options}); + const awareDb = createDimensionAwareDb({db, dimensionId, options}); const result = awareDb.model('test'); expect(result).toBe(awareModel); }); - it('returns a tenant unaware model if not compatible', () => { + it('returns a dimension unaware model if not compatible', () => { const unawareModel = { - [options.accessorMethod]: () => { - throw new Error(); - }, - mongoTenant: { - ...options, - tenantIdKey: 'dimension', - }, + schema: {}, }; const db = { model: () => unawareModel, }; - const awareDb = createTenantAwareDb({db, tenantId, options}); + const awareDb = createDimensionAwareDb({db, dimensionId, options}); const result = awareDb.model('test'); expect(result).toBe(unawareModel); diff --git a/src/api/tenant-aware-model/index.js b/src/api/dimension-aware-model/index.js similarity index 68% rename from src/api/tenant-aware-model/index.js rename to src/api/dimension-aware-model/index.js index 2d594f3..1fa19a2 100644 --- a/src/api/tenant-aware-model/index.js +++ b/src/api/dimension-aware-model/index.js @@ -1,15 +1,20 @@ -const createTenantAwareDb = require('../tenant-aware-db'); -const parseAggregateArguments = require('./parse-aggregate-arguments'); +const createDimensionAwareDb = require('../dimension-aware-db'); +const dimensionInterface = require('../../dimension-interface'); const modifyBulkWriteOpertations = require('./modify-bulk-write-operations'); +const parseAggregateArguments = require('./parse-aggregate-arguments'); +const symbolDimensions = require('../../symbol-dimensions'); -const createPlainModel = ({base, db, tenantId, tenantIdGetter, tenantIdKey}) => +const createPlainModel = ({ + base, + db, + dimension, + dimensionId, + dimensionIdGetter, + dimensionIdKey, +}) => class extends base { - static get hasTenantContext() { - return true; - } - - static [tenantIdGetter]() { - return tenantId; + static [dimensionIdGetter]() { + return dimensionId; } /** @@ -23,7 +28,7 @@ const createPlainModel = ({base, db, tenantId, tenantIdGetter, tenantIdKey}) => pipeline.unshift({ $match: { - [tenantIdKey]: this[tenantIdGetter](), + [dimensionIdKey]: this[dimensionIdGetter](), }, }); @@ -36,13 +41,13 @@ const createPlainModel = ({base, db, tenantId, tenantIdGetter, tenantIdKey}) => } static deleteOne(conditions, callback) { - conditions[tenantIdKey] = this[tenantIdGetter](); + conditions[dimensionIdKey] = this[dimensionIdGetter](); return super.deleteOne(conditions, callback); } static deleteMany(conditions, options, callback) { - conditions[tenantIdKey] = this[tenantIdGetter](); + conditions[dimensionIdKey] = this[dimensionIdGetter](); return super.deleteMany(conditions, options, callback); } @@ -54,7 +59,7 @@ const createPlainModel = ({base, db, tenantId, tenantIdGetter, tenantIdKey}) => } if (conditions) { - conditions[tenantIdKey] = this[tenantIdGetter](); + conditions[dimensionIdKey] = this[dimensionIdGetter](); } return super.remove(conditions, callback); @@ -67,21 +72,21 @@ const createPlainModel = ({base, db, tenantId, tenantIdGetter, tenantIdKey}) => } const self = this; - const tenantId = this[tenantIdGetter](); + const dimensionId = this[dimensionIdGetter](); // Model.insertMany supports a single document as parameter if (!Array.isArray(docs)) { - docs[tenantIdKey] = tenantId; + docs[dimensionIdKey] = dimensionId; } else { docs.forEach(doc => { - doc[tenantIdKey] = tenantId; + doc[dimensionIdKey] = dimensionId; }); } const promisedResult = options ? super.insertMany(docs, options) : super.insertMany(docs); - // ensure the returned docs are instanced of the bound multi tenant model + // ensure the returned docs are instanced of the bound multi dimension model const promisedMapped = promisedResult.then(result => Array.isArray(result) ? result.map(doc => new self(doc)) @@ -99,11 +104,11 @@ const createPlainModel = ({base, db, tenantId, tenantIdGetter, tenantIdKey}) => } static bulkWrite(ops, options, callback) { - const tenantId = this[tenantIdGetter](); + const dimensionId = this[dimensionIdGetter](); const modifiedOps = modifyBulkWriteOpertations({ ops, - tenantId, - tenantIdKey, + dimensionId, + dimensionIdKey, }); return super.bulkWrite(modifiedOps, options, callback); @@ -113,12 +118,13 @@ const createPlainModel = ({base, db, tenantId, tenantIdGetter, tenantIdKey}) => return db; } - get hasTenantContext() { - return true; + constructor(doc, fields, skipId) { + super(doc, fields, skipId); + this[symbolDimensions] = this.constructor[symbolDimensions]; } - [tenantIdGetter]() { - return tenantId; + [dimensionIdGetter]() { + return dimensionId; } }; @@ -149,41 +155,45 @@ const createDiscriminatorModels = ({model, base, createModel}) => { ); }; -const createModel = ({ - base, - db, - tenantId, - tenantIdGetter, - tenantIdKey, - createModel, -}) => { +/** + * + * @param {Mongoose.Model} base + * @param {Mongoose.Db} db + * @param {*} dimensionId + * @param {MongoTenantOptions} options + * @param createModel + * @returns {Mongoose.Model} + */ +const createModel = ({base, db, dimensionId, options, createModel}) => { + const {dimension, dimensionIdGetter, dimensionIdKey} = options; + const model = createPlainModel({ base, db, - tenantId, - tenantIdGetter, - tenantIdKey, + dimension, + dimensionId, + dimensionIdGetter, + dimensionIdKey, }); + dimensionInterface(model).add(dimension, {...options, dimensionId}); inheritOtherStatics({model, base}); createDiscriminatorModels({model, base, createModel}); return model; }; -module.exports = ({base, options, tenantId}) => { - const {tenantIdGetter, tenantIdKey} = options; - const db = createTenantAwareDb({ +module.exports = ({base, options, dimensionId}) => { + const db = createDimensionAwareDb({ db: base.db, - tenantId, + dimensionId, options, }); const config = { db, - tenantId, - tenantIdGetter, - tenantIdKey, + dimensionId, + options, }; const create = base => createModel({ diff --git a/src/api/tenant-aware-model/index.test.js b/src/api/dimension-aware-model/index.test.js similarity index 63% rename from src/api/tenant-aware-model/index.test.js rename to src/api/dimension-aware-model/index.test.js index f65f06c..bc02eb4 100644 --- a/src/api/tenant-aware-model/index.test.js +++ b/src/api/dimension-aware-model/index.test.js @@ -1,11 +1,18 @@ -const tenantAwareModel = require('./index'); +const dimensionAwareModel = require('./index'); +const dimensionInterface = require('../../dimension-interface'); const buildOptions = require('../../options'); -describe('tenant-aware-model', () => { +describe('dimension-aware-model', () => { describe('when called with valid parameters', () => { - const tenantId = '23'; - const tenantIdGetter = 'getTenantId'; - const tenantIdKey = 'tenantId'; + const dimensionId = '23'; + const dimension = 'dim'; + const dimensionIdGetter = 'getDimId'; + const dimensionIdKey = 'dimId'; + const options = buildOptions({ + dimension, + dimensionIdGetter, + dimensionIdKey, + }); const buildBaseModel = () => { const base = class {}; @@ -17,10 +24,10 @@ describe('tenant-aware-model', () => { let model; beforeEach(() => { base = buildBaseModel(); - model = tenantAwareModel({ + model = dimensionAwareModel({ base, - options: buildOptions({tenantIdGetter, tenantIdKey}), - tenantId, + options, + dimensionId, }); }); @@ -33,10 +40,10 @@ describe('tenant-aware-model', () => { base.discriminators = { test: class {}, }; - model = tenantAwareModel({ + model = dimensionAwareModel({ base, - options: buildOptions({tenantIdGetter, tenantIdKey}), - tenantId, + options, + dimensionId, }); expect(model).toHaveProperty('discriminators.test'); expect(model.discriminators.test).not.toBe(base.discriminators.test); @@ -45,19 +52,21 @@ describe('tenant-aware-model', () => { describe('returns a model that', () => { const callback = () => {}; - it('reports having a tenant context', () => { - const result = model.hasTenantContext; + it('keeps track of applied dimensions', () => { + const hasDimension = dimensionInterface(model).has(dimension); + const dimensionOptions = dimensionInterface(model).get(dimension); - expect(result).toBe(true); + expect(hasDimension).toBe(true); + expect(dimensionOptions).toEqual({dimensionId, ...options}); }); - it('reports bound tenant id', () => { - const result = model[tenantIdGetter](); + it('reports bound dimension id', () => { + const result = model[dimensionIdGetter](); - expect(result).toBe(tenantId); + expect(result).toBe(dimensionId); }); - it('has a tenant aware db model', () => { + it('has a dimension aware db model', () => { expect(model.db).not.toBe(base.db); }); @@ -67,41 +76,41 @@ describe('tenant-aware-model', () => { }); // mongoose 4.x - it('applies tenant context to single pipeline', () => { + it('applies dimension context to single pipeline', () => { model.aggregate({$project: {a: 1}}); expect(base.aggregate).toHaveBeenCalled(); expect(base.aggregate.mock.calls[0][0]).toEqual([ - {$match: {[tenantIdKey]: tenantId}}, + {$match: {[dimensionIdKey]: dimensionId}}, {$project: {a: 1}}, ]); }); // mongoose 4.x - it('applies tenant context to multi pipeline', () => { + it('applies dimension context to multi pipeline', () => { model.aggregate({$project: {a: 1}}, {$skip: 5}); expect(base.aggregate).toHaveBeenCalled(); expect(base.aggregate.mock.calls[0][0]).toEqual([ - {$match: {[tenantIdKey]: tenantId}}, + {$match: {[dimensionIdKey]: dimensionId}}, {$project: {a: 1}}, {$skip: 5}, ]); }); - it('applies tenant context to pipeline list', () => { + it('applies dimension context to pipeline list', () => { model.aggregate([{$project: {a: 1}}, {$skip: 5}]); expect(base.aggregate).toHaveBeenCalled(); expect(base.aggregate.mock.calls[0][0]).toEqual([ - {$match: {[tenantIdKey]: tenantId}}, + {$match: {[dimensionIdKey]: dimensionId}}, {$project: {a: 1}}, {$skip: 5}, ]); }); - it('applies tenant context to aggregate builder', () => { + it('applies dimension context to aggregate builder', () => { model.aggregate(); expect(base.aggregate).toHaveBeenCalled(); expect(base.aggregate.mock.calls[0][0]).toEqual([ - {$match: {[tenantIdKey]: tenantId}}, + {$match: {[dimensionIdKey]: dimensionId}}, ]); }); @@ -113,22 +122,22 @@ describe('tenant-aware-model', () => { }); }); - it('applies tenant context in deleteOne', () => { + it('applies dimension context in deleteOne', () => { base.deleteOne = jest.fn(); model.deleteOne({}, undefined); expect(base.deleteOne).toHaveBeenCalledWith( - {[tenantIdKey]: tenantId}, + {[dimensionIdKey]: dimensionId}, undefined ); }); - it('applies tenant context in deleteMany', () => { + it('applies dimension context in deleteMany', () => { base.deleteMany = jest.fn(); model.deleteMany({}, {}, undefined); expect(base.deleteMany).toHaveBeenCalledWith( - {[tenantIdKey]: tenantId}, + {[dimensionIdKey]: dimensionId}, {}, undefined ); @@ -139,15 +148,15 @@ describe('tenant-aware-model', () => { [ 'just with conditions', [{foo: 'bar'}], - [{foo: 'bar', [tenantIdKey]: tenantId}, undefined], + [{foo: 'bar', [dimensionIdKey]: dimensionId}, undefined], ], [ 'with conditions and callback', [{foo: 'bar'}, callback], - [{foo: 'bar', [tenantIdKey]: tenantId}, callback], + [{foo: 'bar', [dimensionIdKey]: dimensionId}, callback], ], ])( - 'applies tenant context when called %s', + 'applies dimension context when called %s', (name, args, expectedBaseArgs) => { base.remove = jest.fn(); model.remove(...args); @@ -161,10 +170,10 @@ describe('tenant-aware-model', () => { [ 'just with callback', [callback], - [{[tenantIdKey]: tenantId}, callback], + [{[dimensionIdKey]: dimensionId}, callback], ], ])( - 'does not apply tenant context when called %s', + 'does not apply dimension context when called %s', (name, args, expectedBaseArgs) => { base.remove = jest.fn(); model.remove(...args); @@ -175,38 +184,38 @@ describe('tenant-aware-model', () => { }); describe('overrides static insertMany which', () => { - it('applies tenant context on single document', async () => { + it('applies dimension context on single document', async () => { base.insertMany = jest.fn(() => Promise.resolve({})); await model.insertMany({}, undefined); expect(base.insertMany).toHaveBeenCalledTimes(1); expect(base.insertMany.mock.calls[0][0]).toEqual({ - [tenantIdKey]: tenantId, + [dimensionIdKey]: dimensionId, }); }); - it('applies tenant context on multiple documents', async () => { + it('applies dimension context on multiple documents', async () => { base.insertMany = jest.fn(() => Promise.resolve([{}])); await model.insertMany([{}], undefined); expect(base.insertMany).toHaveBeenCalledTimes(1); expect(base.insertMany.mock.calls[0][0]).toEqual([ - {[tenantIdKey]: tenantId}, + {[dimensionIdKey]: dimensionId}, ]); }); - it('builds tenant aware models for promise', async () => { + it('builds dimension aware models for promise', async () => { base.insertMany = docs => Promise.resolve(docs); const newDocs = [{}]; const insertedDocs = await model.insertMany(newDocs); expect(insertedDocs).toHaveLength(1); expect(insertedDocs[0]).toBeInstanceOf(model); - expect(insertedDocs[0].hasTenantContext).toBe(true); - expect(insertedDocs[0][tenantIdGetter]()).toBe(tenantId); + // expect(insertedDocs[0].hasTenantContext).toBe(true); + expect(insertedDocs[0][dimensionIdGetter]()).toBe(dimensionId); }); - it('builds tenant aware models for callback', done => { + it('builds dimension aware models for callback', done => { base.insertMany = docs => Promise.resolve(docs); const newDoc = {}; model.insertMany([newDoc], (err, docs) => { @@ -215,8 +224,8 @@ describe('tenant-aware-model', () => { const savedDoc = docs[0]; expect(savedDoc).toBeInstanceOf(model); - expect(savedDoc.hasTenantContext).toBe(true); - expect(savedDoc[tenantIdGetter]()).toBe(tenantId); + // expect(savedDoc.hasTenantContext).toBe(true); + expect(savedDoc[dimensionIdGetter]()).toBe(dimensionId); done(); }); @@ -233,22 +242,22 @@ describe('tenant-aware-model', () => { }); }); - describe('when instanciated', () => { + describe('when instantiated', () => { let instance; beforeEach(() => { instance = new model(); }); - it('reports having a tenant context', () => { - const result = instance.hasTenantContext; - - expect(result).toBe(true); - }); + // it('reports having a dimension context', () => { + // const result = instance.hasTenantContext; + // + // expect(result).toBe(true); + // }); - it('reports bound tenant id', () => { - const result = instance[tenantIdGetter](); + it('reports bound dimension id', () => { + const result = instance[dimensionIdGetter](); - expect(result).toBe(tenantId); + expect(result).toBe(dimensionId); }); }); }); diff --git a/src/api/tenant-aware-model/modify-bulk-write-operations.js b/src/api/dimension-aware-model/modify-bulk-write-operations.js similarity index 51% rename from src/api/tenant-aware-model/modify-bulk-write-operations.js rename to src/api/dimension-aware-model/modify-bulk-write-operations.js index cd82ce3..e57dcde 100644 --- a/src/api/tenant-aware-model/modify-bulk-write-operations.js +++ b/src/api/dimension-aware-model/modify-bulk-write-operations.js @@ -1,11 +1,11 @@ -const patchDocument = ({document, tenantId, tenantIdKey}) => ({ +const patchDocument = ({document, dimensionId, dimensionIdKey}) => ({ ...document, - [tenantIdKey]: tenantId, + [dimensionIdKey]: dimensionId, }); -const patchFilter = ({filter, tenantId, tenantIdKey}) => ({ +const patchFilter = ({filter, dimensionId, dimensionIdKey}) => ({ ...(filter || {}), - [tenantIdKey]: tenantId, + [dimensionIdKey]: dimensionId, }); const forbiddenUpdateOperations = [ @@ -19,12 +19,12 @@ const forbiddenUpdateOperations = [ '$unset', ]; const patchableUpdateOperations = ['$set', '$setOnInsert']; -const patchUpdate = ({update, tenantId, tenantIdKey}) => { +const patchUpdate = ({update, dimensionId, dimensionIdKey}) => { const forbiddenOpsUsed = Object.entries(update).reduce( (ops, [op, fields]) => { if ( forbiddenUpdateOperations.includes(op) && - Object.keys(fields).includes(tenantIdKey) + Object.keys(fields).includes(dimensionIdKey) ) { ops.push(op); } @@ -34,7 +34,7 @@ const patchUpdate = ({update, tenantId, tenantIdKey}) => { ); if (forbiddenOpsUsed.length > 0) { throw new Error( - `Modification of ${tenantIdKey} via bulkInsert update (${forbiddenOpsUsed.join( + `Modification of ${dimensionIdKey} via bulkInsert update (${forbiddenOpsUsed.join( ', ' )}` ); @@ -44,42 +44,54 @@ const patchUpdate = ({update, tenantId, tenantIdKey}) => { patchableUpdateOperations.forEach(op => { if ( patchedUpdate[op] && - Object.keys(patchedUpdate[op]).includes(tenantIdKey) + Object.keys(patchedUpdate[op]).includes(dimensionIdKey) ) { - patchedUpdate[op][tenantIdKey] = tenantId; + patchedUpdate[op][dimensionIdKey] = dimensionId; } }); return patchedUpdate; }; -const modifyInsert = ({tenantId, tenantIdKey, op: {document, ...rest}}) => ({ - document: patchDocument({document, tenantId, tenantIdKey}), +const modifyInsert = ({ + dimensionId, + dimensionIdKey, + op: {document, ...rest}, +}) => ({ + document: patchDocument({document, dimensionId, dimensionIdKey}), ...rest, }); const modifyUpdate = ({ - tenantId, - tenantIdKey, + dimensionId, + dimensionIdKey, op: {filter, update, ...rest}, }) => ({ - filter: patchFilter({filter, tenantId, tenantIdKey}), - update: patchUpdate({update, tenantId, tenantIdKey}), + filter: patchFilter({filter, dimensionId, dimensionIdKey}), + update: patchUpdate({update, dimensionId, dimensionIdKey}), ...rest, }); const modifyReplace = ({ - tenantId, - tenantIdKey, + dimensionId, + dimensionIdKey, op: {filter, replacement, ...rest}, }) => ({ - filter: patchFilter({filter, tenantId, tenantIdKey}), - replacement: patchDocument({document: replacement, tenantId, tenantIdKey}), + filter: patchFilter({filter, dimensionId, dimensionIdKey}), + replacement: patchDocument({ + document: replacement, + dimensionId, + dimensionIdKey, + }), ...rest, }); -const modifyDelete = ({tenantId, tenantIdKey, op: {filter, ...rest}}) => ({ - filter: patchFilter({filter, tenantId, tenantIdKey}), +const modifyDelete = ({ + dimensionId, + dimensionIdKey, + op: {filter, ...rest}, +}) => ({ + filter: patchFilter({filter, dimensionId, dimensionIdKey}), ...rest, }); @@ -92,15 +104,15 @@ const opToModifierMap = { deleteMany: modifyDelete, }; -module.exports = ({ops, tenantId, tenantIdKey}) => { +module.exports = ({ops, dimensionId, dimensionIdKey}) => { return (ops || []).map(op => { const modifiedOp = {...op}; Object.entries(modifiedOp).forEach(([opKey, op]) => { if (opToModifierMap[opKey]) { modifiedOp[opKey] = opToModifierMap[opKey]({ - tenantId, - tenantIdKey, + dimensionId, + dimensionIdKey, op, }); } diff --git a/src/api/dimension-aware-model/modify-bulk-write-operations.test.js b/src/api/dimension-aware-model/modify-bulk-write-operations.test.js new file mode 100644 index 0000000..80963f3 --- /dev/null +++ b/src/api/dimension-aware-model/modify-bulk-write-operations.test.js @@ -0,0 +1,145 @@ +const modifyBulkWriteOperations = require('./modify-bulk-write-operations'); + +describe('modify-bulk-write-operations', () => { + it.each([ + ['dimension id present', {dim: 'a'}, {dim: 't'}], + ['dimension id absent', {}, {dim: 't'}], + ])('modifies insertOne (%s)', (name, document, expectedDocument) => { + const ops = [{insertOne: {document}}]; + const result = modifyBulkWriteOperations({ + ops, + dimensionId: 't', + dimensionIdKey: 'dim', + }); + expect(result).toEqual([{insertOne: {document: expectedDocument}}]); + }); + + it.each([ + ['updateOne', 'dimension id in filter present', {dim: 'a'}, {dim: 't'}], + ['updateOne', 'dimension id in filter absent', {}, {dim: 't'}], + ['updateMany', 'dimension id in filter present', {dim: 'a'}, {dim: 't'}], + ['updateMany', 'dimension id in filter absent', {}, {dim: 't'}], + ])('modifies filter of %s (%s)', (op, name, filter, expectedFilter) => { + const ops = [{[op]: {filter, update: {}}}]; + const result = modifyBulkWriteOperations({ + ops, + dimensionId: 't', + dimensionIdKey: 'dim', + }); + expect(result).toEqual([{[op]: {filter: expectedFilter, update: {}}}]); + }); + + it.each([ + [ + 'updateOne', + 'dimension id in $set', + {$set: {dim: 'a'}}, + {$set: {dim: 't'}}, + ], + [ + 'updateOne', + 'dimension id in $setOnInsert', + {$set: {dim: 'a'}}, + {$set: {dim: 't'}}, + ], + [ + 'updateMany', + 'dimension id in $set', + {$set: {dim: 'a'}}, + {$set: {dim: 't'}}, + ], + [ + 'updateMany', + 'dimension id in $setOnInsert', + {$set: {dim: 'a'}}, + {$set: {dim: 't'}}, + ], + ])('modifies update of %s (%s)', (op, name, update, expectedUpdate) => { + const ops = [{[op]: {filter: {}, update}}]; + const result = modifyBulkWriteOperations({ + ops, + dimensionId: 't', + dimensionIdKey: 'dim', + }); + expect(result).toEqual([ + {[op]: {filter: {dim: 't'}, update: expectedUpdate}}, + ]); + }); + + it.each([ + ['updateOne', '$bit'], + ['updateOne', '$currentDate'], + ['updateOne', '$inc'], + ['updateOne', '$min'], + ['updateOne', '$max'], + ['updateOne', '$mul'], + ['updateOne', '$rename'], + ['updateOne', '$unset'], + ['updateMany', '$bit'], + ['updateMany', '$currentDate'], + ['updateMany', '$inc'], + ['updateMany', '$min'], + ['updateMany', '$max'], + ['updateMany', '$mul'], + ['updateMany', '$rename'], + ['updateMany', '$unset'], + ])('throws on dimension id modification in %s (%s)', (op, updateOp) => { + const ops = [{[op]: {filter: {}, update: {[updateOp]: {dim: 1}}}}]; + const fn = () => + modifyBulkWriteOperations({ops, dimensionId: 't', dimensionIdKey: 'dim'}); + expect(fn).toThrow(); + }); + + it.each([ + ['dimension id present', {dim: 'a'}, {dim: 't'}], + ['dimension id absent', {}, {dim: 't'}], + ])('modifies filter of replaceOne (%s)', (name, filter, expectedFilter) => { + const ops = [{replaceOne: {filter, replacement: {dim: 't'}}}]; + const result = modifyBulkWriteOperations({ + ops, + dimensionId: 't', + dimensionIdKey: 'dim', + }); + expect(result).toEqual([ + {replaceOne: {filter: expectedFilter, replacement: {dim: 't'}}}, + ]); + }); + + it.each([ + ['dimension id present', {dim: 'a'}, {dim: 't'}], + ['dimension id absent', {}, {dim: 't'}], + ])( + 'modifies document of replaceOne (%s)', + (name, replacement, expectedReplacement) => { + const ops = [{replaceOne: {filter: {dim: 't'}, replacement}}]; + const result = modifyBulkWriteOperations({ + ops, + dimensionId: 't', + dimensionIdKey: 'dim', + }); + expect(result).toEqual([ + { + replaceOne: { + filter: {dim: 't'}, + replacement: expectedReplacement, + }, + }, + ]); + } + ); + + it.each([ + ['deleteOne', 'dimension id present', {dim: 'a'}, {dim: 't'}], + ['deleteOne', 'dimension id absent', {}, {dim: 't'}], + ['deleteMany', 'dimension id present', {dim: 'a'}, {dim: 't'}], + ['deleteMany', 'dimension id absent', {}, {dim: 't'}], + ])('modifies filter of %s (%s)', (op, name, filter, expectedFilter) => { + const ops = [{[op]: {filter}}]; + const result = modifyBulkWriteOperations({ + ops, + dimensionId: 't', + dimensionIdKey: 'dim', + }); + expect(result).toEqual([{[op]: {filter: expectedFilter}}]); + }); +}); diff --git a/src/api/tenant-aware-model/parse-aggregate-arguments.js b/src/api/dimension-aware-model/parse-aggregate-arguments.js similarity index 100% rename from src/api/tenant-aware-model/parse-aggregate-arguments.js rename to src/api/dimension-aware-model/parse-aggregate-arguments.js diff --git a/src/api/tenant-aware-model/parse-aggregate-arguments.test.js b/src/api/dimension-aware-model/parse-aggregate-arguments.test.js similarity index 100% rename from src/api/tenant-aware-model/parse-aggregate-arguments.test.js rename to src/api/dimension-aware-model/parse-aggregate-arguments.test.js diff --git a/src/api/index.js b/src/api/index.js index 5a7f54a..86e5b0f 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -1,32 +1,32 @@ -const buildModelCache = require('./tenant-aware-model-cache'); -const createTenantAwareModel = require('./tenant-aware-model'); +const createDimensionAwareModel = require('./dimension-aware-model'); +const dimensionInterface = require('../dimension-interface'); const sanitizeOptions = require('../options'); /** - * Tenant api plugin + * Api plugin * @param {Mongoose.Schema} schema Schema to extend * @param {MongoTenantOptions} [options] Options (optional) */ module.exports = (schema, options) => { const sanitizedOptions = sanitizeOptions(options || {}); - const {accessorMethod} = sanitizedOptions; - const cache = buildModelCache(); + const {dimension, accessorMethod} = sanitizedOptions; + dimensionInterface(schema).add(dimension, sanitizedOptions); + + const cache = new Map(); Object.assign(schema.statics, { - [accessorMethod]: function(tenantId) { - if (!cache.has(this.modelName, tenantId)) { + [accessorMethod]: function(dimensionId) { + const cacheKey = `${this.modelName}:${dimension}:${dimensionId}`; + if (!cache.has(cacheKey)) { const base = this.model(this.modelName); - const model = createTenantAwareModel({ + const model = createDimensionAwareModel({ base, - tenantId, + dimensionId, options: sanitizedOptions, }); - cache.set(this.modelName, tenantId, model); + cache.set(cacheKey, model); } - return cache.get(this.modelName, tenantId); - }, - get mongoTenant() { - return {...sanitizedOptions}; + return cache.get(cacheKey); }, }); diff --git a/src/api/index.test.js b/src/api/index.test.js index 5ac4734..8e56db5 100644 --- a/src/api/index.test.js +++ b/src/api/index.test.js @@ -1,5 +1,6 @@ const api = require('./index'); const buildOptions = require('../options'); +const dimensionInterface = require('../dimension-interface'); const Mongoose = require('mongoose').Mongoose; const Schema = require('mongoose').Schema; @@ -29,22 +30,25 @@ describe('api', () => { expect(tenantAwareModel).not.toBe(model); }); - it('when called twice for same tenant returns identical new models', () => { + it('when called twice for same dimension value returns identical new models', () => { const firstTenantAwareModel = model.byTenant(1); const secondTenantAwareModel = model.byTenant(1); expect(secondTenantAwareModel).toBe(firstTenantAwareModel); }); - it('when called for differen tenants returns different new models', () => { + it('when called for different dimension values returns different new models', () => { const firstTenantAwareModel = model.byTenant(1); const secondTenantAwareModel = model.byTenant(2); expect(secondTenantAwareModel).not.toBe(firstTenantAwareModel); }); }); - it('reports plugin options', () => { - expect(schema).toHaveProperty('statics.mongoTenant'); - expect(schema.statics.mongoTenant).toEqual(options); + it('keeps track of applied dimensions', () => { + const hasTenantDimension = dimensionInterface(schema).has('tenant'); + const dimensionOptions = dimensionInterface(schema).get('tenant'); + + expect(hasTenantDimension).toBe(true); + expect(dimensionOptions).toEqual(options); }); }); }); diff --git a/src/api/tenant-aware-model-cache.js b/src/api/tenant-aware-model-cache.js deleted file mode 100644 index bfae541..0000000 --- a/src/api/tenant-aware-model-cache.js +++ /dev/null @@ -1,13 +0,0 @@ -module.exports = () => { - const cache = {}; - return { - has: (name, id) => (cache[name] && cache[name][id] && true) || false, - get: (name, id) => cache[name] && cache[name][id], - set: (name, id, value) => { - cache[name] = { - ...(cache[name] || {}), - [id]: value, - }; - }, - }; -}; diff --git a/src/api/tenant-aware-model-cache.test.js b/src/api/tenant-aware-model-cache.test.js deleted file mode 100644 index 91d298d..0000000 --- a/src/api/tenant-aware-model-cache.test.js +++ /dev/null @@ -1,43 +0,0 @@ -const buildTenantAwareModelCache = require('./tenant-aware-model-cache'); - -describe('tenant-aware-model-cache', () => { - describe('builds a cache that', () => { - it('returns a cached model', () => { - const model = {}; - const cache = buildTenantAwareModelCache(); - - cache.set('test', '23', model); - const result = cache.get('test', '23'); - - expect(result).toBe(model); - }); - - it('reports a stored model as cached', () => { - const model = {}; - const cache = buildTenantAwareModelCache(); - - cache.set('test', '23', model); - const result = cache.has('test', '23'); - - expect(result).toBe(true); - }); - - it('reports a unknown model as not cached', () => { - const cache = buildTenantAwareModelCache(); - - const result = cache.has('test', '23'); - - expect(result).toBe(false); - }); - - it('reports a unknown tenant as not cached', () => { - const model = {}; - const cache = buildTenantAwareModelCache(); - - cache.set('test', '23', model); - const result = cache.has('test', '42'); - - expect(result).toBe(false); - }); - }); -}); diff --git a/src/api/tenant-aware-model/modify-bulk-write-operations.test.js b/src/api/tenant-aware-model/modify-bulk-write-operations.test.js deleted file mode 100644 index 53f8f99..0000000 --- a/src/api/tenant-aware-model/modify-bulk-write-operations.test.js +++ /dev/null @@ -1,133 +0,0 @@ -const modifyBulkWriteOperations = require('./modify-bulk-write-operations'); - -describe('modify-bulk-write-operations', () => { - const tenantId = 't'; - const tenantIdKey = 'tenantId'; - - it.each([ - ['tenantId present', {[tenantIdKey]: 'a'}, {[tenantIdKey]: 't'}], - ['tenantId absent', {}, {[tenantIdKey]: 't'}], - ])('modifies insertOne (%s)', (name, document, expectedDocument) => { - const ops = [{insertOne: {document}}]; - const result = modifyBulkWriteOperations({ops, tenantId, tenantIdKey}); - expect(result).toEqual([{insertOne: {document: expectedDocument}}]); - }); - - it.each([ - [ - 'updateOne', - 'tenantId in filter present', - {tenantId: 'a'}, - {tenantId: 't'}, - ], - ['updateOne', 'tenantId in filter absent', {}, {tenantId: 't'}], - [ - 'updateMany', - 'tenantId in filter present', - {tenantId: 'a'}, - {tenantId: 't'}, - ], - ['updateMany', 'tenantId in filter absent', {}, {tenantId: 't'}], - ])('modifies filter of %s (%s)', (op, name, filter, expectedFilter) => { - const ops = [{[op]: {filter, update: {}}}]; - const result = modifyBulkWriteOperations({ops, tenantId, tenantIdKey}); - expect(result).toEqual([{[op]: {filter: expectedFilter, update: {}}}]); - }); - - it.each([ - [ - 'updateOne', - 'tenantId in $set', - {$set: {tenantId: 'a'}}, - {$set: {tenantId: 't'}}, - ], - [ - 'updateOne', - 'tenantId in $setOnInsert', - {$set: {tenantId: 'a'}}, - {$set: {tenantId: 't'}}, - ], - [ - 'updateMany', - 'tenantId in $set', - {$set: {tenantId: 'a'}}, - {$set: {tenantId: 't'}}, - ], - [ - 'updateMany', - 'tenantId in $setOnInsert', - {$set: {tenantId: 'a'}}, - {$set: {tenantId: 't'}}, - ], - ])('modifies update of %s (%s)', (op, name, update, expectedUpdate) => { - const ops = [{[op]: {filter: {}, update}}]; - const result = modifyBulkWriteOperations({ops, tenantId, tenantIdKey}); - expect(result).toEqual([ - {[op]: {filter: {tenantId: 't'}, update: expectedUpdate}}, - ]); - }); - - it.each([ - ['updateOne', '$bit'], - ['updateOne', '$currentDate'], - ['updateOne', '$inc'], - ['updateOne', '$min'], - ['updateOne', '$max'], - ['updateOne', '$mul'], - ['updateOne', '$rename'], - ['updateOne', '$unset'], - ['updateMany', '$bit'], - ['updateMany', '$currentDate'], - ['updateMany', '$inc'], - ['updateMany', '$min'], - ['updateMany', '$max'], - ['updateMany', '$mul'], - ['updateMany', '$rename'], - ['updateMany', '$unset'], - ])('throws on tenant id modification in %s (%s)', (op, updateOp) => { - const ops = [{[op]: {filter: {}, update: {[updateOp]: {tenantId: 1}}}}]; - const fn = () => modifyBulkWriteOperations({ops, tenantId, tenantIdKey}); - expect(fn).toThrow(); - }); - - it.each([ - ['tenantId present', {tenantId: 'a'}, {tenantId: 't'}], - ['tenantId absent', {}, {tenantId: 't'}], - ])('modifies filter of replaceOne (%s)', (name, filter, expectedFilter) => { - const ops = [{replaceOne: {filter, replacement: {tenantId: 't'}}}]; - const result = modifyBulkWriteOperations({ops, tenantId, tenantIdKey}); - expect(result).toEqual([ - {replaceOne: {filter: expectedFilter, replacement: {tenantId: 't'}}}, - ]); - }); - - it.each([ - ['tenantId present', {tenantId: 'a'}, {tenantId: 't'}], - ['tenantId absent', {}, {tenantId: 't'}], - ])( - 'modifies document of replaceOne (%s)', - (name, replacement, expectedReplacement) => { - const ops = [{replaceOne: {filter: {tenantId: 't'}, replacement}}]; - const result = modifyBulkWriteOperations({ops, tenantId, tenantIdKey}); - expect(result).toEqual([ - { - replaceOne: { - filter: {tenantId: 't'}, - replacement: expectedReplacement, - }, - }, - ]); - } - ); - - it.each([ - ['deleteOne', 'tenantId present', {tenantId: 'a'}, {tenantId: 't'}], - ['deleteOne', 'tenantId absent', {}, {tenantId: 't'}], - ['deleteMany', 'tenantId present', {tenantId: 'a'}, {tenantId: 't'}], - ['deleteMany', 'tenantId absent', {}, {tenantId: 't'}], - ])('modifies filter of %s (%s)', (op, name, filter, expectedFilter) => { - const ops = [{[op]: {filter}}]; - const result = modifyBulkWriteOperations({ops, tenantId, tenantIdKey}); - expect(result).toEqual([{[op]: {filter: expectedFilter}}]); - }); -}); diff --git a/src/dimension-interface.js b/src/dimension-interface.js new file mode 100644 index 0000000..61121e3 --- /dev/null +++ b/src/dimension-interface.js @@ -0,0 +1,45 @@ +const symbolDimensions = require('./symbol-dimensions'); + +/** + * Interface to handle dimensions of base model + * @param {*} subject + */ +module.exports = subject => { + if (!subject) { + throw new Error('No subject'); + } + return { + /** + * Add a dimension + * @param {string} dimension + * @param {MongoTenantOptions} options + */ + add: (dimension, options) => { + const dimensions = subject[symbolDimensions] || new Map(); + if (dimensions.has(dimension) && dimensions.get(dimension) !== options) { + throw new Error( + `MongoTenant: Dimension "${dimension}" already applied to model "${subject.modelName || + ''}"` + ); + } + dimensions.set(dimension, options); + subject[symbolDimensions] = dimensions; + }, + /** + * Get dimension settings of subject if it exists + * @param {string} dimension + * @returns {MongoTenantOptions|undefined} + */ + get: dimension => + (subject[symbolDimensions] && subject[symbolDimensions].get(dimension)) || + undefined, + /** + * Check if dimension on subject exists + * @param dimension + * @returns {boolean} + */ + has: dimension => + (subject[symbolDimensions] && subject[symbolDimensions].has(dimension)) || + false, + }; +}; diff --git a/src/dimension-interface.test.js b/src/dimension-interface.test.js new file mode 100644 index 0000000..0b6c0d7 --- /dev/null +++ b/src/dimension-interface.test.js @@ -0,0 +1,50 @@ +const dimensionInterface = require('./dimension-interface'); + +describe('dimension-interface', () => { + describe('when instantiated', () => { + let source; + let subject; + beforeEach(() => { + source = {}; + subject = dimensionInterface(source); + }); + + it('reports a unset dimension as unset', () => { + const result = subject.has('never-set'); + expect(result).toBe(false); + }); + + it('reports a added dimension as existing', () => { + subject.add('test', {}); + const result = subject.has('test'); + expect(result).toBe(true); + }); + + it('throws an error when dimension with different options is added multiple times', () => { + subject.add('test', {}); + const fn = () => { + subject.add('test', {}); + }; + + expect(fn).toThrow(); + }); + + it('does not throw an error when dimension with identical options is added multiple times', () => { + const options = {}; + subject.add('test', options); + subject.add('test', options); + }); + + it('returns `undefined` when getting unknown dimension', () => { + const result = subject.get('test'); + expect(result).toBeUndefined(); + }); + + it('returns options of added dimension', () => { + const options = {}; + subject.add('test', options); + const result = subject.get('test'); + expect(result).toBe(options); + }); + }); +}); diff --git a/src/index.test.integration.js b/src/index.test.integration.js index 6c0d70b..2d8ba66 100644 --- a/src/index.test.integration.js +++ b/src/index.test.integration.js @@ -1,6 +1,7 @@ const {Mongoose, Schema, version: mongooseVersion} = require('mongoose'); const {MongoClient, ObjectId} = require('mongodb'); const plugin = require('./index'); +const dimensionInterface = require('./dimension-interface'); const MONGO_URI = process.env.MONGO_URI || 'mongodb://localhost/mongo-tenant-test'; @@ -95,8 +96,8 @@ describe('plugin', () => { modelT2 = model.byTenant(2); }); - it('report having a tenant context', () => { - expect(modelT1).toHaveProperty('hasTenantContext', true); + it('have a dimension context', () => { + expect(dimensionInterface(modelT1).has('tenant')).toBe(true); }); it('report the right tenant id', () => { @@ -104,7 +105,7 @@ describe('plugin', () => { expect(modelT2.getTenantId()).toBe(2); }); - describe('which when instanciated create documents that', () => { + describe('which when instantiated create documents that', () => { let docT1; let docT2; beforeEach(() => { @@ -112,8 +113,8 @@ describe('plugin', () => { docT2 = new modelT2(); }); - it('report having a tenant context', () => { - expect(docT1).toHaveProperty('hasTenantContext', true); + it('have a dimension context', () => { + expect(dimensionInterface(docT1).has('tenant')).toBe(true); }); it('report the right tenant id', () => { @@ -388,7 +389,7 @@ describe('plugin', () => { }); } - it('binds Model.findOneAndRemove() to tenant context', async () => { + it('binds Model.findOneAndRemove() to dimension context', async () => { const {model} = buildModel(); await model.create({tenantId: 'a'}, {tenantId: 'a'}, {tenantId: 'b'}); @@ -400,7 +401,7 @@ describe('plugin', () => { }); if (mongooseVersion >= '5.4.0') { - it('binds Model.findOneAndReplace() to tenant context', async () => { + it('binds Model.findOneAndReplace() to dimension context', async () => { const {model} = buildModel({k: Number, v: Number}); await model.create( {tenantId: 'a', k: 1, v: 1}, @@ -419,7 +420,7 @@ describe('plugin', () => { }); } - it('binds Model.findOneAndUpdate() to tenant context', async () => { + it('binds Model.findOneAndUpdate() to dimension context', async () => { const {model} = buildModel({k: Number, v: Number}); await model.create( {tenantId: 'a', k: 1, v: 1}, @@ -444,7 +445,7 @@ describe('plugin', () => { }); }); - it('binds Model.insertMany() to tenant context', async () => { + it('binds Model.insertMany() to dimension context', async () => { const {model} = buildModel({t: Number}); const insertedDocs = await model .byTenant('a') @@ -452,8 +453,8 @@ describe('plugin', () => { const allDocs = await model.find().sort({t: 1}); expect(insertedDocs).toHaveLength(2); - expect(insertedDocs[0].hasTenantContext).toBeTruthy(); - expect(insertedDocs[1].hasTenantContext).toBeTruthy(); + expect(dimensionInterface(insertedDocs[0]).has('tenant')).toBe(true); + expect(dimensionInterface(insertedDocs[1]).has('tenant')).toBe(true); expect(insertedDocs.map(doc => doc.toObject())).toMatchObject([ {tenantId: 'a', t: 1}, {tenantId: 'a', t: 2}, @@ -464,7 +465,7 @@ describe('plugin', () => { ]); }); - it('binds Model.remove() to tenant context', async () => { + it('binds Model.remove() to dimension context', async () => { const {model} = buildModel({t: Number}); await model.create( {tenantId: 'a', t: 1}, @@ -483,7 +484,7 @@ describe('plugin', () => { }); if (mongooseVersion >= '4.9.0') { - it('binds Model.replaceOne() to tenant context', async () => { + it('binds Model.replaceOne() to dimension context', async () => { const {model} = buildModel({k: Number, v: Number}); await model.create( {tenantId: 'a', k: 1, v: 1}, @@ -502,7 +503,7 @@ describe('plugin', () => { }); } - it('binds Model.update() to tenant context', async () => { + it('binds Model.update() to dimension context', async () => { const {model} = buildModel({t: Number}); await model.create({tenantId: 'a', t: 1}, {tenantId: 'b', t: 1}); @@ -517,7 +518,7 @@ describe('plugin', () => { expect(sortedDocs[1].toObject()).toMatchObject({tenantId: 'b', t: 2}); }); - it('binds Model.updateOne() to tenant context', async () => { + it('binds Model.updateOne() to dimension context', async () => { const {model} = buildModel({t: Number}); await model.create({tenantId: 'a', t: 1}, {tenantId: 'b', t: 1}); @@ -532,7 +533,7 @@ describe('plugin', () => { expect(sortedDocs[1].toObject()).toMatchObject({tenantId: 'b', t: 2}); }); - it('binds Model.updateMany() to tenant context', async () => { + it('binds Model.updateMany() to dimension context', async () => { const {model} = buildModel({t: Number}); await model.create( {tenantId: 'a', t: 1}, @@ -920,18 +921,20 @@ describe('plugin', () => { }); }); - describe('applied on schema with sub schema', () => { - describe('where sub schema is without tenant level', () => { - it('should pass down tenant context on Model.find().populate()', async () => { - const subModel = mongoose.model( - 'subModel', + describe('applied on schema with reference to other schema', () => { + describe('where other schema is without dimension', () => { + it('should not pass down dimension context on Model.find().populate()', async () => { + const otherModel = mongoose.model( + 'otherModel', new Schema({tenantId: String}) ); const {model} = buildModel({ - children: [{type: Schema.Types.ObjectId, ref: subModel.modelName}], + children: [ + {type: Schema.Types.ObjectId, ref: otherModel.modelName}, + ], }); - const subDocs = await subModel.create([ + const subDocs = await otherModel.create([ {tenantId: 'a'}, {tenantId: 'b'}, ]); @@ -957,19 +960,26 @@ describe('plugin', () => { }, ], }); - expect(docs[0].children[0].hasTenantContext).toBeUndefined(); - expect(docs[0].children[1].hasTenantContext).toBeUndefined(); + + expect(dimensionInterface(docs[0].children[0]).has('tenant')).toBe( + false + ); + expect(dimensionInterface(docs[0].children[1]).has('tenant')).toBe( + false + ); }); }); - describe('where sub schema has same tenant level', () => { - it('should pass down tenant context on Model.find().populate()', async () => { - const {model: subModel} = buildModel({}); + describe('where other schema has same dimension with identical options', () => { + it('should pass down dimension context on Model.find().populate()', async () => { + const {model: otherModel} = buildModel({}); const {model} = buildModel({ - children: [{type: Schema.Types.ObjectId, ref: subModel.modelName}], + children: [ + {type: Schema.Types.ObjectId, ref: otherModel.modelName}, + ], }); - const subDocs = await subModel.create([ + const subDocs = await otherModel.create([ {tenantId: 'a'}, {tenantId: 'b'}, ]); @@ -993,17 +1003,65 @@ describe('plugin', () => { }, ], }); - expect(docs[0].children[0].hasTenantContext).toBeTruthy(); + expect(dimensionInterface(docs[0].children[0]).has('tenant')).toBe( + true + ); + }); + }); + + describe('where other schema has same dimension with different options', () => { + it('should pass down dimension context on Model.find().populate()', async () => { + const {model: otherModel} = buildModel( + {}, + { + dimensionIdKey: 'tenant_id', + accessorMethod: 'by_tenant', + } + ); + const {model} = buildModel({ + children: [ + {type: Schema.Types.ObjectId, ref: otherModel.modelName}, + ], + }); + + const subDocs = await otherModel.create([ + {tenant_id: 'a'}, + {tenant_id: 'b'}, + ]); + await model.create({ + tenantId: 'a', + children: subDocs.map(doc => doc._id), + }); + const docs = await model + .byTenant('a') + .find() + .populate({path: 'children', options: {sort: {tenant_id: 1}}}); + const objects = docs.map(doc => doc.toObject()); + + expect(objects).toHaveLength(1); + expect(objects[0].children).toHaveLength(1); + expect(objects[0]).toMatchObject({ + tenantId: 'a', + children: [ + { + tenant_id: 'a', + }, + ], + }); + expect(dimensionInterface(docs[0].children[0]).has('tenant')).toBe( + true + ); }); }); describe('where sub schema has different tenant level', () => { - it('should not pass down tenant context on Model.find().populate()', async () => { + it('should not pass down dimension context on Model.find().populate()', async () => { const {model: subModel} = buildModel( {}, { - tenantIdKey: 'dimension', - tenantIdGetter: 'getDimension', + dimension: 'dimension', + dimensionIdKey: 'dimension', + dimensionIdGetter: 'getDimension', accessorMethod: 'byDimension', } ); @@ -1038,8 +1096,12 @@ describe('plugin', () => { }, ], }); - expect(docs[0].children[0].hasTenantContext).toBeUndefined(); - expect(docs[0].children[1].hasTenantContext).toBeUndefined(); + expect(dimensionInterface(docs[0].children[0]).has('tenant')).toBe( + false + ); + expect(dimensionInterface(docs[0].children[1]).has('tenant')).toBe( + false + ); }); }); }); @@ -1080,5 +1142,47 @@ describe('plugin', () => { }); }); }); + + describe('when applied multiple times on single schema', () => { + describe('with different dimensions', () => { + let schema; + let model; + + beforeEach(async () => { + schema = new Schema({}); + schema.plugin(plugin, { + dimension: 'x', + dimensionIdType: Number, + dimensionIdKey: 'x', + }); + schema.plugin(plugin, { + dimension: 'y', + dimensionIdType: Number, + dimensionIdKey: 'y', + }); + model = mongoose.model('model', schema); + + await model.create([{x: 1, y: 1}, {x: 1, y: 2}, {x: 2, y: 2}]); + }); + + it('filters by first dimensions', async () => { + const docs = await model.byX(1).find(); + expect(docs).toHaveLength(2); + }); + + it('filters by second dimensions', async () => { + const docs = await model.byY(1).find(); + expect(docs).toHaveLength(1); + }); + + it('filters by multiple dimensions', async () => { + const docs = await model + .byX(1) + .byY(2) + .find(); + expect(docs).toHaveLength(1); + }); + }); + }); }); }); diff --git a/src/middleware/document/add-dimension-id.js b/src/middleware/document/add-dimension-id.js new file mode 100644 index 0000000..3be90d1 --- /dev/null +++ b/src/middleware/document/add-dimension-id.js @@ -0,0 +1,12 @@ +const dimensionInterface = require('../../dimension-interface'); + +// we need to return `function () {}` here so injection of `this` works +// properly +module.exports = ({dimension, dimensionIdKey, dimensionIdGetter}) => + function(next) { + if (dimensionInterface(this.constructor).has(dimension)) { + this[dimensionIdKey] = this.constructor[dimensionIdGetter](); + } + + next(); + }; diff --git a/src/middleware/document/add-dimension-id.test.js b/src/middleware/document/add-dimension-id.test.js new file mode 100644 index 0000000..05ef22c --- /dev/null +++ b/src/middleware/document/add-dimension-id.test.js @@ -0,0 +1,52 @@ +const addTenantId = require('./add-dimension-id'); +const dimensionInterface = require('../../dimension-interface'); + +describe('add-dimension-id', () => { + const tenantId = '23'; + const dimension = 'tenant'; + const dimensionIdKey = 'tenantId'; + const dimensionIdGetter = 'getTenantId'; + const options = { + dimension, + dimensionIdKey, + dimensionIdGetter, + }; + const middleware = addTenantId(options); + + describe('builds a document middleware', () => { + describe('when called', () => { + it('calls back next', () => { + const next = jest.fn(); + middleware.call({}, next); + + expect(next).toHaveBeenCalled(); + }); + + describe('on model with dimension context', () => { + const Model = function() {}; + dimensionInterface(Model).add(dimension, options); + Model[dimensionIdGetter] = () => tenantId; + + it('modifies the subject', () => { + const entity = new Model(); + middleware.call(entity, () => {}); + + expect(entity).toHaveProperty(dimensionIdKey, tenantId); + }); + }); + + describe('on model without dimension context', () => { + const Model = function() {}; + + it("doesn't modify the subject", () => { + const entity = new Model(); + const snapshot = JSON.stringify(entity); + + middleware.call(entity, () => {}); + + expect(JSON.stringify(entity)).toBe(snapshot); + }); + }); + }); + }); +}); diff --git a/src/middleware/document/add-tenant-id.js b/src/middleware/document/add-tenant-id.js deleted file mode 100644 index dc2998b..0000000 --- a/src/middleware/document/add-tenant-id.js +++ /dev/null @@ -1,9 +0,0 @@ -// we need to return `function () {}` here so injection of `this` works -// properly -module.exports = ({tenantIdKey, tenantIdGetter}) => function (next) { - if (this.constructor.hasTenantContext) { - this[tenantIdKey] = this.constructor[tenantIdGetter](); - } - - next(); -}; diff --git a/src/middleware/document/add-tenant-id.test.js b/src/middleware/document/add-tenant-id.test.js deleted file mode 100644 index 272d8e3..0000000 --- a/src/middleware/document/add-tenant-id.test.js +++ /dev/null @@ -1,50 +0,0 @@ -const addTenantId = require('./add-tenant-id'); - -describe('add-tenant-id', () => { - const tenantId = '23'; - const tenantIdKey = 'tenantId'; - const tenantIdGetter = 'getTenantId'; - const options = { - tenantIdKey: 'tenantId', - tenantIdGetter: 'getTenantId', - }; - const middleware = addTenantId(options); - - describe('builds a document middleware', () => { - - describe('when called', () => { - it('calls back next', () => { - const next = jest.fn(); - middleware.call({}, next); - - expect(next).toHaveBeenCalled(); - }); - - describe('on schema with tenant context', () => { - const Schema = function () {}; - Schema.hasTenantContext = true; - Schema[tenantIdGetter] = () => tenantId; - - it('modifies the subject', () => { - const entity = new Schema(); - middleware.call(entity, () => {}); - - expect(entity).toHaveProperty(tenantIdKey, tenantId); - }); - }); - - describe('on schema without tenant context', () => { - const Schema = function () {}; - - it('doesn\'t modify the subject', () => { - const entity = new Schema(); - const snapshot = JSON.stringify(entity); - - middleware.call(entity, () => {}); - - expect(JSON.stringify(entity)).toBe(snapshot); - }); - }); - }); - }); -}); diff --git a/src/middleware/index.js b/src/middleware/index.js index 9261996..25b467d 100644 --- a/src/middleware/index.js +++ b/src/middleware/index.js @@ -1,18 +1,22 @@ -const buildAddTenantId = require('./document/add-tenant-id'); -const buildProtectAgainstTenantOverwrite = require('./query/protect-against-tenant-overwrite'); -const buildRestrictToTenant = require('./query/restrict-to-tenant'); +const buildAddDimensionId = require('./document/add-dimension-id'); +const buildProtectAgainstDimensionOverwrite = require('./query/protect-against-dimension-overwrite'); +const buildRestrictToDimension = require('./query/restrict-to-dimension'); const sanitizeOptions = require('../options'); /** - * Tenant middleware plugin + * Middleware plugin * @param {Mongoose.Schema} schema Schema to extend * @param {MongoTenantOptions} [options] Options (optional) */ const middleware = (schema, options) => { const sanitizedOptions = sanitizeOptions(options || {}); - const {tenantIdKey, tenantIdGetter} = sanitizedOptions; + const {dimension, dimensionIdKey, dimensionIdGetter} = sanitizedOptions; - const restrictToTenant = buildRestrictToTenant({tenantIdKey, tenantIdGetter}); + const restrictToDimension = buildRestrictToDimension({ + dimension, + dimensionIdKey, + dimensionIdGetter, + }); [ 'count', 'deleteMany', @@ -28,11 +32,12 @@ const middleware = (schema, options) => { 'update', 'updateOne', 'updateMany', - ].forEach(operation => schema.pre(operation, restrictToTenant)); + ].forEach(operation => schema.pre(operation, restrictToDimension)); - const protectedAgainstOverwrite = buildProtectAgainstTenantOverwrite({ - tenantIdKey, - tenantIdGetter, + const protectedAgainstOverwrite = buildProtectAgainstDimensionOverwrite({ + dimension, + dimensionIdKey, + dimensionIdGetter, }); [ 'findOneAndReplace', @@ -44,10 +49,13 @@ const middleware = (schema, options) => { ].forEach(operation => schema.pre(operation, protectedAgainstOverwrite)); // First `save` pre hook fired will be the mongoose default validation plugin. - // So if we add `tenantId` on a subsequent `save` pre hook the validation will - // always fail (given `tenantId` is required but not set). So we have to - // ensure right `tenantId` on validate. - schema.pre('validate', buildAddTenantId({tenantIdKey, tenantIdGetter})); + // So if we add `dimension id on a subsequent `save` pre hook the validation + // will always fail (given dimension id is required but not set). So we have + // to ensure right dimension id on validate. + schema.pre( + 'validate', + buildAddDimensionId({dimension, dimensionIdKey, dimensionIdGetter}) + ); }; module.exports = middleware; diff --git a/src/middleware/query/protect-against-dimension-overwrite.js b/src/middleware/query/protect-against-dimension-overwrite.js new file mode 100644 index 0000000..9c331c9 --- /dev/null +++ b/src/middleware/query/protect-against-dimension-overwrite.js @@ -0,0 +1,32 @@ +const dimensionInterface = require('../../dimension-interface'); + +const replacementOperations = ['findOneAndReplace', 'replaceOne']; +const isReplacementOperation = value => replacementOperations.includes(value); + +module.exports = ({dimension, dimensionIdKey, dimensionIdGetter}) => + function(next) { + if (dimensionInterface(this.model).has(dimension)) { + const dimensionId = this.model[dimensionIdGetter](); + + // avoid jumping dimension context when overwriting a model. + if ( + dimensionIdKey in this._update || + this.options.overwrite || + isReplacementOperation(this.op) + ) { + this._update[dimensionIdKey] = dimensionId; + } + + // avoid jumping dimension context from $set operations + const $set = this._update.$set; + if ( + $set && + dimensionIdKey in $set && + $set[dimensionIdKey] !== dimensionId + ) { + $set[dimensionIdKey] = dimensionId; + } + } + + next(); + }; diff --git a/src/middleware/query/protect-against-dimension-overwrite.test.js b/src/middleware/query/protect-against-dimension-overwrite.test.js new file mode 100644 index 0000000..f28d21e --- /dev/null +++ b/src/middleware/query/protect-against-dimension-overwrite.test.js @@ -0,0 +1,135 @@ +const dimensionInterface = require('../../dimension-interface'); +const protectAgainstDimensionOverwrite = require('./protect-against-dimension-overwrite'); + +const buildQuery = ({ + dimension, + dimensionId, + dimensionIdKey, + dimensionIdGetter, + dimensionIdUpdateValue, + isOverwrite = false, +}) => { + const model = {}; + if (dimension) { + dimensionInterface(model).add(dimension, { + dimension, + dimensionIdKey, + dimensionIdGetter, + }); + model[dimensionIdGetter] = () => dimensionId; + } + + return { + _update: dimensionIdUpdateValue + ? {[dimensionIdKey]: dimensionIdUpdateValue} + : {}, + options: { + overwrite: isOverwrite, + }, + model, + }; +}; + +describe('protect-against-dimension-overwrite', () => { + describe('builds a query middleware', () => { + const dimension = 'tenant'; + const dimensionId = '23'; + const dimensionIdKey = 'tenantId'; + const dimensionIdGetter = 'getTenantId'; + const options = { + dimension, + dimensionIdKey, + dimensionIdGetter, + }; + const middleware = protectAgainstDimensionOverwrite(options); + + let query; + beforeEach(() => { + query = buildQuery({ + dimension: 'tenant', + dimensionId, + dimensionIdKey, + dimensionIdGetter, + }); + }); + + describe('when called', () => { + it('calls back next', () => { + const next = jest.fn(); + middleware.call(query, next); + + expect(next).toHaveBeenCalled(); + }); + + describe('on schema with dimension context', () => { + it('leaves query untouched when dimensionId is not part of change', () => { + const query = buildQuery({hasTenantContext: false}); + const snapshot = JSON.stringify(query); + middleware.call(query, () => {}); + expect(JSON.stringify(query)).toBe(snapshot); + }); + + it('leaves query untouched when dimensionId is part of change but has same value', () => { + const query = buildQuery({hasTenantContext: false}); + const snapshot = JSON.stringify(query); + middleware.call(query, () => {}); + expect(JSON.stringify(query)).toBe(snapshot); + }); + + it('updates dimensionId value if it is part of change with different value', () => { + query = buildQuery({ + dimension: 'tenant', + dimensionId, + dimensionIdKey, + dimensionIdGetter, + dimensionIdUpdateValue: '42', + }); + middleware.call(query, () => {}); + expect(query).toHaveProperty( + `_update.${dimensionIdKey}`, + dimensionId + ); + }); + + it('updates dimensionId value if it is part of change with different value ($set)', () => { + query = buildQuery({ + dimension: 'tenant', + dimensionId, + dimensionIdKey, + dimensionIdGetter, + }); + query._update.$set = {[dimensionIdKey]: '42'}; + middleware.call(query, () => {}); + expect(query).toHaveProperty( + `_update.$set.${dimensionIdKey}`, + dimensionId + ); + }); + + it('sets dimensionId value if it is missing in an overwrite', () => { + query = buildQuery({ + dimension: 'tenant', + dimensionId, + dimensionIdKey, + dimensionIdGetter, + isOverwrite: true, + }); + middleware.call(query, () => {}); + expect(query).toHaveProperty( + `_update.${dimensionIdKey}`, + dimensionId + ); + }); + }); + + describe('on schema without dimension context', () => { + it("doesn't modifies the query", () => { + const query = buildQuery({hasTenantContext: false}); + const snapshot = JSON.stringify(query); + middleware.call(query, () => {}); + expect(JSON.stringify(query)).toBe(snapshot); + }); + }); + }); + }); +}); diff --git a/src/middleware/query/protect-against-tenant-overwrite.js b/src/middleware/query/protect-against-tenant-overwrite.js deleted file mode 100644 index 30747f4..0000000 --- a/src/middleware/query/protect-against-tenant-overwrite.js +++ /dev/null @@ -1,26 +0,0 @@ -const replacementOperations = ['findOneAndReplace', 'replaceOne']; -const isReplacementOperation = value => replacementOperations.includes(value); - -module.exports = ({tenantIdKey, tenantIdGetter}) => - function(next) { - if (this.model.hasTenantContext) { - const tenantId = this.model[tenantIdGetter](); - - // avoid jumping tenant context when overwriting a model. - if ( - tenantIdKey in this._update || - this.options.overwrite || - isReplacementOperation(this.op) - ) { - this._update[tenantIdKey] = tenantId; - } - - // avoid jumping tenant context from $set operations - const $set = this._update.$set; - if ($set && tenantIdKey in $set && $set[tenantIdKey] !== tenantId) { - $set[tenantIdKey] = tenantId; - } - } - - next(); - }; diff --git a/src/middleware/query/protect-against-tenant-overwrite.test.js b/src/middleware/query/protect-against-tenant-overwrite.test.js deleted file mode 100644 index c8f2db3..0000000 --- a/src/middleware/query/protect-against-tenant-overwrite.test.js +++ /dev/null @@ -1,99 +0,0 @@ -const protectAgainstTenantOverwrite = require('./protect-against-tenant-overwrite'); - -const buildQuery = ({ - hasTenantContext, - tenantId, - tenantIdKey, - tenantIdGetter, - tenantIdUpdateValue, - isOverwrite = false -}) => ({ - _update: tenantIdUpdateValue - ? { [tenantIdKey]: tenantIdUpdateValue } - : {}, - options: { - overwrite: isOverwrite - }, - model: hasTenantContext - ? { - hasTenantContext, - [tenantIdGetter]: () => tenantId, - } - : {} -}); - -describe('protect-against-tenant-overwrite', () => { - describe('builds a query middleware', () => { - const tenantId = '23'; - const tenantIdKey = 'tenantId'; - const tenantIdGetter = 'getTenantId'; - const options = { - tenantIdKey: 'tenantId', - tenantIdGetter: 'getTenantId', - }; - const middleware = protectAgainstTenantOverwrite(options); - - let query; - beforeEach(() => { - query = buildQuery({ - hasTenantContext: true, - tenantId, - tenantIdKey, - tenantIdGetter, - }); - }); - - describe('when called', () => { - it('calls back next', () => { - const next = jest.fn(); - middleware.call(query, next); - - expect(next).toHaveBeenCalled(); - }); - - describe('on schema with tenant context', () => { - it('leaves query untouched when tenantId is not part of change', () => { - const query = buildQuery({hasTenantContext: false}); - const snapshot = JSON.stringify(query); - middleware.call(query, () => {}); - expect(JSON.stringify(query)).toBe(snapshot); - }); - - it('leaves query untouched when tenantId is part of change but has same value', () => { - const query = buildQuery({hasTenantContext: false}); - const snapshot = JSON.stringify(query); - middleware.call(query, () => {}); - expect(JSON.stringify(query)).toBe(snapshot); - }); - - it('updates tenantId value if it is part of change with different value', () => { - query = buildQuery({hasTenantContext: true, tenantId, tenantIdKey, tenantIdGetter, tenantIdUpdateValue: '42'}); - middleware.call(query, () => {}); - expect(query).toHaveProperty(`_update.${tenantIdKey}`, tenantId); - }); - - it('updates tenantId value if it is part of change with different value ($set)', () => { - query = buildQuery({hasTenantContext: true, tenantId, tenantIdKey, tenantIdGetter}); - query._update.$set = { [tenantIdKey]: '42' }; - middleware.call(query, () => {}); - expect(query).toHaveProperty(`_update.$set.${tenantIdKey}`, tenantId); - }); - - it('sets tenantId value if it is missing in an overwrite', () => { - query = buildQuery({hasTenantContext: true, tenantId, tenantIdKey, tenantIdGetter, isOverwrite: true}); - middleware.call(query, () => {}); - expect(query).toHaveProperty(`_update.${tenantIdKey}`, tenantId); - }); - }); - - describe('on schema without tenant context', () => { - it('doesn\'t modifies the query', () => { - const query = buildQuery({hasTenantContext: false}); - const snapshot = JSON.stringify(query); - middleware.call(query, () => {}); - expect(JSON.stringify(query)).toBe(snapshot); - }); - }); - }); - }); -}); diff --git a/src/middleware/query/restrict-to-dimension.js b/src/middleware/query/restrict-to-dimension.js new file mode 100644 index 0000000..a07462c --- /dev/null +++ b/src/middleware/query/restrict-to-dimension.js @@ -0,0 +1,10 @@ +const dimensionInterface = require('../../dimension-interface'); + +module.exports = ({dimension, dimensionIdKey, dimensionIdGetter}) => + function(next) { + if (dimensionInterface(this.model).has(dimension)) { + this._conditions[dimensionIdKey] = this.model[dimensionIdGetter](); + } + + next(); + }; diff --git a/src/middleware/query/restrict-to-dimension.test.js b/src/middleware/query/restrict-to-dimension.test.js new file mode 100644 index 0000000..5acd47a --- /dev/null +++ b/src/middleware/query/restrict-to-dimension.test.js @@ -0,0 +1,66 @@ +const dimensionInterface = require('../../dimension-interface'); +const restrictToDimension = require('./restrict-to-dimension'); + +const buildQuery = ({dimension, dimensionId, dimensionIdGetter}) => { + const model = {}; + if (dimension) { + model[dimensionIdGetter] = () => dimensionId; + dimensionInterface(model).add(dimension, {dimension, dimensionIdGetter}); + } + return { + _conditions: {}, + model, + }; +}; + +describe('restrict-to-dimension', () => { + describe('builds a query middleware', () => { + const dimension = 'tenant'; + const dimensionId = '23'; + const dimensionIdKey = 'tenantId'; + const dimensionIdGetter = 'getTenantId'; + const options = { + dimension, + dimensionIdKey, + dimensionIdGetter, + }; + const middleware = restrictToDimension(options); + + let query; + beforeEach(() => { + query = buildQuery({ + dimension, + dimensionIdGetter, + dimensionId, + }); + }); + + describe('when called', () => { + it('calls back next', () => { + const next = jest.fn(); + middleware.call(query, next); + + expect(next).toHaveBeenCalled(); + }); + + describe('on schema with dimension context', () => { + it('adds the tenant id to the query conditions', () => { + middleware.call(query, () => {}); + expect(query).toHaveProperty( + `_conditions.${dimensionIdKey}`, + dimensionId + ); + }); + }); + + describe('on schema without dimension context', () => { + it("doesn't modifies the query", () => { + const query = buildQuery({hasTenantContext: false}); + const snapshot = JSON.stringify(query); + middleware.call(query, () => {}); + expect(JSON.stringify(query)).toBe(snapshot); + }); + }); + }); + }); +}); diff --git a/src/middleware/query/restrict-to-tenant.js b/src/middleware/query/restrict-to-tenant.js deleted file mode 100644 index 3d6fb02..0000000 --- a/src/middleware/query/restrict-to-tenant.js +++ /dev/null @@ -1,8 +0,0 @@ -module.exports = ({tenantIdKey, tenantIdGetter}) => - function(next) { - if (this.model.hasTenantContext) { - this._conditions[tenantIdKey] = this.model[tenantIdGetter](); - } - - next(); - }; diff --git a/src/middleware/query/restrict-to-tenant.test.js b/src/middleware/query/restrict-to-tenant.test.js deleted file mode 100644 index 95a2d21..0000000 --- a/src/middleware/query/restrict-to-tenant.test.js +++ /dev/null @@ -1,58 +0,0 @@ -const restrictToTenant = require('./restrict-to-tenant'); - -const buildQuery = ({hasTenantContext, tenantIdGetter, tenantId}) => ({ - _conditions: {}, - model: hasTenantContext - ? { - hasTenantContext, - [tenantIdGetter]: () => tenantId, - } - : {} -}); - -describe('restrict-to-tenant', () => { - describe('builds a query middleware', () => { - const tenantId = '23'; - const tenantIdKey = 'tenantId'; - const tenantIdGetter = 'getTenantId'; - const options = { - tenantIdKey: 'tenantId', - tenantIdGetter: 'getTenantId', - }; - const middleware = restrictToTenant(options); - - let query; - beforeEach(() => { - query = buildQuery({ - hasTenantContext: true, - tenantIdGetter, - tenantId - }); - }); - - describe('when called', () => { - it('calls back next', () => { - const next = jest.fn(); - middleware.call(query, next); - - expect(next).toHaveBeenCalled(); - }); - - describe('on schema with tenant context', () => { - it('adds the tenant id to the query conditions', () => { - middleware.call(query, () => {}); - expect(query).toHaveProperty(`_conditions.${tenantIdKey}`, tenantId); - }); - }); - - describe('on schema without tenant context', () => { - it('doesn\'t modifies the query', () => { - const query = buildQuery({hasTenantContext: false}); - const snapshot = JSON.stringify(query); - middleware.call(query, () => {}); - expect(JSON.stringify(query)).toBe(snapshot); - }); - }); - }); - }); -}); diff --git a/src/options.js b/src/options.js index bd8cd28..b604584 100644 --- a/src/options.js +++ b/src/options.js @@ -1,29 +1,52 @@ +const fcToUpper = val => + val.length > 1 + ? val.substring(0, 1).toUpperCase() + val.substring(1) + : val.toUpperCase(); + /** * @typedef MongoTenantOptions - * @property {string} tenantIdGetter + * @property {string} dimension + * @property {string} dimensionIdGetter * @property {string} accessorMethod - * @property {*} tenantIdType - * @property {string} tenantIdKey - * @property {boolean} requireTenantId + * @property {*} dimensionIdType + * @property {string} dimensionIdKey + * @property {boolean} requireDimensionId */ /** * Sanitize plugin options * @param {object} [input] - * @param {string} [input.tenantIdGetter=tenantId] + * @param {string} [input.dimension=tenant] + * @param {string} [input.dimensionIdGetter=tenantId] * @param {string} [input.accessorMethod=byTenant] - * @param {*} [input.tenantIdType=byTenant] - * @param {string} [input.tenantIdKey=getTenantId] - * @param {string} [input.requireTenantId=true] + * @param {*} [input.dimensionIdType=byTenant] + * @param {string} [input.dimensionIdKey=getTenantId] + * @param {boolean} [input.requireDimensionId=true] + * @param {string} [input.tenantIdKey] Legacy key for dimensionIdGetter (deprecated) + * @param {string} [input.tenantIdType] Legacy key for dimensionIdType (deprecated) + * @param {string} [input.tenantIdGetter] Legacy key for dimensionIdKey (deprecated) + * @param {boolean} [input.requireTenantId] Legacy key for requireDimensionId (deprecated) * @returns {MongoTenantOptions} */ -const options = (input = {}) => ({ - tenantIdKey: input.tenantIdKey || 'tenantId', - tenantIdType: input.tenantIdType || String, - accessorMethod: input.accessorMethod || 'byTenant', - tenantIdGetter: input.tenantIdGetter || 'getTenantId', - requireTenantId: - input.requireTenantId === undefined ? true : input.requireTenantId && true, -}); +const options = (input = {}) => { + const dimension = input.dimension || 'tenant'; + return { + dimension, + dimensionIdKey: + input.dimensionIdKey || input.tenantIdKey || `${dimension}Id`, + dimensionIdType: input.dimensionIdType || input.tenantIdType || String, + accessorMethod: input.accessorMethod || `by${fcToUpper(dimension)}`, + dimensionIdGetter: + input.dimensionIdGetter || + input.tenantIdGetter || + `get${fcToUpper(dimension)}Id`, + requireDimensionId: + input.requireDimensionId !== undefined + ? input.requireDimensionId && true + : input.requireTenantId !== undefined + ? input.requireTenantId && true + : true, + }; +}; module.exports = options; diff --git a/src/options.test.js b/src/options.test.js index 6081339..8e9e20e 100644 --- a/src/options.test.js +++ b/src/options.test.js @@ -1,21 +1,46 @@ const options = require('./options'); describe('options', () => { - const assertCompleteOptions = (value) => { - expect(value).toHaveProperty('tenantIdKey'); - expect(value).toHaveProperty('tenantIdType'); + const expectCompleteOptions = value => { + expect(value).toHaveProperty('dimensionIdKey'); + expect(value).toHaveProperty('dimensionIdType'); expect(value).toHaveProperty('accessorMethod'); - expect(value).toHaveProperty('tenantIdGetter'); - expect(value).toHaveProperty('requireTenantId'); + expect(value).toHaveProperty('dimensionIdGetter'); + expect(value).toHaveProperty('requireDimensionId'); }; it('creates default options', () => { const result = options(); - assertCompleteOptions(result); + expectCompleteOptions(result); }); it('adds default option values', () => { - const result = options({tenantIdKey: 'tenant_id'}); - assertCompleteOptions(result); + const result = options({dimensionIdKey: 'tenant_id'}); + expectCompleteOptions(result); + }); + + it('customizes default values depending on dimension', () => { + const result = options({dimension: 'customer'}); + expectCompleteOptions(result); + expect(result).toMatchObject({ + dimensionIdKey: 'customerId', + accessorMethod: 'byCustomer', + dimensionIdGetter: 'getCustomerId', + }); + }); + + it('handles legacy options', () => { + const result = options({ + tenantIdKey: 'tenant_id', + tenantIdType: Number, + tenantIdGetter: 'get_tenant_id', + requireTenantId: false, + }); + expect(result).toMatchObject({ + dimensionIdKey: 'tenant_id', + dimensionIdType: Number, + dimensionIdGetter: 'get_tenant_id', + requireDimensionId: false, + }); }); }); diff --git a/src/schema/add-tenant-id-field.js b/src/schema/add-dimension-id-field.js similarity index 100% rename from src/schema/add-tenant-id-field.js rename to src/schema/add-dimension-id-field.js diff --git a/src/schema/add-tenant-id-field.test.js b/src/schema/add-dimension-id-field.test.js similarity index 87% rename from src/schema/add-tenant-id-field.test.js rename to src/schema/add-dimension-id-field.test.js index 6c39ed8..7da8937 100644 --- a/src/schema/add-tenant-id-field.test.js +++ b/src/schema/add-dimension-id-field.test.js @@ -1,4 +1,4 @@ -const addTenantIdField = require('./add-tenant-id-field'); +const addTenantIdField = require('./add-dimension-id-field'); describe('add-tenant-id-field', () => { describe('when called with valid parameters', () => { diff --git a/src/schema/compound-indexes.js b/src/schema/compound-indexes.js index d884791..dd4f879 100644 --- a/src/schema/compound-indexes.js +++ b/src/schema/compound-indexes.js @@ -1,22 +1,22 @@ /** - * Apply tenancy awareness to schema level unique indexes + * Apply dimension awareness to schema level unique indexes * @param {object} schema - * @param {string} tenantIdKey + * @param {string} dimensionIdKey */ -const compoundSchemaLevelUniqueIndexes = ({schema, tenantIdKey}) => { +const compoundSchemaLevelUniqueIndexes = ({schema, dimensionIdKey}) => { schema._indexes.forEach(index => { - // extend uniqueness of indexes by tenant id field - // skip if perserveUniqueKey of the index is set to true + // extend uniqueness of indexes by dimension id field + // skip if preserveUniqueKey of the index is set to true if (index[1].unique === true && index[1].preserveUniqueKey !== true) { - const tenantAwareIndex = { - [tenantIdKey]: 1, + const dimensionAwareIndex = { + [dimensionIdKey]: 1, }; for (let indexedField in index[0]) { - tenantAwareIndex[indexedField] = index[0][indexedField]; + dimensionAwareIndex[indexedField] = index[0][indexedField]; } - index[0] = tenantAwareIndex; + index[0] = dimensionAwareIndex; } // remove preserveUniqueKey field to avoid confusing mongodb 3.x delete index[1].preserveUniqueKey; @@ -46,9 +46,9 @@ const removeFieldLevelIndex = path => { /** * Apply tenancy awareness to field level unique indexes * @param {object} schema - * @param {string} tenantIdKey + * @param {string} dimensionIdKey */ -const compoundFieldLevelUniqueIndexes = ({schema, tenantIdKey}) => { +const compoundFieldLevelUniqueIndexes = ({schema, dimensionIdKey}) => { schema.eachPath((key, path) => { const pathOptions = path.options; const indexOptions = path._index; @@ -63,10 +63,10 @@ const compoundFieldLevelUniqueIndexes = ({schema, tenantIdKey}) => { unique: true, }; - // create a new one that includes the tenant id field + // create a new one that includes the dimension id field schema.index( { - [tenantIdKey]: 1, + [dimensionIdKey]: 1, [key]: 1, }, schemaIndexOptions @@ -77,7 +77,7 @@ const compoundFieldLevelUniqueIndexes = ({schema, tenantIdKey}) => { }); }; -module.exports = ({schema, tenantIdKey}) => { - compoundSchemaLevelUniqueIndexes({schema, tenantIdKey}); - compoundFieldLevelUniqueIndexes({schema, tenantIdKey}); +module.exports = ({schema, dimensionIdKey}) => { + compoundSchemaLevelUniqueIndexes({schema, dimensionIdKey}); + compoundFieldLevelUniqueIndexes({schema, dimensionIdKey}); }; diff --git a/src/schema/compound-indexes.test.js b/src/schema/compound-indexes.test.js index 38b9b54..89e10b4 100644 --- a/src/schema/compound-indexes.test.js +++ b/src/schema/compound-indexes.test.js @@ -3,7 +3,7 @@ const {Schema} = require('mongoose'); describe('compound-indexes', () => { describe('when called with valid parameters', () => { - const tenantIdKey = 'tenantId'; + const dimensionIdKey = 'tenantId'; describe('where schema has schema level index', () => { let schema; @@ -17,9 +17,9 @@ describe('compound-indexes', () => { describe('with unique key preservation disabled', () => { it('compounds the index', () => { schema.index({id: 1}, {unique: true, preserveUniqueKey: false}); - compoundIndexes({schema, tenantIdKey}); + compoundIndexes({schema, dimensionIdKey}); expect(schema.indexes()).toEqual([ - [{id: 1, [tenantIdKey]: 1}, {unique: true, background: true}], + [{id: 1, [dimensionIdKey]: 1}, {unique: true, background: true}], ]); }); }); @@ -27,7 +27,7 @@ describe('compound-indexes', () => { describe('with unique key preservation enabled', () => { it('does NOT compound the index', () => { schema.index({id: 1}, {unique: true, preserveUniqueKey: true}); - compoundIndexes({schema, tenantIdKey}); + compoundIndexes({schema, dimensionIdKey}); expect(schema.indexes()).toEqual([ [{id: 1}, {unique: true, background: true}], ]); @@ -38,7 +38,7 @@ describe('compound-indexes', () => { describe('and index is NOT unique', () => { it('does NOT compounds the index', () => { schema.index({id: 1}); - compoundIndexes({schema, tenantIdKey}); + compoundIndexes({schema, dimensionIdKey}); expect(schema.indexes()).toEqual([[{id: 1}, {background: true}]]); }); }); @@ -55,9 +55,9 @@ describe('compound-indexes', () => { preserveUniqueKey: false, }, }); - compoundIndexes({schema, tenantIdKey}); + compoundIndexes({schema, dimensionIdKey}); expect(schema.indexes()).toEqual([ - [{id: 1, [tenantIdKey]: 1}, {unique: true, background: true}], + [{id: 1, [dimensionIdKey]: 1}, {unique: true, background: true}], ]); }); @@ -73,10 +73,10 @@ describe('compound-indexes', () => { preserveUniqueKey: false, }, }); - compoundIndexes({schema, tenantIdKey}); + compoundIndexes({schema, dimensionIdKey}); expect(schema.indexes()).toMatchObject([ [ - {id: 1, [tenantIdKey]: 1}, + {id: 1, [dimensionIdKey]: 1}, { unique: true, sparse: true, @@ -96,7 +96,7 @@ describe('compound-indexes', () => { preserveUniqueKey: true, }, }); - compoundIndexes({schema, tenantIdKey}); + compoundIndexes({schema, dimensionIdKey}); expect(schema.indexes()).toEqual([ [{id: 1}, {unique: true, background: true}], ]); @@ -111,7 +111,7 @@ describe('compound-indexes', () => { index: true, }, }); - compoundIndexes({schema, tenantIdKey}); + compoundIndexes({schema, dimensionIdKey}); expect(schema.indexes()).toEqual([[{id: 1}, {background: true}]]); }); }); diff --git a/src/schema/index.js b/src/schema/index.js index 9e601fa..dd883dc 100644 --- a/src/schema/index.js +++ b/src/schema/index.js @@ -1,22 +1,26 @@ -const addTenantIdField = require('./add-tenant-id-field'); +const addDimensionIdField = require('./add-dimension-id-field'); const compoundIndexes = require('./compound-indexes'); const sanitizeOptions = require('../options'); /** - * Tenant middleware plugin + * Schema plugin * @param {Mongoose.Schema} schema Schema to extend * @param {MongoTenantOptions} [options] Options (optional) */ const schema = (schema, options) => { const sanitizedOptions = sanitizeOptions(options || {}); - const {tenantIdKey, tenantIdType, requireTenantId} = sanitizedOptions; - addTenantIdField({ + const { + dimensionIdKey, + dimensionIdType, + requireDimensionId, + } = sanitizedOptions; + addDimensionIdField({ schema, - key: tenantIdKey, - type: tenantIdType, - required: requireTenantId, + key: dimensionIdKey, + type: dimensionIdType, + required: requireDimensionId, }); - compoundIndexes({schema, tenantIdKey}); + compoundIndexes({schema, dimensionIdKey}); }; module.exports = schema; diff --git a/src/symbol-dimensions.js b/src/symbol-dimensions.js new file mode 100644 index 0000000..bc3f250 --- /dev/null +++ b/src/symbol-dimensions.js @@ -0,0 +1 @@ +module.exports = Symbol.for('com.realmq.node-mongo-tenant.dimensions'); From b65f0e7db06f443f29efe58c65c6f5ca5c737bf6 Mon Sep 17 00:00:00 2001 From: baranga Date: Wed, 3 Jul 2019 13:10:14 +0200 Subject: [PATCH 59/61] Implement simple collection separation by dimensio --- src/api/dimension-aware-model/index.js | 46 ++++++++++++++++++++++++ src/index.test.integration.js | 48 ++++++++++++++++++++++++++ src/options.js | 2 ++ 3 files changed, 96 insertions(+) diff --git a/src/api/dimension-aware-model/index.js b/src/api/dimension-aware-model/index.js index 1fa19a2..0d715c8 100644 --- a/src/api/dimension-aware-model/index.js +++ b/src/api/dimension-aware-model/index.js @@ -4,6 +4,8 @@ const modifyBulkWriteOpertations = require('./modify-bulk-write-operations'); const parseAggregateArguments = require('./parse-aggregate-arguments'); const symbolDimensions = require('../../symbol-dimensions'); +const symbolMongooseModelCollection = Symbol.for('mongoose#Model#collection'); + const createPlainModel = ({ base, db, @@ -155,6 +157,48 @@ const createDiscriminatorModels = ({model, base, createModel}) => { ); }; +/** + * + * @param {Mongoose.Model} base + * @param {*} dimensionId + * @param {MongoTenantOptions} options + */ +const renderCollectionName = ({base, dimensionId, options}) => { + const {collection, dimension, dimensionIdKey} = options; + if (typeof collection === 'function') { + const provider = collection; + const rendered = provider({ + model: base, + dimension, + dimensionId, + }); + if (typeof rendered !== 'string') { + throw new Error( + 'MongoTenant: collection provider return invalid collection name' + ); + } + return rendered; + } + if (typeof collection === 'string') { + return collection.split(`{{${dimensionIdKey}}}`).join(dimensionId); + } + return base.collection; +}; + +const adjustCollection = ({base, model, dimensionId, options}) => { + const name = renderCollectionName({base, dimensionId, options}); + if (name === base.collection.name) { + return; + } + + const adjustedCollection = base.collection.conn.collection( + name, + base.collection.ops + ); + model.prototype.collection = adjustedCollection; + model.prototype[symbolMongooseModelCollection] = adjustedCollection; +}; + /** * * @param {Mongoose.Model} base @@ -176,6 +220,8 @@ const createModel = ({base, db, dimensionId, options, createModel}) => { dimensionIdKey, }); + adjustCollection({base, model, dimensionId, options}); + dimensionInterface(model).add(dimension, {...options, dimensionId}); inheritOtherStatics({model, base}); createDiscriminatorModels({model, base, createModel}); diff --git a/src/index.test.integration.js b/src/index.test.integration.js index 2d8ba66..ef5e803 100644 --- a/src/index.test.integration.js +++ b/src/index.test.integration.js @@ -1184,5 +1184,53 @@ describe('plugin', () => { }); }); }); + + describe('configured for dimension based collection separation', () => { + describe('by dimension level collection template', () => { + it('uses different collections', async () => { + const schema = new Schema({t: Number}); + schema.plugin(plugin, {collection: 'models:{{tenantId}}'}); + const model = mongoose.model('model', schema); + + await Promise.all([ + model.byTenant('a').create({t: 1}), + model.byTenant('b').create({t: 2}), + ]); + + const client = await MongoClient.connect(MONGO_URI); + const db = client.db(); + const collections = await db.collections(); + const collectionNames = collections + .map(c => c.collectionName) + .filter(n => n.startsWith('system.') === false) + .sort((a, b) => a.localeCompare(b)); + + expect(collectionNames).toEqual(['models', 'models:a', 'models:b']); + }); + }); + + describe('by dimension level collection provider', () => { + it('uses different collections', async () => { + const schema = new Schema({t: Number}); + schema.plugin(plugin, {collection: 'models:{{tenantId}}'}); + const model = mongoose.model('model', schema); + + await Promise.all([ + model.byTenant('a').create({t: 1}), + model.byTenant('b').create({t: 2}), + ]); + + const client = await MongoClient.connect(MONGO_URI); + const db = client.db(); + const collections = await db.collections(); + const collectionNames = collections + .map(c => c.collectionName) + .filter(n => n.startsWith('system.') === false) + .sort((a, b) => a.localeCompare(b)); + + expect(collectionNames).toEqual(['models', 'models:a', 'models:b']); + }); + }); + }); }); }); diff --git a/src/options.js b/src/options.js index b604584..bc77a7b 100644 --- a/src/options.js +++ b/src/options.js @@ -22,6 +22,7 @@ const fcToUpper = val => * @param {*} [input.dimensionIdType=byTenant] * @param {string} [input.dimensionIdKey=getTenantId] * @param {boolean} [input.requireDimensionId=true] + * @param {string|function} [input.collection] Pattern or provider to determine collection name * @param {string} [input.tenantIdKey] Legacy key for dimensionIdGetter (deprecated) * @param {string} [input.tenantIdType] Legacy key for dimensionIdType (deprecated) * @param {string} [input.tenantIdGetter] Legacy key for dimensionIdKey (deprecated) @@ -46,6 +47,7 @@ const options = (input = {}) => { : input.requireTenantId !== undefined ? input.requireTenantId && true : true, + collection: input.collection, }; }; From 86aac44a35337349ee882d437e63fe2f56fffcf7 Mon Sep 17 00:00:00 2001 From: baranga Date: Wed, 3 Jul 2019 14:46:18 +0200 Subject: [PATCH 60/61] Fix failing test --- src/api/dimension-aware-model/index.js | 2 +- src/api/dimension-aware-model/index.test.js | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/api/dimension-aware-model/index.js b/src/api/dimension-aware-model/index.js index 0d715c8..421f311 100644 --- a/src/api/dimension-aware-model/index.js +++ b/src/api/dimension-aware-model/index.js @@ -182,7 +182,7 @@ const renderCollectionName = ({base, dimensionId, options}) => { if (typeof collection === 'string') { return collection.split(`{{${dimensionIdKey}}}`).join(dimensionId); } - return base.collection; + return base.collection.name; }; const adjustCollection = ({base, model, dimensionId, options}) => { diff --git a/src/api/dimension-aware-model/index.test.js b/src/api/dimension-aware-model/index.test.js index bc02eb4..0704e39 100644 --- a/src/api/dimension-aware-model/index.test.js +++ b/src/api/dimension-aware-model/index.test.js @@ -17,6 +17,12 @@ describe('dimension-aware-model', () => { const buildBaseModel = () => { const base = class {}; base.db = {}; + base.collection = { + name: 'models', + conn: { + collection: () => ({}), + }, + }; return base; }; @@ -38,7 +44,7 @@ describe('dimension-aware-model', () => { it('builds discriminator models', () => { base.discriminators = { - test: class {}, + test: buildBaseModel(), }; model = dimensionAwareModel({ base, From 0da3fd1429724e0256b02e8b196e80c6631f4b1c Mon Sep 17 00:00:00 2001 From: baranga Date: Wed, 3 Jul 2019 14:46:32 +0200 Subject: [PATCH 61/61] Fix integration test --- src/index.test.integration.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/index.test.integration.js b/src/index.test.integration.js index ef5e803..3d000a4 100644 --- a/src/index.test.integration.js +++ b/src/index.test.integration.js @@ -1212,7 +1212,9 @@ describe('plugin', () => { describe('by dimension level collection provider', () => { it('uses different collections', async () => { const schema = new Schema({t: Number}); - schema.plugin(plugin, {collection: 'models:{{tenantId}}'}); + schema.plugin(plugin, { + collection: ({dimensionId}) => `models:${dimensionId}`, + }); const model = mongoose.model('model', schema); await Promise.all([