@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.
Files changed (130) hide show
  1. package/README.md +5 -5
  2. package/dist/module.d.mts +17 -0
  3. package/dist/module.json +1 -1
  4. package/dist/module.mjs +4 -0
  5. package/dist/runtime/components/MongocampAccount.vue +12 -14
  6. package/dist/runtime/components/MongocampAggregationBuilder.d.vue.ts +1 -0
  7. package/dist/runtime/components/MongocampAggregationBuilder.vue +32 -45
  8. package/dist/runtime/components/MongocampAggregationBuilder.vue.d.ts +1 -0
  9. package/dist/runtime/components/MongocampAggregationChart.vue +7 -5
  10. package/dist/runtime/components/MongocampAggregationStagePreview.d.vue.ts +1 -0
  11. package/dist/runtime/components/MongocampAggregationStagePreview.vue +5 -3
  12. package/dist/runtime/components/MongocampAggregationStagePreview.vue.d.ts +1 -0
  13. package/dist/runtime/components/MongocampBucketFiles.vue +29 -40
  14. package/dist/runtime/components/MongocampBulkDelete.vue +8 -9
  15. package/dist/runtime/components/MongocampBulkEdit.vue +5 -4
  16. package/dist/runtime/components/MongocampChart.vue +1 -1
  17. package/dist/runtime/components/MongocampCollectionCharts.d.vue.ts +1 -0
  18. package/dist/runtime/components/MongocampCollectionCharts.vue +10 -7
  19. package/dist/runtime/components/MongocampCollectionCharts.vue.d.ts +1 -0
  20. package/dist/runtime/components/MongocampCollectionCopy.d.vue.ts +1 -0
  21. package/dist/runtime/components/MongocampCollectionCopy.vue +11 -9
  22. package/dist/runtime/components/MongocampCollectionCopy.vue.d.ts +1 -0
  23. package/dist/runtime/components/MongocampCollectionData.vue +97 -87
  24. package/dist/runtime/components/MongocampCollectionInfos.vue +34 -24
  25. package/dist/runtime/components/MongocampCollectionRename.vue +5 -4
  26. package/dist/runtime/components/MongocampCollections.vue +24 -33
  27. package/dist/runtime/components/MongocampCommandPalette.vue +3 -1
  28. package/dist/runtime/components/MongocampConfirmByName.vue +5 -4
  29. package/dist/runtime/components/MongocampDashboard.vue +5 -3
  30. package/dist/runtime/components/MongocampDatabases.vue +14 -8
  31. package/dist/runtime/components/MongocampDocumentCompare.vue +6 -4
  32. package/dist/runtime/components/MongocampDocumentView.vue +12 -9
  33. package/dist/runtime/components/MongocampEmptyState.vue +4 -1
  34. package/dist/runtime/components/MongocampErrorAlert.vue +8 -7
  35. package/dist/runtime/components/MongocampExportAll.d.vue.ts +1 -0
  36. package/dist/runtime/components/MongocampExportAll.vue +19 -7
  37. package/dist/runtime/components/MongocampExportAll.vue.d.ts +1 -0
  38. package/dist/runtime/components/MongocampFilePreview.vue +7 -6
  39. package/dist/runtime/components/MongocampFilterBuilder.vue +12 -16
  40. package/dist/runtime/components/MongocampGrantList.vue +6 -2
  41. package/dist/runtime/components/MongocampImport.vue +32 -28
  42. package/dist/runtime/components/MongocampIndexes.vue +21 -19
  43. package/dist/runtime/components/MongocampJobs.vue +20 -20
  44. package/dist/runtime/components/MongocampLogin.vue +2 -1
  45. package/dist/runtime/components/MongocampPermissionMatrix.vue +14 -11
  46. package/dist/runtime/components/MongocampQueryBar.vue +33 -32
  47. package/dist/runtime/components/MongocampRoleGrants.vue +21 -17
  48. package/dist/runtime/components/MongocampRoles.vue +28 -32
  49. package/dist/runtime/components/MongocampServerInfo.vue +17 -25
  50. package/dist/runtime/components/MongocampServerOverview.vue +16 -12
  51. package/dist/runtime/components/MongocampServerStatus.vue +9 -3
  52. package/dist/runtime/components/MongocampSettings.vue +15 -11
  53. package/dist/runtime/components/MongocampUserAccess.vue +11 -6
  54. package/dist/runtime/components/MongocampUsers.vue +32 -35
  55. package/dist/runtime/components/MongocampVersion.d.vue.ts +1 -1
  56. package/dist/runtime/components/MongocampVersion.vue +20 -11
  57. package/dist/runtime/components/MongocampVersion.vue.d.ts +1 -1
  58. package/dist/runtime/composables/useMongocampAdmin.js +6 -5
  59. package/dist/runtime/composables/useMongocampAggregation.d.ts +10 -1
  60. package/dist/runtime/composables/useMongocampAggregation.js +17 -5
  61. package/dist/runtime/composables/useMongocampBucket.d.ts +4 -0
  62. package/dist/runtime/composables/useMongocampBucket.js +7 -6
  63. package/dist/runtime/composables/useMongocampBulkByFilter.d.ts +6 -4
  64. package/dist/runtime/composables/useMongocampBulkByFilter.js +11 -6
  65. package/dist/runtime/composables/useMongocampCollectionCopy.d.ts +3 -1
  66. package/dist/runtime/composables/useMongocampCollectionCopy.js +4 -2
  67. package/dist/runtime/composables/useMongocampCollectionStats.js +2 -4
  68. package/dist/runtime/composables/useMongocampError.d.ts +1 -1
  69. package/dist/runtime/composables/useMongocampError.js +4 -1
  70. package/dist/runtime/composables/useMongocampExportAll.d.ts +10 -1
  71. package/dist/runtime/composables/useMongocampExportAll.js +4 -1
  72. package/dist/runtime/composables/useMongocampFetchAll.d.ts +11 -5
  73. package/dist/runtime/composables/useMongocampFetchAll.js +8 -8
  74. package/dist/runtime/composables/useMongocampJobs.js +3 -2
  75. package/dist/runtime/composables/useMongocampQuery.d.ts +26 -36
  76. package/dist/runtime/composables/useMongocampQuery.js +45 -48
  77. package/dist/runtime/composables/useMongocampSchema.js +2 -0
  78. package/dist/runtime/composables/useMongocampUi.d.ts +8 -0
  79. package/dist/runtime/composables/useMongocampUi.js +7 -0
  80. package/dist/runtime/locales/de.json +12 -4
  81. package/dist/runtime/locales/en.json +12 -4
  82. package/dist/runtime/plugin.js +8 -0
  83. package/dist/runtime/publicUtils.d.ts +1 -0
  84. package/dist/runtime/publicUtils.js +1 -0
  85. package/dist/runtime/server/handlers/mongocampProxy.d.ts +1 -1
  86. package/dist/runtime/server/handlers/mongocampProxy.js +12 -12
  87. package/dist/runtime/utils/aggregationPipeline.d.ts +2 -1
  88. package/dist/runtime/utils/aggregationPipeline.js +2 -3
  89. package/dist/runtime/utils/caseInsensitive.d.ts +10 -0
  90. package/dist/runtime/utils/caseInsensitive.js +8 -0
  91. package/dist/runtime/utils/collectionStats.d.ts +4 -1
  92. package/dist/runtime/utils/collectionStats.js +2 -2
  93. package/dist/runtime/utils/compactSession.d.ts +13 -0
  94. package/dist/runtime/utils/compactSession.js +12 -0
  95. package/dist/runtime/utils/configRows.d.ts +3 -3
  96. package/dist/runtime/utils/cursorPaging.d.ts +16 -0
  97. package/dist/runtime/utils/cursorPaging.js +17 -0
  98. package/dist/runtime/utils/documentCompare.js +2 -3
  99. package/dist/runtime/utils/documentPaths.d.ts +5 -5
  100. package/dist/runtime/utils/documentPaths.js +9 -2
  101. package/dist/runtime/utils/documentTree.js +3 -0
  102. package/dist/runtime/utils/fileFilter.d.ts +7 -0
  103. package/dist/runtime/utils/fileFilter.js +11 -0
  104. package/dist/runtime/utils/filterBuilder.d.ts +1 -1
  105. package/dist/runtime/utils/filterBuilder.js +5 -11
  106. package/dist/runtime/utils/filterSuggestions.js +1 -1
  107. package/dist/runtime/utils/indexForm.d.ts +7 -0
  108. package/dist/runtime/utils/indexForm.js +9 -0
  109. package/dist/runtime/utils/pagedFetch.d.ts +13 -0
  110. package/dist/runtime/utils/pagedFetch.js +44 -0
  111. package/dist/runtime/utils/queryState.d.ts +5 -0
  112. package/dist/runtime/utils/queryState.js +3 -2
  113. package/dist/runtime/utils/relaxedValues.d.ts +17 -0
  114. package/dist/runtime/utils/relaxedValues.js +51 -0
  115. package/dist/runtime/utils/requestLimits.d.ts +1 -1
  116. package/dist/runtime/utils/requestLimits.js +1 -1
  117. package/dist/runtime/utils/savedQueries.d.ts +2 -0
  118. package/dist/runtime/utils/savedQueries.js +1 -0
  119. package/dist/runtime/utils/schemaAnalysis.d.ts +4 -4
  120. package/dist/runtime/utils/schemaAnalysis.js +2 -2
  121. package/dist/runtime/utils/sensitiveFields.d.ts +20 -0
  122. package/dist/runtime/utils/sensitiveFields.js +63 -0
  123. package/dist/runtime/utils/serverError.d.ts +7 -0
  124. package/dist/runtime/utils/serverError.js +11 -0
  125. package/dist/runtime/utils/serverStatus.d.ts +2 -2
  126. package/dist/runtime/utils/uiTheme.d.ts +65 -0
  127. package/dist/runtime/utils/uiTheme.js +47 -0
  128. package/package.json +22 -16
  129. package/dist/runtime/utils/luceneExpression.d.ts +0 -15
  130. package/dist/runtime/utils/luceneExpression.js +0 -74
