From 53cc563a5d3eb6e409eaa725f55568a2286fcfa6 Mon Sep 17 00:00:00 2001 From: Daniel Rinehart Date: Mon, 11 Sep 2017 12:34:09 -0400 Subject: [PATCH] remove depreacted code and bump version --- .gitignore | 9 +- CHANGELOG.md | 2 + package-lock.json | 1455 ------------------------- package.json | 14 +- src/index.ts | 9 - src/pubsub.ts | 4 +- src/subscriptions-manager.ts | 185 ---- src/test/asyncIteratorSubscription.ts | 27 +- src/test/tests.ts | 571 +--------- src/validation.ts | 43 - 10 files changed, 40 insertions(+), 2279 deletions(-) delete mode 100644 package-lock.json delete mode 100644 src/subscriptions-manager.ts delete mode 100644 src/validation.ts diff --git a/.gitignore b/.gitignore index 71db460..c053ea0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,10 @@ -node_modules .DS_Store -dist +.vscode coverage -typings +dist +node_modules npm-debug.log +package-lock.json +typings +yarn-error.log yarn.lock diff --git a/CHANGELOG.md b/CHANGELOG.md index 73d8fb3..4b76fe8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ # Changelog ### vNEXT +- BREAKING CHANGE: Removed deprecated code. +- BREAKING CHANGE: Minimum GraphQL version bumped to 0.11.X. ### 0.4.4 - Avoid infinite loop after the last consumer unsubscribes, [Issue #81](https://github.com/apollographql/graphql-subscriptions/issues/81) [PR #84](https://github.com/apollographql/graphql-subscriptions/pull/84) diff --git a/package-lock.json b/package-lock.json deleted file mode 100644 index 4adfb56..0000000 --- a/package-lock.json +++ /dev/null @@ -1,1455 +0,0 @@ -{ - "name": "graphql-subscriptions", - "version": "0.4.4", - "lockfileVersion": 1, - "dependencies": { - "@types/graphql": { - "version": "0.9.3", - "resolved": "https://registry.npmjs.org/@types/graphql/-/graphql-0.9.3.tgz", - "integrity": "sha512-+NlcRhAXQUWXnmKomiNR/5ELupOQ3N1Oz7EcUTO8P3nWDo8b2szwvaqelzE97h5N3MU27zrNLGDomJh85OlYnQ==" - }, - "@types/mocha": { - "version": "2.2.41", - "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-2.2.41.tgz", - "integrity": "sha1-4nzwgXFT658nE7LT9saPHhw8pgg=", - "dev": true - }, - "@types/node": { - "version": "7.0.33", - "resolved": "https://registry.npmjs.org/@types/node/-/node-7.0.33.tgz", - "integrity": "sha512-8fVvl6Yyk3jZvSYxRMS9/AmZJ5RXCOP9N4xSlykyBViVESu751pxHYTN14Embn1Fem78YwEHdC7p7KGQQpwunw==", - "dev": true - }, - "abbrev": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.0.9.tgz", - "integrity": "sha1-kbR5JYinc4wl813W9jdSovh3YTU=", - "dev": true - }, - "align-text": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/align-text/-/align-text-0.1.4.tgz", - "integrity": "sha1-DNkKVhCT810KmSVsIrcGlDP60Rc=", - "dev": true - }, - "amdefine": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.1.tgz", - "integrity": "sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU=", - "dev": true - }, - "ansi-regex": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", - "dev": true - }, - "ansi-styles": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", - "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", - "dev": true - }, - "append-transform": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/append-transform/-/append-transform-0.4.0.tgz", - "integrity": "sha1-126/jKlNJ24keja61EpLdKthGZE=", - "dev": true - }, - "argparse": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.9.tgz", - "integrity": "sha1-c9g7wmP4bpf4zE9rrhsOkKfSLIY=", - "dev": true - }, - "array-differ": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/array-differ/-/array-differ-1.0.0.tgz", - "integrity": "sha1-7/UuN1gknTO+QCuLuOVkuytdQDE=", - "dev": true - }, - "array-find-index": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/array-find-index/-/array-find-index-1.0.2.tgz", - "integrity": "sha1-3wEKoSh+Fku9pvlyOwqWoexBh6E=", - "dev": true - }, - "array-uniq": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.3.tgz", - "integrity": "sha1-r2rId6Jcx/dOBYiUdThY39sk/bY=", - "dev": true - }, - "assertion-error": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.0.2.tgz", - "integrity": "sha1-E8pRXYYgbaC6xm6DTdOX2HWBCUw=", - "dev": true - }, - "async": { - "version": "1.5.2", - "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", - "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=", - "dev": true - }, - "babel-code-frame": { - "version": "6.22.0", - "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.22.0.tgz", - "integrity": "sha1-AnYgvuVnqIwyVhV05/0IAdMxGOQ=", - "dev": true - }, - "babel-generator": { - "version": "6.25.0", - "resolved": "https://registry.npmjs.org/babel-generator/-/babel-generator-6.25.0.tgz", - "integrity": "sha1-M6GvcNXyiQrrRlpKd5PB32qeqfw=", - "dev": true - }, - "babel-messages": { - "version": "6.23.0", - "resolved": "https://registry.npmjs.org/babel-messages/-/babel-messages-6.23.0.tgz", - "integrity": "sha1-8830cDhYA1sqKVHG7F7fbGLyYw4=", - "dev": true - }, - "babel-runtime": { - "version": "6.23.0", - "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.23.0.tgz", - "integrity": "sha1-CpSJ8UTecO+zzkMArM2zKeL8VDs=", - "dev": true - }, - "babel-template": { - "version": "6.25.0", - "resolved": "https://registry.npmjs.org/babel-template/-/babel-template-6.25.0.tgz", - "integrity": "sha1-ZlJBFmt8KqTGGdceGSlpVSsQwHE=", - "dev": true - }, - "babel-traverse": { - "version": "6.25.0", - "resolved": "https://registry.npmjs.org/babel-traverse/-/babel-traverse-6.25.0.tgz", - "integrity": "sha1-IldJfi/NGbie3BPEyROB+VEklvE=", - "dev": true - }, - "babel-types": { - "version": "6.25.0", - "resolved": "https://registry.npmjs.org/babel-types/-/babel-types-6.25.0.tgz", - "integrity": "sha1-cK+ySNVmDl0Y+BHZHIMDtUE0oY4=", - "dev": true - }, - "babylon": { - "version": "6.17.4", - "resolved": "https://registry.npmjs.org/babylon/-/babylon-6.17.4.tgz", - "integrity": "sha512-kChlV+0SXkjE0vUn9OZ7pBMWRFd8uq3mZe8x1K6jhuNcAFAtEnjchFAqB+dYEXKyd+JpT6eppRR78QAr5gTsUw==", - "dev": true - }, - "balanced-match": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", - "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", - "dev": true - }, - "beeper": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/beeper/-/beeper-1.1.1.tgz", - "integrity": "sha1-5tXqjF2tABMEpwsiY4RH9pyy+Ak=", - "dev": true - }, - "brace-expansion": { - "version": "1.1.8", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.8.tgz", - "integrity": "sha1-wHshHHyVLsH479Uad+8NHTmQopI=", - "dev": true - }, - "browser-stdout": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.0.tgz", - "integrity": "sha1-81HTKWnTL6XXpVZxVCY9korjvR8=", - "dev": true - }, - "builtin-modules": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", - "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=", - "dev": true - }, - "camelcase": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-1.2.1.tgz", - "integrity": "sha1-m7UwTS4LVmmLLHWLCKPqqdqlijk=", - "dev": true, - "optional": true - }, - "camelcase-keys": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-2.1.0.tgz", - "integrity": "sha1-MIvur/3ygRkFHvodkyITyRuPkuc=", - "dev": true, - "dependencies": { - "camelcase": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-2.1.1.tgz", - "integrity": "sha1-fB0W1nmhu+WcoCys7PsBHiAfWh8=", - "dev": true - } - } - }, - "center-align": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/center-align/-/center-align-0.1.3.tgz", - "integrity": "sha1-qg0yYptu6XIgBBHL1EYckHvCt60=", - "dev": true, - "optional": true - }, - "chai": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/chai/-/chai-3.5.0.tgz", - "integrity": "sha1-TQJjewZ/6Vi9v906QOxW/vc3Mkc=", - "dev": true - }, - "chai-as-promised": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/chai-as-promised/-/chai-as-promised-6.0.0.tgz", - "integrity": "sha1-GgKkM6byTa+sY7nJb6FoTbGqjaY=", - "dev": true - }, - "chalk": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", - "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", - "dev": true - }, - "check-error": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", - "integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=", - "dev": true - }, - "cliui": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-2.1.0.tgz", - "integrity": "sha1-S0dXYP+AJkx2LDoXGQMukcf+oNE=", - "dev": true, - "optional": true, - "dependencies": { - "wordwrap": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.2.tgz", - "integrity": "sha1-t5Zpu0LstAn4PVg8rVLKF+qhZD8=", - "dev": true, - "optional": true - } - } - }, - "clone": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/clone/-/clone-1.0.2.tgz", - "integrity": "sha1-Jgt6meux7f4kdTgXX3gyQ8sZ0Uk=", - "dev": true - }, - "clone-stats": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/clone-stats/-/clone-stats-0.0.1.tgz", - "integrity": "sha1-uI+UqCzzi4eR1YBG6kAprYjKmdE=", - "dev": true - }, - "colors": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/colors/-/colors-1.1.2.tgz", - "integrity": "sha1-FopHAXVran9RoSzgyXv6KMCE7WM=", - "dev": true - }, - "commander": { - "version": "2.9.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.9.0.tgz", - "integrity": "sha1-nJkJQXbhIkDLItbFFGCYQA/g99Q=", - "dev": true - }, - "concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", - "dev": true - }, - "core-js": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.4.1.tgz", - "integrity": "sha1-TekR5mew6ukSTjQlS1OupvxhjT4=", - "dev": true - }, - "core-util-is": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", - "dev": true - }, - "currently-unhandled": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/currently-unhandled/-/currently-unhandled-0.4.1.tgz", - "integrity": "sha1-mI3zP+qxke95mmE2nddsF635V+o=", - "dev": true - }, - "dateformat": { - "version": "1.0.12", - "resolved": "https://registry.npmjs.org/dateformat/-/dateformat-1.0.12.tgz", - "integrity": "sha1-nxJLZ1lMk3/3BpMuSmQsyo27/uk=", - "dev": true - }, - "debug": { - "version": "2.6.8", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.8.tgz", - "integrity": "sha1-5zFTHKLt4n0YgiJCfaF4IdaP9Pw=", - "dev": true - }, - "decamelize": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", - "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", - "dev": true - }, - "deep-eql": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-0.1.3.tgz", - "integrity": "sha1-71WKyrjeJSBs1xOQbXTlaTDrafI=", - "dev": true, - "dependencies": { - "type-detect": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-0.1.1.tgz", - "integrity": "sha1-C6XsKohWQORw6k6FBZcZANrFiCI=", - "dev": true - } - } - }, - "deep-is": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", - "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", - "dev": true - }, - "default-require-extensions": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/default-require-extensions/-/default-require-extensions-1.0.0.tgz", - "integrity": "sha1-836hXT4T/9m0N9M+GnW1+5eHTLg=", - "dev": true - }, - "detect-indent": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/detect-indent/-/detect-indent-4.0.0.tgz", - "integrity": "sha1-920GQ1LN9Docts5hnE7jqUdd4gg=", - "dev": true - }, - "diff": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/diff/-/diff-3.2.0.tgz", - "integrity": "sha1-yc45Okt8vQsFinJck98pkCeGj/k=", - "dev": true - }, - "duplexer2": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/duplexer2/-/duplexer2-0.0.2.tgz", - "integrity": "sha1-xhTc9n4vsUmVqRcR5aYX6KYKMds=", - "dev": true - }, - "error-ex": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.1.tgz", - "integrity": "sha1-+FWobOYa3E6GIcPNoh56dhLDqNw=", - "dev": true - }, - "es6-promise": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.1.1.tgz", - "integrity": "sha512-OaU1hHjgJf+b0NzsxCg7NdIYERD6Hy/PEmFLTjw+b65scuisG3Kt4QoTvJ66BBkPZ581gr0kpoVzKnxniM8nng==" - }, - "escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", - "dev": true - }, - "escodegen": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.8.1.tgz", - "integrity": "sha1-WltTr0aTEQvrsIZ6o0MN07cKEBg=", - "dev": true, - "dependencies": { - "esprima": { - "version": "2.7.3", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-2.7.3.tgz", - "integrity": "sha1-luO3DVd59q1JzQMmc9HDEnZ7pYE=", - "dev": true - }, - "source-map": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.2.0.tgz", - "integrity": "sha1-2rc/vPwrqBm03gO9b26qSBZLP50=", - "dev": true, - "optional": true - } - } - }, - "esprima": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-3.1.3.tgz", - "integrity": "sha1-/cpRzuYTOJXjyI1TXOSdv/YqRjM=", - "dev": true - }, - "estraverse": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-1.9.3.tgz", - "integrity": "sha1-r2fy3JIlgkFZUJJgkaQAXSnJu0Q=", - "dev": true - }, - "esutils": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", - "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=", - "dev": true - }, - "fancy-log": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/fancy-log/-/fancy-log-1.3.0.tgz", - "integrity": "sha1-Rb4X0Cu5kX1gzP/UmVyZnmyMmUg=", - "dev": true - }, - "fast-levenshtein": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", - "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", - "dev": true - }, - "fileset": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/fileset/-/fileset-2.0.3.tgz", - "integrity": "sha1-jnVIqW08wjJ+5eZ0FocjozO7oqA=", - "dev": true - }, - "find-up": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz", - "integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=", - "dev": true - }, - "formatio": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/formatio/-/formatio-1.2.0.tgz", - "integrity": "sha1-87IWfZBoxGmKjVH092CjmlTYGOs=", - "dev": true - }, - "fs.realpath": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", - "dev": true - }, - "get-stdin": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-4.0.1.tgz", - "integrity": "sha1-uWjGsKBDhDJJAui/Gl3zJXmkUP4=", - "dev": true - }, - "glob": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", - "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", - "dev": true - }, - "globals": { - "version": "9.18.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-9.18.0.tgz", - "integrity": "sha512-S0nG3CLEQiY/ILxqtztTWH/3iRRdyBLw6KMDxnKMchrtbj2OFmehVh0WUCfW3DUrIgx/qFrJPICrq4Z4sTR9UQ==", - "dev": true - }, - "glogg": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/glogg/-/glogg-1.0.0.tgz", - "integrity": "sha1-f+DxmfV6yQbPUS/urY+Q7kooT8U=", - "dev": true - }, - "graceful-fs": { - "version": "4.1.11", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", - "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", - "dev": true - }, - "graceful-readlink": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/graceful-readlink/-/graceful-readlink-1.0.1.tgz", - "integrity": "sha1-TK+tdrxi8C+gObL5Tpo906ORpyU=", - "dev": true - }, - "graphql": { - "version": "0.10.3", - "resolved": "https://registry.npmjs.org/graphql/-/graphql-0.10.3.tgz", - "integrity": "sha1-wxOv1VGOZzNRvuGPtj4qDkh0B6s=", - "dev": true - }, - "growl": { - "version": "1.9.2", - "resolved": "https://registry.npmjs.org/growl/-/growl-1.9.2.tgz", - "integrity": "sha1-Dqd0NxXbjY3ixe3hd14bRayFwC8=", - "dev": true - }, - "gulp-util": { - "version": "3.0.7", - "resolved": "https://registry.npmjs.org/gulp-util/-/gulp-util-3.0.7.tgz", - "integrity": "sha1-eJJcS4+LSQBawBoBHFV+YhiUHLs=", - "dev": true, - "dependencies": { - "minimist": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", - "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", - "dev": true - } - } - }, - "gulplog": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/gulplog/-/gulplog-1.0.0.tgz", - "integrity": "sha1-4oxNRdBey77YGDY86PnFkmIp/+U=", - "dev": true - }, - "handlebars": { - "version": "4.0.10", - "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.0.10.tgz", - "integrity": "sha1-PTDHGLCaPZbyPqTMH0A8TTup/08=", - "dev": true, - "dependencies": { - "source-map": { - "version": "0.4.4", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.4.4.tgz", - "integrity": "sha1-66T12pwNyZneaAMti092FzZSA2s=", - "dev": true - } - } - }, - "has-ansi": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", - "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", - "dev": true - }, - "has-flag": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-1.0.0.tgz", - "integrity": "sha1-nZ55MWXOAXoA8AQYxD+UKnsdEfo=", - "dev": true - }, - "has-gulplog": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/has-gulplog/-/has-gulplog-0.1.0.tgz", - "integrity": "sha1-ZBTIKRNpfaUVkDl9r7EvIpZ4Ec4=", - "dev": true - }, - "hosted-git-info": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.5.0.tgz", - "integrity": "sha512-pNgbURSuab90KbTqvRPsseaTxOJCZBD0a7t+haSN33piP9cCM4l0CqdzAif2hUqm716UovKB2ROmiabGAKVXyg==", - "dev": true - }, - "indent-string": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-2.1.0.tgz", - "integrity": "sha1-ji1INIdCEhtKghi3oTfppSBJ3IA=", - "dev": true - }, - "inflight": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", - "dev": true - }, - "inherits": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", - "dev": true - }, - "invariant": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.2.tgz", - "integrity": "sha1-nh9WrArNtr8wMwbzOL47IErmA2A=", - "dev": true - }, - "is-arrayish": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", - "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", - "dev": true - }, - "is-buffer": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.5.tgz", - "integrity": "sha1-Hzsm72E7IUuIy8ojzGwB2Hlh7sw=", - "dev": true - }, - "is-builtin-module": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-builtin-module/-/is-builtin-module-1.0.0.tgz", - "integrity": "sha1-VAVy0096wxGfj3bDDLwbHgN6/74=", - "dev": true - }, - "is-finite": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-finite/-/is-finite-1.0.2.tgz", - "integrity": "sha1-zGZ3aVYCvlUO8R6LSqYwU0K20Ko=", - "dev": true - }, - "is-utf8": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz", - "integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI=", - "dev": true - }, - "isarray": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", - "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", - "dev": true - }, - "isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", - "dev": true - }, - "istanbul": { - "version": "1.0.0-alpha.2", - "resolved": "https://registry.npmjs.org/istanbul/-/istanbul-1.0.0-alpha.2.tgz", - "integrity": "sha1-BglrwI6Yuq10Sq5Gli2N+frGPQg=", - "dev": true - }, - "istanbul-api": { - "version": "1.1.10", - "resolved": "https://registry.npmjs.org/istanbul-api/-/istanbul-api-1.1.10.tgz", - "integrity": "sha1-8n5ecSXI3hP2qAZhr3j1EuVDmys=", - "dev": true, - "dependencies": { - "async": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/async/-/async-2.5.0.tgz", - "integrity": "sha512-e+lJAJeNWuPCNyxZKOBdaJGyLGHugXVQtrAwtuAe2vhxTYxFTKE73p8JuTmdH0qdQZtDvI4dhJwjZc5zsfIsYw==", - "dev": true - } - } - }, - "istanbul-lib-coverage": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-1.1.1.tgz", - "integrity": "sha512-0+1vDkmzxqJIn5rcoEqapSB4DmPxE31EtI2dF2aCkV5esN9EWHxZ0dwgDClivMXJqE7zaYQxq30hj5L0nlTN5Q==", - "dev": true - }, - "istanbul-lib-hook": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/istanbul-lib-hook/-/istanbul-lib-hook-1.0.7.tgz", - "integrity": "sha512-3U2HB9y1ZV9UmFlE12Fx+nPtFqIymzrqCksrXujm3NVbAZIJg/RfYgO1XiIa0mbmxTjWpVEVlkIZJ25xVIAfkQ==", - "dev": true - }, - "istanbul-lib-instrument": { - "version": "1.7.3", - "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-1.7.3.tgz", - "integrity": "sha1-klsjkWPqvdaMxASPUsL6T4mez6c=", - "dev": true - }, - "istanbul-lib-report": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-1.1.1.tgz", - "integrity": "sha512-tvF+YmCmH4thnez6JFX06ujIA19WPa9YUiwjc1uALF2cv5dmE3It8b5I8Ob7FHJ70H9Y5yF+TDkVa/mcADuw1Q==", - "dev": true, - "dependencies": { - "supports-color": { - "version": "3.2.3", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-3.2.3.tgz", - "integrity": "sha1-ZawFBLOVQXHYpklGsq48u4pfVPY=", - "dev": true - } - } - }, - "istanbul-lib-source-maps": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-1.2.1.tgz", - "integrity": "sha512-mukVvSXCn9JQvdJl8wP/iPhqig0MRtuWuD4ZNKo6vB2Ik//AmhAKe3QnPN02dmkRe3lTudFk3rzoHhwU4hb94w==", - "dev": true - }, - "istanbul-reports": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-1.1.1.tgz", - "integrity": "sha512-P8G873A0kW24XRlxHVGhMJBhQ8gWAec+dae7ZxOBzxT4w+a9ATSPvRVK3LB1RAJ9S8bg2tOyWHAGW40Zd2dKfw==", - "dev": true - }, - "iterall": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/iterall/-/iterall-1.1.1.tgz", - "integrity": "sha1-9/CvEemgTsZCYmD1AZ2fzKTVAhQ=" - }, - "js-tokens": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz", - "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=", - "dev": true - }, - "js-yaml": { - "version": "3.8.4", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.8.4.tgz", - "integrity": "sha1-UgtFZPhlc7qWZir4Woyvp7S1pvY=", - "dev": true - }, - "jsesc": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-1.3.0.tgz", - "integrity": "sha1-RsP+yMGJKxKwgz25vHYiF226s0s=", - "dev": true - }, - "json3": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/json3/-/json3-3.3.2.tgz", - "integrity": "sha1-PAQ0dD35Pi9cQq7nsZvLSDV19OE=", - "dev": true - }, - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true - }, - "lazy-cache": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/lazy-cache/-/lazy-cache-1.0.4.tgz", - "integrity": "sha1-odePw6UEdMuAhF07O24dpJpEbo4=", - "dev": true, - "optional": true - }, - "levn": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", - "integrity": "sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=", - "dev": true - }, - "load-json-file": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", - "integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=", - "dev": true - }, - "lodash": { - "version": "4.17.4", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz", - "integrity": "sha1-eCA6TRwyiuHYbcpkYONptX9AVa4=", - "dev": true - }, - "lodash._baseassign": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/lodash._baseassign/-/lodash._baseassign-3.2.0.tgz", - "integrity": "sha1-jDigmVAPIVrQnlnxci/QxSv+Ck4=", - "dev": true - }, - "lodash._basecopy": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/lodash._basecopy/-/lodash._basecopy-3.0.1.tgz", - "integrity": "sha1-jaDmqHbPNEwK2KVIghEd08XHyjY=", - "dev": true - }, - "lodash._basecreate": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/lodash._basecreate/-/lodash._basecreate-3.0.3.tgz", - "integrity": "sha1-G8ZhYU2qf8MRt9A78WgGoCE8+CE=", - "dev": true - }, - "lodash._basetostring": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/lodash._basetostring/-/lodash._basetostring-3.0.1.tgz", - "integrity": "sha1-0YYdh3+CSlL2aYMtyvPuFVZqB9U=", - "dev": true - }, - "lodash._basevalues": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/lodash._basevalues/-/lodash._basevalues-3.0.0.tgz", - "integrity": "sha1-W3dXYoAr3j0yl1A+JjAIIP32Ybc=", - "dev": true - }, - "lodash._getnative": { - "version": "3.9.1", - "resolved": "https://registry.npmjs.org/lodash._getnative/-/lodash._getnative-3.9.1.tgz", - "integrity": "sha1-VwvH3t5G1hzc3mh9ZdPuy6o6r/U=", - "dev": true - }, - "lodash._isiterateecall": { - "version": "3.0.9", - "resolved": "https://registry.npmjs.org/lodash._isiterateecall/-/lodash._isiterateecall-3.0.9.tgz", - "integrity": "sha1-UgOte6Ql+uhCRg5pbbnPPmqsBXw=", - "dev": true - }, - "lodash._reescape": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/lodash._reescape/-/lodash._reescape-3.0.0.tgz", - "integrity": "sha1-Kx1vXf4HyKNVdT5fJ/rH8c3hYWo=", - "dev": true - }, - "lodash._reevaluate": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/lodash._reevaluate/-/lodash._reevaluate-3.0.0.tgz", - "integrity": "sha1-WLx0xAZklTrgsSTYBpltrKQx4u0=", - "dev": true - }, - "lodash._reinterpolate": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz", - "integrity": "sha1-DM8tiRZq8Ds2Y8eWU4t1rG4RTZ0=", - "dev": true - }, - "lodash._root": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/lodash._root/-/lodash._root-3.0.1.tgz", - "integrity": "sha1-+6HEUkwZ7ppfgTa0YJ8BfPTe1pI=", - "dev": true - }, - "lodash.create": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/lodash.create/-/lodash.create-3.1.1.tgz", - "integrity": "sha1-1/KEnw29p+BGgruM1yqwIkYd6+c=", - "dev": true - }, - "lodash.escape": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/lodash.escape/-/lodash.escape-3.2.0.tgz", - "integrity": "sha1-mV7g3BjBtIzJLv+ucaEKq1tIdpg=", - "dev": true - }, - "lodash.isarguments": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/lodash.isarguments/-/lodash.isarguments-3.1.0.tgz", - "integrity": "sha1-L1c9hcaiQon/AGY7SRwdM4/zRYo=", - "dev": true - }, - "lodash.isarray": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/lodash.isarray/-/lodash.isarray-3.0.4.tgz", - "integrity": "sha1-eeTriMNqgSKvhvhEqpvNhRtfu1U=", - "dev": true - }, - "lodash.keys": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/lodash.keys/-/lodash.keys-3.1.2.tgz", - "integrity": "sha1-TbwEcrFWvlCgsoaFXRvQsMZWCYo=", - "dev": true - }, - "lodash.restparam": { - "version": "3.6.1", - "resolved": "https://registry.npmjs.org/lodash.restparam/-/lodash.restparam-3.6.1.tgz", - "integrity": "sha1-k2pOMJ7zMKdkXtQUWYbIWuWyCAU=", - "dev": true - }, - "lodash.template": { - "version": "3.6.2", - "resolved": "https://registry.npmjs.org/lodash.template/-/lodash.template-3.6.2.tgz", - "integrity": "sha1-+M3sxhaaJVvpCYrosMU9N4kx0U8=", - "dev": true - }, - "lodash.templatesettings": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/lodash.templatesettings/-/lodash.templatesettings-3.1.1.tgz", - "integrity": "sha1-+zB4RHU7Zrnxr6VOJix0UwfbqOU=", - "dev": true - }, - "lolex": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/lolex/-/lolex-1.6.0.tgz", - "integrity": "sha1-OpoCg0UqR9dDnnJzG54H1zhuSfY=", - "dev": true - }, - "longest": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/longest/-/longest-1.0.1.tgz", - "integrity": "sha1-MKCy2jj3N3DoKUoNIuZiXtd9AJc=", - "dev": true - }, - "loose-envify": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.3.1.tgz", - "integrity": "sha1-0aitM/qc4OcT1l/dCsi3SNR4yEg=", - "dev": true - }, - "loud-rejection": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/loud-rejection/-/loud-rejection-1.6.0.tgz", - "integrity": "sha1-W0b4AUft7leIcPCG0Eghz5mOVR8=", - "dev": true - }, - "map-obj": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz", - "integrity": "sha1-2TPOuSBdgr3PSIb2dCvcK03qFG0=", - "dev": true - }, - "meow": { - "version": "3.7.0", - "resolved": "https://registry.npmjs.org/meow/-/meow-3.7.0.tgz", - "integrity": "sha1-cstmi0JSKCkKu/qFaJJYcwioAfs=", - "dev": true, - "dependencies": { - "minimist": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", - "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", - "dev": true - }, - "object-assign": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", - "dev": true - } - } - }, - "minimatch": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", - "dev": true - }, - "minimist": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", - "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", - "dev": true - }, - "mkdirp": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", - "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", - "dev": true - }, - "mocha": { - "version": "3.4.2", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-3.4.2.tgz", - "integrity": "sha1-0O9NMyEm2/GNDWQMmzgt1IvpdZQ=", - "dev": true, - "dependencies": { - "debug": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.0.tgz", - "integrity": "sha1-vFlryr52F/Edn6FTYe3tVgi4SZs=", - "dev": true - }, - "glob": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.1.tgz", - "integrity": "sha1-gFIR3wT6rxxjo2ADBs31reULLsg=", - "dev": true - }, - "ms": { - "version": "0.7.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-0.7.2.tgz", - "integrity": "sha1-riXPJRKziFodldfwN4aNhDESR2U=", - "dev": true - }, - "supports-color": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-3.1.2.tgz", - "integrity": "sha1-cqJiiU2dQIuVbKBf83su2KbiotU=", - "dev": true - } - } - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true - }, - "multipipe": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/multipipe/-/multipipe-0.1.2.tgz", - "integrity": "sha1-Ko8t33Du1WTf8tV/HhoTfZ8FB4s=", - "dev": true - }, - "native-promise-only": { - "version": "0.8.1", - "resolved": "https://registry.npmjs.org/native-promise-only/-/native-promise-only-0.8.1.tgz", - "integrity": "sha1-IKMYwwy0X3H+et+/eyHJnBRy7xE=", - "dev": true - }, - "nopt": { - "version": "3.0.6", - "resolved": "https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz", - "integrity": "sha1-xkZdvwirzU2zWTF/eaxopkayj/k=", - "dev": true - }, - "normalize-package-data": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.4.0.tgz", - "integrity": "sha512-9jjUFbTPfEy3R/ad/2oNbKtW9Hgovl5O1FvFWKkKblNXoN/Oou6+9+KKohPK13Yc3/TyunyWhJp6gvRNR/PPAw==", - "dev": true - }, - "number-is-nan": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", - "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", - "dev": true - }, - "object-assign": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-3.0.0.tgz", - "integrity": "sha1-m+3VygiXlJvKR+f/QIBi1Un1h/I=", - "dev": true - }, - "once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", - "dev": true - }, - "optimist": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz", - "integrity": "sha1-2j6nRob6IaGaERwybpDrFaAZZoY=", - "dev": true, - "dependencies": { - "wordwrap": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz", - "integrity": "sha1-o9XabNXAvAAI03I0u68b7WMFkQc=", - "dev": true - } - } - }, - "optionator": { - "version": "0.8.2", - "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.2.tgz", - "integrity": "sha1-NkxeQJ0/TWMB1sC0wFu6UBgK62Q=", - "dev": true - }, - "parse-json": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", - "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", - "dev": true - }, - "path-exists": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz", - "integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=", - "dev": true - }, - "path-is-absolute": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", - "dev": true - }, - "path-parse": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.5.tgz", - "integrity": "sha1-PBrfhx6pzWyUMbbqK9dKD/BVxME=", - "dev": true - }, - "path-to-regexp": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.7.0.tgz", - "integrity": "sha1-Wf3g9DW62suhA6hOnTvGTpa5k30=", - "dev": true - }, - "path-type": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-1.1.0.tgz", - "integrity": "sha1-WcRPfuSR2nBNpBXaWkBwuk+P5EE=", - "dev": true - }, - "pify": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", - "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", - "dev": true - }, - "pinkie": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", - "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=", - "dev": true - }, - "pinkie-promise": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", - "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", - "dev": true - }, - "prelude-ls": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", - "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=", - "dev": true - }, - "process-nextick-args": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", - "integrity": "sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M=", - "dev": true - }, - "read-pkg": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz", - "integrity": "sha1-9f+qXs0pyzHAR0vKfXVra7KePyg=", - "dev": true - }, - "read-pkg-up": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-1.0.1.tgz", - "integrity": "sha1-nWPBMnbAZZGNV/ACpX9AobZD+wI=", - "dev": true - }, - "readable-stream": { - "version": "1.1.14", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", - "integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=", - "dev": true - }, - "redent": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/redent/-/redent-1.0.0.tgz", - "integrity": "sha1-z5Fqsf1fHxbfsggi3W7H9zDCr94=", - "dev": true - }, - "regenerator-runtime": { - "version": "0.10.5", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.10.5.tgz", - "integrity": "sha1-M2w+/BIgrc7dosn6tntaeVWjNlg=", - "dev": true - }, - "remap-istanbul": { - "version": "0.9.5", - "resolved": "https://registry.npmjs.org/remap-istanbul/-/remap-istanbul-0.9.5.tgz", - "integrity": "sha1-oYYXsfMe7Fp9vud1OCmLd1YGqqg=", - "dev": true, - "dependencies": { - "esprima": { - "version": "2.7.3", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-2.7.3.tgz", - "integrity": "sha1-luO3DVd59q1JzQMmc9HDEnZ7pYE=", - "dev": true - }, - "glob": { - "version": "5.0.15", - "resolved": "https://registry.npmjs.org/glob/-/glob-5.0.15.tgz", - "integrity": "sha1-G8k2ueAvSmA/zCIuz3Yz0wuLk7E=", - "dev": true - }, - "istanbul": { - "version": "0.4.5", - "resolved": "https://registry.npmjs.org/istanbul/-/istanbul-0.4.5.tgz", - "integrity": "sha1-ZcfXPUxNqE1POsMQuRj7C4Azczs=", - "dev": true - }, - "supports-color": { - "version": "3.2.3", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-3.2.3.tgz", - "integrity": "sha1-ZawFBLOVQXHYpklGsq48u4pfVPY=", - "dev": true - } - } - }, - "repeat-string": { - "version": "1.6.1", - "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", - "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=", - "dev": true - }, - "repeating": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/repeating/-/repeating-2.0.1.tgz", - "integrity": "sha1-UhTFOpJtNVJwdSf7q0FdvAjQbdo=", - "dev": true - }, - "replace-ext": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/replace-ext/-/replace-ext-0.0.1.tgz", - "integrity": "sha1-KbvZIHinOfC8zitO5B6DeVNSKSQ=", - "dev": true - }, - "resolve": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.1.7.tgz", - "integrity": "sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs=", - "dev": true - }, - "right-align": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/right-align/-/right-align-0.1.3.tgz", - "integrity": "sha1-YTObci/mo1FWiSENJOFMlhSGE+8=", - "dev": true, - "optional": true - }, - "rimraf": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.1.tgz", - "integrity": "sha1-wjOOxkPfeht/5cVPqG9XQopV8z0=", - "dev": true - }, - "samsam": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/samsam/-/samsam-1.2.1.tgz", - "integrity": "sha1-7dOQk6MYQ3DLhZJDsr3yVefY6mc=", - "dev": true - }, - "semver": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.3.0.tgz", - "integrity": "sha1-myzl094C0XxgEq0yaqa00M9U+U8=", - "dev": true - }, - "signal-exit": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", - "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", - "dev": true - }, - "sinon": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/sinon/-/sinon-2.3.6.tgz", - "integrity": "sha1-lTeOfg+XapcS6bRZH/WznnPcPd4=", - "dev": true, - "dependencies": { - "type-detect": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.3.tgz", - "integrity": "sha1-Dj8mcLRAmbC0bChNE2p+9Jx0wuo=", - "dev": true - } - } - }, - "sinon-chai": { - "version": "2.11.0", - "resolved": "https://registry.npmjs.org/sinon-chai/-/sinon-chai-2.11.0.tgz", - "integrity": "sha512-3kbzpr2q8N+M4CWkcym349ifwkXorsbw2YyVpEIvB3AKC/ebrLHXj3DySt8epKGA49zJBSgn1OvWHZ+O+aR0dA==", - "dev": true - }, - "source-map": { - "version": "0.5.6", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.6.tgz", - "integrity": "sha1-dc449SvwczxafwwRjYEzSiu19BI=", - "dev": true - }, - "sparkles": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/sparkles/-/sparkles-1.0.0.tgz", - "integrity": "sha1-Gsu/tZJDbRC76PeFt8xvgoFQEsM=", - "dev": true - }, - "spdx-correct": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-1.0.2.tgz", - "integrity": "sha1-SzBz2TP/UfORLwOsVRlJikFQ20A=", - "dev": true - }, - "spdx-expression-parse": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-1.0.4.tgz", - "integrity": "sha1-m98vIOH0DtRH++JzJmGR/O1RYmw=", - "dev": true - }, - "spdx-license-ids": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-1.2.2.tgz", - "integrity": "sha1-yd96NCRZSt5r0RkA1ZZpbcBrrFc=", - "dev": true - }, - "sprintf-js": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", - "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", - "dev": true - }, - "string_decoder": { - "version": "0.10.31", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", - "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=", - "dev": true - }, - "strip-ansi": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", - "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", - "dev": true - }, - "strip-bom": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz", - "integrity": "sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=", - "dev": true - }, - "strip-indent": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-1.0.1.tgz", - "integrity": "sha1-DHlipq3vp7vUrDZkYKY4VSrhoKI=", - "dev": true - }, - "supports-color": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", - "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", - "dev": true - }, - "text-encoding": { - "version": "0.6.4", - "resolved": "https://registry.npmjs.org/text-encoding/-/text-encoding-0.6.4.tgz", - "integrity": "sha1-45mpgiV6J22uQou5KEXLcb3CbRk=", - "dev": true - }, - "through2": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.1.tgz", - "integrity": "sha1-OE51MU1J8y3hLuu4E2uOtrXVnak=", - "dev": true, - "dependencies": { - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", - "dev": true - }, - "readable-stream": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.0.6.tgz", - "integrity": "sha1-j5A0HmilPMySh4jaz80Rs265t44=", - "dev": true - } - } - }, - "time-stamp": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/time-stamp/-/time-stamp-1.1.0.tgz", - "integrity": "sha1-dkpaEa9QVhkhsTPztE5hhofg9cM=", - "dev": true - }, - "to-fast-properties": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-1.0.3.tgz", - "integrity": "sha1-uDVx+k2MJbguIxsG46MFXeTKGkc=", - "dev": true - }, - "trim-newlines": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-1.0.0.tgz", - "integrity": "sha1-WIeWa7WCpFA6QetST301ARgVphM=", - "dev": true - }, - "trim-right": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/trim-right/-/trim-right-1.0.1.tgz", - "integrity": "sha1-yy4SAwZ+DI3h9hQJS5/kVwTqYAM=", - "dev": true - }, - "tslib": { - "version": "1.7.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.7.1.tgz", - "integrity": "sha1-vIAEFkaRkjp5/oN4u+s9ogF1OOw=", - "dev": true - }, - "tslint": { - "version": "5.4.3", - "resolved": "https://registry.npmjs.org/tslint/-/tslint-5.4.3.tgz", - "integrity": "sha1-dhyEArgONHt3M6BDkKdXslNYBGc=", - "dev": true, - "dependencies": { - "resolve": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.3.3.tgz", - "integrity": "sha1-ZVkHw0aahoDcLeOidaj91paR8OU=", - "dev": true - } - } - }, - "tsutils": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.5.1.tgz", - "integrity": "sha1-wgATkMee7Bpcz6esEtWZY5aD4M8=", - "dev": true - }, - "type-check": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", - "integrity": "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=", - "dev": true - }, - "type-detect": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-1.0.0.tgz", - "integrity": "sha1-diIXzAbbJY7EiQihKY6LlRIejqI=", - "dev": true - }, - "typescript": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.4.1.tgz", - "integrity": "sha1-w8yxbdqgsjFN4DHn5v7onlujRrw=", - "dev": true - }, - "uglify-js": { - "version": "2.8.29", - "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-2.8.29.tgz", - "integrity": "sha1-KcVzMUgFe7Th913zW3qcty5qWd0=", - "dev": true, - "optional": true - }, - "uglify-to-browserify": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz", - "integrity": "sha1-bgkk1r2mta/jSeOabWMoUKD4grc=", - "dev": true, - "optional": true - }, - "util-deprecate": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", - "dev": true - }, - "validate-npm-package-license": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.1.tgz", - "integrity": "sha1-KAS6vnEq0zeUWaz74kdGqywwP7w=", - "dev": true - }, - "vinyl": { - "version": "0.5.3", - "resolved": "https://registry.npmjs.org/vinyl/-/vinyl-0.5.3.tgz", - "integrity": "sha1-sEVbOPxeDPMNQyUTLkYZcMIJHN4=", - "dev": true - }, - "which": { - "version": "1.2.14", - "resolved": "https://registry.npmjs.org/which/-/which-1.2.14.tgz", - "integrity": "sha1-mofEN48D6CfOyvGs31bHNsAcFOU=", - "dev": true - }, - "window-size": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/window-size/-/window-size-0.1.0.tgz", - "integrity": "sha1-VDjNLqk7IC76Ohn+iIeu58lPnJ0=", - "dev": true, - "optional": true - }, - "wordwrap": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", - "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=", - "dev": true - }, - "wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", - "dev": true - }, - "xtend": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", - "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=", - "dev": true - }, - "yargs": { - "version": "3.10.0", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-3.10.0.tgz", - "integrity": "sha1-9+572FfdfB0tOMDnTvvWgdFDH9E=", - "dev": true, - "optional": true - } - } -} diff --git a/package.json b/package.json index 3c3ee05..0f383e4 100644 --- a/package.json +++ b/package.json @@ -8,12 +8,12 @@ "url": "https://github.com/apollostack/graphql-subscriptions.git" }, "dependencies": { - "@types/graphql": "^0.9.1", + "@types/graphql": "^0.11.3", "es6-promise": "^4.0.5", "iterall": "^1.1.1" }, "peerDependencies": { - "graphql": "^0.7.0 || ^0.8.0 || ^0.9.0 || ^0.10.1" + "graphql": "^0.11.3" }, "scripts": { "compile": "tsc", @@ -28,14 +28,14 @@ }, "devDependencies": { "@types/mocha": "^2.2.39", - "@types/node": "^7.0.5", - "chai": "^3.5.0", - "chai-as-promised": "^6.0.0", - "graphql": "^0.10.0", + "@types/node": "^8.0.28", + "chai": "^4.1.2", + "chai-as-promised": "^7.1.1", + "graphql": "^0.11.3", "istanbul": "^1.0.0-alpha.2", "mocha": "^3.3.0", "remap-istanbul": "^0.9.1", - "sinon": "^2.1.0", + "sinon": "^3.2.1", "sinon-chai": "^2.9.0", "tslint": "^5.2.0", "typescript": "^2.3.2" diff --git a/src/index.ts b/src/index.ts index d5ac0c7..626b3b3 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,12 +1,3 @@ export { PubSubEngine } from './pubsub-engine'; export { PubSub } from './pubsub'; export { withFilter, ResolverFn, FilterFn } from './with-filter'; -export { - SubscriptionManager, - SubscriptionOptions, - TriggerConfig, - TriggerMap, - SetupFunction, - SetupFunctions, - ValidationError, -} from './subscriptions-manager'; diff --git a/src/pubsub.ts b/src/pubsub.ts index 9f6446b..e1c7d26 100644 --- a/src/pubsub.ts +++ b/src/pubsub.ts @@ -4,7 +4,7 @@ import { eventEmitterAsyncIterator } from './event-emitter-to-async-iterator'; export class PubSub implements PubSubEngine { protected ee: EventEmitter; - private subscriptions: { [key: string]: [string, Function] }; + private subscriptions: { [key: string]: [string, (...args: any[]) => void] }; private subIdCounter: number; constructor() { @@ -19,7 +19,7 @@ export class PubSub implements PubSubEngine { return true; } - public subscribe(triggerName: string, onMessage: Function): Promise { + public subscribe(triggerName: string, onMessage: (...args: any[]) => void): Promise { this.ee.addListener(triggerName, onMessage); this.subIdCounter = this.subIdCounter + 1; this.subscriptions[this.subIdCounter] = [triggerName, onMessage]; diff --git a/src/subscriptions-manager.ts b/src/subscriptions-manager.ts deleted file mode 100644 index 9811751..0000000 --- a/src/subscriptions-manager.ts +++ /dev/null @@ -1,185 +0,0 @@ -// -// This is basically just event emitters wrapped with a function that filters messages. -// -import { PubSubEngine } from './pubsub-engine'; -import { - GraphQLSchema, - GraphQLError, - validate, - execute, - parse, - specifiedRules, - OperationDefinitionNode, - FieldNode, -} from 'graphql'; -import { getArgumentValues } from 'graphql/execution/values'; - -import { - subscriptionHasSingleRootField, -} from './validation'; - -export class ValidationError extends Error { - errors: Array; - message: string; - - constructor(errors){ - super(); - this.errors = errors; - this.message = 'Subscription query has validation errors'; - } -} - -export interface SubscriptionOptions { - query: string; - operationName: string; - callback: Function; - variables?: { [key: string]: any }; - context?: any; - formatError?: Function; - formatResponse?: Function; -} - -export interface TriggerConfig { - channelOptions?: Object; - filter?: Function; -} - -export interface TriggerMap { - [triggerName: string]: TriggerConfig; -} - -export interface SetupFunction { - (options: SubscriptionOptions, args: {[key: string]: any}, subscriptionName: string): TriggerMap; -} - -export interface SetupFunctions { - [subscriptionName: string]: SetupFunction; -} - -/** - * @deprecated - */ -export class SubscriptionManager { - private pubsub: PubSubEngine; - private schema: GraphQLSchema; - private setupFunctions: SetupFunctions; - private subscriptions: { [externalId: number]: Array}; - private maxSubscriptionId: number; - - constructor(options: { schema: GraphQLSchema, - setupFunctions: SetupFunctions, - pubsub: PubSubEngine }){ - this.pubsub = options.pubsub; - this.schema = options.schema; - this.setupFunctions = options.setupFunctions || {}; - this.subscriptions = {}; - this.maxSubscriptionId = 0; - } - - public publish(triggerName: string, payload: any) { - this.pubsub.publish(triggerName, payload); - } - - public subscribe(options: SubscriptionOptions): Promise { - - // 1. validate the query, operationName and variables - const parsedQuery = parse(options.query); - const errors = validate( - this.schema, - parsedQuery, - [...specifiedRules, subscriptionHasSingleRootField] - ); - - // TODO: validate that all variables have been passed (and are of correct type)? - if (errors.length){ - // this error kills the subscription, so we throw it. - return Promise.reject(new ValidationError(errors)); - } - - let args = {}; - - // operationName is the name of the only root field in the subscription document - let subscriptionName = ''; - parsedQuery.definitions.forEach( definition => { - if (definition.kind === 'OperationDefinition'){ - // only one root field is allowed on subscription. No fragments for now. - const rootField = (definition as OperationDefinitionNode).selectionSet.selections[0] as FieldNode; - subscriptionName = rootField.name.value; - - const fields = this.schema.getSubscriptionType().getFields(); - args = getArgumentValues(fields[subscriptionName], rootField, options.variables); - } - }); - - let triggerMap: TriggerMap; - - if (this.setupFunctions[subscriptionName]) { - triggerMap = this.setupFunctions[subscriptionName](options, args, subscriptionName); - } else { - // if not provided, the triggerName will be the subscriptionName, The trigger will not have any - // options and rely on defaults that are set later. - triggerMap = {[subscriptionName]: {}}; - } - - const externalSubscriptionId = this.maxSubscriptionId++; - this.subscriptions[externalSubscriptionId] = []; - const subscriptionPromises = []; - Object.keys(triggerMap).forEach( triggerName => { - // Deconstruct the trigger options and set any defaults - const { - channelOptions = {}, - filter = () => true, // Let all messages through by default. - } = triggerMap[triggerName]; - - // 2. generate the handler function - // - // rootValue is the payload sent by the event emitter / trigger by - // convention this is the value returned from the mutation - // resolver - const onMessage = (rootValue) => { - return Promise.resolve().then(() => { - if (typeof options.context === 'function') { - return options.context(); - } - return options.context; - }).then((context) => { - return Promise.all([ - context, - filter(rootValue, context), - ]); - }).then(([context, doExecute]) => { - if (!doExecute) { - return; - } - execute( - this.schema, - parsedQuery, - rootValue, - context, - options.variables, - options.operationName - ).then( data => options.callback(null, data) ); - }).catch((error) => { - options.callback(error); - }); - } - - // 3. subscribe and keep the subscription id - subscriptionPromises.push( - this.pubsub.subscribe(triggerName, onMessage, channelOptions) - .then(id => this.subscriptions[externalSubscriptionId].push(id)) - ); - }); - - // Resolve the promise with external sub id only after all subscriptions completed - return Promise.all(subscriptionPromises).then(() => externalSubscriptionId); - } - - public unsubscribe(subId){ - // pass the subId right through to pubsub. Do nothing else. - this.subscriptions[subId].forEach( internalId => { - this.pubsub.unsubscribe(internalId); - }); - delete this.subscriptions[subId]; - } -} diff --git a/src/test/asyncIteratorSubscription.ts b/src/test/asyncIteratorSubscription.ts index 50f2107..327a988 100644 --- a/src/test/asyncIteratorSubscription.ts +++ b/src/test/asyncIteratorSubscription.ts @@ -8,6 +8,7 @@ import * as sinonChai from 'sinon-chai'; import { isAsyncIterable } from 'iterall'; import { PubSub } from '../pubsub'; import { withFilter } from '../with-filter'; +import { ExecutionResult } from 'graphql'; chai.use(chaiAsPromised); chai.use(sinonChai); @@ -55,7 +56,7 @@ function buildSchema(iterator, filterFn = defaultFilter) { } describe('GraphQL-JS asyncIterator', () => { - it('should allow subscriptions', () => { + it('should allow subscriptions', async () => { const query = parse(` subscription S1 { @@ -67,7 +68,7 @@ describe('GraphQL-JS asyncIterator', () => { const schema = buildSchema(origIterator); - const results = subscribe(schema, query); + const results = await subscribe(schema, query) as AsyncIterator; const payload1 = results.next(); expect(isAsyncIterable(results)).to.be.true; @@ -107,21 +108,21 @@ describe('GraphQL-JS asyncIterator', () => { const schema = buildSchema(origIterator, filterFn); - const results = subscribe(schema, query); - expect(isAsyncIterable(results)).to.be.true; - - results.next(); - results.return(); + subscribe(schema, query).then((results: AsyncIterator) => { + expect(isAsyncIterable(results)).to.be.true; - pubsub.publish(FIRST_EVENT, {}); + results.next(); + results.return(); - setTimeout(_ => { - done(); - }, 500); + pubsub.publish(FIRST_EVENT, {}); + setTimeout(_ => { + done(); + }, 500); + }); }); - it('should clear event handlers', () => { + it('should clear event handlers', async () => { const query = parse(` subscription S1 { testSubscription @@ -133,7 +134,7 @@ describe('GraphQL-JS asyncIterator', () => { const returnSpy = spy(origIterator, 'return'); const schema = buildSchema(origIterator); - const results = subscribe(schema, query); + const results = await subscribe(schema, query) as AsyncIterator; const end = results.return(); const r = end.then(res => { diff --git a/src/test/tests.ts b/src/test/tests.ts index 15c39a5..af07ae8 100644 --- a/src/test/tests.ts +++ b/src/test/tests.ts @@ -14,22 +14,6 @@ chai.use(sinonChai); const expect = chai.expect; const assert = chai.assert; -import { - parse, - validate, - GraphQLSchema, - GraphQLObjectType, - GraphQLString, - GraphQLInt, - GraphQLBoolean, -} from 'graphql'; - -import { - SubscriptionManager, -} from '../subscriptions-manager'; - -import { subscriptionHasSingleRootField } from '../validation'; - describe('PubSub', function() { it('can subscribe and is called when events happen', function(done) { const ps = new PubSub(); @@ -61,7 +45,7 @@ describe('AsyncIterator', () => { const evnetName = 'test'; const ps = new PubSub(); const iterator = ps.asyncIterator(evnetName); - expect(iterator).to.be.defined; + expect(iterator).to.not.be.undefined; expect(isAsyncIterable(iterator)).to.be.true; }); @@ -71,9 +55,9 @@ describe('AsyncIterator', () => { const iterator = ps.asyncIterator(evnetName); iterator.next().then(result => { - expect(result).to.be.defined; - expect(result.value).to.be.defined; - expect(result.done).to.be.defined; + expect(result).to.not.be.undefined; + expect(result.value).to.not.be.undefined; + expect(result.done).to.not.be.undefined; done(); }); @@ -111,559 +95,22 @@ describe('AsyncIterator', () => { const iterator = ps.asyncIterator(evnetName); iterator.next().then(result => { - expect(result).to.be.defined; - expect(result.value).to.be.defined; + expect(result).to.not.be.undefined; + expect(result.value).to.not.be.undefined; expect(result.done).to.be.false; }); ps.publish(evnetName, { test: true }); iterator.next().then(result => { - expect(result).to.be.defined; - expect(result.value).not.to.be.defined; + expect(result).to.not.be.undefined; + expect(result.value).to.be.undefined; expect(result.done).to.be.true; done(); }); iterator.return(); - ps.publish(evnetName, { test: true }); - }); -}); -const schema = new GraphQLSchema({ - query: new GraphQLObjectType({ - name: 'Query', - fields: { - testString: { - type: GraphQLString, - resolve: function (_, args) { - return 'works'; - }, - }, - }, - }), - subscription: new GraphQLObjectType({ - name: 'Subscription', - fields: { - testSubscription: { - type: GraphQLString, - resolve: function (root) { - return root; - }, - }, - testContext: { - type: GraphQLString, - resolve(rootValue, args, context) { - return context; - }, - }, - testFilter: { - type: GraphQLString, - resolve: function (root, { filterBoolean }) { - return filterBoolean ? 'goodFilter' : 'badFilter'; - }, - args: { - filterBoolean: { type: GraphQLBoolean }, - }, - }, - testFilterMulti: { - type: GraphQLString, - resolve: function (root, { filterBoolean }) { - return filterBoolean ? 'goodFilter' : 'badFilter'; - }, - args: { - filterBoolean: { type: GraphQLBoolean }, - a: { type: GraphQLString }, - b: { type: GraphQLInt }, - }, - }, - testChannelOptions: { - type: GraphQLString, - resolve: function (root) { - return root; - }, - }, - testArguments: { - type: GraphQLString, - resolve: (root, { testArgument }) => { - return String(testArgument); - }, - args: { - testArgument: { - type: GraphQLInt, - defaultValue: 1234, - }, - }, - }, - }, - }), -}); - -describe('SubscriptionManager', function() { - let capturedArguments: Object; - - const pubsub = new PubSub(); - - const subManager = new SubscriptionManager({ - schema, - setupFunctions: { - 'testFilter': (options, { filterBoolean }) => { - return { - 'Filter1': { - filter: (root) => root.filterBoolean === filterBoolean, - }, - Filter2: { - filter: (root) => { - return new Promise((resolve) => { - setTimeout(() => resolve(root.filterBoolean === filterBoolean), 10); - }); - }, - }, - }; - }, - 'testFilterMulti': (options) => { - return { - 'Trigger1': { - filter: () => true, - }, - 'Trigger2': { - filter: () => true, - }, - }; - }, - 'testChannelOptions': () => { - return { - 'Trigger1': { - channelOptions: { - foo: 'bar', - }, - }, - }; - }, - testContext(options) { - return { - contextTrigger(rootValue, context) { - return context === 'trigger'; - }, - }; - }, - testArguments(opts, args) { - capturedArguments = args; - return { - Trigger1: {}, - }; - }, - }, - pubsub, - }); - - beforeEach(() => { - capturedArguments = undefined; - sinon.spy(pubsub, 'subscribe'); - }); - - afterEach(() => { - sinon.restore(pubsub.subscribe); - }); - - it('throws an error if query is not valid', function() { - const query = 'query a{ testInt }'; - const callback = () => null; - return expect(subManager.subscribe({ query, operationName: 'a', callback })) - .to.eventually.be.rejectedWith('Subscription query has validation errors'); - }); - - it('rejects subscriptions with more than one root field', function() { - const query = 'subscription X{ a: testSubscription, b: testSubscription }'; - const callback = () => null; - return expect(subManager.subscribe({ query, operationName: 'X', callback })) - .to.eventually.be.rejectedWith('Subscription query has validation errors'); - }); - - it('can subscribe with a valid query and gets a subId back', function() { - const query = 'subscription X{ testSubscription }'; - const callback = () => null; - subManager.subscribe({ query, operationName: 'X', callback }).then(subId => { - expect(subId).to.be.a('number'); - subManager.unsubscribe(subId); - }); - }); - - it('can subscribe with a nameless query and gets a subId back', function() { - const query = 'subscription { testSubscription }'; - const callback = () => null; - subManager.subscribe({ query, operationName: 'X', callback }).then(subId => { - expect(subId).to.be.a('number'); - subManager.unsubscribe(subId); - }); - }); - - it('can subscribe with a valid query and get the root value', function(done) { - const query = 'subscription X{ testSubscription }'; - const callback = function(err, payload){ - try { - expect(payload.data.testSubscription).to.equals('good'); - } catch (e) { - done(e); - return; - } - done(); - }; - - subManager.subscribe({ query, operationName: 'X', callback }).then(subId => { - subManager.publish('testSubscription', 'good'); - subManager.unsubscribe(subId); - }); - }); - - it('can use filter functions properly', function(done) { - const query = `subscription Filter1($filterBoolean: Boolean){ - testFilter(filterBoolean: $filterBoolean) - }`; - const callback = function(err, payload){ - if (err) { - done(err); - return; - } - try { - expect(payload.data.testFilter).to.equals('goodFilter'); - } catch (e) { - done(e); - return; - } - done(); - }; - subManager.subscribe({ - query, - operationName: 'Filter1', - variables: { filterBoolean: true}, - callback, - }).then(subId => { - subManager.publish('Filter1', {filterBoolean: false }); - subManager.publish('Filter1', {filterBoolean: true }); - subManager.unsubscribe(subId); - }); - }); - - it('can use a filter function that returns a promise', function(done) { - const query = `subscription Filter2($filterBoolean: Boolean){ - testFilter(filterBoolean: $filterBoolean) - }`; - const callback = function(err, payload){ - if (err) { - done(err); - return; - } - try { - expect(payload.data.testFilter).to.equals('goodFilter'); - } catch (e) { - done(e); - return; - } - done(); - }; - subManager.subscribe({ - query, - operationName: 'Filter2', - variables: { filterBoolean: true}, - callback, - }).then(subId => { - subManager.publish('Filter2', {filterBoolean: false }); - subManager.publish('Filter2', {filterBoolean: true }); - subManager.unsubscribe(subId); - }); - }); - - it('can subscribe to more than one trigger', function(done) { - // I also used this for testing arg parsing (with console.log) - // args a and b can safely be removed. - // TODO: write real tests for argument parsing - let triggerCount = 0; - const query = `subscription multiTrigger($filterBoolean: Boolean, $uga: String){ - testFilterMulti(filterBoolean: $filterBoolean, a: $uga, b: 66) - }`; - const callback = function(err, payload){ - try { - expect(payload.data.testFilterMulti).to.equals('goodFilter'); - triggerCount++; - } catch (e) { - done(e); - return; - } - if (triggerCount === 2) { - done(); - } - }; - subManager.subscribe({ - query, - operationName: 'multiTrigger', - variables: { filterBoolean: true, uga: 'UGA'}, - callback, - }).then(subId => { - subManager.publish('NotATrigger', {filterBoolean: false}); - subManager.publish('Trigger1', {filterBoolean: true }); - subManager.publish('Trigger2', {filterBoolean: true }); - subManager.unsubscribe(subId); - }); - }); - - it('can subscribe to a trigger and pass options to PubSub using "channelOptions"', function(done) { - const query = 'subscription X{ testChannelOptions }'; - subManager.subscribe({ - query, - operationName: 'X', - callback: () => null, - }).then(() => { - expect(pubsub.subscribe).to.have.been.calledOnce; - - const expectedChannelOptions = { - foo: 'bar', - }; - expect(pubsub.subscribe).to.have.been.calledWith( - sinon.match.string, - sinon.match.func, - expectedChannelOptions, - ); - - done(); - }).catch(err => { - done(err); - }); - }); - - it('can unsubscribe', function(done) { - const query = 'subscription X{ testSubscription }'; - const callback = (err, payload) => { - try { - assert(false); - } catch (e) { - done(e); - return; - } - done(); - }; - subManager.subscribe({ query, operationName: 'X', callback }).then(subId => { - subManager.unsubscribe(subId); - subManager.publish('testSubscription', 'bad'); - setTimeout(done, 30); - }); - }); - - it('throws an error when trying to unsubscribe from unknown id', function () { - expect(() => subManager.unsubscribe(123)) - .to.throw('undefined'); - }); - - it('throws an error when trying to unsubscribe a second time', function () { - const query = 'subscription X{ testSubscription }'; - return subManager.subscribe({ query, operationName: 'X', callback() { /* no publish */ } }).then(subId => { - subManager.unsubscribe(subId); - expect(() => subManager.unsubscribe(subId)) - .to.throw('undefined'); - }); - }); - - it('calls the error callback if there is an execution error', function(done) { - const query = `subscription X($uga: Boolean!){ - testSubscription @skip(if: $uga) - }`; - const callback = function(err, payload){ - try { - expect(payload).to.be.defined; - } catch (e) { - done(e); - return; - } - done(); - }; - - subManager.subscribe({ query, operationName: 'X', callback }).then(subId => { - subManager.publish('testSubscription', 'good'); - subManager.unsubscribe(subId); - }); - }); - - it('calls context if it is a function', function(done) { - const query = `subscription TestContext { testContext }`; - const callback = function(error, payload) { - expect(error).to.be.null; - expect(payload.data.testContext).to.eq('trigger'); - done(); - }; - const context = function() { - return 'trigger'; - }; - subManager.subscribe({ - query, - context, - operationName: 'TestContext', - variables: {}, - callback, - }).then(subId => { - subManager.publish('contextTrigger', 'ignored'); - subManager.unsubscribe(subId); - }); - }); - - it('call the error callback if a context functions throws an error', function(done) { - const query = `subscription TestContext { testContext }`; - const callback = function(err, payload){ - try { - expect(payload).to.be.undefined; - expect(err.message).to.equals('context error'); - } catch (e) { - done(e); - return; - } - done(); - }; - const context = function() { - throw new Error('context error'); - }; - subManager.subscribe({ - query, - context, - operationName: 'TestContext', - variables: {}, - callback, - }).then(subId => { - subManager.publish('contextTrigger', 'ignored'); - subManager.unsubscribe(subId); - }); - }); - - it('passes arguments to setupFunction', function(done) { - const query = `subscription TestArguments { - testArguments(testArgument: 10) - }`; - const callback = function(error, payload) { - try { - expect(error).to.be.null; - expect(capturedArguments).to.eql({ testArgument: 10 }); - expect(payload.data.testArguments).to.equal('10'); - done(); - } catch (error) { - done(error); - } - }; - subManager.subscribe({ - query, - operationName: 'TestArguments', - variables: {}, - callback, - }).then(subId => { - subManager.publish('Trigger1', 'ignored'); - subManager.unsubscribe(subId); - }); - }); - - it('passes defaultValue of argument to setupFunction', function(done) { - const query = `subscription TestArguments { - testArguments - }`; - const callback = function(error, payload) { - try { - expect(error).to.be.null; - expect(capturedArguments).to.eql({ testArgument: 1234 }); - expect(payload.data.testArguments).to.equal('1234'); - done(); - } catch (error) { - done(error); - } - }; - subManager.subscribe({ - query, - operationName: 'TestArguments', - variables: {}, - callback, - }).then(subId => { - subManager.publish('Trigger1', 'ignored'); - subManager.unsubscribe(subId); - }); - }); -}); -// --------------------------------------------- -// validation tests .... - -// TODO: Gotta test it.. - -const validationSchema = new GraphQLSchema({ - query: new GraphQLObjectType({ - name: 'Query', - fields: { - placeholder: { type: GraphQLString }, - }, - }), - subscription: new GraphQLObjectType({ - name: 'Subscription', - fields: { - test1: { type: GraphQLString }, - test2: { type: GraphQLString }, - }, - }), -}); - -describe('SubscriptionValidationRule', function() { - it('should allow a valid subscription', function() { - const sub = `subscription S1{ - test1 - }`; - const errors = validate(validationSchema, parse(sub), [subscriptionHasSingleRootField]); - expect(errors.length).to.equals(0); - }); - - it('should allow another valid subscription', function() { - const sub = ` - subscription S1{ - test1 - } - subscription S2{ - test2 - }`; - const errors = validate(validationSchema, parse(sub), [subscriptionHasSingleRootField]); - expect(errors.length).to.equals(0); - }); - - it('should allow two valid subscription definitions', function() { - const sub = `subscription S2{ - test2 - }`; - const errors = validate(validationSchema, parse(sub), [subscriptionHasSingleRootField]); - expect(errors.length).to.equals(0); - }); - - - it('should not allow two fields in the subscription', function() { - const sub = `subscription S3{ - test1 - test2 - }`; - const errors = validate(validationSchema, parse(sub), [subscriptionHasSingleRootField]); - expect(errors.length).to.equals(1); - expect(errors[0].message).to.equals('Subscription "S3" must have only one field.'); - }); - - it('should not allow inline fragments', function() { - const sub = `subscription S4{ - ... on Subscription { - test1 - } - }`; - const errors = validate(validationSchema, parse(sub), [subscriptionHasSingleRootField]); - expect(errors.length).to.equals(1); - expect(errors[0].message).to.equals('Apollo subscriptions do not support fragments on the root field'); - }); - - it('should not allow named fragments', function() { - const sub = `subscription S5{ - ...testFragment - } - - fragment testFragment on Subscription{ - test2 - }`; - const errors = validate(validationSchema, parse(sub), [subscriptionHasSingleRootField]); - expect(errors.length).to.equals(1); - expect(errors[0].message).to.equals('Apollo subscriptions do not support fragments on the root field'); + ps.publish(evnetName, { test: true }); }); }); diff --git a/src/validation.ts b/src/validation.ts deleted file mode 100644 index 3d01ec5..0000000 --- a/src/validation.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { - ValidationContext, - SelectionNode, - GraphQLError, -} from 'graphql'; - -// XXX I don't know how else to do this. Can't seem to import from GraphQL. -const FIELD = 'Field'; - -/** - * @deprecated - */ -export function tooManySubscriptionFieldsError(subscriptionName: string): string { - return `Subscription "${subscriptionName}" must have only one field.`; -} - -// XXX we temporarily use this validation rule to make our life a bit easier. - -/** - * @deprecated - */ -export function subscriptionHasSingleRootField(context: ValidationContext): any { - const schema = context.getSchema(); - schema.getSubscriptionType(); - return { - OperationDefinition(node) { - const operationName = node.name ? node.name.value : ''; - let numFields = 0; - node.selectionSet.selections.forEach( (selection: SelectionNode) => { - if (selection.kind === FIELD) { - numFields++; - } else { - // why the heck use a fragment on the Subscription type? Just ... don't - context.reportError(new GraphQLError('Apollo subscriptions do not support fragments on the root field', [node])); - } - }); - if (numFields > 1) { - context.reportError(new GraphQLError(tooManySubscriptionFieldsError(operationName), [node])); - } - return false; - }, - }; -} \ No newline at end of file