@btst/stack 2.1.0 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/index.cjs +9 -1
- package/dist/api/index.d.cts +4 -4
- package/dist/api/index.d.mts +4 -4
- package/dist/api/index.d.ts +4 -4
- package/dist/api/index.mjs +9 -1
- package/dist/client/index.d.cts +2 -2
- package/dist/client/index.d.mts +2 -2
- package/dist/client/index.d.ts +2 -2
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/packages/stack/src/plugins/ai-chat/api/getters.cjs +42 -0
- package/dist/packages/stack/src/plugins/ai-chat/api/getters.mjs +39 -0
- package/dist/packages/stack/src/plugins/ai-chat/api/plugin.cjs +5 -0
- package/dist/packages/stack/src/plugins/ai-chat/api/plugin.mjs +5 -0
- package/dist/packages/stack/src/plugins/blog/api/getters.cjs +131 -0
- package/dist/packages/stack/src/plugins/blog/api/getters.mjs +127 -0
- package/dist/packages/stack/src/plugins/blog/api/plugin.cjs +60 -107
- package/dist/packages/stack/src/plugins/blog/api/plugin.mjs +60 -107
- package/dist/packages/stack/src/plugins/blog/api/query-key-defs.cjs +18 -0
- package/dist/packages/stack/src/plugins/blog/api/query-key-defs.mjs +15 -0
- package/dist/packages/stack/src/plugins/blog/api/serializers.cjs +21 -0
- package/dist/packages/stack/src/plugins/blog/api/serializers.mjs +18 -0
- package/dist/packages/stack/src/plugins/blog/client/plugin.cjs +16 -1
- package/dist/packages/stack/src/plugins/blog/client/plugin.mjs +17 -2
- package/dist/packages/stack/src/plugins/cms/api/getters.cjs +156 -0
- package/dist/packages/stack/src/plugins/cms/api/getters.mjs +147 -0
- package/dist/packages/stack/src/plugins/cms/api/plugin.cjs +624 -617
- package/dist/packages/stack/src/plugins/cms/api/plugin.mjs +623 -616
- package/dist/packages/stack/src/plugins/cms/api/query-key-defs.cjs +29 -0
- package/dist/packages/stack/src/plugins/cms/api/query-key-defs.mjs +26 -0
- package/dist/packages/stack/src/plugins/cms/client/components/pages/content-editor-page.internal.cjs +1 -1
- package/dist/packages/stack/src/plugins/cms/client/components/pages/content-editor-page.internal.mjs +1 -1
- package/dist/packages/stack/src/plugins/cms/client/hooks/cms-hooks.cjs +6 -3
- package/dist/packages/stack/src/plugins/cms/client/hooks/cms-hooks.mjs +6 -3
- package/dist/packages/stack/src/plugins/cms/client/plugin.cjs +15 -0
- package/dist/packages/stack/src/plugins/cms/client/plugin.mjs +16 -1
- package/dist/packages/stack/src/plugins/form-builder/api/getters.cjs +120 -0
- package/dist/packages/stack/src/plugins/form-builder/api/getters.mjs +112 -0
- package/dist/packages/stack/src/plugins/form-builder/api/plugin.cjs +75 -86
- package/dist/packages/stack/src/plugins/form-builder/api/plugin.mjs +71 -82
- package/dist/packages/stack/src/plugins/form-builder/api/query-key-defs.cjs +37 -0
- package/dist/packages/stack/src/plugins/form-builder/api/query-key-defs.mjs +33 -0
- package/dist/packages/stack/src/plugins/form-builder/client/components/pages/submissions-page.internal.cjs +1 -1
- package/dist/packages/stack/src/plugins/form-builder/client/components/pages/submissions-page.internal.mjs +1 -1
- package/dist/packages/stack/src/plugins/form-builder/client/plugin.cjs +15 -0
- package/dist/packages/stack/src/plugins/form-builder/client/plugin.mjs +16 -1
- package/dist/packages/stack/src/plugins/kanban/api/getters.cjs +84 -0
- package/dist/packages/stack/src/plugins/kanban/api/getters.mjs +81 -0
- package/dist/packages/stack/src/plugins/kanban/api/plugin.cjs +37 -123
- package/dist/packages/stack/src/plugins/kanban/api/plugin.mjs +37 -123
- package/dist/packages/stack/src/plugins/kanban/api/query-key-defs.cjs +26 -0
- package/dist/packages/stack/src/plugins/kanban/api/query-key-defs.mjs +23 -0
- package/dist/packages/stack/src/plugins/kanban/api/serializers.cjs +30 -0
- package/dist/packages/stack/src/plugins/kanban/api/serializers.mjs +26 -0
- package/dist/packages/stack/src/plugins/kanban/client/plugin.cjs +11 -1
- package/dist/packages/stack/src/plugins/kanban/client/plugin.mjs +12 -2
- package/dist/packages/stack/src/plugins/utils.cjs +6 -0
- package/dist/packages/stack/src/plugins/utils.mjs +6 -1
- package/dist/plugins/ai-chat/api/index.cjs +3 -0
- package/dist/plugins/ai-chat/api/index.d.cts +27 -4
- package/dist/plugins/ai-chat/api/index.d.mts +27 -4
- package/dist/plugins/ai-chat/api/index.d.ts +27 -4
- package/dist/plugins/ai-chat/api/index.mjs +1 -0
- package/dist/plugins/ai-chat/client/hooks/index.d.cts +2 -2
- package/dist/plugins/ai-chat/client/hooks/index.d.mts +2 -2
- package/dist/plugins/ai-chat/client/hooks/index.d.ts +2 -2
- package/dist/plugins/ai-chat/query-keys.d.cts +9 -284
- package/dist/plugins/ai-chat/query-keys.d.mts +9 -284
- package/dist/plugins/ai-chat/query-keys.d.ts +9 -284
- package/dist/plugins/api/index.d.cts +4 -3
- package/dist/plugins/api/index.d.mts +4 -3
- package/dist/plugins/api/index.d.ts +4 -3
- package/dist/plugins/blog/api/index.cjs +9 -0
- package/dist/plugins/blog/api/index.d.cts +20 -4
- package/dist/plugins/blog/api/index.d.mts +20 -4
- package/dist/plugins/blog/api/index.d.ts +20 -4
- package/dist/plugins/blog/api/index.mjs +3 -0
- package/dist/plugins/blog/client/hooks/index.d.cts +5 -5
- package/dist/plugins/blog/client/hooks/index.d.mts +5 -5
- package/dist/plugins/blog/client/hooks/index.d.ts +5 -5
- 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.cjs +13 -9
- package/dist/plugins/blog/query-keys.d.cts +8 -333
- package/dist/plugins/blog/query-keys.d.mts +8 -333
- package/dist/plugins/blog/query-keys.d.ts +8 -333
- package/dist/plugins/blog/query-keys.mjs +13 -9
- package/dist/plugins/client/index.cjs +1 -0
- package/dist/plugins/client/index.d.cts +10 -3
- package/dist/plugins/client/index.d.mts +10 -3
- package/dist/plugins/client/index.d.ts +10 -3
- package/dist/plugins/client/index.mjs +1 -1
- package/dist/plugins/cms/api/index.cjs +10 -0
- package/dist/plugins/cms/api/index.d.cts +7 -163
- package/dist/plugins/cms/api/index.d.mts +7 -163
- package/dist/plugins/cms/api/index.d.ts +7 -163
- package/dist/plugins/cms/api/index.mjs +2 -0
- package/dist/plugins/cms/client/hooks/index.d.cts +1 -1
- package/dist/plugins/cms/client/hooks/index.d.mts +1 -1
- package/dist/plugins/cms/client/hooks/index.d.ts +1 -1
- package/dist/plugins/cms/query-keys.cjs +2 -1
- package/dist/plugins/cms/query-keys.d.cts +6 -9
- package/dist/plugins/cms/query-keys.d.mts +6 -9
- package/dist/plugins/cms/query-keys.d.ts +6 -9
- package/dist/plugins/cms/query-keys.mjs +2 -1
- package/dist/plugins/form-builder/api/index.cjs +10 -0
- package/dist/plugins/form-builder/api/index.d.cts +7 -141
- package/dist/plugins/form-builder/api/index.d.mts +7 -141
- package/dist/plugins/form-builder/api/index.d.ts +7 -141
- package/dist/plugins/form-builder/api/index.mjs +2 -0
- package/dist/plugins/form-builder/client/components/index.d.cts +1 -1
- package/dist/plugins/form-builder/client/components/index.d.mts +1 -1
- package/dist/plugins/form-builder/client/components/index.d.ts +1 -1
- package/dist/plugins/form-builder/client/hooks/index.d.cts +1 -1
- package/dist/plugins/form-builder/client/hooks/index.d.mts +1 -1
- package/dist/plugins/form-builder/client/hooks/index.d.ts +1 -1
- package/dist/plugins/form-builder/query-keys.cjs +3 -2
- package/dist/plugins/form-builder/query-keys.d.cts +7 -6
- package/dist/plugins/form-builder/query-keys.d.mts +7 -6
- package/dist/plugins/form-builder/query-keys.d.ts +7 -6
- package/dist/plugins/form-builder/query-keys.mjs +3 -2
- package/dist/plugins/kanban/api/index.cjs +9 -0
- package/dist/plugins/kanban/api/index.d.cts +17 -395
- package/dist/plugins/kanban/api/index.d.mts +17 -395
- package/dist/plugins/kanban/api/index.d.ts +17 -395
- package/dist/plugins/kanban/api/index.mjs +3 -0
- package/dist/plugins/kanban/client/components/index.d.cts +1 -1
- package/dist/plugins/kanban/client/components/index.d.mts +1 -1
- package/dist/plugins/kanban/client/components/index.d.ts +1 -1
- package/dist/plugins/kanban/client/hooks/index.d.cts +1 -1
- package/dist/plugins/kanban/client/hooks/index.d.mts +1 -1
- package/dist/plugins/kanban/client/hooks/index.d.ts +1 -1
- package/dist/plugins/kanban/client/index.d.cts +1 -1
- package/dist/plugins/kanban/client/index.d.mts +1 -1
- package/dist/plugins/kanban/client/index.d.ts +1 -1
- package/dist/plugins/kanban/query-keys.cjs +6 -12
- package/dist/plugins/kanban/query-keys.d.cts +5 -16
- package/dist/plugins/kanban/query-keys.d.mts +5 -16
- package/dist/plugins/kanban/query-keys.d.ts +5 -16
- package/dist/plugins/kanban/query-keys.mjs +6 -12
- package/dist/plugins/open-api/api/index.d.cts +2 -2
- package/dist/plugins/open-api/api/index.d.mts +2 -2
- package/dist/plugins/open-api/api/index.d.ts +2 -2
- package/dist/plugins/route-docs/client/index.d.cts +1 -1
- package/dist/plugins/route-docs/client/index.d.mts +1 -1
- package/dist/plugins/route-docs/client/index.d.ts +1 -1
- package/dist/plugins/ui-builder/index.d.cts +1 -1
- package/dist/plugins/ui-builder/index.d.mts +1 -1
- package/dist/plugins/ui-builder/index.d.ts +1 -1
- package/dist/shared/{stack.BoA0xkJv.d.cts → stack.7n9Y_u7N.d.cts} +33 -7
- package/dist/shared/{stack.BoA0xkJv.d.mts → stack.7n9Y_u7N.d.mts} +33 -7
- package/dist/shared/{stack.BoA0xkJv.d.ts → stack.7n9Y_u7N.d.ts} +33 -7
- package/dist/shared/stack.B1EeBt1b.d.ts +297 -0
- package/dist/shared/stack.BIXEI6v_.d.mts +419 -0
- package/dist/shared/stack.BKfolAyK.d.ts +419 -0
- package/dist/shared/stack.BeSm90va.d.ts +289 -0
- package/dist/shared/stack.BpolpQpf.d.cts +445 -0
- package/dist/shared/stack.C5dtIncc.d.mts +293 -0
- package/dist/shared/stack.CIP6QS9l.d.ts +293 -0
- package/dist/shared/stack.CMh_EdxW.d.cts +289 -0
- package/dist/shared/stack.CP68pFEH.d.mts +297 -0
- package/dist/shared/{stack.BsXokfNh.d.mts → stack.CVDTkMoO.d.cts} +8 -2
- package/dist/shared/{stack.BsXokfNh.d.ts → stack.CVDTkMoO.d.mts} +8 -2
- package/dist/shared/{stack.BsXokfNh.d.cts → stack.CVDTkMoO.d.ts} +8 -2
- package/dist/shared/{stack.DKDMI-QO.d.mts → stack.DJaKVY7v.d.cts} +7 -1
- package/dist/shared/{stack.DKDMI-QO.d.ts → stack.DJaKVY7v.d.mts} +7 -1
- package/dist/shared/{stack.DKDMI-QO.d.cts → stack.DJaKVY7v.d.ts} +7 -1
- package/dist/shared/{stack.DzH_wcvr.d.mts → stack.DdI5W6MB.d.cts} +9 -3
- package/dist/shared/{stack.DzH_wcvr.d.ts → stack.DdI5W6MB.d.mts} +9 -3
- package/dist/shared/{stack.DzH_wcvr.d.cts → stack.DdI5W6MB.d.ts} +9 -3
- package/dist/shared/stack.Dg09R0oB.d.mts +289 -0
- package/dist/shared/stack.Dw0Ly2TM.d.cts +293 -0
- package/dist/shared/stack.IdtKDRka.d.cts +297 -0
- package/dist/shared/stack.TIBF2AOx.d.ts +445 -0
- package/dist/shared/stack.rTy7-wQU.d.mts +445 -0
- package/dist/shared/stack.snB1EDP7.d.cts +419 -0
- package/package.json +3 -3
- package/src/__tests__/stack-api.test.ts +118 -0
- package/src/api/index.ts +15 -1
- package/src/plugins/ai-chat/__tests__/getters.test.ts +109 -0
- package/src/plugins/ai-chat/api/getters.ts +71 -0
- package/src/plugins/ai-chat/api/index.ts +1 -0
- package/src/plugins/ai-chat/api/plugin.ts +8 -0
- package/src/plugins/api/index.ts +3 -1
- package/src/plugins/blog/__tests__/getters.test.ts +540 -0
- package/src/plugins/blog/api/getters.ts +243 -0
- package/src/plugins/blog/api/index.ts +9 -0
- package/src/plugins/blog/api/plugin.ts +98 -141
- package/src/plugins/blog/api/query-key-defs.ts +46 -0
- package/src/plugins/blog/api/serializers.ts +27 -0
- package/src/plugins/blog/client/plugin.tsx +21 -1
- package/src/plugins/blog/query-keys.ts +21 -20
- package/src/plugins/client/index.ts +1 -1
- package/src/plugins/cms/__tests__/getters.test.ts +206 -0
- package/src/plugins/cms/api/getters.ts +268 -0
- package/src/plugins/cms/api/index.ts +15 -1
- package/src/plugins/cms/api/plugin.ts +151 -150
- package/src/plugins/cms/api/query-key-defs.ts +53 -0
- package/src/plugins/cms/api/serializers.ts +12 -0
- package/src/plugins/cms/client/components/pages/content-editor-page.internal.tsx +1 -1
- package/src/plugins/cms/client/hooks/cms-hooks.tsx +3 -0
- package/src/plugins/cms/client/plugin.tsx +19 -0
- package/src/plugins/cms/query-keys.ts +2 -1
- package/src/plugins/cms/types.ts +1 -1
- package/src/plugins/form-builder/__tests__/getters.test.ts +159 -0
- package/src/plugins/form-builder/api/getters.ts +226 -0
- package/src/plugins/form-builder/api/index.ts +15 -1
- package/src/plugins/form-builder/api/plugin.ts +107 -109
- package/src/plugins/form-builder/api/query-key-defs.ts +79 -0
- package/src/plugins/form-builder/api/serializers.ts +12 -0
- package/src/plugins/form-builder/client/components/pages/submissions-page.internal.tsx +1 -1
- package/src/plugins/form-builder/client/plugin.tsx +19 -0
- package/src/plugins/form-builder/query-keys.ts +6 -2
- package/src/plugins/form-builder/types.ts +2 -2
- package/src/plugins/kanban/__tests__/getters.test.ts +172 -0
- package/src/plugins/kanban/api/getters.ts +149 -0
- package/src/plugins/kanban/api/index.ts +4 -0
- package/src/plugins/kanban/api/plugin.ts +65 -146
- package/src/plugins/kanban/api/query-key-defs.ts +54 -0
- package/src/plugins/kanban/api/serializers.ts +49 -0
- package/src/plugins/kanban/client/plugin.tsx +15 -1
- package/src/plugins/kanban/query-keys.ts +10 -14
- package/src/plugins/utils.ts +19 -0
- package/src/types.ts +44 -5
- package/dist/shared/{stack.CbuN2zVV.d.cts → stack.CBON0dWL.d.cts} +7 -7
- package/dist/shared/{stack.CbuN2zVV.d.mts → stack.CBON0dWL.d.mts} +7 -7
- package/dist/shared/{stack.CbuN2zVV.d.ts → stack.CBON0dWL.d.ts} +7 -7
|
@@ -1,333 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
slug: z.ZodOptional<z.ZodString>;
|
|
10
|
-
tagSlug: z.ZodOptional<z.ZodString>;
|
|
11
|
-
offset: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
12
|
-
limit: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
13
|
-
query: z.ZodOptional<z.ZodString>;
|
|
14
|
-
published: z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<boolean | undefined, string | undefined>>;
|
|
15
|
-
}, z.core.$strip>;
|
|
16
|
-
declare const NextPreviousPostsQuerySchema: z.ZodObject<{
|
|
17
|
-
date: z.ZodCoercedDate<unknown>;
|
|
18
|
-
}, z.core.$strip>;
|
|
19
|
-
/**
|
|
20
|
-
* Context passed to blog API hooks
|
|
21
|
-
*/
|
|
22
|
-
interface BlogApiContext<TBody = any, TParams = any, TQuery = any> {
|
|
23
|
-
body?: TBody;
|
|
24
|
-
params?: TParams;
|
|
25
|
-
query?: TQuery;
|
|
26
|
-
request?: Request;
|
|
27
|
-
headers?: Headers;
|
|
28
|
-
[key: string]: any;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Configuration hooks for blog backend plugin
|
|
32
|
-
* All hooks are optional and allow consumers to customize behavior
|
|
33
|
-
*/
|
|
34
|
-
interface BlogBackendHooks {
|
|
35
|
-
/**
|
|
36
|
-
* Called before listing posts. Return false to deny access.
|
|
37
|
-
* @param filter - Query parameters for filtering posts
|
|
38
|
-
* @param context - Request context with headers, etc.
|
|
39
|
-
*/
|
|
40
|
-
onBeforeListPosts?: (filter: z.infer<typeof PostListQuerySchema>, context: BlogApiContext) => Promise<boolean> | boolean;
|
|
41
|
-
/**
|
|
42
|
-
* Called before creating a post. Return false to deny access.
|
|
43
|
-
* @param data - Post data being created
|
|
44
|
-
* @param context - Request context with headers, etc.
|
|
45
|
-
*/
|
|
46
|
-
onBeforeCreatePost?: (data: z.infer<typeof createPostSchema>, context: BlogApiContext) => Promise<boolean> | boolean;
|
|
47
|
-
/**
|
|
48
|
-
* Called before updating a post. Return false to deny access.
|
|
49
|
-
* @param postId - ID of the post being updated
|
|
50
|
-
* @param data - Updated post data
|
|
51
|
-
* @param context - Request context with headers, etc.
|
|
52
|
-
*/
|
|
53
|
-
onBeforeUpdatePost?: (postId: string, data: z.infer<typeof updatePostSchema>, context: BlogApiContext) => Promise<boolean> | boolean;
|
|
54
|
-
/**
|
|
55
|
-
* Called before deleting a post. Return false to deny access.
|
|
56
|
-
* @param postId - ID of the post being deleted
|
|
57
|
-
* @param context - Request context with headers, etc.
|
|
58
|
-
*/
|
|
59
|
-
onBeforeDeletePost?: (postId: string, context: BlogApiContext) => Promise<boolean> | boolean;
|
|
60
|
-
/**
|
|
61
|
-
* Called after posts are read successfully
|
|
62
|
-
* @param posts - Array of posts that were read
|
|
63
|
-
* @param filter - Query parameters used for filtering
|
|
64
|
-
* @param context - Request context
|
|
65
|
-
*/
|
|
66
|
-
onPostsRead?: (posts: Post[], filter: z.infer<typeof PostListQuerySchema>, context: BlogApiContext) => Promise<void> | void;
|
|
67
|
-
/**
|
|
68
|
-
* Called after a post is created successfully
|
|
69
|
-
* @param post - The created post
|
|
70
|
-
* @param context - Request context
|
|
71
|
-
*/
|
|
72
|
-
onPostCreated?: (post: Post, context: BlogApiContext) => Promise<void> | void;
|
|
73
|
-
/**
|
|
74
|
-
* Called after a post is updated successfully
|
|
75
|
-
* @param post - The updated post
|
|
76
|
-
* @param context - Request context
|
|
77
|
-
*/
|
|
78
|
-
onPostUpdated?: (post: Post, context: BlogApiContext) => Promise<void> | void;
|
|
79
|
-
/**
|
|
80
|
-
* Called after a post is deleted successfully
|
|
81
|
-
* @param postId - ID of the deleted post
|
|
82
|
-
* @param context - Request context
|
|
83
|
-
*/
|
|
84
|
-
onPostDeleted?: (postId: string, context: BlogApiContext) => Promise<void> | void;
|
|
85
|
-
/**
|
|
86
|
-
* Called when listing posts fails
|
|
87
|
-
* @param error - The error that occurred
|
|
88
|
-
* @param context - Request context
|
|
89
|
-
*/
|
|
90
|
-
onListPostsError?: (error: Error, context: BlogApiContext) => Promise<void> | void;
|
|
91
|
-
/**
|
|
92
|
-
* Called when creating a post fails
|
|
93
|
-
* @param error - The error that occurred
|
|
94
|
-
* @param context - Request context
|
|
95
|
-
*/
|
|
96
|
-
onCreatePostError?: (error: Error, context: BlogApiContext) => Promise<void> | void;
|
|
97
|
-
/**
|
|
98
|
-
* Called when updating a post fails
|
|
99
|
-
* @param error - The error that occurred
|
|
100
|
-
* @param context - Request context
|
|
101
|
-
*/
|
|
102
|
-
onUpdatePostError?: (error: Error, context: BlogApiContext) => Promise<void> | void;
|
|
103
|
-
/**
|
|
104
|
-
* Called when deleting a post fails
|
|
105
|
-
* @param error - The error that occurred
|
|
106
|
-
* @param context - Request context
|
|
107
|
-
*/
|
|
108
|
-
onDeletePostError?: (error: Error, context: BlogApiContext) => Promise<void> | void;
|
|
109
|
-
}
|
|
110
|
-
/**
|
|
111
|
-
* Blog backend plugin
|
|
112
|
-
* Provides API endpoints for managing blog posts
|
|
113
|
-
* Uses better-db adapter for database operations
|
|
114
|
-
*
|
|
115
|
-
* @param hooks - Optional configuration hooks for customizing plugin behavior
|
|
116
|
-
*/
|
|
117
|
-
declare const blogBackendPlugin: (hooks?: BlogBackendHooks) => _btst_stack_plugins_api.BackendPlugin<{
|
|
118
|
-
readonly listPosts: better_call.StrictEndpoint<"/posts", {
|
|
119
|
-
method: "GET";
|
|
120
|
-
query: z.ZodObject<{
|
|
121
|
-
slug: z.ZodOptional<z.ZodString>;
|
|
122
|
-
tagSlug: z.ZodOptional<z.ZodString>;
|
|
123
|
-
offset: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
124
|
-
limit: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
125
|
-
query: z.ZodOptional<z.ZodString>;
|
|
126
|
-
published: z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<boolean | undefined, string | undefined>>;
|
|
127
|
-
}, z.core.$strip>;
|
|
128
|
-
}, {
|
|
129
|
-
tags: Tag[];
|
|
130
|
-
id: string;
|
|
131
|
-
authorId?: string;
|
|
132
|
-
defaultLocale?: string;
|
|
133
|
-
slug: string;
|
|
134
|
-
title: string;
|
|
135
|
-
content: string;
|
|
136
|
-
excerpt: string;
|
|
137
|
-
image?: string;
|
|
138
|
-
published: boolean;
|
|
139
|
-
status?: "DRAFT" | "PUBLISHED";
|
|
140
|
-
publishedAt?: Date;
|
|
141
|
-
createdAt: Date;
|
|
142
|
-
updatedAt: Date;
|
|
143
|
-
}[]>;
|
|
144
|
-
readonly createPost: better_call.StrictEndpoint<"/posts", {
|
|
145
|
-
method: "POST";
|
|
146
|
-
body: z.ZodObject<{
|
|
147
|
-
slug: z.ZodOptional<z.ZodString>;
|
|
148
|
-
publishedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
149
|
-
createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
150
|
-
updatedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
151
|
-
title: z.ZodString;
|
|
152
|
-
content: z.ZodString;
|
|
153
|
-
excerpt: z.ZodString;
|
|
154
|
-
image: z.ZodOptional<z.ZodString>;
|
|
155
|
-
published: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
156
|
-
tags: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
157
|
-
name: z.ZodString;
|
|
158
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
159
|
-
id: z.ZodString;
|
|
160
|
-
name: z.ZodString;
|
|
161
|
-
slug: z.ZodString;
|
|
162
|
-
}, z.core.$strip>]>>>>;
|
|
163
|
-
}, z.core.$strip>;
|
|
164
|
-
}, Post>;
|
|
165
|
-
readonly updatePost: better_call.StrictEndpoint<"/posts/:id", {
|
|
166
|
-
method: "PUT";
|
|
167
|
-
body: z.ZodObject<{
|
|
168
|
-
publishedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
169
|
-
createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
170
|
-
updatedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
171
|
-
title: z.ZodString;
|
|
172
|
-
content: z.ZodString;
|
|
173
|
-
excerpt: z.ZodString;
|
|
174
|
-
image: z.ZodOptional<z.ZodString>;
|
|
175
|
-
published: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
176
|
-
slug: z.ZodString;
|
|
177
|
-
tags: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
178
|
-
name: z.ZodString;
|
|
179
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
180
|
-
id: z.ZodString;
|
|
181
|
-
name: z.ZodString;
|
|
182
|
-
slug: z.ZodString;
|
|
183
|
-
}, z.core.$strip>]>>>>;
|
|
184
|
-
id: z.ZodString;
|
|
185
|
-
}, z.core.$strip>;
|
|
186
|
-
}, Post>;
|
|
187
|
-
readonly deletePost: better_call.StrictEndpoint<"/posts/:id", {
|
|
188
|
-
method: "DELETE";
|
|
189
|
-
}, {
|
|
190
|
-
success: boolean;
|
|
191
|
-
}>;
|
|
192
|
-
readonly getNextPreviousPosts: better_call.StrictEndpoint<"/posts/next-previous", {
|
|
193
|
-
method: "GET";
|
|
194
|
-
query: z.ZodObject<{
|
|
195
|
-
date: z.ZodCoercedDate<unknown>;
|
|
196
|
-
}, z.core.$strip>;
|
|
197
|
-
}, {
|
|
198
|
-
previous: {
|
|
199
|
-
tags: Tag[];
|
|
200
|
-
id: string;
|
|
201
|
-
authorId?: string;
|
|
202
|
-
defaultLocale?: string;
|
|
203
|
-
slug: string;
|
|
204
|
-
title: string;
|
|
205
|
-
content: string;
|
|
206
|
-
excerpt: string;
|
|
207
|
-
image?: string;
|
|
208
|
-
published: boolean;
|
|
209
|
-
status?: "DRAFT" | "PUBLISHED";
|
|
210
|
-
publishedAt?: Date;
|
|
211
|
-
createdAt: Date;
|
|
212
|
-
updatedAt: Date;
|
|
213
|
-
} | null;
|
|
214
|
-
next: {
|
|
215
|
-
tags: Tag[];
|
|
216
|
-
id: string;
|
|
217
|
-
authorId?: string;
|
|
218
|
-
defaultLocale?: string;
|
|
219
|
-
slug: string;
|
|
220
|
-
title: string;
|
|
221
|
-
content: string;
|
|
222
|
-
excerpt: string;
|
|
223
|
-
image?: string;
|
|
224
|
-
published: boolean;
|
|
225
|
-
status?: "DRAFT" | "PUBLISHED";
|
|
226
|
-
publishedAt?: Date;
|
|
227
|
-
createdAt: Date;
|
|
228
|
-
updatedAt: Date;
|
|
229
|
-
} | null;
|
|
230
|
-
}>;
|
|
231
|
-
readonly listTags: better_call.StrictEndpoint<"/tags", {
|
|
232
|
-
method: "GET";
|
|
233
|
-
}, Tag[]>;
|
|
234
|
-
}>;
|
|
235
|
-
type BlogApiRouter = ReturnType<ReturnType<typeof blogBackendPlugin>["routes"]>;
|
|
236
|
-
|
|
237
|
-
interface PostsListParams {
|
|
238
|
-
query?: string;
|
|
239
|
-
limit?: number;
|
|
240
|
-
published?: boolean;
|
|
241
|
-
tagSlug?: string;
|
|
242
|
-
}
|
|
243
|
-
declare function createBlogQueryKeys(client: ReturnType<typeof createApiClient<BlogApiRouter>>, headers?: HeadersInit): {
|
|
244
|
-
posts: {
|
|
245
|
-
_def: readonly ["posts"];
|
|
246
|
-
} & {
|
|
247
|
-
list: ((params?: PostsListParams | undefined) => Omit<Omit<{
|
|
248
|
-
queryKey: readonly ["posts", "list", {
|
|
249
|
-
query: string | undefined;
|
|
250
|
-
limit: number;
|
|
251
|
-
published: boolean;
|
|
252
|
-
tagSlug: string | undefined;
|
|
253
|
-
}];
|
|
254
|
-
queryFn: _tanstack_react_query.QueryFunction<unknown, readonly ["posts", "list", {
|
|
255
|
-
query: string | undefined;
|
|
256
|
-
limit: number;
|
|
257
|
-
published: boolean;
|
|
258
|
-
tagSlug: string | undefined;
|
|
259
|
-
}]>;
|
|
260
|
-
}, "queryFn"> & {
|
|
261
|
-
_def: readonly ["posts", "list"];
|
|
262
|
-
}, "_def">) & {
|
|
263
|
-
_def: readonly ["posts", "list"];
|
|
264
|
-
};
|
|
265
|
-
detail: ((slug: string) => Omit<{
|
|
266
|
-
queryKey: readonly ["posts", "detail", string];
|
|
267
|
-
queryFn: _tanstack_react_query.QueryFunction<SerializedPost | null, readonly ["posts", "detail", string]>;
|
|
268
|
-
} & {
|
|
269
|
-
_def: readonly ["posts", "detail"];
|
|
270
|
-
}, "_def">) & {
|
|
271
|
-
_def: readonly ["posts", "detail"];
|
|
272
|
-
};
|
|
273
|
-
nextPrevious: ((date: string | Date) => Omit<{
|
|
274
|
-
queryKey: readonly ["posts", "nextPrevious", string, string | Date];
|
|
275
|
-
queryFn: _tanstack_react_query.QueryFunction<{
|
|
276
|
-
previous: SerializedPost | null;
|
|
277
|
-
next: SerializedPost | null;
|
|
278
|
-
}, readonly ["posts", "nextPrevious", string, string | Date]>;
|
|
279
|
-
} & {
|
|
280
|
-
_def: readonly ["posts", "nextPrevious"];
|
|
281
|
-
}, "_def">) & {
|
|
282
|
-
_def: readonly ["posts", "nextPrevious"];
|
|
283
|
-
};
|
|
284
|
-
recent: ((params?: {
|
|
285
|
-
limit?: number;
|
|
286
|
-
excludeSlug?: string;
|
|
287
|
-
} | undefined) => Omit<{
|
|
288
|
-
queryKey: readonly ["posts", "recent", string, {
|
|
289
|
-
limit?: number;
|
|
290
|
-
excludeSlug?: string;
|
|
291
|
-
} | undefined];
|
|
292
|
-
queryFn: _tanstack_react_query.QueryFunction<SerializedPost[], readonly ["posts", "recent", string, {
|
|
293
|
-
limit?: number;
|
|
294
|
-
excludeSlug?: string;
|
|
295
|
-
} | undefined]>;
|
|
296
|
-
} & {
|
|
297
|
-
_def: readonly ["posts", "recent"];
|
|
298
|
-
}, "_def">) & {
|
|
299
|
-
_def: readonly ["posts", "recent"];
|
|
300
|
-
};
|
|
301
|
-
};
|
|
302
|
-
drafts: {
|
|
303
|
-
_def: readonly ["drafts"];
|
|
304
|
-
} & {
|
|
305
|
-
list: ((params?: PostsListParams | undefined) => Omit<Omit<{
|
|
306
|
-
queryKey: readonly ["drafts", "list", {
|
|
307
|
-
limit?: number | undefined;
|
|
308
|
-
}];
|
|
309
|
-
queryFn: _tanstack_react_query.QueryFunction<unknown, readonly ["drafts", "list", {
|
|
310
|
-
limit?: number | undefined;
|
|
311
|
-
}]>;
|
|
312
|
-
}, "queryFn"> & {
|
|
313
|
-
_def: readonly ["drafts", "list"];
|
|
314
|
-
}, "_def">) & {
|
|
315
|
-
_def: readonly ["drafts", "list"];
|
|
316
|
-
};
|
|
317
|
-
};
|
|
318
|
-
tags: {
|
|
319
|
-
_def: readonly ["tags"];
|
|
320
|
-
} & {
|
|
321
|
-
list: (() => Omit<{
|
|
322
|
-
queryKey: readonly ["tags", "list", string];
|
|
323
|
-
queryFn: _tanstack_react_query.QueryFunction<SerializedTag[], readonly ["tags", "list", string]>;
|
|
324
|
-
} & {
|
|
325
|
-
_def: readonly ["tags", "list"];
|
|
326
|
-
}, "_def">) & {
|
|
327
|
-
_def: readonly ["tags", "list"];
|
|
328
|
-
};
|
|
329
|
-
};
|
|
330
|
-
};
|
|
331
|
-
|
|
332
|
-
export { NextPreviousPostsQuerySchema as N, PostListQuerySchema as P, blogBackendPlugin as b, createBlogQueryKeys };
|
|
333
|
-
export type { BlogApiContext as B, BlogBackendHooks as a, BlogApiRouter as c };
|
|
1
|
+
import '@tanstack/react-query';
|
|
2
|
+
export { d as createBlogQueryKeys } from '../../shared/stack.BKfolAyK.js';
|
|
3
|
+
import '@btst/stack/plugins/client';
|
|
4
|
+
import '../../shared/stack.CBON0dWL.js';
|
|
5
|
+
import '@btst/stack/plugins/api';
|
|
6
|
+
import 'better-call';
|
|
7
|
+
import '@btst/db';
|
|
8
|
+
import 'zod';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { mergeQueryKeys, createQueryKeys } from '@lukemorales/query-key-factory';
|
|
2
|
+
import { postsListDiscriminator } from '../../packages/stack/src/plugins/blog/api/query-key-defs.mjs';
|
|
2
3
|
|
|
3
4
|
function isErrorResponse(response) {
|
|
4
5
|
return typeof response === "object" && response !== null && "error" in response && response.error !== null && response.error !== void 0;
|
|
@@ -26,12 +27,12 @@ function createPostsQueries(client, headers) {
|
|
|
26
27
|
return createQueryKeys("posts", {
|
|
27
28
|
list: (params) => ({
|
|
28
29
|
queryKey: [
|
|
29
|
-
{
|
|
30
|
-
query: params?.query !== void 0 && params?.query?.trim() === "" ? void 0 : params?.query,
|
|
31
|
-
limit: params?.limit ?? 10,
|
|
30
|
+
postsListDiscriminator({
|
|
32
31
|
published: params?.published ?? true,
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
limit: params?.limit ?? 10,
|
|
33
|
+
tagSlug: params?.tagSlug,
|
|
34
|
+
query: params?.query
|
|
35
|
+
})
|
|
35
36
|
],
|
|
36
37
|
queryFn: async ({ pageParam }) => {
|
|
37
38
|
try {
|
|
@@ -50,7 +51,8 @@ function createPostsQueries(client, headers) {
|
|
|
50
51
|
const errorResponse = response;
|
|
51
52
|
throw toError(errorResponse.error);
|
|
52
53
|
}
|
|
53
|
-
|
|
54
|
+
const dataResponse = response;
|
|
55
|
+
return dataResponse.data?.items ?? [];
|
|
54
56
|
} catch (error) {
|
|
55
57
|
throw error;
|
|
56
58
|
}
|
|
@@ -72,7 +74,7 @@ function createPostsQueries(client, headers) {
|
|
|
72
74
|
throw toError(errorResponse.error);
|
|
73
75
|
}
|
|
74
76
|
const dataResponse = response;
|
|
75
|
-
return dataResponse.data?.[0] ?? null;
|
|
77
|
+
return dataResponse.data?.items?.[0] ?? null;
|
|
76
78
|
} catch (error) {
|
|
77
79
|
throw error;
|
|
78
80
|
}
|
|
@@ -115,7 +117,8 @@ function createPostsQueries(client, headers) {
|
|
|
115
117
|
const errorResponse = response;
|
|
116
118
|
throw toError(errorResponse.error);
|
|
117
119
|
}
|
|
118
|
-
|
|
120
|
+
const recentResponse = response;
|
|
121
|
+
let posts = recentResponse.data?.items ?? [];
|
|
119
122
|
if (params?.excludeSlug) {
|
|
120
123
|
posts = posts.filter((post) => post.slug !== params.excludeSlug);
|
|
121
124
|
}
|
|
@@ -151,7 +154,8 @@ function createDraftsQueries(client, headers) {
|
|
|
151
154
|
const errorResponse = response;
|
|
152
155
|
throw toError(errorResponse.error);
|
|
153
156
|
}
|
|
154
|
-
|
|
157
|
+
const draftsResponse = response;
|
|
158
|
+
return draftsResponse.data?.items ?? [];
|
|
155
159
|
} catch (error) {
|
|
156
160
|
throw error;
|
|
157
161
|
}
|
|
@@ -9,6 +9,7 @@ function defineClientPlugin(plugin) {
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
exports.createApiClient = utils.createApiClient;
|
|
12
|
+
exports.isConnectionError = utils.isConnectionError;
|
|
12
13
|
exports.createRoute = yar.createRoute;
|
|
13
14
|
exports.createRouter = yar.createRouter;
|
|
14
15
|
exports.createClient = client.createClient;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as ClientPlugin } from '../../shared/stack.
|
|
2
|
-
export { P as PluginOverrides } from '../../shared/stack.
|
|
1
|
+
import { C as ClientPlugin } from '../../shared/stack.7n9Y_u7N.cjs';
|
|
2
|
+
export { P as PluginOverrides } from '../../shared/stack.7n9Y_u7N.cjs';
|
|
3
3
|
import { Route } from '@btst/yar';
|
|
4
4
|
export { Route, createRoute, createRouter } from '@btst/yar';
|
|
5
5
|
import { createClient } from 'better-call/client';
|
|
@@ -7,6 +7,13 @@ export { createClient } from 'better-call/client';
|
|
|
7
7
|
import { Router, Endpoint } from 'better-call';
|
|
8
8
|
import '@btst/db';
|
|
9
9
|
|
|
10
|
+
/**
|
|
11
|
+
* Returns true when a fetch error is a connection-refused / no-server error.
|
|
12
|
+
* Used in SSR loaders to emit an actionable build-time warning when
|
|
13
|
+
* `route.loader()` is called during `next build` with no HTTP server running.
|
|
14
|
+
*/
|
|
15
|
+
declare function isConnectionError(err: unknown): boolean;
|
|
16
|
+
|
|
10
17
|
interface CreateApiClientOptions {
|
|
11
18
|
baseURL?: string;
|
|
12
19
|
basePath?: string;
|
|
@@ -53,4 +60,4 @@ declare function createApiClient<TRouter extends Router | Record<string, Endpoin
|
|
|
53
60
|
*/
|
|
54
61
|
declare function defineClientPlugin<TOverrides = Record<string, never>, TRoutes extends Record<string, Route> = Record<string, Route>>(plugin: ClientPlugin<TOverrides, TRoutes>): ClientPlugin<TOverrides, TRoutes>;
|
|
55
62
|
|
|
56
|
-
export { ClientPlugin, createApiClient, defineClientPlugin };
|
|
63
|
+
export { ClientPlugin, createApiClient, defineClientPlugin, isConnectionError };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as ClientPlugin } from '../../shared/stack.
|
|
2
|
-
export { P as PluginOverrides } from '../../shared/stack.
|
|
1
|
+
import { C as ClientPlugin } from '../../shared/stack.7n9Y_u7N.mjs';
|
|
2
|
+
export { P as PluginOverrides } from '../../shared/stack.7n9Y_u7N.mjs';
|
|
3
3
|
import { Route } from '@btst/yar';
|
|
4
4
|
export { Route, createRoute, createRouter } from '@btst/yar';
|
|
5
5
|
import { createClient } from 'better-call/client';
|
|
@@ -7,6 +7,13 @@ export { createClient } from 'better-call/client';
|
|
|
7
7
|
import { Router, Endpoint } from 'better-call';
|
|
8
8
|
import '@btst/db';
|
|
9
9
|
|
|
10
|
+
/**
|
|
11
|
+
* Returns true when a fetch error is a connection-refused / no-server error.
|
|
12
|
+
* Used in SSR loaders to emit an actionable build-time warning when
|
|
13
|
+
* `route.loader()` is called during `next build` with no HTTP server running.
|
|
14
|
+
*/
|
|
15
|
+
declare function isConnectionError(err: unknown): boolean;
|
|
16
|
+
|
|
10
17
|
interface CreateApiClientOptions {
|
|
11
18
|
baseURL?: string;
|
|
12
19
|
basePath?: string;
|
|
@@ -53,4 +60,4 @@ declare function createApiClient<TRouter extends Router | Record<string, Endpoin
|
|
|
53
60
|
*/
|
|
54
61
|
declare function defineClientPlugin<TOverrides = Record<string, never>, TRoutes extends Record<string, Route> = Record<string, Route>>(plugin: ClientPlugin<TOverrides, TRoutes>): ClientPlugin<TOverrides, TRoutes>;
|
|
55
62
|
|
|
56
|
-
export { ClientPlugin, createApiClient, defineClientPlugin };
|
|
63
|
+
export { ClientPlugin, createApiClient, defineClientPlugin, isConnectionError };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as ClientPlugin } from '../../shared/stack.
|
|
2
|
-
export { P as PluginOverrides } from '../../shared/stack.
|
|
1
|
+
import { C as ClientPlugin } from '../../shared/stack.7n9Y_u7N.js';
|
|
2
|
+
export { P as PluginOverrides } from '../../shared/stack.7n9Y_u7N.js';
|
|
3
3
|
import { Route } from '@btst/yar';
|
|
4
4
|
export { Route, createRoute, createRouter } from '@btst/yar';
|
|
5
5
|
import { createClient } from 'better-call/client';
|
|
@@ -7,6 +7,13 @@ export { createClient } from 'better-call/client';
|
|
|
7
7
|
import { Router, Endpoint } from 'better-call';
|
|
8
8
|
import '@btst/db';
|
|
9
9
|
|
|
10
|
+
/**
|
|
11
|
+
* Returns true when a fetch error is a connection-refused / no-server error.
|
|
12
|
+
* Used in SSR loaders to emit an actionable build-time warning when
|
|
13
|
+
* `route.loader()` is called during `next build` with no HTTP server running.
|
|
14
|
+
*/
|
|
15
|
+
declare function isConnectionError(err: unknown): boolean;
|
|
16
|
+
|
|
10
17
|
interface CreateApiClientOptions {
|
|
11
18
|
baseURL?: string;
|
|
12
19
|
basePath?: string;
|
|
@@ -53,4 +60,4 @@ declare function createApiClient<TRouter extends Router | Record<string, Endpoin
|
|
|
53
60
|
*/
|
|
54
61
|
declare function defineClientPlugin<TOverrides = Record<string, never>, TRoutes extends Record<string, Route> = Record<string, Route>>(plugin: ClientPlugin<TOverrides, TRoutes>): ClientPlugin<TOverrides, TRoutes>;
|
|
55
62
|
|
|
56
|
-
export { ClientPlugin, createApiClient, defineClientPlugin };
|
|
63
|
+
export { ClientPlugin, createApiClient, defineClientPlugin, isConnectionError };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { createApiClient } from '../../packages/stack/src/plugins/utils.mjs';
|
|
1
|
+
export { createApiClient, isConnectionError } from '../../packages/stack/src/plugins/utils.mjs';
|
|
2
2
|
export { createRoute, createRouter } from '@btst/yar';
|
|
3
3
|
export { createClient } from 'better-call/client';
|
|
4
4
|
|
|
@@ -1,7 +1,17 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const plugin = require('../../../packages/stack/src/plugins/cms/api/plugin.cjs');
|
|
4
|
+
const getters = require('../../../packages/stack/src/plugins/cms/api/getters.cjs');
|
|
5
|
+
const queryKeyDefs = require('../../../packages/stack/src/plugins/cms/api/query-key-defs.cjs');
|
|
4
6
|
|
|
5
7
|
|
|
6
8
|
|
|
7
9
|
exports.cmsBackendPlugin = plugin.cmsBackendPlugin;
|
|
10
|
+
exports.getAllContentItems = getters.getAllContentItems;
|
|
11
|
+
exports.getAllContentTypes = getters.getAllContentTypes;
|
|
12
|
+
exports.getContentItemById = getters.getContentItemById;
|
|
13
|
+
exports.getContentItemBySlug = getters.getContentItemBySlug;
|
|
14
|
+
exports.serializeContentItem = getters.serializeContentItem;
|
|
15
|
+
exports.serializeContentItemWithType = getters.serializeContentItemWithType;
|
|
16
|
+
exports.serializeContentType = getters.serializeContentType;
|
|
17
|
+
exports.CMS_QUERY_KEYS = queryKeyDefs.CMS_QUERY_KEYS;
|