@@ -1,10 +1,10 @@
1
1
  import type { SchemaAnalysis } from '@sfxcode/nuxt-mongocamp-server';
2
2
  import type { SampleAnalysis, ValueKind } from './analyzeSamples.js';
3
- /** More documents than this are never analysed in one request (≈ 20 s on the dev server); use a sample instead. */
4
- export declare const FULL_ANALYSIS_MAX_DOCUMENTS = 200000;
5
- /** Time to wait for an analysis of `documents` documents: a fixed allowance plus 0.4 ms each (measured: 0.11 ms), at most 2 minutes. */
3
+ /** More documents than this are never analysed in one request; use a sample instead. */
4
+ export declare const FULL_ANALYSIS_MAX_DOCUMENTS = 1000000;
5
+ /** Time to wait for an analysis of `documents` documents: a fixed allowance plus 0.05 ms each (measured: 0.012 ms), at most 2 minutes. */
6
6
  export declare function analysisTimeoutMs(documents: number): number;
7
- /** What to ask for: the server needs a positive size, and more than the collection holds is the same as all of it. */
7
+ /** What to ask for: the count (every document; more than the collection holds is the same), capped, never 0. */
8
8
  export declare function analysisSampleSize(documents: number): number;
9
9
  export declare function kindOfServerType(serverType: string): ValueKind;
