@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,7 +1,54 @@
1
1
  import * as _btst_stack_plugins_api from '@btst/stack/plugins/api';
2
+ import { a as SerializedContentItemWithType, S as SerializedContentType, b as CMSBackendConfig, I as InverseRelation } from '../../../shared/stack.CXjzTMsb.mjs';
2
3
  import * as better_call from 'better-call';
3
4
  import { z } from 'zod';
4
- import { b as CMSBackendConfig, S as SerializedContentType, a as SerializedContentItemWithType, I as InverseRelation } from '../../../shared/stack.BsXokfNh.mjs';
5
+ import { Adapter } from '@btst/db';
6
+
7
+ /**
8
+ * Retrieve all content types.
9
+ * Pure DB function — no hooks, no HTTP context. Safe for SSG and server-side use.
10
+ *
11
+ * @remarks **Security:** Authorization hooks are NOT called. The caller is
12
+ * responsible for any access-control checks before invoking this function.
13
+ *
14
+ * @param adapter - The database adapter
15
+ */
16
+ declare function getAllContentTypes(adapter: Adapter): Promise<SerializedContentType[]>;
17
+ /**
18
+ * Retrieve all content items for a given content type, with optional pagination.
19
+ * Pure DB function — no hooks, no HTTP context. Safe for SSG and server-side use.
20
+ *
21
+ * @remarks **Security:** Authorization hooks (e.g. `onBeforeListItems`) are NOT
22
+ * called. The caller is responsible for any access-control checks before
23
+ * invoking this function.
24
+ *
25
+ * @param adapter - The database adapter
26
+ * @param contentTypeSlug - The slug of the content type to query
27
+ * @param params - Optional filter/pagination parameters
28
+ */
29
+ declare function getAllContentItems(adapter: Adapter, contentTypeSlug: string, params?: {
30
+ slug?: string;
31
+ limit?: number;
32
+ offset?: number;
33
+ }): Promise<{
34
+ items: SerializedContentItemWithType[];
35
+ total: number;
36
+ limit?: number;
37
+ offset?: number;
38
+ }>;
39
+ /**
40
+ * Retrieve a single content item by its slug within a content type.
41
+ * Returns null if the content type or item is not found.
42
+ * Pure DB function — no hooks, no HTTP context. Safe for SSG and server-side use.
43
+ *
44
+ * @remarks **Security:** Authorization hooks are NOT called. The caller is
45
+ * responsible for any access-control checks before invoking this function.
46
+ *
47
+ * @param adapter - The database adapter
48
+ * @param contentTypeSlug - The slug of the content type
49
+ * @param slug - The slug of the content item
50
+ */
51
+ declare function getContentItemBySlug(adapter: Adapter, contentTypeSlug: string, slug: string): Promise<SerializedContentItemWithType | null>;
5
52
 
