data-primals-engine 1.3.4 → 1.4.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.
Files changed (42) hide show
  1. package/README.md +72 -2
  2. package/client/README.md +20 -0
  3. package/client/package-lock.json +712 -147
  4. package/client/package.json +38 -37
  5. package/client/src/App.jsx +9 -10
  6. package/client/src/App.scss +7 -1
  7. package/client/src/Dashboard.jsx +349 -208
  8. package/client/src/DashboardView.jsx +569 -547
  9. package/client/src/DataEditor.jsx +20 -2
  10. package/client/src/DataLayout.jsx +24 -12
  11. package/client/src/DataTable.jsx +807 -760
  12. package/client/src/DataTable.scss +187 -90
  13. package/client/src/Field.jsx +1783 -1656
  14. package/client/src/ModelCreator.jsx +2 -2
  15. package/client/src/ModelCreatorField.jsx +906 -804
  16. package/client/src/ModelList.jsx +2 -2
  17. package/client/src/PackGallery.jsx +391 -290
  18. package/client/src/PackGallery.scss +231 -210
  19. package/client/src/constants.js +16 -4
  20. package/client/src/translations.js +16750 -16392
  21. package/package.json +14 -11
  22. package/src/core.js +9 -0
  23. package/src/defaultModels.js +18 -10
  24. package/src/email.js +2 -1
  25. package/src/gameObject.js +1 -1
  26. package/src/i18n.js +501 -28
  27. package/src/modules/auth-google/index.js +51 -0
  28. package/src/modules/auth-microsoft/index.js +82 -0
  29. package/src/modules/auth-saml/index.js +90 -0
  30. package/src/modules/data/data.core.js +5 -1
  31. package/src/modules/data/data.history.js +489 -489
  32. package/src/modules/data/data.js +86 -12
  33. package/src/modules/data/data.routes.js +1691 -1663
  34. package/src/modules/user.js +19 -0
  35. package/src/modules/workflow.js +2 -12
  36. package/src/providers.js +110 -1
  37. package/src/sso.js +194 -0
  38. package/test/data.integration.test.js +3 -0
  39. package/test/user.test.js +1 -1
  40. package/client/public/demo/26899917-d1ba-4df4-bb33-48d09a8778da.jpg +0 -0
  41. package/client/public/demo/4b9894c7-12cd-466d-8fd3-a2757b09ec96.jpg +0 -0
  42. package/client/public/demo/7ed369ac-a1a2-4b45-b0cd-4fd5bcf5a75a.jpg +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "data-primals-engine",
3
- "version": "1.3.4",
3
+ "version": "1.4.1",
4
4
  "description": "data-primals-engine is a package responsible from handling large amount of data using MongoDB in a practical and performant way. It can also get workflow models working (for automation), and fully supports internationalisation. It also has integrated AI assistant.",
5
5
  "main": "src/engine.js",
6
6
  "type": "module",
@@ -31,12 +31,11 @@
31
31
  "tar-fs": "3.0.9",
32
32
  "on-headers": "1.1.0",
33
33
  "brace-expansion": "2.0.2",
34
- "prismjs": "1.30.0"
34
+ "prismjs": "1.30.0",
35
+ "xml2js": ">=0.5.0"
35
36
  },
36
37
  "overrides": {
37
- "refractor": {
38
- "prismjs": "1.30.0"
39
- }
38
+ "prismjs": "1.30.0"
40
39
  },
41
40
  "repository": {
42
41
  "type": "git",
@@ -49,11 +48,6 @@
49
48
  "./client": "./client/index.js",
50
49
  "./*": "./src/*.js"
51
50
  },
52
- "peerDependencies": {
53
- "express": "^5.1.0",
54
- "react": "18.3.1",
55
- "react-query": ">=3.0.0"
56
- },
57
51
  "dependencies": {
58
52
  "@langchain/anthropic": "^0.3.26",
59
53
  "@langchain/core": "^0.3.66",
@@ -85,10 +79,11 @@
85
79
  "node-schedule": "^2.1.1",
86
80
  "nodemailer": "^7.0.5",
87
81
  "openai": "^5.10.2",
82
+ "passport": "^0.7.0",
83
+ "passport-saml-encrypted": "^0.1.13",
88
84
  "process": "^0.11.10",
89
85
  "prop-types": "^15.8.1",
90
86
  "randomcolor": "^0.6.2",
91
- "react-i18next": "^15.6.1",
92
87
  "react-markdown": "^10.1.0",
93
88
  "read-excel-file": "^5.8.8",
94
89
  "request-ip": "^3.3.0",
@@ -102,6 +97,14 @@
102
97
  "vitest": "^3.2.4",
103
98
  "yaml": "^2.8.0"
104
99
  },
