data-primals-engine 1.7.2 → 1.7.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.
Files changed (78) hide show
  1. package/README.md +160 -160
  2. package/client/package-lock.json +8430 -8430
  3. package/client/src/APIInfo.jsx +1 -1
  4. package/client/src/App.jsx +2 -1
  5. package/client/src/App.scss +1635 -1626
  6. package/client/src/AssistantChat.jsx +1 -0
  7. package/client/src/CalendarView.jsx +1 -0
  8. package/client/src/ContentView.jsx +3 -3
  9. package/client/src/Dashboard.jsx +5 -2
  10. package/client/src/DashboardChart.jsx +1 -0
  11. package/client/src/DashboardFlexViewItem.jsx +1 -0
  12. package/client/src/DashboardHtmlViewItem.jsx +1 -0
  13. package/client/src/DashboardView.jsx +2 -0
  14. package/client/src/DataEditor.jsx +0 -1
  15. package/client/src/DataImporter.jsx +489 -468
  16. package/client/src/DataLayout.jsx +6 -3
  17. package/client/src/DataTable.jsx +4 -3
  18. package/client/src/Dialog.jsx +92 -90
  19. package/client/src/Dialog.scss +122 -116
  20. package/client/src/DisplayFlexNodeRenderer.jsx +1 -0
  21. package/client/src/FlexBuilderControls.jsx +1 -0
  22. package/client/src/FlexBuilderPreview.jsx +1 -1
  23. package/client/src/FlexNode.jsx +1 -1
  24. package/client/src/HistoryDialog.jsx +3 -2
  25. package/client/src/KPIWidget.jsx +1 -1
  26. package/client/src/KanbanView.jsx +1 -0
  27. package/client/src/ModelCreator.jsx +4 -0
  28. package/client/src/ModelList.jsx +1 -0
  29. package/client/src/PackGallery.jsx +5 -4
  30. package/client/src/RTETrans.jsx +1 -1
  31. package/client/src/RelationField.jsx +2 -0
  32. package/client/src/RelationSelectorWidget.jsx +2 -0
  33. package/client/src/RelationValue.jsx +1 -0
  34. package/client/src/RestoreDialog.jsx +1 -0
  35. package/client/src/WorkflowEditor.jsx +3 -0
  36. package/client/src/contexts/CommandContext.jsx +2 -1
  37. package/client/src/contexts/ModelContext.jsx +3 -3
  38. package/client/src/hooks/data.js +1 -0
  39. package/client/src/hooks/useValidation.js +1 -0
  40. package/client/src/translations.js +24 -24
  41. package/doc/AI-assistance.md +87 -63
  42. package/doc/Concepts.md +122 -0
  43. package/doc/Custom-Endpoints.md +31 -0
  44. package/doc/Event-system.md +13 -14
  45. package/doc/Home.md +33 -0
  46. package/doc/Modules.md +83 -0
  47. package/doc/Packs-gallery.md +8 -23
  48. package/doc/Workflows.md +32 -0
  49. package/doc/automation-workflows.md +141 -102
  50. package/doc/dashboards-kpis-charts.md +47 -49
  51. package/doc/data-management.md +126 -120
  52. package/doc/data-models.md +68 -75
  53. package/doc/roles-permissions.md +144 -43
  54. package/doc/sharding-replication.md +158 -0
  55. package/doc/users.md +54 -30
  56. package/package.json +1 -1
  57. package/server.js +37 -37
  58. package/src/constants.js +7 -8
  59. package/src/data.js +521 -520
  60. package/src/email.js +157 -154
  61. package/src/engine.js +117 -7
  62. package/src/gameObject.js +6 -0
  63. package/src/i18n.js +0 -1
  64. package/src/modules/auth-google/index.js +53 -50
  65. package/src/modules/bucket.js +346 -339
  66. package/src/modules/data/data.backup.js +400 -376
  67. package/src/modules/data/data.cluster.js +410 -42
  68. package/src/modules/data/data.operations.js +3666 -3635
  69. package/src/modules/data/data.replication.js +106 -64
  70. package/src/modules/data/data.routes.js +87 -64
  71. package/src/modules/data/data.scheduling.js +2 -1
  72. package/src/modules/file.js +248 -247
  73. package/src/modules/user.js +11 -1
  74. package/src/sso.js +91 -25
  75. package/test/cluster.test.js +221 -0
  76. package/test/core.test.js +0 -2
  77. package/test/replication.test.js +163 -0
  78. package/doc/core-concepts.md +0 -33
