@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,219 +1,7 @@
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.cjs';
3
- import * as better_call from 'better-call';
4
- import { z } from 'zod';
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>;
52
-
53
- /**
54
- * CMS backend plugin
55
- * Provides API endpoints for managing content types and content items
56
- *
57
- * @param config - Configuration with content types and optional hooks
58
- */
59
- declare const cmsBackendPlugin: (config: CMSBackendConfig) => _btst_stack_plugins_api.BackendPlugin<{
60
- listContentTypes: better_call.StrictEndpoint<"/content-types", {
61
- method: "GET";
62
- }, {
63
- itemCount: number;
64
- createdAt: string;
65
- updatedAt: string;
66
- name: string;
67
- id: string;
68
- slug: string;
69
- description?: string | undefined;
70
- jsonSchema: string;
71
- fieldConfig?: string | undefined;
72
- autoFormVersion?: number | undefined;
73
- }[]>;
74
- getContentTypeBySlug: better_call.StrictEndpoint<"/content-types/:slug", {
75
- method: "GET";
76
- params: z.ZodObject<{
77
- slug: z.ZodString;
78
- }, z.core.$strip>;
79
- }, SerializedContentType>;
80
- listContentItems: better_call.StrictEndpoint<"/content/:typeSlug", {
81
- method: "GET";
82
- params: z.ZodObject<{
83
- typeSlug: z.ZodString;
84
- }, z.core.$strip>;
85
- query: z.ZodObject<{
86
- slug: z.ZodOptional<z.ZodString>;
87
- limit: z.ZodDefault<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
88
- offset: z.ZodDefault<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
89
- }, z.core.$strip>;
90
- }, {
91
- items: SerializedContentItemWithType[];
92
- total: number;
93
- limit?: number;
94
- offset?: number;
95
- }>;
96
- getContentItem: better_call.StrictEndpoint<"/content/:typeSlug/:id", {
97
- method: "GET";
98
- params: z.ZodObject<{
99
- typeSlug: z.ZodString;
100
- id: z.ZodString;
101
- }, z.core.$strip>;
102
- }, SerializedContentItemWithType<Record<string, unknown>>>;
103
- createContentItem: better_call.StrictEndpoint<"/content/:typeSlug", {
104
- method: "POST";
105
- params: z.ZodObject<{
106
- typeSlug: z.ZodString;
107
- }, z.core.$strip>;
108
- body: z.ZodObject<{
109
- slug: z.ZodString;
110
- data: z.ZodObject<{}, z.core.$loose>;
111
- }, z.core.$strip>;
112
- }, {
113
- parsedData: Record<string, unknown>;
114
- createdAt: string;
115
- updatedAt: string;
116
- id: string;
117
- slug: string;
118
- contentTypeId: string;
119
- data: string;
120
- authorId?: string | undefined;
121
- }>;
122
- updateContentItem: better_call.StrictEndpoint<"/content/:typeSlug/:id", {
123
- method: "PUT";
124
- params: z.ZodObject<{
125
- typeSlug: z.ZodString;
126
- id: z.ZodString;
127
- }, z.core.$strip>;
128
- body: z.ZodObject<{
129
- slug: z.ZodOptional<z.ZodString>;
130
- data: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
131
- }, z.core.$strip>;
132
- }, SerializedContentItemWithType<Record<string, unknown>>>;
133
- deleteContentItem: better_call.StrictEndpoint<"/content/:typeSlug/:id", {
134
- method: "DELETE";
135
- params: z.ZodObject<{
136
- typeSlug: z.ZodString;
137
- id: z.ZodString;
138
- }, z.core.$strip>;
139
- }, {
140
- success: boolean;
141
- }>;
142
- getContentItemPopulated: better_call.StrictEndpoint<"/content/:typeSlug/:id/populated", {
143
- method: "GET";
144
- params: z.ZodObject<{
145
- typeSlug: z.ZodString;
146
- id: z.ZodString;
147
- }, z.core.$strip>;
148
- }, {
149
- _relations: Record<string, SerializedContentItemWithType<Record<string, unknown>>[]>;
150
- parsedData: Record<string, unknown>;
151
- contentType?: SerializedContentType;
152
- createdAt: string;
153
- updatedAt: string;
154
- id: string;
155
- slug: string;
156
- contentTypeId: string;
157
- data: string;
158
- authorId?: string | undefined;
159
- }>;
160
- listContentByRelation: better_call.StrictEndpoint<"/content/:typeSlug/by-relation", {
161
- method: "GET";
162
- params: z.ZodObject<{
163
- typeSlug: z.ZodString;
164
- }, z.core.$strip>;
165
- query: z.ZodObject<{
166
- field: z.ZodString;
167
- targetId: z.ZodString;
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: SerializedContentItemWithType<Record<string, unknown>>[];
173
- total: number;
174
- limit: number;
175
- offset: number;
176
- }>;
177
- getInverseRelations: better_call.StrictEndpoint<"/content-types/:slug/inverse-relations", {
178
- method: "GET";
179
- params: z.ZodObject<{
180
- slug: z.ZodString;
181
- }, z.core.$strip>;
182
- query: z.ZodObject<{
183
- itemId: z.ZodOptional<z.ZodString>;
184
- }, z.core.$strip>;
185
- }, {
186
- inverseRelations: InverseRelation[];
187
- }>;
188
- listInverseRelationItems: better_call.StrictEndpoint<"/content-types/:slug/inverse-relations/:sourceType", {
189
- method: "GET";
190
- params: z.ZodObject<{
191
- slug: z.ZodString;
192
- sourceType: z.ZodString;
193
- }, z.core.$strip>;
194
- query: z.ZodObject<{
195
- itemId: z.ZodString;
196
- fieldName: z.ZodString;
197
- limit: z.ZodDefault<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
198
- offset: z.ZodDefault<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
199
- }, z.core.$strip>;
200
- }, {
201
- items: SerializedContentItemWithType<Record<string, unknown>>[];
202
- total: number;
203
- limit: number;
204
- offset: number;
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>;
215
- }>;
216
- type CMSApiRouter = ReturnType<ReturnType<typeof cmsBackendPlugin>["routes"]>;
217
-
218
- export { cmsBackendPlugin, getAllContentItems, getAllContentTypes, getContentItemBySlug };
219
- export type { CMSApiRouter };
1
+ export { C as CMSApiRouter, b as CMSRouteKey, j as CMS_QUERY_KEYS, c as cmsBackendPlugin, d as getAllContentItems, g as getAllContentTypes, f as getContentItemById, e as getContentItemBySlug, h as serializeContentItem, i as serializeContentItemWithType, s as serializeContentType } from '../../../shared/stack.IdtKDRka.cjs';
2
+ import '@btst/stack/plugins/api';
3
+ import '../../../shared/stack.CVDTkMoO.cjs';
4
+ import 'zod';
5
+ import 'better-call';
6
+ import '@btst/db';
7
+ import '@tanstack/react-query';
@@ -1,219 +1,7 @@
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';
3
- import * as better_call from 'better-call';
4
- import { z } from 'zod';
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>;
52
-
53
- /**
54
- * CMS backend plugin
55
- * Provides API endpoints for managing content types and content items
56
- *
57
- * @param config - Configuration with content types and optional hooks
58
- */
59
- declare const cmsBackendPlugin: (config: CMSBackendConfig) => _btst_stack_plugins_api.BackendPlugin<{
60
- listContentTypes: better_call.StrictEndpoint<"/content-types", {
61
- method: "GET";
62
- }, {
63
- itemCount: number;
64
- createdAt: string;
65
- updatedAt: string;
66
- name: string;
67
- id: string;
68
- slug: string;
69
- description?: string | undefined;
70
- jsonSchema: string;
71
- fieldConfig?: string | undefined;
72
- autoFormVersion?: number | undefined;
73
- }[]>;
74
- getContentTypeBySlug: better_call.StrictEndpoint<"/content-types/:slug", {
75
- method: "GET";
76
- params: z.ZodObject<{
77
- slug: z.ZodString;
78
- }, z.core.$strip>;
79
- }, SerializedContentType>;
80
- listContentItems: better_call.StrictEndpoint<"/content/:typeSlug", {
81
- method: "GET";
82
- params: z.ZodObject<{
83
- typeSlug: z.ZodString;
84
- }, z.core.$strip>;
85
- query: z.ZodObject<{
86
- slug: z.ZodOptional<z.ZodString>;
87
- limit: z.ZodDefault<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
88
- offset: z.ZodDefault<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
89
- }, z.core.$strip>;
90
- }, {
91
- items: SerializedContentItemWithType[];
92
- total: number;
93
- limit?: number;
94
- offset?: number;
95
- }>;
96
- getContentItem: better_call.StrictEndpoint<"/content/:typeSlug/:id", {
97
- method: "GET";
98
- params: z.ZodObject<{
99
- typeSlug: z.ZodString;
100
- id: z.ZodString;
101
- }, z.core.$strip>;
102
- }, SerializedContentItemWithType<Record<string, unknown>>>;
103
- createContentItem: better_call.StrictEndpoint<"/content/:typeSlug", {
104
- method: "POST";
105
- params: z.ZodObject<{
106
- typeSlug: z.ZodString;
107
- }, z.core.$strip>;
108
- body: z.ZodObject<{
109
- slug: z.ZodString;
110
- data: z.ZodObject<{}, z.core.$loose>;
111
- }, z.core.$strip>;
112
- }, {
113
- parsedData: Record<string, unknown>;
114
- createdAt: string;
115
- updatedAt: string;
116
- id: string;
117
- slug: string;
118
- contentTypeId: string;
119
- data: string;
120
- authorId?: string | undefined;
121
- }>;
122
- updateContentItem: better_call.StrictEndpoint<"/content/:typeSlug/:id", {
123
- method: "PUT";
124
- params: z.ZodObject<{
125
- typeSlug: z.ZodString;
126
- id: z.ZodString;
127
- }, z.core.$strip>;
128
- body: z.ZodObject<{
129
- slug: z.ZodOptional<z.ZodString>;
130
- data: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
131
- }, z.core.$strip>;
132
- }, SerializedContentItemWithType<Record<string, unknown>>>;
133
- deleteContentItem: better_call.StrictEndpoint<"/content/:typeSlug/:id", {
134
- method: "DELETE";
135
- params: z.ZodObject<{
136
- typeSlug: z.ZodString;
137
- id: z.ZodString;
138
- }, z.core.$strip>;
139
- }, {
140
- success: boolean;
141
- }>;
142
- getContentItemPopulated: better_call.StrictEndpoint<"/content/:typeSlug/:id/populated", {
143
- method: "GET";
144
- params: z.ZodObject<{
145
- typeSlug: z.ZodString;
146
- id: z.ZodString;
147
- }, z.core.$strip>;
148
- }, {
149
- _relations: Record<string, SerializedContentItemWithType<Record<string, unknown>>[]>;
150
- parsedData: Record<string, unknown>;
151
- contentType?: SerializedContentType;
152
- createdAt: string;
153
- updatedAt: string;
154
- id: string;
155
- slug: string;
156
- contentTypeId: string;
157
- data: string;
158
- authorId?: string | undefined;
159
- }>;
160
- listContentByRelation: better_call.StrictEndpoint<"/content/:typeSlug/by-relation", {
161
- method: "GET";
162
- params: z.ZodObject<{
163
- typeSlug: z.ZodString;
164
- }, z.core.$strip>;
165
- query: z.ZodObject<{
166
- field: z.ZodString;
167
- targetId: z.ZodString;
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: SerializedContentItemWithType<Record<string, unknown>>[];
173
- total: number;
174
- limit: number;
175
- offset: number;
176
- }>;
177
- getInverseRelations: better_call.StrictEndpoint<"/content-types/:slug/inverse-relations", {
178
- method: "GET";
179
- params: z.ZodObject<{
180
- slug: z.ZodString;
181
- }, z.core.$strip>;
182
- query: z.ZodObject<{
183
- itemId: z.ZodOptional<z.ZodString>;
184
- }, z.core.$strip>;
185
- }, {
186
- inverseRelations: InverseRelation[];
187
- }>;
188
- listInverseRelationItems: better_call.StrictEndpoint<"/content-types/:slug/inverse-relations/:sourceType", {
189
- method: "GET";
190
- params: z.ZodObject<{
191
- slug: z.ZodString;
192
- sourceType: z.ZodString;
193
- }, z.core.$strip>;
194
- query: z.ZodObject<{
195
- itemId: z.ZodString;
196
- fieldName: z.ZodString;
197
- limit: z.ZodDefault<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
198
- offset: z.ZodDefault<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
199
- }, z.core.$strip>;
200
- }, {
201
- items: SerializedContentItemWithType<Record<string, unknown>>[];
202
- total: number;
203
- limit: number;
204
- offset: number;
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>;
215
- }>;
216
- type CMSApiRouter = ReturnType<ReturnType<typeof cmsBackendPlugin>["routes"]>;
217
-
218
- export { cmsBackendPlugin, getAllContentItems, getAllContentTypes, getContentItemBySlug };
219
- export type { CMSApiRouter };
1
+ export { C as CMSApiRouter, b as CMSRouteKey, j as CMS_QUERY_KEYS, c as cmsBackendPlugin, d as getAllContentItems, g as getAllContentTypes, f as getContentItemById, e as getContentItemBySlug, h as serializeContentItem, i as serializeContentItemWithType, s as serializeContentType } from '../../../shared/stack.CP68pFEH.mjs';
2
+ import '@btst/stack/plugins/api';
3
+ import '../../../shared/stack.CVDTkMoO.mjs';
4
+ import 'zod';
5
+ import 'better-call';
6
+ import '@btst/db';
7
+ import '@tanstack/react-query';
@@ -1,219 +1,7 @@
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';
3
- import * as better_call from 'better-call';
4
- import { z } from 'zod';
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>;
52
-
53
- /**
54
- * CMS backend plugin
55
- * Provides API endpoints for managing content types and content items
56
- *
57
- * @param config - Configuration with content types and optional hooks
58
- */
59
- declare const cmsBackendPlugin: (config: CMSBackendConfig) => _btst_stack_plugins_api.BackendPlugin<{
60
- listContentTypes: better_call.StrictEndpoint<"/content-types", {
61
- method: "GET";
62
- }, {
63
- itemCount: number;
64
- createdAt: string;
65
- updatedAt: string;
66
- name: string;
67
- id: string;
68
- slug: string;
69
- description?: string | undefined;
70
- jsonSchema: string;
71
- fieldConfig?: string | undefined;
72
- autoFormVersion?: number | undefined;
73
- }[]>;
74
- getContentTypeBySlug: better_call.StrictEndpoint<"/content-types/:slug", {
75
- method: "GET";
76
- params: z.ZodObject<{
77
- slug: z.ZodString;
78
- }, z.core.$strip>;
79
- }, SerializedContentType>;
80
- listContentItems: better_call.StrictEndpoint<"/content/:typeSlug", {
81
- method: "GET";
82
- params: z.ZodObject<{
83
- typeSlug: z.ZodString;
84
- }, z.core.$strip>;
85
- query: z.ZodObject<{
86
- slug: z.ZodOptional<z.ZodString>;
87
- limit: z.ZodDefault<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
88
- offset: z.ZodDefault<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
89
- }, z.core.$strip>;
90
- }, {
91
- items: SerializedContentItemWithType[];
92
- total: number;
93
- limit?: number;
94
- offset?: number;
95
- }>;
96
- getContentItem: better_call.StrictEndpoint<"/content/:typeSlug/:id", {
97
- method: "GET";
98
- params: z.ZodObject<{
99
- typeSlug: z.ZodString;
100
- id: z.ZodString;
101
- }, z.core.$strip>;
102
- }, SerializedContentItemWithType<Record<string, unknown>>>;
103
- createContentItem: better_call.StrictEndpoint<"/content/:typeSlug", {
104
- method: "POST";
105
- params: z.ZodObject<{
106
- typeSlug: z.ZodString;
107
- }, z.core.$strip>;
108
- body: z.ZodObject<{
109
- slug: z.ZodString;
110
- data: z.ZodObject<{}, z.core.$loose>;
111
- }, z.core.$strip>;
112
- }, {
113
- parsedData: Record<string, unknown>;
114
- createdAt: string;
115
- updatedAt: string;
116
- id: string;
117
- slug: string;
118
- contentTypeId: string;
119
- data: string;
120
- authorId?: string | undefined;
121
- }>;
122
- updateContentItem: better_call.StrictEndpoint<"/content/:typeSlug/:id", {
123
- method: "PUT";
124
- params: z.ZodObject<{
125
- typeSlug: z.ZodString;
126
- id: z.ZodString;
127
- }, z.core.$strip>;
128
- body: z.ZodObject<{
129
- slug: z.ZodOptional<z.ZodString>;
130
- data: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
131
- }, z.core.$strip>;
132
- }, SerializedContentItemWithType<Record<string, unknown>>>;
133
- deleteContentItem: better_call.StrictEndpoint<"/content/:typeSlug/:id", {
134
- method: "DELETE";
135
- params: z.ZodObject<{
136
- typeSlug: z.ZodString;
137
- id: z.ZodString;
138
- }, z.core.$strip>;
139
- }, {
140
- success: boolean;
141
- }>;
142
- getContentItemPopulated: better_call.StrictEndpoint<"/content/:typeSlug/:id/populated", {
143
- method: "GET";
144
- params: z.ZodObject<{
145
- typeSlug: z.ZodString;
146
- id: z.ZodString;
147
- }, z.core.$strip>;
148
- }, {
149
- _relations: Record<string, SerializedContentItemWithType<Record<string, unknown>>[]>;
150
- parsedData: Record<string, unknown>;
151
- contentType?: SerializedContentType;
152
- createdAt: string;
153
- updatedAt: string;
154
- id: string;
155
- slug: string;
156
- contentTypeId: string;
157
- data: string;
158
- authorId?: string | undefined;
159
- }>;
160
- listContentByRelation: better_call.StrictEndpoint<"/content/:typeSlug/by-relation", {
161
- method: "GET";
162
- params: z.ZodObject<{
163
- typeSlug: z.ZodString;
164
- }, z.core.$strip>;
165
- query: z.ZodObject<{
166
- field: z.ZodString;
167
- targetId: z.ZodString;
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: SerializedContentItemWithType<Record<string, unknown>>[];
173
- total: number;
174
- limit: number;
175
- offset: number;
176
- }>;
177
- getInverseRelations: better_call.StrictEndpoint<"/content-types/:slug/inverse-relations", {
178
- method: "GET";
179
- params: z.ZodObject<{
180
- slug: z.ZodString;
181
- }, z.core.$strip>;
182
- query: z.ZodObject<{
183
- itemId: z.ZodOptional<z.ZodString>;
184
- }, z.core.$strip>;
185
- }, {
186
- inverseRelations: InverseRelation[];
187
- }>;
188
- listInverseRelationItems: better_call.StrictEndpoint<"/content-types/:slug/inverse-relations/:sourceType", {
189
- method: "GET";
190
- params: z.ZodObject<{
191
- slug: z.ZodString;
192
- sourceType: z.ZodString;
193
- }, z.core.$strip>;
194
- query: z.ZodObject<{
195
- itemId: z.ZodString;
196
- fieldName: z.ZodString;
197
- limit: z.ZodDefault<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
198
- offset: z.ZodDefault<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
199
- }, z.core.$strip>;
200
- }, {
201
- items: SerializedContentItemWithType<Record<string, unknown>>[];
202
- total: number;
203
- limit: number;
204
- offset: number;
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>;
215
- }>;
216
- type CMSApiRouter = ReturnType<ReturnType<typeof cmsBackendPlugin>["routes"]>;
217
-
218
- export { cmsBackendPlugin, getAllContentItems, getAllContentTypes, getContentItemBySlug };
219
- export type { CMSApiRouter };
1
+ export { C as CMSApiRouter, b as CMSRouteKey, j as CMS_QUERY_KEYS, c as cmsBackendPlugin, d as getAllContentItems, g as getAllContentTypes, f as getContentItemById, e as getContentItemBySlug, h as serializeContentItem, i as serializeContentItemWithType, s as serializeContentType } from '../../../shared/stack.B1EeBt1b.js';
2
+ import '@btst/stack/plugins/api';
3
+ import '../../../shared/stack.CVDTkMoO.js';
4
+ import 'zod';
5
+ import 'better-call';
6
+ import '@btst/db';
7
+ import '@tanstack/react-query';
@@ -1,2 +1,3 @@
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';
2
+ export { getAllContentItems, getAllContentTypes, getContentItemById, getContentItemBySlug, serializeContentItem, serializeContentItemWithType, serializeContentType } from '../../../packages/stack/src/plugins/cms/api/getters.mjs';
3
+ export { CMS_QUERY_KEYS } from '../../../packages/stack/src/plugins/cms/api/query-key-defs.mjs';