@vitnode/core 1.2.0-canary.21 → 1.2.0-canary.23
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/src/api/models/user/sign-up.d.ts.map +1 -1
- package/dist/src/api/models/user/sign-up.js +1 -2
- package/dist/src/api/models/user.d.ts.map +1 -1
- package/dist/src/api/modules/users/routes/sign-up.route.d.ts +10 -2
- package/dist/src/api/modules/users/routes/sign-up.route.d.ts.map +1 -1
- package/dist/src/api/modules/users/routes/sign-up.route.js +14 -4
- package/dist/src/api/modules/users/users.module.d.ts +10 -2
- package/dist/src/api/modules/users/users.module.d.ts.map +1 -1
- package/dist/src/app_admin/core/users/page.js +1 -1
- package/dist/src/components/form/auto-form.js +1 -1
- package/dist/src/components/form/fields/combobox-async.d.ts +21 -0
- package/dist/src/components/form/fields/combobox-async.d.ts.map +1 -0
- package/dist/src/components/form/fields/combobox-async.js +115 -0
- package/dist/src/components/form/fields/combobox.d.ts +2 -1
- package/dist/src/components/form/fields/combobox.d.ts.map +1 -1
- package/dist/src/components/form/fields/combobox.js +4 -5
- package/dist/src/components/table/content.js +2 -2
- package/dist/src/components/table/order-table-head.js +1 -1
- package/dist/src/components/table/pagination.js +3 -3
- package/dist/src/components/ui/alert-dialog.js +2 -2
- package/dist/src/components/ui/button.d.ts +1 -1
- package/dist/src/components/ui/button.d.ts.map +1 -1
- package/dist/src/components/ui/button.js +1 -0
- package/dist/src/components/ui/dialog.d.ts.map +1 -1
- package/dist/src/components/ui/dialog.js +1 -1
- package/dist/src/lib/fetcher/core.d.ts +15 -0
- package/dist/src/lib/fetcher/core.d.ts.map +1 -0
- package/dist/src/lib/fetcher/core.js +39 -0
- package/dist/src/lib/fetcher/helpers-server.d.ts +3 -0
- package/dist/src/lib/fetcher/helpers-server.d.ts.map +1 -0
- package/dist/src/lib/fetcher/helpers-server.js +18 -0
- package/dist/src/lib/fetcher/helpers.d.ts +0 -1
- package/dist/src/lib/fetcher/helpers.d.ts.map +1 -1
- package/dist/src/lib/fetcher/helpers.js +0 -17
- package/dist/src/lib/fetcher-client.d.ts +8 -0
- package/dist/src/lib/fetcher-client.d.ts.map +1 -0
- package/dist/src/lib/fetcher-client.js +11 -0
- package/dist/src/lib/fetcher.d.ts +2 -1
- package/dist/src/lib/fetcher.d.ts.map +1 -1
- package/dist/src/lib/fetcher.js +14 -33
- package/dist/src/lib/helpers/auto-form.d.ts.map +1 -1
- package/dist/src/lib/helpers/auto-form.js +28 -16
- package/dist/src/lib/helpers/auto-form.test.js +49 -0
- package/dist/src/views/admin/layouts/sidebar/nav/item.d.ts.map +1 -1
- package/dist/src/views/admin/layouts/sidebar/nav/item.js +38 -4
- package/dist/src/views/admin/views/core/dashboard/dashboard-admin-view.js +1 -1
- package/dist/src/views/admin/views/core/test.d.ts.map +1 -1
- package/dist/src/views/admin/views/core/test.js +108 -103
- package/dist/src/views/auth/sign-in/form/form.js +1 -1
- package/dist/src/views/auth/sign-in/form/{hooks/mutation-api.d.ts → mutation-api.d.ts} +1 -1
- package/dist/src/views/auth/sign-in/form/mutation-api.d.ts.map +1 -0
- package/dist/src/views/auth/sign-in/form/{hooks/mutation-api.js → mutation-api.js} +3 -3
- package/dist/src/views/auth/sign-in/form/use-form.d.ts.map +1 -0
- package/dist/src/views/auth/sign-up/email-confirmation-view.d.ts +4 -0
- package/dist/src/views/auth/sign-up/email-confirmation-view.d.ts.map +1 -0
- package/dist/src/views/auth/sign-up/email-confirmation-view.js +55 -0
- package/dist/src/views/auth/sign-up/form/form.js +1 -1
- package/dist/src/views/auth/sign-up/form/mutation-api.d.ts +14 -0
- package/dist/src/views/auth/sign-up/form/mutation-api.d.ts.map +1 -0
- package/dist/src/views/auth/sign-up/form/mutation-api.js +29 -0
- package/dist/src/views/auth/sign-up/form/use-form.d.ts.map +1 -0
- package/dist/src/views/auth/sign-up/form/{hooks/use-form.js → use-form.js} +7 -3
- package/dist/src/views/auth/sign-up/sign-up-view.d.ts.map +1 -1
- package/dist/src/views/auth/sign-up/sign-up-view.js +38 -35
- package/dist/src/views/auth/sign-up/wrapper.d.ts +8 -0
- package/dist/src/views/auth/sign-up/wrapper.d.ts.map +1 -0
- package/dist/src/views/auth/sign-up/wrapper.js +19 -0
- package/dist/src/views/auth/sso/buttons/sso-buttons.d.ts.map +1 -1
- package/dist/src/views/auth/sso/buttons/sso-buttons.js +5 -3
- package/dist/src/views/layouts/theme/header/header.d.ts.map +1 -1
- package/dist/src/views/layouts/theme/header/header.js +24 -21
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -2
- package/src/app_admin/core/users/page.tsx +1 -1
- package/src/locales/en.json +7 -0
- package/dist/src/views/auth/sign-in/form/hooks/mutation-api.d.ts.map +0 -1
- package/dist/src/views/auth/sign-in/form/hooks/use-form.d.ts.map +0 -1
- package/dist/src/views/auth/sign-up/form/hooks/mutation-api.d.ts +0 -6
- package/dist/src/views/auth/sign-up/form/hooks/mutation-api.d.ts.map +0 -1
- package/dist/src/views/auth/sign-up/form/hooks/mutation-api.js +0 -18
- package/dist/src/views/auth/sign-up/form/hooks/use-form.d.ts.map +0 -1
- /package/dist/src/views/auth/sign-in/form/{hooks/use-form.d.ts → use-form.d.ts} +0 -0
- /package/dist/src/views/auth/sign-in/form/{hooks/use-form.js → use-form.js} +0 -0
- /package/dist/src/views/auth/sign-up/form/{hooks/use-form.d.ts → use-form.d.ts} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sign-up.d.ts","sourceRoot":"","sources":["../../../../../src/api/models/user/sign-up.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"sign-up.d.ts","sourceRoot":"","sources":["../../../../../src/api/models/user/sign-up.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAkEpC,eAAO,MAAM,MAAM,GACjB,8CAKG;IACD,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,EACD,GAAG,OAAO;;;;;;;;;;;;;EAwDX,CAAC"}
|
|
@@ -34,8 +34,7 @@ const getDefaultData = async (c)=>{
|
|
|
34
34
|
}
|
|
35
35
|
return {
|
|
36
36
|
roleId: defaultRole.id,
|
|
37
|
-
|
|
38
|
-
emailVerified: false
|
|
37
|
+
emailVerified: !c.get('core').emailProvider
|
|
39
38
|
};
|
|
40
39
|
};
|
|
41
40
|
export const signUp = async ({ email, name, newsletter, hashedPassword }, c)=>{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user.d.ts","sourceRoot":"","sources":["../../../../src/api/models/user.ts"],"names":[],"mappings":"AAIA,qBAAa,SAAS;IACpB,WAAW;;;;;;;;;;;;;;cAAe;IAC1B,kBAAkB;;;;;;;OAAsB;IACxC,MAAM;;;;
|
|
1
|
+
{"version":3,"file":"user.d.ts","sourceRoot":"","sources":["../../../../src/api/models/user.ts"],"names":[],"mappings":"AAIA,qBAAa,SAAS;IACpB,WAAW;;;;;;;;;;;;;;cAAe;IAC1B,kBAAkB;;;;;;;OAAsB;IACxC,MAAM;;;;kBAEw6C,CAAC;;;;;;;;;;;;;;OAF/5C;CACjB"}
|
|
@@ -35,7 +35,9 @@ export declare const signUpRoute: {
|
|
|
35
35
|
};
|
|
36
36
|
}>) => Promise<Response & import("hono").TypedResponse<{
|
|
37
37
|
id: number;
|
|
38
|
-
|
|
38
|
+
emailVerified: boolean;
|
|
39
|
+
email: string;
|
|
40
|
+
}, 201, "json">>;
|
|
39
41
|
pluginId: "@vitnode/core";
|
|
40
42
|
route: {
|
|
41
43
|
method: "post";
|
|
@@ -67,15 +69,21 @@ export declare const signUpRoute: {
|
|
|
67
69
|
};
|
|
68
70
|
};
|
|
69
71
|
responses: {
|
|
70
|
-
|
|
72
|
+
201: {
|
|
71
73
|
content: {
|
|
72
74
|
'application/json': {
|
|
73
75
|
schema: z.ZodObject<{
|
|
74
76
|
id: z.ZodNumber;
|
|
77
|
+
emailVerified: z.ZodBoolean;
|
|
78
|
+
email: z.ZodString;
|
|
75
79
|
}, "strip", z.ZodTypeAny, {
|
|
76
80
|
id: number;
|
|
81
|
+
email: string;
|
|
82
|
+
emailVerified: boolean;
|
|
77
83
|
}, {
|
|
78
84
|
id: number;
|
|
85
|
+
email: string;
|
|
86
|
+
emailVerified: boolean;
|
|
79
87
|
}>;
|
|
80
88
|
};
|
|
81
89
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sign-up.route.d.ts","sourceRoot":"","sources":["../../../../../../src/api/modules/users/routes/sign-up.route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"sign-up.route.d.ts","sourceRoot":"","sources":["../../../../../../src/api/modules/users/routes/sign-up.route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAWxB,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;EAe1B,CAAC;AAEH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuDtB,CAAC"}
|
|
@@ -3,6 +3,7 @@ import { buildRoute } from "../../../lib/route.js";
|
|
|
3
3
|
import { PasswordModel } from "../../../models/password.js";
|
|
4
4
|
import { UserModel } from "../../../models/user.js";
|
|
5
5
|
import { CONFIG_PLUGIN } from "../../../../config.js";
|
|
6
|
+
import { SessionModel } from "../../../models/session.js";
|
|
6
7
|
const nameRegex = /^(?!.* {2})[\p{L}\p{N}._@ -]*$/u;
|
|
7
8
|
export const zodSignUpSchema = z.object({
|
|
8
9
|
email: z.string().email().toLowerCase().openapi({
|
|
@@ -35,11 +36,13 @@ export const signUpRoute = buildRoute({
|
|
|
35
36
|
}
|
|
36
37
|
},
|
|
37
38
|
responses: {
|
|
38
|
-
|
|
39
|
+
201: {
|
|
39
40
|
content: {
|
|
40
41
|
'application/json': {
|
|
41
42
|
schema: z.object({
|
|
42
|
-
id: z.number()
|
|
43
|
+
id: z.number(),
|
|
44
|
+
emailVerified: z.boolean(),
|
|
45
|
+
email: z.string().email()
|
|
43
46
|
})
|
|
44
47
|
}
|
|
45
48
|
},
|
|
@@ -53,8 +56,15 @@ export const signUpRoute = buildRoute({
|
|
|
53
56
|
...c.req.valid('json'),
|
|
54
57
|
hashedPassword
|
|
55
58
|
}, c);
|
|
59
|
+
if (data.emailVerified) {
|
|
60
|
+
await new SessionModel(c).createSessionByUserId(data.id);
|
|
61
|
+
} else {
|
|
62
|
+
// TODO: Send verification email
|
|
63
|
+
}
|
|
56
64
|
return c.json({
|
|
57
|
-
id: data.id
|
|
58
|
-
|
|
65
|
+
id: data.id,
|
|
66
|
+
emailVerified: data.emailVerified,
|
|
67
|
+
email: data.email
|
|
68
|
+
}, 201);
|
|
59
69
|
}
|
|
60
70
|
});
|
|
@@ -234,7 +234,9 @@ export declare const usersModule: import("../../../api/lib/module").BuildModuleR
|
|
|
234
234
|
};
|
|
235
235
|
}>) => Promise<Response & import("hono").TypedResponse<{
|
|
236
236
|
id: number;
|
|
237
|
-
|
|
237
|
+
emailVerified: boolean;
|
|
238
|
+
email: string;
|
|
239
|
+
}, 201, "json">>;
|
|
238
240
|
pluginId: "@vitnode/core";
|
|
239
241
|
route: {
|
|
240
242
|
method: "post";
|
|
@@ -266,15 +268,21 @@ export declare const usersModule: import("../../../api/lib/module").BuildModuleR
|
|
|
266
268
|
};
|
|
267
269
|
};
|
|
268
270
|
responses: {
|
|
269
|
-
|
|
271
|
+
201: {
|
|
270
272
|
content: {
|
|
271
273
|
'application/json': {
|
|
272
274
|
schema: import("zod").ZodObject<{
|
|
273
275
|
id: import("zod").ZodNumber;
|
|
276
|
+
emailVerified: import("zod").ZodBoolean;
|
|
277
|
+
email: import("zod").ZodString;
|
|
274
278
|
}, "strip", import("zod").ZodTypeAny, {
|
|
275
279
|
id: number;
|
|
280
|
+
email: string;
|
|
281
|
+
emailVerified: boolean;
|
|
276
282
|
}, {
|
|
277
283
|
id: number;
|
|
284
|
+
email: string;
|
|
285
|
+
emailVerified: boolean;
|
|
278
286
|
}>;
|
|
279
287
|
};
|
|
280
288
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"users.module.d.ts","sourceRoot":"","sources":["../../../../../src/api/modules/users/users.module.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,WAAW
|
|
1
|
+
{"version":3,"file":"users.module.d.ts","sourceRoot":"","sources":["../../../../../src/api/modules/users/users.module.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mQAKtB,CAAC"}
|
|
@@ -16,7 +16,7 @@ export default async function Page(props) {
|
|
|
16
16
|
getTranslations('admin.global.nav.users')
|
|
17
17
|
]);
|
|
18
18
|
return /*#__PURE__*/ _jsxs("div", {
|
|
19
|
-
className: "
|
|
19
|
+
className: "p-4",
|
|
20
20
|
children: [
|
|
21
21
|
/*#__PURE__*/ _jsx(HeaderContent, {
|
|
22
22
|
desc: t('desc'),
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { z } from 'zod';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { Button } from '../../../components/ui/button';
|
|
4
|
+
import type { ItemAutoFormComponentProps } from './item';
|
|
5
|
+
export declare function AutoFormComboboxAsync<T extends z.ZodTypeAny>({ label, field, description, shape: _s, placeholder, className, id, searchPlaceholder, fetchData, ...props }: ItemAutoFormComponentProps<T> & Omit<React.ComponentProps<typeof Button>, 'role' | 'variant'> & {
|
|
6
|
+
description?: React.ReactNode;
|
|
7
|
+
fetchData: (params: {
|
|
8
|
+
search: string;
|
|
9
|
+
}) => Promise<{
|
|
10
|
+
label: string;
|
|
11
|
+
value: string;
|
|
12
|
+
}[]> | {
|
|
13
|
+
label: string;
|
|
14
|
+
value: string;
|
|
15
|
+
}[];
|
|
16
|
+
id: string;
|
|
17
|
+
label?: React.ReactNode;
|
|
18
|
+
placeholder?: string;
|
|
19
|
+
searchPlaceholder?: string;
|
|
20
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
//# sourceMappingURL=combobox-async.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"combobox-async.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/fields/combobox-async.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAK7B,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAiBhD,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,QAAQ,CAAC;AAMzD,wBAAgB,qBAAqB,CAAC,CAAC,SAAS,CAAC,CAAC,UAAU,EAAE,EAC5D,KAAK,EACL,KAAK,EACL,WAAW,EAEX,KAAK,EAAE,EAAE,EACT,WAAW,EACX,SAAS,EACT,EAAE,EACF,iBAAiB,EACjB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,0BAA0B,CAAC,CAAC,CAAC,GAC9B,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC,GAAG;IAC9D,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC9B,SAAS,EAAE,CAAC,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,KAClC,OAAO,CACL;QACE,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,MAAM,CAAC;KACf,EAAE,CACJ,GACD;QACE,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,MAAM,CAAC;KACf,EAAE,CAAC;IACR,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B,2CA+FF"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useQuery } from "@tanstack/react-query";
|
|
3
|
+
import { Check, ChevronsUpDown } from "lucide-react";
|
|
4
|
+
import { useTranslations } from "next-intl";
|
|
5
|
+
import React from "react";
|
|
6
|
+
import { useDebouncedCallback } from "use-debounce";
|
|
7
|
+
import { Button } from "../../ui/button.js";
|
|
8
|
+
import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList } from "../../ui/command.js";
|
|
9
|
+
import { FormControl, FormItem, FormMessage } from "../../ui/form.js";
|
|
10
|
+
import { Popover, PopoverContent, PopoverTrigger } from "../../ui/popover.js";
|
|
11
|
+
import { cn } from "../../../lib/utils.js";
|
|
12
|
+
import { Skeleton } from "../../ui/skeleton.js";
|
|
13
|
+
import { AutoFormDesc } from "../common/desc.js";
|
|
14
|
+
import { AutoFormLabel } from "../common/label.js";
|
|
15
|
+
export function AutoFormComboboxAsync({ label, field, description, // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
16
|
+
shape: _s, placeholder, className, id, searchPlaceholder, fetchData, ...props }) {
|
|
17
|
+
const t = useTranslations('core.global');
|
|
18
|
+
const [search, setSearch] = React.useState('');
|
|
19
|
+
const { data, isLoading } = useQuery({
|
|
20
|
+
queryKey: [
|
|
21
|
+
id,
|
|
22
|
+
{
|
|
23
|
+
search
|
|
24
|
+
}
|
|
25
|
+
],
|
|
26
|
+
queryFn: async ()=>{
|
|
27
|
+
return await fetchData({
|
|
28
|
+
search
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
const handleChangeSearch = useDebouncedCallback((value)=>{
|
|
33
|
+
setSearch(value);
|
|
34
|
+
}, 500);
|
|
35
|
+
return /*#__PURE__*/ _jsxs(FormItem, {
|
|
36
|
+
className: "flex flex-col",
|
|
37
|
+
children: [
|
|
38
|
+
label && /*#__PURE__*/ _jsx(AutoFormLabel, {
|
|
39
|
+
children: label
|
|
40
|
+
}),
|
|
41
|
+
/*#__PURE__*/ _jsxs(Popover, {
|
|
42
|
+
children: [
|
|
43
|
+
/*#__PURE__*/ _jsx(PopoverTrigger, {
|
|
44
|
+
asChild: true,
|
|
45
|
+
children: /*#__PURE__*/ _jsx(FormControl, {
|
|
46
|
+
children: /*#__PURE__*/ _jsxs(Button, {
|
|
47
|
+
className: cn('w-[200px] justify-between bg-transparent', !field.value && 'text-muted-foreground', className),
|
|
48
|
+
role: "combobox",
|
|
49
|
+
variant: "outline",
|
|
50
|
+
...props,
|
|
51
|
+
children: [
|
|
52
|
+
field.value && field.value.label ? field.value.label : placeholder ?? t('select_option'),
|
|
53
|
+
/*#__PURE__*/ _jsx(ChevronsUpDown, {
|
|
54
|
+
className: "ml-2 h-4 w-4 shrink-0 opacity-50"
|
|
55
|
+
})
|
|
56
|
+
]
|
|
57
|
+
})
|
|
58
|
+
})
|
|
59
|
+
}),
|
|
60
|
+
/*#__PURE__*/ _jsx(PopoverContent, {
|
|
61
|
+
className: "w-[200px] p-0",
|
|
62
|
+
children: /*#__PURE__*/ _jsxs(Command, {
|
|
63
|
+
shouldFilter: false,
|
|
64
|
+
children: [
|
|
65
|
+
/*#__PURE__*/ _jsx(CommandInput, {
|
|
66
|
+
onChangeCapture: (e)=>{
|
|
67
|
+
handleChangeSearch(e.currentTarget.value);
|
|
68
|
+
},
|
|
69
|
+
placeholder: searchPlaceholder ?? t('search_placeholder')
|
|
70
|
+
}),
|
|
71
|
+
/*#__PURE__*/ _jsx(CommandList, {
|
|
72
|
+
children: isLoading ? /*#__PURE__*/ _jsxs("div", {
|
|
73
|
+
className: "space-y-2 p-2",
|
|
74
|
+
children: [
|
|
75
|
+
/*#__PURE__*/ _jsx(Skeleton, {
|
|
76
|
+
className: "h-6 rounded-sm"
|
|
77
|
+
}),
|
|
78
|
+
/*#__PURE__*/ _jsx(Skeleton, {
|
|
79
|
+
className: "h-6 rounded-sm"
|
|
80
|
+
})
|
|
81
|
+
]
|
|
82
|
+
}) : /*#__PURE__*/ _jsx(_Fragment, {
|
|
83
|
+
children: data?.length === 0 ? /*#__PURE__*/ _jsx(CommandEmpty, {
|
|
84
|
+
children: t('results_not_found')
|
|
85
|
+
}) : /*#__PURE__*/ _jsx(CommandGroup, {
|
|
86
|
+
children: (data ?? []).map(({ label, value })=>/*#__PURE__*/ _jsxs(CommandItem, {
|
|
87
|
+
onSelect: ()=>{
|
|
88
|
+
field.onChange({
|
|
89
|
+
label,
|
|
90
|
+
value
|
|
91
|
+
});
|
|
92
|
+
},
|
|
93
|
+
value: label,
|
|
94
|
+
children: [
|
|
95
|
+
label,
|
|
96
|
+
/*#__PURE__*/ _jsx(Check, {
|
|
97
|
+
className: cn('ml-auto', value === field.value?.value ? 'opacity-100' : 'opacity-0')
|
|
98
|
+
})
|
|
99
|
+
]
|
|
100
|
+
}, value))
|
|
101
|
+
})
|
|
102
|
+
})
|
|
103
|
+
})
|
|
104
|
+
]
|
|
105
|
+
})
|
|
106
|
+
})
|
|
107
|
+
]
|
|
108
|
+
}),
|
|
109
|
+
description && /*#__PURE__*/ _jsx(AutoFormDesc, {
|
|
110
|
+
children: description
|
|
111
|
+
}),
|
|
112
|
+
/*#__PURE__*/ _jsx(FormMessage, {})
|
|
113
|
+
]
|
|
114
|
+
});
|
|
115
|
+
}
|
|
@@ -2,7 +2,7 @@ import type { z } from 'zod';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { Button } from '../../../components/ui/button';
|
|
4
4
|
import type { ItemAutoFormComponentProps } from './item';
|
|
5
|
-
export declare function AutoFormCombobox<T extends z.ZodTypeAny>({ label, field, description, shape, placeholder
|
|
5
|
+
export declare function AutoFormCombobox<T extends z.ZodTypeAny>({ label, field, description, shape, placeholder, className, labels, searchPlaceholder, ...props }: ItemAutoFormComponentProps<T> & Omit<React.ComponentProps<typeof Button>, 'role' | 'variant'> & {
|
|
6
6
|
description?: React.ReactNode;
|
|
7
7
|
label?: React.ReactNode;
|
|
8
8
|
labels?: {
|
|
@@ -10,5 +10,6 @@ export declare function AutoFormCombobox<T extends z.ZodTypeAny>({ label, field,
|
|
|
10
10
|
value: string;
|
|
11
11
|
}[];
|
|
12
12
|
placeholder?: string;
|
|
13
|
+
searchPlaceholder?: string;
|
|
13
14
|
}): import("react/jsx-runtime").JSX.Element;
|
|
14
15
|
//# sourceMappingURL=combobox.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"combobox.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/fields/combobox.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAI7B,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAkBhD,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,QAAQ,CAAC;AAKzD,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,CAAC,CAAC,UAAU,EAAE,EACvD,KAAK,EACL,KAAK,EACL,WAAW,EACX,KAAK,
|
|
1
|
+
{"version":3,"file":"combobox.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/fields/combobox.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAI7B,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAkBhD,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,QAAQ,CAAC;AAKzD,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,CAAC,CAAC,UAAU,EAAE,EACvD,KAAK,EACL,KAAK,EACL,WAAW,EACX,KAAK,EACL,WAAW,EACX,SAAS,EACT,MAAW,EACX,iBAAiB,EACjB,GAAG,KAAK,EACT,EAAE,0BAA0B,CAAC,CAAC,CAAC,GAC9B,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC,GAAG;IAC9D,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC9B,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,MAAM,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC5C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B,2CA0EF"}
|
|
@@ -10,8 +10,7 @@ import { getBaseSchema } from "../../../lib/helpers/auto-form.js";
|
|
|
10
10
|
import { cn } from "../../../lib/utils.js";
|
|
11
11
|
import { AutoFormDesc } from "../common/desc.js";
|
|
12
12
|
import { AutoFormLabel } from "../common/label.js";
|
|
13
|
-
export function AutoFormCombobox({ label, field, description, shape,
|
|
14
|
-
placeholder: _, className, labels = [], ...props }) {
|
|
13
|
+
export function AutoFormCombobox({ label, field, description, shape, placeholder, className, labels = [], searchPlaceholder, ...props }) {
|
|
15
14
|
const t = useTranslations('core.global');
|
|
16
15
|
const baseValues = getBaseSchema(shape, true)._def.values;
|
|
17
16
|
const values = baseValues.map((value)=>{
|
|
@@ -38,7 +37,7 @@ placeholder: _, className, labels = [], ...props }) {
|
|
|
38
37
|
variant: "outline",
|
|
39
38
|
...props,
|
|
40
39
|
children: [
|
|
41
|
-
field.value ? values.find(({ value })=>value === field.value)?.label : t('select_option'),
|
|
40
|
+
field.value ? values.find(({ value })=>value === field.value)?.label : placeholder ?? t('select_option'),
|
|
42
41
|
/*#__PURE__*/ _jsx(ChevronsUpDown, {
|
|
43
42
|
className: "ml-2 h-4 w-4 shrink-0 opacity-50"
|
|
44
43
|
})
|
|
@@ -51,12 +50,12 @@ placeholder: _, className, labels = [], ...props }) {
|
|
|
51
50
|
children: /*#__PURE__*/ _jsxs(Command, {
|
|
52
51
|
children: [
|
|
53
52
|
/*#__PURE__*/ _jsx(CommandInput, {
|
|
54
|
-
placeholder:
|
|
53
|
+
placeholder: searchPlaceholder ?? t('search_placeholder')
|
|
55
54
|
}),
|
|
56
55
|
/*#__PURE__*/ _jsxs(CommandList, {
|
|
57
56
|
children: [
|
|
58
57
|
/*#__PURE__*/ _jsx(CommandEmpty, {
|
|
59
|
-
children:
|
|
58
|
+
children: t('results_not_found')
|
|
60
59
|
}),
|
|
61
60
|
/*#__PURE__*/ _jsx(CommandGroup, {
|
|
62
61
|
children: values.map(({ label, value })=>/*#__PURE__*/ _jsxs(CommandItem, {
|
|
@@ -18,7 +18,7 @@ export function ContentDataTable({ columns, edges, pageInfo, order, customNotFou
|
|
|
18
18
|
...props,
|
|
19
19
|
children: [
|
|
20
20
|
/*#__PURE__*/ _jsx(TableHeader, {
|
|
21
|
-
className: "bg-
|
|
21
|
+
className: "bg-card",
|
|
22
22
|
children: /*#__PURE__*/ _jsx(TableRow, {
|
|
23
23
|
children: columns.map((column)=>/*#__PURE__*/ _jsx(TableHead, {
|
|
24
24
|
className: cn(column.className),
|
|
@@ -39,7 +39,7 @@ export function ContentDataTable({ columns, edges, pageInfo, order, customNotFou
|
|
|
39
39
|
}) ?? (column.id === 'actions' ? '' : String(row[column.id]));
|
|
40
40
|
return /*#__PURE__*/ _jsx(TableCell, {
|
|
41
41
|
className: cn({
|
|
42
|
-
'flex
|
|
42
|
+
'flex items-center justify-end gap-2': column.id === 'actions'
|
|
43
43
|
}),
|
|
44
44
|
children: content
|
|
45
45
|
}, `${row.id}_${column.id.toString()}`);
|
|
@@ -16,7 +16,7 @@ export function OrderTableHeadDataTable({ id, children, order: { defaultOrder }
|
|
|
16
16
|
const isActive = currentOrderBy === id.toString();
|
|
17
17
|
const nextOrder = isActive && currentOrder === 'asc' ? 'desc' : 'asc';
|
|
18
18
|
return /*#__PURE__*/ _jsxs(Button, {
|
|
19
|
-
className: "[&_svg]:text-muted-foreground flex h-8 items-center gap-1.5 rounded-md px-2 py-1.5 [&_svg]:size-4 [&_svg]:shrink-0",
|
|
19
|
+
className: "[&_svg]:text-muted-foreground -ml-2 flex h-8 items-center gap-1.5 rounded-md px-2 py-1.5 [&_svg]:size-4 [&_svg]:shrink-0",
|
|
20
20
|
onClick: ()=>{
|
|
21
21
|
startTransition(()=>{
|
|
22
22
|
const params = new URLSearchParams(searchParams.toString());
|
|
@@ -49,7 +49,7 @@ export const PaginationDataTable = ({ pageInfo: { hasNextPage, hasPreviousPage,
|
|
|
49
49
|
isPending ? /*#__PURE__*/ _jsx(Skeleton, {
|
|
50
50
|
className: "h-9 w-[4.5rem]"
|
|
51
51
|
}) : /*#__PURE__*/ _jsx(SelectTrigger, {
|
|
52
|
-
className: "h-8 w-[4.5rem]",
|
|
52
|
+
className: "bg-card h-8 w-[4.5rem]",
|
|
53
53
|
children: /*#__PURE__*/ _jsx(SelectValue, {})
|
|
54
54
|
}),
|
|
55
55
|
/*#__PURE__*/ _jsx(SelectContent, {
|
|
@@ -68,7 +68,7 @@ export const PaginationDataTable = ({ pageInfo: { hasNextPage, hasPreviousPage,
|
|
|
68
68
|
className: "size-8"
|
|
69
69
|
}) : /*#__PURE__*/ _jsx(Button, {
|
|
70
70
|
"aria-label": t('go_to_prev_page'),
|
|
71
|
-
className: "size-8",
|
|
71
|
+
className: "bg-card size-8",
|
|
72
72
|
disabled: !hasPreviousPage,
|
|
73
73
|
onClick: ()=>{
|
|
74
74
|
startTransition(()=>{
|
|
@@ -93,7 +93,7 @@ export const PaginationDataTable = ({ pageInfo: { hasNextPage, hasPreviousPage,
|
|
|
93
93
|
className: "size-8"
|
|
94
94
|
}) : /*#__PURE__*/ _jsx(Button, {
|
|
95
95
|
"aria-label": t('go_to_next_page'),
|
|
96
|
-
className: "size-8",
|
|
96
|
+
className: "bg-card size-8",
|
|
97
97
|
disabled: !hasNextPage || isPending,
|
|
98
98
|
onClick: ()=>{
|
|
99
99
|
startTransition(()=>{
|
|
@@ -34,7 +34,7 @@ function AlertDialogContent({ className, ...props }) {
|
|
|
34
34
|
children: [
|
|
35
35
|
/*#__PURE__*/ _jsx(AlertDialogOverlay, {}),
|
|
36
36
|
/*#__PURE__*/ _jsx(AlertDialogPrimitive.Content, {
|
|
37
|
-
className: cn('bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed left-[50%] top-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg', className),
|
|
37
|
+
className: cn('dark:bg-background bg-card data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed left-[50%] top-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg', className),
|
|
38
38
|
"data-slot": "alert-dialog-content",
|
|
39
39
|
...props
|
|
40
40
|
})
|
|
@@ -78,7 +78,7 @@ function AlertDialogAction({ className, ...props }) {
|
|
|
78
78
|
function AlertDialogCancel({ className, ...props }) {
|
|
79
79
|
return /*#__PURE__*/ _jsx(AlertDialogPrimitive.Cancel, {
|
|
80
80
|
className: cn(buttonVariants({
|
|
81
|
-
variant: '
|
|
81
|
+
variant: 'ghost'
|
|
82
82
|
}), className),
|
|
83
83
|
...props
|
|
84
84
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type VariantProps } from 'class-variance-authority';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
declare const buttonVariants: (props?: ({
|
|
4
|
-
variant?: "default" | "link" | "destructive" | "outline" | "secondary" | "ghost" | null | undefined;
|
|
4
|
+
variant?: "default" | "link" | "destructive" | "destructiveGhost" | "outline" | "secondary" | "ghost" | null | undefined;
|
|
5
5
|
size?: "default" | "sm" | "lg" | "icon" | null | undefined;
|
|
6
6
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
7
|
declare function Button({ className, variant, size, asChild, isLoading, loadingText, ...props }: React.ComponentProps<'button'> & VariantProps<typeof buttonVariants> & {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAGlE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,QAAA,MAAM,cAAc;;;
|
|
1
|
+
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAGlE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,QAAA,MAAM,cAAc;;;8EA+BnB,CAAC;AAEF,iBAAS,MAAM,CAAC,EACd,SAAS,EACT,OAAO,EACP,IAAI,EACJ,OAAe,EACf,SAAS,EACT,WAAW,EACX,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC,GAC/B,YAAY,CAAC,OAAO,cAAc,CAAC,GAAG;IACpC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,2CA4BF;AAED,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -10,6 +10,7 @@ const buttonVariants = cva("inline-flex items-center justify-center gap-2 whites
|
|
|
10
10
|
variant: {
|
|
11
11
|
default: 'bg-primary text-primary-foreground shadow-xs hover:bg-primary/90',
|
|
12
12
|
destructive: 'bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60',
|
|
13
|
+
destructiveGhost: 'hover:bg-destructive/20 text-destructive focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40',
|
|
13
14
|
outline: 'border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50',
|
|
14
15
|
secondary: 'bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80',
|
|
15
16
|
ghost: 'hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/dialog.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,UAAU,CAAC;AACrD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AA4B/B,eAAO,MAAM,SAAS;cA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T,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,KAAK,CAAC,2CAQpD;AAED,iBAAS,iBAAiB,CAAC,EACzB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,WAAW,CAAC,2CAQ1D;AAED,OAAO,EACL,MAAM,EACN,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,WAAW,EACX,aAAa,GACd,CAAC"}
|
|
@@ -114,7 +114,7 @@ function DialogContent({ className, children, showCloseButton = true, ...props }
|
|
|
114
114
|
children: [
|
|
115
115
|
/*#__PURE__*/ _jsx(DialogOverlay, {}),
|
|
116
116
|
/*#__PURE__*/ _jsxs(DialogPrimitive.Content, {
|
|
117
|
-
className: cn('bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed left-[50%] top-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg', className),
|
|
117
|
+
className: cn('dark:bg-background bg-card data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed left-[50%] top-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg', 'max-h-screen overflow-y-scroll', className),
|
|
118
118
|
"data-slot": "dialog-content",
|
|
119
119
|
onInteractOutside: (e)=>{
|
|
120
120
|
// Prevent dismissing the dialog when clicking on a toast
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { BaseBuildModuleReturn, BuildModuleReturn } from '../../api/lib/module';
|
|
2
|
+
import type { Route } from '../../api/lib/route';
|
|
3
|
+
import type { FetcherParams, GetModulePaths, GetValidMethodForPath, GetValidPathsForModule, InferResponseType } from './types';
|
|
4
|
+
interface CoreFetcherOptions<M extends string, Routes extends Route[], Modules extends BaseBuildModuleReturn[], ModuleName extends GetModulePaths<M, Modules>, SelectedPath extends GetValidPathsForModule<ModuleName, M, Routes, Modules>, Method extends GetValidMethodForPath<ModuleName, SelectedPath, M, Routes, Modules> = GetValidMethodForPath<ModuleName, SelectedPath, M, Routes, Modules>> {
|
|
5
|
+
additionalHeaders?: HeadersInit;
|
|
6
|
+
args?: FetcherParams<M, Routes, Modules, ModuleName, SelectedPath, Method>['args'];
|
|
7
|
+
method: Method;
|
|
8
|
+
module: ModuleName;
|
|
9
|
+
options?: Omit<RequestInit, 'body' | 'headers'>;
|
|
10
|
+
path: SelectedPath;
|
|
11
|
+
withPagination?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare function coreFetcher<M extends string, Routes extends Route[], Modules extends BaseBuildModuleReturn[], ModuleName extends GetModulePaths<M, Modules>, SelectedPath extends GetValidPathsForModule<ModuleName, M, Routes, Modules>, Method extends GetValidMethodForPath<ModuleName, SelectedPath, M, Routes, Modules> = GetValidMethodForPath<ModuleName, SelectedPath, M, Routes, Modules>>({ pluginId }: BuildModuleReturn<string, M, Routes, Modules>, { path, method, module, args, options, additionalHeaders, withPagination, }: CoreFetcherOptions<M, Routes, Modules, ModuleName, SelectedPath, Method>): Promise<InferResponseType<M, Routes, Modules, ModuleName, SelectedPath, Method>>;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=core.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../../src/lib/fetcher/core.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACrB,iBAAiB,EAClB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,KAAK,EAAE,MAA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ACN,OAAO,CACR,GAAG,qBAAqB,CAAC,UAAU,EAAE,YAAY,EAAE,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAEvE,EAAE,QAAQ,EAAE,EAAE,iBAAiB,CAAC,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAC3D,EACE,IAAI,EACJ,MAAM,EACN,MAAM,EACN,IAAI,EACJ,OAAO,EACP,iBAAsB,EACtB,cAAsB,GACvB,EAAE,kBAAkB,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,CAAC,GAC1E,OAAO,CACR,iBAAiB,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,CAAC,CACxE,CAwDA"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { CONFIG } from "../config.js";
|
|
2
|
+
import { buildSearchParams } from "./helpers.js";
|
|
3
|
+
export async function coreFetcher({ pluginId }, { path, method, module, args, options, additionalHeaders = {}, withPagination = false }) {
|
|
4
|
+
let currentPath = path;
|
|
5
|
+
// Replace path parameters
|
|
6
|
+
if (args && 'params' in args && args.params) {
|
|
7
|
+
for (const [key, value] of Object.entries(args.params)){
|
|
8
|
+
currentPath = currentPath.replaceAll(`{${key}}`, String(value));
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
// Ensure path starts with a slash
|
|
12
|
+
const formattedPath = currentPath.startsWith('/') ? currentPath : `/${currentPath}`;
|
|
13
|
+
// Construct the base URL
|
|
14
|
+
const url = new URL(`/api/${pluginId}/${module}${formattedPath}`, CONFIG.backend.origin);
|
|
15
|
+
// Add query parameters if they exist
|
|
16
|
+
if (args && 'query' in args && args.query) {
|
|
17
|
+
const queryParams = args.query;
|
|
18
|
+
const searchParams = buildSearchParams({
|
|
19
|
+
...args.query,
|
|
20
|
+
...withPagination && {
|
|
21
|
+
first: !queryParams.last ? queryParams.first ?? '10' : undefined,
|
|
22
|
+
search: queryParams.search ?? ''
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
url.search = searchParams.toString();
|
|
26
|
+
}
|
|
27
|
+
// Build headers
|
|
28
|
+
const headers = new Headers({
|
|
29
|
+
'Content-Type': 'application/json',
|
|
30
|
+
...additionalHeaders
|
|
31
|
+
});
|
|
32
|
+
const response = await fetch(url, {
|
|
33
|
+
method: method.toUpperCase(),
|
|
34
|
+
headers,
|
|
35
|
+
body: args && 'body' in args ? JSON.stringify(args.body) : undefined,
|
|
36
|
+
...options
|
|
37
|
+
});
|
|
38
|
+
return response;
|
|
39
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers-server.d.ts","sourceRoot":"","sources":["../../../../src/lib/fetcher/helpers-server.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAC;AAKrB,eAAO,MAAM,uBAAuB,GAAU,KAAK,QAAQ,kBAkB1D,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import "server-only";
|
|
2
|
+
import { cookies } from "next/headers";
|
|
3
|
+
import { cookieFromStringToObject } from "./cookie-from-string-to-object.js";
|
|
4
|
+
export const handleSetCookiesFetcher = async (res)=>{
|
|
5
|
+
await Promise.all(cookieFromStringToObject(res.headers.getSetCookie()).map(async (cookie)=>{
|
|
6
|
+
const key = Object.keys(cookie)[0];
|
|
7
|
+
const value = Object.values(cookie)[0];
|
|
8
|
+
if (typeof value !== 'string' || typeof key !== 'string') return;
|
|
9
|
+
(await cookies()).set(key, value, {
|
|
10
|
+
domain: cookie.Domain,
|
|
11
|
+
path: cookie.Path,
|
|
12
|
+
expires: new Date(cookie.Expires),
|
|
13
|
+
secure: cookie.Secure,
|
|
14
|
+
httpOnly: cookie.HttpOnly,
|
|
15
|
+
sameSite: cookie.SameSite
|
|
16
|
+
});
|
|
17
|
+
}));
|
|
18
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../src/lib/fetcher/helpers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../src/lib/fetcher/helpers.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB,GAAI,OAAO,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,oBAkBzE,CAAC"}
|
|
@@ -1,20 +1,3 @@
|
|
|
1
|
-
import { cookies } from "next/headers";
|
|
2
|
-
import { cookieFromStringToObject } from "./cookie-from-string-to-object.js";
|
|
3
|
-
export const handleSetCookiesFetcher = async (res)=>{
|
|
4
|
-
await Promise.all(cookieFromStringToObject(res.headers.getSetCookie()).map(async (cookie)=>{
|
|
5
|
-
const key = Object.keys(cookie)[0];
|
|
6
|
-
const value = Object.values(cookie)[0];
|
|
7
|
-
if (typeof value !== 'string' || typeof key !== 'string') return;
|
|
8
|
-
(await cookies()).set(key, value, {
|
|
9
|
-
domain: cookie.Domain,
|
|
10
|
-
path: cookie.Path,
|
|
11
|
-
expires: new Date(cookie.Expires),
|
|
12
|
-
secure: cookie.Secure,
|
|
13
|
-
httpOnly: cookie.HttpOnly,
|
|
14
|
-
sameSite: cookie.SameSite
|
|
15
|
-
});
|
|
16
|
-
}));
|
|
17
|
-
};
|
|
18
1
|
export const buildSearchParams = (query)=>{
|
|
19
2
|
const searchParams = new URLSearchParams();
|
|
20
3
|
for (const [k, v] of Object.entries(query)){
|