diff --git a/.gitignore b/.gitignore index 9622adaf..293c20b9 100644 --- a/.gitignore +++ b/.gitignore @@ -130,3 +130,9 @@ Temporary Items # Project custom ignored file dist +builds +.bin +.terraform +*.plan +*.tfstate.d +*.credentials.json diff --git a/README.md b/README.md index 7efb3835..9133a60d 100644 --- a/README.md +++ b/README.md @@ -17,8 +17,10 @@ [![Coverage Status](https://coveralls.io/repos/nfroidure/whook/badge.svg?branch=master)](https://coveralls.io/r/nfroidure/whook?branch=master) Why write code when you have an OpenAPI definition? + [Check this deck](https://slides.com/nfroidure/introducing-whook) + for a complete introduction to Whook's principles! -# Summary +## Summary Whook eats your documentation and provide you with a performant router that take care of running the right @@ -28,7 +30,7 @@ By using the OpenAPI standard and the dependency injection pattern, Whook provides a convenient, highly modular and easily testable back end framework. -# Quickstart +## Quickstart To start a new Whook project: @@ -44,21 +46,12 @@ DRY_RUN=1 npm run start npm t ``` - -**Work in progress:** Despite I use it in production already, - the Whook's API may change. - -Using it right now, will imply making changes when the next - major release will happen. If you would like to get involved - in its early development, feel free to add issues / comments - or to improve the code. - -# Usage +## Usage The documentation and a tutorial are still to be written but the code is easy to read so let's dive in in the meanwhile. -# Principles +## Principles This projects aims to make creating well documented and highly customizable REST APIs a breeze. It is the final outcome of my experience [building REST APIs with NodeJS](https://insertafter.com/en/blog/http_rest_apis_with_nodejs.html). @@ -100,7 +93,7 @@ And that's it, you have your REST API. We have You may add global wrappers to change every handlers input/output on the fly or add a local wrapper specifically to one of a few handlers. -# Contributing +## Contributing Clone this project's repository and run: @@ -115,7 +108,7 @@ The repository is based on LernaJS that allows to host several NPM Install those [VSCode extensions](https://insertafter.com/en/blog/my_vscode_configuration.html) to get a smooth developer experience. -# Publishing +## Publishing ```sh NODE_ENV=cli npm run lerna -- publish diff --git a/package-lock.json b/package-lock.json index 20bc6ac9..6fa7ea57 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1161,9 +1161,9 @@ } }, "@octokit/endpoint": { - "version": "5.5.3", - "resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-5.5.3.tgz", - "integrity": "sha512-EzKwkwcxeegYYah5ukEeAI/gYRLv2Y9U5PpIsseGSFDk+G3RbipQGBs8GuYS1TLCtQaqoO66+aQGtITPalxsNQ==", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-6.0.0.tgz", + "integrity": "sha512-3nx+MEYoZeD0uJ+7F/gvELLvQJzLXhep2Az0bBSXagbApDvDW0LWwpnAIY/hb0Jwe17A0fJdz0O12dPh05cj7A==", "dev": true, "requires": { "@octokit/types": "^2.0.0", @@ -1229,13 +1229,13 @@ } }, "@octokit/request": { - "version": "5.3.2", - "resolved": "https://registry.npmjs.org/@octokit/request/-/request-5.3.2.tgz", - "integrity": "sha512-7NPJpg19wVQy1cs2xqXjjRq/RmtSomja/VSWnptfYwuBxLdbYh2UjhGi0Wx7B1v5Iw5GKhfFDQL7jM7SSp7K2g==", + "version": "5.3.4", + "resolved": "https://registry.npmjs.org/@octokit/request/-/request-5.3.4.tgz", + "integrity": "sha512-qyj8G8BxQyXjt9Xu6NvfvOr1E0l35lsXtwm3SopsYg/JWXjlsnwqLc8rsD2OLguEL/JjLfBvrXr4az7z8Lch2A==", "dev": true, "requires": { - "@octokit/endpoint": "^5.5.0", - "@octokit/request-error": "^1.0.1", + "@octokit/endpoint": "^6.0.0", + "@octokit/request-error": "^2.0.0", "@octokit/types": "^2.0.0", "deprecation": "^2.0.0", "is-plain-object": "^3.0.0", @@ -1244,6 +1244,17 @@ "universal-user-agent": "^5.0.0" }, "dependencies": { + "@octokit/request-error": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-2.0.0.tgz", + "integrity": "sha512-rtYicB4Absc60rUv74Rjpzek84UbVHGHJRu4fNVlZ1mCcyUPPuzFfG9Rn6sjHrd95DEsmjSt1Axlc699ZlbDkw==", + "dev": true, + "requires": { + "@octokit/types": "^2.0.0", + "deprecation": "^2.0.0", + "once": "^1.4.0" + } + }, "is-plain-object": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-3.0.0.tgz", @@ -1306,9 +1317,9 @@ } }, "@octokit/types": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/@octokit/types/-/types-2.5.0.tgz", - "integrity": "sha512-KEnLwOfdXzxPNL34fj508bhi9Z9cStyN7qY1kOfVahmqtAfrWw6Oq3P4R+dtsg0lYtZdWBpUrS/Ixmd5YILSww==", + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-2.5.1.tgz", + "integrity": "sha512-q4Wr7RexkPRrkQpXzUYF5Fj/14Mr65RyOHj6B9d/sQACpqGcStkHZj4qMEtlMY5SnD/69jlL9ItGPbDM0dR/dA==", "dev": true, "requires": { "@types/node": ">= 8" @@ -1338,9 +1349,9 @@ "dev": true }, "@types/node": { - "version": "13.9.3", - "resolved": "https://registry.npmjs.org/@types/node/-/node-13.9.3.tgz", - "integrity": "sha512-01s+ac4qerwd6RHD+mVbOEsraDHSgUaefQlEdBbUolnQFjKwCr7luvAlEwW1RFojh67u0z4OUTjPn9LEl4zIkA==", + "version": "13.9.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-13.9.5.tgz", + "integrity": "sha512-hkzMMD3xu6BrJpGVLeQ3htQQNAcOrJjX7WFmtK8zWQpz2UJf13LCFF2ALA7c9OVdvc2vQJeDdjfR35M0sBCxvw==", "dev": true }, "@zkochan/cmd-shim": { @@ -1779,9 +1790,9 @@ "dev": true }, "cacache": { - "version": "12.0.3", - "resolved": "https://registry.npmjs.org/cacache/-/cacache-12.0.3.tgz", - "integrity": "sha512-kqdmfXEGFepesTuROHMs3MpFLWrPkSSpRqOw80RCflZXy/khxaArvFrQ7uJxSUduzAufc6G0g1VUCOZXxWavPw==", + "version": "12.0.4", + "resolved": "https://registry.npmjs.org/cacache/-/cacache-12.0.4.tgz", + "integrity": "sha512-a0tMB40oefvuInr4Cwb3GerbL9xTj1D5yg0T5xrjGCGyfvbxseIXX7BAO/u/hIXdafzOI5JC3wDwHyf24buOAQ==", "dev": true, "requires": { "bluebird": "^3.5.5", @@ -2914,9 +2925,9 @@ } }, "es-abstract": { - "version": "1.17.4", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.4.tgz", - "integrity": "sha512-Ae3um/gb8F0mui/jPL+QiqmglkUsaQf7FwBEHYIFkztkneosu9imhqHpBzQ3h1vit8t5iQ74t6PEVvphBZiuiQ==", + "version": "1.17.5", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.5.tgz", + "integrity": "sha512-BR9auzDbySxOcfog0tLECW8l28eRGpDpU3Dm3Hp4q/N+VtLTmyj4EUN088XZWQDW/hzj6sYRDXeOFsaAODKvpg==", "dev": true, "requires": { "es-to-primitive": "^1.2.1", @@ -3194,9 +3205,9 @@ "dev": true }, "figgy-pudding": { - "version": "3.5.1", - "resolved": "https://registry.npmjs.org/figgy-pudding/-/figgy-pudding-3.5.1.tgz", - "integrity": "sha512-vNKxJHTEKNThjfrdJwHc7brvM6eVevuO5nTj6ez8ZQ1qbXTvGthucRF7S4vf2cr71QVnT70V34v0S1DyQsti0w==", + "version": "3.5.2", + "resolved": "https://registry.npmjs.org/figgy-pudding/-/figgy-pudding-3.5.2.tgz", + "integrity": "sha512-0btnI/H8f2pavGMN8w40mlSKOfTK2SVJmBfBeVIj3kNw0swwgzyRq0d5TJVOwodFmtvpPeWPN/MCcfuWF0Ezbw==", "dev": true }, "figures": { @@ -5290,9 +5301,9 @@ } }, "mkdirp": { - "version": "0.5.3", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.3.tgz", - "integrity": "sha512-P+2gwrFqx8lhew375MQHHeTlY8AuOJSrGf0R5ddkEndUkmwpgUob/vQuBD1V22/Cw1/lJr4x+EjllSezBThzBg==", + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.4.tgz", + "integrity": "sha512-iG9AK/dJLtJ0XNgTuDbSyNS3zECqDlAhnQW4CsNxBG3LQJBbHmRX1egw39DmtOdCAqY+dKXV+sgPgilNWUKMVw==", "dev": true, "requires": { "minimist": "^1.2.5" @@ -5408,9 +5419,9 @@ "dev": true }, "node-fetch-npm": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/node-fetch-npm/-/node-fetch-npm-2.0.3.tgz", - "integrity": "sha512-DgwoKEsqLnFZtk3ap7GWBHcHwnUhsNmQqEDcdjfQ8GofLEFJ081NAd4Uin3R7RFZBWVJCwHISw1oaEqPgSLloA==", + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/node-fetch-npm/-/node-fetch-npm-2.0.4.tgz", + "integrity": "sha512-iOuIQDWDyjhv9qSDrj9aq/klt6F9z1p2otB3AV7v3zBDcL/x+OfGsvGQZZCcMZbUf4Ujw1xGNQkjvGnVT22cKg==", "dev": true, "requires": { "encoding": "^0.1.11", @@ -5491,9 +5502,9 @@ } }, "npm-lifecycle": { - "version": "3.1.4", - "resolved": "https://registry.npmjs.org/npm-lifecycle/-/npm-lifecycle-3.1.4.tgz", - "integrity": "sha512-tgs1PaucZwkxECGKhC/stbEgFyc3TGh2TJcg2CDr6jbvQRdteHNhmMeljRzpe4wgFAXQADoy1cSqqi7mtiAa5A==", + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/npm-lifecycle/-/npm-lifecycle-3.1.5.tgz", + "integrity": "sha512-lDLVkjfZmvmfvpvBzA4vzee9cn+Me4orq0QF8glbswJVEbIcSNWib7qGOffolysc3teCqbbPZZkzbr3GQZTL1g==", "dev": true, "requires": { "byline": "^5.0.0", @@ -6123,9 +6134,9 @@ } }, "psl": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/psl/-/psl-1.7.0.tgz", - "integrity": "sha512-5NsSEDv8zY70ScRnOTn7bK7eanl2MvFrOrS/R6x+dBt5g1ghnj9Zv90kO8GwT8gxcu2ANyFprnFYB85IogIJOQ==", + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz", + "integrity": "sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ==", "dev": true }, "pump": { @@ -6583,9 +6594,9 @@ } }, "signal-exit": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", - "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz", + "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==", "dev": true }, "slash": { @@ -7267,9 +7278,9 @@ "dev": true }, "uglify-js": { - "version": "3.8.0", - "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.8.0.tgz", - "integrity": "sha512-ugNSTT8ierCsDHso2jkBHXYrU8Y5/fY2ZUprfrJUiD7YpuFvV4jODLFmb3h4btQjqr5Nh4TX4XtgDfCU1WdioQ==", + "version": "3.8.1", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.8.1.tgz", + "integrity": "sha512-W7KxyzeaQmZvUFbGj4+YFshhVrMBGSg2IbcYAjGWGvx8DHvJMclbTDMpffdxFUGPBHjIytk7KJUR/KUXstUGDw==", "dev": true, "optional": true, "requires": { diff --git a/package.json b/package.json index 5d9fb98d..70096d65 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,13 @@ ], "data": { "ignore": [ - "dist" + "dist", + "builds", + ".bin", + ".terraform", + "*.plan", + "*.tfstate.d", + "*.credentials.json" ], "rootPackage": true } diff --git a/packages/whook-aws-lambda/package.json b/packages/whook-aws-lambda/package.json index 01d59c9a..6b58ec31 100644 --- a/packages/whook-aws-lambda/package.json +++ b/packages/whook-aws-lambda/package.json @@ -52,6 +52,7 @@ "@whook/http-router": "^3.1.3", "@whook/whook": "^3.1.3", "ajv": "^6.11.0", + "bytes": "^3.1.0", "camel-case": "^4.1.1", "common-services": "^7.0.0", "cpr": "3.0.1", @@ -60,8 +61,9 @@ "memory-fs": "0.5.0", "openapi-types": "^1.3.5", "qs": "^6.9.1", - "strict-qs": "^6.0.1", - "yerror": "^5.0.0" + "strict-qs": "^6.0.2", + "yerror": "^5.0.0", + "yhttperror": "^5.0.0" }, "devDependencies": { "@babel/cli": "^7.8.4", diff --git a/packages/whook-aws-lambda/src/index.ts b/packages/whook-aws-lambda/src/index.ts index ea6f032f..3978f9f8 100644 --- a/packages/whook-aws-lambda/src/index.ts +++ b/packages/whook-aws-lambda/src/index.ts @@ -14,7 +14,6 @@ import initCompiler, { DEFAULT_COMPILER_OPTIONS, } from './services/compiler'; import initBuildAutoloader from './services/_autoload'; -import initBuildConstants from './services/BUILD_CONSTANTS'; import Knifecycle, { SPECIAL_PROPS, constant, Autoloader } from 'knifecycle'; import { WhookAPIOperationAddition } from '@whook/whook'; import { @@ -93,8 +92,6 @@ const BUILD_DEFINITIONS: { }, }; -export { initBuildConstants }; - export async function prepareBuildEnvironment( $: Knifecycle = new Knifecycle(), ): Promise { diff --git a/packages/whook-aws-lambda/src/services/QUERY_PARSER.test.ts b/packages/whook-aws-lambda/src/services/QUERY_PARSER.test.ts new file mode 100644 index 00000000..023b7578 --- /dev/null +++ b/packages/whook-aws-lambda/src/services/QUERY_PARSER.test.ts @@ -0,0 +1,85 @@ +import initQueryParser from './QUERY_PARSER'; +import YError from 'yerror'; + +describe('QUERY_PARSER', () => { + const definitions = [ + { + name: 'userId', + in: 'query' as const, + pattern: '^\\d$', + type: 'number' as const, + }, + { + name: 'userName', + in: 'query' as const, + type: 'string' as const, + }, + { + name: 'userIsCool', + in: 'query' as const, + type: 'boolean' as const, + }, + ]; + + test('should work', async () => { + const queryParser = await initQueryParser(); + + expect( + queryParser( + definitions, + '?userId=1&userName=popol&userIsCool=true&doNotExists=2', + ), + ).toMatchInlineSnapshot(` + Object { + "userId": 1, + "userIsCool": true, + "userName": "popol", + } + `); + }); + + describe('should fail', () => { + test('with bad number', async () => { + const queryParser = await initQueryParser(); + + try { + queryParser(definitions, '?userId=ee1&doNotExists=2'); + throw new YError('E_UNEXPECTED_SUCCESS'); + } catch (err) { + expect({ + code: err.code, + params: err.params, + }).toMatchInlineSnapshot(` + Object { + "code": "E_NON_REENTRANT_NUMBER", + "params": Array [ + "ee1", + "NaN", + ], + } + `); + } + }); + + test('with bad boolean', async () => { + const queryParser = await initQueryParser(); + + try { + queryParser(definitions, '?userIsCool=not_really&doNotExists=2'); + throw new YError('E_UNEXPECTED_SUCCESS'); + } catch (err) { + expect({ + code: err.code, + params: err.params, + }).toMatchInlineSnapshot(` + Object { + "code": "E_BAD_BOOLEAN", + "params": Array [ + "not_really", + ], + } + `); + } + }); + }); +}); diff --git a/packages/whook-aws-lambda/src/services/QUERY_PARSER.ts b/packages/whook-aws-lambda/src/services/QUERY_PARSER.ts index f0ae1ce6..1359a0ef 100644 --- a/packages/whook-aws-lambda/src/services/QUERY_PARSER.ts +++ b/packages/whook-aws-lambda/src/services/QUERY_PARSER.ts @@ -27,11 +27,13 @@ export default initializer( ); function castParameters(parameters, values) { + const endValues = {}; + (parameters || []).forEach(parameter => { - values[parameter.name] = castParameterValue( + endValues[parameter.name] = castParameterValue( parameter, values[parameter.name], ); }); - return values; + return endValues; } diff --git a/packages/whook-aws-lambda/src/services/_autoload.ts b/packages/whook-aws-lambda/src/services/_autoload.ts index b86a5eb0..24a4d441 100644 --- a/packages/whook-aws-lambda/src/services/_autoload.ts +++ b/packages/whook-aws-lambda/src/services/_autoload.ts @@ -1,4 +1,4 @@ -import { initAutoload, noop } from '@whook/whook'; +import { WhookBuildConstantsService, initAutoload, noop } from '@whook/whook'; import Knifecycle, { SPECIAL_PROPS, wrapInitializer, @@ -8,7 +8,6 @@ import Knifecycle, { } from 'knifecycle'; import YError from 'yerror'; import { flattenOpenAPI, getOpenAPIOperations } from '@whook/http-router'; -import { BuildConstants } from './BUILD_CONSTANTS'; import { LogService } from 'common-services'; /** @@ -35,7 +34,7 @@ export default alsoInject( $instance, log = noop, }: { - BUILD_CONSTANTS?: BuildConstants; + BUILD_CONSTANTS?: WhookBuildConstantsService; $injector: Injector; $instance: Knifecycle; log: LogService; diff --git a/packages/whook-aws-lambda/src/wrappers/awsConsumerLambda.ts b/packages/whook-aws-lambda/src/wrappers/awsConsumerLambda.ts index 9527e2f9..e74e31bb 100644 --- a/packages/whook-aws-lambda/src/wrappers/awsConsumerLambda.ts +++ b/packages/whook-aws-lambda/src/wrappers/awsConsumerLambda.ts @@ -1,6 +1,13 @@ import { reuseSpecialProps, alsoInject, ServiceInitializer } from 'knifecycle'; -import { noop, WhookOperation, APMService, WhookHandler } from '@whook/whook'; +import { + noop, + WhookOperation, + APMService, + WhookHandler, + identity, +} from '@whook/whook'; import YError from 'yerror'; +import YHTTPError from 'yhttperror'; import { TimeService, LogService } from 'common-services'; type ConsumerWrapperDependencies = { @@ -44,49 +51,58 @@ async function handleForAWSConsumerLambda( log, }: ConsumerWrapperDependencies, handler: WhookHandler, - event: any, + event: { Records: unknown[] }, context: unknown, callback: (err: Error, result?: any) => void, ) { const startTime = time(); - const parameters = { - body: event, - }; try { log('info', 'EVENT', JSON.stringify(event)); - const response = await handler(parameters, OPERATION); - const batchStats: any = {}; + const responses = await Promise.all( + event.Records.map(async (body, index) => { + try { + return await handler({ body }, OPERATION); + } catch (err) { + const castedError = YHTTPError.cast(err); + + log('debug', `💥 - Could not process the record at index ${index}!`); + log('debug-stack', err.stack); - if (response.body && response.body.length) { - const failures = response.body.filter( - ({ response }) => response.status >= 500, - ); + return { + status: castedError.httpCode, + body: { + code: castedError.code, + stack: 'test' === NODE_ENV ? castedError.stack : undefined, + params: castedError.params, + }, + }; + } + }), + ); + const batchStats: any = {}; + const failures = responses.filter(response => response.status >= 500); - batchStats.batchItems = response.body.length; - batchStats.batchSuccesses = response.body.length - failures.length; - batchStats.batchFailures = failures.length; - batchStats.batchStatuses = response.body.map( - ({ response }) => response.status, - ); - batchStats.batchErrorCodes = response.body.map( - ({ response }) => response.body && response.body.code, - ); - } + batchStats.batchItems = responses.length; + batchStats.batchSuccesses = responses.length - failures.length; + batchStats.batchFailures = failures.length; + batchStats.batchStatuses = responses.map(response => response.status); + batchStats.batchErrorCodes = responses + .map(response => response.body && response.body.code) + .filter(identity); apm('CONSUMER', { environment: NODE_ENV, triggerTime: startTime, lambdaName: OPERATION.operationId, - parameters, - type: 'success', + type: batchStats.batchFailures ? 'fail' : 'success', startTime, endTime: time(), ...batchStats, }); - callback(null, response); + callback(null, { status: 200 }); } catch (err) { const castedErr = YError.cast(err); @@ -94,7 +110,6 @@ async function handleForAWSConsumerLambda( environment: NODE_ENV, triggerTime: startTime, lambdaName: OPERATION.operationId, - parameters, type: 'error', stack: castedErr.stack, code: castedErr.code, diff --git a/packages/whook-aws-lambda/src/wrappers/awsHTTPLambda.ts b/packages/whook-aws-lambda/src/wrappers/awsHTTPLambda.ts index 9d2bf5ff..dce8aea1 100644 --- a/packages/whook-aws-lambda/src/wrappers/awsHTTPLambda.ts +++ b/packages/whook-aws-lambda/src/wrappers/awsHTTPLambda.ts @@ -8,6 +8,7 @@ import { } from '@whook/http-router'; import { reuseSpecialProps, alsoInject, ServiceInitializer } from 'knifecycle'; import Ajv from 'ajv'; +import bytes from 'bytes'; import HTTPError from 'yhttperror'; import { prepareParametersValidators, @@ -192,6 +193,7 @@ async function handleForAWSHTTPLambda( ) { const debugging = DEBUG_NODE_ENVS.includes(NODE_ENV); const startTime = time(); + const bufferLimit = bytes.parse(BUFFER_LIMIT); log( 'info', @@ -239,7 +241,7 @@ async function handleForAWSHTTPLambda( { DECODERS, PARSERS, - bufferLimit: BUFFER_LIMIT, + bufferLimit, }, operation, request.body, diff --git a/packages/whook-cli/package-lock.json b/packages/whook-cli/package-lock.json index e1134a80..8e20594d 100644 --- a/packages/whook-cli/package-lock.json +++ b/packages/whook-cli/package-lock.json @@ -313,9 +313,9 @@ "dev": true }, "psl": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/psl/-/psl-1.7.0.tgz", - "integrity": "sha512-5NsSEDv8zY70ScRnOTn7bK7eanl2MvFrOrS/R6x+dBt5g1ghnj9Zv90kO8GwT8gxcu2ANyFprnFYB85IogIJOQ==", + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz", + "integrity": "sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ==", "dev": true }, "punycode": { diff --git a/packages/whook-create/package-lock.json b/packages/whook-create/package-lock.json index 0e44f967..1d8f0244 100644 --- a/packages/whook-create/package-lock.json +++ b/packages/whook-create/package-lock.json @@ -430,9 +430,9 @@ "dev": true }, "mkdirp": { - "version": "0.5.3", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.3.tgz", - "integrity": "sha512-P+2gwrFqx8lhew375MQHHeTlY8AuOJSrGf0R5ddkEndUkmwpgUob/vQuBD1V22/Cw1/lJr4x+EjllSezBThzBg==", + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.4.tgz", + "integrity": "sha512-iG9AK/dJLtJ0XNgTuDbSyNS3zECqDlAhnQW4CsNxBG3LQJBbHmRX1egw39DmtOdCAqY+dKXV+sgPgilNWUKMVw==", "dev": true, "requires": { "minimist": "^1.2.5" @@ -678,9 +678,9 @@ "dev": true }, "uglify-js": { - "version": "3.8.0", - "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.8.0.tgz", - "integrity": "sha512-ugNSTT8ierCsDHso2jkBHXYrU8Y5/fY2ZUprfrJUiD7YpuFvV4jODLFmb3h4btQjqr5Nh4TX4XtgDfCU1WdioQ==", + "version": "3.8.1", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.8.1.tgz", + "integrity": "sha512-W7KxyzeaQmZvUFbGj4+YFshhVrMBGSg2IbcYAjGWGvx8DHvJMclbTDMpffdxFUGPBHjIytk7KJUR/KUXstUGDw==", "dev": true, "optional": true, "requires": { diff --git a/packages/whook-create/src/services/__snapshots__/createWhook.test.ts.snap b/packages/whook-create/src/services/__snapshots__/createWhook.test.ts.snap index 0c74ab6c..27e3e2ce 100644 --- a/packages/whook-create/src/services/__snapshots__/createWhook.test.ts.snap +++ b/packages/whook-create/src/services/__snapshots__/createWhook.test.ts.snap @@ -44,7 +44,7 @@ Object { "writeFileCalls": Array [ Array [ "/home/whoiam/projects/yolo/package.json", - "{\\"name\\":\\"super-project\\",\\"version\\":\\"0.0.0\\",\\"description\\":\\"A new Whook project\\",\\"keywords\\":[\\"whook\\",\\"knifecycle\\",\\"REST\\",\\"HTTP\\",\\"OpenAPI\\",\\"web\\",\\"service\\",\\"handler\\",\\"wrapper\\",\\"example\\"],\\"main\\":\\"dist/index.js\\",\\"types\\":\\"dist/index.d.ts\\",\\"scripts\\":{\\"compile\\":\\"babel --extensions '.ts,.js' src --out-dir=dist --source-maps=true\\",\\"cover\\":\\"npm run jest -- --coverage\\",\\"debug\\":\\"NODE_ENV=\${NODE_ENV:-development} DEV_MODE=1 DESTROY_SOCKETS=1 DEBUG=\${DEBUG:-whook} babel-node --extensions '.ts,.js' --inspect bin/dev\\",\\"dev\\":\\"NODE_ENV=\${NODE_ENV:-development} DEV_MODE=1 DESTROY_SOCKETS=1 babel-node --extensions '.ts,.js' bin/dev\\",\\"jest\\":\\"NODE_ENV=test jest\\",\\"lint\\":\\"eslint 'src/**/*.ts'\\",\\"precz\\":\\"npm run compile\\",\\"prettier\\":\\"prettier --write 'src/**/*.ts'\\",\\"preversion\\":\\"npm run compile\\",\\"start\\":\\"NODE_ENV=\${NODE_ENV:-development} node bin/start\\",\\"test\\":\\"npm run jest\\",\\"types\\":\\"rimraf -f 'dist/**/*.d.ts' && tsc --project . --declaration --emitDeclarationOnly --outDir dist\\",\\"whook\\":\\"NODE_ENV=\${NODE_ENV:-development} whook\\",\\"whook-dev\\":\\"PROJECT_SRC=\\\\\\"$PWD/src\\\\\\" NODE_ENV=\${NODE_ENV:-development} babel-node --extensions '.ts,.js' -- node_modules/@whook/cli/bin/whook.js\\"},\\"author\\":{\\"name\\":\\"Wayne Campbell\\",\\"email\\":\\"wayne@warner.com\\"},\\"license\\":\\"SEE LICENSE\\",\\"repository\\":{\\"type\\":\\"git\\",\\"url\\":\\"https://github.com/nfroidure/whook.git\\"},\\"bugs\\":{\\"url\\":\\"https://github.com/nfroidure/whook/issues\\"},\\"homepage\\":\\"https://github.com/nfroidure/whook\\",\\"dependencies\\":{\\"@whook/authorization\\":\\"\\",\\"@whook/cli\\":\\"\\",\\"@whook/cors\\":\\"\\",\\"@whook/http-router\\":\\"\\",\\"@whook/swagger-ui\\":\\"\\",\\"@whook/whook\\":\\"\\",\\"common-services\\":\\"^7.0.0\\",\\"ecstatic\\":\\"^4.1.2\\",\\"http-auth-utils\\":\\"^2.3.0\\",\\"knifecycle\\":\\"^9.0.0\\",\\"strict-qs\\":\\"^6.0.1\\",\\"yerror\\":\\"^5.0.0\\",\\"yhttperror\\":\\"^5.0.0\\"},\\"devDependencies\\":{\\"@babel/cli\\":\\"^7.8.4\\",\\"@babel/core\\":\\"^7.8.7\\",\\"@babel/node\\":\\"^7.2.2\\",\\"@babel/plugin-proposal-class-properties\\":\\"^7.8.3\\",\\"@babel/plugin-proposal-object-rest-spread\\":\\"^7.8.3\\",\\"@babel/preset-env\\":\\"^7.8.7\\",\\"@babel/preset-typescript\\":\\"^7.8.3\\",\\"@babel/register\\":\\"^7.8.6\\",\\"@types/jest\\":\\"^24.9.0\\",\\"@typescript-eslint/eslint-plugin\\":\\"^2.24.0\\",\\"@typescript-eslint/parser\\":\\"^2.24.0\\",\\"axios\\":\\"^0.19.0\\",\\"babel-eslint\\":\\"^10.1.0\\",\\"babel-plugin-knifecycle\\":\\"^1.2.0\\",\\"eslint\\":\\"^6.8.0\\",\\"eslint-plugin-prettier\\":\\"^3.1.2\\",\\"jest\\":\\"^25.1.0\\",\\"jsdoc-to-markdown\\":\\"^4.0.1\\",\\"openapi-schema-validator\\":\\"^3.0.3\\",\\"prettier\\":\\"^1.19.1\\",\\"rimraf\\":\\"^3.0.2\\",\\"typescript\\":\\"^3.8.3\\"},\\"contributors\\":[],\\"engines\\":{\\"node\\":\\">=10.19.0\\"},\\"files\\":[\\"bin\\",\\"dist\\",\\"src\\",\\"LICENSE\\",\\"README.md\\",\\"CHANGELOG.md\\"],\\"eslintConfig\\":{\\"extends\\":\\"eslint:recommended\\",\\"parserOptions\\":{\\"ecmaVersion\\":2018,\\"sourceType\\":\\"module\\",\\"modules\\":true},\\"env\\":{\\"es6\\":true,\\"node\\":true,\\"jest\\":true,\\"mocha\\":true},\\"plugins\\":[\\"prettier\\"],\\"rules\\":{\\"prettier/prettier\\":\\"error\\"},\\"parser\\":\\"@typescript-eslint/parser\\",\\"ignorePatterns\\":[\\"*.d.ts\\"],\\"overrides\\":[{\\"files\\":[\\"*.ts\\"],\\"rules\\":{\\"no-unused-vars\\":[1,{\\"args\\":\\"none\\"}]}}]},\\"prettier\\":{\\"semi\\":true,\\"printWidth\\":80,\\"singleQuote\\":true,\\"trailingComma\\":\\"all\\",\\"proseWrap\\":\\"always\\"},\\"babel\\":{\\"presets\\":[\\"@babel/typescript\\",[\\"@babel/env\\",{\\"targets\\":{\\"node\\":\\"10.19.0\\"}}]],\\"plugins\\":[\\"@babel/proposal-class-properties\\",\\"@babel/plugin-proposal-object-rest-spread\\",\\"babel-plugin-knifecycle\\"]},\\"jest\\":{\\"coverageReporters\\":[\\"lcov\\",\\"html\\"],\\"testPathIgnorePatterns\\":[\\"/node_modules/\\"],\\"roots\\":[\\"/src\\"],\\"testEnvironment\\":\\"node\\"}}", + "{\\"name\\":\\"super-project\\",\\"version\\":\\"0.0.0\\",\\"description\\":\\"A new Whook project\\",\\"keywords\\":[\\"whook\\",\\"knifecycle\\",\\"REST\\",\\"HTTP\\",\\"OpenAPI\\",\\"web\\",\\"service\\",\\"handler\\",\\"wrapper\\",\\"example\\"],\\"main\\":\\"dist/index.js\\",\\"types\\":\\"dist/index.d.ts\\",\\"scripts\\":{\\"build\\":\\"npm run compile && NODE_ENV=\${NODE_ENV:-development} node bin/build\\",\\"compile\\":\\"babel --extensions '.ts,.js' src --out-dir=dist --source-maps=true\\",\\"cover\\":\\"npm run jest -- --coverage\\",\\"debug\\":\\"NODE_ENV=\${NODE_ENV:-development} DEV_MODE=1 DESTROY_SOCKETS=1 DEBUG=\${DEBUG:-whook} babel-node --extensions '.ts,.js' --inspect bin/dev\\",\\"dev\\":\\"NODE_ENV=\${NODE_ENV:-development} DEV_MODE=1 DESTROY_SOCKETS=1 babel-node --extensions '.ts,.js' bin/dev\\",\\"jest\\":\\"NODE_ENV=test jest\\",\\"lint\\":\\"eslint 'src/**/*.ts'\\",\\"precz\\":\\"npm run compile\\",\\"prettier\\":\\"prettier --write 'src/**/*.ts'\\",\\"preversion\\":\\"npm run compile\\",\\"start\\":\\"NODE_ENV=\${NODE_ENV:-development} node bin/start\\",\\"test\\":\\"npm run jest\\",\\"types\\":\\"rimraf -f 'dist/**/*.d.ts' && tsc --project . --declaration --emitDeclarationOnly --outDir dist\\",\\"whook\\":\\"NODE_ENV=\${NODE_ENV:-development} whook\\",\\"whook-dev\\":\\"PROJECT_SRC=\\\\\\"$PWD/src\\\\\\" NODE_ENV=\${NODE_ENV:-development} babel-node --extensions '.ts,.js' -- node_modules/@whook/cli/bin/whook.js\\"},\\"author\\":{\\"name\\":\\"Wayne Campbell\\",\\"email\\":\\"wayne@warner.com\\"},\\"license\\":\\"SEE LICENSE\\",\\"repository\\":{\\"type\\":\\"git\\",\\"url\\":\\"https://github.com/nfroidure/whook.git\\"},\\"bugs\\":{\\"url\\":\\"https://github.com/nfroidure/whook/issues\\"},\\"homepage\\":\\"https://github.com/nfroidure/whook\\",\\"dependencies\\":{\\"@whook/authorization\\":\\"\\",\\"@whook/cli\\":\\"\\",\\"@whook/cors\\":\\"\\",\\"@whook/http-router\\":\\"\\",\\"@whook/http-transaction\\":\\"^3.1.3\\",\\"@whook/swagger-ui\\":\\"\\",\\"@whook/whook\\":\\"\\",\\"common-services\\":\\"^7.0.0\\",\\"ecstatic\\":\\"^4.1.2\\",\\"http-auth-utils\\":\\"^2.3.0\\",\\"knifecycle\\":\\"^9.0.0\\",\\"strict-qs\\":\\"^6.0.2\\",\\"yerror\\":\\"^5.0.0\\",\\"yhttperror\\":\\"^5.0.0\\"},\\"devDependencies\\":{\\"@babel/cli\\":\\"^7.8.4\\",\\"@babel/core\\":\\"^7.8.7\\",\\"@babel/node\\":\\"^7.2.2\\",\\"@babel/plugin-proposal-class-properties\\":\\"^7.8.3\\",\\"@babel/plugin-proposal-object-rest-spread\\":\\"^7.8.3\\",\\"@babel/preset-env\\":\\"^7.8.7\\",\\"@babel/preset-typescript\\":\\"^7.8.3\\",\\"@babel/register\\":\\"^7.8.6\\",\\"@types/jest\\":\\"^24.9.0\\",\\"@typescript-eslint/eslint-plugin\\":\\"^2.24.0\\",\\"@typescript-eslint/parser\\":\\"^2.24.0\\",\\"axios\\":\\"^0.19.0\\",\\"babel-eslint\\":\\"^10.1.0\\",\\"babel-plugin-knifecycle\\":\\"^1.2.0\\",\\"eslint\\":\\"^6.8.0\\",\\"eslint-plugin-prettier\\":\\"^3.1.2\\",\\"jest\\":\\"^25.1.0\\",\\"jsdoc-to-markdown\\":\\"^4.0.1\\",\\"openapi-schema-validator\\":\\"^3.0.3\\",\\"prettier\\":\\"^1.19.1\\",\\"rimraf\\":\\"^3.0.2\\",\\"typescript\\":\\"^3.8.3\\"},\\"contributors\\":[],\\"engines\\":{\\"node\\":\\">=10.19.0\\"},\\"files\\":[\\"bin\\",\\"dist\\",\\"src\\",\\"LICENSE\\",\\"README.md\\",\\"CHANGELOG.md\\"],\\"eslintConfig\\":{\\"extends\\":\\"eslint:recommended\\",\\"parserOptions\\":{\\"ecmaVersion\\":2018,\\"sourceType\\":\\"module\\",\\"modules\\":true},\\"env\\":{\\"es6\\":true,\\"node\\":true,\\"jest\\":true,\\"mocha\\":true},\\"plugins\\":[\\"prettier\\"],\\"rules\\":{\\"prettier/prettier\\":\\"error\\"},\\"parser\\":\\"@typescript-eslint/parser\\",\\"ignorePatterns\\":[\\"*.d.ts\\"],\\"overrides\\":[{\\"files\\":[\\"*.ts\\"],\\"rules\\":{\\"no-unused-vars\\":[1,{\\"args\\":\\"none\\"}]}}]},\\"prettier\\":{\\"semi\\":true,\\"printWidth\\":80,\\"singleQuote\\":true,\\"trailingComma\\":\\"all\\",\\"proseWrap\\":\\"always\\"},\\"babel\\":{\\"presets\\":[\\"@babel/typescript\\",[\\"@babel/env\\",{\\"targets\\":{\\"node\\":\\"10.19.0\\"}}]],\\"plugins\\":[\\"@babel/proposal-class-properties\\",\\"@babel/plugin-proposal-object-rest-spread\\",\\"babel-plugin-knifecycle\\"]},\\"jest\\":{\\"coverageReporters\\":[\\"lcov\\",\\"html\\"],\\"testPathIgnorePatterns\\":[\\"/node_modules/\\"],\\"roots\\":[\\"/src\\"],\\"testEnvironment\\":\\"node\\"}}", ], Array [ "/home/whoiam/projects/yolo/LICENSE", @@ -153,7 +153,7 @@ Object { "writeFileCalls": Array [ Array [ "/home/whoiam/projects/yolo/package.json", - "{\\"name\\":\\"super-project\\",\\"version\\":\\"0.0.0\\",\\"description\\":\\"A new Whook project\\",\\"keywords\\":[\\"whook\\",\\"knifecycle\\",\\"REST\\",\\"HTTP\\",\\"OpenAPI\\",\\"web\\",\\"service\\",\\"handler\\",\\"wrapper\\",\\"example\\"],\\"main\\":\\"dist/index.js\\",\\"types\\":\\"dist/index.d.ts\\",\\"scripts\\":{\\"compile\\":\\"babel --extensions '.ts,.js' src --out-dir=dist --source-maps=true\\",\\"cover\\":\\"npm run jest -- --coverage\\",\\"debug\\":\\"NODE_ENV=\${NODE_ENV:-development} DEV_MODE=1 DESTROY_SOCKETS=1 DEBUG=\${DEBUG:-whook} babel-node --extensions '.ts,.js' --inspect bin/dev\\",\\"dev\\":\\"NODE_ENV=\${NODE_ENV:-development} DEV_MODE=1 DESTROY_SOCKETS=1 babel-node --extensions '.ts,.js' bin/dev\\",\\"jest\\":\\"NODE_ENV=test jest\\",\\"lint\\":\\"eslint 'src/**/*.ts'\\",\\"precz\\":\\"npm run compile\\",\\"prettier\\":\\"prettier --write 'src/**/*.ts'\\",\\"preversion\\":\\"npm run compile\\",\\"start\\":\\"NODE_ENV=\${NODE_ENV:-development} node bin/start\\",\\"test\\":\\"npm run jest\\",\\"types\\":\\"rimraf -f 'dist/**/*.d.ts' && tsc --project . --declaration --emitDeclarationOnly --outDir dist\\",\\"whook\\":\\"NODE_ENV=\${NODE_ENV:-development} whook\\",\\"whook-dev\\":\\"PROJECT_SRC=\\\\\\"$PWD/src\\\\\\" NODE_ENV=\${NODE_ENV:-development} babel-node --extensions '.ts,.js' -- node_modules/@whook/cli/bin/whook.js\\"},\\"author\\":{\\"name\\":\\"Wayne Campbell\\",\\"email\\":\\"wayne@warner.com\\"},\\"license\\":\\"SEE LICENSE\\",\\"repository\\":{\\"type\\":\\"git\\",\\"url\\":\\"https://github.com/nfroidure/whook.git\\"},\\"bugs\\":{\\"url\\":\\"https://github.com/nfroidure/whook/issues\\"},\\"homepage\\":\\"https://github.com/nfroidure/whook\\",\\"dependencies\\":{\\"@whook/authorization\\":\\"\\",\\"@whook/cli\\":\\"\\",\\"@whook/cors\\":\\"\\",\\"@whook/http-router\\":\\"\\",\\"@whook/swagger-ui\\":\\"\\",\\"@whook/whook\\":\\"\\",\\"common-services\\":\\"^7.0.0\\",\\"ecstatic\\":\\"^4.1.2\\",\\"http-auth-utils\\":\\"^2.3.0\\",\\"knifecycle\\":\\"^9.0.0\\",\\"strict-qs\\":\\"^6.0.1\\",\\"yerror\\":\\"^5.0.0\\",\\"yhttperror\\":\\"^5.0.0\\"},\\"devDependencies\\":{\\"@babel/cli\\":\\"^7.8.4\\",\\"@babel/core\\":\\"^7.8.7\\",\\"@babel/node\\":\\"^7.2.2\\",\\"@babel/plugin-proposal-class-properties\\":\\"^7.8.3\\",\\"@babel/plugin-proposal-object-rest-spread\\":\\"^7.8.3\\",\\"@babel/preset-env\\":\\"^7.8.7\\",\\"@babel/preset-typescript\\":\\"^7.8.3\\",\\"@babel/register\\":\\"^7.8.6\\",\\"@types/jest\\":\\"^24.9.0\\",\\"@typescript-eslint/eslint-plugin\\":\\"^2.24.0\\",\\"@typescript-eslint/parser\\":\\"^2.24.0\\",\\"axios\\":\\"^0.19.0\\",\\"babel-eslint\\":\\"^10.1.0\\",\\"babel-plugin-knifecycle\\":\\"^1.2.0\\",\\"eslint\\":\\"^6.8.0\\",\\"eslint-plugin-prettier\\":\\"^3.1.2\\",\\"jest\\":\\"^25.1.0\\",\\"jsdoc-to-markdown\\":\\"^4.0.1\\",\\"openapi-schema-validator\\":\\"^3.0.3\\",\\"prettier\\":\\"^1.19.1\\",\\"rimraf\\":\\"^3.0.2\\",\\"typescript\\":\\"^3.8.3\\"},\\"contributors\\":[],\\"engines\\":{\\"node\\":\\">=10.19.0\\"},\\"files\\":[\\"bin\\",\\"dist\\",\\"src\\",\\"LICENSE\\",\\"README.md\\",\\"CHANGELOG.md\\"],\\"eslintConfig\\":{\\"extends\\":\\"eslint:recommended\\",\\"parserOptions\\":{\\"ecmaVersion\\":2018,\\"sourceType\\":\\"module\\",\\"modules\\":true},\\"env\\":{\\"es6\\":true,\\"node\\":true,\\"jest\\":true,\\"mocha\\":true},\\"plugins\\":[\\"prettier\\"],\\"rules\\":{\\"prettier/prettier\\":\\"error\\"},\\"parser\\":\\"@typescript-eslint/parser\\",\\"ignorePatterns\\":[\\"*.d.ts\\"],\\"overrides\\":[{\\"files\\":[\\"*.ts\\"],\\"rules\\":{\\"no-unused-vars\\":[1,{\\"args\\":\\"none\\"}]}}]},\\"prettier\\":{\\"semi\\":true,\\"printWidth\\":80,\\"singleQuote\\":true,\\"trailingComma\\":\\"all\\",\\"proseWrap\\":\\"always\\"},\\"babel\\":{\\"presets\\":[\\"@babel/typescript\\",[\\"@babel/env\\",{\\"targets\\":{\\"node\\":\\"10.19.0\\"}}]],\\"plugins\\":[\\"@babel/proposal-class-properties\\",\\"@babel/plugin-proposal-object-rest-spread\\",\\"babel-plugin-knifecycle\\"]},\\"jest\\":{\\"coverageReporters\\":[\\"lcov\\",\\"html\\"],\\"testPathIgnorePatterns\\":[\\"/node_modules/\\"],\\"roots\\":[\\"/src\\"],\\"testEnvironment\\":\\"node\\"}}", + "{\\"name\\":\\"super-project\\",\\"version\\":\\"0.0.0\\",\\"description\\":\\"A new Whook project\\",\\"keywords\\":[\\"whook\\",\\"knifecycle\\",\\"REST\\",\\"HTTP\\",\\"OpenAPI\\",\\"web\\",\\"service\\",\\"handler\\",\\"wrapper\\",\\"example\\"],\\"main\\":\\"dist/index.js\\",\\"types\\":\\"dist/index.d.ts\\",\\"scripts\\":{\\"build\\":\\"npm run compile && NODE_ENV=\${NODE_ENV:-development} node bin/build\\",\\"compile\\":\\"babel --extensions '.ts,.js' src --out-dir=dist --source-maps=true\\",\\"cover\\":\\"npm run jest -- --coverage\\",\\"debug\\":\\"NODE_ENV=\${NODE_ENV:-development} DEV_MODE=1 DESTROY_SOCKETS=1 DEBUG=\${DEBUG:-whook} babel-node --extensions '.ts,.js' --inspect bin/dev\\",\\"dev\\":\\"NODE_ENV=\${NODE_ENV:-development} DEV_MODE=1 DESTROY_SOCKETS=1 babel-node --extensions '.ts,.js' bin/dev\\",\\"jest\\":\\"NODE_ENV=test jest\\",\\"lint\\":\\"eslint 'src/**/*.ts'\\",\\"precz\\":\\"npm run compile\\",\\"prettier\\":\\"prettier --write 'src/**/*.ts'\\",\\"preversion\\":\\"npm run compile\\",\\"start\\":\\"NODE_ENV=\${NODE_ENV:-development} node bin/start\\",\\"test\\":\\"npm run jest\\",\\"types\\":\\"rimraf -f 'dist/**/*.d.ts' && tsc --project . --declaration --emitDeclarationOnly --outDir dist\\",\\"whook\\":\\"NODE_ENV=\${NODE_ENV:-development} whook\\",\\"whook-dev\\":\\"PROJECT_SRC=\\\\\\"$PWD/src\\\\\\" NODE_ENV=\${NODE_ENV:-development} babel-node --extensions '.ts,.js' -- node_modules/@whook/cli/bin/whook.js\\"},\\"author\\":{\\"name\\":\\"Wayne Campbell\\",\\"email\\":\\"wayne@warner.com\\"},\\"license\\":\\"SEE LICENSE\\",\\"repository\\":{\\"type\\":\\"git\\",\\"url\\":\\"https://github.com/nfroidure/whook.git\\"},\\"bugs\\":{\\"url\\":\\"https://github.com/nfroidure/whook/issues\\"},\\"homepage\\":\\"https://github.com/nfroidure/whook\\",\\"dependencies\\":{\\"@whook/authorization\\":\\"\\",\\"@whook/cli\\":\\"\\",\\"@whook/cors\\":\\"\\",\\"@whook/http-router\\":\\"\\",\\"@whook/http-transaction\\":\\"^3.1.3\\",\\"@whook/swagger-ui\\":\\"\\",\\"@whook/whook\\":\\"\\",\\"common-services\\":\\"^7.0.0\\",\\"ecstatic\\":\\"^4.1.2\\",\\"http-auth-utils\\":\\"^2.3.0\\",\\"knifecycle\\":\\"^9.0.0\\",\\"strict-qs\\":\\"^6.0.2\\",\\"yerror\\":\\"^5.0.0\\",\\"yhttperror\\":\\"^5.0.0\\"},\\"devDependencies\\":{\\"@babel/cli\\":\\"^7.8.4\\",\\"@babel/core\\":\\"^7.8.7\\",\\"@babel/node\\":\\"^7.2.2\\",\\"@babel/plugin-proposal-class-properties\\":\\"^7.8.3\\",\\"@babel/plugin-proposal-object-rest-spread\\":\\"^7.8.3\\",\\"@babel/preset-env\\":\\"^7.8.7\\",\\"@babel/preset-typescript\\":\\"^7.8.3\\",\\"@babel/register\\":\\"^7.8.6\\",\\"@types/jest\\":\\"^24.9.0\\",\\"@typescript-eslint/eslint-plugin\\":\\"^2.24.0\\",\\"@typescript-eslint/parser\\":\\"^2.24.0\\",\\"axios\\":\\"^0.19.0\\",\\"babel-eslint\\":\\"^10.1.0\\",\\"babel-plugin-knifecycle\\":\\"^1.2.0\\",\\"eslint\\":\\"^6.8.0\\",\\"eslint-plugin-prettier\\":\\"^3.1.2\\",\\"jest\\":\\"^25.1.0\\",\\"jsdoc-to-markdown\\":\\"^4.0.1\\",\\"openapi-schema-validator\\":\\"^3.0.3\\",\\"prettier\\":\\"^1.19.1\\",\\"rimraf\\":\\"^3.0.2\\",\\"typescript\\":\\"^3.8.3\\"},\\"contributors\\":[],\\"engines\\":{\\"node\\":\\">=10.19.0\\"},\\"files\\":[\\"bin\\",\\"dist\\",\\"src\\",\\"LICENSE\\",\\"README.md\\",\\"CHANGELOG.md\\"],\\"eslintConfig\\":{\\"extends\\":\\"eslint:recommended\\",\\"parserOptions\\":{\\"ecmaVersion\\":2018,\\"sourceType\\":\\"module\\",\\"modules\\":true},\\"env\\":{\\"es6\\":true,\\"node\\":true,\\"jest\\":true,\\"mocha\\":true},\\"plugins\\":[\\"prettier\\"],\\"rules\\":{\\"prettier/prettier\\":\\"error\\"},\\"parser\\":\\"@typescript-eslint/parser\\",\\"ignorePatterns\\":[\\"*.d.ts\\"],\\"overrides\\":[{\\"files\\":[\\"*.ts\\"],\\"rules\\":{\\"no-unused-vars\\":[1,{\\"args\\":\\"none\\"}]}}]},\\"prettier\\":{\\"semi\\":true,\\"printWidth\\":80,\\"singleQuote\\":true,\\"trailingComma\\":\\"all\\",\\"proseWrap\\":\\"always\\"},\\"babel\\":{\\"presets\\":[\\"@babel/typescript\\",[\\"@babel/env\\",{\\"targets\\":{\\"node\\":\\"10.19.0\\"}}]],\\"plugins\\":[\\"@babel/proposal-class-properties\\",\\"@babel/plugin-proposal-object-rest-spread\\",\\"babel-plugin-knifecycle\\"]},\\"jest\\":{\\"coverageReporters\\":[\\"lcov\\",\\"html\\"],\\"testPathIgnorePatterns\\":[\\"/node_modules/\\"],\\"roots\\":[\\"/src\\"],\\"testEnvironment\\":\\"node\\"}}", ], Array [ "/home/whoiam/projects/yolo/LICENSE", @@ -334,7 +334,7 @@ Object { "writeFileCalls": Array [ Array [ "/home/whoiam/projects/yolo/package.json", - "{\\"name\\":\\"super-project\\",\\"version\\":\\"0.0.0\\",\\"description\\":\\"A new Whook project\\",\\"keywords\\":[\\"whook\\",\\"knifecycle\\",\\"REST\\",\\"HTTP\\",\\"OpenAPI\\",\\"web\\",\\"service\\",\\"handler\\",\\"wrapper\\",\\"example\\"],\\"main\\":\\"dist/index.js\\",\\"types\\":\\"dist/index.d.ts\\",\\"scripts\\":{\\"compile\\":\\"babel --extensions '.ts,.js' src --out-dir=dist --source-maps=true\\",\\"cover\\":\\"npm run jest -- --coverage\\",\\"debug\\":\\"NODE_ENV=\${NODE_ENV:-development} DEV_MODE=1 DESTROY_SOCKETS=1 DEBUG=\${DEBUG:-whook} babel-node --extensions '.ts,.js' --inspect bin/dev\\",\\"dev\\":\\"NODE_ENV=\${NODE_ENV:-development} DEV_MODE=1 DESTROY_SOCKETS=1 babel-node --extensions '.ts,.js' bin/dev\\",\\"jest\\":\\"NODE_ENV=test jest\\",\\"lint\\":\\"eslint 'src/**/*.ts'\\",\\"precz\\":\\"npm run compile\\",\\"prettier\\":\\"prettier --write 'src/**/*.ts'\\",\\"preversion\\":\\"npm run compile\\",\\"start\\":\\"NODE_ENV=\${NODE_ENV:-development} node bin/start\\",\\"test\\":\\"npm run jest\\",\\"types\\":\\"rimraf -f 'dist/**/*.d.ts' && tsc --project . --declaration --emitDeclarationOnly --outDir dist\\",\\"whook\\":\\"NODE_ENV=\${NODE_ENV:-development} whook\\",\\"whook-dev\\":\\"PROJECT_SRC=\\\\\\"$PWD/src\\\\\\" NODE_ENV=\${NODE_ENV:-development} babel-node --extensions '.ts,.js' -- node_modules/@whook/cli/bin/whook.js\\"},\\"author\\":{\\"name\\":\\"Wayne Campbell\\",\\"email\\":\\"wayne@warner.com\\"},\\"license\\":\\"SEE LICENSE\\",\\"repository\\":{\\"type\\":\\"git\\",\\"url\\":\\"https://github.com/nfroidure/whook.git\\"},\\"bugs\\":{\\"url\\":\\"https://github.com/nfroidure/whook/issues\\"},\\"homepage\\":\\"https://github.com/nfroidure/whook\\",\\"dependencies\\":{\\"@whook/authorization\\":\\"\\",\\"@whook/cli\\":\\"\\",\\"@whook/cors\\":\\"\\",\\"@whook/http-router\\":\\"\\",\\"@whook/swagger-ui\\":\\"\\",\\"@whook/whook\\":\\"\\",\\"common-services\\":\\"^7.0.0\\",\\"ecstatic\\":\\"^4.1.2\\",\\"http-auth-utils\\":\\"^2.3.0\\",\\"knifecycle\\":\\"^9.0.0\\",\\"strict-qs\\":\\"^6.0.1\\",\\"yerror\\":\\"^5.0.0\\",\\"yhttperror\\":\\"^5.0.0\\"},\\"devDependencies\\":{\\"@babel/cli\\":\\"^7.8.4\\",\\"@babel/core\\":\\"^7.8.7\\",\\"@babel/node\\":\\"^7.2.2\\",\\"@babel/plugin-proposal-class-properties\\":\\"^7.8.3\\",\\"@babel/plugin-proposal-object-rest-spread\\":\\"^7.8.3\\",\\"@babel/preset-env\\":\\"^7.8.7\\",\\"@babel/preset-typescript\\":\\"^7.8.3\\",\\"@babel/register\\":\\"^7.8.6\\",\\"@types/jest\\":\\"^24.9.0\\",\\"@typescript-eslint/eslint-plugin\\":\\"^2.24.0\\",\\"@typescript-eslint/parser\\":\\"^2.24.0\\",\\"axios\\":\\"^0.19.0\\",\\"babel-eslint\\":\\"^10.1.0\\",\\"babel-plugin-knifecycle\\":\\"^1.2.0\\",\\"eslint\\":\\"^6.8.0\\",\\"eslint-plugin-prettier\\":\\"^3.1.2\\",\\"jest\\":\\"^25.1.0\\",\\"jsdoc-to-markdown\\":\\"^4.0.1\\",\\"openapi-schema-validator\\":\\"^3.0.3\\",\\"prettier\\":\\"^1.19.1\\",\\"rimraf\\":\\"^3.0.2\\",\\"typescript\\":\\"^3.8.3\\"},\\"contributors\\":[],\\"engines\\":{\\"node\\":\\">=10.19.0\\"},\\"files\\":[\\"bin\\",\\"dist\\",\\"src\\",\\"LICENSE\\",\\"README.md\\",\\"CHANGELOG.md\\"],\\"eslintConfig\\":{\\"extends\\":\\"eslint:recommended\\",\\"parserOptions\\":{\\"ecmaVersion\\":2018,\\"sourceType\\":\\"module\\",\\"modules\\":true},\\"env\\":{\\"es6\\":true,\\"node\\":true,\\"jest\\":true,\\"mocha\\":true},\\"plugins\\":[\\"prettier\\"],\\"rules\\":{\\"prettier/prettier\\":\\"error\\"},\\"parser\\":\\"@typescript-eslint/parser\\",\\"ignorePatterns\\":[\\"*.d.ts\\"],\\"overrides\\":[{\\"files\\":[\\"*.ts\\"],\\"rules\\":{\\"no-unused-vars\\":[1,{\\"args\\":\\"none\\"}]}}]},\\"prettier\\":{\\"semi\\":true,\\"printWidth\\":80,\\"singleQuote\\":true,\\"trailingComma\\":\\"all\\",\\"proseWrap\\":\\"always\\"},\\"babel\\":{\\"presets\\":[\\"@babel/typescript\\",[\\"@babel/env\\",{\\"targets\\":{\\"node\\":\\"10.19.0\\"}}]],\\"plugins\\":[\\"@babel/proposal-class-properties\\",\\"@babel/plugin-proposal-object-rest-spread\\",\\"babel-plugin-knifecycle\\"]},\\"jest\\":{\\"coverageReporters\\":[\\"lcov\\",\\"html\\"],\\"testPathIgnorePatterns\\":[\\"/node_modules/\\"],\\"roots\\":[\\"/src\\"],\\"testEnvironment\\":\\"node\\"}}", + "{\\"name\\":\\"super-project\\",\\"version\\":\\"0.0.0\\",\\"description\\":\\"A new Whook project\\",\\"keywords\\":[\\"whook\\",\\"knifecycle\\",\\"REST\\",\\"HTTP\\",\\"OpenAPI\\",\\"web\\",\\"service\\",\\"handler\\",\\"wrapper\\",\\"example\\"],\\"main\\":\\"dist/index.js\\",\\"types\\":\\"dist/index.d.ts\\",\\"scripts\\":{\\"build\\":\\"npm run compile && NODE_ENV=\${NODE_ENV:-development} node bin/build\\",\\"compile\\":\\"babel --extensions '.ts,.js' src --out-dir=dist --source-maps=true\\",\\"cover\\":\\"npm run jest -- --coverage\\",\\"debug\\":\\"NODE_ENV=\${NODE_ENV:-development} DEV_MODE=1 DESTROY_SOCKETS=1 DEBUG=\${DEBUG:-whook} babel-node --extensions '.ts,.js' --inspect bin/dev\\",\\"dev\\":\\"NODE_ENV=\${NODE_ENV:-development} DEV_MODE=1 DESTROY_SOCKETS=1 babel-node --extensions '.ts,.js' bin/dev\\",\\"jest\\":\\"NODE_ENV=test jest\\",\\"lint\\":\\"eslint 'src/**/*.ts'\\",\\"precz\\":\\"npm run compile\\",\\"prettier\\":\\"prettier --write 'src/**/*.ts'\\",\\"preversion\\":\\"npm run compile\\",\\"start\\":\\"NODE_ENV=\${NODE_ENV:-development} node bin/start\\",\\"test\\":\\"npm run jest\\",\\"types\\":\\"rimraf -f 'dist/**/*.d.ts' && tsc --project . --declaration --emitDeclarationOnly --outDir dist\\",\\"whook\\":\\"NODE_ENV=\${NODE_ENV:-development} whook\\",\\"whook-dev\\":\\"PROJECT_SRC=\\\\\\"$PWD/src\\\\\\" NODE_ENV=\${NODE_ENV:-development} babel-node --extensions '.ts,.js' -- node_modules/@whook/cli/bin/whook.js\\"},\\"author\\":{\\"name\\":\\"Wayne Campbell\\",\\"email\\":\\"wayne@warner.com\\"},\\"license\\":\\"SEE LICENSE\\",\\"repository\\":{\\"type\\":\\"git\\",\\"url\\":\\"https://github.com/nfroidure/whook.git\\"},\\"bugs\\":{\\"url\\":\\"https://github.com/nfroidure/whook/issues\\"},\\"homepage\\":\\"https://github.com/nfroidure/whook\\",\\"dependencies\\":{\\"@whook/authorization\\":\\"\\",\\"@whook/cli\\":\\"\\",\\"@whook/cors\\":\\"\\",\\"@whook/http-router\\":\\"\\",\\"@whook/http-transaction\\":\\"^3.1.3\\",\\"@whook/swagger-ui\\":\\"\\",\\"@whook/whook\\":\\"\\",\\"common-services\\":\\"^7.0.0\\",\\"ecstatic\\":\\"^4.1.2\\",\\"http-auth-utils\\":\\"^2.3.0\\",\\"knifecycle\\":\\"^9.0.0\\",\\"strict-qs\\":\\"^6.0.2\\",\\"yerror\\":\\"^5.0.0\\",\\"yhttperror\\":\\"^5.0.0\\"},\\"devDependencies\\":{\\"@babel/cli\\":\\"^7.8.4\\",\\"@babel/core\\":\\"^7.8.7\\",\\"@babel/node\\":\\"^7.2.2\\",\\"@babel/plugin-proposal-class-properties\\":\\"^7.8.3\\",\\"@babel/plugin-proposal-object-rest-spread\\":\\"^7.8.3\\",\\"@babel/preset-env\\":\\"^7.8.7\\",\\"@babel/preset-typescript\\":\\"^7.8.3\\",\\"@babel/register\\":\\"^7.8.6\\",\\"@types/jest\\":\\"^24.9.0\\",\\"@typescript-eslint/eslint-plugin\\":\\"^2.24.0\\",\\"@typescript-eslint/parser\\":\\"^2.24.0\\",\\"axios\\":\\"^0.19.0\\",\\"babel-eslint\\":\\"^10.1.0\\",\\"babel-plugin-knifecycle\\":\\"^1.2.0\\",\\"eslint\\":\\"^6.8.0\\",\\"eslint-plugin-prettier\\":\\"^3.1.2\\",\\"jest\\":\\"^25.1.0\\",\\"jsdoc-to-markdown\\":\\"^4.0.1\\",\\"openapi-schema-validator\\":\\"^3.0.3\\",\\"prettier\\":\\"^1.19.1\\",\\"rimraf\\":\\"^3.0.2\\",\\"typescript\\":\\"^3.8.3\\"},\\"contributors\\":[],\\"engines\\":{\\"node\\":\\">=10.19.0\\"},\\"files\\":[\\"bin\\",\\"dist\\",\\"src\\",\\"LICENSE\\",\\"README.md\\",\\"CHANGELOG.md\\"],\\"eslintConfig\\":{\\"extends\\":\\"eslint:recommended\\",\\"parserOptions\\":{\\"ecmaVersion\\":2018,\\"sourceType\\":\\"module\\",\\"modules\\":true},\\"env\\":{\\"es6\\":true,\\"node\\":true,\\"jest\\":true,\\"mocha\\":true},\\"plugins\\":[\\"prettier\\"],\\"rules\\":{\\"prettier/prettier\\":\\"error\\"},\\"parser\\":\\"@typescript-eslint/parser\\",\\"ignorePatterns\\":[\\"*.d.ts\\"],\\"overrides\\":[{\\"files\\":[\\"*.ts\\"],\\"rules\\":{\\"no-unused-vars\\":[1,{\\"args\\":\\"none\\"}]}}]},\\"prettier\\":{\\"semi\\":true,\\"printWidth\\":80,\\"singleQuote\\":true,\\"trailingComma\\":\\"all\\",\\"proseWrap\\":\\"always\\"},\\"babel\\":{\\"presets\\":[\\"@babel/typescript\\",[\\"@babel/env\\",{\\"targets\\":{\\"node\\":\\"10.19.0\\"}}]],\\"plugins\\":[\\"@babel/proposal-class-properties\\",\\"@babel/plugin-proposal-object-rest-spread\\",\\"babel-plugin-knifecycle\\"]},\\"jest\\":{\\"coverageReporters\\":[\\"lcov\\",\\"html\\"],\\"testPathIgnorePatterns\\":[\\"/node_modules/\\"],\\"roots\\":[\\"/src\\"],\\"testEnvironment\\":\\"node\\"}}", ], Array [ "/home/whoiam/projects/yolo/LICENSE", @@ -502,7 +502,7 @@ Object { "writeFileCalls": Array [ Array [ "/home/whoiam/projects/yolo/package.json", - "{\\"name\\":\\"super-project\\",\\"version\\":\\"0.0.0\\",\\"description\\":\\"A new Whook project\\",\\"keywords\\":[\\"whook\\",\\"knifecycle\\",\\"REST\\",\\"HTTP\\",\\"OpenAPI\\",\\"web\\",\\"service\\",\\"handler\\",\\"wrapper\\",\\"example\\"],\\"main\\":\\"dist/index.js\\",\\"types\\":\\"dist/index.d.ts\\",\\"scripts\\":{\\"compile\\":\\"babel --extensions '.ts,.js' src --out-dir=dist --source-maps=true\\",\\"cover\\":\\"npm run jest -- --coverage\\",\\"debug\\":\\"NODE_ENV=\${NODE_ENV:-development} DEV_MODE=1 DESTROY_SOCKETS=1 DEBUG=\${DEBUG:-whook} babel-node --extensions '.ts,.js' --inspect bin/dev\\",\\"dev\\":\\"NODE_ENV=\${NODE_ENV:-development} DEV_MODE=1 DESTROY_SOCKETS=1 babel-node --extensions '.ts,.js' bin/dev\\",\\"jest\\":\\"NODE_ENV=test jest\\",\\"lint\\":\\"eslint 'src/**/*.ts'\\",\\"precz\\":\\"npm run compile\\",\\"prettier\\":\\"prettier --write 'src/**/*.ts'\\",\\"preversion\\":\\"npm run compile\\",\\"start\\":\\"NODE_ENV=\${NODE_ENV:-development} node bin/start\\",\\"test\\":\\"npm run jest\\",\\"types\\":\\"rimraf -f 'dist/**/*.d.ts' && tsc --project . --declaration --emitDeclarationOnly --outDir dist\\",\\"whook\\":\\"NODE_ENV=\${NODE_ENV:-development} whook\\",\\"whook-dev\\":\\"PROJECT_SRC=\\\\\\"$PWD/src\\\\\\" NODE_ENV=\${NODE_ENV:-development} babel-node --extensions '.ts,.js' -- node_modules/@whook/cli/bin/whook.js\\"},\\"author\\":{\\"name\\":\\"Wayne Campbell\\",\\"email\\":\\"wayne@warner.com\\"},\\"license\\":\\"SEE LICENSE\\",\\"repository\\":{\\"type\\":\\"git\\",\\"url\\":\\"https://github.com/nfroidure/whook.git\\"},\\"bugs\\":{\\"url\\":\\"https://github.com/nfroidure/whook/issues\\"},\\"homepage\\":\\"https://github.com/nfroidure/whook\\",\\"dependencies\\":{\\"@whook/authorization\\":\\"\\",\\"@whook/cli\\":\\"\\",\\"@whook/cors\\":\\"\\",\\"@whook/http-router\\":\\"\\",\\"@whook/swagger-ui\\":\\"\\",\\"@whook/whook\\":\\"\\",\\"common-services\\":\\"^7.0.0\\",\\"ecstatic\\":\\"^4.1.2\\",\\"http-auth-utils\\":\\"^2.3.0\\",\\"knifecycle\\":\\"^9.0.0\\",\\"strict-qs\\":\\"^6.0.1\\",\\"yerror\\":\\"^5.0.0\\",\\"yhttperror\\":\\"^5.0.0\\"},\\"devDependencies\\":{\\"@babel/cli\\":\\"^7.8.4\\",\\"@babel/core\\":\\"^7.8.7\\",\\"@babel/node\\":\\"^7.2.2\\",\\"@babel/plugin-proposal-class-properties\\":\\"^7.8.3\\",\\"@babel/plugin-proposal-object-rest-spread\\":\\"^7.8.3\\",\\"@babel/preset-env\\":\\"^7.8.7\\",\\"@babel/preset-typescript\\":\\"^7.8.3\\",\\"@babel/register\\":\\"^7.8.6\\",\\"@types/jest\\":\\"^24.9.0\\",\\"@typescript-eslint/eslint-plugin\\":\\"^2.24.0\\",\\"@typescript-eslint/parser\\":\\"^2.24.0\\",\\"axios\\":\\"^0.19.0\\",\\"babel-eslint\\":\\"^10.1.0\\",\\"babel-plugin-knifecycle\\":\\"^1.2.0\\",\\"eslint\\":\\"^6.8.0\\",\\"eslint-plugin-prettier\\":\\"^3.1.2\\",\\"jest\\":\\"^25.1.0\\",\\"jsdoc-to-markdown\\":\\"^4.0.1\\",\\"openapi-schema-validator\\":\\"^3.0.3\\",\\"prettier\\":\\"^1.19.1\\",\\"rimraf\\":\\"^3.0.2\\",\\"typescript\\":\\"^3.8.3\\"},\\"contributors\\":[],\\"engines\\":{\\"node\\":\\">=10.19.0\\"},\\"files\\":[\\"bin\\",\\"dist\\",\\"src\\",\\"LICENSE\\",\\"README.md\\",\\"CHANGELOG.md\\"],\\"eslintConfig\\":{\\"extends\\":\\"eslint:recommended\\",\\"parserOptions\\":{\\"ecmaVersion\\":2018,\\"sourceType\\":\\"module\\",\\"modules\\":true},\\"env\\":{\\"es6\\":true,\\"node\\":true,\\"jest\\":true,\\"mocha\\":true},\\"plugins\\":[\\"prettier\\"],\\"rules\\":{\\"prettier/prettier\\":\\"error\\"},\\"parser\\":\\"@typescript-eslint/parser\\",\\"ignorePatterns\\":[\\"*.d.ts\\"],\\"overrides\\":[{\\"files\\":[\\"*.ts\\"],\\"rules\\":{\\"no-unused-vars\\":[1,{\\"args\\":\\"none\\"}]}}]},\\"prettier\\":{\\"semi\\":true,\\"printWidth\\":80,\\"singleQuote\\":true,\\"trailingComma\\":\\"all\\",\\"proseWrap\\":\\"always\\"},\\"babel\\":{\\"presets\\":[\\"@babel/typescript\\",[\\"@babel/env\\",{\\"targets\\":{\\"node\\":\\"10.19.0\\"}}]],\\"plugins\\":[\\"@babel/proposal-class-properties\\",\\"@babel/plugin-proposal-object-rest-spread\\",\\"babel-plugin-knifecycle\\"]},\\"jest\\":{\\"coverageReporters\\":[\\"lcov\\",\\"html\\"],\\"testPathIgnorePatterns\\":[\\"/node_modules/\\"],\\"roots\\":[\\"/src\\"],\\"testEnvironment\\":\\"node\\"}}", + "{\\"name\\":\\"super-project\\",\\"version\\":\\"0.0.0\\",\\"description\\":\\"A new Whook project\\",\\"keywords\\":[\\"whook\\",\\"knifecycle\\",\\"REST\\",\\"HTTP\\",\\"OpenAPI\\",\\"web\\",\\"service\\",\\"handler\\",\\"wrapper\\",\\"example\\"],\\"main\\":\\"dist/index.js\\",\\"types\\":\\"dist/index.d.ts\\",\\"scripts\\":{\\"build\\":\\"npm run compile && NODE_ENV=\${NODE_ENV:-development} node bin/build\\",\\"compile\\":\\"babel --extensions '.ts,.js' src --out-dir=dist --source-maps=true\\",\\"cover\\":\\"npm run jest -- --coverage\\",\\"debug\\":\\"NODE_ENV=\${NODE_ENV:-development} DEV_MODE=1 DESTROY_SOCKETS=1 DEBUG=\${DEBUG:-whook} babel-node --extensions '.ts,.js' --inspect bin/dev\\",\\"dev\\":\\"NODE_ENV=\${NODE_ENV:-development} DEV_MODE=1 DESTROY_SOCKETS=1 babel-node --extensions '.ts,.js' bin/dev\\",\\"jest\\":\\"NODE_ENV=test jest\\",\\"lint\\":\\"eslint 'src/**/*.ts'\\",\\"precz\\":\\"npm run compile\\",\\"prettier\\":\\"prettier --write 'src/**/*.ts'\\",\\"preversion\\":\\"npm run compile\\",\\"start\\":\\"NODE_ENV=\${NODE_ENV:-development} node bin/start\\",\\"test\\":\\"npm run jest\\",\\"types\\":\\"rimraf -f 'dist/**/*.d.ts' && tsc --project . --declaration --emitDeclarationOnly --outDir dist\\",\\"whook\\":\\"NODE_ENV=\${NODE_ENV:-development} whook\\",\\"whook-dev\\":\\"PROJECT_SRC=\\\\\\"$PWD/src\\\\\\" NODE_ENV=\${NODE_ENV:-development} babel-node --extensions '.ts,.js' -- node_modules/@whook/cli/bin/whook.js\\"},\\"author\\":{\\"name\\":\\"Wayne Campbell\\",\\"email\\":\\"wayne@warner.com\\"},\\"license\\":\\"SEE LICENSE\\",\\"repository\\":{\\"type\\":\\"git\\",\\"url\\":\\"https://github.com/nfroidure/whook.git\\"},\\"bugs\\":{\\"url\\":\\"https://github.com/nfroidure/whook/issues\\"},\\"homepage\\":\\"https://github.com/nfroidure/whook\\",\\"dependencies\\":{\\"@whook/authorization\\":\\"\\",\\"@whook/cli\\":\\"\\",\\"@whook/cors\\":\\"\\",\\"@whook/http-router\\":\\"\\",\\"@whook/http-transaction\\":\\"^3.1.3\\",\\"@whook/swagger-ui\\":\\"\\",\\"@whook/whook\\":\\"\\",\\"common-services\\":\\"^7.0.0\\",\\"ecstatic\\":\\"^4.1.2\\",\\"http-auth-utils\\":\\"^2.3.0\\",\\"knifecycle\\":\\"^9.0.0\\",\\"strict-qs\\":\\"^6.0.2\\",\\"yerror\\":\\"^5.0.0\\",\\"yhttperror\\":\\"^5.0.0\\"},\\"devDependencies\\":{\\"@babel/cli\\":\\"^7.8.4\\",\\"@babel/core\\":\\"^7.8.7\\",\\"@babel/node\\":\\"^7.2.2\\",\\"@babel/plugin-proposal-class-properties\\":\\"^7.8.3\\",\\"@babel/plugin-proposal-object-rest-spread\\":\\"^7.8.3\\",\\"@babel/preset-env\\":\\"^7.8.7\\",\\"@babel/preset-typescript\\":\\"^7.8.3\\",\\"@babel/register\\":\\"^7.8.6\\",\\"@types/jest\\":\\"^24.9.0\\",\\"@typescript-eslint/eslint-plugin\\":\\"^2.24.0\\",\\"@typescript-eslint/parser\\":\\"^2.24.0\\",\\"axios\\":\\"^0.19.0\\",\\"babel-eslint\\":\\"^10.1.0\\",\\"babel-plugin-knifecycle\\":\\"^1.2.0\\",\\"eslint\\":\\"^6.8.0\\",\\"eslint-plugin-prettier\\":\\"^3.1.2\\",\\"jest\\":\\"^25.1.0\\",\\"jsdoc-to-markdown\\":\\"^4.0.1\\",\\"openapi-schema-validator\\":\\"^3.0.3\\",\\"prettier\\":\\"^1.19.1\\",\\"rimraf\\":\\"^3.0.2\\",\\"typescript\\":\\"^3.8.3\\"},\\"contributors\\":[],\\"engines\\":{\\"node\\":\\">=10.19.0\\"},\\"files\\":[\\"bin\\",\\"dist\\",\\"src\\",\\"LICENSE\\",\\"README.md\\",\\"CHANGELOG.md\\"],\\"eslintConfig\\":{\\"extends\\":\\"eslint:recommended\\",\\"parserOptions\\":{\\"ecmaVersion\\":2018,\\"sourceType\\":\\"module\\",\\"modules\\":true},\\"env\\":{\\"es6\\":true,\\"node\\":true,\\"jest\\":true,\\"mocha\\":true},\\"plugins\\":[\\"prettier\\"],\\"rules\\":{\\"prettier/prettier\\":\\"error\\"},\\"parser\\":\\"@typescript-eslint/parser\\",\\"ignorePatterns\\":[\\"*.d.ts\\"],\\"overrides\\":[{\\"files\\":[\\"*.ts\\"],\\"rules\\":{\\"no-unused-vars\\":[1,{\\"args\\":\\"none\\"}]}}]},\\"prettier\\":{\\"semi\\":true,\\"printWidth\\":80,\\"singleQuote\\":true,\\"trailingComma\\":\\"all\\",\\"proseWrap\\":\\"always\\"},\\"babel\\":{\\"presets\\":[\\"@babel/typescript\\",[\\"@babel/env\\",{\\"targets\\":{\\"node\\":\\"10.19.0\\"}}]],\\"plugins\\":[\\"@babel/proposal-class-properties\\",\\"@babel/plugin-proposal-object-rest-spread\\",\\"babel-plugin-knifecycle\\"]},\\"jest\\":{\\"coverageReporters\\":[\\"lcov\\",\\"html\\"],\\"testPathIgnorePatterns\\":[\\"/node_modules/\\"],\\"roots\\":[\\"/src\\"],\\"testEnvironment\\":\\"node\\"}}", ], Array [ "/home/whoiam/projects/yolo/LICENSE", diff --git a/packages/whook-example/README.md b/packages/whook-example/README.md index c6fe5d7c..dca4e184 100644 --- a/packages/whook-example/README.md +++ b/packages/whook-example/README.md @@ -41,10 +41,10 @@ List available commands: npx whook ls ``` -# Debug +## Debug Execute a handler in isolation: ```sh -npx whook -- handler --name putEcho --parameters '{"body": { "echo": "YOLO!" }}' +npx whook handler --name putEcho --parameters '{"body": { "echo": "YOLO!" }}' ``` Debug `whook` internals: diff --git a/packages/whook-example/bin/build.js b/packages/whook-example/bin/build.js new file mode 100644 index 00000000..8723f087 --- /dev/null +++ b/packages/whook-example/bin/build.js @@ -0,0 +1,5 @@ +#! /usr/bin/env node + +const { runBuild } = require('../dist/index'); + +runBuild(); diff --git a/packages/whook-example/package-lock.json b/packages/whook-example/package-lock.json index 7eb7fc1e..f21b1d60 100644 --- a/packages/whook-example/package-lock.json +++ b/packages/whook-example/package-lock.json @@ -445,9 +445,9 @@ "dev": true }, "mkdirp": { - "version": "0.5.3", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.3.tgz", - "integrity": "sha512-P+2gwrFqx8lhew375MQHHeTlY8AuOJSrGf0R5ddkEndUkmwpgUob/vQuBD1V22/Cw1/lJr4x+EjllSezBThzBg==", + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.4.tgz", + "integrity": "sha512-iG9AK/dJLtJ0XNgTuDbSyNS3zECqDlAhnQW4CsNxBG3LQJBbHmRX1egw39DmtOdCAqY+dKXV+sgPgilNWUKMVw==", "dev": true, "requires": { "minimist": "^1.2.5" @@ -693,9 +693,9 @@ "dev": true }, "uglify-js": { - "version": "3.8.0", - "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.8.0.tgz", - "integrity": "sha512-ugNSTT8ierCsDHso2jkBHXYrU8Y5/fY2ZUprfrJUiD7YpuFvV4jODLFmb3h4btQjqr5Nh4TX4XtgDfCU1WdioQ==", + "version": "3.8.1", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.8.1.tgz", + "integrity": "sha512-W7KxyzeaQmZvUFbGj4+YFshhVrMBGSg2IbcYAjGWGvx8DHvJMclbTDMpffdxFUGPBHjIytk7KJUR/KUXstUGDw==", "dev": true, "optional": true, "requires": { diff --git a/packages/whook-example/package.json b/packages/whook-example/package.json index f3510ddf..120345e3 100644 --- a/packages/whook-example/package.json +++ b/packages/whook-example/package.json @@ -41,6 +41,7 @@ } }, "scripts": { + "build": "npm run compile && NODE_ENV=${NODE_ENV:-development} node bin/build", "cli": "env NODE_ENV=${NODE_ENV:-cli}", "compile": "babel --extensions '.ts,.js' src --out-dir=dist --source-maps=true", "cover": "npm run jest -- --coverage", @@ -77,13 +78,14 @@ "@whook/cli": "^3.1.3", "@whook/cors": "^3.1.3", "@whook/http-router": "^3.1.3", + "@whook/http-transaction": "^3.1.3", "@whook/swagger-ui": "^3.1.3", "@whook/whook": "^3.1.3", "common-services": "^7.0.0", "ecstatic": "^4.1.2", "http-auth-utils": "^2.3.0", "knifecycle": "^9.0.0", - "strict-qs": "^6.0.1", + "strict-qs": "^6.0.2", "yerror": "^5.0.0", "yhttperror": "^5.0.0" }, diff --git a/packages/whook-example/src/index.ts b/packages/whook-example/src/index.ts index d8dfef5c..ca57aa1c 100644 --- a/packages/whook-example/src/index.ts +++ b/packages/whook-example/src/index.ts @@ -1,13 +1,15 @@ -import Knifecycle, { constant, Services } from 'knifecycle'; +import Knifecycle, { constant, Services, alsoInject } from 'knifecycle'; import { runServer as runBaseServer, prepareServer as prepareBaseServer, prepareEnvironment as prepareBaseEnvironment, initAutoload, initAPIDefinitions, + initBuildConstants, } from '@whook/whook'; import initHTTPRouter from '@whook/http-router'; import wrapHTTPRouterWithSwaggerUI from '@whook/swagger-ui'; +import YError from 'yerror'; // Per convention a Whook server main file must export // the following 3 functions to be composable: @@ -57,7 +59,7 @@ export async function prepareEnvironment( // This service loads the API definitions directly by // looking at your `src/handlers` folder. You can - // realease this behavior by removing this line + // release this behavior by removing this line $.register(initAPIDefinitions); // You have to declare the project main file directory @@ -74,3 +76,50 @@ export async function prepareEnvironment( return $; } + +// Additionnally, 2 others functions can be exported +// for building purpose + +// The `runBuild` function is intended to build the +// project +export async function runBuild( + innerPrepareEnvironment = prepareBuildEnvironment, +): Promise { + throw new YError('E_NO_BUILD_IMPLEMENTED'); + + // Usually, here you call the installed build + // return runBaseBuild(innerPrepareEnvironment); +} + +// The `prepareBuildEnvironment` create the build +// environment +export async function prepareBuildEnvironment( + $: Knifecycle = new Knifecycle(), +): Promise { + $ = await prepareEnvironment($); + + // Usually, here you call the installed build env + // $ = await prepareBaseBuildEnvironment($); + + // The build often need to know were initializer + // can be found to create a static build and + // remove the need to create an injector + $.register( + constant('INITIALIZER_PATH_MAP', { + ENV: require.resolve('@whook/whook/dist/services/ProxyedENV'), + apm: require.resolve('@whook/http-transaction/dist/services/apm'), + obfuscator: require.resolve( + '@whook/http-transaction/dist/services/obfuscator', + ), + log: require.resolve('common-services/dist/log'), + time: require.resolve('common-services/dist/time'), + delay: require.resolve('common-services/dist/delay'), + }), + ); + + // Finally, some constants can be serialized instead of being + // initialized in the target build saving some time at boot + $.register(alsoInject(['API_DEFINITIONS'], initBuildConstants)); + + return $; +} diff --git a/packages/whook-http-router/package.json b/packages/whook-http-router/package.json index dee63ebc..b458926d 100644 --- a/packages/whook-http-router/package.json +++ b/packages/whook-http-router/package.json @@ -67,7 +67,7 @@ "openapi-types": "^1.3.5", "qs": "^6.9.1", "siso": "^3.2.0", - "strict-qs": "^6.0.1", + "strict-qs": "^6.0.2", "swagger-parser": "^8.0.4", "yerror": "^5.0.0", "yhttperror": "^5.0.0" diff --git a/packages/whook-http-router/src/index.ts b/packages/whook-http-router/src/index.ts index 0e45996d..547872a1 100644 --- a/packages/whook-http-router/src/index.ts +++ b/packages/whook-http-router/src/index.ts @@ -57,6 +57,7 @@ import { LogService } from 'common-services'; import { IncomingMessage, ServerResponse } from 'http'; const SEARCH_SEPARATOR = '?'; +const PATH_SEPARATOR = '/'; function noop() {} function identity(x) { @@ -288,7 +289,7 @@ async function initHTTPRouter({ .start(async () => { const method = request.method; const path = request.url.split(SEARCH_SEPARATOR)[0]; - const parts = path.split('/').filter(a => a); + const parts = path.split(PATH_SEPARATOR).filter(identity); let [result, pathParameters] = routers[method] ? routers[method].find(parts) : []; @@ -316,7 +317,7 @@ async function initHTTPRouter({ 'E_NOT_FOUND', method, parts, - '/' + parts.join('/'), + PATH_SEPARATOR + parts.join(PATH_SEPARATOR), ); } @@ -457,7 +458,7 @@ async function initHTTPRouter({ function _explodePath(path, parameters) { return path - .split('/') + .split(PATH_SEPARATOR) .filter(identity) .map(node => { const matches = /^{([a-z0-9]+)}$/i.exec(node); @@ -497,7 +498,7 @@ async function _createRouters({ operations.forEach(operation => { const { path, method, operationId, parameters } = operation; - if (!path.startsWith('/')) { + if (!path.startsWith(PATH_SEPARATOR)) { throw new YError('E_BAD_PATH', path); } if (!operationId) { diff --git a/packages/whook/API.md b/packages/whook/API.md index c5e0099b..3ccde6f8 100644 --- a/packages/whook/API.md +++ b/packages/whook/API.md @@ -19,6 +19,9 @@
default ⇒ Promise.<string>

