@sfxcode/nuxt-ui-mongocamp 1.3.2 → 1.3.4
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.d.mts +12 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +18 -5
- package/dist/runtime/components/MongocampAggregationBuilder.vue +2 -2
- package/dist/runtime/components/MongocampBulkDelete.d.vue.ts +5 -3
- package/dist/runtime/components/MongocampBulkDelete.vue.d.ts +5 -3
- package/dist/runtime/components/MongocampCollectionData.d.vue.ts +4 -1
- package/dist/runtime/components/MongocampCollectionData.vue +69 -5
- package/dist/runtime/components/MongocampCollectionData.vue.d.ts +4 -1
- package/dist/runtime/components/MongocampCollectionInfos.vue +104 -8
- package/dist/runtime/components/MongocampCollections.d.vue.ts +8 -1
- package/dist/runtime/components/MongocampCollections.vue +84 -72
- package/dist/runtime/components/MongocampCollections.vue.d.ts +8 -1
- package/dist/runtime/components/MongocampConfirmByName.d.vue.ts +23 -0
- package/dist/runtime/components/MongocampConfirmByName.vue +92 -0
- package/dist/runtime/components/MongocampConfirmByName.vue.d.ts +23 -0
- package/dist/runtime/components/MongocampDashboard.d.vue.ts +5 -3
- package/dist/runtime/components/MongocampDashboard.vue.d.ts +5 -3
- package/dist/runtime/components/MongocampEmptyState.d.vue.ts +5 -3
- package/dist/runtime/components/MongocampEmptyState.vue.d.ts +5 -3
- package/dist/runtime/components/MongocampErrorAlert.vue +28 -5
- package/dist/runtime/components/MongocampGrantList.d.vue.ts +7 -0
- package/dist/runtime/components/MongocampGrantList.vue +38 -0
- package/dist/runtime/components/MongocampGrantList.vue.d.ts +7 -0
- package/dist/runtime/components/MongocampRoles.vue +45 -0
- package/dist/runtime/components/MongocampSettings.d.vue.ts +3 -0
- package/dist/runtime/components/MongocampSettings.vue +179 -0
- package/dist/runtime/components/MongocampSettings.vue.d.ts +3 -0
- package/dist/runtime/components/MongocampUsers.vue +183 -3
- package/dist/runtime/composables/useMongocampAdmin.d.ts +10 -4
- package/dist/runtime/composables/useMongocampAdmin.js +37 -1
- package/dist/runtime/composables/useMongocampAggregation.js +9 -30
- package/dist/runtime/composables/useMongocampBucket.js +1 -1
- package/dist/runtime/composables/useMongocampIndex.d.ts +1 -0
- package/dist/runtime/composables/useMongocampIndex.js +8 -1
- package/dist/runtime/composables/useMongocampQuery.d.ts +2 -2
- package/dist/runtime/composables/useMongocampRoles.d.ts +1 -0
- package/dist/runtime/composables/useMongocampRoles.js +3 -2
- package/dist/runtime/composables/useMongocampSession.d.ts +8 -0
- package/dist/runtime/composables/useMongocampSession.js +45 -0
- package/dist/runtime/composables/useMongocampSystem.d.ts +15 -3
- package/dist/runtime/composables/useMongocampSystem.js +19 -2
- package/dist/runtime/locales/de.json +61 -2
- package/dist/runtime/locales/en.json +61 -2
- package/dist/runtime/plugin.js +19 -0
- package/dist/runtime/utils/aggregationErrors.d.ts +1 -1
- package/dist/runtime/utils/aggregationErrors.js +0 -1
- package/dist/runtime/utils/collectionProtection.d.ts +3 -0
- package/dist/runtime/utils/collectionProtection.js +7 -0
- package/dist/runtime/utils/configRows.d.ts +11 -0
- package/dist/runtime/utils/configRows.js +53 -0
- package/dist/runtime/utils/failureKind.d.ts +3 -0
- package/dist/runtime/utils/failureKind.js +11 -0
- package/dist/runtime/utils/filterBuilder.d.ts +1 -1
- package/dist/runtime/utils/filterBuilder.js +8 -0
- package/dist/runtime/utils/jwtExpiry.d.ts +3 -0
- package/dist/runtime/utils/jwtExpiry.js +31 -0
- package/dist/runtime/utils/serverProbe.d.ts +10 -0
- package/dist/runtime/utils/serverProbe.js +25 -0
- package/dist/runtime/utils/sessionGuard.d.ts +10 -0
- package/dist/runtime/utils/sessionGuard.js +10 -0
- package/dist/runtime/utils/throttled.d.ts +6 -0
- package/dist/runtime/utils/throttled.js +16 -0
- package/package.json +10 -10
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"nuxtUiMongocamp": {
|
|
3
|
+
"confirmByName": {
|
|
4
|
+
"prompt": "Zur Bestätigung \"{name}\" eingeben"
|
|
5
|
+
},
|
|
3
6
|
"common": {
|
|
4
7
|
"cancel": "Abbrechen",
|
|
5
8
|
"delete": "Löschen",
|
|
@@ -27,6 +30,15 @@
|
|
|
27
30
|
"addUser": "Benutzer hinzufügen",
|
|
28
31
|
"editUserTitle": "Benutzer bearbeiten: {userId}",
|
|
29
32
|
"deleteUserTitle": "Benutzer löschen",
|
|
33
|
+
"detailsTooltip": "Details",
|
|
34
|
+
"detailsTitle": "Benutzer: {userId}",
|
|
35
|
+
"detailsRoles": "Rollen",
|
|
36
|
+
"detailsNoRoles": "Keine Rollen zugewiesen",
|
|
37
|
+
"detailsGrants": "Wirksame Berechtigungen",
|
|
38
|
+
"regenerateKeyTooltip": "API-Schlüssel neu erzeugen",
|
|
39
|
+
"regenerateKeyTitle": "API-Schlüssel neu erzeugen: {userId}",
|
|
40
|
+
"confirmRegenerateKey": "Möchten Sie den API-Schlüssel von {userId} wirklich neu erzeugen? Der bisherige Schlüssel ist sofort ungültig, und alles, was ihn noch verwendet, wird abgewiesen.",
|
|
41
|
+
"newApiKeyLabel": "Neuer API-Schlüssel",
|
|
30
42
|
"confirmDelete": "Möchten Sie den Benutzer {userId} wirklich löschen? Diese Aktion kann nicht rückgängig gemacht werden.",
|
|
31
43
|
"email": "E-Mail",
|
|
32
44
|
"password": "Passwort",
|
|
@@ -52,6 +64,9 @@
|
|
|
52
64
|
"addRole": "Rolle hinzufügen",
|
|
53
65
|
"editRoleTitle": "Rolle bearbeiten: {roleName}",
|
|
54
66
|
"deleteRoleTitle": "Rolle löschen",
|
|
67
|
+
"detailsTooltip": "Details",
|
|
68
|
+
"detailsTitle": "Rolle: {roleName}",
|
|
69
|
+
"detailsGrants": "Berechtigungen",
|
|
55
70
|
"confirmDelete": "Möchten Sie die Rolle {roleName} wirklich löschen? Diese Aktion kann nicht rückgängig gemacht werden.",
|
|
56
71
|
"roleName": "Rollenname",
|
|
57
72
|
"adminRole": "Admin-Rolle",
|
|
@@ -105,7 +120,18 @@
|
|
|
105
120
|
"clearBucketTitle": "Bucket leeren",
|
|
106
121
|
"confirmClearBucket": "Möchten Sie wirklich alle Dateien im Bucket \"{bucketName}\" löschen? Der Bucket selbst bleibt erhalten, aber alle darin enthaltenen Dateien werden dauerhaft entfernt. Diese Aktion kann nicht rückgängig gemacht werden.",
|
|
107
122
|
"deleteBucketTitle": "Bucket löschen",
|
|
108
|
-
"confirmDeleteBucket": "Möchten Sie den Bucket \"{bucketName}\" wirklich löschen? Dadurch werden sowohl die Collection \"{bucketName}.files\" als auch \"{bucketName}.chunks\" dauerhaft entfernt. Diese Aktion kann nicht rückgängig gemacht werden."
|
|
123
|
+
"confirmDeleteBucket": "Möchten Sie den Bucket \"{bucketName}\" wirklich löschen? Dadurch werden sowohl die Collection \"{bucketName}.files\" als auch \"{bucketName}.chunks\" dauerhaft entfernt. Diese Aktion kann nicht rückgängig gemacht werden.",
|
|
124
|
+
"clearTooltip": "Collection leeren",
|
|
125
|
+
"dropTooltip": "Collection löschen",
|
|
126
|
+
"clearTitle": "Collection leeren",
|
|
127
|
+
"dropTitle": "Collection löschen",
|
|
128
|
+
"confirmClear": "Dadurch werden alle Dokumente in \"{name}\" dauerhaft gelöscht. Die Collection selbst bleibt erhalten. Diese Aktion kann nicht rückgängig gemacht werden.",
|
|
129
|
+
"confirmDrop": "Dadurch wird die Collection \"{name}\" samt allen Dokumenten und Indizes dauerhaft gelöscht. Diese Aktion kann nicht rückgängig gemacht werden.",
|
|
130
|
+
"clearedTitle": "Collection geleert",
|
|
131
|
+
"clearedDescription": "Alle Dokumente in \"{name}\" wurden gelöscht.",
|
|
132
|
+
"droppedTitle": "Collection gelöscht",
|
|
133
|
+
"droppedDescription": "Die Collection \"{name}\" wurde gelöscht.",
|
|
134
|
+
"bucketActionFailed": "Die Aktion für den Bucket \"{bucketName}\" ist fehlgeschlagen."
|
|
109
135
|
},
|
|
110
136
|
"collectionInfos": {
|
|
111
137
|
"documents": "Dokumente",
|
|
@@ -119,6 +145,11 @@
|
|
|
119
145
|
"copyAsTs": "Als TS-Interface kopieren",
|
|
120
146
|
"copiedTitle": "In die Zwischenablage kopiert",
|
|
121
147
|
"copiedDescription": "TypeScript-Interface kopiert.",
|
|
148
|
+
"jsonSchema": "JSON-Schema",
|
|
149
|
+
"jsonSchemaTitle": "JSON-Schema von {name}",
|
|
150
|
+
"jsonSchemaFailedTitle": "Das JSON-Schema konnte nicht geladen werden",
|
|
151
|
+
"downloadSchema": "Herunterladen",
|
|
152
|
+
"schemaCopiedDescription": "JSON-Schema kopiert.",
|
|
122
153
|
"fieldsCount": "{count} Felder",
|
|
123
154
|
"columnField": "Feld",
|
|
124
155
|
"columnType": "Typ",
|
|
@@ -157,6 +188,13 @@
|
|
|
157
188
|
"uploadFileTooltip": "Datei hochladen",
|
|
158
189
|
"insertDocumentTooltip": "Dokument einfügen",
|
|
159
190
|
"reloadTooltip": "Neu laden",
|
|
191
|
+
"indexFieldTooltip": "{field} indizieren",
|
|
192
|
+
"indexAscending": "Aufsteigenden Index anlegen",
|
|
193
|
+
"indexDescending": "Absteigenden Index anlegen",
|
|
194
|
+
"indexCreatedTitle": "Index angelegt",
|
|
195
|
+
"indexCreatedDescription": "Der Index {name} auf {collection} wurde angelegt.",
|
|
196
|
+
"viewIndexes": "Indizes anzeigen",
|
|
197
|
+
"indexFailedTitle": "{field} konnte nicht indiziert werden",
|
|
160
198
|
"detailsTitle": "Details",
|
|
161
199
|
"insertDocumentTitle": "Dokument einfügen",
|
|
162
200
|
"editDocumentTitle": "Dokument bearbeiten",
|
|
@@ -256,6 +294,25 @@
|
|
|
256
294
|
"changeFailedTitle": "Änderung fehlgeschlagen",
|
|
257
295
|
"changeFailedFallback": "Ihr Passwort konnte nicht geändert werden."
|
|
258
296
|
},
|
|
297
|
+
"settings": {
|
|
298
|
+
"heading": "Servereinstellungen",
|
|
299
|
+
"loadFailedTitle": "Die Servereinstellungen konnten nicht geladen werden",
|
|
300
|
+
"adminOnly": "Nur Administratoren können die Servereinstellungen einsehen.",
|
|
301
|
+
"pluginsHeading": "Plugins",
|
|
302
|
+
"routesPlugins": "Routen-Plugins",
|
|
303
|
+
"filePlugins": "Datei-Plugins",
|
|
304
|
+
"ignoredPlugins": "Ignorierte Plugins",
|
|
305
|
+
"noPlugins": "Keine",
|
|
306
|
+
"searchPlaceholder": "Einstellungen durchsuchen...",
|
|
307
|
+
"maskedNote": "Geheime Werte (Passwörter, Schlüssel, Zugangsdaten, Hosts) werden nie angezeigt.",
|
|
308
|
+
"maskedHint": "Verborgen: dieser Wert ist geheim",
|
|
309
|
+
"columnKey": "Einstellung",
|
|
310
|
+
"columnValue": "Wert",
|
|
311
|
+
"columnType": "Typ",
|
|
312
|
+
"columnRestart": "Neustart",
|
|
313
|
+
"restartNeeded": "Neustart nötig",
|
|
314
|
+
"empty": "Keine Einstellungen gefunden"
|
|
315
|
+
},
|
|
259
316
|
"databases": {
|
|
260
317
|
"heading": "Datenbanken",
|
|
261
318
|
"columnDatabase": "Datenbank",
|
|
@@ -298,6 +355,7 @@
|
|
|
298
355
|
"forbidden": "Dafür fehlt dir die Berechtigung.",
|
|
299
356
|
"generic": "Etwas ist schiefgelaufen.",
|
|
300
357
|
"loginAgain": "Erneut anmelden",
|
|
358
|
+
"requestRefused": "Der Server ist erreichbar und Ihre Sitzung ist gültig, hat diese Anfrage aber abgelehnt. Versuchen Sie es erneut oder ändern Sie Ihre Anfrage.",
|
|
301
359
|
"filterRejectedTitle": "Der Filter konnte nicht angewendet werden",
|
|
302
360
|
"filterRejected": "Der Server hat die aktuelle Suche oder die Filter abgelehnt, obwohl die Collection selbst lädt. Setze sie zurück oder entferne die letzte Bedingung und versuche es erneut.",
|
|
303
361
|
"clearFilters": "Filter zurücksetzen"
|
|
@@ -447,7 +505,8 @@
|
|
|
447
505
|
"aggregation": {
|
|
448
506
|
"errors": {
|
|
449
507
|
"forbidden": "Diese Pipeline verwendet {operator}, was hier nicht erlaubt ist.",
|
|
450
|
-
"retryable": "Die Anfrage wurde auf dem Weg zum Server blockiert. Bitte erneut versuchen."
|
|
508
|
+
"retryable": "Die Anfrage wurde auf dem Weg zum Server blockiert. Bitte erneut versuchen.",
|
|
509
|
+
"unavailable": "Der Server hat diese Anfrage nicht beantwortet. Versuche es erneut."
|
|
451
510
|
},
|
|
452
511
|
"modeVisual": "Stufen",
|
|
453
512
|
"modeJson": "JSON",
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"nuxtUiMongocamp": {
|
|
3
|
+
"confirmByName": {
|
|
4
|
+
"prompt": "Type \"{name}\" to confirm"
|
|
5
|
+
},
|
|
3
6
|
"common": {
|
|
4
7
|
"cancel": "Cancel",
|
|
5
8
|
"delete": "Delete",
|
|
@@ -27,6 +30,15 @@
|
|
|
27
30
|
"addUser": "Add User",
|
|
28
31
|
"editUserTitle": "Edit User: {userId}",
|
|
29
32
|
"deleteUserTitle": "Delete User",
|
|
33
|
+
"detailsTooltip": "Details",
|
|
34
|
+
"detailsTitle": "User: {userId}",
|
|
35
|
+
"detailsRoles": "Roles",
|
|
36
|
+
"detailsNoRoles": "No roles assigned",
|
|
37
|
+
"detailsGrants": "Effective grants",
|
|
38
|
+
"regenerateKeyTooltip": "Regenerate API key",
|
|
39
|
+
"regenerateKeyTitle": "Regenerate API Key: {userId}",
|
|
40
|
+
"confirmRegenerateKey": "Are you sure you want to regenerate the API key of {userId}? Their current key stops working immediately, and anything still using it will be rejected.",
|
|
41
|
+
"newApiKeyLabel": "New API key",
|
|
30
42
|
"confirmDelete": "Are you sure you want to delete user {userId}? This action cannot be undone.",
|
|
31
43
|
"email": "Email",
|
|
32
44
|
"password": "Password",
|
|
@@ -52,6 +64,9 @@
|
|
|
52
64
|
"addRole": "Add Role",
|
|
53
65
|
"editRoleTitle": "Edit Role: {roleName}",
|
|
54
66
|
"deleteRoleTitle": "Delete Role",
|
|
67
|
+
"detailsTooltip": "Details",
|
|
68
|
+
"detailsTitle": "Role: {roleName}",
|
|
69
|
+
"detailsGrants": "Grants",
|
|
55
70
|
"confirmDelete": "Are you sure you want to delete role {roleName}? This action cannot be undone.",
|
|
56
71
|
"roleName": "Role Name",
|
|
57
72
|
"adminRole": "Admin Role",
|
|
@@ -105,7 +120,18 @@
|
|
|
105
120
|
"clearBucketTitle": "Clear Bucket",
|
|
106
121
|
"confirmClearBucket": "Are you sure you want to delete every file in the \"{bucketName}\" bucket? The bucket itself is kept, but all files in it are permanently removed. This action cannot be undone.",
|
|
107
122
|
"deleteBucketTitle": "Delete Bucket",
|
|
108
|
-
"confirmDeleteBucket": "Are you sure you want to delete the \"{bucketName}\" bucket? This permanently removes both the \"{bucketName}.files\" and \"{bucketName}.chunks\" collections. This action cannot be undone."
|
|
123
|
+
"confirmDeleteBucket": "Are you sure you want to delete the \"{bucketName}\" bucket? This permanently removes both the \"{bucketName}.files\" and \"{bucketName}.chunks\" collections. This action cannot be undone.",
|
|
124
|
+
"clearTooltip": "Clear collection",
|
|
125
|
+
"dropTooltip": "Drop collection",
|
|
126
|
+
"clearTitle": "Clear Collection",
|
|
127
|
+
"dropTitle": "Drop Collection",
|
|
128
|
+
"confirmClear": "This permanently deletes every document in \"{name}\". The collection itself is kept. This action cannot be undone.",
|
|
129
|
+
"confirmDrop": "This permanently deletes the collection \"{name}\" together with all its documents and indexes. This action cannot be undone.",
|
|
130
|
+
"clearedTitle": "Collection cleared",
|
|
131
|
+
"clearedDescription": "Every document in \"{name}\" was deleted.",
|
|
132
|
+
"droppedTitle": "Collection dropped",
|
|
133
|
+
"droppedDescription": "The collection \"{name}\" was deleted.",
|
|
134
|
+
"bucketActionFailed": "The action on the bucket \"{bucketName}\" failed."
|
|
109
135
|
},
|
|
110
136
|
"collectionInfos": {
|
|
111
137
|
"documents": "Documents",
|
|
@@ -119,6 +145,11 @@
|
|
|
119
145
|
"copyAsTs": "Copy as TS Interface",
|
|
120
146
|
"copiedTitle": "Copied to clipboard",
|
|
121
147
|
"copiedDescription": "TypeScript interface copied.",
|
|
148
|
+
"jsonSchema": "JSON schema",
|
|
149
|
+
"jsonSchemaTitle": "JSON schema of {name}",
|
|
150
|
+
"jsonSchemaFailedTitle": "The JSON schema could not be loaded",
|
|
151
|
+
"downloadSchema": "Download",
|
|
152
|
+
"schemaCopiedDescription": "JSON schema copied.",
|
|
122
153
|
"fieldsCount": "{count} fields",
|
|
123
154
|
"columnField": "Field",
|
|
124
155
|
"columnType": "Type",
|
|
@@ -157,6 +188,13 @@
|
|
|
157
188
|
"uploadFileTooltip": "Upload file",
|
|
158
189
|
"insertDocumentTooltip": "Insert document",
|
|
159
190
|
"reloadTooltip": "Reload",
|
|
191
|
+
"indexFieldTooltip": "Index {field}",
|
|
192
|
+
"indexAscending": "Create ascending index",
|
|
193
|
+
"indexDescending": "Create descending index",
|
|
194
|
+
"indexCreatedTitle": "Index created",
|
|
195
|
+
"indexCreatedDescription": "Index {name} on {collection} was created.",
|
|
196
|
+
"viewIndexes": "View indexes",
|
|
197
|
+
"indexFailedTitle": "Could not index {field}",
|
|
160
198
|
"detailsTitle": "Details",
|
|
161
199
|
"insertDocumentTitle": "Insert Document",
|
|
162
200
|
"editDocumentTitle": "Edit Document",
|
|
@@ -256,6 +294,25 @@
|
|
|
256
294
|
"changeFailedTitle": "Change failed",
|
|
257
295
|
"changeFailedFallback": "Could not change your password."
|
|
258
296
|
},
|
|
297
|
+
"settings": {
|
|
298
|
+
"heading": "Server settings",
|
|
299
|
+
"loadFailedTitle": "Failed to load the server settings",
|
|
300
|
+
"adminOnly": "Only administrators can view the server settings.",
|
|
301
|
+
"pluginsHeading": "Plugins",
|
|
302
|
+
"routesPlugins": "Route plugins",
|
|
303
|
+
"filePlugins": "File plugins",
|
|
304
|
+
"ignoredPlugins": "Ignored plugins",
|
|
305
|
+
"noPlugins": "None",
|
|
306
|
+
"searchPlaceholder": "Search settings...",
|
|
307
|
+
"maskedNote": "Secret values (passwords, keys, credentials, hosts) are never shown.",
|
|
308
|
+
"maskedHint": "Hidden: this value is a secret",
|
|
309
|
+
"columnKey": "Setting",
|
|
310
|
+
"columnValue": "Value",
|
|
311
|
+
"columnType": "Type",
|
|
312
|
+
"columnRestart": "Restart",
|
|
313
|
+
"restartNeeded": "needs restart",
|
|
314
|
+
"empty": "No settings found"
|
|
315
|
+
},
|
|
259
316
|
"databases": {
|
|
260
317
|
"heading": "Databases",
|
|
261
318
|
"columnDatabase": "Database",
|
|
@@ -298,6 +355,7 @@
|
|
|
298
355
|
"forbidden": "You do not have permission to do this.",
|
|
299
356
|
"generic": "Something went wrong.",
|
|
300
357
|
"loginAgain": "Log in again",
|
|
358
|
+
"requestRefused": "The server is reachable and your session is valid, but it refused this request. Try again, or change what you asked for.",
|
|
301
359
|
"filterRejectedTitle": "The filter could not be applied",
|
|
302
360
|
"filterRejected": "The server rejected the current search or filters, although the collection itself loads. Clear them, or remove the last condition, and try again.",
|
|
303
361
|
"clearFilters": "Clear filters"
|
|
@@ -447,7 +505,8 @@
|
|
|
447
505
|
"aggregation": {
|
|
448
506
|
"errors": {
|
|
449
507
|
"forbidden": "This pipeline uses {operator}, which is not allowed here.",
|
|
450
|
-
"retryable": "The request was blocked on its way to the server. Try again."
|
|
508
|
+
"retryable": "The request was blocked on its way to the server. Try again.",
|
|
509
|
+
"unavailable": "The server did not answer this request. Try again."
|
|
451
510
|
},
|
|
452
511
|
"modeVisual": "Stages",
|
|
453
512
|
"modeJson": "JSON",
|
package/dist/runtime/plugin.js
CHANGED
|
@@ -1,11 +1,30 @@
|
|
|
1
1
|
import { defineNuxtPlugin, addRouteMiddleware, navigateTo, useAsyncData, useRuntimeConfig } from "#app";
|
|
2
2
|
import { useMongocampAuth, useMongocampClientApi } from "#imports";
|
|
3
3
|
import { useMongocampRoles } from "./composables/useMongocampRoles.js";
|
|
4
|
+
import { useMongocampSession } from "./composables/useMongocampSession.js";
|
|
5
|
+
import { runSessionGuard } from "./utils/sessionGuard.js";
|
|
4
6
|
export default defineNuxtPlugin(async (_nuxtApp) => {
|
|
5
7
|
const { informationApi } = useMongocampClientApi();
|
|
6
8
|
const config = useRuntimeConfig();
|
|
7
9
|
const useGlobalAuthMiddleware = config.public.nuxtUiMongocampOptions.useGlobalAuthMiddleware ?? false;
|
|
10
|
+
const useServerProxy = config.public.nuxtUiMongocampOptions.useServerProxy ?? false;
|
|
11
|
+
const sessionGuard = config.public.nuxtUiMongocampOptions.sessionGuard ?? false;
|
|
8
12
|
const { data: version } = await useAsyncData("version", () => informationApi.version());
|
|
13
|
+
if (sessionGuard && !useServerProxy) {
|
|
14
|
+
addRouteMiddleware("session-guard", async (to) => {
|
|
15
|
+
const { checkExpiry, invalidateSession } = useMongocampSession();
|
|
16
|
+
const { loginPath } = useMongocampRoles();
|
|
17
|
+
const outcome = await runSessionGuard({
|
|
18
|
+
path: to.path,
|
|
19
|
+
loginPath,
|
|
20
|
+
checkExpiry,
|
|
21
|
+
invalidate: invalidateSession,
|
|
22
|
+
// a fresh call: it must read the session as it is after the invalidation
|
|
23
|
+
isAllowed: (path) => useMongocampRoles().isAllowedPathForRoute(path)
|
|
24
|
+
});
|
|
25
|
+
if (outcome === "redirect") return navigateTo(loginPath);
|
|
26
|
+
}, { global: true });
|
|
27
|
+
}
|
|
9
28
|
if (useGlobalAuthMiddleware) {
|
|
10
29
|
addRouteMiddleware("global-auth", async (to) => {
|
|
11
30
|
const { logout } = useMongocampAuth();
|
|
@@ -4,7 +4,7 @@ export declare class ForbiddenPipelineError extends Error {
|
|
|
4
4
|
constructor(findings: ForbiddenUse[]);
|
|
5
5
|
}
|
|
6
6
|
export interface ServerErrorInfo {
|
|
7
|
-
kind: 'mongo' | '
|
|
7
|
+
kind: 'mongo' | 'other';
|
|
8
8
|
message: string;
|
|
9
9
|
}
|
|
10
10
|
export declare function parseServerError(msg: string): ServerErrorInfo;
|
|
@@ -12,6 +12,5 @@ export function parseServerError(msg) {
|
|
|
12
12
|
const text = msg.trim();
|
|
13
13
|
const command = MONGO_COMMAND_FAILED.exec(text);
|
|
14
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
15
|
return { kind: "other", message: text.replace(SERVER_ADDRESS, "").replace(BARE_ADDRESS, "").replace(/\s{2,}/g, " ").trim() };
|
|
17
16
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export const BUCKET_COLLECTION_SUFFIX = /\.(?:files|chunks)$/;
|
|
2
|
+
export function isBucketMemberCollection(collectionName) {
|
|
3
|
+
return BUCKET_COLLECTION_SUFFIX.test(collectionName);
|
|
4
|
+
}
|
|
5
|
+
export function isProtectedCollection(collectionName) {
|
|
6
|
+
return collectionName.startsWith("mc_") || isBucketMemberCollection(collectionName);
|
|
7
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const MASKED_VALUE = "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022";
|
|
2
|
+
export interface ConfigRow {
|
|
3
|
+
key: string;
|
|
4
|
+
value: string;
|
|
5
|
+
masked: boolean;
|
|
6
|
+
configType: string;
|
|
7
|
+
needsRestart: boolean;
|
|
8
|
+
comment: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function isSecretConfigKey(key: string): boolean;
|
|
11
|
+
export declare function buildConfigRows(configurations: unknown): ConfigRow[];
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
export const MASKED_VALUE = "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022";
|
|
2
|
+
const EMPTY_VALUE = "\u2014";
|
|
3
|
+
const SECRET_KEY = /pass(?:word)?|secret|token|api[_-]?key(?!length)|credential|private|username|host/i;
|
|
4
|
+
export function isSecretConfigKey(key) {
|
|
5
|
+
return SECRET_KEY.test(key);
|
|
6
|
+
}
|
|
7
|
+
function isPlainRecord(value) {
|
|
8
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
9
|
+
}
|
|
10
|
+
function unwrapOption(value) {
|
|
11
|
+
return isPlainRecord(value) && Object.keys(value).length === 1 && "value" in value ? value.value : value;
|
|
12
|
+
}
|
|
13
|
+
function hasContent(value) {
|
|
14
|
+
if (value === null || value === void 0) return false;
|
|
15
|
+
if (typeof value === "string") return value !== "";
|
|
16
|
+
if (Array.isArray(value)) return value.length > 0;
|
|
17
|
+
return true;
|
|
18
|
+
}
|
|
19
|
+
function formatScalar(value) {
|
|
20
|
+
if (typeof value === "string") return value;
|
|
21
|
+
if (typeof value === "number" || typeof value === "boolean") return String(value);
|
|
22
|
+
try {
|
|
23
|
+
return JSON.stringify(value) ?? EMPTY_VALUE;
|
|
24
|
+
} catch {
|
|
25
|
+
return "[unreadable value]";
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
function formatValue(raw) {
|
|
29
|
+
const value = unwrapOption(raw);
|
|
30
|
+
if (!hasContent(value)) return EMPTY_VALUE;
|
|
31
|
+
return Array.isArray(value) ? value.map(formatScalar).join(", ") : formatScalar(value);
|
|
32
|
+
}
|
|
33
|
+
function isMaskable(raw) {
|
|
34
|
+
const value = unwrapOption(raw);
|
|
35
|
+
return hasContent(value) && typeof value !== "boolean" && typeof value !== "number";
|
|
36
|
+
}
|
|
37
|
+
export function buildConfigRows(configurations) {
|
|
38
|
+
if (!Array.isArray(configurations)) return [];
|
|
39
|
+
const rows = [];
|
|
40
|
+
for (const item of configurations) {
|
|
41
|
+
if (!isPlainRecord(item) || typeof item.key !== "string" || item.key === "") continue;
|
|
42
|
+
const masked = isSecretConfigKey(item.key) && isMaskable(item.value);
|
|
43
|
+
rows.push({
|
|
44
|
+
key: item.key,
|
|
45
|
+
value: masked ? MASKED_VALUE : formatValue(item.value),
|
|
46
|
+
masked,
|
|
47
|
+
configType: typeof item.configType === "string" ? item.configType : "",
|
|
48
|
+
needsRestart: item.needsRestartForActivation === true,
|
|
49
|
+
comment: typeof item.comment === "string" ? item.comment : ""
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
return rows.sort((a, b) => a.key.localeCompare(b.key));
|
|
53
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { SessionState } from '../composables/useMongocampSession.js';
|
|
2
|
+
export type FailureKind = 'session-ended' | 'rejected-request' | 'network' | 'other';
|
|
3
|
+
export declare function classifyFailure(kind: 'network' | 'unauthorized' | 'forbidden' | 'other', diagnose: () => Promise<SessionState>): Promise<FailureKind>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export async function classifyFailure(kind, diagnose) {
|
|
2
|
+
if (kind === "unauthorized") return "session-ended";
|
|
3
|
+
if (kind !== "network") return "other";
|
|
4
|
+
try {
|
|
5
|
+
const state = await diagnose();
|
|
6
|
+
if (state === "expired" || state === "rejected") return "session-ended";
|
|
7
|
+
return state === "active" ? "rejected-request" : "network";
|
|
8
|
+
} catch {
|
|
9
|
+
return "network";
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type FilterFieldType = 'string' | 'number' | 'date-time' | 'boolean' | 'array' | 'object';
|
|
1
|
+
export type FilterFieldType = 'string' | 'number' | 'date-time' | 'boolean' | 'array' | 'object' | 'objectId';
|
|
2
2
|
export type FilterOperator = 'contains' | 'equals' | 'notEquals' | 'startsWith' | 'endsWith' | 'oneOf' | 'gte' | 'lte' | 'between' | 'isTrue' | 'isFalse' | 'isEmpty' | 'isNotEmpty';
|
|
3
3
|
export interface FilterCondition {
|
|
4
4
|
id: string;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { useMongocampQuery } from "../composables/useMongocampQuery.js";
|
|
2
2
|
import { escapeFieldName } from "./escapeFieldName.js";
|
|
3
3
|
import { isIsoDateTimeString } from "./isoDate.js";
|
|
4
|
+
import { isObjectIdHex } from "./objectId.js";
|
|
4
5
|
export const FILTER_OPERATORS_BY_TYPE = {
|
|
5
6
|
"string": ["contains", "equals", "notEquals", "startsWith", "endsWith", "oneOf", "isEmpty", "isNotEmpty"],
|
|
6
7
|
"number": ["equals", "notEquals", "gte", "lte", "between", "oneOf", "isEmpty", "isNotEmpty"],
|
|
7
8
|
"date-time": ["gte", "lte", "between", "isEmpty", "isNotEmpty"],
|
|
8
9
|
"boolean": ["isTrue", "isFalse"],
|
|
10
|
+
"objectId": ["equals", "notEquals", "oneOf"],
|
|
9
11
|
"array": [],
|
|
10
12
|
"object": []
|
|
11
13
|
};
|
|
@@ -59,6 +61,12 @@ export function buildCondition(condition, type) {
|
|
|
59
61
|
const escapedField = escapeFieldName(condition.field);
|
|
60
62
|
const value = (condition.value ?? "").trim();
|
|
61
63
|
const value2 = (condition.value2 ?? "").trim();
|
|
64
|
+
if (type === "objectId") {
|
|
65
|
+
const ids = condition.operator === "oneOf" ? splitList(value) : [value];
|
|
66
|
+
if (ids.length === 0 || !ids.every(isObjectIdHex)) return "";
|
|
67
|
+
if (condition.operator === "oneOf") return h.inClause(field, ids);
|
|
68
|
+
return condition.operator === "notEquals" ? h.notEquals(field, value) : h.equals(field, value);
|
|
69
|
+
}
|
|
62
70
|
switch (condition.operator) {
|
|
63
71
|
case "isEmpty":
|
|
64
72
|
return h.notExists(field, existsType(type));
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
const DEFAULT_LEEWAY_SECONDS = 30;
|
|
2
|
+
function decodeBase64Url(segment) {
|
|
3
|
+
try {
|
|
4
|
+
const base64 = segment.replace(/-/g, "+").replace(/_/g, "/");
|
|
5
|
+
const binary = atob(base64 + "=".repeat((4 - base64.length % 4) % 4));
|
|
6
|
+
return new TextDecoder().decode(Uint8Array.from(binary, (char) => char.charCodeAt(0)));
|
|
7
|
+
} catch {
|
|
8
|
+
return null;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
export function getTokenExpiry(token) {
|
|
12
|
+
if (typeof token !== "string") return null;
|
|
13
|
+
const parts = token.split(".");
|
|
14
|
+
if (parts.length !== 3) return null;
|
|
15
|
+
const json = decodeBase64Url(parts[1]);
|
|
16
|
+
if (json === null) return null;
|
|
17
|
+
let payload;
|
|
18
|
+
try {
|
|
19
|
+
payload = JSON.parse(json);
|
|
20
|
+
} catch {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
if (typeof payload !== "object" || payload === null || Array.isArray(payload)) return null;
|
|
24
|
+
const exp = payload.exp;
|
|
25
|
+
return typeof exp === "number" && Number.isFinite(exp) && exp > 0 ? exp : null;
|
|
26
|
+
}
|
|
27
|
+
export function tokenExpiryState(token, nowMs = Date.now(), leewaySeconds = DEFAULT_LEEWAY_SECONDS) {
|
|
28
|
+
const exp = getTokenExpiry(token);
|
|
29
|
+
if (exp === null) return "unknown";
|
|
30
|
+
return nowMs / 1e3 > exp + leewaySeconds ? "expired" : "valid";
|
|
31
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type ProbeResult = 'reachable' | 'unreachable' | 'skipped';
|
|
2
|
+
interface ServerProbeOptions {
|
|
3
|
+
getUrl: () => string | undefined;
|
|
4
|
+
fetchFn?: typeof fetch;
|
|
5
|
+
now?: () => number;
|
|
6
|
+
cooldownMs?: number;
|
|
7
|
+
timeoutMs?: number;
|
|
8
|
+
}
|
|
9
|
+
export declare function createServerProbe(options: ServerProbeOptions): () => Promise<ProbeResult>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { createThrottled } from "./throttled.js";
|
|
2
|
+
export function createServerProbe(options) {
|
|
3
|
+
const { getUrl, fetchFn = (...args) => fetch(...args), now, cooldownMs, timeoutMs = 5e3 } = options;
|
|
4
|
+
async function ask(url) {
|
|
5
|
+
try {
|
|
6
|
+
const response = await fetchFn(`${url.replace(/\/+$/, "")}/version`, {
|
|
7
|
+
method: "GET",
|
|
8
|
+
credentials: "omit",
|
|
9
|
+
cache: "no-store",
|
|
10
|
+
signal: AbortSignal.timeout(timeoutMs)
|
|
11
|
+
});
|
|
12
|
+
return response.ok ? "reachable" : "unreachable";
|
|
13
|
+
} catch {
|
|
14
|
+
return "unreachable";
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
let currentUrl = "";
|
|
18
|
+
const throttled = createThrottled(() => ask(currentUrl), { now, cooldownMs });
|
|
19
|
+
return function probe() {
|
|
20
|
+
const url = getUrl();
|
|
21
|
+
if (!url) return Promise.resolve("skipped");
|
|
22
|
+
currentUrl = url;
|
|
23
|
+
return throttled();
|
|
24
|
+
};
|
|
25
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { TokenExpiryState } from './jwtExpiry.js';
|
|
2
|
+
interface SessionGuardDeps {
|
|
3
|
+
path: string;
|
|
4
|
+
loginPath: string;
|
|
5
|
+
checkExpiry: () => TokenExpiryState;
|
|
6
|
+
invalidate: () => Promise<void>;
|
|
7
|
+
isAllowed: (path: string) => boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare function runSessionGuard(deps: SessionGuardDeps): Promise<'continue' | 'redirect'>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export async function runSessionGuard(deps) {
|
|
2
|
+
if (deps.checkExpiry() !== "expired") return "continue";
|
|
3
|
+
try {
|
|
4
|
+
await deps.invalidate();
|
|
5
|
+
} catch {
|
|
6
|
+
return "continue";
|
|
7
|
+
}
|
|
8
|
+
if (deps.path === deps.loginPath) return "continue";
|
|
9
|
+
return deps.isAllowed(deps.path) ? "continue" : "redirect";
|
|
10
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export function createThrottled(fn, options = {}) {
|
|
2
|
+
const { now = Date.now, cooldownMs = 5e3 } = options;
|
|
3
|
+
let inFlight = null;
|
|
4
|
+
let last = null;
|
|
5
|
+
return function throttled() {
|
|
6
|
+
if (inFlight) return inFlight;
|
|
7
|
+
if (last && now() - last.at < cooldownMs) return Promise.resolve(last.value);
|
|
8
|
+
inFlight = fn().then((value) => {
|
|
9
|
+
last = { value, at: now() };
|
|
10
|
+
return value;
|
|
11
|
+
}).finally(() => {
|
|
12
|
+
inFlight = null;
|
|
13
|
+
});
|
|
14
|
+
return inFlight;
|
|
15
|
+
};
|
|
16
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sfxcode/nuxt-ui-mongocamp",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.4",
|
|
4
4
|
"description": "A Nuxt module that wraps @sfxcode/nuxt-mongocamp-server with ready-made UI components, composables, and a runtime plugin",
|
|
5
5
|
"repository": "sfxcode/nuxt-ui-mongocamp",
|
|
6
6
|
"homepage": "https://sfxcode.github.io/nuxt-ui-mongocamp/",
|
|
@@ -63,29 +63,29 @@
|
|
|
63
63
|
"@sfxcode/nuxt-ui-formkit": "^1.4.1",
|
|
64
64
|
"consola": "^3.4.2",
|
|
65
65
|
"defu": "^6.1.7",
|
|
66
|
-
"minimatch": "^
|
|
66
|
+
"minimatch": "^11.0.3",
|
|
67
67
|
"unocss-nuxt-ui": "^1.2.2"
|
|
68
68
|
},
|
|
69
69
|
"devDependencies": {
|
|
70
|
-
"@iconify-json/lucide": "^1.2.
|
|
71
|
-
"@nuxt/devtools": "4.0.0
|
|
70
|
+
"@iconify-json/lucide": "^1.2.150",
|
|
71
|
+
"@nuxt/devtools": "^4.0.0",
|
|
72
72
|
"@nuxt/eslint-config": "^1.17.0",
|
|
73
|
-
"@nuxt/kit": "^4.6.
|
|
73
|
+
"@nuxt/kit": "^4.6.3",
|
|
74
74
|
"@nuxt/module-builder": "^1.0.3",
|
|
75
|
-
"@nuxt/schema": "^4.6.
|
|
75
|
+
"@nuxt/schema": "^4.6.3",
|
|
76
76
|
"@nuxt/test-utils": "^4.3.4",
|
|
77
77
|
"@playwright/test": "^1.64.1",
|
|
78
78
|
"@types/node": "latest",
|
|
79
79
|
"@unhead/vue": "^3.4.3",
|
|
80
80
|
"@vue/test-utils": "^2.5.1",
|
|
81
81
|
"changelogen": "^0.6.2",
|
|
82
|
-
"eslint": "^10.
|
|
83
|
-
"happy-dom": "^21.0.
|
|
84
|
-
"nuxt": "^4.6.
|
|
82
|
+
"eslint": "^10.14.0",
|
|
83
|
+
"happy-dom": "^21.0.4",
|
|
84
|
+
"nuxt": "^4.6.3",
|
|
85
85
|
"typescript": "~6.0.3",
|
|
86
86
|
"vitepress": "2.0.0-alpha.18",
|
|
87
87
|
"vitest": "^5.0.5",
|
|
88
|
-
"vue-tsc": "^3.3.
|
|
88
|
+
"vue-tsc": "^3.3.14"
|
|
89
89
|
},
|
|
90
90
|
"packageManager": "pnpm@11.21.0+sha512.521705bce689924eac72f5a3587122f362689ef6571e55ba80076fd637c11132ecffada26fad4ea79c485bfddbfd3d5a2a5b05805a77e893de71ec8a6cca3bb1"
|
|
91
91
|
}
|