data-primals-engine 1.1.8 → 1.2.1
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 +72 -25
- package/client/src/App.scss +11 -6
- package/client/src/AssistantChat.scss +0 -1
- package/client/src/ChartConfigModal.jsx +0 -1
- package/client/src/ConditionBuilder.jsx +0 -2
- package/client/src/ConditionBuilder2.jsx +47 -6
- package/client/src/ContentView.jsx +0 -1
- package/client/src/CronBuilder.scss +0 -1
- package/client/src/CronPartBuilder.jsx +0 -1
- package/client/src/Dashboard.jsx +0 -1
- package/client/src/Dashboard.scss +0 -1
- package/client/src/DashboardChart.jsx +0 -1
- package/client/src/DashboardView.jsx +0 -1
- package/client/src/DataEditor.jsx +0 -4
- package/client/src/DisplayFlexNodeRenderer.jsx +0 -1
- package/client/src/DocumentationPageLayout.jsx +0 -2
- package/client/src/DocumentationPageLayout.scss +0 -1
- package/client/src/Field.jsx +1 -1
- package/client/src/FlexNode.jsx +0 -1
- package/client/src/KanbanView.scss +0 -1
- package/client/src/ModelCreator.jsx +4 -4
- package/client/src/ModelCreator.scss +10 -0
- package/client/src/ModelCreatorField.jsx +34 -34
- package/client/src/RTE.jsx +2 -1
- package/client/src/RestoreDialog.jsx +0 -1
- package/client/src/TourSpotlight.jsx +0 -1
- package/client/src/filter.js +2 -0
- package/client/src/hooks/useDragAndDrop.js +0 -1
- package/issues.txt +0 -0
- package/package.json +3 -2
- package/src/constants.js +6 -0
- package/src/core.js +6 -0
- package/src/data.js +0 -2
- package/src/defaultModels.js +33 -0
- package/src/migrate.js +0 -1
- package/src/modules/assistant.js +211 -133
- package/src/modules/data.js +88 -69
- package/src/modules/user.js +111 -56
- package/src/modules/workflow.js +10 -12
- package/src/providers.js +1 -1
- package/src/workers/crypto-worker.js +0 -1
- package/test/data.integration.test.js +53 -70
- package/test/user.test.js +203 -0
- package/test/workflow.integration.test.js +1 -1
|
@@ -61,7 +61,7 @@ const ModelCreatorField = ({model, handleRenameField, handleRemoveField, handleU
|
|
|
61
61
|
</div>
|
|
62
62
|
<div className="flex flex-row flex-stretch">
|
|
63
63
|
|
|
64
|
-
<div className="flex fieldName">{hint('modelcreator.name.hint')}
|
|
64
|
+
<div className="flex fieldName field-bg">{hint('modelcreator.name.hint')}
|
|
65
65
|
<div className="flex flex-no-gap flex-no-wrap flex-1">
|
|
66
66
|
<TextField
|
|
67
67
|
label={t('modelcreator.fieldName')}
|
|
@@ -88,7 +88,7 @@ const ModelCreatorField = ({model, handleRenameField, handleRemoveField, handleU
|
|
|
88
88
|
|
|
89
89
|
<div className="flex">
|
|
90
90
|
{hint('modelcreator.type.hint')}
|
|
91
|
-
<div className="flex flex-1 flex-stretch flex-no-gap">
|
|
91
|
+
<div className="flex flex-1 flex-stretch field-bg flex-no-gap">
|
|
92
92
|
|
|
93
93
|
<SelectField
|
|
94
94
|
label={t('modelcreator.type', 'Type de champ')}
|
|
@@ -453,16 +453,15 @@ const ModelCreatorField = ({model, handleRenameField, handleRemoveField, handleU
|
|
|
453
453
|
</div>
|
|
454
454
|
|
|
455
455
|
{!['file', 'relation', 'array', 'calculated'].includes(field.type) && (<div
|
|
456
|
-
className="flex flex-no-wrap">
|
|
457
|
-
{hint('modelcreator.default.hint')}
|
|
456
|
+
className="flex flex-no-wrap field-bg mg-item">
|
|
458
457
|
|
|
459
458
|
{['string_t', 'string', 'richtext', 'password', 'url', 'phone', 'email'].includes(field.type) && (<>
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
<
|
|
463
|
-
type="text"
|
|
459
|
+
{hint('modelcreator.default.hint')}
|
|
460
|
+
<div className="flex flex-1">
|
|
461
|
+
<TextField
|
|
464
462
|
className="flex-1"
|
|
465
463
|
value={field.default}
|
|
464
|
+
label={<Trans i18nKey={"modelcreator.default"}>Valeur par défaut :</Trans>}
|
|
466
465
|
disabled={modelLocked || (isLocalUser(me) && field.locked)}
|
|
467
466
|
onChange={(e) => {
|
|
468
467
|
const newFields = [...fields];
|
|
@@ -470,9 +469,10 @@ const ModelCreatorField = ({model, handleRenameField, handleRemoveField, handleU
|
|
|
470
469
|
setFields(newFields);
|
|
471
470
|
}}
|
|
472
471
|
/>
|
|
473
|
-
</
|
|
472
|
+
</div>
|
|
474
473
|
</>)}
|
|
475
474
|
{['number'].includes(field.type) && (<>
|
|
475
|
+
{hint('modelcreator.default.hint')}
|
|
476
476
|
<NumberField
|
|
477
477
|
label={<Trans i18nKey={"modelcreator.default"}>Valeur par défaut :</Trans>}
|
|
478
478
|
type="number"
|
|
@@ -491,6 +491,7 @@ const ModelCreatorField = ({model, handleRenameField, handleRemoveField, handleU
|
|
|
491
491
|
/>
|
|
492
492
|
</>)}
|
|
493
493
|
{['enum'].includes(field.type) && (<>
|
|
494
|
+
{hint('modelcreator.default.hint')}
|
|
494
495
|
<SelectField
|
|
495
496
|
label={<Trans i18nKey={"modelcreator.default"}>Valeur par défaut :</Trans>}
|
|
496
497
|
value={field.default}
|
|
@@ -505,6 +506,7 @@ const ModelCreatorField = ({model, handleRenameField, handleRemoveField, handleU
|
|
|
505
506
|
/>
|
|
506
507
|
</>)}
|
|
507
508
|
{['code'].includes(field.type) && (<>
|
|
509
|
+
{hint('modelcreator.default.hint')}
|
|
508
510
|
<CodeField
|
|
509
511
|
label={<Trans i18nKey={"modelcreator.default"}>Valeur par défaut :</Trans>}
|
|
510
512
|
value={field.language === 'json' ? JSON.stringify(field.default, 2, null) : field.default}
|
|
@@ -516,6 +518,7 @@ const ModelCreatorField = ({model, handleRenameField, handleRemoveField, handleU
|
|
|
516
518
|
/>
|
|
517
519
|
</>)}
|
|
518
520
|
{['boolean'].includes(field.type) && (<>
|
|
521
|
+
{hint('modelcreator.default.hint')}
|
|
519
522
|
<div className="checkbox-label flex flex-1">
|
|
520
523
|
<CheckboxField
|
|
521
524
|
label={<Trans i18nKey={"modelcreator.default"}>Valeur par défaut :</Trans>}
|
|
@@ -530,6 +533,7 @@ const ModelCreatorField = ({model, handleRenameField, handleRemoveField, handleU
|
|
|
530
533
|
</div>
|
|
531
534
|
</>)}
|
|
532
535
|
{['color'].includes(field.type) && (<>
|
|
536
|
+
{hint('modelcreator.default.hint')}
|
|
533
537
|
<ColorField
|
|
534
538
|
label={<Trans i18nKey={"modelcreator.default"}>Valeur par défaut :</Trans>}
|
|
535
539
|
value={field.default || null} name={field.name}
|
|
@@ -543,6 +547,7 @@ const ModelCreatorField = ({model, handleRenameField, handleRemoveField, handleU
|
|
|
543
547
|
/>
|
|
544
548
|
</>)}
|
|
545
549
|
{['date', 'datetime'].includes(field.type) && (<>
|
|
550
|
+
{hint('modelcreator.default.hint')}
|
|
546
551
|
<label className="flex flex-1">
|
|
547
552
|
<Trans i18nKey={"modelcreator.default"}>Valeur par défaut :</Trans>
|
|
548
553
|
<input
|
|
@@ -562,7 +567,7 @@ const ModelCreatorField = ({model, handleRenameField, handleRemoveField, handleU
|
|
|
562
567
|
|
|
563
568
|
|
|
564
569
|
{(['number', 'datetime', 'date'].includes(field.itemsType || field.type)) && (
|
|
565
|
-
<><label className="flex">
|
|
570
|
+
<><label className="flex field-bg mg-item">
|
|
566
571
|
{hint('modelcreator.min.hint')}
|
|
567
572
|
<span><Trans
|
|
568
573
|
i18nKey={"modelcreator.min"}>Valeur minimale :</Trans></span>
|
|
@@ -581,7 +586,7 @@ const ModelCreatorField = ({model, handleRenameField, handleRemoveField, handleU
|
|
|
581
586
|
}}
|
|
582
587
|
/></div>
|
|
583
588
|
</label>
|
|
584
|
-
<label className="flex">
|
|
589
|
+
<label className="flex field-bg mg-item">
|
|
585
590
|
{hint('modelcreator.max.hint')}
|
|
586
591
|
<span><Trans i18nKey={"modelcreator.max"}>Valeur maximale :</Trans></span>
|
|
587
592
|
<div className="flex flex-1"><input
|
|
@@ -601,13 +606,12 @@ const ModelCreatorField = ({model, handleRenameField, handleRemoveField, handleU
|
|
|
601
606
|
</label>
|
|
602
607
|
</>
|
|
603
608
|
)}
|
|
604
|
-
<div className="flex flex-no-wrap">
|
|
609
|
+
<div className="flex flex-no-wrap mg-item">
|
|
605
610
|
{hint('modelcreator.condition.hint')}
|
|
606
611
|
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
type="checkbox"
|
|
612
|
+
<CheckboxField
|
|
613
|
+
label={<Trans
|
|
614
|
+
i18nKey={"modelcreator.condition"}>Condition</Trans>}
|
|
611
615
|
disabled={modelLocked || (isLocalUser(me) && field.locked)}
|
|
612
616
|
checked={field.condition !== undefined}
|
|
613
617
|
onChange={(e) => {
|
|
@@ -620,7 +624,6 @@ const ModelCreatorField = ({model, handleRenameField, handleRemoveField, handleU
|
|
|
620
624
|
setFields(newFields);
|
|
621
625
|
}}
|
|
622
626
|
/>
|
|
623
|
-
</label>
|
|
624
627
|
</div>
|
|
625
628
|
{field.condition !== undefined && (
|
|
626
629
|
<div className={"condition-details flex flex-start"}>
|
|
@@ -691,10 +694,10 @@ const ModelCreatorField = ({model, handleRenameField, handleRemoveField, handleU
|
|
|
691
694
|
|
|
692
695
|
|
|
693
696
|
{mainFieldsTypes.includes(field.itemsType || field.type) && (<div
|
|
694
|
-
className="flex flex-no-wrap"
|
|
697
|
+
className="flex flex-no-wrap mg-item"
|
|
695
698
|
title={t("modelcreator.field.asMain", "Une information principale sera affichée dans le titre de l'enregistrement")}>
|
|
696
699
|
{hint('modelcreator.asMain.hint')}
|
|
697
|
-
<
|
|
700
|
+
<div className="flex flex-1">
|
|
698
701
|
|
|
699
702
|
<CheckboxField
|
|
700
703
|
label={<Trans i18nKey={"modelcreator.asMain"}>Information principale :</Trans>}
|
|
@@ -707,7 +710,7 @@ const ModelCreatorField = ({model, handleRenameField, handleRemoveField, handleU
|
|
|
707
710
|
}}
|
|
708
711
|
help={field.asMain && t('modelcreator.asMain.hint')}
|
|
709
712
|
/>
|
|
710
|
-
</
|
|
713
|
+
</div>
|
|
711
714
|
</div>)}
|
|
712
715
|
|
|
713
716
|
<div className="flex flex-row flex-stretch">
|
|
@@ -729,7 +732,7 @@ const ModelCreatorField = ({model, handleRenameField, handleRemoveField, handleU
|
|
|
729
732
|
</div>
|
|
730
733
|
|
|
731
734
|
|
|
732
|
-
<label className="flex">
|
|
735
|
+
<label className="flex mg-item ">
|
|
733
736
|
{hint('modelcreator.color.hint')}
|
|
734
737
|
<Trans i18nKey={"field.color"}>Color :</Trans>
|
|
735
738
|
<ColorField
|
|
@@ -763,19 +766,16 @@ const ModelCreatorField = ({model, handleRenameField, handleRemoveField, handleU
|
|
|
763
766
|
|
|
764
767
|
<div className={"flex flex-no-wrap"}>
|
|
765
768
|
{hint('modelcreator.anonymized.hint')}
|
|
766
|
-
<
|
|
767
|
-
<Trans i18nKey={"modelcreator.anonymized"}>Donnée anonymisée :</Trans>
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
}}
|
|
777
|
-
/>
|
|
778
|
-
</label>
|
|
769
|
+
<CheckboxField
|
|
770
|
+
label={<Trans i18nKey={"modelcreator.anonymized"}>Donnée anonymisée :</Trans>}
|
|
771
|
+
disabled={modelLocked || (isLocalUser(me) && field.locked)}
|
|
772
|
+
checked={field.anonymized}
|
|
773
|
+
onChange={(e) => {
|
|
774
|
+
const newFields = [...fields];
|
|
775
|
+
newFields[index].anonymized = e.target.checked;
|
|
776
|
+
setFields(newFields);
|
|
777
|
+
}}
|
|
778
|
+
/>
|
|
779
779
|
</div>
|
|
780
780
|
|
|
781
781
|
|
package/client/src/RTE.jsx
CHANGED
|
@@ -28,6 +28,7 @@ import css from 'highlight.js/lib/languages/css'
|
|
|
28
28
|
import js from 'highlight.js/lib/languages/javascript'
|
|
29
29
|
import ts from 'highlight.js/lib/languages/typescript'
|
|
30
30
|
import html from 'highlight.js/lib/languages/xml'
|
|
31
|
+
import {escapeHtml, escapeRegex} from "data-primals-engine/core";
|
|
31
32
|
// create a lowlight instance
|
|
32
33
|
const lowlight = createLowlight(all)
|
|
33
34
|
|
|
@@ -43,7 +44,7 @@ const code = (c) => {
|
|
|
43
44
|
const doc = document.createElement('div');
|
|
44
45
|
doc.innerHTML = c;
|
|
45
46
|
doc.querySelectorAll('code').forEach(cc =>{
|
|
46
|
-
cc.innerHTML = cc.textContent
|
|
47
|
+
cc.innerHTML = escapeHtml(cc.textContent)
|
|
47
48
|
.replace(/\r\n|\n/g, "<br />")
|
|
48
49
|
.replace(/\t/g, " ");
|
|
49
50
|
})
|
package/client/src/filter.js
CHANGED
|
@@ -53,6 +53,8 @@ export const MONGO_CALC_OPERATORS = {
|
|
|
53
53
|
$ln: { label: 'ln', multi: false },
|
|
54
54
|
$log10: { label: 'log', multi: false },
|
|
55
55
|
$concat: { label: 'concat', multi: true },
|
|
56
|
+
|
|
57
|
+
// Date-specific
|
|
56
58
|
$year: { label: 'year', multi: false, isDate: true },
|
|
57
59
|
$month: { label: 'month', multi: false, isDate: true },
|
|
58
60
|
$dayOfMonth: { label: 'dayOfMonth', multi: false, isDate: true },
|
package/issues.txt
ADDED
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "data-primals-engine",
|
|
3
|
-
"version": "1.1
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"description": "data-primals-engine is the package responsible from handling large amount of data in a practical and performant way. It can handle large amount of data in a practical and performant way. It can also get workflow models working (for automation), and fully supports internationalisation.",
|
|
5
5
|
"main": "src/engine.js",
|
|
6
6
|
"type": "module",
|
|
@@ -30,7 +30,8 @@
|
|
|
30
30
|
"resolutions": {
|
|
31
31
|
"tar-fs": "3.0.9",
|
|
32
32
|
"on-headers": "1.1.0",
|
|
33
|
-
"brace-expansion": "2.0.2"
|
|
33
|
+
"brace-expansion": "2.0.2",
|
|
34
|
+
"prismjs": "1.30.0"
|
|
34
35
|
},
|
|
35
36
|
"repository": {
|
|
36
37
|
"type": "git",
|
package/src/constants.js
CHANGED
|
@@ -6,6 +6,12 @@ import {event_trigger} from "./core.js";
|
|
|
6
6
|
*/
|
|
7
7
|
export const install = true;
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
* Maximum reflective steps to be used by the AI (looping over own research)
|
|
11
|
+
* @type {number}
|
|
12
|
+
*/
|
|
13
|
+
export const maxAIReflectiveSteps = 4;
|
|
14
|
+
|
|
9
15
|
/**
|
|
10
16
|
* Database name
|
|
11
17
|
* @type {string}
|
package/src/core.js
CHANGED
|
@@ -9,6 +9,12 @@ export function escapeRegex(string) {
|
|
|
9
9
|
return string.replace(/[/\-\\^$*+?.()|[\]{}]/g, '\\$&');
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
+
export function escapeHtml(string){
|
|
13
|
+
return string.replace(/(javascript|data|vbscript):/gi, '').replace(/[^\w-_. ]/gi, function (c) {
|
|
14
|
+
return `&#${c.charCodeAt(0)};`;
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
|
|
12
18
|
export const isDate = dt => String(new Date(dt)) !== 'Invalid Date'
|
|
13
19
|
|
|
14
20
|
export const safeAssignObject = (obj, key, value) => {
|
package/src/data.js
CHANGED
|
@@ -50,7 +50,6 @@ export function getUserId(user) {
|
|
|
50
50
|
export const getUserName = (user) => {
|
|
51
51
|
return isLocalUser(user) ? user._id + '_'+user._user : user.username;
|
|
52
52
|
}
|
|
53
|
-
// C:/Dev/hackersonline-engine/src/data.js
|
|
54
53
|
|
|
55
54
|
/**
|
|
56
55
|
* Crée une fonction de génération de nombres pseudo-aléatoires basée sur une graine (seed).
|
|
@@ -255,7 +254,6 @@ function buildNestedFindStructure(pathSegments, finalPayload) {
|
|
|
255
254
|
}
|
|
256
255
|
};
|
|
257
256
|
}
|
|
258
|
-
// C:/Dev/hackersonline-engine/src/data.js
|
|
259
257
|
// ... (imports and other functions) ...
|
|
260
258
|
|
|
261
259
|
/**
|
package/src/defaultModels.js
CHANGED
|
@@ -46,6 +46,39 @@ export const defaultModels = {
|
|
|
46
46
|
{ name: 'tokens', type: 'relation', multiple: true, relation: 'token' }
|
|
47
47
|
]
|
|
48
48
|
},
|
|
49
|
+
userPermission: {
|
|
50
|
+
"name": "userPermission",
|
|
51
|
+
"description": "Gère les exceptions aux permissions des rôles pour un utilisateur (ajouts ou retraits, permanents ou temporaires).",
|
|
52
|
+
"fields": [
|
|
53
|
+
{
|
|
54
|
+
"name": "user",
|
|
55
|
+
"type": "relation",
|
|
56
|
+
"relation": "user",
|
|
57
|
+
"required": true,
|
|
58
|
+
"index": true
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"name": "permission",
|
|
62
|
+
"type": "relation",
|
|
63
|
+
"relation": "permission",
|
|
64
|
+
"required": true,
|
|
65
|
+
"index": true
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"name": "isGranted",
|
|
69
|
+
"type": "boolean",
|
|
70
|
+
"required": true,
|
|
71
|
+
"hint": "True pour accorder la permission, False pour la révoquer explicitement."
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"name": "expiresAt",
|
|
75
|
+
"type": "datetime",
|
|
76
|
+
"required": false,
|
|
77
|
+
"index": true,
|
|
78
|
+
"hint": "Si défini, l'exception (l'octroi ou la révocation) est temporaire."
|
|
79
|
+
}
|
|
80
|
+
]
|
|
81
|
+
},
|
|
49
82
|
token: {
|
|
50
83
|
name: 'token',
|
|
51
84
|
"description": "",
|
package/src/migrate.js
CHANGED