Skip to content

Commit

Permalink
Merge pull request #193 from nfroidure/refactor/bootstrap
Browse files Browse the repository at this point in the history
refactor(core): simplify the bootstraping code
  • Loading branch information
nfroidure authored Dec 3, 2024
2 parents f168d46 + 5e58171 commit cafc97f
Show file tree
Hide file tree
Showing 68 changed files with 1,003 additions and 3,611 deletions.
2,558 changes: 272 additions & 2,286 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/whook-authorization/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"@whook/whook": "^17.0.2",
"common-services": "^16.0.4",
"http-auth-utils": "^6.0.1",
"knifecycle": "^17.2.1",
"knifecycle": "^17.3.0",
"yerror": "^8.0.0",
"yhttperror": "^8.0.0"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/whook-aws-lambda/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"camelcase": "^8.0.0",
"common-services": "^16.0.4",
"cpr": "3.0.1",
"knifecycle": "^17.2.1",
"knifecycle": "^17.3.0",
"mkdirp": "^3.0.1",
"openapi-types": "^12.1.3",
"qs": "^6.13.0",
Expand Down
11 changes: 7 additions & 4 deletions packages/whook-aws-lambda/src/commands/testCronLambda.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,13 @@ async function initTestCronLambdaCommand({
type,
extension,
);
const result = await handler({
time: date === 'now' ? new Date(time()).toISOString() : date,
body: JSON.parse(body),
}, {});
const result = await handler(
{
time: date === 'now' ? new Date(time()).toISOString() : date,
body: JSON.parse(body),
},
{},
);

log('info', 'SUCCESS:', result as string);

Expand Down
5 changes: 1 addition & 4 deletions packages/whook-aws-lambda/src/wrappers/awsHTTPLambda.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,7 @@ import {
type DereferencedParameterObject,
pickAllHeaderValues,
} from '@whook/http-transaction';
import type {
APIGatewayProxyEvent,
APIGatewayProxyResult,
} from 'aws-lambda';
import type { APIGatewayProxyEvent, APIGatewayProxyResult } from 'aws-lambda';
import type { WhookErrorHandler } from '@whook/http-router';
import type { AppEnvVars } from 'application-services';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ async function initWrapHandlerForKafkaLambda<S extends WhookHandler>({
null,
{ ENV, OPERATION_API, apm, time, log },
handler as WhookHandler<
LambdaKafkaConsumerInput,
LambdaKafkaConsumerOutput
>,
LambdaKafkaConsumerInput,
LambdaKafkaConsumerOutput
>,
);

return wrappedHandler as unknown as S;
Expand Down
2 changes: 1 addition & 1 deletion packages/whook-cors/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"@apidevtools/swagger-parser": "^10.1.0",
"@whook/http-router": "^17.0.2",
"@whook/whook": "^17.0.2",
"knifecycle": "^17.2.1",
"knifecycle": "^17.3.0",
"openapi-types": "^12.1.3",
"yhttperror": "^8.0.0"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/whook-create/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
"debug": "^4.3.7",
"fs-extra": "^11.2.0",
"inquirer": "^11.1.0",
"knifecycle": "^17.2.1",
"knifecycle": "^17.3.0",
"ora": "^8.1.0",
"yerror": "^8.0.0"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,19 +102,17 @@ DEV_MODE=1
"architecture": "jsarch 'src/**/*.ts' > ARCHITECTURE.md && git add ARCHITECTURE.md",
"build": "rimraf 'dist' && tsc --outDir dist",
"cover": "npm run jest -- --coverage",
"debug": "NODE_OPTIONS=\${NODE_OPTIONS:-'--inspect'} NODE_ENV=\${NODE_ENV:-development} DEV_MODE=1 DESTROY_SOCKETS=1 DEBUG=\${DEBUG:-whook} tsx bin/dev",
"dev": "NODE_ENV=\${NODE_ENV:-development} DEV_MODE=1 DESTROY_SOCKETS=1 tsx bin/dev.js",
"debug": "NODE_OPTIONS=\${NODE_OPTIONS:-'--inspect'} NODE_ENV=\${NODE_ENV:-development} DEV_MODE=1 DESTROY_SOCKETS=1 DEBUG=\${DEBUG:-whook} tsx bin/whook.js",
"dev": "NODE_ENV=\${NODE_ENV:-development} DEV_MODE=1 DESTROY_SOCKETS=1 tsx bin/whook.js",
"format": "npm run prettier",
"graph": "npm run graph:build && npm run graph:generate && git add DEPENDENCIES.mmd*",
"graph:build": "MERMAID_RUN=1 npm run --silent dev > DEPENDENCIES.mmd",
"graph:generate": "mmdc -i DEPENDENCIES.mmd -o DEPENDENCIES.mmd.svg",
"graph": "MERMAID_RUN=1 npm run --silent whook -- __inject mermaid > DEPENDENCIES.mmd",
"jest": "NODE_OPTIONS=--experimental-vm-modules NODE_ENV=test jest",
"lint": "eslint 'src/**/*.ts'",
"postbuild": "NODE_ENV=\${NODE_ENV:-development} tsx bin/build.js",
"prettier": "prettier --write 'src/**/*.ts'",
"rebuild": "swc ./src -s -d dist -C jsc.target=es2022",
"repl": "NODE_ENV=\${NODE_ENV:-development} tsx bin/repl.js",
"start": "NODE_ENV=\${NODE_ENV:-development} node bin/start.js",
"repl": "NODE_ENV=\${NODE_ENV:-development} tsx bin/whook.js -- __inject repl",
"start": "NODE_ENV=\${NODE_ENV:-development} node bin/whook.js",
"test": "NODE_ENV=test npm run build && npm run jest",
"type-check": "tsc --pretty --noEmit",
"watch": "NODE_ENV=\${NODE_ENV:-development} DEV_MODE=1 DESTROY_SOCKETS=1 tsx bin/watch.js",
Expand Down Expand Up @@ -143,7 +141,7 @@ DEV_MODE=1
"common-services": "^16.0.4",
"http-auth-utils": "^6.0.1",
"jwt-service": "^10.1.1",
"knifecycle": "^17.2.1",
"knifecycle": "^17.3.0",
"openapi-types": "^12.1.3",
"pkg-dir": "^8.0.0",
"strict-qs": "^8.0.3",
Expand All @@ -153,7 +151,6 @@ DEV_MODE=1
},
"devDependencies": {
"@eslint/js": "^9.7.0",
"@mermaid-js/mermaid-cli": "^11.4.0",
"@swc/cli": "^0.4.0",
"@swc/core": "^1.6.13",
"@swc/helpers": "^0.5.12",
Expand All @@ -167,7 +164,6 @@ DEV_MODE=1
"eslint-plugin-prettier": "^5.1.3",
"jest": "^29.7.0",
"jsarch": "^6.0.3",
"mermaid": "^11.4.1",
"prettier": "^3.3.3",
"rimraf": "^6.0.1",
"schema2dts": "^7.0.2",
Expand Down Expand Up @@ -416,19 +412,17 @@ DEV_MODE=1
"architecture": "jsarch 'src/**/*.ts' > ARCHITECTURE.md && git add ARCHITECTURE.md",
"build": "rimraf 'dist' && tsc --outDir dist",
"cover": "npm run jest -- --coverage",
"debug": "NODE_OPTIONS=\${NODE_OPTIONS:-'--inspect'} NODE_ENV=\${NODE_ENV:-development} DEV_MODE=1 DESTROY_SOCKETS=1 DEBUG=\${DEBUG:-whook} tsx bin/dev",
"dev": "NODE_ENV=\${NODE_ENV:-development} DEV_MODE=1 DESTROY_SOCKETS=1 tsx bin/dev.js",
"debug": "NODE_OPTIONS=\${NODE_OPTIONS:-'--inspect'} NODE_ENV=\${NODE_ENV:-development} DEV_MODE=1 DESTROY_SOCKETS=1 DEBUG=\${DEBUG:-whook} tsx bin/whook.js",
"dev": "NODE_ENV=\${NODE_ENV:-development} DEV_MODE=1 DESTROY_SOCKETS=1 tsx bin/whook.js",
"format": "npm run prettier",
"graph": "npm run graph:build && npm run graph:generate && git add DEPENDENCIES.mmd*",
"graph:build": "MERMAID_RUN=1 npm run --silent dev > DEPENDENCIES.mmd",
"graph:generate": "mmdc -i DEPENDENCIES.mmd -o DEPENDENCIES.mmd.svg",
"graph": "MERMAID_RUN=1 npm run --silent whook -- __inject mermaid > DEPENDENCIES.mmd",
"jest": "NODE_OPTIONS=--experimental-vm-modules NODE_ENV=test jest",
"lint": "eslint 'src/**/*.ts'",
"postbuild": "NODE_ENV=\${NODE_ENV:-development} tsx bin/build.js",
"prettier": "prettier --write 'src/**/*.ts'",
"rebuild": "swc ./src -s -d dist -C jsc.target=es2022",
"repl": "NODE_ENV=\${NODE_ENV:-development} tsx bin/repl.js",
"start": "NODE_ENV=\${NODE_ENV:-development} node bin/start.js",
"repl": "NODE_ENV=\${NODE_ENV:-development} tsx bin/whook.js -- __inject repl",
"start": "NODE_ENV=\${NODE_ENV:-development} node bin/whook.js",
"test": "NODE_ENV=test npm run build && npm run jest",
"type-check": "tsc --pretty --noEmit",
"watch": "NODE_ENV=\${NODE_ENV:-development} DEV_MODE=1 DESTROY_SOCKETS=1 tsx bin/watch.js",
Expand Down Expand Up @@ -457,7 +451,7 @@ DEV_MODE=1
"common-services": "^16.0.4",
"http-auth-utils": "^6.0.1",
"jwt-service": "^10.1.1",
"knifecycle": "^17.2.1",
"knifecycle": "^17.3.0",
"openapi-types": "^12.1.3",
"pkg-dir": "^8.0.0",
"strict-qs": "^8.0.3",
Expand All @@ -467,7 +461,6 @@ DEV_MODE=1
},
"devDependencies": {
"@eslint/js": "^9.7.0",
"@mermaid-js/mermaid-cli": "^11.4.0",
"@swc/cli": "^0.4.0",
"@swc/core": "^1.6.13",
"@swc/helpers": "^0.5.12",
Expand All @@ -481,7 +474,6 @@ DEV_MODE=1
"eslint-plugin-prettier": "^5.1.3",
"jest": "^29.7.0",
"jsarch": "^6.0.3",
"mermaid": "^11.4.1",
"prettier": "^3.3.3",
"rimraf": "^6.0.1",
"schema2dts": "^7.0.2",
Expand Down Expand Up @@ -768,19 +760,17 @@ DEV_MODE=1
"architecture": "jsarch 'src/**/*.ts' > ARCHITECTURE.md && git add ARCHITECTURE.md",
"build": "rimraf 'dist' && tsc --outDir dist",
"cover": "npm run jest -- --coverage",
"debug": "NODE_OPTIONS=\${NODE_OPTIONS:-'--inspect'} NODE_ENV=\${NODE_ENV:-development} DEV_MODE=1 DESTROY_SOCKETS=1 DEBUG=\${DEBUG:-whook} tsx bin/dev",
"dev": "NODE_ENV=\${NODE_ENV:-development} DEV_MODE=1 DESTROY_SOCKETS=1 tsx bin/dev.js",
"debug": "NODE_OPTIONS=\${NODE_OPTIONS:-'--inspect'} NODE_ENV=\${NODE_ENV:-development} DEV_MODE=1 DESTROY_SOCKETS=1 DEBUG=\${DEBUG:-whook} tsx bin/whook.js",
"dev": "NODE_ENV=\${NODE_ENV:-development} DEV_MODE=1 DESTROY_SOCKETS=1 tsx bin/whook.js",
"format": "npm run prettier",
"graph": "npm run graph:build && npm run graph:generate && git add DEPENDENCIES.mmd*",
"graph:build": "MERMAID_RUN=1 npm run --silent dev > DEPENDENCIES.mmd",
"graph:generate": "mmdc -i DEPENDENCIES.mmd -o DEPENDENCIES.mmd.svg",
"graph": "MERMAID_RUN=1 npm run --silent whook -- __inject mermaid > DEPENDENCIES.mmd",
"jest": "NODE_OPTIONS=--experimental-vm-modules NODE_ENV=test jest",
"lint": "eslint 'src/**/*.ts'",
"postbuild": "NODE_ENV=\${NODE_ENV:-development} tsx bin/build.js",
"prettier": "prettier --write 'src/**/*.ts'",
"rebuild": "swc ./src -s -d dist -C jsc.target=es2022",
"repl": "NODE_ENV=\${NODE_ENV:-development} tsx bin/repl.js",
"start": "NODE_ENV=\${NODE_ENV:-development} node bin/start.js",
"repl": "NODE_ENV=\${NODE_ENV:-development} tsx bin/whook.js -- __inject repl",
"start": "NODE_ENV=\${NODE_ENV:-development} node bin/whook.js",
"test": "NODE_ENV=test npm run build && npm run jest",
"type-check": "tsc --pretty --noEmit",
"watch": "NODE_ENV=\${NODE_ENV:-development} DEV_MODE=1 DESTROY_SOCKETS=1 tsx bin/watch.js",
Expand Down Expand Up @@ -809,7 +799,7 @@ DEV_MODE=1
"common-services": "^16.0.4",
"http-auth-utils": "^6.0.1",
"jwt-service": "^10.1.1",
"knifecycle": "^17.2.1",
"knifecycle": "^17.3.0",
"openapi-types": "^12.1.3",
"pkg-dir": "^8.0.0",
"strict-qs": "^8.0.3",
Expand All @@ -819,7 +809,6 @@ DEV_MODE=1
},
"devDependencies": {
"@eslint/js": "^9.7.0",
"@mermaid-js/mermaid-cli": "^11.4.0",
"@swc/cli": "^0.4.0",
"@swc/core": "^1.6.13",
"@swc/helpers": "^0.5.12",
Expand All @@ -833,7 +822,6 @@ DEV_MODE=1
"eslint-plugin-prettier": "^5.1.3",
"jest": "^29.7.0",
"jsarch": "^6.0.3",
"mermaid": "^11.4.1",
"prettier": "^3.3.3",
"rimraf": "^6.0.1",
"schema2dts": "^7.0.2",
Expand Down Expand Up @@ -1103,19 +1091,17 @@ DEV_MODE=1
"architecture": "jsarch 'src/**/*.ts' > ARCHITECTURE.md && git add ARCHITECTURE.md",
"build": "rimraf 'dist' && tsc --outDir dist",
"cover": "npm run jest -- --coverage",
"debug": "NODE_OPTIONS=\${NODE_OPTIONS:-'--inspect'} NODE_ENV=\${NODE_ENV:-development} DEV_MODE=1 DESTROY_SOCKETS=1 DEBUG=\${DEBUG:-whook} tsx bin/dev",
"dev": "NODE_ENV=\${NODE_ENV:-development} DEV_MODE=1 DESTROY_SOCKETS=1 tsx bin/dev.js",
"debug": "NODE_OPTIONS=\${NODE_OPTIONS:-'--inspect'} NODE_ENV=\${NODE_ENV:-development} DEV_MODE=1 DESTROY_SOCKETS=1 DEBUG=\${DEBUG:-whook} tsx bin/whook.js",
"dev": "NODE_ENV=\${NODE_ENV:-development} DEV_MODE=1 DESTROY_SOCKETS=1 tsx bin/whook.js",
"format": "npm run prettier",
"graph": "npm run graph:build && npm run graph:generate && git add DEPENDENCIES.mmd*",
"graph:build": "MERMAID_RUN=1 npm run --silent dev > DEPENDENCIES.mmd",
"graph:generate": "mmdc -i DEPENDENCIES.mmd -o DEPENDENCIES.mmd.svg",
"graph": "MERMAID_RUN=1 npm run --silent whook -- __inject mermaid > DEPENDENCIES.mmd",
"jest": "NODE_OPTIONS=--experimental-vm-modules NODE_ENV=test jest",
"lint": "eslint 'src/**/*.ts'",
"postbuild": "NODE_ENV=\${NODE_ENV:-development} tsx bin/build.js",
"prettier": "prettier --write 'src/**/*.ts'",
"rebuild": "swc ./src -s -d dist -C jsc.target=es2022",
"repl": "NODE_ENV=\${NODE_ENV:-development} tsx bin/repl.js",
"start": "NODE_ENV=\${NODE_ENV:-development} node bin/start.js",
"repl": "NODE_ENV=\${NODE_ENV:-development} tsx bin/whook.js -- __inject repl",
"start": "NODE_ENV=\${NODE_ENV:-development} node bin/whook.js",
"test": "NODE_ENV=test npm run build && npm run jest",
"type-check": "tsc --pretty --noEmit",
"watch": "NODE_ENV=\${NODE_ENV:-development} DEV_MODE=1 DESTROY_SOCKETS=1 tsx bin/watch.js",
Expand Down Expand Up @@ -1144,7 +1130,7 @@ DEV_MODE=1
"common-services": "^16.0.4",
"http-auth-utils": "^6.0.1",
"jwt-service": "^10.1.1",
"knifecycle": "^17.2.1",
"knifecycle": "^17.3.0",
"openapi-types": "^12.1.3",
"pkg-dir": "^8.0.0",
"strict-qs": "^8.0.3",
Expand All @@ -1154,7 +1140,6 @@ DEV_MODE=1
},
"devDependencies": {
"@eslint/js": "^9.7.0",
"@mermaid-js/mermaid-cli": "^11.4.0",
"@swc/cli": "^0.4.0",
"@swc/core": "^1.6.13",
"@swc/helpers": "^0.5.12",
Expand All @@ -1168,7 +1153,6 @@ DEV_MODE=1
"eslint-plugin-prettier": "^5.1.3",
"jest": "^29.7.0",
"jsarch": "^6.0.3",
"mermaid": "^11.4.1",
"prettier": "^3.3.3",
"rimraf": "^6.0.1",
"schema2dts": "^7.0.2",
Expand Down
Loading

0 comments on commit cafc97f

Please sign in to comment.