@btst/plugin-cms 0.0.0-stage → 1.0.0-beta.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 (204) hide show
  1. package/LICENSE.md +17 -0
  2. package/dist/api/getters.cjs +328 -0
  3. package/dist/api/getters.mjs +314 -0
  4. package/dist/api/index.cjs +29 -0
  5. package/dist/api/index.d.cts +209 -0
  6. package/dist/api/index.d.mts +209 -0
  7. package/dist/api/index.d.ts +209 -0
  8. package/dist/api/index.mjs +7 -0
  9. package/dist/api/lifecycle-migrations.cjs +13 -0
  10. package/dist/api/lifecycle-migrations.mjs +11 -0
  11. package/dist/api/mutations.cjs +59 -0
  12. package/dist/api/mutations.mjs +57 -0
  13. package/dist/api/operations.cjs +1769 -0
  14. package/dist/api/operations.mjs +1762 -0
  15. package/dist/api/plugin.cjs +337 -0
  16. package/dist/api/plugin.mjs +331 -0
  17. package/dist/api/query-key-defs.cjs +44 -0
  18. package/dist/api/query-key-defs.mjs +39 -0
  19. package/dist/api/relations.cjs +76 -0
  20. package/dist/api/relations.mjs +70 -0
  21. package/dist/client/components/forms/content-form.cjs +286 -0
  22. package/dist/client/components/forms/content-form.mjs +284 -0
  23. package/dist/client/components/forms/file-upload.cjs +160 -0
  24. package/dist/client/components/forms/file-upload.mjs +158 -0
  25. package/dist/client/components/forms/relation-field.cjs +237 -0
  26. package/dist/client/components/forms/relation-field.mjs +235 -0
  27. package/dist/client/components/index.cjs +14 -0
  28. package/dist/client/components/index.d.cts +20 -0
  29. package/dist/client/components/index.d.mts +20 -0
  30. package/dist/client/components/index.d.ts +20 -0
  31. package/dist/client/components/index.mjs +10 -0
  32. package/dist/client/components/inverse-relations-panel.cjs +272 -0
  33. package/dist/client/components/inverse-relations-panel.mjs +270 -0
  34. package/dist/client/components/loading/dashboard-skeleton.cjs +18 -0
  35. package/dist/client/components/loading/dashboard-skeleton.mjs +16 -0
  36. package/dist/client/components/loading/editor-skeleton.cjs +32 -0
  37. package/dist/client/components/loading/editor-skeleton.mjs +30 -0
  38. package/dist/client/components/loading/list-skeleton.cjs +32 -0
  39. package/dist/client/components/loading/list-skeleton.mjs +30 -0
  40. package/dist/client/components/pages/404-page.cjs +26 -0
  41. package/dist/client/components/pages/404-page.mjs +24 -0
  42. package/dist/client/components/pages/content-editor-page.cjs +84 -0
  43. package/dist/client/components/pages/content-editor-page.internal.cjs +170 -0
  44. package/dist/client/components/pages/content-editor-page.internal.mjs +168 -0
  45. package/dist/client/components/pages/content-editor-page.mjs +82 -0
  46. package/dist/client/components/pages/content-list-page.cjs +49 -0
  47. package/dist/client/components/pages/content-list-page.internal.cjs +334 -0
  48. package/dist/client/components/pages/content-list-page.internal.mjs +332 -0
  49. package/dist/client/components/pages/content-list-page.mjs +47 -0
  50. package/dist/client/components/pages/dashboard-page.cjs +42 -0
  51. package/dist/client/components/pages/dashboard-page.internal.cjs +102 -0
  52. package/dist/client/components/pages/dashboard-page.internal.mjs +100 -0
  53. package/dist/client/components/pages/dashboard-page.mjs +40 -0
  54. package/dist/client/components/shared/default-error.cjs +17 -0
  55. package/dist/client/components/shared/default-error.mjs +15 -0
  56. package/dist/client/components/shared/empty-state.cjs +16 -0
  57. package/dist/client/components/shared/empty-state.mjs +14 -0
  58. package/dist/client/components/shared/page-wrapper.cjs +29 -0
  59. package/dist/client/components/shared/page-wrapper.mjs +27 -0
  60. package/dist/client/constants.cjs +5 -0
  61. package/dist/client/constants.mjs +3 -0
  62. package/dist/client/hooks/cms-hooks.cjs +300 -0
  63. package/dist/client/hooks/cms-hooks.mjs +280 -0
  64. package/dist/client/hooks/cms-resource.cjs +13 -0
  65. package/dist/client/hooks/cms-resource.mjs +11 -0
  66. package/dist/client/hooks/index.cjs +25 -0
  67. package/dist/client/hooks/index.d.cts +693 -0
  68. package/dist/client/hooks/index.d.mts +693 -0
  69. package/dist/client/hooks/index.d.ts +693 -0
  70. package/dist/client/hooks/index.mjs +1 -0
  71. package/dist/client/index.cjs +15 -0
  72. package/dist/client/index.d.cts +654 -0
  73. package/dist/client/index.d.mts +654 -0
  74. package/dist/client/index.d.ts +654 -0
  75. package/dist/client/index.mjs +3 -0
  76. package/dist/client/overrides.cjs +26 -0
  77. package/dist/client/overrides.mjs +24 -0
  78. package/dist/client/plugin.cjs +316 -0
  79. package/dist/client/plugin.mjs +314 -0
  80. package/dist/client.css +3 -0
  81. package/dist/db.cjs +118 -0
  82. package/dist/db.mjs +116 -0
  83. package/dist/permissions.cjs +46 -0
  84. package/dist/permissions.d.cts +42 -0
  85. package/dist/permissions.d.mts +42 -0
  86. package/dist/permissions.d.ts +42 -0
  87. package/dist/permissions.mjs +44 -0
  88. package/dist/query-keys.cjs +229 -0
  89. package/dist/query-keys.d.cts +8 -0
  90. package/dist/query-keys.d.mts +8 -0
  91. package/dist/query-keys.d.ts +8 -0
  92. package/dist/query-keys.mjs +225 -0
  93. package/dist/schemas.cjs +81 -0
  94. package/dist/schemas.mjs +72 -0
  95. package/dist/shared/plugin-cms.BBshPRkb.d.cts +6 -0
  96. package/dist/shared/plugin-cms.BBshPRkb.d.mts +6 -0
  97. package/dist/shared/plugin-cms.BBshPRkb.d.ts +6 -0
  98. package/dist/shared/plugin-cms.Bptwe33B.d.cts +1749 -0
  99. package/dist/shared/plugin-cms.Csx7tNDO.d.mts +1749 -0
  100. package/dist/shared/plugin-cms.eNW9_FO5.d.ts +1749 -0
  101. package/dist/style.css +6 -0
  102. package/dist/types.cjs +2 -0
  103. package/dist/types.d.cts +406 -0
  104. package/dist/types.d.mts +406 -0
  105. package/dist/types.d.ts +406 -0
  106. package/dist/types.mjs +1 -0
  107. package/dist/ui/src/components/accordion.cjs +81 -0
  108. package/dist/ui/src/components/accordion.mjs +62 -0
  109. package/dist/ui/src/components/alert-dialog.cjs +157 -0
  110. package/dist/ui/src/components/alert-dialog.mjs +132 -0
  111. package/dist/ui/src/components/auto-form/common/label.cjs +18 -0
  112. package/dist/ui/src/components/auto-form/common/label.mjs +16 -0
  113. package/dist/ui/src/components/auto-form/common/tooltip.cjs +9 -0
  114. package/dist/ui/src/components/auto-form/common/tooltip.mjs +7 -0
  115. package/dist/ui/src/components/auto-form/config.cjs +40 -0
  116. package/dist/ui/src/components/auto-form/config.mjs +37 -0
  117. package/dist/ui/src/components/auto-form/dependencies.cjs +48 -0
  118. package/dist/ui/src/components/auto-form/dependencies.mjs +46 -0
  119. package/dist/ui/src/components/auto-form/fields/array.cjs +266 -0
  120. package/dist/ui/src/components/auto-form/fields/array.mjs +264 -0
  121. package/dist/ui/src/components/auto-form/fields/checkbox.cjs +38 -0
  122. package/dist/ui/src/components/auto-form/fields/checkbox.mjs +36 -0
  123. package/dist/ui/src/components/auto-form/fields/date.cjs +67 -0
  124. package/dist/ui/src/components/auto-form/fields/date.mjs +65 -0
  125. package/dist/ui/src/components/auto-form/fields/enum.cjs +73 -0
  126. package/dist/ui/src/components/auto-form/fields/enum.mjs +71 -0
  127. package/dist/ui/src/components/auto-form/fields/input.cjs +32 -0
  128. package/dist/ui/src/components/auto-form/fields/input.mjs +30 -0
  129. package/dist/ui/src/components/auto-form/fields/number.cjs +31 -0
  130. package/dist/ui/src/components/auto-form/fields/number.mjs +29 -0
  131. package/dist/ui/src/components/auto-form/fields/object.cjs +233 -0
  132. package/dist/ui/src/components/auto-form/fields/object.mjs +217 -0
  133. package/dist/ui/src/components/auto-form/fields/radio-group.cjs +67 -0
  134. package/dist/ui/src/components/auto-form/fields/radio-group.mjs +65 -0
  135. package/dist/ui/src/components/auto-form/fields/switch.cjs +38 -0
  136. package/dist/ui/src/components/auto-form/fields/switch.mjs +36 -0
  137. package/dist/ui/src/components/auto-form/fields/textarea.cjs +31 -0
  138. package/dist/ui/src/components/auto-form/fields/textarea.mjs +29 -0
  139. package/dist/ui/src/components/auto-form/helpers.cjs +270 -0
  140. package/dist/ui/src/components/auto-form/helpers.mjs +259 -0
  141. package/dist/ui/src/components/auto-form/index.cjs +92 -0
  142. package/dist/ui/src/components/auto-form/index.mjs +86 -0
  143. package/dist/ui/src/components/auto-form/stepped-auto-form.cjs +374 -0
  144. package/dist/ui/src/components/auto-form/stepped-auto-form.mjs +368 -0
  145. package/dist/ui/src/components/auto-form/types.cjs +11 -0
  146. package/dist/ui/src/components/auto-form/types.mjs +9 -0
  147. package/dist/ui/src/components/badge.cjs +42 -0
  148. package/dist/ui/src/components/badge.mjs +39 -0
  149. package/dist/ui/src/components/button.cjs +56 -0
  150. package/dist/ui/src/components/button.mjs +53 -0
  151. package/dist/ui/src/components/calendar.cjs +207 -0
  152. package/dist/ui/src/components/calendar.mjs +190 -0
  153. package/dist/ui/src/components/card.cjs +56 -0
  154. package/dist/ui/src/components/card.mjs +51 -0
  155. package/dist/ui/src/components/checkbox.cjs +48 -0
  156. package/dist/ui/src/components/checkbox.mjs +32 -0
  157. package/dist/ui/src/components/command.cjs +78 -0
  158. package/dist/ui/src/components/command.mjs +73 -0
  159. package/dist/ui/src/components/date-picker.cjs +41 -0
  160. package/dist/ui/src/components/date-picker.mjs +39 -0
  161. package/dist/ui/src/components/dialog.cjs +119 -0
  162. package/dist/ui/src/components/dialog.mjs +97 -0
  163. package/dist/ui/src/components/form.cjs +120 -0
  164. package/dist/ui/src/components/form.mjs +98 -0
  165. package/dist/ui/src/components/input.cjs +23 -0
  166. package/dist/ui/src/components/input.mjs +21 -0
  167. package/dist/ui/src/components/label.cjs +39 -0
  168. package/dist/ui/src/components/label.mjs +23 -0
  169. package/dist/ui/src/components/multi-select.cjs +555 -0
  170. package/dist/ui/src/components/multi-select.mjs +540 -0
  171. package/dist/ui/src/components/page-layout.cjs +25 -0
  172. package/dist/ui/src/components/page-layout.mjs +23 -0
  173. package/dist/ui/src/components/page-wrapper.cjs +20 -0
  174. package/dist/ui/src/components/page-wrapper.mjs +18 -0
  175. package/dist/ui/src/components/popover.cjs +60 -0
  176. package/dist/ui/src/components/popover.mjs +42 -0
  177. package/dist/ui/src/components/radio-group.cjs +62 -0
  178. package/dist/ui/src/components/radio-group.mjs +45 -0
  179. package/dist/ui/src/components/select.cjs +161 -0
  180. package/dist/ui/src/components/select.mjs +139 -0
  181. package/dist/ui/src/components/separator.cjs +43 -0
  182. package/dist/ui/src/components/separator.mjs +27 -0
  183. package/dist/ui/src/components/skeleton.cjs +17 -0
  184. package/dist/ui/src/components/skeleton.mjs +15 -0
  185. package/dist/ui/src/components/stack-attribution.cjs +24 -0
  186. package/dist/ui/src/components/stack-attribution.mjs +22 -0
  187. package/dist/ui/src/components/switch.cjs +48 -0
  188. package/dist/ui/src/components/switch.mjs +32 -0
  189. package/dist/ui/src/components/table.cjs +89 -0
  190. package/dist/ui/src/components/table.mjs +82 -0
  191. package/dist/ui/src/components/textarea.cjs +20 -0
  192. package/dist/ui/src/components/textarea.mjs +18 -0
  193. package/dist/ui/src/hooks/use-debounce.cjs +16 -0
  194. package/dist/ui/src/hooks/use-debounce.mjs +14 -0
  195. package/dist/ui/src/hooks/use-route-lifecycle.cjs +31 -0
  196. package/dist/ui/src/hooks/use-route-lifecycle.mjs +29 -0
  197. package/dist/ui/src/lib/schema-converter.cjs +133 -0
  198. package/dist/ui/src/lib/schema-converter.mjs +127 -0
  199. package/dist/ui/src/lib/utils.cjs +10 -0
  200. package/dist/ui/src/lib/utils.mjs +8 -0
  201. package/dist/utils.cjs +19 -0
  202. package/dist/utils.mjs +12 -0
  203. package/package.json +170 -3
  204. package/README.md +0 -3
