data-primals-engine 1.6.0 → 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.
- package/README.md +21 -7
- package/client/src/DataTable.jsx +1 -1
- package/client/src/ModelCreator.jsx +683 -686
- package/client/src/ModelCreator.scss +1 -1
- package/client/src/ModelImporter.jsx +3 -0
- package/package.json +1 -1
- package/src/defaultModels.js +7 -0
- package/src/index.js +1 -0
- package/src/modules/data/data.operations.js +3484 -3401
- package/src/modules/user.js +14 -9
- package/test/data.integration.test.js +75 -0
- package/test/user.test.js +106 -1
package/README.md
CHANGED
|
@@ -412,10 +412,11 @@ console.log(`Successfully authenticated as ${currentUser.username}`);
|
|
|
412
412
|
### insertData(modelName, data, files, user)
|
|
413
413
|
|
|
414
414
|
> Inserts one or more documents, intelligently handling nested relationships.
|
|
415
|
-
|
|
415
|
+
_env is used to define the target environment, production ready by default.
|
|
416
|
+
>
|
|
416
417
|
```javascript
|
|
417
418
|
// Uses the `currentUser` object defined above
|
|
418
|
-
const newProduct = { name: 'Super Widget', price: 99.99, status: 'available' };
|
|
419
|
+
const newProduct = { name: 'Super Widget', price: 99.99, status: 'available', _env: 'development' };
|
|
419
420
|
const result = await insertData('product', newProduct, {}, currentUser);
|
|
420
421
|
|
|
421
422
|
if (result.success) {
|
|
@@ -461,6 +462,8 @@ await editData(
|
|
|
461
462
|
Example:
|
|
462
463
|
|
|
463
464
|
```javascript
|
|
465
|
+
|
|
466
|
+
// Edit user settings (dark theme mode)
|
|
464
467
|
await patchData(
|
|
465
468
|
"settings",
|
|
466
469
|
{ userId: "507f1f77bcf86cd799439011" },
|
|
@@ -468,6 +471,15 @@ await patchData(
|
|
|
468
471
|
null,
|
|
469
472
|
currentUser
|
|
470
473
|
);
|
|
474
|
+
|
|
475
|
+
// Transfers data to the 'development' environement
|
|
476
|
+
await patchData(
|
|
477
|
+
"product",
|
|
478
|
+
{ _id: "507f1f77bcf86cd799439012" },
|
|
479
|
+
{ _env: "development" },
|
|
480
|
+
null,
|
|
481
|
+
currentUser
|
|
482
|
+
);
|
|
471
483
|
```
|
|
472
484
|
|
|
473
485
|
### deleteData(modelName, filter, user)
|
|
@@ -490,11 +502,13 @@ Powerful search with relation expansion and filtering.
|
|
|
490
502
|
|
|
491
503
|
Query Options:
|
|
492
504
|
|
|
493
|
-
- model
|
|
494
|
-
-
|
|
495
|
-
-
|
|
496
|
-
-
|
|
497
|
-
-
|
|
505
|
+
- **model**: Model name to search
|
|
506
|
+
- **env**: Filter data by environment (development, staging, production, ...)
|
|
507
|
+
- **filter**: MongoDB-style filter
|
|
508
|
+
- **depth**: Relation expansion depth (default: 1)
|
|
509
|
+
- **limit**: Number of results
|
|
510
|
+
- **page**: Current page for pagination (default: 1)
|
|
511
|
+
- **sort**: Sorting criteria
|
|
498
512
|
|
|
499
513
|
Example:
|
|
500
514
|
```javascript
|
package/client/src/DataTable.jsx
CHANGED
|
@@ -438,7 +438,7 @@ export function DataTable({
|
|
|
438
438
|
onDuplicateData(dataToDuplicate);
|
|
439
439
|
};
|
|
440
440
|
|
|
441
|
-
const desc = t(`model_description_${selectedModel
|
|
441
|
+
const desc = t(`model_description_${selectedModel?.name}`, selectedModel?.description || '');
|
|
442
442
|
return (
|
|
443
443
|
<div className={`datatable${filterActive ? ' filter-active' : ''}`}>
|
|
444
444
|
{advanced && !selectionMode && <div className="flex actions">
|