@sfxcode/nuxt-ui-mongocamp 1.3.1 → 1.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/module.d.mts +12 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +18 -5
- package/dist/runtime/components/MongocampAggregationBuilder.d.vue.ts +6 -0
- package/dist/runtime/components/MongocampAggregationBuilder.vue +390 -0
- package/dist/runtime/components/MongocampAggregationBuilder.vue.d.ts +6 -0
- package/dist/runtime/components/MongocampBulkDelete.d.vue.ts +11 -1
- package/dist/runtime/components/MongocampBulkDelete.vue +1 -0
- package/dist/runtime/components/MongocampBulkDelete.vue.d.ts +11 -1
- package/dist/runtime/components/MongocampBulkEdit.d.vue.ts +29 -0
- package/dist/runtime/components/MongocampBulkEdit.vue +138 -0
- package/dist/runtime/components/MongocampBulkEdit.vue.d.ts +29 -0
- package/dist/runtime/components/MongocampCollectionData.d.vue.ts +4 -1
- package/dist/runtime/components/MongocampCollectionData.vue +167 -4
- package/dist/runtime/components/MongocampCollectionData.vue.d.ts +4 -1
- package/dist/runtime/components/MongocampCollectionInfos.vue +266 -8
- package/dist/runtime/components/MongocampCollections.d.vue.ts +8 -1
- package/dist/runtime/components/MongocampCollections.vue +84 -72
- package/dist/runtime/components/MongocampCollections.vue.d.ts +8 -1
- package/dist/runtime/components/MongocampConfirmByName.d.vue.ts +23 -0
- package/dist/runtime/components/MongocampConfirmByName.vue +92 -0
- package/dist/runtime/components/MongocampConfirmByName.vue.d.ts +23 -0
- package/dist/runtime/components/MongocampErrorAlert.vue +28 -5
- package/dist/runtime/components/MongocampFilterBuilder.d.vue.ts +1 -0
- package/dist/runtime/components/MongocampFilterBuilder.vue +33 -2
- package/dist/runtime/components/MongocampFilterBuilder.vue.d.ts +1 -0
- package/dist/runtime/components/MongocampGrantList.d.vue.ts +7 -0
- package/dist/runtime/components/MongocampGrantList.vue +38 -0
- package/dist/runtime/components/MongocampGrantList.vue.d.ts +7 -0
- package/dist/runtime/components/MongocampImport.d.vue.ts +10 -0
- package/dist/runtime/components/MongocampImport.vue +479 -0
- package/dist/runtime/components/MongocampImport.vue.d.ts +10 -0
- package/dist/runtime/components/MongocampRoles.vue +45 -0
- package/dist/runtime/components/MongocampSettings.d.vue.ts +3 -0
- package/dist/runtime/components/MongocampSettings.vue +179 -0
- package/dist/runtime/components/MongocampSettings.vue.d.ts +3 -0
- package/dist/runtime/components/MongocampUsers.vue +183 -3
- package/dist/runtime/composables/useMongocampAdmin.d.ts +7 -1
- package/dist/runtime/composables/useMongocampAdmin.js +24 -1
- package/dist/runtime/composables/useMongocampAggregation.d.ts +28 -0
- package/dist/runtime/composables/useMongocampAggregation.js +100 -0
- package/dist/runtime/composables/useMongocampBucket.js +1 -1
- package/dist/runtime/composables/useMongocampBulkDelete.d.ts +1 -1
- package/dist/runtime/composables/useMongocampImport.d.ts +14 -0
- package/dist/runtime/composables/useMongocampImport.js +25 -0
- package/dist/runtime/composables/useMongocampIndex.d.ts +1 -0
- package/dist/runtime/composables/useMongocampIndex.js +8 -1
- package/dist/runtime/composables/useMongocampRoles.d.ts +1 -0
- package/dist/runtime/composables/useMongocampRoles.js +3 -2
- package/dist/runtime/composables/useMongocampSession.d.ts +8 -0
- package/dist/runtime/composables/useMongocampSession.js +45 -0
- package/dist/runtime/composables/useMongocampSystem.d.ts +15 -3
- package/dist/runtime/composables/useMongocampSystem.js +19 -2
- package/dist/runtime/locales/de.json +200 -3
- package/dist/runtime/locales/en.json +200 -3
- package/dist/runtime/plugin.js +19 -0
- package/dist/runtime/utils/aggregationErrors.d.ts +10 -0
- package/dist/runtime/utils/aggregationErrors.js +17 -0
- package/dist/runtime/utils/aggregationPipeline.d.ts +42 -0
- package/dist/runtime/utils/aggregationPipeline.js +118 -0
- package/dist/runtime/utils/aggregationResult.d.ts +5 -0
- package/dist/runtime/utils/aggregationResult.js +17 -0
- package/dist/runtime/utils/analyzeSamples.d.ts +27 -0
- package/dist/runtime/utils/analyzeSamples.js +92 -0
- package/dist/runtime/utils/batchInsert.d.ts +22 -0
- package/dist/runtime/utils/batchInsert.js +24 -0
- package/dist/runtime/utils/bulkDelete.d.ts +6 -1
- package/dist/runtime/utils/bulkDelete.js +28 -4
- package/dist/runtime/utils/bulkEdit.d.ts +27 -0
- package/dist/runtime/utils/bulkEdit.js +45 -0
- package/dist/runtime/utils/collectionProtection.d.ts +3 -0
- package/dist/runtime/utils/collectionProtection.js +7 -0
- package/dist/runtime/utils/configRows.d.ts +11 -0
- package/dist/runtime/utils/configRows.js +53 -0
- package/dist/runtime/utils/failureKind.d.ts +3 -0
- package/dist/runtime/utils/failureKind.js +11 -0
- package/dist/runtime/utils/filterSuggestions.d.ts +8 -0
- package/dist/runtime/utils/filterSuggestions.js +15 -0
- package/dist/runtime/utils/importPipeline.d.ts +21 -0
- package/dist/runtime/utils/importPipeline.js +52 -0
- package/dist/runtime/utils/importRows.d.ts +36 -0
- package/dist/runtime/utils/importRows.js +228 -0
- package/dist/runtime/utils/jwtExpiry.d.ts +3 -0
- package/dist/runtime/utils/jwtExpiry.js +31 -0
- package/dist/runtime/utils/objectId.d.ts +1 -0
- package/dist/runtime/utils/objectId.js +4 -0
- package/dist/runtime/utils/serverProbe.d.ts +10 -0
- package/dist/runtime/utils/serverProbe.js +25 -0
- package/dist/runtime/utils/sessionGuard.d.ts +10 -0
- package/dist/runtime/utils/sessionGuard.js +10 -0
- package/dist/runtime/utils/throttled.d.ts +6 -0
- package/dist/runtime/utils/throttled.js +16 -0
- package/package.json +1 -1
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
name: string;
|
|
3
|
+
title: string;
|
|
4
|
+
description: string;
|
|
5
|
+
confirmLabel: string;
|
|
6
|
+
confirmColor?: 'error' | 'warning';
|
|
7
|
+
confirmIcon?: string;
|
|
8
|
+
onConfirm: () => Promise<void>;
|
|
9
|
+
};
|
|
10
|
+
type __VLS_ModelProps = {
|
|
11
|
+
'open'?: boolean;
|
|
12
|
+
};
|
|
13
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
14
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
15
|
+
"update:open": (value: boolean) => any;
|
|
16
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
17
|
+
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
18
|
+
}>, {
|
|
19
|
+
confirmColor: "error" | "warning";
|
|
20
|
+
confirmIcon: string;
|
|
21
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
22
|
+
declare const _default: typeof __VLS_export;
|
|
23
|
+
export default _default;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { computed } from "vue";
|
|
3
|
-
import { useI18n, useMongocampError } from "#imports";
|
|
2
|
+
import { computed, ref, watch } from "vue";
|
|
3
|
+
import { navigateTo, useI18n, useMongocampError, useMongocampRoles, useMongocampSession } from "#imports";
|
|
4
|
+
import { classifyFailure } from "../utils/failureKind";
|
|
4
5
|
const props = defineProps({
|
|
5
6
|
error: { type: null, required: true },
|
|
6
7
|
title: { type: String, required: false },
|
|
@@ -10,8 +11,30 @@ const props = defineProps({
|
|
|
10
11
|
const emit = defineEmits(["retry", "clearFilters"]);
|
|
11
12
|
const { t } = useI18n();
|
|
12
13
|
const { describeError } = useMongocampError();
|
|
14
|
+
const { diagnoseFailure, invalidateSession } = useMongocampSession();
|
|
15
|
+
const { loginPath: configuredLoginPath } = useMongocampRoles();
|
|
13
16
|
const described = computed(() => describeError(props.error));
|
|
14
|
-
const
|
|
17
|
+
const failure = ref(null);
|
|
18
|
+
let diagnosisRun = 0;
|
|
19
|
+
watch(() => [props.error, props.filterRejected], async ([error, filterRejected]) => {
|
|
20
|
+
const run = ++diagnosisRun;
|
|
21
|
+
failure.value = null;
|
|
22
|
+
if (!error || filterRejected) return;
|
|
23
|
+
const kind = await classifyFailure(describeError(error).kind, diagnoseFailure);
|
|
24
|
+
if (run === diagnosisRun) failure.value = kind;
|
|
25
|
+
}, { immediate: true });
|
|
26
|
+
const sessionGone = computed(() => described.value.kind === "unauthorized" || failure.value === "session-ended");
|
|
27
|
+
const requestRefused = computed(() => failure.value === "rejected-request");
|
|
28
|
+
const description = computed(() => {
|
|
29
|
+
if (props.filterRejected) return t("nuxtUiMongocamp.errors.filterRejected");
|
|
30
|
+
if (sessionGone.value) return t("nuxtUiMongocamp.errors.unauthorized");
|
|
31
|
+
if (requestRefused.value) return t("nuxtUiMongocamp.errors.requestRefused");
|
|
32
|
+
return described.value.message;
|
|
33
|
+
});
|
|
34
|
+
async function loginAgain() {
|
|
35
|
+
await invalidateSession();
|
|
36
|
+
await navigateTo(props.loginPath ?? configuredLoginPath);
|
|
37
|
+
}
|
|
15
38
|
</script>
|
|
16
39
|
|
|
17
40
|
<template>
|
|
@@ -21,7 +44,7 @@ const sessionGone = computed(() => described.value.kind === "unauthorized");
|
|
|
21
44
|
variant="subtle"
|
|
22
45
|
icon="i-lucide-circle-alert"
|
|
23
46
|
:title="filterRejected ? t('nuxtUiMongocamp.errors.filterRejectedTitle') : title ?? t('nuxtUiMongocamp.errors.loadFailedTitle')"
|
|
24
|
-
:description="
|
|
47
|
+
:description="description"
|
|
25
48
|
>
|
|
26
49
|
<template #actions>
|
|
27
50
|
<UButton
|
|
@@ -35,10 +58,10 @@ const sessionGone = computed(() => described.value.kind === "unauthorized");
|
|
|
35
58
|
<UButton
|
|
36
59
|
v-else-if="sessionGone"
|
|
37
60
|
:label="t('nuxtUiMongocamp.errors.loginAgain')"
|
|
38
|
-
:to="loginPath ?? '/'"
|
|
39
61
|
color="error"
|
|
40
62
|
variant="subtle"
|
|
41
63
|
icon="i-lucide-log-in"
|
|
64
|
+
@click="loginAgain"
|
|
42
65
|
/>
|
|
43
66
|
<UButton
|
|
44
67
|
v-else
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { computed } from "vue";
|
|
2
|
+
import { computed, ref } from "vue";
|
|
3
3
|
import { useI18n } from "#imports";
|
|
4
4
|
import {
|
|
5
5
|
buildFilterQuery,
|
|
@@ -8,8 +8,10 @@ import {
|
|
|
8
8
|
operatorsFor,
|
|
9
9
|
valueCountFor
|
|
10
10
|
} from "../utils/filterBuilder";
|
|
11
|
+
import { suggestionOptions, wantsSuggestions } from "../utils/filterSuggestions";
|
|
11
12
|
const props = defineProps({
|
|
12
|
-
fields: { type: Array, required: true }
|
|
13
|
+
fields: { type: Array, required: true },
|
|
14
|
+
loadDistinct: { type: Function, required: false }
|
|
13
15
|
});
|
|
14
16
|
const model = defineModel({ type: Object, ...{ required: true } });
|
|
15
17
|
const emit = defineEmits(["apply"]);
|
|
@@ -58,6 +60,22 @@ function changeField(index, field) {
|
|
|
58
60
|
value2: ""
|
|
59
61
|
});
|
|
60
62
|
}
|
|
63
|
+
const suggestions = ref({});
|
|
64
|
+
const loading = /* @__PURE__ */ new Set();
|
|
65
|
+
async function ensureSuggestions(condition) {
|
|
66
|
+
if (!props.loadDistinct || !wantsSuggestions(typeOf(condition.field), condition.operator) || loading.has(condition.field)) return;
|
|
67
|
+
loading.add(condition.field);
|
|
68
|
+
try {
|
|
69
|
+
suggestions.value = { ...suggestions.value, [condition.field]: await props.loadDistinct(condition.field) };
|
|
70
|
+
} catch {
|
|
71
|
+
suggestions.value = { ...suggestions.value, [condition.field]: [] };
|
|
72
|
+
} finally {
|
|
73
|
+
loading.delete(condition.field);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
function listId(condition) {
|
|
77
|
+
return props.loadDistinct && wantsSuggestions(typeOf(condition.field), condition.operator) ? `${condition.id}-suggestions` : void 0;
|
|
78
|
+
}
|
|
61
79
|
function setMatch(match) {
|
|
62
80
|
model.value = { ...model.value, match };
|
|
63
81
|
}
|
|
@@ -129,11 +147,24 @@ function clearAll() {
|
|
|
129
147
|
:type="typeOf(condition.field) === 'date-time' ? 'date' : 'text'"
|
|
130
148
|
:inputmode="typeOf(condition.field) === 'number' ? 'decimal' : void 0"
|
|
131
149
|
:placeholder="condition.operator === 'oneOf' ? t('nuxtUiMongocamp.filterBuilder.listPlaceholder') : void 0"
|
|
150
|
+
:list="listId(condition)"
|
|
132
151
|
size="sm"
|
|
133
152
|
class="w-48"
|
|
134
153
|
:aria-label="t('nuxtUiMongocamp.filterBuilder.value')"
|
|
154
|
+
@focus="ensureSuggestions(condition)"
|
|
135
155
|
@update:model-value="(value) => updateCondition(index, { value: String(value ?? '') })"
|
|
136
156
|
/>
|
|
157
|
+
<datalist
|
|
158
|
+
v-if="listId(condition)"
|
|
159
|
+
:id="listId(condition)"
|
|
160
|
+
>
|
|
161
|
+
<option
|
|
162
|
+
v-for="option in suggestionOptions(suggestions[condition.field] ?? [], condition.operator, condition.value ?? '')"
|
|
163
|
+
:key="option.value"
|
|
164
|
+
:value="option.value"
|
|
165
|
+
:label="option.label"
|
|
166
|
+
/>
|
|
167
|
+
</datalist>
|
|
137
168
|
<template v-if="valueCountFor(condition.operator) === 2">
|
|
138
169
|
<span class="text-sm text-dimmed">{{ t("nuxtUiMongocamp.filterBuilder.and") }}</span>
|
|
139
170
|
<UInput
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Grant } from '@sfxcode/nuxt-mongocamp-server';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
grants: Grant[];
|
|
4
|
+
};
|
|
5
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
6
|
+
declare const _default: typeof __VLS_export;
|
|
7
|
+
export default _default;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed, h, resolveComponent } from "vue";
|
|
3
|
+
import { useI18n } from "#imports";
|
|
4
|
+
defineProps({
|
|
5
|
+
grants: { type: Array, required: true }
|
|
6
|
+
});
|
|
7
|
+
const { t } = useI18n();
|
|
8
|
+
const UBadge = resolveComponent("UBadge");
|
|
9
|
+
function flag(value) {
|
|
10
|
+
return h(UBadge, {
|
|
11
|
+
label: value ? t("nuxtUiMongocamp.common.yes") : t("nuxtUiMongocamp.common.no"),
|
|
12
|
+
color: value ? "success" : "neutral",
|
|
13
|
+
variant: "subtle"
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
const columns = computed(() => [
|
|
17
|
+
{ accessorKey: "name", header: t("nuxtUiMongocamp.roleGrants.columnCollection") },
|
|
18
|
+
{
|
|
19
|
+
accessorKey: "grantType",
|
|
20
|
+
header: t("nuxtUiMongocamp.roleGrants.columnType"),
|
|
21
|
+
cell: ({ row }) => h(UBadge, { label: row.original.grantType, color: "neutral", variant: "subtle" })
|
|
22
|
+
},
|
|
23
|
+
{ accessorKey: "read", header: t("nuxtUiMongocamp.roleGrants.columnRead"), cell: ({ row }) => flag(row.original.read) },
|
|
24
|
+
{ accessorKey: "write", header: t("nuxtUiMongocamp.roleGrants.columnWrite"), cell: ({ row }) => flag(row.original.write) },
|
|
25
|
+
{ accessorKey: "administrate", header: t("nuxtUiMongocamp.roleGrants.columnAdmin"), cell: ({ row }) => flag(row.original.administrate) }
|
|
26
|
+
]);
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
<template>
|
|
30
|
+
<UTable
|
|
31
|
+
:data="grants"
|
|
32
|
+
:columns="columns"
|
|
33
|
+
>
|
|
34
|
+
<template #empty>
|
|
35
|
+
<MongocampEmptyState :title="t('nuxtUiMongocamp.empty.grants')" />
|
|
36
|
+
</template>
|
|
37
|
+
</UTable>
|
|
38
|
+
</template>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Grant } from '@sfxcode/nuxt-mongocamp-server';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
grants: Grant[];
|
|
4
|
+
};
|
|
5
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
6
|
+
declare const _default: typeof __VLS_export;
|
|
7
|
+
export default _default;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
collectionName: string;
|
|
3
|
+
};
|
|
4
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
5
|
+
imported: (count: number) => any;
|
|
6
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
7
|
+
onImported?: ((count: number) => any) | undefined;
|
|
8
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
9
|
+
declare const _default: typeof __VLS_export;
|
|
10
|
+
export default _default;
|