@btst/stack 2.1.0 → 2.2.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 (179) hide show
  1. package/dist/api/index.cjs +9 -1
  2. package/dist/api/index.d.cts +4 -4
  3. package/dist/api/index.d.mts +4 -4
  4. package/dist/api/index.d.ts +4 -4
  5. package/dist/api/index.mjs +9 -1
  6. package/dist/client/index.d.cts +2 -2
  7. package/dist/client/index.d.mts +2 -2
  8. package/dist/client/index.d.ts +2 -2
  9. package/dist/index.d.cts +1 -1
  10. package/dist/index.d.mts +1 -1
  11. package/dist/index.d.ts +1 -1
  12. package/dist/packages/stack/src/plugins/ai-chat/api/getters.cjs +42 -0
  13. package/dist/packages/stack/src/plugins/ai-chat/api/getters.mjs +39 -0
  14. package/dist/packages/stack/src/plugins/ai-chat/api/plugin.cjs +5 -0
  15. package/dist/packages/stack/src/plugins/ai-chat/api/plugin.mjs +5 -0
  16. package/dist/packages/stack/src/plugins/blog/api/getters.cjs +131 -0
  17. package/dist/packages/stack/src/plugins/blog/api/getters.mjs +127 -0
  18. package/dist/packages/stack/src/plugins/blog/api/plugin.cjs +9 -107
  19. package/dist/packages/stack/src/plugins/blog/api/plugin.mjs +9 -107
  20. package/dist/packages/stack/src/plugins/blog/client/plugin.cjs +1 -1
  21. package/dist/packages/stack/src/plugins/blog/client/plugin.mjs +1 -1
  22. package/dist/packages/stack/src/plugins/cms/api/getters.cjs +146 -0
  23. package/dist/packages/stack/src/plugins/cms/api/getters.mjs +138 -0
  24. package/dist/packages/stack/src/plugins/cms/api/plugin.cjs +560 -622
  25. package/dist/packages/stack/src/plugins/cms/api/plugin.mjs +559 -621
  26. package/dist/packages/stack/src/plugins/cms/client/components/pages/content-editor-page.internal.cjs +1 -1
  27. package/dist/packages/stack/src/plugins/cms/client/components/pages/content-editor-page.internal.mjs +1 -1
  28. package/dist/packages/stack/src/plugins/cms/client/hooks/cms-hooks.cjs +6 -3
  29. package/dist/packages/stack/src/plugins/cms/client/hooks/cms-hooks.mjs +6 -3
  30. package/dist/packages/stack/src/plugins/form-builder/api/getters.cjs +111 -0
  31. package/dist/packages/stack/src/plugins/form-builder/api/getters.mjs +104 -0
  32. package/dist/packages/stack/src/plugins/form-builder/api/plugin.cjs +16 -88
  33. package/dist/packages/stack/src/plugins/form-builder/api/plugin.mjs +12 -84
  34. package/dist/packages/stack/src/plugins/form-builder/client/components/pages/submissions-page.internal.cjs +1 -1
  35. package/dist/packages/stack/src/plugins/form-builder/client/components/pages/submissions-page.internal.mjs +1 -1
  36. package/dist/packages/stack/src/plugins/kanban/api/getters.cjs +84 -0
  37. package/dist/packages/stack/src/plugins/kanban/api/getters.mjs +81 -0
  38. package/dist/packages/stack/src/plugins/kanban/api/plugin.cjs +9 -123
  39. package/dist/packages/stack/src/plugins/kanban/api/plugin.mjs +9 -123
  40. package/dist/packages/stack/src/plugins/kanban/client/plugin.cjs +1 -1
  41. package/dist/packages/stack/src/plugins/kanban/client/plugin.mjs +1 -1
  42. package/dist/plugins/ai-chat/api/index.cjs +3 -0
  43. package/dist/plugins/ai-chat/api/index.d.cts +27 -4
  44. package/dist/plugins/ai-chat/api/index.d.mts +27 -4
  45. package/dist/plugins/ai-chat/api/index.d.ts +27 -4
  46. package/dist/plugins/ai-chat/api/index.mjs +1 -0
  47. package/dist/plugins/ai-chat/client/hooks/index.d.cts +2 -2
  48. package/dist/plugins/ai-chat/client/hooks/index.d.mts +2 -2
  49. package/dist/plugins/ai-chat/client/hooks/index.d.ts +2 -2
  50. package/dist/plugins/ai-chat/query-keys.d.cts +9 -284
  51. package/dist/plugins/ai-chat/query-keys.d.mts +9 -284
  52. package/dist/plugins/ai-chat/query-keys.d.ts +9 -284
  53. package/dist/plugins/api/index.d.cts +4 -3
  54. package/dist/plugins/api/index.d.mts +4 -3
  55. package/dist/plugins/api/index.d.ts +4 -3
  56. package/dist/plugins/blog/api/index.cjs +4 -0
  57. package/dist/plugins/blog/api/index.d.cts +3 -2
  58. package/dist/plugins/blog/api/index.d.mts +3 -2
  59. package/dist/plugins/blog/api/index.d.ts +3 -2
  60. package/dist/plugins/blog/api/index.mjs +1 -0
  61. package/dist/plugins/blog/client/hooks/index.d.cts +4 -4
  62. package/dist/plugins/blog/client/hooks/index.d.mts +4 -4
  63. package/dist/plugins/blog/client/hooks/index.d.ts +4 -4
  64. package/dist/plugins/blog/client/index.d.cts +1 -1
  65. package/dist/plugins/blog/client/index.d.mts +1 -1
  66. package/dist/plugins/blog/client/index.d.ts +1 -1
  67. package/dist/plugins/blog/query-keys.cjs +7 -4
  68. package/dist/plugins/blog/query-keys.d.cts +81 -27
  69. package/dist/plugins/blog/query-keys.d.mts +81 -27
  70. package/dist/plugins/blog/query-keys.d.ts +81 -27
  71. package/dist/plugins/blog/query-keys.mjs +7 -4
  72. package/dist/plugins/client/index.d.cts +2 -2
  73. package/dist/plugins/client/index.d.mts +2 -2
  74. package/dist/plugins/client/index.d.ts +2 -2
  75. package/dist/plugins/cms/api/index.cjs +4 -0
  76. package/dist/plugins/cms/api/index.d.cts +61 -5
  77. package/dist/plugins/cms/api/index.d.mts +61 -5
  78. package/dist/plugins/cms/api/index.d.ts +61 -5
  79. package/dist/plugins/cms/api/index.mjs +1 -0
  80. package/dist/plugins/cms/client/hooks/index.d.cts +1 -1
  81. package/dist/plugins/cms/client/hooks/index.d.mts +1 -1
  82. package/dist/plugins/cms/client/hooks/index.d.ts +1 -1
  83. package/dist/plugins/cms/query-keys.d.cts +2 -1
  84. package/dist/plugins/cms/query-keys.d.mts +2 -1
  85. package/dist/plugins/cms/query-keys.d.ts +2 -1
  86. package/dist/plugins/form-builder/api/index.cjs +4 -0
  87. package/dist/plugins/form-builder/api/index.d.cts +77 -7
  88. package/dist/plugins/form-builder/api/index.d.mts +77 -7
  89. package/dist/plugins/form-builder/api/index.d.ts +77 -7
  90. package/dist/plugins/form-builder/api/index.mjs +1 -0
  91. package/dist/plugins/form-builder/client/components/index.d.cts +1 -1
  92. package/dist/plugins/form-builder/client/components/index.d.mts +1 -1
  93. package/dist/plugins/form-builder/client/components/index.d.ts +1 -1
  94. package/dist/plugins/form-builder/client/hooks/index.d.cts +1 -1
  95. package/dist/plugins/form-builder/client/hooks/index.d.mts +1 -1
  96. package/dist/plugins/form-builder/client/hooks/index.d.ts +1 -1
  97. package/dist/plugins/form-builder/query-keys.d.cts +2 -1
  98. package/dist/plugins/form-builder/query-keys.d.mts +2 -1
  99. package/dist/plugins/form-builder/query-keys.d.ts +2 -1
  100. package/dist/plugins/kanban/api/index.cjs +3 -0
  101. package/dist/plugins/kanban/api/index.d.cts +40 -43
  102. package/dist/plugins/kanban/api/index.d.mts +40 -43
  103. package/dist/plugins/kanban/api/index.d.ts +40 -43
  104. package/dist/plugins/kanban/api/index.mjs +1 -0
  105. package/dist/plugins/kanban/client/components/index.d.cts +1 -1
  106. package/dist/plugins/kanban/client/components/index.d.mts +1 -1
  107. package/dist/plugins/kanban/client/components/index.d.ts +1 -1
  108. package/dist/plugins/kanban/client/hooks/index.d.cts +1 -1
  109. package/dist/plugins/kanban/client/hooks/index.d.mts +1 -1
  110. package/dist/plugins/kanban/client/hooks/index.d.ts +1 -1
  111. package/dist/plugins/kanban/client/index.d.cts +1 -1
  112. package/dist/plugins/kanban/client/index.d.mts +1 -1
  113. package/dist/plugins/kanban/client/index.d.ts +1 -1
  114. package/dist/plugins/kanban/query-keys.cjs +4 -3
  115. package/dist/plugins/kanban/query-keys.d.cts +2 -1
  116. package/dist/plugins/kanban/query-keys.d.mts +2 -1
  117. package/dist/plugins/kanban/query-keys.d.ts +2 -1
  118. package/dist/plugins/kanban/query-keys.mjs +4 -3
  119. package/dist/plugins/open-api/api/index.d.cts +2 -2
  120. package/dist/plugins/open-api/api/index.d.mts +2 -2
  121. package/dist/plugins/open-api/api/index.d.ts +2 -2
  122. package/dist/plugins/route-docs/client/index.d.cts +1 -1
  123. package/dist/plugins/route-docs/client/index.d.mts +1 -1
  124. package/dist/plugins/route-docs/client/index.d.ts +1 -1
  125. package/dist/plugins/ui-builder/index.d.cts +1 -1
  126. package/dist/plugins/ui-builder/index.d.mts +1 -1
  127. package/dist/plugins/ui-builder/index.d.ts +1 -1
  128. package/dist/shared/{stack.BoA0xkJv.d.cts → stack.7n9Y_u7N.d.cts} +33 -7
  129. package/dist/shared/{stack.BoA0xkJv.d.mts → stack.7n9Y_u7N.d.mts} +33 -7
  130. package/dist/shared/{stack.BoA0xkJv.d.ts → stack.7n9Y_u7N.d.ts} +33 -7
  131. package/dist/shared/stack.BeSm90va.d.ts +289 -0
  132. package/dist/shared/{stack.DzH_wcvr.d.mts → stack.CIrIsc-A.d.cts} +2 -2
  133. package/dist/shared/{stack.DzH_wcvr.d.ts → stack.CIrIsc-A.d.mts} +2 -2
  134. package/dist/shared/{stack.DzH_wcvr.d.cts → stack.CIrIsc-A.d.ts} +2 -2
  135. package/dist/shared/stack.CMh_EdxW.d.cts +289 -0
  136. package/dist/shared/{stack.BsXokfNh.d.mts → stack.CXjzTMsb.d.cts} +1 -1
  137. package/dist/shared/{stack.BsXokfNh.d.ts → stack.CXjzTMsb.d.mts} +1 -1
  138. package/dist/shared/{stack.BsXokfNh.d.cts → stack.CXjzTMsb.d.ts} +1 -1
  139. package/dist/shared/stack.Dg09R0oB.d.mts +289 -0
  140. package/dist/shared/{stack.DKDMI-QO.d.mts → stack.QD1y_7NY.d.cts} +7 -1
  141. package/dist/shared/{stack.DKDMI-QO.d.ts → stack.QD1y_7NY.d.mts} +7 -1
  142. package/dist/shared/{stack.DKDMI-QO.d.cts → stack.QD1y_7NY.d.ts} +7 -1
  143. package/package.json +1 -1
  144. package/src/__tests__/stack-api.test.ts +118 -0
  145. package/src/api/index.ts +15 -1
  146. package/src/plugins/ai-chat/__tests__/getters.test.ts +109 -0
  147. package/src/plugins/ai-chat/api/getters.ts +71 -0
  148. package/src/plugins/ai-chat/api/index.ts +1 -0
  149. package/src/plugins/ai-chat/api/plugin.ts +8 -0
  150. package/src/plugins/api/index.ts +3 -1
  151. package/src/plugins/blog/__tests__/getters.test.ts +540 -0
  152. package/src/plugins/blog/api/getters.ts +243 -0
  153. package/src/plugins/blog/api/index.ts +7 -0
  154. package/src/plugins/blog/api/plugin.ts +13 -141
  155. package/src/plugins/blog/client/plugin.tsx +2 -1
  156. package/src/plugins/blog/query-keys.ts +16 -13
  157. package/src/plugins/cms/__tests__/getters.test.ts +206 -0
  158. package/src/plugins/cms/api/getters.ts +244 -0
  159. package/src/plugins/cms/api/index.ts +5 -0
  160. package/src/plugins/cms/api/plugin.ts +50 -154
  161. package/src/plugins/cms/client/components/pages/content-editor-page.internal.tsx +1 -1
  162. package/src/plugins/cms/client/hooks/cms-hooks.tsx +3 -0
  163. package/src/plugins/cms/types.ts +1 -1
  164. package/src/plugins/form-builder/__tests__/getters.test.ts +159 -0
  165. package/src/plugins/form-builder/api/getters.ts +203 -0
  166. package/src/plugins/form-builder/api/index.ts +1 -0
  167. package/src/plugins/form-builder/api/plugin.ts +22 -115
  168. package/src/plugins/form-builder/client/components/pages/submissions-page.internal.tsx +1 -1
  169. package/src/plugins/form-builder/types.ts +2 -2
  170. package/src/plugins/kanban/__tests__/getters.test.ts +172 -0
  171. package/src/plugins/kanban/api/getters.ts +149 -0
  172. package/src/plugins/kanban/api/index.ts +1 -0
  173. package/src/plugins/kanban/api/plugin.ts +16 -146
  174. package/src/plugins/kanban/client/plugin.tsx +2 -1
  175. package/src/plugins/kanban/query-keys.ts +8 -5
  176. package/src/types.ts +44 -5
  177. package/dist/shared/{stack.CbuN2zVV.d.cts → stack.BkYlUT_8.d.cts} +6 -6
  178. package/dist/shared/{stack.CbuN2zVV.d.mts → stack.BkYlUT_8.d.mts} +6 -6
  179. package/dist/shared/{stack.CbuN2zVV.d.ts → stack.BkYlUT_8.d.ts} +6 -6
