data-primals-engine 1.7.1 → 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.
- package/README.md +9 -9
- package/client/package-lock.json +8430 -8121
- package/client/package.json +7 -4
- package/client/src/APIInfo.jsx +1 -1
- package/client/src/App.jsx +2 -1
- package/client/src/App.scss +1635 -1626
- package/client/src/AssistantChat.jsx +2 -3
- package/client/src/CalendarView.jsx +1 -0
- package/client/src/ContentView.jsx +3 -3
- package/client/src/Dashboard.jsx +5 -2
- package/client/src/DashboardChart.jsx +1 -0
- package/client/src/DashboardFlexViewItem.jsx +1 -0
- package/client/src/DashboardHtmlViewItem.jsx +1 -0
- package/client/src/DashboardView.jsx +2 -0
- package/client/src/DataEditor.jsx +0 -1
- package/client/src/DataImporter.jsx +489 -468
- package/client/src/DataLayout.jsx +25 -23
- package/client/src/DataTable.jsx +6 -5
- package/client/src/Dialog.jsx +92 -90
- package/client/src/Dialog.scss +122 -116
- package/client/src/DisplayFlexNodeRenderer.jsx +1 -0
- package/client/src/DocumentationPageLayout.scss +1 -1
- package/client/src/FlexBuilderControls.jsx +1 -0
- package/client/src/FlexBuilderPreview.jsx +1 -1
- package/client/src/FlexNode.jsx +1 -1
- package/client/src/HistoryDialog.jsx +3 -2
- package/client/src/KPIWidget.jsx +1 -1
- package/client/src/KanbanView.jsx +1 -0
- package/client/src/ModelCreator.jsx +4 -0
- package/client/src/ModelList.jsx +1 -0
- package/client/src/PackGallery.jsx +5 -4
- package/client/src/RTETrans.jsx +1 -1
- package/client/src/RelationField.jsx +2 -0
- package/client/src/RelationSelectorWidget.jsx +2 -0
- package/client/src/RelationValue.jsx +1 -0
- package/client/src/RestoreDialog.jsx +1 -0
- package/client/src/ViewSwitcher.jsx +1 -1
- package/client/src/WorkflowEditor.jsx +3 -0
- package/client/src/contexts/CommandContext.jsx +2 -1
- package/client/src/contexts/ModelContext.jsx +3 -3
- package/client/src/hooks/data.js +1 -0
- package/client/src/hooks/useValidation.js +1 -0
- package/client/src/translations.js +24 -24
- package/client/vite.config.js +31 -30
- package/doc/AI-assistance.md +87 -63
- package/doc/Concepts.md +122 -0
- package/doc/Custom-Endpoints.md +31 -0
- package/doc/Event-system.md +13 -14
- package/doc/Home.md +33 -0
- package/doc/Modules.md +83 -0
- package/doc/Packs-gallery.md +8 -23
- package/doc/Workflows.md +32 -0
- package/doc/automation-workflows.md +141 -102
- package/doc/dashboards-kpis-charts.md +47 -49
- package/doc/data-management.md +126 -120
- package/doc/data-models.md +68 -75
- package/doc/roles-permissions.md +144 -43
- package/doc/sharding-replication.md +158 -0
- package/doc/users.md +54 -30
- package/package.json +27 -17
- package/server.js +37 -37
- package/src/ai.jobs.js +135 -0
- package/src/constants.js +560 -545
- package/src/data.js +521 -518
- package/src/email.js +157 -154
- package/src/engine.js +167 -49
- package/src/gameObject.js +6 -0
- package/src/i18n.js +0 -1
- package/src/modules/assistant/assistant.js +782 -763
- package/src/modules/assistant/constants.js +23 -16
- package/src/modules/assistant/providers.js +77 -37
- package/src/modules/auth-google/index.js +53 -50
- package/src/modules/bucket.js +346 -335
- package/src/modules/data/data.backup.js +400 -376
- package/src/modules/data/data.cluster.js +559 -0
- package/src/modules/data/data.core.js +11 -8
- package/src/modules/data/data.js +311 -311
- package/src/modules/data/data.operations.js +3666 -3555
- package/src/modules/data/data.relations.js +1 -0
- package/src/modules/data/data.replication.js +125 -0
- package/src/modules/data/data.routes.js +2206 -1879
- package/src/modules/data/data.scheduling.js +2 -1
- package/src/modules/file.js +248 -247
- package/src/modules/mongodb.js +76 -73
- package/src/modules/user.js +18 -2
- package/src/modules/worker-script-runner.js +97 -0
- package/src/modules/workflow.js +177 -52
- package/src/packs.js +5701 -5701
- package/src/providers.js +298 -297
- package/src/sso.js +91 -25
- package/test/assistant.test.js +207 -206
- package/test/cluster.test.js +221 -0
- package/test/core.test.js +0 -2
- package/test/data.integration.test.js +1425 -1416
- package/test/import_export.integration.test.js +210 -210
- package/test/replication.test.js +163 -0
- package/test/workflow.actions.integration.test.js +487 -475
- package/test/workflow.integration.test.js +332 -329
- package/doc/core-concepts.md +0 -33
package/src/constants.js
CHANGED
|
@@ -1,546 +1,561 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Enables auto-installation at startup
|
|
3
|
-
* @type {boolean}
|
|
4
|
-
*/
|
|
5
|
-
export const install = true;
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Maximum reflective steps to be used by the AI (looping over own research)
|
|
9
|
-
* @type {number}
|
|
10
|
-
*/
|
|
11
|
-
export const maxAIReflectiveSteps = 4;
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Database name
|
|
15
|
-
* @type {string}
|
|
16
|
-
*/
|
|
17
|
-
export const dbName = "engine";
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Web server host (for cookie domain)
|
|
21
|
-
* @type {string}
|
|
22
|
-
*/
|
|
23
|
-
export const host = 'localhost'; // or myhost.tld
|
|
24
|
-
|
|
25
|
-
export const port = 7633;
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Cookie secret key (if COOKIES_SECRET is set, it will override this variable)
|
|
29
|
-
* @type {string}
|
|
30
|
-
*/
|
|
31
|
-
export const cookiesSecret = 'hoaivuymzovyoznllmafivpzaovphlejvalwjvelfhqochakfesv';
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* AWS default configuration (overrided by AWS_* environment variables)
|
|
35
|
-
* @type {{bucketName: string, region: string}}
|
|
36
|
-
*/
|
|
37
|
-
export const awsDefaultConfig = {
|
|
38
|
-
bucketName : 'bucket-primals',
|
|
39
|
-
region: 'eu-north-1'
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Email default configuration (overrided by SMTP_* environment variables)
|
|
44
|
-
* @type {{from: string}}
|
|
45
|
-
*/
|
|
46
|
-
export const emailDefaultConfig = {
|
|
47
|
-
from: "Support - data@primals.net <data@primals.net>",
|
|
48
|
-
host: 'smtp.mydomain.tld',
|
|
49
|
-
port: 587,
|
|
50
|
-
secure: false,
|
|
51
|
-
user: 'user',
|
|
52
|
-
pass: 'password'
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export const assistantConfig = {
|
|
56
|
-
maxTokens: 4000
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Maximum number of models per user
|
|
61
|
-
* @type {number}
|
|
62
|
-
*/
|
|
63
|
-
export const maxModelsPerUser = 1000;
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Maximum number of data per user
|
|
67
|
-
* @type {number}
|
|
68
|
-
*/
|
|
69
|
-
export const maxTotalDataPerUser = 500000;
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Maximum length of a string
|
|
73
|
-
* @type {number}
|
|
74
|
-
*/
|
|
75
|
-
export const maxStringLength = 4096;
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Maximum length of a password
|
|
79
|
-
* @type {number}
|
|
80
|
-
*/
|
|
81
|
-
export const maxPasswordLength = 100000;
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* Maximum length of a rich text
|
|
85
|
-
* @type {number}
|
|
86
|
-
*/
|
|
87
|
-
export const maxRichTextLength = 100000;
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* Maximum number of exportable data per user per request
|
|
91
|
-
* @type {number}
|
|
92
|
-
*/
|
|
93
|
-
export const maxExportCount = 50000;
|
|
94
|
-
|
|
95
|
-
export const maxMagnetsDataPerModel = 100;
|
|
96
|
-
export const maxMagnetsModels = 20;
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* Maximum number of data per request
|
|
100
|
-
* @type {number}
|
|
101
|
-
*/
|
|
102
|
-
export const maxRequestData = 2500;
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
* Maximum number of data per post
|
|
106
|
-
* @type {number}
|
|
107
|
-
*/
|
|
108
|
-
export const maxPostData = 500;
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* Maximum number of relations per data
|
|
113
|
-
* @type {number}
|
|
114
|
-
*/
|
|
115
|
-
export const maxRelationsPerData = 1500;
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* Maximum number of filters per request
|
|
119
|
-
* @type {number}
|
|
120
|
-
*/
|
|
121
|
-
export const maxFilterDepth = 8;
|
|
122
|
-
export const elementsPerPage = 30;
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
* Maximum number of alerts per user
|
|
126
|
-
* @type {number}
|
|
127
|
-
*/
|
|
128
|
-
export const maxAlertsPerUser = 15;
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* Storage safety margin (between 0 and 1)
|
|
132
|
-
* @type {number}
|
|
133
|
-
*/
|
|
134
|
-
export const storageSafetyMargin = 0.95;
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
|
-
* Number of bytes in Kilobytes constant
|
|
138
|
-
* @type {number}
|
|
139
|
-
*/
|
|
140
|
-
export const kilobytes = 1024;
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
* Number of bytes in Megabytes constant
|
|
144
|
-
* @type {number}
|
|
145
|
-
*/
|
|
146
|
-
export const megabytes = 1024*1024;
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
*
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
*
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
*
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
*
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
*
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
'
|
|
272
|
-
metaModels['
|
|
273
|
-
metaModels['
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
$
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
$
|
|
332
|
-
$
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
},
|
|
339
|
-
$
|
|
340
|
-
$
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
},
|
|
346
|
-
$
|
|
347
|
-
$
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
$
|
|
354
|
-
$
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
$
|
|
363
|
-
$
|
|
364
|
-
$
|
|
365
|
-
$
|
|
366
|
-
$
|
|
367
|
-
$
|
|
368
|
-
$
|
|
369
|
-
|
|
370
|
-
$
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
description: 'The
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
},
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
{ name: '
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
{ name: '
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
{ name: '
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Enables auto-installation at startup
|
|
3
|
+
* @type {boolean}
|
|
4
|
+
*/
|
|
5
|
+
export const install = true;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Maximum reflective steps to be used by the AI (looping over own research)
|
|
9
|
+
* @type {number}
|
|
10
|
+
*/
|
|
11
|
+
export const maxAIReflectiveSteps = 4;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Database name
|
|
15
|
+
* @type {string}
|
|
16
|
+
*/
|
|
17
|
+
export const dbName = "engine";
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Web server host (for cookie domain)
|
|
21
|
+
* @type {string}
|
|
22
|
+
*/
|
|
23
|
+
export const host = 'localhost'; // or myhost.tld
|
|
24
|
+
|
|
25
|
+
export const port = 7633;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Cookie secret key (if COOKIES_SECRET is set, it will override this variable)
|
|
29
|
+
* @type {string}
|
|
30
|
+
*/
|
|
31
|
+
export const cookiesSecret = 'hoaivuymzovyoznllmafivpzaovphlejvalwjvelfhqochakfesv';
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* AWS default configuration (overrided by AWS_* environment variables)
|
|
35
|
+
* @type {{bucketName: string, region: string}}
|
|
36
|
+
*/
|
|
37
|
+
export const awsDefaultConfig = {
|
|
38
|
+
bucketName : 'bucket-primals',
|
|
39
|
+
region: 'eu-north-1'
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Email default configuration (overrided by SMTP_* environment variables)
|
|
44
|
+
* @type {{from: string}}
|
|
45
|
+
*/
|
|
46
|
+
export const emailDefaultConfig = {
|
|
47
|
+
from: "Support - data@primals.net <data@primals.net>",
|
|
48
|
+
host: 'smtp.mydomain.tld',
|
|
49
|
+
port: 587,
|
|
50
|
+
secure: false,
|
|
51
|
+
user: 'user',
|
|
52
|
+
pass: 'password'
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export const assistantConfig = {
|
|
56
|
+
maxTokens: 4000
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Maximum number of models per user
|
|
61
|
+
* @type {number}
|
|
62
|
+
*/
|
|
63
|
+
export const maxModelsPerUser = 1000;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Maximum number of data per user
|
|
67
|
+
* @type {number}
|
|
68
|
+
*/
|
|
69
|
+
export const maxTotalDataPerUser = 500000;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Maximum length of a string
|
|
73
|
+
* @type {number}
|
|
74
|
+
*/
|
|
75
|
+
export const maxStringLength = 4096;
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Maximum length of a password
|
|
79
|
+
* @type {number}
|
|
80
|
+
*/
|
|
81
|
+
export const maxPasswordLength = 100000;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Maximum length of a rich text
|
|
85
|
+
* @type {number}
|
|
86
|
+
*/
|
|
87
|
+
export const maxRichTextLength = 100000;
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Maximum number of exportable data per user per request
|
|
91
|
+
* @type {number}
|
|
92
|
+
*/
|
|
93
|
+
export const maxExportCount = 50000;
|
|
94
|
+
|
|
95
|
+
export const maxMagnetsDataPerModel = 100;
|
|
96
|
+
export const maxMagnetsModels = 20;
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Maximum number of data per request
|
|
100
|
+
* @type {number}
|
|
101
|
+
*/
|
|
102
|
+
export const maxRequestData = 2500;
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Maximum number of data per post
|
|
106
|
+
* @type {number}
|
|
107
|
+
*/
|
|
108
|
+
export const maxPostData = 500;
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Maximum number of relations per data
|
|
113
|
+
* @type {number}
|
|
114
|
+
*/
|
|
115
|
+
export const maxRelationsPerData = 1500;
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Maximum number of filters per request
|
|
119
|
+
* @type {number}
|
|
120
|
+
*/
|
|
121
|
+
export const maxFilterDepth = 8;
|
|
122
|
+
export const elementsPerPage = 30;
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Maximum number of alerts per user
|
|
126
|
+
* @type {number}
|
|
127
|
+
*/
|
|
128
|
+
export const maxAlertsPerUser = 15;
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Storage safety margin (between 0 and 1)
|
|
132
|
+
* @type {number}
|
|
133
|
+
*/
|
|
134
|
+
export const storageSafetyMargin = 0.95;
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Number of bytes in Kilobytes constant
|
|
138
|
+
* @type {number}
|
|
139
|
+
*/
|
|
140
|
+
export const kilobytes = 1024;
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Number of bytes in Megabytes constant
|
|
144
|
+
* @type {number}
|
|
145
|
+
*/
|
|
146
|
+
export const megabytes = 1024*1024;
|
|
147
|
+
|
|
148
|
+
export const gigabytes = 1024*megabytes;
|
|
149
|
+
|
|
150
|
+
export const terabytes = 1024*gigabytes;
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Maximum bytes per second for data throttling
|
|
154
|
+
* @type {number}
|
|
155
|
+
*/
|
|
156
|
+
export const maxBytesPerSecondThrottleData = 200*kilobytes; // 200Ko/s
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Search request timeout (in milliseconds)
|
|
160
|
+
* @type {number}
|
|
161
|
+
*/
|
|
162
|
+
export const searchRequestTimeout = 15000;
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Maximum model name length
|
|
166
|
+
* @type {number}
|
|
167
|
+
*/
|
|
168
|
+
export const maxModelNameLength = 150;
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Maximum file size (in bytes)
|
|
172
|
+
* @type {number}
|
|
173
|
+
*/
|
|
174
|
+
export const maxFileSize = 20 * 1024 * 1024; // 20 Mo
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Main fields types
|
|
178
|
+
* @type {string[]}
|
|
179
|
+
*/
|
|
180
|
+
export const mainFieldsTypes = ['string_t', 'string', 'url', 'enum', 'email', 'phone', 'date', 'datetime'];
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Maximum number of executions per step in workflows
|
|
184
|
+
* @type {number}
|
|
185
|
+
*/
|
|
186
|
+
export const maxExecutionsByStep = 5;
|
|
187
|
+
/**
|
|
188
|
+
* Maximum number of steps per workflow
|
|
189
|
+
* @type {number}
|
|
190
|
+
*/
|
|
191
|
+
export const maxWorkflowSteps = 15;
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Maximum number of private files per user
|
|
195
|
+
* @type {number}
|
|
196
|
+
*/
|
|
197
|
+
export const maxPrivateFileSize = 20 * megabytes; // Taille max par fichier privé (20 Mo)
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Maximum total size of private files (in bytes)
|
|
201
|
+
* @type {number}
|
|
202
|
+
*/
|
|
203
|
+
export const maxTotalPrivateFilesSize = 250 * megabytes;
|
|
204
|
+
|
|
205
|
+
export const maxPackData = 5000;
|
|
206
|
+
export const maxPackPreviewData = maxPackData / 10;
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Maximum total size of database data per user (in bytes)
|
|
210
|
+
* @type {number}
|
|
211
|
+
*/
|
|
212
|
+
export const maxTotalDataSizePerUser = 50 * megabytes; // Exemple : 50 Mo
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* Default maximum number of data per request
|
|
216
|
+
* @type {number}
|
|
217
|
+
*/
|
|
218
|
+
export const defaultMaxRequestData = 500;
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* Database connections pool size for MongoDB access
|
|
222
|
+
* @type {number}
|
|
223
|
+
*/
|
|
224
|
+
export const databasePoolSize = 30;
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* TLS options for MongoDB access
|
|
228
|
+
* @type {boolean}
|
|
229
|
+
*/
|
|
230
|
+
export const tlsAllowInvalidCertificates = false;
|
|
231
|
+
export const tlsAllowInvalidHostnames = false;
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Options for the HTML sanitizer
|
|
235
|
+
* @type {{allowedSchemesByTag: {}, selfClosing: string[], allowedSchemes: string[], enforceHtmlBoundary: boolean, disallowedTagsMode: string, allowProtocolRelative: boolean, allowedAttributes: {a: string[], img: string[], code: string[]}, allowedTags: string[], allowedSchemesAppliedToAttributes: string[]}}
|
|
236
|
+
*/
|
|
237
|
+
export const optionsSanitizer = {
|
|
238
|
+
allowedTags: [
|
|
239
|
+
"img",
|
|
240
|
+
"address", "article", "aside", "footer", "header", "h1", "h2", "h3", "h4",
|
|
241
|
+
"h5", "h6", "hgroup", "main", "nav", "section", "blockquote", "dd", "div",
|
|
242
|
+
"dl", "dt", "figcaption", "figure", "hr", "li", "main", "ol", "p", "pre",
|
|
243
|
+
"ul", "a", "abbr", "b", "bdi", "bdo", "br", "cite", "code", "data", "dfn",
|
|
244
|
+
"em", "i", "kbd", "mark", "q", "rb", "rp", "rt", "rtc", "ruby", "s", "samp",
|
|
245
|
+
"small", "span", "strong", "sub", "sup", "time", "u", "var", "wbr", "caption",
|
|
246
|
+
"col", "colgroup", "table", "tbody", "td", "tfoot", "th", "thead", "tr"
|
|
247
|
+
],
|
|
248
|
+
disallowedTagsMode: 'discard',
|
|
249
|
+
allowedAttributes: {
|
|
250
|
+
a: [ 'href', 'name', 'target' ],
|
|
251
|
+
code: ['class'],
|
|
252
|
+
img: [ 'src', "alt","width","height","style" ]
|
|
253
|
+
},
|
|
254
|
+
// Lots of these won't come up by default because we don't allow them
|
|
255
|
+
selfClosing: [ 'img', 'br', 'hr', 'area', 'base', 'basefont', 'input', 'link', 'meta' ],
|
|
256
|
+
// URL schemes we permit
|
|
257
|
+
allowedSchemes: [ 'http', 'https', 'ftp', 'mailto', 'tel' ],
|
|
258
|
+
allowedSchemesByTag: {},
|
|
259
|
+
allowedSchemesAppliedToAttributes: [ 'href', 'src', 'cite' ],
|
|
260
|
+
allowProtocolRelative: true,
|
|
261
|
+
enforceHtmlBoundary: false
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* Meta models are arranging models in groups
|
|
267
|
+
* May evolve in the future with the use of packs
|
|
268
|
+
* @type {{}}
|
|
269
|
+
*/
|
|
270
|
+
export const metaModels = {};
|
|
271
|
+
metaModels['common'] = { load: ['contact', 'location', 'request'] };
|
|
272
|
+
metaModels['personal'] = { load: ['budget', 'imageGallery'] };
|
|
273
|
+
metaModels['users'] = { load: ['permission', 'role', 'user', 'userPermission', 'token'], 'require': ['i18n', 'common'] };
|
|
274
|
+
metaModels['i18n'] = { load: ['translation','lang']};
|
|
275
|
+
metaModels['website'] = { load: ['webpage', 'content', 'taxonomy', 'contact', 'event', 'resource'], 'require': ['i18n'] };
|
|
276
|
+
metaModels['messaging'] = { load: ['alert','ticket', 'message', 'channel'], 'require': ['i18n'] };
|
|
277
|
+
metaModels['eshopping'] = { load: [
|
|
278
|
+
'order', 'currency', 'product', 'productVariant', 'discount', 'cart', 'cartItem',
|
|
279
|
+
'brand', 'return', 'review', 'stock', 'returnItem', 'userSubscription',
|
|
280
|
+
'warehouse', 'shipment', 'stockAlert', 'invoice'],
|
|
281
|
+
'require': ['i18n', 'users', 'messaging'] };
|
|
282
|
+
metaModels['workflow'] = { load: ['env', 'workflow', 'workflowRun', 'workflowAction', 'workflowStep', 'workflowTrigger']};
|
|
283
|
+
metaModels['erp'] = { load: [ 'accountingExercise', 'accountingLineItem', 'accountingEntry', 'employee', 'dashboard', 'kpi'] };
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* Available model field attributes
|
|
288
|
+
* @type {string[]}
|
|
289
|
+
*/
|
|
290
|
+
export const allowedFields = ['locked', 'hiddenable', 'encrypted', 'anonymized', 'condition', 'color', 'index', 'indexType', 'type', 'required', 'hint', 'default', 'validate', 'unique', 'name', 'placeholder', 'asMain'];
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
|
|
294
|
+
export const getHost = () => {
|
|
295
|
+
return process.env.HOST || host || 'localhost';
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* Configuration of MongoDB filters
|
|
300
|
+
*/
|
|
301
|
+
export const MONGO_CALC_OPERATORS = {
|
|
302
|
+
$find: {
|
|
303
|
+
label: 'Find in relation',
|
|
304
|
+
description: 'Recherche dans une relation/tableau',
|
|
305
|
+
supportsNesting: true,
|
|
306
|
+
multi: false,
|
|
307
|
+
isFindOperator: true // Nouvelle propriété pour identifier les opérateurs $find
|
|
308
|
+
},
|
|
309
|
+
'$regexMatch': {
|
|
310
|
+
label: 'Find by regex',
|
|
311
|
+
description: 'Find a string matching a regular expression (Ecmascript)',
|
|
312
|
+
specialStructure: true, // Indique une structure spéciale
|
|
313
|
+
args: [
|
|
314
|
+
{ name: 'input', label: 'Input String', type: 'text', description: 'The string to match against.' },
|
|
315
|
+
{ name: 'regex', label: 'Regex Pattern', type: 'text', description: 'The ECMA-262 regex pattern.' },
|
|
316
|
+
{ name: 'options', label: 'Options', type: 'text', optional: true, description: 'Regex options (e.g., "i" for case-insensitivity).' }
|
|
317
|
+
]
|
|
318
|
+
},
|
|
319
|
+
$and: {
|
|
320
|
+
label: 'Et (and)',
|
|
321
|
+
description: 'Renvoie vrai si toutes les conditions sont vérifiées',
|
|
322
|
+
args: 1,
|
|
323
|
+
multi: true
|
|
324
|
+
},
|
|
325
|
+
$or: {
|
|
326
|
+
label: 'Ou (or)',
|
|
327
|
+
description: 'Renvoie vrai si au moins une des conditions est vérifiée.',
|
|
328
|
+
args: 1,
|
|
329
|
+
multi: true
|
|
330
|
+
},
|
|
331
|
+
$not: {label: 'Non (not)', description: 'Inverse la condition (ex: non égal à).', args: 1, multi: true},
|
|
332
|
+
$nor: {
|
|
333
|
+
label: 'Ou Non (nor)',
|
|
334
|
+
description: 'Renvoie vrai si aucune des conditions n\'est vérifiée',
|
|
335
|
+
args: 1,
|
|
336
|
+
multi: true
|
|
337
|
+
},
|
|
338
|
+
$eq: {label: '=', multi: false, args: 2},
|
|
339
|
+
$ne: {label: '!=', multi: false, args: 2},
|
|
340
|
+
$gt: {label: '>', multi: false, args: 2},
|
|
341
|
+
$gte: {label: '>=', multi: false, args: 2},
|
|
342
|
+
$lt: {label: '<', multi: false, args: 2},
|
|
343
|
+
$lte: {label: '<=', multi: false, args: 2},
|
|
344
|
+
$in: {label: 'in', multi: true, args: 2},
|
|
345
|
+
$nin: {label: 'nin', multi: true, args: 2},
|
|
346
|
+
$all: {label: 'afll', multi: true},
|
|
347
|
+
$size: {
|
|
348
|
+
label: 'size',
|
|
349
|
+
multi: false,
|
|
350
|
+
description: 'Renvoie le nombre d\'éléments dans un tableau',
|
|
351
|
+
disableAdvancedValue: true
|
|
352
|
+
},
|
|
353
|
+
$elemMatch: {label: 'elemMatch', multi: true},
|
|
354
|
+
$type: {
|
|
355
|
+
label: 'type',
|
|
356
|
+
description: 'Renvoie le type BSON de l\'élément',
|
|
357
|
+
multi: false,
|
|
358
|
+
disableAdvancedValue: true
|
|
359
|
+
},
|
|
360
|
+
$add: {label: '+', multi: true},
|
|
361
|
+
$subtract: {label: '-', multi: false, args: 2},
|
|
362
|
+
$multiply: {label: '*', multi: true},
|
|
363
|
+
$divide: {label: '/', multi: false, args: 2},
|
|
364
|
+
$mod: {label: '%', multi: false, args: 2},
|
|
365
|
+
$pow: {label: 'pow', multi: false},
|
|
366
|
+
$sqrt: {label: 'sqrt', multi: false},
|
|
367
|
+
$exp: {label: 'exp', multi: false},
|
|
368
|
+
$abs: {label: 'abs', multi: false},
|
|
369
|
+
$ceil: {label: 'ceil', multi: false},
|
|
370
|
+
$floor: {label: 'floor', multi: false},
|
|
371
|
+
$ln: {label: 'ln', multi: false},
|
|
372
|
+
$log10: {label: 'log', multi: false},
|
|
373
|
+
$concat: {label: 'concat', multi: true},
|
|
374
|
+
|
|
375
|
+
// Date-specific
|
|
376
|
+
$year: {label: 'year', multi: false, isDate: true},
|
|
377
|
+
$month: {label: 'month', multi: false, isDate: true},
|
|
378
|
+
$dayOfMonth: {label: 'dayOfMonth', multi: false, isDate: true},
|
|
379
|
+
$hour: {label: 'hour', multi: false, isDate: true},
|
|
380
|
+
$minute: {label: 'minute', multi: false, isDate: true},
|
|
381
|
+
$second: {label: 'second', multi: false, isDate: true},
|
|
382
|
+
$millisecond: {label: 'ms', multi: false, isDate: true},
|
|
383
|
+
// Date operators
|
|
384
|
+
$dateAdd: {
|
|
385
|
+
label: 'Add to date',
|
|
386
|
+
description: 'Adds a duration to a date',
|
|
387
|
+
isDate: true,
|
|
388
|
+
specialStructure: true,
|
|
389
|
+
args: [
|
|
390
|
+
{name: 'startDate', label: 'Start Date', type: 'date'},
|
|
391
|
+
{
|
|
392
|
+
name: 'unit',
|
|
393
|
+
label: 'Unit',
|
|
394
|
+
type: 'select',
|
|
395
|
+
options: ['year', 'month', 'day', 'hour', 'minute', 'second']
|
|
396
|
+
},
|
|
397
|
+
{name: 'amount', label: 'Amount', type: 'number'},
|
|
398
|
+
{name: 'timezone', label: 'Timezone', type: 'text', optional: true}
|
|
399
|
+
]
|
|
400
|
+
},
|
|
401
|
+
$dateSubtract: {
|
|
402
|
+
label: 'Subtract from date',
|
|
403
|
+
description: 'Subtracts a duration from a date',
|
|
404
|
+
isDate: true,
|
|
405
|
+
specialStructure: true,
|
|
406
|
+
args: [
|
|
407
|
+
{name: 'startDate', label: 'Start Date', type: 'date'},
|
|
408
|
+
{
|
|
409
|
+
name: 'unit',
|
|
410
|
+
label: 'Unit',
|
|
411
|
+
type: 'select',
|
|
412
|
+
options: ['year', 'month', 'day', 'hour', 'minute', 'second']
|
|
413
|
+
},
|
|
414
|
+
{name: 'amount', label: 'Amount', type: 'number'},
|
|
415
|
+
{name: 'timezone', label: 'Timezone', type: 'text', optional: true}
|
|
416
|
+
]
|
|
417
|
+
},
|
|
418
|
+
$dateDiff: {
|
|
419
|
+
label: 'Date Difference',
|
|
420
|
+
description: 'Calculates the difference between two dates in specified units',
|
|
421
|
+
isDate: true,
|
|
422
|
+
specialStructure: true,
|
|
423
|
+
args: [
|
|
424
|
+
{
|
|
425
|
+
name: 'startDate',
|
|
426
|
+
label: 'Start Date',
|
|
427
|
+
type: 'date',
|
|
428
|
+
description: 'The starting date (inclusive)'
|
|
429
|
+
},
|
|
430
|
+
{
|
|
431
|
+
name: 'endDate',
|
|
432
|
+
label: 'End Date',
|
|
433
|
+
type: 'date',
|
|
434
|
+
description: 'The ending date (exclusive)'
|
|
435
|
+
},
|
|
436
|
+
{
|
|
437
|
+
name: 'unit',
|
|
438
|
+
label: 'Unit',
|
|
439
|
+
type: 'select',
|
|
440
|
+
options: ['year', 'month', 'week', 'day', 'hour', 'minute', 'second'],
|
|
441
|
+
description: 'The unit for the result'
|
|
442
|
+
},
|
|
443
|
+
{
|
|
444
|
+
name: 'timezone',
|
|
445
|
+
label: 'Timezone',
|
|
446
|
+
type: 'text',
|
|
447
|
+
optional: true,
|
|
448
|
+
description: 'The timezone (e.g. "Europe/Paris")'
|
|
449
|
+
}
|
|
450
|
+
]
|
|
451
|
+
},
|
|
452
|
+
$dateToString: {
|
|
453
|
+
label: 'Format date as string',
|
|
454
|
+
description: 'Formats a date as a string',
|
|
455
|
+
isDate: true,
|
|
456
|
+
specialStructure: true,
|
|
457
|
+
args: [
|
|
458
|
+
{
|
|
459
|
+
name: 'date',
|
|
460
|
+
label: 'Date',
|
|
461
|
+
type: 'date'
|
|
462
|
+
},
|
|
463
|
+
{
|
|
464
|
+
name: 'format',
|
|
465
|
+
label: 'Format',
|
|
466
|
+
optional: true,
|
|
467
|
+
type: 'text'
|
|
468
|
+
},
|
|
469
|
+
{
|
|
470
|
+
name: 'timezone',
|
|
471
|
+
label: 'Timezone',
|
|
472
|
+
type: 'text',
|
|
473
|
+
optional: true,
|
|
474
|
+
description: 'The timezone (e.g. "Europe/Paris")'
|
|
475
|
+
}
|
|
476
|
+
]
|
|
477
|
+
},
|
|
478
|
+
|
|
479
|
+
// Converters
|
|
480
|
+
$toBool: {label: 'toBool', multi: false, converter: true},
|
|
481
|
+
$toString: {label: 'toString', multi: false, converter: true},
|
|
482
|
+
$toInt: {label: 'toInt', multi: false, converter: true},
|
|
483
|
+
$toDouble: {label: 'toDouble', multi: false, converter: true},
|
|
484
|
+
$toDate: {label: 'toDate', multi: false, converter: true},
|
|
485
|
+
|
|
486
|
+
// --- Special Query Operators (not for $expr) ---
|
|
487
|
+
// These operators are handled by a standard $match stage, not inside $expr.
|
|
488
|
+
// The UI should use them to construct parts of the main filter object.
|
|
489
|
+
$regex: {
|
|
490
|
+
label: 'Regex',
|
|
491
|
+
description: 'Matches strings using a regular expression. Applied to a specific field.',
|
|
492
|
+
isQueryOperator: true,
|
|
493
|
+
specialStructure: true,
|
|
494
|
+
args: [
|
|
495
|
+
{ name: 'pattern', label: 'Pattern', type: 'text', description: 'The regex pattern.' },
|
|
496
|
+
{ name: 'options', label: 'Options', type: 'text', optional: true, description: 'Regex options (e.g., "i" for case-insensitivity).' }
|
|
497
|
+
]
|
|
498
|
+
},
|
|
499
|
+
|
|
500
|
+
$text: {
|
|
501
|
+
label: 'Text Search',
|
|
502
|
+
description: 'Performs a full-text search on the collection. Must be a top-level filter condition.',
|
|
503
|
+
isQueryOperator: true,
|
|
504
|
+
isTopLevel: true, // Indicates it's a key in the root of the filter, not under a field name.
|
|
505
|
+
specialStructure: true,
|
|
506
|
+
args: [
|
|
507
|
+
{ name: '$search', label: 'Search Terms', type: 'text' },
|
|
508
|
+
{ name: '$language', label: 'Language', type: 'text', optional: true },
|
|
509
|
+
{ name: '$caseSensitive', label: 'Case Sensitive', type: 'boolean', optional: true },
|
|
510
|
+
{ name: '$diacriticSensitive', label: 'Diacritic Sensitive', type: 'boolean', optional: true }
|
|
511
|
+
]
|
|
512
|
+
},
|
|
513
|
+
|
|
514
|
+
$nearSphere: {
|
|
515
|
+
label: 'Near Sphere',
|
|
516
|
+
description: 'Finds documents near a GeoJSON point on a sphere. Applied to a 2dsphere-indexed field.',
|
|
517
|
+
isQueryOperator: true,
|
|
518
|
+
specialStructure: true,
|
|
519
|
+
args: [
|
|
520
|
+
{ name: 'geometry', label: 'Center Point (GeoJSON)', type: 'code', language: 'json', description: 'e.g., { "type": "Point", "coordinates": [ -73.93, 40.82 ] }' },
|
|
521
|
+
{ name: 'maxDistance', label: 'Max Distance (meters)', type: 'number', optional: true },
|
|
522
|
+
{ name: 'minDistance', label: 'Min Distance (meters)', type: 'number', optional: true }
|
|
523
|
+
]
|
|
524
|
+
},
|
|
525
|
+
|
|
526
|
+
$geoWithin: {
|
|
527
|
+
label: 'Geo Within',
|
|
528
|
+
description: 'Selects documents with geospatial data that exists entirely within a specified shape.',
|
|
529
|
+
isQueryOperator: true,
|
|
530
|
+
specialStructure: true,
|
|
531
|
+
args: [
|
|
532
|
+
{ name: '$geometry', label: 'Shape (GeoJSON)', type: 'code', language: 'json', description: 'A GeoJSON Polygon or MultiPolygon.' }
|
|
533
|
+
]
|
|
534
|
+
},
|
|
535
|
+
|
|
536
|
+
$geoIntersects: {
|
|
537
|
+
label: 'Geo Intersects',
|
|
538
|
+
description: 'Selects documents whose geospatial data intersects with a specified GeoJSON object.',
|
|
539
|
+
isQueryOperator: true,
|
|
540
|
+
specialStructure: true,
|
|
541
|
+
args: [
|
|
542
|
+
{ name: '$geometry', label: 'Geometry (GeoJSON)', type: 'code', language: 'json', description: 'A GeoJSON object to test for intersection.' }
|
|
543
|
+
]
|
|
544
|
+
},
|
|
545
|
+
|
|
546
|
+
// This represents the $geoNear aggregation stage, which has special placement rules.
|
|
547
|
+
$geoNear: {
|
|
548
|
+
label: 'Geo Near (Stage)',
|
|
549
|
+
description: 'Finds and sorts documents by distance. Must be the first operation in a search.',
|
|
550
|
+
isQueryOperator: true,
|
|
551
|
+
isTopLevel: true, // Indicates it's a key in the root of the filter.
|
|
552
|
+
specialStructure: true,
|
|
553
|
+
args: [
|
|
554
|
+
{ name: 'near', label: 'Near Point (GeoJSON)', type: 'code', language: 'json', description: 'The point to search near.' },
|
|
555
|
+
{ name: 'distanceField', label: 'Distance Field Name', type: 'text', description: 'The output field to store the distance.' },
|
|
556
|
+
{ name: 'spherical', label: 'Spherical', type: 'boolean', optional: true, default: true },
|
|
557
|
+
{ name: 'query', label: 'Additional Query', type: 'code', language: 'json', optional: true, description: 'Filters documents before distance calculation.' },
|
|
558
|
+
{ name: 'maxDistance', label: 'Max Distance (meters)', type: 'number', optional: true }
|
|
559
|
+
]
|
|
560
|
+
}
|
|
546
561
|
};
|