data-primals-engine 1.4.2 → 1.4.3

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 CHANGED
@@ -244,6 +244,7 @@ data-primals-engine/
244
244
  ### 📁 Model Management
245
245
 
246
246
  #### Create a model
247
+ > Defines a new data model (schema) in the system. The request body must contain the model's name and an array of field definitions.
247
248
  ```bash
248
249
  curl -X POST http://localhost:7633/api/model?_user=demo \
249
250
  -H "Authorization: Bearer demotoken" \
@@ -259,6 +260,7 @@ curl -X POST http://localhost:7633/api/model?_user=demo \
259
260
  ```
260
261
 
261
262
  #### Update a model
263
+ > Modifies an existing model's structure using its unique ID. This allows you to add, remove, or change fields.
262
264
  ```bash
263
265
  curl -X PUT http://localhost:7633/api/model/60d0fe4f5311236168a109ca?_user=demo \
264
266
  -H "Authorization: Bearer demotoken" \
@@ -274,6 +276,7 @@ curl -X PUT http://localhost:7633/api/model/60d0fe4f5311236168a109ca?_user=demo
274
276
  ```
275
277
 
276
278
  #### Delete a model
279
+ > Permanently deletes a model definition using its name. This action is irreversible.
277
280
  ```bash
278
281
  curl -X DELETE "http://localhost:7633/api/model?_user=demo&name=newModel" \
279
282
  -H "Authorization: Bearer demotoken"
@@ -282,6 +285,7 @@ curl -X DELETE "http://localhost:7633/api/model?_user=demo&name=newModel" \
282
285
  ### 🗂️ Data Management
283
286
 
284
287
  #### Create a document
288
+ > Creates a single new document in the specified model. The `data` object must conform to the model's schema.
285
289
  ```bash
286
290
  curl -X POST http://localhost:7633/api/data?_user=demo \
287
291
  -H "Authorization: Bearer demotoken" \
@@ -297,18 +301,22 @@ curl -X POST http://localhost:7633/api/data?_user=demo \
297
301
  }'
298
302
  ```
299
303
 
304
+
300
305
  #### Search documents
306
+ > Searches for documents using a MongoDB-style filter. This endpoint is ideal for complex queries, pagination, and sorting.
307
+
301
308
  ```bash
302
309
  curl -X POST http://localhost:7633/api/data/search?_user=demo \
303
310
  -H "Authorization: Bearer demotoken" \
304
311
  -H "Content-Type: application/json" \
305
312
  -d '{
306
313
  "model": "product",
307
- "filter": { "price": { "$gt": 50 } }
314
+ "filter": { "$gt" : ["$price", 50] }
308
315
  }'
309
316
  ```
310
317
 
311
318
  #### Update a document by ID
319
+ > Updates a single document by its unique ID. The request body contains the fields to be modified.
312
320
  ```bash
313
321
  curl -X PUT http://localhost:7633/api/data/64a31c123ef59d4c8d55aa99?_user=demo \
314
322
  -H "Authorization: Bearer demotoken" \
@@ -319,7 +327,9 @@ curl -X PUT http://localhost:7633/api/data/64a31c123ef59d4c8d55aa99?_user=demo \
319
327
  }'
320
328
  ```
321
329
 
330
+
322
331
  #### Bulk update
332
+ > Updates multiple documents matching a filter. This is efficient for applying changes to a batch of records, such as restocking all out-of-stock products.
323
333
  ```bash
324
334
  curl -X PUT http://localhost:7633/api/data?_user=demo \
325
335
  -H "Authorization: Bearer demotoken" \
@@ -331,6 +341,7 @@ curl -X PUT http://localhost:7633/api/data?_user=demo \
331
341
  ```
332
342
 
333
343
  #### Delete documents
344
+ > Deletes one or more documents. You can provide an array of `ids` to delete specific documents.
334
345
  ```bash
335
346
  curl -X DELETE http://localhost:7633/api/data?_user=demo \
336
347
  -H "Authorization: Bearer demotoken" \
@@ -805,7 +816,7 @@ Event.Listen("OnDataAdded", (engine, data) => {
805
816
  | OnDataInsert | Triggered just before data insertion. It will use the overrided data. | System | internal | (data) |
806
817
  | OnDataValidate | Triggered to override validation check. | System | internal | (value, field, data) |
807
818
  | OnDataFilter | Triggered to override data filtering operation. | System | internal | (filteredValue, field, data) |
808
- | OnEmailTemplate | Triggered to override custom email templates | System | internal | (filteredValue, field, data) |
819
+ | OnEmailTemplate | Triggered to override custom email templates | System | internal | (templateData, lang) |
809
820
 
810
821
  ### Triggering events
811
822
 
@@ -853,4 +864,4 @@ Distributed under the **MIT License**. See `LICENSE` file.
853
864
 
854
865
  ---
855
866
 
856
- ## [🔼](https://github.com/anonympins/data-primals-engine?tab=readme-ov-file#data-primals-engine) Back to Top
867
+ ## [🔼](#data-primals-engine) Back to Top
@@ -33,6 +33,7 @@
33
33
  "react": "^18.3.1",
34
34
  "react-big-calendar": "^1.15.0",
35
35
  "react-dom": "^18.3.1",
36
+ "react-leaflet": "^4.2.1",
36
37
  "react-router": "^7.8.1",
37
38
  "react-switch": "^7.1.0",
38
39
  "uniqid": "^5.4.0",
@@ -1692,6 +1693,17 @@
1692
1693
  "url": "https://opencollective.com/popperjs"
1693
1694
  }
1694
1695
  },