@@ -1,10 +1,11 @@
1
1
  import * as _tanstack_react_query from '@tanstack/react-query';
2
2
  import { createApiClient } from '@btst/stack/plugins/client';
3
- import { P as PaginatedForms, S as SerializedForm, c as PaginatedFormSubmissions, b as SerializedFormSubmissionWithData } from '../../shared/stack.DzH_wcvr.cjs';
3
+ import { P as PaginatedForms, S as SerializedForm, c as PaginatedFormSubmissions, b as SerializedFormSubmissionWithData } from '../../shared/stack.CIrIsc-A.cjs';
4
4
  import { FormBuilderApiRouter } from './api/index.cjs';
5
5
  import '@btst/stack/plugins/api';
6
6
  import 'better-call';
7
7
  import 'zod';
8
+ import '@btst/db';
8
9
 
9
10
  interface FormListParams {
10
11
  status?: "active" | "inactive" | "archived";
@@ -1,10 +1,11 @@
1
1
  import * as _tanstack_react_query from '@tanstack/react-query';
2
2
  import { createApiClient } from '@btst/stack/plugins/client';
3
- import { P as PaginatedForms, S as SerializedForm, c as PaginatedFormSubmissions, b as SerializedFormSubmissionWithData } from '../../shared/stack.DzH_wcvr.mjs';
3
+ import { P as PaginatedForms, S as SerializedForm, c as PaginatedFormSubmissions, b as SerializedFormSubmissionWithData } from '../../shared/stack.CIrIsc-A.mjs';
4
4
  import { FormBuilderApiRouter } from './api/index.mjs';
5
5
  import '@btst/stack/plugins/api';
6
6
  import 'better-call';
7
7
  import 'zod';
8
+ import '@btst/db';
8
9
 
9
10
  interface FormListParams {
10
11
  status?: "active" | "inactive" | "archived";
@@ -1,10 +1,11 @@
1
1
  import * as _tanstack_react_query from '@tanstack/react-query';
2
2
  import { createApiClient } from '@btst/stack/plugins/client';
3
- import { P as PaginatedForms, S as SerializedForm, c as PaginatedFormSubmissions, b as SerializedFormSubmissionWithData } from '../../shared/stack.DzH_wcvr.js';
3
+ import { P as PaginatedForms, S as SerializedForm, c as PaginatedFormSubmissions, b as SerializedFormSubmissionWithData } from '../../shared/stack.CIrIsc-A.js';
4
4
  import { FormBuilderApiRouter } from './api/index.js';
5
5
  import '@btst/stack/plugins/api';
6
6
  import 'better-call';
7
7
  import 'zod';
8
+ import '@btst/db';
8
9
 
9
10
  interface FormListParams {
10
11
  status?: "active" | "inactive" | "archived";
@@ -1,7 +1,10 @@
1
1
  'use strict';
2
2
 
3
3
  const plugin = require('../../../packages/stack/src/plugins/kanban/api/plugin.cjs');
4
+ const getters = require('../../../packages/stack/src/plugins/kanban/api/getters.cjs');
4
5
 
5
6
 
6
7
 
7
8
  exports.kanbanBackendPlugin = plugin.kanbanBackendPlugin;
9
+ exports.getAllBoards = getters.getAllBoards;
10
+ exports.getBoardById = getters.getBoardById;
@@ -1,7 +1,8 @@
1
1
  import * as _btst_stack_plugins_api from '@btst/stack/plugins/api';
2
2
  import * as better_call from 'better-call';
3
+ import { Adapter } from '@btst/db';
4
+ import { B as BoardWithColumns, d as Board, C as Column, T as Task, e as ColumnWithTasks } from '../../../shared/stack.QD1y_7NY.cjs';
3
5
  import { z } from 'zod';
4
- import { B as Board, C as Column, T as Task, d as ColumnWithTasks } from '../../../shared/stack.DKDMI-QO.cjs';
5
6
 
6
7
  declare const createBoardSchema: z.ZodObject<{
7
8
  description: z.ZodOptional<z.ZodString>;
@@ -80,6 +81,33 @@ declare const BoardListQuerySchema: z.ZodObject<{
80
81
  limit: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
81
82
  }, z.core.$strip>;
82
83
 
84
+ /**
85
+ * Paginated result returned by {@link getAllBoards}.
86
+ */
87
+ interface BoardListResult {
88
+ items: BoardWithColumns[];
89
+ total: number;
90
+ limit?: number;
91
+ offset?: number;
92
+ }
93
+ /**
94
+ * Retrieve all boards matching optional filter criteria, with columns and tasks.
95
+ * Pure DB function - no hooks, no HTTP context. Safe for SSG and server-side use.
96
+ *
97
+ * @param adapter - The database adapter
98
+ * @param params - Optional filter/pagination parameters (same shape as the list API query)
99
+ */
100
+ declare function getAllBoards(adapter: Adapter, params?: z.infer<typeof BoardListQuerySchema>): Promise<BoardListResult>;
101
+ /**
102
+ * Retrieve a single board by its ID, with all columns and tasks.
103
+ * Returns null if the board is not found.
104
+ * Pure DB function - no hooks, no HTTP context. Safe for SSG and server-side use.
105
+ *
106
+ * @param adapter - The database adapter
107
+ * @param id - The board ID
108
+ */
109
+ declare function getBoardById(adapter: Adapter, id: string): Promise<BoardWithColumns | null>;
110
+
83
111
  /**
84
112
  * Context passed to kanban API hooks
85
113
  */
@@ -117,9 +145,11 @@ interface KanbanBackendHooks {
117
145
  */
118
146
  onBeforeDeleteBoard?: (boardId: string, context: KanbanApiContext) => Promise<boolean> | boolean;
119
147
  /**
120
- * Called after boards are listed successfully
148
+ * Called after boards are listed successfully.
149
+ * Receives the items array (same shape as `board[]`) for consistency
150
+ * with analogous hooks in other plugins (e.g. `onPostsRead`).
121
151
  */
122
- onBoardsRead?: (boards: Board[], filter: z.infer<typeof BoardListQuerySchema>, context: KanbanApiContext) => Promise<void> | void;
152
+ onBoardsRead?: (boards: BoardWithColumns[], filter: z.infer<typeof BoardListQuerySchema>, context: KanbanApiContext) => Promise<void> | void;
123
153
  /**
124
154
  * Called after a single board is read successfully
125
155
  */
@@ -221,46 +251,10 @@ declare const kanbanBackendPlugin: (hooks?: KanbanBackendHooks) => _btst_stack_p
221
251
  offset: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
222
252
  limit: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
223
253
  }, z.core.$strip>;
224
- }, {
225
- columns: {
226
- tasks: Task[];
227
- id: string;
228
- title: string;
229
- order: number;
230
- boardId: string;
231
- createdAt: Date;
232
- updatedAt: Date;
233
- }[];
234
- id: string;
235
- name: string;
236
- slug: string;
237
- description?: string;
238
- ownerId?: string;
239
- organizationId?: string;
240
- createdAt: Date;
241
- updatedAt: Date;
242
- }[]>;
254
+ }, BoardListResult>;
243
255
  readonly getBoard: better_call.StrictEndpoint<"/boards/:id", {
244
256
  method: "GET";
245
- }, {
246
- columns: {
247
- tasks: Task[];
248
- id: string;
249
- title: string;
250
- order: number;
251
- boardId: string;
252
- createdAt: Date;
253
- updatedAt: Date;
254
- }[];
255
- id: string;
256
- name: string;
257
- slug: string;
258
- description?: string;
259
- ownerId?: string;
260
- organizationId?: string;
261
- createdAt: Date;
262
- updatedAt: Date;
263
- }>;
257
+ }, BoardWithColumns>;
264
258
  readonly createBoard: better_call.StrictEndpoint<"/boards", {
265
259
  method: "POST";
266
260
  body: z.ZodObject<{
@@ -396,8 +390,11 @@ declare const kanbanBackendPlugin: (hooks?: KanbanBackendHooks) => _btst_stack_p
396
390
  }, {
397
391
  success: boolean;
398
392
  }>;
393
+ }, {
394
+ getAllBoards: (params?: Parameters<typeof getAllBoards>[1]) => Promise<BoardListResult>;
395
+ getBoardById: (id: string) => Promise<BoardWithColumns | null>;
399
396
  }>;
400
397
  type KanbanApiRouter = ReturnType<ReturnType<typeof kanbanBackendPlugin>["routes"]>;
401
398
 
402
- export { kanbanBackendPlugin };
403
- export type { KanbanApiContext, KanbanApiRouter, KanbanBackendHooks };
399
+ export { getAllBoards, getBoardById, kanbanBackendPlugin };
400
+ export type { BoardListResult, KanbanApiContext, KanbanApiRouter, KanbanBackendHooks };
@@ -1,7 +1,8 @@
1
1
  import * as _btst_stack_plugins_api from '@btst/stack/plugins/api';
2
2
  import * as better_call from 'better-call';
3
+ import { Adapter } from '@btst/db';
4
+ import { B as BoardWithColumns, d as Board, C as Column, T as Task, e as ColumnWithTasks } from '../../../shared/stack.QD1y_7NY.mjs';
3
5
  import { z } from 'zod';
4
- import { B as Board, C as Column, T as Task, d as ColumnWithTasks } from '../../../shared/stack.DKDMI-QO.mjs';
5
6
 
6
7
  declare const createBoardSchema: z.ZodObject<{
7
8
  description: z.ZodOptional<z.ZodString>;
@@ -80,6 +81,33 @@ declare const BoardListQuerySchema: z.ZodObject<{
80
81
  limit: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
81
82
  }, z.core.$strip>;
82
83
 
84
+ /**
85
+ * Paginated result returned by {@link getAllBoards}.
86
+ */
87
+ interface BoardListResult {
88
+ items: BoardWithColumns[];
89
+ total: number;
90
+ limit?: number;
91
+ offset?: number;
92
+ }
93
+ /**
94
+ * Retrieve all boards matching optional filter criteria, with columns and tasks.
95
+ * Pure DB function - no hooks, no HTTP context. Safe for SSG and server-side use.
96
+ *
97
+ * @param adapter - The database adapter
98
+ * @param params - Optional filter/pagination parameters (same shape as the list API query)
99
+ */
100
+ declare function getAllBoards(adapter: Adapter, params?: z.infer<typeof BoardListQuerySchema>): Promise<BoardListResult>;
101
+ /**
102
+ * Retrieve a single board by its ID, with all columns and tasks.
103
+ * Returns null if the board is not found.
104
+ * Pure DB function - no hooks, no HTTP context. Safe for SSG and server-side use.
105
+ *
106
+ * @param adapter - The database adapter
107
+ * @param id - The board ID
108
+ */
109
+ declare function getBoardById(adapter: Adapter, id: string): Promise<BoardWithColumns | null>;
110
+
83
111
  /**
84
112
  * Context passed to kanban API hooks
85
113
  */
@@ -117,9 +145,11 @@ interface KanbanBackendHooks {
117
145
  */
118
146
  onBeforeDeleteBoard?: (boardId: string, context: KanbanApiContext) => Promise<boolean> | boolean;
119
147
  /**
120
- * Called after boards are listed successfully
148
+ * Called after boards are listed successfully.
149
+ * Receives the items array (same shape as `board[]`) for consistency
150
+ * with analogous hooks in other plugins (e.g. `onPostsRead`).
121
151
  */
122
- onBoardsRead?: (boards: Board[], filter: z.infer<typeof BoardListQuerySchema>, context: KanbanApiContext) => Promise<void> | void;
152
+ onBoardsRead?: (boards: BoardWithColumns[], filter: z.infer<typeof BoardListQuerySchema>, context: KanbanApiContext) => Promise<void> | void;
123
153
  /**
124
154
  * Called after a single board is read successfully
125
155
  */
@@ -221,46 +251,10 @@ declare const kanbanBackendPlugin: (hooks?: KanbanBackendHooks) => _btst_stack_p
221
251
  offset: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
222
252
  limit: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
223
253
  }, z.core.$strip>;
224
- }, {
225
- columns: {
226
- tasks: Task[];
227
- id: string;
228
- title: string;
229
- order: number;
230
- boardId: string;
231
- createdAt: Date;
232
- updatedAt: Date;
233
- }[];
234
- id: string;
235
- name: string;
236
- slug: string;
237
- description?: string;
238
- ownerId?: string;
239
- organizationId?: string;
240
- createdAt: Date;
241
- updatedAt: Date;
242
- }[]>;
254
+ }, BoardListResult>;
243
255
  readonly getBoard: better_call.StrictEndpoint<"/boards/:id", {
244
256
  method: "GET";
245
- }, {
246
- columns: {
247
- tasks: Task[];
248
- id: string;
249
- title: string;
250
- order: number;
251
- boardId: string;
252
- createdAt: Date;
253
- updatedAt: Date;
254
- }[];
255
- id: string;
256
- name: string;
257
- slug: string;
258
- description?: string;
259
- ownerId?: string;
260
- organizationId?: string;
261
- createdAt: Date;
262
- updatedAt: Date;
263
- }>;
257
+ }, BoardWithColumns>;
264
258
  readonly createBoard: better_call.StrictEndpoint<"/boards", {
265
259
  method: "POST";
266
260
  body: z.ZodObject<{
@@ -396,8 +390,11 @@ declare const kanbanBackendPlugin: (hooks?: KanbanBackendHooks) => _btst_stack_p
396
390
  }, {
397
391
  success: boolean;
398
392
  }>;
393
+ }, {
394
+ getAllBoards: (params?: Parameters<typeof getAllBoards>[1]) => Promise<BoardListResult>;
395
+ getBoardById: (id: string) => Promise<BoardWithColumns | null>;
399
396
  }>;
