@sfxcode/nuxt-ui-mongocamp 1.5.1 → 1.5.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.
Files changed (90) hide show
  1. package/dist/module.d.mts +15 -0
  2. package/dist/module.json +1 -1
  3. package/dist/module.mjs +25 -4
  4. package/dist/runtime/assets/formkit.css +1 -0
  5. package/dist/runtime/components/MongocampAccount.vue +4 -4
  6. package/dist/runtime/components/MongocampBucketFiles.d.vue.ts +21 -1
  7. package/dist/runtime/components/MongocampBucketFiles.vue +17 -5
  8. package/dist/runtime/components/MongocampBucketFiles.vue.d.ts +21 -1
  9. package/dist/runtime/components/MongocampCollectionData.d.vue.ts +22 -2
  10. package/dist/runtime/components/MongocampCollectionData.vue +31 -9
  11. package/dist/runtime/components/MongocampCollectionData.vue.d.ts +22 -2
  12. package/dist/runtime/components/MongocampCollectionInfos.vue +12 -12
  13. package/dist/runtime/components/MongocampCollections.d.vue.ts +19 -1
  14. package/dist/runtime/components/MongocampCollections.vue +20 -7
  15. package/dist/runtime/components/MongocampCollections.vue.d.ts +19 -1
  16. package/dist/runtime/components/MongocampCommandPalette.d.vue.ts +0 -7
  17. package/dist/runtime/components/MongocampCommandPalette.vue +16 -15
  18. package/dist/runtime/components/MongocampCommandPalette.vue.d.ts +0 -7
  19. package/dist/runtime/components/MongocampDashboard.d.vue.ts +3 -3
  20. package/dist/runtime/components/MongocampDashboard.vue +19 -12
  21. package/dist/runtime/components/MongocampDashboard.vue.d.ts +3 -3
  22. package/dist/runtime/components/MongocampDatabases.d.vue.ts +20 -1
  23. package/dist/runtime/components/MongocampDatabases.vue +15 -2
  24. package/dist/runtime/components/MongocampDatabases.vue.d.ts +20 -1
  25. package/dist/runtime/components/MongocampIndexes.vue +1 -1
  26. package/dist/runtime/components/MongocampJobs.d.vue.ts +23 -1
  27. package/dist/runtime/components/MongocampJobs.vue +18 -4
  28. package/dist/runtime/components/MongocampJobs.vue.d.ts +23 -1
  29. package/dist/runtime/components/MongocampLogin.d.vue.ts +16 -1
  30. package/dist/runtime/components/MongocampLogin.vue +13 -5
  31. package/dist/runtime/components/MongocampLogin.vue.d.ts +16 -1
  32. package/dist/runtime/components/MongocampPermissionMatrix.d.vue.ts +19 -2
  33. package/dist/runtime/components/MongocampPermissionMatrix.vue +15 -6
  34. package/dist/runtime/components/MongocampPermissionMatrix.vue.d.ts +19 -2
  35. package/dist/runtime/components/MongocampRoleGrants.d.vue.ts +22 -1
  36. package/dist/runtime/components/MongocampRoleGrants.vue +16 -4
  37. package/dist/runtime/components/MongocampRoleGrants.vue.d.ts +22 -1
  38. package/dist/runtime/components/MongocampRoles.d.vue.ts +22 -1
  39. package/dist/runtime/components/MongocampRoles.vue +22 -5
  40. package/dist/runtime/components/MongocampRoles.vue.d.ts +22 -1
  41. package/dist/runtime/components/MongocampServerInfo.d.vue.ts +2 -2
  42. package/dist/runtime/components/MongocampServerInfo.vue +14 -4
  43. package/dist/runtime/components/MongocampServerInfo.vue.d.ts +2 -2
  44. package/dist/runtime/components/MongocampServerOverview.d.vue.ts +18 -4
  45. package/dist/runtime/components/MongocampServerOverview.vue +33 -22
  46. package/dist/runtime/components/MongocampServerOverview.vue.d.ts +18 -4
  47. package/dist/runtime/components/MongocampServerStatus.d.vue.ts +13 -0
  48. package/dist/runtime/components/MongocampServerStatus.vue +147 -0
  49. package/dist/runtime/components/MongocampServerStatus.vue.d.ts +13 -0
  50. package/dist/runtime/components/MongocampSettings.d.vue.ts +1 -1
  51. package/dist/runtime/components/MongocampSettings.vue.d.ts +1 -1
  52. package/dist/runtime/components/MongocampUserAccess.d.vue.ts +27 -0
  53. package/dist/runtime/components/MongocampUserAccess.vue +168 -0
  54. package/dist/runtime/components/MongocampUserAccess.vue.d.ts +27 -0
  55. package/dist/runtime/components/MongocampUsers.d.vue.ts +24 -1
  56. package/dist/runtime/components/MongocampUsers.vue +22 -4
  57. package/dist/runtime/components/MongocampUsers.vue.d.ts +24 -1
  58. package/dist/runtime/components/MongocampVersion.vue +3 -3
  59. package/dist/runtime/composables/useMongocampAdminGate.js +2 -3
  60. package/dist/runtime/composables/useMongocampBreadcrumbs.d.ts +12 -0
  61. package/dist/runtime/composables/useMongocampBreadcrumbs.js +13 -0
  62. package/dist/runtime/composables/useMongocampCollectionNames.d.ts +21 -0
  63. package/dist/runtime/composables/useMongocampCollectionNames.js +46 -0
  64. package/dist/runtime/composables/useMongocampNavigation.d.ts +32 -0
  65. package/dist/runtime/composables/useMongocampNavigation.js +15 -0
  66. package/dist/runtime/composables/useMongocampPaths.d.ts +6 -0
  67. package/dist/runtime/composables/useMongocampPaths.js +6 -0
  68. package/dist/runtime/composables/useMongocampPermissions.js +2 -3
  69. package/dist/runtime/composables/useMongocampProxyMode.d.ts +5 -0
  70. package/dist/runtime/composables/useMongocampProxyMode.js +4 -0
  71. package/dist/runtime/composables/useMongocampRoles.d.ts +3 -0
  72. package/dist/runtime/composables/useMongocampRoles.js +5 -1
  73. package/dist/runtime/composables/useMongocampSession.js +2 -3
  74. package/dist/runtime/formkit.config.d.ts +3 -0
  75. package/dist/runtime/formkit.config.js +9 -0
  76. package/dist/runtime/locales/de.json +42 -0
  77. package/dist/runtime/locales/en.json +42 -0
  78. package/dist/runtime/publicUtils.d.ts +4 -0
  79. package/dist/runtime/publicUtils.js +4 -0
  80. package/dist/runtime/utils/collectionNames.d.ts +13 -0
  81. package/dist/runtime/utils/collectionNames.js +14 -0
  82. package/dist/runtime/utils/collectionProtection.d.ts +2 -0
  83. package/dist/runtime/utils/collectionProtection.js +3 -0
  84. package/dist/runtime/utils/navigation.d.ts +39 -0
  85. package/dist/runtime/utils/navigation.js +65 -0
  86. package/dist/runtime/utils/paths.d.ts +32 -0
  87. package/dist/runtime/utils/paths.js +24 -0
  88. package/dist/runtime/utils/serverStatus.d.ts +20 -0
  89. package/dist/runtime/utils/serverStatus.js +11 -0
  90. package/package.json +8 -1