1696
+ "node_modules/@react-leaflet/core": {
1697
+ "version": "2.1.0",
1698
+ "resolved": "https://registry.npmjs.org/@react-leaflet/core/-/core-2.1.0.tgz",
1699
+ "integrity": "sha512-Qk7Pfu8BSarKGqILj4x7bCSZ1pjuAPZ+qmRwH5S7mDS91VSbVVsJSrW4qA+GPrro8t69gFYVMWb1Zc4yFmPiVg==",
1700
+ "license": "Hippocratic-2.1",
1701
+ "peerDependencies": {
1702
+ "leaflet": "^1.9.0",
1703
+ "react": "^18.0.0",
1704
+ "react-dom": "^18.0.0"
1705
+ }
1706
+ },
1695
1707
  "node_modules/@remirror/core-constants": {
1696
1708
  "version": "3.0.0",
1697
1709
  "resolved": "https://registry.npmjs.org/@remirror/core-constants/-/core-constants-3.0.0.tgz",
@@ -5157,6 +5169,13 @@
5157
5169
  "json-buffer": "3.0.1"
5158
5170
  }
5159
5171
  },
5172
+ "node_modules/leaflet": {
5173
+ "version": "1.9.4",
5174
+ "resolved": "https://registry.npmjs.org/leaflet/-/leaflet-1.9.4.tgz",
5175
+ "integrity": "sha512-nxS1ynzJOmOlHp+iL3FyWqK89GtNL8U8rvlMOsQdTTssxZwCXh8N2NB3GDQOL+YR3XnWyZAxwQixURb+FA74PA==",
5176
+ "license": "BSD-2-Clause",
5177
+ "peer": true
5178
+ },
5160
5179
  "node_modules/levn": {
5161
5180
  "version": "0.4.1",
5162
5181
  "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz",
@@ -6274,6 +6293,20 @@
6274
6293
  "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz",
6275
6294
  "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ=="
6276
6295
  },
6296
+ "node_modules/react-leaflet": {
6297
+ "version": "4.2.1",
6298
+ "resolved": "https://registry.npmjs.org/react-leaflet/-/react-leaflet-4.2.1.tgz",
6299
+ "integrity": "sha512-p9chkvhcKrWn/H/1FFeVSqLdReGwn2qmiobOQGO3BifX+/vV/39qhY8dGqbdcPh1e6jxh/QHriLXr7a4eLFK4Q==",
6300
+ "license": "Hippocratic-2.1",
6301
+ "dependencies": {
6302
+ "@react-leaflet/core": "^2.1.0"
6303
+ },
6304
+ "peerDependencies": {
6305
+ "leaflet": "^1.9.0",
6306
+ "react": "^18.0.0",
6307
+ "react-dom": "^18.0.0"
6308
+ }
6309
+ },
6277
6310
  "node_modules/react-lifecycles-compat": {
6278
6311
  "version": "3.0.4",
6279
6312
  "resolved": "https://registry.npmjs.org/react-lifecycles-compat/-/react-lifecycles-compat-3.0.4.tgz",
@@ -51,6 +51,7 @@
51
51
  "react": "^18.3.1",
52
52
  "react-big-calendar": "^1.15.0",
53
53
  "react-dom": "^18.3.1",
54
+ "react-leaflet": "^4.2.1",
54
55
  "react-router": "^7.8.1",
55
56
  "react-switch": "^7.1.0",
56
57
  "uniqid": "^5.4.0",
@@ -1039,10 +1039,18 @@ h2.shadow {
1039
1039
  }
1040
1040
  }
1041
1041
 
1042
- .mini input[type=checkbox] {
1043
- cursor: pointer;
1044
- width: 15px;
1045
- height: 15px;
1042
+ .mini {
1043
+ .field-checkbox.field-bg {
1044
+ background: none;
1045
+ }
1046
+ input[type=checkbox] {
1047
+ cursor: pointer;
1048
+ margin: 0 auto;
1049
+ background: none;
1050
+ width: 16px;
1051
+ height: 16px;
1052
+ display: block;
1053
+ }
1046
1054
  }
1047
1055
 
1048
1056
  .pagination-wrapper {
@@ -14,9 +14,9 @@ import './ConditionBuilder.scss';
14
14
  import { useTranslation, Trans } from "react-i18next";
15
15
  import { CodeField } from "./Field.jsx";
16
16
  import { useAuthContext } from "./contexts/AuthContext.jsx";
17
- import { MONGO_CALC_OPERATORS} from "./filter.js";
18
17
  import {ConditionBuilder2} from "./ConditionBuilder2.jsx";
19
18
  import {mongoOperators} from "./constants.js";
19
+ import {MONGO_CALC_OPERATORS} from "../../src/constants";
20
20
 
21
21
  const getFieldDefinition = (fields, fieldName) => fields?.find(f => f.name === fieldName);
22
22
  const getModelFields = (modelName, allModels, user) => {
@@ -2,10 +2,11 @@ import React, {useEffect, useState} from 'react';
2
2
  import { Tooltip } from 'react-tooltip';
3
3
  import {FaPlus, FaProjectDiagram, FaTrash, FaInfoCircle, FaEdit, FaTags, FaCalendarAlt} from 'react-icons/fa';
4
4
  import { Trans } from 'react-i18next';
5
- import {convertInputValue, MONGO_CALC_OPERATORS} from "./filter.js";
5
+ import {convertInputValue} from "./filter.js";
6
6
  import i18n from "i18next";
7
7
  import {FaRepeat} from "react-icons/fa6";
8
8
  import {useAuthContext} from "./contexts/AuthContext.jsx";
9
+ import {MONGO_CALC_OPERATORS} from "../../src/constants.js";
9
10
 
10
11
 
11
12
  // Déterminer si le champ doit être une date