6
53
  /**
7
54
  * CMS backend plugin
@@ -41,10 +88,10 @@ declare const cmsBackendPlugin: (config: CMSBackendConfig) => _btst_stack_plugin
41
88
  offset: z.ZodDefault<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
42
89
  }, z.core.$strip>;
43
90
  }, {
44
- items: SerializedContentItemWithType<Record<string, unknown>>[];
91
+ items: SerializedContentItemWithType[];
45
92
  total: number;
46
- limit: number;
47
- offset: number;
93
+ limit?: number;
94
+ offset?: number;
48
95
  }>;
49
96
  getContentItem: better_call.StrictEndpoint<"/content/:typeSlug/:id", {
50
97
  method: "GET";
@@ -156,8 +203,17 @@ declare const cmsBackendPlugin: (config: CMSBackendConfig) => _btst_stack_plugin
156
203
  limit: number;
157
204
  offset: number;
158
205
  }>;
206
+ }, {
207
+ getAllContentTypes: () => Promise<SerializedContentType[]>;
208
+ getAllContentItems: (contentTypeSlug: string, params?: Parameters<typeof getAllContentItems>[2]) => Promise<{
209
+ items: SerializedContentItemWithType[];
210
+ total: number;
211
+ limit?: number;
212
+ offset?: number;
213
+ }>;
214
+ getContentItemBySlug: (contentTypeSlug: string, slug: string) => Promise<SerializedContentItemWithType<Record<string, unknown>> | null>;
159
215
  }>;
160
216
  type CMSApiRouter = ReturnType<ReturnType<typeof cmsBackendPlugin>["routes"]>;
161
217
 
162
- export { cmsBackendPlugin };
218
+ export { cmsBackendPlugin, getAllContentItems, getAllContentTypes, getContentItemBySlug };
163
219
  export type { CMSApiRouter };
@@ -1,7 +1,54 @@
1
1
  import * as _btst_stack_plugins_api from '@btst/stack/plugins/api';
2
+ import { a as SerializedContentItemWithType, S as SerializedContentType, b as CMSBackendConfig, I as InverseRelation } from '../../../shared/stack.CXjzTMsb.js';
2
3
  import * as better_call from 'better-call';
3
4
  import { z } from 'zod';
4
- import { b as CMSBackendConfig, S as SerializedContentType, a as SerializedContentItemWithType, I as InverseRelation } from '../../../shared/stack.BsXokfNh.js';
5
+ import { Adapter } from '@btst/db';
6
+
7
+ /**
8
+ * Retrieve all content types.
9
+ * Pure DB function — no hooks, no HTTP context. Safe for SSG and server-side use.
10
+ *
11
+ * @remarks **Security:** Authorization hooks are NOT called. The caller is
12
+ * responsible for any access-control checks before invoking this function.
13
+ *
14
+ * @param adapter - The database adapter
15
+ */
16
+ declare function getAllContentTypes(adapter: Adapter): Promise<SerializedContentType[]>;
17
+ /**
18
+ * Retrieve all content items for a given content type, with optional pagination.
19
+ * Pure DB function — no hooks, no HTTP context. Safe for SSG and server-side use.
20
+ *
21
+ * @remarks **Security:** Authorization hooks (e.g. `onBeforeListItems`) are NOT
22
+ * called. The caller is responsible for any access-control checks before
23
+ * invoking this function.
24
+ *
25
+ * @param adapter - The database adapter
26
+ * @param contentTypeSlug - The slug of the content type to query
27
+ * @param params - Optional filter/pagination parameters
28
+ */
29
+ declare function getAllContentItems(adapter: Adapter, contentTypeSlug: string, params?: {
30
+ slug?: string;
31
+ limit?: number;
32
+ offset?: number;
33
+ }): Promise<{
34
+ items: SerializedContentItemWithType[];
35
+ total: number;
36
+ limit?: number;
37
+ offset?: number;
38
+ }>;
39
+ /**
40
+ * Retrieve a single content item by its slug within a content type.
41
+ * Returns null if the content type or item is not found.
42
+ * Pure DB function — no hooks, no HTTP context. Safe for SSG and server-side use.
43
+ *
44
+ * @remarks **Security:** Authorization hooks are NOT called. The caller is
45
+ * responsible for any access-control checks before invoking this function.
46
+ *
47
+ * @param adapter - The database adapter
48
+ * @param contentTypeSlug - The slug of the content type
49
+ * @param slug - The slug of the content item
50
+ */
51
+ declare function getContentItemBySlug(adapter: Adapter, contentTypeSlug: string, slug: string): Promise<SerializedContentItemWithType | null>;
5
52
 
