@btst/stack 2.2.0 → 2.3.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 (159) hide show
  1. package/dist/packages/stack/src/plugins/blog/api/plugin.cjs +52 -1
  2. package/dist/packages/stack/src/plugins/blog/api/plugin.mjs +52 -1
  3. package/dist/packages/stack/src/plugins/blog/api/query-key-defs.cjs +18 -0
  4. package/dist/packages/stack/src/plugins/blog/api/query-key-defs.mjs +15 -0
  5. package/dist/packages/stack/src/plugins/blog/api/serializers.cjs +21 -0
  6. package/dist/packages/stack/src/plugins/blog/api/serializers.mjs +18 -0
  7. package/dist/packages/stack/src/plugins/blog/client/plugin.cjs +15 -0
  8. package/dist/packages/stack/src/plugins/blog/client/plugin.mjs +16 -1
  9. package/dist/packages/stack/src/plugins/cms/api/getters.cjs +10 -0
  10. package/dist/packages/stack/src/plugins/cms/api/getters.mjs +10 -1
  11. package/dist/packages/stack/src/plugins/cms/api/plugin.cjs +70 -1
  12. package/dist/packages/stack/src/plugins/cms/api/plugin.mjs +71 -2
  13. package/dist/packages/stack/src/plugins/cms/api/query-key-defs.cjs +29 -0
  14. package/dist/packages/stack/src/plugins/cms/api/query-key-defs.mjs +26 -0
  15. package/dist/packages/stack/src/plugins/cms/client/plugin.cjs +15 -0
  16. package/dist/packages/stack/src/plugins/cms/client/plugin.mjs +16 -1
  17. package/dist/packages/stack/src/plugins/form-builder/api/getters.cjs +9 -0
  18. package/dist/packages/stack/src/plugins/form-builder/api/getters.mjs +9 -1
  19. package/dist/packages/stack/src/plugins/form-builder/api/plugin.cjs +62 -1
  20. package/dist/packages/stack/src/plugins/form-builder/api/plugin.mjs +63 -2
  21. package/dist/packages/stack/src/plugins/form-builder/api/query-key-defs.cjs +37 -0
  22. package/dist/packages/stack/src/plugins/form-builder/api/query-key-defs.mjs +33 -0
  23. package/dist/packages/stack/src/plugins/form-builder/client/plugin.cjs +15 -0
  24. package/dist/packages/stack/src/plugins/form-builder/client/plugin.mjs +16 -1
  25. package/dist/packages/stack/src/plugins/kanban/api/plugin.cjs +29 -1
  26. package/dist/packages/stack/src/plugins/kanban/api/plugin.mjs +29 -1
  27. package/dist/packages/stack/src/plugins/kanban/api/query-key-defs.cjs +26 -0
  28. package/dist/packages/stack/src/plugins/kanban/api/query-key-defs.mjs +23 -0
  29. package/dist/packages/stack/src/plugins/kanban/api/serializers.cjs +30 -0
  30. package/dist/packages/stack/src/plugins/kanban/api/serializers.mjs +26 -0
  31. package/dist/packages/stack/src/plugins/kanban/client/plugin.cjs +10 -0
  32. package/dist/packages/stack/src/plugins/kanban/client/plugin.mjs +11 -1
  33. package/dist/packages/stack/src/plugins/utils.cjs +6 -0
  34. package/dist/packages/stack/src/plugins/utils.mjs +6 -1
  35. package/dist/plugins/blog/api/index.cjs +5 -0
  36. package/dist/plugins/blog/api/index.d.cts +19 -4
  37. package/dist/plugins/blog/api/index.d.mts +19 -4
  38. package/dist/plugins/blog/api/index.d.ts +19 -4
  39. package/dist/plugins/blog/api/index.mjs +2 -0
  40. package/dist/plugins/blog/client/hooks/index.d.cts +4 -4
  41. package/dist/plugins/blog/client/hooks/index.d.mts +4 -4
  42. package/dist/plugins/blog/client/hooks/index.d.ts +4 -4
  43. package/dist/plugins/blog/client/index.d.cts +1 -1
  44. package/dist/plugins/blog/client/index.d.mts +1 -1
  45. package/dist/plugins/blog/client/index.d.ts +1 -1
  46. package/dist/plugins/blog/query-keys.cjs +6 -5
  47. package/dist/plugins/blog/query-keys.d.cts +8 -387
  48. package/dist/plugins/blog/query-keys.d.mts +8 -387
  49. package/dist/plugins/blog/query-keys.d.ts +8 -387
  50. package/dist/plugins/blog/query-keys.mjs +6 -5
  51. package/dist/plugins/client/index.cjs +1 -0
  52. package/dist/plugins/client/index.d.cts +8 -1
  53. package/dist/plugins/client/index.d.mts +8 -1
  54. package/dist/plugins/client/index.d.ts +8 -1
  55. package/dist/plugins/client/index.mjs +1 -1
  56. package/dist/plugins/cms/api/index.cjs +6 -0
  57. package/dist/plugins/cms/api/index.d.cts +7 -219
  58. package/dist/plugins/cms/api/index.d.mts +7 -219
  59. package/dist/plugins/cms/api/index.d.ts +7 -219
  60. package/dist/plugins/cms/api/index.mjs +2 -1
  61. package/dist/plugins/cms/client/hooks/index.d.cts +1 -1
  62. package/dist/plugins/cms/client/hooks/index.d.mts +1 -1
  63. package/dist/plugins/cms/client/hooks/index.d.ts +1 -1
  64. package/dist/plugins/cms/query-keys.cjs +2 -1
  65. package/dist/plugins/cms/query-keys.d.cts +5 -9
  66. package/dist/plugins/cms/query-keys.d.mts +5 -9
  67. package/dist/plugins/cms/query-keys.d.ts +5 -9
  68. package/dist/plugins/cms/query-keys.mjs +2 -1
  69. package/dist/plugins/form-builder/api/index.cjs +6 -0
  70. package/dist/plugins/form-builder/api/index.d.cts +7 -211
  71. package/dist/plugins/form-builder/api/index.d.mts +7 -211
  72. package/dist/plugins/form-builder/api/index.d.ts +7 -211
  73. package/dist/plugins/form-builder/api/index.mjs +2 -1
  74. package/dist/plugins/form-builder/client/components/index.d.cts +1 -1
  75. package/dist/plugins/form-builder/client/components/index.d.mts +1 -1
  76. package/dist/plugins/form-builder/client/components/index.d.ts +1 -1
  77. package/dist/plugins/form-builder/client/hooks/index.d.cts +1 -1
  78. package/dist/plugins/form-builder/client/hooks/index.d.mts +1 -1
  79. package/dist/plugins/form-builder/client/hooks/index.d.ts +1 -1
  80. package/dist/plugins/form-builder/query-keys.cjs +3 -2
  81. package/dist/plugins/form-builder/query-keys.d.cts +6 -6
  82. package/dist/plugins/form-builder/query-keys.d.mts +6 -6
  83. package/dist/plugins/form-builder/query-keys.d.ts +6 -6
  84. package/dist/plugins/form-builder/query-keys.mjs +3 -2
  85. package/dist/plugins/kanban/api/index.cjs +6 -0
  86. package/dist/plugins/kanban/api/index.d.cts +17 -392
  87. package/dist/plugins/kanban/api/index.d.mts +17 -392
  88. package/dist/plugins/kanban/api/index.d.ts +17 -392
  89. package/dist/plugins/kanban/api/index.mjs +2 -0
  90. package/dist/plugins/kanban/client/components/index.d.cts +1 -1
  91. package/dist/plugins/kanban/client/components/index.d.mts +1 -1
  92. package/dist/plugins/kanban/client/components/index.d.ts +1 -1
  93. package/dist/plugins/kanban/client/hooks/index.d.cts +1 -1
  94. package/dist/plugins/kanban/client/hooks/index.d.mts +1 -1
  95. package/dist/plugins/kanban/client/hooks/index.d.ts +1 -1
  96. package/dist/plugins/kanban/client/index.d.cts +1 -1
  97. package/dist/plugins/kanban/client/index.d.mts +1 -1
  98. package/dist/plugins/kanban/client/index.d.ts +1 -1
  99. package/dist/plugins/kanban/query-keys.cjs +2 -9
  100. package/dist/plugins/kanban/query-keys.d.cts +4 -16
  101. package/dist/plugins/kanban/query-keys.d.mts +4 -16
  102. package/dist/plugins/kanban/query-keys.d.ts +4 -16
  103. package/dist/plugins/kanban/query-keys.mjs +2 -9
  104. package/dist/plugins/ui-builder/index.d.cts +1 -1
  105. package/dist/plugins/ui-builder/index.d.mts +1 -1
  106. package/dist/plugins/ui-builder/index.d.ts +1 -1
  107. package/dist/shared/stack.B1EeBt1b.d.ts +297 -0
  108. package/dist/shared/stack.BIXEI6v_.d.mts +419 -0
  109. package/dist/shared/stack.BKfolAyK.d.ts +419 -0
  110. package/dist/shared/stack.BpolpQpf.d.cts +445 -0
  111. package/dist/shared/stack.C5dtIncc.d.mts +293 -0
  112. package/dist/shared/stack.CIP6QS9l.d.ts +293 -0
  113. package/dist/shared/stack.CP68pFEH.d.mts +297 -0
  114. package/dist/shared/{stack.CXjzTMsb.d.mts → stack.CVDTkMoO.d.cts} +7 -1
  115. package/dist/shared/{stack.CXjzTMsb.d.ts → stack.CVDTkMoO.d.mts} +7 -1
  116. package/dist/shared/{stack.CXjzTMsb.d.cts → stack.CVDTkMoO.d.ts} +7 -1
  117. package/dist/shared/{stack.QD1y_7NY.d.mts → stack.DJaKVY7v.d.cts} +1 -1
  118. package/dist/shared/{stack.QD1y_7NY.d.ts → stack.DJaKVY7v.d.mts} +1 -1
  119. package/dist/shared/{stack.QD1y_7NY.d.cts → stack.DJaKVY7v.d.ts} +1 -1
  120. package/dist/shared/{stack.CIrIsc-A.d.mts → stack.DdI5W6MB.d.cts} +7 -1
  121. package/dist/shared/{stack.CIrIsc-A.d.ts → stack.DdI5W6MB.d.mts} +7 -1
  122. package/dist/shared/{stack.CIrIsc-A.d.cts → stack.DdI5W6MB.d.ts} +7 -1
  123. package/dist/shared/stack.Dw0Ly2TM.d.cts +293 -0
  124. package/dist/shared/stack.IdtKDRka.d.cts +297 -0
  125. package/dist/shared/stack.TIBF2AOx.d.ts +445 -0
  126. package/dist/shared/stack.rTy7-wQU.d.mts +445 -0
  127. package/dist/shared/stack.snB1EDP7.d.cts +419 -0
  128. package/package.json +3 -3
  129. package/src/plugins/blog/api/index.ts +2 -0
  130. package/src/plugins/blog/api/plugin.ts +85 -0
  131. package/src/plugins/blog/api/query-key-defs.ts +46 -0
  132. package/src/plugins/blog/api/serializers.ts +27 -0
  133. package/src/plugins/blog/client/plugin.tsx +19 -0
  134. package/src/plugins/blog/query-keys.ts +5 -7
  135. package/src/plugins/client/index.ts +1 -1
  136. package/src/plugins/cms/api/getters.ts +24 -0
  137. package/src/plugins/cms/api/index.ts +10 -1
  138. package/src/plugins/cms/api/plugin.ts +105 -0
  139. package/src/plugins/cms/api/query-key-defs.ts +53 -0
  140. package/src/plugins/cms/api/serializers.ts +12 -0
  141. package/src/plugins/cms/client/plugin.tsx +19 -0
  142. package/src/plugins/cms/query-keys.ts +2 -1
  143. package/src/plugins/form-builder/api/getters.ts +23 -0
  144. package/src/plugins/form-builder/api/index.ts +15 -2
  145. package/src/plugins/form-builder/api/plugin.ts +91 -0
  146. package/src/plugins/form-builder/api/query-key-defs.ts +79 -0
  147. package/src/plugins/form-builder/api/serializers.ts +12 -0
  148. package/src/plugins/form-builder/client/plugin.tsx +19 -0
  149. package/src/plugins/form-builder/query-keys.ts +6 -2
  150. package/src/plugins/kanban/api/index.ts +3 -0
  151. package/src/plugins/kanban/api/plugin.ts +49 -0
  152. package/src/plugins/kanban/api/query-key-defs.ts +54 -0
  153. package/src/plugins/kanban/api/serializers.ts +49 -0
  154. package/src/plugins/kanban/client/plugin.tsx +13 -0
  155. package/src/plugins/kanban/query-keys.ts +2 -9
  156. package/src/plugins/utils.ts +19 -0
  157. package/dist/shared/{stack.BkYlUT_8.d.cts → stack.CBON0dWL.d.cts} +6 -6
  158. package/dist/shared/{stack.BkYlUT_8.d.mts → stack.CBON0dWL.d.mts} +6 -6
  159. package/dist/shared/{stack.BkYlUT_8.d.ts → stack.CBON0dWL.d.ts} +6 -6
