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 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 ≥ 18
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
- ### Starter Packs
128
- - **E-commerce**: Products, orders, KPIs
129
- - **CRM**: Contacts, leads, interactions
130
- - **Website/blog**: Pages, posts, i18n
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, ids, filter, user)
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"], null, user);
354
+ await deleteData("comments", ["61d1f1a9e3f1a9e3f1a9e3f1"], user);
309
355
 
310
356
  // Delete by filter
311
- await deleteData("logs", null, { createdAt: { $lt: "2023-01-01" } }, user);
357
+ await deleteData("logs", { createdAt: { $lt: "2023-01-01" } }, user);
312
358
  ```
313
359
 
314
- ### searchData({user, query})
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
- user: currentUser,
330
- query: {
331
- model: "blogPost",
332
- filter: { status: "published" },
333
- depth: 2, // Expand author and comments
334
- limit: 10,
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
@@ -39,7 +39,6 @@ $input-height: 50px;
39
39
  bottom: 20px;
40
40
  right: 20px;
41
41
  width: 100%;
42
- left: 2px;
43
42
  max-width: 720px;
44
43
  min-height: 400px;
45
44
  height: 60vh;
@@ -1,4 +1,3 @@
1
- // C:/Dev/hackersonline-engine/client/src/ChartConfigModal.jsx
2
1
  import React, { useState, useEffect } from 'react';
3
2
  import { useTranslation } from 'react-i18next';
4
3
  import { useModelContext } from './contexts/ModelContext.jsx';
@@ -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';
@@ -1,4 +1,3 @@
1
- // C:/Dev/hackersonline-engine/client/src/CronBuilder.scss
2
1
 
3
2
  // J'utilise ici des variables pour les couleurs et espacements.
4
3
  // Si votre projet a déjà un fichier de variables SCSS, il serait bon de les utiliser
@@ -1,4 +1,3 @@
1
- // C:/Dev/hackersonline-engine/client/src/CronPartBuilder.jsx
2
1
 
3
2
  import React, { useMemo } from 'react';
4
3
  import { SelectField, TextField, NumberField } from './Field.jsx';
@@ -1,4 +1,3 @@
1
- // C:/Dev/hackersonline-engine/client/src/Dashboard.jsx
2
1
  import React, {useState, useMemo, useEffect} from 'react';
3
2
  import { Trans, useTranslation } from 'react-i18next';
4
3
  import {FaPlus, FaSpinner} from "react-icons/fa"; // Ajout FaTrash
@@ -231,7 +231,6 @@
231
231
  }
232
232
  }
233
233
  }
234
- // C:/Dev/hackersonline-engine/client/src/Dashboard.scss
235
234
  // ... (autres styles existants) ...
236
235
 
237
236
  // Styles pour les badges de données dans FlexView
@@ -1,4 +1,3 @@
1
- // C:/Dev/hackersonline-engine/client/src/DashboardChart.jsx
2
1
  import React, {useEffect, useMemo, useState} from 'react';
3
2
  import { fr } from 'date-fns/locale'
4
3
  import {
@@ -1,4 +1,3 @@
1
- // C:/Dev/hackersonline-engine/client/src/DashboardView.jsx
2
1
  import React, {useEffect, useState, useMemo, useRef, useCallback} from 'react';
3
2
  import { Trans, useTranslation } from 'react-i18next';
4
3
  import KPIWidget from "./KPIWidget.jsx";
@@ -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,4 +1,3 @@
1
- // C:/Dev/hackersonline-engine/client/src/DisplayFlexNodeRenderer.jsx
2
1
  import {useTranslation} from "react-i18next";
3
2
  import {cssProps} from "../../src/core.js";
4
3
  import FlexDataRenderer from "./FlexDataRenderer.jsx";
@@ -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';
@@ -1,4 +1,3 @@
1
- // C:/Dev/hackersonline-engine/client/src/DocumentationPageLayout.scss
2
1
  @import "_variables";
3
2
 
4
3
  .documentation-layout {
@@ -1,4 +1,3 @@
1
- // C:/Dev/hackersonline-engine/client/src/FlexNode.jsx
2
1
  import React, {useEffect, useRef, useState} from 'react';
3
2
  import PropTypes from 'prop-types';
4
3
  import {
@@ -1,4 +1,3 @@
1
- // C:/Dev/hackersonline-engine/client/src/KanbanView.scss
2
1
 
3
2
  // --- Variables pour une personnalisation facile ---
4
3
  $board-bg: #f4f5f7; // Fond gris clair pour le tableau
@@ -1,4 +1,3 @@
1
- // C:/Dev/hackersonline-engine/client/src/RestoreDialog.jsx
2
1
 
3
2
  import React, { useState, useEffect } from 'react';
4
3
  import { useSearchParams, useNavigate } from 'react-router-dom';
@@ -1,4 +1,3 @@
1
- // C:/Dev/hackersonline-engine/client/src/TourSpotlight.jsx
2
1
 
3
2
  import React, { useState, useEffect, useRef, useCallback } from 'react';
4
3
  import './TourSpotlight.scss';
@@ -1,4 +1,3 @@
1
- // C:/Dev/hackersonline-engine/client/src/hooks/useDragAndDrop.js
2
1
  import { useState, useRef, useCallback } from 'react';
3
2
 
4
3
  const useDragAndDrop = () => {
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.1.8",
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
@@ -1,4 +1,3 @@
1
- // C:/Dev/hackersonline-engine/server/src/migrate.js
2
1
 
3
2
  import process from "node:process";
4
3
  import fs from "node:fs/promises";