@sfxcode/nuxt-ui-mongocamp 1.3.5 → 1.4.0

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 (201) hide show
  1. package/dist/module.d.mts +8 -0
  2. package/dist/module.json +1 -1
  3. package/dist/module.mjs +6 -0
  4. package/dist/runtime/components/MongocampAggregationBuilder.vue +302 -3
  5. package/dist/runtime/components/MongocampAggregationChart.d.vue.ts +6 -0
  6. package/dist/runtime/components/MongocampAggregationChart.vue +93 -0
  7. package/dist/runtime/components/MongocampAggregationChart.vue.d.ts +6 -0
  8. package/dist/runtime/components/MongocampAggregationStagePreview.d.vue.ts +9 -0
  9. package/dist/runtime/components/MongocampAggregationStagePreview.vue +148 -0
  10. package/dist/runtime/components/MongocampAggregationStagePreview.vue.d.ts +9 -0
  11. package/dist/runtime/components/MongocampBucketFiles.vue +169 -48
  12. package/dist/runtime/components/MongocampBulkDelete.d.vue.ts +19 -0
  13. package/dist/runtime/components/MongocampBulkDelete.vue +118 -23
  14. package/dist/runtime/components/MongocampBulkDelete.vue.d.ts +19 -0
  15. package/dist/runtime/components/MongocampBulkEdit.d.vue.ts +6 -0
  16. package/dist/runtime/components/MongocampBulkEdit.vue +23 -2
  17. package/dist/runtime/components/MongocampBulkEdit.vue.d.ts +6 -0
  18. package/dist/runtime/components/MongocampChart.d.vue.ts +29 -0
  19. package/dist/runtime/components/MongocampChart.vue +129 -0
  20. package/dist/runtime/components/MongocampChart.vue.d.ts +29 -0
  21. package/dist/runtime/components/MongocampCollectionCharts.d.vue.ts +15 -0
  22. package/dist/runtime/components/MongocampCollectionCharts.vue +199 -0
  23. package/dist/runtime/components/MongocampCollectionCharts.vue.d.ts +15 -0
  24. package/dist/runtime/components/MongocampCollectionCopy.d.vue.ts +23 -0
  25. package/dist/runtime/components/MongocampCollectionCopy.vue +445 -0
  26. package/dist/runtime/components/MongocampCollectionCopy.vue.d.ts +23 -0
  27. package/dist/runtime/components/MongocampCollectionData.d.vue.ts +4 -0
  28. package/dist/runtime/components/MongocampCollectionData.vue +342 -137
  29. package/dist/runtime/components/MongocampCollectionData.vue.d.ts +4 -0
  30. package/dist/runtime/components/MongocampCollectionInfos.vue +106 -238
  31. package/dist/runtime/components/MongocampCollections.vue +62 -0
  32. package/dist/runtime/components/MongocampCommandPalette.d.vue.ts +40 -0
  33. package/dist/runtime/components/MongocampCommandPalette.vue +135 -0
  34. package/dist/runtime/components/MongocampCommandPalette.vue.d.ts +40 -0
  35. package/dist/runtime/components/MongocampConfirmByName.vue +2 -2
  36. package/dist/runtime/components/MongocampDashboard.d.vue.ts +3 -1
  37. package/dist/runtime/components/MongocampDashboard.vue +21 -2
  38. package/dist/runtime/components/MongocampDashboard.vue.d.ts +3 -1
  39. package/dist/runtime/components/MongocampDatabases.vue +22 -0
  40. package/dist/runtime/components/MongocampDocumentCompare.d.vue.ts +20 -0
  41. package/dist/runtime/components/MongocampDocumentCompare.vue +146 -0
  42. package/dist/runtime/components/MongocampDocumentCompare.vue.d.ts +20 -0
  43. package/dist/runtime/components/MongocampDocumentView.d.vue.ts +22 -0
  44. package/dist/runtime/components/MongocampDocumentView.vue +202 -0
  45. package/dist/runtime/components/MongocampDocumentView.vue.d.ts +22 -0
  46. package/dist/runtime/components/MongocampErrorAlert.vue +12 -4
  47. package/dist/runtime/components/MongocampExportAll.d.vue.ts +18 -0
  48. package/dist/runtime/components/MongocampExportAll.vue +204 -0
  49. package/dist/runtime/components/MongocampExportAll.vue.d.ts +18 -0
  50. package/dist/runtime/components/MongocampFilePreview.d.vue.ts +16 -0
  51. package/dist/runtime/components/MongocampFilePreview.vue +162 -0
  52. package/dist/runtime/components/MongocampFilePreview.vue.d.ts +16 -0
  53. package/dist/runtime/components/MongocampFilterBuilder.vue +11 -0
  54. package/dist/runtime/components/MongocampImport.vue +2 -10
  55. package/dist/runtime/components/MongocampIndexes.d.vue.ts +18 -0
  56. package/dist/runtime/components/MongocampIndexes.vue +455 -0
  57. package/dist/runtime/components/MongocampIndexes.vue.d.ts +18 -0
  58. package/dist/runtime/components/MongocampJobs.d.vue.ts +6 -1
  59. package/dist/runtime/components/MongocampJobs.vue +23 -3
  60. package/dist/runtime/components/MongocampJobs.vue.d.ts +6 -1
  61. package/dist/runtime/components/MongocampPermissionMatrix.d.vue.ts +12 -0
  62. package/dist/runtime/components/MongocampPermissionMatrix.vue +301 -0
  63. package/dist/runtime/components/MongocampPermissionMatrix.vue.d.ts +12 -0
  64. package/dist/runtime/components/MongocampQueryBar.d.vue.ts +26 -0
  65. package/dist/runtime/components/MongocampQueryBar.vue +398 -0
  66. package/dist/runtime/components/MongocampQueryBar.vue.d.ts +26 -0
  67. package/dist/runtime/components/MongocampRoleGrants.vue +2 -2
  68. package/dist/runtime/components/MongocampRoles.vue +3 -3
  69. package/dist/runtime/components/MongocampServerOverview.d.vue.ts +20 -0
  70. package/dist/runtime/components/MongocampServerOverview.vue +443 -0
  71. package/dist/runtime/components/MongocampServerOverview.vue.d.ts +20 -0
  72. package/dist/runtime/components/MongocampSettings.d.vue.ts +25 -1
  73. package/dist/runtime/components/MongocampSettings.vue +70 -9
  74. package/dist/runtime/components/MongocampSettings.vue.d.ts +25 -1
  75. package/dist/runtime/components/MongocampUsers.vue +3 -3
  76. package/dist/runtime/composables/useMongocampAdmin.d.ts +2 -1
  77. package/dist/runtime/composables/useMongocampAdmin.js +6 -1
  78. package/dist/runtime/composables/useMongocampAggregation.d.ts +12 -1
  79. package/dist/runtime/composables/useMongocampAggregation.js +33 -25
  80. package/dist/runtime/composables/useMongocampAutoRefresh.d.ts +26 -0
  81. package/dist/runtime/composables/useMongocampAutoRefresh.js +78 -0
  82. package/dist/runtime/composables/useMongocampBucket.d.ts +13 -1
  83. package/dist/runtime/composables/useMongocampBucket.js +34 -0
  84. package/dist/runtime/composables/useMongocampClientApi.js +2 -1
  85. package/dist/runtime/composables/useMongocampCollectionCopy.d.ts +85 -0
  86. package/dist/runtime/composables/useMongocampCollectionCopy.js +105 -0
  87. package/dist/runtime/composables/useMongocampCollectionStats.d.ts +10 -0
  88. package/dist/runtime/composables/useMongocampCollectionStats.js +17 -0
  89. package/dist/runtime/composables/useMongocampError.d.ts +2 -1
  90. package/dist/runtime/composables/useMongocampError.js +16 -1
  91. package/dist/runtime/composables/useMongocampExportAll.d.ts +47 -0
  92. package/dist/runtime/composables/useMongocampExportAll.js +27 -0
  93. package/dist/runtime/composables/useMongocampExtendedJson.d.ts +5 -1
  94. package/dist/runtime/composables/useMongocampExtendedJson.js +12 -6
  95. package/dist/runtime/composables/useMongocampFetchAll.d.ts +25 -0
  96. package/dist/runtime/composables/useMongocampFetchAll.js +27 -0
  97. package/dist/runtime/composables/useMongocampPermissions.d.ts +14 -0
  98. package/dist/runtime/composables/useMongocampPermissions.js +21 -0
  99. package/dist/runtime/composables/useMongocampPersistedState.d.ts +15 -0
  100. package/dist/runtime/composables/useMongocampPersistedState.js +21 -0
  101. package/dist/runtime/composables/useMongocampProxyApi.js +2 -1
  102. package/dist/runtime/composables/useMongocampQuery.d.ts +48 -0
  103. package/dist/runtime/composables/useMongocampQuery.js +72 -1
  104. package/dist/runtime/composables/useMongocampSavedPipelines.d.ts +25 -0
  105. package/dist/runtime/composables/useMongocampSavedPipelines.js +23 -0
  106. package/dist/runtime/composables/useMongocampSavedQueries.d.ts +37 -0
  107. package/dist/runtime/composables/useMongocampSavedQueries.js +50 -0
  108. package/dist/runtime/composables/useMongocampServerOverview.d.ts +42 -0
  109. package/dist/runtime/composables/useMongocampServerOverview.js +61 -0
  110. package/dist/runtime/composables/useMongocampSession.d.ts +2 -0
  111. package/dist/runtime/composables/useMongocampSession.js +16 -2
  112. package/dist/runtime/composables/useMongocampSystem.d.ts +7 -2
  113. package/dist/runtime/composables/useMongocampSystem.js +6 -2
  114. package/dist/runtime/locales/de.json +495 -9
  115. package/dist/runtime/locales/en.json +495 -9
  116. package/dist/runtime/plugin.js +6 -3
  117. package/dist/runtime/utils/aggregationPipeline.d.ts +5 -4
  118. package/dist/runtime/utils/aggregationPipeline.js +23 -9
  119. package/dist/runtime/utils/aggregationPreview.d.ts +13 -0
  120. package/dist/runtime/utils/aggregationPreview.js +10 -0
  121. package/dist/runtime/utils/aggregationResult.d.ts +5 -0
  122. package/dist/runtime/utils/aggregationResult.js +4 -0
  123. package/dist/runtime/utils/aggregationTemplates.d.ts +34 -0
  124. package/dist/runtime/utils/aggregationTemplates.js +47 -0
  125. package/dist/runtime/utils/analyzeSamples.d.ts +1 -0
  126. package/dist/runtime/utils/analyzeSamples.js +1 -1
  127. package/dist/runtime/utils/autoRefresh.d.ts +14 -0
  128. package/dist/runtime/utils/autoRefresh.js +15 -0
  129. package/dist/runtime/utils/bigIntJson.d.ts +15 -0
  130. package/dist/runtime/utils/bigIntJson.js +55 -0
  131. package/dist/runtime/utils/bulkDelete.d.ts +9 -1
  132. package/dist/runtime/utils/bulkDelete.js +15 -3
  133. package/dist/runtime/utils/bulkEdit.d.ts +6 -0
  134. package/dist/runtime/utils/bulkEdit.js +7 -0
  135. package/dist/runtime/utils/chartData.d.ts +11 -0
  136. package/dist/runtime/utils/chartData.js +9 -0
  137. package/dist/runtime/utils/collectionChart.d.ts +36 -0
  138. package/dist/runtime/utils/collectionChart.js +73 -0
  139. package/dist/runtime/utils/collectionCopy.d.ts +26 -0
  140. package/dist/runtime/utils/collectionCopy.js +38 -0
  141. package/dist/runtime/utils/collectionStats.d.ts +31 -0
  142. package/dist/runtime/utils/collectionStats.js +42 -0
  143. package/dist/runtime/utils/commandPalette.d.ts +48 -0
  144. package/dist/runtime/utils/commandPalette.js +39 -0
  145. package/dist/runtime/utils/documentCompare.d.ts +31 -0
  146. package/dist/runtime/utils/documentCompare.js +70 -0
  147. package/dist/runtime/utils/documentDiff.d.ts +19 -0
  148. package/dist/runtime/utils/documentDiff.js +71 -0
  149. package/dist/runtime/utils/documentPaths.d.ts +44 -0
  150. package/dist/runtime/utils/documentPaths.js +144 -0
  151. package/dist/runtime/utils/documentTree.d.ts +40 -0
  152. package/dist/runtime/utils/documentTree.js +94 -0
  153. package/dist/runtime/utils/exportDocuments.d.ts +35 -0
  154. package/dist/runtime/utils/exportDocuments.js +54 -0
  155. package/dist/runtime/utils/exportRows.js +1 -1
  156. package/dist/runtime/utils/filePreview.d.ts +27 -0
  157. package/dist/runtime/utils/filePreview.js +50 -0
  158. package/dist/runtime/utils/filterBuilder.d.ts +6 -1
  159. package/dist/runtime/utils/filterBuilder.js +6 -5
  160. package/dist/runtime/utils/formatBytes.d.ts +2 -0
  161. package/dist/runtime/utils/formatBytes.js +11 -0
  162. package/dist/runtime/utils/grantMatching.d.ts +8 -0
  163. package/dist/runtime/utils/grantMatching.js +15 -0
  164. package/dist/runtime/utils/importRows.js +12 -2
  165. package/dist/runtime/utils/indexCopy.d.ts +26 -0
  166. package/dist/runtime/utils/indexCopy.js +22 -0
  167. package/dist/runtime/utils/indexForm.d.ts +69 -0
  168. package/dist/runtime/utils/indexForm.js +63 -0
  169. package/dist/runtime/utils/limitedMap.d.ts +17 -0
  170. package/dist/runtime/utils/limitedMap.js +19 -0
  171. package/dist/runtime/utils/luceneExpression.d.ts +15 -0
  172. package/dist/runtime/utils/luceneExpression.js +74 -0
  173. package/dist/runtime/utils/pagedFetch.d.ts +46 -0
  174. package/dist/runtime/utils/pagedFetch.js +58 -0
  175. package/dist/runtime/utils/paginationHeaders.d.ts +4 -0
  176. package/dist/runtime/utils/paginationHeaders.js +4 -0
  177. package/dist/runtime/utils/permissionDenied.d.ts +10 -0
  178. package/dist/runtime/utils/permissionDenied.js +23 -0
  179. package/dist/runtime/utils/permissionMatrix.d.ts +55 -0
  180. package/dist/runtime/utils/permissionMatrix.js +85 -0
  181. package/dist/runtime/utils/persistedState.d.ts +25 -0
  182. package/dist/runtime/utils/persistedState.js +47 -0
  183. package/dist/runtime/utils/queryState.d.ts +45 -0
  184. package/dist/runtime/utils/queryState.js +75 -0
  185. package/dist/runtime/utils/requestLimits.d.ts +2 -0
  186. package/dist/runtime/utils/requestLimits.js +4 -0
  187. package/dist/runtime/utils/resultChart.d.ts +32 -0
  188. package/dist/runtime/utils/resultChart.js +59 -0
  189. package/dist/runtime/utils/savedPipelines.d.ts +22 -0
  190. package/dist/runtime/utils/savedPipelines.js +46 -0
  191. package/dist/runtime/utils/savedQueries.d.ts +60 -0
  192. package/dist/runtime/utils/savedQueries.js +143 -0
  193. package/dist/runtime/utils/schemaAnalysis.d.ts +16 -0
  194. package/dist/runtime/utils/schemaAnalysis.js +57 -0
  195. package/dist/runtime/utils/serverError.d.ts +19 -0
  196. package/dist/runtime/utils/serverError.js +19 -0
  197. package/dist/runtime/utils/serverOverview.d.ts +47 -0
  198. package/dist/runtime/utils/serverOverview.js +40 -0
  199. package/dist/runtime/utils/sessionGuard.d.ts +3 -0
  200. package/dist/runtime/utils/sessionGuard.js +18 -1
  201. package/package.json +12 -11