6
53
  /**
7
54
  * CMS backend plugin
@@ -41,10 +88,10 @@ declare const cmsBackendPlugin: (config: CMSBackendConfig) => _btst_stack_plugin
41
88
  offset: z.ZodDefault<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
42
89
  }, z.core.$strip>;
43
90
  }, {
44
- items: SerializedContentItemWithType<Record<string, unknown>>[];
91
+ items: SerializedContentItemWithType[];
45
92
  total: number;
46
- limit: number;
47
- offset: number;
93
+ limit?: number;
94
+ offset?: number;
48
95
  }>;
49
96
  getContentItem: better_call.StrictEndpoint<"/content/:typeSlug/:id", {
50
97
  method: "GET";
@@ -156,8 +203,17 @@ declare const cmsBackendPlugin: (config: CMSBackendConfig) => _btst_stack_plugin
156
203
  limit: number;
157
204
  offset: number;
158
205
  }>;
206
+ }, {
207
+ getAllContentTypes: () => Promise<SerializedContentType[]>;
208
+ getAllContentItems: (contentTypeSlug: string, params?: Parameters<typeof getAllContentItems>[2]) => Promise<{
209
+ items: SerializedContentItemWithType[];
210
+ total: number;
211
+ limit?: number;
212
+ offset?: number;
213
+ }>;
214
+ getContentItemBySlug: (contentTypeSlug: string, slug: string) => Promise<SerializedContentItemWithType<Record<string, unknown>> | null>;
159
215
  }>;
160
216
  type CMSApiRouter = ReturnType<ReturnType<typeof cmsBackendPlugin>["routes"]>;
161
217
 
162
- export { cmsBackendPlugin };
218
+ export { cmsBackendPlugin, getAllContentItems, getAllContentTypes, getContentItemBySlug };
163
219
  export type { CMSApiRouter };
@@ -1 +1,2 @@
1
1
  export { cmsBackendPlugin } from '../../../packages/stack/src/plugins/cms/api/plugin.mjs';
2
+ export { getAllContentItems, getAllContentTypes, getContentItemBySlug } from '../../../packages/stack/src/plugins/cms/api/getters.mjs';
@@ -1,5 +1,5 @@
1
1
  import * as _tanstack_react_query from '@tanstack/react-query';
2
- import { S as SerializedContentType, a as SerializedContentItemWithType } from '../../../../shared/stack.BsXokfNh.cjs';
2
+ import { S as SerializedContentType, a as SerializedContentItemWithType } from '../../../../shared/stack.CXjzTMsb.cjs';
3
3
  import 'zod';
4
4
 
5
5
  interface UseContentTypesResult {
@@ -1,5 +1,5 @@
1
1
  import * as _tanstack_react_query from '@tanstack/react-query';
2
- import { S as SerializedContentType, a as SerializedContentItemWithType } from '../../../../shared/stack.BsXokfNh.mjs';
2
+ import { S as SerializedContentType, a as SerializedContentItemWithType } from '../../../../shared/stack.CXjzTMsb.mjs';
3
3
  import 'zod';
4
4
 
5
5
  interface UseContentTypesResult {
@@ -1,5 +1,5 @@
1
1
  import * as _tanstack_react_query from '@tanstack/react-query';
2
- import { S as SerializedContentType, a as SerializedContentItemWithType } from '../../../../shared/stack.BsXokfNh.js';
2
+ import { S as SerializedContentType, a as SerializedContentItemWithType } from '../../../../shared/stack.CXjzTMsb.js';
3
3
  import 'zod';
4
4
 
5
5
  interface UseContentTypesResult {
@@ -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 { S as SerializedContentType, P as PaginatedContentItems, a as SerializedContentItemWithType } from '../../shared/stack.BsXokfNh.cjs';
3
+ import { S as SerializedContentType, P as PaginatedContentItems, a as SerializedContentItemWithType } from '../../shared/stack.CXjzTMsb.cjs';
4
4
  import { CMSApiRouter } from './api/index.cjs';
5
5
  import 'zod';
6
6
  import '@btst/stack/plugins/api';
7
7
  import 'better-call';
8
+ import '@btst/db';
8
9
 
9
10
  interface ContentListParams {
10
11
  limit?: number;
@@ -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 { S as SerializedContentType, P as PaginatedContentItems, a as SerializedContentItemWithType } from '../../shared/stack.BsXokfNh.mjs';
3
+ import { S as SerializedContentType, P as PaginatedContentItems, a as SerializedContentItemWithType } from '../../shared/stack.CXjzTMsb.mjs';
4
4
  import { CMSApiRouter } from './api/index.mjs';
5
5
  import 'zod';
6
6
  import '@btst/stack/plugins/api';
7
7
  import 'better-call';
8
+ import '@btst/db';
8
9
 
9
10
  interface ContentListParams {
10
11
  limit?: number;
@@ -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 { S as SerializedContentType, P as PaginatedContentItems, a as SerializedContentItemWithType } from '../../shared/stack.BsXokfNh.js';
3
+ import { S as SerializedContentType, P as PaginatedContentItems, a as SerializedContentItemWithType } from '../../shared/stack.CXjzTMsb.js';
4
4
  import { CMSApiRouter } from './api/index.js';
5
5
  import 'zod';
6
6
  import '@btst/stack/plugins/api';
7
7
  import 'better-call';
8
+ import '@btst/db';
8
9
 
9
10
  interface ContentListParams {
10
11
  limit?: number;
@@ -1,7 +1,11 @@
1
1
  'use strict';
2
2
 
3
3
  const plugin = require('../../../packages/stack/src/plugins/form-builder/api/plugin.cjs');
4
+ const getters = require('../../../packages/stack/src/plugins/form-builder/api/getters.cjs');
4
5
 
5
6
 
6
7
 
7
8
  exports.formBuilderBackendPlugin = plugin.formBuilderBackendPlugin;
9
+ exports.getAllForms = getters.getAllForms;
10
+ exports.getFormBySlug = getters.getFormBySlug;
11
+ exports.getFormSubmissions = getters.getFormSubmissions;
@@ -1,7 +1,63 @@
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 SerializedForm, b as SerializedFormSubmissionWithData, F as FormBuilderBackendConfig } from '../../../shared/stack.CIrIsc-A.cjs';
3
4
  import { z } from 'zod';
4
- import { F as FormBuilderBackendConfig, S as SerializedForm, b as SerializedFormSubmissionWithData } from '../../../shared/stack.DzH_wcvr.cjs';
5
+ import { Adapter } from '@btst/db';
6
+
7
+ /**
8
+ * Retrieve all forms with optional status filter and pagination.
9
+ * Pure DB function — no hooks, no HTTP context. Safe for SSG and server-side use.
10
+ *
11
+ * @remarks **Security:** Authorization hooks (e.g. `onBeforeListForms`) are NOT
12
+ * called. The caller is responsible for any access-control checks before
13
+ * invoking this function.
14
+ *
15
+ * @param adapter - The database adapter
16
+ * @param params - Optional filter/pagination parameters
17
+ */
18
+ declare function getAllForms(adapter: Adapter, params?: {
19
+ status?: string;
20
+ limit?: number;
21
+ offset?: number;
22
+ }): Promise<{
23
+ items: SerializedForm[];
24
+ total: number;
25
+ limit?: number;
26
+ offset?: number;
27
+ }>;
28
+ /**
29
+ * Retrieve a single form by its slug.
30
+ * Returns null if the form is not found.
31
+ * Pure DB function — no hooks, no HTTP context. Safe for SSG and server-side use.
32
+ *
33
+ * @remarks **Security:** Authorization hooks are NOT called. The caller is
34
+ * responsible for any access-control checks before invoking this function.
35
+ *
36
+ * @param adapter - The database adapter
37
+ * @param slug - The form slug
38
+ */
39
+ declare function getFormBySlug(adapter: Adapter, slug: string): Promise<SerializedForm | null>;
40
+ /**
41
+ * Retrieve submissions for a form by form ID, with optional pagination.
42
+ * Returns an empty result if the form does not exist.
43
+ * Pure DB function — no hooks, no HTTP context. Safe for server-side use.
44
+ *
45
+ * @remarks **Security:** Authorization hooks are NOT called. The caller is
46
+ * responsible for any access-control checks before invoking this function.
47
+ *
48
+ * @param adapter - The database adapter
49
+ * @param formId - The form ID
50
+ * @param params - Optional pagination parameters
51
+ */
52
+ declare function getFormSubmissions(adapter: Adapter, formId: string, params?: {
53
+ limit?: number;
54
+ offset?: number;
55
+ }): Promise<{
56
+ items: SerializedFormSubmissionWithData[];
57
+ total: number;
58
+ limit?: number;
59
+ offset?: number;
60
+ }>;
5
61
 
