@arch-cadre/blog-module 1.0.7 → 1.0.9

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 (100) hide show
  1. package/dist/actions/index.d.ts +38 -5
  2. package/dist/actions/index.js +149 -0
  3. package/dist/components/BlogStatsWidget.d.ts +1 -2
  4. package/dist/components/BlogStatsWidget.js +17 -0
  5. package/dist/components/RecentCommentsWidget.d.ts +1 -2
  6. package/dist/components/RecentCommentsWidget.js +24 -0
  7. package/dist/components/RecentPostsWidget.d.ts +1 -2
  8. package/dist/components/RecentPostsWidget.js +24 -0
  9. package/dist/components/ui/button.d.ts +1 -1
  10. package/dist/components/ui/button.js +33 -0
  11. package/dist/components/ui/card.js +12 -0
  12. package/dist/components/ui/input.js +8 -0
  13. package/dist/components/ui/table.js +16 -0
  14. package/dist/components/ui/textarea.js +8 -0
  15. package/dist/index.js +98 -0
  16. package/dist/lib/{utils.mjs → utils.js} +1 -1
  17. package/dist/lib/validation.d.ts +2 -2
  18. package/dist/lib/validation.js +11 -0
  19. package/dist/navigation.js +21 -0
  20. package/dist/routes.js +55 -0
  21. package/dist/schema.js +60 -0
  22. package/dist/ui/views.d.ts +5 -6
  23. package/dist/ui/views.js +119 -0
  24. package/package.json +11 -17
  25. package/src/actions/index.d.ts +67 -0
  26. package/src/actions/index.js +149 -0
  27. package/src/actions/index.ts +157 -0
  28. package/src/components/BlogStatsWidget.d.ts +1 -0
  29. package/src/components/BlogStatsWidget.js +17 -0
  30. package/src/components/BlogStatsWidget.tsx +46 -0
  31. package/src/components/RecentCommentsWidget.d.ts +1 -0
  32. package/src/components/RecentCommentsWidget.js +24 -0
  33. package/src/components/RecentCommentsWidget.tsx +71 -0
  34. package/src/components/RecentPostsWidget.d.ts +1 -0
  35. package/src/components/RecentPostsWidget.js +24 -0
  36. package/src/components/RecentPostsWidget.tsx +68 -0
  37. package/src/components/ui/button.d.ts +11 -0
  38. package/src/components/ui/button.js +33 -0
  39. package/src/components/ui/button.tsx +56 -0
  40. package/src/components/ui/card.d.ts +6 -0
  41. package/src/components/ui/card.js +12 -0
  42. package/src/components/ui/card.tsx +51 -0
  43. package/src/components/ui/input.d.ts +5 -0
  44. package/src/components/ui/input.js +8 -0
  45. package/{dist/components/ui/input.mjs → src/components/ui/input.tsx} +17 -13
  46. package/src/components/ui/table.d.ts +8 -0
  47. package/src/components/ui/table.js +16 -0
  48. package/src/components/ui/table.tsx +83 -0
  49. package/src/components/ui/textarea.d.ts +5 -0
  50. package/src/components/ui/textarea.js +8 -0
  51. package/{dist/components/ui/textarea.mjs → src/components/ui/textarea.tsx} +16 -12
  52. package/src/index.d.ts +3 -0
  53. package/src/index.js +98 -0
  54. package/{dist/index.mjs → src/index.ts} +44 -18
  55. package/src/lib/utils.d.ts +2 -0
  56. package/src/lib/utils.js +5 -0
  57. package/src/lib/utils.ts +6 -0
  58. package/src/lib/validation.d.ts +24 -0
  59. package/src/lib/validation.js +11 -0
  60. package/{dist/lib/validation.mjs → src/lib/validation.ts} +5 -2
  61. package/src/navigation.d.ts +2 -0
  62. package/src/navigation.js +21 -0
  63. package/{dist/navigation.mjs → src/navigation.ts} +9 -7
  64. package/src/routes.d.ts +3 -0
  65. package/src/routes.js +55 -0
  66. package/{dist/routes.mjs → src/routes.tsx} +30 -24
  67. package/src/schema.d.ts +736 -0
  68. package/src/schema.js +60 -0
  69. package/src/schema.ts +67 -0
  70. package/src/styles/globals.css +123 -0
  71. package/src/ui/views.d.ts +15 -0
  72. package/src/ui/views.js +119 -0
  73. package/src/ui/views.tsx +538 -0
  74. package/dist/actions/index.cjs +0 -158
  75. package/dist/actions/index.mjs +0 -121
  76. package/dist/components/BlogStatsWidget.cjs +0 -45
  77. package/dist/components/BlogStatsWidget.mjs +0 -13
  78. package/dist/components/RecentCommentsWidget.cjs +0 -47
  79. package/dist/components/RecentCommentsWidget.mjs +0 -28
  80. package/dist/components/RecentPostsWidget.cjs +0 -47
  81. package/dist/components/RecentPostsWidget.mjs +0 -28
  82. package/dist/components/ui/button.cjs +0 -53
  83. package/dist/components/ui/button.mjs +0 -44
  84. package/dist/components/ui/card.cjs +0 -46
  85. package/dist/components/ui/card.mjs +0 -35
  86. package/dist/components/ui/input.cjs +0 -23
  87. package/dist/components/ui/table.cjs +0 -66
  88. package/dist/components/ui/table.mjs +0 -59
  89. package/dist/components/ui/textarea.cjs +0 -21
  90. package/dist/index.cjs +0 -100
  91. package/dist/lib/utils.cjs +0 -11
  92. package/dist/lib/validation.cjs +0 -16
  93. package/dist/navigation.cjs +0 -23
  94. package/dist/routes.cjs +0 -74
  95. package/dist/schema.cjs +0 -62
  96. package/dist/schema.mjs +0 -53
  97. package/dist/styles/globals.css +0 -1
  98. package/dist/ui/views.cjs +0 -448
  99. package/dist/ui/views.mjs +0 -232
  100. /package/{dist → src}/intl.d.ts +0 -0