400
397
  type KanbanApiRouter = ReturnType<ReturnType<typeof kanbanBackendPlugin>["routes"]>;
401
398
 
402
- export { kanbanBackendPlugin };
403
- export type { KanbanApiContext, KanbanApiRouter, KanbanBackendHooks };
399
+ export { getAllBoards, getBoardById, kanbanBackendPlugin };
400
+ export type { BoardListResult, KanbanApiContext, KanbanApiRouter, KanbanBackendHooks };
@@ -1,7 +1,8 @@
1
1
  import * as _btst_stack_plugins_api from '@btst/stack/plugins/api';
2
2
  import * as better_call from 'better-call';
3
+ import { Adapter } from '@btst/db';
4
+ import { B as BoardWithColumns, d as Board, C as Column, T as Task, e as ColumnWithTasks } from '../../../shared/stack.QD1y_7NY.js';
3
5
  import { z } from 'zod';
4
- import { B as Board, C as Column, T as Task, d as ColumnWithTasks } from '../../../shared/stack.DKDMI-QO.js';
5
6
 
6
7
  declare const createBoardSchema: z.ZodObject<{
7
8
  description: z.ZodOptional<z.ZodString>;
@@ -80,6 +81,33 @@ declare const BoardListQuerySchema: z.ZodObject<{
80
81
  limit: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
81
82
  }, z.core.$strip>;
82
83
 
84
+ /**
85
+ * Paginated result returned by {@link getAllBoards}.
86
+ */
87
+ interface BoardListResult {
88
+ items: BoardWithColumns[];
89
+ total: number;
90
+ limit?: number;
91
+ offset?: number;
92
+ }
93
+ /**
94
+ * Retrieve all boards matching optional filter criteria, with columns and tasks.
95
+ * Pure DB function - no hooks, no HTTP context. Safe for SSG and server-side use.
96
+ *
97
+ * @param adapter - The database adapter
98
+ * @param params - Optional filter/pagination parameters (same shape as the list API query)
99
+ */
100
+ declare function getAllBoards(adapter: Adapter, params?: z.infer<typeof BoardListQuerySchema>): Promise<BoardListResult>;
101
+ /**
102
+ * Retrieve a single board by its ID, with all columns and tasks.
103
+ * Returns null if the board is not found.
104
+ * Pure DB function - no hooks, no HTTP context. Safe for SSG and server-side use.
105
+ *
106
+ * @param adapter - The database adapter
107
+ * @param id - The board ID
108
+ */
109
+ declare function getBoardById(adapter: Adapter, id: string): Promise<BoardWithColumns | null>;
110
+
83
111
  /**
84
112
  * Context passed to kanban API hooks
85
113
  */
@@ -117,9 +145,11 @@ interface KanbanBackendHooks {
117
145
  */
118
146
  onBeforeDeleteBoard?: (boardId: string, context: KanbanApiContext) => Promise<boolean> | boolean;
119
147
  /**
120
- * Called after boards are listed successfully
148
+ * Called after boards are listed successfully.
149
+ * Receives the items array (same shape as `board[]`) for consistency
150
+ * with analogous hooks in other plugins (e.g. `onPostsRead`).
121
151
  */
122
- onBoardsRead?: (boards: Board[], filter: z.infer<typeof BoardListQuerySchema>, context: KanbanApiContext) => Promise<void> | void;
152
+ onBoardsRead?: (boards: BoardWithColumns[], filter: z.infer<typeof BoardListQuerySchema>, context: KanbanApiContext) => Promise<void> | void;
123
153
  /**
124
154
  * Called after a single board is read successfully
125
155
  */
@@ -221,46 +251,10 @@ declare const kanbanBackendPlugin: (hooks?: KanbanBackendHooks) => _btst_stack_p
221
251
  offset: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
222
252
  limit: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
223
253
  }, z.core.$strip>;
224
- }, {
225
- columns: {
226
- tasks: Task[];
227
- id: string;
228
- title: string;
229
- order: number;
230
- boardId: string;
231
- createdAt: Date;
232
- updatedAt: Date;
233
- }[];
234
- id: string;
235
- name: string;
236
- slug: string;
237
- description?: string;
238
- ownerId?: string;
239
- organizationId?: string;
240
- createdAt: Date;
241
- updatedAt: Date;
242
- }[]>;
254
+ }, BoardListResult>;
243
255
  readonly getBoard: better_call.StrictEndpoint<"/boards/:id", {
244
256
  method: "GET";
245
- }, {
246
- columns: {
247
- tasks: Task[];
248
- id: string;
249
- title: string;
250
- order: number;
251
- boardId: string;
252
- createdAt: Date;
253
- updatedAt: Date;
254
- }[];
255
- id: string;
256
- name: string;
257
- slug: string;
258
- description?: string;
259
- ownerId?: string;
260
- organizationId?: string;
261
- createdAt: Date;
262
- updatedAt: Date;
263
- }>;
257
+ }, BoardWithColumns>;
264
258
  readonly createBoard: better_call.StrictEndpoint<"/boards", {
265
259
  method: "POST";
266
260
  body: z.ZodObject<{
@@ -396,8 +390,11 @@ declare const kanbanBackendPlugin: (hooks?: KanbanBackendHooks) => _btst_stack_p
396
390
  }, {
397
391
  success: boolean;
398
392
  }>;
393
+ }, {
394
+ getAllBoards: (params?: Parameters<typeof getAllBoards>[1]) => Promise<BoardListResult>;
395
+ getBoardById: (id: string) => Promise<BoardWithColumns | null>;
399
396
  }>;