@@ -1,400 +1,25 @@
1
- import * as _btst_stack_plugins_api from '@btst/stack/plugins/api';
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';
5
- import { z } from 'zod';
6
-
7
- declare const createBoardSchema: z.ZodObject<{
8
- description: z.ZodOptional<z.ZodString>;
9
- createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
10
- updatedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
11
- name: z.ZodString;
12
- slug: z.ZodOptional<z.ZodString>;
13
- ownerId: z.ZodOptional<z.ZodString>;
14
- organizationId: z.ZodOptional<z.ZodString>;
15
- }, z.core.$strip>;
16
- declare const updateBoardSchema: z.ZodObject<{
17
- createdAt: z.ZodOptional<z.ZodOptional<z.ZodCoercedDate<unknown>>>;
18
- updatedAt: z.ZodOptional<z.ZodOptional<z.ZodCoercedDate<unknown>>>;
19
- name: z.ZodOptional<z.ZodString>;
20
- slug: z.ZodOptional<z.ZodString>;
21
- description: z.ZodOptional<z.ZodOptional<z.ZodString>>;
22
- ownerId: z.ZodOptional<z.ZodOptional<z.ZodString>>;
23
- organizationId: z.ZodOptional<z.ZodOptional<z.ZodString>>;
24
- id: z.ZodNonOptional<z.ZodOptional<z.ZodString>>;
25
- }, z.core.$strip>;
26
- declare const createColumnSchema: z.ZodObject<{
27
- title: z.ZodString;
28
- createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
29
- updatedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
30
- boardId: z.ZodString;
31
- order: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
32
- }, z.core.$strip>;
33
- declare const updateColumnSchema: z.ZodObject<{
34
- createdAt: z.ZodOptional<z.ZodOptional<z.ZodCoercedDate<unknown>>>;
35
- updatedAt: z.ZodOptional<z.ZodOptional<z.ZodCoercedDate<unknown>>>;
36
- title: z.ZodOptional<z.ZodString>;
37
- order: z.ZodOptional<z.ZodDefault<z.ZodOptional<z.ZodNumber>>>;
38
- boardId: z.ZodOptional<z.ZodString>;
39
- id: z.ZodNonOptional<z.ZodOptional<z.ZodString>>;
40
- }, z.core.$strip>;
41
- declare const createTaskSchema: z.ZodObject<{
42
- title: z.ZodString;
43
- description: z.ZodOptional<z.ZodString>;
44
- createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
45
- updatedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
46
- order: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
47
- completedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
48
- priority: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
49
- LOW: "LOW";
50
- MEDIUM: "MEDIUM";
51
- HIGH: "HIGH";
52
- URGENT: "URGENT";
53
- }>>>;
54
- columnId: z.ZodString;
55
- assigneeId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
56
- isArchived: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
57
- }, z.core.$strip>;
58
- declare const updateTaskSchema: z.ZodObject<{
59
- completedAt: z.ZodOptional<z.ZodOptional<z.ZodCoercedDate<unknown>>>;
60
- createdAt: z.ZodOptional<z.ZodOptional<z.ZodCoercedDate<unknown>>>;
61
- updatedAt: z.ZodOptional<z.ZodOptional<z.ZodCoercedDate<unknown>>>;
62
- title: z.ZodOptional<z.ZodString>;
63
- description: z.ZodOptional<z.ZodOptional<z.ZodString>>;
64
- priority: z.ZodOptional<z.ZodDefault<z.ZodOptional<z.ZodEnum<{
65
- LOW: "LOW";
66
- MEDIUM: "MEDIUM";
67
- HIGH: "HIGH";
68
- URGENT: "URGENT";
69
- }>>>>;
70
- order: z.ZodOptional<z.ZodDefault<z.ZodOptional<z.ZodNumber>>>;
71
- columnId: z.ZodOptional<z.ZodString>;
72
- assigneeId: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodString>>>;
73
- isArchived: z.ZodOptional<z.ZodDefault<z.ZodOptional<z.ZodBoolean>>>;
74
- id: z.ZodNonOptional<z.ZodOptional<z.ZodString>>;
75
- }, z.core.$strip>;
76
- declare const BoardListQuerySchema: z.ZodObject<{
77
- slug: z.ZodOptional<z.ZodString>;
78
- ownerId: z.ZodOptional<z.ZodString>;
79
- organizationId: z.ZodOptional<z.ZodString>;
80
- offset: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
81
- limit: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
82
- }, z.core.$strip>;
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>;
1
+ export { B as BoardListResult, e as KANBAN_QUERY_KEYS, b as KanbanApiContext, K as KanbanApiRouter, c as KanbanBackendHooks, a as KanbanRouteKey, g as getAllBoards, d as getBoardById, k as kanbanBackendPlugin } from '../../../shared/stack.TIBF2AOx.js';
2
+ import { B as BoardWithColumns, S as SerializedBoardWithColumns, C as ColumnWithTasks, a as SerializedColumn, T as Task, b as SerializedTask } from '../../../shared/stack.DJaKVY7v.js';
3
+ import '@btst/stack/plugins/api';
4
+ import 'better-call';
5
+ import '@btst/db';
6
+ import 'zod';
7
+ import '@tanstack/react-query';
110
8
 