package/src/index.js ADDED
@@ -0,0 +1,98 @@
1
+ import { assignPermissionToRole, createPermission, db, getRoles, permissionsTable, } from "@arch-cadre/core/server";
2
+ import { inArray, sql } from "drizzle-orm";
3
+ import manifest from "../manifest.json" with { type: "json" };
4
+ import BlogStatsWidget from "./components/BlogStatsWidget.js";
5
+ import RecentCommentsWidget from "./components/RecentCommentsWidget.js";
6
+ import RecentPostsWidget from "./components/RecentPostsWidget.js";
7
+ import { navigation } from "./navigation.js";
8
+ import { privateRoutes, publicRoutes } from "./routes.js";
9
+ const BLOG_PERMISSIONS = [
10
+ { name: "post:create", description: "Allow creating blog posts" },
11
+ { name: "post:update", description: "Allow updating blog posts" },
12
+ { name: "post:delete", description: "Allow deleting blog posts" },
13
+ { name: "comment:create", description: "Allow creating comments" },
14
+ { name: "comment:update", description: "Allow updating comments" },
15
+ { name: "comment:delete", description: "Allow deleting comments" },
16
+ ];
17
+ // --- Module Definition ---
18
+ const blogModule = {
19
+ manifest: manifest,
20
+ init: async () => {
21
+ console.log("[BlogModule] ready.");
22
+ },
23
+ widgets: [
24
+ {
25
+ id: "blog-stats",
26
+ name: "Blog Stats",
27
+ area: "dashboard-stats",
28
+ component: BlogStatsWidget,
29
+ priority: 20,
30
+ },
31
+ {
32
+ id: "recent-posts",
33
+ name: "Recent Posts",
34
+ area: "dashboard-main",
35
+ component: RecentPostsWidget,
36
+ priority: 20,
37
+ },
38
+ {
39
+ id: "recent-comments",
40
+ name: "Recent Comments",
41
+ area: "dashboard-main",
42
+ component: RecentCommentsWidget,
43
+ priority: 30,
44
+ },
45
+ ],
46
+ onEnable: async () => {
47
+ console.log("[BlogModule] enabling and registering permissions...");
48
+ try {
49
+ // 1. Create permissions
50
+ for (const perm of BLOG_PERMISSIONS) {
51
+ await createPermission(perm.name, perm.description);
52
+ }
53
+ // 2. Assign to admin role
54
+ const roles = await getRoles();
55
+ const adminRole = roles.find((r) => r.name === "admin");
56
+ if (adminRole) {
57
+ const blogPermNames = BLOG_PERMISSIONS.map((p) => p.name);
58
+ const blogPerms = await db
59
+ .select()
60
+ .from(permissionsTable)
61
+ .where(inArray(permissionsTable.name, blogPermNames));
62
+ for (const p of blogPerms) {
63
+ await assignPermissionToRole(adminRole.id, p.id);
64
+ }
65
+ console.log("[BlogModule] Permissions assigned to admin role.");
66
+ }
67
+ }
68
+ catch (error) {
69
+ console.error("[BlogModule] Error during permission registration:", error);
70
+ }
71
+ console.log("[BlogModule] enabled.");
72
+ },
73
+ onDisable: async () => {
74
+ console.log("[Blog] onDisable: Cleaning up tables and permissions...");
75
+ try {
76
+ // 1. Remove permissions (cascades to role-permission mappings)
77
+ const blogPermNames = BLOG_PERMISSIONS.map((p) => p.name);
78
+ await db
79
+ .delete(permissionsTable)
80
+ .where(inArray(permissionsTable.name, blogPermNames));
81
+ console.log("[BlogModule] Permissions and mappings removed.");
82
+ // 2. Drop tables
83
+ const tables = ["blog_posts", "blog_comments"];
84
+ for (const table of tables) {
85
+ await db.execute(sql.raw(`DROP TABLE IF EXISTS ${table} CASCADE`));
86
+ }
87
+ }
88
+ catch (e) {
89
+ console.error("[Blog] onDisable Error:", e);
90
+ }
91
+ },
92
+ routes: {
93
+ public: publicRoutes,
94
+ private: privateRoutes,
95
+ },
96
+ navigation: navigation,
97
+ };
98
+ export default blogModule;
@@ -3,62 +3,78 @@ import {
3
3
  createPermission,
4
4
  db,
5
5
  getRoles,
6
- permissionsTable
6
+ permissionsTable,
7
7
  } from "@arch-cadre/core/server";
