@sfxcode/nuxt-ui-mongocamp 1.3.1 → 1.3.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.
- package/README.md +1 -1
- package/dist/module.json +1 -1
- package/dist/runtime/components/MongocampAggregationBuilder.d.vue.ts +6 -0
- package/dist/runtime/components/MongocampAggregationBuilder.vue +390 -0
- package/dist/runtime/components/MongocampAggregationBuilder.vue.d.ts +6 -0
- package/dist/runtime/components/MongocampBulkDelete.d.vue.ts +11 -1
- package/dist/runtime/components/MongocampBulkDelete.vue +1 -0
- package/dist/runtime/components/MongocampBulkDelete.vue.d.ts +11 -1
- package/dist/runtime/components/MongocampBulkEdit.d.vue.ts +29 -0
- package/dist/runtime/components/MongocampBulkEdit.vue +138 -0
- package/dist/runtime/components/MongocampBulkEdit.vue.d.ts +29 -0
- package/dist/runtime/components/MongocampCollectionData.vue +100 -1
- package/dist/runtime/components/MongocampCollectionInfos.vue +162 -0
- package/dist/runtime/components/MongocampFilterBuilder.d.vue.ts +1 -0
- package/dist/runtime/components/MongocampFilterBuilder.vue +33 -2
- package/dist/runtime/components/MongocampFilterBuilder.vue.d.ts +1 -0
- package/dist/runtime/components/MongocampImport.d.vue.ts +10 -0
- package/dist/runtime/components/MongocampImport.vue +479 -0
- package/dist/runtime/components/MongocampImport.vue.d.ts +10 -0
- package/dist/runtime/composables/useMongocampAggregation.d.ts +28 -0
- package/dist/runtime/composables/useMongocampAggregation.js +99 -0
- package/dist/runtime/composables/useMongocampBulkDelete.d.ts +1 -1
- package/dist/runtime/composables/useMongocampImport.d.ts +14 -0
- package/dist/runtime/composables/useMongocampImport.js +25 -0
- package/dist/runtime/locales/de.json +140 -2
- package/dist/runtime/locales/en.json +140 -2
- package/dist/runtime/utils/aggregationErrors.d.ts +10 -0
- package/dist/runtime/utils/aggregationErrors.js +17 -0
- package/dist/runtime/utils/aggregationPipeline.d.ts +42 -0
- package/dist/runtime/utils/aggregationPipeline.js +118 -0
- package/dist/runtime/utils/aggregationResult.d.ts +5 -0
- package/dist/runtime/utils/aggregationResult.js +17 -0
- package/dist/runtime/utils/analyzeSamples.d.ts +27 -0
- package/dist/runtime/utils/analyzeSamples.js +92 -0
- package/dist/runtime/utils/batchInsert.d.ts +22 -0
- package/dist/runtime/utils/batchInsert.js +24 -0
- package/dist/runtime/utils/bulkDelete.d.ts +6 -1
- package/dist/runtime/utils/bulkDelete.js +28 -4
- package/dist/runtime/utils/bulkEdit.d.ts +27 -0
- package/dist/runtime/utils/bulkEdit.js +45 -0
- package/dist/runtime/utils/filterSuggestions.d.ts +8 -0
- package/dist/runtime/utils/filterSuggestions.js +15 -0
- package/dist/runtime/utils/importPipeline.d.ts +21 -0
- package/dist/runtime/utils/importPipeline.js +52 -0
- package/dist/runtime/utils/importRows.d.ts +36 -0
- package/dist/runtime/utils/importRows.js +228 -0
- package/dist/runtime/utils/objectId.d.ts +1 -0
- package/dist/runtime/utils/objectId.js +4 -0
- package/package.json +1 -1
|
@@ -137,7 +137,19 @@
|
|
|
137
137
|
"confirmDeleteIndex": "Möchten Sie den Index \"{indexName}\" wirklich löschen? Diese Aktion kann nicht rückgängig gemacht werden.",
|
|
138
138
|
"errorCreateIndex": "Fehler beim Erstellen des Index",
|
|
139
139
|
"errorDeleteIndex": "Fehler beim Löschen des Index",
|
|
140
|
-
"typeStandard": "Standard"
|
|
140
|
+
"typeStandard": "Standard",
|
|
141
|
+
"statsTitle": "Feldstatistik",
|
|
142
|
+
"statsAnalyze": "Felder analysieren",
|
|
143
|
+
"statsSampleSize": "Stichprobengröße",
|
|
144
|
+
"statsSampled": "{sampled} von {total} Dokumenten geprüft",
|
|
145
|
+
"statsHint": "Zählt, wie oft jedes Feld vorkommt und welche Werte es enthält, anhand einer zufälligen Stichprobe von Dokumenten.",
|
|
146
|
+
"statsNote": "Aus einer zufälligen Stichprobe berechnet, nicht aus der gesamten Collection.",
|
|
147
|
+
"statsTruncated": "Es werden nur die ersten {count} Felder angezeigt.",
|
|
148
|
+
"statsColumnPresent": "Vorhanden",
|
|
149
|
+
"statsPresentTitle": "In {present} von {sampled} geprüften Dokumenten",
|
|
150
|
+
"statsColumnValues": "Häufige Werte",
|
|
151
|
+
"statsEmpty": "Keine Dokumente zum Analysieren",
|
|
152
|
+
"statsFailed": "Die Feldstatistik konnte nicht geladen werden"
|
|
141
153
|
},
|
|
142
154
|
"collectionData": {
|
|
143
155
|
"filterPlaceholder": "Zeilen filtern...",
|
|
@@ -319,7 +331,21 @@
|
|
|
319
331
|
"selectAll": "Alle Zeilen dieser Seite auswählen",
|
|
320
332
|
"selectRow": "Zeile auswählen",
|
|
321
333
|
"partialFailure": "{failed} von {total} konnten nicht gelöscht werden: {reason}",
|
|
322
|
-
"cannotSelectSelf": "Du kannst dein eigenes Konto nicht löschen"
|
|
334
|
+
"cannotSelectSelf": "Du kannst dein eigenes Konto nicht löschen",
|
|
335
|
+
"editSelected": "Auswahl bearbeiten",
|
|
336
|
+
"editTitle": "{count} ausgewähltes Dokument bearbeiten | {count} ausgewählte Dokumente bearbeiten",
|
|
337
|
+
"editDescription": "Setzt ein Feld in allen ausgewählten Dokumenten auf denselben Wert.",
|
|
338
|
+
"editField": "Feld",
|
|
339
|
+
"editType": "Werttyp",
|
|
340
|
+
"editValue": "Wert",
|
|
341
|
+
"editTrue": "true",
|
|
342
|
+
"editFalse": "false",
|
|
343
|
+
"editValueRequired": "Wert eingeben",
|
|
344
|
+
"editSummary": "Setzt \"{field}\" in {count} Dokument. | Setzt \"{field}\" in {count} Dokumenten.",
|
|
345
|
+
"confirmEdit": "{count} aktualisieren",
|
|
346
|
+
"editPartialFailure": "{failed} von {total} konnten nicht aktualisiert werden: {reason}",
|
|
347
|
+
"editShortfall": "nur {matched} von {expected} ausgewählten Dokumenten wurden gefunden",
|
|
348
|
+
"editUnaddressable": "diese Dokument-ID kann nicht gesammelt aktualisiert werden"
|
|
323
349
|
},
|
|
324
350
|
"filterBuilder": {
|
|
325
351
|
"matchLabel": "Treffer bei",
|
|
@@ -357,6 +383,118 @@
|
|
|
357
383
|
"isEmpty": "existiert nicht",
|
|
358
384
|
"isNotEmpty": "existiert"
|
|
359
385
|
}
|
|
386
|
+
},
|
|
387
|
+
"import": {
|
|
388
|
+
"trigger": "Dokumente importieren",
|
|
389
|
+
"title": "Dokumente importieren",
|
|
390
|
+
"chooseFile": "JSON- oder CSV-Datei auswählen",
|
|
391
|
+
"hint": "Ein JSON-Array von Objekten oder eine CSV-Datei mit Kopfzeile. Bis zu {maxRows} Zeilen und {maxMb} MB.",
|
|
392
|
+
"chooseButton": "Datei auswählen",
|
|
393
|
+
"readError": "Die Datei konnte nicht gelesen werden",
|
|
394
|
+
"format": "Format",
|
|
395
|
+
"formatJson": "JSON",
|
|
396
|
+
"formatCsv": "CSV",
|
|
397
|
+
"delimiter": "Trennzeichen",
|
|
398
|
+
"delimiterComma": "Komma (,)",
|
|
399
|
+
"delimiterSemicolon": "Semikolon (;)",
|
|
400
|
+
"delimiterTab": "Tabulator",
|
|
401
|
+
"columnTypes": "Spaltentypen",
|
|
402
|
+
"typeString": "Text",
|
|
403
|
+
"typeNumber": "Zahl",
|
|
404
|
+
"typeBoolean": "Boolean",
|
|
405
|
+
"typeDate": "Datum",
|
|
406
|
+
"typeJson": "JSON",
|
|
407
|
+
"emptyAsText": "Leere Textzellen als leere Zeichenkette behalten",
|
|
408
|
+
"stampMetadata": "Erstellt-/Geändert-Informationen hinzufügen",
|
|
409
|
+
"summary": "{ready} von {total} Zeilen bereit zum Import",
|
|
410
|
+
"problems": "1 Zeile hat ein Problem und wird übersprungen | {count} Zeilen haben Probleme und werden übersprungen",
|
|
411
|
+
"truncated": "Es werden nur die ersten {maxRows} Zeilen importiert.",
|
|
412
|
+
"previewTitle": "Vorschau (erste {count} Zeilen)",
|
|
413
|
+
"moreErrors": "…und {count} weitere",
|
|
414
|
+
"errorRow": "Zeile {row}",
|
|
415
|
+
"errorRowColumn": "Zeile {row}, Spalte {column}",
|
|
416
|
+
"back": "Andere Datei wählen",
|
|
417
|
+
"close": "Schließen",
|
|
418
|
+
"importButton": "{count} Zeile importieren | {count} Zeilen importieren",
|
|
419
|
+
"importing": "Importiere… {done} von {total}",
|
|
420
|
+
"stop": "Stopp",
|
|
421
|
+
"result": "{count} Zeile importiert | {count} Zeilen importiert",
|
|
422
|
+
"failedBatch": "Zeilen {from}–{to} konnten nicht importiert werden: {reason}",
|
|
423
|
+
"maybePartial": "Ein Teil dieser Zeilen wurde möglicherweise schon hinzugefügt — ein erneuter Versuch kann Duplikate erzeugen.",
|
|
424
|
+
"retryFailed": "Fehlgeschlagene Zeilen erneut versuchen",
|
|
425
|
+
"aborted": "Import gestoppt. {count} Zeilen wurden nicht gesendet.",
|
|
426
|
+
"error": {
|
|
427
|
+
"file-too-large": "Die Datei ist zu groß",
|
|
428
|
+
"invalid-json": "Die Datei ist kein gültiges JSON",
|
|
429
|
+
"not-array": "Ein JSON-Array von Objekten wurde erwartet",
|
|
430
|
+
"not-object": "Dieser Eintrag ist kein Objekt",
|
|
431
|
+
"invalid-delimiter": "Ungültiges Trennzeichen",
|
|
432
|
+
"invalid-csv": "Die CSV-Datei konnte nicht gelesen werden (nicht geschlossenes Anführungszeichen oder leere Datei)",
|
|
433
|
+
"invalid-header": "Die Kopfzeile enthält einen leeren oder doppelten Spaltennamen",
|
|
434
|
+
"field-count": "Diese Zeile hat mehr Felder als die Kopfzeile",
|
|
435
|
+
"too-many-rows": "Zu viele Zeilen — die überzähligen werden ignoriert",
|
|
436
|
+
"empty-row": "Diese Zeile hat keine Felder",
|
|
437
|
+
"forbidden-key": "Feldnamen dürfen nicht mit $ beginnen oder __proto__ heißen",
|
|
438
|
+
"too-deep": "Diese Zeile ist zu tief verschachtelt",
|
|
439
|
+
"invalid-number": "Keine gültige Zahl",
|
|
440
|
+
"unsafe-integer": "Ganzzahl zu groß, um exakt gespeichert zu werden — als Text importieren",
|
|
441
|
+
"invalid-id": "_id muss eine 24-stellige Hex-Zeichenkette sein",
|
|
442
|
+
"invalid-boolean": "Erwartet true/false, yes/no oder 1/0",
|
|
443
|
+
"invalid-date": "Kein gültiges ISO-Datum",
|
|
444
|
+
"invalid-json-value": "Kein gültiges JSON"
|
|
445
|
+
}
|
|
446
|
+
},
|
|
447
|
+
"aggregation": {
|
|
448
|
+
"errors": {
|
|
449
|
+
"forbidden": "Diese Pipeline verwendet {operator}, was hier nicht erlaubt ist.",
|
|
450
|
+
"retryable": "Die Anfrage wurde auf dem Weg zum Server blockiert. Bitte erneut versuchen."
|
|
451
|
+
},
|
|
452
|
+
"modeVisual": "Stufen",
|
|
453
|
+
"modeJson": "JSON",
|
|
454
|
+
"addStage": "Stufe hinzufügen",
|
|
455
|
+
"newStageType": "Stufentyp",
|
|
456
|
+
"stageTitle": "Stufe {n}",
|
|
457
|
+
"stageValue": "JSON der Stufe {type}",
|
|
458
|
+
"moveUp": "Stufe nach oben",
|
|
459
|
+
"moveDown": "Stufe nach unten",
|
|
460
|
+
"removeStage": "Stufe entfernen",
|
|
461
|
+
"jsonLabel": "Pipeline (JSON-Array)",
|
|
462
|
+
"run": "Ausführen",
|
|
463
|
+
"resultsCount": "{count} Ergebnis | {count} Ergebnisse",
|
|
464
|
+
"pageSize": "Zeilen pro Seite",
|
|
465
|
+
"exportTooltip": "Diese Seite exportieren",
|
|
466
|
+
"exportJson": "Seite als JSON exportieren",
|
|
467
|
+
"exportCsv": "Seite als CSV exportieren",
|
|
468
|
+
"noResults": "Die Pipeline hat keine Ergebnisse geliefert",
|
|
469
|
+
"precisionNote": "Die Ergebnisse sind reines JSON: Datumswerte erscheinen als ISO-Text, ganze Zahlen über 2^53 können gerundet sein.",
|
|
470
|
+
"runFailedTitle": "Die Pipeline konnte nicht ausgeführt werden",
|
|
471
|
+
"fixStages": "Bitte zuerst die unten markierten Stufen korrigieren.",
|
|
472
|
+
"fixStagesFirst": "Bitte zuerst die fehlerhaften Stufen korrigieren, bevor zu JSON gewechselt wird.",
|
|
473
|
+
"cannotShowVisually": "Diese Pipeline verwendet Stufen, für die der Stufen-Editor kein Formular hat. Bitte in der JSON-Ansicht bleiben.",
|
|
474
|
+
"stageTypes": {
|
|
475
|
+
"$match": "$match — Dokumente filtern",
|
|
476
|
+
"$group": "$group — gruppieren und aggregieren",
|
|
477
|
+
"$sort": "$sort — sortieren",
|
|
478
|
+
"$project": "$project — Felder wählen oder berechnen",
|
|
479
|
+
"$limit": "$limit — die ersten N behalten"
|
|
480
|
+
},
|
|
481
|
+
"stageErrors": {
|
|
482
|
+
"invalid-json": "Kein gültiges JSON",
|
|
483
|
+
"not-object": "Diese Stufe braucht ein JSON-Objekt",
|
|
484
|
+
"invalid-limit": "Das Limit muss eine ganze Zahl ab 1 sein",
|
|
485
|
+
"invalid-sort": "Sortierrichtungen müssen 1 oder -1 sein",
|
|
486
|
+
"group-needs-id": "$group braucht eine _id (null gruppiert alles)",
|
|
487
|
+
"forbidden": "{operator} ist nicht erlaubt"
|
|
488
|
+
},
|
|
489
|
+
"pipelineErrors": {
|
|
490
|
+
"too-large": "Die Pipeline ist zu groß",
|
|
491
|
+
"invalid-json": "Die Pipeline ist kein gültiges JSON",
|
|
492
|
+
"not-array": "Die Pipeline muss ein JSON-Array von Stufen sein",
|
|
493
|
+
"too-many-stages": "Eine Pipeline darf höchstens 50 Stufen haben",
|
|
494
|
+
"stage-shape": "Stufe {n} muss ein Objekt mit genau einem Schlüssel sein, der mit $ beginnt, zum Beispiel \"$match\"",
|
|
495
|
+
"forbidden-operator": "{operator} ist nicht erlaubt (Stufe {n})",
|
|
496
|
+
"too-deep": "Stufe {n} ist zu tief verschachtelt"
|
|
497
|
+
}
|
|
360
498
|
}
|
|
361
499
|
}
|
|
362
500
|
}
|
|
@@ -137,7 +137,19 @@
|
|
|
137
137
|
"confirmDeleteIndex": "Are you sure you want to delete the index \"{indexName}\"? This action cannot be undone.",
|
|
138
138
|
"errorCreateIndex": "Error creating index",
|
|
139
139
|
"errorDeleteIndex": "Error deleting index",
|
|
140
|
-
"typeStandard": "standard"
|
|
140
|
+
"typeStandard": "standard",
|
|
141
|
+
"statsTitle": "Field statistics",
|
|
142
|
+
"statsAnalyze": "Analyze fields",
|
|
143
|
+
"statsSampleSize": "Sample size",
|
|
144
|
+
"statsSampled": "{sampled} of {total} documents sampled",
|
|
145
|
+
"statsHint": "Counts how often each field occurs and which values it holds, from a random sample of documents.",
|
|
146
|
+
"statsNote": "Computed from a random sample, not from the whole collection.",
|
|
147
|
+
"statsTruncated": "Only the first {count} fields are shown.",
|
|
148
|
+
"statsColumnPresent": "Present",
|
|
149
|
+
"statsPresentTitle": "In {present} of {sampled} sampled documents",
|
|
150
|
+
"statsColumnValues": "Common values",
|
|
151
|
+
"statsEmpty": "No documents to analyze",
|
|
152
|
+
"statsFailed": "The field statistics could not be loaded"
|
|
141
153
|
},
|
|
142
154
|
"collectionData": {
|
|
143
155
|
"filterPlaceholder": "Filter rows...",
|
|
@@ -319,7 +331,21 @@
|
|
|
319
331
|
"selectAll": "Select all rows on this page",
|
|
320
332
|
"selectRow": "Select row",
|
|
321
333
|
"partialFailure": "{failed} of {total} could not be deleted: {reason}",
|
|
322
|
-
"cannotSelectSelf": "You cannot delete your own account"
|
|
334
|
+
"cannotSelectSelf": "You cannot delete your own account",
|
|
335
|
+
"editSelected": "Edit selected",
|
|
336
|
+
"editTitle": "Edit {count} selected document | Edit {count} selected documents",
|
|
337
|
+
"editDescription": "Set one field to the same value on every selected document.",
|
|
338
|
+
"editField": "Field",
|
|
339
|
+
"editType": "Value type",
|
|
340
|
+
"editValue": "Value",
|
|
341
|
+
"editTrue": "true",
|
|
342
|
+
"editFalse": "false",
|
|
343
|
+
"editValueRequired": "Enter a value",
|
|
344
|
+
"editSummary": "Sets \"{field}\" on {count} document. | Sets \"{field}\" on {count} documents.",
|
|
345
|
+
"confirmEdit": "Update {count}",
|
|
346
|
+
"editPartialFailure": "{failed} of {total} could not be updated: {reason}",
|
|
347
|
+
"editShortfall": "only {matched} of {expected} selected documents were found",
|
|
348
|
+
"editUnaddressable": "this document id cannot be updated in bulk"
|
|
323
349
|
},
|
|
324
350
|
"filterBuilder": {
|
|
325
351
|
"matchLabel": "Match",
|
|
@@ -357,6 +383,118 @@
|
|
|
357
383
|
"isEmpty": "does not exist",
|
|
358
384
|
"isNotEmpty": "exists"
|
|
359
385
|
}
|
|
386
|
+
},
|
|
387
|
+
"import": {
|
|
388
|
+
"trigger": "Import documents",
|
|
389
|
+
"title": "Import documents",
|
|
390
|
+
"chooseFile": "Choose a JSON or CSV file",
|
|
391
|
+
"hint": "A JSON array of objects, or a CSV file with a header row. Up to {maxRows} rows and {maxMb} MB.",
|
|
392
|
+
"chooseButton": "Choose file",
|
|
393
|
+
"readError": "The file could not be read",
|
|
394
|
+
"format": "Format",
|
|
395
|
+
"formatJson": "JSON",
|
|
396
|
+
"formatCsv": "CSV",
|
|
397
|
+
"delimiter": "Delimiter",
|
|
398
|
+
"delimiterComma": "Comma (,)",
|
|
399
|
+
"delimiterSemicolon": "Semicolon (;)",
|
|
400
|
+
"delimiterTab": "Tab",
|
|
401
|
+
"columnTypes": "Column types",
|
|
402
|
+
"typeString": "Text",
|
|
403
|
+
"typeNumber": "Number",
|
|
404
|
+
"typeBoolean": "Boolean",
|
|
405
|
+
"typeDate": "Date",
|
|
406
|
+
"typeJson": "JSON",
|
|
407
|
+
"emptyAsText": "Keep empty text cells as empty strings",
|
|
408
|
+
"stampMetadata": "Add created/updated information",
|
|
409
|
+
"summary": "{ready} of {total} rows ready to import",
|
|
410
|
+
"problems": "1 row has a problem and will be skipped | {count} rows have problems and will be skipped",
|
|
411
|
+
"truncated": "Only the first {maxRows} rows are imported.",
|
|
412
|
+
"previewTitle": "Preview (first {count} rows)",
|
|
413
|
+
"moreErrors": "…and {count} more",
|
|
414
|
+
"errorRow": "Row {row}",
|
|
415
|
+
"errorRowColumn": "Row {row}, column {column}",
|
|
416
|
+
"back": "Choose another file",
|
|
417
|
+
"close": "Close",
|
|
418
|
+
"importButton": "Import {count} row | Import {count} rows",
|
|
419
|
+
"importing": "Importing… {done} of {total}",
|
|
420
|
+
"stop": "Stop",
|
|
421
|
+
"result": "{count} row imported | {count} rows imported",
|
|
422
|
+
"failedBatch": "Rows {from}–{to} could not be imported: {reason}",
|
|
423
|
+
"maybePartial": "Part of these rows may already have been added — retrying could create duplicates.",
|
|
424
|
+
"retryFailed": "Retry failed rows",
|
|
425
|
+
"aborted": "Import stopped. {count} rows were not sent.",
|
|
426
|
+
"error": {
|
|
427
|
+
"file-too-large": "The file is too large",
|
|
428
|
+
"invalid-json": "The file is not valid JSON",
|
|
429
|
+
"not-array": "Expected a JSON array of objects",
|
|
430
|
+
"not-object": "This entry is not an object",
|
|
431
|
+
"invalid-delimiter": "Invalid delimiter",
|
|
432
|
+
"invalid-csv": "The CSV file could not be read (unclosed quote or empty file)",
|
|
433
|
+
"invalid-header": "The header row has an empty or duplicate column name",
|
|
434
|
+
"field-count": "This row has more fields than the header",
|
|
435
|
+
"too-many-rows": "Too many rows — the extra rows are ignored",
|
|
436
|
+
"empty-row": "This row has no fields",
|
|
437
|
+
"forbidden-key": "Field names must not start with $ or be __proto__",
|
|
438
|
+
"too-deep": "This row is nested too deeply",
|
|
439
|
+
"invalid-number": "Not a valid number",
|
|
440
|
+
"unsafe-integer": "Integer too large to store exactly — import it as text",
|
|
441
|
+
"invalid-id": "_id must be a 24-character hex string",
|
|
442
|
+
"invalid-boolean": "Expected true/false, yes/no or 1/0",
|
|
443
|
+
"invalid-date": "Not a valid ISO date",
|
|
444
|
+
"invalid-json-value": "Not valid JSON"
|
|
445
|
+
}
|
|
446
|
+
},
|
|
447
|
+
"aggregation": {
|
|
448
|
+
"errors": {
|
|
449
|
+
"forbidden": "This pipeline uses {operator}, which is not allowed here.",
|
|
450
|
+
"retryable": "The request was blocked on its way to the server. Try again."
|
|
451
|
+
},
|
|
452
|
+
"modeVisual": "Stages",
|
|
453
|
+
"modeJson": "JSON",
|
|
454
|
+
"addStage": "Add stage",
|
|
455
|
+
"newStageType": "Stage type",
|
|
456
|
+
"stageTitle": "Stage {n}",
|
|
457
|
+
"stageValue": "JSON of the {type} stage",
|
|
458
|
+
"moveUp": "Move stage up",
|
|
459
|
+
"moveDown": "Move stage down",
|
|
460
|
+
"removeStage": "Remove stage",
|
|
461
|
+
"jsonLabel": "Pipeline (JSON array)",
|
|
462
|
+
"run": "Run",
|
|
463
|
+
"resultsCount": "{count} result | {count} results",
|
|
464
|
+
"pageSize": "Rows per page",
|
|
465
|
+
"exportTooltip": "Export this page",
|
|
466
|
+
"exportJson": "Export page as JSON",
|
|
467
|
+
"exportCsv": "Export page as CSV",
|
|
468
|
+
"noResults": "The pipeline returned no results",
|
|
469
|
+
"precisionNote": "Results are plain JSON: dates appear as ISO text and whole numbers beyond 2^53 may be rounded.",
|
|
470
|
+
"runFailedTitle": "The pipeline could not be run",
|
|
471
|
+
"fixStages": "Fix the stages marked below first.",
|
|
472
|
+
"fixStagesFirst": "Fix the stages with errors before switching to JSON.",
|
|
473
|
+
"cannotShowVisually": "This pipeline uses stages the stage editor has no form for. Stay in the JSON view.",
|
|
474
|
+
"stageTypes": {
|
|
475
|
+
"$match": "$match — filter documents",
|
|
476
|
+
"$group": "$group — group and aggregate",
|
|
477
|
+
"$sort": "$sort — order",
|
|
478
|
+
"$project": "$project — choose or compute fields",
|
|
479
|
+
"$limit": "$limit — keep the first N"
|
|
480
|
+
},
|
|
481
|
+
"stageErrors": {
|
|
482
|
+
"invalid-json": "Not valid JSON",
|
|
483
|
+
"not-object": "This stage needs a JSON object",
|
|
484
|
+
"invalid-limit": "The limit must be a whole number of 1 or more",
|
|
485
|
+
"invalid-sort": "Sort directions must be 1 or -1",
|
|
486
|
+
"group-needs-id": "$group needs an _id (use null to group everything)",
|
|
487
|
+
"forbidden": "{operator} is not allowed"
|
|
488
|
+
},
|
|
489
|
+
"pipelineErrors": {
|
|
490
|
+
"too-large": "The pipeline is too large",
|
|
491
|
+
"invalid-json": "The pipeline is not valid JSON",
|
|
492
|
+
"not-array": "The pipeline must be a JSON array of stages",
|
|
493
|
+
"too-many-stages": "A pipeline can have at most 50 stages",
|
|
494
|
+
"stage-shape": "Stage {n} must be an object with exactly one key that starts with $, for example \"$match\"",
|
|
495
|
+
"forbidden-operator": "{operator} is not allowed (stage {n})",
|
|
496
|
+
"too-deep": "Stage {n} is nested too deeply"
|
|
497
|
+
}
|
|
360
498
|
}
|
|
361
499
|
}
|
|
362
500
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ForbiddenUse } from './aggregationPipeline.js';
|
|
2
|
+
export declare class ForbiddenPipelineError extends Error {
|
|
3
|
+
findings: ForbiddenUse[];
|
|
4
|
+
constructor(findings: ForbiddenUse[]);
|
|
5
|
+
}
|
|
6
|
+
export interface ServerErrorInfo {
|
|
7
|
+
kind: 'mongo' | 'empty-result' | 'other';
|
|
8
|
+
message: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function parseServerError(msg: string): ServerErrorInfo;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export class ForbiddenPipelineError extends Error {
|
|
2
|
+
constructor(findings) {
|
|
3
|
+
super(`The pipeline uses ${findings[0]?.operator ?? "a forbidden operator"}`);
|
|
4
|
+
this.findings = findings;
|
|
5
|
+
this.name = "ForbiddenPipelineError";
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
const MONGO_COMMAND_FAILED = /^Command failed with error \d+ \([^)]*\): '([\s\S]*?)' on server \S+?\.\s+The full response is[\s\S]*$/;
|
|
9
|
+
const SERVER_ADDRESS = / on server \S+?(?=\.(?:\s|$)|\s|$)/g;
|
|
10
|
+
const BARE_ADDRESS = /\b(?:\d{1,3}\.){3}\d{1,3}(?::\d+)?\b|\b[a-z0-9-]+(?:\.[a-z0-9-]+)+:\d{2,5}\b/gi;
|
|
11
|
+
export function parseServerError(msg) {
|
|
12
|
+
const text = msg.trim();
|
|
13
|
+
const command = MONGO_COMMAND_FAILED.exec(text);
|
|
14
|
+
if (command) return { kind: "mongo", message: command[1].trim() };
|
|
15
|
+
if (/^Index 0 out of bounds for length 0$/.test(text)) return { kind: "empty-result", message: text };
|
|
16
|
+
return { kind: "other", message: text.replace(SERVER_ADDRESS, "").replace(BARE_ADDRESS, "").replace(/\s{2,}/g, " ").trim() };
|
|
17
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export declare const FORBIDDEN_OPERATORS: readonly ["$out", "$merge", "$function", "$accumulator", "$where", "$lookup", "$unionWith", "$graphLookup"];
|
|
2
|
+
export declare const VISUAL_STAGE_TYPES: readonly ["$match", "$group", "$sort", "$project", "$limit"];
|
|
3
|
+
export type AggregationStageType = typeof VISUAL_STAGE_TYPES[number];
|
|
4
|
+
export interface AggregationStage {
|
|
5
|
+
id: string;
|
|
6
|
+
type: AggregationStageType;
|
|
7
|
+
value: unknown;
|
|
8
|
+
}
|
|
9
|
+
export interface RequestStage {
|
|
10
|
+
stage: string;
|
|
11
|
+
value: unknown;
|
|
12
|
+
}
|
|
13
|
+
export interface ForbiddenUse {
|
|
14
|
+
stageIndex: number;
|
|
15
|
+
operator: string;
|
|
16
|
+
path: string;
|
|
17
|
+
}
|
|
18
|
+
export type PipelineErrorCode = 'too-large' | 'invalid-json' | 'not-array' | 'too-many-stages' | 'stage-shape' | 'forbidden-operator' | 'too-deep';
|
|
19
|
+
export interface PipelineError {
|
|
20
|
+
code: PipelineErrorCode;
|
|
21
|
+
stageIndex?: number;
|
|
22
|
+
operator?: string;
|
|
23
|
+
path?: string;
|
|
24
|
+
}
|
|
25
|
+
export type ParsedPipeline = {
|
|
26
|
+
ok: true;
|
|
27
|
+
pipeline: RequestStage[];
|
|
28
|
+
} | {
|
|
29
|
+
ok: false;
|
|
30
|
+
error: PipelineError;
|
|
31
|
+
};
|
|
32
|
+
export type StageIssueCode = 'not-object' | 'invalid-limit' | 'invalid-sort' | 'group-needs-id';
|
|
33
|
+
export interface StageIssue {
|
|
34
|
+
stageIndex: number;
|
|
35
|
+
code: StageIssueCode;
|
|
36
|
+
}
|
|
37
|
+
export declare function findForbidden(pipeline: RequestStage[]): ForbiddenUse[];
|
|
38
|
+
export declare function buildPipeline(stages: AggregationStage[]): RequestStage[];
|
|
39
|
+
export declare function validateStages(stages: AggregationStage[]): StageIssue[];
|
|
40
|
+
export declare function parsePipeline(text: string): ParsedPipeline;
|
|
41
|
+
export declare function pipelineToText(pipeline: RequestStage[]): string;
|
|
42
|
+
export declare function toVisualStages(pipeline: RequestStage[], makeId?: (index: number) => string): AggregationStage[] | null;
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
export const FORBIDDEN_OPERATORS = [
|
|
2
|
+
"$out",
|
|
3
|
+
"$merge",
|
|
4
|
+
"$function",
|
|
5
|
+
"$accumulator",
|
|
6
|
+
"$where",
|
|
7
|
+
"$lookup",
|
|
8
|
+
"$unionWith",
|
|
9
|
+
"$graphLookup"
|
|
10
|
+
];
|
|
11
|
+
export const VISUAL_STAGE_TYPES = ["$match", "$group", "$sort", "$project", "$limit"];
|
|
12
|
+
const MAX_TEXT_LENGTH = 2e5;
|
|
13
|
+
const MAX_STAGES = 50;
|
|
14
|
+
const MAX_DEPTH = 64;
|
|
15
|
+
const MAX_FINDINGS = 20;
|
|
16
|
+
const FORBIDDEN = new Set(FORBIDDEN_OPERATORS);
|
|
17
|
+
function isPlainObject(value) {
|
|
18
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
19
|
+
}
|
|
20
|
+
function scan(value, path, depth, stageIndex, found) {
|
|
21
|
+
if (found.length >= MAX_FINDINGS) return;
|
|
22
|
+
if (depth > MAX_DEPTH) {
|
|
23
|
+
found.push({ stageIndex, operator: "too-deep", path });
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
if (Array.isArray(value)) {
|
|
27
|
+
value.forEach((item, i) => scan(item, `${path}[${i}]`, depth + 1, stageIndex, found));
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
if (!isPlainObject(value)) return;
|
|
31
|
+
for (const [key, inner] of Object.entries(value)) {
|
|
32
|
+
const keyPath = `${path}.${key}`;
|
|
33
|
+
if (FORBIDDEN.has(key)) found.push({ stageIndex, operator: key, path: keyPath });
|
|
34
|
+
scan(inner, keyPath, depth + 1, stageIndex, found);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
export function findForbidden(pipeline) {
|
|
38
|
+
const found = [];
|
|
39
|
+
pipeline.forEach((stage, stageIndex) => {
|
|
40
|
+
if (FORBIDDEN.has(stage.stage)) found.push({ stageIndex, operator: stage.stage, path: stage.stage });
|
|
41
|
+
scan(stage.value, stage.stage, 0, stageIndex, found);
|
|
42
|
+
});
|
|
43
|
+
return found;
|
|
44
|
+
}
|
|
45
|
+
function isEmptyValue(value) {
|
|
46
|
+
return value === void 0 || value === null || value === "" || isPlainObject(value) && Object.keys(value).length === 0;
|
|
47
|
+
}
|
|
48
|
+
function normaliseValue(type, value) {
|
|
49
|
+
if (type === "$limit" && typeof value === "string" && /^\d+$/.test(value.trim())) return Number(value.trim());
|
|
50
|
+
return value;
|
|
51
|
+
}
|
|
52
|
+
export function buildPipeline(stages) {
|
|
53
|
+
const pipeline = [];
|
|
54
|
+
for (const { type, value } of stages) {
|
|
55
|
+
const normalised = normaliseValue(type, value);
|
|
56
|
+
if (!isEmptyValue(normalised)) pipeline.push({ stage: type, value: normalised });
|
|
57
|
+
}
|
|
58
|
+
return pipeline;
|
|
59
|
+
}
|
|
60
|
+
export function validateStages(stages) {
|
|
61
|
+
const issues = [];
|
|
62
|
+
stages.forEach(({ type, value: raw }, stageIndex) => {
|
|
63
|
+
const value = normaliseValue(type, raw);
|
|
64
|
+
if (isEmptyValue(value)) return;
|
|
65
|
+
if (type === "$limit") {
|
|
66
|
+
if (typeof value !== "number" || !Number.isInteger(value) || value < 1) issues.push({ stageIndex, code: "invalid-limit" });
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
if (!isPlainObject(value)) {
|
|
70
|
+
issues.push({ stageIndex, code: "not-object" });
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
if (type === "$group" && !("_id" in value)) issues.push({ stageIndex, code: "group-needs-id" });
|
|
74
|
+
if (type === "$sort" && !Object.values(value).every((direction) => direction === 1 || direction === -1)) issues.push({ stageIndex, code: "invalid-sort" });
|
|
75
|
+
});
|
|
76
|
+
return issues;
|
|
77
|
+
}
|
|
78
|
+
export function parsePipeline(text) {
|
|
79
|
+
if (text.length > MAX_TEXT_LENGTH) return { ok: false, error: { code: "too-large" } };
|
|
80
|
+
let data;
|
|
81
|
+
try {
|
|
82
|
+
data = JSON.parse(text);
|
|
83
|
+
} catch {
|
|
84
|
+
return { ok: false, error: { code: "invalid-json" } };
|
|
85
|
+
}
|
|
86
|
+
if (!Array.isArray(data)) return { ok: false, error: { code: "not-array" } };
|
|
87
|
+
if (data.length > MAX_STAGES) return { ok: false, error: { code: "too-many-stages" } };
|
|
88
|
+
const pipeline = [];
|
|
89
|
+
for (const [stageIndex, item] of data.entries()) {
|
|
90
|
+
const keys = isPlainObject(item) ? Object.keys(item) : [];
|
|
91
|
+
if (isPlainObject(item) && keys.length === 1 && keys[0].startsWith("$")) {
|
|
92
|
+
pipeline.push({ stage: keys[0], value: item[keys[0]] });
|
|
93
|
+
} else if (isPlainObject(item) && keys.length === 2 && keys.includes("stage") && keys.includes("value") && typeof item.stage === "string" && item.stage.startsWith("$")) {
|
|
94
|
+
pipeline.push({ stage: item.stage, value: item.value });
|
|
95
|
+
} else {
|
|
96
|
+
return { ok: false, error: { code: "stage-shape", stageIndex } };
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
const forbidden = findForbidden(pipeline)[0];
|
|
100
|
+
if (forbidden) {
|
|
101
|
+
return {
|
|
102
|
+
ok: false,
|
|
103
|
+
error: { code: forbidden.operator === "too-deep" ? "too-deep" : "forbidden-operator", stageIndex: forbidden.stageIndex, operator: forbidden.operator, path: forbidden.path }
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
return { ok: true, pipeline };
|
|
107
|
+
}
|
|
108
|
+
export function pipelineToText(pipeline) {
|
|
109
|
+
return JSON.stringify(pipeline.map((stage) => ({ [stage.stage]: stage.value })), null, 2);
|
|
110
|
+
}
|
|
111
|
+
export function toVisualStages(pipeline, makeId = (index) => `stage-${index}`) {
|
|
112
|
+
const stages = [];
|
|
113
|
+
for (const [index, { stage, value }] of pipeline.entries()) {
|
|
114
|
+
if (!VISUAL_STAGE_TYPES.includes(stage)) return null;
|
|
115
|
+
stages.push({ id: makeId(index), type: stage, value });
|
|
116
|
+
}
|
|
117
|
+
return stages;
|
|
118
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const MAX_COLUMNS = 100;
|
|
2
|
+
const MAX_ROWS_FOR_COLUMNS = 200;
|
|
3
|
+
const MAX_CELL_LENGTH = 80;
|
|
4
|
+
export function resultColumns(rows) {
|
|
5
|
+
const keys = /* @__PURE__ */ new Set();
|
|
6
|
+
for (const row of rows.slice(0, MAX_ROWS_FOR_COLUMNS)) {
|
|
7
|
+
for (const key of Object.keys(row)) {
|
|
8
|
+
keys.add(key);
|
|
9
|
+
if (keys.size >= MAX_COLUMNS) break;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
return keys.has("_id") ? ["_id", ...[...keys].filter((key) => key !== "_id")] : [...keys];
|
|
13
|
+
}
|
|
14
|
+
export function formatCell(value) {
|
|
15
|
+
const full = value === void 0 ? "" : typeof value === "object" && value !== null ? JSON.stringify(value) : String(value);
|
|
16
|
+
return { text: full.length > MAX_CELL_LENGTH ? `${full.slice(0, MAX_CELL_LENGTH - 1)}\u2026` : full, full };
|
|
17
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export type ValueKind = 'string' | 'number' | 'boolean' | 'date' | 'object' | 'array' | 'null';
|
|
2
|
+
export interface FieldStatistic {
|
|
3
|
+
path: string;
|
|
4
|
+
present: number;
|
|
5
|
+
share: number;
|
|
6
|
+
types: {
|
|
7
|
+
type: ValueKind;
|
|
8
|
+
count: number;
|
|
9
|
+
}[];
|
|
10
|
+
topValues?: {
|
|
11
|
+
value: string;
|
|
12
|
+
count: number;
|
|
13
|
+
}[];
|
|
14
|
+
}
|
|
15
|
+
export interface SampleAnalysis {
|
|
16
|
+
sampled: number;
|
|
17
|
+
fields: FieldStatistic[];
|
|
18
|
+
truncated: boolean;
|
|
19
|
+
}
|
|
20
|
+
export interface AnalyzeOptions {
|
|
21
|
+
maxDepth?: number;
|
|
22
|
+
maxFields?: number;
|
|
23
|
+
topValues?: number;
|
|
24
|
+
maxDistinctForTop?: number;
|
|
25
|
+
}
|
|
26
|
+
export declare function kindOf(value: unknown): ValueKind;
|
|
27
|
+
export declare function analyzeSamples(rows: unknown[], options?: AnalyzeOptions): SampleAnalysis;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { isIsoDateTimeString } from "./isoDate.js";
|
|
2
|
+
const DEFAULTS = { maxDepth: 3, maxFields: 200, topValues: 5, maxDistinctForTop: 20 };
|
|
3
|
+
const MAX_VALUE_LENGTH = 40;
|
|
4
|
+
function isPlainObject(value) {
|
|
5
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6
|
+
}
|
|
7
|
+
export function kindOf(value) {
|
|
8
|
+
if (value === null || value === void 0) return "null";
|
|
9
|
+
if (Array.isArray(value)) return "array";
|
|
10
|
+
if (typeof value === "string") return isIsoDateTimeString(value) ? "date" : "string";
|
|
11
|
+
if (typeof value === "number" || typeof value === "bigint") return "number";
|
|
12
|
+
if (typeof value === "boolean") return "boolean";
|
|
13
|
+
return "object";
|
|
14
|
+
}
|
|
15
|
+
function shorten(text) {
|
|
16
|
+
return text.length > MAX_VALUE_LENGTH ? `${text.slice(0, MAX_VALUE_LENGTH - 1)}\u2026` : text;
|
|
17
|
+
}
|
|
18
|
+
function comparePaths(a, b) {
|
|
19
|
+
if (a === "_id") return b === "_id" ? 0 : -1;
|
|
20
|
+
if (b === "_id") return 1;
|
|
21
|
+
const left = a.split(".");
|
|
22
|
+
const right = b.split(".");
|
|
23
|
+
for (let i = 0; i < Math.min(left.length, right.length); i++) {
|
|
24
|
+
const order = left[i].localeCompare(right[i]);
|
|
25
|
+
if (order !== 0) return order;
|
|
26
|
+
}
|
|
27
|
+
return left.length - right.length;
|
|
28
|
+
}
|
|
29
|
+
export function analyzeSamples(rows, options = {}) {
|
|
30
|
+
const { maxDepth, maxFields, topValues, maxDistinctForTop } = { ...DEFAULTS, ...options };
|
|
31
|
+
const stats = /* @__PURE__ */ new Map();
|
|
32
|
+
let sampled = 0;
|
|
33
|
+
function visit(value, path, depth, seen) {
|
|
34
|
+
const kind = kindOf(value);
|
|
35
|
+
let entry = seen.get(path);
|
|
36
|
+
if (!entry) {
|
|
37
|
+
entry = /* @__PURE__ */ new Map();
|
|
38
|
+
seen.set(path, entry);
|
|
39
|
+
}
|
|
40
|
+
const values = entry.get(kind) ?? /* @__PURE__ */ new Set();
|
|
41
|
+
entry.set(kind, values);
|
|
42
|
+
if (kind === "string" || kind === "number" || kind === "boolean" || kind === "date") values.add(String(value));
|
|
43
|
+
if (depth >= maxDepth) return;
|
|
44
|
+
if (isPlainObject(value)) {
|
|
45
|
+
for (const [key, inner] of Object.entries(value)) visit(inner, `${path}.${key}`, depth + 1, seen);
|
|
46
|
+
} else if (Array.isArray(value)) {
|
|
47
|
+
for (const item of value) if (isPlainObject(item)) {
|
|
48
|
+
for (const [key, inner] of Object.entries(item)) visit(inner, `${path}[].${key}`, depth + 1, seen);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
for (const row of rows) {
|
|
53
|
+
if (!isPlainObject(row)) continue;
|
|
54
|
+
sampled++;
|
|
55
|
+
const seen = /* @__PURE__ */ new Map();
|
|
56
|
+
for (const [key, value] of Object.entries(row)) visit(value, key, 1, seen);
|
|
57
|
+
for (const [path, kinds] of seen) {
|
|
58
|
+
let acc = stats.get(path);
|
|
59
|
+
if (!acc) {
|
|
60
|
+
acc = { present: 0, types: /* @__PURE__ */ new Map(), values: /* @__PURE__ */ new Map(), highCardinality: false };
|
|
61
|
+
stats.set(path, acc);
|
|
62
|
+
}
|
|
63
|
+
acc.present++;
|
|
64
|
+
for (const [kind, values] of kinds) {
|
|
65
|
+
acc.types.set(kind, (acc.types.get(kind) ?? 0) + 1);
|
|
66
|
+
for (const text of values) {
|
|
67
|
+
if (acc.highCardinality) break;
|
|
68
|
+
acc.values.set(text, (acc.values.get(text) ?? 0) + 1);
|
|
69
|
+
if (acc.values.size > maxDistinctForTop) {
|
|
70
|
+
acc.highCardinality = true;
|
|
71
|
+
acc.values.clear();
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
const paths = [...stats.keys()].sort(comparePaths);
|
|
78
|
+
const fields = paths.slice(0, maxFields).map((path) => {
|
|
79
|
+
const acc = stats.get(path);
|
|
80
|
+
const field = {
|
|
81
|
+
path,
|
|
82
|
+
present: acc.present,
|
|
83
|
+
share: sampled === 0 ? 0 : acc.present / sampled,
|
|
84
|
+
types: [...acc.types].map(([type, count]) => ({ type, count })).sort((a, b) => b.count - a.count || a.type.localeCompare(b.type))
|
|
85
|
+
};
|
|
86
|
+
if (!acc.highCardinality && acc.values.size > 0) {
|
|
87
|
+
field.topValues = [...acc.values].map(([value, count]) => ({ value: shorten(value), count })).sort((a, b) => b.count - a.count || a.value.localeCompare(b.value)).slice(0, topValues);
|
|
88
|
+
}
|
|
89
|
+
return field;
|
|
90
|
+
});
|
|
91
|
+
return { sampled, fields, truncated: paths.length > maxFields };
|
|
92
|
+
}
|