data-primals-engine 1.4.0 → 1.4.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 (40) hide show
  1. package/README.md +856 -797
  2. package/client/src/AssistantChat.jsx +48 -5
  3. package/client/src/AssistantChat.scss +0 -1
  4. package/client/src/ChartConfigModal.jsx +34 -9
  5. package/client/src/Dashboard.jsx +396 -349
  6. package/client/src/DashboardChart.jsx +91 -12
  7. package/client/src/DataTable.jsx +817 -807
  8. package/client/src/Field.jsx +1784 -1782
  9. package/client/src/PackGallery.jsx +391 -290
  10. package/client/src/PackGallery.scss +231 -210
  11. package/client/src/contexts/UIContext.jsx +5 -2
  12. package/client/src/translations.js +188 -0
  13. package/package.json +19 -8
  14. package/src/config.js +2 -2
  15. package/src/core.js +21 -3
  16. package/src/engine.js +2 -1
  17. package/src/events.js +4 -3
  18. package/src/gameObject.js +1 -1
  19. package/src/middlewares/middleware-mongodb.js +3 -1
  20. package/src/modules/assistant/assistant.js +131 -42
  21. package/src/modules/auth-google/index.js +51 -0
  22. package/src/modules/auth-microsoft/index.js +82 -0
  23. package/src/modules/auth-saml/index.js +90 -0
  24. package/src/modules/bucket.js +3 -2
  25. package/src/modules/data/data.backup.js +374 -0
  26. package/src/modules/data/data.history.js +11 -8
  27. package/src/modules/data/data.js +190 -4543
  28. package/src/modules/data/data.operations.js +2790 -0
  29. package/src/modules/data/data.relations.js +687 -0
  30. package/src/modules/data/data.routes.js +1785 -1646
  31. package/src/modules/data/data.scheduling.js +274 -0
  32. package/src/modules/data/data.validation.js +245 -0
  33. package/src/modules/data/index.js +29 -1
  34. package/src/modules/user.js +2 -1
  35. package/src/modules/workflow.js +3 -2
  36. package/src/providers.js +110 -1
  37. package/src/services/stripe.js +3 -2
  38. package/src/sso.js +194 -0
  39. package/test/data.integration.test.js +3 -0
  40. package/test/user.test.js +1 -1