@@ -0,0 +1,65 @@
1
+ const PAGES = {
2
+ home: { labelKey: "nuxtUiMongocamp.navigation.home", icon: "i-lucide-house" },
3
+ account: { labelKey: "nuxtUiMongocamp.navigation.account", icon: "i-lucide-circle-user" },
4
+ collections: { labelKey: "nuxtUiMongocamp.navigation.collections", icon: "i-lucide-database" },
5
+ databases: { labelKey: "nuxtUiMongocamp.navigation.databases", icon: "i-lucide-hard-drive" },
6
+ jobs: { labelKey: "nuxtUiMongocamp.navigation.jobs", icon: "i-lucide-clock" },
7
+ users: { labelKey: "nuxtUiMongocamp.navigation.users", icon: "i-lucide-users" },
8
+ roles: { labelKey: "nuxtUiMongocamp.navigation.roles", icon: "i-lucide-shield" },
9
+ permissions: { labelKey: "nuxtUiMongocamp.navigation.permissions", icon: "i-lucide-key-round" },
10
+ overview: { labelKey: "nuxtUiMongocamp.navigation.overview", icon: "i-lucide-gauge" },
11
+ server: { labelKey: "nuxtUiMongocamp.navigation.server", icon: "i-lucide-activity" },
12
+ settings: { labelKey: "nuxtUiMongocamp.navigation.settings", icon: "i-lucide-settings" }
13
+ };
14
+ function entry(key, paths) {
15
+ return { key, ...PAGES[key], to: paths[key], ...key === "home" ? { exact: true } : {} };
16
+ }
17
+ export function buildNavigation(paths, who) {
18
+ const groups = [{
19
+ key: "main",
20
+ items: [entry("home", paths), ...who.isProxyMode ? [] : [entry("account", paths)]]
21
+ }];
22
+ if (!who.canSeeAdmin) return groups;
23
+ groups.push(
24
+ { key: "data", labelKey: "nuxtUiMongocamp.navigation.groupData", items: [entry("collections", paths), entry("databases", paths), entry("jobs", paths)] },
25
+ { key: "access", labelKey: "nuxtUiMongocamp.navigation.groupAccess", items: [entry("users", paths), entry("roles", paths), entry("permissions", paths)] },
26
+ { key: "server", labelKey: "nuxtUiMongocamp.navigation.groupServer", items: [entry("overview", paths), entry("server", paths), entry("settings", paths)] }
27
+ );
28
+ return groups;
29
+ }
30
+ const NAMED = /* @__PURE__ */ new Set(["collections", "buckets", "roles"]);
31
+ const TAB_KEYS = {
32
+ data: "nuxtUiMongocamp.navigation.data",
33
+ aggregate: "nuxtUiMongocamp.navigation.aggregate"
34
+ };
35
+ const BUCKETS_KEY = "nuxtUiMongocamp.navigation.buckets";
36
+ function decode(segment) {
37
+ try {
38
+ return decodeURIComponent(segment);
39
+ } catch {
40
+ return segment;
41
+ }
42
+ }
43
+ const isUnder = (route, base) => route === base || route.startsWith(base === "/" ? "/" : `${base}/`);
44
+ export function buildBreadcrumbs(routePath, paths) {
45
+ const route = (routePath.split(/[?#]/)[0] ?? "").replace(/\/+$/, "") || "/";
46
+ const parts = [{ labelKey: PAGES.home.labelKey, icon: PAGES.home.icon, to: paths.home }];
47
+ let section;
48
+ for (const key of Object.keys(paths)) {
49
+ if (key === "home" || !isUnder(route, paths[key])) continue;
50
+ if (!section || paths[key].length > paths[section].length) section = key;
51
+ }
52
+ if (section) {
53
+ const base = paths[section];
54
+ parts.push(section === "buckets" ? { labelKey: BUCKETS_KEY, to: paths.collections } : { labelKey: PAGES[section].labelKey, to: base });
55
+ let path = base;
56
+ route.slice(base.length).split("/").filter(Boolean).forEach((segment, index) => {
57
+ path += `/${segment}`;
58
+ const isName = index === 0 && NAMED.has(section);
59
+ const tabKey = !isName && section === "collections" ? TAB_KEYS[segment] : void 0;
60
+ parts.push(tabKey ? { labelKey: tabKey, to: path } : { text: decode(segment), to: path });
61
+ });
62
+ }
63
+ delete parts[parts.length - 1].to;
64
+ return parts;
65
+ }
@@ -0,0 +1,32 @@
1
+ export interface MongocampPaths {
2
+ /** The landing page after login — the first entry of the navigation and of every breadcrumb. */
3
+ home: string;
4
+ /** Collection pages: `<collections>/<name>` (info), `<collections>/<name>/data`. */
5
+ collections: string;
6
+ /** Bucket file browser: `<buckets>/<bucket>`. */
7
+ buckets: string;
8
+ /** The users list. */
9
+ users: string;
10
+ /** The roles list; a role's grants are at `<roles>/<role>`. */
11
+ roles: string;
12
+ /** The jobs list. */
13
+ jobs: string;
14
+ /** The server settings page. */
15
+ settings: string;
16
+ /** The signed-in user's account page. */
17
+ account: string;
18
+ /** The permission matrix page. */
19
+ permissions: string;
20
+ /** The server overview page. */
21
+ overview: string;
22
+ /** The databases page. */
23
+ databases: string;
24
+ /** The server status page. */
25
+ server: string;
26
+ }
27
+ export declare const DEFAULT_PATHS: Readonly<MongocampPaths>;
28
+ /**
29
+ * The configured paths over the defaults. A missing, empty or non-text entry keeps its default, an unknown key is dropped,
30
+ * and trailing slashes are removed (the components append `/<name>` themselves) — `/` alone stays `/`.
31
+ */
32
+ export declare function resolvePaths(configured?: unknown): MongocampPaths;
@@ -0,0 +1,24 @@
1
+ export const DEFAULT_PATHS = Object.freeze({
2
+ home: "/secured",
3
+ collections: "/secured/admin/collections",
4
+ buckets: "/secured/admin/buckets",
5
+ users: "/secured/admin/users",
6
+ roles: "/secured/admin/roles",
7
+ jobs: "/secured/admin/jobs",
8
+ settings: "/secured/admin/settings",
9
+ account: "/secured/account",
10
+ permissions: "/secured/admin/permissions",
11
+ overview: "/secured/admin/overview",
12
+ databases: "/secured/admin/databases",
13
+ server: "/secured/admin/server"
14
+ });
15
+ export function resolvePaths(configured) {
16
+ const source = configured && typeof configured === "object" ? configured : {};
17
+ const paths = { ...DEFAULT_PATHS };
18
+ for (const key of Object.keys(DEFAULT_PATHS)) {
19
+ const value = source[key];
20
+ if (typeof value !== "string" || !value.trim()) continue;
21
+ paths[key] = value.trim().replace(/\/+$/, "") || "/";
22
+ }
23
+ return paths;
24
+ }
@@ -0,0 +1,20 @@
1
+ export type ServerHealth = 'ok' | 'partial' | 'down';
2
+ /**
3
+ * What one request did: it answered (`ok`), the server answered with an error (`refused` — no right, or a server older than
4
+ * 1.9.0 without the route), nothing came back (`failed`), or it was not sent (`skipped` — not signed in, not allowed).
5
+ */
6
+ export type Outcome = 'ok' | 'refused' | 'failed' | 'skipped';
7
+ /** An error that carries an HTTP response proves the server is there; anything else (network, timeout) does not. */
8
+ export declare function outcomeOfError(error: unknown): Outcome;
9
+ /**
10
+ * - `down`: nothing that was asked came back at all — or nothing could be asked and the server's version is unknown too.
11
+ * - `partial`: the server is there but something is missing: a request failed or was refused, or the load came without its connection numbers (the database
12
+ * user lacks `clusterMonitor`).
13
+ * - `ok`: everything that was asked answered.
14
+ */
15
+ export declare function serverHealth(input: {
16
+ info: Outcome;
17
+ stats: Outcome;
18
+ hasConnections: boolean;
19
+ versionKnown: boolean;
20
+ }): ServerHealth;
@@ -0,0 +1,11 @@
1
+ export function outcomeOfError(error) {
2
+ const response = error?.response;
3
+ return typeof response?.status === "number" ? "refused" : "failed";
4
+ }
5
+ export function serverHealth(input) {
6
+ const asked = [input.info, input.stats].filter((outcome) => outcome !== "skipped");
7
+ if (!asked.length) return input.versionKnown ? "ok" : "down";
8
+ if (asked.every((outcome) => outcome === "failed")) return "down";
9
+ if (asked.some((outcome) => outcome !== "ok")) return "partial";
10
+ return input.stats === "ok" && !input.hasConnections ? "partial" : "ok";
11
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sfxcode/nuxt-ui-mongocamp",
3
- "version": "1.5.1",
3
+ "version": "1.5.3",
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/",
@@ -20,6 +20,10 @@
20
20
  ".": {
21
21
  "types": "./dist/types.d.mts",
22
22
  "import": "./dist/module.mjs"
23
+ },
24
+ "./utils": {
25
+ "types": "./dist/runtime/publicUtils.d.ts",
26
+ "import": "./dist/runtime/publicUtils.js"
23
27
  }
24
28
  },
25
29
  "main": "./dist/module.mjs",
@@ -27,6 +31,9 @@
27
31
  "*": {
28
32
  ".": [
29
33
  "./dist/types.d.mts"
34
+ ],
35
+ "utils": [
36
+ "./dist/runtime/publicUtils.d.ts"
30
37
  ]
31
38
  }
32
39
  },