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.
Files changed (63) hide show
  1. package/README.md +37 -0
  2. package/client/src/AddWidgetTypeModal.jsx +47 -43
  3. package/client/src/App.jsx +2 -6
  4. package/client/src/App.scss +13 -1
  5. package/client/src/AssistantChat.jsx +363 -323
  6. package/client/src/AssistantChat.scss +27 -10
  7. package/client/src/Dashboard.jsx +480 -396
  8. package/client/src/Dashboard.scss +1 -1
  9. package/client/src/DashboardHtmlViewItem.jsx +147 -0
  10. package/client/src/DashboardView.jsx +654 -569
  11. package/client/src/DataEditor.jsx +10 -3
  12. package/client/src/DataLayout.jsx +807 -755
  13. package/client/src/DataLayout.scss +14 -0
  14. package/client/src/DataTable.jsx +39 -75
  15. package/client/src/Dialog.scss +1 -1
  16. package/client/src/Field.jsx +2057 -1825
  17. package/client/src/FlexViewCard.jsx +44 -0
  18. package/client/src/HistoryDialog.jsx +69 -14
  19. package/client/src/HtmlViewBuilderModal.jsx +91 -0
  20. package/client/src/HtmlViewBuilderModal.scss +18 -0
  21. package/client/src/HtmlViewCard.jsx +44 -0
  22. package/client/src/HtmlViewCard.scss +35 -0
  23. package/client/src/KanbanCard.jsx +1 -2
  24. package/client/src/ModelCreator.jsx +5 -4
  25. package/client/src/ModelCreatorField.jsx +51 -4
  26. package/client/src/ModelList.jsx +280 -236
  27. package/client/src/Notification.jsx +136 -136
  28. package/client/src/Notification.scss +0 -18
  29. package/client/src/Pagination.jsx +5 -3
  30. package/client/src/RelationField.jsx +354 -258
  31. package/client/src/RelationSelectorWidget.jsx +173 -0
  32. package/client/src/contexts/ModelContext.jsx +10 -1
  33. package/client/src/contexts/UIContext.jsx +72 -63
  34. package/client/src/filter.js +263 -212
  35. package/client/src/hooks/useValidation.js +75 -0
  36. package/client/src/translations.js +24 -24
  37. package/package.json +7 -6
  38. package/src/constants.js +1 -1
  39. package/src/core.js +8 -1
  40. package/src/defaultModels.js +1596 -1544
  41. package/src/engine.js +85 -43
  42. package/src/events.js +137 -113
  43. package/src/i18n.js +710 -10
  44. package/src/index.js +3 -0
  45. package/src/modules/assistant/assistant.js +253 -134
  46. package/src/modules/assistant/constants.js +2 -1
  47. package/src/modules/bucket.js +2 -1
  48. package/src/modules/data/data.core.js +118 -92
  49. package/src/modules/data/data.history.js +555 -492
  50. package/src/modules/data/data.js +3 -53
  51. package/src/modules/data/data.operations.js +3381 -3231
  52. package/src/modules/data/data.relations.js +686 -686
  53. package/src/modules/data/data.routes.js +1879 -1821
  54. package/src/modules/data/data.validation.js +81 -2
  55. package/src/modules/file.js +247 -238
  56. package/src/modules/user.js +1 -0
  57. package/src/modules/workflow.js +2 -2
  58. package/src/openai.jobs.js +3 -2
  59. package/src/packs.js +5482 -5478
  60. package/src/sso.js +2 -2
  61. package/src/workers/import-export-worker.js +1 -1
  62. package/test/data.history.integration.test.js +264 -192
  63. package/test/data.integration.test.js +149 -3
@@ -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);