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/README.md CHANGED
@@ -18,10 +18,11 @@
18
18
 
19
19
  ## πŸš€ Key Features
20
20
 
21
- - **Dynamic Data Modeling**: Define and update schemas using JSON, no migrations required.
21
+ - **Visual Data Modeling**: Define and update schemas using a powerful UI Model Creator, or directly with JSON. No migrations required.
22
22
  - **Custom API Endpoints**: Create server-side logic and new API endpoints directly from the UI in a secure, sandboxed environment.
23
23
  - **Automation Workflows**: Trigger complex actions based on data events (create, update, delete) or schedules (cron).
24
- - **Advanced Querying & Aggregation**: Go beyond simple filters with deep relation expansion, complex lookups, and dynamic calculated fields.
24
+ - **Advanced Querying & Aggregation**: Go beyond simple filters with a visual Condition Builder, deep relation expansion, complex lookups, and dynamic calculated fields.
25
+ - **Rich UI Data Views**: Ready-to-use React components to display your data, including a powerful and configurable Data Table, a Kanban board, and a Calendar view.
25
26
  - **Integrated Backup & Restore**: Secure, encrypted user data backups with rotation policies, supporting both local and AWS S3 storage.
26
27
  - **Automatic Data Auditing**: Automatically tracks all changes (create, update, delete) for every record, providing a complete version history for auditing and traceability.
27
28
  - **Event-Driven & Extensible**: A core event system allows for deep customization and the easy creation of new modules or plugins.
@@ -32,6 +33,14 @@
32
33
  - **πŸ“¦ Starter Packs**: Quickly bootstrap applications with pre-built data packs for CRM, e-commerce, and more.
33
34
  - **πŸ“„Auto-Generated API Documentation**: Interactive API documentation available via the interface or at `/api-docs`.
34
35
 
36
+ ## βš›οΈ Frontend Integration (React)
37
+
38
+ This engine is designed to work seamlessly with its dedicated client library, **`data-primals-engine/client`**. This library provides a complete set of React hooks and UI components to build a rich, data-centric user interface on top of the backend.
39
+
40
+ While this README focuses on the backend engine and its API, you can find detailed instructions on how to integrate the client part in your React application here:
41
+
42
+ ➑️ **[View the Frontend Integration Guide](https://github.com/anonympins/data-primals-engine/tree/develop/client)**
43
+
35
44
 
36
45
  ## 🌟 Why Choose data-primals-engine?
37
46
 
@@ -116,6 +125,12 @@ By default, the app runs on port **7633** : http://localhost:7633
116
125
 
117
126
  ## 🧠 Concepts
118
127
 
128
+ ### Authentication & Authorization
129
+
130
+ The engine includes a pluggable system for user management. For development and testing, it uses a `DefaultUserProvider` which creates a volatile **`demo`** user. This is perfect for getting started quickly without setting up a user database.
131
+
132
+ For production environments, you should extend the base `UserProvider` class to connect to your actual user database (e.g., another MongoDB collection, a SQL database, or an external authentication service). This allows you to implement your own logic for finding users and validating passwords.
133
+
119
134
  ### Models
120
135
  Define schemas using JSON:
121
136
  ```json
@@ -554,6 +569,7 @@ const result = await installPack("61d1f1a9e3f1a9e3f1a9e3f1", user, "en");
554
569
 
555
570
  > You can also open the pack gallery to see the JSON structure of each pack, before installing them.
556
571
 
572
+
557
573
  ---
558
574
  ### Data Auditing & History
559
575
  data-primals-engine includes a built-in, automatic auditing system that creates a complete history for every record in your database.
@@ -702,6 +718,60 @@ Expected response :
702
718
 
703
719
  ```
704
720
 
721
+ ### Pluggable SSO Authentication (Google, SAML, Azure AD)
722
+
723
+ `data-primals-engine` features a powerful and modular Single Sign-On (SSO) system built on Passport.js. This allows you to easily integrate with various enterprise and social identity providers. The core engine remains lightweight, and you only enable the providers you need.
724
+
725
+ #### How It Works
726
+
727
+ The engine provides a central `Sso` component that manages authentication logic. Each provider (Google, SAML, etc.) is an independent module that "plugs into" this central component.
728
+
729
+ To enable an SSO provider, follow these three steps:
730
+
731
+ #### Example: Enabling Google Sign-In
732
+
733
+ **1. Install the Provider's Library**
734
+
735
+ The required Passport strategy is a `peerDependency`. You must install it in your project:
736
+ ```bash
737
+ npm install passport-google-oauth20
738
+ ```
739
+
740
+ **2. Enable the Module**
741
+
742
+ To enable the module in your next engine initilization, just add it to the `modules` array:
743
+ ```javascript
744
+ Config.Set("modules", ["auth-google", "..."]);
745
+ ```
746
+
747
+ **3. Set Environment Variables**
748
+
749
+ Create or update your `.env` file with the credentials obtained from the Google Cloud Console:
750
+ ```env
751
+ GOOGLE_CLIENT_ID=your-google-client-id
752
+ GOOGLE_CLIENT_SECRET=your-google-client-secret
753
+ ```
754
+
755
+ The login flow will now be available at `/api/auth/google`.
756
+
757
+ #### Other Providers
758
+
759
+ The process is identical for other supported providers:
760
+
761
+ - **SAML**:
762
+ 1. `npm install passport-saml-encrypted`
763
+ 2. Enable the `auth-saml` module.
764
+ 3. Set `SAML_ENTRY_POINT`, `SAML_ISSUER`, `SAML_CERT`, and `SAML_DECRYPTION_KEY` environment variables.
765
+
766
+ - **Microsoft Azure AD**:
767
+ 1. `npm install passport-azure-ad`
768
+ 2. Enable the `auth-microsoft` module.
769
+ 3. Set `MICROSOFT_CLIENT_ID`, `MICROSOFT_CLIENT_SECRET`, and `MICROSOFT_TENANT_ID` environment variables.
770
+
771
+ This modular approach makes it simple to extend the engine with any Passport-compatible strategy to meet your authentication needs.
772
+
773
+ See implementations in the `modules` directory.
774
+
705
775
  ---
706
776
  ## Extensibility
707
777
 
package/client/README.md CHANGED
@@ -9,6 +9,26 @@ Your React application must have the following dependencies installed:
9
9
  - react-router-dom
10
10
  - react-cookie
11
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
+
12
32
  ## Installation
13
33
  Install the library:
14
34
  ```shell