@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,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.CXjzTMsb.cjs';
2
+ import { S as SerializedContentType, a as SerializedContentItemWithType } from '../../../../shared/stack.CVDTkMoO.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.CXjzTMsb.mjs';
2
+ import { S as SerializedContentType, a as SerializedContentItemWithType } from '../../../../shared/stack.CVDTkMoO.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.CXjzTMsb.js';
2
+ import { S as SerializedContentType, a as SerializedContentItemWithType } from '../../../../shared/stack.CVDTkMoO.js';
3
3
  import 'zod';
4
4
 
5
5
  interface UseContentTypesResult {
@@ -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/cms/api/query-key-defs.cjs');
4
5
 
5
6
  function isErrorResponse(response) {
6
7
  if (typeof response !== "object" || response === null) {
@@ -70,7 +71,7 @@ function createContentTypesQueries(client, headers) {
70
71
  function createContentQueries(client, headers) {
71
72
  return queryKeyFactory.createQueryKeys("cmsContent", {
72
73
  list: (params) => ({
73
- queryKey: [params],
74
+ queryKey: [queryKeyDefs.contentListDiscriminator(params)],
74
75
  queryFn: async () => {
75
76
  try {
76
77
  const response = await client("/content/:typeSlug", {
@@ -1,10 +1,10 @@
1
+ import { C as CMSApiRouter, a as ContentListDiscriminator } from '../../shared/stack.IdtKDRka.cjs';
1
2
  import * as _tanstack_react_query from '@tanstack/react-query';
2
3
  import { createApiClient } from '@btst/stack/plugins/client';
3
- import { S as SerializedContentType, P as PaginatedContentItems, a as SerializedContentItemWithType } from '../../shared/stack.CXjzTMsb.cjs';
4
- import { CMSApiRouter } from './api/index.cjs';
5
- import 'zod';
4
+ import { S as SerializedContentType, P as PaginatedContentItems, a as SerializedContentItemWithType } from '../../shared/stack.CVDTkMoO.cjs';
6
5
  import '@btst/stack/plugins/api';
7
6
  import 'better-call';
7
+ import 'zod';
8
8
  import '@btst/db';
9
9
 
10
10
  interface ContentListParams {
@@ -44,12 +44,8 @@ declare function createCMSQueryKeys(client: ReturnType<typeof createApiClient<CM
44
44
  list: ((params: {
45
45
  typeSlug: string;
46
46
  } & ContentListParams) => Omit<{
47
- queryKey: readonly ["cmsContent", "list", {
48
- typeSlug: string;
49
- } & ContentListParams];
50
- queryFn: _tanstack_react_query.QueryFunction<PaginatedContentItems<Record<string, unknown>>, readonly ["cmsContent", "list", {
51
- typeSlug: string;
52
- } & ContentListParams]>;
47
+ queryKey: readonly ["cmsContent", "list", ContentListDiscriminator];
48
+ queryFn: _tanstack_react_query.QueryFunction<PaginatedContentItems<Record<string, unknown>>, readonly ["cmsContent", "list", ContentListDiscriminator]>;
53
49
  } & {
54
50
  _def: readonly ["cmsContent", "list"];
55
51
  }, "_def">) & {
@@ -1,10 +1,10 @@
1
+ import { C as CMSApiRouter, a as ContentListDiscriminator } from '../../shared/stack.CP68pFEH.mjs';
1
2
  import * as _tanstack_react_query from '@tanstack/react-query';
2
3
  import { createApiClient } from '@btst/stack/plugins/client';
3
- import { S as SerializedContentType, P as PaginatedContentItems, a as SerializedContentItemWithType } from '../../shared/stack.CXjzTMsb.mjs';
4
- import { CMSApiRouter } from './api/index.mjs';
5
- import 'zod';
4
+ import { S as SerializedContentType, P as PaginatedContentItems, a as SerializedContentItemWithType } from '../../shared/stack.CVDTkMoO.mjs';
6
5
  import '@btst/stack/plugins/api';
7
6
  import 'better-call';
7
+ import 'zod';
8
8
  import '@btst/db';
9
9
 
10
10
  interface ContentListParams {
@@ -44,12 +44,8 @@ declare function createCMSQueryKeys(client: ReturnType<typeof createApiClient<CM
44
44
  list: ((params: {
45
45
  typeSlug: string;
46
46
  } & ContentListParams) => Omit<{
47
- queryKey: readonly ["cmsContent", "list", {
48
- typeSlug: string;
49
- } & ContentListParams];
50
- queryFn: _tanstack_react_query.QueryFunction<PaginatedContentItems<Record<string, unknown>>, readonly ["cmsContent", "list", {
51
- typeSlug: string;
52
- } & ContentListParams]>;
47
+ queryKey: readonly ["cmsContent", "list", ContentListDiscriminator];
48
+ queryFn: _tanstack_react_query.QueryFunction<PaginatedContentItems<Record<string, unknown>>, readonly ["cmsContent", "list", ContentListDiscriminator]>;
53
49
  } & {
54
50
  _def: readonly ["cmsContent", "list"];
55
51
  }, "_def">) & {
@@ -1,10 +1,10 @@
1
+ import { C as CMSApiRouter, a as ContentListDiscriminator } from '../../shared/stack.B1EeBt1b.js';
1
2
  import * as _tanstack_react_query from '@tanstack/react-query';
2
3
  import { createApiClient } from '@btst/stack/plugins/client';
3
- import { S as SerializedContentType, P as PaginatedContentItems, a as SerializedContentItemWithType } from '../../shared/stack.CXjzTMsb.js';
4
- import { CMSApiRouter } from './api/index.js';
5
- import 'zod';
4
+ import { S as SerializedContentType, P as PaginatedContentItems, a as SerializedContentItemWithType } from '../../shared/stack.CVDTkMoO.js';
6
5
  import '@btst/stack/plugins/api';
7
6
  import 'better-call';
7
+ import 'zod';
8
8
  import '@btst/db';
9
9
 
10
10
  interface ContentListParams {
@@ -44,12 +44,8 @@ declare function createCMSQueryKeys(client: ReturnType<typeof createApiClient<CM
44
44
  list: ((params: {
45
45
  typeSlug: string;
46
46
  } & ContentListParams) => Omit<{
47
- queryKey: readonly ["cmsContent", "list", {
48
- typeSlug: string;
49
- } & ContentListParams];
50
- queryFn: _tanstack_react_query.QueryFunction<PaginatedContentItems<Record<string, unknown>>, readonly ["cmsContent", "list", {
51
- typeSlug: string;
52
- } & ContentListParams]>;
47
+ queryKey: readonly ["cmsContent", "list", ContentListDiscriminator];
48
+ queryFn: _tanstack_react_query.QueryFunction<PaginatedContentItems<Record<string, unknown>>, readonly ["cmsContent", "list", ContentListDiscriminator]>;
53
49
  } & {
54
50
  _def: readonly ["cmsContent", "list"];
55
51
  }, "_def">) & {
@@ -1,4 +1,5 @@
1
1
  import { mergeQueryKeys, createQueryKeys } from '@lukemorales/query-key-factory';
2
+ import { contentListDiscriminator } from '../../packages/stack/src/plugins/cms/api/query-key-defs.mjs';
2
3
 
3
4
  function isErrorResponse(response) {
4
5
  if (typeof response !== "object" || response === null) {
@@ -68,7 +69,7 @@ function createContentTypesQueries(client, headers) {
68
69
  function createContentQueries(client, headers) {
69
70
  return createQueryKeys("cmsContent", {
70
71
  list: (params) => ({
71
- queryKey: [params],
72
+ queryKey: [contentListDiscriminator(params)],
72
73
  queryFn: async () => {
73
74
  try {
74
75
  const response = await client("/content/:typeSlug", {
@@ -2,10 +2,16 @@
2
2
 
3
3
  const plugin = require('../../../packages/stack/src/plugins/form-builder/api/plugin.cjs');
4
4
  const getters = require('../../../packages/stack/src/plugins/form-builder/api/getters.cjs');
5
+ const queryKeyDefs = require('../../../packages/stack/src/plugins/form-builder/api/query-key-defs.cjs');
5
6
 
6
7
 
7
8
 
8
9
  exports.formBuilderBackendPlugin = plugin.formBuilderBackendPlugin;
9
10
  exports.getAllForms = getters.getAllForms;
11
+ exports.getFormById = getters.getFormById;
10
12
  exports.getFormBySlug = getters.getFormBySlug;
11
13
  exports.getFormSubmissions = getters.getFormSubmissions;
14
+ exports.serializeForm = getters.serializeForm;
15
+ exports.serializeFormSubmission = getters.serializeFormSubmission;
16
+ exports.serializeFormSubmissionWithData = getters.serializeFormSubmissionWithData;
17
+ exports.FORM_QUERY_KEYS = queryKeyDefs.FORM_QUERY_KEYS;
@@ -1,211 +1,7 @@
1
- import * as _btst_stack_plugins_api from '@btst/stack/plugins/api';
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';
4
- import { z } from 'zod';
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
- }>;
61
-
62
- /**
63
- * Form Builder backend plugin
64
- * Provides API endpoints for managing forms and form submissions
65
- *
66
- * @param config - Configuration with optional hooks
67
- */
68
- declare const formBuilderBackendPlugin: (config?: FormBuilderBackendConfig) => _btst_stack_plugins_api.BackendPlugin<{
69
- listForms: better_call.StrictEndpoint<"/forms", {
70
- method: "GET";
71
- query: z.ZodObject<{
72
- status: z.ZodOptional<z.ZodEnum<{
73
- active: "active";
74
- inactive: "inactive";
75
- archived: "archived";
76
- }>>;
77
- limit: z.ZodDefault<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
78
- offset: z.ZodDefault<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
79
- }, z.core.$strip>;
80
- }, {
81
- items: SerializedForm[];
82
- total: number;
83
- limit?: number;
84
- offset?: number;
85
- }>;
86
- getFormBySlug: better_call.StrictEndpoint<"/forms/:slug", {
87
- method: "GET";
88
- params: z.ZodObject<{
89
- slug: z.ZodString;
90
- }, z.core.$strip>;
91
- }, SerializedForm>;
92
- getFormById: better_call.StrictEndpoint<"/forms/id/:id", {
93
- method: "GET";
94
- params: z.ZodObject<{
95
- id: z.ZodString;
96
- }, z.core.$strip>;
97
- }, SerializedForm>;
98
- createForm: better_call.StrictEndpoint<"/forms", {
99
- method: "POST";
100
- body: z.ZodObject<{
101
- name: z.ZodString;
102
- slug: z.ZodString;
103
- description: z.ZodOptional<z.ZodString>;
104
- schema: z.ZodString;
105
- successMessage: z.ZodOptional<z.ZodString>;
106
- redirectUrl: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>;
107
- status: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
108
- active: "active";
109
- inactive: "inactive";
110
- archived: "archived";
111
- }>>>;
112
- }, z.core.$strip>;
113
- }, SerializedForm>;
114
- updateForm: better_call.StrictEndpoint<"/forms/:id", {
115
- method: "PUT";
116
- params: z.ZodObject<{
117
- id: z.ZodString;
118
- }, z.core.$strip>;
119
- body: z.ZodObject<{
120
- name: z.ZodOptional<z.ZodString>;
121
- slug: z.ZodOptional<z.ZodString>;
122
- description: z.ZodOptional<z.ZodString>;
123
- schema: z.ZodOptional<z.ZodString>;
124
- successMessage: z.ZodOptional<z.ZodString>;
125
- redirectUrl: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>;
126
- status: z.ZodOptional<z.ZodEnum<{
127
- active: "active";
128
- inactive: "inactive";
129
- archived: "archived";
130
- }>>;
131
- }, z.core.$strip>;
132
- }, SerializedForm>;
133
- deleteForm: better_call.StrictEndpoint<"/forms/:id", {
134
- method: "DELETE";
135
- params: z.ZodObject<{
136
- id: z.ZodString;
137
- }, z.core.$strip>;
138
- }, {
139
- success: boolean;
140
- }>;
141
- submitForm: better_call.StrictEndpoint<"/forms/:slug/submit", {
142
- method: "POST";
143
- params: z.ZodObject<{
144
- slug: z.ZodString;
145
- }, z.core.$strip>;
146
- body: z.ZodObject<{
147
- data: z.ZodObject<{}, z.core.$loose>;
148
- }, z.core.$strip>;
149
- }, {
150
- form: {
151
- successMessage: string | undefined;
152
- redirectUrl: string | undefined;
153
- };
154
- submittedAt: string;
155
- id: string;
156
- data: string;
157
- formId: string;
158
- submittedBy?: string | undefined;
159
- ipAddress?: string | undefined;
160
- userAgent?: string | undefined;
161
- }>;
162
- listSubmissions: better_call.StrictEndpoint<"/forms/:formId/submissions", {
163
- method: "GET";
164
- params: z.ZodObject<{
165
- formId: z.ZodString;
166
- }, z.core.$strip>;
167
- query: z.ZodObject<{
168
- limit: z.ZodDefault<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
169
- offset: z.ZodDefault<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
170
- }, z.core.$strip>;
171
- }, {
172
- items: SerializedFormSubmissionWithData[];
173
- total: number;
174
- limit?: number;
175
- offset?: number;
176
- }>;
177
- getSubmission: better_call.StrictEndpoint<"/forms/:formId/submissions/:subId", {
178
- method: "GET";
179
- params: z.ZodObject<{
180
- formId: z.ZodString;
181
- subId: z.ZodString;
182
- }, z.core.$strip>;
183
- }, SerializedFormSubmissionWithData<Record<string, unknown>>>;
184
- deleteSubmission: better_call.StrictEndpoint<"/forms/:formId/submissions/:subId", {
185
- method: "DELETE";
186
- params: z.ZodObject<{
187
- formId: z.ZodString;
188
- subId: z.ZodString;
189
- }, z.core.$strip>;
190
- }, {
191
- success: boolean;
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
- }>;
207
- }>;
208
- type FormBuilderApiRouter = ReturnType<ReturnType<typeof formBuilderBackendPlugin>["routes"]>;
209
-
210
- export { formBuilderBackendPlugin, getAllForms, getFormBySlug, getFormSubmissions };
211
- export type { FormBuilderApiRouter };
1
+ export { j as FORM_QUERY_KEYS, F as FormBuilderApiRouter, b as FormBuilderRouteKey, f as formBuilderBackendPlugin, g as getAllForms, c as getFormById, d as getFormBySlug, e as getFormSubmissions, s as serializeForm, h as serializeFormSubmission, i as serializeFormSubmissionWithData } from '../../../shared/stack.Dw0Ly2TM.cjs';
2
+ import '@btst/stack/plugins/api';
3
+ import 'better-call';
4
+ import '../../../shared/stack.DdI5W6MB.cjs';
5
+ import 'zod';
6
+ import '@btst/db';
7
+ import '@tanstack/react-query';
@@ -1,211 +1,7 @@
1
- import * as _btst_stack_plugins_api from '@btst/stack/plugins/api';
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';
4
- import { z } from 'zod';
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
- }>;
61
-
62
- /**
63
- * Form Builder backend plugin
64
- * Provides API endpoints for managing forms and form submissions
65
- *
66
- * @param config - Configuration with optional hooks
67
- */
68
- declare const formBuilderBackendPlugin: (config?: FormBuilderBackendConfig) => _btst_stack_plugins_api.BackendPlugin<{
69
- listForms: better_call.StrictEndpoint<"/forms", {
70
- method: "GET";
71
- query: z.ZodObject<{
72
- status: z.ZodOptional<z.ZodEnum<{
73
- active: "active";
74
- inactive: "inactive";
75
- archived: "archived";
76
- }>>;
77
- limit: z.ZodDefault<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
78
- offset: z.ZodDefault<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
79
- }, z.core.$strip>;
80
- }, {
81
- items: SerializedForm[];
82
- total: number;
83
- limit?: number;
84
- offset?: number;
85
- }>;
86
- getFormBySlug: better_call.StrictEndpoint<"/forms/:slug", {
87
- method: "GET";
88
- params: z.ZodObject<{
89
- slug: z.ZodString;
90
- }, z.core.$strip>;
91
- }, SerializedForm>;
92
- getFormById: better_call.StrictEndpoint<"/forms/id/:id", {
93
- method: "GET";
94
- params: z.ZodObject<{
95
- id: z.ZodString;
96
- }, z.core.$strip>;
97
- }, SerializedForm>;
98
- createForm: better_call.StrictEndpoint<"/forms", {
99
- method: "POST";
100
- body: z.ZodObject<{
101
- name: z.ZodString;
102
- slug: z.ZodString;
103
- description: z.ZodOptional<z.ZodString>;
104
- schema: z.ZodString;
105
- successMessage: z.ZodOptional<z.ZodString>;
106
- redirectUrl: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>;
107
- status: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
108
- active: "active";
109
- inactive: "inactive";
110
- archived: "archived";
111
- }>>>;
112
- }, z.core.$strip>;
113
- }, SerializedForm>;
114
- updateForm: better_call.StrictEndpoint<"/forms/:id", {
115
- method: "PUT";
116
- params: z.ZodObject<{
117
- id: z.ZodString;
118
- }, z.core.$strip>;
119
- body: z.ZodObject<{
120
- name: z.ZodOptional<z.ZodString>;
121
- slug: z.ZodOptional<z.ZodString>;
122
- description: z.ZodOptional<z.ZodString>;
123
- schema: z.ZodOptional<z.ZodString>;
124
- successMessage: z.ZodOptional<z.ZodString>;
125
- redirectUrl: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>;
126
- status: z.ZodOptional<z.ZodEnum<{
127
- active: "active";
128
- inactive: "inactive";
129
- archived: "archived";
130
- }>>;
131
- }, z.core.$strip>;
132
- }, SerializedForm>;
133
- deleteForm: better_call.StrictEndpoint<"/forms/:id", {
134
- method: "DELETE";
135
- params: z.ZodObject<{
136
- id: z.ZodString;
137
- }, z.core.$strip>;
138
- }, {
139
- success: boolean;
140
- }>;
141
- submitForm: better_call.StrictEndpoint<"/forms/:slug/submit", {
142
- method: "POST";
143
- params: z.ZodObject<{
144
- slug: z.ZodString;
145
- }, z.core.$strip>;
146
- body: z.ZodObject<{
147
- data: z.ZodObject<{}, z.core.$loose>;
148
- }, z.core.$strip>;
149
- }, {
150
- form: {
151
- successMessage: string | undefined;
152
- redirectUrl: string | undefined;
153
- };
154
- submittedAt: string;
155
- id: string;
156
- data: string;
157
- formId: string;
158
- submittedBy?: string | undefined;
159
- ipAddress?: string | undefined;
160
- userAgent?: string | undefined;
161
- }>;
162
- listSubmissions: better_call.StrictEndpoint<"/forms/:formId/submissions", {
163
- method: "GET";
164
- params: z.ZodObject<{
165
- formId: z.ZodString;
166
- }, z.core.$strip>;
167
- query: z.ZodObject<{
168
- limit: z.ZodDefault<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
169
- offset: z.ZodDefault<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
170
- }, z.core.$strip>;
171
- }, {
172
- items: SerializedFormSubmissionWithData[];
173
- total: number;
174
- limit?: number;
175
- offset?: number;
176
- }>;
177
- getSubmission: better_call.StrictEndpoint<"/forms/:formId/submissions/:subId", {
178
- method: "GET";
179
- params: z.ZodObject<{
180
- formId: z.ZodString;
181
- subId: z.ZodString;
182
- }, z.core.$strip>;
183
- }, SerializedFormSubmissionWithData<Record<string, unknown>>>;
184
- deleteSubmission: better_call.StrictEndpoint<"/forms/:formId/submissions/:subId", {
185
- method: "DELETE";
186
- params: z.ZodObject<{
187
- formId: z.ZodString;
188
- subId: z.ZodString;
189
- }, z.core.$strip>;
190
- }, {
191
- success: boolean;
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
- }>;
207
- }>;
208
- type FormBuilderApiRouter = ReturnType<ReturnType<typeof formBuilderBackendPlugin>["routes"]>;
209
-
210
- export { formBuilderBackendPlugin, getAllForms, getFormBySlug, getFormSubmissions };
211
- export type { FormBuilderApiRouter };
1
+ export { j as FORM_QUERY_KEYS, F as FormBuilderApiRouter, b as FormBuilderRouteKey, f as formBuilderBackendPlugin, g as getAllForms, c as getFormById, d as getFormBySlug, e as getFormSubmissions, s as serializeForm, h as serializeFormSubmission, i as serializeFormSubmissionWithData } from '../../../shared/stack.C5dtIncc.mjs';
2
+ import '@btst/stack/plugins/api';
3
+ import 'better-call';
4
+ import '../../../shared/stack.DdI5W6MB.mjs';
5
+ import 'zod';
6
+ import '@btst/db';
7
+ import '@tanstack/react-query';