data-primals-engine 1.5.2 → 1.6.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 (70) hide show
  1. package/README.md +938 -915
  2. package/client/README.md +136 -136
  3. package/client/index.js +0 -1
  4. package/client/public/doc/API.postman_collection.json +213 -213
  5. package/client/public/react.svg +9 -9
  6. package/client/src/AddWidgetTypeModal.jsx +47 -47
  7. package/client/src/App.css +42 -42
  8. package/client/src/App.jsx +92 -150
  9. package/client/src/App.scss +6 -0
  10. package/client/src/AssistantChat.jsx +362 -363
  11. package/client/src/Button.jsx +12 -12
  12. package/client/src/Dashboard.jsx +480 -480
  13. package/client/src/DashboardHtmlViewItem.jsx +146 -146
  14. package/client/src/DashboardView.jsx +654 -654
  15. package/client/src/DataEditor.jsx +383 -383
  16. package/client/src/DataLayout.jsx +779 -808
  17. package/client/src/DataTable.jsx +782 -822
  18. package/client/src/DataTable.scss +186 -186
  19. package/client/src/GeolocationField.jsx +93 -93
  20. package/client/src/HistoryDialog.jsx +307 -307
  21. package/client/src/HistoryDialog.scss +319 -319
  22. package/client/src/HtmlViewBuilderModal.jsx +90 -90
  23. package/client/src/HtmlViewBuilderModal.scss +17 -17
  24. package/client/src/HtmlViewCard.jsx +43 -43
  25. package/client/src/ModelCreator.jsx +683 -686
  26. package/client/src/ModelCreator.scss +1 -1
  27. package/client/src/ModelCreatorField.jsx +950 -950
  28. package/client/src/ModelImporter.jsx +3 -0
  29. package/client/src/ModelList.jsx +280 -280
  30. package/client/src/Notification.jsx +136 -136
  31. package/client/src/PackGallery.jsx +391 -391
  32. package/client/src/PackGallery.scss +231 -231
  33. package/client/src/Pagination.jsx +143 -143
  34. package/client/src/RelationField.jsx +354 -354
  35. package/client/src/RelationSelectorWidget.jsx +172 -172
  36. package/client/src/RelationValue.jsx +2 -1
  37. package/client/src/contexts/CommandContext.jsx +260 -0
  38. package/client/src/contexts/ModelContext.jsx +4 -1
  39. package/client/src/contexts/UIContext.jsx +72 -72
  40. package/client/src/filter.js +263 -263
  41. package/client/src/index.css +90 -90
  42. package/package.json +6 -5
  43. package/perf/artillery-hooks.js +37 -37
  44. package/perf/setup.yml +25 -25
  45. package/src/constants.js +4 -0
  46. package/src/defaultModels.js +7 -0
  47. package/src/engine.js +335 -335
  48. package/src/events.js +232 -137
  49. package/src/filter.js +274 -274
  50. package/src/index.js +1 -0
  51. package/src/modules/assistant/assistant.js +225 -83
  52. package/src/modules/auth-google/index.js +50 -50
  53. package/src/modules/auth-microsoft/index.js +81 -81
  54. package/src/modules/data/data.core.js +118 -118
  55. package/src/modules/data/data.history.js +555 -555
  56. package/src/modules/data/data.operations.js +112 -9
  57. package/src/modules/data/data.relations.js +686 -686
  58. package/src/modules/data/data.routes.js +1879 -1879
  59. package/src/modules/data/data.validation.js +2 -2
  60. package/src/modules/file.js +247 -247
  61. package/src/modules/user.js +14 -9
  62. package/src/packs.js +2 -2
  63. package/src/providers.js +2 -2
  64. package/src/services/stripe.js +196 -196
  65. package/src/sso.js +193 -193
  66. package/test/data.history.integration.test.js +264 -264
  67. package/test/data.integration.test.js +1281 -1206
  68. package/test/events.test.js +108 -10
  69. package/test/model.integration.test.js +377 -377
  70. package/test/user.test.js +106 -1
