From 875faff0cfafae9969b0411ce14b5ae7047744bb Mon Sep 17 00:00:00 2001 From: Juneil Date: Thu, 17 Aug 2017 23:46:07 +0200 Subject: [PATCH 01/19] feat(refactor): first draft --- Makefile | 2 +- package-lock.json | 2708 +++++++++++++++++ package.json | 15 +- src-2/core/decorators.ts | 51 + src-2/core/di.ts | 55 + src-2/core/enums.ts | 10 + src-2/core/hapiness.ts | 142 + src-2/core/hook.ts | 57 + src-2/core/interfaces/extension.ts | 31 + src-2/core/interfaces/index.ts | 2 + src-2/core/interfaces/module.ts | 72 + src-2/core/logger.ts | 17 + src-2/core/metadata.ts | 46 + src-2/core/module.ts | 264 ++ .../externals/injection-js/facade/errors.d.ts | 19 + src-2/externals/injection-js/facade/errors.js | 44 + .../injection-js/facade/errors.js.map | 1 + src-2/externals/injection-js/facade/lang.d.ts | 47 + src-2/externals/injection-js/facade/lang.js | 89 + .../externals/injection-js/facade/lang.js.map | 1 + src-2/externals/injection-js/facade/type.d.ts | 22 + src-2/externals/injection-js/facade/type.js | 24 + .../externals/injection-js/facade/type.js.map | 1 + src-2/externals/injection-js/forward_ref.d.ts | 38 + src-2/externals/injection-js/forward_ref.js | 50 + .../externals/injection-js/forward_ref.js.map | 1 + src-2/externals/injection-js/index.d.ts | 21 + src-2/externals/injection-js/index.js | 34 + src-2/externals/injection-js/index.js.map | 1 + .../injection-js/injection.bundle.js | 38 + .../injection-js/injection_token.d.ts | 62 + .../externals/injection-js/injection_token.js | 76 + .../injection-js/injection_token.js.map | 1 + src-2/externals/injection-js/injector.d.ts | 40 + src-2/externals/injection-js/injector.js | 52 + src-2/externals/injection-js/injector.js.map | 1 + src-2/externals/injection-js/metadata.d.ts | 265 ++ src-2/externals/injection-js/metadata.js | 52 + src-2/externals/injection-js/metadata.js.map | 1 + src-2/externals/injection-js/package.json | 23 + src-2/externals/injection-js/provider.d.ts | 204 ++ src-2/externals/injection-js/provider.js | 9 + src-2/externals/injection-js/provider.js.map | 1 + .../platform_reflection_capabilities.d.ts | 26 + .../platform_reflection_capabilities.js | 9 + .../platform_reflection_capabilities.js.map | 1 + .../injection-js/reflection/reflection.d.ts | 7 + .../injection-js/reflection/reflection.js | 18 + .../injection-js/reflection/reflection.js.map | 1 + .../reflection/reflection_capabilities.d.ts | 29 + .../reflection/reflection_capabilities.js | 234 ++ .../reflection/reflection_capabilities.js.map | 1 + .../injection-js/reflection/reflector.d.ts | 36 + .../injection-js/reflection/reflector.js | 53 + .../injection-js/reflection/reflector.js.map | 1 + .../reflection/reflector_reader.d.ts | 22 + .../reflection/reflector_reader.js | 19 + .../reflection/reflector_reader.js.map | 1 + .../injection-js/reflection/types.d.ts | 10 + .../injection-js/reflection/types.js | 9 + .../injection-js/reflection/types.js.map | 1 + .../injection-js/reflective_errors.d.ts | 138 + .../injection-js/reflective_errors.js | 217 ++ .../injection-js/reflective_errors.js.map | 1 + .../injection-js/reflective_injector.d.ts | 275 ++ .../injection-js/reflective_injector.js | 341 +++ .../injection-js/reflective_injector.js.map | 1 + .../injection-js/reflective_key.d.ts | 36 + .../externals/injection-js/reflective_key.js | 89 + .../injection-js/reflective_key.js.map | 1 + .../injection-js/reflective_provider.d.ts | 88 + .../injection-js/reflective_provider.js | 225 ++ .../injection-js/reflective_provider.js.map | 1 + .../injection-js/util/decorators.d.ts | 162 + .../externals/injection-js/util/decorators.js | 291 ++ .../injection-js/util/decorators.js.map | 1 + test-2/mocha.opts | 7 + test-2/unit/metadata.test.ts | 41 + test-2/unit/mocks.ts | 39 + test-2/unit/module.test.ts | 296 ++ yarn.lock | 1896 ------------ 81 files changed, 7409 insertions(+), 1905 deletions(-) create mode 100644 package-lock.json create mode 100644 src-2/core/decorators.ts create mode 100644 src-2/core/di.ts create mode 100644 src-2/core/enums.ts create mode 100644 src-2/core/hapiness.ts create mode 100644 src-2/core/hook.ts create mode 100644 src-2/core/interfaces/extension.ts create mode 100644 src-2/core/interfaces/index.ts create mode 100644 src-2/core/interfaces/module.ts create mode 100644 src-2/core/logger.ts create mode 100644 src-2/core/metadata.ts create mode 100644 src-2/core/module.ts create mode 100644 src-2/externals/injection-js/facade/errors.d.ts create mode 100644 src-2/externals/injection-js/facade/errors.js create mode 100644 src-2/externals/injection-js/facade/errors.js.map create mode 100644 src-2/externals/injection-js/facade/lang.d.ts create mode 100644 src-2/externals/injection-js/facade/lang.js create mode 100644 src-2/externals/injection-js/facade/lang.js.map create mode 100644 src-2/externals/injection-js/facade/type.d.ts create mode 100644 src-2/externals/injection-js/facade/type.js create mode 100644 src-2/externals/injection-js/facade/type.js.map create mode 100644 src-2/externals/injection-js/forward_ref.d.ts create mode 100644 src-2/externals/injection-js/forward_ref.js create mode 100644 src-2/externals/injection-js/forward_ref.js.map create mode 100644 src-2/externals/injection-js/index.d.ts create mode 100644 src-2/externals/injection-js/index.js create mode 100644 src-2/externals/injection-js/index.js.map create mode 100644 src-2/externals/injection-js/injection.bundle.js create mode 100644 src-2/externals/injection-js/injection_token.d.ts create mode 100644 src-2/externals/injection-js/injection_token.js create mode 100644 src-2/externals/injection-js/injection_token.js.map create mode 100644 src-2/externals/injection-js/injector.d.ts create mode 100644 src-2/externals/injection-js/injector.js create mode 100644 src-2/externals/injection-js/injector.js.map create mode 100644 src-2/externals/injection-js/metadata.d.ts create mode 100644 src-2/externals/injection-js/metadata.js create mode 100644 src-2/externals/injection-js/metadata.js.map create mode 100644 src-2/externals/injection-js/package.json create mode 100644 src-2/externals/injection-js/provider.d.ts create mode 100644 src-2/externals/injection-js/provider.js create mode 100644 src-2/externals/injection-js/provider.js.map create mode 100644 src-2/externals/injection-js/reflection/platform_reflection_capabilities.d.ts create mode 100644 src-2/externals/injection-js/reflection/platform_reflection_capabilities.js create mode 100644 src-2/externals/injection-js/reflection/platform_reflection_capabilities.js.map create mode 100644 src-2/externals/injection-js/reflection/reflection.d.ts create mode 100644 src-2/externals/injection-js/reflection/reflection.js create mode 100644 src-2/externals/injection-js/reflection/reflection.js.map create mode 100644 src-2/externals/injection-js/reflection/reflection_capabilities.d.ts create mode 100644 src-2/externals/injection-js/reflection/reflection_capabilities.js create mode 100644 src-2/externals/injection-js/reflection/reflection_capabilities.js.map create mode 100644 src-2/externals/injection-js/reflection/reflector.d.ts create mode 100644 src-2/externals/injection-js/reflection/reflector.js create mode 100644 src-2/externals/injection-js/reflection/reflector.js.map create mode 100644 src-2/externals/injection-js/reflection/reflector_reader.d.ts create mode 100644 src-2/externals/injection-js/reflection/reflector_reader.js create mode 100644 src-2/externals/injection-js/reflection/reflector_reader.js.map create mode 100644 src-2/externals/injection-js/reflection/types.d.ts create mode 100644 src-2/externals/injection-js/reflection/types.js create mode 100644 src-2/externals/injection-js/reflection/types.js.map create mode 100644 src-2/externals/injection-js/reflective_errors.d.ts create mode 100644 src-2/externals/injection-js/reflective_errors.js create mode 100644 src-2/externals/injection-js/reflective_errors.js.map create mode 100644 src-2/externals/injection-js/reflective_injector.d.ts create mode 100644 src-2/externals/injection-js/reflective_injector.js create mode 100644 src-2/externals/injection-js/reflective_injector.js.map create mode 100644 src-2/externals/injection-js/reflective_key.d.ts create mode 100644 src-2/externals/injection-js/reflective_key.js create mode 100644 src-2/externals/injection-js/reflective_key.js.map create mode 100644 src-2/externals/injection-js/reflective_provider.d.ts create mode 100644 src-2/externals/injection-js/reflective_provider.js create mode 100644 src-2/externals/injection-js/reflective_provider.js.map create mode 100644 src-2/externals/injection-js/util/decorators.d.ts create mode 100644 src-2/externals/injection-js/util/decorators.js create mode 100644 src-2/externals/injection-js/util/decorators.js.map create mode 100644 test-2/mocha.opts create mode 100644 test-2/unit/metadata.test.ts create mode 100644 test-2/unit/mocks.ts create mode 100644 test-2/unit/module.test.ts delete mode 100644 yarn.lock diff --git a/Makefile b/Makefile index 510d3f8..fa7b664 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ pretest: @node ./node_modules/.bin/tslint -p ./tsconfig.json --type-check "./src/**/*.ts" "./test/**/*.ts" --exclude "./src/**/*.d.ts" test: - @node ./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha ./test + @node ./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha ./test-2 coveralls: cat ./coverage/lcov.info | node ./node_modules/.bin/coveralls tsc: diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..5396810 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,2708 @@ +{ + "name": "@hapiness/core", + "version": "1.0.0-rc.6", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "@types/boom": { + "version": "4.3.6", + "resolved": "https://registry.npmjs.org/@types/boom/-/boom-4.3.6.tgz", + "integrity": "sha512-su/eNfCGZrqt49PkCka4W14mCfx5MOaS6qPg7QFu8ZzeyjQ4oXeMg+gBFyCmMzkbmrkha6C7uZuNannWw9wSSw==" + }, + "@types/catbox": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/@types/catbox/-/catbox-7.1.2.tgz", + "integrity": "sha512-9NvH2QwGFTyjCKOgzmXxyX2g/qWs4PXQFETG93JAuK7DqjuROCqfX4dWCgSBV8m69XLiIbNc8QFYooIkIlvfcA==", + "requires": { + "@types/boom": "4.3.6" + } + }, + "@types/fs-extra": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-4.0.0.tgz", + "integrity": "sha512-PlKJw6ujJXLJjbvB3T0UCbY3jibKM6/Ya5cc9j1q+mYDeK3aR4Dp+20ZwxSuvJr9mIoPxp7+IL4aMOEvsscRTA==", + "dev": true, + "requires": { + "@types/node": "8.0.19" + } + }, + "@types/hapi": { + "version": "16.1.8", + "resolved": "https://registry.npmjs.org/@types/hapi/-/hapi-16.1.8.tgz", + "integrity": "sha512-SICFotDKQhSybmdaScGWftQ9mPRx98hiMpU2XzfmxYOSlnmla60QRy4PId/wa0p62fdozBxVrg+fgczFlU1dmA==", + "requires": { + "@types/boom": "4.3.6", + "@types/catbox": "7.1.2", + "@types/joi": "10.4.0", + "@types/mimos": "3.0.1", + "@types/node": "8.0.19", + "@types/podium": "1.0.0", + "@types/shot": "3.4.0" + } + }, + "@types/hoek": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/@types/hoek/-/hoek-4.1.3.tgz", + "integrity": "sha1-0ZgtSPsNKg5dfp2Rg4Jk2OQo0zc=" + }, + "@types/joi": { + "version": "10.4.0", + "resolved": "https://registry.npmjs.org/@types/joi/-/joi-10.4.0.tgz", + "integrity": "sha512-YWG77KJ29DMSPbpFVvcMvafUPAkqXg1e2syk73pm5AOVtOfiHYj6J5EKbqCJe6NRwAQXuf0V8t9zvbRgKbkxHw==" + }, + "@types/mime-db": { + "version": "1.27.0", + "resolved": "https://registry.npmjs.org/@types/mime-db/-/mime-db-1.27.0.tgz", + "integrity": "sha1-m8AUof0f30dknBpUxt15ZrgoR5I=" + }, + "@types/mimos": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@types/mimos/-/mimos-3.0.1.tgz", + "integrity": "sha512-MATIRH4VMIJki8lcYUZdNQEHuAG7iQ1FWwoLgxV+4fUOly2xZYdhHtGgvQyWiTeJqq2tZbE0nOOgZD6pR0FpNQ==", + "requires": { + "@types/mime-db": "1.27.0" + } + }, + "@types/node": { + "version": "8.0.19", + "resolved": "https://registry.npmjs.org/@types/node/-/node-8.0.19.tgz", + "integrity": "sha512-VRQB+Q0L3YZWs45uRdpN9oWr82meL/8TrJ6faoKT5tp0uub2l/aRMhtm5fo68h7kjYKH60f9/bay1nF7ZpTW5g==" + }, + "@types/podium": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@types/podium/-/podium-1.0.0.tgz", + "integrity": "sha1-v6ohUb4rHWEJzGn3+qnawsujuyA=" + }, + "@types/shot": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/@types/shot/-/shot-3.4.0.tgz", + "integrity": "sha1-RZR3xRh9Pr0wNmCrCZ5+ng87ZW8=", + "requires": { + "@types/node": "8.0.19" + } + }, + "@types/websocket": { + "version": "0.0.34", + "resolved": "https://registry.npmjs.org/@types/websocket/-/websocket-0.0.34.tgz", + "integrity": "sha512-cvN32rSoC4aXpXHG2Gf8/f8/gtyA7PmE38E3ENsMymFPgoG8xD/kH/KAVhTINCZTPqmgaWN86c1MitMEsuHjnQ==", + "requires": { + "@types/node": "8.0.19" + } + }, + "abbrev": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.0.9.tgz", + "integrity": "sha1-kbR5JYinc4wl813W9jdSovh3YTU=", + "dev": true + }, + "accept": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/accept/-/accept-2.1.4.tgz", + "integrity": "sha1-iHr1TO7lx/RDBGGXHsQAxh0JrLs=", + "requires": { + "boom": "5.2.0", + "hoek": "4.2.0" + } + }, + "align-text": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/align-text/-/align-text-0.1.4.tgz", + "integrity": "sha1-DNkKVhCT810KmSVsIrcGlDP60Rc=", + "dev": true, + "requires": { + "kind-of": "3.2.2", + "longest": "1.0.1", + "repeat-string": "1.6.1" + } + }, + "amdefine": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.1.tgz", + "integrity": "sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU=", + "dev": true + }, + "ammo": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/ammo/-/ammo-2.0.4.tgz", + "integrity": "sha1-v4CqshFpjqePY+9efxE91dnokX8=", + "requires": { + "boom": "5.2.0", + "hoek": "4.2.0" + } + }, + "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, + "requires": { + "default-require-extensions": "1.0.0" + } + }, + "argparse": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.9.tgz", + "integrity": "sha1-c9g7wmP4bpf4zE9rrhsOkKfSLIY=", + "dev": true, + "requires": { + "sprintf-js": "1.0.3" + } + }, + "arrify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", + "integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=", + "dev": true + }, + "asn1": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.3.tgz", + "integrity": "sha1-2sh4dxPJlmhJ/IGAd36+nB3fO4Y=", + "dev": true + }, + "assert-plus": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-0.2.0.tgz", + "integrity": "sha1-104bh+ev/A24qttwIfP+SBAasjQ=", + "dev": true + }, + "async": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", + "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=", + "dev": true + }, + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", + "dev": true + }, + "aws-sign2": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.6.0.tgz", + "integrity": "sha1-FDQt0428yU0OW4fXY81jYSwOeU8=", + "dev": true + }, + "aws4": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.6.0.tgz", + "integrity": "sha1-g+9cqGCysy5KDe7e6MdxudtXRx4=", + "dev": true + }, + "b64": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/b64/-/b64-3.0.3.tgz", + "integrity": "sha512-Pbeh0i6OLubPJdIdCepn8ZQHwN2MWznZHbHABSTEfQ706ie+yuxNSaPdqX1xRatT6WanaS1EazMiSg0NUW2XxQ==" + }, + "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, + "requires": { + "chalk": "1.1.3", + "esutils": "2.0.2", + "js-tokens": "3.0.2" + } + }, + "babel-generator": { + "version": "6.25.0", + "resolved": "https://registry.npmjs.org/babel-generator/-/babel-generator-6.25.0.tgz", + "integrity": "sha1-M6GvcNXyiQrrRlpKd5PB32qeqfw=", + "dev": true, + "requires": { + "babel-messages": "6.23.0", + "babel-runtime": "6.25.0", + "babel-types": "6.25.0", + "detect-indent": "4.0.0", + "jsesc": "1.3.0", + "lodash": "4.17.4", + "source-map": "0.5.6", + "trim-right": "1.0.1" + } + }, + "babel-messages": { + "version": "6.23.0", + "resolved": "https://registry.npmjs.org/babel-messages/-/babel-messages-6.23.0.tgz", + "integrity": "sha1-8830cDhYA1sqKVHG7F7fbGLyYw4=", + "dev": true, + "requires": { + "babel-runtime": "6.25.0" + } + }, + "babel-runtime": { + "version": "6.25.0", + "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.25.0.tgz", + "integrity": "sha1-M7mOql1IK7AajRqmtDetKwGuxBw=", + "dev": true, + "requires": { + "core-js": "2.4.1", + "regenerator-runtime": "0.10.5" + } + }, + "babel-template": { + "version": "6.25.0", + "resolved": "https://registry.npmjs.org/babel-template/-/babel-template-6.25.0.tgz", + "integrity": "sha1-ZlJBFmt8KqTGGdceGSlpVSsQwHE=", + "dev": true, + "requires": { + "babel-runtime": "6.25.0", + "babel-traverse": "6.25.0", + "babel-types": "6.25.0", + "babylon": "6.17.4", + "lodash": "4.17.4" + } + }, + "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, + "requires": { + "babel-code-frame": "6.22.0", + "babel-messages": "6.23.0", + "babel-runtime": "6.25.0", + "babel-types": "6.25.0", + "babylon": "6.17.4", + "debug": "2.6.8", + "globals": "9.18.0", + "invariant": "2.2.2", + "lodash": "4.17.4" + } + }, + "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, + "requires": { + "babel-runtime": "6.25.0", + "esutils": "2.0.2", + "lodash": "4.17.4", + "to-fast-properties": "1.0.3" + } + }, + "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 + }, + "bcrypt-pbkdf": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.1.tgz", + "integrity": "sha1-Y7xdy2EzG5K8Bf1SiVPDNGKgb40=", + "dev": true, + "optional": true, + "requires": { + "tweetnacl": "0.14.5" + } + }, + "bluebird": { + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-2.11.0.tgz", + "integrity": "sha1-U0uQM8AiyVecVro7Plpcqvu2UOE=", + "dev": true + }, + "boom": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/boom/-/boom-5.2.0.tgz", + "integrity": "sha512-Z5BTk6ZRe4tXXQlkqftmsAUANpXmuwlsF5Oov8ThoMbQRzdGTA1ngYRW160GexgOgjsFOKJz0LYhoNi+2AMBUw==", + "requires": { + "hoek": "4.2.0" + } + }, + "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, + "requires": { + "balanced-match": "1.0.0", + "concat-map": "0.0.1" + } + }, + "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 + }, + "call": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/call/-/call-4.0.2.tgz", + "integrity": "sha1-33b19R7o3Ui4VqyEAPfmnm1zmcQ=", + "requires": { + "boom": "5.2.0", + "hoek": "4.2.0" + } + }, + "camelcase": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-1.2.1.tgz", + "integrity": "sha1-m7UwTS4LVmmLLHWLCKPqqdqlijk=", + "dev": true, + "optional": true + }, + "caseless": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.11.0.tgz", + "integrity": "sha1-cVuW6phBWTzDMGeSP17GDr2k99c=", + "dev": true + }, + "catbox": { + "version": "7.1.5", + "resolved": "https://registry.npmjs.org/catbox/-/catbox-7.1.5.tgz", + "integrity": "sha512-4fui5lELzqZ+9cnaAP/BcqXTH6LvWLBRtFhJ0I4FfgfXiSaZcf6k9m9dqOyChiTxNYtvLk7ZMYSf7ahMq3bf5A==", + "requires": { + "boom": "5.2.0", + "hoek": "4.2.0", + "joi": "10.6.0" + } + }, + "catbox-memory": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/catbox-memory/-/catbox-memory-2.0.4.tgz", + "integrity": "sha1-Qz4lWQLK9UIz0ShkKcj03xToItU=", + "requires": { + "hoek": "4.2.0" + } + }, + "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, + "requires": { + "align-text": "0.1.4", + "lazy-cache": "1.0.4" + } + }, + "chalk": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", + "dev": true, + "requires": { + "ansi-styles": "2.2.1", + "escape-string-regexp": "1.0.5", + "has-ansi": "2.0.0", + "strip-ansi": "3.0.1", + "supports-color": "2.0.0" + } + }, + "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, + "requires": { + "center-align": "0.1.3", + "right-align": "0.1.3", + "wordwrap": "0.0.2" + }, + "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 + } + } + }, + "code-point-at": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", + "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", + "dev": true + }, + "color-convert": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.0.tgz", + "integrity": "sha1-Gsz5fdc5uYO/mU1W/sj5WFNkG3o=", + "dev": true, + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", + "dev": true + }, + "colors": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/colors/-/colors-1.1.2.tgz", + "integrity": "sha1-FopHAXVran9RoSzgyXv6KMCE7WM=", + "dev": true + }, + "combined-stream": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.5.tgz", + "integrity": "sha1-k4NwpXtKUd6ix3wV1cX9+JUWQAk=", + "dev": true, + "requires": { + "delayed-stream": "1.0.0" + } + }, + "commander": { + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.11.0.tgz", + "integrity": "sha512-b0553uYA5YAEGgyYIGYROzKQ7X5RAqedkfjiZxwi0kL1g3bOaBNNZfYkzt/CL0umgD5wc9Jec2FbB98CjkMRvQ==", + "dev": true + }, + "component-emitter": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.1.2.tgz", + "integrity": "sha1-KWWU8nU9qmOZbSrwjRWpURbJrsM=", + "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 + }, + "content": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/content/-/content-3.0.5.tgz", + "integrity": "sha512-MQVYZuNnm5N0xalwtRGlZrcKFwgE6VKXCEh3XkCeoWUo3gL5BS52UiqswRvAwQW1ocfdCNkEKI5uy0pNGax+IQ==", + "requires": { + "boom": "5.2.0" + } + }, + "cookiejar": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/cookiejar/-/cookiejar-2.0.1.tgz", + "integrity": "sha1-PRJ1L2rfaKiS8zJDNJK9WBK7Zo8=", + "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 + }, + "coveralls": { + "version": "2.13.1", + "resolved": "https://registry.npmjs.org/coveralls/-/coveralls-2.13.1.tgz", + "integrity": "sha1-1wu5rMGDXsTwY/+drFQjwXsR8Xg=", + "dev": true, + "requires": { + "js-yaml": "3.6.1", + "lcov-parse": "0.0.10", + "log-driver": "1.2.5", + "minimist": "1.2.0", + "request": "2.79.0" + } + }, + "cryptiles": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-3.1.2.tgz", + "integrity": "sha1-qJ+7Ig9c4l7FboxKqKT9e1sNKf4=", + "requires": { + "boom": "5.2.0" + } + }, + "dashdash": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", + "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", + "dev": true, + "requires": { + "assert-plus": "1.0.0" + }, + "dependencies": { + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", + "dev": true + } + } + }, + "debug": { + "version": "2.6.8", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.8.tgz", + "integrity": "sha1-5zFTHKLt4n0YgiJCfaF4IdaP9Pw=", + "requires": { + "ms": "2.0.0" + } + }, + "decamelize": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", + "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, + "requires": { + "strip-bom": "2.0.0" + } + }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", + "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, + "requires": { + "repeating": "2.0.1" + } + }, + "diff": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-3.2.0.tgz", + "integrity": "sha1-yc45Okt8vQsFinJck98pkCeGj/k=", + "dev": true + }, + "ecc-jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz", + "integrity": "sha1-D8c6ntXw1Tw4GTOYUj735UN3dQU=", + "dev": true, + "optional": true, + "requires": { + "jsbn": "0.1.1" + } + }, + "error-ex": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.1.tgz", + "integrity": "sha1-+FWobOYa3E6GIcPNoh56dhLDqNw=", + "dev": true, + "requires": { + "is-arrayish": "0.2.1" + } + }, + "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 + }, + "esprima": { + "version": "2.7.3", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-2.7.3.tgz", + "integrity": "sha1-luO3DVd59q1JzQMmc9HDEnZ7pYE=", + "dev": true + }, + "esutils": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", + "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=", + "dev": true + }, + "extend": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.1.tgz", + "integrity": "sha1-p1Xqe8Gt/MWjHOfnYtuq3F5jZEQ=", + "dev": true + }, + "extsprintf": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", + "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=", + "dev": true + }, + "fileset": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/fileset/-/fileset-2.0.3.tgz", + "integrity": "sha1-jnVIqW08wjJ+5eZ0FocjozO7oqA=", + "dev": true, + "requires": { + "glob": "7.1.2", + "minimatch": "3.0.4" + } + }, + "find-up": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz", + "integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=", + "dev": true, + "requires": { + "path-exists": "2.1.0", + "pinkie-promise": "2.0.1" + } + }, + "forever-agent": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", + "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=", + "dev": true + }, + "form-data": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.1.4.tgz", + "integrity": "sha1-M8GDrPGTJ27KqYFDpp6Uv+4XUNE=", + "dev": true, + "requires": { + "asynckit": "0.4.0", + "combined-stream": "1.0.5", + "mime-types": "2.1.16" + } + }, + "formatio": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/formatio/-/formatio-1.1.1.tgz", + "integrity": "sha1-XtPM1jZVEJc4NGXZlhmRAOhhYek=", + "dev": true, + "requires": { + "samsam": "1.1.2" + } + }, + "formidable": { + "version": "1.0.14", + "resolved": "https://registry.npmjs.org/formidable/-/formidable-1.0.14.tgz", + "integrity": "sha1-Kz9MQRy7X91pXESEPiojUUpDIxo=", + "dev": true + }, + "fs-extra": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-4.0.1.tgz", + "integrity": "sha1-f8DGyJV/mD9X8waiTlud3Y0N2IA=", + "dev": true, + "requires": { + "graceful-fs": "4.1.11", + "jsonfile": "3.0.1", + "universalify": "0.1.1" + } + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "dev": true + }, + "generate-function": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/generate-function/-/generate-function-2.0.0.tgz", + "integrity": "sha1-aFj+fAlpt9TpCTM3ZHrHn2DfvnQ=", + "dev": true + }, + "generate-object-property": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/generate-object-property/-/generate-object-property-1.2.0.tgz", + "integrity": "sha1-nA4cQDCM6AT0eDYYuTf6iPmdUNA=", + "dev": true, + "requires": { + "is-property": "1.0.2" + } + }, + "get-caller-file": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.2.tgz", + "integrity": "sha1-9wLmMSfn4jHBYKgMFVSstw1QR+U=", + "dev": true + }, + "getpass": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", + "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", + "dev": true, + "requires": { + "assert-plus": "1.0.0" + }, + "dependencies": { + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", + "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, + "requires": { + "fs.realpath": "1.0.0", + "inflight": "1.0.6", + "inherits": "2.0.3", + "minimatch": "3.0.4", + "once": "1.4.0", + "path-is-absolute": "1.0.1" + } + }, + "globals": { + "version": "9.18.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-9.18.0.tgz", + "integrity": "sha512-S0nG3CLEQiY/ILxqtztTWH/3iRRdyBLw6KMDxnKMchrtbj2OFmehVh0WUCfW3DUrIgx/qFrJPICrq4Z4sTR9UQ==", + "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 + }, + "growl": { + "version": "1.9.2", + "resolved": "https://registry.npmjs.org/growl/-/growl-1.9.2.tgz", + "integrity": "sha1-Dqd0NxXbjY3ixe3hd14bRayFwC8=", + "dev": true + }, + "handlebars": { + "version": "4.0.10", + "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.0.10.tgz", + "integrity": "sha1-PTDHGLCaPZbyPqTMH0A8TTup/08=", + "dev": true, + "requires": { + "async": "1.5.2", + "optimist": "0.6.1", + "source-map": "0.4.4", + "uglify-js": "2.8.29" + }, + "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, + "requires": { + "amdefine": "1.0.1" + } + } + } + }, + "hapi": { + "version": "16.5.2", + "resolved": "https://registry.npmjs.org/hapi/-/hapi-16.5.2.tgz", + "integrity": "sha512-8aXEiC2IT1bfF/5RYz9LtWqm99oGVDd2JcQ3KRRvFGDngEE35kZl9Bk2jproY97fBrmAlvkNrmQKWf3jb2lNxw==", + "requires": { + "accept": "2.1.4", + "ammo": "2.0.4", + "boom": "5.2.0", + "call": "4.0.2", + "catbox": "7.1.5", + "catbox-memory": "2.0.4", + "cryptiles": "3.1.2", + "heavy": "4.0.4", + "hoek": "4.2.0", + "iron": "4.0.5", + "items": "2.1.1", + "joi": "10.6.0", + "mimos": "3.0.3", + "podium": "1.3.0", + "shot": "3.4.2", + "statehood": "5.0.3", + "subtext": "5.0.0", + "topo": "2.0.2" + } + }, + "har-validator": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-2.0.6.tgz", + "integrity": "sha1-zcvAgYgmWtEZtqWnyKtw7s+10n0=", + "dev": true, + "requires": { + "chalk": "1.1.3", + "commander": "2.11.0", + "is-my-json-valid": "2.16.0", + "pinkie-promise": "2.0.1" + } + }, + "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, + "requires": { + "ansi-regex": "2.1.1" + } + }, + "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 + }, + "hawk": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/hawk/-/hawk-3.1.3.tgz", + "integrity": "sha1-B4REvXwWQLD+VA0sm3PVlnjo4cQ=", + "dev": true, + "requires": { + "boom": "2.10.1", + "cryptiles": "2.0.5", + "hoek": "2.16.3", + "sntp": "1.0.9" + }, + "dependencies": { + "boom": { + "version": "2.10.1", + "resolved": "https://registry.npmjs.org/boom/-/boom-2.10.1.tgz", + "integrity": "sha1-OciRjO/1eZ+D+UkqhI9iWt0Mdm8=", + "dev": true, + "requires": { + "hoek": "2.16.3" + } + }, + "cryptiles": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-2.0.5.tgz", + "integrity": "sha1-O9/s3GCBR8HGcgL6KR59ylnqo7g=", + "dev": true, + "requires": { + "boom": "2.10.1" + } + }, + "hoek": { + "version": "2.16.3", + "resolved": "https://registry.npmjs.org/hoek/-/hoek-2.16.3.tgz", + "integrity": "sha1-ILt0A9POo5jpHcRxCo/xuCdKJe0=", + "dev": true + } + } + }, + "heavy": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/heavy/-/heavy-4.0.4.tgz", + "integrity": "sha1-NskTNsAMz+hSyqTRUwhjNc0vAOk=", + "requires": { + "boom": "5.2.0", + "hoek": "4.2.0", + "joi": "10.6.0" + } + }, + "hoek": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/hoek/-/hoek-4.2.0.tgz", + "integrity": "sha512-v0XCLxICi9nPfYrS9RL8HbYnXi9obYAeLbSP00BmnZwCK9+Ih9WOjoZ8YoHCoav2csqn4FOz4Orldsy2dmDwmQ==" + }, + "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 + }, + "http-signature": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.1.1.tgz", + "integrity": "sha1-33LiZwZs0Kxn+3at+OE0qPvPkb8=", + "dev": true, + "requires": { + "assert-plus": "0.2.0", + "jsprim": "1.4.1", + "sshpk": "1.13.1" + } + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dev": true, + "requires": { + "once": "1.4.0", + "wrappy": "1.0.2" + } + }, + "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, + "requires": { + "loose-envify": "1.3.1" + } + }, + "invert-kv": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz", + "integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=", + "dev": true + }, + "iron": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/iron/-/iron-4.0.5.tgz", + "integrity": "sha1-TwQszri5c480a1mqc0yDqJvDFCg=", + "requires": { + "boom": "5.2.0", + "cryptiles": "3.1.2", + "hoek": "4.2.0" + } + }, + "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, + "requires": { + "builtin-modules": "1.1.1" + } + }, + "is-finite": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-finite/-/is-finite-1.0.2.tgz", + "integrity": "sha1-zGZ3aVYCvlUO8R6LSqYwU0K20Ko=", + "dev": true, + "requires": { + "number-is-nan": "1.0.1" + } + }, + "is-fullwidth-code-point": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", + "dev": true, + "requires": { + "number-is-nan": "1.0.1" + } + }, + "is-my-json-valid": { + "version": "2.16.0", + "resolved": "https://registry.npmjs.org/is-my-json-valid/-/is-my-json-valid-2.16.0.tgz", + "integrity": "sha1-8Hndm/2uZe4gOKrorLyGqxCeNpM=", + "dev": true, + "requires": { + "generate-function": "2.0.0", + "generate-object-property": "1.2.0", + "jsonpointer": "4.0.1", + "xtend": "4.0.1" + } + }, + "is-property": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-property/-/is-property-1.0.2.tgz", + "integrity": "sha1-V/4cTkhHTt1lsJkR8msc1Ald2oQ=", + "dev": true + }, + "is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" + }, + "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 + }, + "isemail": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/isemail/-/isemail-2.2.1.tgz", + "integrity": "sha1-A1PT2aYpUQgMJiwqoKQrjqjp4qY=" + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "dev": true + }, + "isstream": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", + "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=", + "dev": true + }, + "istanbul": { + "version": "1.1.0-alpha.1", + "resolved": "https://registry.npmjs.org/istanbul/-/istanbul-1.1.0-alpha.1.tgz", + "integrity": "sha1-eBeVZWAYohdMX2DzZ+5dNhy1e3c=", + "dev": true, + "requires": { + "abbrev": "1.0.9", + "async": "1.5.2", + "istanbul-api": "1.1.11", + "js-yaml": "3.6.1", + "mkdirp": "0.5.1", + "nopt": "3.0.6", + "which": "1.3.0", + "wordwrap": "1.0.0" + } + }, + "istanbul-api": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/istanbul-api/-/istanbul-api-1.1.11.tgz", + "integrity": "sha1-/MC0YeKzvaceMFFVE4I4doJX2d4=", + "dev": true, + "requires": { + "async": "2.5.0", + "fileset": "2.0.3", + "istanbul-lib-coverage": "1.1.1", + "istanbul-lib-hook": "1.0.7", + "istanbul-lib-instrument": "1.7.4", + "istanbul-lib-report": "1.1.1", + "istanbul-lib-source-maps": "1.2.1", + "istanbul-reports": "1.1.1", + "js-yaml": "3.9.1", + "mkdirp": "0.5.1", + "once": "1.4.0" + }, + "dependencies": { + "async": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/async/-/async-2.5.0.tgz", + "integrity": "sha512-e+lJAJeNWuPCNyxZKOBdaJGyLGHugXVQtrAwtuAe2vhxTYxFTKE73p8JuTmdH0qdQZtDvI4dhJwjZc5zsfIsYw==", + "dev": true, + "requires": { + "lodash": "4.17.4" + } + }, + "esprima": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.0.tgz", + "integrity": "sha512-oftTcaMu/EGrEIu904mWteKIv8vMuOgGYo7EhVJJN00R/EED9DCua/xxHRdYnKtcECzVg7xOWhflvJMnqcFZjw==", + "dev": true + }, + "js-yaml": { + "version": "3.9.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.9.1.tgz", + "integrity": "sha512-CbcG379L1e+mWBnLvHWWeLs8GyV/EMw862uLI3c+GxVyDHWZcjZinwuBd3iW2pgxgIlksW/1vNJa4to+RvDOww==", + "dev": true, + "requires": { + "argparse": "1.0.9", + "esprima": "4.0.0" + } + } + } + }, + "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, + "requires": { + "append-transform": "0.4.0" + } + }, + "istanbul-lib-instrument": { + "version": "1.7.4", + "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-1.7.4.tgz", + "integrity": "sha1-6f2SDkdn89Ge3HZeLWs/XMvQ7qg=", + "dev": true, + "requires": { + "babel-generator": "6.25.0", + "babel-template": "6.25.0", + "babel-traverse": "6.25.0", + "babel-types": "6.25.0", + "babylon": "6.17.4", + "istanbul-lib-coverage": "1.1.1", + "semver": "5.4.1" + } + }, + "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, + "requires": { + "istanbul-lib-coverage": "1.1.1", + "mkdirp": "0.5.1", + "path-parse": "1.0.5", + "supports-color": "3.2.3" + }, + "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, + "requires": { + "has-flag": "1.0.0" + } + } + } + }, + "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, + "requires": { + "debug": "2.6.8", + "istanbul-lib-coverage": "1.1.1", + "mkdirp": "0.5.1", + "rimraf": "2.6.1", + "source-map": "0.5.6" + } + }, + "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, + "requires": { + "handlebars": "4.0.10" + } + }, + "items": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/items/-/items-2.1.1.tgz", + "integrity": "sha1-i9FtnIOxlSneWuoyGsqtp4NkoZg=" + }, + "joi": { + "version": "10.6.0", + "resolved": "https://registry.npmjs.org/joi/-/joi-10.6.0.tgz", + "integrity": "sha512-hBF3LcqyAid+9X/pwg+eXjD2QBZI5eXnBFJYaAkH4SK3mp9QSRiiQnDYlmlz5pccMvnLcJRS4whhDOTCkmsAdQ==", + "requires": { + "hoek": "4.2.0", + "isemail": "2.2.1", + "items": "2.1.1", + "topo": "2.0.2" + } + }, + "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.6.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.6.1.tgz", + "integrity": "sha1-bl/mfYsgXOTSL60Ft3geja3MSzA=", + "dev": true, + "requires": { + "argparse": "1.0.9", + "esprima": "2.7.3" + } + }, + "jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", + "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", + "dev": true, + "optional": true + }, + "jsesc": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-1.3.0.tgz", + "integrity": "sha1-RsP+yMGJKxKwgz25vHYiF226s0s=", + "dev": true + }, + "json-schema": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", + "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=", + "dev": true + }, + "json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=", + "dev": true + }, + "json3": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/json3/-/json3-3.3.2.tgz", + "integrity": "sha1-PAQ0dD35Pi9cQq7nsZvLSDV19OE=", + "dev": true + }, + "jsonfile": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-3.0.1.tgz", + "integrity": "sha1-pezG9l9T9mLEQVx2daAzHQmS7GY=", + "dev": true, + "requires": { + "graceful-fs": "4.1.11" + } + }, + "jsonpointer": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/jsonpointer/-/jsonpointer-4.0.1.tgz", + "integrity": "sha1-T9kss04OnbPInIYi7PUfm5eMbLk=", + "dev": true + }, + "jsprim": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", + "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", + "dev": true, + "requires": { + "assert-plus": "1.0.0", + "extsprintf": "1.3.0", + "json-schema": "0.2.3", + "verror": "1.10.0" + }, + "dependencies": { + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", + "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, + "requires": { + "is-buffer": "1.1.5" + } + }, + "kindof": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/kindof/-/kindof-1.0.0.tgz", + "integrity": "sha1-ExiZqFJ1N6lNou3NXMSfxglgZWA=", + "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 + }, + "lcid": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz", + "integrity": "sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU=", + "dev": true, + "requires": { + "invert-kv": "1.0.0" + } + }, + "lcov-parse": { + "version": "0.0.10", + "resolved": "https://registry.npmjs.org/lcov-parse/-/lcov-parse-0.0.10.tgz", + "integrity": "sha1-GwuP+ayceIklBYK3C3ExXZ2m2aM=", + "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, + "requires": { + "graceful-fs": "4.1.11", + "parse-json": "2.2.0", + "pify": "2.3.0", + "pinkie-promise": "2.0.1", + "strip-bom": "2.0.0" + } + }, + "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, + "requires": { + "lodash._basecopy": "3.0.1", + "lodash.keys": "3.1.2" + } + }, + "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._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.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, + "requires": { + "lodash._baseassign": "3.2.0", + "lodash._basecreate": "3.0.3", + "lodash._isiterateecall": "3.0.9" + } + }, + "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, + "requires": { + "lodash._getnative": "3.9.1", + "lodash.isarguments": "3.1.0", + "lodash.isarray": "3.0.4" + } + }, + "log-driver": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/log-driver/-/log-driver-1.2.5.tgz", + "integrity": "sha1-euTsJXMC/XkNVXyxDJcQDYV7AFY=", + "dev": true + }, + "lolex": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/lolex/-/lolex-1.3.2.tgz", + "integrity": "sha1-fD2mL/yzDw9agKJWbKJORdigHzE=", + "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, + "requires": { + "js-tokens": "3.0.2" + } + }, + "make-error": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.0.tgz", + "integrity": "sha1-Uq06M5zPEM5itAQLcI/nByRLi5Y=", + "dev": true + }, + "methods": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", + "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=", + "dev": true + }, + "mime": { + "version": "1.2.11", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.2.11.tgz", + "integrity": "sha1-WCA+7Ybjpe8XrtK32evUfwpg3RA=", + "dev": true + }, + "mime-db": { + "version": "1.29.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.29.0.tgz", + "integrity": "sha1-SNJtI1WJZRcErFkWygYAGRQmaHg=" + }, + "mime-types": { + "version": "2.1.16", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.16.tgz", + "integrity": "sha1-K4WKUuXs1RbbiXrCvodIeDBpjiM=", + "dev": true, + "requires": { + "mime-db": "1.29.0" + } + }, + "mimos": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/mimos/-/mimos-3.0.3.tgz", + "integrity": "sha1-uRCQcq03jCty9qAQHEPd+ys2ZB8=", + "requires": { + "hoek": "4.2.0", + "mime-db": "1.29.0" + } + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "dev": true, + "requires": { + "brace-expansion": "1.1.8" + } + }, + "minimist": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", + "dev": true + }, + "mkdirp": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", + "dev": true, + "requires": { + "minimist": "0.0.8" + }, + "dependencies": { + "minimist": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", + "dev": true + } + } + }, + "mocha": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-3.5.0.tgz", + "integrity": "sha512-pIU2PJjrPYvYRqVpjXzj76qltO9uBYI7woYAMoxbSefsa+vqAfptjoeevd6bUgwD0mPIO+hv9f7ltvsNreL2PA==", + "dev": true, + "requires": { + "browser-stdout": "1.3.0", + "commander": "2.9.0", + "debug": "2.6.8", + "diff": "3.2.0", + "escape-string-regexp": "1.0.5", + "glob": "7.1.1", + "growl": "1.9.2", + "json3": "3.3.2", + "lodash.create": "3.1.1", + "mkdirp": "0.5.1", + "supports-color": "3.1.2" + }, + "dependencies": { + "commander": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.9.0.tgz", + "integrity": "sha1-nJkJQXbhIkDLItbFFGCYQA/g99Q=", + "dev": true, + "requires": { + "graceful-readlink": "1.0.1" + } + }, + "glob": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.1.tgz", + "integrity": "sha1-gFIR3wT6rxxjo2ADBs31reULLsg=", + "dev": true, + "requires": { + "fs.realpath": "1.0.0", + "inflight": "1.0.6", + "inherits": "2.0.3", + "minimatch": "3.0.4", + "once": "1.4.0", + "path-is-absolute": "1.0.1" + } + }, + "supports-color": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-3.1.2.tgz", + "integrity": "sha1-cqJiiU2dQIuVbKBf83su2KbiotU=", + "dev": true, + "requires": { + "has-flag": "1.0.0" + } + } + } + }, + "mocha-typescript": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/mocha-typescript/-/mocha-typescript-1.1.7.tgz", + "integrity": "sha512-lry2h3fpqkLzi4y6cOSiyG5DSVL95l99s0GRmvg6BSzYHucnN9ZCAjM0G095tZA3StMo2hC1IgCigjeDN7NCKw==", + "dev": true, + "requires": { + "chalk": "1.1.3", + "yargs": "6.6.0" + }, + "dependencies": { + "camelcase": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-3.0.0.tgz", + "integrity": "sha1-MvxLn82vhF/N9+c7uXysImHwqwo=", + "dev": true + }, + "cliui": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz", + "integrity": "sha1-EgYBU3qRbSmUD5NNo7SNWFo5IT0=", + "dev": true, + "requires": { + "string-width": "1.0.2", + "strip-ansi": "3.0.1", + "wrap-ansi": "2.1.0" + } + }, + "yargs": { + "version": "6.6.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-6.6.0.tgz", + "integrity": "sha1-eC7CHvQDNF+DCoCMo9UTr1YGUgg=", + "dev": true, + "requires": { + "camelcase": "3.0.0", + "cliui": "3.2.0", + "decamelize": "1.2.0", + "get-caller-file": "1.0.2", + "os-locale": "1.4.0", + "read-pkg-up": "1.0.1", + "require-directory": "2.1.1", + "require-main-filename": "1.0.1", + "set-blocking": "2.0.0", + "string-width": "1.0.2", + "which-module": "1.0.0", + "y18n": "3.2.1", + "yargs-parser": "4.2.1" + } + } + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + }, + "must": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/must/-/must-0.12.0.tgz", + "integrity": "sha1-V0HnKb7byLD+K8jFAGRZQVOD0F0=", + "dev": true, + "requires": { + "kindof": "1.0.0" + } + }, + "nan": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.6.2.tgz", + "integrity": "sha1-5P805slf37WuzAjeZZb0NgWn20U=" + }, + "nigel": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/nigel/-/nigel-2.0.2.tgz", + "integrity": "sha1-k6GGb7DFLYc5CqdeKxYfS1x15bE=", + "requires": { + "hoek": "4.2.0", + "vise": "2.0.2" + } + }, + "noder.io": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/noder.io/-/noder.io-1.2.0.tgz", + "integrity": "sha1-rSvGxsP5RliR7bxtv16E3K4vqeY=", + "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, + "requires": { + "abbrev": "1.0.9" + } + }, + "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, + "requires": { + "hosted-git-info": "2.5.0", + "is-builtin-module": "1.0.0", + "semver": "5.4.1", + "validate-npm-package-license": "3.0.1" + } + }, + "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 + }, + "oauth-sign": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.8.2.tgz", + "integrity": "sha1-Rqarfwrq2N6unsBWV4C31O/rnUM=", + "dev": true + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true, + "requires": { + "wrappy": "1.0.2" + } + }, + "optimist": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz", + "integrity": "sha1-2j6nRob6IaGaERwybpDrFaAZZoY=", + "dev": true, + "requires": { + "minimist": "0.0.10", + "wordwrap": "0.0.3" + }, + "dependencies": { + "minimist": { + "version": "0.0.10", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz", + "integrity": "sha1-3j+YVD2/lggr5IrRoMfNqDYwHc8=", + "dev": true + }, + "wordwrap": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz", + "integrity": "sha1-o9XabNXAvAAI03I0u68b7WMFkQc=", + "dev": true + } + } + }, + "os-locale": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz", + "integrity": "sha1-IPnxeuKe00XoveWDsT0gCYA8FNk=", + "dev": true, + "requires": { + "lcid": "1.0.0" + } + }, + "parse-json": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", + "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", + "dev": true, + "requires": { + "error-ex": "1.3.1" + } + }, + "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, + "requires": { + "pinkie-promise": "2.0.1" + } + }, + "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-type": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-1.1.0.tgz", + "integrity": "sha1-WcRPfuSR2nBNpBXaWkBwuk+P5EE=", + "dev": true, + "requires": { + "graceful-fs": "4.1.11", + "pify": "2.3.0", + "pinkie-promise": "2.0.1" + } + }, + "pez": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/pez/-/pez-2.1.5.tgz", + "integrity": "sha1-XsLMYlAMw+tCNtSkFM9aF7XrUAc=", + "requires": { + "b64": "3.0.3", + "boom": "5.2.0", + "content": "3.0.5", + "hoek": "4.2.0", + "nigel": "2.0.2" + } + }, + "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, + "requires": { + "pinkie": "2.0.4" + } + }, + "podium": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/podium/-/podium-1.3.0.tgz", + "integrity": "sha512-ZIujqk1pv8bRZNVxwwwq0BhXilZ2udycQT3Kp8ah3f3TcTmVg7ILJsv/oLf47gRa2qeiP584lNq+pfvS9U3aow==", + "requires": { + "hoek": "4.2.0", + "items": "2.1.1", + "joi": "10.6.0" + } + }, + "punycode": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", + "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=", + "dev": true + }, + "qs": { + "version": "6.3.2", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.3.2.tgz", + "integrity": "sha1-51vV9uJoEioqDgvaYwslUMFmUCw=", + "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, + "requires": { + "load-json-file": "1.1.0", + "normalize-package-data": "2.4.0", + "path-type": "1.1.0" + } + }, + "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, + "requires": { + "find-up": "1.1.2", + "read-pkg": "1.1.0" + } + }, + "readable-stream": { + "version": "1.0.27-1", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.27-1.tgz", + "integrity": "sha1-a2eYPCA1fO/QfwFlABoW1xDZEHg=", + "dev": true, + "requires": { + "core-util-is": "1.0.2", + "inherits": "2.0.3", + "isarray": "0.0.1", + "string_decoder": "0.10.31" + } + }, + "reduce-component": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/reduce-component/-/reduce-component-1.0.1.tgz", + "integrity": "sha1-4Mk1QsV0UhvqE98PlIjtgqt3xdo=", + "dev": true + }, + "reflect-metadata": { + "version": "0.1.10", + "resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.1.10.tgz", + "integrity": "sha1-tPg3BEFqytiZiMmxVjXUfgO5NEo=" + }, + "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 + }, + "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, + "requires": { + "is-finite": "1.0.2" + } + }, + "request": { + "version": "2.79.0", + "resolved": "https://registry.npmjs.org/request/-/request-2.79.0.tgz", + "integrity": "sha1-Tf5b9r6LjNw3/Pk+BLZVd3InEN4=", + "dev": true, + "requires": { + "aws-sign2": "0.6.0", + "aws4": "1.6.0", + "caseless": "0.11.0", + "combined-stream": "1.0.5", + "extend": "3.0.1", + "forever-agent": "0.6.1", + "form-data": "2.1.4", + "har-validator": "2.0.6", + "hawk": "3.1.3", + "http-signature": "1.1.1", + "is-typedarray": "1.0.0", + "isstream": "0.1.2", + "json-stringify-safe": "5.0.1", + "mime-types": "2.1.16", + "oauth-sign": "0.8.2", + "qs": "6.3.2", + "stringstream": "0.0.5", + "tough-cookie": "2.3.2", + "tunnel-agent": "0.4.3", + "uuid": "3.1.0" + } + }, + "require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", + "dev": true + }, + "require-main-filename": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-1.0.1.tgz", + "integrity": "sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE=", + "dev": true + }, + "resolve": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.4.0.tgz", + "integrity": "sha512-aW7sVKPufyHqOmyyLzg/J+8606v5nevBgaliIlV7nUpVMsDnoBGV/cbSLNjZAg9q0Cfd/+easKVKQ8vOu8fn1Q==", + "dev": true, + "requires": { + "path-parse": "1.0.5" + } + }, + "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, + "requires": { + "align-text": "0.1.4" + } + }, + "rimraf": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.1.tgz", + "integrity": "sha1-wjOOxkPfeht/5cVPqG9XQopV8z0=", + "dev": true, + "requires": { + "glob": "7.1.2" + } + }, + "rxjs": { + "version": "5.4.2", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-5.4.2.tgz", + "integrity": "sha1-KjI2/L8D31e64G/Wly/ZnlwI/Pc=", + "dev": true, + "requires": { + "symbol-observable": "1.0.4" + } + }, + "samsam": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/samsam/-/samsam-1.1.2.tgz", + "integrity": "sha1-vsEf3IOp/aBjQBIQ5AF2wwJNFWc=", + "dev": true + }, + "semver": { + "version": "5.4.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.4.1.tgz", + "integrity": "sha512-WfG/X9+oATh81XtllIo/I8gOiY9EXRdv1cQdyykeXK17YcUW3EXUAi2To4pcH6nZtJPr7ZOpM5OMyWJZm+8Rsg==", + "dev": true + }, + "set-blocking": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", + "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", + "dev": true + }, + "shot": { + "version": "3.4.2", + "resolved": "https://registry.npmjs.org/shot/-/shot-3.4.2.tgz", + "integrity": "sha1-Hlw/bysmZJrcQvfrNQIUpaApHWc=", + "requires": { + "hoek": "4.2.0", + "joi": "10.6.0" + } + }, + "should": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/should/-/should-6.0.3.tgz", + "integrity": "sha1-2u4weGpVdmL7x3TACNfFh5Htsdk=", + "dev": true, + "requires": { + "should-equal": "0.3.1", + "should-format": "0.0.7", + "should-type": "0.0.4" + } + }, + "should-equal": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/should-equal/-/should-equal-0.3.1.tgz", + "integrity": "sha1-vY6pemdI45+tR2o75v1y68LnK/A=", + "dev": true, + "requires": { + "should-type": "0.0.4" + } + }, + "should-format": { + "version": "0.0.7", + "resolved": "https://registry.npmjs.org/should-format/-/should-format-0.0.7.tgz", + "integrity": "sha1-Hi74a9kdqcLgQSM1tWq6vZov3hI=", + "dev": true, + "requires": { + "should-type": "0.0.4" + } + }, + "should-type": { + "version": "0.0.4", + "resolved": "https://registry.npmjs.org/should-type/-/should-type-0.0.4.tgz", + "integrity": "sha1-ATKgVBemEmhmQmrPEW8e1WI6XNA=", + "dev": true + }, + "sinon": { + "version": "1.17.7", + "resolved": "https://registry.npmjs.org/sinon/-/sinon-1.17.7.tgz", + "integrity": "sha1-RUKk9JugxFwF6y6d2dID4rjv4L8=", + "dev": true, + "requires": { + "formatio": "1.1.1", + "lolex": "1.3.2", + "samsam": "1.1.2", + "util": "0.10.3" + } + }, + "sntp": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/sntp/-/sntp-1.0.9.tgz", + "integrity": "sha1-ZUEYTMkK7qbG57NeJlkIJEPGYZg=", + "dev": true, + "requires": { + "hoek": "2.16.3" + }, + "dependencies": { + "hoek": { + "version": "2.16.3", + "resolved": "https://registry.npmjs.org/hoek/-/hoek-2.16.3.tgz", + "integrity": "sha1-ILt0A9POo5jpHcRxCo/xuCdKJe0=", + "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 + }, + "source-map-support": { + "version": "0.4.15", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.4.15.tgz", + "integrity": "sha1-AyAt9lwG0r2MfsI2KhkwVv7407E=", + "dev": true, + "requires": { + "source-map": "0.5.6" + } + }, + "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, + "requires": { + "spdx-license-ids": "1.2.2" + } + }, + "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 + }, + "sshpk": { + "version": "1.13.1", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.13.1.tgz", + "integrity": "sha1-US322mKHFEMW3EwY/hzx2UBzm+M=", + "dev": true, + "requires": { + "asn1": "0.2.3", + "assert-plus": "1.0.0", + "bcrypt-pbkdf": "1.0.1", + "dashdash": "1.14.1", + "ecc-jsbn": "0.1.1", + "getpass": "0.1.7", + "jsbn": "0.1.1", + "tweetnacl": "0.14.5" + }, + "dependencies": { + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", + "dev": true + } + } + }, + "statehood": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/statehood/-/statehood-5.0.3.tgz", + "integrity": "sha512-YrPrCt10t3ImH/JMO5szSwX7sCm8HoqVl3VFLOa9EZ1g/qJx/ZmMhN+2uzPPB/vaU6hpkJpXxcBWsgIkkG+MXA==", + "requires": { + "boom": "5.2.0", + "cryptiles": "3.1.2", + "hoek": "4.2.0", + "iron": "4.0.5", + "items": "2.1.1", + "joi": "10.6.0" + } + }, + "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 + }, + "string-width": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "dev": true, + "requires": { + "code-point-at": "1.1.0", + "is-fullwidth-code-point": "1.0.0", + "strip-ansi": "3.0.1" + } + }, + "stringstream": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz", + "integrity": "sha1-TkhM1N5aC7vuGORjB3EKioFiGHg=", + "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, + "requires": { + "ansi-regex": "2.1.1" + } + }, + "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, + "requires": { + "is-utf8": "0.2.1" + } + }, + "strip-json-comments": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", + "dev": true + }, + "subtext": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/subtext/-/subtext-5.0.0.tgz", + "integrity": "sha512-2nXG1G1V+K64Z20cQII7k0s38J2DSycMXBLMAk9RXUFG0uAkAbLSVoa88croX9VhTdBCJbLAe9g6LmzKwpJhhQ==", + "requires": { + "boom": "5.2.0", + "content": "3.0.5", + "hoek": "4.2.0", + "pez": "2.1.5", + "wreck": "12.2.2" + } + }, + "superagent": { + "version": "0.21.0", + "resolved": "https://registry.npmjs.org/superagent/-/superagent-0.21.0.tgz", + "integrity": "sha1-+xUCeYR1HucVIgDmzSHNbhml3oc=", + "dev": true, + "requires": { + "component-emitter": "1.1.2", + "cookiejar": "2.0.1", + "debug": "2.6.8", + "extend": "1.2.1", + "form-data": "0.1.3", + "formidable": "1.0.14", + "methods": "1.0.1", + "mime": "1.2.11", + "qs": "1.2.0", + "readable-stream": "1.0.27-1", + "reduce-component": "1.0.1" + }, + "dependencies": { + "async": { + "version": "0.9.2", + "resolved": "https://registry.npmjs.org/async/-/async-0.9.2.tgz", + "integrity": "sha1-rqdNXmHB+JlhO/ZL2mbUx48v0X0=", + "dev": true + }, + "combined-stream": { + "version": "0.0.7", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-0.0.7.tgz", + "integrity": "sha1-ATfmV7qlp1QcV6w3rF/AfXO03B8=", + "dev": true, + "requires": { + "delayed-stream": "0.0.5" + } + }, + "delayed-stream": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-0.0.5.tgz", + "integrity": "sha1-1LH0OpPoKW3+AmlPRoC8N6MTxz8=", + "dev": true + }, + "extend": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/extend/-/extend-1.2.1.tgz", + "integrity": "sha1-oPX9bPyDpf5J72mNYOyKYk3UV2w=", + "dev": true + }, + "form-data": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-0.1.3.tgz", + "integrity": "sha1-TuQ0bm61Ni6DRKAgdb2NvYxzc+o=", + "dev": true, + "requires": { + "async": "0.9.2", + "combined-stream": "0.0.7", + "mime": "1.2.11" + } + }, + "methods": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/methods/-/methods-1.0.1.tgz", + "integrity": "sha1-dbyRlD3/19oDfPPusO1zoAN80Us=", + "dev": true + }, + "qs": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-1.2.0.tgz", + "integrity": "sha1-7Qeb4oaCFH5v2aNMwrDB4OxkU+4=", + "dev": true + } + } + }, + "supertest": { + "version": "0.15.0", + "resolved": "https://registry.npmjs.org/supertest/-/supertest-0.15.0.tgz", + "integrity": "sha1-hhGGld5L5Yhps+6UxF4dCEyn+sU=", + "dev": true, + "requires": { + "methods": "1.1.2", + "superagent": "0.21.0" + } + }, + "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 + }, + "symbol-observable": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/symbol-observable/-/symbol-observable-1.0.4.tgz", + "integrity": "sha1-Kb9hXUqnEhvdiYsi1LP5vE4qoD0=", + "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 + }, + "topo": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/topo/-/topo-2.0.2.tgz", + "integrity": "sha1-zVYVdSU5BXwNwEkaYhw7xvvh0YI=", + "requires": { + "hoek": "4.2.0" + } + }, + "tough-cookie": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.2.tgz", + "integrity": "sha1-8IH3bkyFcg5sN6X6ztc3FQ2EByo=", + "dev": true, + "requires": { + "punycode": "1.4.1" + } + }, + "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 + }, + "ts-node": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-3.3.0.tgz", + "integrity": "sha1-wTxqMCTjC+EYDdUwOPwgkonUv2k=", + "dev": true, + "requires": { + "arrify": "1.0.1", + "chalk": "2.0.1", + "diff": "3.2.0", + "make-error": "1.3.0", + "minimist": "1.2.0", + "mkdirp": "0.5.1", + "source-map-support": "0.4.15", + "tsconfig": "6.0.0", + "v8flags": "3.0.0", + "yn": "2.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", + "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", + "dev": true, + "requires": { + "color-convert": "1.9.0" + } + }, + "chalk": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.0.1.tgz", + "integrity": "sha512-Mp+FXEI+FrwY/XYV45b2YD3E8i3HwnEAoFcM0qlZzq/RZ9RwWitt2Y/c7cqRAz70U7hfekqx6qNYthuKFO6K0g==", + "dev": true, + "requires": { + "ansi-styles": "3.2.0", + "escape-string-regexp": "1.0.5", + "supports-color": "4.2.1" + } + }, + "has-flag": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz", + "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=", + "dev": true + }, + "supports-color": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.2.1.tgz", + "integrity": "sha512-qxzYsob3yv6U+xMzPrv170y8AwGP7i74g+pbixCfD6rgso8BscLT2qXIuz6TpOaiJZ3mFgT5O9lyT9nMU4LfaA==", + "dev": true, + "requires": { + "has-flag": "2.0.0" + } + } + } + }, + "tsconfig": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/tsconfig/-/tsconfig-6.0.0.tgz", + "integrity": "sha1-aw6DdgA9evGGT434+J3QBZ/80DI=", + "dev": true, + "requires": { + "strip-bom": "3.0.0", + "strip-json-comments": "2.0.1" + }, + "dependencies": { + "strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", + "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.5.0", + "resolved": "https://registry.npmjs.org/tslint/-/tslint-5.5.0.tgz", + "integrity": "sha1-EOjas+MGH6YelELozuOYKs8gpqo=", + "dev": true, + "requires": { + "babel-code-frame": "6.22.0", + "colors": "1.1.2", + "commander": "2.11.0", + "diff": "3.2.0", + "glob": "7.1.2", + "minimatch": "3.0.4", + "resolve": "1.4.0", + "semver": "5.4.1", + "tslib": "1.7.1", + "tsutils": "2.8.0" + } + }, + "tsutils": { + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.8.0.tgz", + "integrity": "sha1-AWAXNymzvxOGKN0UoVN+AIUdgUo=", + "dev": true, + "requires": { + "tslib": "1.7.1" + } + }, + "tunnel-agent": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.4.3.tgz", + "integrity": "sha1-Y3PbdpCf5XDgjXNYM2Xtgop07us=", + "dev": true + }, + "tweetnacl": { + "version": "0.14.5", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", + "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", + "dev": true, + "optional": true + }, + "typedarray-to-buffer": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.2.tgz", + "integrity": "sha1-EBezLZhP9VbroQD1AViauhrOLgQ=", + "requires": { + "is-typedarray": "1.0.0" + } + }, + "typescript": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.4.2.tgz", + "integrity": "sha1-+DlfhdRZJ2BnyYiqQYN6j4KHCEQ=", + "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, + "requires": { + "source-map": "0.5.6", + "uglify-to-browserify": "1.0.2", + "yargs": "3.10.0" + } + }, + "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 + }, + "unit.js": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/unit.js/-/unit.js-2.0.0.tgz", + "integrity": "sha1-6RtWq8UMUw26A82/4OHfKj7jqjI=", + "dev": true, + "requires": { + "bluebird": "2.11.0", + "lodash": "3.10.1", + "must": "0.12.0", + "noder.io": "1.2.0", + "should": "6.0.3", + "sinon": "1.17.7", + "supertest": "0.15.0" + }, + "dependencies": { + "lodash": { + "version": "3.10.1", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-3.10.1.tgz", + "integrity": "sha1-W/Rejkm6QYnhfUgnid/RW9FAt7Y=", + "dev": true + } + } + }, + "universalify": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.1.tgz", + "integrity": "sha1-+nG63UQ3r0wUiEHjs7Fl+enlkLc=", + "dev": true + }, + "user-home": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/user-home/-/user-home-1.1.1.tgz", + "integrity": "sha1-K1viOjK2Onyd640PKNSFcko98ZA=", + "dev": true + }, + "util": { + "version": "0.10.3", + "resolved": "https://registry.npmjs.org/util/-/util-0.10.3.tgz", + "integrity": "sha1-evsa/lCAUkZInj23/g7TeTNqwPk=", + "dev": true, + "requires": { + "inherits": "2.0.1" + }, + "dependencies": { + "inherits": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz", + "integrity": "sha1-sX0I0ya0Qj5Wjv9xn5GwscvfafE=", + "dev": true + } + } + }, + "uuid": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.1.0.tgz", + "integrity": "sha512-DIWtzUkw04M4k3bf1IcpS2tngXEL26YUD2M0tMDUpnUrz2hgzUBlD55a4FjdLGPvfHxS6uluGWvaVEqgBcVa+g==", + "dev": true + }, + "v8flags": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/v8flags/-/v8flags-3.0.0.tgz", + "integrity": "sha512-AGl+C+4qpeSu2g3JxCD/mGFFOs/vVZ3XREkD3ibQXEqr4Y4zgIrPWW124/IKJFHOIVFIoH8miWrLf0o84HYjwA==", + "dev": true, + "requires": { + "user-home": "1.1.1" + } + }, + "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, + "requires": { + "spdx-correct": "1.0.2", + "spdx-expression-parse": "1.0.4" + } + }, + "verror": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", + "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", + "dev": true, + "requires": { + "assert-plus": "1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "1.3.0" + }, + "dependencies": { + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", + "dev": true + } + } + }, + "vise": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/vise/-/vise-2.0.2.tgz", + "integrity": "sha1-awjo+0y3bjpQzW3Q7DczjoEaDTk=", + "requires": { + "hoek": "4.2.0" + } + }, + "websocket": { + "version": "1.0.24", + "resolved": "https://registry.npmjs.org/websocket/-/websocket-1.0.24.tgz", + "integrity": "sha1-dJA+dfJUW2suHeFCW8HJBZF6GJA=", + "requires": { + "debug": "2.6.8", + "nan": "2.6.2", + "typedarray-to-buffer": "3.1.2", + "yaeti": "0.0.6" + } + }, + "which": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.0.tgz", + "integrity": "sha512-xcJpopdamTuY5duC/KnTTNBraPK54YwpenP4lzxU8H91GudWpFv38u0CKjclE1Wi2EH2EDz5LRcHcKbCIzqGyg==", + "dev": true, + "requires": { + "isexe": "2.0.0" + } + }, + "which-module": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/which-module/-/which-module-1.0.0.tgz", + "integrity": "sha1-u6Y8qGGUiZT/MHc2CJ47lgJsKk8=", + "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 + }, + "wrap-ansi": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", + "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", + "dev": true, + "requires": { + "string-width": "1.0.2", + "strip-ansi": "3.0.1" + } + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "dev": true + }, + "wreck": { + "version": "12.2.2", + "resolved": "https://registry.npmjs.org/wreck/-/wreck-12.2.2.tgz", + "integrity": "sha1-4hgj00w21nIATu+jR66MT2BQ49s=", + "requires": { + "boom": "5.2.0", + "hoek": "4.2.0" + } + }, + "xtend": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", + "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=", + "dev": true + }, + "y18n": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.1.tgz", + "integrity": "sha1-bRX7qITAhnnA136I53WegR4H+kE=", + "dev": true + }, + "yaeti": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/yaeti/-/yaeti-0.0.6.tgz", + "integrity": "sha1-8m9ITXJoTPQr7ft2lwqhYI+/lXc=" + }, + "yargs": { + "version": "3.10.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-3.10.0.tgz", + "integrity": "sha1-9+572FfdfB0tOMDnTvvWgdFDH9E=", + "dev": true, + "optional": true, + "requires": { + "camelcase": "1.2.1", + "cliui": "2.1.0", + "decamelize": "1.2.0", + "window-size": "0.1.0" + } + }, + "yargs-parser": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-4.2.1.tgz", + "integrity": "sha1-KczqwNxPA8bIe0qfIX3RjJ90hxw=", + "dev": true, + "requires": { + "camelcase": "3.0.0" + }, + "dependencies": { + "camelcase": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-3.0.0.tgz", + "integrity": "sha1-MvxLn82vhF/N9+c7uXysImHwqwo=", + "dev": true + } + } + }, + "yn": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/yn/-/yn-2.0.0.tgz", + "integrity": "sha1-5a2ryKz0CPY4X8dklWhMiOavaJo=", + "dev": true + } + } +} diff --git a/package.json b/package.json index bed0b5d..aa1b371 100644 --- a/package.json +++ b/package.json @@ -72,29 +72,28 @@ }, "homepage": "https://github.com/hapinessjs/hapiness#readme", "dependencies": { - "@types/boom": "^4.3.5", - "@types/hapi": "^16.1.6", + "@types/hapi": "^16.1.8", "@types/hoek": "^4.1.3", "@types/joi": "^10.4.0", - "@types/node": "^8.0.13", + "@types/node": "^8.0.19", "@types/websocket": "^0.0.34", "debug": "^2.6.8", - "hapi": "^16.4.3", + "hapi": "^16.5.2", "reflect-metadata": "^0.1.10", "websocket": "^1.0.24" }, "devDependencies": { - "@types/fs-extra": "^3.0.3", + "@types/fs-extra": "^4.0.0", "coveralls": "^2.13.1", "fs-extra": "^4.0.0", "istanbul": "^1.1.0-alpha.1", - "mocha": "^3.4.2", + "mocha": "^3.5.0", "mocha-typescript": "^1.1.7", "rimraf": "^2.6.1", "rxjs": "^5.4.2", - "ts-node": "^3.2.0", + "ts-node": "^3.3.0", "tslint": "^5.5.0", - "typescript": "^2.4.1", + "typescript": "^2.4.2", "unit.js": "^2.0.0" }, "engines": { diff --git a/src-2/core/decorators.ts b/src-2/core/decorators.ts new file mode 100644 index 0000000..17abc27 --- /dev/null +++ b/src-2/core/decorators.ts @@ -0,0 +1,51 @@ +import { TypeDecorator, makeDecorator } from '../externals/injection-js/util/decorators'; +import { Type } from '../externals/injection-js/facade/type'; +import { Inject, Injectable, InjectionToken, Optional } from '../externals/injection-js'; +export { Injectable, Inject, Optional, InjectionToken, Type, makeDecorator }; + +/** + * Decorator signature + */ +export interface CoreDecorator { + (obj: T): TypeDecorator; + new (obj: T): T +} + +/** + * Create a decorator with metadata + * + * @param {string} name + * @param {{[name:string]:any;}} props? + * @returns CoreDecorator + */ +export function createDecorator(name: string, props?: { [name: string]: any; }): CoreDecorator { + return >makeDecorator(name, props); +} + +/** + * HapinessModule decorator and metadata. + * + * @Annotation + */ +export interface HapinessModule { + version: string; + declarations?: Array|any>; + providers?: Array|any>; + imports?: Array|any>; + exports?: Array|any>; +} +export const HapinessModule = createDecorator('HapinessModule', { + version: undefined, + declarations: undefined, + providers: undefined, + imports: undefined, + exports: undefined +}); + +/** + * Lib decorator and metadata. + * + * @Annotation + */ +export interface Lib {} +export const Lib = makeDecorator('Lib', null); diff --git a/src-2/core/di.ts b/src-2/core/di.ts new file mode 100644 index 0000000..db17bcc --- /dev/null +++ b/src-2/core/di.ts @@ -0,0 +1,55 @@ +import { ReflectiveInjector } from '../externals/injection-js'; +import { Type } from '../externals/injection-js/facade/type'; +import { + ReflectiveDependency, + ResolvedReflectiveProvider, + ResolvedReflectiveFactory +} from '../externals/injection-js/reflective_provider'; +import { CoreProvide } from './interfaces'; +import { InternalLogger } from './logger'; +import { Observable } from 'rxjs'; + +export class DependencyInjection { + + private static logger = new InternalLogger('di'); + + /** + * Create a new DI and + * can inherits from a parent DI + * + * @param {Type[]} providers + * @param {ReflectiveInjector} parent? + * @returns Observable + */ + static createAndResolve(providers: Type[] | CoreProvide[], parent?: ReflectiveInjector): Observable { + return Observable + .of(parent) + .map(_ => !!_ ? + parent.resolveAndCreateChild(providers) : + ReflectiveInjector.resolveAndCreate(providers) + ) + .do(_ => this.logger.debug(`DI created, providers: ${providers.length}`)); + } + + /** + * Instanciate a component + * resolving its dependencies + * without inject the component + * into the DI + * + * @param {Type} component + * @param {ReflectiveInjector} di + * @returns T + */ + static instantiateComponent(component: Type, di: ReflectiveInjector): Observable { + return Observable + .from(ReflectiveInjector.resolve([component])) + .reduce((a, x: ResolvedReflectiveProvider) => a.concat(x.resolvedFactories), []) + .map(_ => _.reduce((a, r: ResolvedReflectiveFactory) => a.concat(r.dependencies), [])) + .map(_ => _.filter(__ => !!__)) + .do(_ => this.logger.debug(`Component '${component.name}' deps: ${_.length}`)) + .map(_ => _.map(d => di['_getByReflectiveDependency'](d))) + .map(_ => Reflect.construct(component, _)); + } + +} diff --git a/src-2/core/enums.ts b/src-2/core/enums.ts new file mode 100644 index 0000000..2ae568a --- /dev/null +++ b/src-2/core/enums.ts @@ -0,0 +1,10 @@ +export enum ExtentionHooksEnum { + OnExtensionLoad = 'onExtensionLoad', + OnModuleInstantiated = 'onModuleInstantiated' +} + +export enum ModuleEnum { + OnStart = 'onStart', + OnError = 'onError', + OnRegister = 'onRegister' +} diff --git a/src-2/core/hapiness.ts b/src-2/core/hapiness.ts new file mode 100644 index 0000000..ae18914 --- /dev/null +++ b/src-2/core/hapiness.ts @@ -0,0 +1,142 @@ +import { Observable } from 'rxjs'; +import { CoreModule, Extension, ExtensionWithConfig } from './interfaces'; +import { InternalLogger } from './logger'; +import { Type } from './decorators'; +import { ExtentionHooksEnum, ModuleEnum } from './enums'; +import { ModuleManager } from './module'; +import { HookManager } from './hook'; + +export class Hapiness { + + private static module: CoreModule; + + private static extensions: Extension[]; + + private static logger = new InternalLogger('bootstrap'); + + /** + * Entrypoint to bootstrap a module + * will load the extentions and trigger + * module's hooks + * + * @param {Type} module + * @param {Array|ExtensionWithConfig>} extensions? + * @returns Promise + */ + public static bootstrap(module: Type, extensions?: Array | ExtensionWithConfig>): Promise<{}> { + return new Promise((resolve, reject) => { + this + .checkArg(module) + .flatMap(_ => ModuleManager.resolve(_)) + .flatMap(moduleResolved => + Observable + .from([].concat(extensions).filter(_ => !!_)) + .map(_ => this.toExtensionWithConfig(_)) + .flatMap(_ => this.loadExtention(_)) + .toArray() + .do(_ => this.extensions = _) + .flatMap(extensionsLoaded => + Observable + .from(extensionsLoaded) + .map(_ => ({ provide: _.token, useValue: _.value })) + .toArray() + .flatMap(_ => ModuleManager.instantiate(moduleResolved, _)) + .do(_ => this.module = _) + .flatMap(moduleInstanciated => + Observable + .from(ModuleManager.getModules(moduleInstanciated)) + .filter(_ => !!_.parent) + .filter(_ => HookManager + .hasLifecycleHook(ModuleEnum.OnRegister.toString(), _.token) + ) + .flatMap(_ => HookManager + .triggerHook(ModuleEnum.OnRegister.toString(), _.token, _.instance) + ) + .toArray() + .flatMap(_ => HookManager.triggerHook( + ModuleEnum.OnStart.toString(), + moduleInstanciated.token, + moduleInstanciated.instance, + null, + false + )) + ) + ) + ) + .subscribe( + _ => resolve(), + _ => reject(_) + ) + }); + } + + private static checkArg(module: Type): Observable> { + return Observable + .of(module) + .flatMap(_ => !!_ ? + Observable.of(_) : + Observable.throw('Bootstrap failed: no module provided') + ) + .flatMap(_ => typeof _ === 'function' ? + Observable.of(_) : + Observable.throw('Bootstrap failed: module must be a function/class') + ); + } + + /** + * Convert an extension type to ExtensionWithConfig + * + * @param {} extension + * @returns ExtensionWithConfig + */ + private static toExtensionWithConfig(extension): ExtensionWithConfig { + if (extension && extension.token) { + return extension; + } + return { + token: >extension, + config: {} + }; + } + + /** + * Call the OnExtensionLoad hook + * of an extension + * + * @param {ExtensionWithConfig} extension + * @returns Observable + */ + private static loadExtention(extension: ExtensionWithConfig): Observable { + return Observable + .of(Reflect.construct(extension.token, [])) + .do(_ => this.logger.debug(`loading ${extension.token.name}`)) + .switchMap(instance => + HookManager + .triggerHook( + ExtentionHooksEnum.OnExtensionLoad.toString(), + extension.token, + instance, + [ this.module, extension.config ] + ) + ); + } + + /** + * Call the OnModuleInstantiated hook + * of an extension + * + * @param {Extension} extension + * @returns Observable + */ + private static moduleInstantiated(extension: Extension): Observable { + return HookManager + .triggerHook( + ExtentionHooksEnum.OnModuleInstantiated.toString(), + extension.token, + extension.instance, + [ this.module ] + ) + .do(_ => this.logger.debug(`moduleInstantiated ${extension.token.name}`)); + } + +} diff --git a/src-2/core/hook.ts b/src-2/core/hook.ts new file mode 100644 index 0000000..618daca --- /dev/null +++ b/src-2/core/hook.ts @@ -0,0 +1,57 @@ +import { reflector } from '../externals/injection-js/reflection/reflection'; +import { Observable } from 'rxjs'; +import { Type } from './decorators'; +import { InternalLogger } from './logger'; + +export class HookManager { + + private static logger = new InternalLogger('hook'); + + /** + * Check if a token has a hook implemented + * + * @param {string} hook + * @param {Type} token + * @returns boolean + */ + public static hasLifecycleHook(hook: string, token: Type): boolean { + return reflector.hasLifecycleHook(token, hook); + } + + /** + * Trigger the hook if + * it is implemented + * + * @param {string} hook + * @param {Type} token + * @param {T} instance + * @param {any[]} args + * @param {boolean} throwErr + * @returns Observable + */ + public static triggerHook(hook: string, token: Type, instance: T, args?: any[], throwErr?: boolean): Observable { + this.logger.debug(`Triggering hook '${hook}' on '${token ? token.name : null}'`); + return Observable + .merge( + Observable + .of(this.hasLifecycleHook(hook, token)) + .filter(_ => !!_) + .map(_ => Reflect.apply(instance[hook], instance, args || [])) + .flatMap(_ => (_ instanceof Observable) ? + _ : + Observable.of(_) + ), + + Observable + .of(this.hasLifecycleHook(hook, token)) + .filter(_ => !_ && throwErr) + .flatMap(_ => Observable.throw(new Error(`Hook missing ${hook} on ${token ? token.name : null}`))), + + Observable + .of(this.hasLifecycleHook(hook, token)) + .filter(_ => !_ && !throwErr) + .map(_ => null) + + ) + } +} diff --git a/src-2/core/interfaces/extension.ts b/src-2/core/interfaces/extension.ts new file mode 100644 index 0000000..d24540b --- /dev/null +++ b/src-2/core/interfaces/extension.ts @@ -0,0 +1,31 @@ +import { Type } from '../decorators'; +import { Observable } from 'rxjs'; +import { CoreModule } from './module'; + +export interface ExtensionWithConfig { + token: Type; + config: any; +} + +export interface Extension { + value: any; + instance: any; + token: Type; +} + +/** + * OnExtensionLoad Hook + * + * @param {CoreModule} module + * @param {any} config + * @returns Observable + */ +export interface OnExtensionLoad { onExtensionLoad(module: CoreModule, config: any): Observable } + +/** + * OnModuleInstantiated Hook + * + * @param {CoreModule} module + * @returns Observable + */ +export interface OnModuleInstantiated { onModuleInstantiated(module: CoreModule): Observable } diff --git a/src-2/core/interfaces/index.ts b/src-2/core/interfaces/index.ts new file mode 100644 index 0000000..90a1e66 --- /dev/null +++ b/src-2/core/interfaces/index.ts @@ -0,0 +1,2 @@ +export * from './module'; +export * from './extension'; diff --git a/src-2/core/interfaces/module.ts b/src-2/core/interfaces/module.ts new file mode 100644 index 0000000..b5b2ad6 --- /dev/null +++ b/src-2/core/interfaces/module.ts @@ -0,0 +1,72 @@ +import { Type } from '../decorators'; +import { ReflectiveInjector } from '../../externals/injection-js'; +import { Observable } from 'rxjs'; + +/** + * CoreProvide Type + * Used by CoreModule Type + */ +export interface CoreProvide { + provide: any; + useClass?: any; + useValue?: any; + useExisting?: any; + useFactory?: any; + deps?: any[]; +} + +/** + * CoreModule Type + * Represents a Module + */ +export class CoreModule { + token: Type | any; + name: string; + version: string; + instance?: any; + level: ModuleLevel; + di?: ReflectiveInjector; + providers?: CoreProvide[]; + modules?: CoreModule[]; + parent?: CoreModule; + exports?: Type[] | any[]; + declarations?: Type[] | any[]; +} + +/** + * CoreModuleWithProviders Type + * Used to pass data while module importation + */ +export interface CoreModuleWithProviders { + module: Type; + providers: CoreProvide[]; +} + +/** + * Represents the position where + * the module is instantiate + */ +export enum ModuleLevel { + ROOT, + PRIMARY, + SECONDARY +} + +/** + * Module Lifecycle Hook + * called once the module has been + * registered into the server + * + * @returns void | Observable + */ +export interface OnRegister { onRegister(): void | Observable; } + +/** + * Module Lifecycle Hook + * called once the server has started + * only for the MainModule + * + * @returns void | Observable + */ +export interface OnStart { onStart(): void | Observable; } + diff --git a/src-2/core/logger.ts b/src-2/core/logger.ts new file mode 100644 index 0000000..f414ce5 --- /dev/null +++ b/src-2/core/logger.ts @@ -0,0 +1,17 @@ +import * as Debug from 'debug'; + +export class InternalLogger { + + private logger; + + /* istanbul ignore next */ + constructor(private tag = 'core', extension?: string) { + this.logger = Debug(extension ? `hapiness:${extension}` : 'hapiness'); + } + + /* istanbul ignore next */ + debug(message: string): void { + this.logger(`[${this.tag.toUpperCase()}] > ${message}`); + } + +} diff --git a/src-2/core/metadata.ts b/src-2/core/metadata.ts new file mode 100644 index 0000000..5c7cb9b --- /dev/null +++ b/src-2/core/metadata.ts @@ -0,0 +1,46 @@ +import 'reflect-metadata'; +import * as Debug from 'debug'; +const debug = Debug('hapiness:metadata'); + +/** + * Helper to extract Metadata + * from a decorator + * + * @todo Filter with the right type + * @param {any} type + * @returns any + */ +export function extractMetadata(type: any): any { + return extractMetadatas(type) + .pop(); +}; + +/** + * Helper to extract Metadata + * with the decorator name provided + * + * @param {any} type + * @param {string} name + */ +export function extractMetadataByDecorator(type: any, name: string): T { + return extractMetadatas(type) + .filter(x => x.toString().slice(1) === name) + .map(x => x) + .pop(); +} + +/** + * Helper to extract Metadata + * from a decorator + * + * @todo Filter with the right type + * @param {any} decorator + * @returns [] + */ +export function extractMetadatas(decorator: any): any[] { + return Reflect.getOwnMetadataKeys(decorator) + .filter(x => x === 'annotations') + .map(x => Reflect.getOwnMetadata(x, decorator)) + .map(x => [].concat(x)) + .pop() || []; +}; diff --git a/src-2/core/module.ts b/src-2/core/module.ts new file mode 100644 index 0000000..ee606d4 --- /dev/null +++ b/src-2/core/module.ts @@ -0,0 +1,264 @@ +import { Observable } from 'rxjs'; +import { InternalLogger } from './logger'; +import { extractMetadataByDecorator } from './metadata'; +import { HapinessModule, Type, InjectionToken } from './decorators'; +import { CoreModule, CoreProvide, CoreModuleWithProviders, ModuleLevel } from './interfaces'; +import { DependencyInjection } from './di'; + +export class ModuleManager { + + private static decoratorName = 'HapinessModule'; + + private static logger = new InternalLogger('module'); + + /** + * Resolve into a tree of CoreModule + * + * @param {any} module + * @returns Observable + */ + static resolve(module: any): Observable { + this.logger.debug(`Resolving module '${module.name}'`); + return this.resolution(module); + } + + static instantiate(module: CoreModule, providers?: CoreProvide[]): Observable { + this.logger.debug(`Instantiation of module '${module.name}'`); + return this.instantiation(module, providers); + } + + /** + * Get all the tree modules + * + * @param {CoreModule} module + * @returns CoreModule + */ + static getModules(module: CoreModule): CoreModule[] { + const lookup = (_module: CoreModule) => { + return [] + .concat(_module) + .concat([] + .concat(_module.modules) + .filter(_ => !!_) + .map(m => lookup(m)) + .reduce((a, c) => a.concat(c), []) + ); + }; + return lookup(module); + } + + /** + * Helper to convert provider + * to a CoreProvide type + * + * @param {any} provider + * @returns CoreProvide + */ + static toCoreProvider(provider: any): CoreProvide { + return (!!provider.provide ? + provider : + { provide: provider, useClass: provider } + ); + } + + /** + * =========================================================================== + * + * MODULE RESOLUTION + * + * =========================================================================== + */ + + /** + * Process module to CoreModule type + * from metadata and the children + * + * @param {any} module + * @param {CoreModule} parent? + * @returns Observable + */ + private static resolution(module: any, parent?: CoreModule): Observable { + return Observable + .of(module) + .map(_ => this.toCoreModuleWithProviders(_)) + .flatMap(cmwp => + this + .extractMetadata(cmwp.module) + .map(_ => ({ metadata: _, moduleWithProviders: cmwp })) + ) + .flatMap(mcmwp => + this + .metadataToCoreModule(mcmwp.metadata, mcmwp.moduleWithProviders, parent) + .map(_ => this.coreModuleParentConfigProviders(_)) + .map(_ => Object.assign({ module: _ }, mcmwp)) + ) + .flatMap(data => + Observable + .from(data.metadata.imports || []) + .flatMap(_ => this.resolution(_, data.module)) + .toArray() + .do(_ => this.logger.debug(`'${data.module.name}' got ${_.length} children`)) + .map(_ => Object.assign({ modules: _ }, data.module)) + ) + } + + /** + * FIX for exported providers + * that need internal config + * + * @todo find a better solution + * @param {CoreModule} module + * @returns CoreModule + */ + private static coreModuleParentConfigProviders(module: CoreModule): CoreModule { + module.providers = [] + .concat(module.providers) + .concat((module.parent && module.parent.providers) ? + module.parent.providers.filter(_ => (_.provide instanceof InjectionToken)) : + [] + ) + .filter(_ => !!_); + return module; + } + + /** + * Convert metadata to CoreModule type + * + * @param {HapinessModule} metadata + * @param {CoreModuleWithProviders} moduleWithProviders + * @param {CoreModule} parent? + * @returns Observable + */ + private static metadataToCoreModule( + metadata: HapinessModule, + moduleWithProviders: CoreModuleWithProviders, + parent?: CoreModule): Observable { + + return Observable + .of({ + parent, + token: moduleWithProviders.module, + name: moduleWithProviders.module.name, + version: metadata.version, + exports: metadata.exports || [], + declarations: metadata.declarations || [], + providers: (metadata.providers || []) + .concat(moduleWithProviders.providers) + .map(_ => this.toCoreProvider(_)), + level: !!parent ? + parent.level === ModuleLevel.ROOT ? + ModuleLevel.PRIMARY : + ModuleLevel.SECONDARY : + ModuleLevel.ROOT + }) + .do(_ => this.logger.debug(`Build CoreModule for '${_.name}'`)); + } + + /** + * Get HapinessModule metadata type + * if does not exist, throw an error + * + * @param {Type} module + * @returns Observable + */ + private static extractMetadata(module: Type): Observable { + return Observable + .of(extractMetadataByDecorator(module, this.decoratorName)) + .flatMap(_ => !!_ ? + Observable.of(_) : + Observable.throw(new Error(`Module '${module ? module.name : null}' resolution failed: No metadata`)) + ) + } + + /** + * Make sure to convert module into + * a CoreModuleWithProviders type + * + * @param {CoreModuleWithProviders|Type} module + * @returns CoreModuleWithProviders + */ + private static toCoreModuleWithProviders(module: CoreModuleWithProviders | Type): CoreModuleWithProviders { + return ((module && module['module']) ? + module : + { + module, + providers: [] + }); + } + + /** + * =========================================================================== + * + * MODULE INSTANTIATION + * + * =========================================================================== + */ + + /** + * Create the module's DI + * and instantiate the module + * + * @param {CoreModule} module + * @param {CoreProvide[]} providers? + * @param {CoreModule} parent? + * @returns Observable + */ + private static instantiation(module: CoreModule, providers?: CoreProvide[], parent?: CoreModule): Observable { + return Observable + .of(module) + .flatMap(_ => + Observable + .from(_.modules) + .flatMap(child => this.instantiation(child, providers, parent)) + .toArray() + .map(children => Object.assign({}, _, { modules: children })) + ) + .flatMap(_ => + DependencyInjection + .createAndResolve(this.collectProviders(_, providers)) + .map(di => Object.assign({ di }, _)) + ) + .flatMap(_ => + DependencyInjection + .instantiateComponent(_.token, _.di) + .map(instance => Object.assign({ instance }, _)) + ); + } + + /** + * Collect all providers to + * inject into the DI + * + * @param {HapinessModule} module + */ + private static collectProviders(module: CoreModule, providers?: CoreProvide[]): CoreProvide[] { + this.logger.debug(`Collect providers for '${module.name}'`); + return [] + .concat(module.providers) + .concat(providers) + .filter(_ => !!_) + .concat(this.extractExportedProviders(module)); + } + + /** + * Extract exported children providers + * + * @param {CoreModule} module + * @returns CoreProvide[] + */ + private static extractExportedProviders(module: CoreModule): CoreProvide[] { + this.logger.debug(`Extract exported children providers for '${module.name}'`); + return [] + .concat(module.modules) + .filter(_ => (!!_.exports && _.exports.length > 0)) + .map(_ => [] + .concat(_.exports) + .concat( + _.providers + .filter(__ => (__.provide instanceof InjectionToken))) + ) + .reduce((a, c) => a.concat(c), []) + .filter(_ => !!_) + .map(_ => this.toCoreProvider(_)); + } +} diff --git a/src-2/externals/injection-js/facade/errors.d.ts b/src-2/externals/injection-js/facade/errors.d.ts new file mode 100644 index 0000000..dc15d54 --- /dev/null +++ b/src-2/externals/injection-js/facade/errors.d.ts @@ -0,0 +1,19 @@ +/// +import { DebugContext } from './lang'; +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +export declare const ERROR_TYPE: string; +export declare const ERROR_COMPONENT_TYPE: string; +export declare const ERROR_DEBUG_CONTEXT: string; +export declare const ERROR_ORIGINAL_ERROR: string; +export declare const ERROR_LOGGER: string; +export declare function getType(error: Error): Function; +export declare function getDebugContext(error: Error): DebugContext; +export declare function getOriginalError(error: Error): Error; +export declare function getErrorLogger(error: Error): (console: Console, ...values: any[]) => void; +export declare function wrappedError(message: string, originalError: any): Error; diff --git a/src-2/externals/injection-js/facade/errors.js b/src-2/externals/injection-js/facade/errors.js new file mode 100644 index 0000000..7dca94f --- /dev/null +++ b/src-2/externals/injection-js/facade/errors.js @@ -0,0 +1,44 @@ +"use strict"; +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +exports.ERROR_TYPE = 'ngType'; +exports.ERROR_COMPONENT_TYPE = 'ngComponentType'; +exports.ERROR_DEBUG_CONTEXT = 'ngDebugContext'; +exports.ERROR_ORIGINAL_ERROR = 'ngOriginalError'; +exports.ERROR_LOGGER = 'ngErrorLogger'; +function getType(error) { + return error[exports.ERROR_TYPE]; +} +exports.getType = getType; +function getDebugContext(error) { + return error[exports.ERROR_DEBUG_CONTEXT]; +} +exports.getDebugContext = getDebugContext; +function getOriginalError(error) { + return error[exports.ERROR_ORIGINAL_ERROR]; +} +exports.getOriginalError = getOriginalError; +function defaultErrorLogger(console) { + var values = []; + for (var _i = 1; _i < arguments.length; _i++) { + values[_i - 1] = arguments[_i]; + } + console.error.apply(console, values); +} +function getErrorLogger(error) { + return error[exports.ERROR_LOGGER] || defaultErrorLogger; +} +exports.getErrorLogger = getErrorLogger; +function wrappedError(message, originalError) { + var msg = message + " caused by: " + (originalError instanceof Error ? originalError.message : originalError); + var error = Error(msg); + error[exports.ERROR_ORIGINAL_ERROR] = originalError; + return error; +} +exports.wrappedError = wrappedError; +//# sourceMappingURL=errors.js.map \ No newline at end of file diff --git a/src-2/externals/injection-js/facade/errors.js.map b/src-2/externals/injection-js/facade/errors.js.map new file mode 100644 index 0000000..32614f8 --- /dev/null +++ b/src-2/externals/injection-js/facade/errors.js.map @@ -0,0 +1 @@ +{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../lib/facade/errors.ts"],"names":[],"mappings":";AACA;;;;;;GAMG;AAEU,kBAAU,GAAG,QAAQ,CAAC;AACtB,4BAAoB,GAAG,iBAAiB,CAAC;AACzC,2BAAmB,GAAG,gBAAgB,CAAC;AACvC,4BAAoB,GAAG,iBAAiB,CAAC;AACzC,oBAAY,GAAG,eAAe,CAAC;AAG5C,iBAAwB,KAAY;IAClC,MAAM,CAAE,KAAa,CAAC,kBAAU,CAAC,CAAC;AACpC,CAAC;AAFe,eAAO,UAEtB,CAAA;AAED,yBAAgC,KAAY;IAC1C,MAAM,CAAE,KAAa,CAAC,2BAAmB,CAAC,CAAC;AAC7C,CAAC;AAFe,uBAAe,kBAE9B,CAAA;AAED,0BAAiC,KAAY;IAC3C,MAAM,CAAE,KAAa,CAAC,4BAAoB,CAAC,CAAC;AAC9C,CAAC;AAFe,wBAAgB,mBAE/B,CAAA;AAED,4BAA4B,OAAgB;IAAE,gBAAgB;SAAhB,WAAgB,CAAhB,sBAAgB,CAAhB,IAAgB;QAAhB,+BAAgB;;IACtD,OAAO,CAAC,KAAK,OAAb,OAAO,EAAW,MAAM,CAAC,CAAC;AAClC,CAAC;AAED,wBAA+B,KAAY;IACzC,MAAM,CAAE,KAAa,CAAC,oBAAY,CAAC,IAAI,kBAAkB,CAAC;AAC5D,CAAC;AAFe,sBAAc,iBAE7B,CAAA;AAED,sBAA6B,OAAe,EAAE,aAAkB;IAC9D,IAAM,GAAG,GACF,OAAO,qBAAe,aAAa,YAAY,KAAK,GAAG,aAAa,CAAC,OAAO,GAAE,aAAa,CAAG,CAAC;IACtG,IAAM,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;IACxB,KAAa,CAAC,4BAAoB,CAAC,GAAG,aAAa,CAAC;IACrD,MAAM,CAAC,KAAK,CAAC;AACf,CAAC;AANe,oBAAY,eAM3B,CAAA"} \ No newline at end of file diff --git a/src-2/externals/injection-js/facade/lang.d.ts b/src-2/externals/injection-js/facade/lang.d.ts new file mode 100644 index 0000000..f0f0a7f --- /dev/null +++ b/src-2/externals/injection-js/facade/lang.d.ts @@ -0,0 +1,47 @@ +/// +import { Injector } from '../injector'; +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +export interface BrowserNodeGlobal { + Object: typeof Object; + Array: typeof Array; + Map: typeof Map; + Set: typeof Set; + Date: DateConstructor; + RegExp: RegExpConstructor; + JSON: typeof JSON; + Math: any; + assert(condition: any): void; + Reflect: any; + getAngularTestability: Function; + getAllAngularTestabilities: Function; + getAllAngularRootElements: Function; + frameworkStabilizers: Array; + setTimeout: Function; + clearTimeout: Function; + setInterval: Function; + clearInterval: Function; + encodeURI: Function; +} +declare const _global: BrowserNodeGlobal; +export { _global as global }; +export declare function isPresent(obj: any): boolean; +export declare function stringify(token: any): string; +export declare abstract class DebugContext { + readonly abstract nodeIndex: number | null; + readonly abstract injector: Injector; + readonly abstract component: any; + readonly abstract providerTokens: any[]; + readonly abstract references: { + [key: string]: any; + }; + readonly abstract context: any; + readonly abstract componentRenderElement: any; + readonly abstract renderNode: any; + abstract logError(console: Console, ...values: any[]): void; +} diff --git a/src-2/externals/injection-js/facade/lang.js b/src-2/externals/injection-js/facade/lang.js new file mode 100644 index 0000000..39bf2e7 --- /dev/null +++ b/src-2/externals/injection-js/facade/lang.js @@ -0,0 +1,89 @@ +"use strict"; +var globalScope; +if (typeof window === 'undefined') { + if (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope) { + // TODO: Replace any with WorkerGlobalScope from lib.webworker.d.ts #3492 + globalScope = self; + } + else { + globalScope = global; + } +} +else { + globalScope = window; +} +// Need to declare a new variable for global here since TypeScript +// exports the original value of the symbol. +var _global = globalScope; +exports.global = _global; +function isPresent(obj) { + return obj != null; +} +exports.isPresent = isPresent; +function stringify(token) { + if (typeof token === 'string') { + return token; + } + if (token == null) { + return '' + token; + } + if (token.overriddenName) { + return "" + token.overriddenName; + } + if (token.name) { + return "" + token.name; + } + var res = token.toString(); + var newLineIndex = res.indexOf('\n'); + return newLineIndex === -1 ? res : res.substring(0, newLineIndex); +} +exports.stringify = stringify; +var DebugContext = (function () { + function DebugContext() { + } + Object.defineProperty(DebugContext.prototype, "nodeIndex", { + // We don't really need this + // abstract get view(): ViewData; + get: function () { }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DebugContext.prototype, "injector", { + get: function () { }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DebugContext.prototype, "component", { + get: function () { }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DebugContext.prototype, "providerTokens", { + get: function () { }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DebugContext.prototype, "references", { + get: function () { }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DebugContext.prototype, "context", { + get: function () { }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DebugContext.prototype, "componentRenderElement", { + get: function () { }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DebugContext.prototype, "renderNode", { + get: function () { }, + enumerable: true, + configurable: true + }); + return DebugContext; +}()); +exports.DebugContext = DebugContext; +//# sourceMappingURL=lang.js.map \ No newline at end of file diff --git a/src-2/externals/injection-js/facade/lang.js.map b/src-2/externals/injection-js/facade/lang.js.map new file mode 100644 index 0000000..e2b0c51 --- /dev/null +++ b/src-2/externals/injection-js/facade/lang.js.map @@ -0,0 +1 @@ +{"version":3,"file":"lang.js","sourceRoot":"","sources":["../../lib/facade/lang.ts"],"names":[],"mappings":";AAsCA,IAAI,WAA8B,CAAC;AACnC,EAAE,CAAC,CAAC,OAAO,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC;IAClC,EAAE,CAAC,CAAC,OAAO,iBAAiB,KAAK,WAAW,IAAI,IAAI,YAAY,iBAAiB,CAAC,CAAC,CAAC;QAClF,yEAAyE;QACzE,WAAW,GAAQ,IAAI,CAAC;IAC1B,CAAC;IAAC,IAAI,CAAC,CAAC;QACN,WAAW,GAAQ,MAAM,CAAC;IAC5B,CAAC;AACH,CAAC;AAAC,IAAI,CAAC,CAAC;IACN,WAAW,GAAQ,MAAM,CAAC;AAC5B,CAAC;AAED,kEAAkE;AAClE,4CAA4C;AAC5C,IAAM,OAAO,GAAsB,WAAW;AAE3B,cAAM,WAFsB;AAI/C,mBAA0B,GAAQ;IAChC,MAAM,CAAC,GAAG,IAAI,IAAI,CAAC;AACrB,CAAC;AAFe,iBAAS,YAExB,CAAA;AAED,mBAA0B,KAAU;IAClC,EAAE,CAAC,CAAC,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC;QAC9B,MAAM,CAAC,KAAK,CAAC;IACf,CAAC;IAED,EAAE,CAAC,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC;QAClB,MAAM,CAAC,EAAE,GAAG,KAAK,CAAC;IACpB,CAAC;IAED,EAAE,CAAC,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC;QACzB,MAAM,CAAC,KAAG,KAAK,CAAC,cAAgB,CAAC;IACnC,CAAC;IAED,EAAE,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;QACf,MAAM,CAAC,KAAG,KAAK,CAAC,IAAM,CAAC;IACzB,CAAC;IAED,IAAM,GAAG,GAAG,KAAK,CAAC,QAAQ,EAAE,CAAC;IAC7B,IAAM,YAAY,GAAG,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACvC,MAAM,CAAC,YAAY,KAAK,CAAC,CAAC,GAAG,GAAG,GAAG,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC;AACpE,CAAC;AApBe,iBAAS,YAoBxB,CAAA;AAED;IAAA;IAYA,CAAC;IATC,sBAAa,mCAAS;QAFtB,4BAA4B;QAC5B,iCAAiC;aACjC,eAAsC;;;OAAA;IACtC,sBAAa,kCAAQ;aAArB,eAAkC;;;OAAA;IAClC,sBAAa,mCAAS;aAAtB,eAA8B;;;OAAA;IAC9B,sBAAa,wCAAc;aAA3B,eAAqC;;;OAAA;IACrC,sBAAa,oCAAU;aAAvB,eAAgD;;;OAAA;IAChD,sBAAa,iCAAO;aAApB,eAA4B;;;OAAA;IAC5B,sBAAa,gDAAsB;aAAnC,eAA2C;;;OAAA;IAC3C,sBAAa,oCAAU;aAAvB,eAA+B;;;OAAA;IAEjC,mBAAC;AAAD,CAAC,AAZD,IAYC;AAZqB,oBAAY,eAYjC,CAAA"} \ No newline at end of file diff --git a/src-2/externals/injection-js/facade/type.d.ts b/src-2/externals/injection-js/facade/type.d.ts new file mode 100644 index 0000000..f694f6b --- /dev/null +++ b/src-2/externals/injection-js/facade/type.d.ts @@ -0,0 +1,22 @@ +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +/** + * @whatItDoes Represents a type that a Component or other object is instances of. + * + * @description + * + * An example of a `Type` is `MyCustomComponent` class, which in JavaScript is be represented by + * the `MyCustomComponent` constructor function. + * + * @stable + */ +export declare const Type: FunctionConstructor; +export declare function isType(v: any): v is Type; +export interface Type extends Function { + new (...args: any[]): T; +} diff --git a/src-2/externals/injection-js/facade/type.js b/src-2/externals/injection-js/facade/type.js new file mode 100644 index 0000000..b2ed407 --- /dev/null +++ b/src-2/externals/injection-js/facade/type.js @@ -0,0 +1,24 @@ +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +"use strict"; +/** + * @whatItDoes Represents a type that a Component or other object is instances of. + * + * @description + * + * An example of a `Type` is `MyCustomComponent` class, which in JavaScript is be represented by + * the `MyCustomComponent` constructor function. + * + * @stable + */ +exports.Type = Function; +function isType(v) { + return typeof v === 'function'; +} +exports.isType = isType; +//# sourceMappingURL=type.js.map \ No newline at end of file diff --git a/src-2/externals/injection-js/facade/type.js.map b/src-2/externals/injection-js/facade/type.js.map new file mode 100644 index 0000000..5cb27b7 --- /dev/null +++ b/src-2/externals/injection-js/facade/type.js.map @@ -0,0 +1 @@ +{"version":3,"file":"type.js","sourceRoot":"","sources":["../../lib/facade/type.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;;AAEH;;;;;;;;;GASG;AACU,YAAI,GAAG,QAAQ,CAAC;AAE7B,gBAAuB,CAAM;IAC3B,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,CAAC;AACjC,CAAC;AAFe,cAAM,SAErB,CAAA"} \ No newline at end of file diff --git a/src-2/externals/injection-js/forward_ref.d.ts b/src-2/externals/injection-js/forward_ref.d.ts new file mode 100644 index 0000000..a9bf9b6 --- /dev/null +++ b/src-2/externals/injection-js/forward_ref.d.ts @@ -0,0 +1,38 @@ +import { Type } from './facade/type'; +/** + * An interface that a function passed into {@link forwardRef} has to implement. + * + * ### Example + * + * {@example core/di/ts/forward_ref/forward_ref_spec.ts region='forward_ref_fn'} + * @experimental + */ +export interface ForwardRefFn { + (): any; +} +/** + * Allows to refer to references which are not yet defined. + * + * For instance, `forwardRef` is used when the `token` which we need to refer to for the purposes of + * DI is declared, + * but not yet defined. It is also used when the `token` which we use when creating a query is not + * yet defined. + * + * ### Example + * {@example core/di/ts/forward_ref/forward_ref_spec.ts region='forward_ref'} + * @experimental + */ +export declare function forwardRef(forwardRefFn: ForwardRefFn): Type; +/** + * Lazily retrieves the reference value from a forwardRef. + * + * Acts as the identity function when given a non-forward-ref value. + * + * ### Example ([live demo](http://plnkr.co/edit/GU72mJrk1fiodChcmiDR?p=preview)) + * + * {@example core/di/ts/forward_ref/forward_ref_spec.ts region='resolve_forward_ref'} + * + * See: {@link forwardRef} + * @experimental + */ +export declare function resolveForwardRef(type: any): any; diff --git a/src-2/externals/injection-js/forward_ref.js b/src-2/externals/injection-js/forward_ref.js new file mode 100644 index 0000000..4d3f4b8 --- /dev/null +++ b/src-2/externals/injection-js/forward_ref.js @@ -0,0 +1,50 @@ +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +"use strict"; +var lang_1 = require('./facade/lang'); +/** + * Allows to refer to references which are not yet defined. + * + * For instance, `forwardRef` is used when the `token` which we need to refer to for the purposes of + * DI is declared, + * but not yet defined. It is also used when the `token` which we use when creating a query is not + * yet defined. + * + * ### Example + * {@example core/di/ts/forward_ref/forward_ref_spec.ts region='forward_ref'} + * @experimental + */ +function forwardRef(forwardRefFn) { + forwardRefFn.__forward_ref__ = forwardRef; + forwardRefFn.toString = function () { return lang_1.stringify(this()); }; + return forwardRefFn; +} +exports.forwardRef = forwardRef; +/** + * Lazily retrieves the reference value from a forwardRef. + * + * Acts as the identity function when given a non-forward-ref value. + * + * ### Example ([live demo](http://plnkr.co/edit/GU72mJrk1fiodChcmiDR?p=preview)) + * + * {@example core/di/ts/forward_ref/forward_ref_spec.ts region='resolve_forward_ref'} + * + * See: {@link forwardRef} + * @experimental + */ +function resolveForwardRef(type) { + if (typeof type === 'function' && type.hasOwnProperty('__forward_ref__') && + type.__forward_ref__ === forwardRef) { + return type(); + } + else { + return type; + } +} +exports.resolveForwardRef = resolveForwardRef; +//# sourceMappingURL=forward_ref.js.map \ No newline at end of file diff --git a/src-2/externals/injection-js/forward_ref.js.map b/src-2/externals/injection-js/forward_ref.js.map new file mode 100644 index 0000000..36437ca --- /dev/null +++ b/src-2/externals/injection-js/forward_ref.js.map @@ -0,0 +1 @@ +{"version":3,"file":"forward_ref.js","sourceRoot":"","sources":["../lib/forward_ref.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;;AAEH,qBAAwB,eAAe,CAAC,CAAA;AAcxC;;;;;;;;;;;GAWG;AACH,oBAA2B,YAA0B;IAC7C,YAAa,CAAC,eAAe,GAAG,UAAU,CAAC;IAC3C,YAAa,CAAC,QAAQ,GAAG,cAAa,MAAM,CAAC,gBAAS,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IACxE,MAAM,CAAkB,YAAa,CAAC;AACxC,CAAC;AAJe,kBAAU,aAIzB,CAAA;AAED;;;;;;;;;;;GAWG;AACH,2BAAkC,IAAS;IACzC,EAAE,CAAC,CAAC,OAAO,IAAI,KAAK,UAAU,IAAI,IAAI,CAAC,cAAc,CAAC,iBAAiB,CAAC;QACpE,IAAI,CAAC,eAAe,KAAK,UAAU,CAAC,CAAC,CAAC;QACxC,MAAM,CAAgB,IAAK,EAAE,CAAC;IAChC,CAAC;IAAC,IAAI,CAAC,CAAC;QACN,MAAM,CAAC,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAPe,yBAAiB,oBAOhC,CAAA"} \ No newline at end of file diff --git a/src-2/externals/injection-js/index.d.ts b/src-2/externals/injection-js/index.d.ts new file mode 100644 index 0000000..2cbe639 --- /dev/null +++ b/src-2/externals/injection-js/index.d.ts @@ -0,0 +1,21 @@ +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +/** + * @module + * @description + * The `di` module provides dependency injection container services. + */ +export * from './metadata'; +export { forwardRef, resolveForwardRef, ForwardRefFn } from './forward_ref'; +export { Injector } from './injector'; +export { ReflectiveInjector } from './reflective_injector'; +export { Provider, TypeProvider, ValueProvider, ClassProvider, ExistingProvider, FactoryProvider } from './provider'; +export { ResolvedReflectiveFactory, ResolvedReflectiveProvider } from './reflective_provider'; +export { ReflectiveKey } from './reflective_key'; +export { InjectionToken, OpaqueToken } from './injection_token'; +export { Class } from './util/decorators'; diff --git a/src-2/externals/injection-js/index.js b/src-2/externals/injection-js/index.js new file mode 100644 index 0000000..df69d64 --- /dev/null +++ b/src-2/externals/injection-js/index.js @@ -0,0 +1,34 @@ +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +"use strict"; +function __export(m) { + for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; +} +/** + * @module + * @description + * The `di` module provides dependency injection container services. + */ +__export(require('./metadata')); +var forward_ref_1 = require('./forward_ref'); +exports.forwardRef = forward_ref_1.forwardRef; +exports.resolveForwardRef = forward_ref_1.resolveForwardRef; +var injector_1 = require('./injector'); +exports.Injector = injector_1.Injector; +var reflective_injector_1 = require('./reflective_injector'); +exports.ReflectiveInjector = reflective_injector_1.ReflectiveInjector; +var reflective_provider_1 = require('./reflective_provider'); +exports.ResolvedReflectiveFactory = reflective_provider_1.ResolvedReflectiveFactory; +var reflective_key_1 = require('./reflective_key'); +exports.ReflectiveKey = reflective_key_1.ReflectiveKey; +var injection_token_1 = require('./injection_token'); +exports.InjectionToken = injection_token_1.InjectionToken; +exports.OpaqueToken = injection_token_1.OpaqueToken; +var decorators_1 = require('./util/decorators'); +exports.Class = decorators_1.Class; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/src-2/externals/injection-js/index.js.map b/src-2/externals/injection-js/index.js.map new file mode 100644 index 0000000..672d293 --- /dev/null +++ b/src-2/externals/injection-js/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;;;;;AAEH;;;;GAIG;AAEH,iBAAc,YAAY,CAAC,EAAA;AAE3B,4BAA0D,eAAe,CAAC;AAAlE,8CAAU;AAAE,4DAAsD;AAE1E,yBAAuB,YAAY,CAAC;AAA5B,uCAA4B;AACpC,oCAAiC,uBAAuB,CAAC;AAAjD,sEAAiD;AAEzD,oCAAoE,uBAAuB,CAAC;AAApF,oFAAoF;AAC5F,+BAA4B,kBAAkB,CAAC;AAAvC,uDAAuC;AAC/C,gCAA0C,mBAAmB,CAAC;AAAtD,0DAAc;AAAE,oDAAsC;AAC9D,2BAAoB,mBAAmB,CAAC;AAAhC,mCAAgC"} \ No newline at end of file diff --git a/src-2/externals/injection-js/injection.bundle.js b/src-2/externals/injection-js/injection.bundle.js new file mode 100644 index 0000000..c73918c --- /dev/null +++ b/src-2/externals/injection-js/injection.bundle.js @@ -0,0 +1,38 @@ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory() : + typeof define === 'function' && define.amd ? define(factory) : + (factory()); +}(this, (function () { 'use strict'; + +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +function __export(m) { + for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; +} +/** + * @module + * @description + * The `di` module provides dependency injection container services. + */ +__export(require('./metadata')); +var forward_ref_1 = require('./forward_ref'); +exports.forwardRef = forward_ref_1.forwardRef; +exports.resolveForwardRef = forward_ref_1.resolveForwardRef; +var injector_1 = require('./injector'); +exports.Injector = injector_1.Injector; +var reflective_injector_1 = require('./reflective_injector'); +exports.ReflectiveInjector = reflective_injector_1.ReflectiveInjector; +var reflective_provider_1 = require('./reflective_provider'); +exports.ResolvedReflectiveFactory = reflective_provider_1.ResolvedReflectiveFactory; +var reflective_key_1 = require('./reflective_key'); +exports.ReflectiveKey = reflective_key_1.ReflectiveKey; +var injection_token_1 = require('./injection_token'); +exports.InjectionToken = injection_token_1.InjectionToken; +exports.OpaqueToken = injection_token_1.OpaqueToken; + +}))); diff --git a/src-2/externals/injection-js/injection_token.d.ts b/src-2/externals/injection-js/injection_token.d.ts new file mode 100644 index 0000000..7d880a7 --- /dev/null +++ b/src-2/externals/injection-js/injection_token.d.ts @@ -0,0 +1,62 @@ +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +/** + * Creates a token that can be used in a DI Provider. + * + * ### Example ([live demo](http://plnkr.co/edit/Ys9ezXpj2Mnoy3Uc8KBp?p=preview)) + * + * ```typescript + * var t = new OpaqueToken("value"); + * + * var injector = Injector.resolveAndCreate([ + * {provide: t, useValue: "bindingValue"} + * ]); + * + * expect(injector.get(t)).toEqual("bindingValue"); + * ``` + * + * Using an `OpaqueToken` is preferable to using strings as tokens because of possible collisions + * caused by multiple providers using the same string as two different tokens. + * + * Using an `OpaqueToken` is preferable to using an `Object` as tokens because it provides better + * error messages. + * @deprecated since v4.0.0 because it does not support type information, use `InjectionToken` + * instead. + */ +export declare class OpaqueToken { + protected _desc: string; + constructor(_desc: string); + toString(): string; +} +/** + * Creates a token that can be used in a DI Provider. + * + * Use an `InjectionToken` whenever the type you are injecting is not reified (does not have a + * runtime representation) such as when injecting an interface, callable type, array or + * parametrized type. + * + * `InjectionToken` is parameterized on `T` which is the type of object which will be returned by + * the `Injector`. This provides additional level of type safety. + * + * ``` + * interface MyInterface {...} + * var myInterface = injector.get(new InjectionToken('SomeToken')); + * // myInterface is inferred to be MyInterface. + * ``` + * + * ### Example + * + * {@example core/di/ts/injector_spec.ts region='InjectionToken'} + * + * @stable + */ +export declare class InjectionToken extends OpaqueToken { + private _differentiate_from_OpaqueToken_structurally; + constructor(desc: string); + toString(): string; +} diff --git a/src-2/externals/injection-js/injection_token.js b/src-2/externals/injection-js/injection_token.js new file mode 100644 index 0000000..3fd7841 --- /dev/null +++ b/src-2/externals/injection-js/injection_token.js @@ -0,0 +1,76 @@ +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +"use strict"; +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +/** + * Creates a token that can be used in a DI Provider. + * + * ### Example ([live demo](http://plnkr.co/edit/Ys9ezXpj2Mnoy3Uc8KBp?p=preview)) + * + * ```typescript + * var t = new OpaqueToken("value"); + * + * var injector = Injector.resolveAndCreate([ + * {provide: t, useValue: "bindingValue"} + * ]); + * + * expect(injector.get(t)).toEqual("bindingValue"); + * ``` + * + * Using an `OpaqueToken` is preferable to using strings as tokens because of possible collisions + * caused by multiple providers using the same string as two different tokens. + * + * Using an `OpaqueToken` is preferable to using an `Object` as tokens because it provides better + * error messages. + * @deprecated since v4.0.0 because it does not support type information, use `InjectionToken` + * instead. + */ +var OpaqueToken = (function () { + function OpaqueToken(_desc) { + this._desc = _desc; + } + OpaqueToken.prototype.toString = function () { return "Token " + this._desc; }; + return OpaqueToken; +}()); +exports.OpaqueToken = OpaqueToken; +/** + * Creates a token that can be used in a DI Provider. + * + * Use an `InjectionToken` whenever the type you are injecting is not reified (does not have a + * runtime representation) such as when injecting an interface, callable type, array or + * parametrized type. + * + * `InjectionToken` is parameterized on `T` which is the type of object which will be returned by + * the `Injector`. This provides additional level of type safety. + * + * ``` + * interface MyInterface {...} + * var myInterface = injector.get(new InjectionToken('SomeToken')); + * // myInterface is inferred to be MyInterface. + * ``` + * + * ### Example + * + * {@example core/di/ts/injector_spec.ts region='InjectionToken'} + * + * @stable + */ +var InjectionToken = (function (_super) { + __extends(InjectionToken, _super); + function InjectionToken(desc) { + _super.call(this, desc); + } + InjectionToken.prototype.toString = function () { return "InjectionToken " + this._desc; }; + return InjectionToken; +}(OpaqueToken)); +exports.InjectionToken = InjectionToken; +//# sourceMappingURL=injection_token.js.map \ No newline at end of file diff --git a/src-2/externals/injection-js/injection_token.js.map b/src-2/externals/injection-js/injection_token.js.map new file mode 100644 index 0000000..7574fcd --- /dev/null +++ b/src-2/externals/injection-js/injection_token.js.map @@ -0,0 +1 @@ +{"version":3,"file":"injection_token.js","sourceRoot":"","sources":["../lib/injection_token.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;;;;;;;AAEH;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH;IACE,qBAAsB,KAAa;QAAb,UAAK,GAAL,KAAK,CAAQ;IAAG,CAAC;IAEvC,8BAAQ,GAAR,cAAqB,MAAM,CAAC,WAAS,IAAI,CAAC,KAAO,CAAC,CAAC,CAAC;IACtD,kBAAC;AAAD,CAAC,AAJD,IAIC;AAJY,mBAAW,cAIvB,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH;IAAuC,kCAAW;IAIhD,wBAAY,IAAY;QAAI,kBAAM,IAAI,CAAC,CAAC;IAAC,CAAC;IAE1C,iCAAQ,GAAR,cAAqB,MAAM,CAAC,oBAAkB,IAAI,CAAC,KAAO,CAAC,CAAC,CAAC;IAC/D,qBAAC;AAAD,CAAC,AAPD,CAAuC,WAAW,GAOjD;AAPY,sBAAc,iBAO1B,CAAA"} \ No newline at end of file diff --git a/src-2/externals/injection-js/injector.d.ts b/src-2/externals/injection-js/injector.d.ts new file mode 100644 index 0000000..d5995ff --- /dev/null +++ b/src-2/externals/injection-js/injector.d.ts @@ -0,0 +1,40 @@ +import { Type } from './facade/type'; +import { InjectionToken } from './injection_token'; +export declare const THROW_IF_NOT_FOUND: Object; +/** + * @whatItDoes Injector interface + * @howToUse + * ``` + * const injector: Injector = ...; + * injector.get(...); + * ``` + * + * @description + * For more details, see the {@linkDocs guide/dependency-injection "Dependency Injection Guide"}. + * + * ### Example + * + * {@example core/di/ts/injector_spec.ts region='Injector'} + * + * `Injector` returns itself when given `Injector` as a token: + * {@example core/di/ts/injector_spec.ts region='injectInjector'} + * + * @stable + */ +export declare abstract class Injector { + static THROW_IF_NOT_FOUND: Object; + static NULL: Injector; + /** + * Retrieves an instance from the injector based on the provided token. + * If not found: + * - Throws {@link NoProviderError} if no `notFoundValue` that is not equal to + * Injector.THROW_IF_NOT_FOUND is given + * - Returns the `notFoundValue` otherwise + */ + abstract get(token: Type | InjectionToken, notFoundValue?: T): T; + /** + * @deprecated from v4.0.0 use Type or InjectionToken + * @suppress {duplicate} + */ + abstract get(token: any, notFoundValue?: any): any; +} diff --git a/src-2/externals/injection-js/injector.js b/src-2/externals/injection-js/injector.js new file mode 100644 index 0000000..1a5284c --- /dev/null +++ b/src-2/externals/injection-js/injector.js @@ -0,0 +1,52 @@ +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +"use strict"; +var lang_1 = require('./facade/lang'); +var _THROW_IF_NOT_FOUND = new Object(); +exports.THROW_IF_NOT_FOUND = _THROW_IF_NOT_FOUND; +var _NullInjector = (function () { + function _NullInjector() { + } + _NullInjector.prototype.get = function (token, notFoundValue) { + if (notFoundValue === void 0) { notFoundValue = _THROW_IF_NOT_FOUND; } + if (notFoundValue === _THROW_IF_NOT_FOUND) { + throw new Error("No provider for " + lang_1.stringify(token) + "!"); + } + return notFoundValue; + }; + return _NullInjector; +}()); +/** + * @whatItDoes Injector interface + * @howToUse + * ``` + * const injector: Injector = ...; + * injector.get(...); + * ``` + * + * @description + * For more details, see the {@linkDocs guide/dependency-injection "Dependency Injection Guide"}. + * + * ### Example + * + * {@example core/di/ts/injector_spec.ts region='Injector'} + * + * `Injector` returns itself when given `Injector` as a token: + * {@example core/di/ts/injector_spec.ts region='injectInjector'} + * + * @stable + */ +var Injector = (function () { + function Injector() { + } + Injector.THROW_IF_NOT_FOUND = _THROW_IF_NOT_FOUND; + Injector.NULL = new _NullInjector(); + return Injector; +}()); +exports.Injector = Injector; +//# sourceMappingURL=injector.js.map \ No newline at end of file diff --git a/src-2/externals/injection-js/injector.js.map b/src-2/externals/injection-js/injector.js.map new file mode 100644 index 0000000..3753e98 --- /dev/null +++ b/src-2/externals/injection-js/injector.js.map @@ -0,0 +1 @@ +{"version":3,"file":"injector.js","sourceRoot":"","sources":["../lib/injector.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;;AAEH,qBAAwB,eAAe,CAAC,CAAA;AAKxC,IAAM,mBAAmB,GAAG,IAAI,MAAM,EAAE,CAAC;AAC5B,0BAAkB,GAAG,mBAAmB,CAAC;AAEtD;IAAA;IAOA,CAAC;IANC,2BAAG,GAAH,UAAI,KAAU,EAAE,aAAwC;QAAxC,6BAAwC,GAAxC,mCAAwC;QACtD,EAAE,CAAC,CAAC,aAAa,KAAK,mBAAmB,CAAC,CAAC,CAAC;YAC1C,MAAM,IAAI,KAAK,CAAC,qBAAmB,gBAAS,CAAC,KAAK,CAAC,MAAG,CAAC,CAAC;QAC1D,CAAC;QACD,MAAM,CAAC,aAAa,CAAC;IACvB,CAAC;IACH,oBAAC;AAAD,CAAC,AAPD,IAOC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH;IAAA;IAiBA,CAAC;IAhBQ,2BAAkB,GAAG,mBAAmB,CAAC;IACzC,aAAI,GAAa,IAAI,aAAa,EAAE,CAAC;IAe9C,eAAC;AAAD,CAAC,AAjBD,IAiBC;AAjBqB,gBAAQ,WAiB7B,CAAA"} \ No newline at end of file diff --git a/src-2/externals/injection-js/metadata.d.ts b/src-2/externals/injection-js/metadata.d.ts new file mode 100644 index 0000000..2d7b9f5 --- /dev/null +++ b/src-2/externals/injection-js/metadata.d.ts @@ -0,0 +1,265 @@ +/** + * Type of the Inject decorator / constructor function. + * + * @stable + */ +export interface InjectDecorator { + /** + * @whatItDoes A parameter decorator that specifies a dependency. + * @howToUse + * ``` + * @Injectable() + * class Car { + * constructor(@Inject("MyEngine") public engine:Engine) {} + * } + * ``` + * + * @description + * For more details, see the {@linkDocs guide/dependency-injection "Dependency Injection Guide"}. + * + * ### Example + * + * {@example core/di/ts/metadata_spec.ts region='Inject'} + * + * When `@Inject()` is not present, {@link Injector} will use the type annotation of the + * parameter. + * + * ### Example + * + * {@example core/di/ts/metadata_spec.ts region='InjectWithoutDecorator'} + * + * @stable + */ + (token: any): any; + new (token: any): Inject; +} +/** + * Type of the Inject metadata. + * + * @stable + */ +export interface Inject { + token: any; +} +/** + * Inject decorator and metadata. + * + * @stable + * @Annotation + */ +export declare const Inject: InjectDecorator; +/** + * Type of the Optional decorator / constructor function. + * + * @stable + */ +export interface OptionalDecorator { + /** + * @whatItDoes A parameter metadata that marks a dependency as optional. + * {@link Injector} provides `null` if the dependency is not found. + * @howToUse + * ``` + * @Injectable() + * class Car { + * constructor(@Optional() public engine:Engine) {} + * } + * ``` + * + * @description + * For more details, see the {@linkDocs guide/dependency-injection "Dependency Injection Guide"}. + * + * ### Example + * + * {@example core/di/ts/metadata_spec.ts region='Optional'} + * + * @stable + */ + (): any; + new (): Optional; +} +/** + * Type of the Optional metadata. + * + * @stable + */ +export interface Optional { +} +/** + * Optional decorator and metadata. + * + * @stable + * @Annotation + */ +export declare const Optional: OptionalDecorator; +/** + * Type of the Injectable decorator / constructor function. + * + * @stable + */ +export interface InjectableDecorator { + /** + * @whatItDoes A marker metadata that marks a class as available to {@link Injector} for creation. + * @howToUse + * ``` + * @Injectable() + * class Car {} + * ``` + * + * @description + * For more details, see the {@linkDocs guide/dependency-injection "Dependency Injection Guide"}. + * + * ### Example + * + * {@example core/di/ts/metadata_spec.ts region='Injectable'} + * + * {@link Injector} will throw {@link NoAnnotationError} when trying to instantiate a class that + * does not have `@Injectable` marker, as shown in the example below. + * + * {@example core/di/ts/metadata_spec.ts region='InjectableThrows'} + * + * @stable + */ + (): any; + new (): Injectable; +} +/** + * Type of the Injectable metadata. + * + * @stable + */ +export interface Injectable { +} +/** + * Injectable decorator and metadata. + * + * @stable + * @Annotation + */ +export declare const Injectable: InjectableDecorator; +/** + * Type of the Self decorator / constructor function. + * + * @stable + */ +export interface SelfDecorator { + /** + * @whatItDoes Specifies that an {@link Injector} should retrieve a dependency only from itself. + * @howToUse + * ``` + * @Injectable() + * class Car { + * constructor(@Self() public engine:Engine) {} + * } + * ``` + * + * @description + * For more details, see the {@linkDocs guide/dependency-injection "Dependency Injection Guide"}. + * + * ### Example + * + * {@example core/di/ts/metadata_spec.ts region='Self'} + * + * @stable + */ + (): any; + new (): Self; +} +/** + * Type of the Self metadata. + * + * @stable + */ +export interface Self { +} +/** + * Self decorator and metadata. + * + * @stable + * @Annotation + */ +export declare const Self: SelfDecorator; +/** + * Type of the SkipSelf decorator / constructor function. + * + * @stable + */ +export interface SkipSelfDecorator { + /** + * @whatItDoes Specifies that the dependency resolution should start from the parent injector. + * @howToUse + * ``` + * @Injectable() + * class Car { + * constructor(@SkipSelf() public engine:Engine) {} + * } + * ``` + * + * @description + * For more details, see the {@linkDocs guide/dependency-injection "Dependency Injection Guide"}. + * + * ### Example + * + * {@example core/di/ts/metadata_spec.ts region='SkipSelf'} + * + * @stable + */ + (): any; + new (): SkipSelf; +} +/** + * Type of the SkipSelf metadata. + * + * @stable + */ +export interface SkipSelf { +} +/** + * SkipSelf decorator and metadata. + * + * @stable + * @Annotation + */ +export declare const SkipSelf: SkipSelfDecorator; +/** + * Type of the Host decorator / constructor function. + * + * @stable + */ +export interface HostDecorator { + /** + * @whatItDoes Specifies that an injector should retrieve a dependency from any injector until + * reaching the host element of the current component. + * @howToUse + * ``` + * @Injectable() + * class Car { + * constructor(@Host() public engine:Engine) {} + * } + * ``` + * + * @description + * For more details, see the {@linkDocs guide/dependency-injection "Dependency Injection Guide"}. + * + * ### Example + * + * {@example core/di/ts/metadata_spec.ts region='Host'} + * + * @stable + */ + (): any; + new (): Host; +} +/** + * Type of the Host metadata. + * + * @stable + */ +export interface Host { +} +/** + * Host decorator and metadata. + * + * @stable + * @Annotation + */ +export declare const Host: HostDecorator; diff --git a/src-2/externals/injection-js/metadata.js b/src-2/externals/injection-js/metadata.js new file mode 100644 index 0000000..283b847 --- /dev/null +++ b/src-2/externals/injection-js/metadata.js @@ -0,0 +1,52 @@ +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +"use strict"; +var decorators_1 = require('./util/decorators'); +/** + * Inject decorator and metadata. + * + * @stable + * @Annotation + */ +exports.Inject = decorators_1.makeParamDecorator('Inject', [['token', undefined]]); +/** + * Optional decorator and metadata. + * + * @stable + * @Annotation + */ +exports.Optional = decorators_1.makeParamDecorator('Optional', []); +/** + * Injectable decorator and metadata. + * + * @stable + * @Annotation + */ +exports.Injectable = decorators_1.makeDecorator('Injectable', []); +/** + * Self decorator and metadata. + * + * @stable + * @Annotation + */ +exports.Self = decorators_1.makeParamDecorator('Self', []); +/** + * SkipSelf decorator and metadata. + * + * @stable + * @Annotation + */ +exports.SkipSelf = decorators_1.makeParamDecorator('SkipSelf', []); +/** + * Host decorator and metadata. + * + * @stable + * @Annotation + */ +exports.Host = decorators_1.makeParamDecorator('Host', []); +//# sourceMappingURL=metadata.js.map \ No newline at end of file diff --git a/src-2/externals/injection-js/metadata.js.map b/src-2/externals/injection-js/metadata.js.map new file mode 100644 index 0000000..630cb06 --- /dev/null +++ b/src-2/externals/injection-js/metadata.js.map @@ -0,0 +1 @@ +{"version":3,"file":"metadata.js","sourceRoot":"","sources":["../lib/metadata.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;;AAEH,2BAAgD,mBAAmB,CAAC,CAAA;AA8CpE;;;;;GAKG;AACU,cAAM,GAAoB,+BAAkB,CAAC,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;AAwC5F;;;;;GAKG;AACU,gBAAQ,GAAsB,+BAAkB,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;AAyC9E;;;;;GAKG;AACU,kBAAU,GAA6C,0BAAa,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;AAsCpG;;;;;GAKG;AACU,YAAI,GAAkB,+BAAkB,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AAuClE;;;;;GAKG;AACU,gBAAQ,GAAsB,+BAAkB,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;AAuC9E;;;;;GAKG;AACU,YAAI,GAAkB,+BAAkB,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC"} \ No newline at end of file diff --git a/src-2/externals/injection-js/package.json b/src-2/externals/injection-js/package.json new file mode 100644 index 0000000..0332195 --- /dev/null +++ b/src-2/externals/injection-js/package.json @@ -0,0 +1,23 @@ +{ + "name": "injection-js", + "version": "2.0.0-rc.2", + "description": "Dependency Injection library for JavaScript and TypeScript", + "main": "injection.bundle.js", + "module": "index.js", + "jsnext:main": "index.js", + "types": "index.d.ts", + "repository": { + "type": "git", + "url": "git+https://github.com/mgechev/injection-js.git" + }, + "dependencies": {}, + "keywords": [ + "DI", + "dependency", + "injection", + "dependency injection", + "injector" + ], + "author": "Minko Gechev ", + "license": "MIT" +} \ No newline at end of file diff --git a/src-2/externals/injection-js/provider.d.ts b/src-2/externals/injection-js/provider.d.ts new file mode 100644 index 0000000..7d721f5 --- /dev/null +++ b/src-2/externals/injection-js/provider.d.ts @@ -0,0 +1,204 @@ +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +import { Type } from './facade/type'; +/** + * @whatItDoes Configures the {@link Injector} to return an instance of `Type` when `Type' is used + * as token. + * @howToUse + * ``` + * @Injectable() + * class MyService {} + * + * const provider: TypeProvider = MyService; + * ``` + * + * @description + * + * Create an instance by invoking the `new` operator and supplying additional arguments. + * This form is a short form of `TypeProvider`; + * + * For more details, see the {@linkDocs guide/dependency-injection "Dependency Injection Guide"}. + * + * ### Example + * + * {@example core/di/ts/provider_spec.ts region='TypeProvider'} + * + * @stable + */ +export interface TypeProvider extends Type { +} +/** + * @whatItDoes Configures the {@link Injector} to return a value for a token. + * @howToUse + * ``` + * const provider: ValueProvider = {provide: 'someToken', useValue: 'someValue'}; + * ``` + * + * @description + * For more details, see the {@linkDocs guide/dependency-injection "Dependency Injection Guide"}. + * + * ### Example + * + * {@example core/di/ts/provider_spec.ts region='ValueProvider'} + * + * @stable + */ +export interface ValueProvider { + /** + * An injection token. (Typically an instance of `Type` or `InjectionToken`, but can be `any`). + */ + provide: any; + /** + * The value to inject. + */ + useValue: any; + /** + * If true, then injector returns an array of instances. This is useful to allow multiple + * providers spread across many files to provide configuration information to a common token. + * + * ### Example + * + * {@example core/di/ts/provider_spec.ts region='MultiProviderAspect'} + */ + multi?: boolean; +} +/** + * @whatItDoes Configures the {@link Injector} to return an instance of `useClass` for a token. + * @howToUse + * ``` + * @Injectable() + * class MyService {} + * + * const provider: ClassProvider = {provide: 'someToken', useClass: MyService}; + * ``` + * + * @description + * For more details, see the {@linkDocs guide/dependency-injection "Dependency Injection Guide"}. + * + * ### Example + * + * {@example core/di/ts/provider_spec.ts region='ClassProvider'} + * + * Note that following two providers are not equal: + * {@example core/di/ts/provider_spec.ts region='ClassProviderDifference'} + * + * @stable + */ +export interface ClassProvider { + /** + * An injection token. (Typically an instance of `Type` or `InjectionToken`, but can be `any`). + */ + provide: any; + /** + * Class to instantiate for the `token`. + */ + useClass: Type; + /** + * If true, then injector returns an array of instances. This is useful to allow multiple + * providers spread across many files to provide configuration information to a common token. + * + * ### Example + * + * {@example core/di/ts/provider_spec.ts region='MultiProviderAspect'} + */ + multi?: boolean; +} +/** + * @whatItDoes Configures the {@link Injector} to return a value of another `useExisting` token. + * @howToUse + * ``` + * const provider: ExistingProvider = {provide: 'someToken', useExisting: 'someOtherToken'}; + * ``` + * + * @description + * For more details, see the {@linkDocs guide/dependency-injection "Dependency Injection Guide"}. + * + * ### Example + * + * {@example core/di/ts/provider_spec.ts region='ExistingProvider'} + * + * @stable + */ +export interface ExistingProvider { + /** + * An injection token. (Typically an instance of `Type` or `InjectionToken`, but can be `any`). + */ + provide: any; + /** + * Existing `token` to return. (equivalent to `injector.get(useExisting)`) + */ + useExisting: any; + /** + * If true, then injector returns an array of instances. This is useful to allow multiple + * providers spread across many files to provide configuration information to a common token. + * + * ### Example + * + * {@example core/di/ts/provider_spec.ts region='MultiProviderAspect'} + */ + multi?: boolean; +} +/** + * @whatItDoes Configures the {@link Injector} to return a value by invoking a `useFactory` + * function. + * @howToUse + * ``` + * function serviceFactory() { ... } + * + * const provider: FactoryProvider = {provide: 'someToken', useFactory: serviceFactory, deps: []}; + * ``` + * + * @description + * For more details, see the {@linkDocs guide/dependency-injection "Dependency Injection Guide"}. + * + * ### Example + * + * {@example core/di/ts/provider_spec.ts region='FactoryProvider'} + * + * Dependencies can also be marked as optional: + * {@example core/di/ts/provider_spec.ts region='FactoryProviderOptionalDeps'} + * + * @stable + */ +export interface FactoryProvider { + /** + * An injection token. (Typically an instance of `Type` or `InjectionToken`, but can be `any`). + */ + provide: any; + /** + * A function to invoke to create a value for this `token`. The function is invoked with + * resolved values of `token`s in the `deps` field. + */ + useFactory: Function; + /** + * A list of `token`s which need to be resolved by the injector. The list of values is then + * used as arguments to the `useFactory` function. + */ + deps?: any[]; + /** + * If true, then injector returns an array of instances. This is useful to allow multiple + * providers spread across many files to provide configuration information to a common token. + * + * ### Example + * + * {@example core/di/ts/provider_spec.ts region='MultiProviderAspect'} + */ + multi?: boolean; +} +/** + * @whatItDoes Describes how the {@link Injector} should be configured. + * @howToUse + * See {@link TypeProvider}, {@link ValueProvider}, {@link ClassProvider}, {@link ExistingProvider}, + * {@link FactoryProvider}. + * + * @description + * For more details, see the {@linkDocs guide/dependency-injection "Dependency Injection Guide"}. + * + * @stable + */ +export declare type Provider = TypeProvider | ValueProvider | ClassProvider | ExistingProvider | FactoryProvider | any[]; diff --git a/src-2/externals/injection-js/provider.js b/src-2/externals/injection-js/provider.js new file mode 100644 index 0000000..cebcfa9 --- /dev/null +++ b/src-2/externals/injection-js/provider.js @@ -0,0 +1,9 @@ +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +"use strict"; +//# sourceMappingURL=provider.js.map \ No newline at end of file diff --git a/src-2/externals/injection-js/provider.js.map b/src-2/externals/injection-js/provider.js.map new file mode 100644 index 0000000..3493b5d --- /dev/null +++ b/src-2/externals/injection-js/provider.js.map @@ -0,0 +1 @@ +{"version":3,"file":"provider.js","sourceRoot":"","sources":["../lib/provider.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"} \ No newline at end of file diff --git a/src-2/externals/injection-js/reflection/platform_reflection_capabilities.d.ts b/src-2/externals/injection-js/reflection/platform_reflection_capabilities.d.ts new file mode 100644 index 0000000..72932ad --- /dev/null +++ b/src-2/externals/injection-js/reflection/platform_reflection_capabilities.d.ts @@ -0,0 +1,26 @@ +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +import { Type } from '../facade/type'; +import { GetterFn, MethodFn, SetterFn } from './types'; +export interface PlatformReflectionCapabilities { + isReflectionEnabled(): boolean; + factory(type: Type): Function; + hasLifecycleHook(type: any, lcProperty: string): boolean; + parameters(type: Type): any[][]; + annotations(type: Type): any[]; + propMetadata(typeOrFunc: Type): { + [key: string]: any[]; + }; + getter(name: string): GetterFn; + setter(name: string): SetterFn; + method(name: string): MethodFn; + importUri(type: Type): string; + resourceUri(type: Type): string; + resolveIdentifier(name: string, moduleUrl: string, members: string[] | null, runtime: any): any; + resolveEnum(enumIdentifier: any, name: string): any; +} diff --git a/src-2/externals/injection-js/reflection/platform_reflection_capabilities.js b/src-2/externals/injection-js/reflection/platform_reflection_capabilities.js new file mode 100644 index 0000000..e35bef7 --- /dev/null +++ b/src-2/externals/injection-js/reflection/platform_reflection_capabilities.js @@ -0,0 +1,9 @@ +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +"use strict"; +//# sourceMappingURL=platform_reflection_capabilities.js.map \ No newline at end of file diff --git a/src-2/externals/injection-js/reflection/platform_reflection_capabilities.js.map b/src-2/externals/injection-js/reflection/platform_reflection_capabilities.js.map new file mode 100644 index 0000000..b19e72d --- /dev/null +++ b/src-2/externals/injection-js/reflection/platform_reflection_capabilities.js.map @@ -0,0 +1 @@ +{"version":3,"file":"platform_reflection_capabilities.js","sourceRoot":"","sources":["../../lib/reflection/platform_reflection_capabilities.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"} \ No newline at end of file diff --git a/src-2/externals/injection-js/reflection/reflection.d.ts b/src-2/externals/injection-js/reflection/reflection.d.ts new file mode 100644 index 0000000..0cf8667 --- /dev/null +++ b/src-2/externals/injection-js/reflection/reflection.d.ts @@ -0,0 +1,7 @@ +import { Reflector } from './reflector'; +export { Reflector } from './reflector'; +/** + * The {@link Reflector} used internally in Angular to access metadata + * about symbols. + */ +export declare const reflector: Reflector; diff --git a/src-2/externals/injection-js/reflection/reflection.js b/src-2/externals/injection-js/reflection/reflection.js new file mode 100644 index 0000000..f7c6820 --- /dev/null +++ b/src-2/externals/injection-js/reflection/reflection.js @@ -0,0 +1,18 @@ +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +"use strict"; +var reflection_capabilities_1 = require('./reflection_capabilities'); +var reflector_1 = require('./reflector'); +var reflector_2 = require('./reflector'); +exports.Reflector = reflector_2.Reflector; +/** + * The {@link Reflector} used internally in Angular to access metadata + * about symbols. + */ +exports.reflector = new reflector_1.Reflector(new reflection_capabilities_1.ReflectionCapabilities()); +//# sourceMappingURL=reflection.js.map \ No newline at end of file diff --git a/src-2/externals/injection-js/reflection/reflection.js.map b/src-2/externals/injection-js/reflection/reflection.js.map new file mode 100644 index 0000000..3da8c9c --- /dev/null +++ b/src-2/externals/injection-js/reflection/reflection.js.map @@ -0,0 +1 @@ +{"version":3,"file":"reflection.js","sourceRoot":"","sources":["../../lib/reflection/reflection.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;;AAEH,wCAAqC,2BAA2B,CAAC,CAAA;AACjE,0BAAwB,aAAa,CAAC,CAAA;AAEtC,0BAAwB,aAAa,CAAC;AAA9B,0CAA8B;AAEtC;;;GAGG;AACU,iBAAS,GAAG,IAAI,qBAAS,CAAC,IAAI,gDAAsB,EAAE,CAAC,CAAC"} \ No newline at end of file diff --git a/src-2/externals/injection-js/reflection/reflection_capabilities.d.ts b/src-2/externals/injection-js/reflection/reflection_capabilities.d.ts new file mode 100644 index 0000000..b89eff8 --- /dev/null +++ b/src-2/externals/injection-js/reflection/reflection_capabilities.d.ts @@ -0,0 +1,29 @@ +import { Type } from '../facade/type'; +import { PlatformReflectionCapabilities } from './platform_reflection_capabilities'; +import { GetterFn, MethodFn, SetterFn } from './types'; +/** + * Attention: This regex has to hold even if the code is minified! + */ +export declare const DELEGATE_CTOR: RegExp; +export declare class ReflectionCapabilities implements PlatformReflectionCapabilities { + private _reflect; + constructor(reflect?: any); + isReflectionEnabled(): boolean; + factory(t: Type): (args: any[]) => T; + private _ownParameters(type, parentCtor); + parameters(type: Type): any[][]; + private _ownAnnotations(typeOrFunc, parentCtor); + annotations(typeOrFunc: Type): any[]; + private _ownPropMetadata(typeOrFunc, parentCtor); + propMetadata(typeOrFunc: any): { + [key: string]: any[]; + }; + hasLifecycleHook(type: any, lcProperty: string): boolean; + getter(name: string): GetterFn; + setter(name: string): SetterFn; + method(name: string): MethodFn; + importUri(type: any): string; + resourceUri(type: any): string; + resolveIdentifier(name: string, moduleUrl: string, members: string[], runtime: any): any; + resolveEnum(enumIdentifier: any, name: string): any; +} diff --git a/src-2/externals/injection-js/reflection/reflection_capabilities.js b/src-2/externals/injection-js/reflection/reflection_capabilities.js new file mode 100644 index 0000000..ac665e6 --- /dev/null +++ b/src-2/externals/injection-js/reflection/reflection_capabilities.js @@ -0,0 +1,234 @@ +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +"use strict"; +var lang_1 = require('../facade/lang'); +var type_1 = require('../facade/type'); +/** + * Attention: This regex has to hold even if the code is minified! + */ +exports.DELEGATE_CTOR = /^function\s+\S+\(\)\s*{[\s\S]+\.apply\(this,\s*arguments\)/; +var ReflectionCapabilities = (function () { + function ReflectionCapabilities(reflect) { + this._reflect = reflect || lang_1.global['Reflect']; + } + ReflectionCapabilities.prototype.isReflectionEnabled = function () { return true; }; + ReflectionCapabilities.prototype.factory = function (t) { return function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i - 0] = arguments[_i]; + } + return new (t.bind.apply(t, [void 0].concat(args)))(); + }; }; + /** @internal */ + ReflectionCapabilities.prototype._zipTypesAndAnnotations = function (paramTypes, paramAnnotations) { + var result; + if (typeof paramTypes === 'undefined') { + result = new Array(paramAnnotations.length); + } + else { + result = new Array(paramTypes.length); + } + for (var i = 0; i < result.length; i++) { + // TS outputs Object for parameters without types, while Traceur omits + // the annotations. For now we preserve the Traceur behavior to aid + // migration, but this can be revisited. + if (typeof paramTypes === 'undefined') { + result[i] = []; + } + else if (paramTypes[i] != Object) { + result[i] = [paramTypes[i]]; + } + else { + result[i] = []; + } + if (paramAnnotations && paramAnnotations[i] != null) { + result[i] = result[i].concat(paramAnnotations[i]); + } + } + return result; + }; + ReflectionCapabilities.prototype._ownParameters = function (type, parentCtor) { + // If we have no decorators, we only have function.length as metadata. + // In that case, to detect whether a child class declared an own constructor or not, + // we need to look inside of that constructor to check whether it is + // just calling the parent. + // This also helps to work around for https://github.com/Microsoft/TypeScript/issues/12439 + // that sets 'design:paramtypes' to [] + // if a class inherits from another class but has no ctor declared itself. + if (exports.DELEGATE_CTOR.exec(type.toString())) { + return null; + } + // Prefer the direct API. + if (type.parameters && type.parameters !== parentCtor.parameters) { + return type.parameters; + } + // API of tsickle for lowering decorators to properties on the class. + var tsickleCtorParams = type.ctorParameters; + if (tsickleCtorParams && tsickleCtorParams !== parentCtor.ctorParameters) { + // Newer tsickle uses a function closure + // Retain the non-function case for compatibility with older tsickle + var ctorParameters = typeof tsickleCtorParams === 'function' ? tsickleCtorParams() : tsickleCtorParams; + var paramTypes = ctorParameters.map(function (ctorParam) { return ctorParam && ctorParam.type; }); + var paramAnnotations = ctorParameters.map(function (ctorParam) { + return ctorParam && convertTsickleDecoratorIntoMetadata(ctorParam.decorators); + }); + return this._zipTypesAndAnnotations(paramTypes, paramAnnotations); + } + // API for metadata created by invoking the decorators. + if (this._reflect != null && this._reflect.getOwnMetadata != null) { + var paramAnnotations = this._reflect.getOwnMetadata('parameters', type); + var paramTypes = this._reflect.getOwnMetadata('design:paramtypes', type); + if (paramTypes || paramAnnotations) { + return this._zipTypesAndAnnotations(paramTypes, paramAnnotations); + } + } + // If a class has no decorators, at least create metadata + // based on function.length. + // Note: We know that this is a real constructor as we checked + // the content of the constructor above. + return new Array(type.length).fill(undefined); + }; + ReflectionCapabilities.prototype.parameters = function (type) { + // Note: only report metadata if we have at least one class decorator + // to stay in sync with the static reflector. + if (!type_1.isType(type)) { + return []; + } + var parentCtor = getParentCtor(type); + var parameters = this._ownParameters(type, parentCtor); + if (!parameters && parentCtor !== Object) { + parameters = this.parameters(parentCtor); + } + return parameters || []; + }; + ReflectionCapabilities.prototype._ownAnnotations = function (typeOrFunc, parentCtor) { + // Prefer the direct API. + if (typeOrFunc.annotations && typeOrFunc.annotations !== parentCtor.annotations) { + var annotations = typeOrFunc.annotations; + if (typeof annotations === 'function' && annotations.annotations) { + annotations = annotations.annotations; + } + return annotations; + } + // API of tsickle for lowering decorators to properties on the class. + if (typeOrFunc.decorators && typeOrFunc.decorators !== parentCtor.decorators) { + return convertTsickleDecoratorIntoMetadata(typeOrFunc.decorators); + } + // API for metadata created by invoking the decorators. + if (this._reflect && this._reflect.getOwnMetadata) { + return this._reflect.getOwnMetadata('annotations', typeOrFunc); + } + return null; + }; + ReflectionCapabilities.prototype.annotations = function (typeOrFunc) { + if (!type_1.isType(typeOrFunc)) { + return []; + } + var parentCtor = getParentCtor(typeOrFunc); + var ownAnnotations = this._ownAnnotations(typeOrFunc, parentCtor) || []; + var parentAnnotations = parentCtor !== Object ? this.annotations(parentCtor) : []; + return parentAnnotations.concat(ownAnnotations); + }; + ReflectionCapabilities.prototype._ownPropMetadata = function (typeOrFunc, parentCtor) { + // Prefer the direct API. + if (typeOrFunc.propMetadata && + typeOrFunc.propMetadata !== parentCtor.propMetadata) { + var propMetadata = typeOrFunc.propMetadata; + if (typeof propMetadata === 'function' && propMetadata.propMetadata) { + propMetadata = propMetadata.propMetadata; + } + return propMetadata; + } + // API of tsickle for lowering decorators to properties on the class. + if (typeOrFunc.propDecorators && + typeOrFunc.propDecorators !== parentCtor.propDecorators) { + var propDecorators_1 = typeOrFunc.propDecorators; + var propMetadata_1 = {}; + Object.keys(propDecorators_1).forEach(function (prop) { + propMetadata_1[prop] = convertTsickleDecoratorIntoMetadata(propDecorators_1[prop]); + }); + return propMetadata_1; + } + // API for metadata created by invoking the decorators. + if (this._reflect && this._reflect.getOwnMetadata) { + return this._reflect.getOwnMetadata('propMetadata', typeOrFunc); + } + return null; + }; + ReflectionCapabilities.prototype.propMetadata = function (typeOrFunc) { + if (!type_1.isType(typeOrFunc)) { + return {}; + } + var parentCtor = getParentCtor(typeOrFunc); + var propMetadata = {}; + if (parentCtor !== Object) { + var parentPropMetadata_1 = this.propMetadata(parentCtor); + Object.keys(parentPropMetadata_1).forEach(function (propName) { + propMetadata[propName] = parentPropMetadata_1[propName]; + }); + } + var ownPropMetadata = this._ownPropMetadata(typeOrFunc, parentCtor); + if (ownPropMetadata) { + Object.keys(ownPropMetadata).forEach(function (propName) { + var decorators = []; + if (propMetadata.hasOwnProperty(propName)) { + decorators.push.apply(decorators, propMetadata[propName]); + } + decorators.push.apply(decorators, ownPropMetadata[propName]); + propMetadata[propName] = decorators; + }); + } + return propMetadata; + }; + ReflectionCapabilities.prototype.hasLifecycleHook = function (type, lcProperty) { + return type instanceof type_1.Type && lcProperty in type.prototype; + }; + ReflectionCapabilities.prototype.getter = function (name) { return new Function('o', 'return o.' + name + ';'); }; + ReflectionCapabilities.prototype.setter = function (name) { + return new Function('o', 'v', 'return o.' + name + ' = v;'); + }; + ReflectionCapabilities.prototype.method = function (name) { + var functionBody = "if (!o." + name + ") throw new Error('\"" + name + "\" is undefined');\n return o." + name + ".apply(o, args);"; + return new Function('o', 'args', functionBody); + }; + // There is not a concept of import uri in Js, but this is useful in developing Dart applications. + ReflectionCapabilities.prototype.importUri = function (type) { + // StaticSymbol + if (typeof type === 'object' && type['filePath']) { + return type['filePath']; + } + // Runtime type + return "./" + lang_1.stringify(type); + }; + ReflectionCapabilities.prototype.resourceUri = function (type) { return "./" + lang_1.stringify(type); }; + ReflectionCapabilities.prototype.resolveIdentifier = function (name, moduleUrl, members, runtime) { + return runtime; + }; + ReflectionCapabilities.prototype.resolveEnum = function (enumIdentifier, name) { return enumIdentifier[name]; }; + return ReflectionCapabilities; +}()); +exports.ReflectionCapabilities = ReflectionCapabilities; +function convertTsickleDecoratorIntoMetadata(decoratorInvocations) { + if (!decoratorInvocations) { + return []; + } + return decoratorInvocations.map(function (decoratorInvocation) { + var decoratorType = decoratorInvocation.type; + var annotationCls = decoratorType.annotationCls; + var annotationArgs = decoratorInvocation.args ? decoratorInvocation.args : []; + return new (annotationCls.bind.apply(annotationCls, [void 0].concat(annotationArgs)))(); + }); +} +function getParentCtor(ctor) { + var parentProto = Object.getPrototypeOf(ctor.prototype); + var parentCtor = parentProto ? parentProto.constructor : null; + // Note: We always use `Object` as the null value + // to simplify checking later on. + return parentCtor || Object; +} +//# sourceMappingURL=reflection_capabilities.js.map \ No newline at end of file diff --git a/src-2/externals/injection-js/reflection/reflection_capabilities.js.map b/src-2/externals/injection-js/reflection/reflection_capabilities.js.map new file mode 100644 index 0000000..f67dc42 --- /dev/null +++ b/src-2/externals/injection-js/reflection/reflection_capabilities.js.map @@ -0,0 +1 @@ +{"version":3,"file":"reflection_capabilities.js","sourceRoot":"","sources":["../../lib/reflection/reflection_capabilities.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;;AAEH,qBAA2C,gBAAgB,CAAC,CAAA;AAC5D,qBAA2B,gBAAgB,CAAC,CAAA;AAK5C;;GAEG;AACU,qBAAa,GAAG,4DAA4D,CAAC;AAE1F;IAGE,gCAAY,OAAa;QAAI,IAAI,CAAC,QAAQ,GAAG,OAAO,IAAI,aAAM,CAAC,SAAS,CAAC,CAAC;IAAC,CAAC;IAE5E,oDAAmB,GAAnB,cAAiC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;IAE/C,wCAAO,GAAP,UAAW,CAAU,IAAwB,MAAM,CAAC;QAAC,cAAc;aAAd,WAAc,CAAd,sBAAc,CAAd,IAAc;YAAd,6BAAc;;QAAK,OAAA,KAAI,CAAC,YAAD,CAAC,kBAAI,IAAI,KAAC;IAAd,CAAc,CAAC,CAAC,CAAC;IAEzF,gBAAgB;IAChB,wDAAuB,GAAvB,UAAwB,UAAiB,EAAE,gBAAuB;QAChE,IAAI,MAAe,CAAC;QAEpB,EAAE,CAAC,CAAC,OAAO,UAAU,KAAK,WAAW,CAAC,CAAC,CAAC;YACtC,MAAM,GAAG,IAAI,KAAK,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;QAC9C,CAAC;QAAC,IAAI,CAAC,CAAC;YACN,MAAM,GAAG,IAAI,KAAK,CAAC,UAAU,CAAC,MAAM,CAA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AG,WAAW,CAAC,WAAW,GAAG,IAAI,CAAC;IAChE,iDAAiD;IACjD,iCAAiC;IACjC,MAAM,CAAC,UAAU,IAAI,MAAM,CAAC;AAC9B,CAAC"} \ No newline at end of file diff --git a/src-2/externals/injection-js/reflection/reflector.d.ts b/src-2/externals/injection-js/reflection/reflector.d.ts new file mode 100644 index 0000000..b7515b1 --- /dev/null +++ b/src-2/externals/injection-js/reflection/reflector.d.ts @@ -0,0 +1,36 @@ +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +import { Type } from '../facade/type'; +import { PlatformReflectionCapabilities } from './platform_reflection_capabilities'; +import { ReflectorReader } from './reflector_reader'; +import { GetterFn, MethodFn, SetterFn } from './types'; +export { PlatformReflectionCapabilities } from './platform_reflection_capabilities'; +export { GetterFn, MethodFn, SetterFn } from './types'; +/** + * Provides access to reflection data about symbols. Used internally by Angular + * to power dependency injection and compilation. + */ +export declare class Reflector extends ReflectorReader { + reflectionCapabilities: PlatformReflectionCapabilities; + constructor(reflectionCapabilities: PlatformReflectionCapabilities); + updateCapabilities(caps: PlatformReflectionCapabilities): void; + factory(type: Type): Function; + parameters(typeOrFunc: Type): any[][]; + annotations(typeOrFunc: Type): any[]; + propMetadata(typeOrFunc: Type): { + [key: string]: any[]; + }; + hasLifecycleHook(type: any, lcProperty: string): boolean; + getter(name: string): GetterFn; + setter(name: string): SetterFn; + method(name: string): MethodFn; + importUri(type: any): string; + resourceUri(type: any): string; + resolveIdentifier(name: string, moduleUrl: string, members: string[] | null, runtime: any): any; + resolveEnum(identifier: any, name: string): any; +} diff --git a/src-2/externals/injection-js/reflection/reflector.js b/src-2/externals/injection-js/reflection/reflector.js new file mode 100644 index 0000000..24063d3 --- /dev/null +++ b/src-2/externals/injection-js/reflection/reflector.js @@ -0,0 +1,53 @@ +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +"use strict"; +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +var reflector_reader_1 = require('./reflector_reader'); +/** + * Provides access to reflection data about symbols. Used internally by Angular + * to power dependency injection and compilation. + */ +var Reflector = (function (_super) { + __extends(Reflector, _super); + function Reflector(reflectionCapabilities) { + _super.call(this); + this.reflectionCapabilities = reflectionCapabilities; + } + Reflector.prototype.updateCapabilities = function (caps) { this.reflectionCapabilities = caps; }; + Reflector.prototype.factory = function (type) { return this.reflectionCapabilities.factory(type); }; + Reflector.prototype.parameters = function (typeOrFunc) { + return this.reflectionCapabilities.parameters(typeOrFunc); + }; + Reflector.prototype.annotations = function (typeOrFunc) { + return this.reflectionCapabilities.annotations(typeOrFunc); + }; + Reflector.prototype.propMetadata = function (typeOrFunc) { + return this.reflectionCapabilities.propMetadata(typeOrFunc); + }; + Reflector.prototype.hasLifecycleHook = function (type, lcProperty) { + return this.reflectionCapabilities.hasLifecycleHook(type, lcProperty); + }; + Reflector.prototype.getter = function (name) { return this.reflectionCapabilities.getter(name); }; + Reflector.prototype.setter = function (name) { return this.reflectionCapabilities.setter(name); }; + Reflector.prototype.method = function (name) { return this.reflectionCapabilities.method(name); }; + Reflector.prototype.importUri = function (type) { return this.reflectionCapabilities.importUri(type); }; + Reflector.prototype.resourceUri = function (type) { return this.reflectionCapabilities.resourceUri(type); }; + Reflector.prototype.resolveIdentifier = function (name, moduleUrl, members, runtime) { + return this.reflectionCapabilities.resolveIdentifier(name, moduleUrl, members, runtime); + }; + Reflector.prototype.resolveEnum = function (identifier, name) { + return this.reflectionCapabilities.resolveEnum(identifier, name); + }; + return Reflector; +}(reflector_reader_1.ReflectorReader)); +exports.Reflector = Reflector; +//# sourceMappingURL=reflector.js.map \ No newline at end of file diff --git a/src-2/externals/injection-js/reflection/reflector.js.map b/src-2/externals/injection-js/reflection/reflector.js.map new file mode 100644 index 0000000..b3d6915 --- /dev/null +++ b/src-2/externals/injection-js/reflection/reflector.js.map @@ -0,0 +1 @@ +{"version":3,"file":"reflector.js","sourceRoot":"","sources":["../../lib/reflection/reflector.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;;;;;;;AAIH,iCAA8B,oBAAoB,CAAC,CAAA;AAMnD;;;GAGG;AACH;IAA+B,6BAAe;IAC5C,mBAAmB,sBAAsD;QAAI,iBAAO,CAAC;QAAlE,2BAAsB,GAAtB,sBAAsB,CAAgC;IAAa,CAAC;IAEvF,sCAAkB,GAAlB,UAAmB,IAAoC,IAAI,IAAI,CAAC,sBAAsB,GAAG,IAAI,CAAC,CAAC,CAAC;IAEhG,2BAAO,GAAP,UAAQ,IAAe,IAAc,MAAM,CAAC,IAAI,CAAC,sBAAsB,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAExF,8BAAU,GAAV,UAAW,UAAqB;QAC9B,MAAM,CAAC,IAAI,CAAC,sBAAsB,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;IAC5D,CAAC;IAED,+BAAW,GAAX,UAAY,UAAqB;QAC/B,MAAM,CAAC,IAAI,CAAC,sBAAsB,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;IAC7D,CAAC;IAED,gCAAY,GAAZ,UAAa,UAAqB;QAChC,MAAM,CAAC,IAAI,CAAC,sBAAsB,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC;IAC9D,CAAC;IAED,oCAAgB,GAAhB,UAAiB,IAAS,EAAE,UAAkB;QAC5C,MAAM,CAAC,IAAI,CAAC,sBAAsB,CAAC,gBAAgB,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;IACxE,CAAC;IAED,0BAAM,GAAN,UAAO,IAAY,IAAc,MAAM,CAAC,IAAI,CAAC,sBAAsB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAEnF,0BAAM,GAAN,UAAO,IAAY,IAAc,MAAM,CAAC,IAAI,CAAC,sBAAsB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAEnF,0BAAM,GAAN,UAAO,IAAY,IAAc,MAAM,CAAC,IAAI,CAAC,sBAAsB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAEnF,6BAAS,GAAT,UAAU,IAAS,IAAY,MAAM,CAAC,IAAI,CAAC,sBAAsB,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAEpF,+BAAW,GAAX,UAAY,IAAS,IAAY,MAAM,CAAC,IAAI,CAAC,sBAAsB,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAExF,qCAAiB,GAAjB,UAAkB,IAAY,EAAE,SAAiB,EAAE,OAAsB,EAAE,OAAY;QACrF,MAAM,CAAC,IAAI,CAAC,sBAAsB,CAAC,iBAAiB,CAAC,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IAC1F,CAAC;IAED,+BAAW,GAAX,UAAY,UAAe,EAAE,IAAY;QACvC,MAAM,CAAC,IAAI,CAAC,sBAAsB,CAAC,WAAW,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;IACnE,CAAC;IACH,gBAAC;AAAD,CAAC,AAxCD,CAA+B,kCAAe,GAwC7C;AAxCY,iBAAS,YAwCrB,CAAA"} \ No newline at end of file diff --git a/src-2/externals/injection-js/reflection/reflector_reader.d.ts b/src-2/externals/injection-js/reflection/reflector_reader.d.ts new file mode 100644 index 0000000..a20773a --- /dev/null +++ b/src-2/externals/injection-js/reflection/reflector_reader.d.ts @@ -0,0 +1,22 @@ +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +/** + * Provides read-only access to reflection data about symbols. Used internally by Angular + * to power dependency injection and compilation. + */ +export declare abstract class ReflectorReader { + abstract parameters(typeOrFunc: any): any[][]; + abstract annotations(typeOrFunc: any): any[]; + abstract propMetadata(typeOrFunc: any): { + [key: string]: any[]; + }; + abstract importUri(typeOrFunc: any): string | null; + abstract resourceUri(typeOrFunc: any): string; + abstract resolveIdentifier(name: string, moduleUrl: string, members: string[], runtime: any): any; + abstract resolveEnum(identifier: any, name: string): any; +} diff --git a/src-2/externals/injection-js/reflection/reflector_reader.js b/src-2/externals/injection-js/reflection/reflector_reader.js new file mode 100644 index 0000000..42f9b5b --- /dev/null +++ b/src-2/externals/injection-js/reflection/reflector_reader.js @@ -0,0 +1,19 @@ +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +"use strict"; +/** + * Provides read-only access to reflection data about symbols. Used internally by Angular + * to power dependency injection and compilation. + */ +var ReflectorReader = (function () { + function ReflectorReader() { + } + return ReflectorReader; +}()); +exports.ReflectorReader = ReflectorReader; +//# sourceMappingURL=reflector_reader.js.map \ No newline at end of file diff --git a/src-2/externals/injection-js/reflection/reflector_reader.js.map b/src-2/externals/injection-js/reflection/reflector_reader.js.map new file mode 100644 index 0000000..3c039b3 --- /dev/null +++ b/src-2/externals/injection-js/reflection/reflector_reader.js.map @@ -0,0 +1 @@ +{"version":3,"file":"reflector_reader.js","sourceRoot":"","sources":["../../lib/reflection/reflector_reader.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;;AAEH;;;GAGG;AACH;IAAA;IAQA,CAAC;IAAD,sBAAC;AAAD,CAAC,AARD,IAQC;AARqB,uBAAe,kBAQpC,CAAA"} \ No newline at end of file diff --git a/src-2/externals/injection-js/reflection/types.d.ts b/src-2/externals/injection-js/reflection/types.d.ts new file mode 100644 index 0000000..2035e82 --- /dev/null +++ b/src-2/externals/injection-js/reflection/types.d.ts @@ -0,0 +1,10 @@ +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +export declare type SetterFn = (obj: any, value: any) => void; +export declare type GetterFn = (obj: any) => any; +export declare type MethodFn = (obj: any, args: any[]) => any; diff --git a/src-2/externals/injection-js/reflection/types.js b/src-2/externals/injection-js/reflection/types.js new file mode 100644 index 0000000..be069eb --- /dev/null +++ b/src-2/externals/injection-js/reflection/types.js @@ -0,0 +1,9 @@ +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +"use strict"; +//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/src-2/externals/injection-js/reflection/types.js.map b/src-2/externals/injection-js/reflection/types.js.map new file mode 100644 index 0000000..6f7e4e3 --- /dev/null +++ b/src-2/externals/injection-js/reflection/types.js.map @@ -0,0 +1 @@ +{"version":3,"file":"types.js","sourceRoot":"","sources":["../../lib/reflection/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"} \ No newline at end of file diff --git a/src-2/externals/injection-js/reflective_errors.d.ts b/src-2/externals/injection-js/reflective_errors.d.ts new file mode 100644 index 0000000..ee26e30 --- /dev/null +++ b/src-2/externals/injection-js/reflective_errors.d.ts @@ -0,0 +1,138 @@ +/// +import { Type } from './facade/type'; +import { ReflectiveInjector } from './reflective_injector'; +import { ReflectiveKey } from './reflective_key'; +export interface InjectionError extends Error { + keys: ReflectiveKey[]; + injectors: ReflectiveInjector[]; + constructResolvingMessage: (this: InjectionError) => string; + addKey(injector: ReflectiveInjector, key: ReflectiveKey): void; +} +/** + * Thrown when trying to retrieve a dependency by key from {@link Injector}, but the + * {@link Injector} does not have a {@link Provider} for the given key. + * + * ### Example ([live demo](http://plnkr.co/edit/vq8D3FRB9aGbnWJqtEPE?p=preview)) + * + * ```typescript + * class A { + * constructor(b:B) {} + * } + * + * expect(() => Injector.resolveAndCreate([A])).toThrowError(); + * ``` + */ +export declare function noProviderError(injector: ReflectiveInjector, key: ReflectiveKey): InjectionError; +/** + * Thrown when dependencies form a cycle. + * + * ### Example ([live demo](http://plnkr.co/edit/wYQdNos0Tzql3ei1EV9j?p=info)) + * + * ```typescript + * var injector = Injector.resolveAndCreate([ + * {provide: "one", useFactory: (two) => "two", deps: [[new Inject("two")]]}, + * {provide: "two", useFactory: (one) => "one", deps: [[new Inject("one")]]} + * ]); + * + * expect(() => injector.get("one")).toThrowError(); + * ``` + * + * Retrieving `A` or `B` throws a `CyclicDependencyError` as the graph above cannot be constructed. + */ +export declare function cyclicDependencyError(injector: ReflectiveInjector, key: ReflectiveKey): InjectionError; +/** + * Thrown when a constructing type returns with an Error. + * + * The `InstantiationError` class contains the original error plus the dependency graph which caused + * this object to be instantiated. + * + * ### Example ([live demo](http://plnkr.co/edit/7aWYdcqTQsP0eNqEdUAf?p=preview)) + * + * ```typescript + * class A { + * constructor() { + * throw new Error('message'); + * } + * } + * + * var injector = Injector.resolveAndCreate([A]); + + * try { + * injector.get(A); + * } catch (e) { + * expect(e instanceof InstantiationError).toBe(true); + * expect(e.originalException.message).toEqual("message"); + * expect(e.originalStack).toBeDefined(); + * } + * ``` + */ +export declare function instantiationError(injector: ReflectiveInjector, originalException: any, originalStack: any, key: ReflectiveKey): InjectionError; +/** + * Thrown when an object other then {@link Provider} (or `Type`) is passed to {@link Injector} + * creation. + * + * ### Example ([live demo](http://plnkr.co/edit/YatCFbPAMCL0JSSQ4mvH?p=preview)) + * + * ```typescript + * expect(() => Injector.resolveAndCreate(["not a type"])).toThrowError(); + * ``` + */ +export declare function invalidProviderError(provider: any): Error; +/** + * Thrown when the class has no annotation information. + * + * Lack of annotation information prevents the {@link Injector} from determining which dependencies + * need to be injected into the constructor. + * + * ### Example ([live demo](http://plnkr.co/edit/rHnZtlNS7vJOPQ6pcVkm?p=preview)) + * + * ```typescript + * class A { + * constructor(b) {} + * } + * + * expect(() => Injector.resolveAndCreate([A])).toThrowError(); + * ``` + * + * This error is also thrown when the class not marked with {@link Injectable} has parameter types. + * + * ```typescript + * class B {} + * + * class A { + * constructor(b:B) {} // no information about the parameter types of A is available at runtime. + * } + * + * expect(() => Injector.resolveAndCreate([A,B])).toThrowError(); + * ``` + * @stable + */ +export declare function noAnnotationError(typeOrFunc: Type | Function, params: any[][]): Error; +/** + * Thrown when getting an object by index. + * + * ### Example ([live demo](http://plnkr.co/edit/bRs0SX2OTQiJzqvjgl8P?p=preview)) + * + * ```typescript + * class A {} + * + * var injector = Injector.resolveAndCreate([A]); + * + * expect(() => injector.getAt(100)).toThrowError(); + * ``` + * @stable + */ +export declare function outOfBoundsError(index: number): Error; +/** + * Thrown when a multi provider and a regular provider are bound to the same token. + * + * ### Example + * + * ```typescript + * expect(() => Injector.resolveAndCreate([ + * { provide: "Strings", useValue: "string1", multi: true}, + * { provide: "Strings", useValue: "string2", multi: false} + * ])).toThrowError(); + * ``` + */ +export declare function mixingMultiProvidersWithRegularProvidersError(provider1: any, provider2: any): Error; diff --git a/src-2/externals/injection-js/reflective_errors.js b/src-2/externals/injection-js/reflective_errors.js new file mode 100644 index 0000000..da71070 --- /dev/null +++ b/src-2/externals/injection-js/reflective_errors.js @@ -0,0 +1,217 @@ +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +"use strict"; +var errors_1 = require('./facade/errors'); +var errors_2 = require('./facade/errors'); +var lang_1 = require('./facade/lang'); +function findFirstClosedCycle(keys) { + var res = []; + for (var i = 0; i < keys.length; ++i) { + if (res.indexOf(keys[i]) > -1) { + res.push(keys[i]); + return res; + } + res.push(keys[i]); + } + return res; +} +function constructResolvingPath(keys) { + if (keys.length > 1) { + var reversed = findFirstClosedCycle(keys.slice().reverse()); + var tokenStrs = reversed.map(function (k) { return lang_1.stringify(k.token); }); + return ' (' + tokenStrs.join(' -> ') + ')'; + } + return ''; +} +function injectionError(injector, key, constructResolvingMessage, originalError) { + var error = (originalError ? errors_1.wrappedError('', originalError) : Error()); + error.addKey = addKey; + error.keys = [key]; + error.injectors = [injector]; + error.constructResolvingMessage = constructResolvingMessage; + error.message = error.constructResolvingMessage(); + error[errors_2.ERROR_ORIGINAL_ERROR] = originalError; + return error; +} +function addKey(injector, key) { + this.injectors.push(injector); + this.keys.push(key); + this.message = this.constructResolvingMessage(); +} +/** + * Thrown when trying to retrieve a dependency by key from {@link Injector}, but the + * {@link Injector} does not have a {@link Provider} for the given key. + * + * ### Example ([live demo](http://plnkr.co/edit/vq8D3FRB9aGbnWJqtEPE?p=preview)) + * + * ```typescript + * class A { + * constructor(b:B) {} + * } + * + * expect(() => Injector.resolveAndCreate([A])).toThrowError(); + * ``` + */ +function noProviderError(injector, key) { + return injectionError(injector, key, function () { + var first = lang_1.stringify(this.keys[0].token); + return "No provider for " + first + "!" + constructResolvingPath(this.keys); + }); +} +exports.noProviderError = noProviderError; +/** + * Thrown when dependencies form a cycle. + * + * ### Example ([live demo](http://plnkr.co/edit/wYQdNos0Tzql3ei1EV9j?p=info)) + * + * ```typescript + * var injector = Injector.resolveAndCreate([ + * {provide: "one", useFactory: (two) => "two", deps: [[new Inject("two")]]}, + * {provide: "two", useFactory: (one) => "one", deps: [[new Inject("one")]]} + * ]); + * + * expect(() => injector.get("one")).toThrowError(); + * ``` + * + * Retrieving `A` or `B` throws a `CyclicDependencyError` as the graph above cannot be constructed. + */ +function cyclicDependencyError(injector, key) { + return injectionError(injector, key, function () { + return "Cannot instantiate cyclic dependency!" + constructResolvingPath(this.keys); + }); +} +exports.cyclicDependencyError = cyclicDependencyError; +/** + * Thrown when a constructing type returns with an Error. + * + * The `InstantiationError` class contains the original error plus the dependency graph which caused + * this object to be instantiated. + * + * ### Example ([live demo](http://plnkr.co/edit/7aWYdcqTQsP0eNqEdUAf?p=preview)) + * + * ```typescript + * class A { + * constructor() { + * throw new Error('message'); + * } + * } + * + * var injector = Injector.resolveAndCreate([A]); + + * try { + * injector.get(A); + * } catch (e) { + * expect(e instanceof InstantiationError).toBe(true); + * expect(e.originalException.message).toEqual("message"); + * expect(e.originalStack).toBeDefined(); + * } + * ``` + */ +function instantiationError(injector, originalException, originalStack, key) { + return injectionError(injector, key, function () { + var first = lang_1.stringify(this.keys[0].token); + return errors_2.getOriginalError(this).message + ": Error during instantiation of " + first + "!" + constructResolvingPath(this.keys) + "."; + }, originalException); +} +exports.instantiationError = instantiationError; +/** + * Thrown when an object other then {@link Provider} (or `Type`) is passed to {@link Injector} + * creation. + * + * ### Example ([live demo](http://plnkr.co/edit/YatCFbPAMCL0JSSQ4mvH?p=preview)) + * + * ```typescript + * expect(() => Injector.resolveAndCreate(["not a type"])).toThrowError(); + * ``` + */ +function invalidProviderError(provider) { + return Error("Invalid provider - only instances of Provider and Type are allowed, got: " + provider); +} +exports.invalidProviderError = invalidProviderError; +/** + * Thrown when the class has no annotation information. + * + * Lack of annotation information prevents the {@link Injector} from determining which dependencies + * need to be injected into the constructor. + * + * ### Example ([live demo](http://plnkr.co/edit/rHnZtlNS7vJOPQ6pcVkm?p=preview)) + * + * ```typescript + * class A { + * constructor(b) {} + * } + * + * expect(() => Injector.resolveAndCreate([A])).toThrowError(); + * ``` + * + * This error is also thrown when the class not marked with {@link Injectable} has parameter types. + * + * ```typescript + * class B {} + * + * class A { + * constructor(b:B) {} // no information about the parameter types of A is available at runtime. + * } + * + * expect(() => Injector.resolveAndCreate([A,B])).toThrowError(); + * ``` + * @stable + */ +function noAnnotationError(typeOrFunc, params) { + var signature = []; + for (var i = 0, ii = params.length; i < ii; i++) { + var parameter = params[i]; + if (!parameter || parameter.length == 0) { + signature.push('?'); + } + else { + signature.push(parameter.map(lang_1.stringify).join(' ')); + } + } + return Error('Cannot resolve all parameters for \'' + lang_1.stringify(typeOrFunc) + '\'(' + + signature.join(', ') + '). ' + + 'Make sure that all the parameters are decorated with Inject or have valid type annotations and that \'' + + lang_1.stringify(typeOrFunc) + '\' is decorated with Injectable.'); +} +exports.noAnnotationError = noAnnotationError; +/** + * Thrown when getting an object by index. + * + * ### Example ([live demo](http://plnkr.co/edit/bRs0SX2OTQiJzqvjgl8P?p=preview)) + * + * ```typescript + * class A {} + * + * var injector = Injector.resolveAndCreate([A]); + * + * expect(() => injector.getAt(100)).toThrowError(); + * ``` + * @stable + */ +function outOfBoundsError(index) { + return Error("Index " + index + " is out-of-bounds."); +} +exports.outOfBoundsError = outOfBoundsError; +// TODO: add a working example after alpha38 is released +/** + * Thrown when a multi provider and a regular provider are bound to the same token. + * + * ### Example + * + * ```typescript + * expect(() => Injector.resolveAndCreate([ + * { provide: "Strings", useValue: "string1", multi: true}, + * { provide: "Strings", useValue: "string2", multi: false} + * ])).toThrowError(); + * ``` + */ +function mixingMultiProvidersWithRegularProvidersError(provider1, provider2) { + return Error("Cannot mix multi providers and regular providers, got: " + provider1 + " " + provider2); +} +exports.mixingMultiProvidersWithRegularProvidersError = mixingMultiProvidersWithRegularProvidersError; +//# sourceMappingURL=reflective_errors.js.map \ No newline at end of file diff --git a/src-2/externals/injection-js/reflective_errors.js.map b/src-2/externals/injection-js/reflective_errors.js.map new file mode 100644 index 0000000..88c0242 --- /dev/null +++ b/src-2/externals/injection-js/reflective_errors.js.map @@ -0,0 +1 @@ +{"version":3,"file":"reflective_errors.js","sourceRoot":"","sources":["../lib/reflective_errors.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;;AAEH,uBAA2B,iBAAiB,CAAC,CAAA;AAC7C,uBAAqD,iBAAiB,CAAC,CAAA;AACvE,qBAAwB,eAAe,CAAC,CAAA;AAMxC,8BAA8B,IAAW;IACvC,IAAM,GAAG,GAAU,EAAE,CAAC;IACtB,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE,CAAC;QACrC,EAAE,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;YAC9B,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;YACl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S,SAAI,SAAW,CAAC,CAAC;AACnG,CAAC;AAHe,qDAA6C,gDAG5D,CAAA"} \ No newline at end of file diff --git a/src-2/externals/injection-js/reflective_injector.d.ts b/src-2/externals/injection-js/reflective_injector.d.ts new file mode 100644 index 0000000..aa6b1d4 --- /dev/null +++ b/src-2/externals/injection-js/reflective_injector.d.ts @@ -0,0 +1,275 @@ +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +import { Injector } from './injector'; +import { Provider } from './provider'; +import { ResolvedReflectiveProvider } from './reflective_provider'; +/** + * A ReflectiveDependency injection container used for instantiating objects and resolving + * dependencies. + * + * An `Injector` is a replacement for a `new` operator, which can automatically resolve the + * constructor dependencies. + * + * In typical use, application code asks for the dependencies in the constructor and they are + * resolved by the `Injector`. + * + * ### Example ([live demo](http://plnkr.co/edit/jzjec0?p=preview)) + * + * The following example creates an `Injector` configured to create `Engine` and `Car`. + * + * ```typescript + * @Injectable() + * class Engine { + * } + * + * @Injectable() + * class Car { + * constructor(public engine:Engine) {} + * } + * + * var injector = ReflectiveInjector.resolveAndCreate([Car, Engine]); + * var car = injector.get(Car); + * expect(car instanceof Car).toBe(true); + * expect(car.engine instanceof Engine).toBe(true); + * ``` + * + * Notice, we don't use the `new` operator because we explicitly want to have the `Injector` + * resolve all of the object's dependencies automatically. + * + * @stable + */ +export declare abstract class ReflectiveInjector implements Injector { + /** + * Turns an array of provider definitions into an array of resolved providers. + * + * A resolution is a process of flattening multiple nested arrays and converting individual + * providers into an array of {@link ResolvedReflectiveProvider}s. + * + * ### Example ([live demo](http://plnkr.co/edit/AiXTHi?p=preview)) + * + * ```typescript + * @Injectable() + * class Engine { + * } + * + * @Injectable() + * class Car { + * constructor(public engine:Engine) {} + * } + * + * var providers = ReflectiveInjector.resolve([Car, [[Engine]]]); + * + * expect(providers.length).toEqual(2); + * + * expect(providers[0] instanceof ResolvedReflectiveProvider).toBe(true); + * expect(providers[0].key.displayName).toBe("Car"); + * expect(providers[0].dependencies.length).toEqual(1); + * expect(providers[0].factory).toBeDefined(); + * + * expect(providers[1].key.displayName).toBe("Engine"); + * }); + * ``` + * + * See {@link ReflectiveInjector#fromResolvedProviders} for more info. + */ + static resolve(providers: Provider[]): ResolvedReflectiveProvider[]; + /** + * Resolves an array of providers and creates an injector from those providers. + * + * The passed-in providers can be an array of `Type`, {@link Provider}, + * or a recursive array of more providers. + * + * ### Example ([live demo](http://plnkr.co/edit/ePOccA?p=preview)) + * + * ```typescript + * @Injectable() + * class Engine { + * } + * + * @Injectable() + * class Car { + * constructor(public engine:Engine) {} + * } + * + * var injector = ReflectiveInjector.resolveAndCreate([Car, Engine]); + * expect(injector.get(Car) instanceof Car).toBe(true); + * ``` + * + * This function is slower than the corresponding `fromResolvedProviders` + * because it needs to resolve the passed-in providers first. + * See {@link Injector#resolve} and {@link Injector#fromResolvedProviders}. + */ + static resolveAndCreate(providers: Provider[], parent?: Injector): ReflectiveInjector; + /** + * Creates an injector from previously resolved providers. + * + * This API is the recommended way to construct injectors in performance-sensitive parts. + * + * ### Example ([live demo](http://plnkr.co/edit/KrSMci?p=preview)) + * + * ```typescript + * @Injectable() + * class Engine { + * } + * + * @Injectable() + * class Car { + * constructor(public engine:Engine) {} + * } + * + * var providers = ReflectiveInjector.resolve([Car, Engine]); + * var injector = ReflectiveInjector.fromResolvedProviders(providers); + * expect(injector.get(Car) instanceof Car).toBe(true); + * ``` + * @experimental + */ + static fromResolvedProviders(providers: ResolvedReflectiveProvider[], parent?: Injector): ReflectiveInjector; + /** + * Parent of this injector. + * + * + * + * ### Example ([live demo](http://plnkr.co/edit/eosMGo?p=preview)) + * + * ```typescript + * var parent = ReflectiveInjector.resolveAndCreate([]); + * var child = parent.resolveAndCreateChild([]); + * expect(child.parent).toBe(parent); + * ``` + */ + readonly abstract parent: Injector | null; + /** + * Resolves an array of providers and creates a child injector from those providers. + * + * + * + * The passed-in providers can be an array of `Type`, {@link Provider}, + * or a recursive array of more providers. + * + * ### Example ([live demo](http://plnkr.co/edit/opB3T4?p=preview)) + * + * ```typescript + * class ParentProvider {} + * class ChildProvider {} + * + * var parent = ReflectiveInjector.resolveAndCreate([ParentProvider]); + * var child = parent.resolveAndCreateChild([ChildProvider]); + * + * expect(child.get(ParentProvider) instanceof ParentProvider).toBe(true); + * expect(child.get(ChildProvider) instanceof ChildProvider).toBe(true); + * expect(child.get(ParentProvider)).toBe(parent.get(ParentProvider)); + * ``` + * + * This function is slower than the corresponding `createChildFromResolved` + * because it needs to resolve the passed-in providers first. + * See {@link Injector#resolve} and {@link Injector#createChildFromResolved}. + */ + abstract resolveAndCreateChild(providers: Provider[]): ReflectiveInjector; + /** + * Creates a child injector from previously resolved providers. + * + * + * + * This API is the recommended way to construct injectors in performance-sensitive parts. + * + * ### Example ([live demo](http://plnkr.co/edit/VhyfjN?p=preview)) + * + * ```typescript + * class ParentProvider {} + * class ChildProvider {} + * + * var parentProviders = ReflectiveInjector.resolve([ParentProvider]); + * var childProviders = ReflectiveInjector.resolve([ChildProvider]); + * + * var parent = ReflectiveInjector.fromResolvedProviders(parentProviders); + * var child = parent.createChildFromResolved(childProviders); + * + * expect(child.get(ParentProvider) instanceof ParentProvider).toBe(true); + * expect(child.get(ChildProvider) instanceof ChildProvider).toBe(true); + * expect(child.get(ParentProvider)).toBe(parent.get(ParentProvider)); + * ``` + */ + abstract createChildFromResolved(providers: ResolvedReflectiveProvider[]): ReflectiveInjector; + /** + * Resolves a provider and instantiates an object in the context of the injector. + * + * The created object does not get cached by the injector. + * + * ### Example ([live demo](http://plnkr.co/edit/yvVXoB?p=preview)) + * + * ```typescript + * @Injectable() + * class Engine { + * } + * + * @Injectable() + * class Car { + * constructor(public engine:Engine) {} + * } + * + * var injector = ReflectiveInjector.resolveAndCreate([Engine]); + * + * var car = injector.resolveAndInstantiate(Car); + * expect(car.engine).toBe(injector.get(Engine)); + * expect(car).not.toBe(injector.resolveAndInstantiate(Car)); + * ``` + */ + abstract resolveAndInstantiate(provider: Provider): any; + /** + * Instantiates an object using a resolved provider in the context of the injector. + * + * The created object does not get cached by the injector. + * + * ### Example ([live demo](http://plnkr.co/edit/ptCImQ?p=preview)) + * + * ```typescript + * @Injectable() + * class Engine { + * } + * + * @Injectable() + * class Car { + * constructor(public engine:Engine) {} + * } + * + * var injector = ReflectiveInjector.resolveAndCreate([Engine]); + * var carProvider = ReflectiveInjector.resolve([Car])[0]; + * var car = injector.instantiateResolved(carProvider); + * expect(car.engine).toBe(injector.get(Engine)); + * expect(car).not.toBe(injector.instantiateResolved(carProvider)); + * ``` + */ + abstract instantiateResolved(provider: ResolvedReflectiveProvider): any; + abstract get(token: any, notFoundValue?: any): any; +} +export declare class ReflectiveInjector_ implements ReflectiveInjector { + keyIds: number[]; + objs: any[]; + /** + * Private + */ + constructor(_providers: ResolvedReflectiveProvider[], _parent?: Injector); + get(token: any, notFoundValue?: any): any; + readonly parent: Injector | null; + resolveAndCreateChild(providers: Provider[]): ReflectiveInjector; + createChildFromResolved(providers: ResolvedReflectiveProvider[]): ReflectiveInjector; + resolveAndInstantiate(provider: Provider): any; + instantiateResolved(provider: ResolvedReflectiveProvider): any; + getProviderAtIndex(index: number): ResolvedReflectiveProvider; + private _getMaxNumberOfObjects(); + private _instantiateProvider(provider); + private _instantiate(provider, ResolvedReflectiveFactory); + private _getByReflectiveDependency(dep); + private _getByKey(key, visibility, notFoundValue); + private _getObjByKeyId(keyId); + readonly displayName: string; + toString(): string; +} diff --git a/src-2/externals/injection-js/reflective_injector.js b/src-2/externals/injection-js/reflective_injector.js new file mode 100644 index 0000000..8158ab3 --- /dev/null +++ b/src-2/externals/injection-js/reflective_injector.js @@ -0,0 +1,341 @@ +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +"use strict"; +var injector_1 = require('./injector'); +var metadata_1 = require('./metadata'); +var reflective_errors_1 = require('./reflective_errors'); +var reflective_key_1 = require('./reflective_key'); +var reflective_provider_1 = require('./reflective_provider'); +// Threshold for the dynamic version +var UNDEFINED = new Object(); +/** + * A ReflectiveDependency injection container used for instantiating objects and resolving + * dependencies. + * + * An `Injector` is a replacement for a `new` operator, which can automatically resolve the + * constructor dependencies. + * + * In typical use, application code asks for the dependencies in the constructor and they are + * resolved by the `Injector`. + * + * ### Example ([live demo](http://plnkr.co/edit/jzjec0?p=preview)) + * + * The following example creates an `Injector` configured to create `Engine` and `Car`. + * + * ```typescript + * @Injectable() + * class Engine { + * } + * + * @Injectable() + * class Car { + * constructor(public engine:Engine) {} + * } + * + * var injector = ReflectiveInjector.resolveAndCreate([Car, Engine]); + * var car = injector.get(Car); + * expect(car instanceof Car).toBe(true); + * expect(car.engine instanceof Engine).toBe(true); + * ``` + * + * Notice, we don't use the `new` operator because we explicitly want to have the `Injector` + * resolve all of the object's dependencies automatically. + * + * @stable + */ +var ReflectiveInjector = (function () { + function ReflectiveInjector() { + } + /** + * Turns an array of provider definitions into an array of resolved providers. + * + * A resolution is a process of flattening multiple nested arrays and converting individual + * providers into an array of {@link ResolvedReflectiveProvider}s. + * + * ### Example ([live demo](http://plnkr.co/edit/AiXTHi?p=preview)) + * + * ```typescript + * @Injectable() + * class Engine { + * } + * + * @Injectable() + * class Car { + * constructor(public engine:Engine) {} + * } + * + * var providers = ReflectiveInjector.resolve([Car, [[Engine]]]); + * + * expect(providers.length).toEqual(2); + * + * expect(providers[0] instanceof ResolvedReflectiveProvider).toBe(true); + * expect(providers[0].key.displayName).toBe("Car"); + * expect(providers[0].dependencies.length).toEqual(1); + * expect(providers[0].factory).toBeDefined(); + * + * expect(providers[1].key.displayName).toBe("Engine"); + * }); + * ``` + * + * See {@link ReflectiveInjector#fromResolvedProviders} for more info. + */ + ReflectiveInjector.resolve = function (providers) { + return reflective_provider_1.resolveReflectiveProviders(providers); + }; + /** + * Resolves an array of providers and creates an injector from those providers. + * + * The passed-in providers can be an array of `Type`, {@link Provider}, + * or a recursive array of more providers. + * + * ### Example ([live demo](http://plnkr.co/edit/ePOccA?p=preview)) + * + * ```typescript + * @Injectable() + * class Engine { + * } + * + * @Injectable() + * class Car { + * constructor(public engine:Engine) {} + * } + * + * var injector = ReflectiveInjector.resolveAndCreate([Car, Engine]); + * expect(injector.get(Car) instanceof Car).toBe(true); + * ``` + * + * This function is slower than the corresponding `fromResolvedProviders` + * because it needs to resolve the passed-in providers first. + * See {@link Injector#resolve} and {@link Injector#fromResolvedProviders}. + */ + ReflectiveInjector.resolveAndCreate = function (providers, parent) { + var ResolvedReflectiveProviders = ReflectiveInjector.resolve(providers); + return ReflectiveInjector.fromResolvedProviders(ResolvedReflectiveProviders, parent); + }; + /** + * Creates an injector from previously resolved providers. + * + * This API is the recommended way to construct injectors in performance-sensitive parts. + * + * ### Example ([live demo](http://plnkr.co/edit/KrSMci?p=preview)) + * + * ```typescript + * @Injectable() + * class Engine { + * } + * + * @Injectable() + * class Car { + * constructor(public engine:Engine) {} + * } + * + * var providers = ReflectiveInjector.resolve([Car, Engine]); + * var injector = ReflectiveInjector.fromResolvedProviders(providers); + * expect(injector.get(Car) instanceof Car).toBe(true); + * ``` + * @experimental + */ + ReflectiveInjector.fromResolvedProviders = function (providers, parent) { + return new ReflectiveInjector_(providers, parent); + }; + Object.defineProperty(ReflectiveInjector.prototype, "parent", { + /** + * Parent of this injector. + * + * + * + * ### Example ([live demo](http://plnkr.co/edit/eosMGo?p=preview)) + * + * ```typescript + * var parent = ReflectiveInjector.resolveAndCreate([]); + * var child = parent.resolveAndCreateChild([]); + * expect(child.parent).toBe(parent); + * ``` + */ + get: function () { }, + enumerable: true, + configurable: true + }); + return ReflectiveInjector; +}()); +exports.ReflectiveInjector = ReflectiveInjector; +var ReflectiveInjector_ = (function () { + /** + * Private + */ + function ReflectiveInjector_(_providers, _parent) { + /** @internal */ + this._constructionCounter = 0; + this._providers = _providers; + this._parent = _parent || null; + var len = _providers.length; + this.keyIds = new Array(len); + this.objs = new Array(len); + for (var i = 0; i < len; i++) { + this.keyIds[i] = _providers[i].key.id; + this.objs[i] = UNDEFINED; + } + } + ReflectiveInjector_.prototype.get = function (token, notFoundValue) { + if (notFoundValue === void 0) { notFoundValue = injector_1.THROW_IF_NOT_FOUND; } + return this._getByKey(reflective_key_1.ReflectiveKey.get(token), null, notFoundValue); + }; + Object.defineProperty(ReflectiveInjector_.prototype, "parent", { + get: function () { return this._parent; }, + enumerable: true, + configurable: true + }); + ReflectiveInjector_.prototype.resolveAndCreateChild = function (providers) { + var ResolvedReflectiveProviders = ReflectiveInjector.resolve(providers); + return this.createChildFromResolved(ResolvedReflectiveProviders); + }; + ReflectiveInjector_.prototype.createChildFromResolved = function (providers) { + var inj = new ReflectiveInjector_(providers); + inj._parent = this; + return inj; + }; + ReflectiveInjector_.prototype.resolveAndInstantiate = function (provider) { + return this.instantiateResolved(ReflectiveInjector.resolve([provider])[0]); + }; + ReflectiveInjector_.prototype.instantiateResolved = function (provider) { + return this._instantiateProvider(provider); + }; + ReflectiveInjector_.prototype.getProviderAtIndex = function (index) { + if (index < 0 || index >= this._providers.length) { + throw reflective_errors_1.outOfBoundsError(index); + } + return this._providers[index]; + }; + /** @internal */ + ReflectiveInjector_.prototype._new = function (provider) { + if (this._constructionCounter++ > this._getMaxNumberOfObjects()) { + throw reflective_errors_1.cyclicDependencyError(this, provider.key); + } + return this._instantiateProvider(provider); + }; + ReflectiveInjector_.prototype._getMaxNumberOfObjects = function () { return this.objs.length; }; + ReflectiveInjector_.prototype._instantiateProvider = function (provider) { + if (provider.multiProvider) { + var res = new Array(provider.resolvedFactories.length); + for (var i = 0; i < provider.resolvedFactories.length; ++i) { + res[i] = this._instantiate(provider, provider.resolvedFactories[i]); + } + return res; + } + else { + return this._instantiate(provider, provider.resolvedFactories[0]); + } + }; + ReflectiveInjector_.prototype._instantiate = function (provider, ResolvedReflectiveFactory) { + var _this = this; + var factory = ResolvedReflectiveFactory.factory; + var deps; + try { + deps = + ResolvedReflectiveFactory.dependencies.map(function (dep) { return _this._getByReflectiveDependency(dep); }); + } + catch (e) { + if (e.addKey) { + e.addKey(this, provider.key); + } + throw e; + } + var obj; + try { + obj = factory.apply(void 0, deps); + } + catch (e) { + throw reflective_errors_1.instantiationError(this, e, e.stack, provider.key); + } + return obj; + }; + ReflectiveInjector_.prototype._getByReflectiveDependency = function (dep) { + return this._getByKey(dep.key, dep.visibility, dep.optional ? null : injector_1.THROW_IF_NOT_FOUND); + }; + ReflectiveInjector_.prototype._getByKey = function (key, visibility, notFoundValue) { + if (key === INJECTOR_KEY) { + return this; + } + if (visibility instanceof metadata_1.Self) { + return this._getByKeySelf(key, notFoundValue); + } + else { + return this._getByKeyDefault(key, notFoundValue, visibility); + } + }; + ReflectiveInjector_.prototype._getObjByKeyId = function (keyId) { + for (var i = 0; i < this.keyIds.length; i++) { + if (this.keyIds[i] === keyId) { + if (this.objs[i] === UNDEFINED) { + this.objs[i] = this._new(this._providers[i]); + } + return this.objs[i]; + } + } + return UNDEFINED; + }; + /** @internal */ + ReflectiveInjector_.prototype._throwOrNull = function (key, notFoundValue) { + if (notFoundValue !== injector_1.THROW_IF_NOT_FOUND) { + return notFoundValue; + } + else { + throw reflective_errors_1.noProviderError(this, key); + } + }; + /** @internal */ + ReflectiveInjector_.prototype._getByKeySelf = function (key, notFoundValue) { + var obj = this._getObjByKeyId(key.id); + return (obj !== UNDEFINED) ? obj : this._throwOrNull(key, notFoundValue); + }; + /** @internal */ + ReflectiveInjector_.prototype._getByKeyDefault = function (key, notFoundValue, visibility) { + var inj; + if (visibility instanceof metadata_1.SkipSelf) { + inj = this._parent; + } + else { + inj = this; + } + while (inj instanceof ReflectiveInjector_) { + var inj_ = inj; + var obj = inj_._getObjByKeyId(key.id); + if (obj !== UNDEFINED) + return obj; + inj = inj_._parent; + } + if (inj !== null) { + return inj.get(key.token, notFoundValue); + } + else { + return this._throwOrNull(key, notFoundValue); + } + }; + Object.defineProperty(ReflectiveInjector_.prototype, "displayName", { + get: function () { + var providers = _mapProviders(this, function (b) { return ' "' + b.key.displayName + '" '; }) + .join(', '); + return "ReflectiveInjector(providers: [" + providers + "])"; + }, + enumerable: true, + configurable: true + }); + ReflectiveInjector_.prototype.toString = function () { return this.displayName; }; + return ReflectiveInjector_; +}()); +exports.ReflectiveInjector_ = ReflectiveInjector_; +var INJECTOR_KEY = reflective_key_1.ReflectiveKey.get(injector_1.Injector); +function _mapProviders(injector, fn) { + var res = new Array(injector._providers.length); + for (var i = 0; i < injector._providers.length; ++i) { + res[i] = fn(injector.getProviderAtIndex(i)); + } + return res; +} +//# sourceMappingURL=reflective_injector.js.map \ No newline at end of file diff --git a/src-2/externals/injection-js/reflective_injector.js.map b/src-2/externals/injection-js/reflective_injector.js.map new file mode 100644 index 0000000..bf15be1 --- /dev/null +++ b/src-2/externals/injection-js/reflective_injector.js.map @@ -0,0 +1 @@ +{"version":3,"file":"reflective_injector.js","sourceRoot":"","sources":["../lib/reflective_injector.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;;AAEH,yBAA2C,YAAY,CAAC,CAAA;AACxD,yBAA6B,YAAY,CAAC,CAAA;AAE1C,kCAA2F,qBAAqB,CAAC,CAAA;AACjH,+BAA4B,kBAAkB,CAAC,CAAA;AAC/C,oCAAsH,uBAAuB,CAAC,CAAA;AAE9I,oCAAoC;AACpC,IAAM,SAAS,GAAG,IAAI,MAAM,EAAE,CAAC;AAE/B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH;IAAA;IA+NA,CAAC;IA9NC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgCG;IACI,0BAAO,GAAd,UAAe,SAAqB;QAClC,MAAM,CAAC,gDAA0B,CAAC,SAAS,CAAC,CAAC;IAC/C,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACI,mCAAgB,GAAvB,UAAwB,SAAqB,EAAE,MAAiB;QAC9D,IAAM,2BAA2B,GAAG,kBAAkB,CAAC,OAAO,CAAC,SAAS,CA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,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;IACzD,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,UAAU,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE,CAAC;QACpD,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9C,CAAC;IACD,MAAM,CAAC,GAAG,CAAC;AACb,CAAC"} \ No newline at end of file diff --git a/src-2/externals/injection-js/reflective_key.d.ts b/src-2/externals/injection-js/reflective_key.d.ts new file mode 100644 index 0000000..cb96651 --- /dev/null +++ b/src-2/externals/injection-js/reflective_key.d.ts @@ -0,0 +1,36 @@ +/** + * A unique object used for retrieving items from the {@link ReflectiveInjector}. + * + * Keys have: + * - a system-wide unique `id`. + * - a `token`. + * + * `Key` is used internally by {@link ReflectiveInjector} because its system-wide unique `id` allows + * the + * injector to store created objects in a more efficient way. + * + * `Key` should not be created directly. {@link ReflectiveInjector} creates keys automatically when + * resolving + * providers. + * @experimental + */ +export declare class ReflectiveKey { + token: Object; + id: number; + /** + * Private + */ + constructor(token: Object, id: number); + /** + * Returns a stringified token. + */ + readonly displayName: string; + /** + * Retrieves a `Key` for a token. + */ + static get(token: Object): ReflectiveKey; + /** + * @returns the number of keys registered in the system. + */ + static readonly numberOfKeys: number; +} diff --git a/src-2/externals/injection-js/reflective_key.js b/src-2/externals/injection-js/reflective_key.js new file mode 100644 index 0000000..5f403d1 --- /dev/null +++ b/src-2/externals/injection-js/reflective_key.js @@ -0,0 +1,89 @@ +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +"use strict"; +var lang_1 = require('./facade/lang'); +var forward_ref_1 = require('./forward_ref'); +/** + * A unique object used for retrieving items from the {@link ReflectiveInjector}. + * + * Keys have: + * - a system-wide unique `id`. + * - a `token`. + * + * `Key` is used internally by {@link ReflectiveInjector} because its system-wide unique `id` allows + * the + * injector to store created objects in a more efficient way. + * + * `Key` should not be created directly. {@link ReflectiveInjector} creates keys automatically when + * resolving + * providers. + * @experimental + */ +var ReflectiveKey = (function () { + /** + * Private + */ + function ReflectiveKey(token, id) { + this.token = token; + this.id = id; + if (!token) { + throw new Error('Token must be defined!'); + } + } + Object.defineProperty(ReflectiveKey.prototype, "displayName", { + /** + * Returns a stringified token. + */ + get: function () { return lang_1.stringify(this.token); }, + enumerable: true, + configurable: true + }); + /** + * Retrieves a `Key` for a token. + */ + ReflectiveKey.get = function (token) { + return _globalKeyRegistry.get(forward_ref_1.resolveForwardRef(token)); + }; + Object.defineProperty(ReflectiveKey, "numberOfKeys", { + /** + * @returns the number of keys registered in the system. + */ + get: function () { return _globalKeyRegistry.numberOfKeys; }, + enumerable: true, + configurable: true + }); + return ReflectiveKey; +}()); +exports.ReflectiveKey = ReflectiveKey; +/** + * @internal + */ +var KeyRegistry = (function () { + function KeyRegistry() { + this._allKeys = new Map(); + } + KeyRegistry.prototype.get = function (token) { + if (token instanceof ReflectiveKey) + return token; + if (this._allKeys.has(token)) { + return this._allKeys.get(token); + } + var newKey = new ReflectiveKey(token, ReflectiveKey.numberOfKeys); + this._allKeys.set(token, newKey); + return newKey; + }; + Object.defineProperty(KeyRegistry.prototype, "numberOfKeys", { + get: function () { return this._allKeys.size; }, + enumerable: true, + configurable: true + }); + return KeyRegistry; +}()); +exports.KeyRegistry = KeyRegistry; +var _globalKeyRegistry = new KeyRegistry(); +//# sourceMappingURL=reflective_key.js.map \ No newline at end of file diff --git a/src-2/externals/injection-js/reflective_key.js.map b/src-2/externals/injection-js/reflective_key.js.map new file mode 100644 index 0000000..8ee2cea --- /dev/null +++ b/src-2/externals/injection-js/reflective_key.js.map @@ -0,0 +1 @@ +{"version":3,"file":"reflective_key.js","sourceRoot":"","sources":["../lib/reflective_key.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;;AAEH,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C,QAAQ,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QACjC,MAAM,CAAC,MAAM,CAAC;IAChB,CAAC;IAED,sBAAI,qCAAY;aAAhB,cAA6B,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;;;OAAA;IAC3D,kBAAC;AAAD,CAAC,AAhBD,IAgBC;AAhBY,mBAAW,cAgBvB,CAAA;AAED,IAAM,kBAAkB,GAAG,IAAI,WAAW,EAAE,CAAC"} \ No newline at end of file diff --git a/src-2/externals/injection-js/reflective_provider.d.ts b/src-2/externals/injection-js/reflective_provider.d.ts new file mode 100644 index 0000000..58dad27 --- /dev/null +++ b/src-2/externals/injection-js/reflective_provider.d.ts @@ -0,0 +1,88 @@ +import { Self, SkipSelf } from './metadata'; +import { Provider } from './provider'; +import { ReflectiveKey } from './reflective_key'; +/** + * `Dependency` is used by the framework to extend DI. + * This is internal to Angular and should not be used directly. + */ +export declare class ReflectiveDependency { + key: ReflectiveKey; + optional: boolean; + visibility: Self | SkipSelf | null; + constructor(key: ReflectiveKey, optional: boolean, visibility: Self | SkipSelf | null); + static fromKey(key: ReflectiveKey): ReflectiveDependency; +} +/** + * An internal resolved representation of a {@link Provider} used by the {@link Injector}. + * + * It is usually created automatically by `Injector.resolveAndCreate`. + * + * It can be created manually, as follows: + * + * ### Example ([live demo](http://plnkr.co/edit/RfEnhh8kUEI0G3qsnIeT?p%3Dpreview&p=preview)) + * + * ```typescript + * var resolvedProviders = Injector.resolve([{ provide: 'message', useValue: 'Hello' }]); + * var injector = Injector.fromResolvedProviders(resolvedProviders); + * + * expect(injector.get('message')).toEqual('Hello'); + * ``` + * + * @experimental + */ +export interface ResolvedReflectiveProvider { + /** + * A key, usually a `Type`. + */ + key: ReflectiveKey; + /** + * Factory function which can return an instance of an object represented by a key. + */ + resolvedFactories: ResolvedReflectiveFactory[]; + /** + * Indicates if the provider is a multi-provider or a regular provider. + */ + multiProvider: boolean; +} +export declare class ResolvedReflectiveProvider_ implements ResolvedReflectiveProvider { + key: ReflectiveKey; + resolvedFactories: ResolvedReflectiveFactory[]; + multiProvider: boolean; + constructor(key: ReflectiveKey, resolvedFactories: ResolvedReflectiveFactory[], multiProvider: boolean); + readonly resolvedFactory: ResolvedReflectiveFactory; +} +/** + * An internal resolved representation of a factory function created by resolving {@link + * Provider}. + * @experimental + */ +export declare class ResolvedReflectiveFactory { + /** + * Factory function which can return an instance of an object represented by a key. + */ + factory: Function; + /** + * Arguments (dependencies) to the `factory` function. + */ + dependencies: ReflectiveDependency[]; + constructor( + /** + * Factory function which can return an instance of an object represented by a key. + */ + factory: Function, + /** + * Arguments (dependencies) to the `factory` function. + */ + dependencies: ReflectiveDependency[]); +} +/** + * Resolve a list of Providers. + */ +export declare function resolveReflectiveProviders(providers: Provider[]): ResolvedReflectiveProvider[]; +/** + * Merges a list of ResolvedProviders into a list where + * each key is contained exactly once and multi providers + * have been merged. + */ +export declare function mergeResolvedReflectiveProviders(providers: ResolvedReflectiveProvider[], normalizedProvidersMap: Map): Map; +export declare function constructDependencies(typeOrFunc: any, dependencies?: any[]): ReflectiveDependency[]; diff --git a/src-2/externals/injection-js/reflective_provider.js b/src-2/externals/injection-js/reflective_provider.js new file mode 100644 index 0000000..7d48261 --- /dev/null +++ b/src-2/externals/injection-js/reflective_provider.js @@ -0,0 +1,225 @@ +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +"use strict"; +var reflection_1 = require('./reflection/reflection'); +var type_1 = require('./facade/type'); +var forward_ref_1 = require('./forward_ref'); +var injection_token_1 = require('./injection_token'); +var metadata_1 = require('./metadata'); +var reflective_errors_1 = require('./reflective_errors'); +var reflective_key_1 = require('./reflective_key'); +/** + * `Dependency` is used by the framework to extend DI. + * This is internal to Angular and should not be used directly. + */ +var ReflectiveDependency = (function () { + function ReflectiveDependency(key, optional, visibility) { + this.key = key; + this.optional = optional; + this.visibility = visibility; + } + ReflectiveDependency.fromKey = function (key) { + return new ReflectiveDependency(key, false, null); + }; + return ReflectiveDependency; +}()); +exports.ReflectiveDependency = ReflectiveDependency; +var _EMPTY_LIST = []; +var ResolvedReflectiveProvider_ = (function () { + function ResolvedReflectiveProvider_(key, resolvedFactories, multiProvider) { + this.key = key; + this.resolvedFactories = resolvedFactories; + this.multiProvider = multiProvider; + } + Object.defineProperty(ResolvedReflectiveProvider_.prototype, "resolvedFactory", { + get: function () { return this.resolvedFactories[0]; }, + enumerable: true, + configurable: true + }); + return ResolvedReflectiveProvider_; +}()); +exports.ResolvedReflectiveProvider_ = ResolvedReflectiveProvider_; +/** + * An internal resolved representation of a factory function created by resolving {@link + * Provider}. + * @experimental + */ +var ResolvedReflectiveFactory = (function () { + function ResolvedReflectiveFactory( + /** + * Factory function which can return an instance of an object represented by a key. + */ + factory, + /** + * Arguments (dependencies) to the `factory` function. + */ + dependencies) { + this.factory = factory; + this.dependencies = dependencies; + } + return ResolvedReflectiveFactory; +}()); +exports.ResolvedReflectiveFactory = ResolvedReflectiveFactory; +/** + * Resolve a single provider. + */ +function resolveReflectiveFactory(provider) { + var factoryFn; + var resolvedDeps; + if (provider.useClass) { + var useClass = forward_ref_1.resolveForwardRef(provider.useClass); + factoryFn = reflection_1.reflector.factory(useClass); + resolvedDeps = _dependenciesFor(useClass); + } + else if (provider.useExisting) { + factoryFn = function (aliasInstance) { return aliasInstance; }; + resolvedDeps = [ReflectiveDependency.fromKey(reflective_key_1.ReflectiveKey.get(provider.useExisting))]; + } + else if (provider.useFactory) { + factoryFn = provider.useFactory; + resolvedDeps = constructDependencies(provider.useFactory, provider.deps); + } + else { + factoryFn = function () { return provider.useValue; }; + resolvedDeps = _EMPTY_LIST; + } + return new ResolvedReflectiveFactory(factoryFn, resolvedDeps); +} +/** + * Converts the {@link Provider} into {@link ResolvedProvider}. + * + * {@link Injector} internally only uses {@link ResolvedProvider}, {@link Provider} contains + * convenience provider syntax. + */ +function resolveReflectiveProvider(provider) { + return new ResolvedReflectiveProvider_(reflective_key_1.ReflectiveKey.get(provider.provide), [resolveReflectiveFactory(provider)], provider.multi || false); +} +/** + * Resolve a list of Providers. + */ +function resolveReflectiveProviders(providers) { + var normalized = _normalizeProviders(providers, []); + var resolved = normalized.map(resolveReflectiveProvider); + var resolvedProviderMap = mergeResolvedReflectiveProviders(resolved, new Map()); + return Array.from(resolvedProviderMap.values()); +} +exports.resolveReflectiveProviders = resolveReflectiveProviders; +/** + * Merges a list of ResolvedProviders into a list where + * each key is contained exactly once and multi providers + * have been merged. + */ +function mergeResolvedReflectiveProviders(providers, normalizedProvidersMap) { + for (var i = 0; i < providers.length; i++) { + var provider = providers[i]; + var existing = normalizedProvidersMap.get(provider.key.id); + if (existing) { + if (provider.multiProvider !== existing.multiProvider) { + throw reflective_errors_1.mixingMultiProvidersWithRegularProvidersError(existing, provider); + } + if (provider.multiProvider) { + for (var j = 0; j < provider.resolvedFactories.length; j++) { + existing.resolvedFactories.push(provider.resolvedFactories[j]); + } + } + else { + normalizedProvidersMap.set(provider.key.id, provider); + } + } + else { + var resolvedProvider = void 0; + if (provider.multiProvider) { + resolvedProvider = new ResolvedReflectiveProvider_(provider.key, provider.resolvedFactories.slice(), provider.multiProvider); + } + else { + resolvedProvider = provider; + } + normalizedProvidersMap.set(provider.key.id, resolvedProvider); + } + } + return normalizedProvidersMap; +} +exports.mergeResolvedReflectiveProviders = mergeResolvedReflectiveProviders; +function _normalizeProviders(providers, res) { + providers.forEach(function (b) { + if (b instanceof type_1.Type) { + res.push({ provide: b, useClass: b }); + } + else if (b && typeof b == 'object' && b.provide !== undefined) { + res.push(b); + } + else if (b instanceof Array) { + _normalizeProviders(b, res); + } + else { + throw reflective_errors_1.invalidProviderError(b); + } + }); + return res; +} +function constructDependencies(typeOrFunc, dependencies) { + if (!dependencies) { + return _dependenciesFor(typeOrFunc); + } + else { + var params_1 = dependencies.map(function (t) { return [t]; }); + return dependencies.map(function (t) { return _extractToken(typeOrFunc, t, params_1); }); + } +} +exports.constructDependencies = constructDependencies; +function _dependenciesFor(typeOrFunc) { + var params = reflection_1.reflector.parameters(typeOrFunc); + if (!params) + return []; + if (params.some(function (p) { return p == null; })) { + throw reflective_errors_1.noAnnotationError(typeOrFunc, params); + } + return params.map(function (p) { return _extractToken(typeOrFunc, p, params); }); +} +function _extractToken(typeOrFunc, metadata, params) { + var token = null; + var optional = false; + if (!Array.isArray(metadata)) { + if (metadata instanceof metadata_1.Inject) { + return _createDependency(metadata['token'], optional, null); + } + else { + return _createDependency(metadata, optional, null); + } + } + var visibility = null; + for (var i = 0; i < metadata.length; ++i) { + var paramMetadata = metadata[i]; + if (paramMetadata instanceof type_1.Type) { + token = paramMetadata; + } + else if (paramMetadata instanceof metadata_1.Inject) { + token = paramMetadata['token']; + } + else if (paramMetadata instanceof metadata_1.Optional) { + optional = true; + } + else if (paramMetadata instanceof metadata_1.Self || paramMetadata instanceof metadata_1.SkipSelf) { + visibility = paramMetadata; + } + else if (paramMetadata instanceof injection_token_1.InjectionToken) { + token = paramMetadata; + } + } + token = forward_ref_1.resolveForwardRef(token); + if (token != null) { + return _createDependency(token, optional, visibility); + } + else { + throw reflective_errors_1.noAnnotationError(typeOrFunc, params); + } +} +function _createDependency(token, optional, visibility) { + return new ReflectiveDependency(reflective_key_1.ReflectiveKey.get(token), optional, visibility); +} +//# sourceMappingURL=reflective_provider.js.map \ No newline at end of file diff --git a/src-2/externals/injection-js/reflective_provider.js.map b/src-2/externals/injection-js/reflective_provider.js.map new file mode 100644 index 0000000..dc5ed4b --- /dev/null +++ b/src-2/externals/injection-js/reflective_provider.js.map @@ -0,0 +1 @@ +{"version":3,"file":"reflective_provider.js","sourceRoot":"","sources":["../lib/reflective_provider.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;;AAEH,2BAAwB,yBAAyB,CAAC,CAAA;AAClD,qBAAmB,eAAe,CAAC,CAAA;AAEnC,4BAAgC,eAAe,CAAC,CAAA;AAChD,gCAA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C,CAAC,CAAC;QAClB,MAAM,CAAC,iBAAiB,CAAC,KAAK,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC;IACxD,CAAC;IAAC,IAAI,CAAC,CAAC;QACN,MAAM,qCAAiB,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;IAC9C,CAAC;AACH,CAAC;AAED,2BACI,KAAU,EAAE,QAAiB,EAAE,UAAkC;IACnE,MAAM,CAAC,IAAI,oBAAoB,CAAC,8BAAa,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC;AAClF,CAAC"} \ No newline at end of file diff --git a/src-2/externals/injection-js/util/decorators.d.ts b/src-2/externals/injection-js/util/decorators.d.ts new file mode 100644 index 0000000..02f8571 --- /dev/null +++ b/src-2/externals/injection-js/util/decorators.d.ts @@ -0,0 +1,162 @@ +import { Type } from '../facade/type'; +/** + * Declares the interface to be used with {@link Class}. + * + * @stable + */ +export declare type ClassDefinition = { + /** + * Optional argument for specifying the superclass. + */ + extends?: Type; + /** + * Required constructor function for a class. + * + * The function may be optionally wrapped in an `Array`, in which case additional parameter + * annotations may be specified. + * The number of arguments and the number of parameter annotations must match. + * + * See {@link Class} for example of usage. + */ + constructor: Function | any[]; +} & { + /** + * Other methods on the class. Note that values should have type 'Function' but TS requires + * all properties to have a narrower type than the index signature. + */ + [x: string]: Type | Function | any[]; +}; +/** + * An interface implemented by all Angular type decorators, which allows them to be used as ES7 + * decorators as well as + * Angular DSL syntax. + * + * DSL syntax: + * + * ``` + * var MyClass = ng + * .Component({...}) + * .Class({...}); + * ``` + * + * ES7 syntax: + * + * ``` + * @ng.Component({...}) + * class MyClass {...} + * ``` + * @stable + */ +export interface TypeDecorator { + /** + * Invoke as ES7 decorator. + */ + >(type: T): T; + (target: Object, propertyKey?: string | symbol, parameterIndex?: number): void; + /** + * Storage for the accumulated annotations so far used by the DSL syntax. + * + * Used by {@link Class} to annotate the generated class. + */ + annotations: any[]; + /** + * Generate a class from the definition and annotate it with {@link TypeDecorator#annotations}. + */ + Class(obj: ClassDefinition): Type; +} +/** + * Provides a way for expressing ES6 classes with parameter annotations in ES5. + * + * ## Basic Example + * + * ``` + * var Greeter = ng.Class({ + * constructor: function(name) { + * this.name = name; + * }, + * + * greet: function() { + * alert('Hello ' + this.name + '!'); + * } + * }); + * ``` + * + * is equivalent to ES6: + * + * ``` + * class Greeter { + * constructor(name) { + * this.name = name; + * } + * + * greet() { + * alert('Hello ' + this.name + '!'); + * } + * } + * ``` + * + * or equivalent to ES5: + * + * ``` + * var Greeter = function (name) { + * this.name = name; + * } + * + * Greeter.prototype.greet = function () { + * alert('Hello ' + this.name + '!'); + * } + * ``` + * + * ### Example with parameter annotations + * + * ``` + * var MyService = ng.Class({ + * constructor: [String, [new Optional(), Service], function(name, myService) { + * ... + * }] + * }); + * ``` + * + * is equivalent to ES6: + * + * ``` + * class MyService { + * constructor(name: string, @Optional() myService: Service) { + * ... + * } + * } + * ``` + * + * ### Example with inheritance + * + * ``` + * var Shape = ng.Class({ + * constructor: (color) { + * this.color = color; + * } + * }); + * + * var Square = ng.Class({ + * extends: Shape, + * constructor: function(color, size) { + * Shape.call(this, color); + * this.size = size; + * } + * }); + * ``` + * @suppress {globalThis} + * @stable + */ +export declare function Class(clsDef: ClassDefinition): Type; +/** + * @suppress {globalThis} + */ +export declare function makeDecorator(name: string, props: { + [name: string]: any; +}, parentClass?: any, chainFn?: (fn: Function) => void): (...args: any[]) => (cls: any) => any; +export declare function makeParamDecorator(name: string, props: ([string, any] | { + [name: string]: any; +})[], parentClass?: any): any; +export declare function makePropDecorator(name: string, props: ([string, any] | { + [key: string]: any; +})[], parentClass?: any): any; diff --git a/src-2/externals/injection-js/util/decorators.js b/src-2/externals/injection-js/util/decorators.js new file mode 100644 index 0000000..97091b9 --- /dev/null +++ b/src-2/externals/injection-js/util/decorators.js @@ -0,0 +1,291 @@ +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +"use strict"; +var lang_1 = require('../facade/lang'); +var _nextClassId = 0; +var Reflect = lang_1.global['Reflect']; +function extractAnnotation(annotation) { + if (typeof annotation === 'function' && annotation.hasOwnProperty('annotation')) { + // it is a decorator, extract annotation + annotation = annotation.annotation; + } + return annotation; +} +function applyParams(fnOrArray, key) { + if (fnOrArray === Object || fnOrArray === String || fnOrArray === Function || + fnOrArray === Number || fnOrArray === Array) { + throw new Error("Can not use native " + lang_1.stringify(fnOrArray) + " as constructor"); + } + if (typeof fnOrArray === 'function') { + return fnOrArray; + } + if (Array.isArray(fnOrArray)) { + var annotations = fnOrArray; + var annoLength = annotations.length - 1; + var fn = fnOrArray[annoLength]; + if (typeof fn !== 'function') { + throw new Error("Last position of Class method array must be Function in key " + key + " was '" + lang_1.stringify(fn) + "'"); + } + if (annoLength != fn.length) { + throw new Error("Number of annotations (" + annoLength + ") does not match number of arguments (" + fn.length + ") in the function: " + lang_1.stringify(fn)); + } + var paramsAnnotations = []; + for (var i = 0, ii = annotations.length - 1; i < ii; i++) { + var paramAnnotations = []; + paramsAnnotations.push(paramAnnotations); + var annotation = annotations[i]; + if (Array.isArray(annotation)) { + for (var j = 0; j < annotation.length; j++) { + paramAnnotations.push(extractAnnotation(annotation[j])); + } + } + else if (typeof annotation === 'function') { + paramAnnotations.push(extractAnnotation(annotation)); + } + else { + paramAnnotations.push(annotation); + } + } + Reflect.defineMetadata('parameters', paramsAnnotations, fn); + return fn; + } + throw new Error("Only Function or Array is supported in Class definition for key '" + key + "' is '" + lang_1.stringify(fnOrArray) + "'"); +} +/** + * Provides a way for expressing ES6 classes with parameter annotations in ES5. + * + * ## Basic Example + * + * ``` + * var Greeter = ng.Class({ + * constructor: function(name) { + * this.name = name; + * }, + * + * greet: function() { + * alert('Hello ' + this.name + '!'); + * } + * }); + * ``` + * + * is equivalent to ES6: + * + * ``` + * class Greeter { + * constructor(name) { + * this.name = name; + * } + * + * greet() { + * alert('Hello ' + this.name + '!'); + * } + * } + * ``` + * + * or equivalent to ES5: + * + * ``` + * var Greeter = function (name) { + * this.name = name; + * } + * + * Greeter.prototype.greet = function () { + * alert('Hello ' + this.name + '!'); + * } + * ``` + * + * ### Example with parameter annotations + * + * ``` + * var MyService = ng.Class({ + * constructor: [String, [new Optional(), Service], function(name, myService) { + * ... + * }] + * }); + * ``` + * + * is equivalent to ES6: + * + * ``` + * class MyService { + * constructor(name: string, @Optional() myService: Service) { + * ... + * } + * } + * ``` + * + * ### Example with inheritance + * + * ``` + * var Shape = ng.Class({ + * constructor: (color) { + * this.color = color; + * } + * }); + * + * var Square = ng.Class({ + * extends: Shape, + * constructor: function(color, size) { + * Shape.call(this, color); + * this.size = size; + * } + * }); + * ``` + * @suppress {globalThis} + * @stable + */ +function Class(clsDef) { + var constructor = applyParams(clsDef.hasOwnProperty('constructor') ? clsDef.constructor : undefined, 'constructor'); + var proto = constructor.prototype; + if (clsDef.hasOwnProperty('extends')) { + if (typeof clsDef.extends === 'function') { + constructor.prototype = proto = + Object.create(clsDef.extends.prototype); + } + else { + throw new Error("Class definition 'extends' property must be a constructor function was: " + lang_1.stringify(clsDef.extends)); + } + } + for (var key in clsDef) { + if (key !== 'extends' && key !== 'prototype' && clsDef.hasOwnProperty(key)) { + proto[key] = applyParams(clsDef[key], key); + } + } + if (this && this.annotations instanceof Array) { + Reflect.defineMetadata('annotations', this.annotations, constructor); + } + var constructorName = constructor['name']; + if (!constructorName || constructorName === 'constructor') { + constructor['overriddenName'] = "class" + _nextClassId++; + } + return constructor; +} +exports.Class = Class; +/** + * @suppress {globalThis} + */ +function makeDecorator(name, props, parentClass, chainFn) { + var metaCtor = makeMetadataCtor([props]); + function DecoratorFactory(objOrType) { + if (!(Reflect && Reflect.getOwnMetadata)) { + throw 'reflect-metadata shim is required when using class decorators'; + } + if (this instanceof DecoratorFactory) { + metaCtor.call(this, objOrType); + return this; + } + var annotationInstance = new DecoratorFactory(objOrType); + var chainAnnotation = typeof this === 'function' && Array.isArray(this.annotations) ? this.annotations : []; + chainAnnotation.push(annotationInstance); + var TypeDecorator = function TypeDecorator(cls) { + var annotations = Reflect.getOwnMetadata('annotations', cls) || []; + annotations.push(annotationInstance); + Reflect.defineMetadata('annotations', annotations, cls); + return cls; + }; + TypeDecorator.annotations = chainAnnotation; + TypeDecorator.Class = Class; + if (chainFn) + chainFn(TypeDecorator); + return TypeDecorator; + } + if (parentClass) { + DecoratorFactory.prototype = Object.create(parentClass.prototype); + } + DecoratorFactory.prototype.toString = function () { return ("@" + name); }; + DecoratorFactory.annotationCls = DecoratorFactory; + return DecoratorFactory; +} +exports.makeDecorator = makeDecorator; +function makeMetadataCtor(props) { + return function ctor() { + var _this = this; + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i - 0] = arguments[_i]; + } + props.forEach(function (prop, i) { + var argVal = args[i]; + if (Array.isArray(prop)) { + // plain parameter + _this[prop[0]] = argVal === undefined ? prop[1] : argVal; + } + else { + for (var propName in prop) { + _this[propName] = + argVal && argVal.hasOwnProperty(propName) ? argVal[propName] : prop[propName]; + } + } + }); + }; +} +function makeParamDecorator(name, props, parentClass) { + var metaCtor = makeMetadataCtor(props); + function ParamDecoratorFactory() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i - 0] = arguments[_i]; + } + if (this instanceof ParamDecoratorFactory) { + metaCtor.apply(this, args); + return this; + } + var annotationInstance = new ((_a = ParamDecoratorFactory).bind.apply(_a, [void 0].concat(args)))(); + ParamDecorator.annotation = annotationInstance; + return ParamDecorator; + function ParamDecorator(cls, unusedKey, index) { + var parameters = Reflect.getOwnMetadata('parameters', cls) || []; + // there might be gaps if some in between parameters do not have annotations. + // we pad with nulls. + while (parameters.length <= index) { + parameters.push(null); + } + parameters[index] = parameters[index] || []; + parameters[index].push(annotationInstance); + Reflect.defineMetadata('parameters', parameters, cls); + return cls; + } + var _a; + } + if (parentClass) { + ParamDecoratorFactory.prototype = Object.create(parentClass.prototype); + } + ParamDecoratorFactory.prototype.toString = function () { return ("@" + name); }; + ParamDecoratorFactory.annotationCls = ParamDecoratorFactory; + return ParamDecoratorFactory; +} +exports.makeParamDecorator = makeParamDecorator; +function makePropDecorator(name, props, parentClass) { + var metaCtor = makeMetadataCtor(props); + function PropDecoratorFactory() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i - 0] = arguments[_i]; + } + if (this instanceof PropDecoratorFactory) { + metaCtor.apply(this, args); + return this; + } + var decoratorInstance = new ((_a = PropDecoratorFactory).bind.apply(_a, [void 0].concat(args)))(); + return function PropDecorator(target, name) { + var meta = Reflect.getOwnMetadata('propMetadata', target.constructor) || {}; + meta[name] = meta.hasOwnProperty(name) && meta[name] || []; + meta[name].unshift(decoratorInstance); + Reflect.defineMetadata('propMetadata', meta, target.constructor); + }; + var _a; + } + if (parentClass) { + PropDecoratorFactory.prototype = Object.create(parentClass.prototype); + } + PropDecoratorFactory.prototype.toString = function () { return ("@" + name); }; + PropDecoratorFactory.annotationCls = PropDecoratorFactory; + return PropDecoratorFactory; +} +exports.makePropDecorator = makePropDecorator; +//# sourceMappingURL=decorators.js.map \ No newline at end of file diff --git a/src-2/externals/injection-js/util/decorators.js.map b/src-2/externals/injection-js/util/decorators.js.map new file mode 100644 index 0000000..6f89177 --- /dev/null +++ b/src-2/externals/injection-js/util/decorators.js.map @@ -0,0 +1 @@ +{"version":3,"file":"decorators.js","sourceRoot":"","sources":["../../lib/util/decorators.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;;AAEH,qBAAgC,gBAAgB,CAAC,CAAA;AAGjD,IAAI,YAAY,GAAG,CAAC,CAAC;AACrB,IAAM,OAAO,GAAG,aAAM,CAAC,SAAS,CAAC,CAAC;AA8ElC,2BAA2B,UAAe;IACxC,EAAE,CAAC,CAAC,OAAO,UAAU,KAAK,UAAU,IAAI,UAAU,CAAC,cAAc,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;QAChF,wCAAwC;QACxC,UAAU,GAAG,UAAU,CAAC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AAC9B,CAAC;AA3Be,yBAAiB,oBA2BhC,CAAA"} \ No newline at end of file diff --git a/test-2/mocha.opts b/test-2/mocha.opts new file mode 100644 index 0000000..dcd076e --- /dev/null +++ b/test-2/mocha.opts @@ -0,0 +1,7 @@ +--ui tdd +--report lcovonly +--reporter spec +--recursive +--compilers ts:ts-node/register +--throw-deprecation +--colors \ No newline at end of file diff --git a/test-2/unit/metadata.test.ts b/test-2/unit/metadata.test.ts new file mode 100644 index 0000000..d8ead90 --- /dev/null +++ b/test-2/unit/metadata.test.ts @@ -0,0 +1,41 @@ +import { suite, test } from 'mocha-typescript'; +import * as unit from 'unit.js'; +import { extractMetadataByDecorator, extractMetadata, extractMetadatas } from '../../src-2/core/metadata'; +import { HapinessModule } from '../../src-2/core/decorators'; + +@suite('Unit - Metadata') +class Metadata { + + @test('extractMetadatas') + test1() { + @HapinessModule({ + version: 'test' + }) + class TestToken {} + + unit.object(extractMetadata(TestToken)) + .contains({ version: 'test' }); + + } + + @test('extractMetadatas') + test3() { + + class TestToken {} + + unit.array(extractMetadatas(TestToken)) + .is([]); + + } + + @test('extractMetadataByDecorator') + test2() { + @HapinessModule({ + version: 'test123' + }) + class TestToken {} + + unit.object(extractMetadataByDecorator(TestToken, 'HapinessModule')) + .contains({ version: 'test123' }); + } +} diff --git a/test-2/unit/mocks.ts b/test-2/unit/mocks.ts new file mode 100644 index 0000000..838a3d7 --- /dev/null +++ b/test-2/unit/mocks.ts @@ -0,0 +1,39 @@ +import 'reflect-metadata'; + +import { CoreModule, ModuleLevel } from '../../src-2/core/interfaces' +import { InjectionToken, HapinessModule } from '../../src-2/core/decorators'; + +export class EmptyModule {} +export class EmptyProvider {} +export const coreModule: CoreModule = { + token: EmptyModule, + name: EmptyModule.name, + version: '1', + level: ModuleLevel.ROOT +} +export const InjToken = new InjectionToken('token'); + +@HapinessModule({ + version: '123' +}) +export class ModuleWithMetadata {} + + +@HapinessModule({ + version: '123', + imports: [ ModuleWithMetadata ] +}) +export class ModuleWithMetadataWithChild {} + +@HapinessModule({ + version: '123', + exports: [ EmptyProvider ], + providers: [{ provide: InjToken, useValue: 0 }] +}) +export class ModuleWithMetadataExportProvider {} + +@HapinessModule({ + version: '123', + imports: [ ModuleWithMetadataExportProvider ] +}) +export class ModuleWithMetadataWithChildThatExportProvider {} diff --git a/test-2/unit/module.test.ts b/test-2/unit/module.test.ts new file mode 100644 index 0000000..f1fbe61 --- /dev/null +++ b/test-2/unit/module.test.ts @@ -0,0 +1,296 @@ +import { suite, test } from 'mocha-typescript'; +import { ModuleManager } from '../../src-2/core/module'; +import { ModuleLevel } from '../../src-2/core/interfaces'; +import { HapinessModule } from '../../src-2/core/decorators'; +import { Observable } from 'rxjs'; +import * as unit from 'unit.js'; + +import { extractMetadataByDecorator } from '../../src-2/core/metadata'; + +import { + EmptyProvider, + EmptyModule, + coreModule, + InjToken, + ModuleWithMetadata, + ModuleWithMetadataWithChild, + ModuleWithMetadataWithChildThatExportProvider +} from './mocks'; + +@suite('Unit - Module') +class ModuleTestSuite { + + @test('toCoreProvider - provide Class and must return CoreProvide') + testToCoreProvider1() { + + unit + .value(ModuleManager.toCoreProvider(EmptyProvider)) + .is({ provide: EmptyProvider, useClass: EmptyProvider }); + + } + + @test('toCoreProvider - provide CoreProvide and must return CoreProvide') + testToCoreProvider2() { + + unit + .value(ModuleManager.toCoreProvider({ provide: EmptyProvider, useClass: EmptyProvider })) + .is({ provide: EmptyProvider, useClass: EmptyProvider }); + + } + + @test('coreModuleParentConfigProviders - with no parent must return the module with same providers') + testCoreModuleParentConfigProviders1() { + + unit + .object(ModuleManager['coreModuleParentConfigProviders'](coreModule).providers) + .is([]); + + } + + @test('coreModuleParentConfigProviders - with parent must return the module with InjectionToken providers') + testCoreModuleParentConfigProviders2() { + + const module = Object.assign({ + parent: { + providers: [ { provide: InjToken, useClass: EmptyProvider } ] + } + }, coreModule); + + unit + .object(ModuleManager['coreModuleParentConfigProviders'](module).providers) + .is([{ provide: InjToken, useClass: EmptyProvider }]); + + } + + @test('metadataToCoreModule - must return an Observable of CoreModule whithout parent') + testMetadataToCoreModule1() { + + const metadata = { + version: '1', + }; + const cmwp = { + module: EmptyModule, + providers: [ { provide: InjToken, useClass: EmptyProvider } ] + }; + + ModuleManager['metadataToCoreModule'](metadata, cmwp) + .subscribe( + _ => unit + .value(_) + .is({ + parent: undefined, + token: EmptyModule, + name: 'EmptyModule', + version: '1', + exports: [], + declarations: [], + providers: [ { provide: InjToken, useClass: EmptyProvider } ], + level: ModuleLevel.ROOT + }) + ); + + } + + @test('metadataToCoreModule - must return an Observable of CoreModule with ROOT parent') + testMetadataToCoreModule2() { + + const metadata = { + version: '1', + }; + const cmwp = { + module: EmptyModule, + providers: [ { provide: InjToken, useClass: EmptyProvider } ] + }; + + ModuleManager['metadataToCoreModule'](metadata, cmwp, coreModule) + .subscribe( + _ => unit + .value(_) + .is({ + parent: coreModule, + token: EmptyModule, + name: 'EmptyModule', + version: '1', + exports: [], + declarations: [], + providers: [ { provide: InjToken, useClass: EmptyProvider } ], + level: ModuleLevel.PRIMARY + }) + ); + + } + + @test('metadataToCoreModule - must return an Observable of CoreModule with PRIMARY parent') + testMetadataToCoreModule3() { + + const metadata = { + version: '1', + }; + const cmwp = { + module: EmptyModule, + providers: [ { provide: InjToken, useClass: EmptyProvider } ] + }; + const module = Object.assign({}, coreModule, { level: ModuleLevel.PRIMARY }); + + ModuleManager['metadataToCoreModule'](metadata, cmwp, module) + .subscribe( + _ => unit + .value(_) + .is({ + parent: module, + token: EmptyModule, + name: 'EmptyModule', + version: '1', + exports: [], + declarations: [], + providers: [ { provide: InjToken, useClass: EmptyProvider } ], + level: ModuleLevel.SECONDARY + }) + ); + + } + + @test('extractMetadata - must return an Observable of HapinessModule') + testExtractMetadata1() { + + const stub = unit + .stub(require('../../src-2/core/metadata'), 'extractMetadataByDecorator') + .withArgs(ModuleWithMetadata) + .returns({ version: '123' }); + + ModuleManager['extractMetadata'](ModuleWithMetadata) + .subscribe( + _ => unit + .value(_) + .is({ version: '123' }) + ); + stub.parent.restore(); + + } + + @test('extractMetadata - must return an Observable with error') + testExtractMetadata2() { + + const stub = unit + .stub(require('../../src-2/core/metadata'), 'extractMetadataByDecorator') + .withArgs(null).returns(null) + .withArgs(EmptyModule).returns(null); + + ModuleManager['extractMetadata'](null) + .subscribe( + _ => {}, + _ => unit + .object(_) + .isInstanceOf(Error) + .hasProperty('message', 'Module \'null\' resolution failed: No metadata') + ); + + ModuleManager['extractMetadata'](EmptyModule) + .subscribe( + _ => {}, + _ => unit + .object(_) + .isInstanceOf(Error) + .hasProperty('message', 'Module \'EmptyModule\' resolution failed: No metadata') + ); + stub.parent.restore(); + + } + + @test('toCoreModuleWithProviders - provide a Class and must return an CoreModuleWithProviders') + testToCoreModuleWithProviders1() { + + unit + .value(ModuleManager['toCoreModuleWithProviders'](EmptyModule)) + .is({ module: EmptyModule, providers: [] }); + + } + + @test('toCoreModuleWithProviders - provide a CoreModuleWithProviders and must return an CoreModuleWithProviders') + testToCoreModuleWithProviders2() { + + unit + .value(ModuleManager['toCoreModuleWithProviders']({ module: EmptyModule, providers: [] })) + .is({ module: EmptyModule, providers: [] }); + + } + + @test('resolution - provide a Class module with metadata that got 1 child and ' + + 'must return an Observable of CoreModule with a child module') + testResolution1() { + + ModuleManager['resolution'](ModuleWithMetadataWithChild) + .subscribe( + _ => { + unit + .object(_) + .hasProperty('name', 'ModuleWithMetadataWithChild'); + + unit + .array(_.modules) + .hasLength(1); + + unit + .object(_.modules.pop()) + .hasProperty('name', 'ModuleWithMetadata'); + } + ); + + } + + @test('collectProviders - provide a CoreModule and must return array of CoreProvide') + testCollectProviders1() { + + const cmodule = Object.assign({}, coreModule, { providers: [{ provide: EmptyModule, useClass: EmptyModule }] }); + const stub = unit + .stub(ModuleManager, 'extractExportedProviders') + .withArgs(cmodule) + .returns([]); + + unit + .array(ModuleManager['collectProviders'](cmodule)) + .hasLength(1) + .is([{ provide: EmptyModule, useClass: EmptyModule }]); + + stub.parent.restore(); + + } + + @test('extractExportedProviders - provide a CoreModule and must return array of CoreProvide exported by children') + testExtractExportedProviders1() { + + ModuleManager + .resolve(ModuleWithMetadataWithChildThatExportProvider) + .subscribe( + _ => { + unit + .array(ModuleManager['extractExportedProviders'](_)) + .hasLength(2) + .is([ + { provide: EmptyProvider, useClass: EmptyProvider }, + { provide: InjToken, useValue: 0 } + ]); + } + ); + + } + + @test('instantiation - provide a CoreModule and must return an Observable of CoreModule with di and instance') + testInstantiation1() { + + ModuleManager + .resolve(ModuleWithMetadataWithChild) + .flatMap(_ => ModuleManager.instantiate(_)) + .subscribe( + _ => { + unit + .object(_) + .hasProperty('di'); + unit + .object(_.instance) + .isInstanceOf(ModuleWithMetadataWithChild); + } + ); + + } +} diff --git a/yarn.lock b/yarn.lock deleted file mode 100644 index 9ef8155..0000000 --- a/yarn.lock +++ /dev/null @@ -1,1896 +0,0 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. -# yarn lockfile v1 - - -"@types/boom@*", "@types/boom@^4.3.5": - version "4.3.5" - resolved "https://registry.yarnpkg.com/@types/boom/-/boom-4.3.5.tgz#9ccca31e08c989bce483bd76b2de798526c608f5" - -"@types/catbox@*": - version "7.1.1" - resolved "https://registry.yarnpkg.com/@types/catbox/-/catbox-7.1.1.tgz#170e50c35f047163e709c43e8bab551548a7d429" - dependencies: - "@types/boom" "*" - -"@types/fs-extra@^3.0.3": - version "3.0.3" - resolved "https://registry.yarnpkg.com/@types/fs-extra/-/fs-extra-3.0.3.tgz#1d66eb670ebf657e57c0fda014df340c19d8aa0c" - dependencies: - "@types/node" "*" - -"@types/hapi@^16.1.6": - version "16.1.6" - resolved "https://registry.yarnpkg.com/@types/hapi/-/hapi-16.1.6.tgz#a55e0b201e69ca74a147776b3e1a464aa7b14c76" - dependencies: - "@types/boom" "*" - "@types/catbox" "*" - "@types/joi" "*" - "@types/mimos" "*" - "@types/node" "*" - "@types/podium" "*" - "@types/shot" "*" - -"@types/hoek@^4.1.3": - version "4.1.3" - resolved "https://registry.yarnpkg.com/@types/hoek/-/hoek-4.1.3.tgz#d1982d48fb0d2a0e5d7e9d91838264d8e428d337" - -"@types/joi@*", "@types/joi@^10.4.0": - version "10.4.0" - resolved "https://registry.yarnpkg.com/@types/joi/-/joi-10.4.0.tgz#a4de40cdf2462c7e1c83eb47ca3e19177bcc2ae8" - -"@types/mime-db@*": - version "1.27.0" - resolved "https://registry.yarnpkg.com/@types/mime-db/-/mime-db-1.27.0.tgz#9bc014a1fd1fdf47649c1a54c6dd7966b8284792" - -"@types/mimos@*": - version "3.0.0" - resolved "https://registry.yarnpkg.com/@types/mimos/-/mimos-3.0.0.tgz#20356e7381e9529c2a7e764c798be5a48cdeff96" - dependencies: - "@types/mime-db" "*" - -"@types/node@*", "@types/node@^8.0.13": - version "8.0.13" - resolved "https://registry.yarnpkg.com/@types/node/-/node-8.0.13.tgz#530f0f9254209b0335bf5cc6387822594ef47093" - -"@types/podium@*": - version "1.0.0" - resolved "https://registry.yarnpkg.com/@types/podium/-/podium-1.0.0.tgz#bfaa2151be2b1d6109cc69f7faa9dac2cba3bb20" - -"@types/shot@*": - version "3.4.0" - resolved "https://registry.yarnpkg.com/@types/shot/-/shot-3.4.0.tgz#459477c5187d3ebd303660ab099e7e9e0f3b656f" - dependencies: - "@types/node" "*" - -"@types/websocket@^0.0.34": - version "0.0.34" - resolved "https://registry.yarnpkg.com/@types/websocket/-/websocket-0.0.34.tgz#25596764cec885eda070fdb6d19cd76fe582747c" - dependencies: - "@types/node" "*" - -abbrev@1: - version "1.1.0" - resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.1.0.tgz#d0554c2256636e2f56e7c2e5ad183f859428d81f" - -abbrev@1.0.x: - version "1.0.9" - resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.0.9.tgz#91b4792588a7738c25f35dd6f63752a2f8776135" - -accept@2.x.x: - version "2.1.4" - resolved "https://registry.yarnpkg.com/accept/-/accept-2.1.4.tgz#887af54ceee5c7f4430461971ec400c61d09acbb" - dependencies: - boom "5.x.x" - hoek "4.x.x" - -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" - -ammo@2.x.x: - version "2.0.4" - resolved "https://registry.yarnpkg.com/ammo/-/ammo-2.0.4.tgz#bf80aab211698ea78f63ef5e7f113dd5d9e8917f" - dependencies: - boom "5.x.x" - hoek "4.x.x" - -ansi-regex@^2.0.0: - version "2.1.1" - resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df" - -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.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.1.0.tgz#09c202d5c917ec23188caa5c9cb9179cd9547750" - dependencies: - color-convert "^1.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" - dependencies: - default-require-extensions "^1.0.0" - -argparse@^1.0.7: - version "1.0.9" - resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.9.tgz#73d83bc263f86e97f8cc4f6bae1b0e90a7d22c86" - dependencies: - sprintf-js "~1.0.2" - -arrify@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d" - -asn1@~0.2.3: - version "0.2.3" - resolved "https://registry.yarnpkg.com/asn1/-/asn1-0.2.3.tgz#dac8787713c9966849fc8180777ebe9c1ddf3b86" - -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" - -assert-plus@^0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/assert-plus/-/assert-plus-0.2.0.tgz#d74e1b87e7affc0db8aadb7021f3fe48101ab234" - -async@1.x, async@^1.4.0: - version "1.5.2" - resolved "https://registry.yarnpkg.com/async/-/async-1.5.2.tgz#ec6a61ae56480c0c3cb241c95618e20892f9672a" - -async@^2.1.4: - version "2.5.0" - resolved "https://registry.yarnpkg.com/async/-/async-2.5.0.tgz#843190fd6b7357a0b9e1c956edddd5ec8462b54d" - dependencies: - lodash "^4.14.0" - -async@~0.9.0: - version "0.9.2" - resolved "https://registry.yarnpkg.com/async/-/async-0.9.2.tgz#aea74d5e61c1f899613bf64bda66d4c78f2fd17d" - -asynckit@^0.4.0: - version "0.4.0" - resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" - -aws-sign2@~0.6.0: - version "0.6.0" - resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.6.0.tgz#14342dd38dbcc94d0e5b87d763cd63612c0e794f" - -aws4@^1.2.1: - version "1.6.0" - resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.6.0.tgz#83ef5ca860b2b32e4a0deedee8c771b9db57471e" - -b64@3.x.x: - version "3.0.2" - resolved "https://registry.yarnpkg.com/b64/-/b64-3.0.2.tgz#7a9d60466adf7b8de114cbdf651a5fdfcc90894d" - -babel-code-frame@^6.22.0: - version "6.22.0" - resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.22.0.tgz#027620bee567a88c32561574e7fd0801d33118e4" - dependencies: - chalk "^1.1.0" - esutils "^2.0.2" - js-tokens "^3.0.0" - -babel-generator@^6.18.0: - version "6.25.0" - resolved "https://registry.yarnpkg.com/babel-generator/-/babel-generator-6.25.0.tgz#33a1af70d5f2890aeb465a4a7793c1df6a9ea9fc" - dependencies: - babel-messages "^6.23.0" - babel-runtime "^6.22.0" - babel-types "^6.25.0" - detect-indent "^4.0.0" - jsesc "^1.3.0" - lodash "^4.2.0" - source-map "^0.5.0" - trim-right "^1.0.1" - -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-runtime@^6.22.0: - version "6.23.0" - resolved "https://registry.yarnpkg.com/babel-runtime/-/babel-runtime-6.23.0.tgz#0a9489f144de70efb3ce4300accdb329e2fc543b" - dependencies: - core-js "^2.4.0" - regenerator-runtime "^0.10.0" - -babel-template@^6.16.0: - version "6.25.0" - resolved "https://registry.yarnpkg.com/babel-template/-/babel-template-6.25.0.tgz#665241166b7c2aa4c619d71e192969552b10c071" - dependencies: - babel-runtime "^6.22.0" - babel-traverse "^6.25.0" - babel-types "^6.25.0" - babylon "^6.17.2" - lodash "^4.2.0" - -babel-traverse@^6.18.0, babel-traverse@^6.25.0: - version "6.25.0" - resolved "https://registry.yarnpkg.com/babel-traverse/-/babel-traverse-6.25.0.tgz#2257497e2fcd19b89edc13c4c91381f9512496f1" - dependencies: - babel-code-frame "^6.22.0" - babel-messages "^6.23.0" - babel-runtime "^6.22.0" - babel-types "^6.25.0" - babylon "^6.17.2" - debug "^2.2.0" - globals "^9.0.0" - invariant "^2.2.0" - lodash "^4.2.0" - -babel-types@^6.18.0, babel-types@^6.25.0: - version "6.25.0" - resolved "https://registry.yarnpkg.com/babel-types/-/babel-types-6.25.0.tgz#70afb248d5660e5d18f811d91c8303b54134a18e" - dependencies: - babel-runtime "^6.22.0" - esutils "^2.0.2" - lodash "^4.2.0" - to-fast-properties "^1.0.1" - -babylon@^6.17.2, babylon@^6.17.4: - version "6.17.4" - resolved "https://registry.yarnpkg.com/babylon/-/babylon-6.17.4.tgz#3e8b7402b88d22c3423e137a1577883b15ff869a" - -balanced-match@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" - -bcrypt-pbkdf@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.1.tgz#63bc5dcb61331b92bc05fd528953c33462a06f8d" - dependencies: - tweetnacl "^0.14.3" - -bluebird@^2.9.9: - version "2.11.0" - resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-2.11.0.tgz#534b9033c022c9579c56ba3b3e5a5caafbb650e1" - -boom@2.x.x: - version "2.10.1" - resolved "https://registry.yarnpkg.com/boom/-/boom-2.10.1.tgz#39c8918ceff5799f83f9492a848f625add0c766f" - dependencies: - hoek "2.x.x" - -boom@5.x.x: - version "5.1.0" - resolved "https://registry.yarnpkg.com/boom/-/boom-5.1.0.tgz#0308fa8e924cd6d42d9c3bf4883bdc98f0e71df8" - dependencies: - hoek "4.x.x" - -brace-expansion@^1.1.7: - version "1.1.8" - resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.8.tgz#c07b211c7c952ec1f8efd51a77ef0d1d3990a292" - dependencies: - balanced-match "^1.0.0" - concat-map "0.0.1" - -browser-stdout@1.3.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/browser-stdout/-/browser-stdout-1.3.0.tgz#f351d32969d32fa5d7a5567154263d928ae3bd1f" - -builtin-modules@^1.0.0: - version "1.1.1" - resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-1.1.1.tgz#270f076c5a72c02f5b65a47df94c5fe3a278892f" - -call@4.x.x: - version "4.0.2" - resolved "https://registry.yarnpkg.com/call/-/call-4.0.2.tgz#df76f5f51ee8dd48b856ac8400f7e69e6d7399c4" - dependencies: - boom "5.x.x" - hoek "4.x.x" - -camelcase@^1.0.2: - version "1.2.1" - resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-1.2.1.tgz#9bb5304d2e0b56698b2c758b08a3eaa9daa58a39" - -camelcase@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-3.0.0.tgz#32fc4b9fcdaf845fcdf7e73bb97cac2261f0ab0a" - -caseless@~0.11.0: - version "0.11.0" - resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.11.0.tgz#715b96ea9841593cc33067923f5ec60ebda4f7d7" - -catbox-memory@2.x.x: - version "2.0.4" - resolved "https://registry.yarnpkg.com/catbox-memory/-/catbox-memory-2.0.4.tgz#433e255902caf54233d1286429c8f4df14e822d5" - dependencies: - hoek "4.x.x" - -catbox@7.x.x: - version "7.1.5" - resolved "https://registry.yarnpkg.com/catbox/-/catbox-7.1.5.tgz#c56f7e8e9555d27c0dc038a96ef73e57d186bb1f" - dependencies: - boom "5.x.x" - hoek "4.x.x" - joi "10.x.x" - -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" - -chalk@^1.1.0, chalk@^1.1.1, chalk@^1.1.3: - version "1.1.3" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98" - dependencies: - ansi-styles "^2.2.1" - escape-string-regexp "^1.0.2" - has-ansi "^2.0.0" - strip-ansi "^3.0.0" - supports-color "^2.0.0" - -chalk@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.0.1.tgz#dbec49436d2ae15f536114e76d14656cdbc0f44d" - dependencies: - ansi-styles "^3.1.0" - escape-string-regexp "^1.0.5" - supports-color "^4.0.0" - -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@^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" - -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" - -color-convert@^1.0.0: - version "1.9.0" - resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.0.tgz#1accf97dd739b983bf994d56fec8f95853641b7a" - dependencies: - color-name "^1.1.1" - -color-name@^1.1.1: - version "1.1.3" - resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" - -colors@^1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/colors/-/colors-1.1.2.tgz#168a4701756b6a7f51a12ce0c97bfa28c084ed63" - -combined-stream@^1.0.5, combined-stream@~1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.5.tgz#938370a57b4a51dea2c77c15d5c5fdf895164009" - dependencies: - delayed-stream "~1.0.0" - -combined-stream@~0.0.4: - version "0.0.7" - resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-0.0.7.tgz#0137e657baa5a7541c57ac37ac5fc07d73b4dc1f" - dependencies: - delayed-stream "0.0.5" - -commander@2.9.0: - version "2.9.0" - resolved "https://registry.yarnpkg.com/commander/-/commander-2.9.0.tgz#9c99094176e12240cb22d6c5146098400fe0f7d4" - dependencies: - graceful-readlink ">= 1.0.0" - -commander@^2.9.0: - version "2.11.0" - resolved "https://registry.yarnpkg.com/commander/-/commander-2.11.0.tgz#157152fd1e7a6c8d98a5b715cf376df928004563" - -component-emitter@1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/component-emitter/-/component-emitter-1.1.2.tgz#296594f2753daa63996d2af08d15a95116c9aec3" - -concat-map@0.0.1: - version "0.0.1" - resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" - -content@3.x.x: - version "3.0.4" - resolved "https://registry.yarnpkg.com/content/-/content-3.0.4.tgz#ca3dde04480f12519b71526ec44bd488ddfb3fef" - dependencies: - boom "5.x.x" - -cookiejar@2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/cookiejar/-/cookiejar-2.0.1.tgz#3d12752f6adf68a892f332433492bd5812bb668f" - -core-js@^2.4.0: - version "2.4.1" - resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.4.1.tgz#4de911e667b0eae9124e34254b53aea6fc618d3e" - -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" - -coveralls@^2.13.1: - version "2.13.1" - resolved "https://registry.yarnpkg.com/coveralls/-/coveralls-2.13.1.tgz#d70bb9acc1835ec4f063ff9dac5423c17b11f178" - dependencies: - js-yaml "3.6.1" - lcov-parse "0.0.10" - log-driver "1.2.5" - minimist "1.2.0" - request "2.79.0" - -cryptiles@2.x.x: - version "2.0.5" - resolved "https://registry.yarnpkg.com/cryptiles/-/cryptiles-2.0.5.tgz#3bdfecdc608147c1c67202fa291e7dca59eaa3b8" - dependencies: - boom "2.x.x" - -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" - -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" - -debug@2, debug@^2.2.0, debug@^2.6.3, debug@^2.6.8: - version "2.6.8" - resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.8.tgz#e731531ca2ede27d188222427da17821d68ff4fc" - dependencies: - ms "2.0.0" - -debug@2.6.0: - version "2.6.0" - resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.0.tgz#bc596bcabe7617f11d9fa15361eded5608b8499b" - dependencies: - ms "0.7.2" - -decamelize@^1.0.0, decamelize@^1.1.1: - version "1.2.0" - resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" - -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" - dependencies: - strip-bom "^2.0.0" - -delayed-stream@0.0.5: - version "0.0.5" - resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-0.0.5.tgz#d4b1f43a93e8296dfe02694f4680bc37a313c73f" - -delayed-stream@~1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" - -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.2.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/diff/-/diff-3.2.0.tgz#c9ce393a4b7cbd0b058a725c93df299027868ff9" - -diff@^3.1.0, diff@^3.2.0: - version "3.3.0" - resolved "https://registry.yarnpkg.com/diff/-/diff-3.3.0.tgz#056695150d7aa93237ca7e378ac3b1682b7963b9" - -ecc-jsbn@~0.1.1: - version "0.1.1" - resolved "https://registry.yarnpkg.com/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz#0fc73a9ed5f0d53c38193398523ef7e543777505" - dependencies: - jsbn "~0.1.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" - -escape-string-regexp@1.0.5, 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" - -esprima@^2.6.0: - version "2.7.3" - resolved "https://registry.yarnpkg.com/esprima/-/esprima-2.7.3.tgz#96e3b70d5779f6ad49cd032673d1c312767ba581" - -esprima@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.0.tgz#4499eddcd1110e0b218bacf2fa7f7f59f55ca804" - -esutils@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.2.tgz#0abf4f1caa5bcb1f7a9d8acc6dea4faaa04bac9b" - -extend@~1.2.1: - version "1.2.1" - resolved "https://registry.yarnpkg.com/extend/-/extend-1.2.1.tgz#a0f5fd6cfc83a5fe49ef698d60ec8a624dd4576c" - -extend@~3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.1.tgz#a755ea7bc1adfcc5a31ce7e762dbaadc5e636444" - -extsprintf@1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.0.2.tgz#e1080e0658e300b06294990cc70e1502235fd550" - -fileset@^2.0.2: - version "2.0.3" - resolved "https://registry.yarnpkg.com/fileset/-/fileset-2.0.3.tgz#8e7548a96d3cc2327ee5e674168723a333bba2a0" - dependencies: - glob "^7.0.3" - minimatch "^3.0.3" - -find-up@^1.0.0: - version "1.1.2" - resolved "https://registry.yarnpkg.com/find-up/-/find-up-1.1.2.tgz#6b2e9822b1a2ce0a60ab64d610eccad53cb24d0f" - dependencies: - path-exists "^2.0.0" - pinkie-promise "^2.0.0" - -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@0.1.3: - version "0.1.3" - resolved "https://registry.yarnpkg.com/form-data/-/form-data-0.1.3.tgz#4ee4346e6eb5362e8344a02075bd8dbd8c7373ea" - dependencies: - async "~0.9.0" - combined-stream "~0.0.4" - mime "~1.2.11" - -form-data@~2.1.1: - version "2.1.4" - resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.1.4.tgz#33c183acf193276ecaa98143a69e94bfee1750d1" - dependencies: - asynckit "^0.4.0" - combined-stream "^1.0.5" - mime-types "^2.1.12" - -formatio@1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/formatio/-/formatio-1.1.1.tgz#5ed3ccd636551097383465d996199100e86161e9" - dependencies: - samsam "~1.1" - -formidable@1.0.14: - version "1.0.14" - resolved "https://registry.yarnpkg.com/formidable/-/formidable-1.0.14.tgz#2b3f4c411cbb5fdd695c44843e2a23514a43231a" - -fs-extra@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-4.0.0.tgz#414fb4ca2d2170ba0014159d3a8aec3303418d9e" - dependencies: - graceful-fs "^4.1.2" - jsonfile "^3.0.0" - universalify "^0.1.0" - -fs.realpath@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" - -generate-function@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/generate-function/-/generate-function-2.0.0.tgz#6858fe7c0969b7d4e9093337647ac79f60dfbe74" - -generate-object-property@^1.1.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/generate-object-property/-/generate-object-property-1.2.0.tgz#9c0e1c40308ce804f4783618b937fa88f99d50d0" - dependencies: - is-property "^1.0.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" - -getpass@^0.1.1: - version "0.1.7" - resolved "https://registry.yarnpkg.com/getpass/-/getpass-0.1.7.tgz#5eff8e3e684d569ae4cb2b1282604e8ba62149fa" - dependencies: - assert-plus "^1.0.0" - -glob@7.1.1: - version "7.1.1" - resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.1.tgz#805211df04faaf1c63a3600306cdf5ade50b2ec8" - dependencies: - fs.realpath "^1.0.0" - inflight "^1.0.4" - inherits "2" - minimatch "^3.0.2" - once "^1.3.0" - path-is-absolute "^1.0.0" - -glob@^7.0.3, glob@^7.0.5, 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" - -globals@^9.0.0: - version "9.18.0" - resolved "https://registry.yarnpkg.com/globals/-/globals-9.18.0.tgz#aa3896b3e69b487f17e31ed2143d69a8e30c2d8a" - -graceful-fs@^4.1.2, graceful-fs@^4.1.6: - version "4.1.11" - resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.11.tgz#0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658" - -"graceful-readlink@>= 1.0.0": - version "1.0.1" - resolved "https://registry.yarnpkg.com/graceful-readlink/-/graceful-readlink-1.0.1.tgz#4cafad76bc62f02fa039b2f94e9a3dd3a391a725" - -growl@1.9.2: - version "1.9.2" - resolved "https://registry.yarnpkg.com/growl/-/growl-1.9.2.tgz#0ea7743715db8d8de2c5ede1775e1b45ac85c02f" - -handlebars@^4.0.3: - version "4.0.10" - resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.0.10.tgz#3d30c718b09a3d96f23ea4cc1f403c4d3ba9ff4f" - dependencies: - async "^1.4.0" - optimist "^0.6.1" - source-map "^0.4.4" - optionalDependencies: - uglify-js "^2.6" - -hapi@^16.4.3: - version "16.4.3" - resolved "https://registry.yarnpkg.com/hapi/-/hapi-16.4.3.tgz#be4daaf2dcdbee97957ce503061b09765078aa05" - dependencies: - accept "2.x.x" - ammo "2.x.x" - boom "5.x.x" - call "4.x.x" - catbox "7.x.x" - catbox-memory "2.x.x" - cryptiles "3.x.x" - heavy "4.x.x" - hoek "4.x.x" - iron "4.x.x" - items "2.x.x" - joi "10.x.x" - mimos "3.x.x" - podium "1.x.x" - shot "3.x.x" - statehood "5.x.x" - subtext "4.x.x" - topo "2.x.x" - -har-validator@~2.0.6: - version "2.0.6" - resolved "https://registry.yarnpkg.com/har-validator/-/har-validator-2.0.6.tgz#cdcbc08188265ad119b6a5a7c8ab70eecfb5d27d" - dependencies: - chalk "^1.1.1" - commander "^2.9.0" - is-my-json-valid "^2.12.4" - pinkie-promise "^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" - 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" - -has-flag@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-2.0.0.tgz#e8207af1cc7b30d446cc70b734b5e8be18f88d51" - -hawk@~3.1.3: - version "3.1.3" - resolved "https://registry.yarnpkg.com/hawk/-/hawk-3.1.3.tgz#078444bd7c1640b0fe540d2c9b73d59678e8e1c4" - dependencies: - boom "2.x.x" - cryptiles "2.x.x" - hoek "2.x.x" - sntp "1.x.x" - -heavy@4.x.x: - version "4.0.4" - resolved "https://registry.yarnpkg.com/heavy/-/heavy-4.0.4.tgz#36c91336c00ccfe852caa4d153086335cd2f00e9" - dependencies: - boom "5.x.x" - hoek "4.x.x" - joi "10.x.x" - -hoek@2.x.x: - version "2.16.3" - resolved "https://registry.yarnpkg.com/hoek/-/hoek-2.16.3.tgz#20bb7403d3cea398e91dc4710a8ff1b8274a25ed" - -hoek@4.x.x: - version "4.1.1" - resolved "https://registry.yarnpkg.com/hoek/-/hoek-4.1.1.tgz#9cc573ffba2b7b408fb5e9c2a13796be94cddce9" - -hosted-git-info@^2.1.4: - version "2.5.0" - resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.5.0.tgz#6d60e34b3abbc8313062c3b798ef8d901a07af3c" - -http-signature@~1.1.0: - version "1.1.1" - resolved "https://registry.yarnpkg.com/http-signature/-/http-signature-1.1.1.tgz#df72e267066cd0ac67fb76adf8e134a8fbcf91bf" - dependencies: - assert-plus "^0.2.0" - jsprim "^1.2.2" - sshpk "^1.7.0" - -inflight@^1.0.4: - version "1.0.6" - resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" - dependencies: - once "^1.3.0" - wrappy "1" - -inherits@2, inherits@~2.0.1: - version "2.0.3" - resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" - -inherits@2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.1.tgz#b17d08d326b4423e568eff719f91b0b1cbdf69f1" - -invariant@^2.2.0: - version "2.2.2" - resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.2.tgz#9e1f56ac0acdb6bf303306f338be3b204ae60360" - 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" - -iron@4.x.x: - version "4.0.5" - resolved "https://registry.yarnpkg.com/iron/-/iron-4.0.5.tgz#4f042cceb8b9738f346b59aa734c83a89bc31428" - dependencies: - boom "5.x.x" - cryptiles "3.x.x" - hoek "4.x.x" - -is-arrayish@^0.2.1: - version "0.2.1" - resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" - -is-buffer@^1.1.5: - version "1.1.5" - resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.5.tgz#1f3b26ef613b214b88cbca23cc6c01d87961eecc" - -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" - -is-finite@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/is-finite/-/is-finite-1.0.2.tgz#cc6677695602be550ef11e8b4aa6305342b6d0aa" - 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" - dependencies: - number-is-nan "^1.0.0" - -is-my-json-valid@^2.12.4: - version "2.16.0" - resolved "https://registry.yarnpkg.com/is-my-json-valid/-/is-my-json-valid-2.16.0.tgz#f079dd9bfdae65ee2038aae8acbc86ab109e3693" - dependencies: - generate-function "^2.0.0" - generate-object-property "^1.1.0" - jsonpointer "^4.0.0" - xtend "^4.0.0" - -is-property@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/is-property/-/is-property-1.0.2.tgz#57fe1c4e48474edd65b09911f26b1cd4095dda84" - -is-typedarray@^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" - -is-utf8@^0.2.0: - version "0.2.1" - resolved "https://registry.yarnpkg.com/is-utf8/-/is-utf8-0.2.1.tgz#4b0da1442104d1b336340e80797e865cf39f7d72" - -isarray@0.0.1: - version "0.0.1" - resolved "https://registry.yarnpkg.com/isarray/-/isarray-0.0.1.tgz#8a18acfca9a8f4177e09abfc6038939b05d1eedf" - -isemail@2.x.x: - version "2.2.1" - resolved "https://registry.yarnpkg.com/isemail/-/isemail-2.2.1.tgz#0353d3d9a62951080c262c2aa0a42b8ea8e9e2a6" - -isexe@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" - -isstream@~0.1.2: - version "0.1.2" - resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a" - -istanbul-api@^1.1.0-alpha: - version "1.1.11" - resolved "https://registry.yarnpkg.com/istanbul-api/-/istanbul-api-1.1.11.tgz#fcc0b461e2b3bda71e305155138238768257d9de" - dependencies: - async "^2.1.4" - fileset "^2.0.2" - istanbul-lib-coverage "^1.1.1" - istanbul-lib-hook "^1.0.7" - istanbul-lib-instrument "^1.7.4" - istanbul-lib-report "^1.1.1" - istanbul-lib-source-maps "^1.2.1" - istanbul-reports "^1.1.1" - js-yaml "^3.7.0" - mkdirp "^0.5.1" - once "^1.4.0" - -istanbul-lib-coverage@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/istanbul-lib-coverage/-/istanbul-lib-coverage-1.1.1.tgz#73bfb998885299415c93d38a3e9adf784a77a9da" - -istanbul-lib-hook@^1.0.7: - version "1.0.7" - resolved "https://registry.yarnpkg.com/istanbul-lib-hook/-/istanbul-lib-hook-1.0.7.tgz#dd6607f03076578fe7d6f2a630cf143b49bacddc" - dependencies: - append-transform "^0.4.0" - -istanbul-lib-instrument@^1.7.4: - version "1.7.4" - resolved "https://registry.yarnpkg.com/istanbul-lib-instrument/-/istanbul-lib-instrument-1.7.4.tgz#e9fd920e4767f3d19edc765e2d6b3f5ccbd0eea8" - dependencies: - babel-generator "^6.18.0" - babel-template "^6.16.0" - babel-traverse "^6.18.0" - babel-types "^6.18.0" - babylon "^6.17.4" - istanbul-lib-coverage "^1.1.1" - semver "^5.3.0" - -istanbul-lib-report@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/istanbul-lib-report/-/istanbul-lib-report-1.1.1.tgz#f0e55f56655ffa34222080b7a0cd4760e1405fc9" - dependencies: - istanbul-lib-coverage "^1.1.1" - mkdirp "^0.5.1" - path-parse "^1.0.5" - supports-color "^3.1.2" - -istanbul-lib-source-maps@^1.2.1: - version "1.2.1" - resolved "https://registry.yarnpkg.com/istanbul-lib-source-maps/-/istanbul-lib-source-maps-1.2.1.tgz#a6fe1acba8ce08eebc638e572e294d267008aa0c" - dependencies: - debug "^2.6.3" - istanbul-lib-coverage "^1.1.1" - mkdirp "^0.5.1" - rimraf "^2.6.1" - source-map "^0.5.3" - -istanbul-reports@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/istanbul-reports/-/istanbul-reports-1.1.1.tgz#042be5c89e175bc3f86523caab29c014e77fee4e" - dependencies: - handlebars "^4.0.3" - -istanbul@^1.1.0-alpha.1: - version "1.1.0-alpha.1" - resolved "https://registry.yarnpkg.com/istanbul/-/istanbul-1.1.0-alpha.1.tgz#781795656018a2174c5f60f367ee5d361cb57b77" - dependencies: - abbrev "1.0.x" - async "1.x" - istanbul-api "^1.1.0-alpha" - js-yaml "3.x" - mkdirp "0.5.x" - nopt "3.x" - which "^1.1.1" - wordwrap "^1.0.0" - -items@2.x.x: - version "2.1.1" - resolved "https://registry.yarnpkg.com/items/-/items-2.1.1.tgz#8bd16d9c83b19529de5aea321acaada78364a198" - -joi@10.x.x: - version "10.6.0" - resolved "https://registry.yarnpkg.com/joi/-/joi-10.6.0.tgz#52587f02d52b8b75cdb0c74f0b164a191a0e1fc2" - dependencies: - hoek "4.x.x" - isemail "2.x.x" - items "2.x.x" - topo "2.x.x" - -js-tokens@^3.0.0: - version "3.0.2" - resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.2.tgz#9866df395102130e38f7f996bceb65443209c25b" - -js-yaml@3.6.1: - version "3.6.1" - resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.6.1.tgz#6e5fe67d8b205ce4d22fad05b7781e8dadcc4b30" - dependencies: - argparse "^1.0.7" - esprima "^2.6.0" - -js-yaml@3.x, js-yaml@^3.7.0: - version "3.9.0" - resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.9.0.tgz#4ffbbf25c2ac963b8299dc74da7e3740de1c18ce" - 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" - -jsesc@^1.3.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-1.3.0.tgz#46c3fec8c1892b12b0833db9bc7622176dbab34b" - -json-schema@0.2.3: - version "0.2.3" - resolved "https://registry.yarnpkg.com/json-schema/-/json-schema-0.2.3.tgz#b480c892e59a2f05954ce727bd3f2a4e882f9e13" - -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" - -json3@3.3.2: - version "3.3.2" - resolved "https://registry.yarnpkg.com/json3/-/json3-3.3.2.tgz#3c0434743df93e2f5c42aee7b19bcb483575f4e1" - -jsonfile@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-3.0.1.tgz#a5ecc6f65f53f662c4415c7675a0331d0992ec66" - optionalDependencies: - graceful-fs "^4.1.6" - -jsonpointer@^4.0.0: - version "4.0.1" - resolved "https://registry.yarnpkg.com/jsonpointer/-/jsonpointer-4.0.1.tgz#4fd92cb34e0e9db3c89c8622ecf51f9b978c6cb9" - -jsprim@^1.2.2: - version "1.4.0" - resolved "https://registry.yarnpkg.com/jsprim/-/jsprim-1.4.0.tgz#a3b87e40298d8c380552d8cc7628a0bb95a22918" - dependencies: - assert-plus "1.0.0" - extsprintf "1.0.2" - json-schema "0.2.3" - verror "1.3.6" - -kind-of@^3.0.2: - version "3.2.2" - resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-3.2.2.tgz#31ea21a734bab9bbb0f32466d893aea51e4a3c64" - dependencies: - is-buffer "^1.1.5" - -"kindof@>= 1.0.0 < 2": - version "1.0.0" - resolved "https://registry.yarnpkg.com/kindof/-/kindof-1.0.0.tgz#131899a8527537a94da2edcd5cc49fc609606560" - -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" - dependencies: - invert-kv "^1.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" - -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" - dependencies: - graceful-fs "^4.1.2" - parse-json "^2.2.0" - pify "^2.0.0" - pinkie-promise "^2.0.0" - strip-bom "^2.0.0" - -lodash._baseassign@^3.0.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/lodash._baseassign/-/lodash._baseassign-3.2.0.tgz#8c38a099500f215ad09e59f1722fd0c52bfe0a4e" - dependencies: - lodash._basecopy "^3.0.0" - lodash.keys "^3.0.0" - -lodash._basecopy@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/lodash._basecopy/-/lodash._basecopy-3.0.1.tgz#8da0e6a876cf344c0ad8a54882111dd3c5c7ca36" - -lodash._basecreate@^3.0.0: - version "3.0.3" - resolved "https://registry.yarnpkg.com/lodash._basecreate/-/lodash._basecreate-3.0.3.tgz#1bc661614daa7fc311b7d03bf16806a0213cf821" - -lodash._getnative@^3.0.0: - version "3.9.1" - resolved "https://registry.yarnpkg.com/lodash._getnative/-/lodash._getnative-3.9.1.tgz#570bc7dede46d61cdcde687d65d3eecbaa3aaff5" - -lodash._isiterateecall@^3.0.0: - version "3.0.9" - resolved "https://registry.yarnpkg.com/lodash._isiterateecall/-/lodash._isiterateecall-3.0.9.tgz#5203ad7ba425fae842460e696db9cf3e6aac057c" - -lodash.create@3.1.1: - version "3.1.1" - resolved "https://registry.yarnpkg.com/lodash.create/-/lodash.create-3.1.1.tgz#d7f2849f0dbda7e04682bb8cd72ab022461debe7" - dependencies: - lodash._baseassign "^3.0.0" - lodash._basecreate "^3.0.0" - lodash._isiterateecall "^3.0.0" - -lodash.isarguments@^3.0.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/lodash.isarguments/-/lodash.isarguments-3.1.0.tgz#2f573d85c6a24289ff00663b491c1d338ff3458a" - -lodash.isarray@^3.0.0: - version "3.0.4" - resolved "https://registry.yarnpkg.com/lodash.isarray/-/lodash.isarray-3.0.4.tgz#79e4eb88c36a8122af86f844aa9bcd851b5fbb55" - -lodash.keys@^3.0.0: - version "3.1.2" - resolved "https://registry.yarnpkg.com/lodash.keys/-/lodash.keys-3.1.2.tgz#4dbc0472b156be50a0b286855d1bd0b0c656098a" - dependencies: - lodash._getnative "^3.0.0" - lodash.isarguments "^3.0.0" - lodash.isarray "^3.0.0" - -lodash@^3.7.0: - version "3.10.1" - resolved "https://registry.yarnpkg.com/lodash/-/lodash-3.10.1.tgz#5bf45e8e49ba4189e17d482789dfd15bd140b7b6" - -lodash@^4.14.0, lodash@^4.2.0: - version "4.17.4" - resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae" - -log-driver@1.2.5: - version "1.2.5" - resolved "https://registry.yarnpkg.com/log-driver/-/log-driver-1.2.5.tgz#7ae4ec257302fd790d557cb10c97100d857b0056" - -lolex@1.3.2: - version "1.3.2" - resolved "https://registry.yarnpkg.com/lolex/-/lolex-1.3.2.tgz#7c3da62ffcb30f0f5a80a2566ca24e45d8a01f31" - -longest@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/longest/-/longest-1.0.1.tgz#30a0b2da38f73770e8294a0d22e6625ed77d0097" - -loose-envify@^1.0.0: - version "1.3.1" - resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.3.1.tgz#d1a8ad33fa9ce0e713d65fdd0ac8b748d478c848" - dependencies: - js-tokens "^3.0.0" - -make-error@^1.1.1: - version "1.3.0" - resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.0.tgz#52ad3a339ccf10ce62b4040b708fe707244b8b96" - -methods@1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/methods/-/methods-1.0.1.tgz#75bc91943dffd7da037cf3eeb0ed73a0037cd14b" - -methods@1.x: - version "1.1.2" - resolved "https://registry.yarnpkg.com/methods/-/methods-1.1.2.tgz#5529a4d67654134edcc5266656835b0f851afcee" - -mime-db@1.x.x: - version "1.29.0" - resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.29.0.tgz#48d26d235589651704ac5916ca06001914266878" - -mime-db@~1.27.0: - version "1.27.0" - resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.27.0.tgz#820f572296bbd20ec25ed55e5b5de869e5436eb1" - -mime-types@^2.1.12, mime-types@~2.1.7: - version "2.1.15" - resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.15.tgz#a4ebf5064094569237b8cf70046776d09fc92aed" - dependencies: - mime-db "~1.27.0" - -mime@1.2.11, mime@~1.2.11: - version "1.2.11" - resolved "https://registry.yarnpkg.com/mime/-/mime-1.2.11.tgz#58203eed86e3a5ef17aed2b7d9ebd47f0a60dd10" - -mimos@3.x.x: - version "3.0.3" - resolved "https://registry.yarnpkg.com/mimos/-/mimos-3.0.3.tgz#b9109072ad378c2b72f6a0101c43ddfb2b36641f" - dependencies: - hoek "4.x.x" - mime-db "1.x.x" - -minimatch@^3.0.2, minimatch@^3.0.3, minimatch@^3.0.4: - version "3.0.4" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" - dependencies: - brace-expansion "^1.1.7" - -minimist@0.0.8: - version "0.0.8" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" - -minimist@1.2.0, minimist@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" - -minimist@~0.0.1: - version "0.0.10" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.10.tgz#de3f98543dbf96082be48ad1a0c7cda836301dcf" - -mkdirp@0.5.1, mkdirp@0.5.x, 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-typescript@^1.1.7: - version "1.1.7" - resolved "https://registry.yarnpkg.com/mocha-typescript/-/mocha-typescript-1.1.7.tgz#86bca3d74891beeab99e755f74140a51050a7c77" - dependencies: - chalk "^1.1.3" - yargs "^6.5.0" - -mocha@^3.4.2: - version "3.4.2" - resolved "https://registry.yarnpkg.com/mocha/-/mocha-3.4.2.tgz#d0ef4d332126dbf18d0d640c9b382dd48be97594" - dependencies: - browser-stdout "1.3.0" - commander "2.9.0" - debug "2.6.0" - diff "3.2.0" - escape-string-regexp "1.0.5" - glob "7.1.1" - growl "1.9.2" - json3 "3.3.2" - lodash.create "3.1.1" - mkdirp "0.5.1" - supports-color "3.1.2" - -ms@0.7.2: - version "0.7.2" - resolved "https://registry.yarnpkg.com/ms/-/ms-0.7.2.tgz#ae25cf2512b3885a1d95d7f037868d8431124765" - -ms@2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" - -must@^0.12.0: - version "0.12.0" - resolved "https://registry.yarnpkg.com/must/-/must-0.12.0.tgz#5741e729bedbc8b0fe2bc8c5006459415383d05d" - dependencies: - kindof ">= 1.0.0 < 2" - -nan@^2.3.3: - version "2.6.2" - resolved "https://registry.yarnpkg.com/nan/-/nan-2.6.2.tgz#e4ff34e6c95fdfb5aecc08de6596f43605a7db45" - -nigel@2.x.x: - version "2.0.2" - resolved "https://registry.yarnpkg.com/nigel/-/nigel-2.0.2.tgz#93a1866fb0c52d87390aa75e2b161f4b5c75e5b1" - dependencies: - hoek "4.x.x" - vise "2.x.x" - -"noder.io@>= 1.0.0 < 2.0.0": - version "1.2.0" - resolved "https://registry.yarnpkg.com/noder.io/-/noder.io-1.2.0.tgz#ad2bc6c6c3f9465891edbc6dbf5e84dcae2fa9e6" - -nopt@3.x: - version "3.0.6" - resolved "https://registry.yarnpkg.com/nopt/-/nopt-3.0.6.tgz#c6465dbf08abcd4db359317f79ac68a646b28ff9" - dependencies: - abbrev "1" - -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" - dependencies: - hosted-git-info "^2.1.4" - is-builtin-module "^1.0.0" - semver "2 || 3 || 4 || 5" - validate-npm-package-license "^3.0.1" - -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" - -oauth-sign@~0.8.1: - version "0.8.2" - resolved "https://registry.yarnpkg.com/oauth-sign/-/oauth-sign-0.8.2.tgz#46a6ab7f0aead8deae9ec0565780b7d4efeb9d43" - -once@^1.3.0, once@^1.4.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" - dependencies: - wrappy "1" - -optimist@^0.6.1: - version "0.6.1" - resolved "https://registry.yarnpkg.com/optimist/-/optimist-0.6.1.tgz#da3ea74686fa21a19a111c326e90eb15a0196686" - dependencies: - minimist "~0.0.1" - wordwrap "~0.0.2" - -os-locale@^1.4.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/os-locale/-/os-locale-1.4.0.tgz#20f9f17ae29ed345e8bde583b13d2009803c14d9" - dependencies: - lcid "^1.0.0" - -parse-json@^2.2.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-2.2.0.tgz#f480f40434ef80741f8469099f8dea18f55a4dc9" - dependencies: - error-ex "^1.2.0" - -path-exists@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-2.1.0.tgz#0feb6c64f0fc518d9a754dd5efb62c7022761f4b" - dependencies: - pinkie-promise "^2.0.0" - -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-parse@^1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.5.tgz#3c1adf871ea9cd6c9431b6ea2bd74a0ff055c4c1" - -path-type@^1.0.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/path-type/-/path-type-1.1.0.tgz#59c44f7ee491da704da415da5a4070ba4f8fe441" - dependencies: - graceful-fs "^4.1.2" - pify "^2.0.0" - pinkie-promise "^2.0.0" - -pez@2.x.x: - version "2.1.5" - resolved "https://registry.yarnpkg.com/pez/-/pez-2.1.5.tgz#5ec2cc62500cc3eb4236d4a414cf5a17b5eb5007" - dependencies: - b64 "3.x.x" - boom "5.x.x" - content "3.x.x" - hoek "4.x.x" - nigel "2.x.x" - -pify@^2.0.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c" - -pinkie-promise@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/pinkie-promise/-/pinkie-promise-2.0.1.tgz#2135d6dfa7a358c069ac9b178776288228450ffa" - 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" - -podium@1.x.x: - version "1.2.5" - resolved "https://registry.yarnpkg.com/podium/-/podium-1.2.5.tgz#87c566c2f0365bcf0a1ec7602c4d01948cdd2ad5" - dependencies: - hoek "4.x.x" - items "2.x.x" - joi "10.x.x" - -punycode@^1.4.1: - version "1.4.1" - resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e" - -qs@1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/qs/-/qs-1.2.0.tgz#ed079be28682147e6fd9a34cc2b0c1e0ec6453ee" - -qs@~6.3.0: - version "6.3.2" - resolved "https://registry.yarnpkg.com/qs/-/qs-6.3.2.tgz#e75bd5f6e268122a2a0e0bda630b2550c166502c" - -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" - dependencies: - find-up "^1.0.0" - read-pkg "^1.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" - dependencies: - load-json-file "^1.0.0" - normalize-package-data "^2.3.2" - path-type "^1.0.0" - -readable-stream@1.0.27-1: - version "1.0.27-1" - resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-1.0.27-1.tgz#6b67983c20357cefd07f0165001a16d710d91078" - dependencies: - core-util-is "~1.0.0" - inherits "~2.0.1" - isarray "0.0.1" - string_decoder "~0.10.x" - -reduce-component@1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/reduce-component/-/reduce-component-1.0.1.tgz#e0c93542c574521bea13df0f9488ed82ab77c5da" - -reflect-metadata@^0.1.10: - version "0.1.10" - resolved "https://registry.yarnpkg.com/reflect-metadata/-/reflect-metadata-0.1.10.tgz#b4f83704416acad89988c9b15635d47e03b9344a" - -regenerator-runtime@^0.10.0: - version "0.10.5" - resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.10.5.tgz#336c3efc1220adcedda2c9fab67b5a7955a33658" - -repeat-string@^1.5.2: - version "1.6.1" - resolved "https://registry.yarnpkg.com/repeat-string/-/repeat-string-1.6.1.tgz#8dcae470e1c88abc2d600fff4a776286da75e637" - -repeating@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/repeating/-/repeating-2.0.1.tgz#5214c53a926d3552707527fbab415dbc08d06dda" - dependencies: - is-finite "^1.0.0" - -request@2.79.0: - version "2.79.0" - resolved "https://registry.yarnpkg.com/request/-/request-2.79.0.tgz#4dfe5bf6be8b8cdc37fcf93e04b65577722710de" - dependencies: - aws-sign2 "~0.6.0" - aws4 "^1.2.1" - caseless "~0.11.0" - combined-stream "~1.0.5" - extend "~3.0.0" - forever-agent "~0.6.1" - form-data "~2.1.1" - har-validator "~2.0.6" - hawk "~3.1.3" - http-signature "~1.1.0" - is-typedarray "~1.0.0" - isstream "~0.1.2" - json-stringify-safe "~5.0.1" - mime-types "~2.1.7" - oauth-sign "~0.8.1" - qs "~6.3.0" - stringstream "~0.0.4" - tough-cookie "~2.3.0" - tunnel-agent "~0.4.1" - uuid "^3.0.0" - -require-directory@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" - -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" - -resolve@^1.3.2: - version "1.3.3" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.3.3.tgz#655907c3469a8680dc2de3a275a8fdd69691f0e5" - dependencies: - path-parse "^1.0.5" - -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.6.1: - version "2.6.1" - resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.1.tgz#c2338ec643df7a1b7fe5c54fa86f57428a55f33d" - dependencies: - glob "^7.0.5" - -rxjs@^5.4.2: - version "5.4.2" - resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-5.4.2.tgz#2a3236fcbf03df57bae06fd6972fd99e5c08fcf7" - dependencies: - symbol-observable "^1.0.1" - -samsam@1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/samsam/-/samsam-1.1.2.tgz#bec11fdc83a9fda063401210e40176c3024d1567" - -samsam@~1.1: - version "1.1.3" - resolved "https://registry.yarnpkg.com/samsam/-/samsam-1.1.3.tgz#9f5087419b4d091f232571e7fa52e90b0f552621" - -"semver@2 || 3 || 4 || 5", semver@^5.3.0: - version "5.3.0" - resolved "https://registry.yarnpkg.com/semver/-/semver-5.3.0.tgz#9b2ce5d3de02d17c6012ad326aa6b4d0cf54f94f" - -set-blocking@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" - -shot@3.x.x: - version "3.4.2" - resolved "https://registry.yarnpkg.com/shot/-/shot-3.4.2.tgz#1e5c3f6f2b26649adc42f7eb350214a5a0291d67" - dependencies: - hoek "4.x.x" - joi "10.x.x" - -should-equal@0.3.1: - version "0.3.1" - resolved "https://registry.yarnpkg.com/should-equal/-/should-equal-0.3.1.tgz#bd8ea97a6748e39fad476a3be6fd72ebc2e72bf0" - dependencies: - should-type "0.0.4" - -should-format@0.0.7: - version "0.0.7" - resolved "https://registry.yarnpkg.com/should-format/-/should-format-0.0.7.tgz#1e2ef86bd91da9c2e0412335b56ababd9a2fde12" - dependencies: - should-type "0.0.4" - -should-type@0.0.4: - version "0.0.4" - resolved "https://registry.yarnpkg.com/should-type/-/should-type-0.0.4.tgz#0132a05417a6126866426acf116f1ed5623a5cd0" - -should@^6.0.1: - version "6.0.3" - resolved "https://registry.yarnpkg.com/should/-/should-6.0.3.tgz#daee30786a557662fbc774c008d7c58791edb1d9" - dependencies: - should-equal "0.3.1" - should-format "0.0.7" - should-type "0.0.4" - -"sinon@>= 1.14.1 < 2.0.0": - version "1.17.7" - resolved "https://registry.yarnpkg.com/sinon/-/sinon-1.17.7.tgz#4542a4f49ba0c45c05eb2e9dd9d203e2b8efe0bf" - dependencies: - formatio "1.1.1" - lolex "1.3.2" - samsam "1.1.2" - util ">=0.10.3 <1" - -sntp@1.x.x: - version "1.0.9" - resolved "https://registry.yarnpkg.com/sntp/-/sntp-1.0.9.tgz#6541184cc90aeea6c6e7b35e2659082443c66198" - dependencies: - hoek "2.x.x" - -source-map-support@^0.4.0: - version "0.4.15" - resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.4.15.tgz#03202df65c06d2bd8c7ec2362a193056fef8d3b1" - dependencies: - source-map "^0.5.6" - -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.1: - version "0.5.6" - resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.6.tgz#75ce38f52bf0733c5a7f0c118d81334a2bb5f412" - -spdx-correct@~1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-1.0.2.tgz#4b3073d933ff51f3912f03ac5519498a4150db40" - dependencies: - spdx-license-ids "^1.0.2" - -spdx-expression-parse@~1.0.0: - version "1.0.4" - resolved "https://registry.yarnpkg.com/spdx-expression-parse/-/spdx-expression-parse-1.0.4.tgz#9bdf2f20e1f40ed447fbe273266191fced51626c" - -spdx-license-ids@^1.0.2: - version "1.2.2" - resolved "https://registry.yarnpkg.com/spdx-license-ids/-/spdx-license-ids-1.2.2.tgz#c9df7a3424594ade6bd11900d596696dc06bac57" - -sprintf-js@~1.0.2: - version "1.0.3" - resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" - -sshpk@^1.7.0: - version "1.13.1" - resolved "https://registry.yarnpkg.com/sshpk/-/sshpk-1.13.1.tgz#512df6da6287144316dc4c18fe1cf1d940739be3" - dependencies: - asn1 "~0.2.3" - assert-plus "^1.0.0" - dashdash "^1.12.0" - getpass "^0.1.1" - optionalDependencies: - bcrypt-pbkdf "^1.0.0" - ecc-jsbn "~0.1.1" - jsbn "~0.1.0" - tweetnacl "~0.14.0" - -statehood@5.x.x: - version "5.0.2" - resolved "https://registry.yarnpkg.com/statehood/-/statehood-5.0.2.tgz#c6b3baa16ed8b121d3f09a3ffa85e22195a7f2a9" - dependencies: - boom "5.x.x" - cryptiles "3.x.x" - hoek "4.x.x" - iron "4.x.x" - items "2.x.x" - joi "10.x.x" - -string-width@^1.0.1, string-width@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-1.0.2.tgz#118bdf5b8cdc51a2a7e70d211e07e2b0b9b107d3" - dependencies: - code-point-at "^1.0.0" - is-fullwidth-code-point "^1.0.0" - strip-ansi "^3.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" - -stringstream@~0.0.4: - 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" - dependencies: - ansi-regex "^2.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" - 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" - -strip-json-comments@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" - -subtext@4.x.x: - version "4.4.1" - resolved "https://registry.yarnpkg.com/subtext/-/subtext-4.4.1.tgz#2fcec945de429283c3d18b151ff0fa1f1b87aec9" - dependencies: - boom "5.x.x" - content "3.x.x" - hoek "4.x.x" - pez "2.x.x" - wreck "12.x.x" - -superagent@~0.21.0: - version "0.21.0" - resolved "https://registry.yarnpkg.com/superagent/-/superagent-0.21.0.tgz#fb15027984751ee7152200e6cd21cd6e19a5de87" - dependencies: - component-emitter "1.1.2" - cookiejar "2.0.1" - debug "2" - extend "~1.2.1" - form-data "0.1.3" - formidable "1.0.14" - methods "1.0.1" - mime "1.2.11" - qs "1.2.0" - readable-stream "1.0.27-1" - reduce-component "1.0.1" - -"supertest@>= 0.15.0 < 1.0.0": - version "0.15.0" - resolved "https://registry.yarnpkg.com/supertest/-/supertest-0.15.0.tgz#86118695de4be58869b3ee94c45e1d084ca7fac5" - dependencies: - methods "1.x" - superagent "~0.21.0" - -supports-color@3.1.2: - version "3.1.2" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-3.1.2.tgz#72a262894d9d408b956ca05ff37b2ed8a6e2a2d5" - dependencies: - has-flag "^1.0.0" - -supports-color@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7" - -supports-color@^3.1.2: - version "3.2.3" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-3.2.3.tgz#65ac0504b3954171d8a64946b2ae3cbb8a5f54f6" - dependencies: - has-flag "^1.0.0" - -supports-color@^4.0.0: - version "4.2.0" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-4.2.0.tgz#ad986dc7eb2315d009b4d77c8169c2231a684037" - dependencies: - has-flag "^2.0.0" - -symbol-observable@^1.0.1: - version "1.0.4" - resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-1.0.4.tgz#29bf615d4aa7121bdd898b22d4b3f9bc4e2aa03d" - -to-fast-properties@^1.0.1: - version "1.0.3" - resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-1.0.3.tgz#b83571fa4d8c25b82e231b06e3a3055de4ca1a47" - -topo@2.x.x: - version "2.0.2" - resolved "https://registry.yarnpkg.com/topo/-/topo-2.0.2.tgz#cd5615752539057c0dc0491a621c3bc6fbe1d182" - dependencies: - hoek "4.x.x" - -tough-cookie@~2.3.0: - version "2.3.2" - resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.3.2.tgz#f081f76e4c85720e6c37a5faced737150d84072a" - dependencies: - punycode "^1.4.1" - -trim-right@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/trim-right/-/trim-right-1.0.1.tgz#cb2e1203067e0c8de1f614094b9fe45704ea6003" - -ts-node@^3.2.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-3.2.0.tgz#9814f0c0141784900cf12fef1197ad4b7f4d23d1" - dependencies: - arrify "^1.0.0" - chalk "^2.0.0" - diff "^3.1.0" - make-error "^1.1.1" - minimist "^1.2.0" - mkdirp "^0.5.1" - source-map-support "^0.4.0" - tsconfig "^6.0.0" - v8flags "^2.0.11" - yn "^2.0.0" - -tsconfig@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/tsconfig/-/tsconfig-6.0.0.tgz#6b0e8376003d7af1864f8df8f89dd0059ffcd032" - dependencies: - strip-bom "^3.0.0" - strip-json-comments "^2.0.0" - -tslib@^1.7.1: - version "1.7.1" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.7.1.tgz#bc8004164691923a79fe8378bbeb3da2017538ec" - -tslint@^5.5.0: - version "5.5.0" - resolved "https://registry.yarnpkg.com/tslint/-/tslint-5.5.0.tgz#10e8dab3e3061fa61e9442e8cee3982acf20a6aa" - dependencies: - babel-code-frame "^6.22.0" - colors "^1.1.2" - commander "^2.9.0" - diff "^3.2.0" - glob "^7.1.1" - minimatch "^3.0.4" - resolve "^1.3.2" - semver "^5.3.0" - tslib "^1.7.1" - tsutils "^2.5.1" - -tsutils@^2.5.1: - version "2.7.1" - resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-2.7.1.tgz#411a0e9466525a2b2869260a55620d7292155e24" - dependencies: - tslib "^1.7.1" - -tunnel-agent@~0.4.1: - version "0.4.3" - resolved "https://registry.yarnpkg.com/tunnel-agent/-/tunnel-agent-0.4.3.tgz#6373db76909fe570e08d73583365ed828a74eeeb" - -tweetnacl@^0.14.3, tweetnacl@~0.14.0: - version "0.14.5" - resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-0.14.5.tgz#5ae68177f192d4456269d108afa93ff8743f4f64" - -typedarray-to-buffer@^3.1.2: - version "3.1.2" - resolved "https://registry.yarnpkg.com/typedarray-to-buffer/-/typedarray-to-buffer-3.1.2.tgz#1017b32d984ff556eba100f501589aba1ace2e04" - dependencies: - is-typedarray "^1.0.0" - -typescript@^2.4.1: - version "2.4.1" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.4.1.tgz#c3ccb16ddaa0b2314de031e7e6fee89e5ba346bc" - -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-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" - -unit.js@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/unit.js/-/unit.js-2.0.0.tgz#e91b56abc50c530dba03cdbfe0e1df2a3ee3aa32" - dependencies: - bluebird "^2.9.9" - lodash "^3.7.0" - must "^0.12.0" - noder.io ">= 1.0.0 < 2.0.0" - should "^6.0.1" - sinon ">= 1.14.1 < 2.0.0" - supertest ">= 0.15.0 < 1.0.0" - -universalify@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.0.tgz#9eb1c4651debcc670cc94f1a75762332bb967778" - -user-home@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/user-home/-/user-home-1.1.1.tgz#2b5be23a32b63a7c9deb8d0f28d485724a3df190" - -"util@>=0.10.3 <1": - version "0.10.3" - resolved "https://registry.yarnpkg.com/util/-/util-0.10.3.tgz#7afb1afe50805246489e3db7fe0ed379336ac0f9" - dependencies: - inherits "2.0.1" - -uuid@^3.0.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.1.0.tgz#3dd3d3e790abc24d7b0d3a034ffababe28ebbc04" - -v8flags@^2.0.11: - version "2.1.1" - resolved "https://registry.yarnpkg.com/v8flags/-/v8flags-2.1.1.tgz#aab1a1fa30d45f88dd321148875ac02c0b55e5b4" - dependencies: - user-home "^1.1.1" - -validate-npm-package-license@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/validate-npm-package-license/-/validate-npm-package-license-3.0.1.tgz#2804babe712ad3379459acfbe24746ab2c303fbc" - dependencies: - spdx-correct "~1.0.0" - spdx-expression-parse "~1.0.0" - -verror@1.3.6: - version "1.3.6" - resolved "https://registry.yarnpkg.com/verror/-/verror-1.3.6.tgz#cff5df12946d297d2baaefaa2689e25be01c005c" - dependencies: - extsprintf "1.0.2" - -vise@2.x.x: - version "2.0.2" - resolved "https://registry.yarnpkg.com/vise/-/vise-2.0.2.tgz#6b08e8fb4cb76e3a50cd6dd0ec37338e811a0d39" - dependencies: - hoek "4.x.x" - -websocket@^1.0.24: - version "1.0.24" - resolved "https://registry.yarnpkg.com/websocket/-/websocket-1.0.24.tgz#74903e75f2545b6b2e1de1425bc1c905917a1890" - dependencies: - debug "^2.2.0" - nan "^2.3.3" - typedarray-to-buffer "^3.1.2" - yaeti "^0.0.6" - -which-module@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/which-module/-/which-module-1.0.0.tgz#bba63ca861948994ff307736089e3b96026c2a4f" - -which@^1.1.1: - version "1.2.14" - resolved "https://registry.yarnpkg.com/which/-/which-1.2.14.tgz#9a87c4378f03e827cecaf1acdf56c736c01c14e5" - dependencies: - isexe "^2.0.0" - -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@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb" - -wordwrap@~0.0.2: - version "0.0.3" - resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.3.tgz#a3d5da6cd5c0bc0008d37234bbaf1bed63059107" - -wrap-ansi@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-2.1.0.tgz#d8fc3d284dd05794fe84973caecdd1cf824fdd85" - dependencies: - string-width "^1.0.1" - strip-ansi "^3.0.1" - -wrappy@1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" - -wreck@12.x.x: - version "12.2.2" - resolved "https://registry.yarnpkg.com/wreck/-/wreck-12.2.2.tgz#e21823d34c36d672004eefa347ae8c4f6050e3db" - dependencies: - boom "5.x.x" - hoek "4.x.x" - -xtend@^4.0.0: - version "4.0.1" - resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.1.tgz#a5c6d532be656e23db820efb943a1f04998d63af" - -y18n@^3.2.1: - version "3.2.1" - resolved "https://registry.yarnpkg.com/y18n/-/y18n-3.2.1.tgz#6d15fba884c08679c0d77e88e7759e811e07fa41" - -yaeti@^0.0.6: - version "0.0.6" - resolved "https://registry.yarnpkg.com/yaeti/-/yaeti-0.0.6.tgz#f26f484d72684cf42bedfb76970aa1608fbf9577" - -yargs-parser@^4.2.0: - version "4.2.1" - resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-4.2.1.tgz#29cceac0dc4f03c6c87b4a9f217dd18c9f74871c" - dependencies: - camelcase "^3.0.0" - -yargs@^6.5.0: - version "6.6.0" - resolved "https://registry.yarnpkg.com/yargs/-/yargs-6.6.0.tgz#782ec21ef403345f830a808ca3d513af56065208" - dependencies: - camelcase "^3.0.0" - cliui "^3.2.0" - decamelize "^1.1.1" - get-caller-file "^1.0.1" - os-locale "^1.4.0" - read-pkg-up "^1.0.1" - require-directory "^2.1.1" - require-main-filename "^1.0.1" - set-blocking "^2.0.0" - string-width "^1.0.2" - which-module "^1.0.0" - y18n "^3.2.1" - yargs-parser "^4.2.0" - -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" - -yn@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/yn/-/yn-2.0.0.tgz#e5adabc8acf408f6385fc76495684c88e6af689a" From 6d24cc60c4a6b13f8b10cb1c3f7db44bc1c29d30 Mon Sep 17 00:00:00 2001 From: Juneil Date: Fri, 18 Aug 2017 17:27:45 +0200 Subject: [PATCH 02/19] refactor(http-server): second draft --- src-2/core/enums.ts | 10 ++ src-2/core/hapiness.ts | 130 ++++++++++----- src-2/core/hook.ts | 16 +- src-2/core/interfaces/module.ts | 11 +- src-2/core/module.ts | 23 ++- src-2/extensions/http-server/README.md | 89 ++++++++++ src-2/extensions/http-server/decorators.ts | 22 +++ src-2/extensions/http-server/enums.ts | 47 ++++++ src-2/extensions/http-server/extension.ts | 165 ++++++++++++++++++ src-2/extensions/http-server/index.ts | 6 + src-2/extensions/http-server/interfaces.ts | 185 +++++++++++++++++++++ src-2/extensions/http-server/lifecycle.ts | 126 ++++++++++++++ src-2/extensions/http-server/route.ts | 103 ++++++++++++ 13 files changed, 872 insertions(+), 61 deletions(-) create mode 100644 src-2/extensions/http-server/README.md create mode 100644 src-2/extensions/http-server/decorators.ts create mode 100644 src-2/extensions/http-server/enums.ts create mode 100644 src-2/extensions/http-server/extension.ts create mode 100644 src-2/extensions/http-server/index.ts create mode 100644 src-2/extensions/http-server/interfaces.ts create mode 100644 src-2/extensions/http-server/lifecycle.ts create mode 100644 src-2/extensions/http-server/route.ts diff --git a/src-2/core/enums.ts b/src-2/core/enums.ts index 2ae568a..c64430d 100644 --- a/src-2/core/enums.ts +++ b/src-2/core/enums.ts @@ -8,3 +8,13 @@ export enum ModuleEnum { OnError = 'onError', OnRegister = 'onRegister' } + +/** + * Represents the position where + * the module is instantiate + */ +export enum ModuleLevel { + ROOT, + PRIMARY, + SECONDARY +} diff --git a/src-2/core/hapiness.ts b/src-2/core/hapiness.ts index ae18914..9d7014a 100644 --- a/src-2/core/hapiness.ts +++ b/src-2/core/hapiness.ts @@ -2,16 +2,14 @@ import { Observable } from 'rxjs'; import { CoreModule, Extension, ExtensionWithConfig } from './interfaces'; import { InternalLogger } from './logger'; import { Type } from './decorators'; -import { ExtentionHooksEnum, ModuleEnum } from './enums'; +import { ExtentionHooksEnum, ModuleEnum, ModuleLevel } from './enums'; import { ModuleManager } from './module'; import { HookManager } from './hook'; export class Hapiness { private static module: CoreModule; - private static extensions: Extension[]; - private static logger = new InternalLogger('bootstrap'); /** @@ -28,41 +26,7 @@ export class Hapiness { this .checkArg(module) .flatMap(_ => ModuleManager.resolve(_)) - .flatMap(moduleResolved => - Observable - .from([].concat(extensions).filter(_ => !!_)) - .map(_ => this.toExtensionWithConfig(_)) - .flatMap(_ => this.loadExtention(_)) - .toArray() - .do(_ => this.extensions = _) - .flatMap(extensionsLoaded => - Observable - .from(extensionsLoaded) - .map(_ => ({ provide: _.token, useValue: _.value })) - .toArray() - .flatMap(_ => ModuleManager.instantiate(moduleResolved, _)) - .do(_ => this.module = _) - .flatMap(moduleInstanciated => - Observable - .from(ModuleManager.getModules(moduleInstanciated)) - .filter(_ => !!_.parent) - .filter(_ => HookManager - .hasLifecycleHook(ModuleEnum.OnRegister.toString(), _.token) - ) - .flatMap(_ => HookManager - .triggerHook(ModuleEnum.OnRegister.toString(), _.token, _.instance) - ) - .toArray() - .flatMap(_ => HookManager.triggerHook( - ModuleEnum.OnStart.toString(), - moduleInstanciated.token, - moduleInstanciated.instance, - null, - false - )) - ) - ) - ) + .flatMap(_ => this.loadExtensions(extensions, _)) .subscribe( _ => resolve(), _ => reject(_) @@ -70,6 +34,75 @@ export class Hapiness { }); } + /** + * Load extensions + * + * @param {Array|ExtensionWithConfig>} extensions + * @param {CoreModule} moduleResolved + * @returns Observable + */ + private static loadExtensions(extensions: Array | ExtensionWithConfig>, moduleResolved: CoreModule): Observable { + return Observable + .from([].concat(extensions).filter(_ => !!_)) + .map(_ => this.toExtensionWithConfig(_)) + .flatMap(_ => this.loadExtention(_)) + .toArray() + .do(_ => this.extensions = _) + .flatMap(_ => this.instantiateModule(_, moduleResolved)); + } + + /** + * Instantiate module + * + * @param {Extension[]} extensionsLoaded + * @param {CoreModule} moduleResolved + * @returns Observable + */ + private static instantiateModule(extensionsLoaded: Extension[], moduleResolved: CoreModule): Observable { + return Observable + .from(extensionsLoaded) + .map(_ => ({ provide: _.token, useValue: _.value })) + .toArray() + .flatMap(_ => ModuleManager.instantiate(moduleResolved, _)) + .do(_ => this.module = _) + .flatMap(_ => this.callHooks(_)); + } + + /** + * Call Register and Start Hooks + * + * @param {CoreModule} moduleInstantiated + * @returns Observable + */ + private static callHooks(moduleInstantiated: CoreModule): Observable { + return Observable + .from(ModuleManager.getModules(moduleInstantiated)) + .filter(_ => _.level !== ModuleLevel.ROOT) + .filter(_ => HookManager + .hasLifecycleHook(ModuleEnum.OnRegister.toString(), _.token) + ) + .flatMap(_ => HookManager + .triggerHook(ModuleEnum.OnRegister.toString(), _.token, _.instance) + ) + .toArray() + .flatMap(_ => HookManager + .triggerHook( + ModuleEnum.OnStart.toString(), + moduleInstantiated.token, + moduleInstantiated.instance, + null, + false + ) + ); + } + + /** + * Check if the provided module + * is right + * + * @param {Type} module + * @returns Observable + */ private static checkArg(module: Type): Observable> { return Observable .of(module) @@ -140,3 +173,24 @@ export class Hapiness { } } + +/** + * @param {Error} error + * @returns void + */ +export function errorHandler(error: Error): void { + Observable + .of(Hapiness['module']) + .filter(_ => !!(_ && _.instance)) + .flatMap(_ => + HookManager + .triggerHook( + ModuleEnum.OnError.toString(), + _.token, + _.instance, + [ error ], + false + ) + ) + .subscribe(null, _ => console.error(_)); +} diff --git a/src-2/core/hook.ts b/src-2/core/hook.ts index 618daca..86236f6 100644 --- a/src-2/core/hook.ts +++ b/src-2/core/hook.ts @@ -37,21 +37,17 @@ export class HookManager { .of(this.hasLifecycleHook(hook, token)) .filter(_ => !!_) .map(_ => Reflect.apply(instance[hook], instance, args || [])) - .flatMap(_ => (_ instanceof Observable) ? - _ : - Observable.of(_) + .flatMap(_ => + (_ instanceof Observable) ? + _ : !!_ ? + Observable.of(_) : + Observable.empty() ), Observable .of(this.hasLifecycleHook(hook, token)) .filter(_ => !_ && throwErr) - .flatMap(_ => Observable.throw(new Error(`Hook missing ${hook} on ${token ? token.name : null}`))), - - Observable - .of(this.hasLifecycleHook(hook, token)) - .filter(_ => !_ && !throwErr) - .map(_ => null) - + .flatMap(_ => Observable.throw(new Error(`Hook missing ${hook} on ${token ? token.name : null}`))) ) } } diff --git a/src-2/core/interfaces/module.ts b/src-2/core/interfaces/module.ts index b5b2ad6..58c7125 100644 --- a/src-2/core/interfaces/module.ts +++ b/src-2/core/interfaces/module.ts @@ -1,6 +1,7 @@ import { Type } from '../decorators'; import { ReflectiveInjector } from '../../externals/injection-js'; import { Observable } from 'rxjs'; +import { ModuleLevel } from '../enums'; /** * CoreProvide Type @@ -42,16 +43,6 @@ export interface CoreModuleWithProviders { providers: CoreProvide[]; } -/** - * Represents the position where - * the module is instantiate - */ -export enum ModuleLevel { - ROOT, - PRIMARY, - SECONDARY -} - /** * Module Lifecycle Hook * called once the module has been diff --git a/src-2/core/module.ts b/src-2/core/module.ts index ee606d4..751e13c 100644 --- a/src-2/core/module.ts +++ b/src-2/core/module.ts @@ -2,8 +2,9 @@ import { Observable } from 'rxjs'; import { InternalLogger } from './logger'; import { extractMetadataByDecorator } from './metadata'; import { HapinessModule, Type, InjectionToken } from './decorators'; -import { CoreModule, CoreProvide, CoreModuleWithProviders, ModuleLevel } from './interfaces'; +import { CoreModule, CoreProvide, CoreModuleWithProviders } from './interfaces'; import { DependencyInjection } from './di'; +import { ModuleLevel } from './enums'; export class ModuleManager { @@ -186,7 +187,7 @@ export class ModuleManager { }); } - /** + /** * =========================================================================== * * MODULE INSTANTIATION @@ -222,7 +223,23 @@ export class ModuleManager { DependencyInjection .instantiateComponent(_.token, _.di) .map(instance => Object.assign({ instance }, _)) - ); + ) + .flatMap(_ => this.instantiateLibs(_)); + } + + /** + * Instantiate and return array of libs + * + * @param {CoreModule} module + * @returns Type + */ + private static instantiateLibs(module: CoreModule): Observable { + return Observable + .from(module.declarations) + .filter(_ => !!extractMetadataByDecorator(_, 'Lib')) + .flatMap(_ => DependencyInjection.instantiateComponent(_, module.di)) + .toArray() + .map(_ => module); } /** diff --git a/src-2/extensions/http-server/README.md b/src-2/extensions/http-server/README.md new file mode 100644 index 0000000..13a8858 --- /dev/null +++ b/src-2/extensions/http-server/README.md @@ -0,0 +1,89 @@ +# HTTP Server Extension + +The extension is based on HapiJS + +## Usage + +```javascript + Hapiness.bootstrap(Module, + [ + HttpServerExt.setConfig({...}) + ] + ); +``` + +Configuration - [HapiJS Connection options](https://hapijs.com/api#serverconnectionoptions) + +## Extension provider + +```javascript + ... + constructor(@Inject(HttpServerExt) private server: Server) {} + ... +``` +Allow to get the hapi server instance + +## Route +Declare HTTP routes + +```javascript + @Route({metadata}) + class MyClass {} +``` + +- metadata + + - `path` - route path (/my/path) + - `method` - can be an array, values: (get, post, put, delete, patch, options) + - `config` - partially implemented, see [HapiJS Route config](https://hapijs.com/api#route-configuration) + - `providers` - Providers to add in the request DI, it means at each request a new instance of the provider will be created + +- interfaces + - see request and reply on [HapiJS Docs](https://hapijs.com/api#requests) + - `OnGet` - Http Get handler + - arguments: (request, reply) + - `OnPost` - Http Post handler + - arguments: (request, reply) + - `OnPut` - Http Put handler + - arguments: (request, reply) + - `OnDelete` - Http Delete handler + - arguments: (request, reply) + - `OnPatch` - Http Patch handler + - arguments: (request, reply) + - `OnOptions` - Http Options handler + - arguments: (request, reply) + - `OnPreAuth` - Request lifecycle handler + - arguments: (request, reply) + - `OnPostAuth` - Request lifecycle handler + - arguments: (request, reply) + - `OnPreHandler` - Request lifecycle handler + - arguments: (request, reply) + - `OnPostHandler` - Request lifecycle handler + - arguments: (request, reply) + - `OnPreResponse` - Request lifecycle handler + - arguments: (request, reply) + +## Lifecycle + +Request lifecycle component + +```javascript + @Lifecycle({ + event: 'onPreAuth' + }) +    class MyHook implements OnEvent { + onEvent(request, reply) { + ... + } + } +``` + +- metadata + + - `event` - request lifecycle event, see [HapiJS Request lifecycle](https://hapijs.com/api#request-lifecycle) + events: (onPreAuth, onPostAuth, onPreHandler, onPostHandler, onPreResponse) + +- interfaces + + - see request and reply on [HapiJS Docs](https://hapijs.com/api#requests) + - `OnEvent` - Lifecycle handler \ No newline at end of file diff --git a/src-2/extensions/http-server/decorators.ts b/src-2/extensions/http-server/decorators.ts new file mode 100644 index 0000000..aa796b8 --- /dev/null +++ b/src-2/extensions/http-server/decorators.ts @@ -0,0 +1,22 @@ +import { createDecorator, CoreDecorator, Type } from '../../core/decorators'; +import { RouteConfig } from './route'; + +export interface Route { + path: string; + method: string | string[]; + config?: RouteConfig; + // providers?: Array|any>; +} +export const Route = createDecorator('Route', { + path: undefined, + method: undefined, + config: undefined + // providers: undefined +}); + +export interface Lifecycle { + event: string; +} +export const Lifecycle = createDecorator('Lifecycle', { + event: undefined +}); diff --git a/src-2/extensions/http-server/enums.ts b/src-2/extensions/http-server/enums.ts new file mode 100644 index 0000000..0f70474 --- /dev/null +++ b/src-2/extensions/http-server/enums.ts @@ -0,0 +1,47 @@ +export enum LifecycleHooksEnum { + OnPreAuth = 'onPreAuth', + OnPostAuth = 'onPostAuth', + OnPreHandler = 'onPreHandler', + OnPostHandler = 'onPostHandler', + OnPreResponse = 'onPreResponse' +} + +export enum LifecycleEventsEnum { + OnPreAuth = 'onPreAuth', + OnPostAuth = 'onPostAuth', + OnPreHandler = 'onPreHandler', + OnPostHandler = 'onPostHandler', + OnPreResponse = 'onPreResponse' +} + +export enum LifecycleComponentEnum { + OnEvent = 'onEvent' +} + +export enum RouteMethodsEnum { + OnGet = 'onGet', + OnPost = 'onPost', + OnPut = 'onPut', + OnDelete = 'onDelete', + OnPatch = 'onPatch', + OnOptions = 'onOptions' +} + +export function enumByMethod(method: string): RouteMethodsEnum { + switch (method) { + case 'get': + return RouteMethodsEnum.OnGet; + case 'post': + return RouteMethodsEnum.OnPost; + case 'put': + return RouteMethodsEnum.OnPut; + case 'patch': + return RouteMethodsEnum.OnPatch; + case 'options': + return RouteMethodsEnum.OnOptions; + case 'delete': + return RouteMethodsEnum.OnDelete; + default: + throw new Error('Method does not exist'); + } +} diff --git a/src-2/extensions/http-server/extension.ts b/src-2/extensions/http-server/extension.ts new file mode 100644 index 0000000..90e3bc5 --- /dev/null +++ b/src-2/extensions/http-server/extension.ts @@ -0,0 +1,165 @@ +import { ModuleLevel } from '../../core/enums'; +import { DependencyInjection } from '../../core/di'; +import { HookManager } from '../../core/hook'; +import { extractMetadataByDecorator } from '../../core/metadata'; +import { ModuleManager } from '../../core/module'; +import { errorHandler } from '../../core/hapiness'; +import { CoreModule, OnExtensionLoad, OnModuleInstantiated, ExtensionWithConfig, Extension } from '../../core/interfaces'; +import { Lifecycle } from './decorators'; +import { Type } from '../../core/decorators'; +import { enumByMethod, LifecycleComponentEnum } from './enums'; +import { LifecycleManager } from './lifecycle'; +import { RouteBuilder } from './route'; +import { CoreRoute, HapiConfig } from './interfaces'; +import { Observable } from 'rxjs'; +import { RouteConfiguration, Server, Request, ReplyNoContinue, ReplyWithContinue } from 'hapi'; + +export class HttpServerExt implements OnExtensionLoad, OnModuleInstantiated { + + private server: Server; + + public static setConfig(config: HapiConfig): ExtensionWithConfig { + return { + token: HttpServerExt, + config + }; + } + + onExtensionLoad(module: CoreModule, config: HapiConfig): Observable { + return Observable + .of(new Server(config.options)) + .do(_ => _.connection({ host: config.host, port: config.port })) + .flatMap(server => + Observable + .from(ModuleManager.getModules(module)) + ) + } + + /** + * Register a HapiJS Plugin + * + * @param {CoreModule} module + * @param {Server} server + * @returns Observable + */ + private registerPlugin(module: CoreModule, server: Server): Observable { + return Observable + .of(_ => (s, o, n) => n()) + .do(_ => _['attributes'] = { + name: `${module.name}.hapinessplugin`, + version: module.version + }) + .flatMap(_ => Observable.fromPromise(server.register(_))) + .flatMap(_ => this.addRoutes(module, server)); + } + + /** + * Add route from CoreModule + * + * @param {CoreModule} module + * @param {Server} server + * @returns Observable + */ + private addRoutes(module: CoreModule, server: Server): Observable { + return Observable + .from(RouteBuilder.buildRoutes(module)) + .do(_ => + server + .route({ + method: _.method, + path: _.path, + config: Object.assign({ + handler: (request, reply) => this.httpHandler(request, reply, _) + }, _.config) + }) + ) + .toArray(); + } + + private httpHandler(request: Request, reply: ReplyNoContinue, route: CoreRoute): void { + HookManager + .triggerHook( + enumByMethod(request.method).toString(), + route.token, + request['_hapinessRoute'], + [ request, reply ] + ) + .map(_ => !!_.statusCode ? _ : { statusCode: 200, response: _ }) + .subscribe( + _ => + reply(_.response) + .code(!!_.response ? _.statusCode : 204), + _ => { + errorHandler(_); + reply(_); + } + ); + } + + /** + * Initialize and instantiate lifecycle components + * + * @param {CoreModule} module + * @param {Server} server + */ + private instantiateLifecycle(module: CoreModule, server: Server) { + return Observable + .from([].concat(module.declarations)) + .filter(_ => !!_ && !!extractMetadataByDecorator(_, 'Lifecycle')) + .map(_ => extractMetadataByDecorator(_, 'Lifecycle')) + .do(_ => + server.ext(_.event, (request, reply) => { + + }) + ) + + + // ModuleManager.getModules(module).forEach(_module => { + // [].concat(_module.declarations).filter(decl => !!extractMetadataByDecorator(decl, 'Lifecycle')) + // .map(lc => { + // debug('add lifecycle', lc.name, _module.token.name); + // const metadata = extractMetadataByDecorator(lc, 'Lifecycle'); + // server.ext(metadata.event, (request, reply) => { + // const instance = DependencyInjection.instantiateComponent(lc, _module.di); + // HookManager.triggerHook(LifecycleComponentEnum.OnEvent.toString(), lc, instance, [ request, reply ]); + // }); + // }); + // }); + } + + private eventHandler(lifecycle: Type, module: CoreModule, request: Request, reply: ReplyWithContinue): Observable { + return Observable + .of(lifecycle) + .flatMap(lc => + DependencyInjection + .instantiateComponent(lc, module.di) + .flatMap(_ => + HookManager + .triggerHook(LifecycleComponentEnum.OnEvent.toString(), lc, _, [request, reply]) + ) + ) + } + + /** + * this.server = new Server(); + const connection = this.server.connection(config); + debug('server instantiation'); + return Observable.create(observer => { + Observable.forkJoin( + this.registrationObservables(module, this.server, this.flattenModules(module)).concat(this.addRoutes(module, this.server)) + ).subscribe(routes => { + debug('routes and plugins registered'); + LifecycleManager.routeLifecycle(this.server, routes.reduce((a, c) => a.concat(c), [])); + observer.next({ + instance: this, + token: HttpServerExt, + value: this.server + }); + observer.complete(); + }, err => { + observer.error(err); + observer.complete(); + }); + }); + */ +} diff --git a/src-2/extensions/http-server/index.ts b/src-2/extensions/http-server/index.ts new file mode 100644 index 0000000..807332a --- /dev/null +++ b/src-2/extensions/http-server/index.ts @@ -0,0 +1,6 @@ +export * from './extension'; +export * from './decorators'; +export * from './lifecycle'; +export * from './route'; +export * from './interfaces'; +export { Server, Request, ReplyNoContinue, ReplyWithContinue } from 'hapi'; diff --git a/src-2/extensions/http-server/interfaces.ts b/src-2/extensions/http-server/interfaces.ts new file mode 100644 index 0000000..1352175 --- /dev/null +++ b/src-2/extensions/http-server/interfaces.ts @@ -0,0 +1,185 @@ +import { CoreModule, CoreProvide } from '../../core/interfaces'; +import { Type } from '../../core/decorators'; +import { Request, ReplyWithContinue, ReplyNoContinue, ServerOptions } from 'hapi'; +import { Observable } from 'rxjs'; + +export interface HapiConfig { + host: string; + port: number; + options: ServerOptions +} + +export interface ValidateConfig { + params?: any; + query?: any; + payload?: any; + response?: any; +} + +export interface RouteConfig { + description?: string; + notes?: string; + tags?: string[]; + validate?: ValidateConfig; + auth?: any; + bind?: any; + cache?: any; + compression?: any; + cors?: any; + ext?: any; + files?: any; + id?: any; + json?: any; + jsonp?: any; + log?: any; + plugins?: any; + pre?: any; + response?: any; + security?: any; + state?: any; + timeout?: any; +} + +/** + * CoreRoute Type + * Represents an Http Route + */ +export interface CoreRoute { + token: Type | any; + path: string; + method: string | string[]; + module: CoreModule; + providers?: CoreProvide[]; + config?: RouteConfig; +} + +export interface HapinessHTTPHandlerResponse { + response: any; + statusCode: number; +} + +/** + * Route Handler + * called on Http Get request + * + * @returns void | Observable + */ +export interface OnGet { + onGet(request: Request, reply?: ReplyNoContinue): void | Observable; +} + +/** + * Route Handler + * called on Http Post request + * + * @returns void | Observable + */ +export interface OnPost { + onPost(request: Request, reply?: ReplyNoContinue): void | Observable; +} + +/** + * Route Handler + * called on Http Put request + * + * @param {Error} error + * @returns void | Observable + */ +export interface OnPut { + onPut(request: Request, reply?: ReplyNoContinue): void | Observable; +} + +/** + * Route Handler + * called on Http Patch request + * + * @param {string} module + * @returns void | Observable + */ +export interface OnPatch { + onPatch(request: Request, reply?: ReplyNoContinue): void | Observable; +} + +/** + * Route Handler + * called on Http Options request + * + * @param {string} module + * @returns void | Observable + */ +export interface OnOptions { + onOptions(request: Request, reply?: ReplyNoContinue): void | Observable; +} + +/** + * Route Handler + * called on Http Delete request + * + * @param {string} module + * @returns void | Observable + */ +export interface OnDelete { + onDelete(request: Request, reply?: ReplyNoContinue): void | Observable; +} + +/** + * OnPreAuth Lifecycle hook + * + * @param {Request} request + * @param {Reply} reply + * @returns void | Observable + */ +export interface OnPreAuth { + onPreAuth(request: Request, reply?: ReplyWithContinue ): void | Observable; +} + +/** + * OnPostAuth Lifecycle hook + * + * @param {Request} request + * @param {Reply} reply + * @returns void | Observable + */ +export interface OnPostAuth { + onPostAuth(request: Request, reply?: ReplyWithContinue ): void | Observable; +} + +/** + * OnPreHandler Lifecycle hook + * + * @param {Request} request + * @param {Reply} reply + * @returns void | Observable + */ +export interface OnPreHandler { + onPreHandler(request: Request, reply?: ReplyWithContinue ): void | Observable; +} + +/** + * OnPostHandler Lifecycle hook + * + * @param {Request} request + * @param {Reply} reply + * @returns void | Observable + */ +export interface OnPostHandler { + onPostHandler(request: Request, reply?: ReplyWithContinue ): void | Observable; +} + +/** + * OnPreResponse Lifecycle hook + * + * @param {Request} request + * @param {Reply} reply + * @returns void | Observable + */ +export interface OnPreResponse { + onPreResponse(request: Request, reply?: ReplyWithContinue ): void | Observable; +} + +/** + * Request lifecycle component Hook + * + * @returns void | Observable + */ +export interface OnEvent { onEvent(request: Request, reply: ReplyWithContinue): void | Observable; } diff --git a/src-2/extensions/http-server/lifecycle.ts b/src-2/extensions/http-server/lifecycle.ts new file mode 100644 index 0000000..7d58522 --- /dev/null +++ b/src-2/extensions/http-server/lifecycle.ts @@ -0,0 +1,126 @@ +import { Observable } from 'rxjs'; +import { HookManager } from '../../core/hook'; +import { LifecycleEventsEnum, LifecycleHooksEnum } from './enums'; +import { RouteBuilder } from './route'; +import { CoreRoute } from './interfaces'; +import { errorHandler } from '../../core/hapiness'; +import { Request, ReplyWithContinue, Server } from 'hapi'; + +export class LifecycleManager { + + private static eventName = 'onEvent'; + + /** + * Initialize the lifecycle hooks + * for a route + * + * @param {MainModule} main + */ + static routeLifecycle(server: Server, routes: CoreRoute[]): void { + + server.ext(LifecycleEventsEnum.OnPreAuth.toString(), + (request: Request, reply: ReplyWithContinue) => + this.instantiateRoute(routes, request, reply) + .subscribe( + _ => reply.continue(), + _ => errorHandler(_) + ) + ); + + server.ext(LifecycleEventsEnum.OnPostAuth.toString(), + (request: Request, reply: ReplyWithContinue) => + this.eventHandler(LifecycleHooksEnum.OnPostAuth, routes, request, reply) + .subscribe( + _ => reply.continue(), + _ => errorHandler(_) + ) + ); + + server.ext(LifecycleEventsEnum.OnPreHandler.toString(), + (request: Request, reply: ReplyWithContinue) => + this.eventHandler(LifecycleHooksEnum.OnPostAuth, routes, request, reply) + .subscribe( + _ => reply.continue(), + _ => errorHandler(_) + ) + ); + + server.ext(LifecycleEventsEnum.OnPostHandler.toString(), + (request: Request, reply: ReplyWithContinue) => + this.eventHandler(LifecycleHooksEnum.OnPostAuth, routes, request, reply) + .subscribe( + _ => reply.continue(), + _ => errorHandler(_) + ) + ); + + server.ext(LifecycleEventsEnum.OnPostHandler.toString(), + (request: Request, reply: ReplyWithContinue) => + this.eventHandler(LifecycleHooksEnum.OnPostAuth, routes, request, reply) + .subscribe( + _ => reply.continue(), + _ => errorHandler(_), + () => request['_hapinessRoute'] = undefined + ) + ); + } + + /** + * Instantiate the route matching the request + * And trigger OnPreAuth hook + * + * @param {CoreRoute[]} routes + * @param {Request} request + * @param {ReplyWithContinue} reply + * @returns Observable + */ + private static instantiateRoute(routes: CoreRoute[], request: Request, reply: ReplyWithContinue): Observable { + return Observable + .of(routes) + .map(_ => this.findRoute(request, _)) + .filter(_ => !!(_ && _.token)) + .flatMap(_ => RouteBuilder.instantiateRouteAndDI(_, request)) + .do(_ => request['_hapinessRoute'] = _) + .flatMap(_ => this.eventHandler(LifecycleHooksEnum.OnPreAuth, routes, request, reply)) + } + + /** + * Find the matching route with + * path and method + * + * @param {Request} request + * @param {CoreRoute[]} routes + * @returns CoreRoute + */ + private static findRoute(request: Request, routes: CoreRoute[]): CoreRoute { + return routes + .find(r => ((r.method === request.route.method || r.method.indexOf(request.route.method) > -1) && + r.path === request.route.path)); + } + + /** + * Find the route and call + * the hook if the route component + * implements it + * + * @param {eRouteLifecycleHooks} event + * @param {MainModule} mainModule + * @param {} request + * @param {} reply + */ + private static eventHandler(hook: LifecycleHooksEnum, routes: CoreRoute[], + request: Request, reply: ReplyWithContinue): Observable { + + return Observable + .of(routes) + .map(_ => this.findRoute(request, _)) + .filter(_ => request['_hapinessRoute'] && HookManager.hasLifecycleHook(hook.toString(), _.token)) + .flatMap(_ => + HookManager + .triggerHook(hook.toString(), _.token, request['_hapinessRoute'], [request, reply]) + ) + .defaultIfEmpty(reply.continue()) + .filter(_ => !!_ && !_.statusCode && !_.headers && !_.source); + } + +} diff --git a/src-2/extensions/http-server/route.ts b/src-2/extensions/http-server/route.ts new file mode 100644 index 0000000..586f710 --- /dev/null +++ b/src-2/extensions/http-server/route.ts @@ -0,0 +1,103 @@ +import { CoreModule } from '../../core/interfaces'; +import { CoreRoute } from './interfaces'; +import { Observable } from 'rxjs'; +import { Type } from '../../core/decorators'; +import { Route } from './decorators'; +import { extractMetadataByDecorator } from '../../core/metadata'; +import { DependencyInjection } from '../../core/di'; +import { Request } from 'hapi'; + +interface InternalType { + route: Route; + token: Type; +} + +export class HttpRequestInfo {} + +export class RouteBuilder { + + /** + * Helper to extract metadata + * @property {string} decoratorName + */ + private static decoratorName = 'Route'; + + /** + * Entrypoint to build a CoreRoute + * Get the metadata and build the + * route instance + * + * @param {CoreModule} module + * @returns CoreRoute + */ + public static buildRoutes(module: CoreModule): Observable { + return Observable + .of(module) + .filter(_ => !!_) + .flatMap(_ => this.metadataFromDeclarations(_.declarations)) + .flatMap(_ => this.coreRouteFromMetadata(_.route, _.token, module)); + } + + /** + * Instantiate a new Route + * with its own DI/request + * + * @param {CoreRoute} route + * @param {Request} request + * @returns Observable + */ + public static instantiateRouteAndDI(route: CoreRoute, request: Request): Observable { + return Observable + .of(request) + .map(_ => ({ + query: Object.assign({}, request.query), + params: Object.assign({}, request.params), + headers: Object.assign({}, request.headers), + payload: Object.assign({}, request.payload) + })) + .map(_ => ({ provide: HttpRequestInfo, useValue: _ })) + .map(_ => [].concat(route.providers).concat(_)) + .flatMap(_ => DependencyInjection.createAndResolve(_, route.module.di)) + .flatMap(_ => DependencyInjection.instantiateComponent(route.token, _)); + } + + /** + * Transform metadata to instance CoreRoute + * + * @param {Route} data + * @returns CoreRoute + */ + private static coreRouteFromMetadata(data: Route, token: Type, module: CoreModule): Observable { + return Observable + .of(data) + .flatMap(_ => + Observable + .from([].concat(_.method)) + .map(__ => __.toLowerCase()) + .toArray() + .map(__ => ({ data: _, methods: __ })) + ) + .map(_ => ({ + token, + module, + config: _.data.config, + path: _.data.path, + method: _.methods, + providers: [] + })); + } + + /** + * Extract metadata filtered by route + * from the declarations provided + * + * @param {Type} declarations + * @returns Route + */ + private static metadataFromDeclarations(declarations: Type[]): Observable { + return Observable + .from([].concat(declarations)) + .filter(_ => !!_) + .map(_ => ({ token: _, route: extractMetadataByDecorator(_, this.decoratorName) })) + } +} From 5de4863cf17f2c0458e211e8a0fb20e0019ba405 Mon Sep 17 00:00:00 2001 From: Juneil Date: Sat, 19 Aug 2017 12:27:39 +0200 Subject: [PATCH 03/19] refactor(http-server, socket-server): third draft --- src-2/core/decorators.ts | 51 -- src-2/core/di.ts | 55 --- src-2/core/enums.ts | 20 - src-2/core/hook.ts | 53 --- src-2/core/metadata.ts | 46 -- src-2/core/module.ts | 281 ----------- src-2/extensions/http-server/README.md | 89 ---- src-2/extensions/http-server/decorators.ts | 22 - src-2/extensions/http-server/enums.ts | 47 -- src-2/extensions/http-server/extension.ts | 165 ------- src-2/extensions/http-server/index.ts | 6 - src-2/extensions/http-server/lifecycle.ts | 126 ----- src-2/extensions/http-server/route.ts | 103 ----- .../externals/injection-js/facade/errors.d.ts | 19 - src-2/externals/injection-js/facade/errors.js | 44 -- .../injection-js/facade/errors.js.map | 1 - src-2/externals/injection-js/facade/lang.d.ts | 47 -- src-2/externals/injection-js/facade/lang.js | 89 ---- .../externals/injection-js/facade/lang.js.map | 1 - src-2/externals/injection-js/facade/type.d.ts | 22 - src-2/externals/injection-js/facade/type.js | 24 - .../externals/injection-js/facade/type.js.map | 1 - src-2/externals/injection-js/forward_ref.d.ts | 38 -- src-2/externals/injection-js/forward_ref.js | 50 -- .../externals/injection-js/forward_ref.js.map | 1 - src-2/externals/injection-js/index.d.ts | 21 - src-2/externals/injection-js/index.js | 34 -- src-2/externals/injection-js/index.js.map | 1 - .../injection-js/injection.bundle.js | 38 -- .../injection-js/injection_token.d.ts | 62 --- .../externals/injection-js/injection_token.js | 76 --- .../injection-js/injection_token.js.map | 1 - src-2/externals/injection-js/injector.d.ts | 40 -- src-2/externals/injection-js/injector.js | 52 --- src-2/externals/injection-js/injector.js.map | 1 - src-2/externals/injection-js/metadata.d.ts | 265 ----------- src-2/externals/injection-js/metadata.js | 52 --- src-2/externals/injection-js/metadata.js.map | 1 - src-2/externals/injection-js/package.json | 23 - src-2/externals/injection-js/provider.d.ts | 204 -------- src-2/externals/injection-js/provider.js | 9 - src-2/externals/injection-js/provider.js.map | 1 - .../platform_reflection_capabilities.d.ts | 26 -- .../platform_reflection_capabilities.js | 9 - .../platform_reflection_capabilities.js.map | 1 - .../injection-js/reflection/reflection.d.ts | 7 - .../injection-js/reflection/reflection.js | 18 - .../injection-js/reflection/reflection.js.map | 1 - .../reflection/reflection_capabilities.d.ts | 29 -- .../reflection/reflection_capabilities.js | 234 ---------- .../reflection/reflection_capabilities.js.map | 1 - .../injection-js/reflection/reflector.d.ts | 36 -- .../injection-js/reflection/reflector.js | 53 --- .../injection-js/reflection/reflector.js.map | 1 - .../reflection/reflector_reader.d.ts | 22 - .../reflection/reflector_reader.js | 19 - .../reflection/reflector_reader.js.map | 1 - .../injection-js/reflection/types.d.ts | 10 - .../injection-js/reflection/types.js | 9 - .../injection-js/reflection/types.js.map | 1 - .../injection-js/reflective_errors.d.ts | 138 ------ .../injection-js/reflective_errors.js | 217 --------- .../injection-js/reflective_errors.js.map | 1 - .../injection-js/reflective_injector.d.ts | 275 ----------- .../injection-js/reflective_injector.js | 341 -------------- .../injection-js/reflective_injector.js.map | 1 - .../injection-js/reflective_key.d.ts | 36 -- .../externals/injection-js/reflective_key.js | 89 ---- .../injection-js/reflective_key.js.map | 1 - .../injection-js/reflective_provider.d.ts | 88 ---- .../injection-js/reflective_provider.js | 225 --------- .../injection-js/reflective_provider.js.map | 1 - .../injection-js/util/decorators.d.ts | 162 ------- .../externals/injection-js/util/decorators.js | 291 ------------ .../injection-js/util/decorators.js.map | 1 - src/core/bootstrap.ts | 135 ------ src/core/di.ts | 43 +- src/core/enums.ts | 10 + {src-2 => src}/core/hapiness.ts | 8 +- src/core/hook.ts | 95 ++-- src/core/index.ts | 7 - {src-2 => src}/core/interfaces/extension.ts | 2 +- {src-2 => src}/core/interfaces/index.ts | 0 {src-2 => src}/core/interfaces/module.ts | 0 {src-2 => src}/core/logger.ts | 0 src/core/metadata.ts | 2 +- src/core/module.ts | 436 +++++++++--------- src/extensions/http-server/decorators.ts | 6 +- src/extensions/http-server/extension.ts | 259 +++++------ src/extensions/http-server/index.ts | 1 + .../extensions/http-server/interfaces.ts | 0 src/extensions/http-server/lifecycle.ts | 130 ++++-- src/extensions/http-server/route.ts | 249 +++------- src/extensions/socket-server/extension.ts | 19 +- src/index.ts | 9 - test-2/mocha.opts | 7 - test/integration/core.test.ts | 226 --------- test/integration/http-server.test.ts | 254 ---------- test/integration/socket-server.test.ts | 62 --- test/unit/bootstrap.unit.ts | 173 ------- test/unit/di.unit.ts | 74 --- test/unit/hook.unit.ts | 80 ---- test/unit/http-server/enums.unit.ts | 27 -- {test-2 => test}/unit/metadata.test.ts | 0 test/unit/metadata.unit.ts | 30 -- {test-2 => test}/unit/mocks.ts | 0 {test-2 => test}/unit/module.test.ts | 0 test/unit/module.unit.ts | 153 ------ 108 files changed, 572 insertions(+), 6552 deletions(-) delete mode 100644 src-2/core/decorators.ts delete mode 100644 src-2/core/di.ts delete mode 100644 src-2/core/enums.ts delete mode 100644 src-2/core/hook.ts delete mode 100644 src-2/core/metadata.ts delete mode 100644 src-2/core/module.ts delete mode 100644 src-2/extensions/http-server/README.md delete mode 100644 src-2/extensions/http-server/decorators.ts delete mode 100644 src-2/extensions/http-server/enums.ts delete mode 100644 src-2/extensions/http-server/extension.ts delete mode 100644 src-2/extensions/http-server/index.ts delete mode 100644 src-2/extensions/http-server/lifecycle.ts delete mode 100644 src-2/extensions/http-server/route.ts delete mode 100644 src-2/externals/injection-js/facade/errors.d.ts delete mode 100644 src-2/externals/injection-js/facade/errors.js delete mode 100644 src-2/externals/injection-js/facade/errors.js.map delete mode 100644 src-2/externals/injection-js/facade/lang.d.ts delete mode 100644 src-2/externals/injection-js/facade/lang.js delete mode 100644 src-2/externals/injection-js/facade/lang.js.map delete mode 100644 src-2/externals/injection-js/facade/type.d.ts delete mode 100644 src-2/externals/injection-js/facade/type.js delete mode 100644 src-2/externals/injection-js/facade/type.js.map delete mode 100644 src-2/externals/injection-js/forward_ref.d.ts delete mode 100644 src-2/externals/injection-js/forward_ref.js delete mode 100644 src-2/externals/injection-js/forward_ref.js.map delete mode 100644 src-2/externals/injection-js/index.d.ts delete mode 100644 src-2/externals/injection-js/index.js delete mode 100644 src-2/externals/injection-js/index.js.map delete mode 100644 src-2/externals/injection-js/injection.bundle.js delete mode 100644 src-2/externals/injection-js/injection_token.d.ts delete mode 100644 src-2/externals/injection-js/injection_token.js delete mode 100644 src-2/externals/injection-js/injection_token.js.map delete mode 100644 src-2/externals/injection-js/injector.d.ts delete mode 100644 src-2/externals/injection-js/injector.js delete mode 100644 src-2/externals/injection-js/injector.js.map delete mode 100644 src-2/externals/injection-js/metadata.d.ts delete mode 100644 src-2/externals/injection-js/metadata.js delete mode 100644 src-2/externals/injection-js/metadata.js.map delete mode 100644 src-2/externals/injection-js/package.json delete mode 100644 src-2/externals/injection-js/provider.d.ts delete mode 100644 src-2/externals/injection-js/provider.js delete mode 100644 src-2/externals/injection-js/provider.js.map delete mode 100644 src-2/externals/injection-js/reflection/platform_reflection_capabilities.d.ts delete mode 100644 src-2/externals/injection-js/reflection/platform_reflection_capabilities.js delete mode 100644 src-2/externals/injection-js/reflection/platform_reflection_capabilities.js.map delete mode 100644 src-2/externals/injection-js/reflection/reflection.d.ts delete mode 100644 src-2/externals/injection-js/reflection/reflection.js delete mode 100644 src-2/externals/injection-js/reflection/reflection.js.map delete mode 100644 src-2/externals/injection-js/reflection/reflection_capabilities.d.ts delete mode 100644 src-2/externals/injection-js/reflection/reflection_capabilities.js delete mode 100644 src-2/externals/injection-js/reflection/reflection_capabilities.js.map delete mode 100644 src-2/externals/injection-js/reflection/reflector.d.ts delete mode 100644 src-2/externals/injection-js/reflection/reflector.js delete mode 100644 src-2/externals/injection-js/reflection/reflector.js.map delete mode 100644 src-2/externals/injection-js/reflection/reflector_reader.d.ts delete mode 100644 src-2/externals/injection-js/reflection/reflector_reader.js delete mode 100644 src-2/externals/injection-js/reflection/reflector_reader.js.map delete mode 100644 src-2/externals/injection-js/reflection/types.d.ts delete mode 100644 src-2/externals/injection-js/reflection/types.js delete mode 100644 src-2/externals/injection-js/reflection/types.js.map delete mode 100644 src-2/externals/injection-js/reflective_errors.d.ts delete mode 100644 src-2/externals/injection-js/reflective_errors.js delete mode 100644 src-2/externals/injection-js/reflective_errors.js.map delete mode 100644 src-2/externals/injection-js/reflective_injector.d.ts delete mode 100644 src-2/externals/injection-js/reflective_injector.js delete mode 100644 src-2/externals/injection-js/reflective_injector.js.map delete mode 100644 src-2/externals/injection-js/reflective_key.d.ts delete mode 100644 src-2/externals/injection-js/reflective_key.js delete mode 100644 src-2/externals/injection-js/reflective_key.js.map delete mode 100644 src-2/externals/injection-js/reflective_provider.d.ts delete mode 100644 src-2/externals/injection-js/reflective_provider.js delete mode 100644 src-2/externals/injection-js/reflective_provider.js.map delete mode 100644 src-2/externals/injection-js/util/decorators.d.ts delete mode 100644 src-2/externals/injection-js/util/decorators.js delete mode 100644 src-2/externals/injection-js/util/decorators.js.map delete mode 100644 src/core/bootstrap.ts rename {src-2 => src}/core/hapiness.ts (97%) delete mode 100644 src/core/index.ts rename {src-2 => src}/core/interfaces/extension.ts (92%) rename {src-2 => src}/core/interfaces/index.ts (100%) rename {src-2 => src}/core/interfaces/module.ts (100%) rename {src-2 => src}/core/logger.ts (100%) rename {src-2 => src}/extensions/http-server/interfaces.ts (100%) delete mode 100644 src/index.ts delete mode 100644 test-2/mocha.opts delete mode 100644 test/integration/core.test.ts delete mode 100644 test/integration/http-server.test.ts delete mode 100644 test/integration/socket-server.test.ts delete mode 100644 test/unit/bootstrap.unit.ts delete mode 100644 test/unit/di.unit.ts delete mode 100644 test/unit/hook.unit.ts delete mode 100644 test/unit/http-server/enums.unit.ts rename {test-2 => test}/unit/metadata.test.ts (100%) delete mode 100644 test/unit/metadata.unit.ts rename {test-2 => test}/unit/mocks.ts (100%) rename {test-2 => test}/unit/module.test.ts (100%) delete mode 100644 test/unit/module.unit.ts diff --git a/src-2/core/decorators.ts b/src-2/core/decorators.ts deleted file mode 100644 index 17abc27..0000000 --- a/src-2/core/decorators.ts +++ /dev/null @@ -1,51 +0,0 @@ -import { TypeDecorator, makeDecorator } from '../externals/injection-js/util/decorators'; -import { Type } from '../externals/injection-js/facade/type'; -import { Inject, Injectable, InjectionToken, Optional } from '../externals/injection-js'; -export { Injectable, Inject, Optional, InjectionToken, Type, makeDecorator }; - -/** - * Decorator signature - */ -export interface CoreDecorator { - (obj: T): TypeDecorator; - new (obj: T): T -} - -/** - * Create a decorator with metadata - * - * @param {string} name - * @param {{[name:string]:any;}} props? - * @returns CoreDecorator - */ -export function createDecorator(name: string, props?: { [name: string]: any; }): CoreDecorator { - return >makeDecorator(name, props); -} - -/** - * HapinessModule decorator and metadata. - * - * @Annotation - */ -export interface HapinessModule { - version: string; - declarations?: Array|any>; - providers?: Array|any>; - imports?: Array|any>; - exports?: Array|any>; -} -export const HapinessModule = createDecorator('HapinessModule', { - version: undefined, - declarations: undefined, - providers: undefined, - imports: undefined, - exports: undefined -}); - -/** - * Lib decorator and metadata. - * - * @Annotation - */ -export interface Lib {} -export const Lib = makeDecorator('Lib', null); diff --git a/src-2/core/di.ts b/src-2/core/di.ts deleted file mode 100644 index db17bcc..0000000 --- a/src-2/core/di.ts +++ /dev/null @@ -1,55 +0,0 @@ -import { ReflectiveInjector } from '../externals/injection-js'; -import { Type } from '../externals/injection-js/facade/type'; -import { - ReflectiveDependency, - ResolvedReflectiveProvider, - ResolvedReflectiveFactory -} from '../externals/injection-js/reflective_provider'; -import { CoreProvide } from './interfaces'; -import { InternalLogger } from './logger'; -import { Observable } from 'rxjs'; - -export class DependencyInjection { - - private static logger = new InternalLogger('di'); - - /** - * Create a new DI and - * can inherits from a parent DI - * - * @param {Type[]} providers - * @param {ReflectiveInjector} parent? - * @returns Observable - */ - static createAndResolve(providers: Type[] | CoreProvide[], parent?: ReflectiveInjector): Observable { - return Observable - .of(parent) - .map(_ => !!_ ? - parent.resolveAndCreateChild(providers) : - ReflectiveInjector.resolveAndCreate(providers) - ) - .do(_ => this.logger.debug(`DI created, providers: ${providers.length}`)); - } - - /** - * Instanciate a component - * resolving its dependencies - * without inject the component - * into the DI - * - * @param {Type} component - * @param {ReflectiveInjector} di - * @returns T - */ - static instantiateComponent(component: Type, di: ReflectiveInjector): Observable { - return Observable - .from(ReflectiveInjector.resolve([component])) - .reduce((a, x: ResolvedReflectiveProvider) => a.concat(x.resolvedFactories), []) - .map(_ => _.reduce((a, r: ResolvedReflectiveFactory) => a.concat(r.dependencies), [])) - .map(_ => _.filter(__ => !!__)) - .do(_ => this.logger.debug(`Component '${component.name}' deps: ${_.length}`)) - .map(_ => _.map(d => di['_getByReflectiveDependency'](d))) - .map(_ => Reflect.construct(component, _)); - } - -} diff --git a/src-2/core/enums.ts b/src-2/core/enums.ts deleted file mode 100644 index c64430d..0000000 --- a/src-2/core/enums.ts +++ /dev/null @@ -1,20 +0,0 @@ -export enum ExtentionHooksEnum { - OnExtensionLoad = 'onExtensionLoad', - OnModuleInstantiated = 'onModuleInstantiated' -} - -export enum ModuleEnum { - OnStart = 'onStart', - OnError = 'onError', - OnRegister = 'onRegister' -} - -/** - * Represents the position where - * the module is instantiate - */ -export enum ModuleLevel { - ROOT, - PRIMARY, - SECONDARY -} diff --git a/src-2/core/hook.ts b/src-2/core/hook.ts deleted file mode 100644 index 86236f6..0000000 --- a/src-2/core/hook.ts +++ /dev/null @@ -1,53 +0,0 @@ -import { reflector } from '../externals/injection-js/reflection/reflection'; -import { Observable } from 'rxjs'; -import { Type } from './decorators'; -import { InternalLogger } from './logger'; - -export class HookManager { - - private static logger = new InternalLogger('hook'); - - /** - * Check if a token has a hook implemented - * - * @param {string} hook - * @param {Type} token - * @returns boolean - */ - public static hasLifecycleHook(hook: string, token: Type): boolean { - return reflector.hasLifecycleHook(token, hook); - } - - /** - * Trigger the hook if - * it is implemented - * - * @param {string} hook - * @param {Type} token - * @param {T} instance - * @param {any[]} args - * @param {boolean} throwErr - * @returns Observable - */ - public static triggerHook(hook: string, token: Type, instance: T, args?: any[], throwErr?: boolean): Observable { - this.logger.debug(`Triggering hook '${hook}' on '${token ? token.name : null}'`); - return Observable - .merge( - Observable - .of(this.hasLifecycleHook(hook, token)) - .filter(_ => !!_) - .map(_ => Reflect.apply(instance[hook], instance, args || [])) - .flatMap(_ => - (_ instanceof Observable) ? - _ : !!_ ? - Observable.of(_) : - Observable.empty() - ), - - Observable - .of(this.hasLifecycleHook(hook, token)) - .filter(_ => !_ && throwErr) - .flatMap(_ => Observable.throw(new Error(`Hook missing ${hook} on ${token ? token.name : null}`))) - ) - } -} diff --git a/src-2/core/metadata.ts b/src-2/core/metadata.ts deleted file mode 100644 index 5c7cb9b..0000000 --- a/src-2/core/metadata.ts +++ /dev/null @@ -1,46 +0,0 @@ -import 'reflect-metadata'; -import * as Debug from 'debug'; -const debug = Debug('hapiness:metadata'); - -/** - * Helper to extract Metadata - * from a decorator - * - * @todo Filter with the right type - * @param {any} type - * @returns any - */ -export function extractMetadata(type: any): any { - return extractMetadatas(type) - .pop(); -}; - -/** - * Helper to extract Metadata - * with the decorator name provided - * - * @param {any} type - * @param {string} name - */ -export function extractMetadataByDecorator(type: any, name: string): T { - return extractMetadatas(type) - .filter(x => x.toString().slice(1) === name) - .map(x => x) - .pop(); -} - -/** - * Helper to extract Metadata - * from a decorator - * - * @todo Filter with the right type - * @param {any} decorator - * @returns [] - */ -export function extractMetadatas(decorator: any): any[] { - return Reflect.getOwnMetadataKeys(decorator) - .filter(x => x === 'annotations') - .map(x => Reflect.getOwnMetadata(x, decorator)) - .map(x => [].concat(x)) - .pop() || []; -}; diff --git a/src-2/core/module.ts b/src-2/core/module.ts deleted file mode 100644 index 751e13c..0000000 --- a/src-2/core/module.ts +++ /dev/null @@ -1,281 +0,0 @@ -import { Observable } from 'rxjs'; -import { InternalLogger } from './logger'; -import { extractMetadataByDecorator } from './metadata'; -import { HapinessModule, Type, InjectionToken } from './decorators'; -import { CoreModule, CoreProvide, CoreModuleWithProviders } from './interfaces'; -import { DependencyInjection } from './di'; -import { ModuleLevel } from './enums'; - -export class ModuleManager { - - private static decoratorName = 'HapinessModule'; - - private static logger = new InternalLogger('module'); - - /** - * Resolve into a tree of CoreModule - * - * @param {any} module - * @returns Observable - */ - static resolve(module: any): Observable { - this.logger.debug(`Resolving module '${module.name}'`); - return this.resolution(module); - } - - static instantiate(module: CoreModule, providers?: CoreProvide[]): Observable { - this.logger.debug(`Instantiation of module '${module.name}'`); - return this.instantiation(module, providers); - } - - /** - * Get all the tree modules - * - * @param {CoreModule} module - * @returns CoreModule - */ - static getModules(module: CoreModule): CoreModule[] { - const lookup = (_module: CoreModule) => { - return [] - .concat(_module) - .concat([] - .concat(_module.modules) - .filter(_ => !!_) - .map(m => lookup(m)) - .reduce((a, c) => a.concat(c), []) - ); - }; - return lookup(module); - } - - /** - * Helper to convert provider - * to a CoreProvide type - * - * @param {any} provider - * @returns CoreProvide - */ - static toCoreProvider(provider: any): CoreProvide { - return (!!provider.provide ? - provider : - { provide: provider, useClass: provider } - ); - } - - /** - * =========================================================================== - * - * MODULE RESOLUTION - * - * =========================================================================== - */ - - /** - * Process module to CoreModule type - * from metadata and the children - * - * @param {any} module - * @param {CoreModule} parent? - * @returns Observable - */ - private static resolution(module: any, parent?: CoreModule): Observable { - return Observable - .of(module) - .map(_ => this.toCoreModuleWithProviders(_)) - .flatMap(cmwp => - this - .extractMetadata(cmwp.module) - .map(_ => ({ metadata: _, moduleWithProviders: cmwp })) - ) - .flatMap(mcmwp => - this - .metadataToCoreModule(mcmwp.metadata, mcmwp.moduleWithProviders, parent) - .map(_ => this.coreModuleParentConfigProviders(_)) - .map(_ => Object.assign({ module: _ }, mcmwp)) - ) - .flatMap(data => - Observable - .from(data.metadata.imports || []) - .flatMap(_ => this.resolution(_, data.module)) - .toArray() - .do(_ => this.logger.debug(`'${data.module.name}' got ${_.length} children`)) - .map(_ => Object.assign({ modules: _ }, data.module)) - ) - } - - /** - * FIX for exported providers - * that need internal config - * - * @todo find a better solution - * @param {CoreModule} module - * @returns CoreModule - */ - private static coreModuleParentConfigProviders(module: CoreModule): CoreModule { - module.providers = [] - .concat(module.providers) - .concat((module.parent && module.parent.providers) ? - module.parent.providers.filter(_ => (_.provide instanceof InjectionToken)) : - [] - ) - .filter(_ => !!_); - return module; - } - - /** - * Convert metadata to CoreModule type - * - * @param {HapinessModule} metadata - * @param {CoreModuleWithProviders} moduleWithProviders - * @param {CoreModule} parent? - * @returns Observable - */ - private static metadataToCoreModule( - metadata: HapinessModule, - moduleWithProviders: CoreModuleWithProviders, - parent?: CoreModule): Observable { - - return Observable - .of({ - parent, - token: moduleWithProviders.module, - name: moduleWithProviders.module.name, - version: metadata.version, - exports: metadata.exports || [], - declarations: metadata.declarations || [], - providers: (metadata.providers || []) - .concat(moduleWithProviders.providers) - .map(_ => this.toCoreProvider(_)), - level: !!parent ? - parent.level === ModuleLevel.ROOT ? - ModuleLevel.PRIMARY : - ModuleLevel.SECONDARY : - ModuleLevel.ROOT - }) - .do(_ => this.logger.debug(`Build CoreModule for '${_.name}'`)); - } - - /** - * Get HapinessModule metadata type - * if does not exist, throw an error - * - * @param {Type} module - * @returns Observable - */ - private static extractMetadata(module: Type): Observable { - return Observable - .of(extractMetadataByDecorator(module, this.decoratorName)) - .flatMap(_ => !!_ ? - Observable.of(_) : - Observable.throw(new Error(`Module '${module ? module.name : null}' resolution failed: No metadata`)) - ) - } - - /** - * Make sure to convert module into - * a CoreModuleWithProviders type - * - * @param {CoreModuleWithProviders|Type} module - * @returns CoreModuleWithProviders - */ - private static toCoreModuleWithProviders(module: CoreModuleWithProviders | Type): CoreModuleWithProviders { - return ((module && module['module']) ? - module : - { - module, - providers: [] - }); - } - - /** - * =========================================================================== - * - * MODULE INSTANTIATION - * - * =========================================================================== - */ - - /** - * Create the module's DI - * and instantiate the module - * - * @param {CoreModule} module - * @param {CoreProvide[]} providers? - * @param {CoreModule} parent? - * @returns Observable - */ - private static instantiation(module: CoreModule, providers?: CoreProvide[], parent?: CoreModule): Observable { - return Observable - .of(module) - .flatMap(_ => - Observable - .from(_.modules) - .flatMap(child => this.instantiation(child, providers, parent)) - .toArray() - .map(children => Object.assign({}, _, { modules: children })) - ) - .flatMap(_ => - DependencyInjection - .createAndResolve(this.collectProviders(_, providers)) - .map(di => Object.assign({ di }, _)) - ) - .flatMap(_ => - DependencyInjection - .instantiateComponent(_.token, _.di) - .map(instance => Object.assign({ instance }, _)) - ) - .flatMap(_ => this.instantiateLibs(_)); - } - - /** - * Instantiate and return array of libs - * - * @param {CoreModule} module - * @returns Type - */ - private static instantiateLibs(module: CoreModule): Observable { - return Observable - .from(module.declarations) - .filter(_ => !!extractMetadataByDecorator(_, 'Lib')) - .flatMap(_ => DependencyInjection.instantiateComponent(_, module.di)) - .toArray() - .map(_ => module); - } - - /** - * Collect all providers to - * inject into the DI - * - * @param {HapinessModule} module - */ - private static collectProviders(module: CoreModule, providers?: CoreProvide[]): CoreProvide[] { - this.logger.debug(`Collect providers for '${module.name}'`); - return [] - .concat(module.providers) - .concat(providers) - .filter(_ => !!_) - .concat(this.extractExportedProviders(module)); - } - - /** - * Extract exported children providers - * - * @param {CoreModule} module - * @returns CoreProvide[] - */ - private static extractExportedProviders(module: CoreModule): CoreProvide[] { - this.logger.debug(`Extract exported children providers for '${module.name}'`); - return [] - .concat(module.modules) - .filter(_ => (!!_.exports && _.exports.length > 0)) - .map(_ => [] - .concat(_.exports) - .concat( - _.providers - .filter(__ => (__.provide instanceof InjectionToken))) - ) - .reduce((a, c) => a.concat(c), []) - .filter(_ => !!_) - .map(_ => this.toCoreProvider(_)); - } -} diff --git a/src-2/extensions/http-server/README.md b/src-2/extensions/http-server/README.md deleted file mode 100644 index 13a8858..0000000 --- a/src-2/extensions/http-server/README.md +++ /dev/null @@ -1,89 +0,0 @@ -# HTTP Server Extension - -The extension is based on HapiJS - -## Usage - -```javascript - Hapiness.bootstrap(Module, - [ - HttpServerExt.setConfig({...}) - ] - ); -``` - -Configuration - [HapiJS Connection options](https://hapijs.com/api#serverconnectionoptions) - -## Extension provider - -```javascript - ... - constructor(@Inject(HttpServerExt) private server: Server) {} - ... -``` -Allow to get the hapi server instance - -## Route -Declare HTTP routes - -```javascript - @Route({metadata}) - class MyClass {} -``` - -- metadata - - - `path` - route path (/my/path) - - `method` - can be an array, values: (get, post, put, delete, patch, options) - - `config` - partially implemented, see [HapiJS Route config](https://hapijs.com/api#route-configuration) - - `providers` - Providers to add in the request DI, it means at each request a new instance of the provider will be created - -- interfaces - - see request and reply on [HapiJS Docs](https://hapijs.com/api#requests) - - `OnGet` - Http Get handler - - arguments: (request, reply) - - `OnPost` - Http Post handler - - arguments: (request, reply) - - `OnPut` - Http Put handler - - arguments: (request, reply) - - `OnDelete` - Http Delete handler - - arguments: (request, reply) - - `OnPatch` - Http Patch handler - - arguments: (request, reply) - - `OnOptions` - Http Options handler - - arguments: (request, reply) - - `OnPreAuth` - Request lifecycle handler - - arguments: (request, reply) - - `OnPostAuth` - Request lifecycle handler - - arguments: (request, reply) - - `OnPreHandler` - Request lifecycle handler - - arguments: (request, reply) - - `OnPostHandler` - Request lifecycle handler - - arguments: (request, reply) - - `OnPreResponse` - Request lifecycle handler - - arguments: (request, reply) - -## Lifecycle - -Request lifecycle component - -```javascript - @Lifecycle({ - event: 'onPreAuth' - }) -    class MyHook implements OnEvent { - onEvent(request, reply) { - ... - } - } -``` - -- metadata - - - `event` - request lifecycle event, see [HapiJS Request lifecycle](https://hapijs.com/api#request-lifecycle) - events: (onPreAuth, onPostAuth, onPreHandler, onPostHandler, onPreResponse) - -- interfaces - - - see request and reply on [HapiJS Docs](https://hapijs.com/api#requests) - - `OnEvent` - Lifecycle handler \ No newline at end of file diff --git a/src-2/extensions/http-server/decorators.ts b/src-2/extensions/http-server/decorators.ts deleted file mode 100644 index aa796b8..0000000 --- a/src-2/extensions/http-server/decorators.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { createDecorator, CoreDecorator, Type } from '../../core/decorators'; -import { RouteConfig } from './route'; - -export interface Route { - path: string; - method: string | string[]; - config?: RouteConfig; - // providers?: Array|any>; -} -export const Route = createDecorator('Route', { - path: undefined, - method: undefined, - config: undefined - // providers: undefined -}); - -export interface Lifecycle { - event: string; -} -export const Lifecycle = createDecorator('Lifecycle', { - event: undefined -}); diff --git a/src-2/extensions/http-server/enums.ts b/src-2/extensions/http-server/enums.ts deleted file mode 100644 index 0f70474..0000000 --- a/src-2/extensions/http-server/enums.ts +++ /dev/null @@ -1,47 +0,0 @@ -export enum LifecycleHooksEnum { - OnPreAuth = 'onPreAuth', - OnPostAuth = 'onPostAuth', - OnPreHandler = 'onPreHandler', - OnPostHandler = 'onPostHandler', - OnPreResponse = 'onPreResponse' -} - -export enum LifecycleEventsEnum { - OnPreAuth = 'onPreAuth', - OnPostAuth = 'onPostAuth', - OnPreHandler = 'onPreHandler', - OnPostHandler = 'onPostHandler', - OnPreResponse = 'onPreResponse' -} - -export enum LifecycleComponentEnum { - OnEvent = 'onEvent' -} - -export enum RouteMethodsEnum { - OnGet = 'onGet', - OnPost = 'onPost', - OnPut = 'onPut', - OnDelete = 'onDelete', - OnPatch = 'onPatch', - OnOptions = 'onOptions' -} - -export function enumByMethod(method: string): RouteMethodsEnum { - switch (method) { - case 'get': - return RouteMethodsEnum.OnGet; - case 'post': - return RouteMethodsEnum.OnPost; - case 'put': - return RouteMethodsEnum.OnPut; - case 'patch': - return RouteMethodsEnum.OnPatch; - case 'options': - return RouteMethodsEnum.OnOptions; - case 'delete': - return RouteMethodsEnum.OnDelete; - default: - throw new Error('Method does not exist'); - } -} diff --git a/src-2/extensions/http-server/extension.ts b/src-2/extensions/http-server/extension.ts deleted file mode 100644 index 90e3bc5..0000000 --- a/src-2/extensions/http-server/extension.ts +++ /dev/null @@ -1,165 +0,0 @@ -import { ModuleLevel } from '../../core/enums'; -import { DependencyInjection } from '../../core/di'; -import { HookManager } from '../../core/hook'; -import { extractMetadataByDecorator } from '../../core/metadata'; -import { ModuleManager } from '../../core/module'; -import { errorHandler } from '../../core/hapiness'; -import { CoreModule, OnExtensionLoad, OnModuleInstantiated, ExtensionWithConfig, Extension } from '../../core/interfaces'; -import { Lifecycle } from './decorators'; -import { Type } from '../../core/decorators'; -import { enumByMethod, LifecycleComponentEnum } from './enums'; -import { LifecycleManager } from './lifecycle'; -import { RouteBuilder } from './route'; -import { CoreRoute, HapiConfig } from './interfaces'; -import { Observable } from 'rxjs'; -import { RouteConfiguration, Server, Request, ReplyNoContinue, ReplyWithContinue } from 'hapi'; - -export class HttpServerExt implements OnExtensionLoad, OnModuleInstantiated { - - private server: Server; - - public static setConfig(config: HapiConfig): ExtensionWithConfig { - return { - token: HttpServerExt, - config - }; - } - - onExtensionLoad(module: CoreModule, config: HapiConfig): Observable { - return Observable - .of(new Server(config.options)) - .do(_ => _.connection({ host: config.host, port: config.port })) - .flatMap(server => - Observable - .from(ModuleManager.getModules(module)) - ) - } - - /** - * Register a HapiJS Plugin - * - * @param {CoreModule} module - * @param {Server} server - * @returns Observable - */ - private registerPlugin(module: CoreModule, server: Server): Observable { - return Observable - .of(_ => (s, o, n) => n()) - .do(_ => _['attributes'] = { - name: `${module.name}.hapinessplugin`, - version: module.version - }) - .flatMap(_ => Observable.fromPromise(server.register(_))) - .flatMap(_ => this.addRoutes(module, server)); - } - - /** - * Add route from CoreModule - * - * @param {CoreModule} module - * @param {Server} server - * @returns Observable - */ - private addRoutes(module: CoreModule, server: Server): Observable { - return Observable - .from(RouteBuilder.buildRoutes(module)) - .do(_ => - server - .route({ - method: _.method, - path: _.path, - config: Object.assign({ - handler: (request, reply) => this.httpHandler(request, reply, _) - }, _.config) - }) - ) - .toArray(); - } - - private httpHandler(request: Request, reply: ReplyNoContinue, route: CoreRoute): void { - HookManager - .triggerHook( - enumByMethod(request.method).toString(), - route.token, - request['_hapinessRoute'], - [ request, reply ] - ) - .map(_ => !!_.statusCode ? _ : { statusCode: 200, response: _ }) - .subscribe( - _ => - reply(_.response) - .code(!!_.response ? _.statusCode : 204), - _ => { - errorHandler(_); - reply(_); - } - ); - } - - /** - * Initialize and instantiate lifecycle components - * - * @param {CoreModule} module - * @param {Server} server - */ - private instantiateLifecycle(module: CoreModule, server: Server) { - return Observable - .from([].concat(module.declarations)) - .filter(_ => !!_ && !!extractMetadataByDecorator(_, 'Lifecycle')) - .map(_ => extractMetadataByDecorator(_, 'Lifecycle')) - .do(_ => - server.ext(_.event, (request, reply) => { - - }) - ) - - - // ModuleManager.getModules(module).forEach(_module => { - // [].concat(_module.declarations).filter(decl => !!extractMetadataByDecorator(decl, 'Lifecycle')) - // .map(lc => { - // debug('add lifecycle', lc.name, _module.token.name); - // const metadata = extractMetadataByDecorator(lc, 'Lifecycle'); - // server.ext(metadata.event, (request, reply) => { - // const instance = DependencyInjection.instantiateComponent(lc, _module.di); - // HookManager.triggerHook(LifecycleComponentEnum.OnEvent.toString(), lc, instance, [ request, reply ]); - // }); - // }); - // }); - } - - private eventHandler(lifecycle: Type, module: CoreModule, request: Request, reply: ReplyWithContinue): Observable { - return Observable - .of(lifecycle) - .flatMap(lc => - DependencyInjection - .instantiateComponent(lc, module.di) - .flatMap(_ => - HookManager - .triggerHook(LifecycleComponentEnum.OnEvent.toString(), lc, _, [request, reply]) - ) - ) - } - - /** - * this.server = new Server(); - const connection = this.server.connection(config); - debug('server instantiation'); - return Observable.create(observer => { - Observable.forkJoin( - this.registrationObservables(module, this.server, this.flattenModules(module)).concat(this.addRoutes(module, this.server)) - ).subscribe(routes => { - debug('routes and plugins registered'); - LifecycleManager.routeLifecycle(this.server, routes.reduce((a, c) => a.concat(c), [])); - observer.next({ - instance: this, - token: HttpServerExt, - value: this.server - }); - observer.complete(); - }, err => { - observer.error(err); - observer.complete(); - }); - }); - */ -} diff --git a/src-2/extensions/http-server/index.ts b/src-2/extensions/http-server/index.ts deleted file mode 100644 index 807332a..0000000 --- a/src-2/extensions/http-server/index.ts +++ /dev/null @@ -1,6 +0,0 @@ -export * from './extension'; -export * from './decorators'; -export * from './lifecycle'; -export * from './route'; -export * from './interfaces'; -export { Server, Request, ReplyNoContinue, ReplyWithContinue } from 'hapi'; diff --git a/src-2/extensions/http-server/lifecycle.ts b/src-2/extensions/http-server/lifecycle.ts deleted file mode 100644 index 7d58522..0000000 --- a/src-2/extensions/http-server/lifecycle.ts +++ /dev/null @@ -1,126 +0,0 @@ -import { Observable } from 'rxjs'; -import { HookManager } from '../../core/hook'; -import { LifecycleEventsEnum, LifecycleHooksEnum } from './enums'; -import { RouteBuilder } from './route'; -import { CoreRoute } from './interfaces'; -import { errorHandler } from '../../core/hapiness'; -import { Request, ReplyWithContinue, Server } from 'hapi'; - -export class LifecycleManager { - - private static eventName = 'onEvent'; - - /** - * Initialize the lifecycle hooks - * for a route - * - * @param {MainModule} main - */ - static routeLifecycle(server: Server, routes: CoreRoute[]): void { - - server.ext(LifecycleEventsEnum.OnPreAuth.toString(), - (request: Request, reply: ReplyWithContinue) => - this.instantiateRoute(routes, request, reply) - .subscribe( - _ => reply.continue(), - _ => errorHandler(_) - ) - ); - - server.ext(LifecycleEventsEnum.OnPostAuth.toString(), - (request: Request, reply: ReplyWithContinue) => - this.eventHandler(LifecycleHooksEnum.OnPostAuth, routes, request, reply) - .subscribe( - _ => reply.continue(), - _ => errorHandler(_) - ) - ); - - server.ext(LifecycleEventsEnum.OnPreHandler.toString(), - (request: Request, reply: ReplyWithContinue) => - this.eventHandler(LifecycleHooksEnum.OnPostAuth, routes, request, reply) - .subscribe( - _ => reply.continue(), - _ => errorHandler(_) - ) - ); - - server.ext(LifecycleEventsEnum.OnPostHandler.toString(), - (request: Request, reply: ReplyWithContinue) => - this.eventHandler(LifecycleHooksEnum.OnPostAuth, routes, request, reply) - .subscribe( - _ => reply.continue(), - _ => errorHandler(_) - ) - ); - - server.ext(LifecycleEventsEnum.OnPostHandler.toString(), - (request: Request, reply: ReplyWithContinue) => - this.eventHandler(LifecycleHooksEnum.OnPostAuth, routes, request, reply) - .subscribe( - _ => reply.continue(), - _ => errorHandler(_), - () => request['_hapinessRoute'] = undefined - ) - ); - } - - /** - * Instantiate the route matching the request - * And trigger OnPreAuth hook - * - * @param {CoreRoute[]} routes - * @param {Request} request - * @param {ReplyWithContinue} reply - * @returns Observable - */ - private static instantiateRoute(routes: CoreRoute[], request: Request, reply: ReplyWithContinue): Observable { - return Observable - .of(routes) - .map(_ => this.findRoute(request, _)) - .filter(_ => !!(_ && _.token)) - .flatMap(_ => RouteBuilder.instantiateRouteAndDI(_, request)) - .do(_ => request['_hapinessRoute'] = _) - .flatMap(_ => this.eventHandler(LifecycleHooksEnum.OnPreAuth, routes, request, reply)) - } - - /** - * Find the matching route with - * path and method - * - * @param {Request} request - * @param {CoreRoute[]} routes - * @returns CoreRoute - */ - private static findRoute(request: Request, routes: CoreRoute[]): CoreRoute { - return routes - .find(r => ((r.method === request.route.method || r.method.indexOf(request.route.method) > -1) && - r.path === request.route.path)); - } - - /** - * Find the route and call - * the hook if the route component - * implements it - * - * @param {eRouteLifecycleHooks} event - * @param {MainModule} mainModule - * @param {} request - * @param {} reply - */ - private static eventHandler(hook: LifecycleHooksEnum, routes: CoreRoute[], - request: Request, reply: ReplyWithContinue): Observable { - - return Observable - .of(routes) - .map(_ => this.findRoute(request, _)) - .filter(_ => request['_hapinessRoute'] && HookManager.hasLifecycleHook(hook.toString(), _.token)) - .flatMap(_ => - HookManager - .triggerHook(hook.toString(), _.token, request['_hapinessRoute'], [request, reply]) - ) - .defaultIfEmpty(reply.continue()) - .filter(_ => !!_ && !_.statusCode && !_.headers && !_.source); - } - -} diff --git a/src-2/extensions/http-server/route.ts b/src-2/extensions/http-server/route.ts deleted file mode 100644 index 586f710..0000000 --- a/src-2/extensions/http-server/route.ts +++ /dev/null @@ -1,103 +0,0 @@ -import { CoreModule } from '../../core/interfaces'; -import { CoreRoute } from './interfaces'; -import { Observable } from 'rxjs'; -import { Type } from '../../core/decorators'; -import { Route } from './decorators'; -import { extractMetadataByDecorator } from '../../core/metadata'; -import { DependencyInjection } from '../../core/di'; -import { Request } from 'hapi'; - -interface InternalType { - route: Route; - token: Type; -} - -export class HttpRequestInfo {} - -export class RouteBuilder { - - /** - * Helper to extract metadata - * @property {string} decoratorName - */ - private static decoratorName = 'Route'; - - /** - * Entrypoint to build a CoreRoute - * Get the metadata and build the - * route instance - * - * @param {CoreModule} module - * @returns CoreRoute - */ - public static buildRoutes(module: CoreModule): Observable { - return Observable - .of(module) - .filter(_ => !!_) - .flatMap(_ => this.metadataFromDeclarations(_.declarations)) - .flatMap(_ => this.coreRouteFromMetadata(_.route, _.token, module)); - } - - /** - * Instantiate a new Route - * with its own DI/request - * - * @param {CoreRoute} route - * @param {Request} request - * @returns Observable - */ - public static instantiateRouteAndDI(route: CoreRoute, request: Request): Observable { - return Observable - .of(request) - .map(_ => ({ - query: Object.assign({}, request.query), - params: Object.assign({}, request.params), - headers: Object.assign({}, request.headers), - payload: Object.assign({}, request.payload) - })) - .map(_ => ({ provide: HttpRequestInfo, useValue: _ })) - .map(_ => [].concat(route.providers).concat(_)) - .flatMap(_ => DependencyInjection.createAndResolve(_, route.module.di)) - .flatMap(_ => DependencyInjection.instantiateComponent(route.token, _)); - } - - /** - * Transform metadata to instance CoreRoute - * - * @param {Route} data - * @returns CoreRoute - */ - private static coreRouteFromMetadata(data: Route, token: Type, module: CoreModule): Observable { - return Observable - .of(data) - .flatMap(_ => - Observable - .from([].concat(_.method)) - .map(__ => __.toLowerCase()) - .toArray() - .map(__ => ({ data: _, methods: __ })) - ) - .map(_ => ({ - token, - module, - config: _.data.config, - path: _.data.path, - method: _.methods, - providers: [] - })); - } - - /** - * Extract metadata filtered by route - * from the declarations provided - * - * @param {Type} declarations - * @returns Route - */ - private static metadataFromDeclarations(declarations: Type[]): Observable { - return Observable - .from([].concat(declarations)) - .filter(_ => !!_) - .map(_ => ({ token: _, route: extractMetadataByDecorator(_, this.decoratorName) })) - } -} diff --git a/src-2/externals/injection-js/facade/errors.d.ts b/src-2/externals/injection-js/facade/errors.d.ts deleted file mode 100644 index dc15d54..0000000 --- a/src-2/externals/injection-js/facade/errors.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -/// -import { DebugContext } from './lang'; -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -export declare const ERROR_TYPE: string; -export declare const ERROR_COMPONENT_TYPE: string; -export declare const ERROR_DEBUG_CONTEXT: string; -export declare const ERROR_ORIGINAL_ERROR: string; -export declare const ERROR_LOGGER: string; -export declare function getType(error: Error): Function; -export declare function getDebugContext(error: Error): DebugContext; -export declare function getOriginalError(error: Error): Error; -export declare function getErrorLogger(error: Error): (console: Console, ...values: any[]) => void; -export declare function wrappedError(message: string, originalError: any): Error; diff --git a/src-2/externals/injection-js/facade/errors.js b/src-2/externals/injection-js/facade/errors.js deleted file mode 100644 index 7dca94f..0000000 --- a/src-2/externals/injection-js/facade/errors.js +++ /dev/null @@ -1,44 +0,0 @@ -"use strict"; -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -exports.ERROR_TYPE = 'ngType'; -exports.ERROR_COMPONENT_TYPE = 'ngComponentType'; -exports.ERROR_DEBUG_CONTEXT = 'ngDebugContext'; -exports.ERROR_ORIGINAL_ERROR = 'ngOriginalError'; -exports.ERROR_LOGGER = 'ngErrorLogger'; -function getType(error) { - return error[exports.ERROR_TYPE]; -} -exports.getType = getType; -function getDebugContext(error) { - return error[exports.ERROR_DEBUG_CONTEXT]; -} -exports.getDebugContext = getDebugContext; -function getOriginalError(error) { - return error[exports.ERROR_ORIGINAL_ERROR]; -} -exports.getOriginalError = getOriginalError; -function defaultErrorLogger(console) { - var values = []; - for (var _i = 1; _i < arguments.length; _i++) { - values[_i - 1] = arguments[_i]; - } - console.error.apply(console, values); -} -function getErrorLogger(error) { - return error[exports.ERROR_LOGGER] || defaultErrorLogger; -} -exports.getErrorLogger = getErrorLogger; -function wrappedError(message, originalError) { - var msg = message + " caused by: " + (originalError instanceof Error ? originalError.message : originalError); - var error = Error(msg); - error[exports.ERROR_ORIGINAL_ERROR] = originalError; - return error; -} -exports.wrappedError = wrappedError; -//# sourceMappingURL=errors.js.map \ No newline at end of file diff --git a/src-2/externals/injection-js/facade/errors.js.map b/src-2/externals/injection-js/facade/errors.js.map deleted file mode 100644 index 32614f8..0000000 --- a/src-2/externals/injection-js/facade/errors.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../lib/facade/errors.ts"],"names":[],"mappings":";AACA;;;;;;GAMG;AAEU,kBAAU,GAAG,QAAQ,CAAC;AACtB,4BAAoB,GAAG,iBAAiB,CAAC;AACzC,2BAAmB,GAAG,gBAAgB,CAAC;AACvC,4BAAoB,GAAG,iBAAiB,CAAC;AACzC,oBAAY,GAAG,eAAe,CAAC;AAG5C,iBAAwB,KAAY;IAClC,MAAM,CAAE,KAAa,CAAC,kBAAU,CAAC,CAAC;AACpC,CAAC;AAFe,eAAO,UAEtB,CAAA;AAED,yBAAgC,KAAY;IAC1C,MAAM,CAAE,KAAa,CAAC,2BAAmB,CAAC,CAAC;AAC7C,CAAC;AAFe,uBAAe,kBAE9B,CAAA;AAED,0BAAiC,KAAY;IAC3C,MAAM,CAAE,KAAa,CAAC,4BAAoB,CAAC,CAAC;AAC9C,CAAC;AAFe,wBAAgB,mBAE/B,CAAA;AAED,4BAA4B,OAAgB;IAAE,gBAAgB;SAAhB,WAAgB,CAAhB,sBAAgB,CAAhB,IAAgB;QAAhB,+BAAgB;;IACtD,OAAO,CAAC,KAAK,OAAb,OAAO,EAAW,MAAM,CAAC,CAAC;AAClC,CAAC;AAED,wBAA+B,KAAY;IACzC,MAAM,CAAE,KAAa,CAAC,oBAAY,CAAC,IAAI,kBAAkB,CAAC;AAC5D,CAAC;AAFe,sBAAc,iBAE7B,CAAA;AAED,sBAA6B,OAAe,EAAE,aAAkB;IAC9D,IAAM,GAAG,GACF,OAAO,qBAAe,aAAa,YAAY,KAAK,GAAG,aAAa,CAAC,OAAO,GAAE,aAAa,CAAG,CAAC;IACtG,IAAM,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;IACxB,KAAa,CAAC,4BAAoB,CAAC,GAAG,aAAa,CAAC;IACrD,MAAM,CAAC,KAAK,CAAC;AACf,CAAC;AANe,oBAAY,eAM3B,CAAA"} \ No newline at end of file diff --git a/src-2/externals/injection-js/facade/lang.d.ts b/src-2/externals/injection-js/facade/lang.d.ts deleted file mode 100644 index f0f0a7f..0000000 --- a/src-2/externals/injection-js/facade/lang.d.ts +++ /dev/null @@ -1,47 +0,0 @@ -/// -import { Injector } from '../injector'; -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -export interface BrowserNodeGlobal { - Object: typeof Object; - Array: typeof Array; - Map: typeof Map; - Set: typeof Set; - Date: DateConstructor; - RegExp: RegExpConstructor; - JSON: typeof JSON; - Math: any; - assert(condition: any): void; - Reflect: any; - getAngularTestability: Function; - getAllAngularTestabilities: Function; - getAllAngularRootElements: Function; - frameworkStabilizers: Array; - setTimeout: Function; - clearTimeout: Function; - setInterval: Function; - clearInterval: Function; - encodeURI: Function; -} -declare const _global: BrowserNodeGlobal; -export { _global as global }; -export declare function isPresent(obj: any): boolean; -export declare function stringify(token: any): string; -export declare abstract class DebugContext { - readonly abstract nodeIndex: number | null; - readonly abstract injector: Injector; - readonly abstract component: any; - readonly abstract providerTokens: any[]; - readonly abstract references: { - [key: string]: any; - }; - readonly abstract context: any; - readonly abstract componentRenderElement: any; - readonly abstract renderNode: any; - abstract logError(console: Console, ...values: any[]): void; -} diff --git a/src-2/externals/injection-js/facade/lang.js b/src-2/externals/injection-js/facade/lang.js deleted file mode 100644 index 39bf2e7..0000000 --- a/src-2/externals/injection-js/facade/lang.js +++ /dev/null @@ -1,89 +0,0 @@ -"use strict"; -var globalScope; -if (typeof window === 'undefined') { - if (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope) { - // TODO: Replace any with WorkerGlobalScope from lib.webworker.d.ts #3492 - globalScope = self; - } - else { - globalScope = global; - } -} -else { - globalScope = window; -} -// Need to declare a new variable for global here since TypeScript -// exports the original value of the symbol. -var _global = globalScope; -exports.global = _global; -function isPresent(obj) { - return obj != null; -} -exports.isPresent = isPresent; -function stringify(token) { - if (typeof token === 'string') { - return token; - } - if (token == null) { - return '' + token; - } - if (token.overriddenName) { - return "" + token.overriddenName; - } - if (token.name) { - return "" + token.name; - } - var res = token.toString(); - var newLineIndex = res.indexOf('\n'); - return newLineIndex === -1 ? res : res.substring(0, newLineIndex); -} -exports.stringify = stringify; -var DebugContext = (function () { - function DebugContext() { - } - Object.defineProperty(DebugContext.prototype, "nodeIndex", { - // We don't really need this - // abstract get view(): ViewData; - get: function () { }, - enumerable: true, - configurable: true - }); - Object.defineProperty(DebugContext.prototype, "injector", { - get: function () { }, - enumerable: true, - configurable: true - }); - Object.defineProperty(DebugContext.prototype, "component", { - get: function () { }, - enumerable: true, - configurable: true - }); - Object.defineProperty(DebugContext.prototype, "providerTokens", { - get: function () { }, - enumerable: true, - configurable: true - }); - Object.defineProperty(DebugContext.prototype, "references", { - get: function () { }, - enumerable: true, - configurable: true - }); - Object.defineProperty(DebugContext.prototype, "context", { - get: function () { }, - enumerable: true, - configurable: true - }); - Object.defineProperty(DebugContext.prototype, "componentRenderElement", { - get: function () { }, - enumerable: true, - configurable: true - }); - Object.defineProperty(DebugContext.prototype, "renderNode", { - get: function () { }, - enumerable: true, - configurable: true - }); - return DebugContext; -}()); -exports.DebugContext = DebugContext; -//# sourceMappingURL=lang.js.map \ No newline at end of file diff --git a/src-2/externals/injection-js/facade/lang.js.map b/src-2/externals/injection-js/facade/lang.js.map deleted file mode 100644 index e2b0c51..0000000 --- a/src-2/externals/injection-js/facade/lang.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"lang.js","sourceRoot":"","sources":["../../lib/facade/lang.ts"],"names":[],"mappings":";AAsCA,IAAI,WAA8B,CAAC;AACnC,EAAE,CAAC,CAAC,OAAO,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC;IAClC,EAAE,CAAC,CAAC,OAAO,iBAAiB,KAAK,WAAW,IAAI,IAAI,YAAY,iBAAiB,CAAC,CAAC,CAAC;QAClF,yEAAyE;QACzE,WAAW,GAAQ,IAAI,CAAC;IAC1B,CAAC;IAAC,IAAI,CAAC,CAAC;QACN,WAAW,GAAQ,MAAM,CAAC;IAC5B,CAAC;AACH,CAAC;AAAC,IAAI,CAAC,CAAC;IACN,WAAW,GAAQ,MAAM,CAAC;AAC5B,CAAC;AAED,kEAAkE;AAClE,4CAA4C;AAC5C,IAAM,OAAO,GAAsB,WAAW;AAE3B,cAAM,WAFsB;AAI/C,mBAA0B,GAAQ;IAChC,MAAM,CAAC,GAAG,IAAI,IAAI,CAAC;AACrB,CAAC;AAFe,iBAAS,YAExB,CAAA;AAED,mBAA0B,KAAU;IAClC,EAAE,CAAC,CAAC,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC;QAC9B,MAAM,CAAC,KAAK,CAAC;IACf,CAAC;IAED,EAAE,CAAC,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC;QAClB,MAAM,CAAC,EAAE,GAAG,KAAK,CAAC;IACpB,CAAC;IAED,EAAE,CAAC,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC;QACzB,MAAM,CAAC,KAAG,KAAK,CAAC,cAAgB,CAAC;IACnC,CAAC;IAED,EAAE,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;QACf,MAAM,CAAC,KAAG,KAAK,CAAC,IAAM,CAAC;IACzB,CAAC;IAED,IAAM,GAAG,GAAG,KAAK,CAAC,QAAQ,EAAE,CAAC;IAC7B,IAAM,YAAY,GAAG,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACvC,MAAM,CAAC,YAAY,KAAK,CAAC,CAAC,GAAG,GAAG,GAAG,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC;AACpE,CAAC;AApBe,iBAAS,YAoBxB,CAAA;AAED;IAAA;IAYA,CAAC;IATC,sBAAa,mCAAS;QAFtB,4BAA4B;QAC5B,iCAAiC;aACjC,eAAsC;;;OAAA;IACtC,sBAAa,kCAAQ;aAArB,eAAkC;;;OAAA;IAClC,sBAAa,mCAAS;aAAtB,eAA8B;;;OAAA;IAC9B,sBAAa,wCAAc;aAA3B,eAAqC;;;OAAA;IACrC,sBAAa,oCAAU;aAAvB,eAAgD;;;OAAA;IAChD,sBAAa,iCAAO;aAApB,eAA4B;;;OAAA;IAC5B,sBAAa,gDAAsB;aAAnC,eAA2C;;;OAAA;IAC3C,sBAAa,oCAAU;aAAvB,eAA+B;;;OAAA;IAEjC,mBAAC;AAAD,CAAC,AAZD,IAYC;AAZqB,oBAAY,eAYjC,CAAA"} \ No newline at end of file diff --git a/src-2/externals/injection-js/facade/type.d.ts b/src-2/externals/injection-js/facade/type.d.ts deleted file mode 100644 index f694f6b..0000000 --- a/src-2/externals/injection-js/facade/type.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -/** - * @whatItDoes Represents a type that a Component or other object is instances of. - * - * @description - * - * An example of a `Type` is `MyCustomComponent` class, which in JavaScript is be represented by - * the `MyCustomComponent` constructor function. - * - * @stable - */ -export declare const Type: FunctionConstructor; -export declare function isType(v: any): v is Type; -export interface Type extends Function { - new (...args: any[]): T; -} diff --git a/src-2/externals/injection-js/facade/type.js b/src-2/externals/injection-js/facade/type.js deleted file mode 100644 index b2ed407..0000000 --- a/src-2/externals/injection-js/facade/type.js +++ /dev/null @@ -1,24 +0,0 @@ -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -"use strict"; -/** - * @whatItDoes Represents a type that a Component or other object is instances of. - * - * @description - * - * An example of a `Type` is `MyCustomComponent` class, which in JavaScript is be represented by - * the `MyCustomComponent` constructor function. - * - * @stable - */ -exports.Type = Function; -function isType(v) { - return typeof v === 'function'; -} -exports.isType = isType; -//# sourceMappingURL=type.js.map \ No newline at end of file diff --git a/src-2/externals/injection-js/facade/type.js.map b/src-2/externals/injection-js/facade/type.js.map deleted file mode 100644 index 5cb27b7..0000000 --- a/src-2/externals/injection-js/facade/type.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"type.js","sourceRoot":"","sources":["../../lib/facade/type.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;;AAEH;;;;;;;;;GASG;AACU,YAAI,GAAG,QAAQ,CAAC;AAE7B,gBAAuB,CAAM;IAC3B,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,CAAC;AACjC,CAAC;AAFe,cAAM,SAErB,CAAA"} \ No newline at end of file diff --git a/src-2/externals/injection-js/forward_ref.d.ts b/src-2/externals/injection-js/forward_ref.d.ts deleted file mode 100644 index a9bf9b6..0000000 --- a/src-2/externals/injection-js/forward_ref.d.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { Type } from './facade/type'; -/** - * An interface that a function passed into {@link forwardRef} has to implement. - * - * ### Example - * - * {@example core/di/ts/forward_ref/forward_ref_spec.ts region='forward_ref_fn'} - * @experimental - */ -export interface ForwardRefFn { - (): any; -} -/** - * Allows to refer to references which are not yet defined. - * - * For instance, `forwardRef` is used when the `token` which we need to refer to for the purposes of - * DI is declared, - * but not yet defined. It is also used when the `token` which we use when creating a query is not - * yet defined. - * - * ### Example - * {@example core/di/ts/forward_ref/forward_ref_spec.ts region='forward_ref'} - * @experimental - */ -export declare function forwardRef(forwardRefFn: ForwardRefFn): Type; -/** - * Lazily retrieves the reference value from a forwardRef. - * - * Acts as the identity function when given a non-forward-ref value. - * - * ### Example ([live demo](http://plnkr.co/edit/GU72mJrk1fiodChcmiDR?p=preview)) - * - * {@example core/di/ts/forward_ref/forward_ref_spec.ts region='resolve_forward_ref'} - * - * See: {@link forwardRef} - * @experimental - */ -export declare function resolveForwardRef(type: any): any; diff --git a/src-2/externals/injection-js/forward_ref.js b/src-2/externals/injection-js/forward_ref.js deleted file mode 100644 index 4d3f4b8..0000000 --- a/src-2/externals/injection-js/forward_ref.js +++ /dev/null @@ -1,50 +0,0 @@ -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -"use strict"; -var lang_1 = require('./facade/lang'); -/** - * Allows to refer to references which are not yet defined. - * - * For instance, `forwardRef` is used when the `token` which we need to refer to for the purposes of - * DI is declared, - * but not yet defined. It is also used when the `token` which we use when creating a query is not - * yet defined. - * - * ### Example - * {@example core/di/ts/forward_ref/forward_ref_spec.ts region='forward_ref'} - * @experimental - */ -function forwardRef(forwardRefFn) { - forwardRefFn.__forward_ref__ = forwardRef; - forwardRefFn.toString = function () { return lang_1.stringify(this()); }; - return forwardRefFn; -} -exports.forwardRef = forwardRef; -/** - * Lazily retrieves the reference value from a forwardRef. - * - * Acts as the identity function when given a non-forward-ref value. - * - * ### Example ([live demo](http://plnkr.co/edit/GU72mJrk1fiodChcmiDR?p=preview)) - * - * {@example core/di/ts/forward_ref/forward_ref_spec.ts region='resolve_forward_ref'} - * - * See: {@link forwardRef} - * @experimental - */ -function resolveForwardRef(type) { - if (typeof type === 'function' && type.hasOwnProperty('__forward_ref__') && - type.__forward_ref__ === forwardRef) { - return type(); - } - else { - return type; - } -} -exports.resolveForwardRef = resolveForwardRef; -//# sourceMappingURL=forward_ref.js.map \ No newline at end of file diff --git a/src-2/externals/injection-js/forward_ref.js.map b/src-2/externals/injection-js/forward_ref.js.map deleted file mode 100644 index 36437ca..0000000 --- a/src-2/externals/injection-js/forward_ref.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"forward_ref.js","sourceRoot":"","sources":["../lib/forward_ref.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;;AAEH,qBAAwB,eAAe,CAAC,CAAA;AAcxC;;;;;;;;;;;GAWG;AACH,oBAA2B,YAA0B;IAC7C,YAAa,CAAC,eAAe,GAAG,UAAU,CAAC;IAC3C,YAAa,CAAC,QAAQ,GAAG,cAAa,MAAM,CAAC,gBAAS,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IACxE,MAAM,CAAkB,YAAa,CAAC;AACxC,CAAC;AAJe,kBAAU,aAIzB,CAAA;AAED;;;;;;;;;;;GAWG;AACH,2BAAkC,IAAS;IACzC,EAAE,CAAC,CAAC,OAAO,IAAI,KAAK,UAAU,IAAI,IAAI,CAAC,cAAc,CAAC,iBAAiB,CAAC;QACpE,IAAI,CAAC,eAAe,KAAK,UAAU,CAAC,CAAC,CAAC;QACxC,MAAM,CAAgB,IAAK,EAAE,CAAC;IAChC,CAAC;IAAC,IAAI,CAAC,CAAC;QACN,MAAM,CAAC,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAPe,yBAAiB,oBAOhC,CAAA"} \ No newline at end of file diff --git a/src-2/externals/injection-js/index.d.ts b/src-2/externals/injection-js/index.d.ts deleted file mode 100644 index 2cbe639..0000000 --- a/src-2/externals/injection-js/index.d.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -/** - * @module - * @description - * The `di` module provides dependency injection container services. - */ -export * from './metadata'; -export { forwardRef, resolveForwardRef, ForwardRefFn } from './forward_ref'; -export { Injector } from './injector'; -export { ReflectiveInjector } from './reflective_injector'; -export { Provider, TypeProvider, ValueProvider, ClassProvider, ExistingProvider, FactoryProvider } from './provider'; -export { ResolvedReflectiveFactory, ResolvedReflectiveProvider } from './reflective_provider'; -export { ReflectiveKey } from './reflective_key'; -export { InjectionToken, OpaqueToken } from './injection_token'; -export { Class } from './util/decorators'; diff --git a/src-2/externals/injection-js/index.js b/src-2/externals/injection-js/index.js deleted file mode 100644 index df69d64..0000000 --- a/src-2/externals/injection-js/index.js +++ /dev/null @@ -1,34 +0,0 @@ -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -"use strict"; -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -/** - * @module - * @description - * The `di` module provides dependency injection container services. - */ -__export(require('./metadata')); -var forward_ref_1 = require('./forward_ref'); -exports.forwardRef = forward_ref_1.forwardRef; -exports.resolveForwardRef = forward_ref_1.resolveForwardRef; -var injector_1 = require('./injector'); -exports.Injector = injector_1.Injector; -var reflective_injector_1 = require('./reflective_injector'); -exports.ReflectiveInjector = reflective_injector_1.ReflectiveInjector; -var reflective_provider_1 = require('./reflective_provider'); -exports.ResolvedReflectiveFactory = reflective_provider_1.ResolvedReflectiveFactory; -var reflective_key_1 = require('./reflective_key'); -exports.ReflectiveKey = reflective_key_1.ReflectiveKey; -var injection_token_1 = require('./injection_token'); -exports.InjectionToken = injection_token_1.InjectionToken; -exports.OpaqueToken = injection_token_1.OpaqueToken; -var decorators_1 = require('./util/decorators'); -exports.Class = decorators_1.Class; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/src-2/externals/injection-js/index.js.map b/src-2/externals/injection-js/index.js.map deleted file mode 100644 index 672d293..0000000 --- a/src-2/externals/injection-js/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;;;;;AAEH;;;;GAIG;AAEH,iBAAc,YAAY,CAAC,EAAA;AAE3B,4BAA0D,eAAe,CAAC;AAAlE,8CAAU;AAAE,4DAAsD;AAE1E,yBAAuB,YAAY,CAAC;AAA5B,uCAA4B;AACpC,oCAAiC,uBAAuB,CAAC;AAAjD,sEAAiD;AAEzD,oCAAoE,uBAAuB,CAAC;AAApF,oFAAoF;AAC5F,+BAA4B,kBAAkB,CAAC;AAAvC,uDAAuC;AAC/C,gCAA0C,mBAAmB,CAAC;AAAtD,0DAAc;AAAE,oDAAsC;AAC9D,2BAAoB,mBAAmB,CAAC;AAAhC,mCAAgC"} \ No newline at end of file diff --git a/src-2/externals/injection-js/injection.bundle.js b/src-2/externals/injection-js/injection.bundle.js deleted file mode 100644 index c73918c..0000000 --- a/src-2/externals/injection-js/injection.bundle.js +++ /dev/null @@ -1,38 +0,0 @@ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory() : - typeof define === 'function' && define.amd ? define(factory) : - (factory()); -}(this, (function () { 'use strict'; - -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -/** - * @module - * @description - * The `di` module provides dependency injection container services. - */ -__export(require('./metadata')); -var forward_ref_1 = require('./forward_ref'); -exports.forwardRef = forward_ref_1.forwardRef; -exports.resolveForwardRef = forward_ref_1.resolveForwardRef; -var injector_1 = require('./injector'); -exports.Injector = injector_1.Injector; -var reflective_injector_1 = require('./reflective_injector'); -exports.ReflectiveInjector = reflective_injector_1.ReflectiveInjector; -var reflective_provider_1 = require('./reflective_provider'); -exports.ResolvedReflectiveFactory = reflective_provider_1.ResolvedReflectiveFactory; -var reflective_key_1 = require('./reflective_key'); -exports.ReflectiveKey = reflective_key_1.ReflectiveKey; -var injection_token_1 = require('./injection_token'); -exports.InjectionToken = injection_token_1.InjectionToken; -exports.OpaqueToken = injection_token_1.OpaqueToken; - -}))); diff --git a/src-2/externals/injection-js/injection_token.d.ts b/src-2/externals/injection-js/injection_token.d.ts deleted file mode 100644 index 7d880a7..0000000 --- a/src-2/externals/injection-js/injection_token.d.ts +++ /dev/null @@ -1,62 +0,0 @@ -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -/** - * Creates a token that can be used in a DI Provider. - * - * ### Example ([live demo](http://plnkr.co/edit/Ys9ezXpj2Mnoy3Uc8KBp?p=preview)) - * - * ```typescript - * var t = new OpaqueToken("value"); - * - * var injector = Injector.resolveAndCreate([ - * {provide: t, useValue: "bindingValue"} - * ]); - * - * expect(injector.get(t)).toEqual("bindingValue"); - * ``` - * - * Using an `OpaqueToken` is preferable to using strings as tokens because of possible collisions - * caused by multiple providers using the same string as two different tokens. - * - * Using an `OpaqueToken` is preferable to using an `Object` as tokens because it provides better - * error messages. - * @deprecated since v4.0.0 because it does not support type information, use `InjectionToken` - * instead. - */ -export declare class OpaqueToken { - protected _desc: string; - constructor(_desc: string); - toString(): string; -} -/** - * Creates a token that can be used in a DI Provider. - * - * Use an `InjectionToken` whenever the type you are injecting is not reified (does not have a - * runtime representation) such as when injecting an interface, callable type, array or - * parametrized type. - * - * `InjectionToken` is parameterized on `T` which is the type of object which will be returned by - * the `Injector`. This provides additional level of type safety. - * - * ``` - * interface MyInterface {...} - * var myInterface = injector.get(new InjectionToken('SomeToken')); - * // myInterface is inferred to be MyInterface. - * ``` - * - * ### Example - * - * {@example core/di/ts/injector_spec.ts region='InjectionToken'} - * - * @stable - */ -export declare class InjectionToken extends OpaqueToken { - private _differentiate_from_OpaqueToken_structurally; - constructor(desc: string); - toString(): string; -} diff --git a/src-2/externals/injection-js/injection_token.js b/src-2/externals/injection-js/injection_token.js deleted file mode 100644 index 3fd7841..0000000 --- a/src-2/externals/injection-js/injection_token.js +++ /dev/null @@ -1,76 +0,0 @@ -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -"use strict"; -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -/** - * Creates a token that can be used in a DI Provider. - * - * ### Example ([live demo](http://plnkr.co/edit/Ys9ezXpj2Mnoy3Uc8KBp?p=preview)) - * - * ```typescript - * var t = new OpaqueToken("value"); - * - * var injector = Injector.resolveAndCreate([ - * {provide: t, useValue: "bindingValue"} - * ]); - * - * expect(injector.get(t)).toEqual("bindingValue"); - * ``` - * - * Using an `OpaqueToken` is preferable to using strings as tokens because of possible collisions - * caused by multiple providers using the same string as two different tokens. - * - * Using an `OpaqueToken` is preferable to using an `Object` as tokens because it provides better - * error messages. - * @deprecated since v4.0.0 because it does not support type information, use `InjectionToken` - * instead. - */ -var OpaqueToken = (function () { - function OpaqueToken(_desc) { - this._desc = _desc; - } - OpaqueToken.prototype.toString = function () { return "Token " + this._desc; }; - return OpaqueToken; -}()); -exports.OpaqueToken = OpaqueToken; -/** - * Creates a token that can be used in a DI Provider. - * - * Use an `InjectionToken` whenever the type you are injecting is not reified (does not have a - * runtime representation) such as when injecting an interface, callable type, array or - * parametrized type. - * - * `InjectionToken` is parameterized on `T` which is the type of object which will be returned by - * the `Injector`. This provides additional level of type safety. - * - * ``` - * interface MyInterface {...} - * var myInterface = injector.get(new InjectionToken('SomeToken')); - * // myInterface is inferred to be MyInterface. - * ``` - * - * ### Example - * - * {@example core/di/ts/injector_spec.ts region='InjectionToken'} - * - * @stable - */ -var InjectionToken = (function (_super) { - __extends(InjectionToken, _super); - function InjectionToken(desc) { - _super.call(this, desc); - } - InjectionToken.prototype.toString = function () { return "InjectionToken " + this._desc; }; - return InjectionToken; -}(OpaqueToken)); -exports.InjectionToken = InjectionToken; -//# sourceMappingURL=injection_token.js.map \ No newline at end of file diff --git a/src-2/externals/injection-js/injection_token.js.map b/src-2/externals/injection-js/injection_token.js.map deleted file mode 100644 index 7574fcd..0000000 --- a/src-2/externals/injection-js/injection_token.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"injection_token.js","sourceRoot":"","sources":["../lib/injection_token.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;;;;;;;AAEH;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH;IACE,qBAAsB,KAAa;QAAb,UAAK,GAAL,KAAK,CAAQ;IAAG,CAAC;IAEvC,8BAAQ,GAAR,cAAqB,MAAM,CAAC,WAAS,IAAI,CAAC,KAAO,CAAC,CAAC,CAAC;IACtD,kBAAC;AAAD,CAAC,AAJD,IAIC;AAJY,mBAAW,cAIvB,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH;IAAuC,kCAAW;IAIhD,wBAAY,IAAY;QAAI,kBAAM,IAAI,CAAC,CAAC;IAAC,CAAC;IAE1C,iCAAQ,GAAR,cAAqB,MAAM,CAAC,oBAAkB,IAAI,CAAC,KAAO,CAAC,CAAC,CAAC;IAC/D,qBAAC;AAAD,CAAC,AAPD,CAAuC,WAAW,GAOjD;AAPY,sBAAc,iBAO1B,CAAA"} \ No newline at end of file diff --git a/src-2/externals/injection-js/injector.d.ts b/src-2/externals/injection-js/injector.d.ts deleted file mode 100644 index d5995ff..0000000 --- a/src-2/externals/injection-js/injector.d.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { Type } from './facade/type'; -import { InjectionToken } from './injection_token'; -export declare const THROW_IF_NOT_FOUND: Object; -/** - * @whatItDoes Injector interface - * @howToUse - * ``` - * const injector: Injector = ...; - * injector.get(...); - * ``` - * - * @description - * For more details, see the {@linkDocs guide/dependency-injection "Dependency Injection Guide"}. - * - * ### Example - * - * {@example core/di/ts/injector_spec.ts region='Injector'} - * - * `Injector` returns itself when given `Injector` as a token: - * {@example core/di/ts/injector_spec.ts region='injectInjector'} - * - * @stable - */ -export declare abstract class Injector { - static THROW_IF_NOT_FOUND: Object; - static NULL: Injector; - /** - * Retrieves an instance from the injector based on the provided token. - * If not found: - * - Throws {@link NoProviderError} if no `notFoundValue` that is not equal to - * Injector.THROW_IF_NOT_FOUND is given - * - Returns the `notFoundValue` otherwise - */ - abstract get(token: Type | InjectionToken, notFoundValue?: T): T; - /** - * @deprecated from v4.0.0 use Type or InjectionToken - * @suppress {duplicate} - */ - abstract get(token: any, notFoundValue?: any): any; -} diff --git a/src-2/externals/injection-js/injector.js b/src-2/externals/injection-js/injector.js deleted file mode 100644 index 1a5284c..0000000 --- a/src-2/externals/injection-js/injector.js +++ /dev/null @@ -1,52 +0,0 @@ -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -"use strict"; -var lang_1 = require('./facade/lang'); -var _THROW_IF_NOT_FOUND = new Object(); -exports.THROW_IF_NOT_FOUND = _THROW_IF_NOT_FOUND; -var _NullInjector = (function () { - function _NullInjector() { - } - _NullInjector.prototype.get = function (token, notFoundValue) { - if (notFoundValue === void 0) { notFoundValue = _THROW_IF_NOT_FOUND; } - if (notFoundValue === _THROW_IF_NOT_FOUND) { - throw new Error("No provider for " + lang_1.stringify(token) + "!"); - } - return notFoundValue; - }; - return _NullInjector; -}()); -/** - * @whatItDoes Injector interface - * @howToUse - * ``` - * const injector: Injector = ...; - * injector.get(...); - * ``` - * - * @description - * For more details, see the {@linkDocs guide/dependency-injection "Dependency Injection Guide"}. - * - * ### Example - * - * {@example core/di/ts/injector_spec.ts region='Injector'} - * - * `Injector` returns itself when given `Injector` as a token: - * {@example core/di/ts/injector_spec.ts region='injectInjector'} - * - * @stable - */ -var Injector = (function () { - function Injector() { - } - Injector.THROW_IF_NOT_FOUND = _THROW_IF_NOT_FOUND; - Injector.NULL = new _NullInjector(); - return Injector; -}()); -exports.Injector = Injector; -//# sourceMappingURL=injector.js.map \ No newline at end of file diff --git a/src-2/externals/injection-js/injector.js.map b/src-2/externals/injection-js/injector.js.map deleted file mode 100644 index 3753e98..0000000 --- a/src-2/externals/injection-js/injector.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"injector.js","sourceRoot":"","sources":["../lib/injector.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;;AAEH,qBAAwB,eAAe,CAAC,CAAA;AAKxC,IAAM,mBAAmB,GAAG,IAAI,MAAM,EAAE,CAAC;AAC5B,0BAAkB,GAAG,mBAAmB,CAAC;AAEtD;IAAA;IAOA,CAAC;IANC,2BAAG,GAAH,UAAI,KAAU,EAAE,aAAwC;QAAxC,6BAAwC,GAAxC,mCAAwC;QACtD,EAAE,CAAC,CAAC,aAAa,KAAK,mBAAmB,CAAC,CAAC,CAAC;YAC1C,MAAM,IAAI,KAAK,CAAC,qBAAmB,gBAAS,CAAC,KAAK,CAAC,MAAG,CAAC,CAAC;QAC1D,CAAC;QACD,MAAM,CAAC,aAAa,CAAC;IACvB,CAAC;IACH,oBAAC;AAAD,CAAC,AAPD,IAOC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH;IAAA;IAiBA,CAAC;IAhBQ,2BAAkB,GAAG,mBAAmB,CAAC;IACzC,aAAI,GAAa,IAAI,aAAa,EAAE,CAAC;IAe9C,eAAC;AAAD,CAAC,AAjBD,IAiBC;AAjBqB,gBAAQ,WAiB7B,CAAA"} \ No newline at end of file diff --git a/src-2/externals/injection-js/metadata.d.ts b/src-2/externals/injection-js/metadata.d.ts deleted file mode 100644 index 2d7b9f5..0000000 --- a/src-2/externals/injection-js/metadata.d.ts +++ /dev/null @@ -1,265 +0,0 @@ -/** - * Type of the Inject decorator / constructor function. - * - * @stable - */ -export interface InjectDecorator { - /** - * @whatItDoes A parameter decorator that specifies a dependency. - * @howToUse - * ``` - * @Injectable() - * class Car { - * constructor(@Inject("MyEngine") public engine:Engine) {} - * } - * ``` - * - * @description - * For more details, see the {@linkDocs guide/dependency-injection "Dependency Injection Guide"}. - * - * ### Example - * - * {@example core/di/ts/metadata_spec.ts region='Inject'} - * - * When `@Inject()` is not present, {@link Injector} will use the type annotation of the - * parameter. - * - * ### Example - * - * {@example core/di/ts/metadata_spec.ts region='InjectWithoutDecorator'} - * - * @stable - */ - (token: any): any; - new (token: any): Inject; -} -/** - * Type of the Inject metadata. - * - * @stable - */ -export interface Inject { - token: any; -} -/** - * Inject decorator and metadata. - * - * @stable - * @Annotation - */ -export declare const Inject: InjectDecorator; -/** - * Type of the Optional decorator / constructor function. - * - * @stable - */ -export interface OptionalDecorator { - /** - * @whatItDoes A parameter metadata that marks a dependency as optional. - * {@link Injector} provides `null` if the dependency is not found. - * @howToUse - * ``` - * @Injectable() - * class Car { - * constructor(@Optional() public engine:Engine) {} - * } - * ``` - * - * @description - * For more details, see the {@linkDocs guide/dependency-injection "Dependency Injection Guide"}. - * - * ### Example - * - * {@example core/di/ts/metadata_spec.ts region='Optional'} - * - * @stable - */ - (): any; - new (): Optional; -} -/** - * Type of the Optional metadata. - * - * @stable - */ -export interface Optional { -} -/** - * Optional decorator and metadata. - * - * @stable - * @Annotation - */ -export declare const Optional: OptionalDecorator; -/** - * Type of the Injectable decorator / constructor function. - * - * @stable - */ -export interface InjectableDecorator { - /** - * @whatItDoes A marker metadata that marks a class as available to {@link Injector} for creation. - * @howToUse - * ``` - * @Injectable() - * class Car {} - * ``` - * - * @description - * For more details, see the {@linkDocs guide/dependency-injection "Dependency Injection Guide"}. - * - * ### Example - * - * {@example core/di/ts/metadata_spec.ts region='Injectable'} - * - * {@link Injector} will throw {@link NoAnnotationError} when trying to instantiate a class that - * does not have `@Injectable` marker, as shown in the example below. - * - * {@example core/di/ts/metadata_spec.ts region='InjectableThrows'} - * - * @stable - */ - (): any; - new (): Injectable; -} -/** - * Type of the Injectable metadata. - * - * @stable - */ -export interface Injectable { -} -/** - * Injectable decorator and metadata. - * - * @stable - * @Annotation - */ -export declare const Injectable: InjectableDecorator; -/** - * Type of the Self decorator / constructor function. - * - * @stable - */ -export interface SelfDecorator { - /** - * @whatItDoes Specifies that an {@link Injector} should retrieve a dependency only from itself. - * @howToUse - * ``` - * @Injectable() - * class Car { - * constructor(@Self() public engine:Engine) {} - * } - * ``` - * - * @description - * For more details, see the {@linkDocs guide/dependency-injection "Dependency Injection Guide"}. - * - * ### Example - * - * {@example core/di/ts/metadata_spec.ts region='Self'} - * - * @stable - */ - (): any; - new (): Self; -} -/** - * Type of the Self metadata. - * - * @stable - */ -export interface Self { -} -/** - * Self decorator and metadata. - * - * @stable - * @Annotation - */ -export declare const Self: SelfDecorator; -/** - * Type of the SkipSelf decorator / constructor function. - * - * @stable - */ -export interface SkipSelfDecorator { - /** - * @whatItDoes Specifies that the dependency resolution should start from the parent injector. - * @howToUse - * ``` - * @Injectable() - * class Car { - * constructor(@SkipSelf() public engine:Engine) {} - * } - * ``` - * - * @description - * For more details, see the {@linkDocs guide/dependency-injection "Dependency Injection Guide"}. - * - * ### Example - * - * {@example core/di/ts/metadata_spec.ts region='SkipSelf'} - * - * @stable - */ - (): any; - new (): SkipSelf; -} -/** - * Type of the SkipSelf metadata. - * - * @stable - */ -export interface SkipSelf { -} -/** - * SkipSelf decorator and metadata. - * - * @stable - * @Annotation - */ -export declare const SkipSelf: SkipSelfDecorator; -/** - * Type of the Host decorator / constructor function. - * - * @stable - */ -export interface HostDecorator { - /** - * @whatItDoes Specifies that an injector should retrieve a dependency from any injector until - * reaching the host element of the current component. - * @howToUse - * ``` - * @Injectable() - * class Car { - * constructor(@Host() public engine:Engine) {} - * } - * ``` - * - * @description - * For more details, see the {@linkDocs guide/dependency-injection "Dependency Injection Guide"}. - * - * ### Example - * - * {@example core/di/ts/metadata_spec.ts region='Host'} - * - * @stable - */ - (): any; - new (): Host; -} -/** - * Type of the Host metadata. - * - * @stable - */ -export interface Host { -} -/** - * Host decorator and metadata. - * - * @stable - * @Annotation - */ -export declare const Host: HostDecorator; diff --git a/src-2/externals/injection-js/metadata.js b/src-2/externals/injection-js/metadata.js deleted file mode 100644 index 283b847..0000000 --- a/src-2/externals/injection-js/metadata.js +++ /dev/null @@ -1,52 +0,0 @@ -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -"use strict"; -var decorators_1 = require('./util/decorators'); -/** - * Inject decorator and metadata. - * - * @stable - * @Annotation - */ -exports.Inject = decorators_1.makeParamDecorator('Inject', [['token', undefined]]); -/** - * Optional decorator and metadata. - * - * @stable - * @Annotation - */ -exports.Optional = decorators_1.makeParamDecorator('Optional', []); -/** - * Injectable decorator and metadata. - * - * @stable - * @Annotation - */ -exports.Injectable = decorators_1.makeDecorator('Injectable', []); -/** - * Self decorator and metadata. - * - * @stable - * @Annotation - */ -exports.Self = decorators_1.makeParamDecorator('Self', []); -/** - * SkipSelf decorator and metadata. - * - * @stable - * @Annotation - */ -exports.SkipSelf = decorators_1.makeParamDecorator('SkipSelf', []); -/** - * Host decorator and metadata. - * - * @stable - * @Annotation - */ -exports.Host = decorators_1.makeParamDecorator('Host', []); -//# sourceMappingURL=metadata.js.map \ No newline at end of file diff --git a/src-2/externals/injection-js/metadata.js.map b/src-2/externals/injection-js/metadata.js.map deleted file mode 100644 index 630cb06..0000000 --- a/src-2/externals/injection-js/metadata.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"metadata.js","sourceRoot":"","sources":["../lib/metadata.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;;AAEH,2BAAgD,mBAAmB,CAAC,CAAA;AA8CpE;;;;;GAKG;AACU,cAAM,GAAoB,+BAAkB,CAAC,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;AAwC5F;;;;;GAKG;AACU,gBAAQ,GAAsB,+BAAkB,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;AAyC9E;;;;;GAKG;AACU,kBAAU,GAA6C,0BAAa,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;AAsCpG;;;;;GAKG;AACU,YAAI,GAAkB,+BAAkB,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AAuClE;;;;;GAKG;AACU,gBAAQ,GAAsB,+BAAkB,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;AAuC9E;;;;;GAKG;AACU,YAAI,GAAkB,+BAAkB,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC"} \ No newline at end of file diff --git a/src-2/externals/injection-js/package.json b/src-2/externals/injection-js/package.json deleted file mode 100644 index 0332195..0000000 --- a/src-2/externals/injection-js/package.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "name": "injection-js", - "version": "2.0.0-rc.2", - "description": "Dependency Injection library for JavaScript and TypeScript", - "main": "injection.bundle.js", - "module": "index.js", - "jsnext:main": "index.js", - "types": "index.d.ts", - "repository": { - "type": "git", - "url": "git+https://github.com/mgechev/injection-js.git" - }, - "dependencies": {}, - "keywords": [ - "DI", - "dependency", - "injection", - "dependency injection", - "injector" - ], - "author": "Minko Gechev ", - "license": "MIT" -} \ No newline at end of file diff --git a/src-2/externals/injection-js/provider.d.ts b/src-2/externals/injection-js/provider.d.ts deleted file mode 100644 index 7d721f5..0000000 --- a/src-2/externals/injection-js/provider.d.ts +++ /dev/null @@ -1,204 +0,0 @@ -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -import { Type } from './facade/type'; -/** - * @whatItDoes Configures the {@link Injector} to return an instance of `Type` when `Type' is used - * as token. - * @howToUse - * ``` - * @Injectable() - * class MyService {} - * - * const provider: TypeProvider = MyService; - * ``` - * - * @description - * - * Create an instance by invoking the `new` operator and supplying additional arguments. - * This form is a short form of `TypeProvider`; - * - * For more details, see the {@linkDocs guide/dependency-injection "Dependency Injection Guide"}. - * - * ### Example - * - * {@example core/di/ts/provider_spec.ts region='TypeProvider'} - * - * @stable - */ -export interface TypeProvider extends Type { -} -/** - * @whatItDoes Configures the {@link Injector} to return a value for a token. - * @howToUse - * ``` - * const provider: ValueProvider = {provide: 'someToken', useValue: 'someValue'}; - * ``` - * - * @description - * For more details, see the {@linkDocs guide/dependency-injection "Dependency Injection Guide"}. - * - * ### Example - * - * {@example core/di/ts/provider_spec.ts region='ValueProvider'} - * - * @stable - */ -export interface ValueProvider { - /** - * An injection token. (Typically an instance of `Type` or `InjectionToken`, but can be `any`). - */ - provide: any; - /** - * The value to inject. - */ - useValue: any; - /** - * If true, then injector returns an array of instances. This is useful to allow multiple - * providers spread across many files to provide configuration information to a common token. - * - * ### Example - * - * {@example core/di/ts/provider_spec.ts region='MultiProviderAspect'} - */ - multi?: boolean; -} -/** - * @whatItDoes Configures the {@link Injector} to return an instance of `useClass` for a token. - * @howToUse - * ``` - * @Injectable() - * class MyService {} - * - * const provider: ClassProvider = {provide: 'someToken', useClass: MyService}; - * ``` - * - * @description - * For more details, see the {@linkDocs guide/dependency-injection "Dependency Injection Guide"}. - * - * ### Example - * - * {@example core/di/ts/provider_spec.ts region='ClassProvider'} - * - * Note that following two providers are not equal: - * {@example core/di/ts/provider_spec.ts region='ClassProviderDifference'} - * - * @stable - */ -export interface ClassProvider { - /** - * An injection token. (Typically an instance of `Type` or `InjectionToken`, but can be `any`). - */ - provide: any; - /** - * Class to instantiate for the `token`. - */ - useClass: Type; - /** - * If true, then injector returns an array of instances. This is useful to allow multiple - * providers spread across many files to provide configuration information to a common token. - * - * ### Example - * - * {@example core/di/ts/provider_spec.ts region='MultiProviderAspect'} - */ - multi?: boolean; -} -/** - * @whatItDoes Configures the {@link Injector} to return a value of another `useExisting` token. - * @howToUse - * ``` - * const provider: ExistingProvider = {provide: 'someToken', useExisting: 'someOtherToken'}; - * ``` - * - * @description - * For more details, see the {@linkDocs guide/dependency-injection "Dependency Injection Guide"}. - * - * ### Example - * - * {@example core/di/ts/provider_spec.ts region='ExistingProvider'} - * - * @stable - */ -export interface ExistingProvider { - /** - * An injection token. (Typically an instance of `Type` or `InjectionToken`, but can be `any`). - */ - provide: any; - /** - * Existing `token` to return. (equivalent to `injector.get(useExisting)`) - */ - useExisting: any; - /** - * If true, then injector returns an array of instances. This is useful to allow multiple - * providers spread across many files to provide configuration information to a common token. - * - * ### Example - * - * {@example core/di/ts/provider_spec.ts region='MultiProviderAspect'} - */ - multi?: boolean; -} -/** - * @whatItDoes Configures the {@link Injector} to return a value by invoking a `useFactory` - * function. - * @howToUse - * ``` - * function serviceFactory() { ... } - * - * const provider: FactoryProvider = {provide: 'someToken', useFactory: serviceFactory, deps: []}; - * ``` - * - * @description - * For more details, see the {@linkDocs guide/dependency-injection "Dependency Injection Guide"}. - * - * ### Example - * - * {@example core/di/ts/provider_spec.ts region='FactoryProvider'} - * - * Dependencies can also be marked as optional: - * {@example core/di/ts/provider_spec.ts region='FactoryProviderOptionalDeps'} - * - * @stable - */ -export interface FactoryProvider { - /** - * An injection token. (Typically an instance of `Type` or `InjectionToken`, but can be `any`). - */ - provide: any; - /** - * A function to invoke to create a value for this `token`. The function is invoked with - * resolved values of `token`s in the `deps` field. - */ - useFactory: Function; - /** - * A list of `token`s which need to be resolved by the injector. The list of values is then - * used as arguments to the `useFactory` function. - */ - deps?: any[]; - /** - * If true, then injector returns an array of instances. This is useful to allow multiple - * providers spread across many files to provide configuration information to a common token. - * - * ### Example - * - * {@example core/di/ts/provider_spec.ts region='MultiProviderAspect'} - */ - multi?: boolean; -} -/** - * @whatItDoes Describes how the {@link Injector} should be configured. - * @howToUse - * See {@link TypeProvider}, {@link ValueProvider}, {@link ClassProvider}, {@link ExistingProvider}, - * {@link FactoryProvider}. - * - * @description - * For more details, see the {@linkDocs guide/dependency-injection "Dependency Injection Guide"}. - * - * @stable - */ -export declare type Provider = TypeProvider | ValueProvider | ClassProvider | ExistingProvider | FactoryProvider | any[]; diff --git a/src-2/externals/injection-js/provider.js b/src-2/externals/injection-js/provider.js deleted file mode 100644 index cebcfa9..0000000 --- a/src-2/externals/injection-js/provider.js +++ /dev/null @@ -1,9 +0,0 @@ -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -"use strict"; -//# sourceMappingURL=provider.js.map \ No newline at end of file diff --git a/src-2/externals/injection-js/provider.js.map b/src-2/externals/injection-js/provider.js.map deleted file mode 100644 index 3493b5d..0000000 --- a/src-2/externals/injection-js/provider.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"provider.js","sourceRoot":"","sources":["../lib/provider.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"} \ No newline at end of file diff --git a/src-2/externals/injection-js/reflection/platform_reflection_capabilities.d.ts b/src-2/externals/injection-js/reflection/platform_reflection_capabilities.d.ts deleted file mode 100644 index 72932ad..0000000 --- a/src-2/externals/injection-js/reflection/platform_reflection_capabilities.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -import { Type } from '../facade/type'; -import { GetterFn, MethodFn, SetterFn } from './types'; -export interface PlatformReflectionCapabilities { - isReflectionEnabled(): boolean; - factory(type: Type): Function; - hasLifecycleHook(type: any, lcProperty: string): boolean; - parameters(type: Type): any[][]; - annotations(type: Type): any[]; - propMetadata(typeOrFunc: Type): { - [key: string]: any[]; - }; - getter(name: string): GetterFn; - setter(name: string): SetterFn; - method(name: string): MethodFn; - importUri(type: Type): string; - resourceUri(type: Type): string; - resolveIdentifier(name: string, moduleUrl: string, members: string[] | null, runtime: any): any; - resolveEnum(enumIdentifier: any, name: string): any; -} diff --git a/src-2/externals/injection-js/reflection/platform_reflection_capabilities.js b/src-2/externals/injection-js/reflection/platform_reflection_capabilities.js deleted file mode 100644 index e35bef7..0000000 --- a/src-2/externals/injection-js/reflection/platform_reflection_capabilities.js +++ /dev/null @@ -1,9 +0,0 @@ -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -"use strict"; -//# sourceMappingURL=platform_reflection_capabilities.js.map \ No newline at end of file diff --git a/src-2/externals/injection-js/reflection/platform_reflection_capabilities.js.map b/src-2/externals/injection-js/reflection/platform_reflection_capabilities.js.map deleted file mode 100644 index b19e72d..0000000 --- a/src-2/externals/injection-js/reflection/platform_reflection_capabilities.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"platform_reflection_capabilities.js","sourceRoot":"","sources":["../../lib/reflection/platform_reflection_capabilities.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"} \ No newline at end of file diff --git a/src-2/externals/injection-js/reflection/reflection.d.ts b/src-2/externals/injection-js/reflection/reflection.d.ts deleted file mode 100644 index 0cf8667..0000000 --- a/src-2/externals/injection-js/reflection/reflection.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { Reflector } from './reflector'; -export { Reflector } from './reflector'; -/** - * The {@link Reflector} used internally in Angular to access metadata - * about symbols. - */ -export declare const reflector: Reflector; diff --git a/src-2/externals/injection-js/reflection/reflection.js b/src-2/externals/injection-js/reflection/reflection.js deleted file mode 100644 index f7c6820..0000000 --- a/src-2/externals/injection-js/reflection/reflection.js +++ /dev/null @@ -1,18 +0,0 @@ -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -"use strict"; -var reflection_capabilities_1 = require('./reflection_capabilities'); -var reflector_1 = require('./reflector'); -var reflector_2 = require('./reflector'); -exports.Reflector = reflector_2.Reflector; -/** - * The {@link Reflector} used internally in Angular to access metadata - * about symbols. - */ -exports.reflector = new reflector_1.Reflector(new reflection_capabilities_1.ReflectionCapabilities()); -//# sourceMappingURL=reflection.js.map \ No newline at end of file diff --git a/src-2/externals/injection-js/reflection/reflection.js.map b/src-2/externals/injection-js/reflection/reflection.js.map deleted file mode 100644 index 3da8c9c..0000000 --- a/src-2/externals/injection-js/reflection/reflection.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"reflection.js","sourceRoot":"","sources":["../../lib/reflection/reflection.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;;AAEH,wCAAqC,2BAA2B,CAAC,CAAA;AACjE,0BAAwB,aAAa,CAAC,CAAA;AAEtC,0BAAwB,aAAa,CAAC;AAA9B,0CAA8B;AAEtC;;;GAGG;AACU,iBAAS,GAAG,IAAI,qBAAS,CAAC,IAAI,gDAAsB,EAAE,CAAC,CAAC"} \ No newline at end of file diff --git a/src-2/externals/injection-js/reflection/reflection_capabilities.d.ts b/src-2/externals/injection-js/reflection/reflection_capabilities.d.ts deleted file mode 100644 index b89eff8..0000000 --- a/src-2/externals/injection-js/reflection/reflection_capabilities.d.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { Type } from '../facade/type'; -import { PlatformReflectionCapabilities } from './platform_reflection_capabilities'; -import { GetterFn, MethodFn, SetterFn } from './types'; -/** - * Attention: This regex has to hold even if the code is minified! - */ -export declare const DELEGATE_CTOR: RegExp; -export declare class ReflectionCapabilities implements PlatformReflectionCapabilities { - private _reflect; - constructor(reflect?: any); - isReflectionEnabled(): boolean; - factory(t: Type): (args: any[]) => T; - private _ownParameters(type, parentCtor); - parameters(type: Type): any[][]; - private _ownAnnotations(typeOrFunc, parentCtor); - annotations(typeOrFunc: Type): any[]; - private _ownPropMetadata(typeOrFunc, parentCtor); - propMetadata(typeOrFunc: any): { - [key: string]: any[]; - }; - hasLifecycleHook(type: any, lcProperty: string): boolean; - getter(name: string): GetterFn; - setter(name: string): SetterFn; - method(name: string): MethodFn; - importUri(type: any): string; - resourceUri(type: any): string; - resolveIdentifier(name: string, moduleUrl: string, members: string[], runtime: any): any; - resolveEnum(enumIdentifier: any, name: string): any; -} diff --git a/src-2/externals/injection-js/reflection/reflection_capabilities.js b/src-2/externals/injection-js/reflection/reflection_capabilities.js deleted file mode 100644 index ac665e6..0000000 --- a/src-2/externals/injection-js/reflection/reflection_capabilities.js +++ /dev/null @@ -1,234 +0,0 @@ -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -"use strict"; -var lang_1 = require('../facade/lang'); -var type_1 = require('../facade/type'); -/** - * Attention: This regex has to hold even if the code is minified! - */ -exports.DELEGATE_CTOR = /^function\s+\S+\(\)\s*{[\s\S]+\.apply\(this,\s*arguments\)/; -var ReflectionCapabilities = (function () { - function ReflectionCapabilities(reflect) { - this._reflect = reflect || lang_1.global['Reflect']; - } - ReflectionCapabilities.prototype.isReflectionEnabled = function () { return true; }; - ReflectionCapabilities.prototype.factory = function (t) { return function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i - 0] = arguments[_i]; - } - return new (t.bind.apply(t, [void 0].concat(args)))(); - }; }; - /** @internal */ - ReflectionCapabilities.prototype._zipTypesAndAnnotations = function (paramTypes, paramAnnotations) { - var result; - if (typeof paramTypes === 'undefined') { - result = new Array(paramAnnotations.length); - } - else { - result = new Array(paramTypes.length); - } - for (var i = 0; i < result.length; i++) { - // TS outputs Object for parameters without types, while Traceur omits - // the annotations. For now we preserve the Traceur behavior to aid - // migration, but this can be revisited. - if (typeof paramTypes === 'undefined') { - result[i] = []; - } - else if (paramTypes[i] != Object) { - result[i] = [paramTypes[i]]; - } - else { - result[i] = []; - } - if (paramAnnotations && paramAnnotations[i] != null) { - result[i] = result[i].concat(paramAnnotations[i]); - } - } - return result; - }; - ReflectionCapabilities.prototype._ownParameters = function (type, parentCtor) { - // If we have no decorators, we only have function.length as metadata. - // In that case, to detect whether a child class declared an own constructor or not, - // we need to look inside of that constructor to check whether it is - // just calling the parent. - // This also helps to work around for https://github.com/Microsoft/TypeScript/issues/12439 - // that sets 'design:paramtypes' to [] - // if a class inherits from another class but has no ctor declared itself. - if (exports.DELEGATE_CTOR.exec(type.toString())) { - return null; - } - // Prefer the direct API. - if (type.parameters && type.parameters !== parentCtor.parameters) { - return type.parameters; - } - // API of tsickle for lowering decorators to properties on the class. - var tsickleCtorParams = type.ctorParameters; - if (tsickleCtorParams && tsickleCtorParams !== parentCtor.ctorParameters) { - // Newer tsickle uses a function closure - // Retain the non-function case for compatibility with older tsickle - var ctorParameters = typeof tsickleCtorParams === 'function' ? tsickleCtorParams() : tsickleCtorParams; - var paramTypes = ctorParameters.map(function (ctorParam) { return ctorParam && ctorParam.type; }); - var paramAnnotations = ctorParameters.map(function (ctorParam) { - return ctorParam && convertTsickleDecoratorIntoMetadata(ctorParam.decorators); - }); - return this._zipTypesAndAnnotations(paramTypes, paramAnnotations); - } - // API for metadata created by invoking the decorators. - if (this._reflect != null && this._reflect.getOwnMetadata != null) { - var paramAnnotations = this._reflect.getOwnMetadata('parameters', type); - var paramTypes = this._reflect.getOwnMetadata('design:paramtypes', type); - if (paramTypes || paramAnnotations) { - return this._zipTypesAndAnnotations(paramTypes, paramAnnotations); - } - } - // If a class has no decorators, at least create metadata - // based on function.length. - // Note: We know that this is a real constructor as we checked - // the content of the constructor above. - return new Array(type.length).fill(undefined); - }; - ReflectionCapabilities.prototype.parameters = function (type) { - // Note: only report metadata if we have at least one class decorator - // to stay in sync with the static reflector. - if (!type_1.isType(type)) { - return []; - } - var parentCtor = getParentCtor(type); - var parameters = this._ownParameters(type, parentCtor); - if (!parameters && parentCtor !== Object) { - parameters = this.parameters(parentCtor); - } - return parameters || []; - }; - ReflectionCapabilities.prototype._ownAnnotations = function (typeOrFunc, parentCtor) { - // Prefer the direct API. - if (typeOrFunc.annotations && typeOrFunc.annotations !== parentCtor.annotations) { - var annotations = typeOrFunc.annotations; - if (typeof annotations === 'function' && annotations.annotations) { - annotations = annotations.annotations; - } - return annotations; - } - // API of tsickle for lowering decorators to properties on the class. - if (typeOrFunc.decorators && typeOrFunc.decorators !== parentCtor.decorators) { - return convertTsickleDecoratorIntoMetadata(typeOrFunc.decorators); - } - // API for metadata created by invoking the decorators. - if (this._reflect && this._reflect.getOwnMetadata) { - return this._reflect.getOwnMetadata('annotations', typeOrFunc); - } - return null; - }; - ReflectionCapabilities.prototype.annotations = function (typeOrFunc) { - if (!type_1.isType(typeOrFunc)) { - return []; - } - var parentCtor = getParentCtor(typeOrFunc); - var ownAnnotations = this._ownAnnotations(typeOrFunc, parentCtor) || []; - var parentAnnotations = parentCtor !== Object ? this.annotations(parentCtor) : []; - return parentAnnotations.concat(ownAnnotations); - }; - ReflectionCapabilities.prototype._ownPropMetadata = function (typeOrFunc, parentCtor) { - // Prefer the direct API. - if (typeOrFunc.propMetadata && - typeOrFunc.propMetadata !== parentCtor.propMetadata) { - var propMetadata = typeOrFunc.propMetadata; - if (typeof propMetadata === 'function' && propMetadata.propMetadata) { - propMetadata = propMetadata.propMetadata; - } - return propMetadata; - } - // API of tsickle for lowering decorators to properties on the class. - if (typeOrFunc.propDecorators && - typeOrFunc.propDecorators !== parentCtor.propDecorators) { - var propDecorators_1 = typeOrFunc.propDecorators; - var propMetadata_1 = {}; - Object.keys(propDecorators_1).forEach(function (prop) { - propMetadata_1[prop] = convertTsickleDecoratorIntoMetadata(propDecorators_1[prop]); - }); - return propMetadata_1; - } - // API for metadata created by invoking the decorators. - if (this._reflect && this._reflect.getOwnMetadata) { - return this._reflect.getOwnMetadata('propMetadata', typeOrFunc); - } - return null; - }; - ReflectionCapabilities.prototype.propMetadata = function (typeOrFunc) { - if (!type_1.isType(typeOrFunc)) { - return {}; - } - var parentCtor = getParentCtor(typeOrFunc); - var propMetadata = {}; - if (parentCtor !== Object) { - var parentPropMetadata_1 = this.propMetadata(parentCtor); - Object.keys(parentPropMetadata_1).forEach(function (propName) { - propMetadata[propName] = parentPropMetadata_1[propName]; - }); - } - var ownPropMetadata = this._ownPropMetadata(typeOrFunc, parentCtor); - if (ownPropMetadata) { - Object.keys(ownPropMetadata).forEach(function (propName) { - var decorators = []; - if (propMetadata.hasOwnProperty(propName)) { - decorators.push.apply(decorators, propMetadata[propName]); - } - decorators.push.apply(decorators, ownPropMetadata[propName]); - propMetadata[propName] = decorators; - }); - } - return propMetadata; - }; - ReflectionCapabilities.prototype.hasLifecycleHook = function (type, lcProperty) { - return type instanceof type_1.Type && lcProperty in type.prototype; - }; - ReflectionCapabilities.prototype.getter = function (name) { return new Function('o', 'return o.' + name + ';'); }; - ReflectionCapabilities.prototype.setter = function (name) { - return new Function('o', 'v', 'return o.' + name + ' = v;'); - }; - ReflectionCapabilities.prototype.method = function (name) { - var functionBody = "if (!o." + name + ") throw new Error('\"" + name + "\" is undefined');\n return o." + name + ".apply(o, args);"; - return new Function('o', 'args', functionBody); - }; - // There is not a concept of import uri in Js, but this is useful in developing Dart applications. - ReflectionCapabilities.prototype.importUri = function (type) { - // StaticSymbol - if (typeof type === 'object' && type['filePath']) { - return type['filePath']; - } - // Runtime type - return "./" + lang_1.stringify(type); - }; - ReflectionCapabilities.prototype.resourceUri = function (type) { return "./" + lang_1.stringify(type); }; - ReflectionCapabilities.prototype.resolveIdentifier = function (name, moduleUrl, members, runtime) { - return runtime; - }; - ReflectionCapabilities.prototype.resolveEnum = function (enumIdentifier, name) { return enumIdentifier[name]; }; - return ReflectionCapabilities; -}()); -exports.ReflectionCapabilities = ReflectionCapabilities; -function convertTsickleDecoratorIntoMetadata(decoratorInvocations) { - if (!decoratorInvocations) { - return []; - } - return decoratorInvocations.map(function (decoratorInvocation) { - var decoratorType = decoratorInvocation.type; - var annotationCls = decoratorType.annotationCls; - var annotationArgs = decoratorInvocation.args ? decoratorInvocation.args : []; - return new (annotationCls.bind.apply(annotationCls, [void 0].concat(annotationArgs)))(); - }); -} -function getParentCtor(ctor) { - var parentProto = Object.getPrototypeOf(ctor.prototype); - var parentCtor = parentProto ? parentProto.constructor : null; - // Note: We always use `Object` as the null value - // to simplify checking later on. - return parentCtor || Object; -} -//# sourceMappingURL=reflection_capabilities.js.map \ No newline at end of file diff --git a/src-2/externals/injection-js/reflection/reflection_capabilities.js.map b/src-2/externals/injection-js/reflection/reflection_capabilities.js.map deleted file mode 100644 index f67dc42..0000000 --- a/src-2/externals/injection-js/reflection/reflection_capabilities.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"reflection_capabilities.js","sourceRoot":"","sources":["../../lib/reflection/reflection_capabilities.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;;AAEH,qBAA2C,gBAAgB,CAAC,CAAA;AAC5D,qBAA2B,gBAAgB,CAAC,CAAA;AAK5C;;GAEG;AACU,qBAAa,GAAG,4DAA4D,CAAC;AAE1F;IAGE,gCAAY,OAAa;QAAI,IAAI,CAAC,QAAQ,GAAG,OAAO,IAAI,aAAM,CAAC,SAAS,CAAC,CAAC;IAAC,CAAC;IAE5E,oDAAmB,GAAnB,cAAiC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;IAE/C,wCAAO,GAAP,UAAW,CAAU,IAAwB,MAAM,CAAC;QAAC,cAAc;aAAd,WAAc,CAAd,sBAAc,CAAd,IAAc;YAAd,6BAAc;;QAAK,OAAA,KAAI,CAAC,YAAD,CAAC,kBAAI,IAAI,KAAC;IAAd,CAAc,CAAC,CAAC,CAAC;IAEzF,gBAAgB;IAChB,wDAAuB,GAAvB,UAAwB,UAAiB,EAAE,gBAAuB;QAChE,IAAI,MAAe,CAAC;QAEpB,EAAE,CAAC,CAAC,OAAO,UAAU,KAAK,WAAW,CAAC,CAAC,CAAC;YACtC,MAAM,GAAG,IAAI,KAAK,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;QAC9C,CAAC;QAAC,IAAI,CAAC,CAAC;YACN,MAAM,GAAG,IAAI,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;QACxC,CAAC;QAED,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACvC,sEAAsE;YACtE,mEAAmE;YACnE,wCAAwC;YACxC,EAAE,CAAC,CAAC,OAAO,UA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C,IAAI,CAAG,CAAC;IAChC,CAAC;IAED,4CAAW,GAAX,UAAY,IAAS,IAAY,MAAM,CAAC,OAAK,gBAAS,CAAC,IAAI,CAAG,CAAC,CAAC,CAAC;IAEjE,kDAAiB,GAAjB,UAAkB,IAAY,EAAE,SAAiB,EAAE,OAAiB,EAAE,OAAY;QAChF,MAAM,CAAC,OAAO,CAAC;IACjB,CAAC;IACD,4CAAW,GAAX,UAAY,cAAmB,EAAE,IAAY,IAAS,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACtF,6BAAC;AAAD,CAAC,AAzND,IAyNC;AAzNY,8BAAsB,yBAyNlC,CAAA;AAED,6CAA6C,oBAA2B;IACtE,EAAE,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC;QAC1B,MAAM,CAAC,EAAE,CAAC;IACZ,CAAC;IACD,MAAM,CAAC,oBAAoB,CAAC,GAAG,CAAC,UAAA,mBAAmB;QACjD,IAAM,aAAa,GAAG,mBAAmB,CAAC,IAAI,CAAC;QAC/C,IAAM,aAAa,GAAG,aAAa,CAAC,aAAa,CAAC;QAClD,IAAM,cAAc,GAAG,mBAAmB,CAAC,IAAI,GAAG,mBAAmB,CAAC,IAAI,GAAG,EAAE,CAAC;QAChF,MAAM,CAAC,KAAI,aAAa,YAAb,aAAa,kBAAI,cAAc,KAAC,CAAC;IAC9C,CAAC,CAAC,CAAC;AACL,CAAC;AAED,uBAAuB,IAAc;IACnC,IAAM,WAAW,GAAG,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAC1D,IAAM,UAAU,GAAG,WAAW,GAAG,WAAW,CAAC,WAAW,GAAG,IAAI,CAAC;IAChE,iDAAiD;IACjD,iCAAiC;IACjC,MAAM,CAAC,UAAU,IAAI,MAAM,CAAC;AAC9B,CAAC"} \ No newline at end of file diff --git a/src-2/externals/injection-js/reflection/reflector.d.ts b/src-2/externals/injection-js/reflection/reflector.d.ts deleted file mode 100644 index b7515b1..0000000 --- a/src-2/externals/injection-js/reflection/reflector.d.ts +++ /dev/null @@ -1,36 +0,0 @@ -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -import { Type } from '../facade/type'; -import { PlatformReflectionCapabilities } from './platform_reflection_capabilities'; -import { ReflectorReader } from './reflector_reader'; -import { GetterFn, MethodFn, SetterFn } from './types'; -export { PlatformReflectionCapabilities } from './platform_reflection_capabilities'; -export { GetterFn, MethodFn, SetterFn } from './types'; -/** - * Provides access to reflection data about symbols. Used internally by Angular - * to power dependency injection and compilation. - */ -export declare class Reflector extends ReflectorReader { - reflectionCapabilities: PlatformReflectionCapabilities; - constructor(reflectionCapabilities: PlatformReflectionCapabilities); - updateCapabilities(caps: PlatformReflectionCapabilities): void; - factory(type: Type): Function; - parameters(typeOrFunc: Type): any[][]; - annotations(typeOrFunc: Type): any[]; - propMetadata(typeOrFunc: Type): { - [key: string]: any[]; - }; - hasLifecycleHook(type: any, lcProperty: string): boolean; - getter(name: string): GetterFn; - setter(name: string): SetterFn; - method(name: string): MethodFn; - importUri(type: any): string; - resourceUri(type: any): string; - resolveIdentifier(name: string, moduleUrl: string, members: string[] | null, runtime: any): any; - resolveEnum(identifier: any, name: string): any; -} diff --git a/src-2/externals/injection-js/reflection/reflector.js b/src-2/externals/injection-js/reflection/reflector.js deleted file mode 100644 index 24063d3..0000000 --- a/src-2/externals/injection-js/reflection/reflector.js +++ /dev/null @@ -1,53 +0,0 @@ -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -"use strict"; -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var reflector_reader_1 = require('./reflector_reader'); -/** - * Provides access to reflection data about symbols. Used internally by Angular - * to power dependency injection and compilation. - */ -var Reflector = (function (_super) { - __extends(Reflector, _super); - function Reflector(reflectionCapabilities) { - _super.call(this); - this.reflectionCapabilities = reflectionCapabilities; - } - Reflector.prototype.updateCapabilities = function (caps) { this.reflectionCapabilities = caps; }; - Reflector.prototype.factory = function (type) { return this.reflectionCapabilities.factory(type); }; - Reflector.prototype.parameters = function (typeOrFunc) { - return this.reflectionCapabilities.parameters(typeOrFunc); - }; - Reflector.prototype.annotations = function (typeOrFunc) { - return this.reflectionCapabilities.annotations(typeOrFunc); - }; - Reflector.prototype.propMetadata = function (typeOrFunc) { - return this.reflectionCapabilities.propMetadata(typeOrFunc); - }; - Reflector.prototype.hasLifecycleHook = function (type, lcProperty) { - return this.reflectionCapabilities.hasLifecycleHook(type, lcProperty); - }; - Reflector.prototype.getter = function (name) { return this.reflectionCapabilities.getter(name); }; - Reflector.prototype.setter = function (name) { return this.reflectionCapabilities.setter(name); }; - Reflector.prototype.method = function (name) { return this.reflectionCapabilities.method(name); }; - Reflector.prototype.importUri = function (type) { return this.reflectionCapabilities.importUri(type); }; - Reflector.prototype.resourceUri = function (type) { return this.reflectionCapabilities.resourceUri(type); }; - Reflector.prototype.resolveIdentifier = function (name, moduleUrl, members, runtime) { - return this.reflectionCapabilities.resolveIdentifier(name, moduleUrl, members, runtime); - }; - Reflector.prototype.resolveEnum = function (identifier, name) { - return this.reflectionCapabilities.resolveEnum(identifier, name); - }; - return Reflector; -}(reflector_reader_1.ReflectorReader)); -exports.Reflector = Reflector; -//# sourceMappingURL=reflector.js.map \ No newline at end of file diff --git a/src-2/externals/injection-js/reflection/reflector.js.map b/src-2/externals/injection-js/reflection/reflector.js.map deleted file mode 100644 index b3d6915..0000000 --- a/src-2/externals/injection-js/reflection/reflector.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"reflector.js","sourceRoot":"","sources":["../../lib/reflection/reflector.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;;;;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AC,CAAC,CAAC;IAEnF,6BAAS,GAAT,UAAU,IAAS,IAAY,MAAM,CAAC,IAAI,CAAC,sBAAsB,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAEpF,+BAAW,GAAX,UAAY,IAAS,IAAY,MAAM,CAAC,IAAI,CAAC,sBAAsB,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAExF,qCAAiB,GAAjB,UAAkB,IAAY,EAAE,SAAiB,EAAE,OAAsB,EAAE,OAAY;QACrF,MAAM,CAAC,IAAI,CAAC,sBAAsB,CAAC,iBAAiB,CAAC,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IAC1F,CAAC;IAED,+BAAW,GAAX,UAAY,UAAe,EAAE,IAAY;QACvC,MAAM,CAAC,IAAI,CAAC,sBAAsB,CAAC,WAAW,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;IACnE,CAAC;IACH,gBAAC;AAAD,CAAC,AAxCD,CAA+B,kCAAe,GAwC7C;AAxCY,iBAAS,YAwCrB,CAAA"} \ No newline at end of file diff --git a/src-2/externals/injection-js/reflection/reflector_reader.d.ts b/src-2/externals/injection-js/reflection/reflector_reader.d.ts deleted file mode 100644 index a20773a..0000000 --- a/src-2/externals/injection-js/reflection/reflector_reader.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -/** - * Provides read-only access to reflection data about symbols. Used internally by Angular - * to power dependency injection and compilation. - */ -export declare abstract class ReflectorReader { - abstract parameters(typeOrFunc: any): any[][]; - abstract annotations(typeOrFunc: any): any[]; - abstract propMetadata(typeOrFunc: any): { - [key: string]: any[]; - }; - abstract importUri(typeOrFunc: any): string | null; - abstract resourceUri(typeOrFunc: any): string; - abstract resolveIdentifier(name: string, moduleUrl: string, members: string[], runtime: any): any; - abstract resolveEnum(identifier: any, name: string): any; -} diff --git a/src-2/externals/injection-js/reflection/reflector_reader.js b/src-2/externals/injection-js/reflection/reflector_reader.js deleted file mode 100644 index 42f9b5b..0000000 --- a/src-2/externals/injection-js/reflection/reflector_reader.js +++ /dev/null @@ -1,19 +0,0 @@ -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -"use strict"; -/** - * Provides read-only access to reflection data about symbols. Used internally by Angular - * to power dependency injection and compilation. - */ -var ReflectorReader = (function () { - function ReflectorReader() { - } - return ReflectorReader; -}()); -exports.ReflectorReader = ReflectorReader; -//# sourceMappingURL=reflector_reader.js.map \ No newline at end of file diff --git a/src-2/externals/injection-js/reflection/reflector_reader.js.map b/src-2/externals/injection-js/reflection/reflector_reader.js.map deleted file mode 100644 index 3c039b3..0000000 --- a/src-2/externals/injection-js/reflection/reflector_reader.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"reflector_reader.js","sourceRoot":"","sources":["../../lib/reflection/reflector_reader.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;;AAEH;;;GAGG;AACH;IAAA;IAQA,CAAC;IAAD,sBAAC;AAAD,CAAC,AARD,IAQC;AARqB,uBAAe,kBAQpC,CAAA"} \ No newline at end of file diff --git a/src-2/externals/injection-js/reflection/types.d.ts b/src-2/externals/injection-js/reflection/types.d.ts deleted file mode 100644 index 2035e82..0000000 --- a/src-2/externals/injection-js/reflection/types.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -export declare type SetterFn = (obj: any, value: any) => void; -export declare type GetterFn = (obj: any) => any; -export declare type MethodFn = (obj: any, args: any[]) => any; diff --git a/src-2/externals/injection-js/reflection/types.js b/src-2/externals/injection-js/reflection/types.js deleted file mode 100644 index be069eb..0000000 --- a/src-2/externals/injection-js/reflection/types.js +++ /dev/null @@ -1,9 +0,0 @@ -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -"use strict"; -//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/src-2/externals/injection-js/reflection/types.js.map b/src-2/externals/injection-js/reflection/types.js.map deleted file mode 100644 index 6f7e4e3..0000000 --- a/src-2/externals/injection-js/reflection/types.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"types.js","sourceRoot":"","sources":["../../lib/reflection/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"} \ No newline at end of file diff --git a/src-2/externals/injection-js/reflective_errors.d.ts b/src-2/externals/injection-js/reflective_errors.d.ts deleted file mode 100644 index ee26e30..0000000 --- a/src-2/externals/injection-js/reflective_errors.d.ts +++ /dev/null @@ -1,138 +0,0 @@ -/// -import { Type } from './facade/type'; -import { ReflectiveInjector } from './reflective_injector'; -import { ReflectiveKey } from './reflective_key'; -export interface InjectionError extends Error { - keys: ReflectiveKey[]; - injectors: ReflectiveInjector[]; - constructResolvingMessage: (this: InjectionError) => string; - addKey(injector: ReflectiveInjector, key: ReflectiveKey): void; -} -/** - * Thrown when trying to retrieve a dependency by key from {@link Injector}, but the - * {@link Injector} does not have a {@link Provider} for the given key. - * - * ### Example ([live demo](http://plnkr.co/edit/vq8D3FRB9aGbnWJqtEPE?p=preview)) - * - * ```typescript - * class A { - * constructor(b:B) {} - * } - * - * expect(() => Injector.resolveAndCreate([A])).toThrowError(); - * ``` - */ -export declare function noProviderError(injector: ReflectiveInjector, key: ReflectiveKey): InjectionError; -/** - * Thrown when dependencies form a cycle. - * - * ### Example ([live demo](http://plnkr.co/edit/wYQdNos0Tzql3ei1EV9j?p=info)) - * - * ```typescript - * var injector = Injector.resolveAndCreate([ - * {provide: "one", useFactory: (two) => "two", deps: [[new Inject("two")]]}, - * {provide: "two", useFactory: (one) => "one", deps: [[new Inject("one")]]} - * ]); - * - * expect(() => injector.get("one")).toThrowError(); - * ``` - * - * Retrieving `A` or `B` throws a `CyclicDependencyError` as the graph above cannot be constructed. - */ -export declare function cyclicDependencyError(injector: ReflectiveInjector, key: ReflectiveKey): InjectionError; -/** - * Thrown when a constructing type returns with an Error. - * - * The `InstantiationError` class contains the original error plus the dependency graph which caused - * this object to be instantiated. - * - * ### Example ([live demo](http://plnkr.co/edit/7aWYdcqTQsP0eNqEdUAf?p=preview)) - * - * ```typescript - * class A { - * constructor() { - * throw new Error('message'); - * } - * } - * - * var injector = Injector.resolveAndCreate([A]); - - * try { - * injector.get(A); - * } catch (e) { - * expect(e instanceof InstantiationError).toBe(true); - * expect(e.originalException.message).toEqual("message"); - * expect(e.originalStack).toBeDefined(); - * } - * ``` - */ -export declare function instantiationError(injector: ReflectiveInjector, originalException: any, originalStack: any, key: ReflectiveKey): InjectionError; -/** - * Thrown when an object other then {@link Provider} (or `Type`) is passed to {@link Injector} - * creation. - * - * ### Example ([live demo](http://plnkr.co/edit/YatCFbPAMCL0JSSQ4mvH?p=preview)) - * - * ```typescript - * expect(() => Injector.resolveAndCreate(["not a type"])).toThrowError(); - * ``` - */ -export declare function invalidProviderError(provider: any): Error; -/** - * Thrown when the class has no annotation information. - * - * Lack of annotation information prevents the {@link Injector} from determining which dependencies - * need to be injected into the constructor. - * - * ### Example ([live demo](http://plnkr.co/edit/rHnZtlNS7vJOPQ6pcVkm?p=preview)) - * - * ```typescript - * class A { - * constructor(b) {} - * } - * - * expect(() => Injector.resolveAndCreate([A])).toThrowError(); - * ``` - * - * This error is also thrown when the class not marked with {@link Injectable} has parameter types. - * - * ```typescript - * class B {} - * - * class A { - * constructor(b:B) {} // no information about the parameter types of A is available at runtime. - * } - * - * expect(() => Injector.resolveAndCreate([A,B])).toThrowError(); - * ``` - * @stable - */ -export declare function noAnnotationError(typeOrFunc: Type | Function, params: any[][]): Error; -/** - * Thrown when getting an object by index. - * - * ### Example ([live demo](http://plnkr.co/edit/bRs0SX2OTQiJzqvjgl8P?p=preview)) - * - * ```typescript - * class A {} - * - * var injector = Injector.resolveAndCreate([A]); - * - * expect(() => injector.getAt(100)).toThrowError(); - * ``` - * @stable - */ -export declare function outOfBoundsError(index: number): Error; -/** - * Thrown when a multi provider and a regular provider are bound to the same token. - * - * ### Example - * - * ```typescript - * expect(() => Injector.resolveAndCreate([ - * { provide: "Strings", useValue: "string1", multi: true}, - * { provide: "Strings", useValue: "string2", multi: false} - * ])).toThrowError(); - * ``` - */ -export declare function mixingMultiProvidersWithRegularProvidersError(provider1: any, provider2: any): Error; diff --git a/src-2/externals/injection-js/reflective_errors.js b/src-2/externals/injection-js/reflective_errors.js deleted file mode 100644 index da71070..0000000 --- a/src-2/externals/injection-js/reflective_errors.js +++ /dev/null @@ -1,217 +0,0 @@ -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -"use strict"; -var errors_1 = require('./facade/errors'); -var errors_2 = require('./facade/errors'); -var lang_1 = require('./facade/lang'); -function findFirstClosedCycle(keys) { - var res = []; - for (var i = 0; i < keys.length; ++i) { - if (res.indexOf(keys[i]) > -1) { - res.push(keys[i]); - return res; - } - res.push(keys[i]); - } - return res; -} -function constructResolvingPath(keys) { - if (keys.length > 1) { - var reversed = findFirstClosedCycle(keys.slice().reverse()); - var tokenStrs = reversed.map(function (k) { return lang_1.stringify(k.token); }); - return ' (' + tokenStrs.join(' -> ') + ')'; - } - return ''; -} -function injectionError(injector, key, constructResolvingMessage, originalError) { - var error = (originalError ? errors_1.wrappedError('', originalError) : Error()); - error.addKey = addKey; - error.keys = [key]; - error.injectors = [injector]; - error.constructResolvingMessage = constructResolvingMessage; - error.message = error.constructResolvingMessage(); - error[errors_2.ERROR_ORIGINAL_ERROR] = originalError; - return error; -} -function addKey(injector, key) { - this.injectors.push(injector); - this.keys.push(key); - this.message = this.constructResolvingMessage(); -} -/** - * Thrown when trying to retrieve a dependency by key from {@link Injector}, but the - * {@link Injector} does not have a {@link Provider} for the given key. - * - * ### Example ([live demo](http://plnkr.co/edit/vq8D3FRB9aGbnWJqtEPE?p=preview)) - * - * ```typescript - * class A { - * constructor(b:B) {} - * } - * - * expect(() => Injector.resolveAndCreate([A])).toThrowError(); - * ``` - */ -function noProviderError(injector, key) { - return injectionError(injector, key, function () { - var first = lang_1.stringify(this.keys[0].token); - return "No provider for " + first + "!" + constructResolvingPath(this.keys); - }); -} -exports.noProviderError = noProviderError; -/** - * Thrown when dependencies form a cycle. - * - * ### Example ([live demo](http://plnkr.co/edit/wYQdNos0Tzql3ei1EV9j?p=info)) - * - * ```typescript - * var injector = Injector.resolveAndCreate([ - * {provide: "one", useFactory: (two) => "two", deps: [[new Inject("two")]]}, - * {provide: "two", useFactory: (one) => "one", deps: [[new Inject("one")]]} - * ]); - * - * expect(() => injector.get("one")).toThrowError(); - * ``` - * - * Retrieving `A` or `B` throws a `CyclicDependencyError` as the graph above cannot be constructed. - */ -function cyclicDependencyError(injector, key) { - return injectionError(injector, key, function () { - return "Cannot instantiate cyclic dependency!" + constructResolvingPath(this.keys); - }); -} -exports.cyclicDependencyError = cyclicDependencyError; -/** - * Thrown when a constructing type returns with an Error. - * - * The `InstantiationError` class contains the original error plus the dependency graph which caused - * this object to be instantiated. - * - * ### Example ([live demo](http://plnkr.co/edit/7aWYdcqTQsP0eNqEdUAf?p=preview)) - * - * ```typescript - * class A { - * constructor() { - * throw new Error('message'); - * } - * } - * - * var injector = Injector.resolveAndCreate([A]); - - * try { - * injector.get(A); - * } catch (e) { - * expect(e instanceof InstantiationError).toBe(true); - * expect(e.originalException.message).toEqual("message"); - * expect(e.originalStack).toBeDefined(); - * } - * ``` - */ -function instantiationError(injector, originalException, originalStack, key) { - return injectionError(injector, key, function () { - var first = lang_1.stringify(this.keys[0].token); - return errors_2.getOriginalError(this).message + ": Error during instantiation of " + first + "!" + constructResolvingPath(this.keys) + "."; - }, originalException); -} -exports.instantiationError = instantiationError; -/** - * Thrown when an object other then {@link Provider} (or `Type`) is passed to {@link Injector} - * creation. - * - * ### Example ([live demo](http://plnkr.co/edit/YatCFbPAMCL0JSSQ4mvH?p=preview)) - * - * ```typescript - * expect(() => Injector.resolveAndCreate(["not a type"])).toThrowError(); - * ``` - */ -function invalidProviderError(provider) { - return Error("Invalid provider - only instances of Provider and Type are allowed, got: " + provider); -} -exports.invalidProviderError = invalidProviderError; -/** - * Thrown when the class has no annotation information. - * - * Lack of annotation information prevents the {@link Injector} from determining which dependencies - * need to be injected into the constructor. - * - * ### Example ([live demo](http://plnkr.co/edit/rHnZtlNS7vJOPQ6pcVkm?p=preview)) - * - * ```typescript - * class A { - * constructor(b) {} - * } - * - * expect(() => Injector.resolveAndCreate([A])).toThrowError(); - * ``` - * - * This error is also thrown when the class not marked with {@link Injectable} has parameter types. - * - * ```typescript - * class B {} - * - * class A { - * constructor(b:B) {} // no information about the parameter types of A is available at runtime. - * } - * - * expect(() => Injector.resolveAndCreate([A,B])).toThrowError(); - * ``` - * @stable - */ -function noAnnotationError(typeOrFunc, params) { - var signature = []; - for (var i = 0, ii = params.length; i < ii; i++) { - var parameter = params[i]; - if (!parameter || parameter.length == 0) { - signature.push('?'); - } - else { - signature.push(parameter.map(lang_1.stringify).join(' ')); - } - } - return Error('Cannot resolve all parameters for \'' + lang_1.stringify(typeOrFunc) + '\'(' + - signature.join(', ') + '). ' + - 'Make sure that all the parameters are decorated with Inject or have valid type annotations and that \'' + - lang_1.stringify(typeOrFunc) + '\' is decorated with Injectable.'); -} -exports.noAnnotationError = noAnnotationError; -/** - * Thrown when getting an object by index. - * - * ### Example ([live demo](http://plnkr.co/edit/bRs0SX2OTQiJzqvjgl8P?p=preview)) - * - * ```typescript - * class A {} - * - * var injector = Injector.resolveAndCreate([A]); - * - * expect(() => injector.getAt(100)).toThrowError(); - * ``` - * @stable - */ -function outOfBoundsError(index) { - return Error("Index " + index + " is out-of-bounds."); -} -exports.outOfBoundsError = outOfBoundsError; -// TODO: add a working example after alpha38 is released -/** - * Thrown when a multi provider and a regular provider are bound to the same token. - * - * ### Example - * - * ```typescript - * expect(() => Injector.resolveAndCreate([ - * { provide: "Strings", useValue: "string1", multi: true}, - * { provide: "Strings", useValue: "string2", multi: false} - * ])).toThrowError(); - * ``` - */ -function mixingMultiProvidersWithRegularProvidersError(provider1, provider2) { - return Error("Cannot mix multi providers and regular providers, got: " + provider1 + " " + provider2); -} -exports.mixingMultiProvidersWithRegularProvidersError = mixingMultiProvidersWithRegularProvidersError; -//# sourceMappingURL=reflective_errors.js.map \ No newline at end of file diff --git a/src-2/externals/injection-js/reflective_errors.js.map b/src-2/externals/injection-js/reflective_errors.js.map deleted file mode 100644 index 88c0242..0000000 --- a/src-2/externals/injection-js/reflective_errors.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"reflective_errors.js","sourceRoot":"","sources":["../lib/reflective_errors.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;;AAEH,uBAA2B,iBAAiB,CAAC,CAAA;AAC7C,uBAAqD,iBAAiB,CAAC,CAAA;AACvE,qBAAwB,eAAe,CAAC,CAAA;AAMxC,8BAA8B,IAAW;IACvC,IAAM,GAAG,GAAU,EAAE,CAAC;IACtB,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE,CAAC;QACrC,EAAE,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;YAC9B,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;YAClB,MAAM,CAAC,GAAG,CAAC;QACb,CAAC;QACD,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IACpB,CAAC;IACD,MAAM,CAAC,GAAG,CAAC;AACb,CAAC;AAED,gCAAgC,IAAW;IACzC,EAAE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,MAAe;IAChF,IAAM,SAAS,GAAa,EAAE,CAAC;IAC/B,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC;QAChD,IAAM,SAAS,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;QAC5B,EAAE,CAAC,CAAC,CAAC,SAAS,IAAI,SAAS,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC,CAAC;YACxC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACtB,CAAC;QAAC,IAAI,CAAC,CAAC;YACN,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,gBAAS,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;QACrD,CAAC;IACH,CAAC;IACD,MAAM,CAAC,KAAK,CACR,sCAAsC,GAAG,gBAAS,CAAC,UAAU,CAAC,GAAG,KAAK;QACtE,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,KAAK;QAC5B,wGAAwG;QACxG,gBAAS,CAAC,UAAU,CAAC,GAAG,kCAAkC,CAAC,CAAC;AAClE,CAAC;AAfe,yBAAiB,oBAehC,CAAA;AAED;;;;;;;;;;;;;GAaG;AACH,0BAAiC,KAAa;IAC5C,MAAM,CAAC,KAAK,CAAC,WAAS,KAAK,uBAAoB,CAAC,CAAC;AACnD,CAAC;AAFe,wBAAgB,mBAE/B,CAAA;AAED,wDAAwD;AACxD;;;;;;;;;;;GAWG;AACH,uDACI,SAAc,EAAE,SAAc;IAChC,MAAM,CAAC,KAAK,CAAC,4DAA0D,SAAS,SAAI,SAAW,CAAC,CAAC;AACnG,CAAC;AAHe,qDAA6C,gDAG5D,CAAA"} \ No newline at end of file diff --git a/src-2/externals/injection-js/reflective_injector.d.ts b/src-2/externals/injection-js/reflective_injector.d.ts deleted file mode 100644 index aa6b1d4..0000000 --- a/src-2/externals/injection-js/reflective_injector.d.ts +++ /dev/null @@ -1,275 +0,0 @@ -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -import { Injector } from './injector'; -import { Provider } from './provider'; -import { ResolvedReflectiveProvider } from './reflective_provider'; -/** - * A ReflectiveDependency injection container used for instantiating objects and resolving - * dependencies. - * - * An `Injector` is a replacement for a `new` operator, which can automatically resolve the - * constructor dependencies. - * - * In typical use, application code asks for the dependencies in the constructor and they are - * resolved by the `Injector`. - * - * ### Example ([live demo](http://plnkr.co/edit/jzjec0?p=preview)) - * - * The following example creates an `Injector` configured to create `Engine` and `Car`. - * - * ```typescript - * @Injectable() - * class Engine { - * } - * - * @Injectable() - * class Car { - * constructor(public engine:Engine) {} - * } - * - * var injector = ReflectiveInjector.resolveAndCreate([Car, Engine]); - * var car = injector.get(Car); - * expect(car instanceof Car).toBe(true); - * expect(car.engine instanceof Engine).toBe(true); - * ``` - * - * Notice, we don't use the `new` operator because we explicitly want to have the `Injector` - * resolve all of the object's dependencies automatically. - * - * @stable - */ -export declare abstract class ReflectiveInjector implements Injector { - /** - * Turns an array of provider definitions into an array of resolved providers. - * - * A resolution is a process of flattening multiple nested arrays and converting individual - * providers into an array of {@link ResolvedReflectiveProvider}s. - * - * ### Example ([live demo](http://plnkr.co/edit/AiXTHi?p=preview)) - * - * ```typescript - * @Injectable() - * class Engine { - * } - * - * @Injectable() - * class Car { - * constructor(public engine:Engine) {} - * } - * - * var providers = ReflectiveInjector.resolve([Car, [[Engine]]]); - * - * expect(providers.length).toEqual(2); - * - * expect(providers[0] instanceof ResolvedReflectiveProvider).toBe(true); - * expect(providers[0].key.displayName).toBe("Car"); - * expect(providers[0].dependencies.length).toEqual(1); - * expect(providers[0].factory).toBeDefined(); - * - * expect(providers[1].key.displayName).toBe("Engine"); - * }); - * ``` - * - * See {@link ReflectiveInjector#fromResolvedProviders} for more info. - */ - static resolve(providers: Provider[]): ResolvedReflectiveProvider[]; - /** - * Resolves an array of providers and creates an injector from those providers. - * - * The passed-in providers can be an array of `Type`, {@link Provider}, - * or a recursive array of more providers. - * - * ### Example ([live demo](http://plnkr.co/edit/ePOccA?p=preview)) - * - * ```typescript - * @Injectable() - * class Engine { - * } - * - * @Injectable() - * class Car { - * constructor(public engine:Engine) {} - * } - * - * var injector = ReflectiveInjector.resolveAndCreate([Car, Engine]); - * expect(injector.get(Car) instanceof Car).toBe(true); - * ``` - * - * This function is slower than the corresponding `fromResolvedProviders` - * because it needs to resolve the passed-in providers first. - * See {@link Injector#resolve} and {@link Injector#fromResolvedProviders}. - */ - static resolveAndCreate(providers: Provider[], parent?: Injector): ReflectiveInjector; - /** - * Creates an injector from previously resolved providers. - * - * This API is the recommended way to construct injectors in performance-sensitive parts. - * - * ### Example ([live demo](http://plnkr.co/edit/KrSMci?p=preview)) - * - * ```typescript - * @Injectable() - * class Engine { - * } - * - * @Injectable() - * class Car { - * constructor(public engine:Engine) {} - * } - * - * var providers = ReflectiveInjector.resolve([Car, Engine]); - * var injector = ReflectiveInjector.fromResolvedProviders(providers); - * expect(injector.get(Car) instanceof Car).toBe(true); - * ``` - * @experimental - */ - static fromResolvedProviders(providers: ResolvedReflectiveProvider[], parent?: Injector): ReflectiveInjector; - /** - * Parent of this injector. - * - * - * - * ### Example ([live demo](http://plnkr.co/edit/eosMGo?p=preview)) - * - * ```typescript - * var parent = ReflectiveInjector.resolveAndCreate([]); - * var child = parent.resolveAndCreateChild([]); - * expect(child.parent).toBe(parent); - * ``` - */ - readonly abstract parent: Injector | null; - /** - * Resolves an array of providers and creates a child injector from those providers. - * - * - * - * The passed-in providers can be an array of `Type`, {@link Provider}, - * or a recursive array of more providers. - * - * ### Example ([live demo](http://plnkr.co/edit/opB3T4?p=preview)) - * - * ```typescript - * class ParentProvider {} - * class ChildProvider {} - * - * var parent = ReflectiveInjector.resolveAndCreate([ParentProvider]); - * var child = parent.resolveAndCreateChild([ChildProvider]); - * - * expect(child.get(ParentProvider) instanceof ParentProvider).toBe(true); - * expect(child.get(ChildProvider) instanceof ChildProvider).toBe(true); - * expect(child.get(ParentProvider)).toBe(parent.get(ParentProvider)); - * ``` - * - * This function is slower than the corresponding `createChildFromResolved` - * because it needs to resolve the passed-in providers first. - * See {@link Injector#resolve} and {@link Injector#createChildFromResolved}. - */ - abstract resolveAndCreateChild(providers: Provider[]): ReflectiveInjector; - /** - * Creates a child injector from previously resolved providers. - * - * - * - * This API is the recommended way to construct injectors in performance-sensitive parts. - * - * ### Example ([live demo](http://plnkr.co/edit/VhyfjN?p=preview)) - * - * ```typescript - * class ParentProvider {} - * class ChildProvider {} - * - * var parentProviders = ReflectiveInjector.resolve([ParentProvider]); - * var childProviders = ReflectiveInjector.resolve([ChildProvider]); - * - * var parent = ReflectiveInjector.fromResolvedProviders(parentProviders); - * var child = parent.createChildFromResolved(childProviders); - * - * expect(child.get(ParentProvider) instanceof ParentProvider).toBe(true); - * expect(child.get(ChildProvider) instanceof ChildProvider).toBe(true); - * expect(child.get(ParentProvider)).toBe(parent.get(ParentProvider)); - * ``` - */ - abstract createChildFromResolved(providers: ResolvedReflectiveProvider[]): ReflectiveInjector; - /** - * Resolves a provider and instantiates an object in the context of the injector. - * - * The created object does not get cached by the injector. - * - * ### Example ([live demo](http://plnkr.co/edit/yvVXoB?p=preview)) - * - * ```typescript - * @Injectable() - * class Engine { - * } - * - * @Injectable() - * class Car { - * constructor(public engine:Engine) {} - * } - * - * var injector = ReflectiveInjector.resolveAndCreate([Engine]); - * - * var car = injector.resolveAndInstantiate(Car); - * expect(car.engine).toBe(injector.get(Engine)); - * expect(car).not.toBe(injector.resolveAndInstantiate(Car)); - * ``` - */ - abstract resolveAndInstantiate(provider: Provider): any; - /** - * Instantiates an object using a resolved provider in the context of the injector. - * - * The created object does not get cached by the injector. - * - * ### Example ([live demo](http://plnkr.co/edit/ptCImQ?p=preview)) - * - * ```typescript - * @Injectable() - * class Engine { - * } - * - * @Injectable() - * class Car { - * constructor(public engine:Engine) {} - * } - * - * var injector = ReflectiveInjector.resolveAndCreate([Engine]); - * var carProvider = ReflectiveInjector.resolve([Car])[0]; - * var car = injector.instantiateResolved(carProvider); - * expect(car.engine).toBe(injector.get(Engine)); - * expect(car).not.toBe(injector.instantiateResolved(carProvider)); - * ``` - */ - abstract instantiateResolved(provider: ResolvedReflectiveProvider): any; - abstract get(token: any, notFoundValue?: any): any; -} -export declare class ReflectiveInjector_ implements ReflectiveInjector { - keyIds: number[]; - objs: any[]; - /** - * Private - */ - constructor(_providers: ResolvedReflectiveProvider[], _parent?: Injector); - get(token: any, notFoundValue?: any): any; - readonly parent: Injector | null; - resolveAndCreateChild(providers: Provider[]): ReflectiveInjector; - createChildFromResolved(providers: ResolvedReflectiveProvider[]): ReflectiveInjector; - resolveAndInstantiate(provider: Provider): any; - instantiateResolved(provider: ResolvedReflectiveProvider): any; - getProviderAtIndex(index: number): ResolvedReflectiveProvider; - private _getMaxNumberOfObjects(); - private _instantiateProvider(provider); - private _instantiate(provider, ResolvedReflectiveFactory); - private _getByReflectiveDependency(dep); - private _getByKey(key, visibility, notFoundValue); - private _getObjByKeyId(keyId); - readonly displayName: string; - toString(): string; -} diff --git a/src-2/externals/injection-js/reflective_injector.js b/src-2/externals/injection-js/reflective_injector.js deleted file mode 100644 index 8158ab3..0000000 --- a/src-2/externals/injection-js/reflective_injector.js +++ /dev/null @@ -1,341 +0,0 @@ -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -"use strict"; -var injector_1 = require('./injector'); -var metadata_1 = require('./metadata'); -var reflective_errors_1 = require('./reflective_errors'); -var reflective_key_1 = require('./reflective_key'); -var reflective_provider_1 = require('./reflective_provider'); -// Threshold for the dynamic version -var UNDEFINED = new Object(); -/** - * A ReflectiveDependency injection container used for instantiating objects and resolving - * dependencies. - * - * An `Injector` is a replacement for a `new` operator, which can automatically resolve the - * constructor dependencies. - * - * In typical use, application code asks for the dependencies in the constructor and they are - * resolved by the `Injector`. - * - * ### Example ([live demo](http://plnkr.co/edit/jzjec0?p=preview)) - * - * The following example creates an `Injector` configured to create `Engine` and `Car`. - * - * ```typescript - * @Injectable() - * class Engine { - * } - * - * @Injectable() - * class Car { - * constructor(public engine:Engine) {} - * } - * - * var injector = ReflectiveInjector.resolveAndCreate([Car, Engine]); - * var car = injector.get(Car); - * expect(car instanceof Car).toBe(true); - * expect(car.engine instanceof Engine).toBe(true); - * ``` - * - * Notice, we don't use the `new` operator because we explicitly want to have the `Injector` - * resolve all of the object's dependencies automatically. - * - * @stable - */ -var ReflectiveInjector = (function () { - function ReflectiveInjector() { - } - /** - * Turns an array of provider definitions into an array of resolved providers. - * - * A resolution is a process of flattening multiple nested arrays and converting individual - * providers into an array of {@link ResolvedReflectiveProvider}s. - * - * ### Example ([live demo](http://plnkr.co/edit/AiXTHi?p=preview)) - * - * ```typescript - * @Injectable() - * class Engine { - * } - * - * @Injectable() - * class Car { - * constructor(public engine:Engine) {} - * } - * - * var providers = ReflectiveInjector.resolve([Car, [[Engine]]]); - * - * expect(providers.length).toEqual(2); - * - * expect(providers[0] instanceof ResolvedReflectiveProvider).toBe(true); - * expect(providers[0].key.displayName).toBe("Car"); - * expect(providers[0].dependencies.length).toEqual(1); - * expect(providers[0].factory).toBeDefined(); - * - * expect(providers[1].key.displayName).toBe("Engine"); - * }); - * ``` - * - * See {@link ReflectiveInjector#fromResolvedProviders} for more info. - */ - ReflectiveInjector.resolve = function (providers) { - return reflective_provider_1.resolveReflectiveProviders(providers); - }; - /** - * Resolves an array of providers and creates an injector from those providers. - * - * The passed-in providers can be an array of `Type`, {@link Provider}, - * or a recursive array of more providers. - * - * ### Example ([live demo](http://plnkr.co/edit/ePOccA?p=preview)) - * - * ```typescript - * @Injectable() - * class Engine { - * } - * - * @Injectable() - * class Car { - * constructor(public engine:Engine) {} - * } - * - * var injector = ReflectiveInjector.resolveAndCreate([Car, Engine]); - * expect(injector.get(Car) instanceof Car).toBe(true); - * ``` - * - * This function is slower than the corresponding `fromResolvedProviders` - * because it needs to resolve the passed-in providers first. - * See {@link Injector#resolve} and {@link Injector#fromResolvedProviders}. - */ - ReflectiveInjector.resolveAndCreate = function (providers, parent) { - var ResolvedReflectiveProviders = ReflectiveInjector.resolve(providers); - return ReflectiveInjector.fromResolvedProviders(ResolvedReflectiveProviders, parent); - }; - /** - * Creates an injector from previously resolved providers. - * - * This API is the recommended way to construct injectors in performance-sensitive parts. - * - * ### Example ([live demo](http://plnkr.co/edit/KrSMci?p=preview)) - * - * ```typescript - * @Injectable() - * class Engine { - * } - * - * @Injectable() - * class Car { - * constructor(public engine:Engine) {} - * } - * - * var providers = ReflectiveInjector.resolve([Car, Engine]); - * var injector = ReflectiveInjector.fromResolvedProviders(providers); - * expect(injector.get(Car) instanceof Car).toBe(true); - * ``` - * @experimental - */ - ReflectiveInjector.fromResolvedProviders = function (providers, parent) { - return new ReflectiveInjector_(providers, parent); - }; - Object.defineProperty(ReflectiveInjector.prototype, "parent", { - /** - * Parent of this injector. - * - * - * - * ### Example ([live demo](http://plnkr.co/edit/eosMGo?p=preview)) - * - * ```typescript - * var parent = ReflectiveInjector.resolveAndCreate([]); - * var child = parent.resolveAndCreateChild([]); - * expect(child.parent).toBe(parent); - * ``` - */ - get: function () { }, - enumerable: true, - configurable: true - }); - return ReflectiveInjector; -}()); -exports.ReflectiveInjector = ReflectiveInjector; -var ReflectiveInjector_ = (function () { - /** - * Private - */ - function ReflectiveInjector_(_providers, _parent) { - /** @internal */ - this._constructionCounter = 0; - this._providers = _providers; - this._parent = _parent || null; - var len = _providers.length; - this.keyIds = new Array(len); - this.objs = new Array(len); - for (var i = 0; i < len; i++) { - this.keyIds[i] = _providers[i].key.id; - this.objs[i] = UNDEFINED; - } - } - ReflectiveInjector_.prototype.get = function (token, notFoundValue) { - if (notFoundValue === void 0) { notFoundValue = injector_1.THROW_IF_NOT_FOUND; } - return this._getByKey(reflective_key_1.ReflectiveKey.get(token), null, notFoundValue); - }; - Object.defineProperty(ReflectiveInjector_.prototype, "parent", { - get: function () { return this._parent; }, - enumerable: true, - configurable: true - }); - ReflectiveInjector_.prototype.resolveAndCreateChild = function (providers) { - var ResolvedReflectiveProviders = ReflectiveInjector.resolve(providers); - return this.createChildFromResolved(ResolvedReflectiveProviders); - }; - ReflectiveInjector_.prototype.createChildFromResolved = function (providers) { - var inj = new ReflectiveInjector_(providers); - inj._parent = this; - return inj; - }; - ReflectiveInjector_.prototype.resolveAndInstantiate = function (provider) { - return this.instantiateResolved(ReflectiveInjector.resolve([provider])[0]); - }; - ReflectiveInjector_.prototype.instantiateResolved = function (provider) { - return this._instantiateProvider(provider); - }; - ReflectiveInjector_.prototype.getProviderAtIndex = function (index) { - if (index < 0 || index >= this._providers.length) { - throw reflective_errors_1.outOfBoundsError(index); - } - return this._providers[index]; - }; - /** @internal */ - ReflectiveInjector_.prototype._new = function (provider) { - if (this._constructionCounter++ > this._getMaxNumberOfObjects()) { - throw reflective_errors_1.cyclicDependencyError(this, provider.key); - } - return this._instantiateProvider(provider); - }; - ReflectiveInjector_.prototype._getMaxNumberOfObjects = function () { return this.objs.length; }; - ReflectiveInjector_.prototype._instantiateProvider = function (provider) { - if (provider.multiProvider) { - var res = new Array(provider.resolvedFactories.length); - for (var i = 0; i < provider.resolvedFactories.length; ++i) { - res[i] = this._instantiate(provider, provider.resolvedFactories[i]); - } - return res; - } - else { - return this._instantiate(provider, provider.resolvedFactories[0]); - } - }; - ReflectiveInjector_.prototype._instantiate = function (provider, ResolvedReflectiveFactory) { - var _this = this; - var factory = ResolvedReflectiveFactory.factory; - var deps; - try { - deps = - ResolvedReflectiveFactory.dependencies.map(function (dep) { return _this._getByReflectiveDependency(dep); }); - } - catch (e) { - if (e.addKey) { - e.addKey(this, provider.key); - } - throw e; - } - var obj; - try { - obj = factory.apply(void 0, deps); - } - catch (e) { - throw reflective_errors_1.instantiationError(this, e, e.stack, provider.key); - } - return obj; - }; - ReflectiveInjector_.prototype._getByReflectiveDependency = function (dep) { - return this._getByKey(dep.key, dep.visibility, dep.optional ? null : injector_1.THROW_IF_NOT_FOUND); - }; - ReflectiveInjector_.prototype._getByKey = function (key, visibility, notFoundValue) { - if (key === INJECTOR_KEY) { - return this; - } - if (visibility instanceof metadata_1.Self) { - return this._getByKeySelf(key, notFoundValue); - } - else { - return this._getByKeyDefault(key, notFoundValue, visibility); - } - }; - ReflectiveInjector_.prototype._getObjByKeyId = function (keyId) { - for (var i = 0; i < this.keyIds.length; i++) { - if (this.keyIds[i] === keyId) { - if (this.objs[i] === UNDEFINED) { - this.objs[i] = this._new(this._providers[i]); - } - return this.objs[i]; - } - } - return UNDEFINED; - }; - /** @internal */ - ReflectiveInjector_.prototype._throwOrNull = function (key, notFoundValue) { - if (notFoundValue !== injector_1.THROW_IF_NOT_FOUND) { - return notFoundValue; - } - else { - throw reflective_errors_1.noProviderError(this, key); - } - }; - /** @internal */ - ReflectiveInjector_.prototype._getByKeySelf = function (key, notFoundValue) { - var obj = this._getObjByKeyId(key.id); - return (obj !== UNDEFINED) ? obj : this._throwOrNull(key, notFoundValue); - }; - /** @internal */ - ReflectiveInjector_.prototype._getByKeyDefault = function (key, notFoundValue, visibility) { - var inj; - if (visibility instanceof metadata_1.SkipSelf) { - inj = this._parent; - } - else { - inj = this; - } - while (inj instanceof ReflectiveInjector_) { - var inj_ = inj; - var obj = inj_._getObjByKeyId(key.id); - if (obj !== UNDEFINED) - return obj; - inj = inj_._parent; - } - if (inj !== null) { - return inj.get(key.token, notFoundValue); - } - else { - return this._throwOrNull(key, notFoundValue); - } - }; - Object.defineProperty(ReflectiveInjector_.prototype, "displayName", { - get: function () { - var providers = _mapProviders(this, function (b) { return ' "' + b.key.displayName + '" '; }) - .join(', '); - return "ReflectiveInjector(providers: [" + providers + "])"; - }, - enumerable: true, - configurable: true - }); - ReflectiveInjector_.prototype.toString = function () { return this.displayName; }; - return ReflectiveInjector_; -}()); -exports.ReflectiveInjector_ = ReflectiveInjector_; -var INJECTOR_KEY = reflective_key_1.ReflectiveKey.get(injector_1.Injector); -function _mapProviders(injector, fn) { - var res = new Array(injector._providers.length); - for (var i = 0; i < injector._providers.length; ++i) { - res[i] = fn(injector.getProviderAtIndex(i)); - } - return res; -} -//# sourceMappingURL=reflective_injector.js.map \ No newline at end of file diff --git a/src-2/externals/injection-js/reflective_injector.js.map b/src-2/externals/injection-js/reflective_injector.js.map deleted file mode 100644 index bf15be1..0000000 --- a/src-2/externals/injection-js/reflective_injector.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"reflective_injector.js","sourceRoot":"","sources":["../lib/reflective_injector.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;;AAEH,yBAA2C,YAAY,CAAC,CAAA;AACxD,yBAA6B,YAAY,CAAC,CAAA;AAE1C,kCAA2F,qBAAqB,CAAC,CAAA;AACjH,+BAA4B,kBAAkB,CAAC,CAAA;AAC/C,oCAAsH,uBAAuB,CAAC,CAAA;AAE9I,oCAAoC;AACpC,IAAM,SAAS,GAAG,IAAI,MAAM,EAAE,CAAC;AAE/B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH;IAAA;IA+NA,CAAC;IA9NC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgCG;IACI,0BAAO,GAAd,UAAe,SAAqB;QAClC,MAAM,CAAC,gDAA0B,CAAC,SAAS,CAAC,CAAC;IAC/C,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACI,mCAAgB,GAAvB,UAAwB,SAAqB,EAAE,MAAiB;QAC9D,IAAM,2BAA2B,GAAG,kBAAkB,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QAC1E,MAAM,CAAC,kBAAkB,CAAC,qBAAqB,CAAC,2BAA2B,EAAE,MAAM,CAAC,CAAC;IACvF,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACI,wCAAqB,GAA5B,UAA6B,SAAuC,EAAE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AAC,CAAC,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9C,CAAC;IACD,MAAM,CAAC,GAAG,CAAC;AACb,CAAC"} \ No newline at end of file diff --git a/src-2/externals/injection-js/reflective_key.d.ts b/src-2/externals/injection-js/reflective_key.d.ts deleted file mode 100644 index cb96651..0000000 --- a/src-2/externals/injection-js/reflective_key.d.ts +++ /dev/null @@ -1,36 +0,0 @@ -/** - * A unique object used for retrieving items from the {@link ReflectiveInjector}. - * - * Keys have: - * - a system-wide unique `id`. - * - a `token`. - * - * `Key` is used internally by {@link ReflectiveInjector} because its system-wide unique `id` allows - * the - * injector to store created objects in a more efficient way. - * - * `Key` should not be created directly. {@link ReflectiveInjector} creates keys automatically when - * resolving - * providers. - * @experimental - */ -export declare class ReflectiveKey { - token: Object; - id: number; - /** - * Private - */ - constructor(token: Object, id: number); - /** - * Returns a stringified token. - */ - readonly displayName: string; - /** - * Retrieves a `Key` for a token. - */ - static get(token: Object): ReflectiveKey; - /** - * @returns the number of keys registered in the system. - */ - static readonly numberOfKeys: number; -} diff --git a/src-2/externals/injection-js/reflective_key.js b/src-2/externals/injection-js/reflective_key.js deleted file mode 100644 index 5f403d1..0000000 --- a/src-2/externals/injection-js/reflective_key.js +++ /dev/null @@ -1,89 +0,0 @@ -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -"use strict"; -var lang_1 = require('./facade/lang'); -var forward_ref_1 = require('./forward_ref'); -/** - * A unique object used for retrieving items from the {@link ReflectiveInjector}. - * - * Keys have: - * - a system-wide unique `id`. - * - a `token`. - * - * `Key` is used internally by {@link ReflectiveInjector} because its system-wide unique `id` allows - * the - * injector to store created objects in a more efficient way. - * - * `Key` should not be created directly. {@link ReflectiveInjector} creates keys automatically when - * resolving - * providers. - * @experimental - */ -var ReflectiveKey = (function () { - /** - * Private - */ - function ReflectiveKey(token, id) { - this.token = token; - this.id = id; - if (!token) { - throw new Error('Token must be defined!'); - } - } - Object.defineProperty(ReflectiveKey.prototype, "displayName", { - /** - * Returns a stringified token. - */ - get: function () { return lang_1.stringify(this.token); }, - enumerable: true, - configurable: true - }); - /** - * Retrieves a `Key` for a token. - */ - ReflectiveKey.get = function (token) { - return _globalKeyRegistry.get(forward_ref_1.resolveForwardRef(token)); - }; - Object.defineProperty(ReflectiveKey, "numberOfKeys", { - /** - * @returns the number of keys registered in the system. - */ - get: function () { return _globalKeyRegistry.numberOfKeys; }, - enumerable: true, - configurable: true - }); - return ReflectiveKey; -}()); -exports.ReflectiveKey = ReflectiveKey; -/** - * @internal - */ -var KeyRegistry = (function () { - function KeyRegistry() { - this._allKeys = new Map(); - } - KeyRegistry.prototype.get = function (token) { - if (token instanceof ReflectiveKey) - return token; - if (this._allKeys.has(token)) { - return this._allKeys.get(token); - } - var newKey = new ReflectiveKey(token, ReflectiveKey.numberOfKeys); - this._allKeys.set(token, newKey); - return newKey; - }; - Object.defineProperty(KeyRegistry.prototype, "numberOfKeys", { - get: function () { return this._allKeys.size; }, - enumerable: true, - configurable: true - }); - return KeyRegistry; -}()); -exports.KeyRegistry = KeyRegistry; -var _globalKeyRegistry = new KeyRegistry(); -//# sourceMappingURL=reflective_key.js.map \ No newline at end of file diff --git a/src-2/externals/injection-js/reflective_key.js.map b/src-2/externals/injection-js/reflective_key.js.map deleted file mode 100644 index 8ee2cea..0000000 --- a/src-2/externals/injection-js/reflective_key.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"reflective_key.js","sourceRoot":"","sources":["../lib/reflective_key.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;;AAEH,qBAAwB,eAAe,CAAC,CAAA;AAExC,4BAAgC,eAAe,CAAC,CAAA;AAGhD;;;;;;;;;;;;;;;GAeG;AACH;IACE;;OAEG;IACH,uBAAmB,KAAa,EAAS,EAAU;QAAhC,UAAK,GAAL,KAAK,CAAQ;QA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AAI,CAAC,CAAC,CAAC;;;OAAA;IAC3D,kBAAC;AAAD,CAAC,AAhBD,IAgBC;AAhBY,mBAAW,cAgBvB,CAAA;AAED,IAAM,kBAAkB,GAAG,IAAI,WAAW,EAAE,CAAC"} \ No newline at end of file diff --git a/src-2/externals/injection-js/reflective_provider.d.ts b/src-2/externals/injection-js/reflective_provider.d.ts deleted file mode 100644 index 58dad27..0000000 --- a/src-2/externals/injection-js/reflective_provider.d.ts +++ /dev/null @@ -1,88 +0,0 @@ -import { Self, SkipSelf } from './metadata'; -import { Provider } from './provider'; -import { ReflectiveKey } from './reflective_key'; -/** - * `Dependency` is used by the framework to extend DI. - * This is internal to Angular and should not be used directly. - */ -export declare class ReflectiveDependency { - key: ReflectiveKey; - optional: boolean; - visibility: Self | SkipSelf | null; - constructor(key: ReflectiveKey, optional: boolean, visibility: Self | SkipSelf | null); - static fromKey(key: ReflectiveKey): ReflectiveDependency; -} -/** - * An internal resolved representation of a {@link Provider} used by the {@link Injector}. - * - * It is usually created automatically by `Injector.resolveAndCreate`. - * - * It can be created manually, as follows: - * - * ### Example ([live demo](http://plnkr.co/edit/RfEnhh8kUEI0G3qsnIeT?p%3Dpreview&p=preview)) - * - * ```typescript - * var resolvedProviders = Injector.resolve([{ provide: 'message', useValue: 'Hello' }]); - * var injector = Injector.fromResolvedProviders(resolvedProviders); - * - * expect(injector.get('message')).toEqual('Hello'); - * ``` - * - * @experimental - */ -export interface ResolvedReflectiveProvider { - /** - * A key, usually a `Type`. - */ - key: ReflectiveKey; - /** - * Factory function which can return an instance of an object represented by a key. - */ - resolvedFactories: ResolvedReflectiveFactory[]; - /** - * Indicates if the provider is a multi-provider or a regular provider. - */ - multiProvider: boolean; -} -export declare class ResolvedReflectiveProvider_ implements ResolvedReflectiveProvider { - key: ReflectiveKey; - resolvedFactories: ResolvedReflectiveFactory[]; - multiProvider: boolean; - constructor(key: ReflectiveKey, resolvedFactories: ResolvedReflectiveFactory[], multiProvider: boolean); - readonly resolvedFactory: ResolvedReflectiveFactory; -} -/** - * An internal resolved representation of a factory function created by resolving {@link - * Provider}. - * @experimental - */ -export declare class ResolvedReflectiveFactory { - /** - * Factory function which can return an instance of an object represented by a key. - */ - factory: Function; - /** - * Arguments (dependencies) to the `factory` function. - */ - dependencies: ReflectiveDependency[]; - constructor( - /** - * Factory function which can return an instance of an object represented by a key. - */ - factory: Function, - /** - * Arguments (dependencies) to the `factory` function. - */ - dependencies: ReflectiveDependency[]); -} -/** - * Resolve a list of Providers. - */ -export declare function resolveReflectiveProviders(providers: Provider[]): ResolvedReflectiveProvider[]; -/** - * Merges a list of ResolvedProviders into a list where - * each key is contained exactly once and multi providers - * have been merged. - */ -export declare function mergeResolvedReflectiveProviders(providers: ResolvedReflectiveProvider[], normalizedProvidersMap: Map): Map; -export declare function constructDependencies(typeOrFunc: any, dependencies?: any[]): ReflectiveDependency[]; diff --git a/src-2/externals/injection-js/reflective_provider.js b/src-2/externals/injection-js/reflective_provider.js deleted file mode 100644 index 7d48261..0000000 --- a/src-2/externals/injection-js/reflective_provider.js +++ /dev/null @@ -1,225 +0,0 @@ -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -"use strict"; -var reflection_1 = require('./reflection/reflection'); -var type_1 = require('./facade/type'); -var forward_ref_1 = require('./forward_ref'); -var injection_token_1 = require('./injection_token'); -var metadata_1 = require('./metadata'); -var reflective_errors_1 = require('./reflective_errors'); -var reflective_key_1 = require('./reflective_key'); -/** - * `Dependency` is used by the framework to extend DI. - * This is internal to Angular and should not be used directly. - */ -var ReflectiveDependency = (function () { - function ReflectiveDependency(key, optional, visibility) { - this.key = key; - this.optional = optional; - this.visibility = visibility; - } - ReflectiveDependency.fromKey = function (key) { - return new ReflectiveDependency(key, false, null); - }; - return ReflectiveDependency; -}()); -exports.ReflectiveDependency = ReflectiveDependency; -var _EMPTY_LIST = []; -var ResolvedReflectiveProvider_ = (function () { - function ResolvedReflectiveProvider_(key, resolvedFactories, multiProvider) { - this.key = key; - this.resolvedFactories = resolvedFactories; - this.multiProvider = multiProvider; - } - Object.defineProperty(ResolvedReflectiveProvider_.prototype, "resolvedFactory", { - get: function () { return this.resolvedFactories[0]; }, - enumerable: true, - configurable: true - }); - return ResolvedReflectiveProvider_; -}()); -exports.ResolvedReflectiveProvider_ = ResolvedReflectiveProvider_; -/** - * An internal resolved representation of a factory function created by resolving {@link - * Provider}. - * @experimental - */ -var ResolvedReflectiveFactory = (function () { - function ResolvedReflectiveFactory( - /** - * Factory function which can return an instance of an object represented by a key. - */ - factory, - /** - * Arguments (dependencies) to the `factory` function. - */ - dependencies) { - this.factory = factory; - this.dependencies = dependencies; - } - return ResolvedReflectiveFactory; -}()); -exports.ResolvedReflectiveFactory = ResolvedReflectiveFactory; -/** - * Resolve a single provider. - */ -function resolveReflectiveFactory(provider) { - var factoryFn; - var resolvedDeps; - if (provider.useClass) { - var useClass = forward_ref_1.resolveForwardRef(provider.useClass); - factoryFn = reflection_1.reflector.factory(useClass); - resolvedDeps = _dependenciesFor(useClass); - } - else if (provider.useExisting) { - factoryFn = function (aliasInstance) { return aliasInstance; }; - resolvedDeps = [ReflectiveDependency.fromKey(reflective_key_1.ReflectiveKey.get(provider.useExisting))]; - } - else if (provider.useFactory) { - factoryFn = provider.useFactory; - resolvedDeps = constructDependencies(provider.useFactory, provider.deps); - } - else { - factoryFn = function () { return provider.useValue; }; - resolvedDeps = _EMPTY_LIST; - } - return new ResolvedReflectiveFactory(factoryFn, resolvedDeps); -} -/** - * Converts the {@link Provider} into {@link ResolvedProvider}. - * - * {@link Injector} internally only uses {@link ResolvedProvider}, {@link Provider} contains - * convenience provider syntax. - */ -function resolveReflectiveProvider(provider) { - return new ResolvedReflectiveProvider_(reflective_key_1.ReflectiveKey.get(provider.provide), [resolveReflectiveFactory(provider)], provider.multi || false); -} -/** - * Resolve a list of Providers. - */ -function resolveReflectiveProviders(providers) { - var normalized = _normalizeProviders(providers, []); - var resolved = normalized.map(resolveReflectiveProvider); - var resolvedProviderMap = mergeResolvedReflectiveProviders(resolved, new Map()); - return Array.from(resolvedProviderMap.values()); -} -exports.resolveReflectiveProviders = resolveReflectiveProviders; -/** - * Merges a list of ResolvedProviders into a list where - * each key is contained exactly once and multi providers - * have been merged. - */ -function mergeResolvedReflectiveProviders(providers, normalizedProvidersMap) { - for (var i = 0; i < providers.length; i++) { - var provider = providers[i]; - var existing = normalizedProvidersMap.get(provider.key.id); - if (existing) { - if (provider.multiProvider !== existing.multiProvider) { - throw reflective_errors_1.mixingMultiProvidersWithRegularProvidersError(existing, provider); - } - if (provider.multiProvider) { - for (var j = 0; j < provider.resolvedFactories.length; j++) { - existing.resolvedFactories.push(provider.resolvedFactories[j]); - } - } - else { - normalizedProvidersMap.set(provider.key.id, provider); - } - } - else { - var resolvedProvider = void 0; - if (provider.multiProvider) { - resolvedProvider = new ResolvedReflectiveProvider_(provider.key, provider.resolvedFactories.slice(), provider.multiProvider); - } - else { - resolvedProvider = provider; - } - normalizedProvidersMap.set(provider.key.id, resolvedProvider); - } - } - return normalizedProvidersMap; -} -exports.mergeResolvedReflectiveProviders = mergeResolvedReflectiveProviders; -function _normalizeProviders(providers, res) { - providers.forEach(function (b) { - if (b instanceof type_1.Type) { - res.push({ provide: b, useClass: b }); - } - else if (b && typeof b == 'object' && b.provide !== undefined) { - res.push(b); - } - else if (b instanceof Array) { - _normalizeProviders(b, res); - } - else { - throw reflective_errors_1.invalidProviderError(b); - } - }); - return res; -} -function constructDependencies(typeOrFunc, dependencies) { - if (!dependencies) { - return _dependenciesFor(typeOrFunc); - } - else { - var params_1 = dependencies.map(function (t) { return [t]; }); - return dependencies.map(function (t) { return _extractToken(typeOrFunc, t, params_1); }); - } -} -exports.constructDependencies = constructDependencies; -function _dependenciesFor(typeOrFunc) { - var params = reflection_1.reflector.parameters(typeOrFunc); - if (!params) - return []; - if (params.some(function (p) { return p == null; })) { - throw reflective_errors_1.noAnnotationError(typeOrFunc, params); - } - return params.map(function (p) { return _extractToken(typeOrFunc, p, params); }); -} -function _extractToken(typeOrFunc, metadata, params) { - var token = null; - var optional = false; - if (!Array.isArray(metadata)) { - if (metadata instanceof metadata_1.Inject) { - return _createDependency(metadata['token'], optional, null); - } - else { - return _createDependency(metadata, optional, null); - } - } - var visibility = null; - for (var i = 0; i < metadata.length; ++i) { - var paramMetadata = metadata[i]; - if (paramMetadata instanceof type_1.Type) { - token = paramMetadata; - } - else if (paramMetadata instanceof metadata_1.Inject) { - token = paramMetadata['token']; - } - else if (paramMetadata instanceof metadata_1.Optional) { - optional = true; - } - else if (paramMetadata instanceof metadata_1.Self || paramMetadata instanceof metadata_1.SkipSelf) { - visibility = paramMetadata; - } - else if (paramMetadata instanceof injection_token_1.InjectionToken) { - token = paramMetadata; - } - } - token = forward_ref_1.resolveForwardRef(token); - if (token != null) { - return _createDependency(token, optional, visibility); - } - else { - throw reflective_errors_1.noAnnotationError(typeOrFunc, params); - } -} -function _createDependency(token, optional, visibility) { - return new ReflectiveDependency(reflective_key_1.ReflectiveKey.get(token), optional, visibility); -} -//# sourceMappingURL=reflective_provider.js.map \ No newline at end of file diff --git a/src-2/externals/injection-js/reflective_provider.js.map b/src-2/externals/injection-js/reflective_provider.js.map deleted file mode 100644 index dc5ed4b..0000000 --- a/src-2/externals/injection-js/reflective_provider.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"reflective_provider.js","sourceRoot":"","sources":["../lib/reflective_provider.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;;AAEH,2BAAwB,yBAAyB,CAAC,CAAA;AAClD,qBAAmB,eAAe,CAAC,CAAA;AAEnC,4BAAgC,eAAe,CAAC,CAAA;AAChD,gCAA6B,mBAAmB,CAAC,CAAA;AACjD,yBAA+C,YAAY,CAAC,CAAA;AAE5D,kCAAqG,qBAAqB,CAAC,CAAA;AAC3H,+BAA4B,kBAAkB,CAAC,CAAA;AAM/C;;;GAGG;AACH;IACE,8BACW,GAAk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AAM,CAAC,CAAC;IAC9C,CAAC;AACH,CAAC;AAED,2BACI,KAAU,EAAE,QAAiB,EAAE,UAAkC;IACnE,MAAM,CAAC,IAAI,oBAAoB,CAAC,8BAAa,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC;AAClF,CAAC"} \ No newline at end of file diff --git a/src-2/externals/injection-js/util/decorators.d.ts b/src-2/externals/injection-js/util/decorators.d.ts deleted file mode 100644 index 02f8571..0000000 --- a/src-2/externals/injection-js/util/decorators.d.ts +++ /dev/null @@ -1,162 +0,0 @@ -import { Type } from '../facade/type'; -/** - * Declares the interface to be used with {@link Class}. - * - * @stable - */ -export declare type ClassDefinition = { - /** - * Optional argument for specifying the superclass. - */ - extends?: Type; - /** - * Required constructor function for a class. - * - * The function may be optionally wrapped in an `Array`, in which case additional parameter - * annotations may be specified. - * The number of arguments and the number of parameter annotations must match. - * - * See {@link Class} for example of usage. - */ - constructor: Function | any[]; -} & { - /** - * Other methods on the class. Note that values should have type 'Function' but TS requires - * all properties to have a narrower type than the index signature. - */ - [x: string]: Type | Function | any[]; -}; -/** - * An interface implemented by all Angular type decorators, which allows them to be used as ES7 - * decorators as well as - * Angular DSL syntax. - * - * DSL syntax: - * - * ``` - * var MyClass = ng - * .Component({...}) - * .Class({...}); - * ``` - * - * ES7 syntax: - * - * ``` - * @ng.Component({...}) - * class MyClass {...} - * ``` - * @stable - */ -export interface TypeDecorator { - /** - * Invoke as ES7 decorator. - */ - >(type: T): T; - (target: Object, propertyKey?: string | symbol, parameterIndex?: number): void; - /** - * Storage for the accumulated annotations so far used by the DSL syntax. - * - * Used by {@link Class} to annotate the generated class. - */ - annotations: any[]; - /** - * Generate a class from the definition and annotate it with {@link TypeDecorator#annotations}. - */ - Class(obj: ClassDefinition): Type; -} -/** - * Provides a way for expressing ES6 classes with parameter annotations in ES5. - * - * ## Basic Example - * - * ``` - * var Greeter = ng.Class({ - * constructor: function(name) { - * this.name = name; - * }, - * - * greet: function() { - * alert('Hello ' + this.name + '!'); - * } - * }); - * ``` - * - * is equivalent to ES6: - * - * ``` - * class Greeter { - * constructor(name) { - * this.name = name; - * } - * - * greet() { - * alert('Hello ' + this.name + '!'); - * } - * } - * ``` - * - * or equivalent to ES5: - * - * ``` - * var Greeter = function (name) { - * this.name = name; - * } - * - * Greeter.prototype.greet = function () { - * alert('Hello ' + this.name + '!'); - * } - * ``` - * - * ### Example with parameter annotations - * - * ``` - * var MyService = ng.Class({ - * constructor: [String, [new Optional(), Service], function(name, myService) { - * ... - * }] - * }); - * ``` - * - * is equivalent to ES6: - * - * ``` - * class MyService { - * constructor(name: string, @Optional() myService: Service) { - * ... - * } - * } - * ``` - * - * ### Example with inheritance - * - * ``` - * var Shape = ng.Class({ - * constructor: (color) { - * this.color = color; - * } - * }); - * - * var Square = ng.Class({ - * extends: Shape, - * constructor: function(color, size) { - * Shape.call(this, color); - * this.size = size; - * } - * }); - * ``` - * @suppress {globalThis} - * @stable - */ -export declare function Class(clsDef: ClassDefinition): Type; -/** - * @suppress {globalThis} - */ -export declare function makeDecorator(name: string, props: { - [name: string]: any; -}, parentClass?: any, chainFn?: (fn: Function) => void): (...args: any[]) => (cls: any) => any; -export declare function makeParamDecorator(name: string, props: ([string, any] | { - [name: string]: any; -})[], parentClass?: any): any; -export declare function makePropDecorator(name: string, props: ([string, any] | { - [key: string]: any; -})[], parentClass?: any): any; diff --git a/src-2/externals/injection-js/util/decorators.js b/src-2/externals/injection-js/util/decorators.js deleted file mode 100644 index 97091b9..0000000 --- a/src-2/externals/injection-js/util/decorators.js +++ /dev/null @@ -1,291 +0,0 @@ -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -"use strict"; -var lang_1 = require('../facade/lang'); -var _nextClassId = 0; -var Reflect = lang_1.global['Reflect']; -function extractAnnotation(annotation) { - if (typeof annotation === 'function' && annotation.hasOwnProperty('annotation')) { - // it is a decorator, extract annotation - annotation = annotation.annotation; - } - return annotation; -} -function applyParams(fnOrArray, key) { - if (fnOrArray === Object || fnOrArray === String || fnOrArray === Function || - fnOrArray === Number || fnOrArray === Array) { - throw new Error("Can not use native " + lang_1.stringify(fnOrArray) + " as constructor"); - } - if (typeof fnOrArray === 'function') { - return fnOrArray; - } - if (Array.isArray(fnOrArray)) { - var annotations = fnOrArray; - var annoLength = annotations.length - 1; - var fn = fnOrArray[annoLength]; - if (typeof fn !== 'function') { - throw new Error("Last position of Class method array must be Function in key " + key + " was '" + lang_1.stringify(fn) + "'"); - } - if (annoLength != fn.length) { - throw new Error("Number of annotations (" + annoLength + ") does not match number of arguments (" + fn.length + ") in the function: " + lang_1.stringify(fn)); - } - var paramsAnnotations = []; - for (var i = 0, ii = annotations.length - 1; i < ii; i++) { - var paramAnnotations = []; - paramsAnnotations.push(paramAnnotations); - var annotation = annotations[i]; - if (Array.isArray(annotation)) { - for (var j = 0; j < annotation.length; j++) { - paramAnnotations.push(extractAnnotation(annotation[j])); - } - } - else if (typeof annotation === 'function') { - paramAnnotations.push(extractAnnotation(annotation)); - } - else { - paramAnnotations.push(annotation); - } - } - Reflect.defineMetadata('parameters', paramsAnnotations, fn); - return fn; - } - throw new Error("Only Function or Array is supported in Class definition for key '" + key + "' is '" + lang_1.stringify(fnOrArray) + "'"); -} -/** - * Provides a way for expressing ES6 classes with parameter annotations in ES5. - * - * ## Basic Example - * - * ``` - * var Greeter = ng.Class({ - * constructor: function(name) { - * this.name = name; - * }, - * - * greet: function() { - * alert('Hello ' + this.name + '!'); - * } - * }); - * ``` - * - * is equivalent to ES6: - * - * ``` - * class Greeter { - * constructor(name) { - * this.name = name; - * } - * - * greet() { - * alert('Hello ' + this.name + '!'); - * } - * } - * ``` - * - * or equivalent to ES5: - * - * ``` - * var Greeter = function (name) { - * this.name = name; - * } - * - * Greeter.prototype.greet = function () { - * alert('Hello ' + this.name + '!'); - * } - * ``` - * - * ### Example with parameter annotations - * - * ``` - * var MyService = ng.Class({ - * constructor: [String, [new Optional(), Service], function(name, myService) { - * ... - * }] - * }); - * ``` - * - * is equivalent to ES6: - * - * ``` - * class MyService { - * constructor(name: string, @Optional() myService: Service) { - * ... - * } - * } - * ``` - * - * ### Example with inheritance - * - * ``` - * var Shape = ng.Class({ - * constructor: (color) { - * this.color = color; - * } - * }); - * - * var Square = ng.Class({ - * extends: Shape, - * constructor: function(color, size) { - * Shape.call(this, color); - * this.size = size; - * } - * }); - * ``` - * @suppress {globalThis} - * @stable - */ -function Class(clsDef) { - var constructor = applyParams(clsDef.hasOwnProperty('constructor') ? clsDef.constructor : undefined, 'constructor'); - var proto = constructor.prototype; - if (clsDef.hasOwnProperty('extends')) { - if (typeof clsDef.extends === 'function') { - constructor.prototype = proto = - Object.create(clsDef.extends.prototype); - } - else { - throw new Error("Class definition 'extends' property must be a constructor function was: " + lang_1.stringify(clsDef.extends)); - } - } - for (var key in clsDef) { - if (key !== 'extends' && key !== 'prototype' && clsDef.hasOwnProperty(key)) { - proto[key] = applyParams(clsDef[key], key); - } - } - if (this && this.annotations instanceof Array) { - Reflect.defineMetadata('annotations', this.annotations, constructor); - } - var constructorName = constructor['name']; - if (!constructorName || constructorName === 'constructor') { - constructor['overriddenName'] = "class" + _nextClassId++; - } - return constructor; -} -exports.Class = Class; -/** - * @suppress {globalThis} - */ -function makeDecorator(name, props, parentClass, chainFn) { - var metaCtor = makeMetadataCtor([props]); - function DecoratorFactory(objOrType) { - if (!(Reflect && Reflect.getOwnMetadata)) { - throw 'reflect-metadata shim is required when using class decorators'; - } - if (this instanceof DecoratorFactory) { - metaCtor.call(this, objOrType); - return this; - } - var annotationInstance = new DecoratorFactory(objOrType); - var chainAnnotation = typeof this === 'function' && Array.isArray(this.annotations) ? this.annotations : []; - chainAnnotation.push(annotationInstance); - var TypeDecorator = function TypeDecorator(cls) { - var annotations = Reflect.getOwnMetadata('annotations', cls) || []; - annotations.push(annotationInstance); - Reflect.defineMetadata('annotations', annotations, cls); - return cls; - }; - TypeDecorator.annotations = chainAnnotation; - TypeDecorator.Class = Class; - if (chainFn) - chainFn(TypeDecorator); - return TypeDecorator; - } - if (parentClass) { - DecoratorFactory.prototype = Object.create(parentClass.prototype); - } - DecoratorFactory.prototype.toString = function () { return ("@" + name); }; - DecoratorFactory.annotationCls = DecoratorFactory; - return DecoratorFactory; -} -exports.makeDecorator = makeDecorator; -function makeMetadataCtor(props) { - return function ctor() { - var _this = this; - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i - 0] = arguments[_i]; - } - props.forEach(function (prop, i) { - var argVal = args[i]; - if (Array.isArray(prop)) { - // plain parameter - _this[prop[0]] = argVal === undefined ? prop[1] : argVal; - } - else { - for (var propName in prop) { - _this[propName] = - argVal && argVal.hasOwnProperty(propName) ? argVal[propName] : prop[propName]; - } - } - }); - }; -} -function makeParamDecorator(name, props, parentClass) { - var metaCtor = makeMetadataCtor(props); - function ParamDecoratorFactory() { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i - 0] = arguments[_i]; - } - if (this instanceof ParamDecoratorFactory) { - metaCtor.apply(this, args); - return this; - } - var annotationInstance = new ((_a = ParamDecoratorFactory).bind.apply(_a, [void 0].concat(args)))(); - ParamDecorator.annotation = annotationInstance; - return ParamDecorator; - function ParamDecorator(cls, unusedKey, index) { - var parameters = Reflect.getOwnMetadata('parameters', cls) || []; - // there might be gaps if some in between parameters do not have annotations. - // we pad with nulls. - while (parameters.length <= index) { - parameters.push(null); - } - parameters[index] = parameters[index] || []; - parameters[index].push(annotationInstance); - Reflect.defineMetadata('parameters', parameters, cls); - return cls; - } - var _a; - } - if (parentClass) { - ParamDecoratorFactory.prototype = Object.create(parentClass.prototype); - } - ParamDecoratorFactory.prototype.toString = function () { return ("@" + name); }; - ParamDecoratorFactory.annotationCls = ParamDecoratorFactory; - return ParamDecoratorFactory; -} -exports.makeParamDecorator = makeParamDecorator; -function makePropDecorator(name, props, parentClass) { - var metaCtor = makeMetadataCtor(props); - function PropDecoratorFactory() { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i - 0] = arguments[_i]; - } - if (this instanceof PropDecoratorFactory) { - metaCtor.apply(this, args); - return this; - } - var decoratorInstance = new ((_a = PropDecoratorFactory).bind.apply(_a, [void 0].concat(args)))(); - return function PropDecorator(target, name) { - var meta = Reflect.getOwnMetadata('propMetadata', target.constructor) || {}; - meta[name] = meta.hasOwnProperty(name) && meta[name] || []; - meta[name].unshift(decoratorInstance); - Reflect.defineMetadata('propMetadata', meta, target.constructor); - }; - var _a; - } - if (parentClass) { - PropDecoratorFactory.prototype = Object.create(parentClass.prototype); - } - PropDecoratorFactory.prototype.toString = function () { return ("@" + name); }; - PropDecoratorFactory.annotationCls = PropDecoratorFactory; - return PropDecoratorFactory; -} -exports.makePropDecorator = makePropDecorator; -//# sourceMappingURL=decorators.js.map \ No newline at end of file diff --git a/src-2/externals/injection-js/util/decorators.js.map b/src-2/externals/injection-js/util/decorators.js.map deleted file mode 100644 index 6f89177..0000000 --- a/src-2/externals/injection-js/util/decorators.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"decorators.js","sourceRoot":"","sources":["../../lib/util/decorators.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;;AAEH,qBAAgC,gBAAgB,CAAC,CAAA;AAGjD,IAAI,YAAY,GAAG,CAAC,CAAC;AACrB,IAAM,OAAO,GAAG,aAAM,CAAC,SAAS,CAAC,CAAC;AA8ElC,2BAA2B,UAAe;IACxC,EAAE,CAAC,CAAC,OAAO,UAAU,KAAK,UAAU,IAAI,UAAU,CAAC,cAAc,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;QAChF,wCAAwC;QACxC,UAAU,GAAG,UAAU,CAAC,UAAU,CAAC;IACrC,CAAC;IACD,MAAM,CAAC,UAAU,CAAC;AACpB,CAAC;AAED,qBAAqB,SAAuC,EAAE,GAAW;IACvE,EAAE,CAAC,CAAC,SAAS,KAAK,MAAM,IAAI,SAAS,KAAK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EzC;QAA8B,cAAc;aAAd,WAAc,CAAd,sBAAc,CAAd,IAAc;YAAd,6BAAc;;QAC1C,EAAE,CAAC,CAAC,IAAI,YAAY,oBAAoB,CAAC,CAAC,CAAC;YACzC,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;YAC3B,MAAM,CAAC,IAAI,CAAC;QACd,CAAC;QAED,IAAM,iBAAiB,GAAG,WAAU,oBAAqB,iCAAI,IAAI,KAAC,CAAC;QAEnE,MAAM,CAAC,uBAAuB,MAAW,EAAE,IAAY;YACrD,IAAM,IAAI,GAAG,OAAO,CAAC,cAAc,CAAC,cAAc,EAAE,MAAM,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;YAC9E,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;YAC3D,IAAI,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC;YACtC,OAAO,CAAC,cAAc,CAAC,cAAc,EAAE,IAAI,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC;QACnE,CAAC,CAAC;;IACJ,CAAC;IAED,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;QAChB,oBAAoB,CAAC,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;IACxE,CAAC;IAED,oBAAoB,CAAC,SAAS,CAAC,QAAQ,GAAG,cAAM,OAAA,OAAI,IAAI,CAAE,EAAV,CAAU,CAAC;IACrD,oBAAqB,CAAC,aAAa,GAAG,oBAAoB,CAAC;IACjE,MAAM,CAAC,oBAAoB,CAAC;AAC9B,CAAC;AA3Be,yBAAiB,oBA2BhC,CAAA"} \ No newline at end of file diff --git a/src/core/bootstrap.ts b/src/core/bootstrap.ts deleted file mode 100644 index ba57211..0000000 --- a/src/core/bootstrap.ts +++ /dev/null @@ -1,135 +0,0 @@ -import 'rxjs/add/observable/forkJoin'; -import { Type } from './decorators'; -import { ExtentionHooksEnum, ModuleEnum } from './enums'; -import { HookManager } from './hook'; -import { CoreModule, CoreProvide, ModuleManager } from './module'; -import * as Hoek from 'hoek'; -import { Observable } from 'rxjs/Rx'; -const debug = require('debug')('hapiness:bootstrap'); - -export interface ExtensionWithConfig { - token: Type; - config: any; -} - -export interface Extension { - value: any; - instance: any; - token: Type; -} - -/** - * OnExtensionLoad Hook - * - * @param {CoreModule} module - * @param {any} config - * @returns Observable - */ -export interface OnExtensionLoad { onExtensionLoad(module: CoreModule, config: any): Observable } - -/** - * OnModuleInstantiated Hook - * - * @param {CoreModule} module - * @returns Observable - */ -export interface OnModuleInstantiated { onModuleInstantiated(module: CoreModule): Observable } - -export class Hapiness { - - private static module: CoreModule; - - private static extensions: Extension[]; - - /** - * Entrypoint to bootstrap a module - * will load the extentions and trigger - * module's hooks - * - * @param {Type} module - * @param {Array|ExtensionWithConfig>} extensions? - * @returns Promise - */ - public static bootstrap(module: Type, extensions?: Array | ExtensionWithConfig>): Promise<{}> { - return new Promise((resolve, reject) => { - Hoek.assert(!!module, 'Please provide a module to bootstrap'); - Hoek.assert(typeof module === 'function', 'Wrong module to bootstrap'); - debug(`bootstrapping ${module.name}`); - this.module = ModuleManager.resolveModule(module); - let errors = []; - const extensionsObs = (extensions || []) - .map(ext => this.toExtensionWithConfig(ext)) - .map(ext => this.loadExtention(ext)) - .map(ext => ext.catch(e => errors = errors.concat(e))); - let _extensions = []; - Observable.merge(...extensionsObs).subscribe(result => { - _extensions = [].concat(_extensions, result).filter(_ => !(_ instanceof Error)); - }, /* istanbul ignore next */ _ => reject(_), () => { - this.extensions = [].concat(_extensions).filter(_ => !!_); - if (errors.length) { - return reject(errors.shift()); - } - const providers = this.extensions.map(ext => { - return { provide: ext.token, useValue: ext.value }; - }); - ModuleManager.instantiateModule(this.module, providers).subscribe(instance => { - this.module = instance; - Observable.forkJoin( - ModuleManager.getModules(this.module) - .filter(m => !!m.parent) - .filter(m => HookManager.hasLifecycleHook(ModuleEnum.OnRegister.toString(), m.token)) - .map(m => HookManager.triggerHook(ModuleEnum.OnRegister.toString(), m.token, m.instance)) - .concat(this.extensions.map(ext => this.moduleInstantiated(ext))) - .concat(Observable.of('')) - ) - .switchMap(_ => HookManager.triggerHook(ModuleEnum.OnStart.toString(), this.module.token, - this.module.instance, null, false)) - .subscribe(_ => resolve(), _ => reject(_)); - }, /* istanbul ignore next */ _ => reject(_)); - }); - }); - } - - /** - * Convert an extension type to ExtensionWithConfig - * - * @param {} extension - * @returns ExtensionWithConfig - */ - private static toExtensionWithConfig(extension): ExtensionWithConfig { - if (extension && extension.token) { - return extension; - } - return { - token: >extension, - config: {} - }; - } - - /** - * Call the OnExtensionLoad hook - * of an extension - * - * @param {ExtensionWithConfig} extension - * @returns Observable - */ - private static loadExtention(extension: ExtensionWithConfig): Observable { - debug(`loading ${extension.token.name}`); - const instance = Reflect.construct(extension.token, []); - return HookManager.triggerHook(ExtentionHooksEnum.OnExtensionLoad.toString(), - extension.token, instance, [ this.module, extension.config ]); - } - - /** - * Call the OnModuleInstantiated hook - * of an extension - * - * @param {Extension} extension - * @returns Observable - */ - private static moduleInstantiated(extension: Extension): Observable { - debug('moduleInstantiated', extension.token.name); - return HookManager.triggerHook(ExtentionHooksEnum.OnModuleInstantiated.toString(), - extension.token, extension.instance, [ this.module ]); - } -} diff --git a/src/core/di.ts b/src/core/di.ts index 5b32933..db17bcc 100644 --- a/src/core/di.ts +++ b/src/core/di.ts @@ -1,20 +1,34 @@ import { ReflectiveInjector } from '../externals/injection-js'; import { Type } from '../externals/injection-js/facade/type'; -import { ReflectiveDependency, ResolvedReflectiveProvider, ResolvedReflectiveFactory } from '../externals/injection-js/reflective_provider'; +import { + ReflectiveDependency, + ResolvedReflectiveProvider, + ResolvedReflectiveFactory +} from '../externals/injection-js/reflective_provider'; +import { CoreProvide } from './interfaces'; +import { InternalLogger } from './logger'; +import { Observable } from 'rxjs'; export class DependencyInjection { + private static logger = new InternalLogger('di'); + /** * Create a new DI and * can inherits from a parent DI * * @param {Type[]} providers * @param {ReflectiveInjector} parent? - * @returns ReflectiveInjector + * @returns Observable */ - static createAndResolve(providers: Type[], parent?: ReflectiveInjector): ReflectiveInjector { - return parent ? parent.resolveAndCreateChild(providers) - : ReflectiveInjector.resolveAndCreate(providers); + static createAndResolve(providers: Type[] | CoreProvide[], parent?: ReflectiveInjector): Observable { + return Observable + .of(parent) + .map(_ => !!_ ? + parent.resolveAndCreateChild(providers) : + ReflectiveInjector.resolveAndCreate(providers) + ) + .do(_ => this.logger.debug(`DI created, providers: ${providers.length}`)); } /** @@ -27,16 +41,15 @@ export class DependencyInjection { * @param {ReflectiveInjector} di * @returns T */ - static instantiateComponent(component: Type, di: ReflectiveInjector): T { - try { - const reflectiveDeps: ReflectiveDependency[] = ReflectiveInjector.resolve([component]) - .reduce((a, x: ResolvedReflectiveProvider) => a.concat(x.resolvedFactories), []) - .reduce((a, r: ResolvedReflectiveFactory) => a.concat(r.dependencies), []); - const deps = reflectiveDeps.map(d => di['_getByReflectiveDependency'](d)); - return Reflect.construct(component, deps); - } catch (e) { - console.error.apply(console, e); - } + static instantiateComponent(component: Type, di: ReflectiveInjector): Observable { + return Observable + .from(ReflectiveInjector.resolve([component])) + .reduce((a, x: ResolvedReflectiveProvider) => a.concat(x.resolvedFactories), []) + .map(_ => _.reduce((a, r: ResolvedReflectiveFactory) => a.concat(r.dependencies), [])) + .map(_ => _.filter(__ => !!__)) + .do(_ => this.logger.debug(`Component '${component.name}' deps: ${_.length}`)) + .map(_ => _.map(d => di['_getByReflectiveDependency'](d))) + .map(_ => Reflect.construct(component, _)); } } diff --git a/src/core/enums.ts b/src/core/enums.ts index 2ae568a..c64430d 100644 --- a/src/core/enums.ts +++ b/src/core/enums.ts @@ -8,3 +8,13 @@ export enum ModuleEnum { OnError = 'onError', OnRegister = 'onRegister' } + +/** + * Represents the position where + * the module is instantiate + */ +export enum ModuleLevel { + ROOT, + PRIMARY, + SECONDARY +} diff --git a/src-2/core/hapiness.ts b/src/core/hapiness.ts similarity index 97% rename from src-2/core/hapiness.ts rename to src/core/hapiness.ts index 9d7014a..7eca0b2 100644 --- a/src-2/core/hapiness.ts +++ b/src/core/hapiness.ts @@ -27,9 +27,11 @@ export class Hapiness { .checkArg(module) .flatMap(_ => ModuleManager.resolve(_)) .flatMap(_ => this.loadExtensions(extensions, _)) + .ignoreElements() .subscribe( - _ => resolve(), - _ => reject(_) + _ => {}, + _ => reject(_), + () => resolve() ) }); } @@ -167,7 +169,7 @@ export class Hapiness { ExtentionHooksEnum.OnModuleInstantiated.toString(), extension.token, extension.instance, - [ this.module ] + [ this.module, extension.value ] ) .do(_ => this.logger.debug(`moduleInstantiated ${extension.token.name}`)); } diff --git a/src/core/hook.ts b/src/core/hook.ts index 19791b0..86236f6 100644 --- a/src/core/hook.ts +++ b/src/core/hook.ts @@ -1,58 +1,53 @@ import { reflector } from '../externals/injection-js/reflection/reflection'; -import { Observable } from 'rxjs/Observable'; +import { Observable } from 'rxjs'; import { Type } from './decorators'; -import * as Hoek from 'hoek'; -const debug = require('debug')('hapiness:hook'); +import { InternalLogger } from './logger'; export class HookManager { - /** - * Check if a token has a hook implemented - * - * @param {string} hook - * @param {Type} token - * @returns boolean - */ - public static hasLifecycleHook(hook: string, token: Type): boolean { - debug('checking hook', hook, token ? token.name : null); - return reflector.hasLifecycleHook(token, hook); - } + private static logger = new InternalLogger('hook'); - /** - * Trigger the hook if - * it is implemented - * - * @param {string} hook - * @param {Type} token - * @param {T} instance - * @param {any[]} args - * @returns Observable - */ - public static triggerHook(hook: string, token: Type, instance: T, args?: any[], throwErr?: boolean): Observable { - debug('triggering hook', hook, token ? token.name : null); - Hoek.assert((!!token && !!instance), 'Cannot trigger without token/instance'); - if (this.hasLifecycleHook(hook, token)) { - try { - const result = Reflect.apply(instance[hook], instance, args || []); - if (result instanceof Observable) { - return result; - } else { - return Observable.create(observer => { - observer.next(result); - observer.complete(); - }); - } - } catch (e) { - console.error.apply(console, e); - } + /** + * Check if a token has a hook implemented + * + * @param {string} hook + * @param {Type} token + * @returns boolean + */ + public static hasLifecycleHook(hook: string, token: Type): boolean { + return reflector.hasLifecycleHook(token, hook); + } + + /** + * Trigger the hook if + * it is implemented + * + * @param {string} hook + * @param {Type} token + * @param {T} instance + * @param {any[]} args + * @param {boolean} throwErr + * @returns Observable + */ + public static triggerHook(hook: string, token: Type, instance: T, args?: any[], throwErr?: boolean): Observable { + this.logger.debug(`Triggering hook '${hook}' on '${token ? token.name : null}'`); + return Observable + .merge( + Observable + .of(this.hasLifecycleHook(hook, token)) + .filter(_ => !!_) + .map(_ => Reflect.apply(instance[hook], instance, args || [])) + .flatMap(_ => + (_ instanceof Observable) ? + _ : !!_ ? + Observable.of(_) : + Observable.empty() + ), + + Observable + .of(this.hasLifecycleHook(hook, token)) + .filter(_ => !_ && throwErr) + .flatMap(_ => Observable.throw(new Error(`Hook missing ${hook} on ${token ? token.name : null}`))) + ) } - return Observable.create((observer) => { - if (throwErr) { - observer.error(new Error(`Hook missing ${hook} on ${token.name}`)); - } else { - observer.next(); - } - observer.complete(); - }); - } } diff --git a/src/core/index.ts b/src/core/index.ts deleted file mode 100644 index b63d18d..0000000 --- a/src/core/index.ts +++ /dev/null @@ -1,7 +0,0 @@ -export * from './bootstrap'; -export * from './decorators'; -export * from './di'; -export * from './enums'; -export * from './hook'; -export * from './metadata'; -export * from './module'; diff --git a/src-2/core/interfaces/extension.ts b/src/core/interfaces/extension.ts similarity index 92% rename from src-2/core/interfaces/extension.ts rename to src/core/interfaces/extension.ts index d24540b..83716e9 100644 --- a/src-2/core/interfaces/extension.ts +++ b/src/core/interfaces/extension.ts @@ -28,4 +28,4 @@ export interface OnExtensionLoad { onExtensionLoad(module: CoreModule, config: a * @param {CoreModule} module * @returns Observable */ -export interface OnModuleInstantiated { onModuleInstantiated(module: CoreModule): Observable } +export interface OnModuleInstantiated { onModuleInstantiated(module: CoreModule, server: any): Observable } diff --git a/src-2/core/interfaces/index.ts b/src/core/interfaces/index.ts similarity index 100% rename from src-2/core/interfaces/index.ts rename to src/core/interfaces/index.ts diff --git a/src-2/core/interfaces/module.ts b/src/core/interfaces/module.ts similarity index 100% rename from src-2/core/interfaces/module.ts rename to src/core/interfaces/module.ts diff --git a/src-2/core/logger.ts b/src/core/logger.ts similarity index 100% rename from src-2/core/logger.ts rename to src/core/logger.ts diff --git a/src/core/metadata.ts b/src/core/metadata.ts index 30f099a..5c7cb9b 100644 --- a/src/core/metadata.ts +++ b/src/core/metadata.ts @@ -42,5 +42,5 @@ export function extractMetadatas(decorator: any): any[] { .filter(x => x === 'annotations') .map(x => Reflect.getOwnMetadata(x, decorator)) .map(x => [].concat(x)) - .pop(); + .pop() || []; }; diff --git a/src/core/module.ts b/src/core/module.ts index 82a9c1b..751e13c 100644 --- a/src/core/module.ts +++ b/src/core/module.ts @@ -1,235 +1,245 @@ +import { Observable } from 'rxjs'; +import { InternalLogger } from './logger'; import { extractMetadataByDecorator } from './metadata'; -import { ReflectiveInjector } from '../externals/injection-js'; import { HapinessModule, Type, InjectionToken } from './decorators'; +import { CoreModule, CoreProvide, CoreModuleWithProviders } from './interfaces'; import { DependencyInjection } from './di'; -import * as Hoek from 'hoek'; -import { Observable } from 'rxjs/Rx'; -const debug = require('debug')('hapiness:module'); +import { ModuleLevel } from './enums'; -/** - * CoreProvide Type - * Used by CoreModule Type - */ -export interface CoreProvide { - provide: any; - useClass?: any; - useValue?: any; - useExisting?: any; - useFactory?: any; - deps?: any[]; -} - -/** - * CoreModule Type - * Represents a Module - */ -export class CoreModule { - token: Type | any; - name: string; - version: string; - instance?: any; - level: ModuleLevel; - di?: ReflectiveInjector; - providers?: CoreProvide[]; - modules?: CoreModule[]; - parent?: CoreModule; - exports?: Type[] | any[]; - declarations?: Type[] | any[]; -} - -/** - * CoreModuleWithProviders Type - * Used to pass data while module importation - */ -export interface CoreModuleWithProviders { - module: Type; - providers: CoreProvide[]; -} +export class ModuleManager { -/** - * Represents the position where - * the module is instantiate - */ -export enum ModuleLevel { - ROOT, - PRIMARY, - SECONDARY -} + private static decoratorName = 'HapinessModule'; -/** - * ModuleManage - * Class used to manage modules - */ -export class ModuleManager { + private static logger = new InternalLogger('module'); /** - * Helper to extract metadata - * @property {string} decoratorName + * Resolve into a tree of CoreModule + * + * @param {any} module + * @returns Observable */ - private static decoratorName = 'HapinessModule'; + static resolve(module: any): Observable { + this.logger.debug(`Resolving module '${module.name}'`); + return this.resolution(module); + } + + static instantiate(module: CoreModule, providers?: CoreProvide[]): Observable { + this.logger.debug(`Instantiation of module '${module.name}'`); + return this.instantiation(module, providers); + } /** - * Entrypoint to resolve a CoreModule - * Get the metadata. + * Get all the tree modules * - * @param {Type} module - * @param {CoreProvide[]} providers + * @param {CoreModule} module * @returns CoreModule */ - public static resolveModule(module: any): CoreModule { - debug('building module', module.name); - const moduleResolved = this.recursiveResolution(module, null); - debug('module resolved', module.name); - return moduleResolved; + static getModules(module: CoreModule): CoreModule[] { + const lookup = (_module: CoreModule) => { + return [] + .concat(_module) + .concat([] + .concat(_module.modules) + .filter(_ => !!_) + .map(m => lookup(m)) + .reduce((a, c) => a.concat(c), []) + ); + }; + return lookup(module); } - public static instantiateModule(module: CoreModule, providers?: CoreProvide[]): Observable { - debug('instantiate module', module.name, 'extra providers:', providers ? providers.length : 0); - return Observable.create(observer => { - try { - observer.next(this.recursiveInstantiation(module, null, providers)); - observer.complete(); - } catch (err) { - /* istanbul ignore next */ - observer.error(err); - /* istanbul ignore next */ - observer.complete(); - } - }); + /** + * Helper to convert provider + * to a CoreProvide type + * + * @param {any} provider + * @returns CoreProvide + */ + static toCoreProvider(provider: any): CoreProvide { + return (!!provider.provide ? + provider : + { provide: provider, useClass: provider } + ); } /** - * Lookup for module in the - * importation tree by its name + * =========================================================================== + * + * MODULE RESOLUTION * - * @param name - * @param module - * @returns CoreModule | null + * =========================================================================== */ - public static findNestedModule(name: string, module: CoreModule): CoreModule { - debug(`looking for nested module ${name} in ${module.name}`); - if (module.modules && module.modules.length > 0 && - module.modules.find(m => m.name === name)) { - debug(`found nested module ${name} in ${module.name}`); - return module.modules.find(m => m.name === name); - } else if (module.modules && module.modules.length > 0) { - debug(`looking in sub-modules`); - return module.modules - .map(m => this.findNestedModule(name, m)) - .filter(m => !!m) - .shift(); - } - debug(`didn't find module ${name}`); - } /** - * Get elements of a module + * Process module to CoreModule type + * from metadata and the children * - * @param {CoreModule} module - * @param {string} element - * @returns Type + * @param {any} module + * @param {CoreModule} parent? + * @returns Observable */ - public static getElements(module: CoreModule, element: string): Type[] { - Hoek.assert(!!element, 'You need to provide the element you want to get'); - const lookup = (_module: CoreModule) => { - const els = [].concat((_module[element] && Array.isArray(_module[element])) ? _module[element] : []); - return (_module.modules || []).map(m => lookup(m)).reduce((acc, cur) => acc.concat(cur), []).concat(els).filter(_ => !!_); - }; - return lookup(module); + private static resolution(module: any, parent?: CoreModule): Observable { + return Observable + .of(module) + .map(_ => this.toCoreModuleWithProviders(_)) + .flatMap(cmwp => + this + .extractMetadata(cmwp.module) + .map(_ => ({ metadata: _, moduleWithProviders: cmwp })) + ) + .flatMap(mcmwp => + this + .metadataToCoreModule(mcmwp.metadata, mcmwp.moduleWithProviders, parent) + .map(_ => this.coreModuleParentConfigProviders(_)) + .map(_ => Object.assign({ module: _ }, mcmwp)) + ) + .flatMap(data => + Observable + .from(data.metadata.imports || []) + .flatMap(_ => this.resolution(_, data.module)) + .toArray() + .do(_ => this.logger.debug(`'${data.module.name}' got ${_.length} children`)) + .map(_ => Object.assign({ modules: _ }, data.module)) + ) } /** - * Get all the tree modules + * FIX for exported providers + * that need internal config * + * @todo find a better solution * @param {CoreModule} module * @returns CoreModule */ - public static getModules(module: CoreModule): CoreModule[] { - const lookup = (_module: CoreModule) => { - return [].concat(_module).concat((_module.modules || []).map(m => lookup(m)).reduce((a, c) => a.concat(c), [])); - }; - return lookup(module); + private static coreModuleParentConfigProviders(module: CoreModule): CoreModule { + module.providers = [] + .concat(module.providers) + .concat((module.parent && module.parent.providers) ? + module.parent.providers.filter(_ => (_.provide instanceof InjectionToken)) : + [] + ) + .filter(_ => !!_); + return module; } /** - * Transform metadata to instance CoreModule - * - * @param {HapinessModule} data - * @param {Type} module - * @param {CoreModule} parent - * @returns CoreModule - */ - private static coreModuleFromMetadata(data: HapinessModule, module: CoreModuleWithProviders, parent?: CoreModule): CoreModule { - const providers = data.providers || []; - debug('converting module to CoreModule', module.module.name); - return { - parent, - token: module.module, - name: module.module.name, - version: data.version, - exports: data.exports, - declarations: data.declarations || [], - providers: providers.concat(module.providers).map((p: any) => !!p.provide ? - /* istanbul ignore next */ p : {provide: p, useClass: p}), - level: parent ? parent.level === ModuleLevel.ROOT ? - ModuleLevel.PRIMARY : ModuleLevel.SECONDARY : ModuleLevel.ROOT - }; + * Convert metadata to CoreModule type + * + * @param {HapinessModule} metadata + * @param {CoreModuleWithProviders} moduleWithProviders + * @param {CoreModule} parent? + * @returns Observable + */ + private static metadataToCoreModule( + metadata: HapinessModule, + moduleWithProviders: CoreModuleWithProviders, + parent?: CoreModule): Observable { + + return Observable + .of({ + parent, + token: moduleWithProviders.module, + name: moduleWithProviders.module.name, + version: metadata.version, + exports: metadata.exports || [], + declarations: metadata.declarations || [], + providers: (metadata.providers || []) + .concat(moduleWithProviders.providers) + .map(_ => this.toCoreProvider(_)), + level: !!parent ? + parent.level === ModuleLevel.ROOT ? + ModuleLevel.PRIMARY : + ModuleLevel.SECONDARY : + ModuleLevel.ROOT + }) + .do(_ => this.logger.debug(`Build CoreModule for '${_.name}'`)); } /** - * Extract metadata from - * the module provided + * Get HapinessModule metadata type + * if does not exist, throw an error * - * @todo Metadata interface matching... * @param {Type} module - * @returns HapinessModule + * @returns Observable */ - public static metadataFromModule(module: Type): HapinessModule { - debug('metadata for', module.name); - const metadata = extractMetadataByDecorator(module, this.decoratorName); - Hoek.assert(!!metadata, new Error('Please define a Module with the right annotation')); - return metadata; + private static extractMetadata(module: Type): Observable { + return Observable + .of(extractMetadataByDecorator(module, this.decoratorName)) + .flatMap(_ => !!_ ? + Observable.of(_) : + Observable.throw(new Error(`Module '${module ? module.name : null}' resolution failed: No metadata`)) + ) } /** - * Resolve recursively - * each module imported + * Make sure to convert module into + * a CoreModuleWithProviders type * - * @todo Fix circular importation !!! - * @param {Type|CoreModuleWithProviders} module - * @param {CoreModule} parent - * @param {CoreProvide[]} providers - * @returns CoreModule + * @param {CoreModuleWithProviders|Type} module + * @returns CoreModuleWithProviders */ - private static recursiveResolution(module: CoreModuleWithProviders, parent?: CoreModule): CoreModule { - if (!module['module']) { - module = { + private static toCoreModuleWithProviders(module: CoreModuleWithProviders | Type): CoreModuleWithProviders { + return ((module && module['module']) ? + module : + { module, providers: [] - } - } - debug('recursive resolution', module.module.name); - const metadata = this.metadataFromModule(module.module); - const coreModule = this.coreModuleFromMetadata(metadata, module, parent); - coreModule.providers = coreModule.providers.concat( - (parent && parent.providers) ? - parent.providers.filter(_ => (_.provide instanceof InjectionToken)) : - [] - ); - coreModule.modules = (metadata.imports && metadata.imports.length > 0) ? - metadata.imports.map(m => this.recursiveResolution(m, coreModule)) : []; - return coreModule; + }); } - private static recursiveInstantiation(module: CoreModule, parent?: CoreModule, providers?: CoreProvide[]): CoreModule { - debug('recursive instantiation', module.name); - if (module.modules && module.modules.length > 0) { - module.modules.forEach(m => this.recursiveInstantiation(m, module, providers)); - } - module.di = DependencyInjection.createAndResolve(this.collectProviders(module, providers)); - module.instance = DependencyInjection.instantiateComponent(module.token, module.di); - this.instantiateLibs(module); - return module; + /** + * =========================================================================== + * + * MODULE INSTANTIATION + * + * =========================================================================== + */ + + /** + * Create the module's DI + * and instantiate the module + * + * @param {CoreModule} module + * @param {CoreProvide[]} providers? + * @param {CoreModule} parent? + * @returns Observable + */ + private static instantiation(module: CoreModule, providers?: CoreProvide[], parent?: CoreModule): Observable { + return Observable + .of(module) + .flatMap(_ => + Observable + .from(_.modules) + .flatMap(child => this.instantiation(child, providers, parent)) + .toArray() + .map(children => Object.assign({}, _, { modules: children })) + ) + .flatMap(_ => + DependencyInjection + .createAndResolve(this.collectProviders(_, providers)) + .map(di => Object.assign({ di }, _)) + ) + .flatMap(_ => + DependencyInjection + .instantiateComponent(_.token, _.di) + .map(instance => Object.assign({ instance }, _)) + ) + .flatMap(_ => this.instantiateLibs(_)); + } + + /** + * Instantiate and return array of libs + * + * @param {CoreModule} module + * @returns Type + */ + private static instantiateLibs(module: CoreModule): Observable { + return Observable + .from(module.declarations) + .filter(_ => !!extractMetadataByDecorator(_, 'Lib')) + .flatMap(_ => DependencyInjection.instantiateComponent(_, module.di)) + .toArray() + .map(_ => module); } /** @@ -238,60 +248,34 @@ export class ModuleManager { * * @param {HapinessModule} module */ - private static collectProviders(module: CoreModule, providers?: CoreProvide[]): any[] { - debug('collect providers'); - return [].concat(module.providers || []) + private static collectProviders(module: CoreModule, providers?: CoreProvide[]): CoreProvide[] { + this.logger.debug(`Collect providers for '${module.name}'`); + return [] + .concat(module.providers) .concat(providers) - .filter(x => !!x) + .filter(_ => !!_) .concat(this.extractExportedProviders(module)); } /** - * Extract exported providers + * Extract exported children providers * * @param {CoreModule} module - * @returns CoreProvide + * @returns CoreProvide[] */ private static extractExportedProviders(module: CoreModule): CoreProvide[] { - Hoek.assert(!!module, 'Provide a module'); - debug('exported providers extraction', module.name); - return (module.modules || []) + this.logger.debug(`Extract exported children providers for '${module.name}'`); + return [] + .concat(module.modules) .filter(_ => (!!_.exports && _.exports.length > 0)) - .map(_ => { - const exp = _.exports; - return exp.concat((_.providers || []).filter(__ => (__.provide instanceof InjectionToken))); - }) + .map(_ => [] + .concat(_.exports) + .concat( + _.providers + .filter(__ => (__.provide instanceof InjectionToken))) + ) .reduce((a, c) => a.concat(c), []) - .filter(_ => !!_); - } - - /** - * Instantiate and return array of libs - * - * @param {CoreModule} module - * @returns Type - */ - private static instantiateLibs(module: CoreModule): Type[] { - return [].concat(module.declarations).filter(decl => !!extractMetadataByDecorator(decl, 'Lib')) - .map(lib => >DependencyInjection.instantiateComponent(lib, module.di)); + .filter(_ => !!_) + .map(_ => this.toCoreProvider(_)); } } - -/** - * Module Lifecycle Hook - * called once the module has been - * registered into the server - * - * @returns void - */ -export interface OnRegister { onRegister(): void; } - -/** - * Module Lifecycle Hook - * called once the server has started - * only for the MainModule - * - * @returns void - */ -export interface OnStart { onStart(): void; } - diff --git a/src/extensions/http-server/decorators.ts b/src/extensions/http-server/decorators.ts index 28a2c8b..aa796b8 100644 --- a/src/extensions/http-server/decorators.ts +++ b/src/extensions/http-server/decorators.ts @@ -5,13 +5,13 @@ export interface Route { path: string; method: string | string[]; config?: RouteConfig; - providers?: Array|any>; + // providers?: Array|any>; } export const Route = createDecorator('Route', { path: undefined, method: undefined, - config: undefined, - providers: undefined + config: undefined + // providers: undefined }); export interface Lifecycle { diff --git a/src/extensions/http-server/extension.ts b/src/extensions/http-server/extension.ts index ae0142c..849492b 100644 --- a/src/extensions/http-server/extension.ts +++ b/src/extensions/http-server/extension.ts @@ -1,24 +1,18 @@ -import { ExtensionWithConfig } from '../../core'; -import { Extension, OnExtensionLoad, OnModuleInstantiated } from '../../core/bootstrap'; +import { ModuleLevel } from '../../core/enums'; import { DependencyInjection } from '../../core/di'; import { HookManager } from '../../core/hook'; import { extractMetadataByDecorator } from '../../core/metadata'; -import { CoreModule, ModuleManager } from '../../core/module'; +import { ModuleManager } from '../../core/module'; +import { errorHandler } from '../../core/hapiness'; +import { CoreModule, OnExtensionLoad, OnModuleInstantiated, ExtensionWithConfig, Extension } from '../../core/interfaces'; import { Lifecycle } from './decorators'; +import { Type } from '../../core/decorators'; import { enumByMethod, LifecycleComponentEnum } from './enums'; import { LifecycleManager } from './lifecycle'; -import { CoreRoute, RouteBuilder } from './route'; -import { Observable } from 'rxjs/Observable'; -import { RouteConfiguration, Server } from 'hapi'; -import * as Boom from 'boom'; -import * as Hoek from 'hoek'; -import * as Debug from 'debug'; -const debug = Debug('hapiness:extension:httpserver'); - -export interface HapiConfig { - host: string; - port: number; -} +import { RouteBuilder } from './route'; +import { CoreRoute, HapiConfig } from './interfaces'; +import { Observable } from 'rxjs'; +import { RouteConfiguration, Server, Request, ReplyNoContinue, ReplyWithContinue } from 'hapi'; export class HttpServerExt implements OnExtensionLoad, OnModuleInstantiated { @@ -31,161 +25,154 @@ export class HttpServerExt implements OnExtensionLoad, OnModuleInstantiated { }; } - onExtensionLoad(module: CoreModule, config: HapiConfig): Observable { - this.server = new Server(); - const connection = this.server.connection(config); - debug('server instantiation'); - return Observable.create(observer => { - Observable.forkJoin( - this.registrationObservables(module, this.server, this.flattenModules(module)).concat(this.addRoutes(module, this.server)) - ).subscribe(routes => { - debug('routes and plugins registered'); - LifecycleManager.routeLifecycle(this.server, routes.reduce((a, c) => a.concat(c), [])); - observer.next({ - instance: this, - token: HttpServerExt, - value: this.server - }); - observer.complete(); - }, err => { - observer.error(err); - observer.complete(); - }); - }); - } - - onModuleInstantiated(module: CoreModule) { - return Observable.create(observer => { - this.instantiateLifecycle(this.server, module); - this.server.start() - .then(() => { - debug('http server started', this.server.info.uri); - observer.next(); - observer.complete(); - }) - .catch(err => { - observer.error(err); - observer.complete(); - }); - }); - } - /** - * Lookup into the tree of imports - * and flat the tree into a string array of names + * Initialize HapiJS Server + * Add routes by modules + * Add Lifecycle handlers * - * @returns string[] + * @param {CoreModule} module + * @param {HapiConfig} config + * @returns Observable */ - private flattenModules(module: CoreModule): string[] { - const recursive = (_module: CoreModule) => { - if (_module.modules && _module.modules.length > 0) { - return _module.modules.reduce((acc, cur) => acc.concat(recursive(cur)), [].concat(_module.modules)); - } - return []; - }; - debug('flatten modules'); - return recursive(module).map(a => a.name).filter((a, p, arr) => arr.indexOf(a) === p); + onExtensionLoad(module: CoreModule, config: HapiConfig): Observable { + return Observable + .of(new Server(config.options)) + .do(_ => _.connection({ host: config.host, port: config.port })) + .flatMap(server => + Observable + .from(ModuleManager.getModules(module)) + .flatMap(_ => this.registerPlugin(_, server)) + .reduce((a, c) => a.concat(c), []) + .do(_ => LifecycleManager.routeLifecycle(server, _)) + .map(_ => ({ + instance: this, + token: HttpServerExt, + value: server + })) + ) } /** - * Register each module imported - * as HapiJS plugin + * Build Lifecycle components + * Start HapiJS Server * - * @param {string[]} names + * @param {CoreModule} module + * @param {Server} server * @returns Observable */ - private registrationObservables(module: CoreModule, server: Server, names: string[]): Observable[] { - return names - .map(n => ModuleManager.findNestedModule(n, module)) - .filter(m => !!m) - .map(m => this.registerPlugin(m, server)); + onModuleInstantiated(module: CoreModule, server: Server): Observable { + return this + .instantiateLifecycle(module, server) + .flatMap(_ => + Observable + .fromPromise(server.start()) + ); } /** * Register a HapiJS Plugin * * @param {CoreModule} module + * @param {Server} server * @returns Observable */ private registerPlugin(module: CoreModule, server: Server): Observable { - Hoek.assert(!!module, 'Module argument is missing'); - const pluginName = `${module.name}.hapinessplugin`; - debug('registering plugin', pluginName); - return Observable.create((observer) => { - const register: any = (_server, options, next) => { - return next(); - }; - register.attributes = { - name: pluginName, + return Observable + .of(_ => (s, o, n) => n()) + .do(_ => _['attributes'] = { + name: `${module.name}.hapinessplugin`, version: module.version - }; - server.register(register) - .then(() => { - this.addRoutes(module, server) - .subscribe(routes => { - debug('plugin registered', pluginName); - observer.next(routes); - observer.complete(); - }); - }) - .catch((error) => { - observer.error(error); - }); - }); + }) + .flatMap(_ => Observable.fromPromise(server.register(_))) + .flatMap(_ => this.addRoutes(module, server)); } /** - * Add route from CoreModule + * Add routes from CoreModule * * @param {CoreModule} module * @param {Server} server * @returns Observable */ private addRoutes(module: CoreModule, server: Server): Observable { - Hoek.assert((!!module && !!server), Boom.create(500, 'Please provide module and HapiJS server instance')); - return Observable.create(observer => { - const routes = RouteBuilder.buildRoutes(module) || []; - debug('add routes', module.name, routes.length); - routes.forEach(route => { - const config = Object.assign({ - handler: (req, reply) => { - debug('route handler', req.method, req.path); - HookManager.triggerHook( - enumByMethod(req.method).toString(), - route.token, - req['_hapinessRoute'], - [ req, reply ] - ); - } - }, route.config); - server.route({ - method: route.method, - path: route.path, - config - }); - }); - observer.next(routes); - observer.complete(); - }); + return Observable + .from(RouteBuilder.buildRoutes(module)) + .do(_ => + server + .route({ + method: _.method, + path: _.path, + config: Object.assign({ + handler: (request, reply) => this.httpHandler(request, reply, _) + }, _.config) + }) + ) + .toArray(); } /** + * Trigger the http handler hook + * Reply automatically + * + * @param {Request} request + * @param {ReplyNoContinue} reply + * @param {CoreRoute} route + * @returns void + */ + private httpHandler(request: Request, reply: ReplyNoContinue, route: CoreRoute): void { + HookManager + .triggerHook( + enumByMethod(request.method).toString(), + route.token, + request['_hapinessRoute'], + [ request, reply ] + ) + .map(_ => !!_.statusCode ? _ : { statusCode: 200, response: _ }) + .subscribe( + _ => + reply(_.response) + .code(!!_.response ? _.statusCode : 204), + _ => { + errorHandler(_); + reply(_); + } + ); + } + + /** * Initialize and instantiate lifecycle components * - * @param {Server} server * @param {CoreModule} module + * @param {Server} server */ - private instantiateLifecycle(server: Server, module: CoreModule) { - ModuleManager.getModules(module).forEach(_module => { - [].concat(_module.declarations).filter(decl => !!extractMetadataByDecorator(decl, 'Lifecycle')) - .map(lc => { - debug('add lifecycle', lc.name, _module.token.name); - const metadata = extractMetadataByDecorator(lc, 'Lifecycle'); - server.ext(metadata.event, (request, reply) => { - const instance = DependencyInjection.instantiateComponent(lc, _module.di); - HookManager.triggerHook(LifecycleComponentEnum.OnEvent.toString(), lc, instance, [ request, reply ]); - }); - }); - }); + private instantiateLifecycle(module: CoreModule, server: Server): Observable { + return Observable + .from([].concat(module.declarations)) + .filter(_ => !!_ && !!extractMetadataByDecorator(_, 'Lifecycle')) + .map(_ => ({ metadata: extractMetadataByDecorator(_, 'Lifecycle'), token: _ })) + .do(_ => + server.ext(_.metadata.event, (request: Request, reply: ReplyWithContinue) => { + this + .eventHandler(_.token, module, request, reply) + .subscribe( + () => {}, + err => errorHandler(err) + ) + }) + ) + .ignoreElements(); + } + + private eventHandler(lifecycle: Type, module: CoreModule, request: Request, reply: ReplyWithContinue): Observable { + return Observable + .of(lifecycle) + .flatMap(lc => + DependencyInjection + .instantiateComponent(lc, module.di) + .flatMap(_ => + HookManager + .triggerHook(LifecycleComponentEnum.OnEvent.toString(), lc, _, [request, reply]) + ) + ); } } diff --git a/src/extensions/http-server/index.ts b/src/extensions/http-server/index.ts index afc0344..807332a 100644 --- a/src/extensions/http-server/index.ts +++ b/src/extensions/http-server/index.ts @@ -2,4 +2,5 @@ export * from './extension'; export * from './decorators'; export * from './lifecycle'; export * from './route'; +export * from './interfaces'; export { Server, Request, ReplyNoContinue, ReplyWithContinue } from 'hapi'; diff --git a/src-2/extensions/http-server/interfaces.ts b/src/extensions/http-server/interfaces.ts similarity index 100% rename from src-2/extensions/http-server/interfaces.ts rename to src/extensions/http-server/interfaces.ts diff --git a/src/extensions/http-server/lifecycle.ts b/src/extensions/http-server/lifecycle.ts index 1e87e83..7d58522 100644 --- a/src/extensions/http-server/lifecycle.ts +++ b/src/extensions/http-server/lifecycle.ts @@ -1,13 +1,10 @@ +import { Observable } from 'rxjs'; import { HookManager } from '../../core/hook'; import { LifecycleEventsEnum, LifecycleHooksEnum } from './enums'; -import { RouteBuilder, CoreRoute } from './route'; +import { RouteBuilder } from './route'; +import { CoreRoute } from './interfaces'; +import { errorHandler } from '../../core/hapiness'; import { Request, ReplyWithContinue, Server } from 'hapi'; -import * as Debug from 'debug'; -const debug = Debug('lifecycle/hook'); - -export class HttpRequestInfo { - constructor(public id: string) {} -} export class LifecycleManager { @@ -19,38 +16,85 @@ export class LifecycleManager { * * @param {MainModule} main */ - static routeLifecycle(server: Server, routes: CoreRoute[]) { - server.ext(LifecycleEventsEnum.OnPreAuth.toString(), (request: Request, reply: ReplyWithContinue) => { - const route = this.findRoute(request, routes); - /* istanbul ignore else */ - if (route && route.token) { - const reqInfo = new HttpRequestInfo(request.id); - route.providers = route.providers.concat({ provide: HttpRequestInfo, useValue: reqInfo }); - request['_hapinessRoute'] = RouteBuilder.instantiateRouteAndDI(route); - this.eventHandler(LifecycleHooksEnum.OnPreAuth, routes, request, reply); - } else { - reply.continue(); - } - }); + static routeLifecycle(server: Server, routes: CoreRoute[]): void { + + server.ext(LifecycleEventsEnum.OnPreAuth.toString(), + (request: Request, reply: ReplyWithContinue) => + this.instantiateRoute(routes, request, reply) + .subscribe( + _ => reply.continue(), + _ => errorHandler(_) + ) + ); server.ext(LifecycleEventsEnum.OnPostAuth.toString(), - (request, reply) => this.eventHandler(LifecycleHooksEnum.OnPostAuth, routes, request, reply)); + (request: Request, reply: ReplyWithContinue) => + this.eventHandler(LifecycleHooksEnum.OnPostAuth, routes, request, reply) + .subscribe( + _ => reply.continue(), + _ => errorHandler(_) + ) + ); server.ext(LifecycleEventsEnum.OnPreHandler.toString(), - (request, reply) => this.eventHandler(LifecycleHooksEnum.OnPreHandler, routes, request, reply)); + (request: Request, reply: ReplyWithContinue) => + this.eventHandler(LifecycleHooksEnum.OnPostAuth, routes, request, reply) + .subscribe( + _ => reply.continue(), + _ => errorHandler(_) + ) + ); server.ext(LifecycleEventsEnum.OnPostHandler.toString(), - (request, reply) => this.eventHandler(LifecycleHooksEnum.OnPostHandler, routes, request, reply)); + (request: Request, reply: ReplyWithContinue) => + this.eventHandler(LifecycleHooksEnum.OnPostAuth, routes, request, reply) + .subscribe( + _ => reply.continue(), + _ => errorHandler(_) + ) + ); - server.ext(LifecycleEventsEnum.OnPreResponse.toString(), - (request, reply) => { - this.eventHandler(LifecycleHooksEnum.OnPreResponse, routes, request, reply); - request['_hapinessRoute'] = undefined; - }); + server.ext(LifecycleEventsEnum.OnPostHandler.toString(), + (request: Request, reply: ReplyWithContinue) => + this.eventHandler(LifecycleHooksEnum.OnPostAuth, routes, request, reply) + .subscribe( + _ => reply.continue(), + _ => errorHandler(_), + () => request['_hapinessRoute'] = undefined + ) + ); } + /** + * Instantiate the route matching the request + * And trigger OnPreAuth hook + * + * @param {CoreRoute[]} routes + * @param {Request} request + * @param {ReplyWithContinue} reply + * @returns Observable + */ + private static instantiateRoute(routes: CoreRoute[], request: Request, reply: ReplyWithContinue): Observable { + return Observable + .of(routes) + .map(_ => this.findRoute(request, _)) + .filter(_ => !!(_ && _.token)) + .flatMap(_ => RouteBuilder.instantiateRouteAndDI(_, request)) + .do(_ => request['_hapinessRoute'] = _) + .flatMap(_ => this.eventHandler(LifecycleHooksEnum.OnPreAuth, routes, request, reply)) + } + + /** + * Find the matching route with + * path and method + * + * @param {Request} request + * @param {CoreRoute[]} routes + * @returns CoreRoute + */ private static findRoute(request: Request, routes: CoreRoute[]): CoreRoute { - return routes.find(r => ((r.method === request.route.method || r.method.indexOf(request.route.method) > -1) && + return routes + .find(r => ((r.method === request.route.method || r.method.indexOf(request.route.method) > -1) && r.path === request.route.path)); } @@ -64,19 +108,19 @@ export class LifecycleManager { * @param {} request * @param {} reply */ - private static eventHandler(hook: LifecycleHooksEnum, routes: CoreRoute[], request, reply) { - const route = this.findRoute(request, routes); - if (request['_hapinessRoute'] && HookManager.hasLifecycleHook(hook.toString(), route.token)) { - HookManager.triggerHook(hook.toString(), route.token, request['_hapinessRoute'], [request, reply]); - } else { - reply.continue(); - } + private static eventHandler(hook: LifecycleHooksEnum, routes: CoreRoute[], + request: Request, reply: ReplyWithContinue): Observable { + + return Observable + .of(routes) + .map(_ => this.findRoute(request, _)) + .filter(_ => request['_hapinessRoute'] && HookManager.hasLifecycleHook(hook.toString(), _.token)) + .flatMap(_ => + HookManager + .triggerHook(hook.toString(), _.token, request['_hapinessRoute'], [request, reply]) + ) + .defaultIfEmpty(reply.continue()) + .filter(_ => !!_ && !_.statusCode && !_.headers && !_.source); } -} -/** - * Request lifecycle component Hook - * - * @returns void - */ -export interface OnEvent { onEvent(request: Request, reply: ReplyWithContinue): void; } +} diff --git a/src/extensions/http-server/route.ts b/src/extensions/http-server/route.ts index f6bda2e..586f710 100644 --- a/src/extensions/http-server/route.ts +++ b/src/extensions/http-server/route.ts @@ -1,63 +1,18 @@ -import { extractMetadataByDecorator } from '../../core/metadata'; -import { Route } from './decorators'; -import { CoreModule, CoreProvide, DependencyInjection } from '../../core'; +import { CoreModule } from '../../core/interfaces'; +import { CoreRoute } from './interfaces'; +import { Observable } from 'rxjs'; import { Type } from '../../core/decorators'; -import { Request, ReplyWithContinue, ReplyNoContinue } from 'hapi'; -import * as Hoek from 'hoek'; -import * as Boom from 'boom'; -import * as Debug from 'debug'; -const debug = Debug('hapiness:extension:httpserver:route'); - -export { Request, ReplyWithContinue, ReplyNoContinue }; +import { Route } from './decorators'; +import { extractMetadataByDecorator } from '../../core/metadata'; +import { DependencyInjection } from '../../core/di'; +import { Request } from 'hapi'; interface InternalType { route: Route; token: Type; } -export interface ValidateConfig { - params?: any; - query?: any; - payload?: any; - response?: any; -} - -export interface RouteConfig { - description?: string; - notes?: string; - tags?: string[]; - validate?: ValidateConfig; - auth?: any; - bind?: any; - cache?: any; - compression?: any; - cors?: any; - ext?: any; - files?: any; - id?: any; - json?: any; - jsonp?: any; - log?: any; - plugins?: any; - pre?: any; - response?: any; - security?: any; - state?: any; - timeout?: any; -} - -/** - * CoreRoute Type - * Represents an Http Route - */ -export interface CoreRoute { - token: Type | any; - path: string; - method: string | string[]; - module: CoreModule; - providers?: CoreProvide[]; - config?: RouteConfig; -} +export class HttpRequestInfo {} export class RouteBuilder { @@ -75,37 +30,35 @@ export class RouteBuilder { * @param {CoreModule} module * @returns CoreRoute */ - public static buildRoutes(module: CoreModule): CoreRoute[] { - Hoek.assert(!!module, Boom.create(500, 'Please provide a module')); - debug('build routes', module.name); - const routes = this.metadataFromDeclarations(module.declarations) - .map(data => this.coreRouteFromMetadata(data.route, data.token, module)); - return routes; + public static buildRoutes(module: CoreModule): Observable { + return Observable + .of(module) + .filter(_ => !!_) + .flatMap(_ => this.metadataFromDeclarations(_.declarations)) + .flatMap(_ => this.coreRouteFromMetadata(_.route, _.token, module)); } /** * Instantiate a new Route * with its own DI/request * - * /!\ Create a DI/req give some - * perf issues. Still investigating - * for a solution. For now, we provide - * just the DI's module - * * @param {CoreRoute} route - * @returns Type + * @param {Request} request + * @returns Observable */ - public static instantiateRouteAndDI(route: CoreRoute): Type { - debug('instantiate route', route.method, route.path); - if (route.providers && route.providers.length > 0) { - console.warn(`${route.path} - Providers for a route are not available`); - } - return DependencyInjection.instantiateComponent( - >route.token, - /*DependencyInjection.createAndResolve(route.providers - .map(p => Object.assign(>{}, p)), route.module.di - )*/route.module.di - ); + public static instantiateRouteAndDI(route: CoreRoute, request: Request): Observable { + return Observable + .of(request) + .map(_ => ({ + query: Object.assign({}, request.query), + params: Object.assign({}, request.params), + headers: Object.assign({}, request.headers), + payload: Object.assign({}, request.payload) + })) + .map(_ => ({ provide: HttpRequestInfo, useValue: _ })) + .map(_ => [].concat(route.providers).concat(_)) + .flatMap(_ => DependencyInjection.createAndResolve(_, route.module.di)) + .flatMap(_ => DependencyInjection.instantiateComponent(route.token, _)); } /** @@ -114,19 +67,24 @@ export class RouteBuilder { * @param {Route} data * @returns CoreRoute */ - private static coreRouteFromMetadata(data: Route, token: Type, module: CoreModule): CoreRoute { - const providers = data.providers || []; - const method = Array.isArray(data.method) ? - data.method.map(_ => _.toLowerCase()) : - data.method.toString().toLowerCase(); - return { - token, - module, - config: data.config, - path: data.path, - method, - providers: providers.map((p: any) => !!p.provide ? p : { provide: p, useClass: p }) - }; + private static coreRouteFromMetadata(data: Route, token: Type, module: CoreModule): Observable { + return Observable + .of(data) + .flatMap(_ => + Observable + .from([].concat(_.method)) + .map(__ => __.toLowerCase()) + .toArray() + .map(__ => ({ data: _, methods: __ })) + ) + .map(_ => ({ + token, + module, + config: _.data.config, + path: _.data.path, + method: _.methods, + providers: [] + })); } /** @@ -136,113 +94,10 @@ export class RouteBuilder { * @param {Type} declarations * @returns Route */ - private static metadataFromDeclarations(declarations: Type | Type[]): InternalType[] { - debug('metadata from declarations', declarations.length); - return [].concat(declarations) - .map(t => { - return { - route: extractMetadataByDecorator(t, this.decoratorName), - token: >t - }; - }) - .filter(t => !!t.route); + private static metadataFromDeclarations(declarations: Type[]): Observable { + return Observable + .from([].concat(declarations)) + .filter(_ => !!_) + .map(_ => ({ token: _, route: extractMetadataByDecorator(_, this.decoratorName) })) } - } - -/** - * Route Handler - * called on Http Get request - * - * @returns void - */ -export interface OnGet { onGet(request: Request, reply: ReplyNoContinue): void; } - -/** - * Route Handler - * called on Http Post request - * - * @returns void - */ -export interface OnPost { onPost(request: Request, reply: ReplyNoContinue): void; } - -/** - * Route Handler - * called on Http Put request - * - * @param {Error} error - * @returns void - */ -export interface OnPut { onPut(request: Request, reply: ReplyNoContinue): void; } - -/** - * Route Handler - * called on Http Patch request - * - * @param {string} module - * @returns void - */ -export interface OnPatch { onPatch(request: Request, reply: ReplyNoContinue): void; } - -/** - * Route Handler - * called on Http Options request - * - * @param {string} module - * @returns void - */ -export interface OnOptions { onOptions(request: Request, reply: ReplyNoContinue): void; } - -/** - * Route Handler - * called on Http Delete request - * - * @param {string} module - * @returns void - */ -export interface OnDelete { onDelete(request: Request, reply: ReplyNoContinue): void; } - -/** - * OnPreAuth Lifecycle hook - * - * @param {Request} request - * @param {Reply} reply - * @returns void - */ -export interface OnPreAuth { onPreAuth(request: Request, reply: ReplyWithContinue ): void; } - -/** - * OnPostAuth Lifecycle hook - * - * @param {Request} request - * @param {Reply} reply - * @returns void - */ -export interface OnPostAuth { onPostAuth(request: Request, reply: ReplyWithContinue ): void; } - -/** - * OnPreHandler Lifecycle hook - * - * @param {Request} request - * @param {Reply} reply - * @returns void - */ -export interface OnPreHandler { onPreHandler(request: Request, reply: ReplyWithContinue ): void; } - -/** - * OnPostHandler Lifecycle hook - * - * @param {Request} request - * @param {Reply} reply - * @returns void - */ -export interface OnPostHandler { onPostHandler(request: Request, reply: ReplyWithContinue ): void; } - -/** - * OnPreResponse Lifecycle hook - * - * @param {Request} request - * @param {Reply} reply - * @returns void - */ -export interface OnPreResponse { onPreResponse(request: Request, reply: ReplyWithContinue ): void; } diff --git a/src/extensions/socket-server/extension.ts b/src/extensions/socket-server/extension.ts index 30af0ec..b6d76c1 100644 --- a/src/extensions/socket-server/extension.ts +++ b/src/extensions/socket-server/extension.ts @@ -1,9 +1,7 @@ -import { CoreModule, Extension, ExtensionWithConfig, OnExtensionLoad } from '../../core'; +import { CoreModule, Extension, ExtensionWithConfig, OnExtensionLoad } from '../../core/interfaces'; import { Observable } from 'rxjs/Observable'; import { server } from 'websocket'; import { WebSocketServer } from './server'; -import * as Debug from 'debug'; -const debug = Debug('hapiness:extension:socketserver'); export interface SocketConfig { port: number; @@ -15,8 +13,6 @@ export interface SocketConfig { export class SocketServerExt implements OnExtensionLoad { - private server: server; - public static setConfig(config: SocketConfig): ExtensionWithConfig { return { token: SocketServerExt, @@ -33,15 +29,12 @@ export class SocketServerExt implements OnExtensionLoad { * @returns Observable */ onExtensionLoad(module: CoreModule, config: SocketConfig): Observable { - debug('server instantiation'); - const instance = new WebSocketServer(config); - return Observable.create(observer => { - observer.next({ + return Observable + .of(new WebSocketServer(config)) + .map(_ => ({ instance: this, token: SocketServerExt, - value: instance - }); - observer.complete(); - }) + value: _ + })); } } diff --git a/src/index.ts b/src/index.ts deleted file mode 100644 index d9928f7..0000000 --- a/src/index.ts +++ /dev/null @@ -1,9 +0,0 @@ -export { Hapiness, HapinessModule, Inject, Injectable, Optional, Lib, InjectionToken, - CoreModuleWithProviders, OnRegister, OnStart, CoreModule, CoreDecorator, CoreProvide, - Extension, ExtensionWithConfig, makeDecorator, Type, OnModuleInstantiated, OnExtensionLoad } from './core'; - -export { HttpServerExt, HapiConfig, Route, Lifecycle, HttpRequestInfo, OnEvent, OnGet, OnDelete, OnOptions, - OnPatch, OnPost, OnPut, OnPreAuth, OnPostAuth, OnPreHandler, OnPostHandler, OnPreResponse, Request, - ReplyWithContinue, ReplyNoContinue, Server } from './extensions/http-server'; - -export { SocketServerExt, Socket, SocketConfig, WebSocketServer } from './extensions/socket-server'; diff --git a/test-2/mocha.opts b/test-2/mocha.opts deleted file mode 100644 index dcd076e..0000000 --- a/test-2/mocha.opts +++ /dev/null @@ -1,7 +0,0 @@ ---ui tdd ---report lcovonly ---reporter spec ---recursive ---compilers ts:ts-node/register ---throw-deprecation ---colors \ No newline at end of file diff --git a/test/integration/core.test.ts b/test/integration/core.test.ts deleted file mode 100644 index 8957942..0000000 --- a/test/integration/core.test.ts +++ /dev/null @@ -1,226 +0,0 @@ -import { suite, test } from 'mocha-typescript'; -import { Observable } from 'rxjs/Observable'; -import * as unit from 'unit.js'; -import { - Hapiness, - HapinessModule, - Injectable, - OnStart, - OnRegister, - Lib, - InjectionToken, - Inject -} from '../../src/core'; - -@suite('Integration - Core') -class CoreIntegration { - - @test('HapinessModule') - test1(done) { - - @HapinessModule({ - version: '1.0.0' - }) - class ModuleTest implements OnStart { - onStart() { - unit.string(Hapiness['module'].name) - .is('ModuleTest'); - done(); - } - } - - Hapiness.bootstrap(ModuleTest); - } - - @test('HapinessModule - DI') - test2(done) { - - @Injectable() - class Service1 { - getData() { - return 'test'; - } - } - - @HapinessModule({ - version: '1.0.0', - providers: [ Service1 ] - }) - class ModuleTest implements OnStart { - - constructor(private service: Service1) {} - - onStart() { - unit.string(this.service.getData()) - .is('test'); - done(); - } - } - - Hapiness.bootstrap(ModuleTest); - } - - @test('HapinessModule - SubModule') - test3(done) { - - @Injectable() - class Service1 { - getData() { - return 'test'; - } - } - - @Injectable() - class Service2 { - getData() { - return '123'; - } - } - - @HapinessModule({ - version: '1.0.0', - providers: [ Service2 ] - }) - class SubSubModule implements OnRegister { - - constructor(private service: Service2) {} - - onRegister() { - unit.string(this.service.getData()).is('123'); - } - } - - @HapinessModule({ - version: '1.0.0', - providers: [ Service2 ], - exports: [ Service2 ], - imports: [{ module: SubSubModule, providers: [] }] - }) - class SubModule implements OnRegister { - - constructor(private service: Service2) {} - - onRegister() { - unit.string(this.service.getData()).is('123'); - } - } - - @HapinessModule({ - version: '1.0.0', - providers: [ Service1 ], - imports: [ SubModule ] - }) - class ModuleTest implements OnStart { - - constructor( - private service1: Service1, - private service2: Service2 - ) {} - - onStart() { - unit.string(this.service1.getData() + this.service2.getData()) - .is('test123'); - done(); - } - } - - Hapiness.bootstrap(ModuleTest); - } - - @test('HapinessModule - Libs') - test4(done) { - - @Injectable() - class Service1 { - getData() { - return 'test'; - } - } - - @Lib() - class LibTest { - constructor(private service: Service1) { - unit.string(this.service.getData()) - .is('test'); - done(); - } - } - - @HapinessModule({ - version: '1.0.0', - providers: [ Service1 ], - declarations: [ LibTest ] - }) - class ModuleTest {} - - Hapiness.bootstrap(ModuleTest); - } - - @test('HapinessModule - Error') - test5(done) { - - @HapinessModule({ - version: '1.0.0' - }) - class ModuleTest { - - onStart() { - return Observable.create(observer => { - observer.error(new Error('error')); - observer.complete(); - }); - } - } - - Hapiness.bootstrap(ModuleTest).catch(_ => { - unit.object(_) - .isInstanceOf(Error) - .hasProperty('message', 'error'); - done(); - }); - } - - @test('HapinessModule - Provide parent config to sub module') - test6(done) { - - const TOKEN = new InjectionToken('token'); - - @HapinessModule({ - version: '1.0.0' - }) - class SubModuleTest { - - constructor(@Inject(TOKEN) private config) {} - - onRegister() { - unit.must(this.config.test) - .is(true); - done(); - } - } - - @HapinessModule({ - version: '1.0.0', - imports: [ SubModuleTest ] - }) - class ModuleTest { - - static setConfig(config) { - return { - module: ModuleTest, - providers: [ - { provide: TOKEN, useValue: config } - ] - } - } - } - - @HapinessModule({ - version: '1.0.0', - imports: [ ModuleTest.setConfig({ test: true }) ] - }) - class AppModuleTest {} - - Hapiness.bootstrap(AppModuleTest); - } -} diff --git a/test/integration/http-server.test.ts b/test/integration/http-server.test.ts deleted file mode 100644 index 621f6ab..0000000 --- a/test/integration/http-server.test.ts +++ /dev/null @@ -1,254 +0,0 @@ -import { suite, test} from 'mocha-typescript'; -import * as unit from 'unit.js'; -import { Hapiness, HapinessModule, Inject, OnRegister, OnStart } from '../../src/core'; -import { HttpServerExt, Route, Lifecycle, OnGet, OnEvent, OnPreResponse } from '../../src/extensions/http-server'; -import { Server } from 'hapi'; - -@suite('Integration - Http Server') -class HttpServerIntegration { - - @test('route get') - test1(done) { - - @Route({ - path: '/', - method: 'GET', - }) - class RouteTest implements OnGet { - onGet(request, reply) { - reply('test'); - } - } - - @HapinessModule({ - version: '1.0.0', - declarations: [ RouteTest ] - }) - class ModuleTest implements OnStart { - - constructor(@Inject(HttpServerExt) private server: Server) {} - - onStart() { - this.server.inject('/', res => { - unit.must(res.result).equal('test'); - this.server.stop().then(_ => done()); - }); - } - } - - Hapiness.bootstrap(ModuleTest, [ HttpServerExt.setConfig({ host: '0.0.0.0', port: 4444 }) ]); - } - - @test('lifecycle') - test2(done) { - - class Service1 { - getData() { - return '123'; - } - } - class Service2 {} - class Service3 { - getData() { - return '456'; - } - } - - @Route({ - path: '/', - method: 'GET' - }) - class RouteTest implements OnGet, OnPreResponse { - constructor(private serv: Service1, private serv3: Service3) {} - onGet(request, reply) { - reply('x'); - } - onPreResponse(request, reply) { - request.response.source = request.response.source + this.serv.getData() + this.serv3.getData(); - reply.continue(); - } - } - - @Lifecycle({ - event: 'onPostHandler' - }) - class LF implements OnEvent { - onEvent(request, reply) { - request.response.source = 'toto'; - reply.continue(); - } - } - - @HapinessModule({ - version: '1.0.0', - declarations: [ RouteTest, LF ], - providers: [ Service3, Service1, { provide: Service2, useClass: Service2 } ] - }) - class ModuleTest implements OnStart { - - constructor(@Inject(HttpServerExt) private server: Server) {} - - onStart() { - this.server.inject('/', res => { - unit.string(res.result) - .is('toto123456'); - this.server.stop().then(_ => done()); - }); - } - } - - Hapiness.bootstrap(ModuleTest, [ HttpServerExt.setConfig({ host: '0.0.0.0', port: 4444 }) ]) - .catch(_ => done(_)); - } - - /* @test('lifecycle') - test2(done) { - - class Service1 { - getData() { - return '123'; - } - } - class Service2 {} - class Service3 { - getData() { - return '456'; - } - } - - @Route({ - path: '/', - method: 'GET', - providers: [ Service1, { provide: Service2, useClass: Service2 } ] - }) - class RouteTest implements OnGet, OnPreResponse { - constructor(private serv: Service1, private serv3: Service3) {} - onGet(request, reply) { - reply('x'); - } - onPreResponse(request, reply) { - request.response.source = request.response.source + this.serv.getData() + this.serv3.getData(); - reply.continue(); - } - } - - @Lifecycle({ - event: 'onPostHandler' - }) - class LF implements OnEvent { - onEvent(request, reply) { - request.response.source = 'toto'; - reply.continue(); - } - } - - @HapinessModule({ - version: '1.0.0', - declarations: [ RouteTest, LF ], - providers: [ Service3 ] - }) - class ModuleTest implements OnStart { - - constructor(@Inject(HttpServerExt) private server: Server) {} - - onStart() { - this.server.inject('/', res => { - unit.string(res.result) - .is('toto123456'); - this.server.stop().then(_ => done()); - }); - } - } - - Hapiness.bootstrap(ModuleTest, [ HttpServerExt.setConfig({ host: '0.0.0.0', port: 4444 }) ]) - .catch(_ => done(_)); - }*/ - - @test('route submodule') - test3(done) { - - @Route({ - path: '/', - method: 'GET', - }) - class RouteTest implements OnGet { - onGet(request, reply) { - reply('test'); - } - } - - @HapinessModule({ - version: '1.0.0', - declarations: [ RouteTest ] - }) - class SubModuleTest {} - - @HapinessModule({ - version: '1.0.0', - imports: [ SubModuleTest ] - }) - class ModuleTest implements OnStart { - - constructor(@Inject(HttpServerExt) private server: Server) {} - - onStart() { - this.server.inject('/', res => { - unit.must(res.result).equal('test'); - done(); - }); - } - } - - Hapiness.bootstrap(ModuleTest, [ HttpServerExt.setConfig({ host: '0.0.0.0', port: 4444 }) ]) - .catch(_ => console.log(_.message)); - } - - @test('port already used') - test4(done) { - - @HapinessModule({ - version: '1.0.0' - }) - class ModuleTest {} - - Hapiness.bootstrap(ModuleTest, [ HttpServerExt.setConfig({ host: '0.0.0.0', port: 4444 }) ]).catch(_ => { - unit.object(_) - .isInstanceOf(Error) - .hasProperty('message', 'listen EADDRINUSE 0.0.0.0:4444'); - Hapiness['extensions'][0].value.stop().then(__ => done()); - }); - } - - @test('make sure register are done before start hook') - test5(done) { - - @HapinessModule({ - version: '1.0.0' - }) - class SubModuleTest implements OnRegister { - constructor(@Inject(HttpServerExt) private server: Server) {} - onRegister() { - this.server.route({ - path: '/route1', - method: 'GET', - handler: () => {} - }); - } - } - - @HapinessModule({ - version: '1.0.0', - imports: [ SubModuleTest ] - }) - class ModuleTest implements OnStart { - constructor(@Inject(HttpServerExt) private server: Server) {} - onStart() { - unit.object(this.server.table().pop().table.pop()) - .hasProperty('path', '/route1'); - this.server.stop().then(_ => done()); - } - } - - Hapiness.bootstrap(ModuleTest, [ HttpServerExt.setConfig({ host: '0.0.0.0', port: 4445 }) ]); - } -} diff --git a/test/integration/socket-server.test.ts b/test/integration/socket-server.test.ts deleted file mode 100644 index 28ed769..0000000 --- a/test/integration/socket-server.test.ts +++ /dev/null @@ -1,62 +0,0 @@ -import { suite, test } from 'mocha-typescript'; -import * as unit from 'unit.js'; -import { Hapiness, HapinessModule, Inject, OnStart } from '../../src/core'; -import { SocketServerExt, WebSocketServer } from '../../src/extensions/socket-server'; - -@suite('Integration - Socket Server') -class SocketServerIntegration { - - @test('socket message') - test1(done) { - - @HapinessModule({ - version: '1.0.0' - }) - class ModuleTest implements OnStart { - - constructor(@Inject(SocketServerExt) private server: WebSocketServer) {} - - onStart() { - this.server.onRequest(socket => { - unit.array(this.server.getSockets()) - .hasLength(1); - socket.emit('toto', 'test'); - socket.on('close', data => {}); - socket.on('error', data => {}); - socket.on('tata', data => {}); - socket.on('ev', data => { - this.server.broadcast('test', 'test'); - }); - socket.on('*', data => { - if (data.utf8Data === '123') { - unit.string(data.utf8Data) - .is('123'); - socket.emitBytes(new Buffer('test')); - } - }); - socket.onBytes(data => { - unit.string(data.toString()) - .is('test'); - socket.close(); - this.server.getServer().closeAllConnections(); - done(); - }); - }); - - const W3CWebSocket = require('websocket').w3cwebsocket; - const client = new W3CWebSocket('ws://localhost:2222/'); - client.onmessage = (e) => { - if (e.data === JSON.stringify({ event: 'toto', data: 'test' })) { - client.send('{"event":"ev","data":"abc"}'); - } else if (e.data instanceof ArrayBuffer) { - client.send(e.data); - } else { - client.send('123'); - } - }; - } - } - - Hapiness.bootstrap(ModuleTest, [ SocketServerExt.setConfig({ port: 2222 }) ]); - } -} diff --git a/test/unit/bootstrap.unit.ts b/test/unit/bootstrap.unit.ts deleted file mode 100644 index 4e63903..0000000 --- a/test/unit/bootstrap.unit.ts +++ /dev/null @@ -1,173 +0,0 @@ -import { Hapiness } from '../../src/core/bootstrap'; -import { HookManager } from '../../src/core/hook'; -import { ModuleManager } from '../../src/core/module'; -import { Observable } from 'rxjs/Observable'; -import 'rxjs/add/observable/throw'; -import { only, suite, test } from 'mocha-typescript'; -import * as unit from 'unit.js'; - -@only -@suite('Unit - Bootstrap') -class SuiteBoostrap { - - @test('bootstrap - no module') - test1(done) { - - Hapiness.bootstrap(null) - .catch(_ => { - unit.object(_) - .isInstanceOf(Error) - .hasProperty('message', 'Please provide a module to bootstrap'); - done(); - }); - } - - @test('bootstrap - wrong module') - test2(done) { - - Hapiness.bootstrap('test') - .catch(_ => { - unit.object(_) - .isInstanceOf(Error) - .hasProperty('message', 'Wrong module to bootstrap'); - done(); - }); - } - - @test('bootstrap - no extensions') - test3(done) { - - class TestModule {} - const cm = { - token: TestModule, - name: 'TestModule', - version: '' - } - const cmi = Object.assign({ instance: new TestModule() }, cm); - - const mocks = []; - mocks.push(unit.stub(ModuleManager, 'resolveModule') - .returns(cm)); - mocks.push(unit.stub(ModuleManager, 'instantiateModule') - .returns(Observable.create(observer => { - observer.next(cmi); - observer.complete(); - }))); - mocks.push(unit.stub(ModuleManager, 'getModules') - .returns(Observable.create(observer => { - observer.next([ cmi ]); - observer.complete(); - }))); - mocks.push(unit.stub(HookManager, 'hasLifecycleHook') - .returns(false)); - mocks.push(unit.stub(HookManager, 'triggerHook') - .returns(Observable.create(observer => { - observer.next(); - observer.complete(); - }))); - - Hapiness.bootstrap(TestModule) - .then(_ => { - unit.must(Hapiness['module']).equal(cmi); - unit.array(Hapiness['extensions']).is([]); - mocks.forEach(__ => __.restore()); - done(); - }); - } - - @test('bootstrap - with extension') - test4(done) { - - class TestModule {} - class TestExt {} - const cm = { - token: TestModule, - name: 'TestModule', - version: '' - } - const cmi = Object.assign({ instance: new TestModule() }, cm); - const cmic = Object.assign({ parent: cmi }, cmi); - - const mocks = []; - mocks.push(unit.stub(ModuleManager, 'resolveModule') - .returns(cm)); - mocks.push(unit.stub(ModuleManager, 'instantiateModule') - .returns(Observable.create(observer => { - observer.next(cmi); - observer.complete(); - }))); - mocks.push(unit.stub(ModuleManager, 'getModules') - .returns(Observable.create(observer => { - observer.next([ cmi, cmic ]); - observer.complete(); - }))); - mocks.push(unit.stub(HookManager, 'hasLifecycleHook') - .returns(true)); - mocks.push(unit.stub(HookManager, 'triggerHook') - .returns(Observable.create(observer => { - observer.next(); - observer.complete(); - }))); - - mocks.push(unit.stub(Hapiness, 'loadExtention') - .returns(Observable.create(observer => { - observer.next({ - token: TestExt, - instance: new TestExt(), - value: {} - }); - observer.complete(); - }))); - - Hapiness.bootstrap(TestModule, [ TestExt ]) - .then(_ => { - unit.must(Hapiness['module']).equal(cmi); - unit.array(Hapiness['extensions']).isNotEmpty(); - mocks.forEach(__ => __.restore()); - done(); - }); - } - - @test('toExtensionWithConfig') - test5() { - - class Token {} - unit.object(Hapiness['toExtensionWithConfig'](Token)) - .is({ - token: Token, - config: {} - }); - - unit.object(Hapiness['toExtensionWithConfig']({ - token: Token, - config: { - test: true - } - })) - .is({ - token: Token, - config: { - test: true - } - }); - } - - @test('loadExtention') - test6(done) { - class Token { - onExtensionLoad() { - return Observable.create(observer => { - observer.next(true); - observer.complete(); - }); - } - } - Hapiness['loadExtention']({ - token: Token, - config: {} - }).subscribe(_ => { - unit.must(_).equal(true); - done(); - }); - } -} diff --git a/test/unit/di.unit.ts b/test/unit/di.unit.ts deleted file mode 100644 index 31bd560..0000000 --- a/test/unit/di.unit.ts +++ /dev/null @@ -1,74 +0,0 @@ -import { test, suite } from 'mocha-typescript'; -import * as unit from 'unit.js'; -import { Injectable, Inject, Lib, DependencyInjection } from '../../src/core'; - -class MyService { - method() { - return 'hello'; - } -} - -@Injectable() -class MyService2 { - constructor(private svc: MyService) {} - my() { - return this.svc.method(); - } -} - -@suite('Unit - Dependency Injection') -class DI { - - @test('service injection') - testInjection() { - - const injector = DependencyInjection.createAndResolve([MyService, MyService2]); - unit.must(injector.get(MyService2).my()).equal('hello'); - - } - - @test('service injection - extends') - testInjectionExtends() { - - const injector = DependencyInjection.createAndResolve([MyService, MyService2]); - - @Injectable() - class MyOwnService { - constructor(private svc: MyService2) {} - myTest() { - return this.svc.my(); - } - } - - const myInjector = DependencyInjection.createAndResolve([MyOwnService], injector); - - unit.must(myInjector.get(MyOwnService).myTest()).equal('hello'); - - } - - @test('service injection - error') - testInjectionError() { - - const injector = DependencyInjection.createAndResolve([MyService2]); - try { - const svc = injector.get(MyService2); - } catch (e) { - unit.must(e.message).contain('No provider for MyService!'); - } - - } - - @test('instantiate a component') - testInstantiate() { - @Injectable() - class Service { - meth() { return 1; } - } - @Lib() - class Component { - constructor(@Inject(Service) public serv: Service) {} - } - const injector = DependencyInjection.createAndResolve([ Service ]); - unit.must(DependencyInjection.instantiateComponent(Component, injector).serv.meth()).equal(1); - } -} diff --git a/test/unit/hook.unit.ts b/test/unit/hook.unit.ts deleted file mode 100644 index 266e845..0000000 --- a/test/unit/hook.unit.ts +++ /dev/null @@ -1,80 +0,0 @@ -import { test, suite } from 'mocha-typescript'; -import * as unit from 'unit.js'; -import { Observable } from 'rxjs/Observable'; -import { HookManager } from '../../src/core'; - -@suite('Unit - Hook') -class Hook { - - @test('hasLifecycleHook') - test1() { - class TestToken { - onTest() {} - } - - unit.must(HookManager.hasLifecycleHook('onTest', TestToken)) - .is(true); - - unit.must(HookManager.hasLifecycleHook('NuLl', TestToken)) - .is(false); - - unit.must(HookManager.hasLifecycleHook(null, null)) - .is(false); - } - - @test('triggerHook - return abc') - test2(done) { - class TestToken { - onTest() { - return 'abc'; - } - } - HookManager.triggerHook('onTest', TestToken, new TestToken()) - .subscribe(_ => { - unit.must(_).equal('abc'); - done(); - }); - } - - @test('triggerHook - return Observable abc') - test3(done) { - class TestToken { - onTest() { - return Observable.of('abc'); - } - } - HookManager.triggerHook('onTest', TestToken, new TestToken()) - .subscribe(_ => { - unit.must(_).equal('abc'); - done(); - }); - } - - @test('triggerHook - hook does not exist - error') - test4(done) { - class TestToken {} - HookManager.triggerHook('onTest', TestToken, new TestToken(), null, true) - .subscribe(_ => {}, _ => { - unit.object(_) - .isInstanceOf(Error) - .hasProperty('message', 'Hook missing onTest on TestToken'); - done(); - }); - } - - @test('triggerHook - hook does not exist - no error') - test5(done) { - class TestToken {} - HookManager.triggerHook('onTest', TestToken, new TestToken()) - .subscribe(_ => { - unit.must(_).equal(undefined); - done(); - }); - } - - @test('triggerHook - no token/instance') - test6() { - unit.error(HookManager.triggerHook) - .is(new Error('Cannot trigger without token/instance')); - } -} diff --git a/test/unit/http-server/enums.unit.ts b/test/unit/http-server/enums.unit.ts deleted file mode 100644 index dc8f1f9..0000000 --- a/test/unit/http-server/enums.unit.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { suite, test } from 'mocha-typescript'; -import * as unit from 'unit.js'; -import { RouteMethodsEnum, enumByMethod } from '../../../src/extensions/http-server/enums'; - -@suite('Unit - HttpServer - Enums') -class Module { - @test('Hook enum method') - testHookEnumMethod() { - - unit.must(enumByMethod('get')) - .is(RouteMethodsEnum.OnGet.toString()); - unit.must(enumByMethod('post')) - .is(RouteMethodsEnum.OnPost.toString()); - unit.must(enumByMethod('put')) - .is(RouteMethodsEnum.OnPut.toString()); - unit.must(enumByMethod('patch')) - .is(RouteMethodsEnum.OnPatch.toString()); - unit.must(enumByMethod('options')) - .is(RouteMethodsEnum.OnOptions.toString()); - unit.must(enumByMethod('delete')) - .is(RouteMethodsEnum.OnDelete.toString()); - - unit.exception(() => unit.when(() => enumByMethod('unknown'))) - .is(new Error('Method does not exist')); - - } -} diff --git a/test-2/unit/metadata.test.ts b/test/unit/metadata.test.ts similarity index 100% rename from test-2/unit/metadata.test.ts rename to test/unit/metadata.test.ts diff --git a/test/unit/metadata.unit.ts b/test/unit/metadata.unit.ts deleted file mode 100644 index 5a40747..0000000 --- a/test/unit/metadata.unit.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { suite, test } from 'mocha-typescript'; -import * as unit from 'unit.js'; -import { HapinessModule, extractMetadataByDecorator, extractMetadata } from '../../src/core'; - -@suite('Unit - Metadata') -class Metadata { - - @test('extractMetadatas') - test1() { - @HapinessModule({ - version: 'test' - }) - class TestToken {} - - unit.object(extractMetadata(TestToken)) - .contains({ version: 'test' }); - - } - - @test('extractMetadataByDecorator') - test2() { - @HapinessModule({ - version: 'test123' - }) - class TestToken {} - - unit.object(extractMetadataByDecorator(TestToken, 'HapinessModule')) - .contains({ version: 'test123' }); - } -} diff --git a/test-2/unit/mocks.ts b/test/unit/mocks.ts similarity index 100% rename from test-2/unit/mocks.ts rename to test/unit/mocks.ts diff --git a/test-2/unit/module.test.ts b/test/unit/module.test.ts similarity index 100% rename from test-2/unit/module.test.ts rename to test/unit/module.test.ts diff --git a/test/unit/module.unit.ts b/test/unit/module.unit.ts deleted file mode 100644 index 1a3c892..0000000 --- a/test/unit/module.unit.ts +++ /dev/null @@ -1,153 +0,0 @@ -import { suite, test } from 'mocha-typescript'; -import * as unit from 'unit.js'; -import { ModuleManager, ModuleLevel, HapinessModule, InjectionToken } from '../../src/core'; - -@suite('Unit - Module') -class Module { - - @test('findNestedModule') - test1() { - - const cm = { - name: 'TestModule', - modules: [{ - name: 'SubTestModule', - parent: this - }] - } - - unit.must(ModuleManager.findNestedModule('TestModule', cm)) - .equal(undefined); - - unit.must(ModuleManager.findNestedModule('SubTestModule', cm).name) - .is('SubTestModule'); - - } - - @test('getElements') - test2() { - - class Comp1 {} - class Comp2 {} - class Comp3 {} - - const cm = { - name: 'TestModule', - declarations: [ Comp1, Comp2 ], - modules: [{ - name: 'SubTestModule', - declarations: [ Comp3 ] - }] - } - - unit.array(ModuleManager.getElements(cm, 'providers')) - .is([]); - - unit.array(ModuleManager.getElements(cm, 'declarations')) - .is([ Comp3, Comp1, Comp2 ]); - - unit.error(ModuleManager.getElements, /You need to provide the element you want to get/); - - } - - @test('getModules') - test3() { - - const cm = { - name: 'TestModule', - modules: [{ - name: 'SubTestModule', - modules: [{ - name: 'SubSubModule1' - }, { - name: 'SubSubModule2' - }] - }] - } - - unit.array(ModuleManager.getModules(cm)) - .hasLength(4); - - } - - @test('coreModuleFromMetadata') - test4() { - - class ModuleTest {} - class ServiceTest {} - - const data = { - version: '1.0.0', - exports: [], - declarations: [ 'declaration' ] - }; - - const module = { - module: ModuleTest, - providers: [ ServiceTest ] - }; - - unit.object(ModuleManager['coreModuleFromMetadata'](data, module)) - .is({ - parent: undefined, - token: ModuleTest, - name: 'ModuleTest', - version: '1.0.0', - exports: [], - declarations: [ 'declaration' ], - providers: [{ provide: ServiceTest, useClass: ServiceTest }], - level: ModuleLevel.ROOT - }); - - } - - @test('metadataFromModule') - test5() { - - @HapinessModule({ - version: 'xxx', - }) - class ModuleTest {} - - unit.object(ModuleManager['metadataFromModule'](ModuleTest)) - .contains({ - version: 'xxx', - declarations: undefined, - providers: undefined, - imports: undefined, - exports: undefined - }); - - } - - @test('collectProviders - extractExportedProviders') - test6() { - - class Service1 {} - class Service2 {} - class Service3 {} - const token = new InjectionToken('config'); - - const module = { - providers: [ Service1 ], - modules: [{ - exports: [ Service3 ], - providers: [{ provide: token, useValue: 'test' }] - }] - }; - - const providers = [ - { provide: Service2, useClass: Service2 } - ]; - - unit.array(ModuleManager['collectProviders'](module, providers)) - .is([ - Service1, - { provide: Service2, useClass: Service2 }, - Service3, - { provide: token, useValue: 'test' } - ]); - - } - -} From 6a8d8347f26c281a4ae329dbf267ec3a5b331fc4 Mon Sep 17 00:00:00 2001 From: Juneil Date: Sat, 19 Aug 2017 13:13:09 +0200 Subject: [PATCH 04/19] fix(tests): fix some path --- Makefile | 2 +- src/extensions/http-server/decorators.ts | 2 +- test/unit/metadata.test.ts | 4 ++-- test/unit/mocks.ts | 5 +++-- test/unit/module.test.ts | 12 ++++++------ 5 files changed, 13 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index fa7b664..510d3f8 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ pretest: @node ./node_modules/.bin/tslint -p ./tsconfig.json --type-check "./src/**/*.ts" "./test/**/*.ts" --exclude "./src/**/*.d.ts" test: - @node ./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha ./test-2 + @node ./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha ./test coveralls: cat ./coverage/lcov.info | node ./node_modules/.bin/coveralls tsc: diff --git a/src/extensions/http-server/decorators.ts b/src/extensions/http-server/decorators.ts index aa796b8..fde02eb 100644 --- a/src/extensions/http-server/decorators.ts +++ b/src/extensions/http-server/decorators.ts @@ -1,5 +1,5 @@ import { createDecorator, CoreDecorator, Type } from '../../core/decorators'; -import { RouteConfig } from './route'; +import { RouteConfig } from './interfaces'; export interface Route { path: string; diff --git a/test/unit/metadata.test.ts b/test/unit/metadata.test.ts index d8ead90..17567d7 100644 --- a/test/unit/metadata.test.ts +++ b/test/unit/metadata.test.ts @@ -1,7 +1,7 @@ import { suite, test } from 'mocha-typescript'; import * as unit from 'unit.js'; -import { extractMetadataByDecorator, extractMetadata, extractMetadatas } from '../../src-2/core/metadata'; -import { HapinessModule } from '../../src-2/core/decorators'; +import { extractMetadataByDecorator, extractMetadata, extractMetadatas } from '../../src/core/metadata'; +import { HapinessModule } from '../../src/core/decorators'; @suite('Unit - Metadata') class Metadata { diff --git a/test/unit/mocks.ts b/test/unit/mocks.ts index 838a3d7..7e4dce6 100644 --- a/test/unit/mocks.ts +++ b/test/unit/mocks.ts @@ -1,7 +1,8 @@ import 'reflect-metadata'; -import { CoreModule, ModuleLevel } from '../../src-2/core/interfaces' -import { InjectionToken, HapinessModule } from '../../src-2/core/decorators'; +import { CoreModule } from '../../src/core/interfaces' +import { ModuleLevel } from '../../src/core/enums'; +import { InjectionToken, HapinessModule } from '../../src/core/decorators'; export class EmptyModule {} export class EmptyProvider {} diff --git a/test/unit/module.test.ts b/test/unit/module.test.ts index f1fbe61..f056292 100644 --- a/test/unit/module.test.ts +++ b/test/unit/module.test.ts @@ -1,11 +1,11 @@ import { suite, test } from 'mocha-typescript'; -import { ModuleManager } from '../../src-2/core/module'; -import { ModuleLevel } from '../../src-2/core/interfaces'; -import { HapinessModule } from '../../src-2/core/decorators'; +import { ModuleManager } from '../../src/core/module'; +import { ModuleLevel } from '../../src/core/enums'; +import { HapinessModule } from '../../src/core/decorators'; import { Observable } from 'rxjs'; import * as unit from 'unit.js'; -import { extractMetadataByDecorator } from '../../src-2/core/metadata'; +import { extractMetadataByDecorator } from '../../src/core/metadata'; import { EmptyProvider, @@ -154,7 +154,7 @@ class ModuleTestSuite { testExtractMetadata1() { const stub = unit - .stub(require('../../src-2/core/metadata'), 'extractMetadataByDecorator') + .stub(require('../../src/core/metadata'), 'extractMetadataByDecorator') .withArgs(ModuleWithMetadata) .returns({ version: '123' }); @@ -172,7 +172,7 @@ class ModuleTestSuite { testExtractMetadata2() { const stub = unit - .stub(require('../../src-2/core/metadata'), 'extractMetadataByDecorator') + .stub(require('../../src/core/metadata'), 'extractMetadataByDecorator') .withArgs(null).returns(null) .withArgs(EmptyModule).returns(null); From d9370cce5cdf7d50d0177315ba28b88411fde971 Mon Sep 17 00:00:00 2001 From: Juneil Date: Sun, 20 Aug 2017 22:15:41 +0200 Subject: [PATCH 05/19] test(integration): first tests --- src/core/hapiness.ts | 4 +- src/core/index.ts | 9 + src/extensions/http-server/extension.ts | 4 +- src/extensions/http-server/interfaces.ts | 2 +- src/index.ts | 9 + test/integration/core.test.ts | 177 ++++++++++++++++ test/integration/http-server.test.ts | 247 +++++++++++++++++++++++ 7 files changed, 447 insertions(+), 5 deletions(-) create mode 100644 src/core/index.ts create mode 100644 src/index.ts create mode 100644 test/integration/core.test.ts create mode 100644 test/integration/http-server.test.ts diff --git a/src/core/hapiness.ts b/src/core/hapiness.ts index 7eca0b2..1f05e1f 100644 --- a/src/core/hapiness.ts +++ b/src/core/hapiness.ts @@ -21,7 +21,7 @@ export class Hapiness { * @param {Array|ExtensionWithConfig>} extensions? * @returns Promise */ - public static bootstrap(module: Type, extensions?: Array | ExtensionWithConfig>): Promise<{}> { + public static bootstrap(module: Type, extensions?: Array | ExtensionWithConfig>): Promise { return new Promise((resolve, reject) => { this .checkArg(module) @@ -29,7 +29,7 @@ export class Hapiness { .flatMap(_ => this.loadExtensions(extensions, _)) .ignoreElements() .subscribe( - _ => {}, + null, _ => reject(_), () => resolve() ) diff --git a/src/core/index.ts b/src/core/index.ts new file mode 100644 index 0000000..42aaccc --- /dev/null +++ b/src/core/index.ts @@ -0,0 +1,9 @@ +export * from './hapiness'; +export * from './decorators'; +export * from './di'; +export * from './enums'; +export * from './hook'; +export * from './metadata'; +export * from './module'; +export * from './interfaces'; +export * from './logger'; diff --git a/src/extensions/http-server/extension.ts b/src/extensions/http-server/extension.ts index 849492b..a52b72a 100644 --- a/src/extensions/http-server/extension.ts +++ b/src/extensions/http-server/extension.ts @@ -37,7 +37,7 @@ export class HttpServerExt implements OnExtensionLoad, OnModuleInstantiated { onExtensionLoad(module: CoreModule, config: HapiConfig): Observable { return Observable .of(new Server(config.options)) - .do(_ => _.connection({ host: config.host, port: config.port })) + .do(_ => _.connection(Object.assign(config, { options: undefined }))) .flatMap(server => Observable .from(ModuleManager.getModules(module)) @@ -83,7 +83,7 @@ export class HttpServerExt implements OnExtensionLoad, OnModuleInstantiated { name: `${module.name}.hapinessplugin`, version: module.version }) - .flatMap(_ => Observable.fromPromise(server.register(_))) + .flatMap(_ => Observable.fromPromise(server.register({ register: _ }))) .flatMap(_ => this.addRoutes(module, server)); } diff --git a/src/extensions/http-server/interfaces.ts b/src/extensions/http-server/interfaces.ts index 1352175..ce478ad 100644 --- a/src/extensions/http-server/interfaces.ts +++ b/src/extensions/http-server/interfaces.ts @@ -6,7 +6,7 @@ import { Observable } from 'rxjs'; export interface HapiConfig { host: string; port: number; - options: ServerOptions + options?: ServerOptions } export interface ValidateConfig { diff --git a/src/index.ts b/src/index.ts new file mode 100644 index 0000000..d9928f7 --- /dev/null +++ b/src/index.ts @@ -0,0 +1,9 @@ +export { Hapiness, HapinessModule, Inject, Injectable, Optional, Lib, InjectionToken, + CoreModuleWithProviders, OnRegister, OnStart, CoreModule, CoreDecorator, CoreProvide, + Extension, ExtensionWithConfig, makeDecorator, Type, OnModuleInstantiated, OnExtensionLoad } from './core'; + +export { HttpServerExt, HapiConfig, Route, Lifecycle, HttpRequestInfo, OnEvent, OnGet, OnDelete, OnOptions, + OnPatch, OnPost, OnPut, OnPreAuth, OnPostAuth, OnPreHandler, OnPostHandler, OnPreResponse, Request, + ReplyWithContinue, ReplyNoContinue, Server } from './extensions/http-server'; + +export { SocketServerExt, Socket, SocketConfig, WebSocketServer } from './extensions/socket-server'; diff --git a/test/integration/core.test.ts b/test/integration/core.test.ts new file mode 100644 index 0000000..f48e2f6 --- /dev/null +++ b/test/integration/core.test.ts @@ -0,0 +1,177 @@ +import { suite, test } from 'mocha-typescript'; +import { Hapiness, HapinessModule, OnStart, OnRegister, Lib, Injectable } from '../../src/core'; +import { Observable } from 'rxjs'; +import * as unit from 'unit.js'; + +@suite('Integration - Core') +class ModuleTestSuite { + + @test('Bootstrap - Simple module') + testBootstrap1(done) { + + @HapinessModule({ + version: '' + }) + class Module1 implements OnStart { + + onStart() { + done(); + } + + } + + Hapiness + .bootstrap(Module1); + + } + + @test('Bootstrap - Module with embedded module') + testBootstrap2(done) { + let state = 0; + + @HapinessModule({ + version: '' + }) + class Module1 implements OnRegister { + + onRegister() { + state = 1; + } + + } + + @HapinessModule({ + version: '', + imports: [ Module1 ] + }) + class Module2 implements OnStart { + + onStart() { + unit + .value(state) + .is(1); + done(); + } + + } + + Hapiness + .bootstrap(Module2); + + } + + @test('Bootstrap - Module with Lib') + testBootstrap3(done) { + + @Lib() + class Lib1 { + constructor() { + done(); + } + } + + @HapinessModule({ + version: '', + declarations: [ Lib1 ] + }) + class Module1 {} + + Hapiness + .bootstrap(Module1); + + } + + @test('Bootstrap - Module with Provider') + testBootstrap4(done) { + + @Injectable() + class Provider1 { + value() { + return 123; + } + } + + @HapinessModule({ + version: '', + providers: [ Provider1 ] + }) + class Module1 implements OnStart { + constructor(private provider1: Provider1) {} + onStart() { + unit + .number(this.provider1.value()) + .is(123); + done(); + } + } + + Hapiness + .bootstrap(Module1); + + } + + @test('Bootstrap - Module with Lib and Provider') + testBootstrap5(done) { + + @Injectable() + class Provider1 { + value() { + return 123; + } + } + + @Lib() + class Lib1 { + constructor(provider1: Provider1) { + unit + .number(provider1.value()) + .is(123); + } + } + + @HapinessModule({ + version: '', + declarations: [ Lib1 ], + providers: [ Provider1 ] + }) + class Module1 implements OnStart { + constructor(private provider1: Provider1) {} + onStart() { + unit + .number(this.provider1.value()) + .is(123); + done(); + } + } + + Hapiness + .bootstrap(Module1); + + } + + @test('Bootstrap - Error thrown') + testBootstrap6(done) { + + @HapinessModule({ + version: '' + }) + class Module1 implements OnStart { + + onStart() { + throw new Error('Oops'); + } + + } + + Hapiness + .bootstrap(Module1) + .catch(_ => { + unit + .object(_) + .isInstanceOf(Error) + .hasProperty('message', 'Oops'); + done(); + }); + + } +} diff --git a/test/integration/http-server.test.ts b/test/integration/http-server.test.ts new file mode 100644 index 0000000..0de1767 --- /dev/null +++ b/test/integration/http-server.test.ts @@ -0,0 +1,247 @@ +import { suite, test} from 'mocha-typescript'; +import * as unit from 'unit.js'; +import { Hapiness, HapinessModule, Inject, OnRegister, OnStart } from '../../src/core'; +import { HttpServerExt, Route, Lifecycle, OnGet, OnEvent, OnPreResponse } from '../../src/extensions/http-server'; +import { Server } from 'hapi'; + +@suite('Integration - Http Server') +class HttpServerIntegration { + + @test('route get') + test1(done) { + + @Route({ + path: '/', + method: 'GET', + }) + class RouteTest implements OnGet { + onGet(request, reply) { + reply('test'); + } + } + + @HapinessModule({ + version: '1.0.0', + declarations: [ RouteTest ] + }) + class ModuleTest implements OnStart { + + constructor(@Inject(HttpServerExt) private server: Server) {} + + onStart() { + this.server.inject('/', res => { + unit.must(res.result).equal('test'); + this.server.stop().then(_ => done()); + }); + } + } + + Hapiness.bootstrap(ModuleTest, [ HttpServerExt.setConfig({ host: '0.0.0.0', port: 4444 }) ]); + } + + @test('lifecycle') + test2(done) { + + class Service1 { + getData() { + return '123'; + } + } + class Service2 {} + class Service3 { + getData() { + return '456'; + } + } + + @Route({ + path: '/', + method: 'GET' + }) + class RouteTest implements OnGet, OnPreResponse { + constructor(private serv: Service1, private serv3: Service3) {} + onGet(request, reply) { + reply('x'); + } + onPreResponse(request, reply) { + request.response.source = request.response.source + this.serv.getData() + this.serv3.getData(); + reply.continue(); + } + } + + @Lifecycle({ + event: 'onPostHandler' + }) + class LF implements OnEvent { + onEvent(request, reply) { + request.response.source = 'toto'; + reply.continue(); + } + } + + @HapinessModule({ + version: '1.0.0', + declarations: [ RouteTest, LF ], + providers: [ Service3, Service1, { provide: Service2, useClass: Service2 } ] + }) + class ModuleTest implements OnStart { + + constructor(@Inject(HttpServerExt) private server: Server) {} + + onStart() { + this.server.inject('/', res => { + unit.string(res.result) + .is('toto123456'); + this.server.stop().then(_ => done()); + }); + } + } + + Hapiness.bootstrap(ModuleTest, [ HttpServerExt.setConfig({ host: '0.0.0.0', port: 4444 }) ]) + .catch(_ => done(_)); + } + + /* @test('lifecycle') + test2(done) { + class Service1 { + getData() { + return '123'; + } + } + class Service2 {} + class Service3 { + getData() { + return '456'; + } + } + @Route({ + path: '/', + method: 'GET', + providers: [ Service1, { provide: Service2, useClass: Service2 } ] + }) + class RouteTest implements OnGet, OnPreResponse { + constructor(private serv: Service1, private serv3: Service3) {} + onGet(request, reply) { + reply('x'); + } + onPreResponse(request, reply) { + request.response.source = request.response.source + this.serv.getData() + this.serv3.getData(); + reply.continue(); + } + } + @Lifecycle({ + event: 'onPostHandler' + }) + class LF implements OnEvent { + onEvent(request, reply) { + request.response.source = 'toto'; + reply.continue(); + } + } + @HapinessModule({ + version: '1.0.0', + declarations: [ RouteTest, LF ], + providers: [ Service3 ] + }) + class ModuleTest implements OnStart { + constructor(@Inject(HttpServerExt) private server: Server) {} + onStart() { + this.server.inject('/', res => { + unit.string(res.result) + .is('toto123456'); + this.server.stop().then(_ => done()); + }); + } + } + Hapiness.bootstrap(ModuleTest, [ HttpServerExt.setConfig({ host: '0.0.0.0', port: 4444 }) ]) + .catch(_ => done(_)); + }*/ + + @test('route submodule') + test3(done) { + + @Route({ + path: '/', + method: 'GET', + }) + class RouteTest implements OnGet { + onGet(request, reply) { + reply('test'); + } + } + + @HapinessModule({ + version: '1.0.0', + declarations: [ RouteTest ] + }) + class SubModuleTest {} + + @HapinessModule({ + version: '1.0.0', + imports: [ SubModuleTest ] + }) + class ModuleTest implements OnStart { + + constructor(@Inject(HttpServerExt) private server: Server) {} + + onStart() { + this.server.inject('/', res => { + unit.must(res.result).equal('test'); + done(); + }); + } + } + + Hapiness.bootstrap(ModuleTest, [ HttpServerExt.setConfig({ host: '0.0.0.0', port: 4444 }) ]) + .catch(_ => console.log(_.message)); + } + + @test('port already used') + test4(done) { + + @HapinessModule({ + version: '1.0.0' + }) + class ModuleTest {} + + Hapiness.bootstrap(ModuleTest, [ HttpServerExt.setConfig({ host: '0.0.0.0', port: 4444 }) ]).catch(_ => { + unit.object(_) + .isInstanceOf(Error) + .hasProperty('message', 'listen EADDRINUSE 0.0.0.0:4444'); + Hapiness['extensions'][0].value.stop().then(__ => done()); + }); + } + + @test('make sure register are done before start hook') + test5(done) { + + @HapinessModule({ + version: '1.0.0' + }) + class SubModuleTest implements OnRegister { + constructor(@Inject(HttpServerExt) private server: Server) {} + onRegister() { + this.server.route({ + path: '/route1', + method: 'GET', + handler: () => {} + }); + } + } + + @HapinessModule({ + version: '1.0.0', + imports: [ SubModuleTest ] + }) + class ModuleTest implements OnStart { + constructor(@Inject(HttpServerExt) private server: Server) {} + onStart() { + unit.object(this.server.table().pop().table.pop()) + .hasProperty('path', '/route1'); + this.server.stop().then(_ => done()); + } + } + + Hapiness.bootstrap(ModuleTest, [ HttpServerExt.setConfig({ host: '0.0.0.0', port: 4445 }) ]); + } +} From 1a3f9792aba5c274fddb64d0b65961ee5daec0ee Mon Sep 17 00:00:00 2001 From: Juneil Date: Mon, 21 Aug 2017 18:30:10 +0200 Subject: [PATCH 06/19] fix(http-server): lifecycle preresponse fix, bootstrap ordering, ... --- src/core/hapiness.ts | 30 ++++++++++++----- src/core/module.ts | 2 +- src/extensions/http-server/extension.ts | 45 +++++++++++++++---------- src/extensions/http-server/lifecycle.ts | 6 ++-- src/extensions/http-server/route.ts | 3 +- test/integration/http-server.test.ts | 6 ++-- 6 files changed, 59 insertions(+), 33 deletions(-) diff --git a/src/core/hapiness.ts b/src/core/hapiness.ts index 1f05e1f..2d80265 100644 --- a/src/core/hapiness.ts +++ b/src/core/hapiness.ts @@ -47,9 +47,8 @@ export class Hapiness { return Observable .from([].concat(extensions).filter(_ => !!_)) .map(_ => this.toExtensionWithConfig(_)) - .flatMap(_ => this.loadExtention(_)) + .flatMap(_ => this.loadExtention(_, moduleResolved)) .toArray() - .do(_ => this.extensions = _) .flatMap(_ => this.instantiateModule(_, moduleResolved)); } @@ -66,7 +65,15 @@ export class Hapiness { .map(_ => ({ provide: _.token, useValue: _.value })) .toArray() .flatMap(_ => ModuleManager.instantiate(moduleResolved, _)) + .flatMap(moduleInstantiated => + Observable + .from(extensionsLoaded) + .flatMap(_ => this.moduleInstantiated(_, moduleInstantiated)) + .toArray() + .map(_ => moduleInstantiated) + ) .do(_ => this.module = _) + .do(_ => this.extensions = extensionsLoaded) .flatMap(_ => this.callHooks(_)); } @@ -108,6 +115,8 @@ export class Hapiness { private static checkArg(module: Type): Observable> { return Observable .of(module) + .do(_ => this.module = null) + .do(_ => this.extensions = null) .flatMap(_ => !!_ ? Observable.of(_) : Observable.throw('Bootstrap failed: no module provided') @@ -141,7 +150,7 @@ export class Hapiness { * @param {ExtensionWithConfig} extension * @returns Observable */ - private static loadExtention(extension: ExtensionWithConfig): Observable { + private static loadExtention(extension: ExtensionWithConfig, module: CoreModule): Observable { return Observable .of(Reflect.construct(extension.token, [])) .do(_ => this.logger.debug(`loading ${extension.token.name}`)) @@ -151,7 +160,7 @@ export class Hapiness { ExtentionHooksEnum.OnExtensionLoad.toString(), extension.token, instance, - [ this.module, extension.config ] + [ module, extension.config ] ) ); } @@ -163,15 +172,16 @@ export class Hapiness { * @param {Extension} extension * @returns Observable */ - private static moduleInstantiated(extension: Extension): Observable { + private static moduleInstantiated(extension: Extension, module: CoreModule): Observable { return HookManager .triggerHook( ExtentionHooksEnum.OnModuleInstantiated.toString(), extension.token, extension.instance, - [ this.module, extension.value ] + [ module, extension.value ] ) - .do(_ => this.logger.debug(`moduleInstantiated ${extension.token.name}`)); + .do(_ => this.logger.debug(`moduleInstantiated ${extension.token.name}`)) + .defaultIfEmpty(null); } } @@ -185,6 +195,8 @@ export function errorHandler(error: Error): void { .of(Hapiness['module']) .filter(_ => !!(_ && _.instance)) .flatMap(_ => + HookManager + .hasLifecycleHook(ModuleEnum.OnError.toString(), _.token) ? HookManager .triggerHook( ModuleEnum.OnError.toString(), @@ -192,7 +204,9 @@ export function errorHandler(error: Error): void { _.instance, [ error ], false - ) + ) : + Observable + .throw(error) ) .subscribe(null, _ => console.error(_)); } diff --git a/src/core/module.ts b/src/core/module.ts index 751e13c..aca3ed8 100644 --- a/src/core/module.ts +++ b/src/core/module.ts @@ -236,7 +236,7 @@ export class ModuleManager { private static instantiateLibs(module: CoreModule): Observable { return Observable .from(module.declarations) - .filter(_ => !!extractMetadataByDecorator(_, 'Lib')) + .filter(_ => !!_ && !!extractMetadataByDecorator(_, 'Lib')) .flatMap(_ => DependencyInjection.instantiateComponent(_, module.di)) .toArray() .map(_ => module); diff --git a/src/extensions/http-server/extension.ts b/src/extensions/http-server/extension.ts index a52b72a..4777a07 100644 --- a/src/extensions/http-server/extension.ts +++ b/src/extensions/http-server/extension.ts @@ -40,15 +40,15 @@ export class HttpServerExt implements OnExtensionLoad, OnModuleInstantiated { .do(_ => _.connection(Object.assign(config, { options: undefined }))) .flatMap(server => Observable - .from(ModuleManager.getModules(module)) - .flatMap(_ => this.registerPlugin(_, server)) - .reduce((a, c) => a.concat(c), []) - .do(_ => LifecycleManager.routeLifecycle(server, _)) - .map(_ => ({ + // .from(ModuleManager.getModules(module)) + // .flatMap(_ => this.registerPlugin(_, server)) + // .reduce((a, c) => a.concat(c), []) + // .do(_ => LifecycleManager.routeLifecycle(server, _)) + .of({ instance: this, token: HttpServerExt, value: server - })) + }) ) } @@ -61,12 +61,21 @@ export class HttpServerExt implements OnExtensionLoad, OnModuleInstantiated { * @returns Observable */ onModuleInstantiated(module: CoreModule, server: Server): Observable { - return this - .instantiateLifecycle(module, server) - .flatMap(_ => - Observable - .fromPromise(server.start()) - ); + return Observable + .from(ModuleManager.getModules(module)) + .flatMap(_ => this.registerPlugin(_, server)) + .reduce((a, c) => a.concat(c), []) + .do(_ => console.log('========', _)) + .do(_ => LifecycleManager.routeLifecycle(server, _)) + .flatMap(_ => this.instantiateLifecycle(module, server)) + .flatMap(_ => Observable.fromPromise(server.start())); + + // return this + // .instantiateLifecycle(module, server) + // .flatMap(_ => + // Observable + // .fromPromise(server.start()) + // ); } /** @@ -77,13 +86,13 @@ export class HttpServerExt implements OnExtensionLoad, OnModuleInstantiated { * @returns Observable */ private registerPlugin(module: CoreModule, server: Server): Observable { + const register: any = (s, o, n) => n(); + register.attributes = { + name: module.name, + version: module.version + }; return Observable - .of(_ => (s, o, n) => n()) - .do(_ => _['attributes'] = { - name: `${module.name}.hapinessplugin`, - version: module.version - }) - .flatMap(_ => Observable.fromPromise(server.register({ register: _ }))) + .fromPromise(server.register(register)) .flatMap(_ => this.addRoutes(module, server)); } diff --git a/src/extensions/http-server/lifecycle.ts b/src/extensions/http-server/lifecycle.ts index 7d58522..e22e856 100644 --- a/src/extensions/http-server/lifecycle.ts +++ b/src/extensions/http-server/lifecycle.ts @@ -54,9 +54,9 @@ export class LifecycleManager { ) ); - server.ext(LifecycleEventsEnum.OnPostHandler.toString(), + server.ext(LifecycleEventsEnum.OnPreResponse.toString(), (request: Request, reply: ReplyWithContinue) => - this.eventHandler(LifecycleHooksEnum.OnPostAuth, routes, request, reply) + this.eventHandler(LifecycleHooksEnum.OnPreResponse, routes, request, reply) .subscribe( _ => reply.continue(), _ => errorHandler(_), @@ -115,11 +115,11 @@ export class LifecycleManager { .of(routes) .map(_ => this.findRoute(request, _)) .filter(_ => request['_hapinessRoute'] && HookManager.hasLifecycleHook(hook.toString(), _.token)) + .do(_ => console.log('((__v__))', _)) .flatMap(_ => HookManager .triggerHook(hook.toString(), _.token, request['_hapinessRoute'], [request, reply]) ) - .defaultIfEmpty(reply.continue()) .filter(_ => !!_ && !_.statusCode && !_.headers && !_.source); } diff --git a/src/extensions/http-server/route.ts b/src/extensions/http-server/route.ts index 586f710..d1a91b6 100644 --- a/src/extensions/http-server/route.ts +++ b/src/extensions/http-server/route.ts @@ -70,6 +70,7 @@ export class RouteBuilder { private static coreRouteFromMetadata(data: Route, token: Type, module: CoreModule): Observable { return Observable .of(data) + .do(_ => console.log('0000000', _)) .flatMap(_ => Observable .from([].concat(_.method)) @@ -97,7 +98,7 @@ export class RouteBuilder { private static metadataFromDeclarations(declarations: Type[]): Observable { return Observable .from([].concat(declarations)) - .filter(_ => !!_) + .filter(_ => !!_ && !!extractMetadataByDecorator(_, this.decoratorName)) .map(_ => ({ token: _, route: extractMetadataByDecorator(_, this.decoratorName) })) } } diff --git a/test/integration/http-server.test.ts b/test/integration/http-server.test.ts index 0de1767..475398b 100644 --- a/test/integration/http-server.test.ts +++ b/test/integration/http-server.test.ts @@ -1,4 +1,4 @@ -import { suite, test} from 'mocha-typescript'; +import { suite, test, only } from 'mocha-typescript'; import * as unit from 'unit.js'; import { Hapiness, HapinessModule, Inject, OnRegister, OnStart } from '../../src/core'; import { HttpServerExt, Route, Lifecycle, OnGet, OnEvent, OnPreResponse } from '../../src/extensions/http-server'; @@ -36,9 +36,11 @@ class HttpServerIntegration { } } - Hapiness.bootstrap(ModuleTest, [ HttpServerExt.setConfig({ host: '0.0.0.0', port: 4444 }) ]); + Hapiness.bootstrap(ModuleTest, [ HttpServerExt.setConfig({ host: '0.0.0.0', port: 4444 }) ]) + .catch(_ => console.log(_)); } + @only @test('lifecycle') test2(done) { From 8c0dfe7dd47cf0a9aa78a98d6d7cf8591344a4dc Mon Sep 17 00:00:00 2001 From: Juneil Date: Tue, 22 Aug 2017 11:57:15 +0200 Subject: [PATCH 07/19] fix(lifecycle, socketserver): fix lifecycle handlers, add ext services --- src/core/interfaces/module.ts | 9 ++ src/extensions/http-server/extension.ts | 1 - src/extensions/http-server/index.ts | 1 + src/extensions/http-server/lifecycle.ts | 14 +- src/extensions/http-server/route.ts | 1 - src/extensions/http-server/service.ts | 31 ++++ src/extensions/socket-server/index.ts | 1 + src/extensions/socket-server/server.ts | 11 +- src/extensions/socket-server/service.ts | 35 +++++ src/index.ts | 6 +- test/integration/http-server.test.ts | 196 +++++++++++++++--------- test/integration/socket-server.test.ts | 79 ++++++++++ 12 files changed, 298 insertions(+), 87 deletions(-) create mode 100644 src/extensions/http-server/service.ts create mode 100644 src/extensions/socket-server/service.ts create mode 100644 test/integration/socket-server.test.ts diff --git a/src/core/interfaces/module.ts b/src/core/interfaces/module.ts index 58c7125..099c864 100644 --- a/src/core/interfaces/module.ts +++ b/src/core/interfaces/module.ts @@ -61,3 +61,12 @@ export interface OnRegister { onRegister(): void | Observable; } */ export interface OnStart { onStart(): void | Observable; } +/** + * Module Lifecycle Hook + * called when an error + * occured in components + * + * @returns void | Observable + */ +export interface OnError { onError(error: Error): void | Observable; } + diff --git a/src/extensions/http-server/extension.ts b/src/extensions/http-server/extension.ts index 4777a07..9ff2b16 100644 --- a/src/extensions/http-server/extension.ts +++ b/src/extensions/http-server/extension.ts @@ -65,7 +65,6 @@ export class HttpServerExt implements OnExtensionLoad, OnModuleInstantiated { .from(ModuleManager.getModules(module)) .flatMap(_ => this.registerPlugin(_, server)) .reduce((a, c) => a.concat(c), []) - .do(_ => console.log('========', _)) .do(_ => LifecycleManager.routeLifecycle(server, _)) .flatMap(_ => this.instantiateLifecycle(module, server)) .flatMap(_ => Observable.fromPromise(server.start())); diff --git a/src/extensions/http-server/index.ts b/src/extensions/http-server/index.ts index 807332a..0f97f6f 100644 --- a/src/extensions/http-server/index.ts +++ b/src/extensions/http-server/index.ts @@ -3,4 +3,5 @@ export * from './decorators'; export * from './lifecycle'; export * from './route'; export * from './interfaces'; +export * from './service'; export { Server, Request, ReplyNoContinue, ReplyWithContinue } from 'hapi'; diff --git a/src/extensions/http-server/lifecycle.ts b/src/extensions/http-server/lifecycle.ts index e22e856..b43e249 100644 --- a/src/extensions/http-server/lifecycle.ts +++ b/src/extensions/http-server/lifecycle.ts @@ -79,8 +79,13 @@ export class LifecycleManager { .of(routes) .map(_ => this.findRoute(request, _)) .filter(_ => !!(_ && _.token)) - .flatMap(_ => RouteBuilder.instantiateRouteAndDI(_, request)) - .do(_ => request['_hapinessRoute'] = _) + .flatMap(route => + RouteBuilder + .instantiateRouteAndDI(route, request) + .map(_ => ({ route, instance: _ })) + ) + .do(_ => request['_hapinessRoute'] = _.instance) + .defaultIfEmpty(null) .flatMap(_ => this.eventHandler(LifecycleHooksEnum.OnPreAuth, routes, request, reply)) } @@ -115,12 +120,13 @@ export class LifecycleManager { .of(routes) .map(_ => this.findRoute(request, _)) .filter(_ => request['_hapinessRoute'] && HookManager.hasLifecycleHook(hook.toString(), _.token)) - .do(_ => console.log('((__v__))', _)) .flatMap(_ => HookManager .triggerHook(hook.toString(), _.token, request['_hapinessRoute'], [request, reply]) + .defaultIfEmpty(null) ) - .filter(_ => !!_ && !_.statusCode && !_.headers && !_.source); + .isEmpty() + .filter(_ => !!_); } } diff --git a/src/extensions/http-server/route.ts b/src/extensions/http-server/route.ts index d1a91b6..a8efac9 100644 --- a/src/extensions/http-server/route.ts +++ b/src/extensions/http-server/route.ts @@ -70,7 +70,6 @@ export class RouteBuilder { private static coreRouteFromMetadata(data: Route, token: Type, module: CoreModule): Observable { return Observable .of(data) - .do(_ => console.log('0000000', _)) .flatMap(_ => Observable .from([].concat(_.method)) diff --git a/src/extensions/http-server/service.ts b/src/extensions/http-server/service.ts new file mode 100644 index 0000000..569a724 --- /dev/null +++ b/src/extensions/http-server/service.ts @@ -0,0 +1,31 @@ +import { Injectable, Inject } from '../../core'; +import { HttpServerExt, Server } from './'; +import { Observable } from 'rxjs'; + +@Injectable() +export class HttpServerService { + + constructor( + @Inject(HttpServerExt) private httpServer: Server + ) {} + + /** + * Get HapiJS Server instance + * + * @returns Server + */ + instance(): Server { + return this.httpServer; + } + + /** + * Stop the HapiJS Server + * + * @returns Observable + */ + stop(): Observable { + return Observable + .fromPromise(this.httpServer.stop()); + } + +} diff --git a/src/extensions/socket-server/index.ts b/src/extensions/socket-server/index.ts index cce0a84..20ac8c8 100644 --- a/src/extensions/socket-server/index.ts +++ b/src/extensions/socket-server/index.ts @@ -1,3 +1,4 @@ export * from './extension'; export * from './socket'; export * from './server'; +export * from './service'; diff --git a/src/extensions/socket-server/server.ts b/src/extensions/socket-server/server.ts index 165d2d0..053bebf 100644 --- a/src/extensions/socket-server/server.ts +++ b/src/extensions/socket-server/server.ts @@ -10,17 +10,18 @@ export class WebSocketServer { private server: server; private subscribers: Array<(socket: Socket) => void>; private sockets: Socket[]; + private httpServer: http.Server; constructor(config: SocketConfig) { - const httpServer = http.createServer((_request, _response) => { + this.httpServer = http.createServer((_request, _response) => { /* istanbul ignore next */ _response.writeHead(404); /* istanbul ignore next */ _response.end(); }); - httpServer.listen(config.port); + this.httpServer.listen(config.port); delete config.port; - const _config = Object.assign({ httpServer }, config); + const _config = Object.assign({ httpServer: this.httpServer }, config); this.server = new server(_config); this.sockets = []; this.subscribers = []; @@ -79,4 +80,8 @@ export class WebSocketServer { public getServer() { return this.server; } + + public getHttpServer() { + return this.httpServer; + } } diff --git a/src/extensions/socket-server/service.ts b/src/extensions/socket-server/service.ts new file mode 100644 index 0000000..e9627e9 --- /dev/null +++ b/src/extensions/socket-server/service.ts @@ -0,0 +1,35 @@ +import { Injectable, Inject } from '../../core'; +import { WebSocketServer } from './server'; +import { SocketServerExt } from './extension'; +import { Observable } from 'rxjs'; + +@Injectable() +export class SocketServerService { + + constructor( + @Inject(SocketServerExt) private socketServer: WebSocketServer + ) {} + + /** + * Get WebSocket Server instance + * + * @returns Server + */ + instance(): WebSocketServer { + return this.socketServer; + } + + /** + * Stop the WebSocket Server + * + * @returns Observable + */ + stop(): Observable { + return Observable + .of(this.socketServer) + .do(_ => _.getHttpServer().close()) + .do(_ => _.getServer().shutDown()) + .map(_ => null); + } + +} diff --git a/src/index.ts b/src/index.ts index d9928f7..90bd025 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,9 +1,9 @@ export { Hapiness, HapinessModule, Inject, Injectable, Optional, Lib, InjectionToken, - CoreModuleWithProviders, OnRegister, OnStart, CoreModule, CoreDecorator, CoreProvide, + CoreModuleWithProviders, OnRegister, OnStart, OnError, CoreModule, CoreDecorator, CoreProvide, Extension, ExtensionWithConfig, makeDecorator, Type, OnModuleInstantiated, OnExtensionLoad } from './core'; export { HttpServerExt, HapiConfig, Route, Lifecycle, HttpRequestInfo, OnEvent, OnGet, OnDelete, OnOptions, OnPatch, OnPost, OnPut, OnPreAuth, OnPostAuth, OnPreHandler, OnPostHandler, OnPreResponse, Request, - ReplyWithContinue, ReplyNoContinue, Server } from './extensions/http-server'; + ReplyWithContinue, ReplyNoContinue, Server, HttpServerService } from './extensions/http-server'; -export { SocketServerExt, Socket, SocketConfig, WebSocketServer } from './extensions/socket-server'; +export { SocketServerExt, Socket, SocketConfig, WebSocketServer, SocketServerService } from './extensions/socket-server'; diff --git a/test/integration/http-server.test.ts b/test/integration/http-server.test.ts index 475398b..398cd2a 100644 --- a/test/integration/http-server.test.ts +++ b/test/integration/http-server.test.ts @@ -1,8 +1,9 @@ import { suite, test, only } from 'mocha-typescript'; import * as unit from 'unit.js'; -import { Hapiness, HapinessModule, Inject, OnRegister, OnStart } from '../../src/core'; +import { Hapiness, HapinessModule, Inject, OnRegister, OnStart, OnError } from '../../src/core'; import { HttpServerExt, Route, Lifecycle, OnGet, OnEvent, OnPreResponse } from '../../src/extensions/http-server'; import { Server } from 'hapi'; +import { Observable } from 'rxjs'; @suite('Integration - Http Server') class HttpServerIntegration { @@ -36,11 +37,9 @@ class HttpServerIntegration { } } - Hapiness.bootstrap(ModuleTest, [ HttpServerExt.setConfig({ host: '0.0.0.0', port: 4444 }) ]) - .catch(_ => console.log(_)); + Hapiness.bootstrap(ModuleTest, [ HttpServerExt.setConfig({ host: '0.0.0.0', port: 4444 }) ]); } - @only @test('lifecycle') test2(done) { @@ -103,62 +102,6 @@ class HttpServerIntegration { .catch(_ => done(_)); } - /* @test('lifecycle') - test2(done) { - class Service1 { - getData() { - return '123'; - } - } - class Service2 {} - class Service3 { - getData() { - return '456'; - } - } - @Route({ - path: '/', - method: 'GET', - providers: [ Service1, { provide: Service2, useClass: Service2 } ] - }) - class RouteTest implements OnGet, OnPreResponse { - constructor(private serv: Service1, private serv3: Service3) {} - onGet(request, reply) { - reply('x'); - } - onPreResponse(request, reply) { - request.response.source = request.response.source + this.serv.getData() + this.serv3.getData(); - reply.continue(); - } - } - @Lifecycle({ - event: 'onPostHandler' - }) - class LF implements OnEvent { - onEvent(request, reply) { - request.response.source = 'toto'; - reply.continue(); - } - } - @HapinessModule({ - version: '1.0.0', - declarations: [ RouteTest, LF ], - providers: [ Service3 ] - }) - class ModuleTest implements OnStart { - constructor(@Inject(HttpServerExt) private server: Server) {} - onStart() { - this.server.inject('/', res => { - unit.string(res.result) - .is('toto123456'); - this.server.stop().then(_ => done()); - }); - } - } - Hapiness.bootstrap(ModuleTest, [ HttpServerExt.setConfig({ host: '0.0.0.0', port: 4444 }) ]) - .catch(_ => done(_)); - }*/ - @test('route submodule') test3(done) { @@ -194,25 +137,24 @@ class HttpServerIntegration { } } - Hapiness.bootstrap(ModuleTest, [ HttpServerExt.setConfig({ host: '0.0.0.0', port: 4444 }) ]) - .catch(_ => console.log(_.message)); + Hapiness.bootstrap(ModuleTest, [ HttpServerExt.setConfig({ host: '0.0.0.0', port: 4444 }) ]); } - @test('port already used') - test4(done) { + // @test('port already used') + // test4(done) { - @HapinessModule({ - version: '1.0.0' - }) - class ModuleTest {} + // @HapinessModule({ + // version: '1.0.0' + // }) + // class ModuleTest {} - Hapiness.bootstrap(ModuleTest, [ HttpServerExt.setConfig({ host: '0.0.0.0', port: 4444 }) ]).catch(_ => { - unit.object(_) - .isInstanceOf(Error) - .hasProperty('message', 'listen EADDRINUSE 0.0.0.0:4444'); - Hapiness['extensions'][0].value.stop().then(__ => done()); - }); - } + // Hapiness.bootstrap(ModuleTest, [ HttpServerExt.setConfig({ host: '0.0.0.0', port: 4444 }) ]).catch(_ => { + // unit.object(_) + // .isInstanceOf(Error) + // .hasProperty('message', 'listen EADDRINUSE 0.0.0.0:4444'); + // Hapiness['extensions'][0].value.stop().then(__ => done()); + // }); + // } @test('make sure register are done before start hook') test5(done) { @@ -246,4 +188,108 @@ class HttpServerIntegration { Hapiness.bootstrap(ModuleTest, [ HttpServerExt.setConfig({ host: '0.0.0.0', port: 4445 }) ]); } + + @test('response with Observable') + test6(done) { + + @Route({ + path: '/', + method: 'GET', + }) + class RouteTest implements OnGet { + onGet(request, reply) { + return Observable + .of('test'); + } + } + + @Route({ + path: '/2', + method: 'GET', + }) + class RouteTest2 implements OnGet { + onGet(request, reply) { + reply('test2'); + } + } + + @Route({ + path: '/3', + method: 'GET', + }) + class RouteTest3 implements OnGet { + onGet(request, reply) { + return Observable + .of({ response: 'test3', statusCode: 201 }); + } + } + + @HapinessModule({ + version: '1.0.0', + declarations: [ RouteTest, RouteTest2, RouteTest3 ] + }) + class ModuleTest implements OnStart { + constructor(@Inject(HttpServerExt) private server: Server) {} + onStart() { + this.server.inject('/', res => { + unit.string(res.result) + .is('test'); + unit.value(res.statusCode) + .is(200) + this.server.inject('/2', res2 => { + unit.string(res2.result) + .is('test2'); + this.server.inject('/3', res3 => { + unit.string(res3.result) + .is('test3'); + unit.value(res3.statusCode) + .is(201) + this.server.stop().then(_ => done()); + }); + }); + }); + } + } + + Hapiness.bootstrap(ModuleTest, [ HttpServerExt.setConfig({ host: '0.0.0.0', port: 4445 }) ]); + } + + @test('throw error in route') + test7(done) { + + @Route({ + path: '/', + method: 'GET', + }) + class RouteTest implements OnGet { + onGet(request, reply) { + throw new Error('Oops'); + } + } + + @HapinessModule({ + version: '1.0.0', + declarations: [ RouteTest ] + }) + class ModuleTest implements OnStart, OnError { + + constructor(@Inject(HttpServerExt) private server: Server) {} + + onStart() { + this.server.inject('/', res => { + unit.must(res.statusCode).equal(500); + }); + } + + onError(error) { + unit + .object(error) + .isInstanceOf(Error) + .hasProperty('message', 'Oops'); + this.server.stop().then(_ => done()); + } + } + + Hapiness.bootstrap(ModuleTest, [ HttpServerExt.setConfig({ host: '0.0.0.0', port: 4444 }) ]); + } } diff --git a/test/integration/socket-server.test.ts b/test/integration/socket-server.test.ts new file mode 100644 index 0000000..95ff5da --- /dev/null +++ b/test/integration/socket-server.test.ts @@ -0,0 +1,79 @@ +import { suite, test } from 'mocha-typescript'; +import * as unit from 'unit.js'; +import { Hapiness, HapinessModule, Inject, OnStart } from '../../src/core'; +import { SocketServerExt, WebSocketServer, SocketServerService } from '../../src/extensions/socket-server'; + +@suite('Integration - Socket Server') +class SocketServerIntegration { + + @test('socket message') + test1(done) { + + @HapinessModule({ + version: '1.0.0', + providers: [ SocketServerService ] + }) + class ModuleTest implements OnStart { + + constructor(private server: SocketServerService) {} + + onStart() { + this.server.instance().onRequest(socket => { + unit.array(this.server.instance().getSockets()) + .hasLength(1); + socket.emit('toto', 'test'); + socket.on('close', data => {}); + socket.on('error', data => {}); + socket.on('tata', data => {}); + socket.on('ev', data => { + this.server.instance().broadcast('test', 'test'); + }); + socket.on('*', data => { + if (data.utf8Data === '123') { + unit.string(data.utf8Data) + .is('123'); + socket.emitBytes(new Buffer('test')); + } + }); + socket.onBytes(data => { + unit.string(data.toString()) + .is('test'); + socket.close(); + this.server.stop() + .subscribe(_ => done()); + }); + }); + + const W3CWebSocket = require('websocket').w3cwebsocket; + const client = new W3CWebSocket('ws://localhost:2222/'); + client.onmessage = (e) => { + if (e.data === JSON.stringify({ event: 'toto', data: 'test' })) { + client.send('{"event":"ev","data":"abc"}'); + } else if (e.data instanceof ArrayBuffer) { + client.send(e.data); + } else { + client.send('123'); + } + }; + } + } + + Hapiness.bootstrap(ModuleTest, [ SocketServerExt.setConfig({ port: 2222 }) ]); + } + + @test('did well stop') + test2(done) { + + @HapinessModule({ + version: '1.0.0', + providers: [ SocketServerService ] + }) + class ModuleTest implements OnStart { + + onStart() { + done(); + } + } + Hapiness.bootstrap(ModuleTest, [ SocketServerExt.setConfig({ port: 2222 }) ]); + } +} From f6f4b4a1b18487b28487d31f4f4d159cbffb38a7 Mon Sep 17 00:00:00 2001 From: Juneil Date: Tue, 22 Aug 2017 17:56:08 +0200 Subject: [PATCH 08/19] test(core): unit tests --- src/core/di.ts | 2 +- src/core/hook.ts | 4 +- test/integration/core.test.ts | 354 +++++++-------- test/integration/http-server.test.ts | 574 ++++++++++++------------- test/integration/socket-server.test.ts | 138 +++--- test/unit/di.test.ts | 140 ++++++ test/unit/hapiness.test.ts | 65 +++ test/unit/hook.test.ts | 119 +++++ test/unit/mocks.ts | 5 +- test/unit/module.test.ts | 66 ++- 10 files changed, 920 insertions(+), 547 deletions(-) create mode 100644 test/unit/di.test.ts create mode 100644 test/unit/hapiness.test.ts create mode 100644 test/unit/hook.test.ts diff --git a/src/core/di.ts b/src/core/di.ts index db17bcc..9ef2063 100644 --- a/src/core/di.ts +++ b/src/core/di.ts @@ -32,7 +32,7 @@ export class DependencyInjection { } /** - * Instanciate a component + * Instantiate a component * resolving its dependencies * without inject the component * into the DI diff --git a/src/core/hook.ts b/src/core/hook.ts index 86236f6..bdcf0ae 100644 --- a/src/core/hook.ts +++ b/src/core/hook.ts @@ -30,7 +30,6 @@ export class HookManager { * @returns Observable */ public static triggerHook(hook: string, token: Type, instance: T, args?: any[], throwErr?: boolean): Observable { - this.logger.debug(`Triggering hook '${hook}' on '${token ? token.name : null}'`); return Observable .merge( Observable @@ -47,7 +46,8 @@ export class HookManager { Observable .of(this.hasLifecycleHook(hook, token)) .filter(_ => !_ && throwErr) - .flatMap(_ => Observable.throw(new Error(`Hook missing ${hook} on ${token ? token.name : null}`))) + .flatMap(_ => Observable.throw(new Error(`Hook missing ${hook} on ${token.name}`))) ) + .do(_ => this.logger.debug(`Triggering hook '${hook}' on '${token.name}'`)); } } diff --git a/test/integration/core.test.ts b/test/integration/core.test.ts index f48e2f6..057638f 100644 --- a/test/integration/core.test.ts +++ b/test/integration/core.test.ts @@ -1,177 +1,177 @@ -import { suite, test } from 'mocha-typescript'; -import { Hapiness, HapinessModule, OnStart, OnRegister, Lib, Injectable } from '../../src/core'; -import { Observable } from 'rxjs'; -import * as unit from 'unit.js'; - -@suite('Integration - Core') -class ModuleTestSuite { - - @test('Bootstrap - Simple module') - testBootstrap1(done) { - - @HapinessModule({ - version: '' - }) - class Module1 implements OnStart { - - onStart() { - done(); - } - - } - - Hapiness - .bootstrap(Module1); - - } - - @test('Bootstrap - Module with embedded module') - testBootstrap2(done) { - let state = 0; - - @HapinessModule({ - version: '' - }) - class Module1 implements OnRegister { - - onRegister() { - state = 1; - } - - } - - @HapinessModule({ - version: '', - imports: [ Module1 ] - }) - class Module2 implements OnStart { - - onStart() { - unit - .value(state) - .is(1); - done(); - } - - } - - Hapiness - .bootstrap(Module2); - - } - - @test('Bootstrap - Module with Lib') - testBootstrap3(done) { - - @Lib() - class Lib1 { - constructor() { - done(); - } - } - - @HapinessModule({ - version: '', - declarations: [ Lib1 ] - }) - class Module1 {} - - Hapiness - .bootstrap(Module1); - - } - - @test('Bootstrap - Module with Provider') - testBootstrap4(done) { - - @Injectable() - class Provider1 { - value() { - return 123; - } - } - - @HapinessModule({ - version: '', - providers: [ Provider1 ] - }) - class Module1 implements OnStart { - constructor(private provider1: Provider1) {} - onStart() { - unit - .number(this.provider1.value()) - .is(123); - done(); - } - } - - Hapiness - .bootstrap(Module1); - - } - - @test('Bootstrap - Module with Lib and Provider') - testBootstrap5(done) { - - @Injectable() - class Provider1 { - value() { - return 123; - } - } - - @Lib() - class Lib1 { - constructor(provider1: Provider1) { - unit - .number(provider1.value()) - .is(123); - } - } - - @HapinessModule({ - version: '', - declarations: [ Lib1 ], - providers: [ Provider1 ] - }) - class Module1 implements OnStart { - constructor(private provider1: Provider1) {} - onStart() { - unit - .number(this.provider1.value()) - .is(123); - done(); - } - } - - Hapiness - .bootstrap(Module1); - - } - - @test('Bootstrap - Error thrown') - testBootstrap6(done) { - - @HapinessModule({ - version: '' - }) - class Module1 implements OnStart { - - onStart() { - throw new Error('Oops'); - } - - } - - Hapiness - .bootstrap(Module1) - .catch(_ => { - unit - .object(_) - .isInstanceOf(Error) - .hasProperty('message', 'Oops'); - done(); - }); - - } -} +// import { suite, test } from 'mocha-typescript'; +// import { Hapiness, HapinessModule, OnStart, OnRegister, Lib, Injectable } from '../../src/core'; +// import { Observable } from 'rxjs'; +// import * as unit from 'unit.js'; + +// @suite('Integration - Core') +// class ModuleTestSuite { + +// @test('Bootstrap - Simple module') +// testBootstrap1(done) { + +// @HapinessModule({ +// version: '' +// }) +// class Module1 implements OnStart { + +// onStart() { +// done(); +// } + +// } + +// Hapiness +// .bootstrap(Module1); + +// } + +// @test('Bootstrap - Module with embedded module') +// testBootstrap2(done) { +// let state = 0; + +// @HapinessModule({ +// version: '' +// }) +// class Module1 implements OnRegister { + +// onRegister() { +// state = 1; +// } + +// } + +// @HapinessModule({ +// version: '', +// imports: [ Module1 ] +// }) +// class Module2 implements OnStart { + +// onStart() { +// unit +// .value(state) +// .is(1); +// done(); +// } + +// } + +// Hapiness +// .bootstrap(Module2); + +// } + +// @test('Bootstrap - Module with Lib') +// testBootstrap3(done) { + +// @Lib() +// class Lib1 { +// constructor() { +// done(); +// } +// } + +// @HapinessModule({ +// version: '', +// declarations: [ Lib1 ] +// }) +// class Module1 {} + +// Hapiness +// .bootstrap(Module1); + +// } + +// @test('Bootstrap - Module with Provider') +// testBootstrap4(done) { + +// @Injectable() +// class Provider1 { +// value() { +// return 123; +// } +// } + +// @HapinessModule({ +// version: '', +// providers: [ Provider1 ] +// }) +// class Module1 implements OnStart { +// constructor(private provider1: Provider1) {} +// onStart() { +// unit +// .number(this.provider1.value()) +// .is(123); +// done(); +// } +// } + +// Hapiness +// .bootstrap(Module1); + +// } + +// @test('Bootstrap - Module with Lib and Provider') +// testBootstrap5(done) { + +// @Injectable() +// class Provider1 { +// value() { +// return 123; +// } +// } + +// @Lib() +// class Lib1 { +// constructor(provider1: Provider1) { +// unit +// .number(provider1.value()) +// .is(123); +// } +// } + +// @HapinessModule({ +// version: '', +// declarations: [ Lib1 ], +// providers: [ Provider1 ] +// }) +// class Module1 implements OnStart { +// constructor(private provider1: Provider1) {} +// onStart() { +// unit +// .number(this.provider1.value()) +// .is(123); +// done(); +// } +// } + +// Hapiness +// .bootstrap(Module1); + +// } + +// @test('Bootstrap - Error thrown') +// testBootstrap6(done) { + +// @HapinessModule({ +// version: '' +// }) +// class Module1 implements OnStart { + +// onStart() { +// throw new Error('Oops'); +// } + +// } + +// Hapiness +// .bootstrap(Module1) +// .catch(_ => { +// unit +// .object(_) +// .isInstanceOf(Error) +// .hasProperty('message', 'Oops'); +// done(); +// }); + +// } +// } diff --git a/test/integration/http-server.test.ts b/test/integration/http-server.test.ts index 398cd2a..0fa0b2c 100644 --- a/test/integration/http-server.test.ts +++ b/test/integration/http-server.test.ts @@ -1,295 +1,279 @@ -import { suite, test, only } from 'mocha-typescript'; -import * as unit from 'unit.js'; -import { Hapiness, HapinessModule, Inject, OnRegister, OnStart, OnError } from '../../src/core'; -import { HttpServerExt, Route, Lifecycle, OnGet, OnEvent, OnPreResponse } from '../../src/extensions/http-server'; -import { Server } from 'hapi'; -import { Observable } from 'rxjs'; - -@suite('Integration - Http Server') -class HttpServerIntegration { - - @test('route get') - test1(done) { - - @Route({ - path: '/', - method: 'GET', - }) - class RouteTest implements OnGet { - onGet(request, reply) { - reply('test'); - } - } - - @HapinessModule({ - version: '1.0.0', - declarations: [ RouteTest ] - }) - class ModuleTest implements OnStart { - - constructor(@Inject(HttpServerExt) private server: Server) {} - - onStart() { - this.server.inject('/', res => { - unit.must(res.result).equal('test'); - this.server.stop().then(_ => done()); - }); - } - } - - Hapiness.bootstrap(ModuleTest, [ HttpServerExt.setConfig({ host: '0.0.0.0', port: 4444 }) ]); - } - - @test('lifecycle') - test2(done) { - - class Service1 { - getData() { - return '123'; - } - } - class Service2 {} - class Service3 { - getData() { - return '456'; - } - } - - @Route({ - path: '/', - method: 'GET' - }) - class RouteTest implements OnGet, OnPreResponse { - constructor(private serv: Service1, private serv3: Service3) {} - onGet(request, reply) { - reply('x'); - } - onPreResponse(request, reply) { - request.response.source = request.response.source + this.serv.getData() + this.serv3.getData(); - reply.continue(); - } - } - - @Lifecycle({ - event: 'onPostHandler' - }) - class LF implements OnEvent { - onEvent(request, reply) { - request.response.source = 'toto'; - reply.continue(); - } - } - - @HapinessModule({ - version: '1.0.0', - declarations: [ RouteTest, LF ], - providers: [ Service3, Service1, { provide: Service2, useClass: Service2 } ] - }) - class ModuleTest implements OnStart { - - constructor(@Inject(HttpServerExt) private server: Server) {} - - onStart() { - this.server.inject('/', res => { - unit.string(res.result) - .is('toto123456'); - this.server.stop().then(_ => done()); - }); - } - } - - Hapiness.bootstrap(ModuleTest, [ HttpServerExt.setConfig({ host: '0.0.0.0', port: 4444 }) ]) - .catch(_ => done(_)); - } - - @test('route submodule') - test3(done) { - - @Route({ - path: '/', - method: 'GET', - }) - class RouteTest implements OnGet { - onGet(request, reply) { - reply('test'); - } - } - - @HapinessModule({ - version: '1.0.0', - declarations: [ RouteTest ] - }) - class SubModuleTest {} - - @HapinessModule({ - version: '1.0.0', - imports: [ SubModuleTest ] - }) - class ModuleTest implements OnStart { - - constructor(@Inject(HttpServerExt) private server: Server) {} - - onStart() { - this.server.inject('/', res => { - unit.must(res.result).equal('test'); - done(); - }); - } - } - - Hapiness.bootstrap(ModuleTest, [ HttpServerExt.setConfig({ host: '0.0.0.0', port: 4444 }) ]); - } - - // @test('port already used') - // test4(done) { - - // @HapinessModule({ - // version: '1.0.0' - // }) - // class ModuleTest {} - - // Hapiness.bootstrap(ModuleTest, [ HttpServerExt.setConfig({ host: '0.0.0.0', port: 4444 }) ]).catch(_ => { - // unit.object(_) - // .isInstanceOf(Error) - // .hasProperty('message', 'listen EADDRINUSE 0.0.0.0:4444'); - // Hapiness['extensions'][0].value.stop().then(__ => done()); - // }); - // } - - @test('make sure register are done before start hook') - test5(done) { - - @HapinessModule({ - version: '1.0.0' - }) - class SubModuleTest implements OnRegister { - constructor(@Inject(HttpServerExt) private server: Server) {} - onRegister() { - this.server.route({ - path: '/route1', - method: 'GET', - handler: () => {} - }); - } - } - - @HapinessModule({ - version: '1.0.0', - imports: [ SubModuleTest ] - }) - class ModuleTest implements OnStart { - constructor(@Inject(HttpServerExt) private server: Server) {} - onStart() { - unit.object(this.server.table().pop().table.pop()) - .hasProperty('path', '/route1'); - this.server.stop().then(_ => done()); - } - } - - Hapiness.bootstrap(ModuleTest, [ HttpServerExt.setConfig({ host: '0.0.0.0', port: 4445 }) ]); - } - - @test('response with Observable') - test6(done) { - - @Route({ - path: '/', - method: 'GET', - }) - class RouteTest implements OnGet { - onGet(request, reply) { - return Observable - .of('test'); - } - } - - @Route({ - path: '/2', - method: 'GET', - }) - class RouteTest2 implements OnGet { - onGet(request, reply) { - reply('test2'); - } - } - - @Route({ - path: '/3', - method: 'GET', - }) - class RouteTest3 implements OnGet { - onGet(request, reply) { - return Observable - .of({ response: 'test3', statusCode: 201 }); - } - } - - @HapinessModule({ - version: '1.0.0', - declarations: [ RouteTest, RouteTest2, RouteTest3 ] - }) - class ModuleTest implements OnStart { - constructor(@Inject(HttpServerExt) private server: Server) {} - onStart() { - this.server.inject('/', res => { - unit.string(res.result) - .is('test'); - unit.value(res.statusCode) - .is(200) - this.server.inject('/2', res2 => { - unit.string(res2.result) - .is('test2'); - this.server.inject('/3', res3 => { - unit.string(res3.result) - .is('test3'); - unit.value(res3.statusCode) - .is(201) - this.server.stop().then(_ => done()); - }); - }); - }); - } - } - - Hapiness.bootstrap(ModuleTest, [ HttpServerExt.setConfig({ host: '0.0.0.0', port: 4445 }) ]); - } - - @test('throw error in route') - test7(done) { - - @Route({ - path: '/', - method: 'GET', - }) - class RouteTest implements OnGet { - onGet(request, reply) { - throw new Error('Oops'); - } - } - - @HapinessModule({ - version: '1.0.0', - declarations: [ RouteTest ] - }) - class ModuleTest implements OnStart, OnError { - - constructor(@Inject(HttpServerExt) private server: Server) {} - - onStart() { - this.server.inject('/', res => { - unit.must(res.statusCode).equal(500); - }); - } - - onError(error) { - unit - .object(error) - .isInstanceOf(Error) - .hasProperty('message', 'Oops'); - this.server.stop().then(_ => done()); - } - } - - Hapiness.bootstrap(ModuleTest, [ HttpServerExt.setConfig({ host: '0.0.0.0', port: 4444 }) ]); - } -} +// import { suite, test, only } from 'mocha-typescript'; +// import * as unit from 'unit.js'; +// import { Hapiness, HapinessModule, Inject, OnRegister, OnStart, OnError } from '../../src/core'; +// import { HttpServerExt, Route, Lifecycle, OnGet, OnEvent, OnPreResponse } from '../../src/extensions/http-server'; +// import { Server } from 'hapi'; +// import { Observable } from 'rxjs'; + +// @suite('Integration - Http Server') +// class HttpServerIntegration { + +// @test('route get') +// test1(done) { + +// @Route({ +// path: '/', +// method: 'GET', +// }) +// class RouteTest implements OnGet { +// onGet(request, reply) { +// reply('test'); +// } +// } + +// @HapinessModule({ +// version: '1.0.0', +// declarations: [ RouteTest ] +// }) +// class ModuleTest implements OnStart { + +// constructor(@Inject(HttpServerExt) private server: Server) {} + +// onStart() { +// this.server.inject('/', res => { +// unit.must(res.result).equal('test'); +// this.server.stop().then(_ => done()); +// }); +// } +// } + +// Hapiness.bootstrap(ModuleTest, [ HttpServerExt.setConfig({ host: '0.0.0.0', port: 4444 }) ]); +// } + +// @test('lifecycle') +// test2(done) { + +// class Service1 { +// getData() { +// return '123'; +// } +// } +// class Service2 {} +// class Service3 { +// getData() { +// return '456'; +// } +// } + +// @Route({ +// path: '/', +// method: 'GET' +// }) +// class RouteTest implements OnGet, OnPreResponse { +// constructor(private serv: Service1, private serv3: Service3) {} +// onGet(request, reply) { +// reply('x'); +// } +// onPreResponse(request, reply) { +// request.response.source = request.response.source + this.serv.getData() + this.serv3.getData(); +// reply.continue(); +// } +// } + +// @Lifecycle({ +// event: 'onPostHandler' +// }) +// class LF implements OnEvent { +// onEvent(request, reply) { +// request.response.source = 'toto'; +// reply.continue(); +// } +// } + +// @HapinessModule({ +// version: '1.0.0', +// declarations: [ RouteTest, LF ], +// providers: [ Service3, Service1, { provide: Service2, useClass: Service2 } ] +// }) +// class ModuleTest implements OnStart { + +// constructor(@Inject(HttpServerExt) private server: Server) {} + +// onStart() { +// this.server.inject('/', res => { +// unit.string(res.result) +// .is('toto123456'); +// this.server.stop().then(_ => done()); +// }); +// } +// } + +// Hapiness.bootstrap(ModuleTest, [ HttpServerExt.setConfig({ host: '0.0.0.0', port: 4444 }) ]) +// .catch(_ => done(_)); +// } + +// @test('route submodule') +// test3(done) { + +// @Route({ +// path: '/', +// method: 'GET', +// }) +// class RouteTest implements OnGet { +// onGet(request, reply) { +// reply('test'); +// } +// } + +// @HapinessModule({ +// version: '1.0.0', +// declarations: [ RouteTest ] +// }) +// class SubModuleTest {} + +// @HapinessModule({ +// version: '1.0.0', +// imports: [ SubModuleTest ] +// }) +// class ModuleTest implements OnStart { + +// constructor(@Inject(HttpServerExt) private server: Server) {} + +// onStart() { +// this.server.inject('/', res => { +// unit.must(res.result).equal('test'); +// done(); +// }); +// } +// } + +// Hapiness.bootstrap(ModuleTest, [ HttpServerExt.setConfig({ host: '0.0.0.0', port: 4444 }) ]); +// } + +// @test('make sure register are done before start hook') +// test5(done) { + +// @HapinessModule({ +// version: '1.0.0' +// }) +// class SubModuleTest implements OnRegister { +// constructor(@Inject(HttpServerExt) private server: Server) {} +// onRegister() { +// this.server.route({ +// path: '/route1', +// method: 'GET', +// handler: () => {} +// }); +// } +// } + +// @HapinessModule({ +// version: '1.0.0', +// imports: [ SubModuleTest ] +// }) +// class ModuleTest implements OnStart { +// constructor(@Inject(HttpServerExt) private server: Server) {} +// onStart() { +// unit.object(this.server.table().pop().table.pop()) +// .hasProperty('path', '/route1'); +// this.server.stop().then(_ => done()); +// } +// } + +// Hapiness.bootstrap(ModuleTest, [ HttpServerExt.setConfig({ host: '0.0.0.0', port: 4445 }) ]); +// } + +// @test('response with Observable') +// test6(done) { + +// @Route({ +// path: '/', +// method: 'GET', +// }) +// class RouteTest implements OnGet { +// onGet(request, reply) { +// return Observable +// .of('test'); +// } +// } + +// @Route({ +// path: '/2', +// method: 'GET', +// }) +// class RouteTest2 implements OnGet { +// onGet(request, reply) { +// reply('test2'); +// } +// } + +// @Route({ +// path: '/3', +// method: 'GET', +// }) +// class RouteTest3 implements OnGet { +// onGet(request, reply) { +// return Observable +// .of({ response: 'test3', statusCode: 201 }); +// } +// } + +// @HapinessModule({ +// version: '1.0.0', +// declarations: [ RouteTest, RouteTest2, RouteTest3 ] +// }) +// class ModuleTest implements OnStart { +// constructor(@Inject(HttpServerExt) private server: Server) {} +// onStart() { +// this.server.inject('/', res => { +// unit.string(res.result) +// .is('test'); +// unit.value(res.statusCode) +// .is(200) +// this.server.inject('/2', res2 => { +// unit.string(res2.result) +// .is('test2'); +// this.server.inject('/3', res3 => { +// unit.string(res3.result) +// .is('test3'); +// unit.value(res3.statusCode) +// .is(201) +// this.server.stop().then(_ => done()); +// }); +// }); +// }); +// } +// } + +// Hapiness.bootstrap(ModuleTest, [ HttpServerExt.setConfig({ host: '0.0.0.0', port: 4445 }) ]); +// } + +// @test('throw error in route') +// test7(done) { + +// @Route({ +// path: '/', +// method: 'GET', +// }) +// class RouteTest implements OnGet { +// onGet(request, reply) { +// throw new Error('Oops'); +// } +// } + +// @HapinessModule({ +// version: '1.0.0', +// declarations: [ RouteTest ] +// }) +// class ModuleTest implements OnStart, OnError { + +// constructor(@Inject(HttpServerExt) private server: Server) {} + +// onStart() { +// this.server.inject('/', res => { +// unit.must(res.statusCode).equal(500); +// }); +// } + +// onError(error) { +// unit +// .object(error) +// .isInstanceOf(Error) +// .hasProperty('message', 'Oops'); +// this.server.stop().then(_ => done()); +// } +// } + +// Hapiness.bootstrap(ModuleTest, [ HttpServerExt.setConfig({ host: '0.0.0.0', port: 4444 }) ]); +// } +// } diff --git a/test/integration/socket-server.test.ts b/test/integration/socket-server.test.ts index 95ff5da..fdec279 100644 --- a/test/integration/socket-server.test.ts +++ b/test/integration/socket-server.test.ts @@ -1,79 +1,79 @@ -import { suite, test } from 'mocha-typescript'; -import * as unit from 'unit.js'; -import { Hapiness, HapinessModule, Inject, OnStart } from '../../src/core'; -import { SocketServerExt, WebSocketServer, SocketServerService } from '../../src/extensions/socket-server'; +// import { suite, test } from 'mocha-typescript'; +// import * as unit from 'unit.js'; +// import { Hapiness, HapinessModule, Inject, OnStart } from '../../src/core'; +// import { SocketServerExt, WebSocketServer, SocketServerService } from '../../src/extensions/socket-server'; -@suite('Integration - Socket Server') -class SocketServerIntegration { +// @suite('Integration - Socket Server') +// class SocketServerIntegration { - @test('socket message') - test1(done) { +// @test('socket message') +// test1(done) { - @HapinessModule({ - version: '1.0.0', - providers: [ SocketServerService ] - }) - class ModuleTest implements OnStart { +// @HapinessModule({ +// version: '1.0.0', +// providers: [ SocketServerService ] +// }) +// class ModuleTest implements OnStart { - constructor(private server: SocketServerService) {} +// constructor(private server: SocketServerService) {} - onStart() { - this.server.instance().onRequest(socket => { - unit.array(this.server.instance().getSockets()) - .hasLength(1); - socket.emit('toto', 'test'); - socket.on('close', data => {}); - socket.on('error', data => {}); - socket.on('tata', data => {}); - socket.on('ev', data => { - this.server.instance().broadcast('test', 'test'); - }); - socket.on('*', data => { - if (data.utf8Data === '123') { - unit.string(data.utf8Data) - .is('123'); - socket.emitBytes(new Buffer('test')); - } - }); - socket.onBytes(data => { - unit.string(data.toString()) - .is('test'); - socket.close(); - this.server.stop() - .subscribe(_ => done()); - }); - }); +// onStart() { +// this.server.instance().onRequest(socket => { +// unit.array(this.server.instance().getSockets()) +// .hasLength(1); +// socket.emit('toto', 'test'); +// socket.on('close', data => {}); +// socket.on('error', data => {}); +// socket.on('tata', data => {}); +// socket.on('ev', data => { +// this.server.instance().broadcast('test', 'test'); +// }); +// socket.on('*', data => { +// if (data.utf8Data === '123') { +// unit.string(data.utf8Data) +// .is('123'); +// socket.emitBytes(new Buffer('test')); +// } +// }); +// socket.onBytes(data => { +// unit.string(data.toString()) +// .is('test'); +// socket.close(); +// this.server.stop() +// .subscribe(_ => done()); +// }); +// }); - const W3CWebSocket = require('websocket').w3cwebsocket; - const client = new W3CWebSocket('ws://localhost:2222/'); - client.onmessage = (e) => { - if (e.data === JSON.stringify({ event: 'toto', data: 'test' })) { - client.send('{"event":"ev","data":"abc"}'); - } else if (e.data instanceof ArrayBuffer) { - client.send(e.data); - } else { - client.send('123'); - } - }; - } - } +// const W3CWebSocket = require('websocket').w3cwebsocket; +// const client = new W3CWebSocket('ws://localhost:2222/'); +// client.onmessage = (e) => { +// if (e.data === JSON.stringify({ event: 'toto', data: 'test' })) { +// client.send('{"event":"ev","data":"abc"}'); +// } else if (e.data instanceof ArrayBuffer) { +// client.send(e.data); +// } else { +// client.send('123'); +// } +// }; +// } +// } - Hapiness.bootstrap(ModuleTest, [ SocketServerExt.setConfig({ port: 2222 }) ]); - } +// Hapiness.bootstrap(ModuleTest, [ SocketServerExt.setConfig({ port: 2222 }) ]); +// } - @test('did well stop') - test2(done) { +// @test('did well stop') +// test2(done) { - @HapinessModule({ - version: '1.0.0', - providers: [ SocketServerService ] - }) - class ModuleTest implements OnStart { +// @HapinessModule({ +// version: '1.0.0', +// providers: [ SocketServerService ] +// }) +// class ModuleTest implements OnStart { - onStart() { - done(); - } - } - Hapiness.bootstrap(ModuleTest, [ SocketServerExt.setConfig({ port: 2222 }) ]); - } -} +// onStart() { +// done(); +// } +// } +// Hapiness.bootstrap(ModuleTest, [ SocketServerExt.setConfig({ port: 2222 }) ]); +// } +// } diff --git a/test/unit/di.test.ts b/test/unit/di.test.ts new file mode 100644 index 0000000..0398a6d --- /dev/null +++ b/test/unit/di.test.ts @@ -0,0 +1,140 @@ +import { Injectable } from '../../src/core'; +import { suite, test } from 'mocha-typescript'; +import { DependencyInjection, Lib } from '../../src/core'; +import { Observable } from 'rxjs'; +import * as unit from 'unit.js'; + +import { EmptyProvider } from './mocks'; + +@suite('Unit - DI') +class ModuleTestSuite { + + @test('createAndResolve - provide providers without parent and must return DI') + testCreateAndResolve1() { + + DependencyInjection + .createAndResolve([ EmptyProvider ]) + .subscribe( + _ => + unit + .object(_.get(EmptyProvider)) + .isInstanceOf(EmptyProvider) + ); + + } + + @test('createAndResolve - provide providers with parent and must return DI') + testCreateAndResolve2() { + + @Injectable() + class ParentProvider {} + + DependencyInjection + .createAndResolve([ ParentProvider ]) + .flatMap(_ => DependencyInjection.createAndResolve([ EmptyProvider ], _)) + .subscribe( + _ => + unit + .object(_.get(ParentProvider)) + .isInstanceOf(ParentProvider) + ); + + } + + @test('createAndResolve - provide provider that thrown error') + testCreateAndResolve3() { + + @Injectable() + class ParentProvider { + constructor() { throw new Error('Oops'); } + } + + DependencyInjection + .createAndResolve([ EmptyProvider ]) + .subscribe( + null, + _ => + unit + .object(_) + .isInstanceOf(Error) + .hasProperty('message', 'Oops') + ); + + } + + @test('createAndResolve - provide parent and provide an already injected provider') + testCreateAndResolve4() { + + let count = 0; + + @Injectable() + class TestProvider { + constructor() { count++; } + } + + DependencyInjection + .createAndResolve([ TestProvider ]) + .do(_ => _.get(TestProvider)) + .flatMap(_ => DependencyInjection.createAndResolve([ TestProvider ], _)) + .subscribe( + _ => { + _.get(TestProvider); + unit + .number(count) + .is(2); + } + ); + + } + + @test('instantiateComponent - instantiate Lib component with provider dependency') + testInstantiateComponent1() { + + let count = 0; + + @Lib() + class TestLib { + constructor(public provider: EmptyProvider) {} + } + + DependencyInjection + .createAndResolve([ EmptyProvider ]) + .flatMap(_ => + DependencyInjection + .instantiateComponent(TestLib, _) + ) + .subscribe( + _ => + unit + .object(_.provider) + .isInstanceOf(EmptyProvider) + ); + + } + + @test('instantiateComponent - instantiate Lib and with no provider') + testInstantiateComponent2() { + + let count = 0; + + @Lib() + class TestLib { + constructor(public provider: EmptyProvider) {} + } + + DependencyInjection + .createAndResolve([]) + .flatMap(_ => + DependencyInjection + .instantiateComponent(TestLib, _) + ) + .subscribe( + null, + _ => + unit + .object(_) + .isInstanceOf(Error) + ); + + } +} diff --git a/test/unit/hapiness.test.ts b/test/unit/hapiness.test.ts new file mode 100644 index 0000000..9f58ea9 --- /dev/null +++ b/test/unit/hapiness.test.ts @@ -0,0 +1,65 @@ +import * as util from 'util'; +import { Injectable } from '../../src/core'; +import { suite, test } from 'mocha-typescript'; +import { Hapiness, ModuleManager } from '../../src/core'; +import { Observable } from 'rxjs'; +import * as unit from 'unit.js'; + +import { EmptyModule, coreModule } from './mocks'; + +@suite('Unit - Hapiness') +class TestSuite { + + @test('bootstrap - provide module and must resolve') + testBootstrap1(done) { + + const stub1 = unit + .stub(Hapiness, 'checkArg') + .withArgs(EmptyModule) + .returns(Observable.of(EmptyModule)); + const stub2 = unit + .stub(ModuleManager, 'resolve') + .withArgs(EmptyModule) + .returns(Observable.of(coreModule)); + const stub3 = unit + .stub(Hapiness, 'loadExtensions') + .withArgs(undefined, coreModule) + .returns(Observable.of([])); + + Hapiness + .bootstrap(EmptyModule) + .then(_ => { + stub1.parent.restore(); + stub2.parent.restore(); + stub3.parent.restore(); + done(); + }); + } + + @test('bootstrap - provide module and must reject') + testBootstrap2(done) { + + const stub1 = unit + .stub(Hapiness, 'checkArg') + .withArgs(EmptyModule) + .returns(Observable.throw(new Error('Oops'))); + + Hapiness + .bootstrap(EmptyModule) + .catch(_ => { + unit + .object(_) + .isInstanceOf(Error) + .hasProperty('message', 'Oops'); + + stub1.parent.restore(); + done(); + }); + } + + @test('loadExtensions - ') + testLoadExtensions1() { + + } + +} diff --git a/test/unit/hook.test.ts b/test/unit/hook.test.ts new file mode 100644 index 0000000..5f71c25 --- /dev/null +++ b/test/unit/hook.test.ts @@ -0,0 +1,119 @@ +import * as util from 'util'; +import { Injectable } from '../../src/core'; +import { suite, test } from 'mocha-typescript'; +import { HookManager } from '../../src/core'; +import { Observable } from 'rxjs'; +import * as unit from 'unit.js'; + +import { EmptyProvider } from './mocks'; + +@suite('Unit - Hook') +class ModuleTestSuite { + + @test('hasLifecycleHook - provide hook and token and must return true') + testHasLifecycleHook1() { + + class MyToken { + test() {} + } + + unit + .bool(HookManager.hasLifecycleHook('test', MyToken)) + .isTrue(); + } + + @test('hasLifecycleHook - provide hook and token and must return false') + testHasLifecycleHook2() { + + class MyToken {} + + unit + .bool(HookManager.hasLifecycleHook('test', MyToken)) + .isFalse(); + } + + @test('triggerHook - provide hook, token and instance and must return Observable hook value') + testTriggerHook1() { + + class MyToken { + test() { return 1 } + } + + HookManager + .triggerHook('test', MyToken, new MyToken()) + .subscribe( + _ => + unit + .value(_) + .is(1) + ); + } + + @test('triggerHook - provide hook, token and instance and must return Observable') + testTriggerHook2() { + + class MyToken { + test() { return Observable.of(1) } + } + + HookManager + .triggerHook('test', MyToken, new MyToken()) + .subscribe( + _ => + unit + .value(_) + .is(1) + ); + } + + @test('triggerHook - provide hook, token and instance and must return void') + testTriggerHook3() { + + class MyToken { + test() {} + } + + HookManager + .triggerHook('test', MyToken, new MyToken()) + .isEmpty() + .subscribe( + _ => + unit + .bool(_) + .isTrue() + ); + } + + @test('triggerHook - provide hook, token and instance without hook and must throw error') + testTriggerHook4() { + + class MyToken {} + + HookManager + .triggerHook('test', MyToken, new MyToken(), null, true) + .subscribe( + null, + _ => + unit + .object(_) + .isInstanceOf(Error) + .hasProperty('message', 'Hook missing test on MyToken') + ); + } + + @test('triggerHook - provide hook, token and instance without hook and must not throw error') + testTriggerHook5() { + + class MyToken {} + + HookManager + .triggerHook('test', MyToken, new MyToken()) + .isEmpty() + .subscribe( + _ => + unit + .bool(_) + .isTrue() + ); + } +} diff --git a/test/unit/mocks.ts b/test/unit/mocks.ts index 7e4dce6..6c5dd22 100644 --- a/test/unit/mocks.ts +++ b/test/unit/mocks.ts @@ -2,7 +2,7 @@ import 'reflect-metadata'; import { CoreModule } from '../../src/core/interfaces' import { ModuleLevel } from '../../src/core/enums'; -import { InjectionToken, HapinessModule } from '../../src/core/decorators'; +import { InjectionToken, HapinessModule, Lib } from '../../src/core/decorators'; export class EmptyModule {} export class EmptyProvider {} @@ -38,3 +38,6 @@ export class ModuleWithMetadataExportProvider {} imports: [ ModuleWithMetadataExportProvider ] }) export class ModuleWithMetadataWithChildThatExportProvider {} + +@Lib() +export class EmptyLib {} diff --git a/test/unit/module.test.ts b/test/unit/module.test.ts index f056292..7a38b7a 100644 --- a/test/unit/module.test.ts +++ b/test/unit/module.test.ts @@ -1,7 +1,8 @@ import { suite, test } from 'mocha-typescript'; import { ModuleManager } from '../../src/core/module'; import { ModuleLevel } from '../../src/core/enums'; -import { HapinessModule } from '../../src/core/decorators'; +import { HapinessModule, Lib } from '../../src/core/decorators'; +import { DependencyInjection } from '../../src/core/di'; import { Observable } from 'rxjs'; import * as unit from 'unit.js'; @@ -14,7 +15,8 @@ import { InjToken, ModuleWithMetadata, ModuleWithMetadataWithChild, - ModuleWithMetadataWithChildThatExportProvider + ModuleWithMetadataWithChildThatExportProvider, + EmptyLib } from './mocks'; @suite('Unit - Module') @@ -293,4 +295,64 @@ class ModuleTestSuite { ); } + + @test('getModules - provide a CoreModule and must return array of module') + testGetModules1() { + + const module = Object.assign({}, coreModule, { modules: {} }); + + unit + .array(ModuleManager.getModules(module)) + .is([ module, {} ]); + + } + + @test('instantiateLibs - provide a CoreModule and must return an Observable of CoreModule') + testInstantiateLibs1() { + + const module = Object.assign({}, coreModule, { declarations: [ EmptyLib ], di: { stub: true } }); + const stub = unit + .stub(DependencyInjection, 'instantiateComponent') + .withArgs(EmptyLib, { stub: true }) + .returns(Observable.of(null)) + + ModuleManager['instantiateLibs'](module) + .subscribe(_ => + unit + .object(_) + .is(module) + ); + + stub.parent.restore(); + + } + + @test('instantiateLibs - provide a CoreModule and must thrown an error') + testInstantiateLibs2() { + + @Lib() + class LibWithError { + constructor() { + throw new Error('Oops'); + } + } + + const module = Object.assign({}, coreModule, { declarations: [ EmptyLib ], di: { stub: true } }); + const stub = unit + .stub(DependencyInjection, 'instantiateComponent') + .withArgs(EmptyLib, { stub: true }) + .returns(Observable.of(null)) + + ModuleManager['instantiateLibs'](module) + .subscribe( + null, + _ => unit + .object(_) + .isInstanceOf(Error) + .hasProperty('message', 'Oops') + ); + + stub.parent.restore(); + + } } From 645868b7a24db01135650905ae43e23e8972292b Mon Sep 17 00:00:00 2001 From: Juneil Date: Wed, 23 Aug 2017 11:16:49 +0200 Subject: [PATCH 09/19] test(core): end of unit tests --- src/core/hapiness.ts | 4 +- test/unit/hapiness.test.ts | 251 ++++++++++++++++++++++++++++++++++++- test/unit/mocks.ts | 4 +- 3 files changed, 254 insertions(+), 5 deletions(-) diff --git a/src/core/hapiness.ts b/src/core/hapiness.ts index 2d80265..1e35935 100644 --- a/src/core/hapiness.ts +++ b/src/core/hapiness.ts @@ -119,11 +119,11 @@ export class Hapiness { .do(_ => this.extensions = null) .flatMap(_ => !!_ ? Observable.of(_) : - Observable.throw('Bootstrap failed: no module provided') + Observable.throw(new Error('Bootstrap failed: no module provided')) ) .flatMap(_ => typeof _ === 'function' ? Observable.of(_) : - Observable.throw('Bootstrap failed: module must be a function/class') + Observable.throw(new Error('Bootstrap failed: module must be a function/class')) ); } diff --git a/test/unit/hapiness.test.ts b/test/unit/hapiness.test.ts index 9f58ea9..ba67785 100644 --- a/test/unit/hapiness.test.ts +++ b/test/unit/hapiness.test.ts @@ -1,7 +1,7 @@ import * as util from 'util'; import { Injectable } from '../../src/core'; import { suite, test } from 'mocha-typescript'; -import { Hapiness, ModuleManager } from '../../src/core'; +import { Hapiness, ModuleManager, HookManager, errorHandler } from '../../src/core'; import { Observable } from 'rxjs'; import * as unit from 'unit.js'; @@ -57,9 +57,256 @@ class TestSuite { }); } - @test('loadExtensions - ') + @test('loadExtensions - provide extensions and module and must call instantiateModule') testLoadExtensions1() { + class MyExt {} + const extwc = { token: MyExt, config: {} }; + const ext = { value: 123, instance: {}, token: MyExt }; + + const stub1 = unit + .stub(Hapiness, 'toExtensionWithConfig') + .withArgs(MyExt) + .returns(extwc); + const stub2 = unit + .stub(Hapiness, 'loadExtention') + .withArgs(extwc, coreModule) + .returns(Observable.of(ext)); + const stub3 = unit + .stub(Hapiness, 'instantiateModule') + .withArgs([ ext ], coreModule) + .returns(Observable.of(null)); + + Hapiness['loadExtensions']([ MyExt, null ], coreModule) + .subscribe(); + + stub1.parent.restore(); + stub2.parent.restore(); + stub3.parent.restore(); + + } + + @test('instantiateModule - provide loaded extensions and module and must call callHooks') + testInstantiateModule1() { + + class MyExt {} + const ext = { value: 123, instance: {}, token: MyExt }; + + const stub1 = unit + .stub(ModuleManager, 'instantiate') + .withArgs(coreModule, [{ provide: MyExt, useValue: 123 }]) + .returns(Observable.of(coreModule)); + const stub2 = unit + .stub(Hapiness, 'moduleInstantiated') + .withArgs(ext, coreModule) + .returns(Observable.of(null)); + const stub3 = unit + .stub(Hapiness, 'callHooks') + .withArgs(coreModule) + .returns(Observable.of(null)); + + Hapiness['instantiateModule']([ ext ], coreModule) + .subscribe(); + + stub1.parent.restore(); + stub2.parent.restore(); + stub3.parent.restore(); + + } + + @test('callHooks - provide module and must call hooks') + testCallHooks1() { + + class EmptyModule2 { + onRegister() {} + } + const module = Object.assign({ instance: new EmptyModule() }, coreModule); + + const getModulesRes = [ + module, + { token: EmptyModule2, instance: new EmptyModule2() } + ]; + + const stub1 = unit + .stub(ModuleManager, 'getModules') + .withArgs(module) + .returns(getModulesRes); + const stub2 = unit + .stub(HookManager, 'hasLifecycleHook') + .withArgs('onRegister', EmptyModule2) + .returns(true); + const stub3 = unit + .stub(HookManager, 'triggerHook') + .returns(Observable.of(null)) + .withArgs('onRegister', EmptyModule2, getModulesRes[1].instance) + .returns(Observable.of(null)); + stub3 + .withArgs('onStart', EmptyModule, getModulesRes[0].instance, null, false) + .returns(Observable.of(null)); + + Hapiness['callHooks'](module) + .subscribe(); + + stub1.parent.restore(); + stub2.parent.restore(); + stub3.parent.restore(); + + } + + @test('checkArg - provide module and must not throw error') + testCheckArg1(done) { + + Hapiness['checkArg'](EmptyModule) + .subscribe( + _ => done() + ); + + } + + @test('checkArg - dont provide module and must throw error') + testCheckArg2() { + + Hapiness['checkArg'](null) + .subscribe( + null, + _ => + unit + .object(_) + .isInstanceOf(Error) + .hasProperty('message', 'Bootstrap failed: no module provided') + ); + + } + + @test('checkArg - provide wrong module and must throw error') + testCheckArg3() { + + Hapiness['checkArg']('module') + .subscribe( + null, + _ => + unit + .object(_) + .isInstanceOf(Error) + .hasProperty('message', 'Bootstrap failed: module must be a function/class') + ); + + } + + @test('toExtensionWithConfig - provide extension and must return ExtensionWithConfig') + testToExtensionWithConfig1() { + + class MyExt {} + + unit + .object(Hapiness['toExtensionWithConfig'](MyExt)) + .is({ token: MyExt, config: {} }); + + unit + .object(Hapiness['toExtensionWithConfig']({ token: MyExt, config: { test: 1 } })) + .is({ token: MyExt, config: { test: 1 } }); + + } + + @test('loadExtention - provide extension and module and must return Extension') + testLoadExtention1() { + + class MyExt {} + const ext = { token: MyExt, config: {} }; + const instance = new MyExt(); + + const stub1 = unit + .stub(Reflect, 'construct') + .returns(instance); + const stub2 = unit + .stub(HookManager, 'triggerHook') + .withArgs('onExtensionLoad', MyExt, instance, [ coreModule, {} ]) + .returns(Observable.of({})); + + Hapiness['loadExtention'](ext, coreModule) + .subscribe( + _ => + unit + .value(_) + .is({}) + ) + + stub1.restore(); + stub2.parent.restore(); + + } + + @test('moduleInstantiated - provide extension and module and must return Observable') + testModuleInstantiated1() { + + class MyExt {} + const ext = { token: MyExt, instance: new MyExt(), value: 123 }; + + const stub1 = unit + .stub(HookManager, 'triggerHook') + .withArgs('onModuleInstantiated', ext.token, ext.instance, [ coreModule, ext.value ]) + .returns(Observable.of(null)); + + Hapiness['moduleInstantiated'](ext, coreModule) + .subscribe( + _ => + unit + .value(_) + .is(null) + ) + + stub1.parent.restore(); + + } + + @test('errorHandler - provide Error and must trigger onError') + testErrorHandler1() { + + class ModuleError { + onError() {} + } + const module = { token: ModuleError, instance: new ModuleError() }; + const error = new Error('Oops'); + + const stub1 = unit + .stub(HookManager, 'hasLifecycleHook') + .returns(true); + const stub2 = unit + .stub(HookManager, 'triggerHook') + .withArgs('onError', module.token, module.instance, [ error ]) + .returns(Observable.of(null)); + + Hapiness['module'] = module; + errorHandler(error); + stub1.restore(); + stub2.parent.restore(); + Hapiness['module'] = undefined; + + } + + @test('errorHandler - provide Error and must not trigger onError') + testErrorHandler2() { + + class ModuleError { + onError() {} + } + const module = { token: ModuleError, instance: new ModuleError() }; + const error = new Error('Oops'); + + const stub1 = unit + .stub(HookManager, 'hasLifecycleHook') + .returns(false); + const stub2 = unit + .stub(console, 'error') + .withArgs(error) + .returns(null); + + Hapiness['module'] = module; + errorHandler(error); + stub1.restore(); + stub2.parent.restore(); + Hapiness['module'] = undefined; + } } diff --git a/test/unit/mocks.ts b/test/unit/mocks.ts index 6c5dd22..3fa6ce1 100644 --- a/test/unit/mocks.ts +++ b/test/unit/mocks.ts @@ -4,7 +4,9 @@ import { CoreModule } from '../../src/core/interfaces' import { ModuleLevel } from '../../src/core/enums'; import { InjectionToken, HapinessModule, Lib } from '../../src/core/decorators'; -export class EmptyModule {} +export class EmptyModule { + onStart() {} +} export class EmptyProvider {} export const coreModule: CoreModule = { token: EmptyModule, From f1390c12c071804c49c961d6e54522e694465569 Mon Sep 17 00:00:00 2001 From: Juneil Date: Thu, 24 Aug 2017 10:47:31 +0200 Subject: [PATCH 10/19] test(http-request): unit test --- src/extensions/http-server/decorators.ts | 6 +- src/extensions/http-server/extension.ts | 17 +- src/extensions/http-server/route.ts | 6 +- src/extensions/socket-server/extension.ts | 4 + src/extensions/socket-server/server.ts | 17 +- test/integration/core.test.ts | 354 +++++------ test/integration/http-server.test.ts | 558 +++++++++--------- test/integration/socket-server.test.ts | 138 ++--- .../unit/extensions/http-server/enums.test.ts | 27 + .../extensions/http-server/extension.test.ts | 86 +++ 10 files changed, 664 insertions(+), 549 deletions(-) create mode 100644 test/unit/extensions/http-server/enums.test.ts create mode 100644 test/unit/extensions/http-server/extension.test.ts diff --git a/src/extensions/http-server/decorators.ts b/src/extensions/http-server/decorators.ts index fde02eb..88bbb3a 100644 --- a/src/extensions/http-server/decorators.ts +++ b/src/extensions/http-server/decorators.ts @@ -5,13 +5,13 @@ export interface Route { path: string; method: string | string[]; config?: RouteConfig; - // providers?: Array|any>; + providers?: Array|any>; } export const Route = createDecorator('Route', { path: undefined, method: undefined, - config: undefined - // providers: undefined + config: undefined, + providers: undefined }); export interface Lifecycle { diff --git a/src/extensions/http-server/extension.ts b/src/extensions/http-server/extension.ts index 9ff2b16..a1bee50 100644 --- a/src/extensions/http-server/extension.ts +++ b/src/extensions/http-server/extension.ts @@ -27,8 +27,6 @@ export class HttpServerExt implements OnExtensionLoad, OnModuleInstantiated { /** * Initialize HapiJS Server - * Add routes by modules - * Add Lifecycle handlers * * @param {CoreModule} module * @param {HapiConfig} config @@ -40,10 +38,6 @@ export class HttpServerExt implements OnExtensionLoad, OnModuleInstantiated { .do(_ => _.connection(Object.assign(config, { options: undefined }))) .flatMap(server => Observable - // .from(ModuleManager.getModules(module)) - // .flatMap(_ => this.registerPlugin(_, server)) - // .reduce((a, c) => a.concat(c), []) - // .do(_ => LifecycleManager.routeLifecycle(server, _)) .of({ instance: this, token: HttpServerExt, @@ -54,6 +48,8 @@ export class HttpServerExt implements OnExtensionLoad, OnModuleInstantiated { /** * Build Lifecycle components + * Add routes by modules + * Add Lifecycle handlers * Start HapiJS Server * * @param {CoreModule} module @@ -67,14 +63,7 @@ export class HttpServerExt implements OnExtensionLoad, OnModuleInstantiated { .reduce((a, c) => a.concat(c), []) .do(_ => LifecycleManager.routeLifecycle(server, _)) .flatMap(_ => this.instantiateLifecycle(module, server)) - .flatMap(_ => Observable.fromPromise(server.start())); - - // return this - // .instantiateLifecycle(module, server) - // .flatMap(_ => - // Observable - // .fromPromise(server.start()) - // ); + .flatMap(_ => server.start()); } /** diff --git a/src/extensions/http-server/route.ts b/src/extensions/http-server/route.ts index a8efac9..0107aa1 100644 --- a/src/extensions/http-server/route.ts +++ b/src/extensions/http-server/route.ts @@ -53,7 +53,8 @@ export class RouteBuilder { query: Object.assign({}, request.query), params: Object.assign({}, request.params), headers: Object.assign({}, request.headers), - payload: Object.assign({}, request.payload) + payload: Object.assign({}, request.payload), + id: request.id })) .map(_ => ({ provide: HttpRequestInfo, useValue: _ })) .map(_ => [].concat(route.providers).concat(_)) @@ -84,6 +85,9 @@ export class RouteBuilder { path: _.data.path, method: _.methods, providers: [] + .concat(_.data.providers) + .filter(p => !!p) + .map(p => p.provide ? p : { provide: p, useClass: p }) })); } diff --git a/src/extensions/socket-server/extension.ts b/src/extensions/socket-server/extension.ts index b6d76c1..6ffed78 100644 --- a/src/extensions/socket-server/extension.ts +++ b/src/extensions/socket-server/extension.ts @@ -9,6 +9,10 @@ export interface SocketConfig { keepaliveInterval?: number; keepaliveGracePeriod?: number; closeTimeout?: number; + tls?: { + key: Buffer; + cert: Buffer; + } } export class SocketServerExt implements OnExtensionLoad { diff --git a/src/extensions/socket-server/server.ts b/src/extensions/socket-server/server.ts index 053bebf..a3cbc43 100644 --- a/src/extensions/socket-server/server.ts +++ b/src/extensions/socket-server/server.ts @@ -2,6 +2,7 @@ import { server, request } from 'websocket'; import { Socket } from './socket'; import { SocketConfig } from './extension'; import * as http from 'http'; +import * as https from 'https'; import * as Debug from 'debug'; const debug = Debug('hapiness:extension:socketserver'); @@ -10,18 +11,22 @@ export class WebSocketServer { private server: server; private subscribers: Array<(socket: Socket) => void>; private sockets: Socket[]; - private httpServer: http.Server; + private httpServer: http.Server | https.Server; constructor(config: SocketConfig) { - this.httpServer = http.createServer((_request, _response) => { - /* istanbul ignore next */ + /* istanbul ignore next */ + const httpHandler = (_request, _response) => { _response.writeHead(404); - /* istanbul ignore next */ _response.end(); - }); + }; + if (!!config.tls) { + this.httpServer = https.createServer(config.tls, httpHandler); + } else { + this.httpServer = http.createServer(httpHandler); + } this.httpServer.listen(config.port); delete config.port; - const _config = Object.assign({ httpServer: this.httpServer }, config); + const _config = Object.assign({ httpServer: this.httpServer }, config); this.server = new server(_config); this.sockets = []; this.subscribers = []; diff --git a/test/integration/core.test.ts b/test/integration/core.test.ts index 057638f..f48e2f6 100644 --- a/test/integration/core.test.ts +++ b/test/integration/core.test.ts @@ -1,177 +1,177 @@ -// import { suite, test } from 'mocha-typescript'; -// import { Hapiness, HapinessModule, OnStart, OnRegister, Lib, Injectable } from '../../src/core'; -// import { Observable } from 'rxjs'; -// import * as unit from 'unit.js'; - -// @suite('Integration - Core') -// class ModuleTestSuite { - -// @test('Bootstrap - Simple module') -// testBootstrap1(done) { - -// @HapinessModule({ -// version: '' -// }) -// class Module1 implements OnStart { - -// onStart() { -// done(); -// } - -// } - -// Hapiness -// .bootstrap(Module1); - -// } - -// @test('Bootstrap - Module with embedded module') -// testBootstrap2(done) { -// let state = 0; - -// @HapinessModule({ -// version: '' -// }) -// class Module1 implements OnRegister { - -// onRegister() { -// state = 1; -// } - -// } - -// @HapinessModule({ -// version: '', -// imports: [ Module1 ] -// }) -// class Module2 implements OnStart { - -// onStart() { -// unit -// .value(state) -// .is(1); -// done(); -// } - -// } - -// Hapiness -// .bootstrap(Module2); - -// } - -// @test('Bootstrap - Module with Lib') -// testBootstrap3(done) { - -// @Lib() -// class Lib1 { -// constructor() { -// done(); -// } -// } - -// @HapinessModule({ -// version: '', -// declarations: [ Lib1 ] -// }) -// class Module1 {} - -// Hapiness -// .bootstrap(Module1); - -// } - -// @test('Bootstrap - Module with Provider') -// testBootstrap4(done) { - -// @Injectable() -// class Provider1 { -// value() { -// return 123; -// } -// } - -// @HapinessModule({ -// version: '', -// providers: [ Provider1 ] -// }) -// class Module1 implements OnStart { -// constructor(private provider1: Provider1) {} -// onStart() { -// unit -// .number(this.provider1.value()) -// .is(123); -// done(); -// } -// } - -// Hapiness -// .bootstrap(Module1); - -// } - -// @test('Bootstrap - Module with Lib and Provider') -// testBootstrap5(done) { - -// @Injectable() -// class Provider1 { -// value() { -// return 123; -// } -// } - -// @Lib() -// class Lib1 { -// constructor(provider1: Provider1) { -// unit -// .number(provider1.value()) -// .is(123); -// } -// } - -// @HapinessModule({ -// version: '', -// declarations: [ Lib1 ], -// providers: [ Provider1 ] -// }) -// class Module1 implements OnStart { -// constructor(private provider1: Provider1) {} -// onStart() { -// unit -// .number(this.provider1.value()) -// .is(123); -// done(); -// } -// } - -// Hapiness -// .bootstrap(Module1); - -// } - -// @test('Bootstrap - Error thrown') -// testBootstrap6(done) { - -// @HapinessModule({ -// version: '' -// }) -// class Module1 implements OnStart { - -// onStart() { -// throw new Error('Oops'); -// } - -// } - -// Hapiness -// .bootstrap(Module1) -// .catch(_ => { -// unit -// .object(_) -// .isInstanceOf(Error) -// .hasProperty('message', 'Oops'); -// done(); -// }); - -// } -// } +import { suite, test } from 'mocha-typescript'; +import { Hapiness, HapinessModule, OnStart, OnRegister, Lib, Injectable } from '../../src/core'; +import { Observable } from 'rxjs'; +import * as unit from 'unit.js'; + +@suite('Integration - Core') +class ModuleTestSuite { + + @test('Bootstrap - Simple module') + testBootstrap1(done) { + + @HapinessModule({ + version: '' + }) + class Module1 implements OnStart { + + onStart() { + done(); + } + + } + + Hapiness + .bootstrap(Module1); + + } + + @test('Bootstrap - Module with embedded module') + testBootstrap2(done) { + let state = 0; + + @HapinessModule({ + version: '' + }) + class Module1 implements OnRegister { + + onRegister() { + state = 1; + } + + } + + @HapinessModule({ + version: '', + imports: [ Module1 ] + }) + class Module2 implements OnStart { + + onStart() { + unit + .value(state) + .is(1); + done(); + } + + } + + Hapiness + .bootstrap(Module2); + + } + + @test('Bootstrap - Module with Lib') + testBootstrap3(done) { + + @Lib() + class Lib1 { + constructor() { + done(); + } + } + + @HapinessModule({ + version: '', + declarations: [ Lib1 ] + }) + class Module1 {} + + Hapiness + .bootstrap(Module1); + + } + + @test('Bootstrap - Module with Provider') + testBootstrap4(done) { + + @Injectable() + class Provider1 { + value() { + return 123; + } + } + + @HapinessModule({ + version: '', + providers: [ Provider1 ] + }) + class Module1 implements OnStart { + constructor(private provider1: Provider1) {} + onStart() { + unit + .number(this.provider1.value()) + .is(123); + done(); + } + } + + Hapiness + .bootstrap(Module1); + + } + + @test('Bootstrap - Module with Lib and Provider') + testBootstrap5(done) { + + @Injectable() + class Provider1 { + value() { + return 123; + } + } + + @Lib() + class Lib1 { + constructor(provider1: Provider1) { + unit + .number(provider1.value()) + .is(123); + } + } + + @HapinessModule({ + version: '', + declarations: [ Lib1 ], + providers: [ Provider1 ] + }) + class Module1 implements OnStart { + constructor(private provider1: Provider1) {} + onStart() { + unit + .number(this.provider1.value()) + .is(123); + done(); + } + } + + Hapiness + .bootstrap(Module1); + + } + + @test('Bootstrap - Error thrown') + testBootstrap6(done) { + + @HapinessModule({ + version: '' + }) + class Module1 implements OnStart { + + onStart() { + throw new Error('Oops'); + } + + } + + Hapiness + .bootstrap(Module1) + .catch(_ => { + unit + .object(_) + .isInstanceOf(Error) + .hasProperty('message', 'Oops'); + done(); + }); + + } +} diff --git a/test/integration/http-server.test.ts b/test/integration/http-server.test.ts index 0fa0b2c..41d21ee 100644 --- a/test/integration/http-server.test.ts +++ b/test/integration/http-server.test.ts @@ -1,279 +1,279 @@ -// import { suite, test, only } from 'mocha-typescript'; -// import * as unit from 'unit.js'; -// import { Hapiness, HapinessModule, Inject, OnRegister, OnStart, OnError } from '../../src/core'; -// import { HttpServerExt, Route, Lifecycle, OnGet, OnEvent, OnPreResponse } from '../../src/extensions/http-server'; -// import { Server } from 'hapi'; -// import { Observable } from 'rxjs'; - -// @suite('Integration - Http Server') -// class HttpServerIntegration { - -// @test('route get') -// test1(done) { - -// @Route({ -// path: '/', -// method: 'GET', -// }) -// class RouteTest implements OnGet { -// onGet(request, reply) { -// reply('test'); -// } -// } - -// @HapinessModule({ -// version: '1.0.0', -// declarations: [ RouteTest ] -// }) -// class ModuleTest implements OnStart { - -// constructor(@Inject(HttpServerExt) private server: Server) {} - -// onStart() { -// this.server.inject('/', res => { -// unit.must(res.result).equal('test'); -// this.server.stop().then(_ => done()); -// }); -// } -// } - -// Hapiness.bootstrap(ModuleTest, [ HttpServerExt.setConfig({ host: '0.0.0.0', port: 4444 }) ]); -// } - -// @test('lifecycle') -// test2(done) { - -// class Service1 { -// getData() { -// return '123'; -// } -// } -// class Service2 {} -// class Service3 { -// getData() { -// return '456'; -// } -// } - -// @Route({ -// path: '/', -// method: 'GET' -// }) -// class RouteTest implements OnGet, OnPreResponse { -// constructor(private serv: Service1, private serv3: Service3) {} -// onGet(request, reply) { -// reply('x'); -// } -// onPreResponse(request, reply) { -// request.response.source = request.response.source + this.serv.getData() + this.serv3.getData(); -// reply.continue(); -// } -// } - -// @Lifecycle({ -// event: 'onPostHandler' -// }) -// class LF implements OnEvent { -// onEvent(request, reply) { -// request.response.source = 'toto'; -// reply.continue(); -// } -// } - -// @HapinessModule({ -// version: '1.0.0', -// declarations: [ RouteTest, LF ], -// providers: [ Service3, Service1, { provide: Service2, useClass: Service2 } ] -// }) -// class ModuleTest implements OnStart { - -// constructor(@Inject(HttpServerExt) private server: Server) {} - -// onStart() { -// this.server.inject('/', res => { -// unit.string(res.result) -// .is('toto123456'); -// this.server.stop().then(_ => done()); -// }); -// } -// } - -// Hapiness.bootstrap(ModuleTest, [ HttpServerExt.setConfig({ host: '0.0.0.0', port: 4444 }) ]) -// .catch(_ => done(_)); -// } - -// @test('route submodule') -// test3(done) { - -// @Route({ -// path: '/', -// method: 'GET', -// }) -// class RouteTest implements OnGet { -// onGet(request, reply) { -// reply('test'); -// } -// } - -// @HapinessModule({ -// version: '1.0.0', -// declarations: [ RouteTest ] -// }) -// class SubModuleTest {} - -// @HapinessModule({ -// version: '1.0.0', -// imports: [ SubModuleTest ] -// }) -// class ModuleTest implements OnStart { - -// constructor(@Inject(HttpServerExt) private server: Server) {} - -// onStart() { -// this.server.inject('/', res => { -// unit.must(res.result).equal('test'); -// done(); -// }); -// } -// } - -// Hapiness.bootstrap(ModuleTest, [ HttpServerExt.setConfig({ host: '0.0.0.0', port: 4444 }) ]); -// } - -// @test('make sure register are done before start hook') -// test5(done) { - -// @HapinessModule({ -// version: '1.0.0' -// }) -// class SubModuleTest implements OnRegister { -// constructor(@Inject(HttpServerExt) private server: Server) {} -// onRegister() { -// this.server.route({ -// path: '/route1', -// method: 'GET', -// handler: () => {} -// }); -// } -// } - -// @HapinessModule({ -// version: '1.0.0', -// imports: [ SubModuleTest ] -// }) -// class ModuleTest implements OnStart { -// constructor(@Inject(HttpServerExt) private server: Server) {} -// onStart() { -// unit.object(this.server.table().pop().table.pop()) -// .hasProperty('path', '/route1'); -// this.server.stop().then(_ => done()); -// } -// } - -// Hapiness.bootstrap(ModuleTest, [ HttpServerExt.setConfig({ host: '0.0.0.0', port: 4445 }) ]); -// } - -// @test('response with Observable') -// test6(done) { - -// @Route({ -// path: '/', -// method: 'GET', -// }) -// class RouteTest implements OnGet { -// onGet(request, reply) { -// return Observable -// .of('test'); -// } -// } - -// @Route({ -// path: '/2', -// method: 'GET', -// }) -// class RouteTest2 implements OnGet { -// onGet(request, reply) { -// reply('test2'); -// } -// } - -// @Route({ -// path: '/3', -// method: 'GET', -// }) -// class RouteTest3 implements OnGet { -// onGet(request, reply) { -// return Observable -// .of({ response: 'test3', statusCode: 201 }); -// } -// } - -// @HapinessModule({ -// version: '1.0.0', -// declarations: [ RouteTest, RouteTest2, RouteTest3 ] -// }) -// class ModuleTest implements OnStart { -// constructor(@Inject(HttpServerExt) private server: Server) {} -// onStart() { -// this.server.inject('/', res => { -// unit.string(res.result) -// .is('test'); -// unit.value(res.statusCode) -// .is(200) -// this.server.inject('/2', res2 => { -// unit.string(res2.result) -// .is('test2'); -// this.server.inject('/3', res3 => { -// unit.string(res3.result) -// .is('test3'); -// unit.value(res3.statusCode) -// .is(201) -// this.server.stop().then(_ => done()); -// }); -// }); -// }); -// } -// } - -// Hapiness.bootstrap(ModuleTest, [ HttpServerExt.setConfig({ host: '0.0.0.0', port: 4445 }) ]); -// } - -// @test('throw error in route') -// test7(done) { - -// @Route({ -// path: '/', -// method: 'GET', -// }) -// class RouteTest implements OnGet { -// onGet(request, reply) { -// throw new Error('Oops'); -// } -// } - -// @HapinessModule({ -// version: '1.0.0', -// declarations: [ RouteTest ] -// }) -// class ModuleTest implements OnStart, OnError { - -// constructor(@Inject(HttpServerExt) private server: Server) {} - -// onStart() { -// this.server.inject('/', res => { -// unit.must(res.statusCode).equal(500); -// }); -// } - -// onError(error) { -// unit -// .object(error) -// .isInstanceOf(Error) -// .hasProperty('message', 'Oops'); -// this.server.stop().then(_ => done()); -// } -// } - -// Hapiness.bootstrap(ModuleTest, [ HttpServerExt.setConfig({ host: '0.0.0.0', port: 4444 }) ]); -// } -// } +import { suite, test, only } from 'mocha-typescript'; +import * as unit from 'unit.js'; +import { Hapiness, HapinessModule, Inject, OnRegister, OnStart, OnError } from '../../src/core'; +import { HttpServerExt, Route, Lifecycle, OnGet, OnEvent, OnPreResponse } from '../../src/extensions/http-server'; +import { Server } from 'hapi'; +import { Observable } from 'rxjs'; + +@suite('Integration - Http Server') +class HttpServerIntegration { + + @test('route get') + test1(done) { + + @Route({ + path: '/', + method: 'GET', + }) + class RouteTest implements OnGet { + onGet(request, reply) { + reply('test'); + } + } + + @HapinessModule({ + version: '1.0.0', + declarations: [ RouteTest ] + }) + class ModuleTest implements OnStart { + + constructor(@Inject(HttpServerExt) private server: Server) {} + + onStart() { + this.server.inject('/', res => { + unit.must(res.result).equal('test'); + this.server.stop().then(_ => done()); + }); + } + } + + Hapiness.bootstrap(ModuleTest, [ HttpServerExt.setConfig({ host: '0.0.0.0', port: 4444 }) ]); + } + + @test('lifecycle') + test2(done) { + + class Service1 { + getData() { + return '123'; + } + } + class Service2 {} + class Service3 { + getData() { + return '456'; + } + } + + @Route({ + path: '/', + method: 'GET' + }) + class RouteTest implements OnGet, OnPreResponse { + constructor(private serv: Service1, private serv3: Service3) {} + onGet(request, reply) { + reply('x'); + } + onPreResponse(request, reply) { + request.response.source = request.response.source + this.serv.getData() + this.serv3.getData(); + reply.continue(); + } + } + + @Lifecycle({ + event: 'onPostHandler' + }) + class LF implements OnEvent { + onEvent(request, reply) { + request.response.source = 'toto'; + reply.continue(); + } + } + + @HapinessModule({ + version: '1.0.0', + declarations: [ RouteTest, LF ], + providers: [ Service3, Service1, { provide: Service2, useClass: Service2 } ] + }) + class ModuleTest implements OnStart { + + constructor(@Inject(HttpServerExt) private server: Server) {} + + onStart() { + this.server.inject('/', res => { + unit.string(res.result) + .is('toto123456'); + this.server.stop().then(_ => done()); + }); + } + } + + Hapiness.bootstrap(ModuleTest, [ HttpServerExt.setConfig({ host: '0.0.0.0', port: 4444 }) ]) + .catch(_ => done(_)); + } + + @test('route submodule') + test3(done) { + + @Route({ + path: '/', + method: 'GET', + }) + class RouteTest implements OnGet { + onGet(request, reply) { + reply('test'); + } + } + + @HapinessModule({ + version: '1.0.0', + declarations: [ RouteTest ] + }) + class SubModuleTest {} + + @HapinessModule({ + version: '1.0.0', + imports: [ SubModuleTest ] + }) + class ModuleTest implements OnStart { + + constructor(@Inject(HttpServerExt) private server: Server) {} + + onStart() { + this.server.inject('/', res => { + unit.must(res.result).equal('test'); + done(); + }); + } + } + + Hapiness.bootstrap(ModuleTest, [ HttpServerExt.setConfig({ host: '0.0.0.0', port: 4444 }) ]); + } + + @test('make sure register are done before start hook') + test5(done) { + + @HapinessModule({ + version: '1.0.0' + }) + class SubModuleTest implements OnRegister { + constructor(@Inject(HttpServerExt) private server: Server) {} + onRegister() { + this.server.route({ + path: '/route1', + method: 'GET', + handler: () => {} + }); + } + } + + @HapinessModule({ + version: '1.0.0', + imports: [ SubModuleTest ] + }) + class ModuleTest implements OnStart { + constructor(@Inject(HttpServerExt) private server: Server) {} + onStart() { + unit.object(this.server.table().pop().table.pop()) + .hasProperty('path', '/route1'); + this.server.stop().then(_ => done()); + } + } + + Hapiness.bootstrap(ModuleTest, [ HttpServerExt.setConfig({ host: '0.0.0.0', port: 4445 }) ]); + } + + @test('response with Observable') + test6(done) { + + @Route({ + path: '/', + method: 'GET', + }) + class RouteTest implements OnGet { + onGet(request, reply) { + return Observable + .of('test'); + } + } + + @Route({ + path: '/2', + method: 'GET', + }) + class RouteTest2 implements OnGet { + onGet(request, reply) { + reply('test2'); + } + } + + @Route({ + path: '/3', + method: 'GET', + }) + class RouteTest3 implements OnGet { + onGet(request, reply) { + return Observable + .of({ response: 'test3', statusCode: 201 }); + } + } + + @HapinessModule({ + version: '1.0.0', + declarations: [ RouteTest, RouteTest2, RouteTest3 ] + }) + class ModuleTest implements OnStart { + constructor(@Inject(HttpServerExt) private server: Server) {} + onStart() { + this.server.inject('/', res => { + unit.string(res.result) + .is('test'); + unit.value(res.statusCode) + .is(200) + this.server.inject('/2', res2 => { + unit.string(res2.result) + .is('test2'); + this.server.inject('/3', res3 => { + unit.string(res3.result) + .is('test3'); + unit.value(res3.statusCode) + .is(201) + this.server.stop().then(_ => done()); + }); + }); + }); + } + } + + Hapiness.bootstrap(ModuleTest, [ HttpServerExt.setConfig({ host: '0.0.0.0', port: 4445 }) ]); + } + + @test('throw error in route') + test7(done) { + + @Route({ + path: '/', + method: 'GET', + }) + class RouteTest implements OnGet { + onGet(request, reply) { + throw new Error('Oops'); + } + } + + @HapinessModule({ + version: '1.0.0', + declarations: [ RouteTest ] + }) + class ModuleTest implements OnStart, OnError { + + constructor(@Inject(HttpServerExt) private server: Server) {} + + onStart() { + this.server.inject('/', res => { + unit.must(res.statusCode).equal(500); + }); + } + + onError(error) { + unit + .object(error) + .isInstanceOf(Error) + .hasProperty('message', 'Oops'); + this.server.stop().then(_ => done()); + } + } + + Hapiness.bootstrap(ModuleTest, [ HttpServerExt.setConfig({ host: '0.0.0.0', port: 4444 }) ]); + } +} diff --git a/test/integration/socket-server.test.ts b/test/integration/socket-server.test.ts index fdec279..95ff5da 100644 --- a/test/integration/socket-server.test.ts +++ b/test/integration/socket-server.test.ts @@ -1,79 +1,79 @@ -// import { suite, test } from 'mocha-typescript'; -// import * as unit from 'unit.js'; -// import { Hapiness, HapinessModule, Inject, OnStart } from '../../src/core'; -// import { SocketServerExt, WebSocketServer, SocketServerService } from '../../src/extensions/socket-server'; +import { suite, test } from 'mocha-typescript'; +import * as unit from 'unit.js'; +import { Hapiness, HapinessModule, Inject, OnStart } from '../../src/core'; +import { SocketServerExt, WebSocketServer, SocketServerService } from '../../src/extensions/socket-server'; -// @suite('Integration - Socket Server') -// class SocketServerIntegration { +@suite('Integration - Socket Server') +class SocketServerIntegration { -// @test('socket message') -// test1(done) { + @test('socket message') + test1(done) { -// @HapinessModule({ -// version: '1.0.0', -// providers: [ SocketServerService ] -// }) -// class ModuleTest implements OnStart { + @HapinessModule({ + version: '1.0.0', + providers: [ SocketServerService ] + }) + class ModuleTest implements OnStart { -// constructor(private server: SocketServerService) {} + constructor(private server: SocketServerService) {} -// onStart() { -// this.server.instance().onRequest(socket => { -// unit.array(this.server.instance().getSockets()) -// .hasLength(1); -// socket.emit('toto', 'test'); -// socket.on('close', data => {}); -// socket.on('error', data => {}); -// socket.on('tata', data => {}); -// socket.on('ev', data => { -// this.server.instance().broadcast('test', 'test'); -// }); -// socket.on('*', data => { -// if (data.utf8Data === '123') { -// unit.string(data.utf8Data) -// .is('123'); -// socket.emitBytes(new Buffer('test')); -// } -// }); -// socket.onBytes(data => { -// unit.string(data.toString()) -// .is('test'); -// socket.close(); -// this.server.stop() -// .subscribe(_ => done()); -// }); -// }); + onStart() { + this.server.instance().onRequest(socket => { + unit.array(this.server.instance().getSockets()) + .hasLength(1); + socket.emit('toto', 'test'); + socket.on('close', data => {}); + socket.on('error', data => {}); + socket.on('tata', data => {}); + socket.on('ev', data => { + this.server.instance().broadcast('test', 'test'); + }); + socket.on('*', data => { + if (data.utf8Data === '123') { + unit.string(data.utf8Data) + .is('123'); + socket.emitBytes(new Buffer('test')); + } + }); + socket.onBytes(data => { + unit.string(data.toString()) + .is('test'); + socket.close(); + this.server.stop() + .subscribe(_ => done()); + }); + }); -// const W3CWebSocket = require('websocket').w3cwebsocket; -// const client = new W3CWebSocket('ws://localhost:2222/'); -// client.onmessage = (e) => { -// if (e.data === JSON.stringify({ event: 'toto', data: 'test' })) { -// client.send('{"event":"ev","data":"abc"}'); -// } else if (e.data instanceof ArrayBuffer) { -// client.send(e.data); -// } else { -// client.send('123'); -// } -// }; -// } -// } + const W3CWebSocket = require('websocket').w3cwebsocket; + const client = new W3CWebSocket('ws://localhost:2222/'); + client.onmessage = (e) => { + if (e.data === JSON.stringify({ event: 'toto', data: 'test' })) { + client.send('{"event":"ev","data":"abc"}'); + } else if (e.data instanceof ArrayBuffer) { + client.send(e.data); + } else { + client.send('123'); + } + }; + } + } -// Hapiness.bootstrap(ModuleTest, [ SocketServerExt.setConfig({ port: 2222 }) ]); -// } + Hapiness.bootstrap(ModuleTest, [ SocketServerExt.setConfig({ port: 2222 }) ]); + } -// @test('did well stop') -// test2(done) { + @test('did well stop') + test2(done) { -// @HapinessModule({ -// version: '1.0.0', -// providers: [ SocketServerService ] -// }) -// class ModuleTest implements OnStart { + @HapinessModule({ + version: '1.0.0', + providers: [ SocketServerService ] + }) + class ModuleTest implements OnStart { -// onStart() { -// done(); -// } -// } -// Hapiness.bootstrap(ModuleTest, [ SocketServerExt.setConfig({ port: 2222 }) ]); -// } -// } + onStart() { + done(); + } + } + Hapiness.bootstrap(ModuleTest, [ SocketServerExt.setConfig({ port: 2222 }) ]); + } +} diff --git a/test/unit/extensions/http-server/enums.test.ts b/test/unit/extensions/http-server/enums.test.ts new file mode 100644 index 0000000..fd4d116 --- /dev/null +++ b/test/unit/extensions/http-server/enums.test.ts @@ -0,0 +1,27 @@ +import { suite, test } from 'mocha-typescript'; +import * as unit from 'unit.js'; +import { RouteMethodsEnum, enumByMethod } from '../../../../src/extensions/http-server/enums'; + +@suite('Unit - HttpServer - Enums') +class Module { + @test('Hook enum method') + testHookEnumMethod() { + + unit.must(enumByMethod('get')) + .is(RouteMethodsEnum.OnGet.toString()); + unit.must(enumByMethod('post')) + .is(RouteMethodsEnum.OnPost.toString()); + unit.must(enumByMethod('put')) + .is(RouteMethodsEnum.OnPut.toString()); + unit.must(enumByMethod('patch')) + .is(RouteMethodsEnum.OnPatch.toString()); + unit.must(enumByMethod('options')) + .is(RouteMethodsEnum.OnOptions.toString()); + unit.must(enumByMethod('delete')) + .is(RouteMethodsEnum.OnDelete.toString()); + + unit.exception(() => unit.when(() => enumByMethod('unknown'))) + .is(new Error('Method does not exist')); + + } +} diff --git a/test/unit/extensions/http-server/extension.test.ts b/test/unit/extensions/http-server/extension.test.ts new file mode 100644 index 0000000..dc5d6e4 --- /dev/null +++ b/test/unit/extensions/http-server/extension.test.ts @@ -0,0 +1,86 @@ +import { suite, test } from 'mocha-typescript'; +import { HttpServerExt, LifecycleManager } from '../../../../src/extensions/http-server'; +import { ModuleManager } from '../../../../src/core'; +import { Observable } from 'rxjs'; +import * as unit from 'unit.js'; + +import * as Hapi from 'hapi'; + +import { coreModule, EmptyModule } from '../../mocks'; + +@suite('Unit - HttpServer - Extension') +class ModuleTestSuite { + + @test('onExtensionLoad - provide module and config and must return Observable of Extension') + testOnExtensionLoad1() { + + class ServerMock { + connection(config) { + unit + .object(config) + .is({ options: undefined }); + } + } + const uglyHapi = Hapi; + const tmpServer = uglyHapi.Server; + uglyHapi['Server'] = ServerMock; + + const extInstance = new HttpServerExt(); + extInstance + .onExtensionLoad(coreModule, { options: {} }) + .subscribe( + _ => { + unit + .value(_.token) + .is(HttpServerExt); + unit + .value(_.instance) + .is(extInstance); + unit + .value(_.value) + .isInstanceOf(ServerMock); + } + ); + + uglyHapi['Server'] = tmpServer; + } + + @test('onModuleInstantiated - provide module and server and must return Observable') + testOnModuleInstantiated1() { + + class EmptyModule2 {} + const getModulesRes = [ + { token: EmptyModule }, + { token: EmptyModule2 } + ]; + const extInstance = new HttpServerExt(); + const server = { start: () => Promise.resolve() } + + const stub1 = unit + .stub(ModuleManager, 'getModules') + .withArgs(coreModule) + .returns(getModulesRes); + const stub2 = unit + .stub(extInstance, 'registerPlugin'); + stub2 + .withArgs(getModulesRes[0], server) + .returns([{}]); + stub2 + .withArgs(getModulesRes[1], server) + .returns([{}, {}]); + const stub3 = unit + .stub(LifecycleManager, 'routeLifecycle'); + const stub4 = unit + .stub(extInstance, 'instantiateLifecycle') + .returns(Observable.of(null)); + + extInstance + .onModuleInstantiated(coreModule, server) + .subscribe(); + + stub1.parent.restore(); + stub2.restore(); + stub3.restore(); + stub4.restore(); + } +} From 0c397e827b07d2281c604f7cf3261062f6de34fa Mon Sep 17 00:00:00 2001 From: Juneil Date: Thu, 24 Aug 2017 10:51:34 +0200 Subject: [PATCH 11/19] fix(yarn): add yarn.lock --- yarn.lock | 1866 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1866 insertions(+) create mode 100644 yarn.lock diff --git a/yarn.lock b/yarn.lock new file mode 100644 index 0000000..5d88b9e --- /dev/null +++ b/yarn.lock @@ -0,0 +1,1866 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +"@types/boom@*": + version "4.3.7" + resolved "https://registry.yarnpkg.com/@types/boom/-/boom-4.3.7.tgz#2771d7b1fd7df70c6860ed30ec6752feaca9f3de" + +"@types/catbox@*": + version "7.1.3" + resolved "https://registry.yarnpkg.com/@types/catbox/-/catbox-7.1.3.tgz#895ee7d335fda7e5af688b21e8b9b5e84e30dd39" + dependencies: + "@types/boom" "*" + +"@types/fs-extra@^4.0.0": + version "4.0.0" + resolved "https://registry.yarnpkg.com/@types/fs-extra/-/fs-extra-4.0.0.tgz#1dd742ad5c9bce308f7a52d02ebc01421bc9102f" + dependencies: + "@types/node" "*" + +"@types/hapi@^16.1.8": + version "16.1.9" + resolved "https://registry.yarnpkg.com/@types/hapi/-/hapi-16.1.9.tgz#0748fa17dffdd59c97e6e2ef0c4343afc4261d64" + dependencies: + "@types/boom" "*" + "@types/catbox" "*" + "@types/joi" "*" + "@types/mimos" "*" + "@types/node" "*" + "@types/podium" "*" + "@types/shot" "*" + +"@types/hoek@^4.1.3": + version "4.1.3" + resolved "https://registry.yarnpkg.com/@types/hoek/-/hoek-4.1.3.tgz#d1982d48fb0d2a0e5d7e9d91838264d8e428d337" + +"@types/joi@*", "@types/joi@^10.4.0": + version "10.4.1" + resolved "https://registry.yarnpkg.com/@types/joi/-/joi-10.4.1.tgz#30e987649cede8d2a78829489857e969a81e1e99" + +"@types/mime-db@*": + version "1.27.0" + resolved "https://registry.yarnpkg.com/@types/mime-db/-/mime-db-1.27.0.tgz#9bc014a1fd1fdf47649c1a54c6dd7966b8284792" + +"@types/mimos@*": + version "3.0.1" + resolved "https://registry.yarnpkg.com/@types/mimos/-/mimos-3.0.1.tgz#59d96abe1c9e487e7463fe41e8d86d76b57a441a" + dependencies: + "@types/mime-db" "*" + +"@types/node@*", "@types/node@^8.0.19": + version "8.0.24" + resolved "https://registry.yarnpkg.com/@types/node/-/node-8.0.24.tgz#06c580084d9add1fb40c1510ef0b448961246fb1" + +"@types/podium@*": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@types/podium/-/podium-1.0.0.tgz#bfaa2151be2b1d6109cc69f7faa9dac2cba3bb20" + +"@types/shot@*": + version "3.4.0" + resolved "https://registry.yarnpkg.com/@types/shot/-/shot-3.4.0.tgz#459477c5187d3ebd303660ab099e7e9e0f3b656f" + dependencies: + "@types/node" "*" + +"@types/websocket@^0.0.34": + version "0.0.34" + resolved "https://registry.yarnpkg.com/@types/websocket/-/websocket-0.0.34.tgz#25596764cec885eda070fdb6d19cd76fe582747c" + dependencies: + "@types/node" "*" + +abbrev@1, abbrev@1.0.x: + version "1.0.9" + resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.0.9.tgz#91b4792588a7738c25f35dd6f63752a2f8776135" + +accept@^2.1.4: + version "2.1.4" + resolved "https://registry.yarnpkg.com/accept/-/accept-2.1.4.tgz#887af54ceee5c7f4430461971ec400c61d09acbb" + dependencies: + boom "5.x.x" + hoek "4.x.x" + +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" + +ammo@^2.0.4: + version "2.0.4" + resolved "https://registry.yarnpkg.com/ammo/-/ammo-2.0.4.tgz#bf80aab211698ea78f63ef5e7f113dd5d9e8917f" + dependencies: + boom "5.x.x" + hoek "4.x.x" + +ansi-regex@^2.0.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df" + +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.1.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.0.tgz#c159b8d5be0f9e5a6f346dab94f16ce022161b88" + dependencies: + color-convert "^1.9.0" + +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" + +argparse@^1.0.7: + version "1.0.9" + resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.9.tgz#73d83bc263f86e97f8cc4f6bae1b0e90a7d22c86" + dependencies: + sprintf-js "~1.0.2" + +arrify@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d" + +asn1@~0.2.3: + version "0.2.3" + resolved "https://registry.yarnpkg.com/asn1/-/asn1-0.2.3.tgz#dac8787713c9966849fc8180777ebe9c1ddf3b86" + +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" + +assert-plus@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/assert-plus/-/assert-plus-0.2.0.tgz#d74e1b87e7affc0db8aadb7021f3fe48101ab234" + +async@1.x, async@^1.4.0: + version "1.5.2" + resolved "https://registry.yarnpkg.com/async/-/async-1.5.2.tgz#ec6a61ae56480c0c3cb241c95618e20892f9672a" + +async@^2.1.4: + version "2.5.0" + resolved "https://registry.yarnpkg.com/async/-/async-2.5.0.tgz#843190fd6b7357a0b9e1c956edddd5ec8462b54d" + dependencies: + lodash "^4.14.0" + +async@~0.9.0: + version "0.9.2" + resolved "https://registry.yarnpkg.com/async/-/async-0.9.2.tgz#aea74d5e61c1f899613bf64bda66d4c78f2fd17d" + +asynckit@^0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" + +aws-sign2@~0.6.0: + version "0.6.0" + resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.6.0.tgz#14342dd38dbcc94d0e5b87d763cd63612c0e794f" + +aws4@^1.2.1: + version "1.6.0" + resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.6.0.tgz#83ef5ca860b2b32e4a0deedee8c771b9db57471e" + +b64@3.x.x: + version "3.0.3" + resolved "https://registry.yarnpkg.com/b64/-/b64-3.0.3.tgz#36afeee0d9345f046387ce6de8a6702afe5bb56e" + +babel-code-frame@^6.22.0, babel-code-frame@^6.26.0: + version "6.26.0" + resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.26.0.tgz#63fd43f7dc1e3bb7ce35947db8fe369a3f58c74b" + dependencies: + chalk "^1.1.3" + esutils "^2.0.2" + js-tokens "^3.0.2" + +babel-generator@^6.18.0: + version "6.26.0" + resolved "https://registry.yarnpkg.com/babel-generator/-/babel-generator-6.26.0.tgz#ac1ae20070b79f6e3ca1d3269613053774f20dc5" + dependencies: + babel-messages "^6.23.0" + babel-runtime "^6.26.0" + babel-types "^6.26.0" + detect-indent "^4.0.0" + jsesc "^1.3.0" + lodash "^4.17.4" + source-map "^0.5.6" + trim-right "^1.0.1" + +babel-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-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" + dependencies: + core-js "^2.4.0" + regenerator-runtime "^0.11.0" + +babel-template@^6.16.0: + version "6.26.0" + resolved "https://registry.yarnpkg.com/babel-template/-/babel-template-6.26.0.tgz#de03e2d16396b069f46dd9fff8521fb1a0e35e02" + dependencies: + babel-runtime "^6.26.0" + babel-traverse "^6.26.0" + babel-types "^6.26.0" + babylon "^6.18.0" + lodash "^4.17.4" + +babel-traverse@^6.18.0, babel-traverse@^6.26.0: + version "6.26.0" + resolved "https://registry.yarnpkg.com/babel-traverse/-/babel-traverse-6.26.0.tgz#46a9cbd7edcc62c8e5c064e2d2d8d0f4035766ee" + dependencies: + babel-code-frame "^6.26.0" + babel-messages "^6.23.0" + babel-runtime "^6.26.0" + babel-types "^6.26.0" + babylon "^6.18.0" + debug "^2.6.8" + globals "^9.18.0" + invariant "^2.2.2" + lodash "^4.17.4" + +babel-types@^6.18.0, babel-types@^6.26.0: + version "6.26.0" + resolved "https://registry.yarnpkg.com/babel-types/-/babel-types-6.26.0.tgz#a3b073f94ab49eb6fa55cd65227a334380632497" + dependencies: + babel-runtime "^6.26.0" + esutils "^2.0.2" + lodash "^4.17.4" + to-fast-properties "^1.0.3" + +babylon@^6.17.4, babylon@^6.18.0: + version "6.18.0" + resolved "https://registry.yarnpkg.com/babylon/-/babylon-6.18.0.tgz#af2f3b88fa6f5c1e4c634d1a0f8eac4f55b395e3" + +balanced-match@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" + +bcrypt-pbkdf@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.1.tgz#63bc5dcb61331b92bc05fd528953c33462a06f8d" + dependencies: + tweetnacl "^0.14.3" + +bluebird@^2.9.9: + version "2.11.0" + resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-2.11.0.tgz#534b9033c022c9579c56ba3b3e5a5caafbb650e1" + +boom@2.x.x: + version "2.10.1" + resolved "https://registry.yarnpkg.com/boom/-/boom-2.10.1.tgz#39c8918ceff5799f83f9492a848f625add0c766f" + dependencies: + hoek "2.x.x" + +boom@5.x.x, boom@^5.2.0: + 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.8" + resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.8.tgz#c07b211c7c952ec1f8efd51a77ef0d1d3990a292" + dependencies: + balanced-match "^1.0.0" + concat-map "0.0.1" + +browser-stdout@1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/browser-stdout/-/browser-stdout-1.3.0.tgz#f351d32969d32fa5d7a5567154263d928ae3bd1f" + +builtin-modules@^1.0.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-1.1.1.tgz#270f076c5a72c02f5b65a47df94c5fe3a278892f" + +call@^4.0.2: + version "4.0.2" + resolved "https://registry.yarnpkg.com/call/-/call-4.0.2.tgz#df76f5f51ee8dd48b856ac8400f7e69e6d7399c4" + dependencies: + boom "5.x.x" + hoek "4.x.x" + +camelcase@^1.0.2: + version "1.2.1" + resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-1.2.1.tgz#9bb5304d2e0b56698b2c758b08a3eaa9daa58a39" + +camelcase@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-3.0.0.tgz#32fc4b9fcdaf845fcdf7e73bb97cac2261f0ab0a" + +caseless@~0.11.0: + version "0.11.0" + resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.11.0.tgz#715b96ea9841593cc33067923f5ec60ebda4f7d7" + +catbox-memory@^2.0.4: + version "2.0.4" + resolved "https://registry.yarnpkg.com/catbox-memory/-/catbox-memory-2.0.4.tgz#433e255902caf54233d1286429c8f4df14e822d5" + dependencies: + hoek "4.x.x" + +catbox@^7.1.5: + version "7.1.5" + resolved "https://registry.yarnpkg.com/catbox/-/catbox-7.1.5.tgz#c56f7e8e9555d27c0dc038a96ef73e57d186bb1f" + dependencies: + boom "5.x.x" + hoek "4.x.x" + joi "10.x.x" + +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" + +chalk@^1.1.1, chalk@^1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98" + dependencies: + ansi-styles "^2.2.1" + escape-string-regexp "^1.0.2" + has-ansi "^2.0.0" + strip-ansi "^3.0.0" + supports-color "^2.0.0" + +chalk@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.1.0.tgz#ac5becf14fa21b99c6c92ca7a7d7cfd5b17e743e" + dependencies: + ansi-styles "^3.1.0" + escape-string-regexp "^1.0.5" + supports-color "^4.0.0" + +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@^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" + +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" + +color-convert@^1.9.0: + version "1.9.0" + resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.0.tgz#1accf97dd739b983bf994d56fec8f95853641b7a" + dependencies: + color-name "^1.1.1" + +color-name@^1.1.1: + version "1.1.3" + resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" + +colors@^1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/colors/-/colors-1.1.2.tgz#168a4701756b6a7f51a12ce0c97bfa28c084ed63" + +combined-stream@^1.0.5, combined-stream@~1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.5.tgz#938370a57b4a51dea2c77c15d5c5fdf895164009" + dependencies: + delayed-stream "~1.0.0" + +combined-stream@~0.0.4: + version "0.0.7" + resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-0.0.7.tgz#0137e657baa5a7541c57ac37ac5fc07d73b4dc1f" + dependencies: + delayed-stream "0.0.5" + +commander@2.9.0: + version "2.9.0" + resolved "https://registry.yarnpkg.com/commander/-/commander-2.9.0.tgz#9c99094176e12240cb22d6c5146098400fe0f7d4" + dependencies: + graceful-readlink ">= 1.0.0" + +commander@^2.9.0: + version "2.11.0" + resolved "https://registry.yarnpkg.com/commander/-/commander-2.11.0.tgz#157152fd1e7a6c8d98a5b715cf376df928004563" + +component-emitter@1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/component-emitter/-/component-emitter-1.1.2.tgz#296594f2753daa63996d2af08d15a95116c9aec3" + +concat-map@0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" + +content@3.x.x: + version "3.0.5" + resolved "https://registry.yarnpkg.com/content/-/content-3.0.5.tgz#9e147dc7c838c4de9483096845ddb4de455ec509" + dependencies: + boom "5.x.x" + +cookiejar@2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/cookiejar/-/cookiejar-2.0.1.tgz#3d12752f6adf68a892f332433492bd5812bb668f" + +core-js@^2.4.0: + version "2.5.0" + resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.5.0.tgz#569c050918be6486b3837552028ae0466b717086" + +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" + +coveralls@^2.13.1: + version "2.13.1" + resolved "https://registry.yarnpkg.com/coveralls/-/coveralls-2.13.1.tgz#d70bb9acc1835ec4f063ff9dac5423c17b11f178" + dependencies: + js-yaml "3.6.1" + lcov-parse "0.0.10" + log-driver "1.2.5" + minimist "1.2.0" + request "2.79.0" + +cryptiles@2.x.x: + version "2.0.5" + resolved "https://registry.yarnpkg.com/cryptiles/-/cryptiles-2.0.5.tgz#3bdfecdc608147c1c67202fa291e7dca59eaa3b8" + dependencies: + boom "2.x.x" + +cryptiles@3.x.x, cryptiles@^3.1.2: + version "3.1.2" + resolved "https://registry.yarnpkg.com/cryptiles/-/cryptiles-3.1.2.tgz#a89fbb220f5ce25ec56e8c4aa8a4fd7b5b0d29fe" + dependencies: + boom "5.x.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" + +debug@2, debug@2.6.8, debug@^2.2.0, debug@^2.6.3, debug@^2.6.8: + version "2.6.8" + resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.8.tgz#e731531ca2ede27d188222427da17821d68ff4fc" + dependencies: + ms "2.0.0" + +decamelize@^1.0.0, decamelize@^1.1.1: + version "1.2.0" + resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" + +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" + dependencies: + strip-bom "^2.0.0" + +delayed-stream@0.0.5: + version "0.0.5" + resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-0.0.5.tgz#d4b1f43a93e8296dfe02694f4680bc37a313c73f" + +delayed-stream@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" + +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.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/diff/-/diff-3.2.0.tgz#c9ce393a4b7cbd0b058a725c93df299027868ff9" + +diff@^3.1.0, diff@^3.2.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/diff/-/diff-3.3.0.tgz#056695150d7aa93237ca7e378ac3b1682b7963b9" + +ecc-jsbn@~0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz#0fc73a9ed5f0d53c38193398523ef7e543777505" + dependencies: + jsbn "~0.1.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" + +escape-string-regexp@1.0.5, 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" + +esprima@^2.6.0: + version "2.7.3" + resolved "https://registry.yarnpkg.com/esprima/-/esprima-2.7.3.tgz#96e3b70d5779f6ad49cd032673d1c312767ba581" + +esprima@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.0.tgz#4499eddcd1110e0b218bacf2fa7f7f59f55ca804" + +esutils@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.2.tgz#0abf4f1caa5bcb1f7a9d8acc6dea4faaa04bac9b" + +extend@~1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/extend/-/extend-1.2.1.tgz#a0f5fd6cfc83a5fe49ef698d60ec8a624dd4576c" + +extend@~3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.1.tgz#a755ea7bc1adfcc5a31ce7e762dbaadc5e636444" + +extsprintf@1.3.0, extsprintf@^1.2.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.3.0.tgz#96918440e3041a7a414f8c52e3c574eb3c3e1e05" + +fileset@^2.0.2: + version "2.0.3" + resolved "https://registry.yarnpkg.com/fileset/-/fileset-2.0.3.tgz#8e7548a96d3cc2327ee5e674168723a333bba2a0" + dependencies: + glob "^7.0.3" + minimatch "^3.0.3" + +find-up@^1.0.0: + version "1.1.2" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-1.1.2.tgz#6b2e9822b1a2ce0a60ab64d610eccad53cb24d0f" + dependencies: + path-exists "^2.0.0" + pinkie-promise "^2.0.0" + +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@0.1.3: + version "0.1.3" + resolved "https://registry.yarnpkg.com/form-data/-/form-data-0.1.3.tgz#4ee4346e6eb5362e8344a02075bd8dbd8c7373ea" + dependencies: + async "~0.9.0" + combined-stream "~0.0.4" + mime "~1.2.11" + +form-data@~2.1.1: + version "2.1.4" + resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.1.4.tgz#33c183acf193276ecaa98143a69e94bfee1750d1" + dependencies: + asynckit "^0.4.0" + combined-stream "^1.0.5" + mime-types "^2.1.12" + +formatio@1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/formatio/-/formatio-1.1.1.tgz#5ed3ccd636551097383465d996199100e86161e9" + dependencies: + samsam "~1.1" + +formidable@1.0.14: + version "1.0.14" + resolved "https://registry.yarnpkg.com/formidable/-/formidable-1.0.14.tgz#2b3f4c411cbb5fdd695c44843e2a23514a43231a" + +fs-extra@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-4.0.1.tgz#7fc0c6c8957f983f57f306a24e5b9ddd8d0dd880" + dependencies: + graceful-fs "^4.1.2" + jsonfile "^3.0.0" + universalify "^0.1.0" + +fs.realpath@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" + +generate-function@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/generate-function/-/generate-function-2.0.0.tgz#6858fe7c0969b7d4e9093337647ac79f60dfbe74" + +generate-object-property@^1.1.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/generate-object-property/-/generate-object-property-1.2.0.tgz#9c0e1c40308ce804f4783618b937fa88f99d50d0" + dependencies: + is-property "^1.0.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" + +getpass@^0.1.1: + version "0.1.7" + resolved "https://registry.yarnpkg.com/getpass/-/getpass-0.1.7.tgz#5eff8e3e684d569ae4cb2b1282604e8ba62149fa" + dependencies: + assert-plus "^1.0.0" + +glob@7.1.1: + version "7.1.1" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.1.tgz#805211df04faaf1c63a3600306cdf5ade50b2ec8" + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^3.0.2" + once "^1.3.0" + path-is-absolute "^1.0.0" + +glob@^7.0.3, glob@^7.0.5, 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" + +globals@^9.18.0: + version "9.18.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-9.18.0.tgz#aa3896b3e69b487f17e31ed2143d69a8e30c2d8a" + +graceful-fs@^4.1.2, graceful-fs@^4.1.6: + version "4.1.11" + resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.11.tgz#0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658" + +"graceful-readlink@>= 1.0.0": + version "1.0.1" + resolved "https://registry.yarnpkg.com/graceful-readlink/-/graceful-readlink-1.0.1.tgz#4cafad76bc62f02fa039b2f94e9a3dd3a391a725" + +growl@1.9.2: + version "1.9.2" + resolved "https://registry.yarnpkg.com/growl/-/growl-1.9.2.tgz#0ea7743715db8d8de2c5ede1775e1b45ac85c02f" + +handlebars@^4.0.3: + version "4.0.10" + resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.0.10.tgz#3d30c718b09a3d96f23ea4cc1f403c4d3ba9ff4f" + dependencies: + async "^1.4.0" + optimist "^0.6.1" + source-map "^0.4.4" + optionalDependencies: + uglify-js "^2.6" + +hapi@^16.5.2: + version "16.5.2" + resolved "https://registry.yarnpkg.com/hapi/-/hapi-16.5.2.tgz#d1dadf33721c6ac3aaa905ce086d9c7ffb883092" + dependencies: + accept "^2.1.4" + ammo "^2.0.4" + boom "^5.2.0" + call "^4.0.2" + catbox "^7.1.5" + catbox-memory "^2.0.4" + cryptiles "^3.1.2" + heavy "^4.0.4" + hoek "^4.2.0" + iron "^4.0.5" + items "^2.1.1" + joi "^10.6.0" + mimos "^3.0.3" + podium "^1.3.0" + shot "^3.4.2" + statehood "^5.0.3" + subtext "^5.0.0" + topo "^2.0.2" + +har-validator@~2.0.6: + version "2.0.6" + resolved "https://registry.yarnpkg.com/har-validator/-/har-validator-2.0.6.tgz#cdcbc08188265ad119b6a5a7c8ab70eecfb5d27d" + dependencies: + chalk "^1.1.1" + commander "^2.9.0" + is-my-json-valid "^2.12.4" + pinkie-promise "^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" + 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" + +has-flag@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-2.0.0.tgz#e8207af1cc7b30d446cc70b734b5e8be18f88d51" + +hawk@~3.1.3: + version "3.1.3" + resolved "https://registry.yarnpkg.com/hawk/-/hawk-3.1.3.tgz#078444bd7c1640b0fe540d2c9b73d59678e8e1c4" + dependencies: + boom "2.x.x" + cryptiles "2.x.x" + hoek "2.x.x" + sntp "1.x.x" + +heavy@^4.0.4: + version "4.0.4" + resolved "https://registry.yarnpkg.com/heavy/-/heavy-4.0.4.tgz#36c91336c00ccfe852caa4d153086335cd2f00e9" + dependencies: + boom "5.x.x" + hoek "4.x.x" + joi "10.x.x" + +hoek@2.x.x: + version "2.16.3" + resolved "https://registry.yarnpkg.com/hoek/-/hoek-2.16.3.tgz#20bb7403d3cea398e91dc4710a8ff1b8274a25ed" + +hoek@4.x.x, hoek@^4.2.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/hoek/-/hoek-4.2.0.tgz#72d9d0754f7fe25ca2d01ad8f8f9a9449a89526d" + +hosted-git-info@^2.1.4: + version "2.5.0" + resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.5.0.tgz#6d60e34b3abbc8313062c3b798ef8d901a07af3c" + +http-signature@~1.1.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/http-signature/-/http-signature-1.1.1.tgz#df72e267066cd0ac67fb76adf8e134a8fbcf91bf" + dependencies: + assert-plus "^0.2.0" + jsprim "^1.2.2" + sshpk "^1.7.0" + +inflight@^1.0.4: + version "1.0.6" + resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" + dependencies: + once "^1.3.0" + wrappy "1" + +inherits@2, inherits@~2.0.1: + version "2.0.3" + resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" + +inherits@2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.1.tgz#b17d08d326b4423e568eff719f91b0b1cbdf69f1" + +invariant@^2.2.2: + version "2.2.2" + resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.2.tgz#9e1f56ac0acdb6bf303306f338be3b204ae60360" + 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" + +iron@4.x.x, iron@^4.0.5: + version "4.0.5" + resolved "https://registry.yarnpkg.com/iron/-/iron-4.0.5.tgz#4f042cceb8b9738f346b59aa734c83a89bc31428" + dependencies: + boom "5.x.x" + cryptiles "3.x.x" + hoek "4.x.x" + +is-arrayish@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" + +is-buffer@^1.1.5: + version "1.1.5" + resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.5.tgz#1f3b26ef613b214b88cbca23cc6c01d87961eecc" + +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" + +is-finite@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/is-finite/-/is-finite-1.0.2.tgz#cc6677695602be550ef11e8b4aa6305342b6d0aa" + 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" + dependencies: + number-is-nan "^1.0.0" + +is-my-json-valid@^2.12.4: + version "2.16.1" + resolved "https://registry.yarnpkg.com/is-my-json-valid/-/is-my-json-valid-2.16.1.tgz#5a846777e2c2620d1e69104e5d3a03b1f6088f11" + dependencies: + generate-function "^2.0.0" + generate-object-property "^1.1.0" + jsonpointer "^4.0.0" + xtend "^4.0.0" + +is-property@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/is-property/-/is-property-1.0.2.tgz#57fe1c4e48474edd65b09911f26b1cd4095dda84" + +is-typedarray@^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" + +is-utf8@^0.2.0: + version "0.2.1" + resolved "https://registry.yarnpkg.com/is-utf8/-/is-utf8-0.2.1.tgz#4b0da1442104d1b336340e80797e865cf39f7d72" + +isarray@0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/isarray/-/isarray-0.0.1.tgz#8a18acfca9a8f4177e09abfc6038939b05d1eedf" + +isemail@2.x.x: + version "2.2.1" + resolved "https://registry.yarnpkg.com/isemail/-/isemail-2.2.1.tgz#0353d3d9a62951080c262c2aa0a42b8ea8e9e2a6" + +isexe@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" + +isstream@~0.1.2: + version "0.1.2" + resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a" + +istanbul-api@^1.1.0-alpha: + version "1.1.12" + resolved "https://registry.yarnpkg.com/istanbul-api/-/istanbul-api-1.1.12.tgz#92d67e9d8f9ea87349a64a70ddf5a7a8cdf97f21" + dependencies: + async "^2.1.4" + fileset "^2.0.2" + istanbul-lib-coverage "^1.1.1" + istanbul-lib-hook "^1.0.7" + istanbul-lib-instrument "^1.7.5" + istanbul-lib-report "^1.1.1" + istanbul-lib-source-maps "^1.2.1" + istanbul-reports "^1.1.1" + js-yaml "^3.7.0" + mkdirp "^0.5.1" + once "^1.4.0" + +istanbul-lib-coverage@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/istanbul-lib-coverage/-/istanbul-lib-coverage-1.1.1.tgz#73bfb998885299415c93d38a3e9adf784a77a9da" + +istanbul-lib-hook@^1.0.7: + version "1.0.7" + resolved "https://registry.yarnpkg.com/istanbul-lib-hook/-/istanbul-lib-hook-1.0.7.tgz#dd6607f03076578fe7d6f2a630cf143b49bacddc" + dependencies: + append-transform "^0.4.0" + +istanbul-lib-instrument@^1.7.5: + version "1.7.5" + resolved "https://registry.yarnpkg.com/istanbul-lib-instrument/-/istanbul-lib-instrument-1.7.5.tgz#adb596f8f0cb8b95e739206351a38a586af21b1e" + dependencies: + babel-generator "^6.18.0" + babel-template "^6.16.0" + babel-traverse "^6.18.0" + babel-types "^6.18.0" + babylon "^6.17.4" + istanbul-lib-coverage "^1.1.1" + semver "^5.3.0" + +istanbul-lib-report@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/istanbul-lib-report/-/istanbul-lib-report-1.1.1.tgz#f0e55f56655ffa34222080b7a0cd4760e1405fc9" + dependencies: + istanbul-lib-coverage "^1.1.1" + mkdirp "^0.5.1" + path-parse "^1.0.5" + supports-color "^3.1.2" + +istanbul-lib-source-maps@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/istanbul-lib-source-maps/-/istanbul-lib-source-maps-1.2.1.tgz#a6fe1acba8ce08eebc638e572e294d267008aa0c" + dependencies: + debug "^2.6.3" + istanbul-lib-coverage "^1.1.1" + mkdirp "^0.5.1" + rimraf "^2.6.1" + source-map "^0.5.3" + +istanbul-reports@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/istanbul-reports/-/istanbul-reports-1.1.1.tgz#042be5c89e175bc3f86523caab29c014e77fee4e" + dependencies: + handlebars "^4.0.3" + +istanbul@^1.1.0-alpha.1: + version "1.1.0-alpha.1" + resolved "https://registry.yarnpkg.com/istanbul/-/istanbul-1.1.0-alpha.1.tgz#781795656018a2174c5f60f367ee5d361cb57b77" + dependencies: + abbrev "1.0.x" + async "1.x" + istanbul-api "^1.1.0-alpha" + js-yaml "3.x" + mkdirp "0.5.x" + nopt "3.x" + which "^1.1.1" + wordwrap "^1.0.0" + +items@2.x.x, items@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/items/-/items-2.1.1.tgz#8bd16d9c83b19529de5aea321acaada78364a198" + +joi@10.x.x, joi@^10.6.0: + version "10.6.0" + resolved "https://registry.yarnpkg.com/joi/-/joi-10.6.0.tgz#52587f02d52b8b75cdb0c74f0b164a191a0e1fc2" + dependencies: + hoek "4.x.x" + isemail "2.x.x" + items "2.x.x" + topo "2.x.x" + +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-yaml@3.6.1, js-yaml@3.x: + version "3.6.1" + resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.6.1.tgz#6e5fe67d8b205ce4d22fad05b7781e8dadcc4b30" + dependencies: + argparse "^1.0.7" + esprima "^2.6.0" + +js-yaml@^3.7.0: + version "3.9.1" + resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.9.1.tgz#08775cebdfdd359209f0d2acd383c8f86a6904a0" + 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" + +jsesc@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-1.3.0.tgz#46c3fec8c1892b12b0833db9bc7622176dbab34b" + +json-schema@0.2.3: + version "0.2.3" + resolved "https://registry.yarnpkg.com/json-schema/-/json-schema-0.2.3.tgz#b480c892e59a2f05954ce727bd3f2a4e882f9e13" + +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" + +json3@3.3.2: + version "3.3.2" + resolved "https://registry.yarnpkg.com/json3/-/json3-3.3.2.tgz#3c0434743df93e2f5c42aee7b19bcb483575f4e1" + +jsonfile@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-3.0.1.tgz#a5ecc6f65f53f662c4415c7675a0331d0992ec66" + optionalDependencies: + graceful-fs "^4.1.6" + +jsonpointer@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/jsonpointer/-/jsonpointer-4.0.1.tgz#4fd92cb34e0e9db3c89c8622ecf51f9b978c6cb9" + +jsprim@^1.2.2: + version "1.4.1" + resolved "https://registry.yarnpkg.com/jsprim/-/jsprim-1.4.1.tgz#313e66bc1e5cc06e438bc1b7499c2e5c56acb6a2" + dependencies: + assert-plus "1.0.0" + extsprintf "1.3.0" + json-schema "0.2.3" + verror "1.10.0" + +kind-of@^3.0.2: + version "3.2.2" + resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-3.2.2.tgz#31ea21a734bab9bbb0f32466d893aea51e4a3c64" + dependencies: + is-buffer "^1.1.5" + +"kindof@>= 1.0.0 < 2": + version "1.0.0" + resolved "https://registry.yarnpkg.com/kindof/-/kindof-1.0.0.tgz#131899a8527537a94da2edcd5cc49fc609606560" + +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" + dependencies: + invert-kv "^1.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" + +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" + dependencies: + graceful-fs "^4.1.2" + parse-json "^2.2.0" + pify "^2.0.0" + pinkie-promise "^2.0.0" + strip-bom "^2.0.0" + +lodash._baseassign@^3.0.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/lodash._baseassign/-/lodash._baseassign-3.2.0.tgz#8c38a099500f215ad09e59f1722fd0c52bfe0a4e" + dependencies: + lodash._basecopy "^3.0.0" + lodash.keys "^3.0.0" + +lodash._basecopy@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/lodash._basecopy/-/lodash._basecopy-3.0.1.tgz#8da0e6a876cf344c0ad8a54882111dd3c5c7ca36" + +lodash._basecreate@^3.0.0: + version "3.0.3" + resolved "https://registry.yarnpkg.com/lodash._basecreate/-/lodash._basecreate-3.0.3.tgz#1bc661614daa7fc311b7d03bf16806a0213cf821" + +lodash._getnative@^3.0.0: + version "3.9.1" + resolved "https://registry.yarnpkg.com/lodash._getnative/-/lodash._getnative-3.9.1.tgz#570bc7dede46d61cdcde687d65d3eecbaa3aaff5" + +lodash._isiterateecall@^3.0.0: + version "3.0.9" + resolved "https://registry.yarnpkg.com/lodash._isiterateecall/-/lodash._isiterateecall-3.0.9.tgz#5203ad7ba425fae842460e696db9cf3e6aac057c" + +lodash.create@3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/lodash.create/-/lodash.create-3.1.1.tgz#d7f2849f0dbda7e04682bb8cd72ab022461debe7" + dependencies: + lodash._baseassign "^3.0.0" + lodash._basecreate "^3.0.0" + lodash._isiterateecall "^3.0.0" + +lodash.isarguments@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/lodash.isarguments/-/lodash.isarguments-3.1.0.tgz#2f573d85c6a24289ff00663b491c1d338ff3458a" + +lodash.isarray@^3.0.0: + version "3.0.4" + resolved "https://registry.yarnpkg.com/lodash.isarray/-/lodash.isarray-3.0.4.tgz#79e4eb88c36a8122af86f844aa9bcd851b5fbb55" + +lodash.keys@^3.0.0: + version "3.1.2" + resolved "https://registry.yarnpkg.com/lodash.keys/-/lodash.keys-3.1.2.tgz#4dbc0472b156be50a0b286855d1bd0b0c656098a" + dependencies: + lodash._getnative "^3.0.0" + lodash.isarguments "^3.0.0" + lodash.isarray "^3.0.0" + +lodash@^3.7.0: + version "3.10.1" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-3.10.1.tgz#5bf45e8e49ba4189e17d482789dfd15bd140b7b6" + +lodash@^4.14.0, lodash@^4.17.4: + version "4.17.4" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae" + +log-driver@1.2.5: + version "1.2.5" + resolved "https://registry.yarnpkg.com/log-driver/-/log-driver-1.2.5.tgz#7ae4ec257302fd790d557cb10c97100d857b0056" + +lolex@1.3.2: + version "1.3.2" + resolved "https://registry.yarnpkg.com/lolex/-/lolex-1.3.2.tgz#7c3da62ffcb30f0f5a80a2566ca24e45d8a01f31" + +longest@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/longest/-/longest-1.0.1.tgz#30a0b2da38f73770e8294a0d22e6625ed77d0097" + +loose-envify@^1.0.0: + version "1.3.1" + resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.3.1.tgz#d1a8ad33fa9ce0e713d65fdd0ac8b748d478c848" + dependencies: + js-tokens "^3.0.0" + +make-error@^1.1.1: + version "1.3.0" + resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.0.tgz#52ad3a339ccf10ce62b4040b708fe707244b8b96" + +methods@1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/methods/-/methods-1.0.1.tgz#75bc91943dffd7da037cf3eeb0ed73a0037cd14b" + +methods@1.x: + version "1.1.2" + resolved "https://registry.yarnpkg.com/methods/-/methods-1.1.2.tgz#5529a4d67654134edcc5266656835b0f851afcee" + +mime-db@1.x.x, mime-db@~1.29.0: + version "1.29.0" + resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.29.0.tgz#48d26d235589651704ac5916ca06001914266878" + +mime-types@^2.1.12, mime-types@~2.1.7: + version "2.1.16" + resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.16.tgz#2b858a52e5ecd516db897ac2be87487830698e23" + dependencies: + mime-db "~1.29.0" + +mime@1.2.11, mime@~1.2.11: + version "1.2.11" + resolved "https://registry.yarnpkg.com/mime/-/mime-1.2.11.tgz#58203eed86e3a5ef17aed2b7d9ebd47f0a60dd10" + +mimos@^3.0.3: + version "3.0.3" + resolved "https://registry.yarnpkg.com/mimos/-/mimos-3.0.3.tgz#b9109072ad378c2b72f6a0101c43ddfb2b36641f" + dependencies: + hoek "4.x.x" + mime-db "1.x.x" + +minimatch@^3.0.2, minimatch@^3.0.3, minimatch@^3.0.4: + version "3.0.4" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" + dependencies: + brace-expansion "^1.1.7" + +minimist@0.0.8, minimist@~0.0.1: + version "0.0.8" + resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" + +minimist@1.2.0, minimist@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" + +mkdirp@0.5.1, mkdirp@0.5.x, 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-typescript@^1.1.7: + version "1.1.7" + resolved "https://registry.yarnpkg.com/mocha-typescript/-/mocha-typescript-1.1.7.tgz#86bca3d74891beeab99e755f74140a51050a7c77" + dependencies: + chalk "^1.1.3" + yargs "^6.5.0" + +mocha@^3.5.0: + version "3.5.0" + resolved "https://registry.yarnpkg.com/mocha/-/mocha-3.5.0.tgz#1328567d2717f997030f8006234bce9b8cd72465" + dependencies: + browser-stdout "1.3.0" + commander "2.9.0" + debug "2.6.8" + diff "3.2.0" + escape-string-regexp "1.0.5" + glob "7.1.1" + growl "1.9.2" + json3 "3.3.2" + lodash.create "3.1.1" + mkdirp "0.5.1" + supports-color "3.1.2" + +ms@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" + +must@^0.12.0: + version "0.12.0" + resolved "https://registry.yarnpkg.com/must/-/must-0.12.0.tgz#5741e729bedbc8b0fe2bc8c5006459415383d05d" + dependencies: + kindof ">= 1.0.0 < 2" + +nan@^2.3.3: + version "2.6.2" + resolved "https://registry.yarnpkg.com/nan/-/nan-2.6.2.tgz#e4ff34e6c95fdfb5aecc08de6596f43605a7db45" + +nigel@2.x.x: + version "2.0.2" + resolved "https://registry.yarnpkg.com/nigel/-/nigel-2.0.2.tgz#93a1866fb0c52d87390aa75e2b161f4b5c75e5b1" + dependencies: + hoek "4.x.x" + vise "2.x.x" + +"noder.io@>= 1.0.0 < 2.0.0": + version "1.2.0" + resolved "https://registry.yarnpkg.com/noder.io/-/noder.io-1.2.0.tgz#ad2bc6c6c3f9465891edbc6dbf5e84dcae2fa9e6" + +nopt@3.x: + version "3.0.6" + resolved "https://registry.yarnpkg.com/nopt/-/nopt-3.0.6.tgz#c6465dbf08abcd4db359317f79ac68a646b28ff9" + dependencies: + abbrev "1" + +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" + dependencies: + hosted-git-info "^2.1.4" + is-builtin-module "^1.0.0" + semver "2 || 3 || 4 || 5" + validate-npm-package-license "^3.0.1" + +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" + +oauth-sign@~0.8.1: + version "0.8.2" + resolved "https://registry.yarnpkg.com/oauth-sign/-/oauth-sign-0.8.2.tgz#46a6ab7f0aead8deae9ec0565780b7d4efeb9d43" + +once@^1.3.0, once@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" + dependencies: + wrappy "1" + +optimist@^0.6.1: + version "0.6.1" + resolved "https://registry.yarnpkg.com/optimist/-/optimist-0.6.1.tgz#da3ea74686fa21a19a111c326e90eb15a0196686" + dependencies: + minimist "~0.0.1" + wordwrap "~0.0.2" + +os-locale@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/os-locale/-/os-locale-1.4.0.tgz#20f9f17ae29ed345e8bde583b13d2009803c14d9" + dependencies: + lcid "^1.0.0" + +parse-json@^2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-2.2.0.tgz#f480f40434ef80741f8469099f8dea18f55a4dc9" + dependencies: + error-ex "^1.2.0" + +path-exists@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-2.1.0.tgz#0feb6c64f0fc518d9a754dd5efb62c7022761f4b" + dependencies: + pinkie-promise "^2.0.0" + +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-parse@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.5.tgz#3c1adf871ea9cd6c9431b6ea2bd74a0ff055c4c1" + +path-type@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/path-type/-/path-type-1.1.0.tgz#59c44f7ee491da704da415da5a4070ba4f8fe441" + dependencies: + graceful-fs "^4.1.2" + pify "^2.0.0" + pinkie-promise "^2.0.0" + +pez@2.x.x: + version "2.1.5" + resolved "https://registry.yarnpkg.com/pez/-/pez-2.1.5.tgz#5ec2cc62500cc3eb4236d4a414cf5a17b5eb5007" + dependencies: + b64 "3.x.x" + boom "5.x.x" + content "3.x.x" + hoek "4.x.x" + nigel "2.x.x" + +pify@^2.0.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c" + +pinkie-promise@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/pinkie-promise/-/pinkie-promise-2.0.1.tgz#2135d6dfa7a358c069ac9b178776288228450ffa" + 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" + +podium@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/podium/-/podium-1.3.0.tgz#3c490f54d16f10f5260cbe98641f1cb733a8851c" + dependencies: + hoek "4.x.x" + items "2.x.x" + joi "10.x.x" + +punycode@^1.4.1: + version "1.4.1" + resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e" + +qs@1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/qs/-/qs-1.2.0.tgz#ed079be28682147e6fd9a34cc2b0c1e0ec6453ee" + +qs@~6.3.0: + version "6.3.2" + resolved "https://registry.yarnpkg.com/qs/-/qs-6.3.2.tgz#e75bd5f6e268122a2a0e0bda630b2550c166502c" + +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" + dependencies: + find-up "^1.0.0" + read-pkg "^1.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" + dependencies: + load-json-file "^1.0.0" + normalize-package-data "^2.3.2" + path-type "^1.0.0" + +readable-stream@1.0.27-1: + version "1.0.27-1" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-1.0.27-1.tgz#6b67983c20357cefd07f0165001a16d710d91078" + dependencies: + core-util-is "~1.0.0" + inherits "~2.0.1" + isarray "0.0.1" + string_decoder "~0.10.x" + +reduce-component@1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/reduce-component/-/reduce-component-1.0.1.tgz#e0c93542c574521bea13df0f9488ed82ab77c5da" + +reflect-metadata@^0.1.10: + version "0.1.10" + resolved "https://registry.yarnpkg.com/reflect-metadata/-/reflect-metadata-0.1.10.tgz#b4f83704416acad89988c9b15635d47e03b9344a" + +regenerator-runtime@^0.11.0: + version "0.11.0" + resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.11.0.tgz#7e54fe5b5ccd5d6624ea6255c3473be090b802e1" + +repeat-string@^1.5.2: + version "1.6.1" + resolved "https://registry.yarnpkg.com/repeat-string/-/repeat-string-1.6.1.tgz#8dcae470e1c88abc2d600fff4a776286da75e637" + +repeating@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/repeating/-/repeating-2.0.1.tgz#5214c53a926d3552707527fbab415dbc08d06dda" + dependencies: + is-finite "^1.0.0" + +request@2.79.0: + version "2.79.0" + resolved "https://registry.yarnpkg.com/request/-/request-2.79.0.tgz#4dfe5bf6be8b8cdc37fcf93e04b65577722710de" + dependencies: + aws-sign2 "~0.6.0" + aws4 "^1.2.1" + caseless "~0.11.0" + combined-stream "~1.0.5" + extend "~3.0.0" + forever-agent "~0.6.1" + form-data "~2.1.1" + har-validator "~2.0.6" + hawk "~3.1.3" + http-signature "~1.1.0" + is-typedarray "~1.0.0" + isstream "~0.1.2" + json-stringify-safe "~5.0.1" + mime-types "~2.1.7" + oauth-sign "~0.8.1" + qs "~6.3.0" + stringstream "~0.0.4" + tough-cookie "~2.3.0" + tunnel-agent "~0.4.1" + uuid "^3.0.0" + +require-directory@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" + +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" + +resolve@^1.3.2: + version "1.4.0" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.4.0.tgz#a75be01c53da25d934a98ebd0e4c4a7312f92a86" + dependencies: + path-parse "^1.0.5" + +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.6.1: + version "2.6.1" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.1.tgz#c2338ec643df7a1b7fe5c54fa86f57428a55f33d" + dependencies: + glob "^7.0.5" + +rxjs@^5.4.2: + version "5.4.3" + resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-5.4.3.tgz#0758cddee6033d68e0fd53676f0f3596ce3d483f" + dependencies: + symbol-observable "^1.0.1" + +samsam@1.1.2, samsam@~1.1: + version "1.1.2" + resolved "https://registry.yarnpkg.com/samsam/-/samsam-1.1.2.tgz#bec11fdc83a9fda063401210e40176c3024d1567" + +"semver@2 || 3 || 4 || 5", semver@^5.3.0: + version "5.4.1" + resolved "https://registry.yarnpkg.com/semver/-/semver-5.4.1.tgz#e059c09d8571f0540823733433505d3a2f00b18e" + +set-blocking@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" + +shot@^3.4.2: + version "3.4.2" + resolved "https://registry.yarnpkg.com/shot/-/shot-3.4.2.tgz#1e5c3f6f2b26649adc42f7eb350214a5a0291d67" + dependencies: + hoek "4.x.x" + joi "10.x.x" + +should-equal@0.3.1: + version "0.3.1" + resolved "https://registry.yarnpkg.com/should-equal/-/should-equal-0.3.1.tgz#bd8ea97a6748e39fad476a3be6fd72ebc2e72bf0" + dependencies: + should-type "0.0.4" + +should-format@0.0.7: + version "0.0.7" + resolved "https://registry.yarnpkg.com/should-format/-/should-format-0.0.7.tgz#1e2ef86bd91da9c2e0412335b56ababd9a2fde12" + dependencies: + should-type "0.0.4" + +should-type@0.0.4: + version "0.0.4" + resolved "https://registry.yarnpkg.com/should-type/-/should-type-0.0.4.tgz#0132a05417a6126866426acf116f1ed5623a5cd0" + +should@^6.0.1: + version "6.0.3" + resolved "https://registry.yarnpkg.com/should/-/should-6.0.3.tgz#daee30786a557662fbc774c008d7c58791edb1d9" + dependencies: + should-equal "0.3.1" + should-format "0.0.7" + should-type "0.0.4" + +"sinon@>= 1.14.1 < 2.0.0": + version "1.17.7" + resolved "https://registry.yarnpkg.com/sinon/-/sinon-1.17.7.tgz#4542a4f49ba0c45c05eb2e9dd9d203e2b8efe0bf" + dependencies: + formatio "1.1.1" + lolex "1.3.2" + samsam "1.1.2" + util ">=0.10.3 <1" + +sntp@1.x.x: + version "1.0.9" + resolved "https://registry.yarnpkg.com/sntp/-/sntp-1.0.9.tgz#6541184cc90aeea6c6e7b35e2659082443c66198" + dependencies: + hoek "2.x.x" + +source-map-support@^0.4.0: + version "0.4.16" + resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.4.16.tgz#16fecf98212467d017d586a2af68d628b9421cd8" + dependencies: + source-map "^0.5.6" + +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.3, source-map@^0.5.6, source-map@~0.5.1: + version "0.5.7" + resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc" + +spdx-correct@~1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-1.0.2.tgz#4b3073d933ff51f3912f03ac5519498a4150db40" + dependencies: + spdx-license-ids "^1.0.2" + +spdx-expression-parse@~1.0.0: + version "1.0.4" + resolved "https://registry.yarnpkg.com/spdx-expression-parse/-/spdx-expression-parse-1.0.4.tgz#9bdf2f20e1f40ed447fbe273266191fced51626c" + +spdx-license-ids@^1.0.2: + version "1.2.2" + resolved "https://registry.yarnpkg.com/spdx-license-ids/-/spdx-license-ids-1.2.2.tgz#c9df7a3424594ade6bd11900d596696dc06bac57" + +sprintf-js@~1.0.2: + version "1.0.3" + resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" + +sshpk@^1.7.0: + version "1.13.1" + resolved "https://registry.yarnpkg.com/sshpk/-/sshpk-1.13.1.tgz#512df6da6287144316dc4c18fe1cf1d940739be3" + dependencies: + asn1 "~0.2.3" + assert-plus "^1.0.0" + dashdash "^1.12.0" + getpass "^0.1.1" + optionalDependencies: + bcrypt-pbkdf "^1.0.0" + ecc-jsbn "~0.1.1" + jsbn "~0.1.0" + tweetnacl "~0.14.0" + +statehood@^5.0.3: + version "5.0.3" + resolved "https://registry.yarnpkg.com/statehood/-/statehood-5.0.3.tgz#c07a75620db5379b60d2edd47f538002a8ac7dd6" + dependencies: + boom "5.x.x" + cryptiles "3.x.x" + hoek "4.x.x" + iron "4.x.x" + items "2.x.x" + joi "10.x.x" + +string-width@^1.0.1, string-width@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-1.0.2.tgz#118bdf5b8cdc51a2a7e70d211e07e2b0b9b107d3" + dependencies: + code-point-at "^1.0.0" + is-fullwidth-code-point "^1.0.0" + strip-ansi "^3.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" + +stringstream@~0.0.4: + 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" + dependencies: + ansi-regex "^2.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" + 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" + +strip-json-comments@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" + +subtext@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/subtext/-/subtext-5.0.0.tgz#9c3f083018bb1586b167ad8cfd87083f5ccdfe0f" + dependencies: + boom "5.x.x" + content "3.x.x" + hoek "4.x.x" + pez "2.x.x" + wreck "12.x.x" + +superagent@~0.21.0: + version "0.21.0" + resolved "https://registry.yarnpkg.com/superagent/-/superagent-0.21.0.tgz#fb15027984751ee7152200e6cd21cd6e19a5de87" + dependencies: + component-emitter "1.1.2" + cookiejar "2.0.1" + debug "2" + extend "~1.2.1" + form-data "0.1.3" + formidable "1.0.14" + methods "1.0.1" + mime "1.2.11" + qs "1.2.0" + readable-stream "1.0.27-1" + reduce-component "1.0.1" + +"supertest@>= 0.15.0 < 1.0.0": + version "0.15.0" + resolved "https://registry.yarnpkg.com/supertest/-/supertest-0.15.0.tgz#86118695de4be58869b3ee94c45e1d084ca7fac5" + dependencies: + methods "1.x" + superagent "~0.21.0" + +supports-color@3.1.2, supports-color@^3.1.2: + version "3.1.2" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-3.1.2.tgz#72a262894d9d408b956ca05ff37b2ed8a6e2a2d5" + dependencies: + has-flag "^1.0.0" + +supports-color@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7" + +supports-color@^4.0.0: + version "4.2.1" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-4.2.1.tgz#65a4bb2631e90e02420dba5554c375a4754bb836" + dependencies: + has-flag "^2.0.0" + +symbol-observable@^1.0.1: + version "1.0.4" + resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-1.0.4.tgz#29bf615d4aa7121bdd898b22d4b3f9bc4e2aa03d" + +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" + +topo@2.x.x, topo@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/topo/-/topo-2.0.2.tgz#cd5615752539057c0dc0491a621c3bc6fbe1d182" + dependencies: + hoek "4.x.x" + +tough-cookie@~2.3.0: + version "2.3.2" + resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.3.2.tgz#f081f76e4c85720e6c37a5faced737150d84072a" + dependencies: + punycode "^1.4.1" + +trim-right@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/trim-right/-/trim-right-1.0.1.tgz#cb2e1203067e0c8de1f614094b9fe45704ea6003" + +ts-node@^3.3.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-3.3.0.tgz#c13c6a3024e30be1180dd53038fc209289d4bf69" + dependencies: + arrify "^1.0.0" + chalk "^2.0.0" + diff "^3.1.0" + make-error "^1.1.1" + minimist "^1.2.0" + mkdirp "^0.5.1" + source-map-support "^0.4.0" + tsconfig "^6.0.0" + v8flags "^3.0.0" + yn "^2.0.0" + +tsconfig@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/tsconfig/-/tsconfig-6.0.0.tgz#6b0e8376003d7af1864f8df8f89dd0059ffcd032" + dependencies: + strip-bom "^3.0.0" + strip-json-comments "^2.0.0" + +tslib@^1.7.1: + version "1.7.1" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.7.1.tgz#bc8004164691923a79fe8378bbeb3da2017538ec" + +tslint@^5.5.0: + version "5.6.0" + resolved "https://registry.yarnpkg.com/tslint/-/tslint-5.6.0.tgz#088aa6c6026623338650b2900828ab3edf59f6cf" + dependencies: + babel-code-frame "^6.22.0" + colors "^1.1.2" + commander "^2.9.0" + diff "^3.2.0" + glob "^7.1.1" + minimatch "^3.0.4" + resolve "^1.3.2" + semver "^5.3.0" + tslib "^1.7.1" + tsutils "^2.7.1" + +tsutils@^2.7.1: + version "2.8.1" + resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-2.8.1.tgz#3771404e7ca9f0bedf5d919a47a4b1890a68efff" + dependencies: + tslib "^1.7.1" + +tunnel-agent@~0.4.1: + version "0.4.3" + resolved "https://registry.yarnpkg.com/tunnel-agent/-/tunnel-agent-0.4.3.tgz#6373db76909fe570e08d73583365ed828a74eeeb" + +tweetnacl@^0.14.3, tweetnacl@~0.14.0: + version "0.14.5" + resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-0.14.5.tgz#5ae68177f192d4456269d108afa93ff8743f4f64" + +typedarray-to-buffer@^3.1.2: + version "3.1.2" + resolved "https://registry.yarnpkg.com/typedarray-to-buffer/-/typedarray-to-buffer-3.1.2.tgz#1017b32d984ff556eba100f501589aba1ace2e04" + dependencies: + is-typedarray "^1.0.0" + +typescript@^2.4.2: + version "2.5.1" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.5.1.tgz#ce7cc93ada3de19475cc9d17e3adea7aee1832aa" + +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-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" + +unit.js@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/unit.js/-/unit.js-2.0.0.tgz#e91b56abc50c530dba03cdbfe0e1df2a3ee3aa32" + dependencies: + bluebird "^2.9.9" + lodash "^3.7.0" + must "^0.12.0" + noder.io ">= 1.0.0 < 2.0.0" + should "^6.0.1" + sinon ">= 1.14.1 < 2.0.0" + supertest ">= 0.15.0 < 1.0.0" + +universalify@^0.1.0: + version "0.1.1" + resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.1.tgz#fa71badd4437af4c148841e3b3b165f9e9e590b7" + +user-home@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/user-home/-/user-home-1.1.1.tgz#2b5be23a32b63a7c9deb8d0f28d485724a3df190" + +"util@>=0.10.3 <1": + version "0.10.3" + resolved "https://registry.yarnpkg.com/util/-/util-0.10.3.tgz#7afb1afe50805246489e3db7fe0ed379336ac0f9" + dependencies: + inherits "2.0.1" + +uuid@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.1.0.tgz#3dd3d3e790abc24d7b0d3a034ffababe28ebbc04" + +v8flags@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/v8flags/-/v8flags-3.0.0.tgz#4be9604488e0c4123645def705b1848d16b8e01f" + dependencies: + user-home "^1.1.1" + +validate-npm-package-license@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/validate-npm-package-license/-/validate-npm-package-license-3.0.1.tgz#2804babe712ad3379459acfbe24746ab2c303fbc" + dependencies: + spdx-correct "~1.0.0" + spdx-expression-parse "~1.0.0" + +verror@1.10.0: + version "1.10.0" + resolved "https://registry.yarnpkg.com/verror/-/verror-1.10.0.tgz#3a105ca17053af55d6e270c1f8288682e18da400" + dependencies: + assert-plus "^1.0.0" + core-util-is "1.0.2" + extsprintf "^1.2.0" + +vise@2.x.x: + version "2.0.2" + resolved "https://registry.yarnpkg.com/vise/-/vise-2.0.2.tgz#6b08e8fb4cb76e3a50cd6dd0ec37338e811a0d39" + dependencies: + hoek "4.x.x" + +websocket@^1.0.24: + version "1.0.24" + resolved "https://registry.yarnpkg.com/websocket/-/websocket-1.0.24.tgz#74903e75f2545b6b2e1de1425bc1c905917a1890" + dependencies: + debug "^2.2.0" + nan "^2.3.3" + typedarray-to-buffer "^3.1.2" + yaeti "^0.0.6" + +which-module@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/which-module/-/which-module-1.0.0.tgz#bba63ca861948994ff307736089e3b96026c2a4f" + +which@^1.1.1: + version "1.3.0" + resolved "https://registry.yarnpkg.com/which/-/which-1.3.0.tgz#ff04bdfc010ee547d780bec38e1ac1c2777d253a" + dependencies: + isexe "^2.0.0" + +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@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb" + +wordwrap@~0.0.2: + version "0.0.3" + resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.3.tgz#a3d5da6cd5c0bc0008d37234bbaf1bed63059107" + +wrap-ansi@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-2.1.0.tgz#d8fc3d284dd05794fe84973caecdd1cf824fdd85" + dependencies: + string-width "^1.0.1" + strip-ansi "^3.0.1" + +wrappy@1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" + +wreck@12.x.x: + version "12.2.3" + resolved "https://registry.yarnpkg.com/wreck/-/wreck-12.2.3.tgz#3cb2ea880ea51c5982a23fa8182c53970b9b3afe" + dependencies: + boom "5.x.x" + hoek "4.x.x" + +xtend@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.1.tgz#a5c6d532be656e23db820efb943a1f04998d63af" + +y18n@^3.2.1: + version "3.2.1" + resolved "https://registry.yarnpkg.com/y18n/-/y18n-3.2.1.tgz#6d15fba884c08679c0d77e88e7759e811e07fa41" + +yaeti@^0.0.6: + version "0.0.6" + resolved "https://registry.yarnpkg.com/yaeti/-/yaeti-0.0.6.tgz#f26f484d72684cf42bedfb76970aa1608fbf9577" + +yargs-parser@^4.2.0: + version "4.2.1" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-4.2.1.tgz#29cceac0dc4f03c6c87b4a9f217dd18c9f74871c" + dependencies: + camelcase "^3.0.0" + +yargs@^6.5.0: + version "6.6.0" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-6.6.0.tgz#782ec21ef403345f830a808ca3d513af56065208" + dependencies: + camelcase "^3.0.0" + cliui "^3.2.0" + decamelize "^1.1.1" + get-caller-file "^1.0.1" + os-locale "^1.4.0" + read-pkg-up "^1.0.1" + require-directory "^2.1.1" + require-main-filename "^1.0.1" + set-blocking "^2.0.0" + string-width "^1.0.2" + which-module "^1.0.0" + y18n "^3.2.1" + yargs-parser "^4.2.0" + +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" + +yn@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/yn/-/yn-2.0.0.tgz#e5adabc8acf408f6385fc76495684c88e6af689a" From 22a7d3497589f253cba548df4a80ef3857fc7903 Mon Sep 17 00:00:00 2001 From: Juneil Date: Thu, 24 Aug 2017 11:12:39 +0200 Subject: [PATCH 12/19] test(*): add some tests --- src/extensions/http-server/extension.ts | 2 +- test/integration/http-server.test.ts | 11 +-- .../extensions/http-server/extension.test.ts | 86 ++++++++++++++++++- 3 files changed, 92 insertions(+), 7 deletions(-) diff --git a/src/extensions/http-server/extension.ts b/src/extensions/http-server/extension.ts index a1bee50..3324e01 100644 --- a/src/extensions/http-server/extension.ts +++ b/src/extensions/http-server/extension.ts @@ -124,7 +124,7 @@ export class HttpServerExt implements OnExtensionLoad, OnModuleInstantiated { request['_hapinessRoute'], [ request, reply ] ) - .map(_ => !!_.statusCode ? _ : { statusCode: 200, response: _ }) + .map(_ => !!_ && _.statusCode ? _ : { statusCode: 200, response: _ }) .subscribe( _ => reply(_.response) diff --git a/test/integration/http-server.test.ts b/test/integration/http-server.test.ts index 41d21ee..5161b94 100644 --- a/test/integration/http-server.test.ts +++ b/test/integration/http-server.test.ts @@ -1,7 +1,7 @@ import { suite, test, only } from 'mocha-typescript'; import * as unit from 'unit.js'; import { Hapiness, HapinessModule, Inject, OnRegister, OnStart, OnError } from '../../src/core'; -import { HttpServerExt, Route, Lifecycle, OnGet, OnEvent, OnPreResponse } from '../../src/extensions/http-server'; +import { HttpServerExt, Route, Lifecycle, OnGet, OnEvent, OnPreResponse, HttpServerService } from '../../src/extensions/http-server'; import { Server } from 'hapi'; import { Observable } from 'rxjs'; @@ -23,16 +23,17 @@ class HttpServerIntegration { @HapinessModule({ version: '1.0.0', - declarations: [ RouteTest ] + declarations: [ RouteTest ], + providers: [ HttpServerService ] }) class ModuleTest implements OnStart { - constructor(@Inject(HttpServerExt) private server: Server) {} + constructor(private server: HttpServerService) {} onStart() { - this.server.inject('/', res => { + this.server.instance().inject('/', res => { unit.must(res.result).equal('test'); - this.server.stop().then(_ => done()); + this.server.stop().subscribe(_ => done()); }); } } diff --git a/test/unit/extensions/http-server/extension.test.ts b/test/unit/extensions/http-server/extension.test.ts index dc5d6e4..29bad62 100644 --- a/test/unit/extensions/http-server/extension.test.ts +++ b/test/unit/extensions/http-server/extension.test.ts @@ -1,6 +1,6 @@ import { suite, test } from 'mocha-typescript'; import { HttpServerExt, LifecycleManager } from '../../../../src/extensions/http-server'; -import { ModuleManager } from '../../../../src/core'; +import { HookManager, ModuleManager } from '../../../../src/core'; import { Observable } from 'rxjs'; import * as unit from 'unit.js'; @@ -83,4 +83,88 @@ class ModuleTestSuite { stub3.restore(); stub4.restore(); } + + @test('httpHandler - provide request, reply and route and must reply 200') + testHttpHandler1() { + + const request = { + method: 'get' + }; + const reply = res => { + unit + .value(res) + .is('toto') + return { + code: c => { + unit + .value(c) + .is(200); + } + }; + }; + const stub4 = unit + .stub(HookManager, 'triggerHook') + .returns(Observable.of('toto')); + + const extInstance = new HttpServerExt(); + extInstance['httpHandler'](request, reply, {}) + + stub4.restore(); + } + + @test('httpHandler - provide request, reply and route and must reply 201') + testHttpHandler2() { + + const request = { + method: 'get' + }; + const reply = res => { + unit + .value(res) + .is('abc') + return { + code: c => { + unit + .value(c) + .is(201); + } + }; + }; + const stub4 = unit + .stub(HookManager, 'triggerHook') + .returns(Observable.of({ response: 'abc', statusCode: 201 })); + + const extInstance = new HttpServerExt(); + extInstance['httpHandler'](request, reply, {}) + + stub4.restore(); + } + + @test('httpHandler - provide request, reply and route and must reply 204') + testHttpHandler3() { + + const request = { + method: 'get' + }; + const reply = res => { + unit + .value(res) + .is(null) + return { + code: c => { + unit + .value(c) + .is(204); + } + }; + }; + const stub4 = unit + .stub(HookManager, 'triggerHook') + .returns(Observable.of(null)); + + const extInstance = new HttpServerExt(); + extInstance['httpHandler'](request, reply, {}) + + stub4.restore(); + } } From 85380b3eb0dd22ee76262be2b9c537d472f1310b Mon Sep 17 00:00:00 2001 From: Juneil Date: Thu, 24 Aug 2017 16:06:07 +0200 Subject: [PATCH 13/19] fix(http-server): fix start + lifecycle --- src/core/hapiness.ts | 2 +- src/extensions/http-server/extension.ts | 7 ++++--- test/integration/http-server.test.ts | 18 +++++++++++++++++- .../extensions/http-server/extension.test.ts | 7 ++++++- 4 files changed, 28 insertions(+), 6 deletions(-) diff --git a/src/core/hapiness.ts b/src/core/hapiness.ts index 1e35935..5aeb15d 100644 --- a/src/core/hapiness.ts +++ b/src/core/hapiness.ts @@ -65,6 +65,7 @@ export class Hapiness { .map(_ => ({ provide: _.token, useValue: _.value })) .toArray() .flatMap(_ => ModuleManager.instantiate(moduleResolved, _)) + .do(_ => this.extensions = extensionsLoaded) .flatMap(moduleInstantiated => Observable .from(extensionsLoaded) @@ -73,7 +74,6 @@ export class Hapiness { .map(_ => moduleInstantiated) ) .do(_ => this.module = _) - .do(_ => this.extensions = extensionsLoaded) .flatMap(_ => this.callHooks(_)); } diff --git a/src/extensions/http-server/extension.ts b/src/extensions/http-server/extension.ts index 3324e01..283f313 100644 --- a/src/extensions/http-server/extension.ts +++ b/src/extensions/http-server/extension.ts @@ -59,10 +59,10 @@ export class HttpServerExt implements OnExtensionLoad, OnModuleInstantiated { onModuleInstantiated(module: CoreModule, server: Server): Observable { return Observable .from(ModuleManager.getModules(module)) + .flatMap(_ => this.instantiateLifecycle(_, server)) .flatMap(_ => this.registerPlugin(_, server)) .reduce((a, c) => a.concat(c), []) .do(_ => LifecycleManager.routeLifecycle(server, _)) - .flatMap(_ => this.instantiateLifecycle(module, server)) .flatMap(_ => server.start()); } @@ -142,7 +142,7 @@ export class HttpServerExt implements OnExtensionLoad, OnModuleInstantiated { * @param {CoreModule} module * @param {Server} server */ - private instantiateLifecycle(module: CoreModule, server: Server): Observable { + private instantiateLifecycle(module: CoreModule, server: Server): Observable { return Observable .from([].concat(module.declarations)) .filter(_ => !!_ && !!extractMetadataByDecorator(_, 'Lifecycle')) @@ -157,7 +157,8 @@ export class HttpServerExt implements OnExtensionLoad, OnModuleInstantiated { ) }) ) - .ignoreElements(); + .toArray() + .map(_ => module); } private eventHandler(lifecycle: Type, module: CoreModule, request: Request, reply: ReplyWithContinue): Observable { diff --git a/test/integration/http-server.test.ts b/test/integration/http-server.test.ts index 5161b94..7d4d07c 100644 --- a/test/integration/http-server.test.ts +++ b/test/integration/http-server.test.ts @@ -141,6 +141,22 @@ class HttpServerIntegration { Hapiness.bootstrap(ModuleTest, [ HttpServerExt.setConfig({ host: '0.0.0.0', port: 4444 }) ]); } + @test('port already used') + test4(done) { + + @HapinessModule({ + version: '1.0.0' + }) + class ModuleTest {} + + Hapiness.bootstrap(ModuleTest, [ HttpServerExt.setConfig({ host: '0.0.0.0', port: 4444 }) ]).catch(_ => { + unit.object(_) + .isInstanceOf(Error) + .hasProperty('message', 'listen EADDRINUSE 0.0.0.0:4444'); + Hapiness['extensions'][0].value.stop().then(__ => done()); + }); + } + @test('make sure register are done before start hook') test5(done) { @@ -275,6 +291,6 @@ class HttpServerIntegration { } } - Hapiness.bootstrap(ModuleTest, [ HttpServerExt.setConfig({ host: '0.0.0.0', port: 4444 }) ]); + Hapiness.bootstrap(ModuleTest, [ HttpServerExt.setConfig({ host: '0.0.0.0', port: 4445 }) ]); } } diff --git a/test/unit/extensions/http-server/extension.test.ts b/test/unit/extensions/http-server/extension.test.ts index 29bad62..9c484c9 100644 --- a/test/unit/extensions/http-server/extension.test.ts +++ b/test/unit/extensions/http-server/extension.test.ts @@ -72,7 +72,12 @@ class ModuleTestSuite { .stub(LifecycleManager, 'routeLifecycle'); const stub4 = unit .stub(extInstance, 'instantiateLifecycle') - .returns(Observable.of(null)); + stub4 + .withArgs(getModulesRes[0], server) + .returns(Observable.of(getModulesRes[0])); + stub4 + .withArgs(getModulesRes[1], server) + .returns(Observable.of(getModulesRes[1])); extInstance .onModuleInstantiated(coreModule, server) From 90cbd32ad91f1c5eb90e2d65e52f6b17d7642f96 Mon Sep 17 00:00:00 2001 From: Juneil Date: Mon, 28 Aug 2017 15:29:31 +0200 Subject: [PATCH 14/19] fix(bootstrap): wrong hook call order --- src/core/hapiness.ts | 17 +++++++++++++++-- src/extensions/http-server/interfaces.ts | 1 + test/unit/hapiness.test.ts | 20 ++++++++++++-------- 3 files changed, 28 insertions(+), 10 deletions(-) diff --git a/src/core/hapiness.ts b/src/core/hapiness.ts index 5aeb15d..a8f7150 100644 --- a/src/core/hapiness.ts +++ b/src/core/hapiness.ts @@ -65,6 +65,7 @@ export class Hapiness { .map(_ => ({ provide: _.token, useValue: _.value })) .toArray() .flatMap(_ => ModuleManager.instantiate(moduleResolved, _)) + .flatMap(_ => this.callRegister(_)) .do(_ => this.extensions = extensionsLoaded) .flatMap(moduleInstantiated => Observable @@ -74,7 +75,7 @@ export class Hapiness { .map(_ => moduleInstantiated) ) .do(_ => this.module = _) - .flatMap(_ => this.callHooks(_)); + .flatMap(_ => this.callStart(_)); } /** @@ -83,7 +84,7 @@ export class Hapiness { * @param {CoreModule} moduleInstantiated * @returns Observable */ - private static callHooks(moduleInstantiated: CoreModule): Observable { + private static callRegister(moduleInstantiated: CoreModule): Observable { return Observable .from(ModuleManager.getModules(moduleInstantiated)) .filter(_ => _.level !== ModuleLevel.ROOT) @@ -94,6 +95,18 @@ export class Hapiness { .triggerHook(ModuleEnum.OnRegister.toString(), _.token, _.instance) ) .toArray() + .map(_ => moduleInstantiated) + } + + /** + * Call Register and Start Hooks + * + * @param {CoreModule} moduleInstantiated + * @returns Observable + */ + private static callStart(moduleInstantiated: CoreModule): Observable { + return Observable + .of(moduleInstantiated) .flatMap(_ => HookManager .triggerHook( ModuleEnum.OnStart.toString(), diff --git a/src/extensions/http-server/interfaces.ts b/src/extensions/http-server/interfaces.ts index ce478ad..60c88ff 100644 --- a/src/extensions/http-server/interfaces.ts +++ b/src/extensions/http-server/interfaces.ts @@ -32,6 +32,7 @@ export interface RouteConfig { json?: any; jsonp?: any; log?: any; + payload?: any; plugins?: any; pre?: any; response?: any; diff --git a/test/unit/hapiness.test.ts b/test/unit/hapiness.test.ts index ba67785..07aa2f5 100644 --- a/test/unit/hapiness.test.ts +++ b/test/unit/hapiness.test.ts @@ -101,7 +101,11 @@ class TestSuite { .withArgs(ext, coreModule) .returns(Observable.of(null)); const stub3 = unit - .stub(Hapiness, 'callHooks') + .stub(Hapiness, 'callRegister') + .withArgs(coreModule) + .returns(Observable.of(coreModule)); + const stub4 = unit + .stub(Hapiness, 'callStart') .withArgs(coreModule) .returns(Observable.of(null)); @@ -114,7 +118,7 @@ class TestSuite { } - @test('callHooks - provide module and must call hooks') + @test('callRegister - provide module and must call hooks') testCallHooks1() { class EmptyModule2 { @@ -137,14 +141,14 @@ class TestSuite { .returns(true); const stub3 = unit .stub(HookManager, 'triggerHook') - .returns(Observable.of(null)) + .returns(Observable.of(module)) .withArgs('onRegister', EmptyModule2, getModulesRes[1].instance) - .returns(Observable.of(null)); - stub3 - .withArgs('onStart', EmptyModule, getModulesRes[0].instance, null, false) - .returns(Observable.of(null)); + .returns(Observable.of(module)); + // stub3 + // .withArgs('onStart', EmptyModule, getModulesRes[0].instance, null, false) + // .returns(Observable.of(null)); - Hapiness['callHooks'](module) + Hapiness['callRegister'](module) .subscribe(); stub1.parent.restore(); From 07bc81b00b119a062b61a951de1782370352e6e7 Mon Sep 17 00:00:00 2001 From: Juneil Date: Mon, 28 Aug 2017 15:33:49 +0200 Subject: [PATCH 15/19] fix(bootstrap): fix docs --- src/core/hapiness.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/hapiness.ts b/src/core/hapiness.ts index a8f7150..e387400 100644 --- a/src/core/hapiness.ts +++ b/src/core/hapiness.ts @@ -79,7 +79,7 @@ export class Hapiness { } /** - * Call Register and Start Hooks + * Call Register Hooks * * @param {CoreModule} moduleInstantiated * @returns Observable @@ -99,7 +99,7 @@ export class Hapiness { } /** - * Call Register and Start Hooks + * Call Start Hooks * * @param {CoreModule} moduleInstantiated * @returns Observable From 31e7a97b81f8348d7da92f01c34295c42f2fa315 Mon Sep 17 00:00:00 2001 From: njl07 Date: Mon, 28 Aug 2017 18:23:17 +0200 Subject: [PATCH 16/19] upgrade(version): Latest packages' versions --- package-lock.json | 322 +++++++++++++++++++++++++++------------------- package.json | 18 +-- yarn.lock | 78 +++++++---- 3 files changed, 252 insertions(+), 166 deletions(-) diff --git a/package-lock.json b/package-lock.json index 5396810..5bc3ea0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,20 +1,20 @@ { "name": "@hapiness/core", - "version": "1.0.0-rc.6", + "version": "1.0.0-rc.7", "lockfileVersion": 1, "requires": true, "dependencies": { "@types/boom": { - "version": "4.3.6", - "resolved": "https://registry.npmjs.org/@types/boom/-/boom-4.3.6.tgz", - "integrity": "sha512-su/eNfCGZrqt49PkCka4W14mCfx5MOaS6qPg7QFu8ZzeyjQ4oXeMg+gBFyCmMzkbmrkha6C7uZuNannWw9wSSw==" + "version": "4.3.7", + "resolved": "https://registry.npmjs.org/@types/boom/-/boom-4.3.7.tgz", + "integrity": "sha512-z6CT5iHAtBUib2JQwwiGVKHESAk5Elfwn0HFlpLC4rwpTtgCa1P5OCFzfCmF3vSpgYoZKm+3fh6sgFWJwwb8fw==" }, "@types/catbox": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/@types/catbox/-/catbox-7.1.2.tgz", - "integrity": "sha512-9NvH2QwGFTyjCKOgzmXxyX2g/qWs4PXQFETG93JAuK7DqjuROCqfX4dWCgSBV8m69XLiIbNc8QFYooIkIlvfcA==", + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/@types/catbox/-/catbox-7.1.3.tgz", + "integrity": "sha512-gpCXh6swH1/hUuWuozT70FJNgDj9Z0LV6P5sDW7/LPONolPiQYpq+XueImVQ9jyKips4k+Vi3Z7ooeHf8B8/qA==", "requires": { - "@types/boom": "4.3.6" + "@types/boom": "4.3.7" } }, "@types/fs-extra": { @@ -23,19 +23,19 @@ "integrity": "sha512-PlKJw6ujJXLJjbvB3T0UCbY3jibKM6/Ya5cc9j1q+mYDeK3aR4Dp+20ZwxSuvJr9mIoPxp7+IL4aMOEvsscRTA==", "dev": true, "requires": { - "@types/node": "8.0.19" + "@types/node": "8.0.25" } }, "@types/hapi": { - "version": "16.1.8", - "resolved": "https://registry.npmjs.org/@types/hapi/-/hapi-16.1.8.tgz", - "integrity": "sha512-SICFotDKQhSybmdaScGWftQ9mPRx98hiMpU2XzfmxYOSlnmla60QRy4PId/wa0p62fdozBxVrg+fgczFlU1dmA==", + "version": "16.1.9", + "resolved": "https://registry.npmjs.org/@types/hapi/-/hapi-16.1.9.tgz", + "integrity": "sha512-t0oOkiGguDhnE10fiFaIkWZRlQymNwq3U/Ql81x+UpDWHFPmpdhebXcKcncUhXueF43lOwlZbscVucMu3lO4zQ==", "requires": { - "@types/boom": "4.3.6", - "@types/catbox": "7.1.2", - "@types/joi": "10.4.0", + "@types/boom": "4.3.7", + "@types/catbox": "7.1.3", + "@types/joi": "10.4.1", "@types/mimos": "3.0.1", - "@types/node": "8.0.19", + "@types/node": "8.0.25", "@types/podium": "1.0.0", "@types/shot": "3.4.0" } @@ -46,9 +46,9 @@ "integrity": "sha1-0ZgtSPsNKg5dfp2Rg4Jk2OQo0zc=" }, "@types/joi": { - "version": "10.4.0", - "resolved": "https://registry.npmjs.org/@types/joi/-/joi-10.4.0.tgz", - "integrity": "sha512-YWG77KJ29DMSPbpFVvcMvafUPAkqXg1e2syk73pm5AOVtOfiHYj6J5EKbqCJe6NRwAQXuf0V8t9zvbRgKbkxHw==" + "version": "10.4.1", + "resolved": "https://registry.npmjs.org/@types/joi/-/joi-10.4.1.tgz", + "integrity": "sha512-tZ0q9R3XaEbBD6WW4mdBhRWUeG2ehVC4UqPAeIE0joE3BA/VfqdLF2asGkgQnC6xyU9VomDnaHS0IF5sjpr0eg==" }, "@types/mime-db": { "version": "1.27.0", @@ -64,9 +64,9 @@ } }, "@types/node": { - "version": "8.0.19", - "resolved": "https://registry.npmjs.org/@types/node/-/node-8.0.19.tgz", - "integrity": "sha512-VRQB+Q0L3YZWs45uRdpN9oWr82meL/8TrJ6faoKT5tp0uub2l/aRMhtm5fo68h7kjYKH60f9/bay1nF7ZpTW5g==" + "version": "8.0.25", + "resolved": "https://registry.npmjs.org/@types/node/-/node-8.0.25.tgz", + "integrity": "sha512-zT+t9841g1HsjLtPMCYxmb1U4pcZ2TOegAKiomlmj6bIziuaEYHUavxLE9NRwdntY0vOCrgHho6OXjDX7fm/Kw==" }, "@types/podium": { "version": "1.0.0", @@ -78,7 +78,7 @@ "resolved": "https://registry.npmjs.org/@types/shot/-/shot-3.4.0.tgz", "integrity": "sha1-RZR3xRh9Pr0wNmCrCZ5+ng87ZW8=", "requires": { - "@types/node": "8.0.19" + "@types/node": "8.0.25" } }, "@types/websocket": { @@ -86,7 +86,7 @@ "resolved": "https://registry.npmjs.org/@types/websocket/-/websocket-0.0.34.tgz", "integrity": "sha512-cvN32rSoC4aXpXHG2Gf8/f8/gtyA7PmE38E3ENsMymFPgoG8xD/kH/KAVhTINCZTPqmgaWN86c1MitMEsuHjnQ==", "requires": { - "@types/node": "8.0.19" + "@types/node": "8.0.25" } }, "abbrev": { @@ -208,9 +208,9 @@ "integrity": "sha512-Pbeh0i6OLubPJdIdCepn8ZQHwN2MWznZHbHABSTEfQ706ie+yuxNSaPdqX1xRatT6WanaS1EazMiSg0NUW2XxQ==" }, "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=", + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz", + "integrity": "sha1-Y/1D99weO7fONZR9uP42mj9Yx0s=", "dev": true, "requires": { "chalk": "1.1.3", @@ -219,18 +219,18 @@ } }, "babel-generator": { - "version": "6.25.0", - "resolved": "https://registry.npmjs.org/babel-generator/-/babel-generator-6.25.0.tgz", - "integrity": "sha1-M6GvcNXyiQrrRlpKd5PB32qeqfw=", + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-generator/-/babel-generator-6.26.0.tgz", + "integrity": "sha1-rBriAHC3n248odMmlhMFN3TyDcU=", "dev": true, "requires": { "babel-messages": "6.23.0", - "babel-runtime": "6.25.0", - "babel-types": "6.25.0", + "babel-runtime": "6.26.0", + "babel-types": "6.26.0", "detect-indent": "4.0.0", "jsesc": "1.3.0", "lodash": "4.17.4", - "source-map": "0.5.6", + "source-map": "0.5.7", "trim-right": "1.0.1" } }, @@ -240,65 +240,76 @@ "integrity": "sha1-8830cDhYA1sqKVHG7F7fbGLyYw4=", "dev": true, "requires": { - "babel-runtime": "6.25.0" + "babel-runtime": "6.26.0" } }, "babel-runtime": { - "version": "6.25.0", - "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.25.0.tgz", - "integrity": "sha1-M7mOql1IK7AajRqmtDetKwGuxBw=", + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz", + "integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=", "dev": true, "requires": { - "core-js": "2.4.1", - "regenerator-runtime": "0.10.5" + "core-js": "2.5.0", + "regenerator-runtime": "0.11.0" } }, "babel-template": { - "version": "6.25.0", - "resolved": "https://registry.npmjs.org/babel-template/-/babel-template-6.25.0.tgz", - "integrity": "sha1-ZlJBFmt8KqTGGdceGSlpVSsQwHE=", + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-template/-/babel-template-6.26.0.tgz", + "integrity": "sha1-3gPi0WOWsGn0bdn/+FIfsaDjXgI=", "dev": true, "requires": { - "babel-runtime": "6.25.0", - "babel-traverse": "6.25.0", - "babel-types": "6.25.0", - "babylon": "6.17.4", + "babel-runtime": "6.26.0", + "babel-traverse": "6.26.0", + "babel-types": "6.26.0", + "babylon": "6.18.0", "lodash": "4.17.4" } }, "babel-traverse": { - "version": "6.25.0", - "resolved": "https://registry.npmjs.org/babel-traverse/-/babel-traverse-6.25.0.tgz", - "integrity": "sha1-IldJfi/NGbie3BPEyROB+VEklvE=", + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-traverse/-/babel-traverse-6.26.0.tgz", + "integrity": "sha1-RqnL1+3MYsjlwGTi0tjQ9ANXZu4=", "dev": true, "requires": { - "babel-code-frame": "6.22.0", + "babel-code-frame": "6.26.0", "babel-messages": "6.23.0", - "babel-runtime": "6.25.0", - "babel-types": "6.25.0", - "babylon": "6.17.4", + "babel-runtime": "6.26.0", + "babel-types": "6.26.0", + "babylon": "6.18.0", "debug": "2.6.8", "globals": "9.18.0", "invariant": "2.2.2", "lodash": "4.17.4" + }, + "dependencies": { + "debug": { + "version": "2.6.8", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.8.tgz", + "integrity": "sha1-5zFTHKLt4n0YgiJCfaF4IdaP9Pw=", + "dev": true, + "requires": { + "ms": "2.0.0" + } + } } }, "babel-types": { - "version": "6.25.0", - "resolved": "https://registry.npmjs.org/babel-types/-/babel-types-6.25.0.tgz", - "integrity": "sha1-cK+ySNVmDl0Y+BHZHIMDtUE0oY4=", + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-types/-/babel-types-6.26.0.tgz", + "integrity": "sha1-o7Bz+Uq0nrb6Vc1lInozQ4BjJJc=", "dev": true, "requires": { - "babel-runtime": "6.25.0", + "babel-runtime": "6.26.0", "esutils": "2.0.2", "lodash": "4.17.4", "to-fast-properties": "1.0.3" } }, "babylon": { - "version": "6.17.4", - "resolved": "https://registry.npmjs.org/babylon/-/babylon-6.17.4.tgz", - "integrity": "sha512-kChlV+0SXkjE0vUn9OZ7pBMWRFd8uq3mZe8x1K6jhuNcAFAtEnjchFAqB+dYEXKyd+JpT6eppRR78QAr5gTsUw==", + "version": "6.18.0", + "resolved": "https://registry.npmjs.org/babylon/-/babylon-6.18.0.tgz", + "integrity": "sha512-q/UEjfGJ2Cm3oKV71DJz9d25TPnq5rhBVL2Q4fA5wcC3jcrdn7+SssEybFIxwAvvP+YCsCYNKughoF33GxgycQ==", "dev": true }, "balanced-match": { @@ -507,9 +518,9 @@ "dev": true }, "core-js": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.4.1.tgz", - "integrity": "sha1-TekR5mew6ukSTjQlS1OupvxhjT4=", + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.0.tgz", + "integrity": "sha1-VpwFCRi+ZIazg3VSAorgRmtxcIY=", "dev": true }, "core-util-is": { @@ -557,9 +568,9 @@ } }, "debug": { - "version": "2.6.8", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.8.tgz", - "integrity": "sha1-5zFTHKLt4n0YgiJCfaF4IdaP9Pw=", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.0.1.tgz", + "integrity": "sha512-6nVc6S36qbt/mutyt+UGMnawAMrPDZUPQjRZI3FS9tCtDRhvxJbK79unYBLPi+z5SLXQ3ftoVBFCblQtNSls8w==", "requires": { "ms": "2.0.0" } @@ -850,7 +861,7 @@ "requires": { "chalk": "1.1.3", "commander": "2.11.0", - "is-my-json-valid": "2.16.0", + "is-my-json-valid": "2.16.1", "pinkie-promise": "2.0.1" } }, @@ -1020,9 +1031,9 @@ } }, "is-my-json-valid": { - "version": "2.16.0", - "resolved": "https://registry.npmjs.org/is-my-json-valid/-/is-my-json-valid-2.16.0.tgz", - "integrity": "sha1-8Hndm/2uZe4gOKrorLyGqxCeNpM=", + "version": "2.16.1", + "resolved": "https://registry.npmjs.org/is-my-json-valid/-/is-my-json-valid-2.16.1.tgz", + "integrity": "sha512-ochPsqWS1WXj8ZnMIV0vnNXooaMhp7cyL4FMSIPKTtnV0Ha/T19G2b9kkhcNsabV9bxYkze7/aLZJb/bYuFduQ==", "dev": true, "requires": { "generate-function": "2.0.0", @@ -1079,7 +1090,7 @@ "requires": { "abbrev": "1.0.9", "async": "1.5.2", - "istanbul-api": "1.1.11", + "istanbul-api": "1.1.13", "js-yaml": "3.6.1", "mkdirp": "0.5.1", "nopt": "3.0.6", @@ -1088,19 +1099,19 @@ } }, "istanbul-api": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/istanbul-api/-/istanbul-api-1.1.11.tgz", - "integrity": "sha1-/MC0YeKzvaceMFFVE4I4doJX2d4=", + "version": "1.1.13", + "resolved": "https://registry.npmjs.org/istanbul-api/-/istanbul-api-1.1.13.tgz", + "integrity": "sha1-cZf2RBNgDr3+xjR6LcPU4D+X7Vo=", "dev": true, "requires": { "async": "2.5.0", "fileset": "2.0.3", "istanbul-lib-coverage": "1.1.1", "istanbul-lib-hook": "1.0.7", - "istanbul-lib-instrument": "1.7.4", + "istanbul-lib-instrument": "1.7.5", "istanbul-lib-report": "1.1.1", "istanbul-lib-source-maps": "1.2.1", - "istanbul-reports": "1.1.1", + "istanbul-reports": "1.1.2", "js-yaml": "3.9.1", "mkdirp": "0.5.1", "once": "1.4.0" @@ -1149,16 +1160,16 @@ } }, "istanbul-lib-instrument": { - "version": "1.7.4", - "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-1.7.4.tgz", - "integrity": "sha1-6f2SDkdn89Ge3HZeLWs/XMvQ7qg=", + "version": "1.7.5", + "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-1.7.5.tgz", + "integrity": "sha1-rbWW+PDLi5XnOSBjUaOKWGryGx4=", "dev": true, "requires": { - "babel-generator": "6.25.0", - "babel-template": "6.25.0", - "babel-traverse": "6.25.0", - "babel-types": "6.25.0", - "babylon": "6.17.4", + "babel-generator": "6.26.0", + "babel-template": "6.26.0", + "babel-traverse": "6.26.0", + "babel-types": "6.26.0", + "babylon": "6.18.0", "istanbul-lib-coverage": "1.1.1", "semver": "5.4.1" } @@ -1196,13 +1207,24 @@ "istanbul-lib-coverage": "1.1.1", "mkdirp": "0.5.1", "rimraf": "2.6.1", - "source-map": "0.5.6" + "source-map": "0.5.7" + }, + "dependencies": { + "debug": { + "version": "2.6.8", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.8.tgz", + "integrity": "sha1-5zFTHKLt4n0YgiJCfaF4IdaP9Pw=", + "dev": true, + "requires": { + "ms": "2.0.0" + } + } } }, "istanbul-reports": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-1.1.1.tgz", - "integrity": "sha512-P8G873A0kW24XRlxHVGhMJBhQ8gWAec+dae7ZxOBzxT4w+a9ATSPvRVK3LB1RAJ9S8bg2tOyWHAGW40Zd2dKfw==", + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-1.1.2.tgz", + "integrity": "sha1-D7Lj9qqZIr085F0F2KtNXo4HvU8=", "dev": true, "requires": { "handlebars": "4.0.10" @@ -1476,9 +1498,9 @@ "dev": true }, "mime-db": { - "version": "1.29.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.29.0.tgz", - "integrity": "sha1-SNJtI1WJZRcErFkWygYAGRQmaHg=" + "version": "1.30.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.30.0.tgz", + "integrity": "sha1-dMZD2i3Z1qRTmZY0ZbJtXKfXHwE=" }, "mime-types": { "version": "2.1.16", @@ -1487,6 +1509,14 @@ "dev": true, "requires": { "mime-db": "1.29.0" + }, + "dependencies": { + "mime-db": { + "version": "1.29.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.29.0.tgz", + "integrity": "sha1-SNJtI1WJZRcErFkWygYAGRQmaHg=", + "dev": true + } } }, "mimos": { @@ -1495,7 +1525,7 @@ "integrity": "sha1-uRCQcq03jCty9qAQHEPd+ys2ZB8=", "requires": { "hoek": "4.2.0", - "mime-db": "1.29.0" + "mime-db": "1.30.0" } }, "minimatch": { @@ -1558,6 +1588,15 @@ "graceful-readlink": "1.0.1" } }, + "debug": { + "version": "2.6.8", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.8.tgz", + "integrity": "sha1-5zFTHKLt4n0YgiJCfaF4IdaP9Pw=", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, "glob": { "version": "7.1.1", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.1.tgz", @@ -1883,9 +1922,9 @@ "integrity": "sha1-tPg3BEFqytiZiMmxVjXUfgO5NEo=" }, "regenerator-runtime": { - "version": "0.10.5", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.10.5.tgz", - "integrity": "sha1-M2w+/BIgrc7dosn6tntaeVWjNlg=", + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.0.tgz", + "integrity": "sha512-/aA0kLeRb5N9K0d4fw7ooEbI+xDe+DKD499EQqygGqeS8N3xto15p09uY2xj7ixP81sNPXvRLnAQIqdVStgb1A==", "dev": true }, "repeat-string": { @@ -1972,9 +2011,9 @@ } }, "rxjs": { - "version": "5.4.2", - "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-5.4.2.tgz", - "integrity": "sha1-KjI2/L8D31e64G/Wly/ZnlwI/Pc=", + "version": "5.4.3", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-5.4.3.tgz", + "integrity": "sha512-fSNi+y+P9ss+EZuV0GcIIqPUK07DEaMRUtLJvdcvMyFjc9dizuDjere+A4V7JrLGnm9iCc+nagV/4QdMTkqC4A==", "dev": true, "requires": { "symbol-observable": "1.0.4" @@ -2072,18 +2111,18 @@ } }, "source-map": { - "version": "0.5.6", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.6.tgz", - "integrity": "sha1-dc449SvwczxafwwRjYEzSiu19BI=", + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", "dev": true }, "source-map-support": { - "version": "0.4.15", - "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.4.15.tgz", - "integrity": "sha1-AyAt9lwG0r2MfsI2KhkwVv7407E=", + "version": "0.4.16", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.4.16.tgz", + "integrity": "sha512-A6vlydY7H/ljr4L2UOhDSajQdZQ6dMD7cLH0pzwcmwLyc9u8PNI4WGtnfDDzX7uzGL6c/T+ORL97Zlh+S4iOrg==", "dev": true, "requires": { - "source-map": "0.5.6" + "source-map": "0.5.7" } }, "spdx-correct": { @@ -2150,12 +2189,6 @@ "joi": "10.6.0" } }, - "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 - }, "string-width": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", @@ -2167,6 +2200,12 @@ "strip-ansi": "3.0.1" } }, + "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 + }, "stringstream": { "version": "0.0.5", "resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz", @@ -2206,7 +2245,7 @@ "content": "3.0.5", "hoek": "4.2.0", "pez": "2.1.5", - "wreck": "12.2.2" + "wreck": "12.2.3" } }, "superagent": { @@ -2243,6 +2282,15 @@ "delayed-stream": "0.0.5" } }, + "debug": { + "version": "2.6.8", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.8.tgz", + "integrity": "sha1-5zFTHKLt4n0YgiJCfaF4IdaP9Pw=", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, "delayed-stream": { "version": "0.0.5", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-0.0.5.tgz", @@ -2338,12 +2386,12 @@ "dev": true, "requires": { "arrify": "1.0.1", - "chalk": "2.0.1", + "chalk": "2.1.0", "diff": "3.2.0", "make-error": "1.3.0", "minimist": "1.2.0", "mkdirp": "0.5.1", - "source-map-support": "0.4.15", + "source-map-support": "0.4.16", "tsconfig": "6.0.0", "v8flags": "3.0.0", "yn": "2.0.0" @@ -2359,9 +2407,9 @@ } }, "chalk": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.0.1.tgz", - "integrity": "sha512-Mp+FXEI+FrwY/XYV45b2YD3E8i3HwnEAoFcM0qlZzq/RZ9RwWitt2Y/c7cqRAz70U7hfekqx6qNYthuKFO6K0g==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.1.0.tgz", + "integrity": "sha512-LUHGS/dge4ujbXMJrnihYMcL4AoOweGnw9Tp3kQuqy1Kx5c1qKjqvMJZ6nVJPMWJtKCTN72ZogH3oeSO9g9rXQ==", "dev": true, "requires": { "ansi-styles": "3.2.0", @@ -2411,12 +2459,12 @@ "dev": true }, "tslint": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/tslint/-/tslint-5.5.0.tgz", - "integrity": "sha1-EOjas+MGH6YelELozuOYKs8gpqo=", + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/tslint/-/tslint-5.7.0.tgz", + "integrity": "sha1-wl4NDJL6EgHCvDDoROCOaCtPNVI=", "dev": true, "requires": { - "babel-code-frame": "6.22.0", + "babel-code-frame": "6.26.0", "colors": "1.1.2", "commander": "2.11.0", "diff": "3.2.0", @@ -2425,13 +2473,13 @@ "resolve": "1.4.0", "semver": "5.4.1", "tslib": "1.7.1", - "tsutils": "2.8.0" + "tsutils": "2.8.1" } }, "tsutils": { - "version": "2.8.0", - "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.8.0.tgz", - "integrity": "sha1-AWAXNymzvxOGKN0UoVN+AIUdgUo=", + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.8.1.tgz", + "integrity": "sha1-N3FATnyp8L7fXZGaR6SxiQpo7/8=", "dev": true, "requires": { "tslib": "1.7.1" @@ -2459,9 +2507,9 @@ } }, "typescript": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.4.2.tgz", - "integrity": "sha1-+DlfhdRZJ2BnyYiqQYN6j4KHCEQ=", + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.5.1.tgz", + "integrity": "sha1-znzJOto94ZR1zJ0X463qeu4YMqo=", "dev": true }, "uglify-js": { @@ -2471,7 +2519,7 @@ "dev": true, "optional": true, "requires": { - "source-map": "0.5.6", + "source-map": "0.5.7", "uglify-to-browserify": "1.0.2", "yargs": "3.10.0" } @@ -2596,6 +2644,16 @@ "nan": "2.6.2", "typedarray-to-buffer": "3.1.2", "yaeti": "0.0.6" + }, + "dependencies": { + "debug": { + "version": "2.6.8", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.8.tgz", + "integrity": "sha1-5zFTHKLt4n0YgiJCfaF4IdaP9Pw=", + "requires": { + "ms": "2.0.0" + } + } } }, "which": { @@ -2643,9 +2701,9 @@ "dev": true }, "wreck": { - "version": "12.2.2", - "resolved": "https://registry.npmjs.org/wreck/-/wreck-12.2.2.tgz", - "integrity": "sha1-4hgj00w21nIATu+jR66MT2BQ49s=", + "version": "12.2.3", + "resolved": "https://registry.npmjs.org/wreck/-/wreck-12.2.3.tgz", + "integrity": "sha512-6gIqKsW7Qc5s6cxLImozB0jUZ0N0x3Xycc8o4gMUzIINNOMGfmK1Fz532mrtrLS1XrLsfBxffNqkCj0UDJsigQ==", "requires": { "boom": "5.2.0", "hoek": "4.2.0" diff --git a/package.json b/package.json index aa1b371..6876faa 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@hapiness/core", - "version": "1.0.0-rc.6", + "version": "1.0.0-rc.7", "description": "Project to have a HapiJS (https://hapijs.com/) based framework to create easier NodeJS back-end with some awesome features", "main": "index.js", "types": "index.d.ts", @@ -72,12 +72,12 @@ }, "homepage": "https://github.com/hapinessjs/hapiness#readme", "dependencies": { - "@types/hapi": "^16.1.8", + "@types/hapi": "^16.1.9", "@types/hoek": "^4.1.3", - "@types/joi": "^10.4.0", - "@types/node": "^8.0.19", + "@types/joi": "^10.4.1", + "@types/node": "^8.0.25", "@types/websocket": "^0.0.34", - "debug": "^2.6.8", + "debug": "^3.0.1", "hapi": "^16.5.2", "reflect-metadata": "^0.1.10", "websocket": "^1.0.24" @@ -85,21 +85,21 @@ "devDependencies": { "@types/fs-extra": "^4.0.0", "coveralls": "^2.13.1", - "fs-extra": "^4.0.0", + "fs-extra": "^4.0.1", "istanbul": "^1.1.0-alpha.1", "mocha": "^3.5.0", "mocha-typescript": "^1.1.7", "rimraf": "^2.6.1", - "rxjs": "^5.4.2", + "rxjs": "^5.4.3", "ts-node": "^3.3.0", "tslint": "^5.5.0", - "typescript": "^2.4.2", + "typescript": "^2.5.1", "unit.js": "^2.0.0" }, "engines": { "node": ">=7.0.0" }, "peerDependencies": { - "rxjs": "^5.4.2" + "rxjs": "^5.4.3" } } diff --git a/yarn.lock b/yarn.lock index 5d88b9e..a5e5cb0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -18,7 +18,7 @@ dependencies: "@types/node" "*" -"@types/hapi@^16.1.8": +"@types/hapi@^16.1.9": version "16.1.9" resolved "https://registry.yarnpkg.com/@types/hapi/-/hapi-16.1.9.tgz#0748fa17dffdd59c97e6e2ef0c4343afc4261d64" dependencies: @@ -34,7 +34,7 @@ version "4.1.3" resolved "https://registry.yarnpkg.com/@types/hoek/-/hoek-4.1.3.tgz#d1982d48fb0d2a0e5d7e9d91838264d8e428d337" -"@types/joi@*", "@types/joi@^10.4.0": +"@types/joi@*", "@types/joi@^10.4.1": version "10.4.1" resolved "https://registry.yarnpkg.com/@types/joi/-/joi-10.4.1.tgz#30e987649cede8d2a78829489857e969a81e1e99" @@ -48,9 +48,9 @@ dependencies: "@types/mime-db" "*" -"@types/node@*", "@types/node@^8.0.19": - version "8.0.24" - resolved "https://registry.yarnpkg.com/@types/node/-/node-8.0.24.tgz#06c580084d9add1fb40c1510ef0b448961246fb1" +"@types/node@*", "@types/node@^8.0.25": + version "8.0.25" + resolved "https://registry.yarnpkg.com/@types/node/-/node-8.0.25.tgz#66ecaf4df93f5281b48427ee96fbcdfc4f0cdce1" "@types/podium@*": version "1.0.0" @@ -68,7 +68,11 @@ dependencies: "@types/node" "*" -abbrev@1, abbrev@1.0.x: +abbrev@1: + version "1.1.0" + resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.1.0.tgz#d0554c2256636e2f56e7c2e5ad183f859428d81f" + +abbrev@1.0.x: version "1.0.9" resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.0.9.tgz#91b4792588a7738c25f35dd6f63752a2f8776135" @@ -456,6 +460,12 @@ debug@2, debug@2.6.8, debug@^2.2.0, debug@^2.6.3, debug@^2.6.8: dependencies: ms "2.0.0" +debug@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/debug/-/debug-3.0.1.tgz#0564c612b521dc92d9f2988f0549e34f9c98db64" + dependencies: + ms "2.0.0" + decamelize@^1.0.0, decamelize@^1.1.1: version "1.2.0" resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" @@ -572,7 +582,7 @@ formidable@1.0.14: version "1.0.14" resolved "https://registry.yarnpkg.com/formidable/-/formidable-1.0.14.tgz#2b3f4c411cbb5fdd695c44843e2a23514a43231a" -fs-extra@^4.0.0: +fs-extra@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-4.0.1.tgz#7fc0c6c8957f983f57f306a24e5b9ddd8d0dd880" dependencies: @@ -832,8 +842,8 @@ isstream@~0.1.2: resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a" istanbul-api@^1.1.0-alpha: - version "1.1.12" - resolved "https://registry.yarnpkg.com/istanbul-api/-/istanbul-api-1.1.12.tgz#92d67e9d8f9ea87349a64a70ddf5a7a8cdf97f21" + version "1.1.13" + resolved "https://registry.yarnpkg.com/istanbul-api/-/istanbul-api-1.1.13.tgz#7197f64413600ebdfec6347a2dc3d4e03f97ed5a" dependencies: async "^2.1.4" fileset "^2.0.2" @@ -842,7 +852,7 @@ istanbul-api@^1.1.0-alpha: istanbul-lib-instrument "^1.7.5" istanbul-lib-report "^1.1.1" istanbul-lib-source-maps "^1.2.1" - istanbul-reports "^1.1.1" + istanbul-reports "^1.1.2" js-yaml "^3.7.0" mkdirp "^0.5.1" once "^1.4.0" @@ -888,9 +898,9 @@ istanbul-lib-source-maps@^1.2.1: rimraf "^2.6.1" source-map "^0.5.3" -istanbul-reports@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/istanbul-reports/-/istanbul-reports-1.1.1.tgz#042be5c89e175bc3f86523caab29c014e77fee4e" +istanbul-reports@^1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/istanbul-reports/-/istanbul-reports-1.1.2.tgz#0fb2e3f6aa9922bd3ce45d05d8ab4d5e8e07bd4f" dependencies: handlebars "^4.0.3" @@ -924,14 +934,14 @@ 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-yaml@3.6.1, js-yaml@3.x: +js-yaml@3.6.1: version "3.6.1" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.6.1.tgz#6e5fe67d8b205ce4d22fad05b7781e8dadcc4b30" dependencies: argparse "^1.0.7" esprima "^2.6.0" -js-yaml@^3.7.0: +js-yaml@3.x, js-yaml@^3.7.0: version "3.9.1" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.9.1.tgz#08775cebdfdd359209f0d2acd383c8f86a6904a0" dependencies: @@ -1096,7 +1106,11 @@ methods@1.x: version "1.1.2" resolved "https://registry.yarnpkg.com/methods/-/methods-1.1.2.tgz#5529a4d67654134edcc5266656835b0f851afcee" -mime-db@1.x.x, mime-db@~1.29.0: +mime-db@1.x.x: + version "1.30.0" + resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.30.0.tgz#74c643da2dd9d6a45399963465b26d5ca7d71f01" + +mime-db@~1.29.0: version "1.29.0" resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.29.0.tgz#48d26d235589651704ac5916ca06001914266878" @@ -1123,7 +1137,7 @@ minimatch@^3.0.2, minimatch@^3.0.3, minimatch@^3.0.4: dependencies: brace-expansion "^1.1.7" -minimist@0.0.8, minimist@~0.0.1: +minimist@0.0.8: version "0.0.8" resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" @@ -1131,6 +1145,10 @@ minimist@1.2.0, minimist@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" +minimist@~0.0.1: + version "0.0.10" + resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.10.tgz#de3f98543dbf96082be48ad1a0c7cda836301dcf" + mkdirp@0.5.1, mkdirp@0.5.x, mkdirp@^0.5.1: version "0.5.1" resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" @@ -1396,16 +1414,20 @@ rimraf@^2.6.1: dependencies: glob "^7.0.5" -rxjs@^5.4.2: +rxjs@^5.4.3: version "5.4.3" resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-5.4.3.tgz#0758cddee6033d68e0fd53676f0f3596ce3d483f" dependencies: symbol-observable "^1.0.1" -samsam@1.1.2, samsam@~1.1: +samsam@1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/samsam/-/samsam-1.1.2.tgz#bec11fdc83a9fda063401210e40176c3024d1567" +samsam@~1.1: + version "1.1.3" + resolved "https://registry.yarnpkg.com/samsam/-/samsam-1.1.3.tgz#9f5087419b4d091f232571e7fa52e90b0f552621" + "semver@2 || 3 || 4 || 5", semver@^5.3.0: version "5.4.1" resolved "https://registry.yarnpkg.com/semver/-/semver-5.4.1.tgz#e059c09d8571f0540823733433505d3a2f00b18e" @@ -1588,7 +1610,7 @@ superagent@~0.21.0: methods "1.x" superagent "~0.21.0" -supports-color@3.1.2, supports-color@^3.1.2: +supports-color@3.1.2: version "3.1.2" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-3.1.2.tgz#72a262894d9d408b956ca05ff37b2ed8a6e2a2d5" dependencies: @@ -1598,6 +1620,12 @@ supports-color@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7" +supports-color@^3.1.2: + version "3.2.3" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-3.2.3.tgz#65ac0504b3954171d8a64946b2ae3cbb8a5f54f6" + dependencies: + has-flag "^1.0.0" + supports-color@^4.0.0: version "4.2.1" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-4.2.1.tgz#65a4bb2631e90e02420dba5554c375a4754bb836" @@ -1655,8 +1683,8 @@ tslib@^1.7.1: resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.7.1.tgz#bc8004164691923a79fe8378bbeb3da2017538ec" tslint@^5.5.0: - version "5.6.0" - resolved "https://registry.yarnpkg.com/tslint/-/tslint-5.6.0.tgz#088aa6c6026623338650b2900828ab3edf59f6cf" + version "5.7.0" + resolved "https://registry.yarnpkg.com/tslint/-/tslint-5.7.0.tgz#c25e0d0c92fa1201c2bc30e844e08e682b4f3552" dependencies: babel-code-frame "^6.22.0" colors "^1.1.2" @@ -1667,9 +1695,9 @@ tslint@^5.5.0: resolve "^1.3.2" semver "^5.3.0" tslib "^1.7.1" - tsutils "^2.7.1" + tsutils "^2.8.1" -tsutils@^2.7.1: +tsutils@^2.8.1: version "2.8.1" resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-2.8.1.tgz#3771404e7ca9f0bedf5d919a47a4b1890a68efff" dependencies: @@ -1689,7 +1717,7 @@ typedarray-to-buffer@^3.1.2: dependencies: is-typedarray "^1.0.0" -typescript@^2.4.2: +typescript@^2.5.1: version "2.5.1" resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.5.1.tgz#ce7cc93ada3de19475cc9d17e3adea7aee1832aa" From 53db8d0351a4448d3588cc82fdc0281b537054c6 Mon Sep 17 00:00:00 2001 From: njl07 Date: Mon, 28 Aug 2017 18:34:28 +0200 Subject: [PATCH 17/19] fix(import): Delete obsolete import --- src/extensions/socket-server/extension.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/extensions/socket-server/extension.ts b/src/extensions/socket-server/extension.ts index 6ffed78..f517550 100644 --- a/src/extensions/socket-server/extension.ts +++ b/src/extensions/socket-server/extension.ts @@ -1,6 +1,5 @@ import { CoreModule, Extension, ExtensionWithConfig, OnExtensionLoad } from '../../core/interfaces'; import { Observable } from 'rxjs/Observable'; -import { server } from 'websocket'; import { WebSocketServer } from './server'; export interface SocketConfig { From 079af4e305f3a472d106d351444db13cfb7a8af9 Mon Sep 17 00:00:00 2001 From: njl07 Date: Mon, 28 Aug 2017 18:34:45 +0200 Subject: [PATCH 18/19] doc(readme): Update readme --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index 5c069f5..c0ff2f3 100644 --- a/README.md +++ b/README.md @@ -115,6 +115,13 @@ To set up your development environment: [Back to top](#table-of-contents) ## Change History +* v1.0.0-rc.7 (2017-08-28) + * Code refactoring with only functional programming + * Improve errors management + * Allow HTTPS and WSS connections + * Add service for HTTP and WS extension to use it in DI + * Latest packages' versions + * Documentation * v1.0.0-rc.6 (2017-07-16) * DI/req performance issue temp. fix * v1.0.0-rc.5 (2017-07-11) From 6a2f0340cc0fae1c16434bb4ca1ca2e8fb80a752 Mon Sep 17 00:00:00 2001 From: njl07 Date: Mon, 28 Aug 2017 18:38:56 +0200 Subject: [PATCH 19/19] upgrade(version): Latest node version --- .nvmrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.nvmrc b/.nvmrc index d578315..9da0a09 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -8.1.3 \ No newline at end of file +8.4.0 \ No newline at end of file