@@ -58,6 +58,7 @@ const AssistantChat = ({ config }) => {
58
58
  try {
59
59
  const response = await fetch('/api/assistant/chat', {
60
60
  method: 'POST',
61
+ credentials: "include",
61
62
  headers: { 'Content-Type': 'application/json' },
62
63
  body: JSON.stringify(payload)
63
64
  });
@@ -64,6 +64,7 @@ const CalendarView = ({ settings, model, onEditData }) => {
64
64
  ['calendarData', model.name],
65
65
  () => fetch(`/api/data/search?_user=${me.username}&depth=1`, {
66
66
  method: 'POST',
67
+ credentials: "include",
67
68
  headers: { 'Content-Type': 'application/json' },
68
69
  // Note : Pour de très grands ensembles de données, vous pourriez vouloir implémenter une récupération par plage de dates.
69
70
  body: JSON.stringify({ model: model.name, page: 1 })
@@ -49,14 +49,14 @@ const ContentView = () => { // Le prop 'menu' a été retiré car non passé par
49
49
  // 2. Récupérer le contenu principal basé sur le slug et la langue
50
50
  const {data: contentData, isLoading: isLoadingContent, error: errorContent} = useQuery(
51
51
  ['contentPage', slug, langCode, cat], // Ajout de cat pour la spécificité de la clé
52
- () => fetch('/api/website/content?lang='+langCode+'&slug='+slug+'&limit=1&sort=_id:DESC', { headers: { 'Content-Type': 'application/json'}}).then(e => e.json())
52
+ () => fetch('/api/website/content?lang='+langCode+'&slug='+slug+'&limit=1&sort=_id:DESC', { credentials: "include", headers: { 'Content-Type': 'application/json'}}).then(e => e.json())
53
53
  );
54
54
  const pageContent = contentData?.data?.[0];
55
55
 
56
56
  // 4. Récupérer les sous-catégories de la catégorie parente 'cat'
57
57
  const {data: childCategoriesData, isLoading: isLoadingChildCategories} = useQuery(
58
58
  ['childDocCategories', cat, langCode], // Clé de query mise à jour
59
- () => fetch('/api/website/taxonomies?lang='+langCode+'&identifier='+cat, { headers: { 'Content-Type': 'application/json' }}).then(e => e.json()), // Tri par order, puis par nom
59
+ () => fetch('/api/website/taxonomies?lang='+langCode+'&identifier='+cat, { credentials: "include",headers: { 'Content-Type': 'application/json' }}).then(e => e.json()), // Tri par order, puis par nom
60
60
  { enabled: !!cat && !!langCode } // Activer si cat et langCode sont présents
61
61
  );
62
62
  const childCategories = childCategoriesData?.data || [];
@@ -66,7 +66,7 @@ const ContentView = () => { // Le prop 'menu' a été retiré car non passé par
66
66
 
67
67
  const {data: tocContentQuery, isLoading: isLoadingTocContent} = useQuery(
68
68
  ['tocContent', childCategoryIds, langCode], // Clé de query mise à jour
69
- () => fetch( '/api/website/content?cats='+childCategoryIds.join(',')+'&lang='+langCode+'&sort=order:ASC,title:ASC', { headers: { 'Content-Type': 'application/json' }}).then(e => e.json()), // Tri par order, puis par titre
69
+ () => fetch( '/api/website/content?cats='+childCategoryIds.join(',')+'&lang='+langCode+'&sort=order:ASC,title:ASC', { credentials: "include",headers: { 'Content-Type': 'application/json' }}).then(e => e.json()), // Tri par order, puis par titre
70
70
  {enabled: !!langCode && childCategoryIds.length > 0} // Activer si langCode et des IDs de catégories enfants sont présents
71
71
  );
72
72
 
@@ -46,6 +46,7 @@ export function DashboardsPage() {
46
46
  const response = await fetch(
47
47
  `/api/data/search?model=dashboard&_user=${me.username}`, {
48
48
  method: 'POST',
49
+ credentials: "include",
49
50
  headers: { 'Content-Type': 'application/json' },
50
51
  // body: JSON.stringify({ sort: { name: 1 } }) // Optionnel: trier
51
52
  });
@@ -69,6 +70,7 @@ export function DashboardsPage() {
69
70
  const isFirstDashboard = !dashboardsData?.data || dashboardsData.data.length === 0;
70
71
  const response = await fetch('/api/data', {
71
72
  method: 'POST',
73
+ credentials: "include",
72
74
  headers: { 'Content-Type': 'application/json' },
73
75
  body: JSON.stringify({
74
76
  model: 'dashboard',
@@ -100,6 +102,7 @@ export function DashboardsPage() {
100
102
  const { _id, _hash, _user, _createdAt, _updatedAt, ...data } = dashboardData;
101
103
  const response = await fetch(`/api/data`, {
102
104
  method: 'PUT',
105
+ credentials: "include",
103
106
  headers: { 'Content-Type': 'application/json' },
104
107
  body: JSON.stringify({
105
108
  model: 'dashboard',
@@ -384,7 +387,8 @@ export function DashboardsPage() {
384
387
  onChange={(selectedOption) => {
385
388
  setSelectedDashboardId(selectedOption.value);
386
389
  const d = dashboardsData.data.find(f => f._id === selectedOption.value);
387
- history.pushState({}, null, '/user/'+getUserHash(me)+'/dashboards/'+d._hash);
390
+ if( me )
391
+ history.pushState({}, null, '/user/'+getUserHash(me)+'/dashboards/'+d._hash);
388
392
  }}
389
393
  items={dashboardOptions}
390
394
  />
@@ -425,7 +429,6 @@ export function DashboardsPage() {
425
429
  label={t('dashboards.refreshPresets.label', 'Préréglages')}
426
430
  value={dashboardToEdit.refreshInterval}
427
431
  onChange={(option) => {
428
- console.log({option});
429
432
  if (option?.value)
430
433
  handleEditFieldChange({ name: 'refreshInterval', value: option?.value })
431
434
  }}
@@ -28,6 +28,7 @@ const fetchChartData = async (chartConfig) => {
28
28
  try {
29
29
  const response = await fetch(`/api/charts/aggregate`, {
30
30
  method: 'POST',
31
+ credentials: "include",
31
32
  headers: { 'Content-Type': 'application/json' },
32
33
  body: JSON.stringify(chartConfig) // Le filtre sera envoyil est dans chartConfig
33
34
  });
@@ -37,6 +37,7 @@ const DashboardFlexViewItem = ({ flexViewConfig, allModels }) => {
37
37
 
38
38
  const response = await fetch(apiUrl, {
39
39
  method: 'POST',
40
+ credentials: "include",
40
41
  headers: { 'Content-Type': 'application/json' },
41
42
  body: JSON.stringify(payload)
42
43
  });
@@ -96,6 +96,7 @@ const DashboardHtmlViewItem = ({ config }) => {
96
96
  async () => {
97
97
  const response = await fetch(`/api/data/search?model=${modelName}&depth=2&limit=${limit || 10}&sort=${JSON.stringify(sort || {})}`, {
98
98
  method: 'POST',
99
+ credentials: "include",
99
100
  headers: { 'Content-Type': 'application/json' },
100
101
  body: JSON.stringify({ filter: filter || {}}),
101
102
  });
@@ -27,6 +27,7 @@ async function updateDashboardLayout(dashboard, newLayoutData, username, t) {
27
27
  try {
28
28
  const response = await fetch(`/api/data/${dashboard._id}?_user=${username}`, {
29
29
  method: 'PUT',
30
+ credentials: "include",
30
31
  headers: { 'Content-Type': 'application/json' },
31
32
  body: JSON.stringify({
32
33
  model: 'dashboard',
@@ -178,6 +179,7 @@ export function DashboardView({ dashboard }) {
178
179
  const response = await fetch(
179
180
  `/api/data/search?model=kpi&lang=${lang}&_user=${me.username}`, {
180
181
  method: 'POST',
182
+ credentials: "include",
181
183
  headers: { 'Content-Type': 'application/json' }
182
184
  });
183
185
  if (!response.ok) {
@@ -185,7 +185,6 @@ export const DataEditor = forwardRef(function MyDataEditor({
185
185
  )}</div>
186
186
  }
187
187
 
188
- {console.log(formData[field.name])}
189
188
  return <CodeField key={field.name} language={field.language} name={inputProps.name}
190
189
  value={typeof (value) === 'string' ? value : JSON.stringify(value)}
191
190
  onChange={handleChange}/>