@sfxcode/nuxt-ui-mongocamp 1.5.7 → 2.0.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.
- package/README.md +5 -5
- package/dist/module.d.mts +17 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +4 -0
- package/dist/runtime/components/MongocampAccount.vue +12 -14
- package/dist/runtime/components/MongocampAggregationBuilder.d.vue.ts +1 -0
- package/dist/runtime/components/MongocampAggregationBuilder.vue +32 -45
- package/dist/runtime/components/MongocampAggregationBuilder.vue.d.ts +1 -0
- package/dist/runtime/components/MongocampAggregationChart.vue +7 -5
- package/dist/runtime/components/MongocampAggregationStagePreview.d.vue.ts +1 -0
- package/dist/runtime/components/MongocampAggregationStagePreview.vue +5 -3
- package/dist/runtime/components/MongocampAggregationStagePreview.vue.d.ts +1 -0
- package/dist/runtime/components/MongocampBucketFiles.vue +29 -40
- package/dist/runtime/components/MongocampBulkDelete.vue +8 -9
- package/dist/runtime/components/MongocampBulkEdit.vue +5 -4
- package/dist/runtime/components/MongocampChart.vue +1 -1
- package/dist/runtime/components/MongocampCollectionCharts.d.vue.ts +1 -0
- package/dist/runtime/components/MongocampCollectionCharts.vue +10 -7
- package/dist/runtime/components/MongocampCollectionCharts.vue.d.ts +1 -0
- package/dist/runtime/components/MongocampCollectionCopy.d.vue.ts +1 -0
- package/dist/runtime/components/MongocampCollectionCopy.vue +11 -9
- package/dist/runtime/components/MongocampCollectionCopy.vue.d.ts +1 -0
- package/dist/runtime/components/MongocampCollectionData.vue +97 -87
- package/dist/runtime/components/MongocampCollectionInfos.vue +34 -24
- package/dist/runtime/components/MongocampCollectionRename.vue +5 -4
- package/dist/runtime/components/MongocampCollections.vue +24 -33
- package/dist/runtime/components/MongocampCommandPalette.vue +3 -1
- package/dist/runtime/components/MongocampConfirmByName.vue +5 -4
- package/dist/runtime/components/MongocampDashboard.vue +5 -3
- package/dist/runtime/components/MongocampDatabases.vue +14 -8
- package/dist/runtime/components/MongocampDocumentCompare.vue +6 -4
- package/dist/runtime/components/MongocampDocumentView.vue +12 -9
- package/dist/runtime/components/MongocampEmptyState.vue +4 -1
- package/dist/runtime/components/MongocampErrorAlert.vue +8 -7
- package/dist/runtime/components/MongocampExportAll.d.vue.ts +1 -0
- package/dist/runtime/components/MongocampExportAll.vue +19 -7
- package/dist/runtime/components/MongocampExportAll.vue.d.ts +1 -0
- package/dist/runtime/components/MongocampFilePreview.vue +7 -6
- package/dist/runtime/components/MongocampFilterBuilder.vue +12 -16
- package/dist/runtime/components/MongocampGrantList.vue +6 -2
- package/dist/runtime/components/MongocampImport.vue +32 -28
- package/dist/runtime/components/MongocampIndexes.vue +21 -19
- package/dist/runtime/components/MongocampJobs.vue +20 -20
- package/dist/runtime/components/MongocampLogin.vue +2 -1
- package/dist/runtime/components/MongocampPermissionMatrix.vue +14 -11
- package/dist/runtime/components/MongocampQueryBar.vue +33 -32
- package/dist/runtime/components/MongocampRoleGrants.vue +21 -17
- package/dist/runtime/components/MongocampRoles.vue +28 -32
- package/dist/runtime/components/MongocampServerInfo.vue +17 -25
- package/dist/runtime/components/MongocampServerOverview.vue +16 -12
- package/dist/runtime/components/MongocampServerStatus.vue +9 -3
- package/dist/runtime/components/MongocampSettings.vue +15 -11
- package/dist/runtime/components/MongocampUserAccess.vue +11 -6
- package/dist/runtime/components/MongocampUsers.vue +32 -35
- package/dist/runtime/components/MongocampVersion.d.vue.ts +1 -1
- package/dist/runtime/components/MongocampVersion.vue +20 -11
- package/dist/runtime/components/MongocampVersion.vue.d.ts +1 -1
- package/dist/runtime/composables/useMongocampAdmin.js +6 -5
- package/dist/runtime/composables/useMongocampAggregation.d.ts +10 -1
- package/dist/runtime/composables/useMongocampAggregation.js +17 -5
- package/dist/runtime/composables/useMongocampBucket.d.ts +4 -0
- package/dist/runtime/composables/useMongocampBucket.js +7 -6
- package/dist/runtime/composables/useMongocampBulkByFilter.d.ts +6 -4
- package/dist/runtime/composables/useMongocampBulkByFilter.js +11 -6
- package/dist/runtime/composables/useMongocampCollectionCopy.d.ts +3 -1
- package/dist/runtime/composables/useMongocampCollectionCopy.js +4 -2
- package/dist/runtime/composables/useMongocampCollectionStats.js +2 -4
- package/dist/runtime/composables/useMongocampError.d.ts +1 -1
- package/dist/runtime/composables/useMongocampError.js +4 -1
- package/dist/runtime/composables/useMongocampExportAll.d.ts +10 -1
- package/dist/runtime/composables/useMongocampExportAll.js +4 -1
- package/dist/runtime/composables/useMongocampFetchAll.d.ts +11 -5
- package/dist/runtime/composables/useMongocampFetchAll.js +8 -8
- package/dist/runtime/composables/useMongocampJobs.js +3 -2
- package/dist/runtime/composables/useMongocampQuery.d.ts +26 -36
- package/dist/runtime/composables/useMongocampQuery.js +45 -48
- package/dist/runtime/composables/useMongocampSchema.js +2 -0
- package/dist/runtime/composables/useMongocampUi.d.ts +8 -0
- package/dist/runtime/composables/useMongocampUi.js +7 -0
- package/dist/runtime/locales/de.json +12 -4
- package/dist/runtime/locales/en.json +12 -4
- package/dist/runtime/plugin.js +8 -0
- package/dist/runtime/publicUtils.d.ts +1 -0
- package/dist/runtime/publicUtils.js +1 -0
- package/dist/runtime/server/handlers/mongocampProxy.d.ts +1 -1
- package/dist/runtime/server/handlers/mongocampProxy.js +12 -12
- package/dist/runtime/utils/aggregationPipeline.d.ts +2 -1
- package/dist/runtime/utils/aggregationPipeline.js +2 -3
- package/dist/runtime/utils/caseInsensitive.d.ts +10 -0
- package/dist/runtime/utils/caseInsensitive.js +8 -0
- package/dist/runtime/utils/collectionStats.d.ts +4 -1
- package/dist/runtime/utils/collectionStats.js +2 -2
- package/dist/runtime/utils/compactSession.d.ts +13 -0
- package/dist/runtime/utils/compactSession.js +12 -0
- package/dist/runtime/utils/configRows.d.ts +3 -3
- package/dist/runtime/utils/cursorPaging.d.ts +16 -0
- package/dist/runtime/utils/cursorPaging.js +17 -0
- package/dist/runtime/utils/documentCompare.js +2 -3
- package/dist/runtime/utils/documentPaths.d.ts +5 -5
- package/dist/runtime/utils/documentPaths.js +9 -2
- package/dist/runtime/utils/documentTree.js +3 -0
- package/dist/runtime/utils/fileFilter.d.ts +7 -0
- package/dist/runtime/utils/fileFilter.js +11 -0
- package/dist/runtime/utils/filterBuilder.d.ts +1 -1
- package/dist/runtime/utils/filterBuilder.js +5 -11
- package/dist/runtime/utils/filterSuggestions.js +1 -1
- package/dist/runtime/utils/indexForm.d.ts +7 -0
- package/dist/runtime/utils/indexForm.js +9 -0
- package/dist/runtime/utils/pagedFetch.d.ts +13 -0
- package/dist/runtime/utils/pagedFetch.js +44 -0
- package/dist/runtime/utils/queryState.d.ts +5 -0
- package/dist/runtime/utils/queryState.js +3 -2
- package/dist/runtime/utils/relaxedValues.d.ts +17 -0
- package/dist/runtime/utils/relaxedValues.js +51 -0
- package/dist/runtime/utils/requestLimits.d.ts +1 -1
- package/dist/runtime/utils/requestLimits.js +1 -1
- package/dist/runtime/utils/savedQueries.d.ts +2 -0
- package/dist/runtime/utils/savedQueries.js +1 -0
- package/dist/runtime/utils/schemaAnalysis.d.ts +4 -4
- package/dist/runtime/utils/schemaAnalysis.js +2 -2
- package/dist/runtime/utils/sensitiveFields.d.ts +20 -0
- package/dist/runtime/utils/sensitiveFields.js +63 -0
- package/dist/runtime/utils/serverError.d.ts +7 -0
- package/dist/runtime/utils/serverError.js +11 -0
- package/dist/runtime/utils/serverStatus.d.ts +2 -2
- package/dist/runtime/utils/uiTheme.d.ts +65 -0
- package/dist/runtime/utils/uiTheme.js +47 -0
- package/package.json +22 -16
- package/dist/runtime/utils/luceneExpression.d.ts +0 -15
- package/dist/runtime/utils/luceneExpression.js +0 -74
|
@@ -14,6 +14,9 @@ export function useMongocampError() {
|
|
|
14
14
|
if (status === 403) {
|
|
15
15
|
return { kind: "forbidden", message: t("nuxtUiMongocamp.errors.forbidden") };
|
|
16
16
|
}
|
|
17
|
+
if (status === 404) {
|
|
18
|
+
return { kind: "notFound", message: t("nuxtUiMongocamp.errors.notFound") };
|
|
19
|
+
}
|
|
17
20
|
const message = error instanceof Error && error.message ? error.message : t(fallbackKey ?? "nuxtUiMongocamp.errors.generic");
|
|
18
21
|
return { kind: "other", message };
|
|
19
22
|
}
|
|
@@ -27,7 +30,7 @@ export function useMongocampError() {
|
|
|
27
30
|
}
|
|
28
31
|
if (base.kind === "forbidden") return base;
|
|
29
32
|
if (server.message && server.status !== void 0 && server.status >= 400) {
|
|
30
|
-
return { kind: server.status === 400 ? "invalid" : "other", message: server.message };
|
|
33
|
+
return { kind: server.status === 400 ? "invalid" : server.status === 404 ? "notFound" : "other", message: server.message };
|
|
31
34
|
}
|
|
32
35
|
return base;
|
|
33
36
|
}
|
|
@@ -4,6 +4,8 @@ export interface ExportCollectionOptions {
|
|
|
4
4
|
format: ExportFormat;
|
|
5
5
|
/** Lucene filter: export only the documents that match (the current filter of a table). It travels in the URL: over ~1 800 encoded characters it throws `FilterTooLongError`. */
|
|
6
6
|
filter?: string;
|
|
7
|
+
/** Match the wildcards of `filter` without regard to case (server 2.0 matches them case-sensitively otherwise). */
|
|
8
|
+
filterCaseInsensitive?: boolean;
|
|
7
9
|
sort?: string[];
|
|
8
10
|
/** Limit the fields; for a CSV they are also its columns, in this order (default: the fields of the first 1 000 documents). */
|
|
9
11
|
projection?: string[];
|
|
@@ -11,6 +13,12 @@ export interface ExportCollectionOptions {
|
|
|
11
13
|
columns?: string[];
|
|
12
14
|
/** Stop after this many documents (`limit`); default: all. */
|
|
13
15
|
maxRows?: number;
|
|
16
|
+
/**
|
|
17
|
+
* JSON/NDJSON only: `relaxed` (default) is readable and keeps ids, dates, big integers, decimals and date-like text, but a
|
|
18
|
+
* re-import stores every whole number as Int64; `canonical` wraps every number too, so a re-import keeps Int32/Int64/Double
|
|
19
|
+
* exactly (larger files). Ignored for CSV, which stays plain.
|
|
20
|
+
*/
|
|
21
|
+
extendedJson?: 'relaxed' | 'canonical';
|
|
14
22
|
/** How many documents the caller expects (the count of the filter): a file with fewer is reported as `incomplete`. */
|
|
15
23
|
expected?: number;
|
|
16
24
|
/** After every chunk of the stream. */
|
|
@@ -45,7 +53,8 @@ export interface ExportResult {
|
|
|
45
53
|
/**
|
|
46
54
|
* Exports a whole collection, or every document matching a filter, as JSON, NDJSON or CSV — not just the rows on screen.
|
|
47
55
|
* The server streams the file (`GET …/documents/export`, server 1.8.1): there is no document cap and the browser never parses
|
|
48
|
-
* a document.
|
|
56
|
+
* a document. JSON and NDJSON files are relaxed Extended JSON (`{ "$oid" }`, `{ "$date" }`, `{ "$numberLong" }`, …), so they go
|
|
57
|
+
* back in through the importer with every type; CSV stays plain text (an integer beyond 2^53 keeps every digit).
|
|
49
58
|
* The file ends up in a `Blob` (the browser may keep it on disk) and is handed to the browser as a download.
|
|
50
59
|
*/
|
|
51
60
|
export declare function useMongocampExportAll(): {
|
|
@@ -26,9 +26,12 @@ export function useMongocampExportAll() {
|
|
|
26
26
|
collectionName: collection,
|
|
27
27
|
format,
|
|
28
28
|
filter: options.filter?.trim() ? options.filter : void 0,
|
|
29
|
+
filterCaseInsensitive: options.filter?.trim() ? options.filterCaseInsensitive : void 0,
|
|
29
30
|
sort: options.sort?.length ? options.sort : void 0,
|
|
30
31
|
projection,
|
|
31
|
-
limit: options.maxRows
|
|
32
|
+
limit: options.maxRows,
|
|
33
|
+
// CSV is plain unless a format is asked for; the JSON formats keep their types
|
|
34
|
+
extendedJson: format === "csv" ? void 0 : options.extendedJson ?? "relaxed"
|
|
32
35
|
}, options.signal ? { signal: options.signal } : void 0);
|
|
33
36
|
const mimeType = EXPORT_MIME_TYPES[format];
|
|
34
37
|
const { stream, state } = countingStream(options.onProgress);
|
|
@@ -2,22 +2,28 @@ import type { FetchAllOptions, FetchAllResult } from '../utils/pagedFetch.js';
|
|
|
2
2
|
export interface FetchAllDocumentsOptions<T> extends FetchAllOptions<T> {
|
|
3
3
|
/** Lucene filter, as for the document list. */
|
|
4
4
|
filter?: string;
|
|
5
|
+
/** Match the wildcards of `filter` without regard to case (server 2.0 matches them case-sensitively otherwise). */
|
|
6
|
+
filterCaseInsensitive?: boolean;
|
|
5
7
|
/** Sort keys as the document list takes them (`['name', '-age']`). Without one the server's natural order is used. */
|
|
6
8
|
sort?: string[];
|
|
7
9
|
/** Fields to return; `['_id']` is the cheap way to collect ids. */
|
|
8
10
|
projection?: string[];
|
|
9
11
|
}
|
|
10
12
|
export interface FetchAllFilesOptions<T> extends FetchAllOptions<T> {
|
|
13
|
+
/** A MongoDB query as JSON text (not Lucene — the file list ignores Lucene), e.g. from `filenameFilter`. */
|
|
11
14
|
filter?: string;
|
|
12
15
|
sort?: string;
|
|
13
16
|
projection?: string;
|
|
14
17
|
}
|
|
15
18
|
/**
|
|
16
|
-
* Reads every document of a collection (or of a Lucene filter) page by page
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
19
|
+
* Reads every document of a collection (or of a Lucene filter) page by page, following the server's cursor
|
|
20
|
+
* (`fetchAllByCursor`, server 2.0): every page costs the same, and documents added or removed while reading do not make the
|
|
21
|
+
* others missing or repeated (verified: 25 000 documents read during concurrent inserts, none lost or doubled). The
|
|
22
|
+
* rows are relaxed Extended JSON, as the server sends them — `_id` `{ $oid }`, dates `{ $date }`, integers beyond 2^53
|
|
23
|
+
* `{ $numberLong }`, decimals, date-looking text `{ $string }` (`idOf` / `unwrapExtendedJson` give plain values) — and the
|
|
24
|
+
* total comes from the first page's pagination header (later pages skip the count).
|
|
25
|
+
* Capped at 10 000 rows by default (`maxRows` raises it); see `utils/pagedFetch.ts` for stopping, progress and abort.
|
|
26
|
+
* Every page has its own 60 s timeout.
|
|
21
27
|
*/
|
|
22
28
|
export declare function useMongocampFetchAll(): {
|
|
23
29
|
fetchAllDocuments: <T = Record<string, unknown>>(collectionName: string, options?: FetchAllDocumentsOptions<T>) => Promise<FetchAllResult<T>>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useMongocampClientApi } from "#imports";
|
|
2
2
|
import { readJsonKeepingLongs } from "../utils/bigIntJson.js";
|
|
3
|
-
import {
|
|
3
|
+
import { fetchAllByCursor } from "../utils/pagedFetch.js";
|
|
4
4
|
import { headerNumber } from "../utils/paginationHeaders.js";
|
|
5
5
|
const PAGE_TIMEOUT_MS = 6e4;
|
|
6
6
|
function requestInit(signal) {
|
|
@@ -10,17 +10,17 @@ function requestInit(signal) {
|
|
|
10
10
|
export function useMongocampFetchAll() {
|
|
11
11
|
const { documentApi, fileApi } = useMongocampClientApi();
|
|
12
12
|
async function fetchAllDocuments(collectionName, options = {}) {
|
|
13
|
-
const { filter, sort, projection, ...paging } = options;
|
|
14
|
-
return
|
|
15
|
-
const response = await documentApi.searchDocumentsRaw({ collectionName, searchRequest: { filter, sort, projection },
|
|
16
|
-
return { rows: await readJsonKeepingLongs(response), total: headerNumber(response.raw?.headers, "x-pagination-count-rows") };
|
|
13
|
+
const { filter, filterCaseInsensitive, sort, projection, ...paging } = options;
|
|
14
|
+
return fetchAllByCursor(async (after, pageSize, first) => {
|
|
15
|
+
const response = await documentApi.searchDocumentsRaw({ collectionName, searchRequest: { filter, sort, projection }, after, count: first ? "exact" : "none", rowsPerPage: pageSize, extendedJson: "relaxed", filterCaseInsensitive }, requestInit(options.signal));
|
|
16
|
+
return { rows: await readJsonKeepingLongs(response), next: response.raw?.headers.get("x-pagination-next") || void 0, total: headerNumber(response.raw?.headers, "x-pagination-count-rows") };
|
|
17
17
|
}, paging);
|
|
18
18
|
}
|
|
19
19
|
async function fetchAllFiles(bucketName, options = {}) {
|
|
20
20
|
const { filter, sort, projection, ...paging } = options;
|
|
21
|
-
return
|
|
22
|
-
const response = await fileApi.listFilesRaw({ bucketName, filter, sort, projection,
|
|
23
|
-
return { rows: await readJsonKeepingLongs(response), total: headerNumber(response.raw?.headers, "x-pagination-count-rows") };
|
|
21
|
+
return fetchAllByCursor(async (after, pageSize, first) => {
|
|
22
|
+
const response = await fileApi.listFilesRaw({ bucketName, filter, sort, projection, after, count: first ? "exact" : "none", rowsPerPage: pageSize }, requestInit(options.signal));
|
|
23
|
+
return { rows: await readJsonKeepingLongs(response), next: response.raw?.headers.get("x-pagination-next") || void 0, total: headerNumber(response.raw?.headers, "x-pagination-count-rows") };
|
|
24
24
|
}, paging);
|
|
25
25
|
}
|
|
26
26
|
return { fetchAllDocuments, fetchAllFiles };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { useMongocampClientApi } from "#imports";
|
|
2
|
+
import { ignoringNotFound } from "../utils/serverError.js";
|
|
2
3
|
export function useMongocampJobs() {
|
|
3
4
|
const { jobApi } = useMongocampClientApi();
|
|
4
5
|
async function listJobs() {
|
|
@@ -18,8 +19,8 @@ export function useMongocampJobs() {
|
|
|
18
19
|
return result.value;
|
|
19
20
|
}
|
|
20
21
|
async function deleteJob(jobGroup, jobName) {
|
|
21
|
-
const result = await jobApi.deleteJob({ jobGroup, jobName });
|
|
22
|
-
return result.value;
|
|
22
|
+
const result = await ignoringNotFound(() => jobApi.deleteJob({ jobGroup, jobName }));
|
|
23
|
+
return result ? result.value : true;
|
|
23
24
|
}
|
|
24
25
|
return { listJobs, listPossibleJobs, registerJob, updateJob, executeJob, deleteJob };
|
|
25
26
|
}
|
|
@@ -1,23 +1,18 @@
|
|
|
1
1
|
/** Scalar value accepted by all query helpers. `null` and `undefined` produce an empty (no-op) expression. */
|
|
2
2
|
export type QueryValue = string | number | boolean | null | undefined;
|
|
3
3
|
/**
|
|
4
|
-
* What kind of values a field holds
|
|
5
|
-
*
|
|
4
|
+
* What kind of values a field holds. Server 2.0 tests existence the same way for every type, so this no longer changes the
|
|
5
|
+
* query; it is still accepted so existing calls keep compiling.
|
|
6
|
+
* @deprecated not needed with MongoCamp 2.0
|
|
6
7
|
*/
|
|
7
8
|
export type ExistsFieldType = 'text' | 'number' | 'date';
|
|
8
9
|
export interface MongocampQueryHelper {
|
|
9
10
|
/**
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* MongoCamp (last verified on 1.6.3, not re-checked on 1.8) does not understand `_exists_:field` (it matches nothing), and `field:*` only matches text,
|
|
14
|
-
* which is why this is not just a wildcard.
|
|
11
|
+
* `_exists_:field` — the field is present, whatever its type (text, number, date, boolean, array, object). Like
|
|
12
|
+
* MongoDB's `$exists`, a field holding `null`, `''` or `[]` exists too. `type` is ignored (kept for older calls).
|
|
15
13
|
*/
|
|
16
14
|
exists: (fieldName: string, type?: ExistsFieldType) => string;
|
|
17
|
-
/**
|
|
18
|
-
* Matches documents where the field is absent: every `exists` clause negated and ANDed (negating the
|
|
19
|
-
* whole group is silently ignored by the server).
|
|
20
|
-
*/
|
|
15
|
+
/** `-_exists_:field` — the field is absent. */
|
|
21
16
|
notExists: (fieldName: string, type?: ExistsFieldType) => string;
|
|
22
17
|
/** Alias for `notExists`. */
|
|
23
18
|
isEmpty: (fieldName: string, type?: ExistsFieldType) => string;
|
|
@@ -36,14 +31,11 @@ export interface MongocampQueryHelper {
|
|
|
36
31
|
/**
|
|
37
32
|
* `field:[from TO to]` — inclusive range.
|
|
38
33
|
*
|
|
39
|
-
* Pass `null` (or `'*'`) for an open end
|
|
40
|
-
* the far bound of the other bound's type: the 64-bit integer limits for numbers, year 0001 / 9999 for
|
|
41
|
-
* dates. Both ends open means "has a value" and returns `exists(field)`. An open end next to a *text*
|
|
42
|
-
* bound can't be expressed and still becomes `*`, which the server rejects.
|
|
34
|
+
* Pass `null` (or `'*'`) for an open end (`[x TO *]`); both ends open is `exists(field)`.
|
|
43
35
|
*
|
|
44
|
-
* A date without a time is
|
|
45
|
-
*
|
|
46
|
-
*
|
|
36
|
+
* A date without a time is midnight UTC for the server, so as the **upper** bound it is widened to the end of that day
|
|
37
|
+
* (`T23:59:59.999Z`) — "up to 2024-06-15" includes the 15th. Characters that would break out of the range (brackets,
|
|
38
|
+
* quotes, whitespace…) in a bound are escaped.
|
|
47
39
|
*/
|
|
48
40
|
inRange: (fieldName: string, from: QueryValue, to: QueryValue) => string;
|
|
49
41
|
/**
|
|
@@ -105,14 +97,19 @@ export interface MongocampQueryHelper {
|
|
|
105
97
|
/**
|
|
106
98
|
* `_id:"<hex>"` — the document with this id. The id must be a 24-character hex ObjectId (any case); anything else
|
|
107
99
|
* **throws** a `TypeError` instead of returning `''`, because "no filter" would match every document. (A wildcard on
|
|
108
|
-
* `_id` matches nothing on the server, so there is no `like` for ids.)
|
|
100
|
+
* `_id` matches nothing on the server, so there is no `like` for ids.) Takes the id as text or as a relaxed read returns
|
|
101
|
+
* it, `{ $oid }`.
|
|
109
102
|
*/
|
|
110
|
-
byId: (id: string
|
|
103
|
+
byId: (id: string | {
|
|
104
|
+
$oid: string;
|
|
105
|
+
}) => string;
|
|
111
106
|
/**
|
|
112
107
|
* `_id:("a" OR "b")` — any of these documents. Every id must be a 24-character hex ObjectId or it throws, like `byId`.
|
|
113
108
|
* An empty array returns `''` (no clause), as `inClause` does.
|
|
114
109
|
*/
|
|
115
|
-
byIds: (ids: string
|
|
110
|
+
byIds: (ids: Array<string | {
|
|
111
|
+
$oid: string;
|
|
112
|
+
}>) => string;
|
|
116
113
|
/** `field:true` — a boolean field that is true. A document without the field does not match. */
|
|
117
114
|
isTrue: (fieldName: string) => string;
|
|
118
115
|
/** `field:false` — a boolean field that is false. A document without the field does not match. */
|
|
@@ -123,32 +120,25 @@ export interface MongocampQueryHelper {
|
|
|
123
120
|
*/
|
|
124
121
|
arrayContains: (fieldName: string, value: QueryValue) => string;
|
|
125
122
|
/**
|
|
126
|
-
*
|
|
127
|
-
* `
|
|
128
|
-
* arrays of *text* (verified: `nums:*` matched no array of numbers). Pass `type` when you know the element type for the
|
|
129
|
-
* shorter clause. Arrays of booleans and of objects are not covered (nothing matches them).
|
|
123
|
+
* `field.0:*` — the field is an array with at least one element, of any type (an empty array and a missing field do
|
|
124
|
+
* not match). `type` is ignored (kept for older calls).
|
|
130
125
|
*/
|
|
131
126
|
hasItems: (fieldName: string, type?: ExistsFieldType) => string;
|
|
132
127
|
/**
|
|
133
|
-
* The whole UTC day `YYYY-MM-DD`: `field:[YYYY-MM-
|
|
134
|
-
*
|
|
135
|
-
* real calendar date.
|
|
128
|
+
* The whole UTC day `YYYY-MM-DD`: `field:[YYYY-MM-DD TO YYYY-MM-DDT23:59:59.999Z]` (a bare date is midnight, so the upper
|
|
129
|
+
* bound is the end of the day). Throws a `TypeError` for anything that is not a real calendar date.
|
|
136
130
|
*/
|
|
137
131
|
onDay: (fieldName: string, day: string) => string;
|
|
138
132
|
/** `-field:[the whole UTC day]` — everything except that day (documents without the field included). */
|
|
139
133
|
notOnDay: (fieldName: string, day: string) => string;
|
|
140
134
|
/**
|
|
141
|
-
* The negation of any expression
|
|
142
|
-
*
|
|
143
|
-
* De Morgan's law as `((-A) OR (-B))` — each negated clause in its own parentheses, which the server needs — and a
|
|
144
|
-
* negated `OR` group as `((-A) AND (-B))`, recursively. A single clause becomes `-clause` (and `-clause` becomes
|
|
145
|
-
* `clause`). Returns `''` for an empty expression. Throws `UnsupportedExpressionError` for text it cannot read
|
|
146
|
-
* (`NOT …`, `AND`/`OR` mixed without parentheses) rather than guessing.
|
|
135
|
+
* The negation of any expression: `-(expression)` — server 2.0 follows Lucene, so `-(A AND B)` is "not both". A single
|
|
136
|
+
* clause becomes `-clause` and `-clause` becomes `clause`. Returns `''` for an empty expression.
|
|
147
137
|
*/
|
|
148
138
|
not: (queryPart: string | null | undefined) => string;
|
|
149
|
-
/** The negation of "all of these": `notAnd(a, b)` =
|
|
139
|
+
/** The negation of "all of these": `notAnd(a, b)` = `-(a AND b)`. Empty parts are ignored. */
|
|
150
140
|
notAnd: (...queryParts: (string | null | undefined)[]) => string;
|
|
151
|
-
/** The negation of "any of these": `notOr(a, b)` =
|
|
141
|
+
/** The negation of "any of these": `notOr(a, b)` = `-(a OR b)`. Empty parts are ignored. */
|
|
152
142
|
notOr: (...queryParts: (string | null | undefined)[]) => string;
|
|
153
143
|
}
|
|
154
144
|
export declare function useMongocampQuery(): MongocampQueryHelper;
|
|
@@ -1,17 +1,9 @@
|
|
|
1
1
|
import { escapeFieldName } from "../utils/escapeFieldName.js";
|
|
2
2
|
import { isIsoDateTimeString } from "../utils/isoDate.js";
|
|
3
3
|
import { isObjectIdHex } from "../utils/objectId.js";
|
|
4
|
-
import { parseLuceneExpression } from "../utils/luceneExpression.js";
|
|
5
4
|
import { useMongocampQueryBuilder } from "./useMongocampQueryBuilder.js";
|
|
6
|
-
|
|
7
|
-
const DATE_BOUNDS = { from: "0001-01-01T00:00:00Z", to: "9999-12-31T23:59:59.999Z" };
|
|
8
|
-
const PLAIN_NUMBER_REGEX = /^-?(?:\d+(?:\.\d+)?|\.\d+)$/;
|
|
5
|
+
import { idOf } from "../utils/relaxedValues.js";
|
|
9
6
|
const DATE_ONLY_REGEX = /^\d{4}-\d{2}-\d{2}$/;
|
|
10
|
-
function boundKind(value) {
|
|
11
|
-
if (PLAIN_NUMBER_REGEX.test(value)) return "number";
|
|
12
|
-
if (isIsoDateTimeString(value)) return "date";
|
|
13
|
-
return "other";
|
|
14
|
-
}
|
|
15
7
|
function boundText(value) {
|
|
16
8
|
if (value == null) return null;
|
|
17
9
|
const text = value.toString().trim();
|
|
@@ -20,33 +12,48 @@ function boundText(value) {
|
|
|
20
12
|
function escapeBound(value) {
|
|
21
13
|
return value.replace(/[\s[\]{}()"\\^~!&|]/g, "\\$&");
|
|
22
14
|
}
|
|
23
|
-
function
|
|
24
|
-
return DATE_ONLY_REGEX.test(value) ? `${value}
|
|
15
|
+
function endOfDay(value) {
|
|
16
|
+
return DATE_ONLY_REGEX.test(value) && isIsoDateTimeString(value) ? `${value}T23:59:59.999Z` : value;
|
|
17
|
+
}
|
|
18
|
+
function isSingleTerm(text) {
|
|
19
|
+
if (text.startsWith("(") || text.startsWith("-(")) return false;
|
|
20
|
+
let quoted = false;
|
|
21
|
+
let depth = 0;
|
|
22
|
+
for (let i = 0; i < text.length; i++) {
|
|
23
|
+
const char = text[i];
|
|
24
|
+
if (char === "\\") i++;
|
|
25
|
+
else if (char === '"') quoted = !quoted;
|
|
26
|
+
else if (quoted) continue;
|
|
27
|
+
else if (char === "[" || char === "{" || char === "(") depth++;
|
|
28
|
+
else if (char === "]" || char === "}" || char === ")") depth--;
|
|
29
|
+
else if (depth === 0 && /\s/.test(char)) return false;
|
|
30
|
+
}
|
|
31
|
+
return true;
|
|
25
32
|
}
|
|
26
|
-
function
|
|
27
|
-
if (
|
|
28
|
-
|
|
29
|
-
|
|
33
|
+
function isWrappedGroup(text) {
|
|
34
|
+
if (!text.startsWith("(") || !text.endsWith(")")) return false;
|
|
35
|
+
let quoted = false;
|
|
36
|
+
let depth = 0;
|
|
37
|
+
for (let i = 0; i < text.length; i++) {
|
|
38
|
+
const char = text[i];
|
|
39
|
+
if (char === "\\") i++;
|
|
40
|
+
else if (char === '"') quoted = !quoted;
|
|
41
|
+
else if (quoted) continue;
|
|
42
|
+
else if (char === "(") depth++;
|
|
43
|
+
else if (char === ")" && --depth === 0 && i < text.length - 1) return false;
|
|
44
|
+
}
|
|
45
|
+
return depth === 0;
|
|
30
46
|
}
|
|
31
47
|
export function useMongocampQuery() {
|
|
32
48
|
const { q } = useMongocampQueryBuilder();
|
|
33
49
|
function fieldTerm(fieldName, value) {
|
|
34
50
|
return q.field(escapeFieldName(fieldName), value);
|
|
35
51
|
}
|
|
36
|
-
function
|
|
37
|
-
|
|
38
|
-
if (!type || type === "text") clauses.push(fieldTerm(fieldName, "*"));
|
|
39
|
-
if (!type || type === "number") clauses.push(fieldTerm(fieldName, q.range(NUMBER_BOUNDS.from, NUMBER_BOUNDS.to)));
|
|
40
|
-
if (!type || type === "date") clauses.push(fieldTerm(fieldName, q.range(DATE_BOUNDS.from, DATE_BOUNDS.to)));
|
|
41
|
-
return clauses;
|
|
42
|
-
}
|
|
43
|
-
function exists(fieldName, type) {
|
|
44
|
-
const clauses = existsClauses(fieldName, type);
|
|
45
|
-
return clauses.length === 1 ? clauses[0] : `(${clauses.join(" OR ")})`;
|
|
52
|
+
function exists(fieldName, _type) {
|
|
53
|
+
return q.field("_exists_", escapeFieldName(fieldName));
|
|
46
54
|
}
|
|
47
55
|
function notExists(fieldName, type) {
|
|
48
|
-
|
|
49
|
-
return clauses.length === 1 ? clauses[0] : and(...clauses);
|
|
56
|
+
return `-${exists(fieldName, type)}`;
|
|
50
57
|
}
|
|
51
58
|
function isEmpty(fieldName, type) {
|
|
52
59
|
return notExists(fieldName, type);
|
|
@@ -66,9 +73,8 @@ export function useMongocampQuery() {
|
|
|
66
73
|
const lower = boundText(from);
|
|
67
74
|
const upper = boundText(to);
|
|
68
75
|
if (lower === null && upper === null) return exists(fieldName);
|
|
69
|
-
const
|
|
70
|
-
const
|
|
71
|
-
const toStr = upper === null ? farBound(kind, "to") : escapeBound(boundKind(upper) === "date" ? widenDate(upper, "to") : upper);
|
|
76
|
+
const fromStr = lower === null ? "*" : escapeBound(lower);
|
|
77
|
+
const toStr = upper === null ? "*" : escapeBound(endOfDay(upper));
|
|
72
78
|
return fieldTerm(fieldName, q.range(fromStr, toStr));
|
|
73
79
|
}
|
|
74
80
|
function notInRange(fieldName, from, to) {
|
|
@@ -134,10 +140,10 @@ export function useMongocampQuery() {
|
|
|
134
140
|
return id;
|
|
135
141
|
}
|
|
136
142
|
function byId(id) {
|
|
137
|
-
return equals("_id", requireObjectId(id, "byId"));
|
|
143
|
+
return equals("_id", requireObjectId(idOf(id) ?? id, "byId"));
|
|
138
144
|
}
|
|
139
145
|
function byIds(ids) {
|
|
140
|
-
return inClause("_id", ids.map((id) => requireObjectId(id, "byIds")));
|
|
146
|
+
return inClause("_id", ids.map((id) => requireObjectId(idOf(id) ?? id, "byIds")));
|
|
141
147
|
}
|
|
142
148
|
function isTrue(fieldName) {
|
|
143
149
|
return fieldTerm(fieldName, "true");
|
|
@@ -149,8 +155,8 @@ export function useMongocampQuery() {
|
|
|
149
155
|
if (value == null || value.toString().length === 0) return "";
|
|
150
156
|
return inClause(fieldName, [value]);
|
|
151
157
|
}
|
|
152
|
-
function hasItems(fieldName,
|
|
153
|
-
return
|
|
158
|
+
function hasItems(fieldName, _type) {
|
|
159
|
+
return q.field(`${escapeFieldName(fieldName)}.0`, "*");
|
|
154
160
|
}
|
|
155
161
|
function requireDay(day, helper) {
|
|
156
162
|
const parsed = DATE_ONLY_REGEX.test(day) ? /* @__PURE__ */ new Date(`${day}T00:00:00Z`) : null;
|
|
@@ -165,21 +171,12 @@ export function useMongocampQuery() {
|
|
|
165
171
|
function notOnDay(fieldName, day) {
|
|
166
172
|
return `-${onDay(fieldName, requireDay(day, "notOnDay"))}`;
|
|
167
173
|
}
|
|
168
|
-
function render(node) {
|
|
169
|
-
if (node.kind === "clause") return node.text;
|
|
170
|
-
if (node.kind === "not") return negate(node.node);
|
|
171
|
-
const parts = node.parts.map(render);
|
|
172
|
-
return node.kind === "and" ? and(...parts) : or(...parts);
|
|
173
|
-
}
|
|
174
|
-
function negate(node) {
|
|
175
|
-
if (node.kind === "clause") return node.text.startsWith("-") ? node.text.slice(1) : `-${node.text}`;
|
|
176
|
-
if (node.kind === "not") return render(node.node);
|
|
177
|
-
const negated = node.parts.map(negate);
|
|
178
|
-
return node.kind === "and" ? or(...negated) : and(...negated);
|
|
179
|
-
}
|
|
180
174
|
function not(queryPart) {
|
|
181
|
-
const
|
|
182
|
-
|
|
175
|
+
const text = (queryPart ?? "").trim();
|
|
176
|
+
if (text === "" || text === "()") return "";
|
|
177
|
+
if (isSingleTerm(text)) return text.startsWith("-") ? text.slice(1) : `-${text}`;
|
|
178
|
+
if (text.startsWith("-") && isWrappedGroup(text.slice(1))) return text.slice(1);
|
|
179
|
+
return isWrappedGroup(text) ? `-${text}` : `-(${text})`;
|
|
183
180
|
}
|
|
184
181
|
function notAnd(...queryParts) {
|
|
185
182
|
return not(and(...queryParts));
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isTextValue, leafWrapperText } from "../utils/relaxedValues.js";
|
|
1
2
|
const DATE_TIME_STRING_REGEX = /^\d{4}-\d{2}-\d{2}(?:[T ]\d{2}:\d{2}(?::\d{2}(?:\.\d+)?)?(?:Z|[+-]\d{2}:?\d{2})?)?$/;
|
|
2
3
|
function isDateTimeString(value) {
|
|
3
4
|
return DATE_TIME_STRING_REGEX.test(value);
|
|
@@ -12,6 +13,7 @@ function detectValueType(value) {
|
|
|
12
13
|
if (typeof value === "string") return isDateTimeString(value) ? "date-time" : "string";
|
|
13
14
|
if (Array.isArray(value)) return "array";
|
|
14
15
|
if (isPlainObject(value)) {
|
|
16
|
+
if (isTextValue(value) || leafWrapperText(value) !== void 0) return "string";
|
|
15
17
|
if ("$date" in value) return "date-time";
|
|
16
18
|
if ("$oid" in value) return "string";
|
|
17
19
|
if ("$numberInt" in value || "$numberLong" in value || "$numberDouble" in value || "$numberDecimal" in value) return "number";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ComputedRef } from 'vue';
|
|
2
|
+
import type { MongocampUiTheme } from '../utils/uiTheme.js';
|
|
3
|
+
/**
|
|
4
|
+
* The module's look from `app.config.ts` (key `ui` under `nuxtUiMongocamp`), merged over the defaults and checked. Reactive:
|
|
5
|
+
* `updateAppConfig()` restyles the components without a reload. Components spread a role onto Nuxt UI
|
|
6
|
+
* components (`v-bind="ui.iconButton"`, `h(UButton, { ...ui.value.iconButton, color: 'error' })`).
|
|
7
|
+
*/
|
|
8
|
+
export declare function useMongocampUi(): ComputedRef<MongocampUiTheme>;
|
|
@@ -200,7 +200,8 @@
|
|
|
200
200
|
"chartsPick": "Wählen Sie ein Feld, um seine Verteilung zu sehen",
|
|
201
201
|
"presenceSummary": "Diagramm Feldhäufigkeit",
|
|
202
202
|
"presenceLabel": "Anteil der Dokumente mit dem Feld (%)",
|
|
203
|
-
"presenceDescription": "Die {count} Felder, die in den wenigsten Dokumenten vorkommen"
|
|
203
|
+
"presenceDescription": "Die {count} Felder, die in den wenigsten Dokumenten vorkommen",
|
|
204
|
+
"loadFailedTitle": "{name} konnte nicht geladen werden"
|
|
204
205
|
},
|
|
205
206
|
"collectionData": {
|
|
206
207
|
"filterPlaceholder": "Zeilen filtern...",
|
|
@@ -256,7 +257,8 @@
|
|
|
256
257
|
"chartScopeAll": "Alle {count} Dokumente der Sammlung. | Alle {count} Dokumente der Sammlung.",
|
|
257
258
|
"chartScopeFiltered": "Das {count} Dokument, das zum aktuellen Filter passt. | Die {count} Dokumente, die zum aktuellen Filter passen.",
|
|
258
259
|
"chartTooLong": "Der aktuelle Filter ist zu lang für eine Diagrammanfrage. Bitte zuerst einschränken.",
|
|
259
|
-
"aggregateTooltip": "Die passenden Dokumente aggregieren"
|
|
260
|
+
"aggregateTooltip": "Die passenden Dokumente aggregieren",
|
|
261
|
+
"sensitiveFieldsNote": "Passwörter und API-Keys sind ausgeblendet, und die Collection ist hier schreibgeschützt – Benutzer werden auf der Benutzerseite verwaltet."
|
|
260
262
|
},
|
|
261
263
|
"bucketFiles": {
|
|
262
264
|
"filterPlaceholder": "Nach Dateiname filtern...",
|
|
@@ -399,7 +401,6 @@
|
|
|
399
401
|
"importMaxBytes": "Größter Import",
|
|
400
402
|
"grantDeniedStatus": "Status bei fehlender Berechtigung",
|
|
401
403
|
"deniedStages": "Abgelehnte Aggregations-Operatoren",
|
|
402
|
-
"olderServer": "Dieser Server hat keine Capabilities-Route (älter als 1.9.0).",
|
|
403
404
|
"partFailed": "{part} konnte nicht geladen werden.",
|
|
404
405
|
"partStats": "Die Datenbanklast",
|
|
405
406
|
"partCapabilities": "Die Fähigkeiten",
|
|
@@ -443,6 +444,7 @@
|
|
|
443
444
|
"network": "Der Server ist nicht erreichbar oder deine Sitzung ist abgelaufen. Erneut versuchen oder neu anmelden.",
|
|
444
445
|
"unauthorized": "Deine Sitzung ist abgelaufen. Bitte melde dich erneut an.",
|
|
445
446
|
"forbidden": "Dafür fehlt dir die Berechtigung.",
|
|
447
|
+
"notFound": "Es existiert nicht (mehr). Vielleicht wurde es gelöscht oder umbenannt.",
|
|
446
448
|
"notAllowed": "Der Server erlaubt diese Anfrage nicht.",
|
|
447
449
|
"notAllowedOperator": "Der Server erlaubt den Operator {operator} nicht.",
|
|
448
450
|
"serverMessage": "Meldung des Servers: {message}",
|
|
@@ -615,12 +617,14 @@
|
|
|
615
617
|
"importFile": "Datei importieren",
|
|
616
618
|
"ndjsonImporting": "Der Server liest die Datei …",
|
|
617
619
|
"ndjsonFailed": "{failed} von {read} Zeilen konnten nicht importiert werden",
|
|
620
|
+
"ndjsonAborted": "Nichts wurde importiert – der Server hat nichts aus der Datei behalten. Ursache beheben und die ganze Datei erneut senden.",
|
|
618
621
|
"ndjsonLine": "Zeile {line}: {reason}",
|
|
619
622
|
"ndjsonMoreErrors": "Nur die ersten fehlgeschlagenen Zeilen werden genannt."
|
|
620
623
|
},
|
|
621
624
|
"aggregation": {
|
|
622
625
|
"errors": {
|
|
623
626
|
"forbidden": "Diese Pipeline verwendet {operator}, was hier nicht erlaubt ist.",
|
|
627
|
+
"sensitiveField": "Diese Pipeline liest {field}, ein ausgeblendetes Feld der MongoCamp-Benutzer (Passwort-Hash oder API-Key).",
|
|
624
628
|
"retryable": "Die Anfrage wurde auf dem Weg zum Server blockiert. Bitte erneut versuchen.",
|
|
625
629
|
"unavailable": "Der Server hat diese Anfrage nicht beantwortet. Versuche es erneut.",
|
|
626
630
|
"filterTooLong": "Der Filter ist zu lang für ein Diagramm (höchstens {max} Zeichen). Bitte zuerst einschränken."
|
|
@@ -774,7 +778,9 @@
|
|
|
774
778
|
"wordFilter": "Filter",
|
|
775
779
|
"wordSort": "Sortierung",
|
|
776
780
|
"wordFields": "Felder",
|
|
777
|
-
"customFilter": "Filtertext: {query}"
|
|
781
|
+
"customFilter": "Filtertext: {query}",
|
|
782
|
+
"matchCase": "Groß-/Kleinschreibung beachten",
|
|
783
|
+
"matchCaseHint": "Aus: Suche und Platzhalter im Filter ignorieren Groß- und Kleinschreibung. An: sie müssen genau passen, was bei großen Collections schneller ist."
|
|
778
784
|
},
|
|
779
785
|
"indexes": {
|
|
780
786
|
"columnUsage": "Nutzung",
|
|
@@ -876,6 +882,8 @@
|
|
|
876
882
|
"scopeFiltered": "Die Dokumente von {collection}, die zum aktuellen Filter passen",
|
|
877
883
|
"count": "{count} Dokument | {count} Dokumente",
|
|
878
884
|
"formatLabel": "Format",
|
|
885
|
+
"exactTypes": "Genaue Zahlentypen behalten",
|
|
886
|
+
"exactTypesHint": "Größere Datei; ein erneuter Import behält ganze Zahlen genau als Int32 bzw. Int64. Ohne diese Option ist die Datei leichter lesbar und ein erneuter Import speichert ganze Zahlen als Int64.",
|
|
879
887
|
"formatJson": "JSON (ein Array)",
|
|
880
888
|
"formatNdjson": "NDJSON (ein Dokument pro Zeile)",
|
|
881
889
|
"formatCsv": "CSV",
|
|
@@ -200,7 +200,8 @@
|
|
|
200
200
|
"chartsPick": "Choose a field to see its distribution",
|
|
201
201
|
"presenceSummary": "Field presence chart",
|
|
202
202
|
"presenceLabel": "Share of documents that have the field (%)",
|
|
203
|
-
"presenceDescription": "The {count} fields found in the fewest documents"
|
|
203
|
+
"presenceDescription": "The {count} fields found in the fewest documents",
|
|
204
|
+
"loadFailedTitle": "Could not load {name}"
|
|
204
205
|
},
|
|
205
206
|
"collectionData": {
|
|
206
207
|
"filterPlaceholder": "Filter rows...",
|
|
@@ -256,7 +257,8 @@
|
|
|
256
257
|
"chartScopeAll": "All {count} document of the collection. | All {count} documents of the collection.",
|
|
257
258
|
"chartScopeFiltered": "The {count} document that match the current filter. | The {count} documents that match the current filter.",
|
|
258
259
|
"chartTooLong": "The current filter is too long to send with a chart request. Narrow it first.",
|
|
259
|
-
"aggregateTooltip": "Aggregate the matching documents"
|
|
260
|
+
"aggregateTooltip": "Aggregate the matching documents",
|
|
261
|
+
"sensitiveFieldsNote": "Passwords and API keys are hidden, and the collection is read-only here — manage users on the users page."
|
|
260
262
|
},
|
|
261
263
|
"bucketFiles": {
|
|
262
264
|
"filterPlaceholder": "Filter by filename...",
|
|
@@ -399,7 +401,6 @@
|
|
|
399
401
|
"importMaxBytes": "Largest import",
|
|
400
402
|
"grantDeniedStatus": "Status for a missing grant",
|
|
401
403
|
"deniedStages": "Refused aggregation operators",
|
|
402
|
-
"olderServer": "This server has no capabilities route (older than 1.9.0).",
|
|
403
404
|
"partFailed": "{part} could not be loaded.",
|
|
404
405
|
"partStats": "The database load",
|
|
405
406
|
"partCapabilities": "The capabilities",
|
|
@@ -443,6 +444,7 @@
|
|
|
443
444
|
"network": "The server could not be reached, or your session has expired. Try again, or log in again.",
|
|
444
445
|
"unauthorized": "Your session has expired. Please log in again.",
|
|
445
446
|
"forbidden": "You do not have permission to do this.",
|
|
447
|
+
"notFound": "It does not exist (any more). It may have been deleted or renamed.",
|
|
446
448
|
"notAllowed": "The server does not allow this request.",
|
|
447
449
|
"notAllowedOperator": "The server does not allow the operator {operator}.",
|
|
448
450
|
"serverMessage": "Server message: {message}",
|
|
@@ -615,12 +617,14 @@
|
|
|
615
617
|
"importFile": "Import file",
|
|
616
618
|
"ndjsonImporting": "The server is reading the file…",
|
|
617
619
|
"ndjsonFailed": "{failed} of {read} lines could not be imported",
|
|
620
|
+
"ndjsonAborted": "Nothing was imported — the server kept none of the file. Fix the cause and send the whole file again.",
|
|
618
621
|
"ndjsonLine": "Line {line}: {reason}",
|
|
619
622
|
"ndjsonMoreErrors": "Only the first failed lines are named."
|
|
620
623
|
},
|
|
621
624
|
"aggregation": {
|
|
622
625
|
"errors": {
|
|
623
626
|
"forbidden": "This pipeline uses {operator}, which is not allowed here.",
|
|
627
|
+
"sensitiveField": "This pipeline reads {field}, a hidden field of MongoCamp's users (password hash or API key).",
|
|
624
628
|
"retryable": "The request was blocked on its way to the server. Try again.",
|
|
625
629
|
"unavailable": "The server did not answer this request. Try again.",
|
|
626
630
|
"filterTooLong": "The filter is too long to chart ({max} characters at most). Narrow it first."
|
|
@@ -774,7 +778,9 @@
|
|
|
774
778
|
"wordFilter": "Filter",
|
|
775
779
|
"wordSort": "Sort",
|
|
776
780
|
"wordFields": "Fields",
|
|
777
|
-
"customFilter": "Filter text: {query}"
|
|
781
|
+
"customFilter": "Filter text: {query}",
|
|
782
|
+
"matchCase": "Match case",
|
|
783
|
+
"matchCaseHint": "Off: the search and filter wildcards ignore upper and lower case. On: they match the case exactly, which is faster on large collections."
|
|
778
784
|
},
|
|
779
785
|
"indexes": {
|
|
780
786
|
"columnUsage": "Usage",
|
|
@@ -876,6 +882,8 @@
|
|
|
876
882
|
"scopeFiltered": "The documents of {collection} that match the current filter",
|
|
877
883
|
"count": "{count} document | {count} documents",
|
|
878
884
|
"formatLabel": "Format",
|
|
885
|
+
"exactTypes": "Keep exact number types",
|
|
886
|
+
"exactTypesHint": "Larger file; a re-import keeps whole numbers as Int32 and Int64 exactly as stored. Without it the file is easier to read and a re-import stores whole numbers as Int64.",
|
|
879
887
|
"formatJson": "JSON (one array)",
|
|
880
888
|
"formatNdjson": "NDJSON (one document per line)",
|
|
881
889
|
"formatCsv": "CSV",
|
package/dist/runtime/plugin.js
CHANGED
|
@@ -7,6 +7,7 @@ import { useMongocampConnection } from "./composables/useMongocampConnection.js"
|
|
|
7
7
|
import { CONNECTION_CHECK_TIMEOUT_MS, CONNECTION_RETRY_MAX_MS, CONNECTION_RETRY_MS } from "./utils/connection.js";
|
|
8
8
|
import { nextDelay } from "./utils/autoRefresh.js";
|
|
9
9
|
import { createVerifyCache, runSessionGuard } from "./utils/sessionGuard.js";
|
|
10
|
+
import { compactProfile } from "./utils/compactSession.js";
|
|
10
11
|
export default defineNuxtPlugin(async (_nuxtApp) => {
|
|
11
12
|
const { systemApi } = useMongocampClientApi();
|
|
12
13
|
const config = useRuntimeConfig();
|
|
@@ -28,6 +29,13 @@ export default defineNuxtPlugin(async (_nuxtApp) => {
|
|
|
28
29
|
}
|
|
29
30
|
}, { lazy: true, server: false }) : await useAsyncData("version", () => systemApi.version());
|
|
30
31
|
if (offline && import.meta.client) watchConnection();
|
|
32
|
+
if (config.public.nuxtUiMongocampOptions.compactSession && import.meta.client) {
|
|
33
|
+
const storage = useMongocampStorage();
|
|
34
|
+
watch(() => storage.value?.profile, (profile) => {
|
|
35
|
+
const compact = compactProfile(profile);
|
|
36
|
+
if (compact) storage.value.profile = compact;
|
|
37
|
+
}, { immediate: true, flush: "sync" });
|
|
38
|
+
}
|
|
31
39
|
if (sessionGuard && !useServerProxy) {
|
|
32
40
|
addRouteMiddleware("session-guard", async (to) => {
|
|
33
41
|
const { checkExpiry, invalidateSession, verify } = useMongocampSession();
|
|
@@ -3,3 +3,4 @@ export { connectionUsage, formatCount, formatUptime } from './utils/serverInfo.j
|
|
|
3
3
|
export { groupCollectionNames } from './utils/collectionNames.js';
|
|
4
4
|
export { bucketNameOf, isBucketMemberCollection, isProtectedCollection } from './utils/collectionProtection.js';
|
|
5
5
|
export { isNetworkFailure } from './utils/connection.js';
|
|
6
|
+
export { idOf } from './utils/relaxedValues.js';
|