@btst/stack 2.3.0 → 2.5.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.
Files changed (208) hide show
  1. package/dist/packages/stack/src/client/components/compose.cjs +1 -2
  2. package/dist/packages/stack/src/client/components/compose.mjs +1 -2
  3. package/dist/packages/stack/src/plugins/ai-chat/api/page-tools.cjs +71 -0
  4. package/dist/packages/stack/src/plugins/ai-chat/api/page-tools.mjs +68 -0
  5. package/dist/packages/stack/src/plugins/ai-chat/api/plugin.cjs +87 -54
  6. package/dist/packages/stack/src/plugins/ai-chat/api/plugin.mjs +87 -54
  7. package/dist/packages/stack/src/plugins/ai-chat/client/components/chat-input.cjs +2 -2
  8. package/dist/packages/stack/src/plugins/ai-chat/client/components/chat-input.mjs +2 -2
  9. package/dist/packages/stack/src/plugins/ai-chat/client/components/chat-interface.cjs +89 -22
  10. package/dist/packages/stack/src/plugins/ai-chat/client/components/chat-interface.mjs +90 -23
  11. package/dist/packages/stack/src/plugins/ai-chat/client/components/chat-layout.cjs +110 -33
  12. package/dist/packages/stack/src/plugins/ai-chat/client/components/chat-layout.mjs +112 -35
  13. package/dist/packages/stack/src/plugins/ai-chat/client/components/chat-sidebar.cjs +1 -1
  14. package/dist/packages/stack/src/plugins/ai-chat/client/components/chat-sidebar.mjs +1 -1
  15. package/dist/packages/stack/src/plugins/ai-chat/client/plugin.cjs +14 -21
  16. package/dist/packages/stack/src/plugins/ai-chat/client/plugin.mjs +15 -22
  17. package/dist/packages/stack/src/plugins/ai-chat/schemas.cjs +17 -1
  18. package/dist/packages/stack/src/plugins/ai-chat/schemas.mjs +17 -1
  19. package/dist/packages/stack/src/plugins/blog/api/plugin.cjs +28 -45
  20. package/dist/packages/stack/src/plugins/blog/api/plugin.mjs +22 -39
  21. package/dist/packages/stack/src/plugins/blog/client/components/forms/post-forms.cjs +15 -2
  22. package/dist/packages/stack/src/plugins/blog/client/components/forms/post-forms.mjs +16 -3
  23. package/dist/packages/stack/src/plugins/blog/client/components/pages/edit-post-page.internal.cjs +24 -1
  24. package/dist/packages/stack/src/plugins/blog/client/components/pages/edit-post-page.internal.mjs +24 -1
  25. package/dist/packages/stack/src/plugins/blog/client/components/pages/fill-blog-form-handler.cjs +26 -0
  26. package/dist/packages/stack/src/plugins/blog/client/components/pages/fill-blog-form-handler.mjs +24 -0
  27. package/dist/packages/stack/src/plugins/blog/client/components/pages/new-post-page.internal.cjs +30 -1
  28. package/dist/packages/stack/src/plugins/blog/client/components/pages/new-post-page.internal.mjs +30 -1
  29. package/dist/packages/stack/src/plugins/blog/client/components/pages/post-page.internal.cjs +18 -0
  30. package/dist/packages/stack/src/plugins/blog/client/components/pages/post-page.internal.mjs +18 -0
  31. package/dist/packages/stack/src/plugins/blog/client/plugin.cjs +23 -27
  32. package/dist/packages/stack/src/plugins/blog/client/plugin.mjs +24 -28
  33. package/dist/packages/stack/src/plugins/cms/api/mutations.cjs +48 -0
  34. package/dist/packages/stack/src/plugins/cms/api/mutations.mjs +46 -0
  35. package/dist/packages/stack/src/plugins/cms/api/plugin.cjs +21 -18
  36. package/dist/packages/stack/src/plugins/cms/api/plugin.mjs +21 -18
  37. package/dist/packages/stack/src/plugins/cms/client/plugin.cjs +11 -15
  38. package/dist/packages/stack/src/plugins/cms/client/plugin.mjs +12 -16
  39. package/dist/packages/stack/src/plugins/form-builder/api/plugin.cjs +58 -62
  40. package/dist/packages/stack/src/plugins/form-builder/api/plugin.mjs +58 -62
  41. package/dist/packages/stack/src/plugins/form-builder/client/plugin.cjs +12 -12
  42. package/dist/packages/stack/src/plugins/form-builder/client/plugin.mjs +13 -13
  43. package/dist/packages/stack/src/plugins/kanban/api/mutations.cjs +91 -0
  44. package/dist/packages/stack/src/plugins/kanban/api/mutations.mjs +87 -0
  45. package/dist/packages/stack/src/plugins/kanban/api/plugin.cjs +92 -118
  46. package/dist/packages/stack/src/plugins/kanban/api/plugin.mjs +89 -115
  47. package/dist/packages/stack/src/plugins/kanban/client/hooks/kanban-hooks.cjs +7 -3
  48. package/dist/packages/stack/src/plugins/kanban/client/hooks/kanban-hooks.mjs +7 -3
  49. package/dist/packages/stack/src/plugins/kanban/client/plugin.cjs +22 -29
  50. package/dist/packages/stack/src/plugins/kanban/client/plugin.mjs +23 -30
  51. package/dist/packages/stack/src/plugins/ui-builder/client/components/pages/page-builder-page.internal.cjs +89 -0
  52. package/dist/packages/stack/src/plugins/ui-builder/client/components/pages/page-builder-page.internal.mjs +89 -0
  53. package/dist/packages/stack/src/plugins/ui-builder/client/plugin.cjs +8 -8
  54. package/dist/packages/stack/src/plugins/ui-builder/client/plugin.mjs +9 -9
  55. package/dist/packages/stack/src/plugins/utils.cjs +42 -0
  56. package/dist/packages/stack/src/plugins/utils.mjs +41 -1
  57. package/dist/plugins/ai-chat/api/index.d.cts +1 -1
  58. package/dist/plugins/ai-chat/api/index.d.mts +1 -1
  59. package/dist/plugins/ai-chat/api/index.d.ts +1 -1
  60. package/dist/plugins/ai-chat/client/components/index.d.cts +1 -1
  61. package/dist/plugins/ai-chat/client/components/index.d.mts +1 -1
  62. package/dist/plugins/ai-chat/client/components/index.d.ts +1 -1
  63. package/dist/plugins/ai-chat/client/context/page-ai-context.cjs +92 -0
  64. package/dist/plugins/ai-chat/client/context/page-ai-context.d.cts +84 -0
  65. package/dist/plugins/ai-chat/client/context/page-ai-context.d.mts +84 -0
  66. package/dist/plugins/ai-chat/client/context/page-ai-context.d.ts +84 -0
  67. package/dist/plugins/ai-chat/client/context/page-ai-context.mjs +88 -0
  68. package/dist/plugins/ai-chat/client/hooks/index.d.cts +1 -1
  69. package/dist/plugins/ai-chat/client/hooks/index.d.mts +1 -1
  70. package/dist/plugins/ai-chat/client/hooks/index.d.ts +1 -1
  71. package/dist/plugins/ai-chat/client/index.d.cts +10 -10
  72. package/dist/plugins/ai-chat/client/index.d.mts +10 -10
  73. package/dist/plugins/ai-chat/client/index.d.ts +10 -10
  74. package/dist/plugins/ai-chat/query-keys.d.cts +1 -1
  75. package/dist/plugins/ai-chat/query-keys.d.mts +1 -1
  76. package/dist/plugins/ai-chat/query-keys.d.ts +1 -1
  77. package/dist/plugins/blog/api/index.d.cts +2 -2
  78. package/dist/plugins/blog/api/index.d.mts +2 -2
  79. package/dist/plugins/blog/api/index.d.ts +2 -2
  80. package/dist/plugins/blog/client/hooks/index.d.cts +2 -2
  81. package/dist/plugins/blog/client/hooks/index.d.mts +2 -2
  82. package/dist/plugins/blog/client/hooks/index.d.ts +2 -2
  83. package/dist/plugins/blog/client/index.d.cts +13 -13
  84. package/dist/plugins/blog/client/index.d.mts +13 -13
  85. package/dist/plugins/blog/client/index.d.ts +13 -13
  86. package/dist/plugins/blog/query-keys.d.cts +2 -2
  87. package/dist/plugins/blog/query-keys.d.mts +2 -2
  88. package/dist/plugins/blog/query-keys.d.ts +2 -2
  89. package/dist/plugins/client/index.cjs +1 -0
  90. package/dist/plugins/client/index.d.cts +8 -1
  91. package/dist/plugins/client/index.d.mts +8 -1
  92. package/dist/plugins/client/index.d.ts +8 -1
  93. package/dist/plugins/client/index.mjs +1 -1
  94. package/dist/plugins/cms/api/index.cjs +2 -0
  95. package/dist/plugins/cms/api/index.d.cts +2 -2
  96. package/dist/plugins/cms/api/index.d.mts +2 -2
  97. package/dist/plugins/cms/api/index.d.ts +2 -2
  98. package/dist/plugins/cms/api/index.mjs +1 -0
  99. package/dist/plugins/cms/client/hooks/index.d.cts +1 -1
  100. package/dist/plugins/cms/client/hooks/index.d.mts +1 -1
  101. package/dist/plugins/cms/client/hooks/index.d.ts +1 -1
  102. package/dist/plugins/cms/client/index.d.cts +6 -6
  103. package/dist/plugins/cms/client/index.d.mts +6 -6
  104. package/dist/plugins/cms/client/index.d.ts +6 -6
  105. package/dist/plugins/cms/query-keys.d.cts +2 -2
  106. package/dist/plugins/cms/query-keys.d.mts +2 -2
  107. package/dist/plugins/cms/query-keys.d.ts +2 -2
  108. package/dist/plugins/form-builder/api/index.d.cts +2 -2
  109. package/dist/plugins/form-builder/api/index.d.mts +2 -2
  110. package/dist/plugins/form-builder/api/index.d.ts +2 -2
  111. package/dist/plugins/form-builder/client/components/index.d.cts +1 -1
  112. package/dist/plugins/form-builder/client/components/index.d.mts +1 -1
  113. package/dist/plugins/form-builder/client/components/index.d.ts +1 -1
  114. package/dist/plugins/form-builder/client/hooks/index.d.cts +1 -1
  115. package/dist/plugins/form-builder/client/hooks/index.d.mts +1 -1
  116. package/dist/plugins/form-builder/client/hooks/index.d.ts +1 -1
  117. package/dist/plugins/form-builder/client/index.d.cts +6 -6
  118. package/dist/plugins/form-builder/client/index.d.mts +6 -6
  119. package/dist/plugins/form-builder/client/index.d.ts +6 -6
  120. package/dist/plugins/form-builder/query-keys.d.cts +2 -2
  121. package/dist/plugins/form-builder/query-keys.d.mts +2 -2
  122. package/dist/plugins/form-builder/query-keys.d.ts +2 -2
  123. package/dist/plugins/kanban/api/index.cjs +4 -0
  124. package/dist/plugins/kanban/api/index.d.cts +1 -1
  125. package/dist/plugins/kanban/api/index.d.mts +1 -1
  126. package/dist/plugins/kanban/api/index.d.ts +1 -1
  127. package/dist/plugins/kanban/api/index.mjs +1 -0
  128. package/dist/plugins/kanban/client/index.d.cts +12 -12
  129. package/dist/plugins/kanban/client/index.d.mts +12 -12
  130. package/dist/plugins/kanban/client/index.d.ts +12 -12
  131. package/dist/plugins/kanban/query-keys.d.cts +1 -1
  132. package/dist/plugins/kanban/query-keys.d.mts +1 -1
  133. package/dist/plugins/kanban/query-keys.d.ts +1 -1
  134. package/dist/plugins/ui-builder/client/hooks/index.d.cts +1 -1
  135. package/dist/plugins/ui-builder/client/hooks/index.d.mts +1 -1
  136. package/dist/plugins/ui-builder/client/hooks/index.d.ts +1 -1
  137. package/dist/plugins/ui-builder/client/index.d.cts +3 -3
  138. package/dist/plugins/ui-builder/client/index.d.mts +3 -3
  139. package/dist/plugins/ui-builder/client/index.d.ts +3 -3
  140. package/dist/plugins/ui-builder/index.d.cts +2 -2
  141. package/dist/plugins/ui-builder/index.d.mts +2 -2
  142. package/dist/plugins/ui-builder/index.d.ts +2 -2
  143. package/dist/shared/{stack.C-WUPMT6.d.cts → stack.B2xZTSiO.d.cts} +4 -4
  144. package/dist/shared/{stack.B1EeBt1b.d.ts → stack.B58oHdqm.d.mts} +33 -3
  145. package/dist/shared/{stack.CVDTkMoO.d.mts → stack.B8QD11QU.d.cts} +7 -7
  146. package/dist/shared/{stack.CVDTkMoO.d.cts → stack.B8QD11QU.d.mts} +7 -7
  147. package/dist/shared/{stack.CVDTkMoO.d.ts → stack.B8QD11QU.d.ts} +7 -7
  148. package/dist/shared/{stack.CIP6QS9l.d.ts → stack.BDVEpue1.d.ts} +1 -1
  149. package/dist/shared/{stack.C5dtIncc.d.mts → stack.BTvbxZvw.d.cts} +1 -1
  150. package/dist/shared/{stack.DaOcgmrM.d.ts → stack.BV9hnvu4.d.cts} +31 -7
  151. package/dist/shared/{stack.DaOcgmrM.d.cts → stack.BV9hnvu4.d.mts} +31 -7
  152. package/dist/shared/{stack.DaOcgmrM.d.mts → stack.BV9hnvu4.d.ts} +31 -7
  153. package/dist/shared/{stack.DdI5W6MB.d.mts → stack.BozPgbrZ.d.cts} +19 -19
  154. package/dist/shared/{stack.DdI5W6MB.d.ts → stack.BozPgbrZ.d.mts} +19 -19
  155. package/dist/shared/{stack.DdI5W6MB.d.cts → stack.BozPgbrZ.d.ts} +19 -19
  156. package/dist/shared/{stack.CP68pFEH.d.mts → stack.C9Mg2Q46.d.cts} +33 -3
  157. package/dist/shared/{stack.BeSm90va.d.ts → stack.CTDVxbrA.d.ts} +72 -14
  158. package/dist/shared/{stack.C-Ptrz8s.d.ts → stack.Cj_zKww4.d.ts} +4 -4
  159. package/dist/shared/{stack.TIBF2AOx.d.ts → stack.CxaFNQCV.d.mts} +89 -34
  160. package/dist/shared/{stack.CMh_EdxW.d.cts → stack.D-b5zbPm.d.cts} +72 -14
  161. package/dist/shared/{stack.Dw0Ly2TM.d.cts → stack.DTtmJPQO.d.mts} +1 -1
  162. package/dist/shared/{stack.BKfolAyK.d.ts → stack.DXnclTG7.d.ts} +11 -11
  163. package/dist/shared/{stack.snB1EDP7.d.cts → stack.DaZM10cp.d.cts} +11 -11
  164. package/dist/shared/{stack.Dg09R0oB.d.mts → stack.FVWf2JhZ.d.mts} +72 -14
  165. package/dist/shared/{stack.BIXEI6v_.d.mts → stack.cfCkioTe.d.mts} +11 -11
  166. package/dist/shared/{stack.6fUOjLs9.d.mts → stack.dH7u-TJH.d.mts} +4 -4
  167. package/dist/shared/{stack.BpolpQpf.d.cts → stack.j75TpKh2.d.ts} +89 -34
  168. package/dist/shared/{stack.rTy7-wQU.d.mts → stack.n1_i1p2B.d.cts} +89 -34
  169. package/dist/shared/{stack.IdtKDRka.d.cts → stack.sO33ZDhK.d.ts} +33 -3
  170. package/package.json +14 -1
  171. package/src/client/components/compose.tsx +7 -4
  172. package/src/plugins/ai-chat/api/page-tools.ts +111 -0
  173. package/src/plugins/ai-chat/api/plugin.ts +228 -72
  174. package/src/plugins/ai-chat/client/components/chat-input.tsx +2 -2
  175. package/src/plugins/ai-chat/client/components/chat-interface.tsx +154 -58
  176. package/src/plugins/ai-chat/client/components/chat-layout.tsx +166 -32
  177. package/src/plugins/ai-chat/client/components/chat-sidebar.tsx +1 -1
  178. package/src/plugins/ai-chat/client/context/page-ai-context.tsx +240 -0
  179. package/src/plugins/ai-chat/client/plugin.tsx +23 -31
  180. package/src/plugins/ai-chat/schemas.ts +16 -0
  181. package/src/plugins/blog/api/plugin.ts +31 -47
  182. package/src/plugins/blog/client/components/forms/post-forms.tsx +29 -2
  183. package/src/plugins/blog/client/components/pages/edit-post-page.internal.tsx +28 -0
  184. package/src/plugins/blog/client/components/pages/fill-blog-form-handler.ts +38 -0
  185. package/src/plugins/blog/client/components/pages/new-post-page.internal.tsx +33 -1
  186. package/src/plugins/blog/client/components/pages/post-page.internal.tsx +20 -0
  187. package/src/plugins/blog/client/plugin.tsx +36 -39
  188. package/src/plugins/client/index.ts +5 -1
  189. package/src/plugins/cms/api/index.ts +4 -0
  190. package/src/plugins/cms/api/mutations.ts +84 -0
  191. package/src/plugins/cms/api/plugin.ts +23 -17
  192. package/src/plugins/cms/client/plugin.tsx +18 -21
  193. package/src/plugins/cms/types.ts +7 -7
  194. package/src/plugins/form-builder/api/plugin.ts +64 -64
  195. package/src/plugins/form-builder/client/plugin.tsx +19 -18
  196. package/src/plugins/form-builder/types.ts +19 -24
  197. package/src/plugins/kanban/api/index.ts +6 -0
  198. package/src/plugins/kanban/api/mutations.ts +169 -0
  199. package/src/plugins/kanban/api/plugin.ts +123 -136
  200. package/src/plugins/kanban/client/hooks/kanban-hooks.tsx +4 -0
  201. package/src/plugins/kanban/client/plugin.tsx +35 -41
  202. package/src/plugins/ui-builder/client/components/pages/page-builder-page.internal.tsx +132 -0
  203. package/src/plugins/ui-builder/client/plugin.tsx +11 -10
  204. package/src/plugins/ui-builder/types.ts +4 -4
  205. package/src/plugins/utils.ts +92 -1
  206. package/dist/shared/{stack.CBON0dWL.d.mts → stack.BQmuNl5p.d.cts} +2 -2
  207. package/dist/shared/{stack.CBON0dWL.d.ts → stack.BQmuNl5p.d.mts} +2 -2
  208. package/dist/shared/{stack.CBON0dWL.d.cts → stack.BQmuNl5p.d.ts} +2 -2
