@lastbrain/app 2.0.18 → 2.0.21

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 (254) hide show
  1. package/dist/app-shell/not-found.js +2 -2
  2. package/dist/components/LanguageSwitcher.d.ts +7 -0
  3. package/dist/components/LanguageSwitcher.d.ts.map +1 -0
  4. package/dist/components/LanguageSwitcher.js +62 -0
  5. package/dist/config/version.d.ts.map +1 -1
  6. package/dist/config/version.js +19 -21
  7. package/dist/i18n/LanguageProvider.d.ts +4 -0
  8. package/dist/i18n/LanguageProvider.d.ts.map +1 -0
  9. package/dist/i18n/LanguageProvider.js +6 -0
  10. package/dist/i18n/TranslationsScript.d.ts +8 -0
  11. package/dist/i18n/TranslationsScript.d.ts.map +1 -0
  12. package/dist/i18n/TranslationsScript.js +10 -0
  13. package/dist/i18n/cookies.d.ts +6 -0
  14. package/dist/i18n/cookies.d.ts.map +1 -0
  15. package/dist/i18n/cookies.js +24 -0
  16. package/dist/i18n/langHrefHelper.d.ts +36 -0
  17. package/dist/i18n/langHrefHelper.d.ts.map +1 -0
  18. package/dist/i18n/langHrefHelper.js +41 -0
  19. package/dist/i18n/server-helpers.d.ts +33 -0
  20. package/dist/i18n/server-helpers.d.ts.map +1 -0
  21. package/dist/i18n/server-helpers.js +39 -0
  22. package/dist/i18n/server-lang.d.ts +10 -0
  23. package/dist/i18n/server-lang.d.ts.map +1 -0
  24. package/dist/i18n/server-lang.js +42 -0
  25. package/dist/i18n/server.d.ts +10 -0
  26. package/dist/i18n/server.d.ts.map +1 -0
  27. package/dist/i18n/server.js +8 -0
  28. package/dist/i18n/types.d.ts +38 -0
  29. package/dist/i18n/types.d.ts.map +1 -0
  30. package/dist/i18n/types.js +4 -0
  31. package/dist/i18n/useLangRouter.d.ts +12 -0
  32. package/dist/i18n/useLangRouter.d.ts.map +1 -0
  33. package/dist/i18n/useLangRouter.js +18 -0
  34. package/dist/i18n/useLink.d.ts +34 -0
  35. package/dist/i18n/useLink.d.ts.map +1 -0
  36. package/dist/i18n/useLink.js +58 -0
  37. package/dist/i18n/useModuleTranslation.d.ts +11 -0
  38. package/dist/i18n/useModuleTranslation.d.ts.map +1 -0
  39. package/dist/i18n/useModuleTranslation.js +23 -0
  40. package/dist/index.d.ts +7 -0
  41. package/dist/index.d.ts.map +1 -1
  42. package/dist/index.js +7 -0
  43. package/dist/layouts/AdminLayout.js +1 -1
  44. package/dist/layouts/AppProviders.d.ts +4 -1
  45. package/dist/layouts/AppProviders.d.ts.map +1 -1
  46. package/dist/layouts/AppProviders.js +18 -8
  47. package/dist/layouts/AuthLayout.js +1 -1
  48. package/dist/layouts/AuthLayoutWithSidebar.d.ts.map +1 -1
  49. package/dist/layouts/AuthLayoutWithSidebar.js +5 -3
  50. package/dist/layouts/RootLayout.d.ts +4 -1
  51. package/dist/layouts/RootLayout.d.ts.map +1 -1
  52. package/dist/layouts/RootLayout.js +2 -2
  53. package/dist/scripts/i18n-build.d.ts +7 -0
  54. package/dist/scripts/i18n-build.d.ts.map +1 -0
  55. package/dist/scripts/i18n-build.js +100 -0
  56. package/dist/scripts/init-app.js +12 -12
  57. package/dist/scripts/module-build.d.ts.map +1 -1
  58. package/dist/scripts/module-build.js +384 -81
  59. package/dist/styles.css +1 -1
  60. package/dist/templates/DefaultDoc.d.ts.map +1 -1
  61. package/dist/templates/DefaultDoc.js +90 -2
  62. package/dist/templates/middleware-i18n.example.d.ts +16 -0
  63. package/dist/templates/middleware-i18n.example.d.ts.map +1 -0
  64. package/dist/templates/middleware-i18n.example.js +72 -0
  65. package/package.json +14 -3
  66. package/src/app-shell/not-found.tsx +2 -2
  67. package/src/components/LanguageSwitcher.tsx +156 -0
  68. package/src/config/version.ts +19 -21
  69. package/src/i18n/LanguageProvider.tsx +7 -0
  70. package/src/i18n/README_LANG_HELPERS.md +187 -0
  71. package/src/i18n/TranslationsScript.tsx +17 -0
  72. package/src/i18n/cookies.ts +24 -0
  73. package/src/i18n/langHrefHelper.ts +51 -0
  74. package/src/i18n/server-helpers.ts +48 -0
  75. package/src/i18n/server-lang.ts +51 -0
  76. package/src/i18n/server.ts +13 -0
  77. package/src/i18n/types.ts +39 -0
  78. package/src/i18n/useLangRouter.ts +21 -0
  79. package/src/i18n/useLink.ts +60 -0
  80. package/src/i18n/useModuleTranslation.ts +27 -0
  81. package/src/index.ts +20 -0
  82. package/src/layouts/AdminLayout.tsx +1 -1
  83. package/src/layouts/AppProviders.tsx +35 -16
  84. package/src/layouts/AuthLayout.tsx +1 -1
  85. package/src/layouts/AuthLayoutWithSidebar.tsx +5 -3
  86. package/src/layouts/RootLayout.tsx +12 -5
  87. package/src/scripts/i18n-build.ts +122 -0
  88. package/src/scripts/init-app.ts +12 -12
  89. package/src/scripts/module-build.ts +476 -94
  90. package/src/templates/DefaultDoc.tsx +511 -1
  91. package/src/templates/middleware-i18n.example.ts +92 -0
  92. package/dist/app-shell/(admin)/dashboard/page.d.ts +0 -2
  93. package/dist/app-shell/(admin)/dashboard/page.d.ts.map +0 -1
  94. package/dist/app-shell/(admin)/dashboard/page.js +0 -5
  95. package/dist/app-shell/(admin)/page.d.ts +0 -2
  96. package/dist/app-shell/(admin)/page.d.ts.map +0 -1
  97. package/dist/app-shell/(admin)/page.js +0 -5
  98. package/dist/app-shell/(auth)/dashboard/page.d.ts +0 -2
  99. package/dist/app-shell/(auth)/dashboard/page.d.ts.map +0 -1
  100. package/dist/app-shell/(auth)/dashboard/page.js +0 -5
  101. package/dist/app-shell/(auth)/page.d.ts +0 -2
  102. package/dist/app-shell/(auth)/page.d.ts.map +0 -1
  103. package/dist/app-shell/(auth)/page.js +0 -5
  104. package/dist/components/TableStructure.d.ts +0 -8
  105. package/dist/components/TableStructure.d.ts.map +0 -1
  106. package/dist/components/TableStructure.js +0 -37
  107. package/dist/hooks/useNotificationsSimple.d.ts +0 -20
  108. package/dist/hooks/useNotificationsSimple.d.ts.map +0 -1
  109. package/dist/hooks/useNotificationsSimple.js +0 -37
  110. package/dist/module-build.d.ts +0 -2
  111. package/dist/module-build.d.ts.map +0 -1
  112. package/dist/module-build.js +0 -50
  113. package/dist/modules/index.d.ts +0 -3
  114. package/dist/modules/index.d.ts.map +0 -1
  115. package/dist/modules/index.js +0 -2
  116. package/dist/src/__tests__/module-registry.test.d.ts +0 -2
  117. package/dist/src/__tests__/module-registry.test.d.ts.map +0 -1
  118. package/dist/src/__tests__/module-registry.test.js +0 -53
  119. package/dist/src/app-shell/(admin)/layout.d.ts +0 -4
  120. package/dist/src/app-shell/(admin)/layout.d.ts.map +0 -1
  121. package/dist/src/app-shell/(admin)/layout.js +0 -5
  122. package/dist/src/app-shell/(auth)/layout.d.ts +0 -4
  123. package/dist/src/app-shell/(auth)/layout.d.ts.map +0 -1
  124. package/dist/src/app-shell/(auth)/layout.js +0 -5
  125. package/dist/src/app-shell/(public)/page.d.ts +0 -2
  126. package/dist/src/app-shell/(public)/page.d.ts.map +0 -1
  127. package/dist/src/app-shell/(public)/page.js +0 -5
  128. package/dist/src/app-shell/layout.d.ts +0 -3
  129. package/dist/src/app-shell/layout.d.ts.map +0 -1
  130. package/dist/src/app-shell/layout.js +0 -3
  131. package/dist/src/app-shell/not-found.d.ts +0 -2
  132. package/dist/src/app-shell/not-found.d.ts.map +0 -1
  133. package/dist/src/app-shell/not-found.js +0 -10
  134. package/dist/src/auth/authHelpers.d.ts +0 -7
  135. package/dist/src/auth/authHelpers.d.ts.map +0 -1
  136. package/dist/src/auth/authHelpers.js +0 -19
  137. package/dist/src/auth/useAuthSession.d.ts +0 -7
  138. package/dist/src/auth/useAuthSession.d.ts.map +0 -1
  139. package/dist/src/auth/useAuthSession.js +0 -49
  140. package/dist/src/cli.d.ts +0 -3
  141. package/dist/src/cli.d.ts.map +0 -1
  142. package/dist/src/cli.js +0 -143
  143. package/dist/src/components/NotificationContainer.d.ts +0 -2
  144. package/dist/src/components/NotificationContainer.d.ts.map +0 -1
  145. package/dist/src/components/NotificationContainer.js +0 -8
  146. package/dist/src/hooks/useNotifications.d.ts +0 -30
  147. package/dist/src/hooks/useNotifications.d.ts.map +0 -1
  148. package/dist/src/hooks/useNotifications.js +0 -165
  149. package/dist/src/index.d.ts +0 -22
  150. package/dist/src/index.d.ts.map +0 -1
  151. package/dist/src/index.js +0 -22
  152. package/dist/src/layouts/AdminLayout.d.ts +0 -4
  153. package/dist/src/layouts/AdminLayout.d.ts.map +0 -1
  154. package/dist/src/layouts/AdminLayout.js +0 -4
  155. package/dist/src/layouts/AdminLayoutWithSidebar.d.ts +0 -10
  156. package/dist/src/layouts/AdminLayoutWithSidebar.d.ts.map +0 -1
  157. package/dist/src/layouts/AdminLayoutWithSidebar.js +0 -62
  158. package/dist/src/layouts/AppProviders.d.ts +0 -27
  159. package/dist/src/layouts/AppProviders.d.ts.map +0 -1
  160. package/dist/src/layouts/AppProviders.js +0 -48
  161. package/dist/src/layouts/AuthLayout.d.ts +0 -4
  162. package/dist/src/layouts/AuthLayout.d.ts.map +0 -1
  163. package/dist/src/layouts/AuthLayout.js +0 -4
  164. package/dist/src/layouts/AuthLayoutWithSidebar.d.ts +0 -12
  165. package/dist/src/layouts/AuthLayoutWithSidebar.d.ts.map +0 -1
  166. package/dist/src/layouts/AuthLayoutWithSidebar.js +0 -60
  167. package/dist/src/layouts/PublicLayout.d.ts +0 -8
  168. package/dist/src/layouts/PublicLayout.d.ts.map +0 -1
  169. package/dist/src/layouts/PublicLayout.js +0 -6
  170. package/dist/src/layouts/PublicLayoutWithSidebar.d.ts +0 -9
  171. package/dist/src/layouts/PublicLayoutWithSidebar.d.ts.map +0 -1
  172. package/dist/src/layouts/PublicLayoutWithSidebar.js +0 -60
  173. package/dist/src/layouts/RootLayout.d.ts +0 -6
  174. package/dist/src/layouts/RootLayout.d.ts.map +0 -1
  175. package/dist/src/layouts/RootLayout.js +0 -9
  176. package/dist/src/modules/module-loader.d.ts +0 -5
  177. package/dist/src/modules/module-loader.d.ts.map +0 -1
  178. package/dist/src/modules/module-loader.js +0 -10
  179. package/dist/src/scripts/db-init.d.ts +0 -2
  180. package/dist/src/scripts/db-init.d.ts.map +0 -1
  181. package/dist/src/scripts/db-init.js +0 -300
  182. package/dist/src/scripts/db-migrations-sync.d.ts +0 -2
  183. package/dist/src/scripts/db-migrations-sync.d.ts.map +0 -1
  184. package/dist/src/scripts/db-migrations-sync.js +0 -84
  185. package/dist/src/scripts/dev-sync.d.ts +0 -2
  186. package/dist/src/scripts/dev-sync.d.ts.map +0 -1
  187. package/dist/src/scripts/dev-sync.js +0 -194
  188. package/dist/src/scripts/init-app.d.ts +0 -12
  189. package/dist/src/scripts/init-app.d.ts.map +0 -1
  190. package/dist/src/scripts/init-app.js +0 -2175
  191. package/dist/src/scripts/module-add.d.ts +0 -2
  192. package/dist/src/scripts/module-add.d.ts.map +0 -1
  193. package/dist/src/scripts/module-add.js +0 -232
  194. package/dist/src/scripts/module-build.d.ts +0 -2
  195. package/dist/src/scripts/module-build.d.ts.map +0 -1
  196. package/dist/src/scripts/module-build.js +0 -1280
  197. package/dist/src/scripts/module-create.d.ts +0 -28
  198. package/dist/src/scripts/module-create.d.ts.map +0 -1
  199. package/dist/src/scripts/module-create.js +0 -1429
  200. package/dist/src/scripts/module-delete.d.ts +0 -6
  201. package/dist/src/scripts/module-delete.d.ts.map +0 -1
  202. package/dist/src/scripts/module-delete.js +0 -147
  203. package/dist/src/scripts/module-list.d.ts +0 -2
  204. package/dist/src/scripts/module-list.d.ts.map +0 -1
  205. package/dist/src/scripts/module-list.js +0 -61
  206. package/dist/src/scripts/module-remove.d.ts +0 -2
  207. package/dist/src/scripts/module-remove.d.ts.map +0 -1
  208. package/dist/src/scripts/module-remove.js +0 -311
  209. package/dist/src/scripts/readme-build.d.ts +0 -2
  210. package/dist/src/scripts/readme-build.d.ts.map +0 -1
  211. package/dist/src/scripts/readme-build.js +0 -39
  212. package/dist/src/scripts/script-runner.d.ts +0 -5
  213. package/dist/src/scripts/script-runner.d.ts.map +0 -1
  214. package/dist/src/scripts/script-runner.js +0 -25
  215. package/dist/src/templates/AuthGuidePage.d.ts +0 -2
  216. package/dist/src/templates/AuthGuidePage.d.ts.map +0 -1
  217. package/dist/src/templates/AuthGuidePage.js +0 -9
  218. package/dist/src/templates/DefaultDoc.d.ts +0 -2
  219. package/dist/src/templates/DefaultDoc.d.ts.map +0 -1
  220. package/dist/src/templates/DefaultDoc.js +0 -240
  221. package/dist/src/templates/DocPage.d.ts +0 -17
  222. package/dist/src/templates/DocPage.d.ts.map +0 -1
  223. package/dist/src/templates/DocPage.js +0 -193
  224. package/dist/src/templates/DocsPageWithModules.d.ts +0 -2
  225. package/dist/src/templates/DocsPageWithModules.d.ts.map +0 -1
  226. package/dist/src/templates/DocsPageWithModules.js +0 -8
  227. package/dist/src/templates/MigrationsGuidePage.d.ts +0 -2
  228. package/dist/src/templates/MigrationsGuidePage.d.ts.map +0 -1
  229. package/dist/src/templates/MigrationsGuidePage.js +0 -11
  230. package/dist/src/templates/ModuleGuidePage.d.ts +0 -2
  231. package/dist/src/templates/ModuleGuidePage.d.ts.map +0 -1
  232. package/dist/src/templates/ModuleGuidePage.js +0 -14
  233. package/dist/src/templates/SimpleDocPage.d.ts +0 -2
  234. package/dist/src/templates/SimpleDocPage.d.ts.map +0 -1
  235. package/dist/src/templates/SimpleDocPage.js +0 -28
  236. package/dist/src/templates/SimpleHomePage.d.ts +0 -6
  237. package/dist/src/templates/SimpleHomePage.d.ts.map +0 -1
  238. package/dist/src/templates/SimpleHomePage.js +0 -7
  239. package/dist/src/types/menu.d.ts +0 -23
  240. package/dist/src/types/menu.d.ts.map +0 -1
  241. package/dist/src/types/menu.js +0 -1
  242. package/dist/templates/HomePage.d.ts +0 -6
  243. package/dist/templates/HomePage.d.ts.map +0 -1
  244. package/dist/templates/HomePage.js +0 -6
  245. package/dist/templates/components/AppAside.d.ts +0 -6
  246. package/dist/templates/components/AppAside.d.ts.map +0 -1
  247. package/dist/templates/components/AppAside.js +0 -9
  248. package/dist/templates/layouts/admin-layout.d.ts +0 -4
  249. package/dist/templates/layouts/admin-layout.d.ts.map +0 -1
  250. package/dist/templates/layouts/admin-layout.js +0 -6
  251. package/dist/templates/layouts/auth-layout.d.ts +0 -4
  252. package/dist/templates/layouts/auth-layout.d.ts.map +0 -1
  253. package/dist/templates/layouts/auth-layout.js +0 -6
  254. package/dist/templates/migrations/20201010100000_init.sql +0 -123