Auto detect the Whook PROJECT_DIR

+
default ⇒ Promise.<Object>
+

Wrap the ENV service in order to filter ENV vars for the build

+
default ⇒ Promise.<string>

Auto detect the Whook WHOOK_PLUGINS_PATHS

@@ -33,6 +36,11 @@
prepareEnvironment($) ⇒

Prepare the Whook server environment

+
initBuildConstants(constants) ⇒ Promise.<Object>
+

Allow to proxy constants directly by serializing it in the + build, saving some computing and increasing boot time of + the build.

+
initENV(services, [log]) ⇒ Promise.<Object>

Initialize the ENV service using process env plus dotenv files

@@ -124,6 +132,21 @@ Auto detect the Whook PROJECT_DIR +## default ⇒ Promise.<Object> +Wrap the ENV service in order to filter ENV vars for the build + +**Kind**: global variable +**Returns**: Promise.<Object> - A promise of an object containing the reshaped env vars. + +| Param | Type | Default | Description | +| --- | --- | --- | --- | +| services | Object | | The services ENV depends on | +| services.NODE_ENV | Object | | The injected NODE_ENV value to add it to the build env | +| [services.PROXYED_ENV_VARS] | Object | {} | A list of environment variable names to proxy | +| [log] | Object | noop | An optional logging service | + + + ## default ⇒ Promise.<string> Auto detect the Whook WHOOK_PLUGINS_PATHS @@ -164,6 +187,27 @@ A promise of the Knifecycle instance | --- | --- | --- | | $ | Knifecycle | The Knifecycle instance to set the various services | + + +## initBuildConstants(constants) ⇒ Promise.<Object> +Allow to proxy constants directly by serializing it in the + build, saving some computing and increasing boot time of + the build. + +**Kind**: global function +**Returns**: Promise.<Object> - A promise of an object containing the gathered constants. + +| Param | Type | Description | +| --- | --- | --- | +| constants | Object | The serializable constants to gather | + +**Example** +```js +import { initBuildConstants } from '@whook/aws-lambda'; +import { alsoInject } from 'knifecycle'; + +export default alsoInject(['MY_OWN_CONSTANT'], initBuildConstants); +``` ## initENV(services, [log]) ⇒ Promise.<Object> diff --git a/packages/whook/ARCHITECTURE.md b/packages/whook/ARCHITECTURE.md index 8f8987d6..2b65a928 100644 --- a/packages/whook/ARCHITECTURE.md +++ b/packages/whook/ARCHITECTURE.md @@ -13,7 +13,7 @@ Whook exposes a `runServer` function to programmatically spawn its server. It is intended to be reusable and injectable so that projects can override the whole `whook` default behavior. -[See in context](./src/index.ts#L152-L156) +[See in context](./src/index.ts#L157-L161) @@ -26,7 +26,7 @@ Whook exposes a `prepareServer` function to create its server containing the bootstrapped environment and allowing to complete and run the server. -[See in context](./src/index.ts#L222-L229) +[See in context](./src/index.ts#L227-L234) @@ -36,7 +36,7 @@ Whook exposes a `prepareServer` function to create its server * server. We also inject `log` for logging purpose and custom other * injected name that were required upfront. -[See in context](./src/index.ts#L243-L247) +[See in context](./src/index.ts#L248-L252) @@ -48,7 +48,7 @@ The Whook `prepareEnvironment` function aims to provide the complete provides a chance to override some services/constants before actually preparing the server. -[See in context](./src/index.ts#L260-L266) +[See in context](./src/index.ts#L265-L271) @@ -58,7 +58,7 @@ The Whook server heavily rely on the process working directory to dynamically load contents. We are making it available to the DI system as a constant. -[See in context](./src/index.ts#L277-L281) +[See in context](./src/index.ts#L282-L286) @@ -67,7 +67,7 @@ The Whook server heavily rely on the process working directory Whook has different behaviors depending on the `NODE_ENV` value consider setting it to production before shipping. -[See in context](./src/index.ts#L285-L288) +[See in context](./src/index.ts#L290-L293) @@ -76,7 +76,7 @@ Whook has different behaviors depending on the `NODE_ENV` value Whook need to know where to look up for things like commands / handlers etc... -[See in context](./src/index.ts#L292-L295) +[See in context](./src/index.ts#L297-L300) @@ -87,7 +87,7 @@ Whook's default logger write to the NodeJS default console module so that you can set the `DEBUG` environment variable to `whook` and get debug messages in output. -[See in context](./src/index.ts#L298-L303) +[See in context](./src/index.ts#L303-L308) @@ -98,7 +98,7 @@ Whook's embed a few default initializers proxied from `src/services` folder. It can be wrapped or overriden, at will, later in project's main file. -[See in context](./src/index.ts#L322-L327) +[See in context](./src/index.ts#L327-L332) diff --git a/packages/whook/README.md b/packages/whook/README.md index f5eacbe4..9bfa8e14 100644 --- a/packages/whook/README.md +++ b/packages/whook/README.md @@ -56,6 +56,9 @@ Whook is built over Knifecyle which is great for adding or easily override/wrap
default ⇒ Promise.<string>

