data-primals-engine 1.0.0 → 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.
@@ -0,0 +1,9 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <module type="JAVA_MODULE" version="4">
3
+ <component name="NewModuleRootManager" inherit-compiler-output="true">
4
+ <exclude-output />
5
+ <content url="file://$MODULE_DIR$" />
6
+ <orderEntry type="inheritedJdk" />
7
+ <orderEntry type="sourceFolder" forTests="false" />
8
+ </component>
9
+ </module>
@@ -0,0 +1,6 @@
1
+ <component name="InspectionProjectProfileManager">
2
+ <profile version="1.0">
3
+ <option name="myName" value="Project Default" />
4
+ <inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
5
+ </profile>
6
+ </component>
package/.idea/misc.xml ADDED
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectRootManager">
4
+ <output url="file://$PROJECT_DIR$/out" />
5
+ </component>
6
+ </project>
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectModuleManager">
4
+ <modules>
5
+ <module fileurl="file://$PROJECT_DIR$/.idea/data-primals-engine.iml" filepath="$PROJECT_DIR$/.idea/data-primals-engine.iml" />
6
+ </modules>
7
+ </component>
8
+ </project>
package/.idea/vcs.xml ADDED
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="" vcs="Git" />
5
+ </component>
6
+ </project>
package/README.md CHANGED
@@ -1,68 +1,67 @@
1
1
  # Data Primals Engine
2
2
 
3
- **data-primals-engine** est un moteur backend **Node.js** puissant et flexible, conçu pour accélérer le développement d'applications complexes basées sur les données. Construit sur **Express.js** et **MongoDB**, il offre une architecture modulaire, un système de modélisation de données dynamique, des workflows d'automatisation, une gestion avancée des utilisateurs, et bien plus encore.
3
+ **data-primals-engine** is a powerful and flexible **Node.js** backend framework designed to accelerate development of complex data-driven applications. Built on **Express.js** and **MongoDB**, it offers dynamic data modeling, automation workflows, advanced user management, and more.
4
4
 
5
- > Que vous construisiez un CRM, une boutique e-commerce, un CMS ou une application SaaS complexe, **data-primals-engine** vous fournit les fondations robustes pour vous concentrer sur ce qui rend votre application unique.
5
+ > Whether you're building a CRM, e-commerce site, CMS, or SaaS platform, **data-primals-engine** provides the strong foundations so you can focus on what makes your application unique.
6
6
 
7
7
  ---
8
8
 
9
- ## 🚀 Caractéristiques Principales
9
+ ## 🚀 Key Features
10
10
 
11
- - **Modélisation de données dynamique** : Créez des schémas de données via JSON sans migration de code.
12
- - **API RESTful puissante** : Opérations CRUD avancées, recherche et filtrage inclus.
13
- - **Architecture modulaire** : Ajoutez vos propres modules dynamiquement.
14
- - **Workflows d'automatisation** : Créez des processus métier automatisés.
15
- - **Authentification & autorisation** : Fournisseurs d'utilisateurs extensibles, rôles et permissions granulaires.
16
- - **📃 Packs de démarrage** : CRM, e-commerce, site vitrine, etc.
17
- - **🧠 Intégration IA** : Support de OpenAI, Google Gemini via LangChain.
18
- - **i18n complet** : Multilingue avec traduction des interfaces et validations.
19
- - **📄 Documentation automatique** : Swagger disponible par défaut sur `/api-docs`.
11
+ - **Dynamic data modeling**: Define and update schemas using JSON, no migrations required.
12
+ - **Robust REST API**: Advanced CRUD operations, filtering, and querying.
13
+ - **Modular architecture**: Load or extend modules dynamically.
14
+ - **Automation workflows**: Trigger actions on events or schedules.
15
+ - **Authentication & authorization**: Role-based access control, pluggable providers.
16
+ - **📦 Starter Packs**: CRM, e-commerce, showcase websites, etc.
17
+ - **🧠 AI Integration**: Supports OpenAI, Google Gemini via LangChain.
18
+ - **🌐 i18n support**: Multilingual interfaces, translated validations.
19
+ - **📄 Auto Documentation**: Swagger available at `/api-docs`.
20
20
 
21
21
  ---
22
22
 
23
- ## 🚀 Prérequisa
23
+ ## ⚙️ Requirements
24
24
 
25
25
  - Node.js ≥ 18
26
- - MongoDB installé ou accessible
27
- - NPM ou Yarn pour la gestion des dépendances
26
+ - MongoDB (local or remote)
27
+ - NPM or Yarn
28
28
 
29
29
  ---
30
30
 
31
- ## ⚡ Installation et Lancement Rapide
31
+ ## ⚡ Quick Start
32
32
 