400
397
  type KanbanApiRouter = ReturnType<ReturnType<typeof kanbanBackendPlugin>["routes"]>;
401
398
 
402
- export { kanbanBackendPlugin };
403
- export type { KanbanApiContext, KanbanApiRouter, KanbanBackendHooks };
399
+ export { getAllBoards, getBoardById, kanbanBackendPlugin };
400
+ export type { BoardListResult, KanbanApiContext, KanbanApiRouter, KanbanBackendHooks };
@@ -1 +1,2 @@
1
1
  export { kanbanBackendPlugin } from '../../../packages/stack/src/plugins/kanban/api/plugin.mjs';
2
+ export { getAllBoards, getBoardById } from '../../../packages/stack/src/plugins/kanban/api/getters.mjs';
@@ -1,7 +1,7 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as react from 'react';
3
3
  import { HTMLAttributes, ReactNode } from 'react';
4
- import { b as SerializedColumn, c as SerializedTask, a as SerializedBoard } from '../../../../shared/stack.DKDMI-QO.cjs';
4
+ import { b as SerializedColumn, c as SerializedTask, a as SerializedBoard } from '../../../../shared/stack.QD1y_7NY.cjs';
5
5
 
6
6
  declare function BoardsListPageComponent(): react_jsx_runtime.JSX.Element;