@@ -1,7 +1,7 @@
1
1
  import * as _tanstack_react_query from '@tanstack/react-query';
2
2
  import { QueryClient } from '@tanstack/react-query';
3
3
  import { createApiClient } from '@btst/stack/plugins/client';
4
- import { P as Post, T as Tag, c as createPostSchema, u as updatePostSchema, S as SerializedPost, a as SerializedTag } from './stack.CBON0dWL.js';
4
+ import { P as Post, T as Tag, c as createPostSchema, u as updatePostSchema, S as SerializedPost, a as SerializedTag } from './stack.BQmuNl5p.js';
5
5
  import * as _btst_stack_plugins_api from '@btst/stack/plugins/api';
6
6
  import * as better_call from 'better-call';
7
7
  import { Adapter } from '@btst/db';
@@ -113,30 +113,30 @@ interface BlogApiContext<TBody = any, TParams = any, TQuery = any> {
113
113
  */
114
114
  interface BlogBackendHooks {
115
115
  /**
116
- * Called before listing posts. Return false to deny access.
116
+ * Called before listing posts. Throw an error to deny access.
117
117
  * @param filter - Query parameters for filtering posts
118
118
  * @param context - Request context with headers, etc.
119
119
  */
120
- onBeforeListPosts?: (filter: z.infer<typeof PostListQuerySchema>, context: BlogApiContext) => Promise<boolean> | boolean;
120
+ onBeforeListPosts?: (filter: z.infer<typeof PostListQuerySchema>, context: BlogApiContext) => Promise<void> | void;
121
121
  /**
122
- * Called before creating a post. Return false to deny access.
122
+ * Called before creating a post. Throw an error to deny access.
123
123
  * @param data - Post data being created
124
124
  * @param context - Request context with headers, etc.
125
125
  */
126
- onBeforeCreatePost?: (data: z.infer<typeof createPostSchema>, context: BlogApiContext) => Promise<boolean> | boolean;
126
+ onBeforeCreatePost?: (data: z.infer<typeof createPostSchema>, context: BlogApiContext) => Promise<void> | void;
127
127
  /**
128
- * Called before updating a post. Return false to deny access.
128
+ * Called before updating a post. Throw an error to deny access.
129
129
  * @param postId - ID of the post being updated
130
130
  * @param data - Updated post data
131
131
  * @param context - Request context with headers, etc.
132
132
  */
133
- onBeforeUpdatePost?: (postId: string, data: z.infer<typeof updatePostSchema>, context: BlogApiContext) => Promise<boolean> | boolean;
133
+ onBeforeUpdatePost?: (postId: string, data: z.infer<typeof updatePostSchema>, context: BlogApiContext) => Promise<void> | void;
134
134
  /**
135
- * Called before deleting a post. Return false to deny access.
135
+ * Called before deleting a post. Throw an error to deny access.
136
136
  * @param postId - ID of the post being deleted
137
137
  * @param context - Request context with headers, etc.
138
138
  */
139
- onBeforeDeletePost?: (postId: string, context: BlogApiContext) => Promise<boolean> | boolean;
139
+ onBeforeDeletePost?: (postId: string, context: BlogApiContext) => Promise<void> | void;
140
140
  /**
141
141
  * Called after posts are read successfully
142
142
  * @param posts - The list of posts returned by the query
@@ -218,11 +218,11 @@ declare const blogBackendPlugin: (hooks?: BlogBackendHooks) => _btst_stack_plugi
218
218
  name: z.ZodString;
219
219
  slug: z.ZodString;
220
220
  }, z.core.$strip>]>>>>;
221
+ title: z.ZodString;
221
222
  slug: z.ZodOptional<z.ZodString>;
222
- publishedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
223
223
  createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
224
224
  updatedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
225
- title: z.ZodString;
225
+ publishedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
226
226
  content: z.ZodString;
227
227
  excerpt: z.ZodString;
228
228
  image: z.ZodOptional<z.ZodString>;
@@ -1,7 +1,7 @@
1
1
  import * as _tanstack_react_query from '@tanstack/react-query';
2
2
  import { QueryClient } from '@tanstack/react-query';
3
3
  import { createApiClient } from '@btst/stack/plugins/client';
4
- import { P as Post, T as Tag, c as createPostSchema, u as updatePostSchema, S as SerializedPost, a as SerializedTag } from './stack.CBON0dWL.cjs';
4
+ import { P as Post, T as Tag, c as createPostSchema, u as updatePostSchema, S as SerializedPost, a as SerializedTag } from './stack.BQmuNl5p.cjs';
5
5
  import * as _btst_stack_plugins_api from '@btst/stack/plugins/api';
6
6
  import * as better_call from 'better-call';
7
7
  import { Adapter } from '@btst/db';
@@ -113,30 +113,30 @@ interface BlogApiContext<TBody = any, TParams = any, TQuery = any> {
113
113
  */
114
114
  interface BlogBackendHooks {
115
115
  /**
116
- * Called before listing posts. Return false to deny access.
116
+ * Called before listing posts. Throw an error to deny access.
117
117
  * @param filter - Query parameters for filtering posts
118
118
  * @param context - Request context with headers, etc.
119
119
  */
120
- onBeforeListPosts?: (filter: z.infer<typeof PostListQuerySchema>, context: BlogApiContext) => Promise<boolean> | boolean;
120
+ onBeforeListPosts?: (filter: z.infer<typeof PostListQuerySchema>, context: BlogApiContext) => Promise<void> | void;
121
121
  /**
122
- * Called before creating a post. Return false to deny access.
122
+ * Called before creating a post. Throw an error to deny access.
123
123
  * @param data - Post data being created
124
124
  * @param context - Request context with headers, etc.
125
125
  */
126
- onBeforeCreatePost?: (data: z.infer<typeof createPostSchema>, context: BlogApiContext) => Promise<boolean> | boolean;
126
+ onBeforeCreatePost?: (data: z.infer<typeof createPostSchema>, context: BlogApiContext) => Promise<void> | void;
127
127
  /**
128
- * Called before updating a post. Return false to deny access.
128
+ * Called before updating a post. Throw an error to deny access.
129
129
  * @param postId - ID of the post being updated
130
130
  * @param data - Updated post data
131
131
  * @param context - Request context with headers, etc.
132
132
  */
133
- onBeforeUpdatePost?: (postId: string, data: z.infer<typeof updatePostSchema>, context: BlogApiContext) => Promise<boolean> | boolean;
133
+ onBeforeUpdatePost?: (postId: string, data: z.infer<typeof updatePostSchema>, context: BlogApiContext) => Promise<void> | void;
134
134
  /**
135
- * Called before deleting a post. Return false to deny access.
135
+ * Called before deleting a post. Throw an error to deny access.
136
136
  * @param postId - ID of the post being deleted
137
137
  * @param context - Request context with headers, etc.
138
138
  */
139
- onBeforeDeletePost?: (postId: string, context: BlogApiContext) => Promise<boolean> | boolean;
139
+ onBeforeDeletePost?: (postId: string, context: BlogApiContext) => Promise<void> | void;
140
140
  /**
141
141
  * Called after posts are read successfully
142
142
  * @param posts - The list of posts returned by the query
@@ -218,11 +218,11 @@ declare const blogBackendPlugin: (hooks?: BlogBackendHooks) => _btst_stack_plugi
218
218
  name: z.ZodString;
219
219
  slug: z.ZodString;
220
220
  }, z.core.$strip>]>>>>;
221
+ title: z.ZodString;
221
222
  slug: z.ZodOptional<z.ZodString>;
222
- publishedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
223
223
  createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
224
224
  updatedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
225
- title: z.ZodString;
225
+ publishedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
226
226
  content: z.ZodString;
227
227
  excerpt: z.ZodString;
228
228
  image: z.ZodOptional<z.ZodString>;
@@ -5,7 +5,7 @@ import * as _btst_stack_plugins_api from '@btst/stack/plugins/api';
5
5
  import * as better_call from 'better-call';
6
6
  import * as zod_v4_core from 'zod/v4/core';
7
7
  import * as zod from 'zod';
8
- import { LanguageModel, Tool } from 'ai';
8
+ import { Tool, LanguageModel } from 'ai';
9
9
 
10
10
  /**
11
11
  * Context passed to AI Chat API hooks
@@ -24,49 +24,61 @@ interface ChatApiContext<TBody = any, TParams = any, TQuery = any> {
24
24
  */
25
25
  interface AiChatBackendHooks {
26
26
  /**
27
- * Called before processing a chat message. Return false to deny access.
27
+ * Called before processing a chat message. Throw an error to deny access.
28
28
  * @param messages - Array of messages being sent
29
29
  * @param context - Request context with headers, etc.
30
30
  */
31
31
  onBeforeChat?: (messages: Array<{
32
32
  role: string;
33
33
  content: string;
34
- }>, context: ChatApiContext) => Promise<boolean> | boolean;
34
+ }>, context: ChatApiContext) => Promise<void> | void;
35
35
  /**
36
- * Called before listing conversations. Return false to deny access.
36
+ * Called before listing conversations. Throw an error to deny access.
37
37
  * @param context - Request context with headers, etc.
38
38
  */
39
- onBeforeListConversations?: (context: ChatApiContext) => Promise<boolean> | boolean;
39
+ onBeforeListConversations?: (context: ChatApiContext) => Promise<void> | void;
40
40
  /**
41
- * Called before getting a single conversation. Return false to deny access.
41
+ * Called before getting a single conversation. Throw an error to deny access.
42
42
  * @param conversationId - ID of the conversation being accessed
43
43
  * @param context - Request context with headers, etc.
44
44
  */
45
- onBeforeGetConversation?: (conversationId: string, context: ChatApiContext) => Promise<boolean> | boolean;
45
+ onBeforeGetConversation?: (conversationId: string, context: ChatApiContext) => Promise<void> | void;
46
46
  /**
47
- * Called before creating a conversation. Return false to deny access.
47
+ * Called before creating a conversation. Throw an error to deny access.
48
48
  * @param data - Conversation data being created
49
49
  * @param context - Request context with headers, etc.
50
50
  */
51
51
  onBeforeCreateConversation?: (data: {
52
52
  id?: string;
53
53
  title?: string;
54
- }, context: ChatApiContext) => Promise<boolean> | boolean;
54
+ }, context: ChatApiContext) => Promise<void> | void;
55
55
  /**
56
- * Called before updating a conversation. Return false to deny access.
56
+ * Called before updating a conversation. Throw an error to deny access.
57
57
  * @param conversationId - ID of the conversation being updated
58
58
  * @param data - Updated conversation data
59
59
  * @param context - Request context with headers, etc.
60
60
  */
