@ramses1er/cbk-toolkit 1.14.0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{index.d.ts → client.d.ts} +17 -37
- package/dist/{index.js → client.js} +427 -511
- package/dist/client.js.map +1 -0
- package/dist/server.d.ts +33 -0
- package/dist/server.js +161 -0
- package/dist/server.js.map +1 -0
- package/package.json +8 -6
- package/dist/index.js.map +0 -1
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import * as React$1 from 'react';
|
|
2
2
|
import React__default, { ReactNode, ComponentType } from 'react';
|
|
3
|
-
import { NextRequest, NextResponse } from 'next/server';
|
|
4
3
|
|
|
5
4
|
type IconType = ReactNode | ComponentType<{
|
|
6
5
|
size?: number;
|
|
@@ -13,6 +12,21 @@ interface NavItem {
|
|
|
13
12
|
href: string;
|
|
14
13
|
subItems?: NavItem[];
|
|
15
14
|
}
|
|
15
|
+
type FooterItem = {
|
|
16
|
+
icon?: IconType;
|
|
17
|
+
label: string;
|
|
18
|
+
href: string;
|
|
19
|
+
} | {
|
|
20
|
+
icon?: IconType;
|
|
21
|
+
label: string;
|
|
22
|
+
confirm: {
|
|
23
|
+
title?: string;
|
|
24
|
+
question: string;
|
|
25
|
+
messageYes: string;
|
|
26
|
+
messageNo: string;
|
|
27
|
+
onAction: () => Promise<void> | void;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
16
30
|
interface SideNavStaticConfig {
|
|
17
31
|
brand?: {
|
|
18
32
|
logo?: ReactNode;
|
|
@@ -21,11 +35,7 @@ interface SideNavStaticConfig {
|
|
|
21
35
|
};
|
|
22
36
|
mainItems: NavItem[];
|
|
23
37
|
title?: string;
|
|
24
|
-
footer?:
|
|
25
|
-
icon?: IconType;
|
|
26
|
-
label: string;
|
|
27
|
-
href: string;
|
|
28
|
-
}[];
|
|
38
|
+
footer?: FooterItem[];
|
|
29
39
|
toggleIcon?: ReactNode;
|
|
30
40
|
}
|
|
31
41
|
interface SideNavProps extends SideNavStaticConfig {
|
|
@@ -197,34 +207,4 @@ interface RouteGuardProviderProps {
|
|
|
197
207
|
declare function RouteGuardProvider({ children, config, useCurrentUser, pagePermissions, deniedPath, }: RouteGuardProviderProps): React$1.JSX.Element;
|
|
198
208
|
declare function routeGuard(page: string, Component: ComponentType): (props: Record<string, unknown>) => React$1.JSX.Element;
|
|
199
209
|
|
|
200
|
-
|
|
201
|
-
status: number;
|
|
202
|
-
code?: string;
|
|
203
|
-
constructor(message: string, status?: number, code?: string);
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
/**
|
|
207
|
-
* Transforme n'importe quelle erreur en réponse JSON standardisée
|
|
208
|
-
* @param error L'erreur levée
|
|
209
|
-
* @param defaultStatus Statut HTTP par défaut si non défini
|
|
210
|
-
* @param showDetails Force l'affichage des détails (true) ou le mode sécurisé (false). Par défaut : automatique selon NODE_ENV
|
|
211
|
-
* @returns Response JSON
|
|
212
|
-
*/
|
|
213
|
-
declare function handleServerError(error: unknown, defaultStatus?: number, showDetails?: boolean): Response;
|
|
214
|
-
|
|
215
|
-
interface AuthGuardOptions {
|
|
216
|
-
publicRoutes: string[];
|
|
217
|
-
loginUrl: string;
|
|
218
|
-
jwtSecret: string;
|
|
219
|
-
}
|
|
220
|
-
declare function authGuard(request: NextRequest, options: AuthGuardOptions): Promise<NextResponse<unknown>>;
|
|
221
|
-
|
|
222
|
-
interface AuthInfo {
|
|
223
|
-
userId: string;
|
|
224
|
-
userRole: string;
|
|
225
|
-
permissions: string[];
|
|
226
|
-
}
|
|
227
|
-
declare function withAuth(handler: (req: Request, auth: AuthInfo) => Promise<Response>): (req: Request) => Promise<Response>;
|
|
228
|
-
declare function withHandler(handler: (req: Request) => Promise<Response>): (req: Request) => Promise<Response>;
|
|
229
|
-
|
|
230
|
-
export { AccessDenied, ActionsMenu, ApiError, type AuthInfo, type Column, Confirmation, DatePicker, type FetcherOptions, FieldContainer, Form, HeaderContent, HttpError, Input, Label, LoaderSubmit, Loading, Modal, type NavItem, Option, type RouteGuardConfig, RouteGuardProvider, Select, SessionExpired, SideNav, type SideNavProps, type SideNavStaticConfig, Table, type TableAction, TextArea, type UseCurrentUser, authGuard, createRouteGuardConfig, createSideNav, fetcher, handleServerError, routeGuard, withAuth, withHandler };
|
|
210
|
+
export { AccessDenied, ActionsMenu, ApiError, type Column, Confirmation, DatePicker, type FetcherOptions, FieldContainer, type FooterItem, Form, HeaderContent, Input, Label, LoaderSubmit, Loading, Modal, type NavItem, Option, type RouteGuardConfig, RouteGuardProvider, Select, SessionExpired, SideNav, type SideNavProps, type SideNavStaticConfig, Table, type TableAction, TextArea, type UseCurrentUser, createRouteGuardConfig, createSideNav, fetcher, routeGuard };
|