10
10
  /**
@@ -1,7 +1,7 @@
1
1
  import { comparePaths } from "./analyzeSamples.js";
2
- export const FULL_ANALYSIS_MAX_DOCUMENTS = 2e5;
2
+ export const FULL_ANALYSIS_MAX_DOCUMENTS = 1e6;
3
3
  const BASE_TIMEOUT_MS = 15e3;
4
- const MS_PER_DOCUMENT = 0.4;
4
+ const MS_PER_DOCUMENT = 0.05;
5
5
  const MAX_TIMEOUT_MS = 12e4;
6
6
  export function analysisTimeoutMs(documents) {
7
7
  return Math.min(MAX_TIMEOUT_MS, Math.round(BASE_TIMEOUT_MS + Math.max(0, documents) * MS_PER_DOCUMENT));
@@ -0,0 +1,20 @@
1
+ /** The top-level fields of `collection` that are never shown; `[]` for ordinary collections. */
2
+ export declare function sensitiveFieldsOf(collection: string): readonly string[];
3
+ /** A copy of `row` without the sensitive fields of `collection` (the row itself when there are none). */
4
+ export declare function withoutSensitiveFields<T extends Record<string, unknown>>(row: T, collection: string): T;
5
+ interface PipelineStageLike {
6
+ stage: string;
7
+ value: unknown;
8
+ }
9
+ /** The hidden fields a pipeline over `collection` can reach (its own collection and every collection it joins). */
10
+ export declare function sensitiveFieldsOfPipeline(collection: string, pipeline: readonly PipelineStageLike[]): string[];
11
+ export interface SensitiveFieldUse {
12
+ stageIndex: number;
13
+ /** The path as written, e.g. `$password` or `$u.apiKey`. */
14
+ reference: string;
15
+ }
16
+ /** Every string `'$…'` (a field path, not a `'$$variable'`) whose last segment is one of `fields`. */
17
+ export declare function sensitiveFieldReferences(pipeline: readonly PipelineStageLike[], fields: readonly string[]): SensitiveFieldUse[];
18
+ /** A copy of `value` without any key named in `fields`, at any depth. */
19
+ export declare function withoutFieldsDeep<T>(value: T, fields: readonly string[]): T;
20
+ export {};
@@ -0,0 +1,63 @@
1
+ const SENSITIVE_FIELDS = {
2
+ mc_users: ["password", "apiKey"]
3
+ };
4
+ export function sensitiveFieldsOf(collection) {
5
+ return Object.hasOwn(SENSITIVE_FIELDS, collection) ? SENSITIVE_FIELDS[collection] : [];
6
+ }
7
+ export function withoutSensitiveFields(row, collection) {
8
+ const hidden = sensitiveFieldsOf(collection);
9
+ if (hidden.length === 0 || !hidden.some((field) => Object.hasOwn(row, field))) return row;
10
+ return Object.fromEntries(Object.entries(row).filter(([key]) => !hidden.includes(key)));
11
+ }
12
+ function isRecord(value) {
13
+ return typeof value === "object" && value !== null && !Array.isArray(value);
14
+ }
15
+ function joinedCollections(value, into, depth = 0) {
16
+ if (depth > 32) return;
17
+ if (Array.isArray(value)) {
18
+ for (const entry of value) joinedCollections(entry, into, depth + 1);
19
+ return;
20
+ }
21
+ if (!isRecord(value)) return;
22
+ for (const [key, entry] of Object.entries(value)) {
23
+ if (key === "from" && typeof entry === "string") into.add(entry);
24
+ if (key === "$unionWith") {
25
+ if (typeof entry === "string") into.add(entry);
26
+ else if (isRecord(entry) && typeof entry.coll === "string") into.add(entry.coll);
27
+ }
28
+ joinedCollections(entry, into, depth + 1);
29
+ }
30
+ }
31
+ export function sensitiveFieldsOfPipeline(collection, pipeline) {
32
+ const read = /* @__PURE__ */ new Set([collection]);
33
+ for (const stage of pipeline) {
34
+ if (stage.stage === "$unionWith" || stage.stage === "unionWith") joinedCollections({ $unionWith: stage.value }, read);
35
+ joinedCollections(stage.value, read);
36
+ }
37
+ return [...new Set([...read].flatMap((name) => [...sensitiveFieldsOf(name)]))];
38
+ }
39
+ export function sensitiveFieldReferences(pipeline, fields) {
40
+ if (fields.length === 0) return [];
41
+ const found = [];
42
+ const visit = (value, stageIndex, depth) => {
43
+ if (depth > 32 || found.length >= 20) return;
44
+ if (typeof value === "string") {
45
+ if (value.startsWith("$") && !value.startsWith("$$") && fields.includes(value.slice(1).split(".").pop())) found.push({ stageIndex, reference: value });
46
+ return;
47
+ }
48
+ if (Array.isArray(value)) value.forEach((entry) => visit(entry, stageIndex, depth + 1));
49
+ else if (isRecord(value)) Object.values(value).forEach((entry) => visit(entry, stageIndex, depth + 1));
50
+ };
51
+ pipeline.forEach((stage, index) => visit(stage.value, index, 0));
52
+ return found;
53
+ }
54
+ export function withoutFieldsDeep(value, fields) {
55
+ if (fields.length === 0) return value;
56
+ const strip = (entry, depth) => {
57
+ if (depth > 64) return entry;
58
+ if (Array.isArray(entry)) return entry.map((item) => strip(item, depth + 1));
59
+ if (!isRecord(entry)) return entry;
60
+ return Object.fromEntries(Object.entries(entry).filter(([key]) => !fields.includes(key)).map(([key, inner]) => [key, strip(inner, depth + 1)]));
61
+ };
62
+ return strip(value, 0);
63
+ }
@@ -1,4 +1,11 @@
1
1
  export declare const OPERATOR_NOT_ALLOWED_CODE = 4031;
