@btst/stack 1.2.1 → 1.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.
- package/dist/packages/better-stack/src/plugins/blog/api/plugin.cjs +117 -137
- package/dist/packages/better-stack/src/plugins/blog/api/plugin.mjs +117 -137
- package/dist/packages/better-stack/src/plugins/blog/client/plugin.cjs +10 -0
- package/dist/packages/better-stack/src/plugins/blog/client/plugin.mjs +10 -0
- package/dist/packages/better-stack/src/plugins/blog/db.cjs +12 -2
- package/dist/packages/better-stack/src/plugins/blog/db.mjs +12 -2
- package/dist/plugins/blog/api/index.d.cts +1 -1
- package/dist/plugins/blog/api/index.d.mts +1 -1
- package/dist/plugins/blog/api/index.d.ts +1 -1
- package/dist/plugins/blog/client/hooks/index.d.cts +2 -2
- package/dist/plugins/blog/client/hooks/index.d.mts +2 -2
- package/dist/plugins/blog/client/hooks/index.d.ts +2 -2
- package/dist/plugins/blog/client/index.d.cts +1 -1
- package/dist/plugins/blog/client/index.d.mts +1 -1
- package/dist/plugins/blog/client/index.d.ts +1 -1
- package/dist/plugins/blog/query-keys.d.cts +5 -5
- package/dist/plugins/blog/query-keys.d.mts +5 -5
- package/dist/plugins/blog/query-keys.d.ts +5 -5
- package/package.json +3 -3
- package/src/plugins/blog/api/plugin.ts +139 -190
- package/src/plugins/blog/client/plugin.tsx +12 -0
- package/src/plugins/blog/db.ts +10 -0
- package/src/plugins/blog/types.ts +7 -0
- package/dist/shared/{stack.Cr2JoQdo.d.cts → stack.DLhzx1-D.d.cts} +2 -2
- package/dist/shared/{stack.Cr2JoQdo.d.mts → stack.DLhzx1-D.d.mts} +2 -2
- package/dist/shared/{stack.Cr2JoQdo.d.ts → stack.DLhzx1-D.d.ts} +2 -2
|
@@ -24,53 +24,7 @@ const blogBackendPlugin = (hooks) => defineBackendPlugin({
|
|
|
24
24
|
name: "blog",
|
|
25
25
|
dbPlugin: blogSchema,
|
|
26
26
|
routes: (adapter) => {
|
|
27
|
-
const
|
|
28
|
-
let cache = null;
|
|
29
|
-
return {
|
|
30
|
-
getAllTags: async () => {
|
|
31
|
-
if (!cache) {
|
|
32
|
-
cache = await adapter.findMany({
|
|
33
|
-
model: "tag"
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
return cache;
|
|
37
|
-
},
|
|
38
|
-
invalidate: () => {
|
|
39
|
-
cache = null;
|
|
40
|
-
},
|
|
41
|
-
addTag: (tag) => {
|
|
42
|
-
if (cache) {
|
|
43
|
-
cache.push(tag);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
};
|
|
48
|
-
const createPostTagCache = () => {
|
|
49
|
-
let cache = null;
|
|
50
|
-
const getAllPostTags = async () => {
|
|
51
|
-
if (!cache) {
|
|
52
|
-
cache = await adapter.findMany({
|
|
53
|
-
model: "postTag"
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
return cache;
|
|
57
|
-
};
|
|
58
|
-
return {
|
|
59
|
-
getAllPostTags,
|
|
60
|
-
invalidate: () => {
|
|
61
|
-
cache = null;
|
|
62
|
-
},
|
|
63
|
-
getByTagId: async (tagId) => {
|
|
64
|
-
const allPostTags = await getAllPostTags();
|
|
65
|
-
return allPostTags.filter((pt) => pt.tagId === tagId);
|
|
66
|
-
},
|
|
67
|
-
getByPostId: async (postId) => {
|
|
68
|
-
const allPostTags = await getAllPostTags();
|
|
69
|
-
return allPostTags.filter((pt) => pt.postId === postId);
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
};
|
|
73
|
-
const findOrCreateTags = async (tagInputs, tagCache) => {
|
|
27
|
+
const findOrCreateTags = async (tagInputs) => {
|
|
74
28
|
if (tagInputs.length === 0) return [];
|
|
75
29
|
const normalizeTagName = (name) => {
|
|
76
30
|
return name.trim();
|
|
@@ -93,7 +47,9 @@ const blogBackendPlugin = (hooks) => defineBackendPlugin({
|
|
|
93
47
|
if (tagsToFindOrCreate.length === 0) {
|
|
94
48
|
return tagsWithIds;
|
|
95
49
|
}
|
|
96
|
-
const allTags = await
|
|
50
|
+
const allTags = await adapter.findMany({
|
|
51
|
+
model: "tag"
|
|
52
|
+
});
|
|
97
53
|
const tagMapBySlug = /* @__PURE__ */ new Map();
|
|
98
54
|
for (const tag of allTags) {
|
|
99
55
|
tagMapBySlug.set(tag.slug, tag);
|
|
@@ -126,33 +82,9 @@ const blogBackendPlugin = (hooks) => defineBackendPlugin({
|
|
|
126
82
|
}
|
|
127
83
|
});
|
|
128
84
|
createdTags.push(newTag);
|
|
129
|
-
tagCache.addTag(newTag);
|
|
130
85
|
}
|
|
131
86
|
return [...tagsWithIds, ...foundTags, ...createdTags];
|
|
132
87
|
};
|
|
133
|
-
const loadTagsForPosts = async (postIds, tagCache, postTagCache) => {
|
|
134
|
-
if (postIds.length === 0) return /* @__PURE__ */ new Map();
|
|
135
|
-
const allPostTags = await postTagCache.getAllPostTags();
|
|
136
|
-
const relevantPostTags = allPostTags.filter(
|
|
137
|
-
(pt) => postIds.includes(pt.postId)
|
|
138
|
-
);
|
|
139
|
-
const tagIds = [...new Set(relevantPostTags.map((pt) => pt.tagId))];
|
|
140
|
-
if (tagIds.length === 0) return /* @__PURE__ */ new Map();
|
|
141
|
-
const allTags = await tagCache.getAllTags();
|
|
142
|
-
const tagMap = /* @__PURE__ */ new Map();
|
|
143
|
-
for (const tag of allTags) {
|
|
144
|
-
tagMap.set(tag.id, tag);
|
|
145
|
-
}
|
|
146
|
-
const postTagsMap = /* @__PURE__ */ new Map();
|
|
147
|
-
for (const postTag of relevantPostTags) {
|
|
148
|
-
const tag = tagMap.get(postTag.tagId);
|
|
149
|
-
if (tag) {
|
|
150
|
-
const existing = postTagsMap.get(postTag.postId) || [];
|
|
151
|
-
postTagsMap.set(postTag.postId, [...existing, { ...tag }]);
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
return postTagsMap;
|
|
155
|
-
};
|
|
156
88
|
const listPosts = createEndpoint(
|
|
157
89
|
"/posts",
|
|
158
90
|
{
|
|
@@ -162,8 +94,6 @@ const blogBackendPlugin = (hooks) => defineBackendPlugin({
|
|
|
162
94
|
async (ctx) => {
|
|
163
95
|
const { query, headers } = ctx;
|
|
164
96
|
const context = { query, headers };
|
|
165
|
-
const tagCache = createTagCache();
|
|
166
|
-
const postTagCache = createPostTagCache();
|
|
167
97
|
try {
|
|
168
98
|
if (hooks?.onBeforeListPosts) {
|
|
169
99
|
const canList = await hooks.onBeforeListPosts(query, context);
|
|
@@ -175,12 +105,29 @@ const blogBackendPlugin = (hooks) => defineBackendPlugin({
|
|
|
175
105
|
}
|
|
176
106
|
let tagFilterPostIds = null;
|
|
177
107
|
if (query.tagSlug) {
|
|
178
|
-
const
|
|
179
|
-
|
|
108
|
+
const tag = await adapter.findOne({
|
|
109
|
+
model: "tag",
|
|
110
|
+
where: [
|
|
111
|
+
{
|
|
112
|
+
field: "slug",
|
|
113
|
+
value: query.tagSlug,
|
|
114
|
+
operator: "eq"
|
|
115
|
+
}
|
|
116
|
+
]
|
|
117
|
+
});
|
|
180
118
|
if (!tag) {
|
|
181
119
|
return [];
|
|
182
120
|
}
|
|
183
|
-
const postTags = await
|
|
121
|
+
const postTags = await adapter.findMany({
|
|
122
|
+
model: "postTag",
|
|
123
|
+
where: [
|
|
124
|
+
{
|
|
125
|
+
field: "tagId",
|
|
126
|
+
value: tag.id,
|
|
127
|
+
operator: "eq"
|
|
128
|
+
}
|
|
129
|
+
]
|
|
130
|
+
});
|
|
184
131
|
tagFilterPostIds = new Set(postTags.map((pt) => pt.postId));
|
|
185
132
|
if (tagFilterPostIds.size === 0) {
|
|
186
133
|
return [];
|
|
@@ -209,17 +156,36 @@ const blogBackendPlugin = (hooks) => defineBackendPlugin({
|
|
|
209
156
|
sortBy: {
|
|
210
157
|
field: "createdAt",
|
|
211
158
|
direction: "desc"
|
|
159
|
+
},
|
|
160
|
+
join: {
|
|
161
|
+
postTag: true
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
const tagIds = /* @__PURE__ */ new Set();
|
|
165
|
+
for (const post of posts) {
|
|
166
|
+
if (post.postTag) {
|
|
167
|
+
for (const pt of post.postTag) {
|
|
168
|
+
tagIds.add(pt.tagId);
|
|
169
|
+
}
|
|
212
170
|
}
|
|
171
|
+
}
|
|
172
|
+
const tags = tagIds.size > 0 ? await adapter.findMany({
|
|
173
|
+
model: "tag"
|
|
174
|
+
}) : [];
|
|
175
|
+
const tagMap = /* @__PURE__ */ new Map();
|
|
176
|
+
for (const tag of tags) {
|
|
177
|
+
if (tagIds.has(tag.id)) {
|
|
178
|
+
tagMap.set(tag.id, tag);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
let result = posts.map((post) => {
|
|
182
|
+
const postTags = (post.postTag || []).map((pt) => tagMap.get(pt.tagId)).filter((tag) => tag !== void 0);
|
|
183
|
+
const { postTag: _, ...postWithoutJoin } = post;
|
|
184
|
+
return {
|
|
185
|
+
...postWithoutJoin,
|
|
186
|
+
tags: postTags
|
|
187
|
+
};
|
|
213
188
|
});
|
|
214
|
-
const postTagsMap = await loadTagsForPosts(
|
|
215
|
-
posts.map((post) => post.id),
|
|
216
|
-
tagCache,
|
|
217
|
-
postTagCache
|
|
218
|
-
);
|
|
219
|
-
let result = posts.map((post) => ({
|
|
220
|
-
...post,
|
|
221
|
-
tags: postTagsMap.get(post.id) || []
|
|
222
|
-
}));
|
|
223
189
|
if (tagFilterPostIds) {
|
|
224
190
|
result = result.filter((post) => tagFilterPostIds.has(post.id));
|
|
225
191
|
}
|
|
@@ -260,7 +226,6 @@ const blogBackendPlugin = (hooks) => defineBackendPlugin({
|
|
|
260
226
|
body: ctx.body,
|
|
261
227
|
headers: ctx.headers
|
|
262
228
|
};
|
|
263
|
-
const tagCache = createTagCache();
|
|
264
229
|
try {
|
|
265
230
|
if (hooks?.onBeforeCreatePost) {
|
|
266
231
|
const canCreate = await hooks.onBeforeCreatePost(
|
|
@@ -286,7 +251,7 @@ const blogBackendPlugin = (hooks) => defineBackendPlugin({
|
|
|
286
251
|
}
|
|
287
252
|
});
|
|
288
253
|
if (tagNames.length > 0) {
|
|
289
|
-
const createdTags = await findOrCreateTags(tagNames
|
|
254
|
+
const createdTags = await findOrCreateTags(tagNames);
|
|
290
255
|
await adapter.transaction(async (tx) => {
|
|
291
256
|
for (const tag of createdTags) {
|
|
292
257
|
await tx.create({
|
|
@@ -326,7 +291,6 @@ const blogBackendPlugin = (hooks) => defineBackendPlugin({
|
|
|
326
291
|
params: ctx.params,
|
|
327
292
|
headers: ctx.headers
|
|
328
293
|
};
|
|
329
|
-
const tagCache = createTagCache();
|
|
330
294
|
try {
|
|
331
295
|
if (hooks?.onBeforeUpdatePost) {
|
|
332
296
|
const canUpdate = await hooks.onBeforeUpdatePost(
|
|
@@ -384,7 +348,7 @@ const blogBackendPlugin = (hooks) => defineBackendPlugin({
|
|
|
384
348
|
});
|
|
385
349
|
}
|
|
386
350
|
if (tagNames.length > 0) {
|
|
387
|
-
const createdTags = await findOrCreateTags(tagNames
|
|
351
|
+
const createdTags = await findOrCreateTags(tagNames);
|
|
388
352
|
for (const tag of createdTags) {
|
|
389
353
|
await tx.create({
|
|
390
354
|
model: "postTag",
|
|
@@ -434,15 +398,9 @@ const blogBackendPlugin = (hooks) => defineBackendPlugin({
|
|
|
434
398
|
});
|
|
435
399
|
}
|
|
436
400
|
}
|
|
437
|
-
await adapter.
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
where: [{ field: "postId", value: ctx.params.id }]
|
|
441
|
-
});
|
|
442
|
-
await tx.delete({
|
|
443
|
-
model: "post",
|
|
444
|
-
where: [{ field: "id", value: ctx.params.id }]
|
|
445
|
-
});
|
|
401
|
+
await adapter.delete({
|
|
402
|
+
model: "post",
|
|
403
|
+
where: [{ field: "id", value: ctx.params.id }]
|
|
446
404
|
});
|
|
447
405
|
if (hooks?.onPostDeleted) {
|
|
448
406
|
await hooks.onPostDeleted(ctx.params.id, context);
|
|
@@ -465,8 +423,6 @@ const blogBackendPlugin = (hooks) => defineBackendPlugin({
|
|
|
465
423
|
async (ctx) => {
|
|
466
424
|
const { query, headers } = ctx;
|
|
467
425
|
const context = { query, headers };
|
|
468
|
-
const tagCache = createTagCache();
|
|
469
|
-
const postTagCache = createPostTagCache();
|
|
470
426
|
try {
|
|
471
427
|
if (hooks?.onBeforeListPosts) {
|
|
472
428
|
const canList = await hooks.onBeforeListPosts(
|
|
@@ -480,12 +436,15 @@ const blogBackendPlugin = (hooks) => defineBackendPlugin({
|
|
|
480
436
|
}
|
|
481
437
|
}
|
|
482
438
|
const date = query.date;
|
|
483
|
-
const
|
|
484
|
-
const WINDOW_SIZE = 100;
|
|
485
|
-
const allPosts = await adapter.findMany({
|
|
439
|
+
const previousPosts = await adapter.findMany({
|
|
486
440
|
model: "post",
|
|
487
|
-
limit:
|
|
441
|
+
limit: 1,
|
|
488
442
|
where: [
|
|
443
|
+
{
|
|
444
|
+
field: "createdAt",
|
|
445
|
+
value: date,
|
|
446
|
+
operator: "lt"
|
|
447
|
+
},
|
|
489
448
|
{
|
|
490
449
|
field: "published",
|
|
491
450
|
value: true,
|
|
@@ -495,44 +454,65 @@ const blogBackendPlugin = (hooks) => defineBackendPlugin({
|
|
|
495
454
|
sortBy: {
|
|
496
455
|
field: "createdAt",
|
|
497
456
|
direction: "desc"
|
|
457
|
+
},
|
|
458
|
+
join: {
|
|
459
|
+
postTag: true
|
|
498
460
|
}
|
|
499
461
|
});
|
|
500
|
-
const
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
462
|
+
const nextPosts = await adapter.findMany({
|
|
463
|
+
model: "post",
|
|
464
|
+
limit: 1,
|
|
465
|
+
where: [
|
|
466
|
+
{
|
|
467
|
+
field: "createdAt",
|
|
468
|
+
value: date,
|
|
469
|
+
operator: "gt"
|
|
470
|
+
},
|
|
471
|
+
{
|
|
472
|
+
field: "published",
|
|
473
|
+
value: true,
|
|
474
|
+
operator: "eq"
|
|
475
|
+
}
|
|
476
|
+
],
|
|
477
|
+
sortBy: {
|
|
478
|
+
field: "createdAt",
|
|
479
|
+
direction: "asc"
|
|
480
|
+
},
|
|
481
|
+
join: {
|
|
482
|
+
postTag: true
|
|
483
|
+
}
|
|
504
484
|
});
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
for (
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
485
|
+
const tagIds = /* @__PURE__ */ new Set();
|
|
486
|
+
const allPosts = [...previousPosts, ...nextPosts];
|
|
487
|
+
for (const post of allPosts) {
|
|
488
|
+
if (post.postTag) {
|
|
489
|
+
for (const pt of post.postTag) {
|
|
490
|
+
tagIds.add(pt.tagId);
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
const tagMap = /* @__PURE__ */ new Map();
|
|
495
|
+
if (tagIds.size > 0) {
|
|
496
|
+
const tags = await adapter.findMany({
|
|
497
|
+
model: "tag"
|
|
498
|
+
});
|
|
499
|
+
for (const tag of tags) {
|
|
500
|
+
if (tagIds.has(tag.id)) {
|
|
501
|
+
tagMap.set(tag.id, tag);
|
|
502
|
+
}
|
|
516
503
|
}
|
|
517
504
|
}
|
|
518
|
-
const
|
|
519
|
-
|
|
520
|
-
...
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
);
|
|
505
|
+
const mapPostWithTags = (post) => {
|
|
506
|
+
const tags = (post.postTag || []).map((pt) => tagMap.get(pt.tagId)).filter((tag) => tag !== void 0);
|
|
507
|
+
const { postTag: _, ...postWithoutJoin } = post;
|
|
508
|
+
return {
|
|
509
|
+
...postWithoutJoin,
|
|
510
|
+
tags
|
|
511
|
+
};
|
|
512
|
+
};
|
|
527
513
|
return {
|
|
528
|
-
previous:
|
|
529
|
-
|
|
530
|
-
tags: postTagsMap.get(previousPost.id) || []
|
|
531
|
-
} : null,
|
|
532
|
-
next: nextPost ? {
|
|
533
|
-
...nextPost,
|
|
534
|
-
tags: postTagsMap.get(nextPost.id) || []
|
|
535
|
-
} : null
|
|
514
|
+
previous: previousPosts[0] ? mapPostWithTags(previousPosts[0]) : null,
|
|
515
|
+
next: nextPosts[0] ? mapPostWithTags(nextPosts[0]) : null
|
|
536
516
|
};
|
|
537
517
|
} catch (error) {
|
|
538
518
|
if (hooks?.onListPostsError) {
|
|
@@ -477,6 +477,10 @@ const blogClientPlugin = (config) => client.defineClientPlugin({
|
|
|
477
477
|
if (page.length < limit) break;
|
|
478
478
|
offset += limit;
|
|
479
479
|
}
|
|
480
|
+
const tagsRes = await client$1("/tags", {
|
|
481
|
+
method: "GET"
|
|
482
|
+
});
|
|
483
|
+
const tags = tagsRes.data ?? [];
|
|
480
484
|
const getLastModified = (p) => {
|
|
481
485
|
const dates = [p.updatedAt, p.publishedAt, p.createdAt].filter(
|
|
482
486
|
Boolean
|
|
@@ -499,6 +503,12 @@ const blogClientPlugin = (config) => client.defineClientPlugin({
|
|
|
499
503
|
lastModified: getLastModified(p),
|
|
500
504
|
changeFrequency: "monthly",
|
|
501
505
|
priority: 0.6
|
|
506
|
+
})),
|
|
507
|
+
...tags.map((t) => ({
|
|
508
|
+
url: `${origin}/blog/tag/${t.slug}`,
|
|
509
|
+
lastModified: t.updatedAt ? new Date(t.updatedAt) : void 0,
|
|
510
|
+
changeFrequency: "weekly",
|
|
511
|
+
priority: 0.5
|
|
502
512
|
}))
|
|
503
513
|
];
|
|
504
514
|
return entries;
|
|
@@ -475,6 +475,10 @@ const blogClientPlugin = (config) => defineClientPlugin({
|
|
|
475
475
|
if (page.length < limit) break;
|
|
476
476
|
offset += limit;
|
|
477
477
|
}
|
|
478
|
+
const tagsRes = await client("/tags", {
|
|
479
|
+
method: "GET"
|
|
480
|
+
});
|
|
481
|
+
const tags = tagsRes.data ?? [];
|
|
478
482
|
const getLastModified = (p) => {
|
|
479
483
|
const dates = [p.updatedAt, p.publishedAt, p.createdAt].filter(
|
|
480
484
|
Boolean
|
|
@@ -497,6 +501,12 @@ const blogClientPlugin = (config) => defineClientPlugin({
|
|
|
497
501
|
lastModified: getLastModified(p),
|
|
498
502
|
changeFrequency: "monthly",
|
|
499
503
|
priority: 0.6
|
|
504
|
+
})),
|
|
505
|
+
...tags.map((t) => ({
|
|
506
|
+
url: `${origin}/blog/tag/${t.slug}`,
|
|
507
|
+
lastModified: t.updatedAt ? new Date(t.updatedAt) : void 0,
|
|
508
|
+
changeFrequency: "weekly",
|
|
509
|
+
priority: 0.5
|
|
500
510
|
}))
|
|
501
511
|
];
|
|
502
512
|
return entries;
|
|
@@ -77,11 +77,21 @@ const blogSchema = db.createDbPlugin("blog", {
|
|
|
77
77
|
fields: {
|
|
78
78
|
postId: {
|
|
79
79
|
type: "string",
|
|
80
|
-
required: true
|
|
80
|
+
required: true,
|
|
81
|
+
references: {
|
|
82
|
+
model: "post",
|
|
83
|
+
field: "id",
|
|
84
|
+
onDelete: "cascade"
|
|
85
|
+
}
|
|
81
86
|
},
|
|
82
87
|
tagId: {
|
|
83
88
|
type: "string",
|
|
84
|
-
required: true
|
|
89
|
+
required: true,
|
|
90
|
+
references: {
|
|
91
|
+
model: "tag",
|
|
92
|
+
field: "id",
|
|
93
|
+
onDelete: "cascade"
|
|
94
|
+
}
|
|
85
95
|
}
|
|
86
96
|
}
|
|
87
97
|
}
|
|
@@ -75,11 +75,21 @@ const blogSchema = createDbPlugin("blog", {
|
|
|
75
75
|
fields: {
|
|
76
76
|
postId: {
|
|
77
77
|
type: "string",
|
|
78
|
-
required: true
|
|
78
|
+
required: true,
|
|
79
|
+
references: {
|
|
80
|
+
model: "post",
|
|
81
|
+
field: "id",
|
|
82
|
+
onDelete: "cascade"
|
|
83
|
+
}
|
|
79
84
|
},
|
|
80
85
|
tagId: {
|
|
81
86
|
type: "string",
|
|
82
|
-
required: true
|
|
87
|
+
required: true,
|
|
88
|
+
references: {
|
|
89
|
+
model: "tag",
|
|
90
|
+
field: "id",
|
|
91
|
+
onDelete: "cascade"
|
|
92
|
+
}
|
|
83
93
|
}
|
|
84
94
|
}
|
|
85
95
|
}
|
|
@@ -2,6 +2,6 @@ export { B as BlogApiContext, c as BlogApiRouter, a as BlogBackendHooks, N as Ne
|
|
|
2
2
|
import '@btst/stack/plugins/api';
|
|
3
3
|
import 'better-call';
|
|
4
4
|
import 'zod';
|
|
5
|
-
import '../../../shared/stack.
|
|
5
|
+
import '../../../shared/stack.DLhzx1-D.cjs';
|
|
6
6
|
import '@tanstack/react-query';
|
|
7
7
|
import '@btst/stack/plugins/client';
|
|
@@ -2,6 +2,6 @@ export { B as BlogApiContext, c as BlogApiRouter, a as BlogBackendHooks, N as Ne
|
|
|
2
2
|
import '@btst/stack/plugins/api';
|
|
3
3
|
import 'better-call';
|
|
4
4
|
import 'zod';
|
|
5
|
-
import '../../../shared/stack.
|
|
5
|
+
import '../../../shared/stack.DLhzx1-D.mjs';
|
|
6
6
|
import '@tanstack/react-query';
|
|
7
7
|
import '@btst/stack/plugins/client';
|
|
@@ -2,6 +2,6 @@ export { B as BlogApiContext, c as BlogApiRouter, a as BlogBackendHooks, N as Ne
|
|
|
2
2
|
import '@btst/stack/plugins/api';
|
|
3
3
|
import 'better-call';
|
|
4
4
|
import 'zod';
|
|
5
|
-
import '../../../shared/stack.
|
|
5
|
+
import '../../../shared/stack.DLhzx1-D.js';
|
|
6
6
|
import '@tanstack/react-query';
|
|
7
7
|
import '@btst/stack/plugins/client';
|
|
@@ -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 '../../../../shared/stack.
|
|
2
|
+
import { S as SerializedPost, c as createPostSchema, u as updatePostSchema, a as SerializedTag } from '../../../../shared/stack.DLhzx1-D.cjs';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -141,9 +141,9 @@ declare function useCreatePost(): _tanstack_react_query.UseMutationResult<Serial
|
|
|
141
141
|
})[];
|
|
142
142
|
slug?: string | undefined;
|
|
143
143
|
createdAt?: Date | undefined;
|
|
144
|
+
image?: string | undefined;
|
|
144
145
|
publishedAt?: Date | undefined;
|
|
145
146
|
updatedAt?: Date | undefined;
|
|
146
|
-
image?: string | undefined;
|
|
147
147
|
}, unknown>;
|
|
148
148
|
/** Update an existing post by id */
|
|
149
149
|
declare function useUpdatePost(): _tanstack_react_query.UseMutationResult<SerializedPost | null, Error, {
|
|
@@ -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 '../../../../shared/stack.
|
|
2
|
+
import { S as SerializedPost, c as createPostSchema, u as updatePostSchema, a as SerializedTag } from '../../../../shared/stack.DLhzx1-D.mjs';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -141,9 +141,9 @@ declare function useCreatePost(): _tanstack_react_query.UseMutationResult<Serial
|
|
|
141
141
|
})[];
|
|
142
142
|
slug?: string | undefined;
|
|
143
143
|
createdAt?: Date | undefined;
|
|
144
|
+
image?: string | undefined;
|
|
144
145
|
publishedAt?: Date | undefined;
|
|
145
146
|
updatedAt?: Date | undefined;
|
|
146
|
-
image?: string | undefined;
|
|
147
147
|
}, unknown>;
|
|
148
148
|
/** Update an existing post by id */
|
|
149
149
|
declare function useUpdatePost(): _tanstack_react_query.UseMutationResult<SerializedPost | null, Error, {
|
|
@@ -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 '../../../../shared/stack.
|
|
2
|
+
import { S as SerializedPost, c as createPostSchema, u as updatePostSchema, a as SerializedTag } from '../../../../shared/stack.DLhzx1-D.js';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -141,9 +141,9 @@ declare function useCreatePost(): _tanstack_react_query.UseMutationResult<Serial
|
|
|
141
141
|
})[];
|
|
142
142
|
slug?: string | undefined;
|
|
143
143
|
createdAt?: Date | undefined;
|
|
144
|
+
image?: string | undefined;
|
|
144
145
|
publishedAt?: Date | undefined;
|
|
145
146
|
updatedAt?: Date | undefined;
|
|
146
|
-
image?: string | undefined;
|
|
147
147
|
}, unknown>;
|
|
148
148
|
/** Update an existing post by id */
|
|
149
149
|
declare function useUpdatePost(): _tanstack_react_query.UseMutationResult<SerializedPost | null, Error, {
|
|
@@ -3,7 +3,7 @@ import * as react from 'react';
|
|
|
3
3
|
import { ComponentType } from 'react';
|
|
4
4
|
import * as _btst_yar from '@btst/yar';
|
|
5
5
|
import { QueryClient } from '@tanstack/react-query';
|
|
6
|
-
import { P as Post, S as SerializedPost } from '../../../shared/stack.
|
|
6
|
+
import { P as Post, S as SerializedPost } from '../../../shared/stack.DLhzx1-D.cjs';
|
|
7
7
|
export { UsePostsOptions, UsePostsResult } from './hooks/index.cjs';
|
|
8
8
|
import 'zod';
|
|
9
9
|
|
|
@@ -3,7 +3,7 @@ import * as react from 'react';
|
|
|
3
3
|
import { ComponentType } from 'react';
|
|
4
4
|
import * as _btst_yar from '@btst/yar';
|
|
5
5
|
import { QueryClient } from '@tanstack/react-query';
|
|
6
|
-
import { P as Post, S as SerializedPost } from '../../../shared/stack.
|
|
6
|
+
import { P as Post, S as SerializedPost } from '../../../shared/stack.DLhzx1-D.mjs';
|
|
7
7
|
export { UsePostsOptions, UsePostsResult } from './hooks/index.mjs';
|
|
8
8
|
import 'zod';
|
|
9
9
|
|
|
@@ -3,7 +3,7 @@ import * as react from 'react';
|
|
|
3
3
|
import { ComponentType } from 'react';
|
|
4
4
|
import * as _btst_yar from '@btst/yar';
|
|
5
5
|
import { QueryClient } from '@tanstack/react-query';
|
|
6
|
-
import { P as Post, S as SerializedPost } from '../../../shared/stack.
|
|
6
|
+
import { P as Post, S as SerializedPost } from '../../../shared/stack.DLhzx1-D.js';
|
|
7
7
|
export { UsePostsOptions, UsePostsResult } from './hooks/index.js';
|
|
8
8
|
import 'zod';
|
|
9
9
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as _btst_stack_plugins_api from '@btst/stack/plugins/api';
|
|
2
2
|
import * as better_call from 'better-call';
|
|
3
3
|
import { z } from 'zod';
|
|
4
|
-
import { c as createPostSchema, u as updatePostSchema, P as Post, T as Tag, S as SerializedPost, a as SerializedTag } from '../../shared/stack.
|
|
4
|
+
import { c as createPostSchema, u as updatePostSchema, P as Post, T as Tag, S as SerializedPost, a as SerializedTag } from '../../shared/stack.DLhzx1-D.cjs';
|
|
5
5
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
6
6
|
import { createApiClient } from '@btst/stack/plugins/client';
|
|
7
7
|
|
|
@@ -199,8 +199,6 @@ declare const blogBackendPlugin: (hooks?: BlogBackendHooks) => _btst_stack_plugi
|
|
|
199
199
|
slug?: string | undefined;
|
|
200
200
|
published?: boolean | undefined;
|
|
201
201
|
createdAt?: unknown;
|
|
202
|
-
publishedAt?: unknown;
|
|
203
|
-
updatedAt?: unknown;
|
|
204
202
|
image?: string | undefined;
|
|
205
203
|
tags?: ({
|
|
206
204
|
name: string;
|
|
@@ -209,6 +207,8 @@ declare const blogBackendPlugin: (hooks?: BlogBackendHooks) => _btst_stack_plugi
|
|
|
209
207
|
name: string;
|
|
210
208
|
slug: string;
|
|
211
209
|
})[] | undefined;
|
|
210
|
+
publishedAt?: unknown;
|
|
211
|
+
updatedAt?: unknown;
|
|
212
212
|
};
|
|
213
213
|
} & {
|
|
214
214
|
method?: "POST" | undefined;
|
|
@@ -239,8 +239,6 @@ declare const blogBackendPlugin: (hooks?: BlogBackendHooks) => _btst_stack_plugi
|
|
|
239
239
|
slug: z.ZodOptional<z.ZodString>;
|
|
240
240
|
published: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
241
241
|
createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
242
|
-
publishedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
243
|
-
updatedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
244
242
|
content: z.ZodString;
|
|
245
243
|
excerpt: z.ZodString;
|
|
246
244
|
image: z.ZodOptional<z.ZodString>;
|
|
@@ -251,6 +249,8 @@ declare const blogBackendPlugin: (hooks?: BlogBackendHooks) => _btst_stack_plugi
|
|
|
251
249
|
name: z.ZodString;
|
|
252
250
|
slug: z.ZodString;
|
|
253
251
|
}, z.core.$strip>]>>>>;
|
|
252
|
+
publishedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
253
|
+
updatedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
254
254
|
}, z.core.$strip>;
|
|
255
255
|
};
|
|
256
256
|
path: "/posts";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as _btst_stack_plugins_api from '@btst/stack/plugins/api';
|
|
2
2
|
import * as better_call from 'better-call';
|
|
3
3
|
import { z } from 'zod';
|
|
4
|
-
import { c as createPostSchema, u as updatePostSchema, P as Post, T as Tag, S as SerializedPost, a as SerializedTag } from '../../shared/stack.
|
|
4
|
+
import { c as createPostSchema, u as updatePostSchema, P as Post, T as Tag, S as SerializedPost, a as SerializedTag } from '../../shared/stack.DLhzx1-D.mjs';
|
|
5
5
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
6
6
|
import { createApiClient } from '@btst/stack/plugins/client';
|
|
7
7
|
|
|
@@ -199,8 +199,6 @@ declare const blogBackendPlugin: (hooks?: BlogBackendHooks) => _btst_stack_plugi
|
|
|
199
199
|
slug?: string | undefined;
|
|
200
200
|
published?: boolean | undefined;
|
|
201
201
|
createdAt?: unknown;
|
|
202
|
-
publishedAt?: unknown;
|
|
203
|
-
updatedAt?: unknown;
|
|
204
202
|
image?: string | undefined;
|
|
205
203
|
tags?: ({
|
|
206
204
|
name: string;
|
|
@@ -209,6 +207,8 @@ declare const blogBackendPlugin: (hooks?: BlogBackendHooks) => _btst_stack_plugi
|
|
|
209
207
|
name: string;
|
|
210
208
|
slug: string;
|
|
211
209
|
})[] | undefined;
|
|
210
|
+
publishedAt?: unknown;
|
|
211
|
+
updatedAt?: unknown;
|
|
212
212
|
};
|
|
213
213
|
} & {
|
|
214
214
|
method?: "POST" | undefined;
|
|
@@ -239,8 +239,6 @@ declare const blogBackendPlugin: (hooks?: BlogBackendHooks) => _btst_stack_plugi
|
|
|
239
239
|
slug: z.ZodOptional<z.ZodString>;
|
|
240
240
|
published: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
241
241
|
createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
242
|
-
publishedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
243
|
-
updatedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
244
242
|
content: z.ZodString;
|
|
245
243
|
excerpt: z.ZodString;
|
|
246
244
|
image: z.ZodOptional<z.ZodString>;
|
|
@@ -251,6 +249,8 @@ declare const blogBackendPlugin: (hooks?: BlogBackendHooks) => _btst_stack_plugi
|
|
|
251
249
|
name: z.ZodString;
|
|
252
250
|
slug: z.ZodString;
|
|
253
251
|
}, z.core.$strip>]>>>>;
|
|
252
|
+
publishedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
253
|
+
updatedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
254
254
|
}, z.core.$strip>;
|
|
255
255
|
};
|
|
256
256
|
path: "/posts";
|