6
62
  /**
7
63
  * Form Builder backend plugin
@@ -24,8 +80,8 @@ declare const formBuilderBackendPlugin: (config?: FormBuilderBackendConfig) => _
24
80
  }, {
25
81
  items: SerializedForm[];
26
82
  total: number;
27
- limit: number;
28
- offset: number;
83
+ limit?: number;
84
+ offset?: number;
29
85
  }>;
30
86
  getFormBySlug: better_call.StrictEndpoint<"/forms/:slug", {
31
87
  method: "GET";
@@ -113,10 +169,10 @@ declare const formBuilderBackendPlugin: (config?: FormBuilderBackendConfig) => _
113
169
  offset: z.ZodDefault<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
114
170
  }, z.core.$strip>;
115
171
  }, {
116
- items: SerializedFormSubmissionWithData<Record<string, unknown>>[];
172
+ items: SerializedFormSubmissionWithData[];
117
173
  total: number;
118
- limit: number;
119
- offset: number;
174
+ limit?: number;
175
+ offset?: number;
120
176
  }>;
121
177
  getSubmission: better_call.StrictEndpoint<"/forms/:formId/submissions/:subId", {
122
178
  method: "GET";
@@ -134,8 +190,22 @@ declare const formBuilderBackendPlugin: (config?: FormBuilderBackendConfig) => _
134
190
  }, {
135
191
  success: boolean;
136
192
  }>;
193
+ }, {
194
+ getAllForms: (params?: Parameters<typeof getAllForms>[1]) => Promise<{
195
+ items: SerializedForm[];
196
+ total: number;
197
+ limit?: number;
198
+ offset?: number;
199
+ }>;
200
+ getFormBySlug: (slug: string) => Promise<SerializedForm | null>;
201
+ getFormSubmissions: (formId: string, params?: Parameters<typeof getFormSubmissions>[2]) => Promise<{
202
+ items: SerializedFormSubmissionWithData[];
203
+ total: number;
204
+ limit?: number;
205
+ offset?: number;
206
+ }>;
137
207
  }>;
138
208
  type FormBuilderApiRouter = ReturnType<ReturnType<typeof formBuilderBackendPlugin>["routes"]>;
139
209
 
140
- export { formBuilderBackendPlugin };
210
+ export { formBuilderBackendPlugin, getAllForms, getFormBySlug, getFormSubmissions };
141
211
  export type { FormBuilderApiRouter };
@@ -1,7 +1,63 @@
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 SerializedForm, b as SerializedFormSubmissionWithData, F as FormBuilderBackendConfig } from '../../../shared/stack.CIrIsc-A.mjs';
3
4
  import { z } from 'zod';
4
- import { F as FormBuilderBackendConfig, S as SerializedForm, b as SerializedFormSubmissionWithData } from '../../../shared/stack.DzH_wcvr.mjs';
5
+ import { Adapter } from '@btst/db';
6
+
7
+ /**
8
+ * Retrieve all forms with optional status filter and pagination.
9
+ * Pure DB function — no hooks, no HTTP context. Safe for SSG and server-side use.
10
+ *
11
+ * @remarks **Security:** Authorization hooks (e.g. `onBeforeListForms`) are NOT
12
+ * called. The caller is responsible for any access-control checks before
13
+ * invoking this function.
14
+ *
15
+ * @param adapter - The database adapter
16
+ * @param params - Optional filter/pagination parameters
17
+ */
18
+ declare function getAllForms(adapter: Adapter, params?: {
19
+ status?: string;
20
+ limit?: number;
21
+ offset?: number;
22
+ }): Promise<{
23
+ items: SerializedForm[];
24
+ total: number;
25
+ limit?: number;
26
+ offset?: number;
27
+ }>;
28
+ /**
29
+ * Retrieve a single form by its slug.
30
+ * Returns null if the form is not found.
31
+ * Pure DB function — no hooks, no HTTP context. Safe for SSG and server-side use.
32
+ *
33
+ * @remarks **Security:** Authorization hooks are NOT called. The caller is
34
+ * responsible for any access-control checks before invoking this function.
35
+ *
36
+ * @param adapter - The database adapter
37
+ * @param slug - The form slug
38
+ */
39
+ declare function getFormBySlug(adapter: Adapter, slug: string): Promise<SerializedForm | null>;
40
+ /**
41
+ * Retrieve submissions for a form by form ID, with optional pagination.
42
+ * Returns an empty result if the form does not exist.
43
+ * Pure DB function — no hooks, no HTTP context. Safe for server-side use.
44
+ *
45
+ * @remarks **Security:** Authorization hooks are NOT called. The caller is
46
+ * responsible for any access-control checks before invoking this function.
47
+ *
48
+ * @param adapter - The database adapter
49
+ * @param formId - The form ID
50
+ * @param params - Optional pagination parameters
51
+ */
52
+ declare function getFormSubmissions(adapter: Adapter, formId: string, params?: {
53
+ limit?: number;
54
+ offset?: number;
55
+ }): Promise<{
56
+ items: SerializedFormSubmissionWithData[];
57
+ total: number;
58
+ limit?: number;
59
+ offset?: number;
60
+ }>;
5
61
 