2
+ /** The request was answered 404: what it asked for does not exist (any more). */
3
+ export declare function isNotFound(error: unknown): boolean;
4
+ /**
5
+ * Runs a delete-like request for which "it is already gone" is success: a 404 resolves with `undefined` instead of
6
+ * rejecting (server 2.0 answers 404 where 1.x answered `200 false` / a count of 0). Any other failure still rejects.
7
+ */
8
+ export declare function ignoringNotFound<T>(run: () => Promise<T>): Promise<T | undefined>;
2
9
  export interface ServerError {
3
10
  /** HTTP status of the response, when there was one. */
4
11
  status?: number;
@@ -1,5 +1,16 @@
1
1
  import { parseServerError } from "./aggregationErrors.js";
2
2
  export const OPERATOR_NOT_ALLOWED_CODE = 4031;
3
+ export function isNotFound(error) {
4
+ return error?.response?.status === 404;
5
+ }
6
+ export async function ignoringNotFound(run) {
7
+ try {
8
+ return await run();
9
+ } catch (error) {
10
+ if (isNotFound(error)) return void 0;
11
+ throw error;
12
+ }
13
+ }
3
14
  export async function readServerError(error) {
4
15
  const response = error?.response;
5
16
  const status = typeof response?.status === "number" ? response.status : void 0;
@@ -1,7 +1,7 @@
1
1
  export type ServerHealth = 'ok' | 'partial' | 'down';
2
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).
3
+ * What one request did: it answered (`ok`), the server answered with an error (`refused` — e.g. no right: `/system/stats` is
4
+ * for administrators), nothing came back (`failed`), or it was not sent (`skipped` — not signed in, not allowed).
5
5
  */
6
6
  export type Outcome = 'ok' | 'refused' | 'failed' | 'skipped';
7
7
  /** An error that carries an HTTP response proves the server is there; anything else (network, timeout) does not. */
@@ -0,0 +1,65 @@
1
+ import type { AlertProps, BadgeProps, ButtonProps } from '@nuxt/ui';
2
+ /**
3
+ * The module's own look, set by an app in `app.config.ts` (key `ui` under `nuxtUiMongocamp`) and read through
4
+ * `useMongocampUi()`. Roles, not components: one entry styles every button/alert/badge of that kind in
5
+ * every Mongocamp component. Colours that carry a meaning (`error`, `warning`, `success`, `info` on a
6
+ * delete button, an error alert, a status badge) are not themeable — only the variant and size around them.
7
+ */
8
+ export type ControlSize = NonNullable<ButtonProps['size']>;
9
+ export interface ButtonStyle {
10
+ color?: ButtonProps['color'];
11
+ variant?: ButtonProps['variant'];
12
+ size?: ButtonProps['size'];
13
+ }
14
+ export interface MongocampUiTheme {
15
+ /** Inputs, selects and field groups inside the components' toolbars and editors. */
16
+ controlSize: ControlSize;
17
+ /** Reload and other buttons in a component's own toolbar. */
18
+ toolbarButton: ButtonStyle;
19
+ /** Small icon buttons: table row actions (a delete keeps its `error` colour) and toolbar icons. */
20
+ iconButton: ButtonStyle;
21
+ /** The sortable column headers of tables. */
22
+ sortHeader: ButtonStyle;
23
+ /** Cancel, close and back in dialog footers. */
24
+ dialogCancel: ButtonStyle;
25
+ /** The confirming button of an irreversible action (delete, regenerate). */
26
+ dangerAction: ButtonStyle;
27
+ /** Secondary actions beside content: copy, download, stop. */
28
+ secondaryAction: ButtonStyle;
29
+ /** Small buttons inside dense editors (document tree, aggregation stages, chips). */
30
+ compactButton: ButtonStyle;
31
+ /** Every alert; its colour stays the one that fits the message. */
32
+ alert: {
33
+ variant?: AlertProps['variant'];
34
+ };
35
+ /** A button inside an alert (retry, log in again); its colour follows the alert. */
36
+ alertAction: {
37
+ variant?: ButtonProps['variant'];
38
+ size?: ButtonProps['size'];
39
+ };
40
+ /** Every badge; its colour stays the one that fits the value. */
41
+ badge: {
42
+ variant?: BadgeProps['variant'];
43
+ };
44
+ /** Widths of dialogs and drawers (`content` classes) and the footer layout. */
45
+ modal: {
46
+ md: string;
47
+ lg: string;
48
+ xl: string;
49
+ footer: string;
50
+ };
51
+ }
52
+ export type MongocampUiThemeInput = {
53
+ [K in keyof MongocampUiTheme]?: MongocampUiTheme[K] extends string ? MongocampUiTheme[K] : Partial<MongocampUiTheme[K]>;
54
+ };
55
+ /** Today's look. Changing a value here changes every consumer app that has not set it. */
56
+ export declare const DEFAULT_UI: MongocampUiTheme;
57
+ /** Values of `data-mongocamp-part`. Public API: a stylesheet can target them. */
58
+ export declare const MONGOCAMP_PARTS: readonly ["heading", "toolbar", "table", "row-actions", "empty", "error"];
59
+ export type MongocampPart = typeof MONGOCAMP_PARTS[number];
60
+ /**
61
+ * Merges an app's (partial, unchecked) theme over the defaults. Unknown keys are ignored, a value that is
62
+ * not a non-empty string falls back to the default, a role's field the default leaves open (`size` of
63
+ * `toolbarButton`) can be set. Always returns fresh objects.
64
+ */
65
+ export declare function resolveUi(input: unknown): MongocampUiTheme;
@@ -0,0 +1,47 @@
1
+ export const DEFAULT_UI = {
2
+ controlSize: "sm",
3
+ toolbarButton: { color: "neutral", variant: "ghost" },
4
+ iconButton: { color: "neutral", variant: "ghost", size: "sm" },
5
+ sortHeader: { color: "neutral", variant: "ghost" },
6
+ dialogCancel: { color: "neutral", variant: "ghost" },
7
+ dangerAction: { color: "error" },
8
+ secondaryAction: { color: "neutral", variant: "subtle" },
9
+ compactButton: { color: "neutral", variant: "ghost", size: "xs" },
10
+ alert: { variant: "subtle" },
11
+ alertAction: { variant: "subtle" },
12
+ badge: { variant: "subtle" },
13
+ modal: { md: "sm:max-w-xl", lg: "sm:max-w-3xl", xl: "sm:max-w-5xl", footer: "justify-end" }
14
+ };
15
+ export const MONGOCAMP_PARTS = ["heading", "toolbar", "table", "row-actions", "empty", "error"];
16
+ function isRecord(value) {
17
+ return typeof value === "object" && value !== null && !Array.isArray(value);
18
+ }
19
+ function isText(value) {
20
+ return typeof value === "string" && value.trim() !== "";
21
+ }
22
+ export function resolveUi(input) {
23
+ const source = isRecord(input) ? input : {};
24
+ const result = {};
25
+ for (const [key, fallback] of Object.entries(DEFAULT_UI)) {
26
+ const given = source[key];
27
+ if (typeof fallback === "string") {
28
+ result[key] = isText(given) ? given.trim() : fallback;
29
+ continue;
30
+ }
31
+ const base = fallback;
32
+ const fields = key === "modal" ? Object.keys(base) : roleFields(key);
33
+ const merged = {};
34
+ for (const field of fields) {
35
+ const value = isRecord(given) ? given[field] : void 0;
36
+ if (isText(value)) merged[field] = value.trim();
37
+ else if (base[field] !== void 0) merged[field] = base[field];
38
+ }
39
+ result[key] = merged;
40
+ }
41
+ return result;
42
+ }
43
+ function roleFields(key) {
44
+ if (key === "alert" || key === "badge") return ["variant"];
45
+ if (key === "alertAction") return ["variant", "size"];
46
+ return ["color", "variant", "size"];
47
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sfxcode/nuxt-ui-mongocamp",
3
- "version": "1.5.7",
3
+ "version": "2.0.0",
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/",
@@ -51,7 +51,7 @@
51
51
  "dev": "npm run dev:prepare && nuxt dev playground",
52
52
  "dev:build": "nuxt build playground",
53
53
  "dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxt prepare playground",
54
- "release": "npm run lint && npm run test && npm run prepack && changelogen --patch --release && npm publish && git push --follow-tags",
54
+ "release": "npm run lint && npm run test && npm run prepack && changelogen --major --release && npm publish && git push --follow-tags",
55
55
  "lint": "eslint .",
56
56
  "test": "vitest run --project unit --project components",
57
57
  "test:watch": "vitest watch",
@@ -62,39 +62,45 @@
62
62
  "docs:preview": "vitepress preview docs"
63
63
  },
64
64
  "dependencies": {
65
- "@formkit/nuxt": "^2.5.0",
65
+ "@formkit/nuxt": "^2.10.0",
66
66
  "@internationalized/date": "^3.12.4",
67
- "@nuxt/ui": "^4.12.0",
68
- "@nuxtjs/i18n": "^10.6.0",
69
- "@sfxcode/nuxt-mongocamp-server": "^1.9.2",
70
- "@sfxcode/nuxt-ui-formkit": "^1.4.2",
67
+ "@nuxt/ui": "^4.13.1",
68
+ "@nuxtjs/i18n": "^10.7.0",
69
+ "@sfxcode/nuxt-mongocamp-server": "^2.0.0",
70
+ "@sfxcode/nuxt-ui-formkit": "^1.5.0",
71
71
  "@tanstack/charts": "^1.5.0",
72
72
  "@tanstack/vue-table": "^8.21.3",
73
73
  "consola": "^3.4.2",
74
74
  "defu": "^6.1.7",
75
- "minimatch": "^11.0.8",
75
+ "minimatch": "^11.0.9",
76
76
  "unocss-nuxt-ui": "^1.3.0"
77
77
  },
78
78
  "devDependencies": {
79
- "@iconify-json/lucide": "^1.2.155",
80
- "@nuxt/devtools": "^4.2.0",
79
+ "@iconify-json/lucide": "^1.2.161",
80
+ "@nuxt/devtools": "^4.2.2",
81
81
  "@nuxt/eslint-config": "^1.17.0",
82
- "@nuxt/kit": "^4.6.4",
82
+ "@nuxt/kit": "^4.7.0",
83
83
  "@nuxt/module-builder": "^1.0.4",
84
- "@nuxt/schema": "^4.6.4",
84
+ "@nuxt/schema": "^4.7.0",
85
85
  "@nuxt/test-utils": "^4.4.0",
86
86
  "@playwright/test": "^1.65.1",
87
87
  "@types/node": "latest",
88
- "@unhead/vue": "^3.4.3",
88
+ "@unhead/vue": "^3.5.4",
89
89
  "@vue/test-utils": "^2.6.0",
90
90
  "changelogen": "^0.6.2",
91
- "eslint": "^10.15.0",
91
+ "eslint": "^10.16.0",
92
+ "h3": "2.0.8",
92
93
  "happy-dom": "^21.0.4",
93
- "nuxt": "^4.6.4",
94
+ "nitro": "3.0.261103-rc",
95
+ "nuxt": "^4.7.0",
94
96
  "typescript": "~6.0.3",
95
97
  "vitepress": "2.0.0-alpha.18",
96
- "vitest": "^5.1.0",
98
+ "vitest": "^5.1.2",
97
99
  "vue-tsc": "^3.3.14"
98
100
  },
101
+ "peerDependencies": {
102
+ "nitro": ">=3.0.261103-rc",
103
+ "nuxt": ">=4.7.0"
104
+ },
99
105
  "packageManager": "pnpm@11.21.0+sha512.521705bce689924eac72f5a3587122f362689ef6571e55ba80076fd637c11132ecffada26fad4ea79c485bfddbfd3d5a2a5b05805a77e893de71ec8a6cca3bb1"
100
106
  }