61
61
  onBeforeUpdateConversation?: (conversationId: string, data: {
62
62
  title?: string;
63
- }, context: ChatApiContext) => Promise<boolean> | boolean;
63
+ }, context: ChatApiContext) => Promise<void> | void;
64
64
  /**
65
- * Called before deleting a conversation. Return false to deny access.
65
+ * Called before deleting a conversation. Throw an error to deny access.
66
66
  * @param conversationId - ID of the conversation being deleted
67
67
  * @param context - Request context with headers, etc.
68
68
  */
69
- onBeforeDeleteConversation?: (conversationId: string, context: ChatApiContext) => Promise<boolean> | boolean;
69
+ onBeforeDeleteConversation?: (conversationId: string, context: ChatApiContext) => Promise<void> | void;
70
+ /**
71
+ * Called after the structural routeName/allowlist validation, with the list
72
+ * of tool names that passed. Return a filtered subset to further restrict
73
+ * which tools the LLM sees, or return [] to suppress all page tools.
74
+ * Throw an Error to abort the entire chat request with a 403 response.
75
+ * Not called when no tools passed the structural validation step.
76
+ *
77
+ * @param toolNames - Names that passed the routeName allowlist check
78
+ * @param routeName - routeName claimed by the request (may be undefined)
79
+ * @param context - Full request context (headers, body, etc.)
80
+ */
81
+ onBeforeToolsActivated?: (toolNames: string[], routeName: string | undefined, context: ChatApiContext) => Promise<string[]> | string[];
70
82
  /**
71
83
  * Called after a chat message is processed successfully
72
84
  * @param conversationId - ID of the conversation
@@ -152,6 +164,23 @@ type AiChatMode = "authenticated" | "public";
152
164
  /**
153
165
  * Configuration for AI Chat backend plugin
154
166
  */