6
62
  /**
7
63
  * Form Builder backend plugin
@@ -24,8 +80,8 @@ declare const formBuilderBackendPlugin: (config?: FormBuilderBackendConfig) => _
24
80
  }, {
25
81
  items: SerializedForm[];
26
82
  total: number;
27
- limit: number;
28
- offset: number;
83
+ limit?: number;
84
+ offset?: number;
29
85
  }>;
30
86
  getFormBySlug: better_call.StrictEndpoint<"/forms/:slug", {
31
87
  method: "GET";
@@ -113,10 +169,10 @@ declare const formBuilderBackendPlugin: (config?: FormBuilderBackendConfig) => _
113
169
  offset: z.ZodDefault<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
114
170
  }, z.core.$strip>;
115
171
  }, {
116
- items: SerializedFormSubmissionWithData<Record<string, unknown>>[];
172
+ items: SerializedFormSubmissionWithData[];
117
173
  total: number;
118
- limit: number;
119
- offset: number;
174
+ limit?: number;
175
+ offset?: number;
120
176
  }>;
121
177
  getSubmission: better_call.StrictEndpoint<"/forms/:formId/submissions/:subId", {
122
178
  method: "GET";
@@ -134,8 +190,22 @@ declare const formBuilderBackendPlugin: (config?: FormBuilderBackendConfig) => _
134
190
  }, {
135
191
  success: boolean;
136
192
  }>;
193
+ }, {
194
+ getAllForms: (params?: Parameters<typeof getAllForms>[1]) => Promise<{
195
+ items: SerializedForm[];
196
+ total: number;
197
+ limit?: number;
198
+ offset?: number;
199
+ }>;
200
+ getFormBySlug: (slug: string) => Promise<SerializedForm | null>;
201
+ getFormSubmissions: (formId: string, params?: Parameters<typeof getFormSubmissions>[2]) => Promise<{
202
+ items: SerializedFormSubmissionWithData[];
203
+ total: number;
204
+ limit?: number;
205
+ offset?: number;
206
+ }>;
137
207
  }>;
138
208
  type FormBuilderApiRouter = ReturnType<ReturnType<typeof formBuilderBackendPlugin>["routes"]>;
139
209
 
140
- export { formBuilderBackendPlugin };
210
+ export { formBuilderBackendPlugin, getAllForms, getFormBySlug, getFormSubmissions };
141
211
  export type { FormBuilderApiRouter };
@@ -1,7 +1,63 @@
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 SerializedForm, b as SerializedFormSubmissionWithData, F as FormBuilderBackendConfig } from '../../../shared/stack.CIrIsc-A.js';
3
4
  import { z } from 'zod';
4
- import { F as FormBuilderBackendConfig, S as SerializedForm, b as SerializedFormSubmissionWithData } from '../../../shared/stack.DzH_wcvr.js';
5
+ import { Adapter } from '@btst/db';
6
+
7
+ /**
8
+ * Retrieve all forms with optional status filter and pagination.
9
+ * Pure DB function — no hooks, no HTTP context. Safe for SSG and server-side use.
10
+ *
11
+ * @remarks **Security:** Authorization hooks (e.g. `onBeforeListForms`) are NOT
12
+ * called. The caller is responsible for any access-control checks before
13
+ * invoking this function.
14
+ *
15
+ * @param adapter - The database adapter
16
+ * @param params - Optional filter/pagination parameters
17
+ */
18
+ declare function getAllForms(adapter: Adapter, params?: {
19
+ status?: string;
20
+ limit?: number;
21
+ offset?: number;
22
+ }): Promise<{
23
+ items: SerializedForm[];
24
+ total: number;
25
+ limit?: number;
26
+ offset?: number;
27
+ }>;
28
+ /**
29
+ * Retrieve a single form by its slug.
30
+ * Returns null if the form is not found.
31
+ * Pure DB function — no hooks, no HTTP context. Safe for SSG and server-side use.
32
+ *
33
+ * @remarks **Security:** Authorization hooks are NOT called. The caller is
34
+ * responsible for any access-control checks before invoking this function.
35
+ *
36
+ * @param adapter - The database adapter
37
+ * @param slug - The form slug
38
+ */
39
+ declare function getFormBySlug(adapter: Adapter, slug: string): Promise<SerializedForm | null>;
40
+ /**
41
+ * Retrieve submissions for a form by form ID, with optional pagination.
42
+ * Returns an empty result if the form does not exist.
43
+ * Pure DB function — no hooks, no HTTP context. Safe for server-side use.
44
+ *
45
+ * @remarks **Security:** Authorization hooks are NOT called. The caller is
46
+ * responsible for any access-control checks before invoking this function.
47
+ *
48
+ * @param adapter - The database adapter
49
+ * @param formId - The form ID
50
+ * @param params - Optional pagination parameters
51
+ */
52
+ declare function getFormSubmissions(adapter: Adapter, formId: string, params?: {
53
+ limit?: number;
54
+ offset?: number;
55
+ }): Promise<{
56
+ items: SerializedFormSubmissionWithData[];
57
+ total: number;
58
+ limit?: number;
59
+ offset?: number;
60
+ }>;
5
61
 