111
9
  /**
112
- * Context passed to kanban API hooks
10
+ * Serialize a Task for SSR/SSG use (convert dates to strings).
11
+ * Pure function — no DB access, no hooks.
113
12
  */
114
- interface KanbanApiContext<TBody = unknown, TParams = unknown, TQuery = unknown> {
115
- body?: TBody;
116
- params?: TParams;
117
- query?: TQuery;
118
- request?: Request;
119
- headers?: Headers;
120
- [key: string]: unknown;
121
- }
13
+ declare function serializeTask(task: Task): SerializedTask;
122
14
  /**
123
- * Configuration hooks for kanban backend plugin
124
- * All hooks are optional and allow consumers to customize behavior
15
+ * Serialize a Column (with its tasks) for SSR/SSG use (convert dates to strings).
16
+ * Pure function no DB access, no hooks.
125
17
  */
126
- interface KanbanBackendHooks {
127
- /**
128
- * Called before listing boards. Return false to deny access.
129
- */
130
- onBeforeListBoards?: (filter: z.infer<typeof BoardListQuerySchema>, context: KanbanApiContext) => Promise<boolean> | boolean;
131
- /**
132
- * Called before creating a board. Return false to deny access.
133
- */
134
- onBeforeCreateBoard?: (data: z.infer<typeof createBoardSchema>, context: KanbanApiContext) => Promise<boolean> | boolean;
135
- /**
136
- * Called before reading a single board. Return false to deny access.
137
- */
138
- onBeforeReadBoard?: (boardId: string, context: KanbanApiContext) => Promise<boolean> | boolean;
139
- /**
140
- * Called before updating a board. Return false to deny access.
141
- */
142
- onBeforeUpdateBoard?: (boardId: string, data: z.infer<typeof updateBoardSchema>, context: KanbanApiContext) => Promise<boolean> | boolean;
143
- /**
144
- * Called before deleting a board. Return false to deny access.
145
- */
146
- onBeforeDeleteBoard?: (boardId: string, context: KanbanApiContext) => Promise<boolean> | boolean;
147
- /**
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`).
151
- */
152
- onBoardsRead?: (boards: BoardWithColumns[], filter: z.infer<typeof BoardListQuerySchema>, context: KanbanApiContext) => Promise<void> | void;
153
- /**
154
- * Called after a single board is read successfully
155
- */
156
- onBoardRead?: (board: Board, context: KanbanApiContext) => Promise<void> | void;
157
- /**
158
- * Called after a board is created successfully
159
- */
160
- onBoardCreated?: (board: Board, context: KanbanApiContext) => Promise<void> | void;
161
- /**
162
- * Called after a board is updated successfully
163
- */
164
- onBoardUpdated?: (board: Board, context: KanbanApiContext) => Promise<void> | void;
165
- /**
166
- * Called after a board is deleted successfully
167
- */
168
- onBoardDeleted?: (boardId: string, context: KanbanApiContext) => Promise<void> | void;
169
- /**
170
- * Called when listing boards fails
171
- */
172
- onListBoardsError?: (error: Error, context: KanbanApiContext) => Promise<void> | void;
173
- /**
174
- * Called when reading a single board fails
175
- */
176
- onReadBoardError?: (error: Error, context: KanbanApiContext) => Promise<void> | void;
177
- /**
178
- * Called when creating a board fails
179
- */
180
- onCreateBoardError?: (error: Error, context: KanbanApiContext) => Promise<void> | void;
181
- /**
182
- * Called when updating a board fails
183
- */
184
- onUpdateBoardError?: (error: Error, context: KanbanApiContext) => Promise<void> | void;
185
- /**
186
- * Called when deleting a board fails
187
- */
188
- onDeleteBoardError?: (error: Error, context: KanbanApiContext) => Promise<void> | void;
189
- /**
190
- * Called before creating a column. Return false to deny access.
191
- */
192
- onBeforeCreateColumn?: (data: z.infer<typeof createColumnSchema>, context: KanbanApiContext) => Promise<boolean> | boolean;
193
- /**
194
- * Called before updating a column. Return false to deny access.
195
- */
196
- onBeforeUpdateColumn?: (columnId: string, data: z.infer<typeof updateColumnSchema>, context: KanbanApiContext) => Promise<boolean> | boolean;
197
- /**
198
- * Called before deleting a column. Return false to deny access.
199
- */
200
- onBeforeDeleteColumn?: (columnId: string, context: KanbanApiContext) => Promise<boolean> | boolean;
201
- /**
202
- * Called after a column is created successfully
203
- */
204
- onColumnCreated?: (column: Column, context: KanbanApiContext) => Promise<void> | void;
205
- /**
206
- * Called after a column is updated successfully
207
- */
208
- onColumnUpdated?: (column: Column, context: KanbanApiContext) => Promise<void> | void;
209
- /**
210
- * Called after a column is deleted successfully
211
- */
212
- onColumnDeleted?: (columnId: string, context: KanbanApiContext) => Promise<void> | void;
213
- /**
214
- * Called before creating a task. Return false to deny access.
215
- */
216
- onBeforeCreateTask?: (data: z.infer<typeof createTaskSchema>, context: KanbanApiContext) => Promise<boolean> | boolean;
217
- /**
218
- * Called before updating a task. Return false to deny access.
219
- */
220
- onBeforeUpdateTask?: (taskId: string, data: z.infer<typeof updateTaskSchema>, context: KanbanApiContext) => Promise<boolean> | boolean;
221
- /**
222
- * Called before deleting a task. Return false to deny access.
223
- */
224
- onBeforeDeleteTask?: (taskId: string, context: KanbanApiContext) => Promise<boolean> | boolean;
225
- /**
226
- * Called after a task is created successfully
227
- */
228
- onTaskCreated?: (task: Task, context: KanbanApiContext) => Promise<void> | void;
229
- /**
230
- * Called after a task is updated successfully
231
- */
232
- onTaskUpdated?: (task: Task, context: KanbanApiContext) => Promise<void> | void;
233
- /**
234
- * Called after a task is deleted successfully
235
- */
236
- onTaskDeleted?: (taskId: string, context: KanbanApiContext) => Promise<void> | void;
237
- }
18
+ declare function serializeColumn(col: ColumnWithTasks): SerializedColumn;
238
19
  /**
239
- * Kanban backend plugin
240
- * Provides API endpoints for managing kanban boards, columns, and tasks
241
- *
242
- * @param hooks - Optional configuration hooks for customizing plugin behavior
20
+ * Serialize a Board (with columns and tasks) for SSR/SSG use (convert dates to strings).
21
+ * Pure function no DB access, no hooks.
243
22
  */