167
+ /**
168
+ * Extracts only the literal (non-index-signature) keys from a type.
169
+ * For `Record<string, T>` this resolves to `never`, so collision checks are
170
+ * skipped when the tools map is typed with a broad string index.
171
+ */
172
+ type KnownKeys<T> = {
173
+ [K in keyof T]: string extends K ? never : K;
174
+ }[keyof T];
175
+ /**
176
+ * Ensures `TClientTools` has no keys that are also literal keys in `TTools`.
177
+ * Colliding keys are mapped to `never`, which produces a compile-time error
178
+ * at the point of the duplicate key. When `TTools` uses a string index
179
+ * signature the check is skipped to avoid false positives.
180
+ */
181
+ type NoKeyCollision<TTools, TClientTools extends Record<string, Tool>> = KnownKeys<TTools> & keyof TClientTools extends never ? TClientTools : {
182
+ [K in keyof TClientTools]: K extends KnownKeys<TTools> ? never : TClientTools[K];
183
+ };
155
184
  interface AiChatBackendConfig {
156
185
  /**
157
186
  * The language model to use for chat completions.
@@ -182,6 +211,29 @@ interface AiChatBackendConfig {
182
211
  * @see https://ai-sdk.dev/docs/ai-sdk-core/tools-and-tool-calling
183
212
  */
184
213
  tools?: Record<string, Tool>;
214
+ /**
215
+ * Enable route-aware page tools.
216
+ * When true, the server will include tool schemas for client-side page tools
217
+ * (e.g. fillBlogForm, updatePageLayers) based on the availableTools list
218
+ * sent with each request.
219
+ * @default false
220
+ */
221
+ enablePageTools?: boolean;
222
+ /**
223
+ * Custom client-side tool schemas for non-BTST pages.
224
+ * Merged with built-in page tool schemas (fillBlogForm, updatePageLayers).
225
+ * Only included when enablePageTools is true and the tool name appears in
226
+ * the availableTools list sent with the request.
227
+ *
228
+ * @example
229
+ * clientToolSchemas: {
230
+ * addToCart: tool({
231
+ * description: "Add current product to cart",
232
+ * parameters: z.object({ quantity: z.number().int().min(1) }),
233
+ * }),
234
+ * }
235
+ */
236
+ clientToolSchemas?: Record<string, Tool>;
185
237
  /**
186
238
  * Optional hooks for customizing plugin behavior
187
239
  */
@@ -194,7 +246,10 @@ interface AiChatBackendConfig {
194
246
  *
195
247
  * @param config - Configuration including model, tools, and optional hooks
196
248
  */
197
- declare const aiChatBackendPlugin: (config: AiChatBackendConfig) => _btst_stack_plugins_api.BackendPlugin<{
249
+ declare const aiChatBackendPlugin: <TTools extends Record<string, Tool> = Record<never, Tool>, TClientTools extends Record<string, Tool> = Record<never, Tool>>(config: Omit<AiChatBackendConfig, "tools" | "clientToolSchemas"> & {
250
+ tools?: TTools;
251
+ clientToolSchemas?: NoKeyCollision<TTools, TClientTools>;
252
+ }) => _btst_stack_plugins_api.BackendPlugin<{
198
253
  chat: better_call.StrictEndpoint<"/chat", {
199
254
  method: "POST";
200
255
  body: zod.ZodObject<{
@@ -223,6 +278,9 @@ declare const aiChatBackendPlugin: (config: AiChatBackendConfig) => _btst_stack_
223
278
  }, zod_v4_core.$strip>]>>;
224
279
  conversationId: zod.ZodOptional<zod.ZodString>;
225
280
  model: zod.ZodOptional<zod.ZodString>;
281
+ pageContext: zod.ZodOptional<zod.ZodString>;
282
+ availableTools: zod.ZodOptional<zod.ZodArray<zod.ZodString>>;
283
+ routeName: zod.ZodOptional<zod.ZodString>;
226
284
  }, zod_v4_core.$strip>;
227
285
  }, Response>;
228
286
  createConversation: better_call.StrictEndpoint<"/chat/conversations", {
@@ -1,7 +1,7 @@
1
1
  import * as _tanstack_react_query from '@tanstack/react-query';
2
2
  import { QueryClient } from '@tanstack/react-query';
3
3
  import { createApiClient } from '@btst/stack/plugins/client';
4
- import { P as Post, T as Tag, c as createPostSchema, u as updatePostSchema, S as SerializedPost, a as SerializedTag } from './stack.CBON0dWL.mjs';
4
+ import { P as Post, T as Tag, c as createPostSchema, u as updatePostSchema, S as SerializedPost, a as SerializedTag } from './stack.BQmuNl5p.mjs';
5
5
  import * as _btst_stack_plugins_api from '@btst/stack/plugins/api';
6
6
  import * as better_call from 'better-call';
7
7
  import { Adapter } from '@btst/db';
@@ -113,30 +113,30 @@ interface BlogApiContext<TBody = any, TParams = any, TQuery = any> {
113
113
  */
114
114
  interface BlogBackendHooks {
115
115
  /**
116
- * Called before listing posts. Return false to deny access.
116
+ * Called before listing posts. Throw an error to deny access.
117
117
  * @param filter - Query parameters for filtering posts
118
118
  * @param context - Request context with headers, etc.
119
119
  */
120
- onBeforeListPosts?: (filter: z.infer<typeof PostListQuerySchema>, context: BlogApiContext) => Promise<boolean> | boolean;
120
+ onBeforeListPosts?: (filter: z.infer<typeof PostListQuerySchema>, context: BlogApiContext) => Promise<void> | void;
121
121
  /**
122
- * Called before creating a post. Return false to deny access.
122
+ * Called before creating a post. Throw an error to deny access.
123
123
  * @param data - Post data being created
124
124
  * @param context - Request context with headers, etc.
125
125
  */
126
- onBeforeCreatePost?: (data: z.infer<typeof createPostSchema>, context: BlogApiContext) => Promise<boolean> | boolean;
126
+ onBeforeCreatePost?: (data: z.infer<typeof createPostSchema>, context: BlogApiContext) => Promise<void> | void;
127
127
  /**
128
- * Called before updating a post. Return false to deny access.
128
+ * Called before updating a post. Throw an error to deny access.
129
129
  * @param postId - ID of the post being updated
130
130
  * @param data - Updated post data
131
131
  * @param context - Request context with headers, etc.
132
132
  */
133
- onBeforeUpdatePost?: (postId: string, data: z.infer<typeof updatePostSchema>, context: BlogApiContext) => Promise<boolean> | boolean;
133
+ onBeforeUpdatePost?: (postId: string, data: z.infer<typeof updatePostSchema>, context: BlogApiContext) => Promise<void> | void;
134
134
  /**
135
- * Called before deleting a post. Return false to deny access.
135
+ * Called before deleting a post. Throw an error to deny access.
136
136
  * @param postId - ID of the post being deleted
137
137
  * @param context - Request context with headers, etc.
138
138
  */
139
- onBeforeDeletePost?: (postId: string, context: BlogApiContext) => Promise<boolean> | boolean;
139
+ onBeforeDeletePost?: (postId: string, context: BlogApiContext) => Promise<void> | void;
140
140
  /**
141
141
  * Called after posts are read successfully
142
142
  * @param posts - The list of posts returned by the query
@@ -218,11 +218,11 @@ declare const blogBackendPlugin: (hooks?: BlogBackendHooks) => _btst_stack_plugi
218
218
  name: z.ZodString;
219
219
  slug: z.ZodString;
220
220
  }, z.core.$strip>]>>>>;
221
+ title: z.ZodString;
221
222
  slug: z.ZodOptional<z.ZodString>;
222
- publishedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
223
223
  createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
224
224
  updatedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
225
- title: z.ZodString;
225
+ publishedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
226
226
  content: z.ZodString;
227
227
  excerpt: z.ZodString;
228
228
  image: z.ZodOptional<z.ZodString>;
@@ -83,21 +83,21 @@ interface LoaderContext {
83
83
  */
84
84
  interface UIBuilderClientHooks {
85
85
  /**
86
- * Called before loading the page list. Return false to cancel loading.
86
+ * Called before loading the page list. Throw an error to cancel loading.
87
87
  * @param context - Loader context with path, params, etc.
88
88
  */
89
- beforeLoadPageList?: (context: LoaderContext) => Promise<boolean> | boolean;
89
+ beforeLoadPageList?: (context: LoaderContext) => Promise<void> | void;
90
90
  /**
91
91
  * Called after the page list is loaded.
92
92
  * @param context - Loader context
93
93
  */
94
94
  afterLoadPageList?: (context: LoaderContext) => Promise<void> | void;
95
95
  /**
96
- * Called before loading the page builder. Return false to cancel loading.
96
+ * Called before loading the page builder. Throw an error to cancel loading.
97
97
  * @param pageId - The page ID (undefined for new pages)
98
98
  * @param context - Loader context
99
99
  */
100
- beforeLoadPageBuilder?: (pageId: string | undefined, context: LoaderContext) => Promise<boolean> | boolean;
100
+ beforeLoadPageBuilder?: (pageId: string | undefined, context: LoaderContext) => Promise<void> | void;
101
101
  /**
102
102
  * Called after the page builder is loaded.
103
103
  * @param pageId - The page ID (undefined for new pages)
@@ -1,18 +1,18 @@
1
1
  import * as _btst_stack_plugins_api from '@btst/stack/plugins/api';
2
2
  import * as better_call from 'better-call';
3
3
  import { Adapter } from '@btst/db';
4
- import { B as BoardWithColumns, d as Board, e as Column, T as Task, C as ColumnWithTasks } from './stack.DJaKVY7v.cjs';
4
+ import { B as BoardWithColumns, P as Priority, T as Task, d as Board, e as Column, C as ColumnWithTasks } from './stack.DJaKVY7v.js';
5
5
  import { z } from 'zod';
6
6
  import { QueryClient } from '@tanstack/react-query';
7
7
 
8
8
  declare const createBoardSchema: z.ZodObject<{
9
9
  description: z.ZodOptional<z.ZodString>;
10
10
  name: z.ZodString;
11
- createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
12
- updatedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
13
11
  slug: z.ZodOptional<z.ZodString>;
14
12
  ownerId: z.ZodOptional<z.ZodString>;
15
13
  organizationId: z.ZodOptional<z.ZodString>;
14
+ createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
15
+ updatedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
16
16
  }, z.core.$strip>;
17
17
  declare const updateBoardSchema: z.ZodObject<{
18
18
  createdAt: z.ZodOptional<z.ZodOptional<z.ZodCoercedDate<unknown>>>;
@@ -28,8 +28,8 @@ declare const createColumnSchema: z.ZodObject<{
28
28
  title: z.ZodString;
29
29
  createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
30
30
  updatedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
31
- boardId: z.ZodString;
32
31
  order: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
32
+ boardId: z.ZodString;
33
33
  }, z.core.$strip>;
34
34
  declare const updateColumnSchema: z.ZodObject<{
35
35
  createdAt: z.ZodOptional<z.ZodOptional<z.ZodCoercedDate<unknown>>>;
@@ -109,6 +109,58 @@ declare function getAllBoards(adapter: Adapter, params?: z.infer<typeof BoardLis
109
109
  */
110
110
  declare function getBoardById(adapter: Adapter, id: string): Promise<BoardWithColumns | null>;
111
111
 
112
+ /**
113
+ * Input for creating a new Kanban task.
114
+ */
115
+ interface CreateKanbanTaskInput {
116
+ title: string;
117
+ columnId: string;
118
+ description?: string;
119
+ priority?: Priority;
120
+ assigneeId?: string;
121
+ }
122
+ /**
123
+ * Create a new task in a Kanban column.
124
+ * Computes the next order value from existing tasks in the column.
125
+ *
126
+ * @remarks **Security:** No authorization hooks (onBeforeCreateTask) are called.
127
+ * The caller is responsible for any access-control checks before invoking this
128
+ * function.
129
+ *
130
+ * @param adapter - The database adapter
131
+ * @param input - Task creation input
132
+ */
133
+ declare function createKanbanTask(adapter: Adapter, input: CreateKanbanTaskInput): Promise<Task>;
134
+ /**
135
+ * Find a board by slug, or create it with the given name and custom column titles.
136
+ *
137
+ * Concurrency-safe at two levels:
138
+ * - **Same process**: concurrent calls with the same slug share a single in-flight
139
+ * Promise (via `_pendingBoardCreations`), so only one DB write is attempted.
140
+ * - **Cross-instance**: the DB `unique` constraint on `slug` causes the losing
141
+ * write to throw; the catch block re-fetches and returns the winner's board.
142
+ *
143
+ * @remarks **Security:** No authorization hooks are called. The caller is
144
+ * responsible for any access-control checks before invoking this function.
145
+ *
146
+ * @param adapter - The database adapter
147
+ * @param slug - Unique URL-safe slug for the board
148
+ * @param name - Display name for the board (used only on creation)
149
+ * @param columnTitles - Ordered list of column names to create (used only on creation)
150
+ */
151
+ declare function findOrCreateKanbanBoard(adapter: Adapter, slug: string, name: string, columnTitles: string[]): Promise<Board>;
152
+ /**
153
+ * Retrieve all columns for a given board, sorted by order.
154
+ * Co-located with mutations because it is primarily used alongside
155
+ * {@link createKanbanTask} to resolve column IDs before task creation.
156
+ *
157
+ * @remarks **Security:** No authorization hooks are called.
158
+ *
159
+ * @param adapter - The database adapter
160
+ * @param boardId - The board ID
161
+ */
162
+ declare function getKanbanColumnsByBoardId(adapter: Adapter, boardId: string): Promise<Column[]>;
163
+
112
164
  /**
113
165
  * Route keys for the Kanban plugin — matches the keys returned by
114
166
  * `stackClient.router.getRoute(path).routeKey`.
@@ -137,25 +189,25 @@ interface KanbanApiContext<TBody = unknown, TParams = unknown, TQuery = unknown>
137
189
  */
138
190
  interface KanbanBackendHooks {
139
191
  /**
140
- * Called before listing boards. Return false to deny access.
192
+ * Called before listing boards. Throw an error to deny access.
141
193
  */
142
- onBeforeListBoards?: (filter: z.infer<typeof BoardListQuerySchema>, context: KanbanApiContext) => Promise<boolean> | boolean;
194
+ onBeforeListBoards?: (filter: z.infer<typeof BoardListQuerySchema>, context: KanbanApiContext) => Promise<void> | void;
143
195
  /**
144
- * Called before creating a board. Return false to deny access.
196
+ * Called before creating a board. Throw an error to deny access.
145
197
  */
146
- onBeforeCreateBoard?: (data: z.infer<typeof createBoardSchema>, context: KanbanApiContext) => Promise<boolean> | boolean;
198
+ onBeforeCreateBoard?: (data: z.infer<typeof createBoardSchema>, context: KanbanApiContext) => Promise<void> | void;
147
199
  /**
148
- * Called before reading a single board. Return false to deny access.
200
+ * Called before reading a single board. Throw an error to deny access.
149
201
  */
150
- onBeforeReadBoard?: (boardId: string, context: KanbanApiContext) => Promise<boolean> | boolean;
202
+ onBeforeReadBoard?: (boardId: string, context: KanbanApiContext) => Promise<void> | void;
151
203
  /**
152
- * Called before updating a board. Return false to deny access.
204
+ * Called before updating a board. Throw an error to deny access.
153
205
  */
154
- onBeforeUpdateBoard?: (boardId: string, data: z.infer<typeof updateBoardSchema>, context: KanbanApiContext) => Promise<boolean> | boolean;
206
+ onBeforeUpdateBoard?: (boardId: string, data: z.infer<typeof updateBoardSchema>, context: KanbanApiContext) => Promise<void> | void;
155
207
  /**
156
- * Called before deleting a board. Return false to deny access.
208
+ * Called before deleting a board. Throw an error to deny access.
157
209
  */
158
- onBeforeDeleteBoard?: (boardId: string, context: KanbanApiContext) => Promise<boolean> | boolean;
210
+ onBeforeDeleteBoard?: (boardId: string, context: KanbanApiContext) => Promise<void> | void;
159
211
  /**
160
212
  * Called after boards are listed successfully.
161
213
  * Receives the items array (same shape as `board[]`) for consistency
@@ -199,17 +251,17 @@ interface KanbanBackendHooks {
199
251
  */
200
252
  onDeleteBoardError?: (error: Error, context: KanbanApiContext) => Promise<void> | void;
201
253
  /**
202
- * Called before creating a column. Return false to deny access.
254
+ * Called before creating a column. Throw an error to deny access.
203
255
  */
204
- onBeforeCreateColumn?: (data: z.infer<typeof createColumnSchema>, context: KanbanApiContext) => Promise<boolean> | boolean;
256
+ onBeforeCreateColumn?: (data: z.infer<typeof createColumnSchema>, context: KanbanApiContext) => Promise<void> | void;
205
257
  /**
206
- * Called before updating a column. Return false to deny access.
258
+ * Called before updating a column. Throw an error to deny access.
207
259
  */
208
- onBeforeUpdateColumn?: (columnId: string, data: z.infer<typeof updateColumnSchema>, context: KanbanApiContext) => Promise<boolean> | boolean;
260
+ onBeforeUpdateColumn?: (columnId: string, data: z.infer<typeof updateColumnSchema>, context: KanbanApiContext) => Promise<void> | void;
209
261
  /**
210
- * Called before deleting a column. Return false to deny access.
262
+ * Called before deleting a column. Throw an error to deny access.
211
263
  */
212
- onBeforeDeleteColumn?: (columnId: string, context: KanbanApiContext) => Promise<boolean> | boolean;
264
+ onBeforeDeleteColumn?: (columnId: string, context: KanbanApiContext) => Promise<void> | void;
213
265
  /**
214
266
  * Called after a column is created successfully
215
267
  */
@@ -223,17 +275,17 @@ interface KanbanBackendHooks {
223
275
  */
224
276
  onColumnDeleted?: (columnId: string, context: KanbanApiContext) => Promise<void> | void;
225
277
  /**
226
- * Called before creating a task. Return false to deny access.
278
+ * Called before creating a task. Throw an error to deny access.
227
279
  */
228
- onBeforeCreateTask?: (data: z.infer<typeof createTaskSchema>, context: KanbanApiContext) => Promise<boolean> | boolean;
280
+ onBeforeCreateTask?: (data: z.infer<typeof createTaskSchema>, context: KanbanApiContext) => Promise<void> | void;
229
281
  /**
230
- * Called before updating a task. Return false to deny access.
282
+ * Called before updating a task. Throw an error to deny access.
231
283
  */
232
- onBeforeUpdateTask?: (taskId: string, data: z.infer<typeof updateTaskSchema>, context: KanbanApiContext) => Promise<boolean> | boolean;
284
+ onBeforeUpdateTask?: (taskId: string, data: z.infer<typeof updateTaskSchema>, context: KanbanApiContext) => Promise<void> | void;
233
285
  /**
234
- * Called before deleting a task. Return false to deny access.
286
+ * Called before deleting a task. Throw an error to deny access.
235
287
  */
236
- onBeforeDeleteTask?: (taskId: string, context: KanbanApiContext) => Promise<boolean> | boolean;
288
+ onBeforeDeleteTask?: (taskId: string, context: KanbanApiContext) => Promise<void> | void;
237
289
  /**
238
290
  * Called after a task is created successfully
239
291
  */
@@ -272,11 +324,11 @@ declare const kanbanBackendPlugin: (hooks?: KanbanBackendHooks) => _btst_stack_p
272
324
  body: z.ZodObject<{
273
325
  description: z.ZodOptional<z.ZodString>;
274
326
  name: z.ZodString;
275
- createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
276
- updatedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
277
327
  slug: z.ZodOptional<z.ZodString>;
278
328
  ownerId: z.ZodOptional<z.ZodString>;
279
329
  organizationId: z.ZodOptional<z.ZodString>;
330
+ createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
331
+ updatedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
280
332
  }, z.core.$strip>;
281
333
  }, {
282
334
  columns: ColumnWithTasks[];
@@ -294,11 +346,11 @@ declare const kanbanBackendPlugin: (hooks?: KanbanBackendHooks) => _btst_stack_p
294
346
  body: z.ZodObject<{
295
347
  description: z.ZodOptional<z.ZodOptional<z.ZodString>>;
296
348
  name: z.ZodOptional<z.ZodString>;
297
- createdAt: z.ZodOptional<z.ZodOptional<z.ZodCoercedDate<unknown>>>;
298
- updatedAt: z.ZodOptional<z.ZodOptional<z.ZodCoercedDate<unknown>>>;
299
349
  slug: z.ZodOptional<z.ZodString>;
300
350
  ownerId: z.ZodOptional<z.ZodOptional<z.ZodString>>;
301
351
  organizationId: z.ZodOptional<z.ZodOptional<z.ZodString>>;
352
+ createdAt: z.ZodOptional<z.ZodOptional<z.ZodCoercedDate<unknown>>>;
353
+ updatedAt: z.ZodOptional<z.ZodOptional<z.ZodCoercedDate<unknown>>>;
302
354
  }, z.core.$strip>;
303
355
  }, Board>;
304
356
  readonly deleteBoard: better_call.StrictEndpoint<"/boards/:id", {
@@ -312,8 +364,8 @@ declare const kanbanBackendPlugin: (hooks?: KanbanBackendHooks) => _btst_stack_p
312
364
  title: z.ZodString;
313
365
  createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
314
366
  updatedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
315
- boardId: z.ZodString;
316
367
  order: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
368
+ boardId: z.ZodString;
317
369
  }, z.core.$strip>;
318
370
  }, Column>;
319
371
  readonly updateColumn: better_call.StrictEndpoint<"/columns/:id", {
@@ -322,8 +374,8 @@ declare const kanbanBackendPlugin: (hooks?: KanbanBackendHooks) => _btst_stack_p
322
374
  title: z.ZodOptional<z.ZodString>;
323
375
  createdAt: z.ZodOptional<z.ZodOptional<z.ZodCoercedDate<unknown>>>;
324
376
  updatedAt: z.ZodOptional<z.ZodOptional<z.ZodCoercedDate<unknown>>>;
325
- boardId: z.ZodOptional<z.ZodString>;
326
377
  order: z.ZodOptional<z.ZodDefault<z.ZodOptional<z.ZodNumber>>>;
378
+ boardId: z.ZodOptional<z.ZodString>;
327
379
  }, z.core.$strip>;
328
380
  }, Column>;
329
381
  readonly deleteColumn: better_call.StrictEndpoint<"/columns/:id", {
@@ -406,6 +458,9 @@ declare const kanbanBackendPlugin: (hooks?: KanbanBackendHooks) => _btst_stack_p
406
458
  getAllBoards: (params?: Parameters<typeof getAllBoards>[1]) => Promise<BoardListResult>;
407
459
  getBoardById: (id: string) => Promise<BoardWithColumns | null>;
408
460
  prefetchForRoute: KanbanPrefetchForRoute;
461
+ createTask: (input: Parameters<typeof createKanbanTask>[1]) => Promise<Task>;
462
+ findOrCreateBoard: (slug: string, name: string, columnTitles: string[]) => Promise<Board>;
463
+ getColumnsByBoardId: (boardId: string) => Promise<Column[]>;
409
464
  }>;
410
465
  type KanbanApiRouter = ReturnType<ReturnType<typeof kanbanBackendPlugin>["routes"]>;
411
466
 
@@ -441,5 +496,5 @@ declare const KANBAN_QUERY_KEYS: {
441
496
  boardDetail: (boardId: string) => readonly ["boards", "detail", string];
442
497
  };
443
498
 
444
- export { getBoardById as d, KANBAN_QUERY_KEYS as e, getAllBoards as g, kanbanBackendPlugin as k };
445
- export type { BoardListResult as B, KanbanApiRouter as K, KanbanRouteKey as a, KanbanApiContext as b, KanbanBackendHooks as c, BoardsListDiscriminator as f };
499
+ export { getBoardById as d, createKanbanTask as e, findOrCreateKanbanBoard as f, getAllBoards as g, getKanbanColumnsByBoardId as h, KANBAN_QUERY_KEYS as i, kanbanBackendPlugin as k };
500
+ export type { BoardListResult as B, CreateKanbanTaskInput as C, KanbanApiRouter as K, KanbanRouteKey as a, KanbanApiContext as b, KanbanBackendHooks as c, BoardsListDiscriminator as j };