Auto detect the Whook PROJECT_DIR

+
default ⇒ Promise.<Object>
+

Wrap the ENV service in order to filter ENV vars for the build

+
default ⇒ Promise.<string>

Auto detect the Whook WHOOK_PLUGINS_PATHS

@@ -70,6 +73,11 @@ Whook is built over Knifecyle which is great for adding or easily override/wrap
prepareEnvironment($) ⇒

Prepare the Whook server environment

+
initBuildConstants(constants) ⇒ Promise.<Object>
+

Allow to proxy constants directly by serializing it in the + build, saving some computing and increasing boot time of + the build.

+
initENV(services, [log]) ⇒ Promise.<Object>

Initialize the ENV service using process env plus dotenv files

@@ -161,6 +169,21 @@ Auto detect the Whook PROJECT_DIR +## default ⇒ Promise.<Object> +Wrap the ENV service in order to filter ENV vars for the build + +**Kind**: global variable +**Returns**: Promise.<Object> - A promise of an object containing the reshaped env vars. + +| Param | Type | Default | Description | +| --- | --- | --- | --- | +| services | Object | | The services ENV depends on | +| services.NODE_ENV | Object | | The injected NODE_ENV value to add it to the build env | +| [services.PROXYED_ENV_VARS] | Object | {} | A list of environment variable names to proxy | +| [log] | Object | noop | An optional logging service | + + + ## default ⇒ Promise.<string> Auto detect the Whook WHOOK_PLUGINS_PATHS @@ -201,6 +224,27 @@ A promise of the Knifecycle instance | --- | --- | --- | | $ | Knifecycle | The Knifecycle instance to set the various services | + + +## initBuildConstants(constants) ⇒ Promise.<Object> +Allow to proxy constants directly by serializing it in the + build, saving some computing and increasing boot time of + the build. + +**Kind**: global function +**Returns**: Promise.<Object> - A promise of an object containing the gathered constants. + +| Param | Type | Description | +| --- | --- | --- | +| constants | Object | The serializable constants to gather | + +**Example** +```js +import { initBuildConstants } from '@whook/aws-lambda'; +import { alsoInject } from 'knifecycle'; + +export default alsoInject(['MY_OWN_CONSTANT'], initBuildConstants); +``` ## initENV(services, [log]) ⇒ Promise.<Object> diff --git a/packages/whook/src/index.ts b/packages/whook/src/index.ts index 206a2e6c..45fdb7b6 100644 --- a/packages/whook/src/index.ts +++ b/packages/whook/src/index.ts @@ -46,6 +46,10 @@ import initHTTPServer, { import initPort, { PortEnv } from './services/PORT'; import initHost, { HostEnv } from './services/HOST'; import initEnv, { ENVConfig, ENVService } from './services/ENV'; +import initProxyedENV, { ProxyedENVConfig } from './services/ProxyedENV'; +import initBuildConstants, { + WhookBuildConstantsService, +} from './services/BUILD_CONSTANTS'; import initConfigs, { CONFIGSService, WhookConfig, @@ -102,8 +106,12 @@ export { WhookAPIOperationConfig, WhookServiceMap, WhookInitializerMap, + WhookBuildConstantsService, + initBuildConstants, ENVService, initEnv, + ProxyedENVConfig, + initProxyedENV, WhookPluginsService, WhookPluginsPathsService, CONFIGSService, diff --git a/packages/whook-aws-lambda/src/services/BUILD_CONSTANTS.ts b/packages/whook/src/services/BUILD_CONSTANTS.ts similarity index 65% rename from packages/whook-aws-lambda/src/services/BUILD_CONSTANTS.ts rename to packages/whook/src/services/BUILD_CONSTANTS.ts index 774fe514..04e9f206 100644 --- a/packages/whook-aws-lambda/src/services/BUILD_CONSTANTS.ts +++ b/packages/whook/src/services/BUILD_CONSTANTS.ts @@ -1,26 +1,24 @@ import { service } from 'knifecycle'; -export default service(initBuildConstants, 'BUILD_CONSTANTS', [ - 'API_DEFINITIONS', -]); +export default service(initBuildConstants, 'BUILD_CONSTANTS', []); -export type BuildConstants = { [name: string]: any }; +export type WhookBuildConstantsService = { [name: string]: any }; /** * Allow to proxy constants directly by serializing it in the * build, saving some computing and increasing boot time of - * lambdas. + * the build. * @param {Object} constants * The serializable constants to gather * @return {Promise} * A promise of an object containing the gathered constants. * @example - * import { initBuildConstants } from '@whook/aws-lambda'; + * import { initBuildConstants } from '@whook/whook'; * import { alsoInject } from 'knifecycle'; * * export default alsoInject(['MY_OWN_CONSTANT'], initBuildConstants); */ -async function initBuildConstants( +async function initBuildConstants( constants: S, ): Promise { return constants; diff --git a/packages/whook-aws-lambda/src/services/ENV.test.ts b/packages/whook/src/services/ProxyedENV.test.ts similarity index 97% rename from packages/whook-aws-lambda/src/services/ENV.test.ts rename to packages/whook/src/services/ProxyedENV.test.ts index ae422576..36fa676b 100644 --- a/packages/whook-aws-lambda/src/services/ENV.test.ts +++ b/packages/whook/src/services/ProxyedENV.test.ts @@ -1,4 +1,4 @@ -import initEnv from './ENV'; +import initEnv from './ProxyedENV'; describe('initEnv', () => { const log = jest.fn(); diff --git a/packages/whook-aws-lambda/src/services/ENV.ts b/packages/whook/src/services/ProxyedENV.ts similarity index 87% rename from packages/whook-aws-lambda/src/services/ENV.ts rename to packages/whook/src/services/ProxyedENV.ts index 66ec5bd1..88ec3bbc 100644 --- a/packages/whook-aws-lambda/src/services/ENV.ts +++ b/packages/whook/src/services/ProxyedENV.ts @@ -1,14 +1,14 @@ -import { initEnv, ENVService, noop } from '@whook/whook'; +import initEnv, { ENVService } from './ENV'; import { wrapInitializer, alsoInject } from 'knifecycle'; import { LogService } from 'common-services'; +import { noop } from '../libs/utils'; -export type ENVConfig = { +export type ProxyedENVConfig = { NODE_ENV?: string; PROXYED_ENV_VARS?: string[]; }; -export type ENVDependencies = ENVConfig & { +export type ProxyedENVDependencies = ProxyedENVConfig & { NODE_ENV: string; - PROXYED_ENV_VARS: string[]; log?: LogService; };