244
- declare const kanbanBackendPlugin: (hooks?: KanbanBackendHooks) => _btst_stack_plugins_api.BackendPlugin<{
245
- readonly listBoards: better_call.StrictEndpoint<"/boards", {
246
- method: "GET";
247
- query: z.ZodObject<{
248
- slug: z.ZodOptional<z.ZodString>;
249
- ownerId: z.ZodOptional<z.ZodString>;
250
- organizationId: z.ZodOptional<z.ZodString>;
251
- offset: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
252
- limit: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
253
- }, z.core.$strip>;
254
- }, BoardListResult>;
255
- readonly getBoard: better_call.StrictEndpoint<"/boards/:id", {
256
- method: "GET";
257
- }, BoardWithColumns>;
258
- readonly createBoard: better_call.StrictEndpoint<"/boards", {
259
- method: "POST";
260
- body: z.ZodObject<{
261
- description: z.ZodOptional<z.ZodString>;
262
- createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
263
- updatedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
264
- name: z.ZodString;
265
- slug: z.ZodOptional<z.ZodString>;
266
- ownerId: z.ZodOptional<z.ZodString>;
267
- organizationId: z.ZodOptional<z.ZodString>;
268
- }, z.core.$strip>;
269
- }, {
270
- columns: ColumnWithTasks[];
271
- id: string;
272
- name: string;
273
- slug: string;
274
- description?: string;
275
- ownerId?: string;
276
- organizationId?: string;
277
- createdAt: Date;
278
- updatedAt: Date;
279
- }>;
280
- readonly updateBoard: better_call.StrictEndpoint<"/boards/:id", {
281
- method: "PUT";
282
- body: z.ZodObject<{
283
- description: z.ZodOptional<z.ZodOptional<z.ZodString>>;
284
- createdAt: z.ZodOptional<z.ZodOptional<z.ZodCoercedDate<unknown>>>;
285
- updatedAt: z.ZodOptional<z.ZodOptional<z.ZodCoercedDate<unknown>>>;
286
- name: z.ZodOptional<z.ZodString>;
287
- slug: z.ZodOptional<z.ZodString>;
288
- ownerId: z.ZodOptional<z.ZodOptional<z.ZodString>>;
289
- organizationId: z.ZodOptional<z.ZodOptional<z.ZodString>>;
290
- }, z.core.$strip>;
291
- }, Board>;
292
- readonly deleteBoard: better_call.StrictEndpoint<"/boards/:id", {
293
- method: "DELETE";
294
- }, {
295
- success: boolean;
296
- }>;
297
- readonly createColumn: better_call.StrictEndpoint<"/columns", {
298
- method: "POST";
299
- body: z.ZodObject<{
300
- title: z.ZodString;
301
- createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
302
- updatedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
303
- boardId: z.ZodString;
304
- order: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
305
- }, z.core.$strip>;
306
- }, Column>;
307
- readonly updateColumn: better_call.StrictEndpoint<"/columns/:id", {
308
- method: "PUT";
309
- body: z.ZodObject<{
310
- title: z.ZodOptional<z.ZodString>;
311
- createdAt: z.ZodOptional<z.ZodOptional<z.ZodCoercedDate<unknown>>>;
312
- updatedAt: z.ZodOptional<z.ZodOptional<z.ZodCoercedDate<unknown>>>;
313
- boardId: z.ZodOptional<z.ZodString>;
314
- order: z.ZodOptional<z.ZodDefault<z.ZodOptional<z.ZodNumber>>>;
315
- }, z.core.$strip>;
316
- }, Column>;
317
- readonly deleteColumn: better_call.StrictEndpoint<"/columns/:id", {
318
- method: "DELETE";
319
- }, {
320
- success: boolean;
321
- }>;
322
- readonly reorderColumns: better_call.StrictEndpoint<"/columns/reorder", {
323
- method: "POST";
324
- body: z.ZodObject<{
325
- boardId: z.ZodString;
326
- columnIds: z.ZodArray<z.ZodString>;
327
- }, z.core.$strip>;
328
- }, {
329
- success: boolean;
330
- }>;
331
- readonly createTask: better_call.StrictEndpoint<"/tasks", {
332
- method: "POST";
333
- body: z.ZodObject<{
334
- title: z.ZodString;
335
- description: z.ZodOptional<z.ZodString>;
336
- createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
337
- updatedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
338
- order: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
339
- completedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
340
- priority: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
341
- LOW: "LOW";
342
- MEDIUM: "MEDIUM";
343
- HIGH: "HIGH";
344
- URGENT: "URGENT";
345
- }>>>;
346
- columnId: z.ZodString;
347
- assigneeId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
348
- isArchived: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
349
- }, z.core.$strip>;
350
- }, Task>;
351
- readonly updateTask: better_call.StrictEndpoint<"/tasks/:id", {
352
- method: "PUT";
353
- body: z.ZodObject<{
354
- title: z.ZodOptional<z.ZodString>;
355
- description: z.ZodOptional<z.ZodOptional<z.ZodString>>;
356
- createdAt: z.ZodOptional<z.ZodOptional<z.ZodCoercedDate<unknown>>>;
357
- updatedAt: z.ZodOptional<z.ZodOptional<z.ZodCoercedDate<unknown>>>;
358
- order: z.ZodOptional<z.ZodDefault<z.ZodOptional<z.ZodNumber>>>;
359
- completedAt: z.ZodOptional<z.ZodOptional<z.ZodCoercedDate<unknown>>>;
360
- priority: z.ZodOptional<z.ZodDefault<z.ZodOptional<z.ZodEnum<{
361
- LOW: "LOW";
362
- MEDIUM: "MEDIUM";
363
- HIGH: "HIGH";
364
- URGENT: "URGENT";
365
- }>>>>;
366
- columnId: z.ZodOptional<z.ZodString>;
367
- assigneeId: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodString>>>;
368
- isArchived: z.ZodOptional<z.ZodDefault<z.ZodOptional<z.ZodBoolean>>>;
369
- }, z.core.$strip>;
370
- }, Task>;
371
- readonly deleteTask: better_call.StrictEndpoint<"/tasks/:id", {
372
- method: "DELETE";
373
- }, {
374
- success: boolean;
375
- }>;
376
- readonly moveTask: better_call.StrictEndpoint<"/tasks/move", {
377
- method: "POST";
378
- body: z.ZodObject<{
379
- taskId: z.ZodString;
380
- targetColumnId: z.ZodString;
381
- targetOrder: z.ZodNumber;
382
- }, z.core.$strip>;
383
- }, Task>;
384
- readonly reorderTasks: better_call.StrictEndpoint<"/tasks/reorder", {
385
- method: "POST";
386
- body: z.ZodObject<{
387
- columnId: z.ZodString;
388
- taskIds: z.ZodArray<z.ZodString>;
389
- }, z.core.$strip>;
390
- }, {
391
- success: boolean;
392
- }>;
393
- }, {
394
- getAllBoards: (params?: Parameters<typeof getAllBoards>[1]) => Promise<BoardListResult>;
395
- getBoardById: (id: string) => Promise<BoardWithColumns | null>;
396
- }>;
397
- type KanbanApiRouter = ReturnType<ReturnType<typeof kanbanBackendPlugin>["routes"]>;
23
+ declare function serializeBoard(board: BoardWithColumns): SerializedBoardWithColumns;
398
24
 