6
62
  /**
7
63
  * Form Builder backend plugin
@@ -24,8 +80,8 @@ declare const formBuilderBackendPlugin: (config?: FormBuilderBackendConfig) => _
24
80
  }, {
25
81
  items: SerializedForm[];
26
82
  total: number;
27
- limit: number;
28
- offset: number;
83
+ limit?: number;
84
+ offset?: number;
29
85
  }>;
30
86
  getFormBySlug: better_call.StrictEndpoint<"/forms/:slug", {
31
87
  method: "GET";
@@ -113,10 +169,10 @@ declare const formBuilderBackendPlugin: (config?: FormBuilderBackendConfig) => _
113
169
  offset: z.ZodDefault<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
114
170
  }, z.core.$strip>;
115
171
  }, {
116
- items: SerializedFormSubmissionWithData<Record<string, unknown>>[];
172
+ items: SerializedFormSubmissionWithData[];
117
173
  total: number;
118
- limit: number;
119
- offset: number;
174
+ limit?: number;
175
+ offset?: number;
120
176
  }>;
121
177
  getSubmission: better_call.StrictEndpoint<"/forms/:formId/submissions/:subId", {
122
178
  method: "GET";
@@ -134,8 +190,22 @@ declare const formBuilderBackendPlugin: (config?: FormBuilderBackendConfig) => _
134
190
  }, {
135
191
  success: boolean;
136
192
  }>;
193
+ }, {
194
+ getAllForms: (params?: Parameters<typeof getAllForms>[1]) => Promise<{
195
+ items: SerializedForm[];
196
+ total: number;
197
+ limit?: number;
198
+ offset?: number;
199
+ }>;
200
+ getFormBySlug: (slug: string) => Promise<SerializedForm | null>;
201
+ getFormSubmissions: (formId: string, params?: Parameters<typeof getFormSubmissions>[2]) => Promise<{
202
+ items: SerializedFormSubmissionWithData[];
203
+ total: number;
204
+ limit?: number;
205
+ offset?: number;
206
+ }>;
137
207
  }>;
138
208
  type FormBuilderApiRouter = ReturnType<ReturnType<typeof formBuilderBackendPlugin>["routes"]>;
139
209
 
140
- export { formBuilderBackendPlugin };
210
+ export { formBuilderBackendPlugin, getAllForms, getFormBySlug, getFormSubmissions };
141
211
  export type { FormBuilderApiRouter };
@@ -1 +1,2 @@
1
1
  export { formBuilderBackendPlugin } from '../../../packages/stack/src/plugins/form-builder/api/plugin.mjs';
2
+ export { getAllForms, getFormBySlug, getFormSubmissions } from '../../../packages/stack/src/plugins/form-builder/api/getters.mjs';
@@ -1,7 +1,7 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { ComponentType } from 'react';
3
3
  import { A as AutoFormInputComponentProps } from '../../../../shared/stack.8nldKomx.cjs';
4
- import { a as SerializedFormSubmission } from '../../../../shared/stack.DzH_wcvr.cjs';
4
+ import { a as SerializedFormSubmission } from '../../../../shared/stack.CIrIsc-A.cjs';
5
5
  import 'react-hook-form';
6
6
  import 'zod';
7
7
 
@@ -1,7 +1,7 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { ComponentType } from 'react';
3
3
  import { A as AutoFormInputComponentProps } from '../../../../shared/stack.8nldKomx.mjs';
4
- import { a as SerializedFormSubmission } from '../../../../shared/stack.DzH_wcvr.mjs';
4
+ import { a as SerializedFormSubmission } from '../../../../shared/stack.CIrIsc-A.mjs';
5
5
  import 'react-hook-form';
6
6
  import 'zod';
7
7
 
@@ -1,7 +1,7 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { ComponentType } from 'react';
3
3
  import { A as AutoFormInputComponentProps } from '../../../../shared/stack.8nldKomx.js';
4
- import { a as SerializedFormSubmission } from '../../../../shared/stack.DzH_wcvr.js';
4
+ import { a as SerializedFormSubmission } from '../../../../shared/stack.CIrIsc-A.js';
5
5
  import 'react-hook-form';
6
6
  import 'zod';
7
7
 
@@ -1,5 +1,5 @@
1
1
  import * as _tanstack_react_query from '@tanstack/react-query';
2
- import { S as SerializedForm, a as SerializedFormSubmission, b as SerializedFormSubmissionWithData } from '../../../../shared/stack.DzH_wcvr.cjs';
2
+ import { S as SerializedForm, a as SerializedFormSubmission, b as SerializedFormSubmissionWithData } from '../../../../shared/stack.CIrIsc-A.cjs';
3
3
 
4
4
  interface UseFormsOptions {
5
5
  /** Filter by status */
@@ -1,5 +1,5 @@
1
1
  import * as _tanstack_react_query from '@tanstack/react-query';
2
- import { S as SerializedForm, a as SerializedFormSubmission, b as SerializedFormSubmissionWithData } from '../../../../shared/stack.DzH_wcvr.mjs';
2
+ import { S as SerializedForm, a as SerializedFormSubmission, b as SerializedFormSubmissionWithData } from '../../../../shared/stack.CIrIsc-A.mjs';
3
3
 
4
4
  interface UseFormsOptions {
5
5
  /** Filter by status */
@@ -1,5 +1,5 @@
1
1
  import * as _tanstack_react_query from '@tanstack/react-query';
2
- import { S as SerializedForm, a as SerializedFormSubmission, b as SerializedFormSubmissionWithData } from '../../../../shared/stack.DzH_wcvr.js';
2
+ import { S as SerializedForm, a as SerializedFormSubmission, b as SerializedFormSubmissionWithData } from '../../../../shared/stack.CIrIsc-A.js';
3
3
 
4
4
  interface UseFormsOptions {
5
5
  /** Filter by status */