7
7
 
@@ -1,7 +1,7 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as react from 'react';
3
3
  import { HTMLAttributes, ReactNode } from 'react';
4
- import { b as SerializedColumn, c as SerializedTask, a as SerializedBoard } from '../../../../shared/stack.DKDMI-QO.mjs';
4
+ import { b as SerializedColumn, c as SerializedTask, a as SerializedBoard } from '../../../../shared/stack.QD1y_7NY.mjs';
5
5
 
6
6
  declare function BoardsListPageComponent(): react_jsx_runtime.JSX.Element;
7
7
 
@@ -1,7 +1,7 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as react from 'react';
3
3
  import { HTMLAttributes, ReactNode } from 'react';
4
- import { b as SerializedColumn, c as SerializedTask, a as SerializedBoard } from '../../../../shared/stack.DKDMI-QO.js';
4
+ import { b as SerializedColumn, c as SerializedTask, a as SerializedBoard } from '../../../../shared/stack.QD1y_7NY.js';
5
5
 
6
6
  declare function BoardsListPageComponent(): react_jsx_runtime.JSX.Element;
7
7
 
@@ -1,6 +1,6 @@
1
1
  import * as _tanstack_react_query from '@tanstack/react-query';
2
2
  import { a as KanbanUser } from '../../../../shared/stack.FeaWkglm.cjs';