8
+ import type { IModule } from "@arch-cadre/modules";
8
9
  import { inArray, sql } from "drizzle-orm";
9
10
  import manifest from "../manifest.json" with { type: "json" };
10
- import BlogStatsWidget from "./components/BlogStatsWidget.mjs";
11
- import RecentCommentsWidget from "./components/RecentCommentsWidget.mjs";
12
- import RecentPostsWidget from "./components/RecentPostsWidget.mjs";
13
- import { navigation } from "./navigation.mjs";
14
- import { privateRoutes, publicRoutes } from "./routes.mjs";
11
+ import BlogStatsWidget from "./components/BlogStatsWidget.js";
12
+ import RecentCommentsWidget from "./components/RecentCommentsWidget.js";
13
+ import RecentPostsWidget from "./components/RecentPostsWidget.js";
14
+ import { navigation } from "./navigation.js";
15
+ import { privateRoutes, publicRoutes } from "./routes.js";
16
+
15
17
  const BLOG_PERMISSIONS = [
16
18
  { name: "post:create", description: "Allow creating blog posts" },
17
19
  { name: "post:update", description: "Allow updating blog posts" },
18
20
  { name: "post:delete", description: "Allow deleting blog posts" },
19
21
  { name: "comment:create", description: "Allow creating comments" },
20
22
  { name: "comment:update", description: "Allow updating comments" },
21
- { name: "comment:delete", description: "Allow deleting comments" }
23
+ { name: "comment:delete", description: "Allow deleting comments" },
22
24
  ];
