data-primals-engine 1.1.8 → 1.2.0
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/README.md +65 -22
- package/client/src/AssistantChat.scss +0 -1
- package/client/src/ChartConfigModal.jsx +0 -1
- package/client/src/ConditionBuilder.jsx +0 -2
- package/client/src/ContentView.jsx +0 -1
- package/client/src/CronBuilder.scss +0 -1
- package/client/src/CronPartBuilder.jsx +0 -1
- package/client/src/Dashboard.jsx +0 -1
- package/client/src/Dashboard.scss +0 -1
- package/client/src/DashboardChart.jsx +0 -1
- package/client/src/DashboardView.jsx +0 -1
- package/client/src/DataEditor.jsx +0 -4
- package/client/src/DisplayFlexNodeRenderer.jsx +0 -1
- package/client/src/DocumentationPageLayout.jsx +0 -2
- package/client/src/DocumentationPageLayout.scss +0 -1
- package/client/src/FlexNode.jsx +0 -1
- package/client/src/KanbanView.scss +0 -1
- package/client/src/RestoreDialog.jsx +0 -1
- package/client/src/TourSpotlight.jsx +0 -1
- package/client/src/hooks/useDragAndDrop.js +0 -1
- package/issues.txt +0 -0
- package/package.json +1 -1
- package/src/constants.js +6 -0
- package/src/data.js +0 -2
- package/src/migrate.js +0 -1
- package/src/modules/assistant.js +211 -133
- package/src/modules/data.js +88 -69
- package/src/modules/workflow.js +10 -12
- package/src/providers.js +1 -1
- package/src/workers/crypto-worker.js +0 -1
- package/test/data.integration.test.js +53 -70
- package/test/workflow.integration.test.js +1 -1
package/README.md
CHANGED
|
@@ -23,18 +23,37 @@
|
|
|
23
23
|
- **🌐 i18n support**: Multilingual interfaces, translated validations.
|
|
24
24
|
- **📄 Auto Documentation**: Swagger available at `/api-docs`.
|
|
25
25
|
|
|
26
|
+
|
|
27
|
+
## 🌟 Why Choose data-primals-engine?
|
|
28
|
+
|
|
29
|
+
- **Zero Boilerplate**: Focus on your business logic, not infrastructure
|
|
30
|
+
- **Scalability**: Architecture designed for rapidly growing applications
|
|
31
|
+
- **Modularity**: Enable/disable features as needed
|
|
32
|
+
- **Batteries Included**: Everything you need to get started quickly
|
|
33
|
+
- **Proven Performance**: Handles 50k+ documents efficiently
|
|
34
|
+
- **AI Ready**: Built-in LangChain integration for OpenAI/Gemini
|
|
35
|
+
|
|
26
36
|
---
|
|
27
37
|
|
|
28
38
|
## ⚙️ Requirements
|
|
29
39
|
|
|
30
|
-
- Node.js ≥
|
|
31
|
-
- MongoDB (local or remote)
|
|
40
|
+
- Node.js ≥ 20
|
|
41
|
+
- MongoDB (local or remote), see [installation guide](https://www.mongodb.com/docs/manual/installation/)
|
|
32
42
|
- NPM or Yarn
|
|
33
43
|
|
|
34
44
|
---
|
|
35
45
|
|
|
36
46
|
## ⚡ Quick Start
|
|
37
47
|
|
|
48
|
+
### check
|
|
49
|
+
```bash
|
|
50
|
+
# Verify required versions
|
|
51
|
+
node -v # Must show ≥ v18
|
|
52
|
+
mongod --version # Must be installed
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### install
|
|
56
|
+
|
|
38
57
|
```bash
|
|
39
58
|
npm i data-primals-engine
|
|
40
59
|
```
|
|
@@ -44,6 +63,8 @@ git clone https://github.com/anonympins/data-primals-engine.git
|
|
|
44
63
|
cd data-primals-engine
|
|
45
64
|
npm install
|
|
46
65
|
```
|
|
66
|
+
|
|
67
|
+
### configure
|
|
47
68
|
Possibly create a `.env` file:
|
|
48
69
|
```env
|
|
49
70
|
MONGO_DB_URL=mongodb://127.0.0.1:27017
|
|
@@ -68,7 +89,7 @@ MONGO_DB_URL=mongodb://127.0.0.1:27017
|
|
|
68
89
|
| CA_CERT | Path to CA cert file. | certs/cert.pem |
|
|
69
90
|
| CERT_KEY | Path to the key file for your certificate. | certs/key.pem |
|
|
70
91
|
|
|
71
|
-
Start the server
|
|
92
|
+
### Start the server
|
|
72
93
|
```bash
|
|
73
94
|
# Development mode
|
|
74
95
|
npm run devserver
|
|
@@ -77,7 +98,8 @@ npm run devserver
|
|
|
77
98
|
npm run server
|
|
78
99
|
```
|
|
79
100
|
|
|
80
|
-
By default, the app runs on port **7633
|
|
101
|
+
By default, the app runs on port **7633** : http://localhost:7633
|
|
102
|
+
|
|
81
103
|
|
|
82
104
|
---
|
|
83
105
|
|
|
@@ -93,10 +115,22 @@ Define schemas using JSON:
|
|
|
93
115
|
{ "name": "name", "type": "string", "required": true },
|
|
94
116
|
{ "name": "price", "type": "number", "required": true },
|
|
95
117
|
{ "name": "stock", "type": "number", "default": 0 },
|
|
96
|
-
{ "name": "category", "type": "relation", "relation": "taxonomy"
|
|
118
|
+
{ "name": "category", "type": "relation", "relation": "taxonomy",
|
|
119
|
+
"relationFilter": { "$eq": ["$type", "category"] }
|
|
120
|
+
},
|
|
121
|
+
{ "name": "tags", "type": "relation", "relation": "taxonomy", "multiple": true,
|
|
122
|
+
"relationFilter": { "$eq": ["$type", "keyword"] }
|
|
123
|
+
}
|
|
97
124
|
]
|
|
98
125
|
}
|
|
99
126
|
```
|
|
127
|
+
### Smart Relations
|
|
128
|
+
- Handles up to 2,000 direct relations
|
|
129
|
+
- For larger datasets, use intermediate collections
|
|
130
|
+
- Automatic indexing on key fields
|
|
131
|
+
- Custom indexing on fields
|
|
132
|
+
- Custom fields :
|
|
133
|
+
|
|
100
134
|
| Type | Description | Properties/Notes |
|
|
101
135
|
|:------------|:------------------------------------------------------------------------------------|:--------------------------------------------------------------------------|
|
|
102
136
|
| string | Character string. | minLength, maxLength |
|
|
@@ -124,10 +158,22 @@ Define schemas using JSON:
|
|
|
124
158
|
Activatable features:
|
|
125
159
|
- `mongodb`, `data`, `user`, `workflow`, `file`, `assistant`, `swagger`
|
|
126
160
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
-
|
|
161
|
+
## 🏗️ Use Case Examples
|
|
162
|
+
|
|
163
|
+
### 🛒 E-Commerce Backoffice
|
|
164
|
+
- Install ecommerce-starter pack
|
|
165
|
+
- Add products via API/UI
|
|
166
|
+
- Customize order workflows
|
|
167
|
+
|
|
168
|
+
### 🎫 Support Ticket System
|
|
169
|
+
- Create ticket model with [open, pending, resolved] statuses
|
|
170
|
+
- Configure notification workflows
|
|
171
|
+
- Add custom endpoints for analytics
|
|
172
|
+
|
|
173
|
+
### 🤖 AI Chatbot
|
|
174
|
+
- Define your model
|
|
175
|
+
- Set up workflow: "When new entry → generate AI content"
|
|
176
|
+
- Connect to frontend chat interface
|
|
131
177
|
|
|
132
178
|
---
|
|
133
179
|
|
|
@@ -297,7 +343,7 @@ await patchData(
|
|
|
297
343
|
);
|
|
298
344
|
```
|
|
299
345
|
|
|
300
|
-
### deleteData(modelName,
|
|
346
|
+
### deleteData(modelName, filter, user)
|
|
301
347
|
|
|
302
348
|
>Deletes data with cascading relation cleanup.
|
|
303
349
|
|
|
@@ -305,13 +351,13 @@ Examples:
|
|
|
305
351
|
|
|
306
352
|
```javascript
|
|
307
353
|
// Delete by IDs
|
|
308
|
-
await deleteData("comments", ["61d1f1a9e3f1a9e3f1a9e3f1"],
|
|
354
|
+
await deleteData("comments", ["61d1f1a9e3f1a9e3f1a9e3f1"], user);
|
|
309
355
|
|
|
310
356
|
// Delete by filter
|
|
311
|
-
await deleteData("logs",
|
|
357
|
+
await deleteData("logs", { createdAt: { $lt: "2023-01-01" } }, user);
|
|
312
358
|
```
|
|
313
359
|
|
|
314
|
-
### searchData(
|
|
360
|
+
### searchData(query, user)
|
|
315
361
|
|
|
316
362
|
Powerful search with relation expansion and filtering.
|
|
317
363
|
|
|
@@ -326,15 +372,12 @@ Query Options:
|
|
|
326
372
|
Example:
|
|
327
373
|
```javascript
|
|
328
374
|
const results = await searchData({
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
sort: "createdAt:DESC"
|
|
336
|
-
}
|
|
337
|
-
});
|
|
375
|
+
model: "blogPost",
|
|
376
|
+
filter: { status: "published" },
|
|
377
|
+
depth: 2, // Expand author and comments
|
|
378
|
+
limit: 10,
|
|
379
|
+
sort: "createdAt:DESC"
|
|
380
|
+
}, user);
|
|
338
381
|
```
|
|
339
382
|
|
|
340
383
|
## Import/Export
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
// C:/Dev/hackersonline-engine/client/src/ConditionBuilder.jsx
|
|
2
1
|
|
|
3
2
|
import React, {useState, useEffect, useRef} from 'react';
|
|
4
3
|
import {
|
|
@@ -567,7 +566,6 @@ const ConditionBuilder = ({ initialValue = null, onChange, models, model = null,
|
|
|
567
566
|
setRoot(p);
|
|
568
567
|
onChange(p);
|
|
569
568
|
};
|
|
570
|
-
// C:/Dev/hackersonline-engine/client/src/ConditionBuilder.jsx
|
|
571
569
|
useEffect(() => {
|
|
572
570
|
let parsedValue = {}; // Valeur par défaut si tout échoue
|
|
573
571
|
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
// C:/Dev/hackersonline-engine/client/src/pages/ContentView.jsx
|
|
2
1
|
import React, {useEffect, useMemo, useRef, useState} from 'react';
|
|
3
2
|
import {useParams, Link, useLocation } from 'react-router-dom'; // NavLink supprimé car non utilisé
|
|
4
3
|
import { useQuery } from 'react-query';
|
package/client/src/Dashboard.jsx
CHANGED
|
@@ -52,10 +52,6 @@ const getInputType = (fieldType) => {
|
|
|
52
52
|
}
|
|
53
53
|
};
|
|
54
54
|
|
|
55
|
-
// C:/Dev/hackersonline-engine/client/src/DataEditor.jsx
|
|
56
|
-
// C:/Dev/hackersonline-engine/client/src/DataEditor.jsx
|
|
57
|
-
|
|
58
|
-
|
|
59
55
|
/**
|
|
60
56
|
* Evaluates a single condition against form data.
|
|
61
57
|
* @param {object} currentModelDef - The definition of the current model.
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
// C:/Dev/hackersonline-engine/client/src/DocumentationPageLayout.jsx
|
|
2
1
|
import React from 'react';
|
|
3
2
|
import { Outlet } from 'react-router-dom';
|
|
4
3
|
import './DocumentationPageLayout.scss'; // Nous créerons ce fichier SCSS ensuite
|
|
5
|
-
// C:/Dev/hackersonline-engine/client/src/DocumentationMenu.jsx
|
|
6
4
|
import { NavLink } from 'react-router-dom';
|
|
7
5
|
import { useTranslation } from 'react-i18next';
|
|
8
6
|
import { FaChevronDown, FaChevronRight } from 'react-icons/fa';
|
package/client/src/FlexNode.jsx
CHANGED
package/issues.txt
ADDED
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "data-primals-engine",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
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.",
|
|
5
5
|
"main": "src/engine.js",
|
|
6
6
|
"type": "module",
|
package/src/constants.js
CHANGED
|
@@ -6,6 +6,12 @@ import {event_trigger} from "./core.js";
|
|
|
6
6
|
*/
|
|
7
7
|
export const install = true;
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
* Maximum reflective steps to be used by the AI (looping over own research)
|
|
11
|
+
* @type {number}
|
|
12
|
+
*/
|
|
13
|
+
export const maxAIReflectiveSteps = 4;
|
|
14
|
+
|
|
9
15
|
/**
|
|
10
16
|
* Database name
|
|
11
17
|
* @type {string}
|
package/src/data.js
CHANGED
|
@@ -50,7 +50,6 @@ export function getUserId(user) {
|
|
|
50
50
|
export const getUserName = (user) => {
|
|
51
51
|
return isLocalUser(user) ? user._id + '_'+user._user : user.username;
|
|
52
52
|
}
|
|
53
|
-
// C:/Dev/hackersonline-engine/src/data.js
|
|
54
53
|
|
|
55
54
|
/**
|
|
56
55
|
* Crée une fonction de génération de nombres pseudo-aléatoires basée sur une graine (seed).
|
|
@@ -255,7 +254,6 @@ function buildNestedFindStructure(pathSegments, finalPayload) {
|
|
|
255
254
|
}
|
|
256
255
|
};
|
|
257
256
|
}
|
|
258
|
-
// C:/Dev/hackersonline-engine/src/data.js
|
|
259
257
|
// ... (imports and other functions) ...
|
|
260
258
|
|
|
261
259
|
/**
|
package/src/migrate.js
CHANGED