@@ -2,6 +2,12 @@
2
2
  export const websiteTranslations = {
3
3
  fr: {
4
4
  translation: {
5
+ "time.minute": "Minute",
6
+ "time.hour": "Heure",
7
+ "time.day": "Jour",
8
+ "time.week": "Semaine",
9
+ "time.month": "Mois",
10
+ "time.year": "Année",
5
11
  "modelcreator.gauge.hint": "Affiche le champ numérique sous forme de jauge visuelle. Nécessite de définir une valeur minimale et maximale.",
6
12
  "modelcreator.percent.hint": "En mode jauge, affiche la valeur sous forme de pourcentage (calculé à partir du min/max) au lieu de la valeur brute.",
7
13
 
@@ -133,6 +139,16 @@ export const websiteTranslations = {
133
139
  "packs.sortBy": "Trier par :",
134
140
  "packs.sort.lastUpdated": "Derniers ajouts",
135
141
  "packs.sort.mostStarred": "Plus populaires",
142
+ "packs.myPack": "Mon pack",
143
+ "packs.public": "Public",
144
+ "packs.public.tooltip": "Rendre ce pack visible par les autres utilisateurs dans la galerie.",
145
+ "packs.update.success": "Pack mis à jour avec succès !",
146
+ "packs.update.error": "Échec de la mise à jour du pack",
147
+ "packs.myPacksTitle": "Mes Packs",
148
+ "packs.clearFilter": "Voir tous les packs",
149
+ "packs.myPacks": "Mes packs",
150
+ "packs.filteringMyPacks": "Affichage de vos packs uniquement",
151
+ "packs.noMyPacks": "Vous n'avez créé aucun pack.",
136
152
 
137
153
  "noComparison": "Transformation seule",
138
154
  "addCondition": "Condition",
@@ -590,6 +606,13 @@ export const websiteTranslations = {
590
606
  },
591
607
  en: {
592
608
  translation: {
609
+ "time.minute":"Minute",
610
+ "time.hour":"Hour",
611
+ "time.day":"Day",
612
+ "time.week":"Week",
613
+ "time.month":"Month",
614
+ "time.year":"Year",
615
+
593
616
  "modelcreator.gauge.hint": "Displays the numeric field as a visual gauge. Requires a minimum and maximum value to be set.",
594
617
  "modelcreator.percent.hint": "In gauge mode, displays the value as a percentage (calculated from the min/max) instead of the raw value.",
595
618
  "duration.unit.days": "days",
@@ -734,6 +757,16 @@ export const websiteTranslations = {
734
757
  "packs.sortBy": "Sort by:",
735
758
  "packs.sort.lastUpdated": "Latest Additions",
736
759
  "packs.sort.mostStarred": "Most Popular",
760
+ "packs.myPack": "My pack",
761
+ "packs.public": "Public",
762
+ "packs.public.tooltip": "Make this pack visible to other users in the gallery.",
763
+ "packs.update.success": "Pack updated successfully!",
764
+ "packs.update.error": "Failed to update pack",
765
+ "packs.myPacksTitle": "My Packs",
766
+ "packs.clearFilter": "Show all packs",
767
+ "packs.myPacks": "My packs",
768
+ "packs.filteringMyPacks": "Showing only your packs",
769
+ "packs.noMyPacks": "You have not created any packs.",
737
770
 
738
771
  "noComparison": "Transformation only",
739
772
  "addCondition": "Condition",
@@ -2051,6 +2084,22 @@ export const websiteTranslations = {
2051
2084
  },
2052
2085
  es: {
2053
2086
  translation: {
2087
+ "time.minute": "Minuto",
2088
+ "time.hour": "Hora",
2089
+ "time.day": "Día",
2090
+ "time.week": "Semana",
2091
+ "time.month": "Mes",
2092
+ "time.year": "Año",
2093
+ "packs.myPack": "Mi Pack",
2094
+ "packs.public": "Público",
2095
+ "packs.public.tooltip": "Hacer este pack visible para otros usuarios en la galería.",
2096
+ "packs.update.success": "¡Pack actualizado correctamente!",
2097
+ "packs.update.error": "Error al actualizar el pack",
2098
+ "packs.myPacksTitle": "Mis Packs",
2099
+ "packs.clearFilter": "Ver todos los packs",
2100
+ "packs.myPacks": "Mis Packs",
2101
+ "packs.filteringMyPacks": "Mostrando solo tus packs",
2102
+ "packs.noMyPacks": "No has creado ningún pack.",
2054
2103
  "modelcreator.gauge.hint": "Muestra el campo numérico como un indicador visual. Requiere que se establezcan un valor mínimo y máximo.",
2055
2104
  "modelcreator.percent.hint": "En modo indicador, muestra el valor como un porcentaje (calculado a partir del mínimo/máximo) en lugar del valor bruto.",
2056
2105
  "duration.unit.days": "días",
@@ -3515,6 +3564,22 @@ export const websiteTranslations = {
3515
3564
  },
3516
3565
  pt: {
3517
3566
  translation: {
3567
+ "time.minute":"Minuto",
3568
+ "time.hour":"Hora",
3569
+ "time.day":"Dia",
3570
+ "time.week":"Semana",
3571
+ "time.month":"Mês",
3572
+ "time.year":"Ano",
3573
+ "packs.myPack": "Meu Pacote",
3574
+ "packs.public": "Público",
3575
+ "packs.public.tooltip": "Tornar este pacote visível para outros usuários na galeria.",
3576
+ "packs.update.success": "Pacote atualizado com sucesso!",
3577
+ "packs.update.error": "Falha na atualização do pacote",
3578
+ "packs.myPacksTitle": "Meus Pacotes",
3579
+ "packs.clearFilter": "Ver todos os pacotes",
3580
+ "packs.myPacks": "Meus Pacotes",
3581
+ "packs.filteringMyPacks": "Exibindo apenas seus pacotes",
3582
+ "packs.noMyPacks": "Você não criou nenhum pacote.",
3518
3583
  "modelcreator.gauge.hint": "Exibe o campo numérico como um indicador visual. Requer a definição de um valor mínimo e máximo.",
3519
3584
  "modelcreator.percent.hint": "No modo de indicador, exibe o valor como uma porcentagem (calculada a partir do mínimo/máximo) em vez do valor bruto.",
3520
3585
  "duration.unit.days": "dias",
@@ -4974,6 +5039,22 @@ export const websiteTranslations = {
4974
5039
  },
4975
5040
  de: {
4976
5041
  translation: {
5042
+ "time.minute":"Minute",
5043
+ "time.hour":"Stunde",
5044
+ "time.day":"Tag",
5045
+ "time.week":"Woche",
5046
+ "time.month":"Monat",
5047
+ "time.year":"Jahr",
5048
+ "packs.myPack": "Mein Pack",
5049
+ "packs.public": "Öffentlich",
5050
+ "packs.public.tooltip": "Dieses Pack für andere Nutzer in der Galerie sichtbar machen.",
5051
+ "packs.update.success": "Pack erfolgreich aktualisiert!",
5052
+ "packs.update.error": "Pack-Aktualisierung fehlgeschlagen",
5053
+ "packs.myPacksTitle": "Meine Packs",
5054
+ "packs.clearFilter": "Alle Packs anzeigen",
5055
+ "packs.myPacks": "Meine Packs",
5056
+ "packs.filteringMyPacks": "Nur deine Packs werden angezeigt",
5057
+ "packs.noMyPacks": "Du hast keine Packs erstellt.",
4977
5058
  "modelcreator.gauge.hint": "Zeigt das numerische Feld als visuelle Anzeige an. Erfordert die Festlegung eines Mindest- und Höchstwerts.",
4978
5059
  "modelcreator.percent.hint": "Im Anzeigemodus wird der Wert als Prozentsatz (berechnet aus Min./Max.) anstelle des Rohwerts angezeigt.",
4979
5060
  "duration.unit.days": "Tage",
@@ -6418,6 +6499,22 @@ export const websiteTranslations = {
6418
6499
  },
6419
6500
  it: {
6420
6501
  translation: {
6502
+ "time.minute":"Minuto",
6503
+ "time.hour":"Ora",
6504
+ "time.day":"Giorno",
6505
+ "time.week":"Settimana",
6506
+ "time.month":"Mese",
6507
+ "time.year":"Anno",
6508
+ "packs.myPack": "Il mio pacchetto",
6509
+ "packs.public": "Pubblico",
6510
+ "packs.public.tooltip": "Rendi questo pacchetto visibile agli altri utenti nella galleria.",
6511
+ "packs.update.success": "Pacchetto aggiornato con successo!",
6512
+ "packs.update.error": "Aggiornamento del pacchetto non riuscito",
6513
+ "packs.myPacksTitle": "I miei pacchetti",
6514
+ "packs.clearFilter": "Visualizza tutti i pacchetti",
6515
+ "packs.myPacks": "I miei pacchetti",
6516
+ "packs.filteringMyPacks": "Visualizza solo i tuoi pacchetti",
6517
+ "packs.noMyPacks": "Non hai creato alcun pacchetto.",
6421
6518
  "modelcreator.gauge.hint": "Visualizza il campo numerico come indicatore visivo. Richiede l'impostazione di un valore minimo e massimo.",
6422
6519
  "modelcreator.percent.hint": "In modalità indicatore, visualizza il valore come percentuale (calcolata dal minimo/massimo) anziché come valore grezzo.",
6423
6520
  "duration.unit.days": "giorni",
@@ -7875,6 +7972,22 @@ export const websiteTranslations = {
7875
7972
  },
7876
7973
  cs: {
7877
7974
  translation: {
7975
+ "time.minute":"Minuta",
7976
+ "time.hour":"Hodina",
7977
+ "time.day":"Den",
7978
+ "time.week":"Týden",
7979
+ "time.month":"Měsíc",
7980
+ "time.year":"Rok",
7981
+ "packs.myPack": "Můj balíček",
7982
+ "packs.public": "Veřejný",
7983
+ "packs.public.tooltip": "Zobrazit tento balíček ostatním uživatelům v galerii.",
7984
+ "packs.update.success": "Balíček byl úspěšně aktualizován!",
7985
+ "packs.update.error": "Aktualizace balíčku selhala",
7986
+ "packs.myPacksTitle": "Moje balíčky",
7987
+ "packs.clearFilter": "Zobrazit všechny balíčky",
7988
+ "packs.myPacks": "Moje balíčky",
7989
+ "packs.filteringMyPacks": "Zobrazují se pouze vaše balíčky",
7990
+ "packs.noMyPacks": "Nevytvořili jste žádné balíčky.",
7878
7991
  "modelcreator.gauge.hint": "Zobrazuje číselné pole jako vizuální měřidlo. Vyžaduje nastavení minimální a maximální hodnoty.",
7879
7992
  "modelcreator.percent.hint": "V režimu měřidla zobrazuje hodnotu v procentech (vypočtených z min./max.) namísto nezpracované hodnoty.",
7880
7993
  "duration.unit.days": "dny",
@@ -9326,6 +9439,22 @@ export const websiteTranslations = {
9326
9439
  },
9327
9440
  ru: {
9328
9441
  translation: {
9442
+ "time.minute":"Минута",
9443
+ "time.hour":"Час",
9444
+ "time.day":"День",
9445
+ "time.week":"Неделя",
9446
+ "time.month":"Месяц",
9447
+ "time.year":"Год",
9448
+ "packs.myPack": "Мой пакет",
9449
+ "packs.public": "Публичный",
9450
+ "packs.public.tooltip": "Сделать этот пакет видимым для других пользователей в галерее",
9451
+ "packs.update.success": "Пакет успешно обновлён!",
9452
+ "packs.update.error": "Обновление пакета не удалось",
9453
+ "packs.myPacksTitle": "Мои пакеты",
9454
+ "packs.clearFilter": "Просмотреть все пакеты",
9455
+ "packs.myPacks": "Мои пакеты",
9456
+ "packs.filteringMyPacks": "Показывать только ваши пакеты",
9457
+ "packs.noMyPacks": "Вы не создали ни одного пакета",
9329
9458
  "modelcreator.gauge.hint": "Отображает числовое поле в виде визуальной шкалы. Требуется задать минимальное и максимальное значения.",
9330
9459
  "modelcreator.percent.hint": "В режиме шкалы отображает значение в процентах (рассчитанных на основе минимального и максимального значений), а не в исходном виде.",
9331
9460
  "duration.unit.days": "дней",
@@ -10789,6 +10918,17 @@ export const websiteTranslations = {
10789
10918
  },
10790
10919
  ar: {
10791
10920
  translation: {
10921
+ "الدقيقة الزمنية": "الدقيقة", "الساعة الزمنية": "الساعة", "اليوم الزمني": "اليوم", "الأسبوع الزمني": "الأسبوع", "الشهر الزمني": "الشهر", "السنة الزمنية": "السنة",
10922
+ "packs.myPack": "حزمتي",
10923
+ "packs.public": "عامة",
10924
+ "packs.public.tooltip": "إظهار هذه الحزمة للمستخدمين الآخرين في المعرض",
10925
+ "packs.update.success": "تم تحديث الحزمة بنجاح!",
10926
+ "packs.update.error": "فشل تحديث الحزمة",
10927
+ "packs.myPacksTitle": "حزمي",
10928
+ "packs.clearFilter": "عرض جميع الحزم",
10929
+ "packs.myPacks": "حزمي",
10930
+ "packs.filteringMyPacks": "عرض حزمك فقط",
10931
+ "packs.noMyPacks": "لم تُنشئ أي حزم",
10792
10932
  "modelcreator.gauge.hint": "يعرض الحقل الرقمي كمقياس مرئي. يتطلب تحديد الحد الأدنى والحد الأقصى للقيمة.",
10793
10933
  "modelcreator.percent.hint": "في وضع المقياس، يعرض القيمة كنسبة مئوية (محسوبة من الحد الأدنى/الأقصى) بدلاً من القيمة الخام.",
10794
10934
  "duration.unit.days": "أيام",
@@ -12267,6 +12407,22 @@ export const websiteTranslations = {
12267
12407
  },
12268
12408
  sv: {
12269
12409
  translation: {
12410
+ "time.minute":"Minut",
12411
+ "time.hour":"Timme",
12412
+ "time.day":"Dag",
12413
+ "time.week":"Vecka",
12414
+ "time.month":"Månad",
12415
+ "time.year":"År",
12416
+ "packs.myPack": "حزمتي",
12417
+ "packs.public": "عامة",
12418
+ "packs.public.tooltip": "إظهار هذه الحزمة للمستخدمين الآخرين في المعرض",
12419
+ "packs.update.success": "تم تحديث الحزمة بنجاح!",
12420
+ "packs.update.error": "فشل تحديث الحزمة",
12421
+ "packs.myPacksTitle": "حزمي",
12422
+ "packs.clearFilter": "عرض جميع الحزم",
12423
+ "packs.myPacks": "حزمي",
12424
+ "packs.filteringMyPacks": "عرض حزمك فقط",
12425
+ "packs.noMyPacks": "لم تُنشئ أي حزم",
12270
12426
  "modelcreator.gauge.hint": "Visar det numeriska fältet som en visuell mätare. Kräver att ett minimum- och maxvärde ställs in.",
12271
12427
  "modelcreator.percent.hint": "I mätläge visas värdet som en procentandel (beräknat från min/max) istället för det råa värdet.",
12272
12428
  "duration.unit.days": "dagar",
@@ -13718,6 +13874,22 @@ export const websiteTranslations = {
13718
13874
  },
13719
13875
  el: {
13720
13876
  translation: {
13877
+ "time.minute":"Λεπτό",
13878
+ "time.hour":"Ώρα",
13879
+ "time.day":"Ημέρα",
13880
+ "time.week":"Εβδομάδα",
13881
+ "time.month":"Μήνας",
13882
+ "time.year":"Έτος",
13883
+ "packs.myPack": "Το Πακέτο μου",
13884
+ "packs.public": "Δημόσιο",
13885
+ "packs.public.tooltip": "Κάντε αυτό το πακέτο ορατό σε άλλους χρήστες στη συλλογή.",
13886
+ "packs.update.success": "Το πακέτο ενημερώθηκε με επιτυχία!",
13887
+ "packs.update.error": "Η ενημέρωση του πακέτου απέτυχε",
13888
+ "packs.myPacksTitle": "Τα Πακέτα μου",
13889
+ "packs.clearFilter": "Προβολή όλων των πακέτων",
13890
+ "packs.myPacks": "Τα Πακέτα μου",
13891
+ "packs.filteringMyPacks": "Εμφάνιση μόνο των πακέτων σας",
13892
+ "packs.noMyPacks": "Δεν έχετε δημιουργήσει κανένα πακέτο.",
13721
13893
  "modelcreator.gauge.hint": "Εμφανίζει το αριθμητικό πεδίο ως οπτικό μετρητή. Απαιτείται να οριστεί μια ελάχιστη και μια μέγιστη τιμή.",
13722
13894
  "modelcreator.percent.hint": "Στη λειτουργία μετρητή, εμφανίζει την τιμή ως ποσοστό (υπολογιζόμενο από την ελάχιστη/μέγιστη τιμή) αντί για την ακατέργαστη τιμή.",
13723
13895
  "duration.unit.days": "ημέρες",
@@ -15178,6 +15350,22 @@ export const websiteTranslations = {
15178
15350
  },
15179
15351
  fa: {
15180
15352
  "translation": {
15353
+ "time.minute":"دقیقه",
15354
+ "time.hour":"ساعت",
15355
+ "time.day":"روز",
15356
+ "time.week":"هفته",
15357
+ "time.month":"ماه",
15358
+ "time.year":"سال",
15359
+ "packs.myPack": "بسته من",
15360
+ "packs.public": "عمومی",
15361
+ "packs.public.tooltip": "این بسته را برای سایر کاربران در گالری قابل مشاهده کنید.",
15362
+ "packs.update.success": "بسته با موفقیت به‌روزرسانی شد!",
15363
+ "packs.update.error": "به‌روزرسانی بسته ناموفق بود",
15364
+ "packs.myPacksTitle": "بسته‌های من",
15365
+ "packs.clearFilter": "مشاهده همه بسته‌ها",
15366
+ "packs.myPacks": "بسته‌های من",
15367
+ "packs.filteringMyPacks": "فقط بسته‌های شما نمایش داده می‌شود",
15368
+ "packs.noMyPacks": "شما هیچ بسته‌ای ایجاد نکرده‌اید.",
15181
15369
  "modelcreator.gauge.hint": "فیلد عددی را به عنوان یک معیار بصری نمایش می‌دهد. نیاز به تنظیم حداقل و حداکثر مقدار دارد.",
15182
15370
  "modelcreator.percent.hint": "در حالت معیار، مقدار را به صورت درصد (محاسبه شده از حداقل/حداکثر) به جای مقدار خام نمایش می‌دهد.",
15183
15371
  "duration.unit.days": "روز",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "data-primals-engine",
3
- "version": "1.4.0",
3
+ "version": "1.4.2",
4
4
  "description": "data-primals-engine is a package responsible from handling large amount of data using MongoDB in a practical and performant way. It can also get workflow models working (for automation), and fully supports internationalisation. It also has integrated AI assistant.",
5
5
  "main": "src/engine.js",
6
6
  "type": "module",
@@ -31,9 +31,16 @@
31
31
  "tar-fs": "3.0.9",
32
32
  "on-headers": "1.1.0",
33
33
  "brace-expansion": "2.0.2",
34
- "prismjs": "1.30.0"
34
+ "prismjs": "1.30.0",
35
+ "xml2js": ">=0.5.0"
35
36
  },
36
37
  "overrides": {
38
+ "react-syntax-highlighter": {
39
+ "prismjs": "1.30.0"
40
+ },
41
+ "react-code-blocks": {
42
+ "prismjs": "1.30.0"
43
+ },
37
44
  "refractor": {
38
45
  "prismjs": "1.30.0"
39
46
  }
@@ -49,12 +56,6 @@
49
56
  "./client": "./client/index.js",
50
57
  "./*": "./src/*.js"
51
58
  },
52
- "peerDependencies": {
53
- "express": "^5.1.0",
54
- "react": "18.3.1",
55
- "react-query": ">=3.0.0",
56
- "react-i18next": "^15.6.1"
57
- },
58
59
  "dependencies": {
59
60
  "@langchain/anthropic": "^0.3.26",
60
61
  "@langchain/core": "^0.3.66",
@@ -86,6 +87,8 @@
86
87
  "node-schedule": "^2.1.1",
87
88
  "nodemailer": "^7.0.5",
88
89
  "openai": "^5.10.2",
90
+ "passport": "^0.7.0",
91
+ "passport-saml-encrypted": "^0.1.13",
89
92
  "process": "^0.11.10",
90
93
  "prop-types": "^15.8.1",
91
94
  "randomcolor": "^0.6.2",
@@ -102,6 +105,14 @@
102
105
  "vitest": "^3.2.4",
103
106
  "yaml": "^2.8.0"
104
107
  },
108
+ "peerDependencies": {
109
+ "express": "^5.1.0",
110
+ "passport-azure-ad": "^4.3.5",
111
+ "passport-google-oauth20": "^2.0.0",
112
+ "react": "18.3.1",
113
+ "react-i18next": "^15.6.1",
114
+ "react-query": ">=3.0.0"
115
+ },
105
116
  "devDependencies": {
106
117
  "@eslint/js": "^9.32.0",
107
118
  "concurrently": "^9.2.0",
package/src/config.js CHANGED
@@ -1,4 +1,4 @@
1
-
1
+ import {safeAssignObject} from "./core.js";
2
2
 
3
3
 
4
4
  const config = [];
@@ -11,6 +11,6 @@ export const Config = {
11
11
  return config[name];
12
12
  },
13
13
  Set: (name, value) => {
14
- config[name] = value;
14
+ safeAssignObject(config, name, value);
15
15
  }
16
16
  }
package/src/core.js CHANGED
@@ -36,7 +36,7 @@ export function escapeHtml(string){
36
36
  export const isDate = dt => String(new Date(dt)) !== 'Invalid Date'
37
37
 
38
38
  export const safeAssignObject = (obj, key, value) => {
39
- if( !["__proto__", "constructor"].includes(key)){
39
+ if( !["__proto__", "constructor", "prototype"].includes(key)){
40
40
  obj[key] = value;
41
41
  }
42
42
  }
@@ -351,13 +351,13 @@ export const event_trigger = (name, ...params) => {
351
351
  };
352
352
  export const event_on = (name, callback) => {
353
353
  if (!Array.isArray(triggers[name])) {
354
- triggers[name] = [];
354
+ safeAssignObject(triggers, name, []);
355
355
  }
356
356
  triggers[name].push({ callback });
357
357
  };
358
358
  export const event_off = (name, callback) => {
359
359
  if (callback && triggers[name]) {
360
- triggers[name] = triggers[name].filter((f) => f.callback !== callback);
360
+ safeAssignObject(triggers, name, triggers[name].filter((f) => f.callback !== callback));
361
361
  } else {
362
362
  triggers[name] = undefined;
363
363
  }
@@ -418,3 +418,21 @@ export function object_equals( x, y ) {
418
418
  export const isValidPath = (path) =>{
419
419
  return /^(?:[a-z]:)?[\/\\]{0,2}(?:[.\/\\ ](?![.\/\\\n])|[^<>:"|?*.\/\\ \n])+$/gmi.test(path);
420
420
  }
421
+
422
+
423
+ /**
424
+ * Génère une couleur de base cohérente à partir d'une chaîne de caractères.
425
+ * @param {string} str La chaîne à hasher (par exemple, le libellé d'une catégorie).
426
+ * @returns {string} Une couleur au format 'hsl(h, s, l)'.
427
+ */
428
+ export const stringToHslColor = (str) => {
429
+ let hash = 0;
430
+ for (let i = 0; i < str.length; i++) {
431
+ hash = str.charCodeAt(i) + ((hash << 5) - hash);
432
+ }
433
+ // Utiliser HSL pour un meilleur contrôle sur la saturation et la luminosité
434
+ const h = hash % 360; // Teinte (0-359)
435
+ const s = 70; // Saturation (fixe pour des couleurs vives mais pas criardes)
436
+ const l = 55; // Luminosité (fixe pour une bonne lisibilité)
437
+ return `hsl(${h}, ${s}%, ${l}%)`;
438
+ };
package/src/engine.js CHANGED
@@ -13,7 +13,6 @@ import {
13
13
  import http from "http";
14
14
  import cookieParser from "cookie-parser";
15
15
  import requestIp from 'request-ip';
16
- import {createModel, deleteModels, getModels, installAllPacks, validateModelStructure} from "./modules/data/data.js";
17
16
  import {defaultModels} from "./defaultModels.js";
18
17
  import {DefaultUserProvider} from "./providers.js";
19
18
  import formidableMiddleware from 'express-formidable';
@@ -22,6 +21,8 @@ import * as tls from "node:tls";
22
21
  import {Event} from "./events.js";
23
22
  import path from "node:path";
24
23
  import { fileURLToPath } from 'node:url';
24
+ import {validateModelStructure} from "./modules/data/data.validation.js";
25
+ import {createModel, deleteModels, getModels, installAllPacks} from "./modules/data/data.operations.js";
25
26
  // Constants
26
27
 
27
28
  // On définit __dirname pour obtenir le chemin absolu du répertoire courant,
package/src/events.js CHANGED
@@ -1,3 +1,4 @@
1
+ import {safeAssignObject} from "./core.js";
1
2
 
2
3
  const events = {};
3
4
 
@@ -81,9 +82,9 @@ export const Event = {
81
82
  throw new Error(`Layer '${layer}' does not exist in system '${system}'. Valid layers are: ${validLayers.join(', ')}`); // Message d'erreur plus informatif
82
83
  }
83
84
 
84
- events[system] = events[system] || {}; // Simplification de la création des objets
85
- events[system][name] = events[system][name] || {};
86
- events[system][name][layer] = events[system][name][layer] || [];
85
+ safeAssignObject(events, system, events[system] || {}); // Simplification de la création des objets
86
+ safeAssignObject(events[system], name, events[system][name] || {});
87
+ safeAssignObject(events[system][name], layer, events[system][name][layer] || []);
87
88
  events[system][name][layer].push(callback);
88
89
  },
89
90
  RemoveCallback: (name, callback, layer="medium", system='priority') => {
package/src/gameObject.js CHANGED
@@ -33,7 +33,7 @@ export const GameObject = {
33
33
  }
34
34
  }
35
35
  // Behavior.js
36
- class Behaviour {
36
+ export class Behaviour {
37
37
  constructor(gameObject) {
38
38
  this.gameObject = gameObject;
39
39
  Event.Trigger("GameObject."+(this.constructor.name)+".init", "system", "calls", this);
@@ -1,3 +1,5 @@
1
+ import {safeAssignObject} from "../core.js";
2
+
1
3
  const TEST_REGEX = /^\$|\./;
2
4
  const TEST_REGEX_WITHOUT_DOT = /^\$/;
3
5
  const REPLACE_REGEX = /^\$|\./g;
@@ -59,7 +61,7 @@ function _sanitize(target, options) {
59
61
  let shouldRecurse = true;
60
62
 
61
63
  if( (key === 'regex' && obj.input) || key === '$regex' ){
62
- obj[key] = new RegExp(val, "ui");
64
+ safeAssignObject(obj, key, new RegExp(val, "ui"));
63
65
  }
64
66
  else if (!wl.includes(key) && regex.test(key)) {
65
67
  isSanitized = true;