399
- export { getAllBoards, getBoardById, kanbanBackendPlugin };
400
- export type { BoardListResult, KanbanApiContext, KanbanApiRouter, KanbanBackendHooks };
25
+ export { serializeBoard, serializeColumn, serializeTask };
@@ -1,2 +1,4 @@
1
1
  export { kanbanBackendPlugin } from '../../../packages/stack/src/plugins/kanban/api/plugin.mjs';
2
2
  export { getAllBoards, getBoardById } from '../../../packages/stack/src/plugins/kanban/api/getters.mjs';
3
+ export { serializeBoard, serializeColumn, serializeTask } from '../../../packages/stack/src/plugins/kanban/api/serializers.mjs';
4
+ export { KANBAN_QUERY_KEYS } from '../../../packages/stack/src/plugins/kanban/api/query-key-defs.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.QD1y_7NY.cjs';
4
+ import { a as SerializedColumn, b as SerializedTask, c as SerializedBoard } from '../../../../shared/stack.DJaKVY7v.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.QD1y_7NY.mjs';
4
+ import { a as SerializedColumn, b as SerializedTask, c as SerializedBoard } from '../../../../shared/stack.DJaKVY7v.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.QD1y_7NY.js';
4
+ import { a as SerializedColumn, b as SerializedTask, c as SerializedBoard } from '../../../../shared/stack.DJaKVY7v.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.QD1y_7NY.cjs';
3
+ import { S as SerializedBoardWithColumns, c as SerializedBoard, a as SerializedColumn, b as SerializedTask, P as Priority } from '../../../../shared/stack.DJaKVY7v.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.QD1y_7NY.mjs';
3
+ import { S as SerializedBoardWithColumns, c as SerializedBoard, a as SerializedColumn, b as SerializedTask, P as Priority } from '../../../../shared/stack.DJaKVY7v.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.QD1y_7NY.js';
3
+ import { S as SerializedBoardWithColumns, c as SerializedBoard, a as SerializedColumn, b as SerializedTask, P as Priority } from '../../../../shared/stack.DJaKVY7v.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.QD1y_7NY.cjs';
5
+ import { S as SerializedBoardWithColumns } from '../../../shared/stack.DJaKVY7v.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.QD1y_7NY.mjs';
5
+ import { S as SerializedBoardWithColumns } from '../../../shared/stack.DJaKVY7v.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.QD1y_7NY.js';
5
+ import { S as SerializedBoardWithColumns } from '../../../shared/stack.DJaKVY7v.js';
6
6
  export { K as KanbanPluginOverrides, a as KanbanUser } from '../../../shared/stack.FeaWkglm.js';
