data-primals-engine 1.0.2-s → 1.0.3
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 +28 -5
- package/server.js +1 -37
- package/src/modules/assistant.js +1 -1
- package/src/modules/file.js +7 -0
- package/src/providers.js +1 -2
- package/swagger-en.yml +1417 -0
- package/swagger-fr.yml +2897 -0
- package/.idea/data-primals-engine.iml +0 -9
- package/.idea/inspectionProfiles/Project_Default.xml +0 -6
- package/.idea/misc.xml +0 -6
- package/.idea/modules.xml +0 -8
- package/.idea/vcs.xml +0 -6
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "data-primals-engine",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
|
|
3
|
+
"version": "1.0.3",
|
|
5
4
|
"description": "data-primals-engine is the package responsible from handling large amount of data in a practical and performant way. It can handle large amount of data in a practical and performant way. It can also get workflow models working (for automation), and fully supports internationalisation.",
|
|
6
5
|
"main": "src/engine.js",
|
|
7
6
|
"type": "module",
|
|
8
7
|
"scripts": {
|
|
8
|
+
"preinstall": "npx npm-force-resolutions",
|
|
9
9
|
"devserver": "cross-env NODE_ENV=development node server.js",
|
|
10
10
|
"server": "cross-env NODE_ENV=production node server.js",
|
|
11
11
|
"migrate:create": "node src/migrate.js create",
|
|
@@ -14,6 +14,11 @@
|
|
|
14
14
|
"migrate:revert": "node src/migrate.js revert",
|
|
15
15
|
"migrate:status": "node src/migrate.js status"
|
|
16
16
|
},
|
|
17
|
+
"resolutions": {
|
|
18
|
+
"tar-fs": "3.0.9",
|
|
19
|
+
"on-headers": "1.1.0",
|
|
20
|
+
"brace-expansion": "2.0.2"
|
|
21
|
+
},
|
|
17
22
|
"repository": {
|
|
18
23
|
"type": "git",
|
|
19
24
|
"url": "https://github.com/anonympins/data-primals-engine.git"
|
|
@@ -34,11 +39,14 @@
|
|
|
34
39
|
"check-disk-space": "^3.4.0",
|
|
35
40
|
"compression": "^1.8.0",
|
|
36
41
|
"connect-mongo": "^5.1.0",
|
|
42
|
+
"connect-multiparty": "^2.2.0",
|
|
37
43
|
"cookie-parser": "^1.4.7",
|
|
44
|
+
"cronstrue": "^3.1.0",
|
|
38
45
|
"csv-parse": "^5.6.0",
|
|
39
46
|
"csv-parser": "^3.2.0",
|
|
40
47
|
"express": "^4.21.2",
|
|
41
48
|
"express-csrf-double-submit-cookie": "^1.2.1",
|
|
49
|
+
"express-rate-limit": "^8.0.1",
|
|
42
50
|
"express-session": "^1.18.1",
|
|
43
51
|
"express-sitemap-xml": "^3.1.0",
|
|
44
52
|
"juice": "^11.0.1",
|
|
@@ -46,13 +54,27 @@
|
|
|
46
54
|
"mongodb": "^6.12.0",
|
|
47
55
|
"node-schedule": "^2.1.1",
|
|
48
56
|
"nodemailer": "^6.10.0",
|
|
57
|
+
"randomcolor": "^0.6.2",
|
|
49
58
|
"rate-limiter-flexible": "^5.0.5",
|
|
50
|
-
"
|
|
59
|
+
"request-ip": "^3.3.0",
|
|
60
|
+
"sanitize-html": "^2.17.0",
|
|
51
61
|
"sirv": "^3.0.1",
|
|
62
|
+
"swagger-ui-express": "^5.0.1",
|
|
52
63
|
"tar": "^7.4.3",
|
|
53
64
|
"tar-fs": "^3.0.8",
|
|
54
65
|
"uniqid": "^5.4.0",
|
|
55
|
-
"yaml": "^2.8.0"
|
|
66
|
+
"yaml": "^2.8.0",
|
|
67
|
+
"bcrypt": "^5.1.1",
|
|
68
|
+
"date-fns": "^4.1.0",
|
|
69
|
+
"express-mongo-sanitize": "^2.2.0",
|
|
70
|
+
"i18next": "^24.2.2",
|
|
71
|
+
"i18next-browser-languagedetector": "^8.0.4",
|
|
72
|
+
"node-cache": "^5.1.2",
|
|
73
|
+
"openai": "^5.8.2",
|
|
74
|
+
"react-helmet": "^6.1.0",
|
|
75
|
+
"react-i18next": "^15.4.1",
|
|
76
|
+
"react-markdown": "^10.1.0",
|
|
77
|
+
"zlib": "^1.0.5"
|
|
56
78
|
},
|
|
57
79
|
"devDependencies": {
|
|
58
80
|
"@eslint/js": "^9.17.0",
|
|
@@ -67,7 +89,8 @@
|
|
|
67
89
|
"primals",
|
|
68
90
|
"automation",
|
|
69
91
|
"aws",
|
|
70
|
-
"bucket",
|
|
92
|
+
"bucket",
|
|
93
|
+
"S3"
|
|
71
94
|
],
|
|
72
95
|
"author": "anonympins",
|
|
73
96
|
"license": "MIT",
|
package/server.js
CHANGED
|
@@ -32,54 +32,18 @@ import path from "node:path";
|
|
|
32
32
|
import { getAllPacks} from "../data-primals-engine/src/packs.js";
|
|
33
33
|
import {middlewareAuthenticator, userInitiator} from "../data-primals-engine/src/modules/user.js";
|
|
34
34
|
import {defaultModels} from "../data-primals-engine/src/defaultModels.js";
|
|
35
|
-
Config.Set("modules", ["mongodb", "data", "file", "bucket", "workflow","user", "assistant"])
|
|
35
|
+
Config.Set("modules", ["mongodb", "data", "file", "bucket", "workflow","user", "assistant", "swagger"])
|
|
36
36
|
Config.Set("middlewares", []);
|
|
37
37
|
|
|
38
38
|
const bench = GameObject.Create("Benchmark");
|
|
39
39
|
const timer = bench.addComponent(BenchmarkTool);
|
|
40
40
|
timer.start();
|
|
41
41
|
|
|
42
|
-
const swaggerDocument = YAML.parse(fs.readFileSync(process.cwd()+'/swagger-en.yml', 'utf8'));
|
|
43
|
-
|
|
44
42
|
const engine = Engine.Create();
|
|
45
43
|
|
|
46
|
-
const models = defaultModels;
|
|
47
|
-
|
|
48
44
|
const port = process.env.PORT || 7633;
|
|
49
45
|
engine.start(port, async (r) => {
|
|
50
46
|
const logger = engine.getComponent(Logger);
|
|
51
|
-
logger.info("Loading and validating models...");
|
|
52
|
-
const ms = Object.values(models);
|
|
53
|
-
|
|
54
|
-
let dbModels = await getModels();
|
|
55
|
-
|
|
56
|
-
for(let i = 0; i < ms.length; ++i){
|
|
57
|
-
const model = ms[i];
|
|
58
|
-
validateModelStructure(model);
|
|
59
|
-
// Création des modèles
|
|
60
|
-
if( !dbModels.find(m =>m.name === model.name) )
|
|
61
|
-
{
|
|
62
|
-
model.locked = true;
|
|
63
|
-
const r = await createModel(model);
|
|
64
|
-
dbModels.push({...model, _id: r.insertedId });
|
|
65
|
-
}
|
|
66
|
-
else
|
|
67
|
-
logger.info('Model loaded (' + model.name + ')', {});
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
engine.use('/doc', swaggerUi.serve, swaggerUi.setup(swaggerDocument));
|
|
71
|
-
|
|
72
|
-
if( install )
|
|
73
|
-
await installAllPacks();
|
|
74
47
|
|
|
75
48
|
timer.stop();
|
|
76
49
|
});
|
|
77
|
-
|
|
78
|
-
const installAllPacks = async () => {
|
|
79
|
-
|
|
80
|
-
const packs = await getAllPacks();
|
|
81
|
-
|
|
82
|
-
console.log(util.inspect(packs, false, 20, true));
|
|
83
|
-
await packsCollection.deleteMany({ _user: { $exists : false }});
|
|
84
|
-
await packsCollection.insertMany(packs);
|
|
85
|
-
}
|
package/src/modules/assistant.js
CHANGED
|
@@ -292,5 +292,5 @@ export async function onInit(engine) {
|
|
|
292
292
|
res.status(500).json({success: false, message: "Une erreur interne est survenue."});
|
|
293
293
|
}
|
|
294
294
|
});
|
|
295
|
-
logger.info("Module 'assistant'
|
|
295
|
+
logger.info("Module 'assistant' loaded and endpoint '/api/assistant/chat' registered.");
|
|
296
296
|
}
|
package/src/modules/file.js
CHANGED
|
@@ -14,6 +14,9 @@ import crypto from "node:crypto";
|
|
|
14
14
|
import * as tar from "tar";
|
|
15
15
|
import {promisify} from "node:util";
|
|
16
16
|
import {calculateTotalUserStorageUsage, hasPermission} from "./user.js";
|
|
17
|
+
import {Logger} from "../gameObject.js";
|
|
18
|
+
import YAML from "yaml";
|
|
19
|
+
import swaggerUi from "swagger-ui-express";
|
|
17
20
|
|
|
18
21
|
const pbkdf2Async = promisify(crypto.pbkdf2);
|
|
19
22
|
|
|
@@ -190,3 +193,7 @@ export async function decryptFile(filePath, password) {
|
|
|
190
193
|
throw new Error(`Decryption failed: ${error.message}`);
|
|
191
194
|
}
|
|
192
195
|
}
|
|
196
|
+
|
|
197
|
+
export async function onInit(defaultEngine) {
|
|
198
|
+
|
|
199
|
+
}
|
package/src/providers.js
CHANGED
|
@@ -54,8 +54,7 @@ export class DefaultUserProvider extends UserProvider {
|
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
async validatePassword(user, password) {
|
|
57
|
-
|
|
58
|
-
return await compare(password, user.password);
|
|
57
|
+
return true;
|
|
59
58
|
}
|
|
60
59
|
|
|
61
60
|
async initiateUser(req) {
|