data-primals-engine 1.4.1 → 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 +37 -22
- package/client/package-lock.json +33 -0
- package/client/package.json +1 -0
- package/client/src/App.scss +12 -4
- package/client/src/AssistantChat.jsx +48 -5
- package/client/src/AssistantChat.scss +0 -1
- package/client/src/ChartConfigModal.jsx +34 -9
- package/client/src/ConditionBuilder.jsx +1 -1
- package/client/src/ConditionBuilder2.jsx +2 -1
- package/client/src/Dashboard.jsx +396 -349
- package/client/src/DashboardChart.jsx +91 -12
- package/client/src/DataEditor.jsx +376 -368
- package/client/src/DataLayout.jsx +3 -2
- package/client/src/DataTable.jsx +60 -31
- package/client/src/Field.jsx +1788 -1782
- package/client/src/GeolocationField.jsx +94 -0
- package/client/src/ModelCreatorField.jsx +1 -0
- package/client/src/RelationField.jsx +2 -2
- package/client/src/constants.js +2 -2
- package/client/src/contexts/UIContext.jsx +5 -2
- package/client/src/filter.js +0 -155
- package/client/src/translations.js +16828 -16750
- package/package.json +10 -2
- package/src/config.js +2 -2
- package/src/constants.js +262 -4
- package/src/core.js +21 -3
- package/src/defaultModels.js +12 -12
- package/src/engine.js +7 -1
- package/src/events.js +4 -3
- package/src/filter.js +272 -260
- package/src/i18n.js +187 -177
- package/src/middlewares/middleware-mongodb.js +3 -1
- package/src/modules/assistant/assistant.js +131 -42
- package/src/modules/bucket.js +3 -2
- package/src/modules/data/data.backup.js +374 -0
- package/src/modules/data/data.core.js +2 -1
- package/src/modules/data/data.history.js +11 -8
- package/src/modules/data/data.js +190 -4551
- package/src/modules/data/data.operations.js +3000 -0
- package/src/modules/data/data.relations.js +687 -0
- package/src/modules/data/data.routes.js +132 -38
- package/src/modules/data/data.scheduling.js +274 -0
- package/src/modules/data/data.validation.js +248 -0
- package/src/modules/data/index.js +29 -1
- package/src/modules/user.js +2 -1
- package/src/modules/workflow.js +3 -2
- package/src/services/stripe.js +3 -2
- package/swagger-en.yml +133 -0
- package/test/model.integration.test.js +377 -221
|
@@ -16,7 +16,8 @@ export const mongoDBWhitelist = [
|
|
|
16
16
|
"$abs", '$sin', '$cos', '$tan', '$asin', '$acos', '$atan',
|
|
17
17
|
"$toDate", "$toBool", "$toString", "$toInt", "$toDouble",
|
|
18
18
|
"$dateDiff", "$dateSubtract", "$dateAdd", "$dateToString",
|
|
19
|
-
'$year', '$month', '$week', '$dayOfMonth', '$dayOfWeek', '$dayOfYear', '$hour', '$minute', '$second', '$millisecond'
|
|
19
|
+
'$year', '$month', '$week', '$dayOfMonth', '$dayOfWeek', '$dayOfYear', '$hour', '$minute', '$second', '$millisecond',
|
|
20
|
+
'$geoNear', '$regex', '$text', '$nearSphere','$geoWithin','$geoIntersects'
|
|
20
21
|
];
|
|
21
22
|
export let importJobs = {};
|
|
22
23
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {isPlainObject} from "../../core.js";
|
|
1
|
+
import {isPlainObject, safeAssignObject} from "../../core.js";
|
|
2
2
|
import {getCollection, getCollectionForUser, isObjectId, ObjectId} from "../mongodb.js";
|
|
3
|
-
import {
|
|
3
|
+
import {handleDemoInitialization} from "./data.js";
|
|
4
4
|
import { Event} from "../../events.js"
|
|
5
5
|
import {Logger} from "../../gameObject.js";
|
|
6
6
|
import {hasPermission, middlewareAuthenticator, userInitiator} from "../user.js";
|
|
7
7
|
import {isLocalUser} from "../../data.js";
|
|
8
|
+
import {getModel} from "./data.operations.js";
|
|
8
9
|
|
|
9
|
-
let logger;
|
|
10
10
|
/**
|
|
11
11
|
* Compare deux valeurs de manière récursive. Gère les ObjectId, les objets, les tableaux et les primitives.
|
|
12
12
|
* @param {*} a - Première valeur.
|
|
@@ -55,10 +55,10 @@ function calculateDiff(beforeDoc, afterDoc, historizedFields) {
|
|
|
55
55
|
const afterValue = afterDoc[fieldName];
|
|
56
56
|
|
|
57
57
|
if (!isEqual(beforeValue, afterValue)) {
|
|
58
|
-
changes
|
|
58
|
+
safeAssignObject(changes, fieldName, {
|
|
59
59
|
from: beforeValue,
|
|
60
60
|
to: afterValue
|
|
61
|
-
};
|
|
61
|
+
});
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
// Retourne null si aucun changement n'a été détecté, ce qui est plus facile à vérifier qu'un objet vide.
|
|
@@ -264,13 +264,16 @@ export async function handleGetRevisionRequest(req, res) {
|
|
|
264
264
|
}
|
|
265
265
|
|
|
266
266
|
|
|
267
|
+
|
|
268
|
+
let engine, logger;
|
|
267
269
|
/**
|
|
268
270
|
* Initialise les écouteurs d'événements pour le module d'historique.
|
|
269
|
-
* @param {object}
|
|
271
|
+
* @param {object} defaultEngine - L'instance du moteur.
|
|
270
272
|
*/
|
|
271
|
-
export function onInit(
|
|
272
|
-
logger = engine.getComponent(Logger);
|
|
273
|
+
export function onInit(defaultEngine) {
|
|
273
274
|
|
|
275
|
+
engine = defaultEngine;
|
|
276
|
+
logger = engine.getComponent(Logger);
|
|
274
277
|
engine.get('/api/data/history/:modelName/:recordId', [middlewareAuthenticator, userInitiator], handleGetHistoryRequest);
|
|
275
278
|
engine.get('/api/data/history/:modelName/:recordId/:version', [middlewareAuthenticator, userInitiator], handleGetRevisionRequest);
|
|
276
279
|
engine.post('/api/data/history/:modelName/:recordId/revert/:version', [middlewareAuthenticator, userInitiator], handleRevertToRevisionRequest);
|