Skip to content

Commit

Permalink
V9 initial code migration
Browse files Browse the repository at this point in the history
Changed config to be yaml instead of json

Changed config format for simpler configuration

Changed config format for multi-plugin services running concurrently with different names for monilith deployments

Multi-log handler functionality added

Logs can filter between different log plugins - allowing for log/plugin direction logging/stats - eg: logs to graylog but stats to grafana

Added multi-events ability as well - you can route specific plugins/events over specific event plugins

Starting migration away from sec.config.ts definitions for config of plugins

More type-safety built into all elements

callable methods are now a type safe object on the service - and a function to call them that is type linked

events are now in the events object on the BSB service class for a cleaner plugin.

init and run can be sync/async

initial setup of a BSB plugin invoked abstract classes for more type-safety

Split logging/events/plugins/services from SB into extendable classes for unique cases where the standard classes do not work the way you need them too - so you can extend and change what is needed without hacking around the problem

Initial setup speed from from +1s to ~40ms

Included cleanups during the setup to optimize memory usage

config plugins are simplified even more for less data transfer from the config plugin to other services/ or the BSB itself

Plugin search algorithim now uses defined info in config instead of trying to search for plugins - initial setup will require PDK for easier configuration

prepped for zod - config validation

prepped for future expansion with interoperability between languages with zod for input and output data from events.

client setup is minified as well for simpler use

clients get their own logging defition so you can identify what is creating logs

PI data in logs are removed since it is more complex to handle in client code - so rather just control the data coming into logs better

logging is now sync - but pushed to an events bus which then pushes to the logging plugins

config plugin is disposed after use for memory and safety

Plugin constructors now just have a single object passed in just to make it easier to setup/create a plugin

Added more comments/ts info to functions to make use easier

Simplified the setup of plugins for logging/events/config/services and moved them to their own classes

Overall big cleanup and optimize as well as additional features for more flexibility in deployments
  • Loading branch information
mrinc committed Dec 14, 2023
1 parent d5f4840 commit 7c61b8b
Show file tree
Hide file tree
Showing 80 changed files with 5,358 additions and 5,751 deletions.
747 changes: 463 additions & 284 deletions nodejs/package-lock.json

Large diffs are not rendered by default.

11 changes: 7 additions & 4 deletions nodejs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"scripts": {
"dev": "nodemon --config ./nodemon.json",
"start": "node lib/cli.js",
"build": "tsc && npm run testDev",
"build": "rm -rfv ./lib && tsc && npm run testDev",
"build-release": "rm -rfv ./lib && tsc && npm run test && rm -rfv ./lib && tsc --p ./tsconfig-release.json",
"postinstall": "node ./postinstall.js",
"lint": "eslint src/ --ext .js,.jsx,.ts,.tsx",
"test": "env TS_NODE_COMPILER_OPTIONS='{\"module\": \"commonjs\" }' node ./node_modules/nyc/bin/nyc.js --reporter json --reporter lcov ./node_modules/mocha/bin/mocha.js -r ts-node/register 'src/tests/**/*.ts' --reporter json --reporter-options output=junit.json",
Expand All @@ -34,10 +35,11 @@
"@types/assert": "^1.5.6",
"@types/chai": "^4.3.3",
"@types/mocha": "^9.1.1",
"@types/node": "^18.7.16",
"@types/node": "^18.19.3",
"@types/yargs": "^17.0.12",
"@typescript-eslint/eslint-plugin": "^5.31.0",
"@typescript-eslint/parser": "^5.31.0",
"chai": "^4.3.10",
"eslint": "^8.20.0",
"mocha": "^10.0.0",
"nyc": "^15.1.0",
Expand All @@ -47,7 +49,8 @@
},
"dependencies": {
"@bettercorp/tools": "^2.0.20220714140658",
"yaml": "^2.3.1"
"yaml": "^2.3.1",
"zod": "^3.21.4"
},
"bsb_project": true,
"bsbInit": {
Expand Down Expand Up @@ -116,4 +119,4 @@
"src/tests"
]
}
}
}
20 changes: 20 additions & 0 deletions nodejs/sec-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
default:
logging:
events:
rabbit:
plugin: events-rabbitMQ
package: "@bettercorp/bsb-rabbitmq"
enabled: false
services:
service-default0X:
plugin: service-default0
enabled: false
service-default1X:
plugin: service-default1
enabled: false
service-default2X:
plugin: service-default2
enabled: false
service-default3X:
plugin: service-default3
enabled: false
Loading

0 comments on commit 7c61b8b

Please sign in to comment.