data-primals-engine 1.0.11 → 1.1.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.
- package/README.md +36 -0
- package/client/README.md +116 -0
- package/client/index.html +31 -0
- package/client/index.js +25 -0
- package/client/package-lock.json +11664 -0
- package/client/package.json +70 -0
- package/client/public/demo/26899917-d1ba-4df4-bb33-48d09a8778da.jpg +0 -0
- package/client/public/demo/4b9894c7-12cd-466d-8fd3-a2757b09ec96.jpg +0 -0
- package/client/public/demo/7ed369ac-a1a2-4b45-b0cd-4fd5bcf5a75a.jpg +0 -0
- package/client/public/doc/API.postman_collection.json +214 -0
- package/client/public/github.svg +1 -0
- package/client/public/profilCompany.jpg +0 -0
- package/client/public/profilDeveloper.jpg +0 -0
- package/client/public/profilEngineer.jpg +0 -0
- package/client/public/profilPersonal.jpg +0 -0
- package/client/public/profils .psd +0 -0
- package/client/public/react.svg +9 -0
- package/client/src/APIInfo.jsx +328 -0
- package/client/src/AddWidgetTypeModal.jsx +44 -0
- package/client/src/AddWidgetTypeModal.scss +87 -0
- package/client/src/App.css +42 -0
- package/client/src/App.jsx +588 -0
- package/client/src/App.scss +1466 -0
- package/client/src/AssistantChat.jsx +280 -0
- package/client/src/AssistantChat.scss +229 -0
- package/client/src/Button.jsx +12 -0
- package/client/src/Button.scss +197 -0
- package/client/src/CalculationBuilder.jsx +338 -0
- package/client/src/CalculationStepRow.jsx +199 -0
- package/client/src/CalendarConfigModal.jsx +49 -0
- package/client/src/ChartConfigModal.jsx +402 -0
- package/client/src/ConditionBuilder.jsx +622 -0
- package/client/src/ConditionBuilder.scss +672 -0
- package/client/src/ConditionBuilder2.jsx +757 -0
- package/client/src/ContentView.jsx +274 -0
- package/client/src/CronBuilder.jsx +126 -0
- package/client/src/CronBuilder.scss +128 -0
- package/client/src/CronPartBuilder.jsx +150 -0
- package/client/src/Dashboard.jsx +210 -0
- package/client/src/Dashboard.scss +445 -0
- package/client/src/DashboardChart.jsx +362 -0
- package/client/src/DashboardFlexViewItem.jsx +129 -0
- package/client/src/DashboardView.jsx +554 -0
- package/client/src/DataChart.jsx +349 -0
- package/client/src/DataEditor.jsx +556 -0
- package/client/src/DataLayout.jsx +709 -0
- package/client/src/DataTable.jsx +996 -0
- package/client/src/DataTable.scss +73 -0
- package/client/src/Dialog.jsx +90 -0
- package/client/src/Dialog.scss +117 -0
- package/client/src/DisplayFlexNodeRenderer.jsx +115 -0
- package/client/src/DocumentationPageLayout.jsx +93 -0
- package/client/src/DocumentationPageLayout.scss +262 -0
- package/client/src/Draggable.jsx +222 -0
- package/client/src/Draggable.scss +49 -0
- package/client/src/ExportDialog.jsx +172 -0
- package/client/src/Field.jsx +1558 -0
- package/client/src/FlexBuilder.jsx +269 -0
- package/client/src/FlexBuilder.scss +226 -0
- package/client/src/FlexBuilderControls.jsx +170 -0
- package/client/src/FlexBuilderModal.jsx +75 -0
- package/client/src/FlexBuilderModal.scss +109 -0
- package/client/src/FlexBuilderPreview.jsx +48 -0
- package/client/src/FlexBuilderUtils.js +84 -0
- package/client/src/FlexDataRenderer.jsx +170 -0
- package/client/src/FlexDataRenderer.scss +80 -0
- package/client/src/FlexNode.jsx +290 -0
- package/client/src/FlexTreeUtils.js +129 -0
- package/client/src/HiddenableCell.jsx +46 -0
- package/client/src/HiddenableCell.scss +36 -0
- package/client/src/KPIDialog.jsx +39 -0
- package/client/src/KPIWidget.jsx +139 -0
- package/client/src/KanbanCard.jsx +92 -0
- package/client/src/KanbanColumn.jsx +29 -0
- package/client/src/KanbanConfigModal.jsx +115 -0
- package/client/src/KanbanView.jsx +113 -0
- package/client/src/KanbanView.scss +107 -0
- package/client/src/MessageRotator.jsx +77 -0
- package/client/src/MessageRotator.scss +14 -0
- package/client/src/ModelCreator.jsx +640 -0
- package/client/src/ModelCreator.scss +154 -0
- package/client/src/ModelCreatorField.jsx +810 -0
- package/client/src/ModelImporter.jsx +120 -0
- package/client/src/ModelList.jsx +205 -0
- package/client/src/Notification.jsx +137 -0
- package/client/src/Notification.scss +126 -0
- package/client/src/NotificationProvider.jsx +73 -0
- package/client/src/PackGallery.jsx +211 -0
- package/client/src/PackGallery.scss +156 -0
- package/client/src/Pagination.jsx +141 -0
- package/client/src/RTE.jsx +415 -0
- package/client/src/RTETrans.jsx +103 -0
- package/client/src/RelationField.jsx +247 -0
- package/client/src/RelationValue.jsx +230 -0
- package/client/src/RestoreConfirmationModal.jsx +183 -0
- package/client/src/RestoreDialog.jsx +134 -0
- package/client/src/RestoreDialog.scss +67 -0
- package/client/src/RichTextEditorModal.jsx +34 -0
- package/client/src/RichTextEditorModal.scss +54 -0
- package/client/src/TourSpotlight.jsx +234 -0
- package/client/src/TourSpotlight.scss +100 -0
- package/client/src/TutorialsMenu.jsx +83 -0
- package/client/src/TutorialsMenu.scss +217 -0
- package/client/src/TutorialsRewardModal.jsx +65 -0
- package/client/src/Utils.jsx +78 -0
- package/client/src/ViewSwitcher.jsx +54 -0
- package/client/src/ViewSwitcher.scss +74 -0
- package/client/src/Webpage.jsx +69 -0
- package/client/src/_variables.scss +21 -0
- package/client/src/assets/react.svg +1 -0
- package/client/src/constants.js +68 -0
- package/client/src/contexts/AuthContext.jsx +28 -0
- package/client/src/contexts/ModelContext.jsx +328 -0
- package/client/src/contexts/UIContext.jsx +52 -0
- package/client/src/core/data.js +35 -0
- package/client/src/entry-client.jsx +15 -0
- package/client/src/entry-server.jsx +13 -0
- package/client/src/filter.js +222 -0
- package/client/src/hooks/data.js +101 -0
- package/client/src/hooks/useDebounce.js +20 -0
- package/client/src/hooks/useDragAndDrop.js +59 -0
- package/client/src/hooks/useLocalStorage.js +100 -0
- package/client/src/hooks/useMount.js +42 -0
- package/client/src/hooks/useTutorials.jsx +227 -0
- package/client/src/hooks/useWindowSize.js +24 -0
- package/client/src/i18n.js +47 -0
- package/client/src/index.css +90 -0
- package/client/src/index.js +10 -0
- package/client/src/main.jsx +11 -0
- package/client/src/translations.js +15940 -0
- package/client/src/tutorials.js +112 -0
- package/client/vite.config.js +30 -0
- package/eslint.config.js +50 -0
- package/package.json +51 -27
- package/server.js +9 -0
- package/src/constants.js +12 -23
- package/src/core.js +9 -8
- package/src/data.js +81 -80
- package/src/defaultModels.js +114 -115
- package/src/email.js +8 -9
- package/src/engine.js +5 -5
- package/src/events.js +1 -2
- package/src/i18n.js +212 -211
- package/src/middlewares/middleware-mongodb.js +94 -93
- package/src/migrate.js +24 -24
- package/src/modules/assistant.js +55 -55
- package/src/modules/bucket.js +10 -9
- package/src/modules/data.js +387 -357
- package/src/modules/file.js +3 -6
- package/src/modules/mongodb.js +6 -7
- package/src/modules/user.js +24 -47
- package/src/modules/workflow.js +139 -73
- package/src/openai.jobs.js +2 -2
- package/src/packs.js +30 -31
- package/src/providers.js +101 -3
- package/src/setenv.js +1 -1
- package/src/user.js +0 -17
- package/src/workers/crypto-worker.js +21 -20
- package/src/workers/import-export-worker.js +18 -18
- package/test/data.backup.integration.test.js +7 -12
- package/test/data.integration.test.js +27 -25
- package/test/globalSetup.js +2 -2
- package/test/import_export.integration.test.js +6 -6
- package/test/model.integration.test.js +21 -22
- package/test/workflow.integration.test.js +2 -5
- package/test/workflow.robustness.test.js +6 -13
- package/vitest.config.js +2 -2
package/README.md
CHANGED
|
@@ -43,6 +43,21 @@ Possibly create a `.env` file:
|
|
|
43
43
|
```env
|
|
44
44
|
MONGO_DB_URL=mongodb://127.0.0.1:27017
|
|
45
45
|
```
|
|
46
|
+
| Variable | Description | Example |
|
|
47
|
+
|:----------------------|:------------------------------------------------------------------------|:-----------------------------------------|
|
|
48
|
+
| MONGO_DB_URL | Connection URL for your MongoDB database. | mongodb://user:pass@host:27017/db |
|
|
49
|
+
| PORT | Port on which the Express server will listen. | 7633 |
|
|
50
|
+
| JWT_SECRET | Secret key for signing JWT authentication tokens. | a_long_random_secret_string |
|
|
51
|
+
| OPENAI_API_KEY | Your optional OpenAI API key for AI features. | sk-xxxxxxxxxxxxxxxxxxxx |
|
|
52
|
+
| GOOGLE_API_KEY | Your optional Google (Gemini) API key for AI features. | AIzaSyxxxxxxxxxxxxxxxxxxxx |
|
|
53
|
+
| AWS_ACCESS_KEY_ID | AWS access key for S3 storage (files, backups). Keep empty to disable | AKIAIOSFODNN7EXAMPLE |
|
|
54
|
+
| AWS_SECRET_ACCESS_KEY | AWS secret access key. | wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY | |
|
|
55
|
+
| AWS_REGION | Region for your S3 bucket. | eu-west-3 | |
|
|
56
|
+
| AWS_S3_BUCKET_NAME | Name of the S3 bucket to use. | my-backup-bucket | |
|
|
57
|
+
| SMTP_HOST | SMTP server host for sending emails. | smtp.example.com |
|
|
58
|
+
| SMTP_PORT | SMTP server port. | 587 |
|
|
59
|
+
| SMTP_USER | Username for SMTP authentication. | user@example.com |
|
|
60
|
+
| SMTP_PASS | Password for SMTP authentication. | password |
|
|
46
61
|
|
|
47
62
|
Start the server:
|
|
48
63
|
```bash
|
|
@@ -73,6 +88,27 @@ Define schemas using JSON:
|
|
|
73
88
|
]
|
|
74
89
|
}
|
|
75
90
|
```
|
|
91
|
+
| Type | Description | Properties/Notes |
|
|
92
|
+
|:------------|:------------------------------------------------------------------------------------|:--------------------------------------------------------------------------|
|
|
93
|
+
| string | Character string. | minLength, maxLength |
|
|
94
|
+
| string_t | International character string ID. | same as string, translated in { key, value } |
|
|
95
|
+
| number | Numeric value (integer or float). | min, max |
|
|
96
|
+
| boolean | Boolean value (true/false). | – |
|
|
97
|
+
| date | Stores a ISO date. | – |
|
|
98
|
+
| datetime | Stores an ISO date and time. | – |
|
|
99
|
+
| richtext | Rich text field (HTML) for WYSIWYG editors. | |
|
|
100
|
+
| richtext_t | International rich text field (HTML) for WYSIWYG editors. | i18n |
|
|
101
|
+
| email | String validated as an email address. | – |
|
|
102
|
+
| password | String that will be automatically hashed. | – |
|
|
103
|
+
| enum | Allows selecting a value from a predefined list. | items: ["value1", "value2"] |
|
|
104
|
+
| relation | Creates a link to a document in another model. | relation: "target_model_name", multiple: true/false |
|
|
105
|
+
| file | For uploading a file (stored on S3 if configured). | allowedTypes:['image/jpeg', 'image/png', 'image/bmp'], maxSize: 1024*1000 |
|
|
106
|
+
| image | Specialized file type for images, with preview. | – |
|
|
107
|
+
| array | Stores a list of values. | itemsType: 'enum' // any type except relations |
|
|
108
|
+
| object | Stores a nested JSON object. – | |
|
|
109
|
+
| code | Stores language="*" as string, stores language="json" as arbitrary JSON structure. | language="json" conditionBuilder=true |
|
|
110
|
+
| model | Stores a model by name | – |
|
|
111
|
+
| modelField | Stores a model field path | – |
|
|
76
112
|
|
|
77
113
|
### 2. Modules
|
|
78
114
|
Activatable features:
|
package/client/README.md
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
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
|
+
## Installation
|
|
13
|
+
Install the library:
|
|
14
|
+
```shell
|
|
15
|
+
npm install ../../data-primals-engine
|
|
16
|
+
```
|
|
17
|
+
Install peer dependencies:
|
|
18
|
+
```shell
|
|
19
|
+
npm install react-query react-router-dom react-cookie
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Basic Setup
|
|
23
|
+
|
|
24
|
+
The setup mainly occurs in your application's root file (typically App.jsx or main.jsx).
|
|
25
|
+
|
|
26
|
+
It consists of initializing a single QueryClient instance and wrapping your app with the required Providers.
|
|
27
|
+
|
|
28
|
+
### Set the QueryClient (Singleton)
|
|
29
|
+
For react-query caching to work correctly across your app (including inside the library), it is crucial to instantiate QueryClient only once.
|
|
30
|
+
|
|
31
|
+
The data-primals-engine library needs to know which QueryClient instance you're using. It exports a setQueryClient function for that purpose.
|
|
32
|
+
|
|
33
|
+
### Set up the Providers
|
|
34
|
+
Your app must be wrapped by several Providers in the correct order so the contexts are available to all child components.
|
|
35
|
+
|
|
36
|
+
## Full example (App.jsx)
|
|
37
|
+
Here's what your main application file should look like:
|
|
38
|
+
```jsx
|
|
39
|
+
// In your main App.jsx file (e.g., hackersonline/client/src/App.jsx)
|
|
40
|
+
|
|
41
|
+
import React from 'react';
|
|
42
|
+
import { BrowserRouter, Routes, Route } from 'react-router-dom';
|
|
43
|
+
import { CookiesProvider } from 'react-cookie';
|
|
44
|
+
|
|
45
|
+
// 1. Import QueryClient and its Provider from react-query
|
|
46
|
+
import { QueryClient, QueryClientProvider } from 'react-query';
|
|
47
|
+
|
|
48
|
+
// 2. Import Providers and the config function from data-primals-engine
|
|
49
|
+
import {
|
|
50
|
+
ModelProvider,
|
|
51
|
+
AuthProvider,
|
|
52
|
+
UIProvider,
|
|
53
|
+
NotificationProvider,
|
|
54
|
+
setQueryClient // <-- Important config function
|
|
55
|
+
} from 'data-primals-engine/client';
|
|
56
|
+
|
|
57
|
+
// 3. Import the i18n config (see dedicated section)
|
|
58
|
+
import 'data-primals-engine/i18n';
|
|
59
|
+
|
|
60
|
+
// 4. (CRUCIAL) Create a unique instance of QueryClient
|
|
61
|
+
const queryClient = new QueryClient();
|
|
62
|
+
|
|
63
|
+
// 5. (CRUCIAL) Pass the instance to the shared library
|
|
64
|
+
setQueryClient(queryClient);
|
|
65
|
+
|
|
66
|
+
// Your page components
|
|
67
|
+
import HomePage from './pages/HomePage';
|
|
68
|
+
import UserDashboard from './pages/UserDashboard';
|
|
69
|
+
|
|
70
|
+
function App() {
|
|
71
|
+
return (
|
|
72
|
+
// 6. Wrap the app with all required providers
|
|
73
|
+
<QueryClientProvider client={queryClient}>
|
|
74
|
+
<AuthProvider>
|
|
75
|
+
<CookiesProvider>
|
|
76
|
+
<ModelProvider>
|
|
77
|
+
<BrowserRouter>
|
|
78
|
+
<UIProvider>
|
|
79
|
+
<NotificationProvider>
|
|
80
|
+
|
|
81
|
+
{/* Your app content */}
|
|
82
|
+
<Routes>
|
|
83
|
+
<Route path="/" element={<HomePage />} />
|
|
84
|
+
<Route path="/dashboard" element={<UserDashboard />} />
|
|
85
|
+
{/* ... other routes */}
|
|
86
|
+
</Routes>
|
|
87
|
+
|
|
88
|
+
</NotificationProvider>
|
|
89
|
+
</UIProvider>
|
|
90
|
+
</BrowserRouter>
|
|
91
|
+
</ModelProvider>
|
|
92
|
+
</CookiesProvider>
|
|
93
|
+
</AuthProvider>
|
|
94
|
+
</QueryClientProvider>
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export default App;
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Internationalization (i18n)
|
|
102
|
+
The library comes with its own i18next configuration and translation files.
|
|
103
|
+
To enable it in your app, you just need to import the config module once in your main file (App.jsx or main.jsx):
|
|
104
|
+
|
|
105
|
+
```jsx
|
|
106
|
+
// In App.jsx or main.jsx
|
|
107
|
+
import 'data-primals-engine/i18n';
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
This simple import will:
|
|
111
|
+
|
|
112
|
+
- Initialize i18next.
|
|
113
|
+
- Load default translations (French, English, etc.).
|
|
114
|
+
- Enable automatic browser language detection.
|
|
115
|
+
|
|
116
|
+
You can then use react-i18next components and hooks (useTranslation, Trans) as usual in your application.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
+
<title>Welcome page - data-primals-engine</title>
|
|
8
|
+
<link rel="icon" type="image/png" href="/favicon-96x96.png" sizes="96x96" />
|
|
9
|
+
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
|
10
|
+
<link rel="shortcut icon" href="/favicon.ico" />
|
|
11
|
+
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
|
|
12
|
+
<link rel="manifest" href="/site.webmanifest" />
|
|
13
|
+
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
14
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
15
|
+
<link href="https://fonts.googleapis.com/css2?family=Nunito+Sans:ital,opsz,wght@0,6..12,200..1000;1,6..12,200..1000&family=Outfit:wght@100..900&display=swap" rel="stylesheet">
|
|
16
|
+
</head>
|
|
17
|
+
<body>
|
|
18
|
+
<div id="root"></div>
|
|
19
|
+
|
|
20
|
+
<!-- Google tag (gtag.js) -->
|
|
21
|
+
<script async src="https://www.googletagmanager.com/gtag/js?id=G-NDHNSVB4YB"></script>
|
|
22
|
+
<script>
|
|
23
|
+
window.dataLayer = window.dataLayer || [];
|
|
24
|
+
function gtag(){dataLayer.push(arguments);}
|
|
25
|
+
gtag('js', new Date());
|
|
26
|
+
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
<script type="module" src="/src/main.jsx"></script>
|
|
30
|
+
</body>
|
|
31
|
+
</html>
|
package/client/index.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// data-primals-engine/client/src/index.js
|
|
2
|
+
|
|
3
|
+
// Contexts
|
|
4
|
+
export { ModelProvider, useModelContext } from './src/contexts/ModelContext';
|
|
5
|
+
export { AuthProvider, useAuthContext } from './src/contexts/AuthContext';
|
|
6
|
+
export { UIProvider, useUI } from './src/contexts/UIContext';
|
|
7
|
+
export { NotificationProvider, useNotificationContext } from './src/NotificationProvider';
|
|
8
|
+
|
|
9
|
+
// Hooks
|
|
10
|
+
export { default as useLocalStorage } from './src/hooks/useLocalStorage';
|
|
11
|
+
|
|
12
|
+
// Components
|
|
13
|
+
export { default as DataLayout } from './src/DataLayout';
|
|
14
|
+
export { default as Webpage } from './src/Webpage';
|
|
15
|
+
export { SelectField, TextField } from './src/Field';
|
|
16
|
+
export { default as Button } from './src/Button';
|
|
17
|
+
export { default as APIInfo } from './src/APIInfo';
|
|
18
|
+
export { NotificationList } from './src/Notification';
|
|
19
|
+
export { DashboardsPage } from './src/Dashboard';
|
|
20
|
+
export { default as RestoreDialog } from './src/RestoreDialog';
|
|
21
|
+
export { default as MessageRotator } from './src/MessageRotator';
|
|
22
|
+
export { default as DocumentationPageLayout } from './src/DocumentationPageLayout';
|
|
23
|
+
export { default as ContentView } from './src/ContentView';
|
|
24
|
+
export { default as AssistantChat } from './src/AssistantChat';
|
|
25
|
+
export { setQueryClient } from './src/App.jsx';
|