data-primals-engine 1.5.2 → 1.6.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.
Files changed (63) hide show
  1. package/README.md +924 -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/ModelCreatorField.jsx +950 -950
  26. package/client/src/ModelList.jsx +280 -280
  27. package/client/src/Notification.jsx +136 -136
  28. package/client/src/PackGallery.jsx +391 -391
  29. package/client/src/PackGallery.scss +231 -231
  30. package/client/src/Pagination.jsx +143 -143
  31. package/client/src/RelationField.jsx +354 -354
  32. package/client/src/RelationSelectorWidget.jsx +172 -172
  33. package/client/src/RelationValue.jsx +2 -1
  34. package/client/src/contexts/CommandContext.jsx +260 -0
  35. package/client/src/contexts/ModelContext.jsx +4 -1
  36. package/client/src/contexts/UIContext.jsx +72 -72
  37. package/client/src/filter.js +263 -263
  38. package/client/src/index.css +90 -90
  39. package/package.json +6 -5
  40. package/perf/artillery-hooks.js +37 -37
  41. package/perf/setup.yml +25 -25
  42. package/src/constants.js +4 -0
  43. package/src/engine.js +335 -335
  44. package/src/events.js +232 -137
  45. package/src/filter.js +274 -274
  46. package/src/modules/assistant/assistant.js +225 -83
  47. package/src/modules/auth-google/index.js +50 -50
  48. package/src/modules/auth-microsoft/index.js +81 -81
  49. package/src/modules/data/data.core.js +118 -118
  50. package/src/modules/data/data.history.js +555 -555
  51. package/src/modules/data/data.operations.js +3401 -3381
  52. package/src/modules/data/data.relations.js +686 -686
  53. package/src/modules/data/data.routes.js +1879 -1879
  54. package/src/modules/data/data.validation.js +2 -2
  55. package/src/modules/file.js +247 -247
  56. package/src/packs.js +2 -2
  57. package/src/providers.js +2 -2
  58. package/src/services/stripe.js +196 -196
  59. package/src/sso.js +193 -193
  60. package/test/data.history.integration.test.js +264 -264
  61. package/test/data.integration.test.js +1206 -1206
  62. package/test/events.test.js +108 -10
  63. package/test/model.integration.test.js +377 -377