33
33
  ```bash
34
- git clone https://votre-repository/data-primals-engine.git
34
+ git clone https://your-repo/data-primals-engine.git
35
35
  cd data-primals-engine
36
36
  npm install
37
37
  ```
38
38
 
39
- Créez un fichier `.env` à la racine :
39
+ Create a `.env` file:
40
40
  ```env
41
41
  MONGO_DB_URL=mongodb://127.0.0.1:27017
42
42
  ```
43
43
 
44
- Démarrer le serveur :
44
+ Start the server:
45
45
  ```bash
46
- # Mode développement
47
- tnpm run devserver
46
+ # Development mode
47
+ npm run devserver
48
48
 
49
- # Mode production
49
+ # Production mode
50
50
  npm run server
51
51
  ```
52
52
 
53
- Par défaut, l'application tourne sur le port **7633**.
53
+ By default, the app runs on port **7633**.
54
54
 
55
55
  ---
56
56
 
57
- ## 📊 Concepts Clés
58
-
59
- ### 1. 📂 Modèles
60
- Définis en JSON, les modèles structurent vos données.
57
+ ## 🧠 Concepts
61
58
 
59
+ ### 1. Models
60
+ Define schemas using JSON:
62
61
  ```json
63
62
  {
64
63
  "name": "product",
65
- "description": "Fiche produit e-commerce",
64
+ "description": "E-commerce product schema",
66
65
  "fields": [
67
66
  { "name": "name", "type": "string", "required": true },
68
67
  { "name": "price", "type": "number", "required": true },
@@ -72,33 +71,72 @@ Définis en JSON, les modèles structurent vos données.
72
71
  }
73
72
  ```
74
73
 
75
- ### 2. 📊 Modules
76
- Fonctionnalités activables via configuration :
74
+ ### 2. Modules
75
+ Activatable features:
77
76
  - `mongodb`, `data`, `user`, `workflow`, `file`, `assistant`, `swagger`
78
77
 
79
- ### 3. 🏘️ Packs de Démarrage
80
- - **E-commerce** : Produits, commandes, KPIs...
81
- - **CRM** : Contacts, opportunités, interactions
82
- - **Site web / blog** : Pages, articles, multi-langue
78
+ ### 3. Starter Packs
79
+ - **E-commerce**: Products, orders, KPIs
80
+ - **CRM**: Contacts, leads, interactions
81
+ - **Website/blog**: Pages, posts, i18n
83
82
 
84
- ### 4. Workflows
85
- Automatisez vos processus avec :
86
- - **Triggers** : DataAdded, DataUpdated, Scheduled, Manual
87
- - **Actions** : CreateData, UpdateData, SendEmail, ApiCall
83
+ ### 4. Workflows
84
+ Automate business processes:
85
+ - **Triggers**: `DataAdded`, `DataUpdated`, `Scheduled`, `Manual`
86
+ - **Actions**: `CreateData`, `UpdateData`, `SendEmail`, `ApiCall`
88
87
 
89
- Exemple :
90
- > Lors d'une nouvelle commande : Envoyer un mail au client, mettre à jour le stock, notifier la logistique.
88
+ Example:
89
+ > When a new order is created, email the customer, update stock, and notify logistics.
91
90
 
92
91
  ---
93
92
 
94
- ## 🔧 API : Exemple avec `curl`
93
+ ## 🔌 API Examples (using `curl`)
94
+
95
+ ### 📁 Model Management
95
96
 
96
- ### Créer un produit
97
+ #### Create a model
97
98
  ```bash
98
- curl -X POST http://localhost:7633/api/data \
99
+ curl -X POST http://localhost:7633/api/model?_user=demouser \
100
+ -H "Authorization: Bearer demotoken" \
99
101
  -H "Content-Type: application/json" \
100
- -H "_user: demouser" \
102
+ -d '{
103
+ "name": "newModel",
104
+ "description": "A test model.",
105
+ "fields": [
106
+ {"name": "title", "type": "string", "required": true},
107
+ {"name": "price", "type": "number"}
108
+ ]
109
+ }'
110
+ ```
111
+
112
+ #### Update a model
113
+ ```bash
114
+ curl -X PUT http://localhost:7633/api/model/60d0fe4f5311236168a109ca?_user=demouser \
115
+ -H "Authorization: Bearer demotoken" \
116
+ -H "Content-Type: application/json" \
117
+ -d '{
118
+ "name": "updatedModel",
119
+ "description": "Updated description.",
120
+ "fields": [
121
+ {"name": "title", "type": "string", "required": true},
122
+ {"name": "status", "type": "enum", "items": ["active", "inactive"]}
123
+ ]
124
+ }'
125
+ ```
126
+
127
+ #### Delete a model
128
+ ```bash
129
+ curl -X DELETE "http://localhost:7633/api/model?_user=demouser&name=newModel" \
130
+ -H "Authorization: Bearer demotoken"
131
+ ```
132
+
133
+ ### 🗂️ Data Management
134
+
135
+ #### Create a document
136
+ ```bash
137
+ curl -X POST http://localhost:7633/api/data?_user=demouser \
101
138
  -H "Authorization: Bearer demotoken" \
139
+ -H "Content-Type: application/json" \
102
140
  -d '{
103
141
  "model": "product",
104
142
  "data": {
@@ -110,29 +148,52 @@ curl -X POST http://localhost:7633/api/data \
110
148
  }'
111
149
  ```