23
- const blogModule = {
24
- manifest,
25
+
26
+ // --- Module Definition ---
27
+ const blogModule: IModule = {
28
+ manifest: manifest as any,
29
+
25
30
  init: async () => {
26
31
  console.log("[BlogModule] ready.");
27
32
  },
33
+
28
34
  widgets: [
29
35
  {
30
36
  id: "blog-stats",
31
37
  name: "Blog Stats",
32
38
  area: "dashboard-stats",
33
39
  component: BlogStatsWidget,
34
- priority: 20
40
+ priority: 20,
35
41
  },
36
42
  {
37
43
  id: "recent-posts",
38
44
  name: "Recent Posts",
39
45
  area: "dashboard-main",
40
46
  component: RecentPostsWidget,
41
- priority: 20
47
+ priority: 20,
42
48
  },
43
49
  {
44
50
  id: "recent-comments",
45
51
  name: "Recent Comments",
46
52
  area: "dashboard-main",
47
53
  component: RecentCommentsWidget,
48
- priority: 30
49
- }
54
+ priority: 30,
55
+ },
50
56
  ],
57
+
51
58
  onEnable: async () => {
52
59
  console.log("[BlogModule] enabling and registering permissions...");
60
+
53
61
  try {
62
+ // 1. Create permissions
54
63
  for (const perm of BLOG_PERMISSIONS) {
55
64
  await createPermission(perm.name, perm.description);
56
65
  }
66
+
67
+ // 2. Assign to admin role
57
68
  const roles = await getRoles();
58
69
  const adminRole = roles.find((r) => r.name === "admin");
70
+
59
71
  if (adminRole) {
60
72
  const blogPermNames = BLOG_PERMISSIONS.map((p) => p.name);
61
- const blogPerms = await db.select().from(permissionsTable).where(inArray(permissionsTable.name, blogPermNames));
73
+ const blogPerms = await db
74
+ .select()
75
+ .from(permissionsTable)
76
+ .where(inArray(permissionsTable.name, blogPermNames));
77
+
62
78
  for (const p of blogPerms) {
63
79
  await assignPermissionToRole(adminRole.id, p.id);
64
80
  }
@@ -67,17 +83,24 @@ const blogModule = {
67
83
  } catch (error) {
68
84
  console.error(
69
85
  "[BlogModule] Error during permission registration:",
70
- error
86
+ error,
71
87
  );
72
88
  }
89
+
73
90
  console.log("[BlogModule] enabled.");
74
91
  },
92
+
75
93
  onDisable: async () => {
76
94
  console.log("[Blog] onDisable: Cleaning up tables and permissions...");
77
95
  try {
96
+ // 1. Remove permissions (cascades to role-permission mappings)
78
97
  const blogPermNames = BLOG_PERMISSIONS.map((p) => p.name);
79
- await db.delete(permissionsTable).where(inArray(permissionsTable.name, blogPermNames));
98
+ await db
99
+ .delete(permissionsTable)
100
+ .where(inArray(permissionsTable.name, blogPermNames));
80
101
  console.log("[BlogModule] Permissions and mappings removed.");
102
+
103
+ // 2. Drop tables
81
104
  const tables = ["blog_posts", "blog_comments"];
82
105
  for (const table of tables) {
83
106
  await db.execute(sql.raw(`DROP TABLE IF EXISTS ${table} CASCADE`));
@@ -86,10 +109,13 @@ const blogModule = {
86
109
  console.error("[Blog] onDisable Error:", e);
87
110
  }
88
111
  },
112
+
89
113
  routes: {
90
114
  public: publicRoutes,
91
- private: privateRoutes
115
+ private: privateRoutes,
92
116
  },
93
- navigation
117
+
118
+ navigation: navigation,
94
119
  };
120
+
95
121
  export default blogModule;
@@ -0,0 +1,2 @@
1
+ import { type ClassValue } from "clsx";
2
+ export declare function cn(...inputs: ClassValue[]): string;
@@ -0,0 +1,5 @@
1
+ import { clsx } from "clsx";
2
+ import { twMerge } from "tailwind-merge";
3
+ export function cn(...inputs) {
4
+ return twMerge(clsx(inputs));
5
+ }
@@ -0,0 +1,6 @@
1
+ import { type ClassValue, clsx } from "clsx";
2
+ import { twMerge } from "tailwind-merge";
3
+
4
+ export function cn(...inputs: ClassValue[]) {
5
+ return twMerge(clsx(inputs));
6
+ }
@@ -0,0 +1,24 @@
1
+ import { z } from "zod";
2
+ export declare const postSchema: z.ZodObject<{
3
+ title: z.ZodString;
4
+ content: z.ZodString;
5
+ slug: z.ZodString;
6
+ }, "strip", z.ZodTypeAny, {
7
+ title: string;
8
+ slug: string;
9
+ content: string;
10
+ }, {
11
+ title: string;
12
+ slug: string;
13
+ content: string;
14
+ }>;
15
+ export declare const commentSchema: z.ZodObject<{
16
+ content: z.ZodString;
17
+ postId: z.ZodString;
18
+ }, "strip", z.ZodTypeAny, {
19
+ content: string;
20
+ postId: string;
21
+ }, {
22
+ content: string;
23
+ postId: string;
24
+ }>;
@@ -0,0 +1,11 @@
1
+ import { z } from "zod";
2
+ // --- Validation Schemas ---
3
+ export const postSchema = z.object({
4
+ title: z.string().min(3, "Title must be at least 3 characters"),
5
+ content: z.string().min(10, "Content must be at least 10 characters"),
6
+ slug: z.string().min(3, "Slug is required"),
7
+ });
8
+ export const commentSchema = z.object({
9
+ content: z.string().min(2, "Comment is too short"),
10
+ postId: z.string().uuid(),
11
+ });
@@ -1,10 +1,13 @@
1
1
  import { z } from "zod";
2
+
3
+ // --- Validation Schemas ---
2
4
  export const postSchema = z.object({
3
5
  title: z.string().min(3, "Title must be at least 3 characters"),
4
6
  content: z.string().min(10, "Content must be at least 10 characters"),
5
- slug: z.string().min(3, "Slug is required")
7
+ slug: z.string().min(3, "Slug is required"),
6
8
  });
9
+
7
10
  export const commentSchema = z.object({
8
11
  content: z.string().min(2, "Comment is too short"),
9
- postId: z.string().uuid()
12
+ postId: z.string().uuid(),
10
13
  });
@@ -0,0 +1,2 @@
1
+ import type { ModuleNavigation } from "@arch-cadre/modules";
2
+ export declare const navigation: ModuleNavigation;
@@ -0,0 +1,21 @@
1
+ import { i18n } from "@arch-cadre/intl";
2
+ export const navigation = {
3
+ public: [
4
+ {
5
+ title: i18n("Blog"),
6
+ url: "/blog",
7
+ icon: "solar:pen-2-broken",
8
+ },
9
+ ],
10
+ admin: {
11
+ [i18n("CMS")]: [
12
+ {
13
+ title: i18n("Blog Manager"),
14
+ url: "/blog",
15
+ icon: "solar:posts-carousel-vertical-broken",
16
+ roles: ["admin"],
17
+ permissions: ["post:create", "post:update", "post:delete"],
18
+ },
19
+ ],
20
+ },
21
+ };
@@ -1,11 +1,13 @@
1
1
  import { i18n } from "@arch-cadre/intl";
2
- export const navigation = {
2
+ import type { ModuleNavigation } from "@arch-cadre/modules";
3
+
4
+ export const navigation: ModuleNavigation = {
3
5
  public: [
4
6
  {
5
7
  title: i18n("Blog"),
6
8
  url: "/blog",
7
- icon: "solar:pen-2-broken"
8
- }
9
+ icon: "solar:pen-2-broken",
10
+ },
9
11
  ],
10
12
  admin: {
11
13
  [i18n("CMS")]: [
@@ -14,8 +16,8 @@ export const navigation = {
14
16
  url: "/blog",
15
17
  icon: "solar:posts-carousel-vertical-broken",
16
18
  roles: ["admin"],
17
- permissions: ["post:create", "post:update", "post:delete"]
18
- }
19
- ]
20
- }
19
+ permissions: ["post:create", "post:update", "post:delete"],
20
+ },
21
+ ],
22
+ },
21
23
  };
@@ -0,0 +1,3 @@
1
+ import type { PrivateRouteDefinition, PublicRouteDefinition } from "@arch-cadre/modules";
2
+ export declare const publicRoutes: PublicRouteDefinition[];
3
+ export declare const privateRoutes: PrivateRouteDefinition[];
package/src/routes.js ADDED
@@ -0,0 +1,55 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { getCurrentSession } from "@arch-cadre/core/server";
3
+ import { getComments, getPostById, getPostBySlug, getPosts } from "./actions/index.js";
4
+ import { BlogAdminPage, BlogListPage, CreatePostForm, EditPostForm, PostDetailPage, } from "./ui/views.js";
5
+ export const publicRoutes = [
6
+ {
7
+ path: "/blog",
8
+ component: async () => {
9
+ const posts = await getPosts();
10
+ return _jsx(BlogListPage, { posts: posts });
11
+ },
12
+ auth: false,
13
+ },
14
+ {
15
+ path: "/blog/:slug",
16
+ component: async ({ params }) => {
17
+ const { slug } = await params;
18
+ const post = await getPostBySlug(slug);
19
+ const comments = post ? await getComments(post.id) : [];
20
+ const session = await getCurrentSession();
21
+ return (_jsx(PostDetailPage, { post: post, comments: comments, currentUser: session?.user }));
22
+ },
23
+ auth: false,
24
+ },
25
+ ];
26
+ export const privateRoutes = [
27
+ {
28
+ path: "/blog",
29
+ component: async () => {
30
+ const posts = await getPosts();
31
+ return _jsx(BlogAdminPage, { posts: posts });
32
+ },
33
+ auth: true,
34
+ roles: ["admin"],
35
+ permissions: ["post:create", "post:update", "post:delete"],
36
+ },
37
+ {
38
+ path: "/blog/new",
39
+ component: CreatePostForm,
40
+ auth: true,
41
+ roles: ["admin"],
42
+ permissions: ["post:create"],
43
+ },
44
+ {
45
+ path: "/blog/edit/:id",
46
+ component: async ({ params }) => {
47
+ const { id } = await params;
48
+ const post = await getPostById(id);
49
+ return _jsx(EditPostForm, { post: post });
50
+ },
51
+ auth: true,
52
+ roles: ["admin"],
53
+ permissions: ["post:update"],
54
+ },
55
+ ];
@@ -1,68 +1,74 @@
1
1
  import { getCurrentSession } from "@arch-cadre/core/server";
2
+ import type {
3
+ PrivateRouteDefinition,
4
+ PublicRouteDefinition,
5
+ } from "@arch-cadre/modules";
2
6
  import * as React from "react";
3
- import { getComments, getPostById, getPostBySlug, getPosts } from "./actions/index.mjs";
7
+ import { getComments, getPostById, getPostBySlug, getPosts } from "./actions/index.js";
4
8
  import {
5
9
  BlogAdminPage,
6
10
  BlogListPage,
7
11
  CreatePostForm,
8
12
  EditPostForm,
9
- PostDetailPage
10
- } from "./ui/views.mjs";
11
- export const publicRoutes = [
13
+ PostDetailPage,
14
+ } from "./ui/views.js";
15
+
16
+ export const publicRoutes: PublicRouteDefinition[] = [
12
17
  {
13
18
  path: "/blog",
14
19
  component: async () => {
15
20
  const posts = await getPosts();
16
- return /* @__PURE__ */ React.createElement(BlogListPage, { posts });
21
+ return <BlogListPage posts={posts} />;
17
22
  },
18
- auth: false
23
+ auth: false,
19
24
  },
20
25
  {
21
26
  path: "/blog/:slug",
22
- component: async ({ params }) => {
27
+ component: async ({ params }: any) => {
23
28
  const { slug } = await params;
24
29
  const post = await getPostBySlug(slug);
25
30
  const comments = post ? await getComments(post.id) : [];
26
31
  const session = await getCurrentSession();
27
- return /* @__PURE__ */ React.createElement(
28
- PostDetailPage,
29
- {
30
- post,
31
- comments,
32
- currentUser: session?.user
33
- }
32
+
33
+ return (
34
+ <PostDetailPage
35
+ post={post}
36
+ comments={comments}
37
+ currentUser={session?.user}
38
+ />
34
39
  );
35
40
  },
36
- auth: false
37
- }
41
+ auth: false,
42
+ },
38
43
  ];
39
- export const privateRoutes = [
44
+
45
+ export const privateRoutes: PrivateRouteDefinition[] = [
40
46
  {
41
47
  path: "/blog",
42
48
  component: async () => {
43
49
  const posts = await getPosts();
44
- return /* @__PURE__ */ React.createElement(BlogAdminPage, { posts });
50
+ return <BlogAdminPage posts={posts} />;
45
51
  },
46
52
  auth: true,
47
53
  roles: ["admin"],
48
- permissions: ["post:create", "post:update", "post:delete"]
54
+ permissions: ["post:create", "post:update", "post:delete"],
49
55
  },
50
56
  {
51
57
  path: "/blog/new",
52
58
  component: CreatePostForm,
53
59
  auth: true,
54
60
  roles: ["admin"],
55
- permissions: ["post:create"]
61
+ permissions: ["post:create"],
56
62
  },
57
63
  {
58
64
  path: "/blog/edit/:id",
59
- component: async ({ params }) => {
65
+ component: async ({ params }: any) => {
60
66
  const { id } = await params;
61
67
  const post = await getPostById(id);
62
- return /* @__PURE__ */ React.createElement(EditPostForm, { post });
68
+ return <EditPostForm post={post} />;
63
69
  },
64
70
  auth: true,
65
71
  roles: ["admin"],
66
- permissions: ["post:update"]
67
- }
72
+ permissions: ["post:update"],
73
+ },
68
74
  ];