@@ -1,90 +1,90 @@
1
- /* index.css */
2
- @import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap');
3
-
4
- :root {
5
- font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
6
- line-height: 1.5;
7
- font-weight: 400;
8
-
9
- color-scheme: light dark;
10
- color: rgba(255, 255, 255, 0.87);
11
- background-color: #242424;
12
-
13
- font-synthesis: none;
14
- text-rendering: optimizeLegibility;
15
- -webkit-font-smoothing: antialiased;
16
- -moz-osx-font-smoothing: grayscale;
17
- }
18
-
19
-
20
- #root {
21
- width: 100%;
22
- display: flex;
23
- flex-direction: column;
24
- align-items: stretch;
25
- justify-content: flex-start;
26
- }
27
-
28
-
29
- body {
30
- margin: 0;
31
- display: flex;
32
- min-width: 320px;
33
- min-height: 100vh;
34
- }
35
-
36
- h1 {
37
- font-size: 2em; /* Slightly reduced for better balance */
38
- line-height: 1.2;
39
- margin-bottom: 0.5em; /* Added margin for spacing */
40
- }
41
-
42
- h2 {
43
- font-size: 1.5em;
44
- line-height: 1.3;
45
- margin-bottom: 0.5em;
46
- }
47
-
48
- h3 {
49
- font-size: 1.4em;
50
- line-height: 1.3;
51
- margin-bottom: 0.5em;
52
- }
53
-
54
- h4 {
55
- font-size: 1.2em;
56
- line-height: 1.3;
57
- margin-bottom: 0.5em;
58
- }
59
-
60
- button {
61
- border-radius: 8px;
62
- border: 1px solid transparent;
63
- padding: 0.15em 0.25em;
64
- font-size: 0.9em;
65
- font-weight: 500;
66
- font-family: inherit;
67
- background-color: #1a1a1a;
68
- cursor: pointer;
69
- transition: border-color 0.25s;
70
- }
71
- button:hover {
72
- border-color: #4767FF;
73
- }
74
- button:focus,
75
- button:focus-visible {
76
- outline: 4px auto -webkit-focus-ring-color;
77
- }
78
-
79
- @media (prefers-color-scheme: light) {
80
- :root {
81
- color: #213547;
82
- background-color: #ffffff;
83
- }
84
- a:hover {
85
- color: #4767FF;
86
- }
87
- button {
88
- background-color: #f9f9f9;
89
- }
90
- }
1
+ /* index.css */
2
+ @import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap');
3
+
4
+ :root {
5
+ font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
6
+ line-height: 1.5;
7
+ font-weight: 400;
8
+
9
+ color-scheme: light dark;
10
+ color: rgba(255, 255, 255, 0.87);
11
+ background-color: #242424;
12
+
13
+ font-synthesis: none;
14
+ text-rendering: optimizeLegibility;
15
+ -webkit-font-smoothing: antialiased;
16
+ -moz-osx-font-smoothing: grayscale;
17
+ }
18
+
19
+
20
+ #root {
21
+ width: 100%;
22
+ display: flex;
23
+ flex-direction: column;
24
+ align-items: stretch;
25
+ justify-content: flex-start;
26
+ }
27
+
28
+
29
+ body {
30
+ margin: 0;
31
+ display: flex;
32
+ min-width: 320px;
33
+ min-height: 100vh;
34
+ }
35
+
36
+ h1 {
37
+ font-size: 2em; /* Slightly reduced for better balance */
38
+ line-height: 1.2;
39
+ margin-bottom: 0.5em; /* Added margin for spacing */
40
+ }
41
+
42
+ h2 {
43
+ font-size: 1.5em;
44
+ line-height: 1.3;
45
+ margin-bottom: 0.5em;
46
+ }
47
+
48
+ h3 {
49
+ font-size: 1.4em;
50
+ line-height: 1.3;
51
+ margin-bottom: 0.5em;
52
+ }
53
+
54
+ h4 {
55
+ font-size: 1.2em;
56
+ line-height: 1.3;
57
+ margin-bottom: 0.5em;
58
+ }
59
+
60
+ button {
61
+ border-radius: 8px;
62
+ border: 1px solid transparent;
63
+ padding: 0.15em 0.25em;
64
+ font-size: 0.9em;
65
+ font-weight: 500;
66
+ font-family: inherit;
67
+ background-color: #1a1a1a;
68
+ cursor: pointer;
69
+ transition: border-color 0.25s;
70
+ }
71
+ button:hover {
72
+ border-color: #4767FF;
73
+ }
74
+ button:focus,
75
+ button:focus-visible {
76
+ outline: 4px auto -webkit-focus-ring-color;
77
+ }
78
+
79
+ @media (prefers-color-scheme: light) {
80
+ :root {
81
+ color: #213547;
82
+ background-color: #ffffff;
83
+ }
84
+ a:hover {
85
+ color: #4767FF;
86
+ }
87
+ button {
88
+ background-color: #f9f9f9;
89
+ }
90
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "data-primals-engine",
3
- "version": "1.5.2",
3
+ "version": "1.6.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",
@@ -28,11 +28,12 @@
28
28
  "@rollup/rollup-linux-x64-gnu": "4.6.1"
29
29
  },
