data-primals-engine 1.5.0 → 1.5.2
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 -0
- package/client/src/AddWidgetTypeModal.jsx +47 -43
- package/client/src/App.jsx +2 -6
- package/client/src/App.scss +13 -1
- package/client/src/AssistantChat.jsx +363 -323
- package/client/src/AssistantChat.scss +27 -10
- package/client/src/Dashboard.jsx +480 -396
- package/client/src/Dashboard.scss +1 -1
- package/client/src/DashboardHtmlViewItem.jsx +147 -0
- package/client/src/DashboardView.jsx +654 -569
- package/client/src/DataEditor.jsx +10 -3
- package/client/src/DataLayout.jsx +807 -755
- package/client/src/DataLayout.scss +14 -0
- package/client/src/DataTable.jsx +39 -75
- package/client/src/Dialog.scss +1 -1
- package/client/src/Field.jsx +2057 -1825
- package/client/src/FlexViewCard.jsx +44 -0
- package/client/src/HistoryDialog.jsx +69 -14
- package/client/src/HtmlViewBuilderModal.jsx +91 -0
- package/client/src/HtmlViewBuilderModal.scss +18 -0
- package/client/src/HtmlViewCard.jsx +44 -0
- package/client/src/HtmlViewCard.scss +35 -0
- package/client/src/KanbanCard.jsx +1 -2
- package/client/src/ModelCreator.jsx +5 -4
- package/client/src/ModelCreatorField.jsx +51 -4
- package/client/src/ModelList.jsx +280 -236
- package/client/src/Notification.jsx +136 -136
- package/client/src/Notification.scss +0 -18
- package/client/src/Pagination.jsx +5 -3
- package/client/src/RelationField.jsx +354 -258
- package/client/src/RelationSelectorWidget.jsx +173 -0
- package/client/src/contexts/ModelContext.jsx +10 -1
- package/client/src/contexts/UIContext.jsx +72 -63
- package/client/src/filter.js +263 -212
- package/client/src/hooks/useValidation.js +75 -0
- package/client/src/translations.js +24 -24
- package/package.json +7 -6
- package/src/constants.js +1 -1
- package/src/core.js +8 -1
- package/src/defaultModels.js +1596 -1544
- package/src/engine.js +85 -43
- package/src/events.js +137 -113
- package/src/i18n.js +710 -10
- package/src/index.js +3 -0
- package/src/modules/assistant/assistant.js +253 -134
- package/src/modules/assistant/constants.js +2 -1
- package/src/modules/bucket.js +2 -1
- package/src/modules/data/data.core.js +118 -92
- package/src/modules/data/data.history.js +555 -492
- package/src/modules/data/data.js +3 -53
- package/src/modules/data/data.operations.js +3381 -3231
- package/src/modules/data/data.relations.js +686 -686
- package/src/modules/data/data.routes.js +1879 -1821
- package/src/modules/data/data.validation.js +81 -2
- package/src/modules/file.js +247 -238
- package/src/modules/user.js +1 -0
- package/src/modules/workflow.js +2 -2
- package/src/openai.jobs.js +3 -2
- package/src/packs.js +5482 -5478
- package/src/sso.js +2 -2
- package/src/workers/import-export-worker.js +1 -1
- package/test/data.history.integration.test.js +264 -192
- package/test/data.integration.test.js +149 -3
package/src/modules/data/data.js
CHANGED
|
@@ -159,56 +159,6 @@ export async function onInit(defaultEngine) {
|
|
|
159
159
|
|
|
160
160
|
// Triggers
|
|
161
161
|
|
|
162
|
-
Event.Listen("OnValidateModelStructure", async (modelStructure) =>{
|
|
163
|
-
|
|
164
|
-
const objectKeys = Object.keys(modelStructure);
|
|
165
|
-
|
|
166
|
-
if( objectKeys.find(o => !["name", "_user", "icon", "history", "locked", "_id", "description", "maxRequestData", "fields"].includes(o)) ){
|
|
167
|
-
throw new Error(i18n.t('api.model.invalidStructure'));
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
// Vérification du type de name
|
|
171
|
-
if (typeof modelStructure.name !== 'string' || !modelStructure.name) {
|
|
172
|
-
throw new Error(i18n.t("api.validate.requiredFieldString", ["name"]));
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
// Vérification du type de description
|
|
176
|
-
if (typeof modelStructure.description !== 'string') {
|
|
177
|
-
throw new Error(i18n.t("api.validate.fieldString", ["description"]));
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
// Vérification de la présence et du type du tableau fields
|
|
181
|
-
if (!Array.isArray(modelStructure.fields)) {
|
|
182
|
-
throw new Error(i18n.t('api.validate.fieldArray', ["fields"]));
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
// Vérification de chaque champ dans le tableau fields
|
|
186
|
-
for (const field of modelStructure.fields) {
|
|
187
|
-
validateField(field);
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
if (modelStructure.constraints) {
|
|
191
|
-
if (!Array.isArray(modelStructure.constraints)) {
|
|
192
|
-
throw new Error('Model "constraints" property must be an array.');
|
|
193
|
-
}
|
|
194
|
-
const fieldNames = new Set(modelStructure.fields.map(f => f.name));
|
|
195
|
-
for (const constraint of modelStructure.constraints) {
|
|
196
|
-
if (constraint.type === 'unique') {
|
|
197
|
-
if (!constraint.name || !Array.isArray(constraint.keys) || constraint.keys.length === 0) {
|
|
198
|
-
throw new Error('Unique constraint must have a "name" and a non-empty "keys" array.');
|
|
199
|
-
}
|
|
200
|
-
for (const key of constraint.keys) {
|
|
201
|
-
if (!fieldNames.has(key)) {
|
|
202
|
-
throw new Error(`Constraint key "${key}" in constraint "${constraint.name}" does not exist as a field in the model.`);
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
return true; // La structure du modèle est valide
|
|
210
|
-
}, "event", "system");
|
|
211
|
-
|
|
212
162
|
}
|
|
213
163
|
|
|
214
164
|
|
|
@@ -327,13 +277,13 @@ export async function handleDemoInitialization(req, res) {
|
|
|
327
277
|
|
|
328
278
|
logger.info(`[Demo Init] Installing dynamically generated pack with models: [${models.join(', ')}].`);
|
|
329
279
|
|
|
280
|
+
// Create and install pack
|
|
281
|
+
const result = await installPack(packToInstall, user, req.query.lang || 'en');
|
|
282
|
+
|
|
330
283
|
await sequential(packs.map(p => {
|
|
331
284
|
return () => installPack(p, user, req.query.lang || 'en');
|
|
332
285
|
}));
|
|
333
286
|
|
|
334
|
-
// Create and install pack
|
|
335
|
-
const result = await installPack(packToInstall, user, req.query.lang || 'en');
|
|
336
|
-
|
|
337
287
|
if (result.success || result.modifiedCount > 0) {
|
|
338
288
|
|
|
339
289
|
await Event.Trigger('OnDemoUserAdded', "event", "system", req.me.username);
|