package/client/README.md CHANGED
@@ -1,136 +1,136 @@
1
- This guide explains how to integrate and use the client-side part of the `data-primals-engine` library in an external React application (such as hackersonline).
2
- The library provides a set of context Providers, Hooks, and UI components to interact with the `data-primals-engine` backend.
3
-
4
- # Table of Contents
5
- ## Prerequisites
6
- Your React application must have the following dependencies installed:
7
- - react & react-dom (version >= 18.0.0)
8
- - react-query (version >= 3.0.0)
9
- - react-router-dom
10
- - react-cookie
11
-
12
- ## What is `data-primals-engine`?
13
-
14
- The `data-primals-engine` is more than just a set of utilities; it's a comprehensive toolkit for building data-centric applications. Once integrated, it provides a full suite of UI components and hooks to manage your data lifecycle.
15
-
16
- ### Core Features
17
-
18
- * **AI-Powered Model Creator**: A complete UI for visually creating your data models, with support for dozens of field types (relations, translated text, numbers, files...) and advanced properties (history, validation, conditional display...).
19
- * **Dynamic Data Views**: Ready-to-use components to display your data, including:
20
- * A powerful and configurable **Data Table**.
21
- * A **Kanban View** with drag-and-drop.
22
- * A **Calendar View**.
23
- * **Dashboards & KPIs**: Build custom dashboards to monitor your activity with charts and Key Performance Indicators.
24
- * **Data Management Tools**:
25
- * A flexible **Data Importer** (CSV, Excel, JSON).
26
- * A powerful **Data Exporter**.
27
- * A **Visual Condition Builder** for creating complex queries.
28
- * **Built-in Systems**: The library also includes systems for **user tutorials**, **data versioning/history**, **backups**, and much more.
29
-
30
- This guide focuses on the technical integration. Once set up, you will be able to use the components and hooks provided by the library to leverage these features.
31
-
32
- ## Installation
33
- Install the library:
34
- ```shell
35
- npm install ../../data-primals-engine
36
- ```
37
- Install peer dependencies:
38
- ```shell
39
- npm install react-query react-router-dom react-cookie
40
- ```
41
-
42
- ## Basic Setup
43
-
44
- The setup mainly occurs in your application's root file (typically App.jsx or main.jsx).
45
-
46
- It consists of initializing a single QueryClient instance and wrapping your app with the required Providers.
47
-
48
- ### Set the QueryClient (Singleton)
49
- For react-query caching to work correctly across your app (including inside the library), it is crucial to instantiate QueryClient only once.
50
-
51
- The data-primals-engine library needs to know which QueryClient instance you're using. It exports a setQueryClient function for that purpose.
52
-
53
- ### Set up the Providers
54
- Your app must be wrapped by several Providers in the correct order so the contexts are available to all child components.
55
-
56
- ## Full example (App.jsx)
57
- Here's what your main application file should look like:
58
- ```jsx
59
- // In your main App.jsx file (e.g., hackersonline/client/src/App.jsx)
60
-
61
- import React from 'react';
62
- import { BrowserRouter, Routes, Route } from 'react-router-dom';
63
- import { CookiesProvider } from 'react-cookie';
64
-
65
- // 1. Import QueryClient and its Provider from react-query
66
- import { QueryClient, QueryClientProvider } from 'react-query';
67
-
68
- // 2. Import Providers and the config function from data-primals-engine
69
- import {
70
- ModelProvider,
71
- AuthProvider,
72
- UIProvider,
73
- NotificationProvider,
74
- setQueryClient // <-- Important config function
75
- } from 'data-primals-engine/client';
76
-
77
- // 3. Import the i18n config (see dedicated section)
78
- import 'data-primals-engine/i18n';
79
-
80
- // 4. (CRUCIAL) Create a unique instance of QueryClient
81
- const queryClient = new QueryClient();
82
-
83
- // 5. (CRUCIAL) Pass the instance to the shared library
84
- setQueryClient(queryClient);
85
-
86
- // Your page components
87
- import HomePage from './pages/HomePage';
88
- import UserDashboard from './pages/UserDashboard';
89
-
90
- function App() {
91
- return (
92
- // 6. Wrap the app with all required providers
93
- <QueryClientProvider client={queryClient}>
94
- <AuthProvider>
95
- <CookiesProvider>
96
- <ModelProvider>
97
- <BrowserRouter>
98
- <UIProvider>
99
- <NotificationProvider>
100
-
101
- {/* Your app content */}
102
- <Routes>
103
- <Route path="/" element={<HomePage />} />
104
- <Route path="/dashboard" element={<UserDashboard />} />
105
- {/* ... other routes */}
106
- </Routes>
107
-
108
- </NotificationProvider>
109
- </UIProvider>
110
- </BrowserRouter>
111
- </ModelProvider>
112
- </CookiesProvider>
113
- </AuthProvider>
114
- </QueryClientProvider>
115
- );
116
- }
117
-
118
- export default App;
119
- ```
120
-
121
- ## Internationalization (i18n)
122
- The library comes with its own i18next configuration and translation files.
123
- To enable it in your app, you just need to import the config module once in your main file (App.jsx or main.jsx):
124
-
125
- ```jsx
126
- // In App.jsx or main.jsx
127
- import 'data-primals-engine/i18n';
128
- ```
129
-
130
- This simple import will:
131
-
132
- - Initialize i18next.
133
- - Load default translations (French, English, etc.).
134
- - Enable automatic browser language detection.
135
-
136
- You can then use react-i18next components and hooks (useTranslation, Trans) as usual in your application.
1
+ This guide explains how to integrate and use the client-side part of the `data-primals-engine` library in an external React application (such as hackersonline).
2
+ The library provides a set of context Providers, Hooks, and UI components to interact with the `data-primals-engine` backend.
3
+
4
+ # Table of Contents
5
+ ## Prerequisites
6
+ Your React application must have the following dependencies installed:
7
+ - react & react-dom (version >= 18.0.0)
8
+ - react-query (version >= 3.0.0)
9
+ - react-router-dom
10
+ - react-cookie
11
+
12
+ ## What is `data-primals-engine`?
13
+
14
+ The `data-primals-engine` is more than just a set of utilities; it's a comprehensive toolkit for building data-centric applications. Once integrated, it provides a full suite of UI components and hooks to manage your data lifecycle.
15
+
16
+ ### Core Features
17
+
18
+ * **AI-Powered Model Creator**: A complete UI for visually creating your data models, with support for dozens of field types (relations, translated text, numbers, files...) and advanced properties (history, validation, conditional display...).
19
+ * **Dynamic Data Views**: Ready-to-use components to display your data, including:
20
+ * A powerful and configurable **Data Table**.
21
+ * A **Kanban View** with drag-and-drop.
22
+ * A **Calendar View**.
23
+ * **Dashboards & KPIs**: Build custom dashboards to monitor your activity with charts and Key Performance Indicators.
24
+ * **Data Management Tools**:
25
+ * A flexible **Data Importer** (CSV, Excel, JSON).
26
+ * A powerful **Data Exporter**.
27
+ * A **Visual Condition Builder** for creating complex queries.
28
+ * **Built-in Systems**: The library also includes systems for **user tutorials**, **data versioning/history**, **backups**, and much more.
29
+
30
+ This guide focuses on the technical integration. Once set up, you will be able to use the components and hooks provided by the library to leverage these features.
31
+
32
+ ## Installation
33
+ Install the library:
34
+ ```shell
35
+ npm install ../../data-primals-engine
36
+ ```
37
+ Install peer dependencies:
38
+ ```shell
39
+ npm install react-query react-router-dom react-cookie
40
+ ```
41
+
42
+ ## Basic Setup
43
+
44
+ The setup mainly occurs in your application's root file (typically App.jsx or main.jsx).
45
+
46
+ It consists of initializing a single QueryClient instance and wrapping your app with the required Providers.
47
+
48
+ ### Set the QueryClient (Singleton)
49
+ For react-query caching to work correctly across your app (including inside the library), it is crucial to instantiate QueryClient only once.
50
+
51
+ The data-primals-engine library needs to know which QueryClient instance you're using. It exports a setQueryClient function for that purpose.
52
+
53
+ ### Set up the Providers
54
+ Your app must be wrapped by several Providers in the correct order so the contexts are available to all child components.
55
+
56
+ ## Full example (App.jsx)
57
+ Here's what your main application file should look like:
58
+ ```jsx
59
+ // In your main App.jsx file (e.g., hackersonline/client/src/App.jsx)
60
+
61
+ import React from 'react';
62
+ import { BrowserRouter, Routes, Route } from 'react-router-dom';
63
+ import { CookiesProvider } from 'react-cookie';
64
+
65
+ // 1. Import QueryClient and its Provider from react-query
66
+ import { QueryClient, QueryClientProvider } from 'react-query';
67
+
68
+ // 2. Import Providers and the config function from data-primals-engine
69
+ import {
70
+ ModelProvider,
71
+ AuthProvider,
72
+ UIProvider,
73
+ NotificationProvider,
74
+ setQueryClient // <-- Important config function
75
+ } from 'data-primals-engine/client';
76
+
77
+ // 3. Import the i18n config (see dedicated section)
78
+ import 'data-primals-engine/i18n';
79
+
80
+ // 4. (CRUCIAL) Create a unique instance of QueryClient
81
+ const queryClient = new QueryClient();
82
+
83
+ // 5. (CRUCIAL) Pass the instance to the shared library
84
+ setQueryClient(queryClient);
85
+
86
+ // Your page components
87
+ import HomePage from './pages/HomePage';
88
+ import UserDashboard from './pages/UserDashboard';
89
+
90
+ function App() {
91
+ return (
92
+ // 6. Wrap the app with all required providers
93
+ <QueryClientProvider client={queryClient}>
94
+ <AuthProvider>
95
+ <CookiesProvider>
96
+ <ModelProvider>
97
+ <BrowserRouter>
98
+ <UIProvider>
99
+ <NotificationProvider>
100
+
101
+ {/* Your app content */}
102
+ <Routes>
103
+ <Route path="/" element={<HomePage />} />
104
+ <Route path="/dashboard" element={<UserDashboard />} />
105
+ {/* ... other routes */}
106
+ </Routes>
107
+
108
+ </NotificationProvider>
109
+ </UIProvider>
110
+ </BrowserRouter>
111
+ </ModelProvider>
112
+ </CookiesProvider>
113
+ </AuthProvider>
114
+ </QueryClientProvider>
115
+ );
116
+ }
117
+
118
+ export default App;
119
+ ```
120
+
121
+ ## Internationalization (i18n)
122
+ The library comes with its own i18next configuration and translation files.
123
+ To enable it in your app, you just need to import the config module once in your main file (App.jsx or main.jsx):
124
+
125
+ ```jsx
126
+ // In App.jsx or main.jsx
127
+ import 'data-primals-engine/i18n';
128
+ ```
129
+
130
+ This simple import will:
131
+
132
+ - Initialize i18next.
133
+ - Load default translations (French, English, etc.).
134
+ - Enable automatic browser language detection.
135
+
136
+ You can then use react-i18next components and hooks (useTranslation, Trans) as usual in your application.
package/client/index.js CHANGED
@@ -22,4 +22,3 @@ export { default as MessageRotator } from './src/MessageRotator';
22
22
  export { default as DocumentationPageLayout } from './src/DocumentationPageLayout';
23
23
  export { default as ContentView } from './src/ContentView';
24
24
  export { default as AssistantChat } from './src/AssistantChat';
25
- export { setQueryClient } from './src/App.jsx';