@@ -0,0 +1,61 @@
1
+ import { useMongocampClientApi } from "#imports";
2
+ import { mapLimit } from "../utils/limitedMap.js";
3
+ import { toCollectionStat } from "../utils/serverOverview.js";
4
+ import { useMongocampJobs } from "./useMongocampJobs.js";
5
+ import { useMongocampSystem } from "./useMongocampSystem.js";
6
+ const REQUEST_TIMEOUT_MS = 15e3;
7
+ const DEFAULT_MAX_COLLECTIONS = 200;
8
+ const DEFAULT_CONCURRENCY = 6;
9
+ function abortError() {
10
+ return new DOMException("The operation was aborted.", "AbortError");
11
+ }
12
+ export function useMongocampServerOverview() {
13
+ const { collectionApi } = useMongocampClientApi();
14
+ const { getDatabaseInfos, getCluster } = useMongocampSystem();
15
+ const { listJobs } = useMongocampJobs();
16
+ async function loadOverview(options = {}) {
17
+ const { signal } = options;
18
+ if (signal?.aborted) throw abortError();
19
+ const maxCollections = Math.max(0, Math.floor(options.maxCollections ?? DEFAULT_MAX_COLLECTIONS));
20
+ const errors = {};
21
+ const [databases, names, cluster, jobs] = await Promise.allSettled([getDatabaseInfos(), collectionApi.listCollections(), getCluster(), listJobs()]);
22
+ if (signal?.aborted) throw abortError();
23
+ const result = {
24
+ databases: databases.status === "fulfilled" ? databases.value : null,
25
+ collections: [],
26
+ collectionCount: 0,
27
+ skipped: 0,
28
+ failed: [],
29
+ cluster: cluster.status === "fulfilled" ? cluster.value : null,
30
+ jobs: jobs.status === "fulfilled" ? jobs.value : null,
31
+ errors
32
+ };
33
+ if (databases.status === "rejected") errors.databases = databases.reason;
34
+ if (cluster.status === "rejected") errors.cluster = cluster.reason;
35
+ if (jobs.status === "rejected") errors.jobs = jobs.reason;
36
+ if (names.status === "rejected") {
37
+ errors.collections = names.reason;
38
+ return result;
39
+ }
40
+ const own = names.value.filter((name) => !name.startsWith("mc_"));
41
+ result.collectionCount = own.length;
42
+ const toRead = own.slice(0, maxCollections);
43
+ result.skipped = own.length - toRead.length;
44
+ if (toRead.length > 0) options.onProgress?.({ done: 0, total: toRead.length });
45
+ const settled = await mapLimit(toRead, options.concurrency ?? DEFAULT_CONCURRENCY, async (name) => {
46
+ const timeout = AbortSignal.timeout(REQUEST_TIMEOUT_MS);
47
+ const init = { signal: signal ? AbortSignal.any([signal, timeout]) : timeout };
48
+ return toCollectionStat(name, await collectionApi.getCollectionInformation({ collectionName: name }, init));
49
+ }, { signal, onProgress: (done, total) => options.onProgress?.({ done, total }) });
50
+ if (signal?.aborted) throw abortError();
51
+ settled.forEach((outcome, index) => {
52
+ if (outcome?.ok) result.collections.push(outcome.value);
53
+ else {
54
+ result.failed.push(toRead[index]);
55
+ if (outcome && errors.collections === void 0) errors.collections = outcome.error;
56
+ }
57
+ });
58
+ return result;
59
+ }
60
+ return { loadOverview };
61
+ }
@@ -1,7 +1,9 @@
1
1
  import type { TokenExpiryState } from '../utils/jwtExpiry.js';