@@ -1,15 +0,0 @@
1
- export type LuceneNode = {
2
- kind: 'clause';
3
- text: string;
4
- } | {
5
- kind: 'and' | 'or';
6
- parts: LuceneNode[];
7
- } | {
8
- kind: 'not';
9
- node: LuceneNode;
10
- };
11
- export declare class UnsupportedExpressionError extends Error {
12
- constructor(expression: string, reason: string);
13
- }
14
- /** `null` for an empty expression; throws {@link UnsupportedExpressionError} for anything it cannot read. */
15
- export declare function parseLuceneExpression(expression: string): LuceneNode | null;
@@ -1,74 +0,0 @@
1
- export class UnsupportedExpressionError extends Error {
2
- constructor(expression, reason) {
3
- super(`Cannot negate this expression (${reason}): ${expression}`);
4
- this.name = "UnsupportedExpressionError";
5
- }
6
- }
7
- const OPEN = /* @__PURE__ */ new Set(["(", "[", "{"]);
8
- const CLOSE = /* @__PURE__ */ new Set([")", "]", "}"]);
9
- function scan(text, visit) {
10
- let depth = 0;
11
- let inQuote = false;
12
- for (let i = 0; i < text.length; i++) {
13
- const char = text[i];
14
- if (char === "\\") {
15
- i++;
16
- continue;
17
- }
18
- if (char === '"') {
19
- inQuote = !inQuote;
20
- continue;
21
- }
22
- if (inQuote) continue;
23
- if (CLOSE.has(char)) depth--;
24
- const found = visit(char, i, depth);
25
- if (found !== void 0) return found;
26
- if (OPEN.has(char)) depth++;
27
- }
28
- return void 0;
29
- }
30
- function matchingClose(text, start) {
31
- const index = scan(text.slice(start), (char, i, depth) => char === ")" && depth === 0 ? i : void 0);
32
- return index === void 0 ? -1 : start + index;
33
- }
34
- function splitTopLevel(text) {
35
- const parts = [];
36
- const operators = /* @__PURE__ */ new Set();
37
- let last = 0;
38
- scan(text, (char, i, depth) => {
39
- if (char !== " " || depth !== 0) return void 0;
40
- for (const operator of ["AND", "OR"]) {
41
- const token = ` ${operator} `;
42
- if (text.startsWith(token, i)) {
43
- parts.push(text.slice(last, i));
44
- operators.add(operator);
45
- last = i + token.length;
46
- return void 0;
47
- }
48
- }
49
- return void 0;
50
- });
51
- parts.push(text.slice(last));
52
- return { parts: parts.map((part) => part.trim()), operators };
53
- }
54
- export function parseLuceneExpression(expression) {
55
- const text = expression.trim();
56
- if (text === "" || text === "()") return null;
57
- return parse(text, expression);
58
- }
59
- function parse(text, original) {
60
- if (text.startsWith("NOT ") || text.startsWith("!")) throw new UnsupportedExpressionError(original, "NOT is not supported");
61
- if (text.startsWith("-(") && matchingClose(text, 1) === text.length - 1) {
62
- return { kind: "not", node: parse(text.slice(2, -1).trim(), original) };
63
- }
64
- if (text.startsWith("(")) {
65
- const close = matchingClose(text, 0);
66
- if (close === -1) throw new UnsupportedExpressionError(original, "unbalanced parentheses");
67
- if (close === text.length - 1) return parse(text.slice(1, -1).trim(), original);
68
- }
69
- const { parts, operators } = splitTopLevel(text);
70
- if (operators.size === 0) return { kind: "clause", text };
71
- if (operators.size > 1) throw new UnsupportedExpressionError(original, "AND and OR mixed without parentheses");
72
- if (parts.includes("")) throw new UnsupportedExpressionError(original, "empty operand");
73
- return { kind: operators.has("AND") ? "and" : "or", parts: parts.map((part) => parse(part, original)) };
74
- }