@merkaly/nuxt 0.5.0 → 0.6.1
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/dist/module.d.mts +2 -2
- package/dist/module.json +1 -1
- package/dist/module.mjs +16 -4
- package/dist/runtime/adapters/create.auth.session.d.ts +9 -0
- package/dist/runtime/adapters/create.auth.session.js +14 -0
- package/dist/runtime/adapters/delete.auth.session.d.ts +1 -0
- package/dist/runtime/adapters/delete.auth.session.js +6 -0
- package/dist/runtime/adapters/read.auth.session.d.ts +9 -0
- package/dist/runtime/adapters/read.auth.session.js +8 -0
- package/dist/runtime/components/app.d.vue.ts +3 -3
- package/dist/runtime/components/app.vue +10 -8
- package/dist/runtime/components/app.vue.d.ts +3 -3
- package/dist/runtime/components/format/FormatIcon.d.vue.ts +19 -1
- package/dist/runtime/components/format/FormatIcon.vue +15 -3
- package/dist/runtime/components/format/FormatIcon.vue.d.ts +19 -1
- package/dist/runtime/components/input/InputMoney.d.vue.ts +1 -1
- package/dist/runtime/components/input/InputMoney.vue +1 -1
- package/dist/runtime/components/input/InputMoney.vue.d.ts +1 -1
- package/dist/runtime/components/table/TableDatagrid.vue +7 -5
- package/dist/runtime/composables/useDatagrid.d.ts +7 -2
- package/dist/runtime/composables/useDatagrid.js +7 -2
- package/dist/runtime/plugins/api.global.d.ts +1 -1
- package/dist/runtime/plugins/api.global.js +4 -4
- package/dist/runtime/plugins/auth0.client.js +11 -11
- package/dist/runtime/plugins/sentry.global.js +2 -5
- package/dist/runtime/server/middleware/proxy.d.ts +2 -0
- package/dist/runtime/server/middleware/proxy.js +34 -0
- package/package.json +22 -25
package/dist/module.d.mts
CHANGED
|
@@ -27,7 +27,7 @@ interface MerkalyModuleOptions {
|
|
|
27
27
|
token: string;
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
|
-
declare const
|
|
30
|
+
declare const _default: _nuxt_schema.NuxtModule<MerkalyModuleOptions, MerkalyModuleOptions, false>;
|
|
31
31
|
|
|
32
|
-
export {
|
|
32
|
+
export { _default as default };
|
|
33
33
|
export type { MerkalyModuleOptions };
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineNuxtModule, useLogger, createResolver, addPlugin, addRouteMiddleware, addImportsDir, addComponentsDir, addTypeTemplate } from '@nuxt/kit';
|
|
1
|
+
import { defineNuxtModule, useLogger, createResolver, addPlugin, addServerHandler, addRouteMiddleware, addImportsDir, addComponentsDir, addTypeTemplate } from '@nuxt/kit';
|
|
2
2
|
import { defu } from 'defu';
|
|
3
3
|
import { createJiti } from 'jiti';
|
|
4
4
|
import { existsSync } from 'node:fs';
|
|
@@ -73,7 +73,7 @@ function configureSentry(nuxt, options) {
|
|
|
73
73
|
org: "merkaly",
|
|
74
74
|
project: options.sentry.project
|
|
75
75
|
});
|
|
76
|
-
nuxt.options.sourcemap = { client: "hidden" };
|
|
76
|
+
nuxt.options.sourcemap = { client: "hidden", server: true };
|
|
77
77
|
}
|
|
78
78
|
async function loadBootstrapConfig(nuxt) {
|
|
79
79
|
const rootDirResolver = createResolver(nuxt.options.rootDir);
|
|
@@ -95,15 +95,26 @@ function configureBootstrapVueNext(nuxt, components) {
|
|
|
95
95
|
}
|
|
96
96
|
);
|
|
97
97
|
}
|
|
98
|
+
function configureAppHead(nuxt) {
|
|
99
|
+
nuxt.options.app?.head?.script?.push({
|
|
100
|
+
crossorigin: "anonymous",
|
|
101
|
+
src: "https://kit.fontawesome.com/55a4b2f4e1.js"
|
|
102
|
+
});
|
|
103
|
+
}
|
|
98
104
|
function registerRuntimeFeatures(nuxt, options, resolver) {
|
|
99
105
|
addPlugin({ src: resolver.resolve("./runtime/plugins/api.global") });
|
|
100
106
|
addPlugin({ src: resolver.resolve("./runtime/plugins/auth0.client") });
|
|
101
107
|
addPlugin({ src: resolver.resolve("./runtime/plugins/sentry.global") });
|
|
108
|
+
addServerHandler({
|
|
109
|
+
handler: resolver.resolve("./runtime/server/middleware/proxy"),
|
|
110
|
+
middleware: true
|
|
111
|
+
});
|
|
102
112
|
addRouteMiddleware({
|
|
103
113
|
global: options.auth0.requiresAuth,
|
|
104
114
|
name: "auth",
|
|
105
115
|
path: resolver.resolve("./runtime/middleware/auth")
|
|
106
116
|
});
|
|
117
|
+
addImportsDir(resolver.resolve("./runtime/adapters"));
|
|
107
118
|
addImportsDir(resolver.resolve("./runtime/composables"));
|
|
108
119
|
addImportsDir(resolver.resolve("./runtime/utils"));
|
|
109
120
|
addComponentsDir({
|
|
@@ -123,7 +134,7 @@ function configureVite(nuxt) {
|
|
|
123
134
|
}
|
|
124
135
|
);
|
|
125
136
|
}
|
|
126
|
-
const
|
|
137
|
+
const module = defineNuxtModule({
|
|
127
138
|
defaults: defaultOptions,
|
|
128
139
|
meta: {
|
|
129
140
|
name: "@merkaly/nuxt",
|
|
@@ -148,9 +159,10 @@ const merkalyModule = defineNuxtModule({
|
|
|
148
159
|
logger.info("Loading bootstrap.config.ts");
|
|
149
160
|
}
|
|
150
161
|
configureBootstrapVueNext(nuxt, bootstrapComponentsConfig);
|
|
162
|
+
configureAppHead(nuxt);
|
|
151
163
|
registerRuntimeFeatures(nuxt, options, resolver);
|
|
152
164
|
configureVite(nuxt);
|
|
153
165
|
}
|
|
154
166
|
});
|
|
155
167
|
|
|
156
|
-
export {
|
|
168
|
+
export { module as default };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
interface AuthSessionData {
|
|
2
|
+
expiresAt: string | Date;
|
|
3
|
+
issuedAt: string | Date;
|
|
4
|
+
orgId?: string;
|
|
5
|
+
role: string;
|
|
6
|
+
userId: string;
|
|
7
|
+
}
|
|
8
|
+
export declare const createAuthSession: (args?: ((args: object) => import("#imports").AdapterArgs<AuthSessionData, Record<string, unknown>, object>) | undefined) => import("#imports").UseApiReturn<AuthSessionData, Record<string, unknown>, object>;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { useAuth } from "#imports";
|
|
2
|
+
import { withAdapter } from "../utils/withAdapter.js";
|
|
3
|
+
export const createAuthSession = withAdapter(() => {
|
|
4
|
+
const { token } = useAuth();
|
|
5
|
+
return {
|
|
6
|
+
default: () => ({}),
|
|
7
|
+
global: true,
|
|
8
|
+
headers: {
|
|
9
|
+
authorization: token.value ? `Bearer ${token.value}` : ""
|
|
10
|
+
},
|
|
11
|
+
method: "POST",
|
|
12
|
+
uri: "/session"
|
|
13
|
+
};
|
|
14
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const deleteAuthSession: (args?: ((args: object) => import("../utils/withAdapter.js").AdapterArgs<undefined, Record<string, unknown>, object>) | undefined) => import("../composables/useApi.js").UseApiReturn<undefined, Record<string, unknown>, object>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
interface AuthSessionData {
|
|
2
|
+
expiresAt: string | Date;
|
|
3
|
+
issuedAt: string | Date;
|
|
4
|
+
orgId?: string;
|
|
5
|
+
role: string;
|
|
6
|
+
userId: string;
|
|
7
|
+
}
|
|
8
|
+
export declare const readAuthSession: (args?: ((args: object) => import("../utils/withAdapter.js").AdapterArgs<AuthSessionData, Record<string, unknown>, object>) | undefined) => import("../composables/useApi.js").UseApiReturn<AuthSessionData, Record<string, unknown>, object>;
|
|
9
|
+
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
declare var
|
|
1
|
+
declare var __VLS_7: {}, __VLS_9: {};
|
|
2
2
|
type __VLS_Slots = {} & {
|
|
3
|
-
loading?: (props: typeof
|
|
3
|
+
loading?: (props: typeof __VLS_7) => any;
|
|
4
4
|
} & {
|
|
5
|
-
default?: (props: typeof
|
|
5
|
+
default?: (props: typeof __VLS_9) => any;
|
|
6
6
|
};
|
|
7
7
|
declare const __VLS_base: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
8
8
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
@@ -15,13 +15,15 @@ hook("page:finish", () => regenerate());
|
|
|
15
15
|
</script>
|
|
16
16
|
|
|
17
17
|
<template>
|
|
18
|
-
<
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
<main>
|
|
19
|
+
<BApp>
|
|
20
|
+
<!-- Mostramos spinner mientras auth se carga -->
|
|
21
|
+
<slot v-if="isLoading" name="loading" />
|
|
21
22
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
<!-- Renderizamos páginas solo cuando isLoading = false -->
|
|
24
|
+
<slot v-else>
|
|
25
|
+
<NuxtPage />
|
|
26
|
+
</slot>
|
|
27
|
+
</BApp>
|
|
28
|
+
</main>
|
|
27
29
|
</template>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
declare var
|
|
1
|
+
declare var __VLS_7: {}, __VLS_9: {};
|
|
2
2
|
type __VLS_Slots = {} & {
|
|
3
|
-
loading?: (props: typeof
|
|
3
|
+
loading?: (props: typeof __VLS_7) => any;
|
|
4
4
|
} & {
|
|
5
|
-
default?: (props: typeof
|
|
5
|
+
default?: (props: typeof __VLS_9) => any;
|
|
6
6
|
};
|
|
7
7
|
declare const __VLS_base: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
8
8
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
@@ -1,6 +1,14 @@
|
|
|
1
|
-
import type { ColorVariant } from 'bootstrap-vue-next';
|
|
1
|
+
import type { ColorVariant, AlignmentVertical, AlignmentHorizontal } from 'bootstrap-vue-next';
|
|
2
2
|
import type { PropType } from 'vue';
|
|
3
3
|
declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
4
|
+
alignV: {
|
|
5
|
+
type: PropType<AlignmentVertical>;
|
|
6
|
+
default: () => string;
|
|
7
|
+
};
|
|
8
|
+
alignH: {
|
|
9
|
+
type: PropType<AlignmentHorizontal>;
|
|
10
|
+
default: () => string;
|
|
11
|
+
};
|
|
4
12
|
mode: {
|
|
5
13
|
type: StringConstructor;
|
|
6
14
|
default: string;
|
|
@@ -42,6 +50,14 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
42
50
|
default: () => string;
|
|
43
51
|
};
|
|
44
52
|
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
53
|
+
alignV: {
|
|
54
|
+
type: PropType<AlignmentVertical>;
|
|
55
|
+
default: () => string;
|
|
56
|
+
};
|
|
57
|
+
alignH: {
|
|
58
|
+
type: PropType<AlignmentHorizontal>;
|
|
59
|
+
default: () => string;
|
|
60
|
+
};
|
|
45
61
|
mode: {
|
|
46
62
|
type: StringConstructor;
|
|
47
63
|
default: string;
|
|
@@ -88,6 +104,8 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
88
104
|
size: string;
|
|
89
105
|
tag: string;
|
|
90
106
|
variant: string;
|
|
107
|
+
alignV: AlignmentVertical;
|
|
108
|
+
alignH: AlignmentHorizontal;
|
|
91
109
|
opacity: string | number;
|
|
92
110
|
provider: string;
|
|
93
111
|
reversed: boolean;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { computed } from "vue";
|
|
3
3
|
const props = defineProps({
|
|
4
|
+
alignV: { type: String, default: () => "center" },
|
|
5
|
+
alignH: { type: String, default: () => "start" },
|
|
4
6
|
mode: { type: String, default: "duotone" },
|
|
5
7
|
name: { type: String, required: true },
|
|
6
8
|
opacity: { type: [String, Number], default: () => "" },
|
|
@@ -28,17 +30,27 @@ const classList = computed(() => [
|
|
|
28
30
|
fontSize.value,
|
|
29
31
|
fontColor.value
|
|
30
32
|
].filter(Boolean));
|
|
33
|
+
const wrapperClass = computed(() => [
|
|
34
|
+
"d-flex",
|
|
35
|
+
`justify-content-${props.alignH}`,
|
|
36
|
+
`align-items-${props.alignV}`,
|
|
37
|
+
{ "flex-row-reverse": props.reversed }
|
|
38
|
+
]);
|
|
39
|
+
defineOptions({
|
|
40
|
+
inheritAttrs: false
|
|
41
|
+
});
|
|
31
42
|
</script>
|
|
32
43
|
|
|
33
44
|
<template>
|
|
34
45
|
<template v-if="hasContent">
|
|
35
|
-
<span :class="
|
|
36
|
-
<component :is="props.tag" :class="classList" />
|
|
46
|
+
<span :class="wrapperClass">
|
|
47
|
+
<component :is="props.tag" :class="classList" v-bind="$attrs" />
|
|
48
|
+
|
|
37
49
|
<slot>
|
|
38
50
|
<span :class="fontColor" class="ps-1" v-text="props.text" />
|
|
39
51
|
</slot>
|
|
40
52
|
</span>
|
|
41
53
|
</template>
|
|
42
54
|
|
|
43
|
-
<component :is="props.tag" v-else :class="classList" />
|
|
55
|
+
<component :is="props.tag" v-else :class="classList" v-bind="$attrs" />
|
|
44
56
|
</template>
|
|
@@ -1,6 +1,14 @@
|
|
|
1
|
-
import type { ColorVariant } from 'bootstrap-vue-next';
|
|
1
|
+
import type { ColorVariant, AlignmentVertical, AlignmentHorizontal } from 'bootstrap-vue-next';
|
|
2
2
|
import type { PropType } from 'vue';
|
|
3
3
|
declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
4
|
+
alignV: {
|
|
5
|
+
type: PropType<AlignmentVertical>;
|
|
6
|
+
default: () => string;
|
|
7
|
+
};
|
|
8
|
+
alignH: {
|
|
9
|
+
type: PropType<AlignmentHorizontal>;
|
|
10
|
+
default: () => string;
|
|
11
|
+
};
|
|
4
12
|
mode: {
|
|
5
13
|
type: StringConstructor;
|
|
6
14
|
default: string;
|
|
@@ -42,6 +50,14 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
42
50
|
default: () => string;
|
|
43
51
|
};
|
|
44
52
|
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
53
|
+
alignV: {
|
|
54
|
+
type: PropType<AlignmentVertical>;
|
|
55
|
+
default: () => string;
|
|
56
|
+
};
|
|
57
|
+
alignH: {
|
|
58
|
+
type: PropType<AlignmentHorizontal>;
|
|
59
|
+
default: () => string;
|
|
60
|
+
};
|
|
45
61
|
mode: {
|
|
46
62
|
type: StringConstructor;
|
|
47
63
|
default: string;
|
|
@@ -88,6 +104,8 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
88
104
|
size: string;
|
|
89
105
|
tag: string;
|
|
90
106
|
variant: string;
|
|
107
|
+
alignV: AlignmentVertical;
|
|
108
|
+
alignH: AlignmentHorizontal;
|
|
91
109
|
opacity: string | number;
|
|
92
110
|
provider: string;
|
|
93
111
|
reversed: boolean;
|
|
@@ -77,9 +77,9 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
77
77
|
decimal: string;
|
|
78
78
|
min: number;
|
|
79
79
|
max: number;
|
|
80
|
-
prefix: string;
|
|
81
80
|
placeholder: string;
|
|
82
81
|
precision: number;
|
|
82
|
+
prefix: string;
|
|
83
83
|
suffix: string;
|
|
84
84
|
thousands: string;
|
|
85
85
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
@@ -77,9 +77,9 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
77
77
|
decimal: string;
|
|
78
78
|
min: number;
|
|
79
79
|
max: number;
|
|
80
|
-
prefix: string;
|
|
81
80
|
placeholder: string;
|
|
82
81
|
precision: number;
|
|
82
|
+
prefix: string;
|
|
83
83
|
suffix: string;
|
|
84
84
|
thousands: string;
|
|
85
85
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
@@ -21,7 +21,9 @@ const canFilter = Boolean(slots.filters);
|
|
|
21
21
|
const hasDetailsSlot = computed(() => Boolean(slots["details"]));
|
|
22
22
|
const hasActionsSlot = computed(() => Boolean(slots["actions"]));
|
|
23
23
|
const hasBulkSlot = computed(() => Boolean(slots["bulk"]));
|
|
24
|
-
const visibleColumns = computed(() => Object.entries($datagrid.value.columns))
|
|
24
|
+
const visibleColumns = computed(() => Object.entries($datagrid.value.columns).filter(({ 1: column }) => {
|
|
25
|
+
return column.visible !== false;
|
|
26
|
+
}));
|
|
25
27
|
const tableColspan = computed(() => {
|
|
26
28
|
const baseColumns = 2;
|
|
27
29
|
const selectColumn = props.hideSelect ? 0 : 1;
|
|
@@ -172,8 +174,8 @@ function getRowAttrs(item, idx) {
|
|
|
172
174
|
v-if="$datagrid.loading"
|
|
173
175
|
:value="100"
|
|
174
176
|
animated
|
|
175
|
-
height="5px"
|
|
176
177
|
class="rounded-0 position-absolute w-100 start-0"
|
|
178
|
+
height="5px"
|
|
177
179
|
style="bottom: -6px; z-index: 10" />
|
|
178
180
|
</BCardHeader>
|
|
179
181
|
|
|
@@ -200,7 +202,7 @@ function getRowAttrs(item, idx) {
|
|
|
200
202
|
</BTh>
|
|
201
203
|
|
|
202
204
|
<template v-for="[key, column] in visibleColumns" :key="key">
|
|
203
|
-
<BTh :class="[column.class, column.thClass]">
|
|
205
|
+
<BTh :class="[column.class, column.thClass, 'text-nowrap']">
|
|
204
206
|
<slot :name="`head[${key}]`" v-bind="{ column, key }">
|
|
205
207
|
<span v-text="column.title ?? sentenceCase(key)" />
|
|
206
208
|
</slot>
|
|
@@ -219,7 +221,7 @@ function getRowAttrs(item, idx) {
|
|
|
219
221
|
</BTd>
|
|
220
222
|
</BTbody>
|
|
221
223
|
|
|
222
|
-
<BTbody v-else class="fw-semibold text-gray-600">
|
|
224
|
+
<BTbody v-else class="fw-semibold text-gray-600 text-nowrap">
|
|
223
225
|
<template v-for="(item, idx) in visibleItems" :key="getRowKey(item, idx)">
|
|
224
226
|
<BTr v-bind="getRowAttrs(item, idx)">
|
|
225
227
|
<BTd v-if="hasDetailsSlot" class="p-0 w-25px">
|
|
@@ -247,7 +249,7 @@ function getRowAttrs(item, idx) {
|
|
|
247
249
|
</template>
|
|
248
250
|
|
|
249
251
|
<BTd v-if="hasActionsSlot" class="text-end px-3">
|
|
250
|
-
<DropdownIcon
|
|
252
|
+
<DropdownIcon icon="caret-down" text="Actions" toggle-class="py-1 px-3" variant="light-dark">
|
|
251
253
|
<slot :index="idx" :item="item" name="actions" />
|
|
252
254
|
</DropdownIcon>
|
|
253
255
|
</BTd>
|
|
@@ -5,20 +5,25 @@ export interface ColumnDefinition<C = unknown> {
|
|
|
5
5
|
thClass?: string;
|
|
6
6
|
title?: string;
|
|
7
7
|
type?: unknown;
|
|
8
|
+
visible?: boolean;
|
|
8
9
|
}
|
|
9
10
|
export type DataGridItem<C> = C;
|
|
11
|
+
export type DataGridAddItemMode = 'append' | 'prepend';
|
|
12
|
+
export interface DataGridAddItemOptions {
|
|
13
|
+
mode?: DataGridAddItemMode;
|
|
14
|
+
}
|
|
10
15
|
export type DataGridRowAttrs = Record<string, unknown>;
|
|
11
16
|
export type DataGridRowKey = string | number;
|
|
12
17
|
export interface DataGridRowDefinition {
|
|
13
18
|
attrs?: DataGridRowAttrs;
|
|
14
|
-
class?: string
|
|
19
|
+
class?: string | Record<string, unknown>;
|
|
15
20
|
key?: DataGridRowKey;
|
|
16
21
|
}
|
|
17
22
|
export interface DataGrid<C = unknown> {
|
|
18
23
|
columns: Record<string, ColumnDefinition<C>>;
|
|
19
24
|
error: unknown;
|
|
20
25
|
fn: {
|
|
21
|
-
addItem: (item: C) => DataGridItem<C>[];
|
|
26
|
+
addItem: (item: C, options?: DataGridAddItemOptions) => DataGridItem<C>[];
|
|
22
27
|
removeItem: (predicate: (item: DataGridItem<C>, index: number) => boolean) => number;
|
|
23
28
|
};
|
|
24
29
|
items: DataGridItem<C>[];
|
|
@@ -4,8 +4,13 @@ export function useDatagrid(params) {
|
|
|
4
4
|
columns: params.columns,
|
|
5
5
|
error: params.error ?? null,
|
|
6
6
|
fn: {
|
|
7
|
-
addItem(item) {
|
|
8
|
-
|
|
7
|
+
addItem(item, options = {}) {
|
|
8
|
+
const mode = options.mode ?? "append";
|
|
9
|
+
if (mode === "prepend") {
|
|
10
|
+
state.items.unshift(item);
|
|
11
|
+
} else if (mode === "append") {
|
|
12
|
+
state.items.push(item);
|
|
13
|
+
}
|
|
9
14
|
return state.items;
|
|
10
15
|
},
|
|
11
16
|
removeItem(predicate) {
|
|
@@ -37,9 +37,9 @@ export interface ParamsOptions {
|
|
|
37
37
|
body?: FetchOptions['body'];
|
|
38
38
|
controller?: AbortController;
|
|
39
39
|
default?: () => unknown;
|
|
40
|
+
global?: boolean;
|
|
40
41
|
headers?: FetchOptions['headers'];
|
|
41
42
|
method?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
|
|
42
|
-
prefix?: string;
|
|
43
43
|
query?: FetchOptions['query'];
|
|
44
44
|
timeout?: FetchOptions['timeout'];
|
|
45
45
|
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { defineNuxtPlugin
|
|
1
|
+
import { defineNuxtPlugin } from "#app";
|
|
2
2
|
import { useAuth } from "#imports";
|
|
3
|
+
const GLOBAL_API_HEADER = "x-merkaly-global";
|
|
3
4
|
export default defineNuxtPlugin(({ provide }) => provide("api", async (url, options = {}) => {
|
|
4
|
-
const { public: $config } = useRuntimeConfig();
|
|
5
5
|
const { tenant, token } = useAuth();
|
|
6
6
|
await $fetch(url, {
|
|
7
|
-
|
|
8
|
-
baseURL: new URL(options.prefix || $config.merkaly.api.prefix || "/", $config.merkaly.api.url).href,
|
|
7
|
+
baseURL: "/api",
|
|
9
8
|
body: options?.body,
|
|
10
9
|
headers: {
|
|
11
10
|
authorization: token.value ? `Bearer ${token.value}` : "",
|
|
12
11
|
identity: tenant.value,
|
|
12
|
+
[GLOBAL_API_HEADER]: options.global ? "true" : "",
|
|
13
13
|
...options?.headers
|
|
14
14
|
},
|
|
15
15
|
method: options?.method,
|
|
@@ -40,17 +40,17 @@ export default defineNuxtPlugin(async ({ callHook, hook }) => {
|
|
|
40
40
|
redirect_uri: redirectUri
|
|
41
41
|
}
|
|
42
42
|
});
|
|
43
|
-
auth0.linkWithConnection = (connection) => {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
});
|
|
43
|
+
auth0.linkWithConnection = async (connection) => {
|
|
44
|
+
await linkingClient.loginWithPopup({ authorizationParams: { connection } });
|
|
45
|
+
const claims = await linkingClient.getIdTokenClaims();
|
|
46
|
+
if (!claims?.sub) {
|
|
47
|
+
throw new Error("Failed to get ID token for linking");
|
|
48
|
+
}
|
|
49
|
+
const [provider, ...userIdParts] = claims.sub.split("|");
|
|
50
|
+
const userId = userIdParts.join("|");
|
|
51
|
+
const body = { provider, userId };
|
|
52
|
+
const { $api } = useNuxtApp();
|
|
53
|
+
return await $api("/identities", { body, global: true, method: "POST" });
|
|
54
54
|
};
|
|
55
55
|
const isAuthCallback = window.location.pathname === callbackPath;
|
|
56
56
|
if (!isAuthCallback) {
|
|
@@ -2,13 +2,10 @@ import { defineNuxtPlugin } from "#app";
|
|
|
2
2
|
import { setUser } from "@sentry/nuxt";
|
|
3
3
|
export default defineNuxtPlugin(async ({ hook }) => {
|
|
4
4
|
hook("merkaly:auth", (user) => {
|
|
5
|
-
|
|
6
|
-
return setUser(null);
|
|
7
|
-
}
|
|
8
|
-
return setUser({
|
|
5
|
+
return setUser(user ? {
|
|
9
6
|
id: user.sub,
|
|
10
7
|
email: user.email,
|
|
11
8
|
username: user.name
|
|
12
|
-
});
|
|
9
|
+
} : null);
|
|
13
10
|
});
|
|
14
11
|
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { defineEventHandler, getRequestURL, proxyRequest } from "h3";
|
|
2
|
+
import { useRuntimeConfig } from "#imports";
|
|
3
|
+
const GLOBAL_API_HEADER = "x-merkaly-global";
|
|
4
|
+
const API_PREFIX_PATTERN = /^\/api\/?/;
|
|
5
|
+
const API_ROUTE_PATTERN = /^\/api(?:\/|$)/;
|
|
6
|
+
const EDGE_SLASH_PATTERN = /^\/|\/$/g;
|
|
7
|
+
function normalizeSegment(value) {
|
|
8
|
+
return value.replace(EDGE_SLASH_PATTERN, "");
|
|
9
|
+
}
|
|
10
|
+
function resolveProxyPath(prefix, pathname, search) {
|
|
11
|
+
const normalizedPathname = pathname.replace(API_PREFIX_PATTERN, "");
|
|
12
|
+
return `/${[prefix, normalizedPathname].map(normalizeSegment).filter(Boolean).join("/")}${search}`;
|
|
13
|
+
}
|
|
14
|
+
function isGlobalRequest(value) {
|
|
15
|
+
if (Array.isArray(value)) {
|
|
16
|
+
return value.includes("true");
|
|
17
|
+
}
|
|
18
|
+
return value === "true";
|
|
19
|
+
}
|
|
20
|
+
export default defineEventHandler((event) => {
|
|
21
|
+
if (!API_ROUTE_PATTERN.test(event.path)) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
const { public: $config } = useRuntimeConfig();
|
|
25
|
+
const targetOrigin = new URL($config.merkaly.api.url);
|
|
26
|
+
const url = getRequestURL(event);
|
|
27
|
+
const prefix = isGlobalRequest(event.node.req.headers[GLOBAL_API_HEADER]) ? "" : $config.merkaly.api.prefix;
|
|
28
|
+
const path = resolveProxyPath(prefix, url.pathname, url.search);
|
|
29
|
+
event.node.req.headers["x-forwarded-host"] = url.host;
|
|
30
|
+
if (import.meta.dev && targetOrigin.hostname.endsWith(".test")) {
|
|
31
|
+
process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";
|
|
32
|
+
}
|
|
33
|
+
return proxyRequest(event, new URL(path, targetOrigin).toString());
|
|
34
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@merkaly/nuxt",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.1",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/merkaly-io/nuxt.git"
|
|
@@ -27,22 +27,8 @@
|
|
|
27
27
|
"files": [
|
|
28
28
|
"dist"
|
|
29
29
|
],
|
|
30
|
-
"scripts": {
|
|
31
|
-
"build": "nuxt-module-build build",
|
|
32
|
-
"build:stub": "nuxt-module-build build --stub",
|
|
33
|
-
"dev": "pnpm dev:prepare && cd playground && pnpm storybook",
|
|
34
|
-
"dev:build": "nuxi build playground",
|
|
35
|
-
"dev:prepare": "pnpm build:stub && nuxi prepare playground",
|
|
36
|
-
"lint": "eslint .",
|
|
37
|
-
"prepack": "pnpm build",
|
|
38
|
-
"prepare": "nuxt-module-build prepare",
|
|
39
|
-
"release": "pnpm lint && pnpm test && pnpm build && changelogen --release && npm publish --access public && git push --follow-tags",
|
|
40
|
-
"test": "vitest run",
|
|
41
|
-
"test:types": "vue-tsc --noEmit && cd playground && vue-tsc --noEmit",
|
|
42
|
-
"test:watch": "vitest watch"
|
|
43
|
-
},
|
|
44
30
|
"dependencies": {
|
|
45
|
-
"@auth0/auth0-spa-js": "^2.
|
|
31
|
+
"@auth0/auth0-spa-js": "^2.19.0",
|
|
46
32
|
"@bootstrap-vue-next/nuxt": "^0.44.1",
|
|
47
33
|
"@nuxt/devtools": "^3.2.1",
|
|
48
34
|
"@nuxt/eslint": "1.15.1",
|
|
@@ -51,13 +37,13 @@
|
|
|
51
37
|
"@nuxt/image": "^2.0.0",
|
|
52
38
|
"@nuxt/kit": "^4.4.2",
|
|
53
39
|
"@nuxtjs/plausible": "^3.0.1",
|
|
54
|
-
"@sentry/nuxt": "^10.
|
|
40
|
+
"@sentry/nuxt": "^10.51.0",
|
|
55
41
|
"@types/node": "latest",
|
|
56
42
|
"@types/vue-select": "^3.16.8",
|
|
57
|
-
"@vueuse/components": "^14.
|
|
58
|
-
"@vueuse/core": "^14.
|
|
59
|
-
"@vueuse/integrations": "^14.
|
|
60
|
-
"@vueuse/nuxt": "^14.
|
|
43
|
+
"@vueuse/components": "^14.3.0",
|
|
44
|
+
"@vueuse/core": "^14.3.0",
|
|
45
|
+
"@vueuse/integrations": "^14.3.0",
|
|
46
|
+
"@vueuse/nuxt": "^14.3.0",
|
|
61
47
|
"bootstrap": "^5.3.8",
|
|
62
48
|
"bootstrap-vue-next": "^0.44.1",
|
|
63
49
|
"change-case": "^5",
|
|
@@ -67,7 +53,7 @@
|
|
|
67
53
|
"filesize": "^11.0.2",
|
|
68
54
|
"nuxt": "^4.4.2",
|
|
69
55
|
"reflect-metadata": "^0.2.2",
|
|
70
|
-
"sass": "^1.
|
|
56
|
+
"sass": "^1.99.0",
|
|
71
57
|
"typescript": "~5.9.3",
|
|
72
58
|
"v-money3": "^3.24.1",
|
|
73
59
|
"vite-svg-loader": "^5.1.0",
|
|
@@ -85,9 +71,20 @@
|
|
|
85
71
|
"vue-tsc": "^3.2.1"
|
|
86
72
|
},
|
|
87
73
|
"optionalDependencies": {
|
|
88
|
-
"defu": "^6.1.
|
|
74
|
+
"defu": "^6.1.5"
|
|
89
75
|
},
|
|
90
76
|
"engines": {
|
|
91
|
-
"node": ">=
|
|
77
|
+
"node": ">=24"
|
|
78
|
+
},
|
|
79
|
+
"scripts": {
|
|
80
|
+
"build": "nuxt-module-build build",
|
|
81
|
+
"build:stub": "nuxt-module-build build --stub",
|
|
82
|
+
"dev": "pnpm dev:prepare && cd playground && pnpm storybook",
|
|
83
|
+
"dev:build": "nuxi build playground",
|
|
84
|
+
"dev:prepare": "pnpm build:stub && nuxi prepare playground",
|
|
85
|
+
"lint": "eslint .",
|
|
86
|
+
"test": "vitest run",
|
|
87
|
+
"test:types": "vue-tsc --noEmit && cd playground && vue-tsc --noEmit",
|
|
88
|
+
"test:watch": "vitest watch"
|
|
92
89
|
}
|
|
93
|
-
}
|
|
90
|
+
}
|