@@ -0,0 +1,209 @@
1
+ export { C as CMSApiRouter, a as CMSRouteKey, b as CMS_QUERY_KEYS, c as cmsBackendPlugin, d as createCMSQueryKeys } from '../shared/plugin-cms.Bptwe33B.cjs';
2
+ import { DBAdapter } from '@btst/db';
3
+ import { CMSReadView, CMSContentFields, CMSReadOptions, CMSContentItemResult, SerializedContentType, ContentItem, SerializedContentItem, ContentItemWithType, SerializedContentItemWithType, ContentType } from '../types.cjs';
4
+ export { CMSBackendConfig, CMSBackendHooks, CMSCreateOperationContext, CMSCreateResultContext, CMSDeleteOperationContext, CMSDeleteResultContext, CMSOperationErrorContext, CMSOperationLifecycleContext, CMSSelectedData, CMSUpdateOperationContext, CMSUpdateResultContext, ContentTypeConfig, PaginatedContentItems, SerializedContentItemContent } from '../types.cjs';
5
+ import { z } from 'zod';
6
+ import '@btst/stack/plugins/client';
7
+ import '@btst/stack/authorization';
8
+ import '@btst/stack/plugins/api';
9
+ import 'better-call';
10
+ import '@tanstack/react-query';
11
+
12
+ /**
13
+ * Removed CMS lifecycle names and their canonical v3 replacements.
14
+ *
15
+ * The aggregate error callback remains one phase. Its operation argument
16
+ * distinguishes create, update, delete, list, and get failures.
17
+ */
18
+ declare const CMS_LIFECYCLE_HOOK_MIGRATIONS: Readonly<{
19
+ readonly onBeforeCreate: "onBeforeCreateContent";
20
+ readonly onAfterCreate: "onAfterCreateContent";
21
+ readonly onBeforeUpdate: "onBeforeUpdateContent";
22
+ readonly onAfterUpdate: "onAfterUpdateContent";
23
+ readonly onBeforeDelete: "onBeforeDeleteContent";
24
+ readonly onAfterDelete: "onAfterDeleteContent";
25
+ readonly onError: "onErrorExecuteContentOperation";
26
+ }>;
27
+
28
+ /**
29
+ * Serialize a ContentType for SSR/SSG use (convert dates to strings).
30
+ * Applies lazy migration for legacy schemas (version 1 → 2).
31
+ */
32
+ declare function serializeContentType(ct: ContentType): SerializedContentType;
33
+ /**
34
+ * Serialize a ContentItem for SSR/SSG use (convert dates to strings).
35
+ */
36
+ declare function serializeContentItem(item: ContentItem): SerializedContentItem;
37
+ /**
38
+ * Serialize a ContentItem with parsed data and joined ContentType.
39
+ * Throws a SyntaxError if `item.data` is not valid JSON, so corrupted rows
40
+ * produce a visible, debuggable error rather than silently returning null.
41
+ */
42
+ declare function serializeContentItemWithType(item: ContentItemWithType): SerializedContentItemWithType;
43
+ /**
44
+ * Retrieve all content types.
45
+ * Pure DB function — no hooks, no HTTP context. Safe for SSG and server-side use.
46
+ *
47
+ * @remarks **Security:** Operation authorization and lifecycle hooks are NOT called. The caller is
48
+ * responsible for any access-control checks before invoking this function.
49
+ *
50
+ * @param adapter - The database adapter
51
+ */
52
+ declare function getAllContentTypes(adapter: DBAdapter): Promise<SerializedContentType[]>;
53
+ /**
54
+ * Retrieve all content items for a given content type, with optional pagination
55
+ * and free-text search.
56
+ * Pure DB function — no hooks, no HTTP context. Safe for SSG and server-side use.
57
+ *
58
+ * @remarks **Security:** Operation authorization and lifecycle hooks are NOT
59
+ * called. The caller is responsible for any access-control checks before
60
+ * invoking this function.
61
+ *
62
+ * @param adapter - The database adapter
63
+ * @param contentTypeSlug - The slug of the content type to query
64
+ * @param params - Optional filter/pagination parameters. `search` matches
65
+ * case-insensitively against item slugs and string values in the item data.
66
+ */
67
+ declare function getAllContentItems<TView extends CMSReadView = undefined, const TFields extends CMSContentFields = undefined>(adapter: DBAdapter, contentTypeSlug: string, params?: {
68
+ slug?: string;
69
+ limit?: number;
70
+ offset?: number;
71
+ search?: string;
72
+ } & CMSReadOptions<TView, TFields>): Promise<{
73
+ items: CMSContentItemResult<Record<string, unknown>, TView, TFields>[];
74
+ total: number;
75
+ limit?: number;
76
+ offset?: number;
77
+ }>;
78
+ /**
79
+ * Retrieve a single content item by its ID.
80
+ * Returns null if the item is not found.
81
+ * Pure DB function — no hooks, no HTTP context. Safe for SSG and server-side use.
82
+ *
83
+ * @remarks **Security:** Operation authorization and lifecycle hooks are NOT called. The caller is
84
+ * responsible for any access-control checks before invoking this function.
85
+ *
86
+ * @param adapter - The database adapter
87
+ * @param id - The content item ID (UUID)
88
+ */
89
+ declare function getContentItemById<TView extends CMSReadView = undefined, const TFields extends CMSContentFields = undefined>(adapter: DBAdapter, id: string, options?: CMSReadOptions<TView, TFields>): Promise<CMSContentItemResult<Record<string, unknown>, TView, TFields> | null>;
90
+ /**
91
+ * Retrieve a single content item by its slug within a content type.
92
+ * Returns null if the content type or item is not found.
93
+ * Pure DB function — no hooks, no HTTP context. Safe for SSG and server-side use.
94
+ *
95
+ * @remarks **Security:** Operation authorization and lifecycle hooks are NOT called. The caller is
96
+ * responsible for any access-control checks before invoking this function.
97
+ *
98
+ * @param adapter - The database adapter
99
+ * @param contentTypeSlug - The slug of the content type
100
+ * @param slug - The slug of the content item
101
+ */
102
+ declare function getContentItemBySlug<TView extends CMSReadView = undefined, const TFields extends CMSContentFields = undefined>(adapter: DBAdapter, contentTypeSlug: string, slug: string, options?: CMSReadOptions<TView, TFields>): Promise<CMSContentItemResult<Record<string, unknown>, TView, TFields> | null>;
103
+ /** Parameters for a page of items referencing one relation target. */
104
+ interface ContentItemsByRelationParams<TView extends CMSReadView = CMSReadView, TFields extends CMSContentFields = CMSContentFields> extends CMSReadOptions<TView, TFields> {
105
+ /** Declared top-level relation field on the source content type. */
106
+ field: string;
107
+ /** ID of the item referenced by the relation. */
108
+ targetId: string;
109
+ /** Number of items to return (default: 20). */
110
+ limit?: number;
111
+ /** Number of matching items to skip (default: 0). */
112
+ offset?: number;
113
+ }
114
+ /** A page of unique related items, ordered by creation time then ID descending. */
115
+ interface ContentItemsByRelationResult<TView extends CMSReadView = undefined, TFields extends CMSContentFields = undefined> {
116
+ items: CMSContentItemResult<Record<string, unknown>, TView, TFields>[];
117
+ total: number;
118
+ limit: number;
119
+ offset: number;
120
+ }
121
+ /**
122
+ * Retrieve source items whose relation field references a target item.
123
+ * Relation rows are scanned completely, metadata is read in batches, and full
124
+ * content is fetched only for the requested page. Internal scans grow with the
125
+ * relation count; this does not promise constant query counts or native joins.
126
+ * Set `view: "content"` for identity, parsed content and serialized timestamps
127
+ * without the editor envelope. Omitting it preserves the full item response.
128
+ *
129
+ * @remarks This lower-level read does not authorize requests, validate relation
130
+ * configuration or target access, or compose lifecycle hooks. Callers own those
131
+ * checks and pagination validation. Use `forRequest(request).operations.cms` for
132
+ * request work or trusted operations for validated, lifecycle-aware server work.
133
+ */
134
+ declare function getContentItemsByRelation<TView extends CMSReadView = undefined, const TFields extends CMSContentFields = undefined>(adapter: DBAdapter, contentTypeSlug: string, params: ContentItemsByRelationParams<TView, TFields>): Promise<ContentItemsByRelationResult<TView, TFields>>;
135
+
136
+ declare const CMSContentTypeParamsSchema: z.ZodObject<{
137
+ slug: z.ZodString;
138
+ }, z.core.$strip>;
139
+ declare const CMSContentItemParamsSchema: z.ZodObject<{
140
+ typeSlug: z.ZodString;
141
+ id: z.ZodString;
142
+ }, z.core.$strip>;
143
+ declare const CMSCreateContentItemBodySchema: z.ZodObject<{
144
+ slug: z.ZodString;
145
+ data: z.ZodType<Record<string, any>, unknown, z.core.$ZodTypeInternals<Record<string, any>, unknown>>;
146
+ }, z.core.$strip>;
147
+ declare const CMSUpdateContentItemBodySchema: z.ZodObject<{
148
+ slug: z.ZodOptional<z.ZodString>;
149
+ data: z.ZodOptional<z.ZodType<Record<string, any>, unknown, z.core.$ZodTypeInternals<Record<string, any>, unknown>>>;
150
+ }, z.core.$strip>;
151
+
152
+ /**
153
+ * Input for creating a new CMS content item.
154
+ */
155
+ interface CreateCMSContentItemInput {
156
+ /** URL-safe slug for the item */
157
+ slug: string;
158
+ /** Arbitrary data payload — should match the content type schema */
159
+ data: Record<string, unknown>;
160
+ }
161
+ /**
162
+ * Options for {@link createCMSContentItem}.
163
+ */
164
+ interface CreateCMSContentItemOptions {
165
+ /**
166
+ * When `true`, persist relation fields (`belongsTo`, `hasMany`,
167
+ * `manyToMany`) into the `contentRelation` junction table in addition to
168
+ * the item's JSON payload.
169
+ *
170
+ * This is what the HTTP `POST /content/:typeSlug` route does, and is
171
+ * required for the admin "Related Items" panel / inverse-relation queries
172
+ * to find the item.
173
+ *
174
+ * Seeds and other programmatic callers that want the admin UI to work
175
+ * should enable this flag. Callers are still expected to pass
176
+ * pre-created target IDs (`{ id }` or `[{ id }, ...]`) — inline `_new`
177
+ * creation is only supported via the HTTP route.
178
+ *
179
+ * Defaults to `false` for backwards compatibility (a no-op for content
180
+ * types without relations).
181
+ */
182
+ syncRelations?: boolean;
183
+ }
184
+ /**
185
+ * Create a new content item for a content type (looked up by slug).
186
+ *
187
+ * Bypasses Zod schema validation and inline `_new` relation creation — the
188
+ * caller is responsible for providing valid data and pre-created relation
189
+ * IDs. For schema validation or inline creation of related items, use the
190
+ * HTTP endpoint instead.
191
+ *
192
+ * Throws if the content type is not found or the slug is already taken within
193
+ * that content type.
194
+ *
195
+ * @remarks **Security:** Operation authorization and lifecycle hooks are not
196
+ * called. The caller is responsible for any access-control checks before
197
+ * invoking this function.
198
+ *
199
+ * @param adapter - The database adapter
200
+ * @param contentTypeSlug - Slug of the target content type
201
+ * @param input - Item slug and data payload
202
+ * @param options - See {@link CreateCMSContentItemOptions}. Pass
203
+ * `{ syncRelations: true }` to also populate the `contentRelation`
204
+ * junction table for relation fields in the payload.
205
+ */
206
+ declare function createCMSContentItem(adapter: DBAdapter, contentTypeSlug: string, input: CreateCMSContentItemInput, options?: CreateCMSContentItemOptions): Promise<SerializedContentItem>;
207
+
208
+ export { CMSContentFields, CMSContentItemParamsSchema, CMSContentItemResult, CMSContentTypeParamsSchema, CMSCreateContentItemBodySchema, CMSReadOptions, CMSReadView, CMSUpdateContentItemBodySchema, CMS_LIFECYCLE_HOOK_MIGRATIONS, createCMSContentItem, getAllContentItems, getAllContentTypes, getContentItemById, getContentItemBySlug, getContentItemsByRelation, serializeContentItem, serializeContentItemWithType, serializeContentType };
209
+ export type { ContentItemsByRelationParams, ContentItemsByRelationResult, CreateCMSContentItemInput, CreateCMSContentItemOptions };
@@ -0,0 +1,209 @@
1
+ export { C as CMSApiRouter, a as CMSRouteKey, b as CMS_QUERY_KEYS, c as cmsBackendPlugin, d as createCMSQueryKeys } from '../shared/plugin-cms.Csx7tNDO.mjs';
2
+ import { DBAdapter } from '@btst/db';
3
+ import { CMSReadView, CMSContentFields, CMSReadOptions, CMSContentItemResult, SerializedContentType, ContentItem, SerializedContentItem, ContentItemWithType, SerializedContentItemWithType, ContentType } from '../types.mjs';
4
+ export { CMSBackendConfig, CMSBackendHooks, CMSCreateOperationContext, CMSCreateResultContext, CMSDeleteOperationContext, CMSDeleteResultContext, CMSOperationErrorContext, CMSOperationLifecycleContext, CMSSelectedData, CMSUpdateOperationContext, CMSUpdateResultContext, ContentTypeConfig, PaginatedContentItems, SerializedContentItemContent } from '../types.mjs';
5
+ import { z } from 'zod';
6
+ import '@btst/stack/plugins/client';
7
+ import '@btst/stack/authorization';
8
+ import '@btst/stack/plugins/api';
9
+ import 'better-call';
10
+ import '@tanstack/react-query';
11
+
12
+ /**
13
+ * Removed CMS lifecycle names and their canonical v3 replacements.
14
+ *
15
+ * The aggregate error callback remains one phase. Its operation argument
16
+ * distinguishes create, update, delete, list, and get failures.
17
+ */
18
+ declare const CMS_LIFECYCLE_HOOK_MIGRATIONS: Readonly<{
19
+ readonly onBeforeCreate: "onBeforeCreateContent";
20
+ readonly onAfterCreate: "onAfterCreateContent";
21
+ readonly onBeforeUpdate: "onBeforeUpdateContent";
22
+ readonly onAfterUpdate: "onAfterUpdateContent";
23
+ readonly onBeforeDelete: "onBeforeDeleteContent";
24
+ readonly onAfterDelete: "onAfterDeleteContent";
25
+ readonly onError: "onErrorExecuteContentOperation";
26
+ }>;
27
+
28
+ /**
29
+ * Serialize a ContentType for SSR/SSG use (convert dates to strings).
30
+ * Applies lazy migration for legacy schemas (version 1 → 2).
31
+ */
32
+ declare function serializeContentType(ct: ContentType): SerializedContentType;
33
+ /**
34
+ * Serialize a ContentItem for SSR/SSG use (convert dates to strings).
35
+ */
36
+ declare function serializeContentItem(item: ContentItem): SerializedContentItem;
37
+ /**
38
+ * Serialize a ContentItem with parsed data and joined ContentType.
39
+ * Throws a SyntaxError if `item.data` is not valid JSON, so corrupted rows
40
+ * produce a visible, debuggable error rather than silently returning null.
41
+ */
42
+ declare function serializeContentItemWithType(item: ContentItemWithType): SerializedContentItemWithType;
43
+ /**
44
+ * Retrieve all content types.
45
+ * Pure DB function — no hooks, no HTTP context. Safe for SSG and server-side use.
46
+ *
47
+ * @remarks **Security:** Operation authorization and lifecycle hooks are NOT called. The caller is
48
+ * responsible for any access-control checks before invoking this function.
49
+ *
50
+ * @param adapter - The database adapter
51
+ */
52
+ declare function getAllContentTypes(adapter: DBAdapter): Promise<SerializedContentType[]>;
53
+ /**
54
+ * Retrieve all content items for a given content type, with optional pagination
55
+ * and free-text search.
56
+ * Pure DB function — no hooks, no HTTP context. Safe for SSG and server-side use.
57
+ *
58
+ * @remarks **Security:** Operation authorization and lifecycle hooks are NOT
59
+ * called. The caller is responsible for any access-control checks before
60
+ * invoking this function.
61
+ *
62
+ * @param adapter - The database adapter
63
+ * @param contentTypeSlug - The slug of the content type to query
64
+ * @param params - Optional filter/pagination parameters. `search` matches
65
+ * case-insensitively against item slugs and string values in the item data.
66
+ */
67
+ declare function getAllContentItems<TView extends CMSReadView = undefined, const TFields extends CMSContentFields = undefined>(adapter: DBAdapter, contentTypeSlug: string, params?: {
68
+ slug?: string;
69
+ limit?: number;
70
+ offset?: number;
71
+ search?: string;
72
+ } & CMSReadOptions<TView, TFields>): Promise<{
73
+ items: CMSContentItemResult<Record<string, unknown>, TView, TFields>[];
74
+ total: number;
75
+ limit?: number;
76
+ offset?: number;
77
+ }>;
78
+ /**
79
+ * Retrieve a single content item by its ID.
80
+ * Returns null if the item is not found.
81
+ * Pure DB function — no hooks, no HTTP context. Safe for SSG and server-side use.
82
+ *
83
+ * @remarks **Security:** Operation authorization and lifecycle hooks are NOT called. The caller is
84
+ * responsible for any access-control checks before invoking this function.
85
+ *
86
+ * @param adapter - The database adapter
87
+ * @param id - The content item ID (UUID)
88
+ */
89
+ declare function getContentItemById<TView extends CMSReadView = undefined, const TFields extends CMSContentFields = undefined>(adapter: DBAdapter, id: string, options?: CMSReadOptions<TView, TFields>): Promise<CMSContentItemResult<Record<string, unknown>, TView, TFields> | null>;
90
+ /**
91
+ * Retrieve a single content item by its slug within a content type.
92
+ * Returns null if the content type or item is not found.
93
+ * Pure DB function — no hooks, no HTTP context. Safe for SSG and server-side use.
94
+ *
95
+ * @remarks **Security:** Operation authorization and lifecycle hooks are NOT called. The caller is
96
+ * responsible for any access-control checks before invoking this function.
97
+ *
98
+ * @param adapter - The database adapter
99
+ * @param contentTypeSlug - The slug of the content type
100
+ * @param slug - The slug of the content item
101
+ */
102
+ declare function getContentItemBySlug<TView extends CMSReadView = undefined, const TFields extends CMSContentFields = undefined>(adapter: DBAdapter, contentTypeSlug: string, slug: string, options?: CMSReadOptions<TView, TFields>): Promise<CMSContentItemResult<Record<string, unknown>, TView, TFields> | null>;
103
+ /** Parameters for a page of items referencing one relation target. */
104
+ interface ContentItemsByRelationParams<TView extends CMSReadView = CMSReadView, TFields extends CMSContentFields = CMSContentFields> extends CMSReadOptions<TView, TFields> {
105
+ /** Declared top-level relation field on the source content type. */
106
+ field: string;
107
+ /** ID of the item referenced by the relation. */
108
+ targetId: string;
109
+ /** Number of items to return (default: 20). */
110
+ limit?: number;
111
+ /** Number of matching items to skip (default: 0). */
112
+ offset?: number;
113
+ }
114
+ /** A page of unique related items, ordered by creation time then ID descending. */
115
+ interface ContentItemsByRelationResult<TView extends CMSReadView = undefined, TFields extends CMSContentFields = undefined> {
116
+ items: CMSContentItemResult<Record<string, unknown>, TView, TFields>[];
117
+ total: number;
118
+ limit: number;
119
+ offset: number;
120
+ }
121
+ /**
122
+ * Retrieve source items whose relation field references a target item.
123
+ * Relation rows are scanned completely, metadata is read in batches, and full
124
+ * content is fetched only for the requested page. Internal scans grow with the
125
+ * relation count; this does not promise constant query counts or native joins.
126
+ * Set `view: "content"` for identity, parsed content and serialized timestamps
127
+ * without the editor envelope. Omitting it preserves the full item response.
128
+ *
129
+ * @remarks This lower-level read does not authorize requests, validate relation
130
+ * configuration or target access, or compose lifecycle hooks. Callers own those
131
+ * checks and pagination validation. Use `forRequest(request).operations.cms` for
132
+ * request work or trusted operations for validated, lifecycle-aware server work.
133
+ */
134
+ declare function getContentItemsByRelation<TView extends CMSReadView = undefined, const TFields extends CMSContentFields = undefined>(adapter: DBAdapter, contentTypeSlug: string, params: ContentItemsByRelationParams<TView, TFields>): Promise<ContentItemsByRelationResult<TView, TFields>>;
135
+
136
+ declare const CMSContentTypeParamsSchema: z.ZodObject<{
137
+ slug: z.ZodString;
138
+ }, z.core.$strip>;
139
+ declare const CMSContentItemParamsSchema: z.ZodObject<{
140
+ typeSlug: z.ZodString;
141
+ id: z.ZodString;
142
+ }, z.core.$strip>;
143
+ declare const CMSCreateContentItemBodySchema: z.ZodObject<{
144
+ slug: z.ZodString;
145
+ data: z.ZodType<Record<string, any>, unknown, z.core.$ZodTypeInternals<Record<string, any>, unknown>>;
146
+ }, z.core.$strip>;
147
+ declare const CMSUpdateContentItemBodySchema: z.ZodObject<{
148
+ slug: z.ZodOptional<z.ZodString>;
149
+ data: z.ZodOptional<z.ZodType<Record<string, any>, unknown, z.core.$ZodTypeInternals<Record<string, any>, unknown>>>;
150
+ }, z.core.$strip>;
151
+
152
+ /**
153
+ * Input for creating a new CMS content item.
154
+ */
155
+ interface CreateCMSContentItemInput {
156
+ /** URL-safe slug for the item */
157
+ slug: string;
158
+ /** Arbitrary data payload — should match the content type schema */
159
+ data: Record<string, unknown>;
160
+ }
161
+ /**
162
+ * Options for {@link createCMSContentItem}.
163
+ */
164
+ interface CreateCMSContentItemOptions {
165
+ /**
166
+ * When `true`, persist relation fields (`belongsTo`, `hasMany`,
167
+ * `manyToMany`) into the `contentRelation` junction table in addition to
168
+ * the item's JSON payload.
169
+ *
170
+ * This is what the HTTP `POST /content/:typeSlug` route does, and is
171
+ * required for the admin "Related Items" panel / inverse-relation queries
172
+ * to find the item.
173
+ *
174
+ * Seeds and other programmatic callers that want the admin UI to work
175
+ * should enable this flag. Callers are still expected to pass
176
+ * pre-created target IDs (`{ id }` or `[{ id }, ...]`) — inline `_new`
177
+ * creation is only supported via the HTTP route.
178
+ *
179
+ * Defaults to `false` for backwards compatibility (a no-op for content
180
+ * types without relations).
181
+ */
182
+ syncRelations?: boolean;
183
+ }
184
+ /**
185
+ * Create a new content item for a content type (looked up by slug).
186
+ *
187
+ * Bypasses Zod schema validation and inline `_new` relation creation — the
188
+ * caller is responsible for providing valid data and pre-created relation
189
+ * IDs. For schema validation or inline creation of related items, use the
190
+ * HTTP endpoint instead.
191
+ *
192
+ * Throws if the content type is not found or the slug is already taken within
193
+ * that content type.
194
+ *
195
+ * @remarks **Security:** Operation authorization and lifecycle hooks are not
196
+ * called. The caller is responsible for any access-control checks before
197
+ * invoking this function.
198
+ *
199
+ * @param adapter - The database adapter
200
+ * @param contentTypeSlug - Slug of the target content type
201
+ * @param input - Item slug and data payload
202
+ * @param options - See {@link CreateCMSContentItemOptions}. Pass
203
+ * `{ syncRelations: true }` to also populate the `contentRelation`
204
+ * junction table for relation fields in the payload.
205
+ */
206
+ declare function createCMSContentItem(adapter: DBAdapter, contentTypeSlug: string, input: CreateCMSContentItemInput, options?: CreateCMSContentItemOptions): Promise<SerializedContentItem>;
207
+
208
+ export { CMSContentFields, CMSContentItemParamsSchema, CMSContentItemResult, CMSContentTypeParamsSchema, CMSCreateContentItemBodySchema, CMSReadOptions, CMSReadView, CMSUpdateContentItemBodySchema, CMS_LIFECYCLE_HOOK_MIGRATIONS, createCMSContentItem, getAllContentItems, getAllContentTypes, getContentItemById, getContentItemBySlug, getContentItemsByRelation, serializeContentItem, serializeContentItemWithType, serializeContentType };
209
+ export type { ContentItemsByRelationParams, ContentItemsByRelationResult, CreateCMSContentItemInput, CreateCMSContentItemOptions };
@@ -0,0 +1,209 @@
1
+ export { C as CMSApiRouter, a as CMSRouteKey, b as CMS_QUERY_KEYS, c as cmsBackendPlugin, d as createCMSQueryKeys } from '../shared/plugin-cms.eNW9_FO5.js';
2
+ import { DBAdapter } from '@btst/db';
3
+ import { CMSReadView, CMSContentFields, CMSReadOptions, CMSContentItemResult, SerializedContentType, ContentItem, SerializedContentItem, ContentItemWithType, SerializedContentItemWithType, ContentType } from '../types.js';
4
+ export { CMSBackendConfig, CMSBackendHooks, CMSCreateOperationContext, CMSCreateResultContext, CMSDeleteOperationContext, CMSDeleteResultContext, CMSOperationErrorContext, CMSOperationLifecycleContext, CMSSelectedData, CMSUpdateOperationContext, CMSUpdateResultContext, ContentTypeConfig, PaginatedContentItems, SerializedContentItemContent } from '../types.js';
5
+ import { z } from 'zod';
6
+ import '@btst/stack/plugins/client';
7
+ import '@btst/stack/authorization';
8
+ import '@btst/stack/plugins/api';
9
+ import 'better-call';
10
+ import '@tanstack/react-query';
11
+
12
+ /**
13
+ * Removed CMS lifecycle names and their canonical v3 replacements.
14
+ *
15
+ * The aggregate error callback remains one phase. Its operation argument
16
+ * distinguishes create, update, delete, list, and get failures.
17
+ */
18
+ declare const CMS_LIFECYCLE_HOOK_MIGRATIONS: Readonly<{
19
+ readonly onBeforeCreate: "onBeforeCreateContent";
20
+ readonly onAfterCreate: "onAfterCreateContent";
21
+ readonly onBeforeUpdate: "onBeforeUpdateContent";
22
+ readonly onAfterUpdate: "onAfterUpdateContent";
23
+ readonly onBeforeDelete: "onBeforeDeleteContent";
24
+ readonly onAfterDelete: "onAfterDeleteContent";
25
+ readonly onError: "onErrorExecuteContentOperation";
26
+ }>;
27
+
28
+ /**
29
+ * Serialize a ContentType for SSR/SSG use (convert dates to strings).
30
+ * Applies lazy migration for legacy schemas (version 1 → 2).
31
+ */
32
+ declare function serializeContentType(ct: ContentType): SerializedContentType;
33
+ /**
34
+ * Serialize a ContentItem for SSR/SSG use (convert dates to strings).
35
+ */
36
+ declare function serializeContentItem(item: ContentItem): SerializedContentItem;
37
+ /**
38
+ * Serialize a ContentItem with parsed data and joined ContentType.
39
+ * Throws a SyntaxError if `item.data` is not valid JSON, so corrupted rows
40
+ * produce a visible, debuggable error rather than silently returning null.
41
+ */
42
+ declare function serializeContentItemWithType(item: ContentItemWithType): SerializedContentItemWithType;
43
+ /**
44
+ * Retrieve all content types.
45
+ * Pure DB function — no hooks, no HTTP context. Safe for SSG and server-side use.
46
+ *
47
+ * @remarks **Security:** Operation authorization and lifecycle hooks are NOT called. The caller is
48
+ * responsible for any access-control checks before invoking this function.
49
+ *
50
+ * @param adapter - The database adapter
51
+ */
52
+ declare function getAllContentTypes(adapter: DBAdapter): Promise<SerializedContentType[]>;
53
+ /**
54
+ * Retrieve all content items for a given content type, with optional pagination
55
+ * and free-text search.
56
+ * Pure DB function — no hooks, no HTTP context. Safe for SSG and server-side use.
57
+ *
58
+ * @remarks **Security:** Operation authorization and lifecycle hooks are NOT
59
+ * called. The caller is responsible for any access-control checks before
60
+ * invoking this function.
61
+ *
62
+ * @param adapter - The database adapter
63
+ * @param contentTypeSlug - The slug of the content type to query
64
+ * @param params - Optional filter/pagination parameters. `search` matches
65
+ * case-insensitively against item slugs and string values in the item data.
66
+ */
67
+ declare function getAllContentItems<TView extends CMSReadView = undefined, const TFields extends CMSContentFields = undefined>(adapter: DBAdapter, contentTypeSlug: string, params?: {
68
+ slug?: string;
69
+ limit?: number;
70
+ offset?: number;
71
+ search?: string;
72
+ } & CMSReadOptions<TView, TFields>): Promise<{
73
+ items: CMSContentItemResult<Record<string, unknown>, TView, TFields>[];
74
+ total: number;
75
+ limit?: number;
76
+ offset?: number;
77
+ }>;
78
+ /**
79
+ * Retrieve a single content item by its ID.
80
+ * Returns null if the item is not found.
81
+ * Pure DB function — no hooks, no HTTP context. Safe for SSG and server-side use.
82
+ *
83
+ * @remarks **Security:** Operation authorization and lifecycle hooks are NOT called. The caller is
84
+ * responsible for any access-control checks before invoking this function.
85
+ *
86
+ * @param adapter - The database adapter
87
+ * @param id - The content item ID (UUID)
88
+ */
89
+ declare function getContentItemById<TView extends CMSReadView = undefined, const TFields extends CMSContentFields = undefined>(adapter: DBAdapter, id: string, options?: CMSReadOptions<TView, TFields>): Promise<CMSContentItemResult<Record<string, unknown>, TView, TFields> | null>;
90
+ /**
91
+ * Retrieve a single content item by its slug within a content type.
92
+ * Returns null if the content type or item is not found.
93
+ * Pure DB function — no hooks, no HTTP context. Safe for SSG and server-side use.
94
+ *
95
+ * @remarks **Security:** Operation authorization and lifecycle hooks are NOT called. The caller is
96
+ * responsible for any access-control checks before invoking this function.
97
+ *
98
+ * @param adapter - The database adapter
99
+ * @param contentTypeSlug - The slug of the content type
100
+ * @param slug - The slug of the content item
101
+ */
102
+ declare function getContentItemBySlug<TView extends CMSReadView = undefined, const TFields extends CMSContentFields = undefined>(adapter: DBAdapter, contentTypeSlug: string, slug: string, options?: CMSReadOptions<TView, TFields>): Promise<CMSContentItemResult<Record<string, unknown>, TView, TFields> | null>;
103
+ /** Parameters for a page of items referencing one relation target. */
104
+ interface ContentItemsByRelationParams<TView extends CMSReadView = CMSReadView, TFields extends CMSContentFields = CMSContentFields> extends CMSReadOptions<TView, TFields> {
105
+ /** Declared top-level relation field on the source content type. */
106
+ field: string;
107
+ /** ID of the item referenced by the relation. */
108
+ targetId: string;
109
+ /** Number of items to return (default: 20). */
110
+ limit?: number;
111
+ /** Number of matching items to skip (default: 0). */
112
+ offset?: number;
113
+ }
114
+ /** A page of unique related items, ordered by creation time then ID descending. */
115
+ interface ContentItemsByRelationResult<TView extends CMSReadView = undefined, TFields extends CMSContentFields = undefined> {
116
+ items: CMSContentItemResult<Record<string, unknown>, TView, TFields>[];
117
+ total: number;
118
+ limit: number;
119
+ offset: number;
120
+ }
121
+ /**
122
+ * Retrieve source items whose relation field references a target item.
123
+ * Relation rows are scanned completely, metadata is read in batches, and full
124
+ * content is fetched only for the requested page. Internal scans grow with the
125
+ * relation count; this does not promise constant query counts or native joins.
126
+ * Set `view: "content"` for identity, parsed content and serialized timestamps
127
+ * without the editor envelope. Omitting it preserves the full item response.
128
+ *
129
+ * @remarks This lower-level read does not authorize requests, validate relation
130
+ * configuration or target access, or compose lifecycle hooks. Callers own those
131
+ * checks and pagination validation. Use `forRequest(request).operations.cms` for
132
+ * request work or trusted operations for validated, lifecycle-aware server work.
133
+ */
134
+ declare function getContentItemsByRelation<TView extends CMSReadView = undefined, const TFields extends CMSContentFields = undefined>(adapter: DBAdapter, contentTypeSlug: string, params: ContentItemsByRelationParams<TView, TFields>): Promise<ContentItemsByRelationResult<TView, TFields>>;
135
+
136
+ declare const CMSContentTypeParamsSchema: z.ZodObject<{
137
+ slug: z.ZodString;
138
+ }, z.core.$strip>;
139
+ declare const CMSContentItemParamsSchema: z.ZodObject<{
140
+ typeSlug: z.ZodString;
141
+ id: z.ZodString;
142
+ }, z.core.$strip>;
143
+ declare const CMSCreateContentItemBodySchema: z.ZodObject<{
144
+ slug: z.ZodString;
145
+ data: z.ZodType<Record<string, any>, unknown, z.core.$ZodTypeInternals<Record<string, any>, unknown>>;
146
+ }, z.core.$strip>;
147
+ declare const CMSUpdateContentItemBodySchema: z.ZodObject<{
148
+ slug: z.ZodOptional<z.ZodString>;
149
+ data: z.ZodOptional<z.ZodType<Record<string, any>, unknown, z.core.$ZodTypeInternals<Record<string, any>, unknown>>>;
150
+ }, z.core.$strip>;
151
+
152
+ /**
153
+ * Input for creating a new CMS content item.
154
+ */
155
+ interface CreateCMSContentItemInput {
156
+ /** URL-safe slug for the item */
157
+ slug: string;
158
+ /** Arbitrary data payload — should match the content type schema */
159
+ data: Record<string, unknown>;
160
+ }
161
+ /**
162
+ * Options for {@link createCMSContentItem}.
163
+ */
164
+ interface CreateCMSContentItemOptions {
165
+ /**
166
+ * When `true`, persist relation fields (`belongsTo`, `hasMany`,
167
+ * `manyToMany`) into the `contentRelation` junction table in addition to
168
+ * the item's JSON payload.
169
+ *
170
+ * This is what the HTTP `POST /content/:typeSlug` route does, and is
171
+ * required for the admin "Related Items" panel / inverse-relation queries
172
+ * to find the item.
173
+ *
174
+ * Seeds and other programmatic callers that want the admin UI to work
175
+ * should enable this flag. Callers are still expected to pass
176
+ * pre-created target IDs (`{ id }` or `[{ id }, ...]`) — inline `_new`
177
+ * creation is only supported via the HTTP route.
178
+ *
179
+ * Defaults to `false` for backwards compatibility (a no-op for content
180
+ * types without relations).
181
+ */
182
+ syncRelations?: boolean;
183
+ }
184
+ /**
185
+ * Create a new content item for a content type (looked up by slug).
186
+ *
187
+ * Bypasses Zod schema validation and inline `_new` relation creation — the
188
+ * caller is responsible for providing valid data and pre-created relation
189
+ * IDs. For schema validation or inline creation of related items, use the
190
+ * HTTP endpoint instead.
191
+ *
192
+ * Throws if the content type is not found or the slug is already taken within
193
+ * that content type.
194
+ *
195
+ * @remarks **Security:** Operation authorization and lifecycle hooks are not
196
+ * called. The caller is responsible for any access-control checks before
197
+ * invoking this function.
198
+ *
199
+ * @param adapter - The database adapter
200
+ * @param contentTypeSlug - Slug of the target content type
201
+ * @param input - Item slug and data payload
202
+ * @param options - See {@link CreateCMSContentItemOptions}. Pass
203
+ * `{ syncRelations: true }` to also populate the `contentRelation`
204
+ * junction table for relation fields in the payload.
205
+ */
206
+ declare function createCMSContentItem(adapter: DBAdapter, contentTypeSlug: string, input: CreateCMSContentItemInput, options?: CreateCMSContentItemOptions): Promise<SerializedContentItem>;
207
+
208
+ export { CMSContentFields, CMSContentItemParamsSchema, CMSContentItemResult, CMSContentTypeParamsSchema, CMSCreateContentItemBodySchema, CMSReadOptions, CMSReadView, CMSUpdateContentItemBodySchema, CMS_LIFECYCLE_HOOK_MIGRATIONS, createCMSContentItem, getAllContentItems, getAllContentTypes, getContentItemById, getContentItemBySlug, getContentItemsByRelation, serializeContentItem, serializeContentItemWithType, serializeContentType };
209
+ export type { ContentItemsByRelationParams, ContentItemsByRelationResult, CreateCMSContentItemInput, CreateCMSContentItemOptions };
@@ -0,0 +1,7 @@
1
+ export { cmsBackendPlugin } from './plugin.mjs';
2
+ export { getAllContentItems, getAllContentTypes, getContentItemById, getContentItemBySlug, getContentItemsByRelation, serializeContentItem, serializeContentItemWithType, serializeContentType } from './getters.mjs';
3
+ export { createCMSContentItem } from './mutations.mjs';
4
+ export { CMS_QUERY_KEYS } from './query-key-defs.mjs';
5
+ export { createCMSQueryKeys } from '../query-keys.mjs';
6
+ export { CMSContentItemParamsSchema, CMSContentTypeParamsSchema, CMSCreateContentItemBodySchema, CMSUpdateContentItemBodySchema } from './operations.mjs';
7
+ export { CMS_LIFECYCLE_HOOK_MIGRATIONS } from './lifecycle-migrations.mjs';
@@ -0,0 +1,13 @@
1
+ 'use strict';
2
+
3
+ const CMS_LIFECYCLE_HOOK_MIGRATIONS = Object.freeze({
4
+ onBeforeCreate: "onBeforeCreateContent",
5
+ onAfterCreate: "onAfterCreateContent",
6
+ onBeforeUpdate: "onBeforeUpdateContent",
7
+ onAfterUpdate: "onAfterUpdateContent",
8
+ onBeforeDelete: "onBeforeDeleteContent",
9
+ onAfterDelete: "onAfterDeleteContent",
10
+ onError: "onErrorExecuteContentOperation"
11
+ });
12
+
13
+ exports.CMS_LIFECYCLE_HOOK_MIGRATIONS = CMS_LIFECYCLE_HOOK_MIGRATIONS;
@@ -0,0 +1,11 @@
1
+ const CMS_LIFECYCLE_HOOK_MIGRATIONS = Object.freeze({
2
+ onBeforeCreate: "onBeforeCreateContent",
3
+ onAfterCreate: "onAfterCreateContent",
4
+ onBeforeUpdate: "onBeforeUpdateContent",
5
+ onAfterUpdate: "onAfterUpdateContent",
6
+ onBeforeDelete: "onBeforeDeleteContent",
7
+ onAfterDelete: "onAfterDeleteContent",
8
+ onError: "onErrorExecuteContentOperation"
9
+ });
10
+
11
+ export { CMS_LIFECYCLE_HOOK_MIGRATIONS };