@@ -1,5 +0,0 @@
1
- "use client";
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- export default function AuthDashboardPage() {
4
- return (_jsxs("div", { className: "mx-auto max-w-4xl space-y-3 px-4 py-16", children: [_jsx("h1", { className: "text-3xl font-bold", children: "Tableau de bord" }), _jsx("p", { className: "text-slate-600", children: "Bienvenue utilisateur \u2014 votre session est active." })] }));
5
- }
@@ -1,8 +0,0 @@
1
- interface TableStructureProps {
2
- tableName: string;
3
- title?: string;
4
- description?: string;
5
- }
6
- export declare function TableStructure({ tableName, title, description, }: TableStructureProps): import("react/jsx-runtime").JSX.Element;
7
- export {};
8
- //# sourceMappingURL=TableStructure.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TableStructure.d.ts","sourceRoot":"","sources":["../../src/components/TableStructure.tsx"],"names":[],"mappings":"AA6BA,UAAU,mBAAmB;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,wBAAgB,cAAc,CAAC,EAC7B,SAAS,EACT,KAAK,EACL,WAAW,GACZ,EAAE,mBAAmB,2CAgIrB"}
@@ -1,37 +0,0 @@
1
- "use client";
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { useEffect, useState } from "react";
4
- import { Card, CardBody, CardHeader, Table, TableHeader, TableColumn, TableBody, TableRow, TableCell, Chip, Spinner, } from "@lastbrain/ui";
5
- import { createBrowserClient } from "@supabase/ssr";
6
- export function TableStructure({ tableName, title, description, }) {
7
- const [columns, setColumns] = useState([]);
8
- const [loading, setLoading] = useState(true);
9
- const [error, setError] = useState(null);
10
- useEffect(() => {
11
- const fetchStructure = async () => {
12
- try {
13
- const supabase = createBrowserClient(process.env.NEXT_PUBLIC_SUPABASE_URL, process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY);
14
- const { data, error } = await supabase.rpc("get_table_structure", {
15
- table_name: tableName,
16
- });
17
- if (error)
18
- throw error;
19
- setColumns(data || []);
20
- }
21
- catch (err) {
22
- setError(err instanceof Error ? err.message : "Erreur lors du chargement");
23
- }
24
- finally {
25
- setLoading(false);
26
- }
27
- };
28
- fetchStructure();
29
- }, [tableName]);
30
- if (loading) {
31
- return (_jsx(Card, { children: _jsx(CardBody, { className: "flex justify-center items-center py-8", children: _jsx(Spinner, { size: "lg" }) }) }));
32
- }
33
- if (error) {
34
- return (_jsx(Card, { children: _jsx(CardBody, { children: _jsxs("p", { className: "text-red-500", children: ["Erreur: ", error] }) }) }));
35
- }
36
- return (_jsxs(Card, { children: [_jsx(CardHeader, { children: _jsxs("div", { className: "flex flex-col gap-1", children: [_jsx("h3", { className: "text-lg font-semibold", children: title || `Table: ${tableName}` }), description && (_jsx("p", { className: "text-sm text-slate-600 dark:text-slate-400", children: description }))] }) }), _jsx(CardBody, { children: _jsxs(Table, { "aria-label": `Structure de la table ${tableName}`, children: [_jsxs(TableHeader, { children: [_jsx(TableColumn, { children: "COLONNE" }), _jsx(TableColumn, { children: "TYPE" }), _jsx(TableColumn, { children: "NULLABLE" }), _jsx(TableColumn, { children: "CONTRAINTES" }), _jsx(TableColumn, { children: "RELATION" })] }), _jsx(TableBody, { children: columns.map((col) => (_jsxs(TableRow, { children: [_jsx(TableCell, { children: _jsxs("div", { className: "flex items-center gap-2", children: [_jsx("code", { className: "font-mono text-sm", children: col.column_name }), col.is_primary_key && (_jsx(Chip, { size: "sm", color: "primary", variant: "flat", children: "PK" }))] }) }), _jsx(TableCell, { children: _jsx("code", { className: "font-mono text-sm text-purple-600 dark:text-purple-400", children: col.data_type }) }), _jsx(TableCell, { children: _jsx(Chip, { size: "sm", color: col.is_nullable === "YES" ? "warning" : "success", variant: "flat", children: col.is_nullable === "YES" ? "NULL" : "NOT NULL" }) }), _jsx(TableCell, { children: col.column_default && (_jsxs(Chip, { size: "sm", variant: "flat", children: ["default: ", col.column_default.substring(0, 30), col.column_default.length > 30 ? "..." : ""] })) }), _jsx(TableCell, { children: col.is_foreign_key && col.foreign_table && (_jsxs("div", { className: "flex items-center gap-1", children: [_jsx(Chip, { size: "sm", color: "secondary", variant: "flat", children: "FK" }), _jsxs("code", { className: "font-mono text-xs", children: ["\u2192 ", col.foreign_table, ".", col.foreign_column] })] })) })] }, col.column_name))) })] }) })] }));
37
- }
@@ -1,20 +0,0 @@
1
- /**
2
- * Hook simple pour utiliser les notifications partout dans l'app
3
- * Wrapper autour du contexte pour plus de simplicité
4
- */
5
- export declare function useNotificationsSimple(): {
6
- notifications: import("./useNotifications.js").UserNotification[];
7
- unreadCount: number;
8
- loading: boolean;
9
- error: string | null;
10
- isEmpty: boolean;
11
- hasUnread: boolean;
12
- refetch: () => Promise<void>;
13
- markAsRead: (id: string) => Promise<void>;
14
- markAllAsRead: () => Promise<void>;
15
- deleteNotification: (id: string) => Promise<void>;
16
- realtimeActive: boolean;
17
- lastUpdate: any;
18
- };
19
- export default useNotificationsSimple;
20
- //# sourceMappingURL=useNotificationsSimple.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useNotificationsSimple.d.ts","sourceRoot":"","sources":["../../src/hooks/useNotificationsSimple.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,wBAAgB,sBAAsB;;;;;;;;;;;;;EAmCrC;AAED,eAAe,sBAAsB,CAAC"}
@@ -1,37 +0,0 @@
1
- import { useNotifications as useNotificationsContext } from "../layouts/AppProviders.js";
2
- /**
3
- * Hook simple pour utiliser les notifications partout dans l'app
4
- * Wrapper autour du contexte pour plus de simplicité
5
- */
6
- export function useNotificationsSimple() {
7
- const context = useNotificationsContext();
8
- // Log uniquement en cas de problème pour le debug
9
- if (context.error || (context.data.notifications.length > 0 && process.env.NODE_ENV === 'development')) {
10
- console.log("[useNotificationsSimple] État:", {
11
- dataNotifications: context.data.notifications?.length || 0,
12
- dataUnreadCount: context.data.unreadCount,
13
- loading: context.loading,
14
- error: context.error,
15
- realtimeActive: context.realtimeActive
16
- });
17
- }
18
- return {
19
- // Données principales
20
- notifications: context.data.notifications,
21
- unreadCount: context.data.unreadCount,
22
- // États
23
- loading: context.loading,
24
- error: context.error,
25
- isEmpty: context.isEmpty,
26
- hasUnread: context.hasUnread,
27
- // Actions
28
- refetch: context.refetch,
29
- markAsRead: context.markAsRead,
30
- markAllAsRead: context.markAllAsRead,
31
- deleteNotification: context.deleteNotification,
32
- // Realtime info
33
- realtimeActive: context.realtimeActive,
34
- lastUpdate: context.lastRealtimePayload,
35
- };
36
- }
37
- export default useNotificationsSimple;
@@ -1,2 +0,0 @@
1
- export declare function runModuleBuild(): void;
2
- //# sourceMappingURL=module-build.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"module-build.d.ts","sourceRoot":"","sources":["../src/module-build.ts"],"names":[],"mappings":"AAuDA,wBAAgB,cAAc,SAO7B"}
@@ -1,50 +0,0 @@
1
- import fs from "node:fs";
2
- import path from "node:path";
3
- import { fileURLToPath } from "node:url";
4
- import { moduleConfigs } from "./modules/index.js";
5
- const webAppRoot = path.join(fileURLToPath(new URL("../../../apps/web", import.meta.url)));
6
- const appDirectory = path.join(webAppRoot, "app");
7
- function ensureDirectory(dir) {
8
- fs.mkdirSync(dir, { recursive: true });
9
- }
10
- function toPascalCase(value) {
11
- return value
12
- .split(/[^a-zA-Z0-9]+/)
13
- .filter(Boolean)
14
- .map((segment) => segment[0].toUpperCase() + segment.slice(1))
15
- .join("");
16
- }
17
- function buildPage(moduleConfig, page) {
18
- const segments = page.path.replace(/^\//, "").split("/").filter(Boolean);
19
- const routeDir = path.join(appDirectory, ...segments);
20
- const filePath = path.join(routeDir, "page.tsx");
21
- ensureDirectory(routeDir);
22
- const wrapperSuffix = segments.length ? toPascalCase(segments.join("-")) : "Root";
23
- const wrapperName = `${page.componentExport}${wrapperSuffix}Route`;
24
- const content = `import { ${page.componentExport} } from "${moduleConfig.moduleName}";
25
-
26
- export default function ${wrapperName}() {
27
- return <${page.componentExport} />;
28
- }
29
- `;
30
- fs.writeFileSync(filePath, content);
31
- console.log(`⭐ Generated page: ${filePath}`);
32
- }
33
- function buildApi(moduleConfig, api) {
34
- const segments = api.path.replace(/^\//, "").split("/").filter(Boolean);
35
- const routeDir = path.join(appDirectory, ...segments);
36
- const filePath = path.join(routeDir, "route.ts");
37
- ensureDirectory(routeDir);
38
- const content = `export { ${api.handlerExport} } from "${moduleConfig.moduleName}/${api.entryPoint}";
39
- `;
40
- fs.writeFileSync(filePath, content);
41
- console.log(`🔌 Generated API route: ${filePath}`);
42
- }
43
- export function runModuleBuild() {
44
- ensureDirectory(appDirectory);
45
- for (const moduleConfig of moduleConfigs) {
46
- moduleConfig.pages.forEach((page) => buildPage(moduleConfig, page));
47
- moduleConfig.apis.forEach((api) => buildApi(moduleConfig, api));
48
- }
49
- }
50
- runModuleBuild();
@@ -1,3 +0,0 @@
1
- import type { ModuleBuildConfig } from "@lastbrain/core";
2
- export declare const moduleConfigs: ModuleBuildConfig[];
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/modules/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAGzD,eAAO,MAAM,aAAa,EAAE,iBAAiB,EAAsB,CAAC"}
@@ -1,2 +0,0 @@
1
- import authBuildConfig from "@lastbrain/module-auth/auth.build.config";
2
- export const moduleConfigs = [authBuildConfig];
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=module-registry.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"module-registry.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/module-registry.test.ts"],"names":[],"mappings":""}
@@ -1,53 +0,0 @@
1
- import { describe, it, expect } from "vitest";
2
- import { AVAILABLE_MODULES } from "@lastbrain/core/config/modules";
3
- describe("Module Registry", () => {
4
- describe("AVAILABLE_MODULES", () => {
5
- it("should have at least one module defined", () => {
6
- expect(AVAILABLE_MODULES.length).toBeGreaterThan(0);
7
- });
8
- it("should have auth module defined", () => {
9
- const authModule = AVAILABLE_MODULES.find((m) => m.name === "auth");
10
- expect(authModule).toBeDefined();
11
- expect(authModule?.package).toBe("@lastbrain/module-auth");
12
- });
13
- it("should have ai module defined", () => {
14
- const aiModule = AVAILABLE_MODULES.find((m) => m.name === "ai");
15
- expect(aiModule).toBeDefined();
16
- expect(aiModule?.package).toBe("@lastbrain/module-ai");
17
- });
18
- it("should have all required properties for each module", () => {
19
- AVAILABLE_MODULES.forEach((module) => {
20
- expect(module.name).toBeDefined();
21
- expect(module.package).toBeDefined();
22
- expect(module.emoji).toBeDefined();
23
- expect(module.description).toBeDefined();
24
- });
25
- });
26
- it("should have unique module names", () => {
27
- const names = AVAILABLE_MODULES.map((m) => m.name);
28
- const uniqueNames = new Set(names);
29
- expect(names.length).toBe(uniqueNames.size);
30
- });
31
- it("should have unique package names", () => {
32
- const packages = AVAILABLE_MODULES.map((m) => m.package);
33
- const uniquePackages = new Set(packages);
34
- expect(packages.length).toBe(uniquePackages.size);
35
- });
36
- it("should have emoji", () => {
37
- AVAILABLE_MODULES.forEach((module) => {
38
- // Check if emoji contains at least one emoji (basic check)
39
- expect(module.emoji).toMatch(/[\u{1F300}-\u{1F9FF}]/u);
40
- });
41
- });
42
- it("should have non-empty descriptions", () => {
43
- AVAILABLE_MODULES.forEach((module) => {
44
- expect(module.description.length).toBeGreaterThan(0);
45
- });
46
- });
47
- it("should have valid package names", () => {
48
- AVAILABLE_MODULES.forEach((module) => {
49
- expect(module.package).toMatch(/^@lastbrain(-labs)?\/module-/);
50
- });
51
- });
52
- });
53
- });
@@ -1,4 +0,0 @@
1
- export default function AdminShellLayout({ children, }: {
2
- children: React.ReactNode;
3
- }): import("react/jsx-runtime").JSX.Element;
4
- //# sourceMappingURL=layout.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../../../src/app-shell/(admin)/layout.tsx"],"names":[],"mappings":"AAEA,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,EACvC,QAAQ,GACT,EAAE;IACD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,2CAQA"}
@@ -1,5 +0,0 @@
1
- "use client";
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- export default function AdminShellLayout({ children, }) {
4
- return (_jsxs("div", { className: "mx-auto max-w-5xl px-4 py-16", children: [_jsx("h1", { className: "text-3xl font-bold", children: "Section Admin" }), _jsx("p", { className: "text-slate-600", children: "Gestion avanc\u00E9e des modules." }), children] }));
5
- }
@@ -1,4 +0,0 @@
1
- export default function AuthLayout({ children, }: {
2
- children: React.ReactNode;
3
- }): import("react/jsx-runtime").JSX.Element;
4
- //# sourceMappingURL=layout.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../../../src/app-shell/(auth)/layout.tsx"],"names":[],"mappings":"AAEA,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,EACjC,QAAQ,GACT,EAAE;IACD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,2CAQA"}
@@ -1,5 +0,0 @@
1
- "use client";
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- export default function AuthLayout({ children, }) {
4
- return (_jsxs("div", { className: "mx-auto max-w-5xl px-4 py-16", children: [_jsx("h1", { className: "text-3xl font-bold", children: "Section Auth" }), _jsx("p", { className: "text-slate-600", children: "Les pages authentifi\u00E9es regroup\u00E9es ici." }), children] }));
5
- }
@@ -1,2 +0,0 @@
1
- export default function PublicPage(): import("react/jsx-runtime").JSX.Element;
2
- //# sourceMappingURL=page.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"page.d.ts","sourceRoot":"","sources":["../../../../src/app-shell/(public)/page.tsx"],"names":[],"mappings":"AAEA,MAAM,CAAC,OAAO,UAAU,UAAU,4CAYjC"}
@@ -1,5 +0,0 @@
1
- "use client";
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- export default function PublicPage() {
4
- return (_jsxs("div", { className: "mx-auto max-w-3xl space-y-4 px-4 py-16 text-center", children: [_jsx("h1", { className: "text-3xl font-bold", children: "Bienvenue sur LastBrain" }), _jsx("p", { className: "text-slate-600", children: "Cette coquille publique pr\u00E9sente la structure par d\u00E9faut." }), _jsx("button", { className: "rounded-full bg-slate-900 px-5 py-2 text-white", children: "Connexion" })] }));
5
- }
@@ -1,3 +0,0 @@
1
- import { RootLayout } from "../layouts/RootLayout";
2
- export default RootLayout;
3
- //# sourceMappingURL=layout.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../../src/app-shell/layout.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,eAAe,UAAU,CAAC"}
@@ -1,3 +0,0 @@
1
- "use client";
2
- import { RootLayout } from "../layouts/RootLayout";
3
- export default RootLayout;
@@ -1,2 +0,0 @@
1
- export default function NotFound(): import("react/jsx-runtime").JSX.Element;
2
- //# sourceMappingURL=not-found.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"not-found.d.ts","sourceRoot":"","sources":["../../../src/app-shell/not-found.tsx"],"names":[],"mappings":"AAIA,MAAM,CAAC,OAAO,UAAU,QAAQ,4CAuB/B"}
@@ -1,10 +0,0 @@
1
- "use client";
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { Button } from "@lastbrain/ui";
4
- import { useRouter } from "next/navigation";
5
- export default function NotFound() {
6
- const router = useRouter();
7
- return (_jsx("div", { className: "flex min-h-screen items-center justify-center bg-background", children: _jsxs("div", { className: "mx-auto max-w-md text-center", children: [_jsx("h1", { className: "mb-4 text-6xl font-bold text-foreground", children: "404" }), _jsx("h2", { className: "mb-4 text-2xl font-semibold text-foreground", children: "Page non trouv\u00E9e" }), _jsx("p", { className: "mb-8 text-muted-foreground", children: "La page que vous recherchez n'existe pas ou a \u00E9t\u00E9 d\u00E9plac\u00E9e." }), _jsx(Button, { onPress: () => {
8
- router.back();
9
- }, className: "inline-flex items-center justify-center rounded-md bg-primary px-6 py-3 text-sm font-medium text-primary-foreground transition-colors hover:bg-primary/90", children: "Retour \u00E0 l'accueil" })] }) }));
10
- }
@@ -1,7 +0,0 @@
1
- export declare function signOut(): Promise<void>;
2
- export declare function signIn(email: string, password: string): Promise<{
3
- user: import("@supabase/supabase-js").AuthUser;
4
- session: import("@supabase/supabase-js").AuthSession;
5
- weakPassword?: import("@supabase/supabase-js").WeakPassword;
6
- }>;
7
- //# sourceMappingURL=authHelpers.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"authHelpers.d.ts","sourceRoot":"","sources":["../../../src/auth/authHelpers.ts"],"names":[],"mappings":"AAIA,wBAAsB,OAAO,kBAM5B;AAED,wBAAsB,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;;;;GAW3D"}
@@ -1,19 +0,0 @@
1
- "use client";
2
- import { supabaseBrowserClient } from "@lastbrain/core";
3
- export async function signOut() {
4
- const { error } = await supabaseBrowserClient.auth.signOut();
5
- if (error) {
6
- console.error("Error signing out:", error);
7
- throw error;
8
- }
9
- }
10
- export async function signIn(email, password) {
11
- const { data, error } = await supabaseBrowserClient.auth.signInWithPassword({
12
- email,
13
- password,
14
- });
15
- if (error) {
16
- throw error;
17
- }
18
- return data;
19
- }
@@ -1,7 +0,0 @@
1
- import type { User } from "@supabase/supabase-js";
2
- export declare function useAuthSession(): {
3
- user: User | null;
4
- loading: boolean;
5
- isSuperAdmin: boolean;
6
- };
7
- //# sourceMappingURL=useAuthSession.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useAuthSession.d.ts","sourceRoot":"","sources":["../../../src/auth/useAuthSession.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAElD,wBAAgB,cAAc;;;;EAmD7B"}
@@ -1,49 +0,0 @@
1
- "use client";
2
- import { useEffect, useState } from "react";
3
- import { supabaseBrowserClient } from "@lastbrain/core";
4
- export function useAuthSession() {
5
- const [user, setUser] = useState(null);
6
- const [loading, setLoading] = useState(true);
7
- const [isSuperAdmin, setIsSuperAdmin] = useState(false);
8
- useEffect(() => {
9
- const checkSuperAdmin = async (userId) => {
10
- try {
11
- const { data, error } = await supabaseBrowserClient.rpc("is_superadmin", { user_id: userId });
12
- if (!error && data) {
13
- setIsSuperAdmin(data);
14
- }
15
- }
16
- catch (error) {
17
- console.error("Error checking superadmin status:", error);
18
- setIsSuperAdmin(false);
19
- }
20
- finally {
21
- // Ne terminer le loading qu'après avoir vérifié le status admin
22
- setLoading(false);
23
- }
24
- };
25
- // Récupérer la session initiale
26
- supabaseBrowserClient.auth.getSession().then(({ data: { session } }) => {
27
- setUser(session?.user ?? null);
28
- if (session?.user) {
29
- checkSuperAdmin(session.user.id);
30
- }
31
- else {
32
- setLoading(false);
33
- }
34
- });
35
- // Écouter les changements d'auth
36
- const { data: { subscription }, } = supabaseBrowserClient.auth.onAuthStateChange((_event, session) => {
37
- setUser(session?.user ?? null);
38
- if (session?.user) {
39
- checkSuperAdmin(session.user.id);
40
- }
41
- else {
42
- setIsSuperAdmin(false);
43
- setLoading(false);
44
- }
45
- });
46
- return () => subscription.unsubscribe();
47
- }, []);
48
- return { user, loading, isSuperAdmin };
49
- }
package/dist/src/cli.d.ts DELETED
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
3
- //# sourceMappingURL=cli.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/cli.ts"],"names":[],"mappings":""}
package/dist/src/cli.js DELETED
@@ -1,143 +0,0 @@
1
- #!/usr/bin/env node
2
- import { Command } from "commander";
3
- import path from "path";
4
- import { initApp } from "./scripts/init-app.js";
5
- import { addModule } from "./scripts/module-add.js";
6
- import { removeModule } from "./scripts/module-remove.js";
7
- import { listModules } from "./scripts/module-list.js";
8
- import { createModule } from "./scripts/module-create.js";
9
- const program = new Command();
10
- program
11
- .name("lastbrain")
12
- .description("CLI pour créer et gérer des applications LastBrain")
13
- .version("0.1.0");
14
- program
15
- .command("init [directory]")
16
- .description("Initialise une nouvelle application Next.js LastBrain")
17
- .option("-f, --force", "Écrase les fichiers existants")
18
- .option("--no-heroui", "Ne pas utiliser HeroUI (Tailwind CSS uniquement)")
19
- .option("--with-auth", "Inclure le module d'authentification")
20
- .option("--no-interactive", "Mode non-interactif (skip la sélection des modules)")
21
- .action(async (directory, options) => {
22
- try {
23
- const targetDir = directory
24
- ? path.resolve(process.cwd(), directory)
25
- : process.cwd();
26
- await initApp({
27
- force: options.force || false,
28
- targetDir,
29
- projectName: directory || path.basename(process.cwd()),
30
- useHeroUI: options.heroui !== false, // Par défaut true, false si --no-heroui
31
- withAuth: options.withAuth || false,
32
- interactive: options.interactive !== false,
33
- });
34
- }
35
- catch (error) {
36
- console.error("❌ Erreur lors de l'initialisation:", error);
37
- process.exit(1);
38
- }
39
- });
40
- program
41
- .command("add-module <module>")
42
- .description("Ajoute un module à l'application")
43
- .action(async (moduleName) => {
44
- try {
45
- await addModule(moduleName, process.cwd());
46
- }
47
- catch (error) {
48
- console.error("❌ Erreur lors de l'ajout du module:", error);
49
- process.exit(1);
50
- }
51
- });
52
- program
53
- .command("remove-module <module>")
54
- .description("Supprime un module de l'application")
55
- .action(async (moduleName) => {
56
- try {
57
- await removeModule(moduleName, process.cwd());
58
- }
59
- catch (error) {
60
- console.error("❌ Erreur lors de la suppression du module:", error);
61
- process.exit(1);
62
- }
63
- });
64
- program
65
- .command("list-modules")
66
- .description("Liste les modules disponibles et installés")
67
- .action(async () => {
68
- try {
69
- await listModules(process.cwd());
70
- }
71
- catch (error) {
72
- console.error("❌ Erreur lors de la liste des modules:", error);
73
- process.exit(1);
74
- }
75
- });
76
- program
77
- .command("create-module")
78
- .description("Crée un nouveau module dans packages/")
79
- .action(async () => {
80
- try {
81
- await createModule();
82
- }
83
- catch (error) {
84
- console.error("❌ Erreur lors de la création du module:", error);
85
- process.exit(1);
86
- }
87
- });
88
- // Commandes de build et maintenance
89
- program
90
- .command("module:build")
91
- .description("Build les configurations de modules")
92
- .option("--debug", "Affiche tous les logs détaillés")
93
- .action(async (options) => {
94
- try {
95
- // Passer le flag debug via process.argv pour que module-build puisse le lire
96
- if (options.debug && !process.argv.includes("--debug")) {
97
- process.argv.push("--debug");
98
- }
99
- const { runModuleBuild } = await import("./scripts/module-build.js");
100
- await runModuleBuild();
101
- }
102
- catch (error) {
103
- console.error("❌ Erreur lors du build des modules:", error);
104
- process.exit(1);
105
- }
106
- });
107
- program
108
- .command("db:init")
109
- .description("Initialise la base de données Supabase")
110
- .action(async () => {
111
- try {
112
- await import("./scripts/db-init.js");
113
- }
114
- catch (error) {
115
- console.error("❌ Erreur lors de l'initialisation de la DB:", error);
116
- process.exit(1);
117
- }
118
- });
119
- program
120
- .command("db:migrations:sync")
121
- .description("Synchronise les migrations de modules")
122
- .action(async () => {
123
- try {
124
- await import("./scripts/db-migrations-sync.js");
125
- }
126
- catch (error) {
127
- console.error("❌ Erreur lors de la sync des migrations:", error);
128
- process.exit(1);
129
- }
130
- });
131
- program
132
- .command("readme:create")
133
- .description("Génère le fichier README")
134
- .action(async () => {
135
- try {
136
- await import("./scripts/readme-build.js");
137
- }
138
- catch (error) {
139
- console.error("❌ Erreur lors de la création du README:", error);
140
- process.exit(1);
141
- }
142
- });
143
- program.parse();
@@ -1,2 +0,0 @@
1
- export declare function NotificationContainer(): import("react/jsx-runtime").JSX.Element;
2
- //# sourceMappingURL=NotificationContainer.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"NotificationContainer.d.ts","sourceRoot":"","sources":["../../../src/components/NotificationContainer.tsx"],"names":[],"mappings":"AAKA,wBAAgB,qBAAqB,4CAcpC"}
@@ -1,8 +0,0 @@
1
- "use client";
2
- import { jsx as _jsx } from "react/jsx-runtime";
3
- import { Notification } from "@lastbrain/ui";
4
- import { useNotifications } from "../layouts/AppProviders";
5
- export function NotificationContainer() {
6
- const { data, loading, markAsRead, markAllAsRead, deleteNotification } = useNotifications();
7
- return (_jsx(Notification, { notifications: data.notifications, unreadCount: data.unreadCount, loading: loading, onMarkAsRead: markAsRead, onMarkAllAsRead: markAllAsRead, onDelete: deleteNotification }));
8
- }
@@ -1,30 +0,0 @@
1
- import type { User } from "@supabase/supabase-js";
2
- export interface UserNotification {
3
- id: string;
4
- owner_id: string;
5
- title: string;
6
- message: string;
7
- body?: string;
8
- type: string;
9
- read: boolean;
10
- created_at: string;
11
- updated_at: string;
12
- }
13
- export interface NotificationsData {
14
- notifications: UserNotification[];
15
- unreadCount: number;
16
- }
17
- export declare function useNotifications(user?: User | null): {
18
- data: NotificationsData;
19
- loading: boolean;
20
- error: string | null;
21
- refetch: () => Promise<void>;
22
- markAsRead: (notificationId: string) => Promise<void>;
23
- markAllAsRead: () => Promise<void>;
24
- deleteNotification: (notificationId: string) => Promise<void>;
25
- isEmpty: boolean;
26
- hasUnread: boolean;
27
- realtimeActive: boolean;
28
- lastRealtimePayload: any;
29
- };
30
- //# sourceMappingURL=useNotifications.d.ts.map