@gnar-engine/core 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@gnar-engine/core",
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "Gnar Engine - Service Core",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/core.js",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist"
|
|
9
|
+
],
|
|
10
|
+
"scripts": {
|
|
11
|
+
"bundle": "esbuild src/app.js --bundle --minify --outfile=dist/core.js --format=esm --platform=node --packages=external --external:node:* --external:*.node",
|
|
12
|
+
"build": "npm run bundle",
|
|
13
|
+
"test": "jest"
|
|
14
|
+
},
|
|
15
|
+
"author": "Gnar Software Ltd.",
|
|
16
|
+
"license": "MIT",
|
|
17
|
+
"engines": {
|
|
18
|
+
"node": ">=20.0.0"
|
|
19
|
+
},
|
|
20
|
+
"repository": {
|
|
21
|
+
"type": "git",
|
|
22
|
+
"url": "https://github.com/Gnar-Software/gnar-engine"
|
|
23
|
+
},
|
|
24
|
+
"keywords": [
|
|
25
|
+
"gnar",
|
|
26
|
+
"engine",
|
|
27
|
+
"core",
|
|
28
|
+
"node",
|
|
29
|
+
"microservice",
|
|
30
|
+
"framework"
|
|
31
|
+
],
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"@fastify/cors": "^11.0.0",
|
|
34
|
+
"@fastify/rate-limit": "^10.2.2",
|
|
35
|
+
"ajv": "^8.17.1",
|
|
36
|
+
"ajv-formats": "^3.0.1",
|
|
37
|
+
"amqplib": "^0.10.5",
|
|
38
|
+
"doctrine": "^3.0.0",
|
|
39
|
+
"dotenv": "^16.4.7",
|
|
40
|
+
"fastify": "^5.2.1",
|
|
41
|
+
"fs": "^0.0.1-security",
|
|
42
|
+
"mongodb": "^6.0.0",
|
|
43
|
+
"mongosh": "^1.10.6",
|
|
44
|
+
"mysql2": "^3.12.0",
|
|
45
|
+
"node-cron": "^3.0.3",
|
|
46
|
+
"openssl": "^1.0.0",
|
|
47
|
+
"path": "^0.12.7",
|
|
48
|
+
"pino": "^9.6.0",
|
|
49
|
+
"pino-pretty": "^13.0.0",
|
|
50
|
+
"uuid": "^11.1.0",
|
|
51
|
+
"ws": "^8.13.0"
|
|
52
|
+
},
|
|
53
|
+
"devDependencies": {
|
|
54
|
+
"@babel/preset-env": "^7.22.20",
|
|
55
|
+
"esbuild": "^0.19.0",
|
|
56
|
+
"jest": "^29.7.0",
|
|
57
|
+
"nodemon": "^3.1.9",
|
|
58
|
+
"supertest": "^6.3.3"
|
|
59
|
+
}
|
|
60
|
+
}
|
package/readme.md
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Gnar Engine - Service Core / Base Image
|
|
2
|
+
|
|
3
|
+
The Gnar Engine Service Core bootstraps:
|
|
4
|
+
|
|
5
|
+
- Fastify Web Server
|
|
6
|
+
- AJV schema validation
|
|
7
|
+
- A command bus providing a single abstraction layer for executing functions within or between services
|
|
8
|
+
- Inter service messaging (Rabbit MQ)
|
|
9
|
+
- Logging
|
|
10
|
+
- Errors
|
|
11
|
+
- Database initialisation
|
|
12
|
+
- Handling for seeders & migrations
|
|
13
|
+
- Health checks
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### message controller example implementation
|
|
17
|
+
|
|
18
|
+
``` javascript
|
|
19
|
+
import { messageController } from './controllers/message-controller.js';
|
|
20
|
+
|
|
21
|
+
await messageController.init({
|
|
22
|
+
config: {
|
|
23
|
+
queueName: 'userServiceQueue',
|
|
24
|
+
prefetch: 20
|
|
25
|
+
},
|
|
26
|
+
handlers: {
|
|
27
|
+
customJob: async (payload) => {
|
|
28
|
+
console.log('Handling customJob:', payload);
|
|
29
|
+
return { received: true };
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
```
|