2
2
  export type SessionState = 'active' | 'expired' | 'unknown';
3
+ export type SessionVerification = 'valid' | 'invalid' | 'unknown';
3
4
  export declare function useMongocampSession(): {
4
5
  checkExpiry: () => TokenExpiryState;
5
6
  currentState: () => SessionState;
7
+ verify: () => Promise<SessionVerification>;
6
8
  invalidateSession: () => Promise<void>;
7
9
  };
@@ -1,10 +1,12 @@
1
1
  import { useRuntimeConfig } from "#app";
2
- import { useMongocampAuth, useMongocampStorage } from "#imports";
2
+ import { useMongocampAuth, useMongocampClientApi, useMongocampStorage } from "#imports";
3
3
  import { tokenExpiryState } from "../utils/jwtExpiry.js";
4
+ const VERIFY_TIMEOUT_MS = 15e3;
4
5
  export function useMongocampSession() {
5
6
  const config = useRuntimeConfig();
6
7
  const { logout } = useMongocampAuth();
7
8
  const storage = useMongocampStorage();
9
+ const { authApi } = useMongocampClientApi();
8
10
  const isProxyMode = config.public.nuxtUiMongocampOptions?.useServerProxy ?? false;
9
11
  function checkExpiry() {
10
12
  if (isProxyMode) return "unknown";
@@ -15,9 +17,21 @@ export function useMongocampSession() {
15
17
  const expiry = checkExpiry();
16
18
  return expiry === "valid" ? "active" : expiry;
17
19
  }
20
+ async function verify() {
21
+ if (isProxyMode) return "unknown";
22
+ const token = storage.value?.token;
23
+ if (typeof token !== "string" || !token) return "unknown";
24
+ try {
25
+ const result = await authApi.isAuthenticated({ signal: AbortSignal.timeout(VERIFY_TIMEOUT_MS) });
26
+ if (result.value === true) return "valid";
27
+ return result.value === false ? "invalid" : "unknown";
28
+ } catch (e) {
29
+ return e?.response?.status === 401 ? "invalid" : "unknown";
30
+ }
31
+ }
18
32
  async function invalidateSession() {
19
33
  if (isProxyMode) return;
20
34
  await logout();
21
35
  }
22
- return { checkExpiry, currentState, invalidateSession };
36
+ return { checkExpiry, currentState, verify, invalidateSession };
23
37
  }
@@ -1,12 +1,16 @@
1
- import type { DatabaseInfo } from '@sfxcode/nuxt-mongocamp-server';
1
+ import type { ClusterMemberInformation, DatabaseInfo } from '@sfxcode/nuxt-mongocamp-server';
2
2
  import type { ConfigRow } from '../utils/configRows.js';
3
+ export interface ServerCluster {
4
+ coordinator: ClusterMemberInformation;
5
+ members: ClusterMemberInformation[];
6
+ }
3
7
  export interface ServerPlugins {
4
8
  routesPlugins: string[];
5
9
  filePlugins: string[];
6
10
  ignoredPlugins: string[];
7
11
  }
8
12
  /**
9
- * Read-only wrapper for databaseApi and applicationApi. Deliberately read-only —
13
+ * Read-only wrapper for databaseApi, applicationApi and the cluster view of systemApi. Deliberately read-only —
10
14
  * deleteDatabase, shutdown and updateConfiguration are out of scope (cross-cutting, highly
11
15
  * destructive) and not exposed. The server's settings and configuration payloads contain real secrets
12
16
  * (auth secret, database credentials and host), so the settings methods never hand them out:
@@ -14,6 +18,7 @@ export interface ServerPlugins {
14
18
  * already masked (see utils/configRows.ts).
15
19
  */
16
20
  export declare function useMongocampSystem(): {
21
+ getCluster: () => Promise<ServerCluster>;
17
22
  listDatabases: () => Promise<string[]>;
18
23
  getDatabaseInfos: () => Promise<DatabaseInfo[]>;
19
24
  getDatabaseInfo: (databaseName: string) => Promise<DatabaseInfo>;
@@ -5,7 +5,7 @@ function withTimeout() {
5
5
  return { signal: AbortSignal.timeout(REQUEST_TIMEOUT_MS) };
6
6
  }
7
7
  export function useMongocampSystem() {
8
- const { databaseApi, applicationApi } = useMongocampClientApi();
8
+ const { databaseApi, applicationApi, systemApi } = useMongocampClientApi();
9
9
  async function listDatabases() {
10
10
  return databaseApi.listDatabases(withTimeout());
11
11
  }
@@ -34,5 +34,9 @@ export function useMongocampSystem() {
34
34
  if (!row) throw new Error(`The server returned no usable configuration for "${configurationKey}"`);
35
35
  return row;
36
36
  }
37
- return { listDatabases, getDatabaseInfos, getDatabaseInfo, listCollectionsByDatabase, getSettings, listConfigurations, getConfig };
37
+ async function getCluster() {
38
+ const cluster = await systemApi.viewCluster(withTimeout());
39
+ return { coordinator: cluster.coordinator, members: cluster.members?.length ? cluster.members : [cluster.coordinator] };
40
+ }
41
+ return { getCluster, listDatabases, getDatabaseInfos, getDatabaseInfo, listCollectionsByDatabase, getSettings, listConfigurations, getConfig };
38
42
  }