3
- import { S as SerializedBoardWithColumns, a as SerializedBoard, b as SerializedColumn, c as SerializedTask, P as Priority } from '../../../../shared/stack.DKDMI-QO.cjs';
3
+ import { S as SerializedBoardWithColumns, a as SerializedBoard, b as SerializedColumn, c as SerializedTask, P as Priority } from '../../../../shared/stack.QD1y_7NY.cjs';
4
4
  import 'react';
5
5
 
6
6
  /**
@@ -1,6 +1,6 @@
1
1
  import * as _tanstack_react_query from '@tanstack/react-query';
2
2
  import { a as KanbanUser } from '../../../../shared/stack.FeaWkglm.mjs';
3
- import { S as SerializedBoardWithColumns, a as SerializedBoard, b as SerializedColumn, c as SerializedTask, P as Priority } from '../../../../shared/stack.DKDMI-QO.mjs';
3
+ import { S as SerializedBoardWithColumns, a as SerializedBoard, b as SerializedColumn, c as SerializedTask, P as Priority } from '../../../../shared/stack.QD1y_7NY.mjs';
4
4
  import 'react';
5
5
 
6
6
  /**
@@ -1,6 +1,6 @@
1
1
  import * as _tanstack_react_query from '@tanstack/react-query';
2
2
  import { a as KanbanUser } from '../../../../shared/stack.FeaWkglm.js';
3
- import { S as SerializedBoardWithColumns, a as SerializedBoard, b as SerializedColumn, c as SerializedTask, P as Priority } from '../../../../shared/stack.DKDMI-QO.js';
3
+ import { S as SerializedBoardWithColumns, a as SerializedBoard, b as SerializedColumn, c as SerializedTask, P as Priority } from '../../../../shared/stack.QD1y_7NY.js';
4
4
  import 'react';
5
5
 
6
6
  /**
@@ -2,7 +2,7 @@ import * as _btst_stack_plugins_client from '@btst/stack/plugins/client';
2
2
  import * as react from 'react';
3
3
  import * as _btst_yar from '@btst/yar';
4
4
  import { QueryClient } from '@tanstack/react-query';
5
- import { S as SerializedBoardWithColumns } from '../../../shared/stack.DKDMI-QO.cjs';
5
+ import { S as SerializedBoardWithColumns } from '../../../shared/stack.QD1y_7NY.cjs';
6
6
  export { K as KanbanPluginOverrides, a as KanbanUser } from '../../../shared/stack.FeaWkglm.cjs';
7
7
 
8
8
  /**
@@ -2,7 +2,7 @@ import * as _btst_stack_plugins_client from '@btst/stack/plugins/client';
2
2
  import * as react from 'react';
3
3
  import * as _btst_yar from '@btst/yar';
4
4
  import { QueryClient } from '@tanstack/react-query';
5
- import { S as SerializedBoardWithColumns } from '../../../shared/stack.DKDMI-QO.mjs';
5
+ import { S as SerializedBoardWithColumns } from '../../../shared/stack.QD1y_7NY.mjs';
6
6
  export { K as KanbanPluginOverrides, a as KanbanUser } from '../../../shared/stack.FeaWkglm.mjs';
7
7
 
8
8
  /**
@@ -2,7 +2,7 @@ import * as _btst_stack_plugins_client from '@btst/stack/plugins/client';
2
2
  import * as react from 'react';
3
3
  import * as _btst_yar from '@btst/yar';
4
4
  import { QueryClient } from '@tanstack/react-query';
5
- import { S as SerializedBoardWithColumns } from '../../../shared/stack.DKDMI-QO.js';
5
+ import { S as SerializedBoardWithColumns } from '../../../shared/stack.QD1y_7NY.js';
6
6
  export { K as KanbanPluginOverrides, a as KanbanUser } from '../../../shared/stack.FeaWkglm.js';
7
7
 
8
8
  /**
@@ -51,7 +51,8 @@ function createBoardsQueries(client, headers) {
51
51
  const errorResponse = response;
52
52
  throw toError(errorResponse.error);
53
53
  }
54
- return response.data ?? [];
54
+ const envelope = response.data;
55
+ return envelope?.items ?? [];
55
56
  } catch (error) {
56
57
  throw error;
57
58
  }
@@ -92,8 +93,8 @@ function createBoardsQueries(client, headers) {
92
93
  const errorResponse = response;
93
94
  throw toError(errorResponse.error);
94
95
  }
95
- const boards = response.data ?? [];
96
- return boards[0] ?? null;
96
+ const envelope = response.data;
97
+ return envelope?.items?.[0] ?? null;
97
98
  } catch (error) {
98
99
  throw error;
99
100
  }
@@ -1,9 +1,10 @@
1
1
  import * as _tanstack_react_query from '@tanstack/react-query';
2
2
  import { createApiClient } from '@btst/stack/plugins/client';
3
- import { S as SerializedBoardWithColumns } from '../../shared/stack.DKDMI-QO.cjs';
3
+ import { S as SerializedBoardWithColumns } from '../../shared/stack.QD1y_7NY.cjs';
4
4
  import { KanbanApiRouter } from './api/index.cjs';
5
5
  import '@btst/stack/plugins/api';
6
6
  import 'better-call';
7
+ import '@btst/db';
7
8
  import 'zod';
8
9
 
9
10
  interface BoardsListParams {
@@ -1,9 +1,10 @@
1
1
  import * as _tanstack_react_query from '@tanstack/react-query';
2
2
  import { createApiClient } from '@btst/stack/plugins/client';
3
- import { S as SerializedBoardWithColumns } from '../../shared/stack.DKDMI-QO.mjs';
3
+ import { S as SerializedBoardWithColumns } from '../../shared/stack.QD1y_7NY.mjs';
4
4
  import { KanbanApiRouter } from './api/index.mjs';
5
5
  import '@btst/stack/plugins/api';
6
6
  import 'better-call';
7
+ import '@btst/db';
7
8
  import 'zod';
8
9
 
9
10
  interface BoardsListParams {
@@ -1,9 +1,10 @@
1
1
  import * as _tanstack_react_query from '@tanstack/react-query';
2
2
  import { createApiClient } from '@btst/stack/plugins/client';
3
- import { S as SerializedBoardWithColumns } from '../../shared/stack.DKDMI-QO.js';
3
+ import { S as SerializedBoardWithColumns } from '../../shared/stack.QD1y_7NY.js';
4
4
  import { KanbanApiRouter } from './api/index.js';
5
5
  import '@btst/stack/plugins/api';
6
6
  import 'better-call';
7
+ import '@btst/db';
7
8
  import 'zod';
8
9
 
9
10
  interface BoardsListParams {
@@ -49,7 +49,8 @@ function createBoardsQueries(client, headers) {
49
49
  const errorResponse = response;
50
50
  throw toError(errorResponse.error);
51
51
  }
52
- return response.data ?? [];
52
+ const envelope = response.data;
53
+ return envelope?.items ?? [];
53
54
  } catch (error) {
54
55
  throw error;
55
56
  }
@@ -90,8 +91,8 @@ function createBoardsQueries(client, headers) {
90
91
  const errorResponse = response;
91
92
  throw toError(errorResponse.error);
92
93
  }
93
- const boards = response.data ?? [];
94
- return boards[0] ?? null;
94
+ const envelope = response.data;
95
+ return envelope?.items?.[0] ?? null;
95
96
  } catch (error) {
96
97
  throw error;
97
98
  }
@@ -1,6 +1,6 @@
1
1
  import * as _btst_stack_plugins_api from '@btst/stack/plugins/api';
2
2
  import * as better_call from 'better-call';
3
- import { S as StackContext } from '../../../shared/stack.BoA0xkJv.cjs';
3
+ import { S as StackContext } from '../../../shared/stack.7n9Y_u7N.cjs';
4
4
  import '@btst/yar';
5
5
  import '@btst/db';
6
6
 
@@ -79,7 +79,7 @@ declare const openApiBackendPlugin: (options?: OpenAPIOptions) => _btst_stack_pl
79
79
  readonly reference: better_call.StrictEndpoint<string, {
80
80
  method: "GET";
81
81
  }, Response>;
82
- }>;
82
+ }, never>;
83
83
  type OpenApiRouter = ReturnType<ReturnType<typeof openApiBackendPlugin>["routes"]>;
84
84
 
85
85
  /**
@@ -1,6 +1,6 @@
1
1
  import * as _btst_stack_plugins_api from '@btst/stack/plugins/api';
2
2
  import * as better_call from 'better-call';
3
- import { S as StackContext } from '../../../shared/stack.BoA0xkJv.mjs';
3
+ import { S as StackContext } from '../../../shared/stack.7n9Y_u7N.mjs';
4
4
  import '@btst/yar';
5
5
  import '@btst/db';
6
6
 
@@ -79,7 +79,7 @@ declare const openApiBackendPlugin: (options?: OpenAPIOptions) => _btst_stack_pl
79
79
  readonly reference: better_call.StrictEndpoint<string, {
80
80
  method: "GET";
81
81
  }, Response>;
82
- }>;
82
+ }, never>;
83
83
  type OpenApiRouter = ReturnType<ReturnType<typeof openApiBackendPlugin>["routes"]>;
84
84
 
85
85
  /**
@@ -1,6 +1,6 @@
1
1
  import * as _btst_stack_plugins_api from '@btst/stack/plugins/api';
2
2
  import * as better_call from 'better-call';
3
- import { S as StackContext } from '../../../shared/stack.BoA0xkJv.js';
3
+ import { S as StackContext } from '../../../shared/stack.7n9Y_u7N.js';
4
4
  import '@btst/yar';
5
5
  import '@btst/db';
6
6
 
@@ -79,7 +79,7 @@ declare const openApiBackendPlugin: (options?: OpenAPIOptions) => _btst_stack_pl
79
79
  readonly reference: better_call.StrictEndpoint<string, {
80
80
  method: "GET";
81
81
  }, Response>;
82
- }>;
82
+ }, never>;
83
83
  type OpenApiRouter = ReturnType<ReturnType<typeof openApiBackendPlugin>["routes"]>;
84
84
 
85
85
  /**
@@ -2,7 +2,7 @@ import * as _btst_stack_plugins_client from '@btst/stack/plugins/client';
2
2
  import * as react from 'react';
3
3
  import * as _btst_yar from '@btst/yar';
4
4
  import { QueryClient } from '@tanstack/react-query';
5
- import { a as SitemapEntry, b as ClientStackContext } from '../../../shared/stack.BoA0xkJv.cjs';
5
+ import { a as SitemapEntry, b as ClientStackContext } from '../../../shared/stack.7n9Y_u7N.cjs';
6
6
  import '@btst/db';
7
7
  import 'better-call';
8
8