112
150
 
113
- ### Rechercher des produits
151
+ #### Search documents
152
+ ```bash
153
+ curl -X POST http://localhost:7633/api/data/search?_user=demouser \
154
+ -H "Authorization: Bearer demotoken" \
155
+ -H "Content-Type: application/json" \
156
+ -d '{
157
+ "model": "product",
158
+ "filter": { "price": { "$gt": 50 } }
159
+ }'
160
+ ```
161
+
162
+ #### Update a document by ID
114
163
  ```bash
115
- curl -X POST http://localhost:7633/api/data/search \
164
+ curl -X PUT http://localhost:7633/api/data/64a31c123ef59d4c8d55aa99?_user=demouser \
165
+ -H "Authorization: Bearer demotoken" \
116
166
  -H "Content-Type: application/json" \
117
- -H "_user: demouser" \
167
+ -d '{
168
+ "model": "product",
169
+ "data": { "price": 109.99 }
170
+ }'
171
+ ```
172
+
173
+ #### Bulk update
174
+ ```bash
175
+ curl -X PUT http://localhost:7633/api/data?_user=demouser \
118
176
  -H "Authorization: Bearer demotoken" \
177
+ -H "Content-Type: application/json" \
119
178
  -d '{
120
179
  "model": "product",
121
- "filter": {
122
- "price": {
123
- "$gt": 50
124
- },
125
- "published": true
126
- },
127
- "sort": "price:ASC",
128
- "limit": 10,
129
- "depth": 1
180
+ "data": { "stock": 999 }
181
+ }'
182
+ ```
183
+
184
+ #### Delete documents
185
+ ```bash
186
+ curl -X DELETE http://localhost:7633/api/data?_user=demouser \
187
+ -H "Authorization: Bearer demotoken" \
188
+ -H "Content-Type: application/json" \
189
+ -d '{
190
+ "ids": ["64a31c123ef59d4c8d55aa99"]
130
191
  }'
131
192
  ```
132
193
 
133
194
  ---
134
195
 
135
- ## 📁 Structure du Projet
196
+ ## 📁 Project Structure
136
197
  ```
137
198
  data-primals-engine/
138
199
  ├── src/
@@ -149,21 +210,21 @@ data-primals-engine/
149
210
 
150
211
  ---
151
212
 
152
- ## 🌟 Comment Contribuer ?
213
+ ## 🤝 Contributing
153
214
 
154
- 1. Forkez le repo
155
- 2. Créez une branche : `git checkout -b feature/nom`
156
- 3. Commitez : `git commit -m "Ajout de ..."`
157
- 4. Push : `git push origin feature/nom`
158
- 5. Ouvrez une pull request
215
+ 1. Fork the repo
216
+ 2. Create your feature branch: `git checkout -b feature/your-feature`
217
+ 3. Commit changes: `git commit -m "Add new feature"`
218
+ 4. Push to your branch: `git push origin feature/your-feature`
219
+ 5. Open a pull request
159
220
 
160
- Merci de laisser une au repo si vous aimez le projet !
221
+ Starthe repo if you find it useful!
161
222
 
162
223
  ---
163
224
 
164
- ## 📚 Licence
165
- Distribué sous licence **MIT**. Voir le fichier `LICENSE`.
225
+ ## 📄 License
226
+ Distributed under the **MIT License**. See `LICENSE` file.
166
227
 
167
228
  ---
168
229
 
169
- ## 🔼 Retour en haut
230
+ ## 🔼 Back to Top
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "data-primals-engine",
3
- "version": "1.0.0",
4
- "description": "datas-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.",
3
+ "version": "1.0.1",
4
+
5
+ "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
6
  "main": "src/engine.js",
6
7
  "type": "module",
7
8
  "scripts": {
@@ -13,6 +14,10 @@
13
14
  "migrate:revert": "node src/migrate.js revert",
14
15
  "migrate:status": "node src/migrate.js status"
15
16
  },
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "https://github.com/anonympins/data-primals-engine.git"
20
+ },
16
21
  "exports": {
17
22
  ".": "./src/index.js",
18
23
  "./modules/*": "./src/modules/*.js",