7
7
 
8
8
  /**
@@ -1,6 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  const queryKeyFactory = require('@lukemorales/query-key-factory');
4
+ const queryKeyDefs = require('../../packages/stack/src/plugins/kanban/api/query-key-defs.cjs');
4
5
 
5
6
  function isErrorResponse(response) {
6
7
  return typeof response === "object" && response !== null && "error" in response && response.error !== null && response.error !== void 0;
@@ -25,15 +26,7 @@ function createKanbanQueryKeys(client, headers) {
25
26
  function createBoardsQueries(client, headers) {
26
27
  return queryKeyFactory.createQueryKeys("boards", {
27
28
  list: (params) => ({
28
- queryKey: [
29
- {
30
- slug: params?.slug,
31
- ownerId: params?.ownerId,
32
- organizationId: params?.organizationId,
33
- limit: params?.limit ?? 50,
34
- offset: params?.offset ?? 0
35
- }
36
- ],
29
+ queryKey: [queryKeyDefs.boardsListDiscriminator(params)],
37
30
  queryFn: async () => {
38
31
  try {
39
32
  const response = await client("/boards", {
@@ -1,7 +1,7 @@
1
1
  import * as _tanstack_react_query from '@tanstack/react-query';
2
+ import { K as KanbanApiRouter, f as BoardsListDiscriminator } from '../../shared/stack.BpolpQpf.cjs';
2
3
  import { createApiClient } from '@btst/stack/plugins/client';
3
- import { S as SerializedBoardWithColumns } from '../../shared/stack.QD1y_7NY.cjs';
4
- import { KanbanApiRouter } from './api/index.cjs';
4
+ import { S as SerializedBoardWithColumns } from '../../shared/stack.DJaKVY7v.cjs';
5
5
  import '@btst/stack/plugins/api';
6
6
  import 'better-call';
7
7
  import '@btst/db';
@@ -19,20 +19,8 @@ declare function createKanbanQueryKeys(client: ReturnType<typeof createApiClient
19
19
  _def: readonly ["boards"];
20
20
  } & {
21
21
  list: ((params?: BoardsListParams | undefined) => Omit<{
22
- queryKey: readonly ["boards", "list", {
23
- slug: string | undefined;
24
- ownerId: string | undefined;
25
- organizationId: string | undefined;
26
- limit: number;
27
- offset: number;
28
- }];
29
- queryFn: _tanstack_react_query.QueryFunction<SerializedBoardWithColumns[], readonly ["boards", "list", {
30
- slug: string | undefined;
31
- ownerId: string | undefined;
32
- organizationId: string | undefined;
33
- limit: number;
34
- offset: number;
35
- }]>;
22
+ queryKey: readonly ["boards", "list", BoardsListDiscriminator];
23
+ queryFn: _tanstack_react_query.QueryFunction<SerializedBoardWithColumns[], readonly ["boards", "list", BoardsListDiscriminator]>;
36
24
  } & {
37
25
  _def: readonly ["boards", "list"];
38
26
  }, "_def">) & {
@@ -1,7 +1,7 @@
1
1
  import * as _tanstack_react_query from '@tanstack/react-query';
2
+ import { K as KanbanApiRouter, f as BoardsListDiscriminator } from '../../shared/stack.rTy7-wQU.mjs';
2
3
  import { createApiClient } from '@btst/stack/plugins/client';
3
- import { S as SerializedBoardWithColumns } from '../../shared/stack.QD1y_7NY.mjs';
4
- import { KanbanApiRouter } from './api/index.mjs';
4
+ import { S as SerializedBoardWithColumns } from '../../shared/stack.DJaKVY7v.mjs';
5
5
  import '@btst/stack/plugins/api';
6
6
  import 'better-call';
7
7
  import '@btst/db';
@@ -19,20 +19,8 @@ declare function createKanbanQueryKeys(client: ReturnType<typeof createApiClient
19
19
  _def: readonly ["boards"];
20
20
  } & {
21
21
  list: ((params?: BoardsListParams | undefined) => Omit<{
22
- queryKey: readonly ["boards", "list", {
23
- slug: string | undefined;
24
- ownerId: string | undefined;
25
- organizationId: string | undefined;
26
- limit: number;
27
- offset: number;
28
- }];
29
- queryFn: _tanstack_react_query.QueryFunction<SerializedBoardWithColumns[], readonly ["boards", "list", {
30
- slug: string | undefined;
31
- ownerId: string | undefined;
32
- organizationId: string | undefined;
33
- limit: number;
34
- offset: number;
35
- }]>;
22
+ queryKey: readonly ["boards", "list", BoardsListDiscriminator];
23
+ queryFn: _tanstack_react_query.QueryFunction<SerializedBoardWithColumns[], readonly ["boards", "list", BoardsListDiscriminator]>;
36
24
  } & {
37
25
  _def: readonly ["boards", "list"];
38
26
  }, "_def">) & {
@@ -1,7 +1,7 @@
1
1
  import * as _tanstack_react_query from '@tanstack/react-query';
2
+ import { K as KanbanApiRouter, f as BoardsListDiscriminator } from '../../shared/stack.TIBF2AOx.js';
2
3
  import { createApiClient } from '@btst/stack/plugins/client';
3
- import { S as SerializedBoardWithColumns } from '../../shared/stack.QD1y_7NY.js';
4
- import { KanbanApiRouter } from './api/index.js';
4
+ import { S as SerializedBoardWithColumns } from '../../shared/stack.DJaKVY7v.js';
5
5
  import '@btst/stack/plugins/api';
6
6
  import 'better-call';
7
7
  import '@btst/db';
@@ -19,20 +19,8 @@ declare function createKanbanQueryKeys(client: ReturnType<typeof createApiClient
19
19
  _def: readonly ["boards"];
20
20
  } & {
21
21
  list: ((params?: BoardsListParams | undefined) => Omit<{
22
- queryKey: readonly ["boards", "list", {
23
- slug: string | undefined;
24
- ownerId: string | undefined;
25
- organizationId: string | undefined;
26
- limit: number;
27
- offset: number;
28
- }];
29
- queryFn: _tanstack_react_query.QueryFunction<SerializedBoardWithColumns[], readonly ["boards", "list", {
30
- slug: string | undefined;
31
- ownerId: string | undefined;
32
- organizationId: string | undefined;
33
- limit: number;
34
- offset: number;
35
- }]>;
22
+ queryKey: readonly ["boards", "list", BoardsListDiscriminator];
23
+ queryFn: _tanstack_react_query.QueryFunction<SerializedBoardWithColumns[], readonly ["boards", "list", BoardsListDiscriminator]>;
36
24
  } & {
37
25
  _def: readonly ["boards", "list"];
38
26
  }, "_def">) & {