@btst/stack 2.11.2 → 2.11.4

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 (41) hide show
  1. package/dist/packages/stack/src/plugins/cms/api/mutations.cjs +12 -1
  2. package/dist/packages/stack/src/plugins/cms/api/mutations.mjs +12 -1
  3. package/dist/packages/stack/src/plugins/cms/api/plugin.cjs +11 -51
  4. package/dist/packages/stack/src/plugins/cms/api/plugin.mjs +3 -43
  5. package/dist/packages/stack/src/plugins/cms/api/relations.cjs +76 -0
  6. package/dist/packages/stack/src/plugins/cms/api/relations.mjs +70 -0
  7. package/dist/plugins/blog/api/index.d.cts +2 -2
  8. package/dist/plugins/blog/api/index.d.mts +2 -2
  9. package/dist/plugins/blog/api/index.d.ts +2 -2
  10. package/dist/plugins/blog/client/hooks/index.d.cts +2 -2
  11. package/dist/plugins/blog/client/hooks/index.d.mts +2 -2
  12. package/dist/plugins/blog/client/hooks/index.d.ts +2 -2
  13. package/dist/plugins/blog/client/index.d.cts +2 -2
  14. package/dist/plugins/blog/client/index.d.mts +2 -2
  15. package/dist/plugins/blog/client/index.d.ts +2 -2
  16. package/dist/plugins/blog/query-keys.d.cts +2 -2
  17. package/dist/plugins/blog/query-keys.d.mts +2 -2
  18. package/dist/plugins/blog/query-keys.d.ts +2 -2
  19. package/dist/plugins/cms/api/index.d.cts +1 -1
  20. package/dist/plugins/cms/api/index.d.mts +1 -1
  21. package/dist/plugins/cms/api/index.d.ts +1 -1
  22. package/dist/plugins/cms/query-keys.d.cts +1 -1
  23. package/dist/plugins/cms/query-keys.d.mts +1 -1
  24. package/dist/plugins/cms/query-keys.d.ts +1 -1
  25. package/dist/shared/{stack.DOZ1EXjM.d.mts → stack.6mEHS2WH.d.mts} +3 -3
  26. package/dist/shared/{stack.DX-tQ93o.d.cts → stack.AJTXI7kw.d.cts} +3 -3
  27. package/dist/shared/{stack.E17kSK1W.d.mts → stack.C1jLzFZ6.d.mts} +5 -5
  28. package/dist/shared/{stack.D0p6oNme.d.ts → stack.DF1ewpVE.d.ts} +5 -5
  29. package/dist/shared/{stack.BX7MHi0J.d.mts → stack.DbnCLdNF.d.mts} +34 -7
  30. package/dist/shared/{stack.VF6FhyZw.d.ts → stack.QYn-Px94.d.ts} +3 -3
  31. package/dist/shared/{stack.DWipT53I.d.cts → stack.XulPeAD3.d.cts} +5 -5
  32. package/dist/shared/{stack.fQjVhw5a.d.ts → stack.fXlShnhv.d.ts} +34 -7
  33. package/dist/shared/{stack.C9zoS1TN.d.cts → stack.r6HohbyX.d.cts} +34 -7
  34. package/package.json +4 -4
  35. package/src/plugins/cms/api/index.ts +1 -0
  36. package/src/plugins/cms/api/mutations.ts +48 -3
  37. package/src/plugins/cms/api/plugin.ts +11 -101
  38. package/src/plugins/cms/api/relations.ts +174 -0
  39. package/dist/shared/{stack.BWp0hcm9.d.cts → stack.BQmuNl5p.d.cts} +3 -3
  40. package/dist/shared/{stack.BWp0hcm9.d.mts → stack.BQmuNl5p.d.mts} +3 -3
  41. package/dist/shared/{stack.BWp0hcm9.d.ts → stack.BQmuNl5p.d.ts} +3 -3
@@ -1,8 +1,9 @@
1
1
  'use strict';
2
2
 
3
3
  const getters = require('./getters.cjs');
4
+ const relations = require('./relations.cjs');
4
5
 