30
30
  "resolutions": {
31
- "tar-fs": "3.0.9",
32
31
  "on-headers": "1.1.0",
33
32
  "brace-expansion": "2.0.2",
34
33
  "prismjs": "1.30.0",
35
- "xml2js": ">=0.5.0"
34
+ "xml2js": ">=0.5.0",
35
+ "tar-fs": ">=3.1.1",
36
+ "vite": ">=7.0.8"
36
37
  },
37
38
  "overrides": {
38
39
  "react-syntax-highlighter": {
@@ -76,13 +77,13 @@
76
77
  "express-session": "^1.18.2",
77
78
  "handlebars": "^4.7.8",
78
79
  "i18next-browser-languagedetector": "^8.2.0",
79
- "isolated-vm": "^4.7.2",
80
+ "isolated-vm": "^5.0.0",
80
81
  "juice": "^11.0.1",
81
82
  "mathjs": "^14.6.0",
82
83
  "mongodb": "^6.18.0",
83
84
  "node-cache": "^5.1.2",
84
85
  "node-schedule": "^2.1.1",
85
- "nodemailer": "^7.0.5",
86
+ "nodemailer": "^7.0.7",
86
87
  "openai": "^5.10.2",
87
88
  "passport": "^0.7.0",
88
89
  "passport-saml-encrypted": "^0.1.13",
@@ -1,37 +1,37 @@
1
- import {uuidv4} from "../src/core.js";
2
-
3
-
4
- export function setScenarioVariables(context, events, done) {
5
- // context.vars is where we store variables for the virtual user's session
6
- context.vars.vuId = uuidv4().replace(/-/g, '');
7
- context.vars.demoUser = `perf${Math.floor(Math.random() * 9000000) + 1000000}`;
8
- return done();
9
- }
10
- // Hook to name requests to aggregate metrics by endpoint
11
- export function metricsByEndpoint_beforeRequest(requestParams, context, ee, next) {
12
- // Remove query parameters for the metric name
13
- const urlPath = requestParams.url.split('?')[0];
14
-
15
- // Replace unique IDs (ObjectId or UUID) in the URL with a placeholder for aggregation
16
- // Example: /api/data/60d0fe4f5311236168a109ca -> /api/data/:id
17
- const name = urlPath.replace(/([a-fA-F0-9]{24}|[a-fA-F0-9-]{36})/g, ':id');
18
-
19
- // Emit an internal Artillery event to name the request
20
- ee.emit('request:set_name', name);
21
-
22
- return next();
23
- }
24
-
25
- // Hook pour logger les erreurs de manière détaillée
26
- export function metricsByEndpoint_afterResponse(requestParams, response, context, ee, next) {
27
- // On vérifie si le statut est un code d'erreur (4xx ou 5xx)
28
- if (response.statusCode >= 400) {
29
- console.error(`\n[ERREUR] Requête ${requestParams.method} ${requestParams.url} a échoué avec le statut ${response.statusCode}`);
30
- // On log le corps de la réponse, qui contient souvent le message d'erreur du serveur
31
- if (response.body) {
32
- console.error(` -> Réponse: ${response.body}\n`);
33
- }
34
- }
35
- // On passe à la suite du scénario
36
- return next();
37
- }
1
+ import {uuidv4} from "../src/core.js";
2
+
3
+
4
+ export function setScenarioVariables(context, events, done) {
5
+ // context.vars is where we store variables for the virtual user's session
6
+ context.vars.vuId = uuidv4().replace(/-/g, '');
7
+ context.vars.demoUser = `perf${Math.floor(Math.random() * 9000000) + 1000000}`;
8
+ return done();
9
+ }
10
+ // Hook to name requests to aggregate metrics by endpoint
11
+ export function metricsByEndpoint_beforeRequest(requestParams, context, ee, next) {
12
+ // Remove query parameters for the metric name
13
+ const urlPath = requestParams.url.split('?')[0];
14
+
15
+ // Replace unique IDs (ObjectId or UUID) in the URL with a placeholder for aggregation
16
+ // Example: /api/data/60d0fe4f5311236168a109ca -> /api/data/:id
17
+ const name = urlPath.replace(/([a-fA-F0-9]{24}|[a-fA-F0-9-]{36})/g, ':id');
18
+
19
+ // Emit an internal Artillery event to name the request
20
+ ee.emit('request:set_name', name);
21
+
22
+ return next();
23
+ }
24
+
25
+ // Hook pour logger les erreurs de manière détaillée
26
+ export function metricsByEndpoint_afterResponse(requestParams, response, context, ee, next) {
27
+ // On vérifie si le statut est un code d'erreur (4xx ou 5xx)
28
+ if (response.statusCode >= 400) {
29
+ console.error(`\n[ERREUR] Requête ${requestParams.method} ${requestParams.url} a échoué avec le statut ${response.statusCode}`);
30
+ // On log le corps de la réponse, qui contient souvent le message d'erreur du serveur
31
+ if (response.body) {
32
+ console.error(` -> Réponse: ${response.body}\n`);
33
+ }
34
+ }
35
+ // On passe à la suite du scénario
36
+ return next();
37
+ }
package/perf/setup.yml CHANGED
@@ -1,26 +1,26 @@
1
- config:
2
- target: "http://localhost:7633"
3
- phases:
4
- # Exécute ce scénario une seule fois avec un seul utilisateur virtuel
5
- - duration: 1
6
- arrivalCount: 1
7
- defaults:
8
- headers:
9
- # Utilise le token statique de l'utilisateur 'demo' pour l'installation
10
- Authorization: "Bearer demotoken"
11
- Content-Type: 'application/json'
12
-
13
- scenarios:
14
- - name: "Installation unique des packs de données"
15
- flow:
16
- - log: "Installation du 'Website Starter Pack'..."
17
- - post:
18
- url: "/api/packs/install?_user=demo"
19
- json:
20
- packName: "Website Starter Pack"
21
- - log: "Installation du 'Multilingual starter pack'..."
22
- - post:
23
- url: "/api/packs/install?_user=demo"
24
- json:
25
- packName: "Multilingual starter pack"
1
+ config:
2
+ target: "http://localhost:7633"
3
+ phases:
4
+ # Exécute ce scénario une seule fois avec un seul utilisateur virtuel
5
+ - duration: 1
6
+ arrivalCount: 1
7
+ defaults:
8
+ headers:
9
+ # Utilise le token statique de l'utilisateur 'demo' pour l'installation
10
+ Authorization: "Bearer demotoken"
11
+ Content-Type: 'application/json'
12
+
13
+ scenarios:
14
+ - name: "Installation unique des packs de données"
15
+ flow:
16
+ - log: "Installation du 'Website Starter Pack'..."
17
+ - post:
18
+ url: "/api/packs/install?_user=demo"
19
+ json:
20
+ packName: "Website Starter Pack"
21
+ - log: "Installation du 'Multilingual starter pack'..."
22
+ - post:
23
+ url: "/api/packs/install?_user=demo"
24
+ json:
25
+ packName: "Multilingual starter pack"
26
26
  - log: "Installation terminée."
package/src/constants.js CHANGED
@@ -52,6 +52,10 @@ export const emailDefaultConfig = {
52
52
  pass: 'password'
53
53
  }
54
54
 
55
+ export const assistantConfig = {
56
+ maxTokens: 4000
57
+ }
58
+
55
59
  /**
56
60
  * Maximum number of models per user
57
61
  * @type {number}
@@ -84,6 +84,13 @@ export const defaultModels = {
84
84
  "required": false,
85
85
  "index": true,
86
86
  "hint": "Si défini, l'exception (l'octroi ou la révocation) est temporaire."
87
+ },
88
+ {
89
+ "name": "env",
90
+ "type": "relation",
91
+ "relation": "env",
92
+ "required": false,
93
+ "hint": "Si défini, la permission ne s'applique qu'à cet environnement. Sinon, elle est globale."
87
94
  }
88
95
  ]
89
96
  },