100
+ "peerDependencies": {
101
+ "express": "^5.1.0",
102
+ "passport-azure-ad": "^4.3.5",
103
+ "passport-google-oauth20": "^2.0.0",
104
+ "react": "18.3.1",
105
+ "react-i18next": "^15.6.1",
106
+ "react-query": ">=3.0.0"
107
+ },
105
108
  "devDependencies": {
106
109
  "@eslint/js": "^9.32.0",
107
110
  "concurrently": "^9.2.0",
package/src/core.js CHANGED
@@ -9,6 +9,15 @@ export function escapeRegex(string) {
9
9
  return string.replace(/[/\-\\^$*+?.()|[\]{}]/g, '\\$&');
10
10
  }
11
11
 
12
+ export const sequential = async (tasks) => {
13
+ const res = [];
14
+ for (const task of tasks) {
15
+ const r = await task();
16
+ res.push(r);
17
+ }
18
+ return res;
19
+ };
20
+
12
21
  export function isValidRegex(s) {
13
22
  try {
14
23
  const m = s.match(/^([/~@;%#'])(.*?)\1([gimsuy]*)$/);
@@ -180,18 +180,25 @@ export const defaultModels = {
180
180
  cronMask: [false, true, true, true, true, true],
181
181
  hint: "À quelle fréquence vérifier si la condition est remplie."
182
182
  },
183
+ { name: "isActive", type: "boolean", default: true },
183
184
  {
184
- name: "notificationChannel",
185
- type: "enum",
186
- items: ["in_app", "email"],
187
- default: "in_app"
185
+ name: "sendEmail",
186
+ type: "boolean",
187
+ default: false,
188
+ hint: "Cochez pour envoyer également une notification par e-mail."
188
189
  },
189
- { name: "isActive", type: "boolean", default: true },
190
190
  {
191
191
  name: "lastNotifiedAt",
192
192
  type: "datetime",
193
193
  required: false, // Important: ce champ est géré par le système
194
194
  hint: "Timestamp de la dernière notification envoyée pour cette alerte."
195
+ },
196
+ {
197
+ name: "message",
198
+ type: "richtext_t",
199
+ required: false,
200
+ hint: "Message personnalisé pour l'e-mail. Si vide, un message par défaut sera utilisé. Vous pouvez utiliser les variables {count}, {alert.name}....",
201
+ condition: { $eq: ["$sendEmail", true] }
195
202
  }
196
203
  ]
197
204
  },
@@ -1082,11 +1089,12 @@ export const defaultModels = {
1082
1089
  hint: "Structure JSON décrivant l'organisation des KPIs. Exemple : { \"type\": \"columns\", \"columns\": [ [\"kpi_id_1\"], [\"kpi_id_2\", \"kpi_id_3\"] ] }."
1083
1090
  },
1084
1091
  {
1085
- name: 'settings', // Paramètres spécifiques à ce tableau de bord
1086
- type: 'code', // Utilisation du type 'code' pour stocker des paramètres JSON
1087
- language: 'json',
1088
- default: { "defaultTimeRange": "last_7_days", "refreshInterval": null }, // Paramètres par défaut (plage de temps, pas de rafraîchissement auto)
1089
- hint: "Paramètres JSON pour le tableau de bord, comme la plage de temps par défaut ('defaultTimeRange') ou l'intervalle de rafraîchissement en secondes ('refreshInterval')."
1092
+ name: 'refreshInterval',
1093
+ type: 'number',
1094
+ delay: true, // Sera interprété par le front-end comme un champ de durée
1095
+ unit: 's',
1096
+ min: 0,
1097
+ hint: "Intervalle de rafraîchissement automatique en secondes. Laisser vide ou à 0 pour désactiver."
1090
1098
  },
1091
1099
  {
1092
1100
  name: 'isDefault', // Indicateur pour le tableau de bord par défaut
package/src/email.js CHANGED
@@ -47,7 +47,7 @@ const createTransporter = (smtpConfig) => {
47
47
  export const sendEmail = async (email = "", data, smtpConfig = null, lang, tpl = null) => {
48
48
  const contactEmail = smtpConfig ? (smtpConfig.from || emailDefaultConfig.from) :"Our company <noreply@ourdomain.tld>";
49
49
  const emails = Array.isArray(email) ? email : [email];
50
- if (emails.length === 0) return;
50
+ if (emails.length === 0) return false;
51
51
 
52
52
  // Choisir le transporteur à utiliser
53
53
  const transporter = smtpConfig ? createTransporter(smtpConfig||emailDefaultConfig) : defaultTransporter;
@@ -76,6 +76,7 @@ export const sendEmail = async (email = "", data, smtpConfig = null, lang, tpl =
76
76
  try {
77
77
  await Promise.all(sendPromises);
78
78
  console.log(`Email(s) sent successfully to : ${emails.join(', ')}`);
79
+ return true;
79
80
  } catch (error) {
80
81
  console.error("Error when sending to one ore more emails :", error);
81
82
  // Vous pouvez relancer l'erreur si vous voulez que l'appelant la gère
package/src/gameObject.js CHANGED
@@ -33,7 +33,7 @@ export const GameObject = {
33
33
  }
34
34
  }
35
35
  // Behavior.js
36
- class Behaviour {
36
+ export class Behaviour {
37
37
  constructor(gameObject) {
38
38
  this.gameObject = gameObject;
39
39
  Event.Trigger("GameObject."+(this.constructor.name)+".init", "system", "calls", this);