5
- async function createCMSContentItem(adapter, contentTypeSlug, input) {
6
+ async function createCMSContentItem(adapter, contentTypeSlug, input, options = {}) {
6
7
  const contentType = await adapter.findOne({
7
8
  model: "contentType",
8
9
  where: [
@@ -42,6 +43,16 @@ async function createCMSContentItem(adapter, contentTypeSlug, input) {
42
43
  updatedAt: /* @__PURE__ */ new Date()
43
44
  }
44
45
  });
46
+ if (options.syncRelations) {
47
+ const relationFields = relations.extractRelationFields(contentType);
48
+ if (Object.keys(relationFields).length > 0) {
49
+ const relationIds = relations.collectExistingRelationIds(
50
+ input.data,
51
+ relationFields
52
+ );
53
+ await relations.syncRelations(adapter, item.id, relationIds);
54
+ }
55
+ }
45
56
  return getters.serializeContentItem(item);
46
57
  }
47
58
 
@@ -1,6 +1,7 @@
1
1
  import { serializeContentItem } from './getters.mjs';
2
+ import { extractRelationFields, collectExistingRelationIds, syncRelations } from './relations.mjs';
2
3
 
3
- async function createCMSContentItem(adapter, contentTypeSlug, input) {
4
+ async function createCMSContentItem(adapter, contentTypeSlug, input, options = {}) {
4
5
  const contentType = await adapter.findOne({
5
6
  model: "contentType",
6
7
  where: [
@@ -40,6 +41,16 @@ async function createCMSContentItem(adapter, contentTypeSlug, input) {
40
41
  updatedAt: /* @__PURE__ */ new Date()
41
42
  }
42
43
  });
44
+ if (options.syncRelations) {
45
+ const relationFields = extractRelationFields(contentType);
46
+ if (Object.keys(relationFields).length > 0) {
47
+ const relationIds = collectExistingRelationIds(
48
+ input.data,
49
+ relationFields
50
+ );
51
+ await syncRelations(adapter, item.id, relationIds);
52
+ }
53
+ }
43
54
  return serializeContentItem(item);
44
55
  }
45
56
 
@@ -8,6 +8,7 @@ const schemas = require('../schemas.cjs');
8
8
  const utils = require('../utils.cjs');
9
9
  const getters = require('./getters.cjs');
10
10
  const mutations = require('./mutations.cjs');
11
+ const relations = require('./relations.cjs');
11
12
  const queryKeyDefs = require('./query-key-defs.cjs');
12
13
  const utils$1 = require('../../utils.cjs');
13
14
 
@@ -68,27 +69,8 @@ function getContentTypeZodSchema(contentType) {
68
69
  const jsonSchema = JSON.parse(contentType.jsonSchema);
69
70
  return schemaConverter.formSchemaToZod(jsonSchema);
70
71
  }
71
- function extractRelationFields(contentType) {
72
- const jsonSchema = JSON.parse(
73
- contentType.jsonSchema
74
- );
75
- const properties = jsonSchema.properties || {};
76
- const relationFields = {};
77
- for (const [fieldName, fieldSchema] of Object.entries(properties)) {
78
- if (fieldSchema.fieldType === "relation" && fieldSchema.relation) {
79
- relationFields[fieldName] = fieldSchema.relation;
80
- }
81
- }
82
- return relationFields;
83
- }
84
- function isNewRelationValue(value) {
85
- return typeof value === "object" && value !== null && "_new" in value && value._new === true && "data" in value;
86
- }
87
- function isExistingRelationValue(value) {
88
- return typeof value === "object" && value !== null && "id" in value && typeof value.id === "string";
89
- }
90
72
  async function processRelationsInData(adapter, contentType, data, getContentTypeFn) {
91
- const relationFields = extractRelationFields(contentType);
73
+ const relationFields = relations.extractRelationFields(contentType);
92
74
  const processedData = { ...data };
93
75
  const relationIds = {};
94
76
  for (const [fieldName, relationConfig] of Object.entries(relationFields)) {
@@ -109,7 +91,7 @@ async function processRelationsInData(adapter, contentType, data, getContentType
109
91
  const ids = [];
110
92
  if (relationConfig.type === "belongsTo") {
111
93
  const value = fieldValue;
112
- if (isNewRelationValue(value)) {
94
+ if (relations.isNewRelationValue(value)) {
113
95
  const newItem = await createRelatedItem(
114
96
  adapter,
115
97
  targetContentType,
@@ -117,14 +99,14 @@ async function processRelationsInData(adapter, contentType, data, getContentType
117
99
  );
118
100
  ids.push(newItem.id);
119
101
  processedData[fieldName] = { id: newItem.id };
120
- } else if (isExistingRelationValue(value)) {
102
+ } else if (relations.isExistingRelationValue(value)) {
121
103
  ids.push(value.id);
122
104
  }
123
105
  } else {
124
106
  const values = Array.isArray(fieldValue) ? fieldValue : [];
125
107
  const processedValues = [];
126
108
  for (const value of values) {
127
- if (isNewRelationValue(value)) {
109
+ if (relations.isNewRelationValue(value)) {
128
110
  const newItem = await createRelatedItem(
129
111
  adapter,
130
112
  targetContentType,
@@ -132,7 +114,7 @@ async function processRelationsInData(adapter, contentType, data, getContentType
132
114
  );
133
115
  ids.push(newItem.id);
134
116
  processedValues.push({ id: newItem.id });
135
- } else if (isExistingRelationValue(value)) {
117
+ } else if (relations.isExistingRelationValue(value)) {
136
118
  ids.push(value.id);
137
119
  processedValues.push({ id: value.id });
138
120
  }
@@ -180,28 +162,6 @@ async function createRelatedItem(adapter, targetContentType, data) {
180
162
  });
181
163
  return item;
182
164
  }
183
- async function syncRelations(adapter, sourceId, relationIds) {
184
- for (const [fieldName, targetIds] of Object.entries(relationIds)) {
185
- await adapter.delete({
186
- model: "contentRelation",
187
- where: [
188
- { field: "sourceId", value: sourceId, operator: "eq" },
189
- { field: "fieldName", value: fieldName, operator: "eq" }
190
- ]
191
- });
192
- for (const targetId of targetIds) {
193
- await adapter.create({
194
- model: "contentRelation",
195
- data: {
196
- sourceId,
197
- targetId,
198
- fieldName,
199
- createdAt: /* @__PURE__ */ new Date()
200
- }
201
- });
202
- }
203
- }
204
- }
205
165
  async function populateRelations(adapter, item) {
206
166
  const relations = {};
207
167
  const contentRelations = await adapter.findMany({
@@ -331,9 +291,9 @@ const cmsBackendPlugin = (config) => {
331
291
  },
332
292
  prefetchForRoute: createCMSPrefetchForRoute(adapter),
333
293
  // Mutations
334
- createContentItem: async (typeSlug, input) => {
294
+ createContentItem: async (typeSlug, input, options) => {
335
295
  await ensureSynced(adapter);
336
- return mutations.createCMSContentItem(adapter, typeSlug, input);
296
+ return mutations.createCMSContentItem(adapter, typeSlug, input, options);
337
297
  }
338
298
  }),
339
299
  routes: (adapter) => {
@@ -506,7 +466,7 @@ const cmsBackendPlugin = (config) => {
506
466
  updatedAt: /* @__PURE__ */ new Date()
507
467
  }
508
468
  });
509
- await syncRelations(adapter, item.id, relationIds);
469
+ await relations.syncRelations(adapter, item.id, relationIds);
510
470
  const serialized = getters.serializeContentItem(item);
511
471
  if (config.hooks?.onAfterCreate) {
512
472
  await config.hooks.onAfterCreate(serialized, context);
@@ -605,7 +565,7 @@ const cmsBackendPlugin = (config) => {
605
565
  );
606
566
  }
607
567
  if (relationIds) {
608
- await syncRelations(adapter, id, relationIds);
568
+ await relations.syncRelations(adapter, id, relationIds);
609
569
  }
610
570
  const updateData = {
611
571
  updatedAt: /* @__PURE__ */ new Date()
@@ -786,7 +746,7 @@ const cmsBackendPlugin = (config) => {
786
746
  });
787
747
  const inverseRelations = [];
788
748
  for (const contentType of allContentTypes) {
789
- const relationFields = extractRelationFields(contentType);
749
+ const relationFields = relations.extractRelationFields(contentType);
790
750
  for (const [fieldName, relationConfig] of Object.entries(
791
751
  relationFields
792
752
  )) {
@@ -6,6 +6,7 @@ import { listContentQuerySchema } from '../schemas.mjs';
6
6
  import { slugify } from '../utils.mjs';
7
7
  import { serializeContentType, getAllContentItems, serializeContentItemWithType, serializeContentItem, getContentItemById, getContentItemBySlug, getAllContentTypes } from './getters.mjs';
8
8
  import { createCMSContentItem } from './mutations.mjs';
9
+ import { syncRelations, extractRelationFields, isNewRelationValue, isExistingRelationValue } from './relations.mjs';
9
10
  import { CMS_QUERY_KEYS } from './query-key-defs.mjs';
10
11
  import { runHookWithShim } from '../../utils.mjs';
11
12
 
@@ -66,25 +67,6 @@ function getContentTypeZodSchema(contentType) {
66
67
  const jsonSchema = JSON.parse(contentType.jsonSchema);
67
68
  return formSchemaToZod(jsonSchema);
68
69
  }
69
- function extractRelationFields(contentType) {
70
- const jsonSchema = JSON.parse(
71
- contentType.jsonSchema
72
- );
73
- const properties = jsonSchema.properties || {};
74
- const relationFields = {};
75
- for (const [fieldName, fieldSchema] of Object.entries(properties)) {
76
- if (fieldSchema.fieldType === "relation" && fieldSchema.relation) {
77
- relationFields[fieldName] = fieldSchema.relation;
78
- }
79
- }
80
- return relationFields;
81
- }
82
- function isNewRelationValue(value) {
83
- return typeof value === "object" && value !== null && "_new" in value && value._new === true && "data" in value;
84
- }
85
- function isExistingRelationValue(value) {
86
- return typeof value === "object" && value !== null && "id" in value && typeof value.id === "string";
87
- }
88
70
  async function processRelationsInData(adapter, contentType, data, getContentTypeFn) {
89
71
  const relationFields = extractRelationFields(contentType);
90
72
  const processedData = { ...data };
@@ -178,28 +160,6 @@ async function createRelatedItem(adapter, targetContentType, data) {
178
160
  });
179
161
  return item;
180
162
  }
181
- async function syncRelations(adapter, sourceId, relationIds) {
182
- for (const [fieldName, targetIds] of Object.entries(relationIds)) {
183
- await adapter.delete({
184
- model: "contentRelation",
185
- where: [
186
- { field: "sourceId", value: sourceId, operator: "eq" },
187
- { field: "fieldName", value: fieldName, operator: "eq" }
188
- ]
189
- });
190
- for (const targetId of targetIds) {
191
- await adapter.create({
192
- model: "contentRelation",
193
- data: {
194
- sourceId,
195
- targetId,
196
- fieldName,
197
- createdAt: /* @__PURE__ */ new Date()
198
- }
199
- });
200
- }
201
- }
202
- }
203
163
  async function populateRelations(adapter, item) {
204
164
  const relations = {};
205
165
  const contentRelations = await adapter.findMany({
@@ -329,9 +289,9 @@ const cmsBackendPlugin = (config) => {
329
289
  },
330
290
  prefetchForRoute: createCMSPrefetchForRoute(adapter),
331
291
  // Mutations
332
- createContentItem: async (typeSlug, input) => {
292
+ createContentItem: async (typeSlug, input, options) => {
333
293
  await ensureSynced(adapter);
334
- return createCMSContentItem(adapter, typeSlug, input);
294
+ return createCMSContentItem(adapter, typeSlug, input, options);
335
295
  }
336
296
  }),
337
297
  routes: (adapter) => {
@@ -0,0 +1,76 @@
1
+ 'use strict';
2
+
3
+ function extractRelationFields(contentType) {
4
+ const jsonSchema = JSON.parse(
5
+ contentType.jsonSchema
6
+ );
7
+ const properties = jsonSchema.properties || {};
8
+ const relationFields = {};
9
+ for (const [fieldName, fieldSchema] of Object.entries(properties)) {
10
+ if (fieldSchema.fieldType === "relation" && fieldSchema.relation) {
11
+ relationFields[fieldName] = fieldSchema.relation;
12
+ }
13
+ }
14
+ return relationFields;
15
+ }
16
+ function isNewRelationValue(value) {
17
+ return typeof value === "object" && value !== null && "_new" in value && value._new === true && "data" in value;
18
+ }
19
+ function isExistingRelationValue(value) {
20
+ return typeof value === "object" && value !== null && "id" in value && typeof value.id === "string";
21
+ }
22
+ function collectExistingRelationIds(data, relationFields) {
23
+ const relationIds = {};
24
+ for (const [fieldName, relationConfig] of Object.entries(relationFields)) {
25
+ if (!(fieldName in data)) continue;
26
+ const fieldValue = data[fieldName];
27
+ if (!fieldValue) {
28
+ relationIds[fieldName] = [];
29
+ continue;
30
+ }
31
+ const ids = [];
32
+ if (relationConfig.type === "belongsTo") {
33
+ const value = fieldValue;
34
+ if (isExistingRelationValue(value)) {
35
+ ids.push(value.id);
36
+ }
37
+ } else {
38
+ const values = Array.isArray(fieldValue) ? fieldValue : [];
39
+ for (const value of values) {
40
+ if (isExistingRelationValue(value)) {
41
+ ids.push(value.id);
42
+ }
43
+ }
44
+ }
45
+ relationIds[fieldName] = ids;
46
+ }
47
+ return relationIds;
48
+ }
49
+ async function syncRelations(adapter, sourceId, relationIds) {
50
+ for (const [fieldName, targetIds] of Object.entries(relationIds)) {
51
+ await adapter.delete({
52
+ model: "contentRelation",
53
+ where: [
54
+ { field: "sourceId", value: sourceId, operator: "eq" },
55
+ { field: "fieldName", value: fieldName, operator: "eq" }
56
+ ]
57
+ });
58
+ for (const targetId of targetIds) {
59
+ await adapter.create({
60
+ model: "contentRelation",
61
+ data: {
62
+ sourceId,
63
+ targetId,
64
+ fieldName,
65
+ createdAt: /* @__PURE__ */ new Date()
66
+ }
67
+ });
68
+ }
69
+ }
70
+ }
71
+
72
+ exports.collectExistingRelationIds = collectExistingRelationIds;
73
+ exports.extractRelationFields = extractRelationFields;
74
+ exports.isExistingRelationValue = isExistingRelationValue;
75
+ exports.isNewRelationValue = isNewRelationValue;
76
+ exports.syncRelations = syncRelations;
@@ -0,0 +1,70 @@
1
+ function extractRelationFields(contentType) {
2
+ const jsonSchema = JSON.parse(
3
+ contentType.jsonSchema
4
+ );
5
+ const properties = jsonSchema.properties || {};
6
+ const relationFields = {};
7
+ for (const [fieldName, fieldSchema] of Object.entries(properties)) {
8
+ if (fieldSchema.fieldType === "relation" && fieldSchema.relation) {
9
+ relationFields[fieldName] = fieldSchema.relation;
10
+ }
11
+ }
12
+ return relationFields;
13
+ }
14
+ function isNewRelationValue(value) {
15
+ return typeof value === "object" && value !== null && "_new" in value && value._new === true && "data" in value;
16
+ }
17
+ function isExistingRelationValue(value) {
18
+ return typeof value === "object" && value !== null && "id" in value && typeof value.id === "string";
19
+ }
20
+ function collectExistingRelationIds(data, relationFields) {
21
+ const relationIds = {};
22
+ for (const [fieldName, relationConfig] of Object.entries(relationFields)) {
23
+ if (!(fieldName in data)) continue;
24
+ const fieldValue = data[fieldName];
25
+ if (!fieldValue) {
26
+ relationIds[fieldName] = [];
27
+ continue;
28
+ }
29
+ const ids = [];
30
+ if (relationConfig.type === "belongsTo") {
31
+ const value = fieldValue;
32
+ if (isExistingRelationValue(value)) {
33
+ ids.push(value.id);
34
+ }
35
+ } else {
36
+ const values = Array.isArray(fieldValue) ? fieldValue : [];
37
+ for (const value of values) {
38
+ if (isExistingRelationValue(value)) {
39
+ ids.push(value.id);
40
+ }
41
+ }
42
+ }
43
+ relationIds[fieldName] = ids;
44
+ }
45
+ return relationIds;
46
+ }
47
+ async function syncRelations(adapter, sourceId, relationIds) {
48
+ for (const [fieldName, targetIds] of Object.entries(relationIds)) {
49
+ await adapter.delete({
50
+ model: "contentRelation",
51
+ where: [
52
+ { field: "sourceId", value: sourceId, operator: "eq" },
53
+ { field: "fieldName", value: fieldName, operator: "eq" }
54
+ ]
55
+ });
56
+ for (const targetId of targetIds) {
57
+ await adapter.create({
58
+ model: "contentRelation",
59
+ data: {
60
+ sourceId,
61
+ targetId,
62
+ fieldName,
63
+ createdAt: /* @__PURE__ */ new Date()
64
+ }
65
+ });
66
+ }
67
+ }
68
+ }
69
+
70
+ export { collectExistingRelationIds, extractRelationFields, isExistingRelationValue, isNewRelationValue, syncRelations };
@@ -1,5 +1,5 @@
1
- export { B as BLOG_QUERY_KEYS, j as BlogApiContext, m as BlogApiRouter, k as BlogBackendHooks, h as BlogRouteKey, C as CreatePostInput, N as NextPreviousPostsQuerySchema, P as PostListParams, i as PostListQuerySchema, c as PostListResult, U as UpdatePostInput, l as blogBackendPlugin, f as createBlogQueryKeys, d as createPost, e as deletePost, g as getAllPosts, b as getAllTags, a as getPostBySlug, u as updatePost } from '../../../shared/stack.DWipT53I.cjs';
2
- import { P as Post, T as Tag, S as SerializedPost, a as SerializedTag } from '../../../shared/stack.BWp0hcm9.cjs';
1
+ export { B as BLOG_QUERY_KEYS, j as BlogApiContext, m as BlogApiRouter, k as BlogBackendHooks, h as BlogRouteKey, C as CreatePostInput, N as NextPreviousPostsQuerySchema, P as PostListParams, i as PostListQuerySchema, c as PostListResult, U as UpdatePostInput, l as blogBackendPlugin, f as createBlogQueryKeys, d as createPost, e as deletePost, g as getAllPosts, b as getAllTags, a as getPostBySlug, u as updatePost } from '../../../shared/stack.XulPeAD3.cjs';
2
+ import { P as Post, T as Tag, S as SerializedPost, a as SerializedTag } from '../../../shared/stack.BQmuNl5p.cjs';
3
3
  import '@tanstack/react-query';
4
4
  import '@btst/stack/plugins/client';
5
5
  import '@btst/stack/plugins/api';
@@ -1,5 +1,5 @@
1
- export { B as BLOG_QUERY_KEYS, j as BlogApiContext, m as BlogApiRouter, k as BlogBackendHooks, h as BlogRouteKey, C as CreatePostInput, N as NextPreviousPostsQuerySchema, P as PostListParams, i as PostListQuerySchema, c as PostListResult, U as UpdatePostInput, l as blogBackendPlugin, f as createBlogQueryKeys, d as createPost, e as deletePost, g as getAllPosts, b as getAllTags, a as getPostBySlug, u as updatePost } from '../../../shared/stack.E17kSK1W.mjs';
2
- import { P as Post, T as Tag, S as SerializedPost, a as SerializedTag } from '../../../shared/stack.BWp0hcm9.mjs';
1
+ export { B as BLOG_QUERY_KEYS, j as BlogApiContext, m as BlogApiRouter, k as BlogBackendHooks, h as BlogRouteKey, C as CreatePostInput, N as NextPreviousPostsQuerySchema, P as PostListParams, i as PostListQuerySchema, c as PostListResult, U as UpdatePostInput, l as blogBackendPlugin, f as createBlogQueryKeys, d as createPost, e as deletePost, g as getAllPosts, b as getAllTags, a as getPostBySlug, u as updatePost } from '../../../shared/stack.C1jLzFZ6.mjs';
2
+ import { P as Post, T as Tag, S as SerializedPost, a as SerializedTag } from '../../../shared/stack.BQmuNl5p.mjs';
3
3
  import '@tanstack/react-query';
4
4
  import '@btst/stack/plugins/client';
5
5
  import '@btst/stack/plugins/api';
@@ -1,5 +1,5 @@
1
- export { B as BLOG_QUERY_KEYS, j as BlogApiContext, m as BlogApiRouter, k as BlogBackendHooks, h as BlogRouteKey, C as CreatePostInput, N as NextPreviousPostsQuerySchema, P as PostListParams, i as PostListQuerySchema, c as PostListResult, U as UpdatePostInput, l as blogBackendPlugin, f as createBlogQueryKeys, d as createPost, e as deletePost, g as getAllPosts, b as getAllTags, a as getPostBySlug, u as updatePost } from '../../../shared/stack.D0p6oNme.js';
2
- import { P as Post, T as Tag, S as SerializedPost, a as SerializedTag } from '../../../shared/stack.BWp0hcm9.js';
1
+ export { B as BLOG_QUERY_KEYS, j as BlogApiContext, m as BlogApiRouter, k as BlogBackendHooks, h as BlogRouteKey, C as CreatePostInput, N as NextPreviousPostsQuerySchema, P as PostListParams, i as PostListQuerySchema, c as PostListResult, U as UpdatePostInput, l as blogBackendPlugin, f as createBlogQueryKeys, d as createPost, e as deletePost, g as getAllPosts, b as getAllTags, a as getPostBySlug, u as updatePost } from '../../../shared/stack.DF1ewpVE.js';
2
+ import { P as Post, T as Tag, S as SerializedPost, a as SerializedTag } from '../../../shared/stack.BQmuNl5p.js';
3
3
  import '@tanstack/react-query';
4
4
  import '@btst/stack/plugins/client';
5
5
  import '@btst/stack/plugins/api';
@@ -1,6 +1,6 @@
1
- export { P as PostCreateInput, e as PostUpdateInput, o as UseNextPreviousPostsOptions, p as UseNextPreviousPostsResult, d as UsePostResult, b as UsePostSearchOptions, c as UsePostSearchResult, U as UsePostsOptions, a as UsePostsResult, r as UseRecentPostsOptions, s as UseRecentPostsResult, k as useCreatePost, m as useDeletePost, q as useNextPreviousPosts, g as usePost, n as usePostSearch, u as usePosts, t as useRecentPosts, h as useSuspensePost, f as useSuspensePosts, j as useSuspenseTags, i as useTags, l as useUpdatePost } from '../../../../shared/stack.DX-tQ93o.cjs';
1
+ export { P as PostCreateInput, e as PostUpdateInput, o as UseNextPreviousPostsOptions, p as UseNextPreviousPostsResult, d as UsePostResult, b as UsePostSearchOptions, c as UsePostSearchResult, U as UsePostsOptions, a as UsePostsResult, r as UseRecentPostsOptions, s as UseRecentPostsResult, k as useCreatePost, m as useDeletePost, q as useNextPreviousPosts, g as usePost, n as usePostSearch, u as usePosts, t as useRecentPosts, h as useSuspensePost, f as useSuspensePosts, j as useSuspenseTags, i as useTags, l as useUpdatePost } from '../../../../shared/stack.AJTXI7kw.cjs';
2
2
  import '@tanstack/react-query';
3
- import '../../../../shared/stack.BWp0hcm9.cjs';
3
+ import '../../../../shared/stack.BQmuNl5p.cjs';
4
4
  import 'zod';
5
5
 
6
6
  declare function useDebounce<T>(value: T, delay?: number): T;
@@ -1,6 +1,6 @@
1
- export { P as PostCreateInput, e as PostUpdateInput, o as UseNextPreviousPostsOptions, p as UseNextPreviousPostsResult, d as UsePostResult, b as UsePostSearchOptions, c as UsePostSearchResult, U as UsePostsOptions, a as UsePostsResult, r as UseRecentPostsOptions, s as UseRecentPostsResult, k as useCreatePost, m as useDeletePost, q as useNextPreviousPosts, g as usePost, n as usePostSearch, u as usePosts, t as useRecentPosts, h as useSuspensePost, f as useSuspensePosts, j as useSuspenseTags, i as useTags, l as useUpdatePost } from '../../../../shared/stack.DOZ1EXjM.mjs';
1
+ export { P as PostCreateInput, e as PostUpdateInput, o as UseNextPreviousPostsOptions, p as UseNextPreviousPostsResult, d as UsePostResult, b as UsePostSearchOptions, c as UsePostSearchResult, U as UsePostsOptions, a as UsePostsResult, r as UseRecentPostsOptions, s as UseRecentPostsResult, k as useCreatePost, m as useDeletePost, q as useNextPreviousPosts, g as usePost, n as usePostSearch, u as usePosts, t as useRecentPosts, h as useSuspensePost, f as useSuspensePosts, j as useSuspenseTags, i as useTags, l as useUpdatePost } from '../../../../shared/stack.6mEHS2WH.mjs';
2
2
  import '@tanstack/react-query';
3
- import '../../../../shared/stack.BWp0hcm9.mjs';
3
+ import '../../../../shared/stack.BQmuNl5p.mjs';
4
4
  import 'zod';
5
5
 
6
6
  declare function useDebounce<T>(value: T, delay?: number): T;
@@ -1,6 +1,6 @@
1
- export { P as PostCreateInput, e as PostUpdateInput, o as UseNextPreviousPostsOptions, p as UseNextPreviousPostsResult, d as UsePostResult, b as UsePostSearchOptions, c as UsePostSearchResult, U as UsePostsOptions, a as UsePostsResult, r as UseRecentPostsOptions, s as UseRecentPostsResult, k as useCreatePost, m as useDeletePost, q as useNextPreviousPosts, g as usePost, n as usePostSearch, u as usePosts, t as useRecentPosts, h as useSuspensePost, f as useSuspensePosts, j as useSuspenseTags, i as useTags, l as useUpdatePost } from '../../../../shared/stack.VF6FhyZw.js';
1
+ export { P as PostCreateInput, e as PostUpdateInput, o as UseNextPreviousPostsOptions, p as UseNextPreviousPostsResult, d as UsePostResult, b as UsePostSearchOptions, c as UsePostSearchResult, U as UsePostsOptions, a as UsePostsResult, r as UseRecentPostsOptions, s as UseRecentPostsResult, k as useCreatePost, m as useDeletePost, q as useNextPreviousPosts, g as usePost, n as usePostSearch, u as usePosts, t as useRecentPosts, h as useSuspensePost, f as useSuspensePosts, j as useSuspenseTags, i as useTags, l as useUpdatePost } from '../../../../shared/stack.QYn-Px94.js';
2
2
  import '@tanstack/react-query';
3
- import '../../../../shared/stack.BWp0hcm9.js';
3
+ import '../../../../shared/stack.BQmuNl5p.js';
4
4
  import 'zod';
5
5
 
6
6
  declare function useDebounce<T>(value: T, delay?: number): T;
@@ -2,8 +2,8 @@ import * as _btst_stack_plugins_client from '@btst/stack/plugins/client';
2
2
  import * as _btst_yar from '@btst/yar';
3
3
  import { ComponentType, ReactNode } from 'react';
4
4
  import { QueryClient } from '@tanstack/react-query';
5
- import { P as Post, S as SerializedPost } from '../../../shared/stack.BWp0hcm9.cjs';
6
- export { U as UsePostsOptions, a as UsePostsResult } from '../../../shared/stack.DX-tQ93o.cjs';
5
+ import { P as Post, S as SerializedPost } from '../../../shared/stack.BQmuNl5p.cjs';
6
+ export { U as UsePostsOptions, a as UsePostsResult } from '../../../shared/stack.AJTXI7kw.cjs';
7
7
  import 'zod';
8
8
 
9
9
  /**
@@ -2,8 +2,8 @@ import * as _btst_stack_plugins_client from '@btst/stack/plugins/client';
2
2
  import * as _btst_yar from '@btst/yar';
3
3
  import { ComponentType, ReactNode } from 'react';
4
4
  import { QueryClient } from '@tanstack/react-query';
5
- import { P as Post, S as SerializedPost } from '../../../shared/stack.BWp0hcm9.mjs';
6
- export { U as UsePostsOptions, a as UsePostsResult } from '../../../shared/stack.DOZ1EXjM.mjs';
5
+ import { P as Post, S as SerializedPost } from '../../../shared/stack.BQmuNl5p.mjs';
6
+ export { U as UsePostsOptions, a as UsePostsResult } from '../../../shared/stack.6mEHS2WH.mjs';
7
7
  import 'zod';
8
8
 
9
9
  /**
@@ -2,8 +2,8 @@ import * as _btst_stack_plugins_client from '@btst/stack/plugins/client';
2
2
  import * as _btst_yar from '@btst/yar';
3
3
  import { ComponentType, ReactNode } from 'react';
4
4
  import { QueryClient } from '@tanstack/react-query';
5
- import { P as Post, S as SerializedPost } from '../../../shared/stack.BWp0hcm9.js';
6
- export { U as UsePostsOptions, a as UsePostsResult } from '../../../shared/stack.VF6FhyZw.js';
5
+ import { P as Post, S as SerializedPost } from '../../../shared/stack.BQmuNl5p.js';
6
+ export { U as UsePostsOptions, a as UsePostsResult } from '../../../shared/stack.QYn-Px94.js';
7
7
  import 'zod';
8
8
 
9
9
  /**
@@ -1,7 +1,7 @@
1
1
  import '@tanstack/react-query';
2
- export { f as createBlogQueryKeys } from '../../shared/stack.DWipT53I.cjs';
2
+ export { f as createBlogQueryKeys } from '../../shared/stack.XulPeAD3.cjs';
3
3
  import '@btst/stack/plugins/client';
4
- import '../../shared/stack.BWp0hcm9.cjs';
4
+ import '../../shared/stack.BQmuNl5p.cjs';
5
5
  import '@btst/stack/plugins/api';
6
6
  import '@btst/db';
7
7
  import 'better-call';
@@ -1,7 +1,7 @@
1
1
  import '@tanstack/react-query';
2
- export { f as createBlogQueryKeys } from '../../shared/stack.E17kSK1W.mjs';
2
+ export { f as createBlogQueryKeys } from '../../shared/stack.C1jLzFZ6.mjs';
3
3
  import '@btst/stack/plugins/client';
4
- import '../../shared/stack.BWp0hcm9.mjs';
4
+ import '../../shared/stack.BQmuNl5p.mjs';
5
5
  import '@btst/stack/plugins/api';
6
6
  import '@btst/db';
7
7
  import 'better-call';
@@ -1,7 +1,7 @@
1
1
  import '@tanstack/react-query';
2
- export { f as createBlogQueryKeys } from '../../shared/stack.D0p6oNme.js';
2
+ export { f as createBlogQueryKeys } from '../../shared/stack.DF1ewpVE.js';
3
3
  import '@btst/stack/plugins/client';
4
- import '../../shared/stack.BWp0hcm9.js';
4
+ import '../../shared/stack.BQmuNl5p.js';
5
5
  import '@btst/stack/plugins/api';
6
6
  import '@btst/db';
7
7
  import 'better-call';
@@ -1,4 +1,4 @@
1
- export { C as CMSApiRouter, b as CMSRouteKey, l as CMS_QUERY_KEYS, k as CreateCMSContentItemInput, c as cmsBackendPlugin, j as createCMSContentItem, d as getAllContentItems, g as getAllContentTypes, f as getContentItemById, e as getContentItemBySlug, h as serializeContentItem, i as serializeContentItemWithType, s as serializeContentType } from '../../../shared/stack.C9zoS1TN.cjs';
1
+ export { C as CMSApiRouter, b as CMSRouteKey, m as CMS_QUERY_KEYS, k as CreateCMSContentItemInput, l as CreateCMSContentItemOptions, c as cmsBackendPlugin, j as createCMSContentItem, d as getAllContentItems, g as getAllContentTypes, f as getContentItemById, e as getContentItemBySlug, h as serializeContentItem, i as serializeContentItemWithType, s as serializeContentType } from '../../../shared/stack.r6HohbyX.cjs';
2
2
  import '@btst/stack/plugins/api';
3
3
  import '../../../shared/stack.B8QD11QU.cjs';
4
4
  import 'zod';
@@ -1,4 +1,4 @@
1
- export { C as CMSApiRouter, b as CMSRouteKey, l as CMS_QUERY_KEYS, k as CreateCMSContentItemInput, c as cmsBackendPlugin, j as createCMSContentItem, d as getAllContentItems, g as getAllContentTypes, f as getContentItemById, e as getContentItemBySlug, h as serializeContentItem, i as serializeContentItemWithType, s as serializeContentType } from '../../../shared/stack.BX7MHi0J.mjs';
1
+ export { C as CMSApiRouter, b as CMSRouteKey, m as CMS_QUERY_KEYS, k as CreateCMSContentItemInput, l as CreateCMSContentItemOptions, c as cmsBackendPlugin, j as createCMSContentItem, d as getAllContentItems, g as getAllContentTypes, f as getContentItemById, e as getContentItemBySlug, h as serializeContentItem, i as serializeContentItemWithType, s as serializeContentType } from '../../../shared/stack.DbnCLdNF.mjs';
2
2
  import '@btst/stack/plugins/api';
3
3
  import '../../../shared/stack.B8QD11QU.mjs';
4
4
  import 'zod';
@@ -1,4 +1,4 @@
1
- export { C as CMSApiRouter, b as CMSRouteKey, l as CMS_QUERY_KEYS, k as CreateCMSContentItemInput, c as cmsBackendPlugin, j as createCMSContentItem, d as getAllContentItems, g as getAllContentTypes, f as getContentItemById, e as getContentItemBySlug, h as serializeContentItem, i as serializeContentItemWithType, s as serializeContentType } from '../../../shared/stack.fQjVhw5a.js';
1
+ export { C as CMSApiRouter, b as CMSRouteKey, m as CMS_QUERY_KEYS, k as CreateCMSContentItemInput, l as CreateCMSContentItemOptions, c as cmsBackendPlugin, j as createCMSContentItem, d as getAllContentItems, g as getAllContentTypes, f as getContentItemById, e as getContentItemBySlug, h as serializeContentItem, i as serializeContentItemWithType, s as serializeContentType } from '../../../shared/stack.fXlShnhv.js';
2
2
  import '@btst/stack/plugins/api';
3
3
  import '../../../shared/stack.B8QD11QU.js';
4
4
  import 'zod';
@@ -1,4 +1,4 @@
1
- import { C as CMSApiRouter, a as ContentListDiscriminator } from '../../shared/stack.C9zoS1TN.cjs';
1
+ import { C as CMSApiRouter, a as ContentListDiscriminator } from '../../shared/stack.r6HohbyX.cjs';
2
2
  import * as _tanstack_react_query from '@tanstack/react-query';
3
3
  import { createApiClient } from '@btst/stack/plugins/client';
4
4
  import { S as SerializedContentType, P as PaginatedContentItems, a as SerializedContentItemWithType } from '../../shared/stack.B8QD11QU.cjs';
@@ -1,4 +1,4 @@
1
- import { C as CMSApiRouter, a as ContentListDiscriminator } from '../../shared/stack.BX7MHi0J.mjs';
1
+ import { C as CMSApiRouter, a as ContentListDiscriminator } from '../../shared/stack.DbnCLdNF.mjs';
2
2
  import * as _tanstack_react_query from '@tanstack/react-query';
3
3
  import { createApiClient } from '@btst/stack/plugins/client';
4
4
  import { S as SerializedContentType, P as PaginatedContentItems, a as SerializedContentItemWithType } from '../../shared/stack.B8QD11QU.mjs';
@@ -1,4 +1,4 @@
1
- import { C as CMSApiRouter, a as ContentListDiscriminator } from '../../shared/stack.fQjVhw5a.js';
1
+ import { C as CMSApiRouter, a as ContentListDiscriminator } from '../../shared/stack.fXlShnhv.js';
2
2
  import * as _tanstack_react_query from '@tanstack/react-query';
3
3
  import { createApiClient } from '@btst/stack/plugins/client';
4
4
  import { S as SerializedContentType, P as PaginatedContentItems, a as SerializedContentItemWithType } from '../../shared/stack.B8QD11QU.js';
@@ -1,5 +1,5 @@
1
1
  import * as _tanstack_react_query from '@tanstack/react-query';
2
- import { S as SerializedPost, c as createPostSchema, u as updatePostSchema, a as SerializedTag } from './stack.BWp0hcm9.mjs';
2
+ import { S as SerializedPost, c as createPostSchema, u as updatePostSchema, a as SerializedTag } from './stack.BQmuNl5p.mjs';
3
3
  import { z } from 'zod';
4
4
 
5
5
  /**
@@ -135,14 +135,14 @@ declare function useCreatePost(): _tanstack_react_query.UseMutationResult<Serial
135
135
  name: string;
136
136
  slug: string;
137
137
  })[];
138
- published: boolean;
139
138
  title: string;
140
139
  content: string;
141
140
  excerpt: string;
141
+ published: boolean;
142
142
  slug?: string | undefined;
143
- publishedAt?: Date | undefined;
144
143
  createdAt?: Date | undefined;
145
144
  updatedAt?: Date | undefined;
145
+ publishedAt?: Date | undefined;
146
146
  image?: string | undefined;
147
147
  }, unknown>;
148
148
  /** Update an existing post by id */
@@ -1,5 +1,5 @@
1
1
  import * as _tanstack_react_query from '@tanstack/react-query';
2
- import { S as SerializedPost, c as createPostSchema, u as updatePostSchema, a as SerializedTag } from './stack.BWp0hcm9.cjs';
2
+ import { S as SerializedPost, c as createPostSchema, u as updatePostSchema, a as SerializedTag } from './stack.BQmuNl5p.cjs';
3
3
  import { z } from 'zod';
4
4
 
5
5
  /**
@@ -135,14 +135,14 @@ declare function useCreatePost(): _tanstack_react_query.UseMutationResult<Serial
135
135
  name: string;
136
136
  slug: string;
137
137
  })[];
138
- published: boolean;
139
138
  title: string;
140
139
  content: string;
141
140
  excerpt: string;
141
+ published: boolean;
142
142
  slug?: string | undefined;
143
- publishedAt?: Date | undefined;
144
143
  createdAt?: Date | undefined;
145
144
  updatedAt?: Date | undefined;
145
+ publishedAt?: Date | undefined;
146
146
  image?: string | undefined;
147
147
  }, unknown>;
148
148
  /** Update an existing post by id */