@btst/stack 2.2.0 → 2.4.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/stack/src/client/components/compose.cjs +1 -2
- package/dist/packages/stack/src/client/components/compose.mjs +1 -2
- package/dist/packages/stack/src/plugins/ai-chat/api/page-tools.cjs +71 -0
- package/dist/packages/stack/src/plugins/ai-chat/api/page-tools.mjs +68 -0
- package/dist/packages/stack/src/plugins/ai-chat/api/plugin.cjs +54 -7
- package/dist/packages/stack/src/plugins/ai-chat/api/plugin.mjs +54 -7
- package/dist/packages/stack/src/plugins/ai-chat/client/components/chat-input.cjs +2 -2
- package/dist/packages/stack/src/plugins/ai-chat/client/components/chat-input.mjs +2 -2
- package/dist/packages/stack/src/plugins/ai-chat/client/components/chat-interface.cjs +89 -22
- package/dist/packages/stack/src/plugins/ai-chat/client/components/chat-interface.mjs +90 -23
- package/dist/packages/stack/src/plugins/ai-chat/client/components/chat-layout.cjs +110 -33
- package/dist/packages/stack/src/plugins/ai-chat/client/components/chat-layout.mjs +112 -35
- package/dist/packages/stack/src/plugins/ai-chat/client/components/chat-sidebar.cjs +1 -1
- package/dist/packages/stack/src/plugins/ai-chat/client/components/chat-sidebar.mjs +1 -1
- package/dist/packages/stack/src/plugins/ai-chat/schemas.cjs +17 -1
- package/dist/packages/stack/src/plugins/ai-chat/schemas.mjs +17 -1
- package/dist/packages/stack/src/plugins/blog/api/plugin.cjs +52 -1
- package/dist/packages/stack/src/plugins/blog/api/plugin.mjs +52 -1
- 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/components/forms/post-forms.cjs +15 -2
- package/dist/packages/stack/src/plugins/blog/client/components/forms/post-forms.mjs +16 -3
- package/dist/packages/stack/src/plugins/blog/client/components/pages/edit-post-page.internal.cjs +24 -1
- package/dist/packages/stack/src/plugins/blog/client/components/pages/edit-post-page.internal.mjs +24 -1
- package/dist/packages/stack/src/plugins/blog/client/components/pages/fill-blog-form-handler.cjs +26 -0
- package/dist/packages/stack/src/plugins/blog/client/components/pages/fill-blog-form-handler.mjs +24 -0
- package/dist/packages/stack/src/plugins/blog/client/components/pages/new-post-page.internal.cjs +30 -1
- package/dist/packages/stack/src/plugins/blog/client/components/pages/new-post-page.internal.mjs +30 -1
- package/dist/packages/stack/src/plugins/blog/client/components/pages/post-page.internal.cjs +18 -0
- package/dist/packages/stack/src/plugins/blog/client/components/pages/post-page.internal.mjs +18 -0
- package/dist/packages/stack/src/plugins/blog/client/plugin.cjs +15 -0
- package/dist/packages/stack/src/plugins/blog/client/plugin.mjs +16 -1
- package/dist/packages/stack/src/plugins/cms/api/getters.cjs +10 -0
- package/dist/packages/stack/src/plugins/cms/api/getters.mjs +10 -1
- package/dist/packages/stack/src/plugins/cms/api/mutations.cjs +48 -0
- package/dist/packages/stack/src/plugins/cms/api/mutations.mjs +46 -0
- package/dist/packages/stack/src/plugins/cms/api/plugin.cjs +75 -0
- package/dist/packages/stack/src/plugins/cms/api/plugin.mjs +76 -1
- 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/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 +9 -0
- package/dist/packages/stack/src/plugins/form-builder/api/getters.mjs +9 -1
- package/dist/packages/stack/src/plugins/form-builder/api/plugin.cjs +62 -1
- package/dist/packages/stack/src/plugins/form-builder/api/plugin.mjs +63 -2
- 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/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/mutations.cjs +91 -0
- package/dist/packages/stack/src/plugins/kanban/api/mutations.mjs +87 -0
- package/dist/packages/stack/src/plugins/kanban/api/plugin.cjs +34 -1
- package/dist/packages/stack/src/plugins/kanban/api/plugin.mjs +34 -1
- 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/hooks/kanban-hooks.cjs +7 -3
- package/dist/packages/stack/src/plugins/kanban/client/hooks/kanban-hooks.mjs +7 -3
- package/dist/packages/stack/src/plugins/kanban/client/plugin.cjs +10 -0
- package/dist/packages/stack/src/plugins/kanban/client/plugin.mjs +11 -1
- package/dist/packages/stack/src/plugins/ui-builder/client/components/pages/page-builder-page.internal.cjs +89 -0
- package/dist/packages/stack/src/plugins/ui-builder/client/components/pages/page-builder-page.internal.mjs +89 -0
- 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.d.cts +1 -1
- package/dist/plugins/ai-chat/api/index.d.mts +1 -1
- package/dist/plugins/ai-chat/api/index.d.ts +1 -1
- package/dist/plugins/ai-chat/client/components/index.d.cts +1 -1
- package/dist/plugins/ai-chat/client/components/index.d.mts +1 -1
- package/dist/plugins/ai-chat/client/components/index.d.ts +1 -1
- package/dist/plugins/ai-chat/client/context/page-ai-context.cjs +92 -0
- package/dist/plugins/ai-chat/client/context/page-ai-context.d.cts +84 -0
- package/dist/plugins/ai-chat/client/context/page-ai-context.d.mts +84 -0
- package/dist/plugins/ai-chat/client/context/page-ai-context.d.ts +84 -0
- package/dist/plugins/ai-chat/client/context/page-ai-context.mjs +88 -0
- package/dist/plugins/ai-chat/client/hooks/index.d.cts +1 -1
- package/dist/plugins/ai-chat/client/hooks/index.d.mts +1 -1
- package/dist/plugins/ai-chat/client/hooks/index.d.ts +1 -1
- package/dist/plugins/ai-chat/client/index.d.cts +2 -2
- package/dist/plugins/ai-chat/client/index.d.mts +2 -2
- package/dist/plugins/ai-chat/client/index.d.ts +2 -2
- package/dist/plugins/ai-chat/query-keys.d.cts +1 -1
- package/dist/plugins/ai-chat/query-keys.d.mts +1 -1
- package/dist/plugins/ai-chat/query-keys.d.ts +1 -1
- package/dist/plugins/blog/api/index.cjs +5 -0
- package/dist/plugins/blog/api/index.d.cts +19 -4
- package/dist/plugins/blog/api/index.d.mts +19 -4
- package/dist/plugins/blog/api/index.d.ts +19 -4
- package/dist/plugins/blog/api/index.mjs +2 -0
- package/dist/plugins/blog/client/hooks/index.d.cts +3 -3
- package/dist/plugins/blog/client/hooks/index.d.mts +3 -3
- package/dist/plugins/blog/client/hooks/index.d.ts +3 -3
- 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 +6 -5
- package/dist/plugins/blog/query-keys.d.cts +8 -387
- package/dist/plugins/blog/query-keys.d.mts +8 -387
- package/dist/plugins/blog/query-keys.d.ts +8 -387
- package/dist/plugins/blog/query-keys.mjs +6 -5
- package/dist/plugins/client/index.cjs +1 -0
- package/dist/plugins/client/index.d.cts +8 -1
- package/dist/plugins/client/index.d.mts +8 -1
- package/dist/plugins/client/index.d.ts +8 -1
- package/dist/plugins/client/index.mjs +1 -1
- package/dist/plugins/cms/api/index.cjs +8 -0
- package/dist/plugins/cms/api/index.d.cts +7 -219
- package/dist/plugins/cms/api/index.d.mts +7 -219
- package/dist/plugins/cms/api/index.d.ts +7 -219
- package/dist/plugins/cms/api/index.mjs +3 -1
- 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 +5 -9
- package/dist/plugins/cms/query-keys.d.mts +5 -9
- package/dist/plugins/cms/query-keys.d.ts +5 -9
- package/dist/plugins/cms/query-keys.mjs +2 -1
- package/dist/plugins/form-builder/api/index.cjs +6 -0
- package/dist/plugins/form-builder/api/index.d.cts +7 -211
- package/dist/plugins/form-builder/api/index.d.mts +7 -211
- package/dist/plugins/form-builder/api/index.d.ts +7 -211
- package/dist/plugins/form-builder/api/index.mjs +2 -1
- 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 +6 -6
- package/dist/plugins/form-builder/query-keys.d.mts +6 -6
- package/dist/plugins/form-builder/query-keys.d.ts +6 -6
- package/dist/plugins/form-builder/query-keys.mjs +3 -2
- package/dist/plugins/kanban/api/index.cjs +10 -0
- package/dist/plugins/kanban/api/index.d.cts +17 -392
- package/dist/plugins/kanban/api/index.d.mts +17 -392
- package/dist/plugins/kanban/api/index.d.ts +17 -392
- 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 +2 -9
- package/dist/plugins/kanban/query-keys.d.cts +4 -16
- package/dist/plugins/kanban/query-keys.d.mts +4 -16
- package/dist/plugins/kanban/query-keys.d.ts +4 -16
- package/dist/plugins/kanban/query-keys.mjs +2 -9
- 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.B7ONvlD_.d.mts +293 -0
- package/dist/shared/{stack.BeSm90va.d.ts → stack.BEn34wW6.d.ts} +60 -2
- package/dist/shared/stack.BUkC2EsZ.d.cts +327 -0
- package/dist/shared/{stack.DaOcgmrM.d.ts → stack.BV9hnvu4.d.cts} +31 -7
- package/dist/shared/{stack.DaOcgmrM.d.cts → stack.BV9hnvu4.d.mts} +31 -7
- package/dist/shared/{stack.DaOcgmrM.d.mts → stack.BV9hnvu4.d.ts} +31 -7
- package/dist/shared/stack.BepFXT3w.d.mts +500 -0
- package/dist/shared/stack.CL8ts1Mu.d.ts +419 -0
- package/dist/shared/{stack.CXjzTMsb.d.cts → stack.CVDTkMoO.d.cts} +7 -1
- package/dist/shared/{stack.CXjzTMsb.d.mts → stack.CVDTkMoO.d.mts} +7 -1
- package/dist/shared/{stack.CXjzTMsb.d.ts → stack.CVDTkMoO.d.ts} +7 -1
- package/dist/shared/stack.CczspVn2.d.mts +327 -0
- package/dist/shared/stack.CgWzG5jH.d.ts +500 -0
- package/dist/shared/stack.D3GB6wKv.d.cts +500 -0
- package/dist/shared/stack.DASmUVjX.d.ts +327 -0
- package/dist/shared/{stack.QD1y_7NY.d.cts → stack.DJaKVY7v.d.cts} +1 -1
- package/dist/shared/{stack.QD1y_7NY.d.mts → stack.DJaKVY7v.d.mts} +1 -1
- package/dist/shared/{stack.QD1y_7NY.d.ts → stack.DJaKVY7v.d.ts} +1 -1
- package/dist/shared/{stack.Dg09R0oB.d.mts → stack.DTDxgFj8.d.mts} +60 -2
- package/dist/shared/{stack.CMh_EdxW.d.cts → stack.DWoCZff7.d.cts} +60 -2
- package/dist/shared/{stack.CIrIsc-A.d.cts → stack.DdI5W6MB.d.cts} +7 -1
- package/dist/shared/{stack.CIrIsc-A.d.mts → stack.DdI5W6MB.d.mts} +7 -1
- package/dist/shared/{stack.CIrIsc-A.d.ts → stack.DdI5W6MB.d.ts} +7 -1
- package/dist/shared/stack.Dk5r4W1F.d.mts +419 -0
- package/dist/shared/stack.Kq2-QzOC.d.ts +293 -0
- package/dist/shared/stack.heOA9gzA.d.cts +419 -0
- package/dist/shared/stack.kcdnD4gA.d.cts +293 -0
- package/package.json +16 -3
- package/src/client/components/compose.tsx +7 -4
- package/src/plugins/ai-chat/api/page-tools.ts +111 -0
- package/src/plugins/ai-chat/api/plugin.ts +180 -9
- package/src/plugins/ai-chat/client/components/chat-input.tsx +2 -2
- package/src/plugins/ai-chat/client/components/chat-interface.tsx +154 -58
- package/src/plugins/ai-chat/client/components/chat-layout.tsx +166 -32
- package/src/plugins/ai-chat/client/components/chat-sidebar.tsx +1 -1
- package/src/plugins/ai-chat/client/context/page-ai-context.tsx +240 -0
- package/src/plugins/ai-chat/schemas.ts +16 -0
- package/src/plugins/blog/api/index.ts +2 -0
- package/src/plugins/blog/api/plugin.ts +85 -0
- 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/components/forms/post-forms.tsx +29 -2
- package/src/plugins/blog/client/components/pages/edit-post-page.internal.tsx +28 -0
- package/src/plugins/blog/client/components/pages/fill-blog-form-handler.ts +38 -0
- package/src/plugins/blog/client/components/pages/new-post-page.internal.tsx +33 -1
- package/src/plugins/blog/client/components/pages/post-page.internal.tsx +20 -0
- package/src/plugins/blog/client/plugin.tsx +19 -0
- package/src/plugins/blog/query-keys.ts +5 -7
- package/src/plugins/client/index.ts +1 -1
- package/src/plugins/cms/api/getters.ts +24 -0
- package/src/plugins/cms/api/index.ts +14 -1
- package/src/plugins/cms/api/mutations.ts +84 -0
- package/src/plugins/cms/api/plugin.ts +114 -0
- 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/plugin.tsx +19 -0
- package/src/plugins/cms/query-keys.ts +2 -1
- package/src/plugins/form-builder/api/getters.ts +23 -0
- package/src/plugins/form-builder/api/index.ts +15 -2
- package/src/plugins/form-builder/api/plugin.ts +91 -0
- 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/plugin.tsx +19 -0
- package/src/plugins/form-builder/query-keys.ts +6 -2
- package/src/plugins/kanban/api/index.ts +9 -0
- package/src/plugins/kanban/api/mutations.ts +169 -0
- package/src/plugins/kanban/api/plugin.ts +61 -0
- 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/hooks/kanban-hooks.tsx +4 -0
- package/src/plugins/kanban/client/plugin.tsx +13 -0
- package/src/plugins/kanban/query-keys.ts +2 -9
- package/src/plugins/ui-builder/client/components/pages/page-builder-page.internal.tsx +132 -0
- package/src/plugins/utils.ts +19 -0
- package/dist/shared/{stack.BkYlUT_8.d.cts → stack.BQmuNl5p.d.cts} +6 -6
- package/dist/shared/{stack.BkYlUT_8.d.mts → stack.BQmuNl5p.d.mts} +6 -6
- package/dist/shared/{stack.BkYlUT_8.d.ts → stack.BQmuNl5p.d.ts} +6 -6
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A client-side tool handler — receives the AI's tool call args and returns a result.
|
|
5
|
+
* The result is sent back to the model so it can continue the conversation.
|
|
6
|
+
*/
|
|
7
|
+
type PageAIClientTool = (args: any) => Promise<{
|
|
8
|
+
success: boolean;
|
|
9
|
+
message?: string;
|
|
10
|
+
}>;
|
|
11
|
+
/**
|
|
12
|
+
* Configuration registered by a page to provide AI context and capabilities.
|
|
13
|
+
* Any component in the tree can call useRegisterPageAIContext with this config.
|
|
14
|
+
*/
|
|
15
|
+
interface PageAIContextConfig {
|
|
16
|
+
/**
|
|
17
|
+
* Identifier for the current route/page (e.g. "blog-post", "ui-builder-edit-page").
|
|
18
|
+
* Shown as a badge in the chat header.
|
|
19
|
+
*/
|
|
20
|
+
routeName: string;
|
|
21
|
+
/**
|
|
22
|
+
* Human-readable description of the current page and its content.
|
|
23
|
+
* Injected into the AI system prompt so it understands what the user is looking at.
|
|
24
|
+
* Capped at 8,000 characters server-side.
|
|
25
|
+
*/
|
|
26
|
+
pageDescription: string;
|
|
27
|
+
/**
|
|
28
|
+
* Optional suggested prompts shown as quick-action chips in the chat empty state.
|
|
29
|
+
* These augment (not replace) any static suggestions configured in plugin overrides.
|
|
30
|
+
*/
|
|
31
|
+
suggestions?: string[];
|
|
32
|
+
/**
|
|
33
|
+
* Client-side tool handlers keyed by tool name.
|
|
34
|
+
* When the AI calls a tool by this name, the handler is invoked with the tool args.
|
|
35
|
+
* The result is sent back to the model via addToolResult.
|
|
36
|
+
*
|
|
37
|
+
* Tool schemas must be registered server-side via enablePageTools + clientToolSchemas
|
|
38
|
+
* in aiChatBackendPlugin (built-in tools like fillBlogForm are pre-registered).
|
|
39
|
+
*/
|
|
40
|
+
clientTools?: Record<string, PageAIClientTool>;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Provider that enables route-aware AI context across the app.
|
|
44
|
+
*
|
|
45
|
+
* Place this at the root layout — above all StackProviders — so it spans
|
|
46
|
+
* both your main app tree and any chat modals rendered as parallel/intercept routes.
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* // app/layout.tsx
|
|
50
|
+
* import { PageAIContextProvider } from "@btst/stack/plugins/ai-chat/client/context"
|
|
51
|
+
*
|
|
52
|
+
* export default function RootLayout({ children }) {
|
|
53
|
+
* return <PageAIContextProvider>{children}</PageAIContextProvider>
|
|
54
|
+
* }
|
|
55
|
+
*/
|
|
56
|
+
declare function PageAIContextProvider({ children, }: {
|
|
57
|
+
children: React.ReactNode;
|
|
58
|
+
}): react_jsx_runtime.JSX.Element;
|
|
59
|
+
/**
|
|
60
|
+
* Register page AI context from any component.
|
|
61
|
+
* The registration is cleaned up automatically when the component unmounts.
|
|
62
|
+
*
|
|
63
|
+
* Pass `null` to conditionally disable context (e.g. while data is loading).
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* // Blog post page
|
|
67
|
+
* useRegisterPageAIContext(post ? {
|
|
68
|
+
* routeName: "blog-post",
|
|
69
|
+
* pageDescription: `Blog post: "${post.title}"\n\n${post.content?.slice(0, 16000)}`,
|
|
70
|
+
* suggestions: ["Summarize this post", "What are the key takeaways?"],
|
|
71
|
+
* } : null)
|
|
72
|
+
*/
|
|
73
|
+
declare function useRegisterPageAIContext(config: PageAIContextConfig | null): void;
|
|
74
|
+
/**
|
|
75
|
+
* Read the currently active page AI context.
|
|
76
|
+
* Returns null when no page has registered context, or when PageAIContextProvider
|
|
77
|
+
* is not in the tree.
|
|
78
|
+
*
|
|
79
|
+
* Used internally by ChatInterface to inject context into requests.
|
|
80
|
+
*/
|
|
81
|
+
declare function usePageAIContext(): PageAIContextConfig | null;
|
|
82
|
+
|
|
83
|
+
export { PageAIContextProvider, usePageAIContext, useRegisterPageAIContext };
|
|
84
|
+
export type { PageAIClientTool, PageAIContextConfig };
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { createContext, useRef, useState, useCallback, useMemo, useContext, useId, useEffect } from 'react';
|
|
4
|
+
|
|
5
|
+
const PageAIAPIContext = createContext(null);
|
|
6
|
+
const PageAIVersionContext = createContext(0);
|
|
7
|
+
function PageAIContextProvider({
|
|
8
|
+
children
|
|
9
|
+
}) {
|
|
10
|
+
const registrationsRef = useRef(/* @__PURE__ */ new Map());
|
|
11
|
+
const insertionOrderRef = useRef([]);
|
|
12
|
+
const [version, setVersion] = useState(0);
|
|
13
|
+
const bumpVersion = useCallback(() => setVersion((v) => v + 1), []);
|
|
14
|
+
const register = useCallback(
|
|
15
|
+
(id, config) => {
|
|
16
|
+
registrationsRef.current.set(id, config);
|
|
17
|
+
insertionOrderRef.current = insertionOrderRef.current.filter(
|
|
18
|
+
(k) => k !== id
|
|
19
|
+
);
|
|
20
|
+
insertionOrderRef.current.push(id);
|
|
21
|
+
bumpVersion();
|
|
22
|
+
},
|
|
23
|
+
[bumpVersion]
|
|
24
|
+
);
|
|
25
|
+
const unregister = useCallback(
|
|
26
|
+
(id) => {
|
|
27
|
+
registrationsRef.current.delete(id);
|
|
28
|
+
insertionOrderRef.current = insertionOrderRef.current.filter(
|
|
29
|
+
(k) => k !== id
|
|
30
|
+
);
|
|
31
|
+
bumpVersion();
|
|
32
|
+
},
|
|
33
|
+
[bumpVersion]
|
|
34
|
+
);
|
|
35
|
+
const getActive = useCallback(() => {
|
|
36
|
+
const order = insertionOrderRef.current;
|
|
37
|
+
if (order.length === 0) return null;
|
|
38
|
+
const lastId = order[order.length - 1];
|
|
39
|
+
if (!lastId) return null;
|
|
40
|
+
return registrationsRef.current.get(lastId) ?? null;
|
|
41
|
+
}, []);
|
|
42
|
+
const api = useMemo(
|
|
43
|
+
() => ({ register, unregister, getActive }),
|
|
44
|
+
[register, unregister, getActive]
|
|
45
|
+
);
|
|
46
|
+
return /* @__PURE__ */ jsx(PageAIAPIContext.Provider, { value: api, children: /* @__PURE__ */ jsx(PageAIVersionContext.Provider, { value: version, children }) });
|
|
47
|
+
}
|
|
48
|
+
function useRegisterPageAIContext(config) {
|
|
49
|
+
const ctx = useContext(PageAIAPIContext);
|
|
50
|
+
const id = useId();
|
|
51
|
+
const configRef = useRef(config);
|
|
52
|
+
configRef.current = config;
|
|
53
|
+
useEffect(() => {
|
|
54
|
+
if (!ctx || !configRef.current) return;
|
|
55
|
+
ctx.register(id, {
|
|
56
|
+
get routeName() {
|
|
57
|
+
return configRef.current?.routeName ?? "";
|
|
58
|
+
},
|
|
59
|
+
get pageDescription() {
|
|
60
|
+
return configRef.current?.pageDescription ?? "";
|
|
61
|
+
},
|
|
62
|
+
get suggestions() {
|
|
63
|
+
return configRef.current?.suggestions;
|
|
64
|
+
},
|
|
65
|
+
get clientTools() {
|
|
66
|
+
return configRef.current?.clientTools;
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
return () => {
|
|
70
|
+
ctx.unregister(id);
|
|
71
|
+
};
|
|
72
|
+
}, [
|
|
73
|
+
ctx,
|
|
74
|
+
id,
|
|
75
|
+
config === null,
|
|
76
|
+
config?.routeName,
|
|
77
|
+
config?.pageDescription,
|
|
78
|
+
JSON.stringify(config?.suggestions)
|
|
79
|
+
]);
|
|
80
|
+
}
|
|
81
|
+
function usePageAIContext() {
|
|
82
|
+
useContext(PageAIVersionContext);
|
|
83
|
+
const ctx = useContext(PageAIAPIContext);
|
|
84
|
+
if (!ctx) return null;
|
|
85
|
+
return ctx.getActive();
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export { PageAIContextProvider, usePageAIContext, useRegisterPageAIContext };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
2
|
-
import { f as ConversationWithMessages } from '../../../../shared/stack.
|
|
2
|
+
import { f as ConversationWithMessages } from '../../../../shared/stack.DWoCZff7.cjs';
|
|
3
3
|
import { S as SerializedConversation } from '../../../../shared/stack.Be1QIHEn.cjs';
|
|
4
4
|
export { a as SerializedMessage } from '../../../../shared/stack.Be1QIHEn.cjs';
|
|
5
5
|
import '@btst/stack/plugins/client';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
2
|
-
import { f as ConversationWithMessages } from '../../../../shared/stack.
|
|
2
|
+
import { f as ConversationWithMessages } from '../../../../shared/stack.DTDxgFj8.mjs';
|
|
3
3
|
import { S as SerializedConversation } from '../../../../shared/stack.Be1QIHEn.mjs';
|
|
4
4
|
export { a as SerializedMessage } from '../../../../shared/stack.Be1QIHEn.mjs';
|
|
5
5
|
import '@btst/stack/plugins/client';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
2
|
-
import { f as ConversationWithMessages } from '../../../../shared/stack.
|
|
2
|
+
import { f as ConversationWithMessages } from '../../../../shared/stack.BEn34wW6.js';
|
|
3
3
|
import { S as SerializedConversation } from '../../../../shared/stack.Be1QIHEn.js';
|
|
4
4
|
export { a as SerializedMessage } from '../../../../shared/stack.Be1QIHEn.js';
|
|
5
5
|
import '@btst/stack/plugins/client';
|
|
@@ -3,8 +3,8 @@ import * as react from 'react';
|
|
|
3
3
|
import * as _btst_yar from '@btst/yar';
|
|
4
4
|
import { QueryClient } from '@tanstack/react-query';
|
|
5
5
|
import { S as SerializedConversation, a as SerializedMessage } from '../../../shared/stack.Be1QIHEn.cjs';
|
|
6
|
-
import { A as AiChatMode } from '../../../shared/stack.
|
|
7
|
-
export { a as AiChatPluginOverrides, b as AllowedFileType, i as ChatInput, C as ChatInterface, e as ChatLayout, f as ChatLayoutProps, h as ChatMessage, g as ChatSidebar, D as DEFAULT_ALLOWED_FILE_TYPES, j as ToolCallDisplay, T as ToolCallProps, d as ToolCallRenderer, c as ToolCallState } from '../../../shared/stack.
|
|
6
|
+
import { A as AiChatMode } from '../../../shared/stack.BV9hnvu4.cjs';
|
|
7
|
+
export { a as AiChatPluginOverrides, b as AllowedFileType, i as ChatInput, C as ChatInterface, e as ChatLayout, f as ChatLayoutProps, h as ChatMessage, g as ChatSidebar, D as DEFAULT_ALLOWED_FILE_TYPES, j as ToolCallDisplay, T as ToolCallProps, d as ToolCallRenderer, c as ToolCallState } from '../../../shared/stack.BV9hnvu4.cjs';
|
|
8
8
|
export { UIMessage } from 'ai';
|
|
9
9
|
import 'react/jsx-runtime';
|
|
10
10
|
|
|
@@ -3,8 +3,8 @@ import * as react from 'react';
|
|
|
3
3
|
import * as _btst_yar from '@btst/yar';
|
|
4
4
|
import { QueryClient } from '@tanstack/react-query';
|
|
5
5
|
import { S as SerializedConversation, a as SerializedMessage } from '../../../shared/stack.Be1QIHEn.mjs';
|
|
6
|
-
import { A as AiChatMode } from '../../../shared/stack.
|
|
7
|
-
export { a as AiChatPluginOverrides, b as AllowedFileType, i as ChatInput, C as ChatInterface, e as ChatLayout, f as ChatLayoutProps, h as ChatMessage, g as ChatSidebar, D as DEFAULT_ALLOWED_FILE_TYPES, j as ToolCallDisplay, T as ToolCallProps, d as ToolCallRenderer, c as ToolCallState } from '../../../shared/stack.
|
|
6
|
+
import { A as AiChatMode } from '../../../shared/stack.BV9hnvu4.mjs';
|
|
7
|
+
export { a as AiChatPluginOverrides, b as AllowedFileType, i as ChatInput, C as ChatInterface, e as ChatLayout, f as ChatLayoutProps, h as ChatMessage, g as ChatSidebar, D as DEFAULT_ALLOWED_FILE_TYPES, j as ToolCallDisplay, T as ToolCallProps, d as ToolCallRenderer, c as ToolCallState } from '../../../shared/stack.BV9hnvu4.mjs';
|
|
8
8
|
export { UIMessage } from 'ai';
|
|
9
9
|
import 'react/jsx-runtime';
|
|
10
10
|
|
|
@@ -3,8 +3,8 @@ import * as react from 'react';
|
|
|
3
3
|
import * as _btst_yar from '@btst/yar';
|
|
4
4
|
import { QueryClient } from '@tanstack/react-query';
|
|
5
5
|
import { S as SerializedConversation, a as SerializedMessage } from '../../../shared/stack.Be1QIHEn.js';
|
|
6
|
-
import { A as AiChatMode } from '../../../shared/stack.
|
|
7
|
-
export { a as AiChatPluginOverrides, b as AllowedFileType, i as ChatInput, C as ChatInterface, e as ChatLayout, f as ChatLayoutProps, h as ChatMessage, g as ChatSidebar, D as DEFAULT_ALLOWED_FILE_TYPES, j as ToolCallDisplay, T as ToolCallProps, d as ToolCallRenderer, c as ToolCallState } from '../../../shared/stack.
|
|
6
|
+
import { A as AiChatMode } from '../../../shared/stack.BV9hnvu4.js';
|
|
7
|
+
export { a as AiChatPluginOverrides, b as AllowedFileType, i as ChatInput, C as ChatInterface, e as ChatLayout, f as ChatLayoutProps, h as ChatMessage, g as ChatSidebar, D as DEFAULT_ALLOWED_FILE_TYPES, j as ToolCallDisplay, T as ToolCallProps, d as ToolCallRenderer, c as ToolCallState } from '../../../shared/stack.BV9hnvu4.js';
|
|
8
8
|
export { UIMessage } from 'ai';
|
|
9
9
|
import 'react/jsx-runtime';
|
|
10
10
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import '@tanstack/react-query';
|
|
2
2
|
import '@btst/stack/plugins/client';
|
|
3
3
|
import '../../shared/stack.Be1QIHEn.cjs';
|
|
4
|
-
export { f as ConversationWithMessages, c as createAiChatQueryKeys } from '../../shared/stack.
|
|
4
|
+
export { f as ConversationWithMessages, c as createAiChatQueryKeys } from '../../shared/stack.DWoCZff7.cjs';
|
|
5
5
|
import '@btst/stack/plugins/api';
|
|
6
6
|
import 'better-call';
|
|
7
7
|
import 'zod/v4/core';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import '@tanstack/react-query';
|
|
2
2
|
import '@btst/stack/plugins/client';
|
|
3
3
|
import '../../shared/stack.Be1QIHEn.mjs';
|
|
4
|
-
export { f as ConversationWithMessages, c as createAiChatQueryKeys } from '../../shared/stack.
|
|
4
|
+
export { f as ConversationWithMessages, c as createAiChatQueryKeys } from '../../shared/stack.DTDxgFj8.mjs';
|
|
5
5
|
import '@btst/stack/plugins/api';
|
|
6
6
|
import 'better-call';
|
|
7
7
|
import 'zod/v4/core';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import '@tanstack/react-query';
|
|
2
2
|
import '@btst/stack/plugins/client';
|
|
3
3
|
import '../../shared/stack.Be1QIHEn.js';
|
|
4
|
-
export { f as ConversationWithMessages, c as createAiChatQueryKeys } from '../../shared/stack.
|
|
4
|
+
export { f as ConversationWithMessages, c as createAiChatQueryKeys } from '../../shared/stack.BEn34wW6.js';
|
|
5
5
|
import '@btst/stack/plugins/api';
|
|
6
6
|
import 'better-call';
|
|
7
7
|
import 'zod/v4/core';
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
const plugin = require('../../../packages/stack/src/plugins/blog/api/plugin.cjs');
|
|
4
4
|
const getters = require('../../../packages/stack/src/plugins/blog/api/getters.cjs');
|
|
5
|
+
const serializers = require('../../../packages/stack/src/plugins/blog/api/serializers.cjs');
|
|
6
|
+
const queryKeyDefs = require('../../../packages/stack/src/plugins/blog/api/query-key-defs.cjs');
|
|
5
7
|
const plugins_blog_queryKeys = require('../query-keys.cjs');
|
|
6
8
|
|
|
7
9
|
|
|
@@ -12,4 +14,7 @@ exports.blogBackendPlugin = plugin.blogBackendPlugin;
|
|
|
12
14
|
exports.getAllPosts = getters.getAllPosts;
|
|
13
15
|
exports.getAllTags = getters.getAllTags;
|
|
14
16
|
exports.getPostBySlug = getters.getPostBySlug;
|
|
17
|
+
exports.serializePost = serializers.serializePost;
|
|
18
|
+
exports.serializeTag = serializers.serializeTag;
|
|
19
|
+
exports.BLOG_QUERY_KEYS = queryKeyDefs.BLOG_QUERY_KEYS;
|
|
15
20
|
exports.createBlogQueryKeys = plugins_blog_queryKeys.createBlogQueryKeys;
|
|
@@ -1,8 +1,23 @@
|
|
|
1
|
-
export { B as
|
|
1
|
+
export { B as BLOG_QUERY_KEYS, h as BlogApiContext, k as BlogApiRouter, i as BlogBackendHooks, e as BlogRouteKey, N as NextPreviousPostsQuerySchema, P as PostListParams, f as PostListQuerySchema, c as PostListResult, j as blogBackendPlugin, d as createBlogQueryKeys, g as getAllPosts, b as getAllTags, a as getPostBySlug } from '../../../shared/stack.heOA9gzA.cjs';
|
|
2
|
+
import { P as Post, T as Tag, S as SerializedPost, a as SerializedTag } from '../../../shared/stack.BQmuNl5p.cjs';
|
|
3
|
+
import '@tanstack/react-query';
|
|
4
|
+
import '@btst/stack/plugins/client';
|
|
2
5
|
import '@btst/stack/plugins/api';
|
|
3
6
|
import 'better-call';
|
|
4
7
|
import '@btst/db';
|
|
5
|
-
import '../../../shared/stack.BkYlUT_8.cjs';
|
|
6
8
|
import 'zod';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Serialize a Tag for SSR/SSG use (convert dates to strings).
|
|
12
|
+
* Pure function — no DB access, no hooks.
|
|
13
|
+
*/
|
|
14
|
+
declare function serializeTag(tag: Tag): SerializedTag;
|
|
15
|
+
/**
|
|
16
|
+
* Serialize a Post (with tags) for SSR/SSG use (convert dates to strings).
|
|
17
|
+
* Pure function — no DB access, no hooks.
|
|
18
|
+
*/
|
|
19
|
+
declare function serializePost(post: Post & {
|
|
20
|
+
tags: Tag[];
|
|
21
|
+
}): SerializedPost;
|
|
22
|
+
|
|
23
|
+
export { serializePost, serializeTag };
|
|
@@ -1,8 +1,23 @@
|
|
|
1
|
-
export { B as
|
|
1
|
+
export { B as BLOG_QUERY_KEYS, h as BlogApiContext, k as BlogApiRouter, i as BlogBackendHooks, e as BlogRouteKey, N as NextPreviousPostsQuerySchema, P as PostListParams, f as PostListQuerySchema, c as PostListResult, j as blogBackendPlugin, d as createBlogQueryKeys, g as getAllPosts, b as getAllTags, a as getPostBySlug } from '../../../shared/stack.Dk5r4W1F.mjs';
|
|
2
|
+
import { P as Post, T as Tag, S as SerializedPost, a as SerializedTag } from '../../../shared/stack.BQmuNl5p.mjs';
|
|
3
|
+
import '@tanstack/react-query';
|
|
4
|
+
import '@btst/stack/plugins/client';
|
|
2
5
|
import '@btst/stack/plugins/api';
|
|
3
6
|
import 'better-call';
|
|
4
7
|
import '@btst/db';
|
|
5
|
-
import '../../../shared/stack.BkYlUT_8.mjs';
|
|
6
8
|
import 'zod';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Serialize a Tag for SSR/SSG use (convert dates to strings).
|
|
12
|
+
* Pure function — no DB access, no hooks.
|
|
13
|
+
*/
|
|
14
|
+
declare function serializeTag(tag: Tag): SerializedTag;
|
|
15
|
+
/**
|
|
16
|
+
* Serialize a Post (with tags) for SSR/SSG use (convert dates to strings).
|
|
17
|
+
* Pure function — no DB access, no hooks.
|
|
18
|
+
*/
|
|
19
|
+
declare function serializePost(post: Post & {
|
|
20
|
+
tags: Tag[];
|
|
21
|
+
}): SerializedPost;
|
|
22
|
+
|
|
23
|
+
export { serializePost, serializeTag };
|
|
@@ -1,8 +1,23 @@
|
|
|
1
|
-
export { B as
|
|
1
|
+
export { B as BLOG_QUERY_KEYS, h as BlogApiContext, k as BlogApiRouter, i as BlogBackendHooks, e as BlogRouteKey, N as NextPreviousPostsQuerySchema, P as PostListParams, f as PostListQuerySchema, c as PostListResult, j as blogBackendPlugin, d as createBlogQueryKeys, g as getAllPosts, b as getAllTags, a as getPostBySlug } from '../../../shared/stack.CL8ts1Mu.js';
|
|
2
|
+
import { P as Post, T as Tag, S as SerializedPost, a as SerializedTag } from '../../../shared/stack.BQmuNl5p.js';
|
|
3
|
+
import '@tanstack/react-query';
|
|
4
|
+
import '@btst/stack/plugins/client';
|
|
2
5
|
import '@btst/stack/plugins/api';
|
|
3
6
|
import 'better-call';
|
|
4
7
|
import '@btst/db';
|
|
5
|
-
import '../../../shared/stack.BkYlUT_8.js';
|
|
6
8
|
import 'zod';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Serialize a Tag for SSR/SSG use (convert dates to strings).
|
|
12
|
+
* Pure function — no DB access, no hooks.
|
|
13
|
+
*/
|
|
14
|
+
declare function serializeTag(tag: Tag): SerializedTag;
|
|
15
|
+
/**
|
|
16
|
+
* Serialize a Post (with tags) for SSR/SSG use (convert dates to strings).
|
|
17
|
+
* Pure function — no DB access, no hooks.
|
|
18
|
+
*/
|
|
19
|
+
declare function serializePost(post: Post & {
|
|
20
|
+
tags: Tag[];
|
|
21
|
+
}): SerializedPost;
|
|
22
|
+
|
|
23
|
+
export { serializePost, serializeTag };
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
export { NextPreviousPostsQuerySchema, PostListQuerySchema, blogBackendPlugin } from '../../../packages/stack/src/plugins/blog/api/plugin.mjs';
|
|
2
2
|
export { getAllPosts, getAllTags, getPostBySlug } from '../../../packages/stack/src/plugins/blog/api/getters.mjs';
|
|
3
|
+
export { serializePost, serializeTag } from '../../../packages/stack/src/plugins/blog/api/serializers.mjs';
|
|
4
|
+
export { BLOG_QUERY_KEYS } from '../../../packages/stack/src/plugins/blog/api/query-key-defs.mjs';
|
|
3
5
|
export { createBlogQueryKeys } from '../query-keys.mjs';
|
|
@@ -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.BQmuNl5p.cjs';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -128,8 +128,6 @@ declare function useSuspenseTags(): {
|
|
|
128
128
|
};
|
|
129
129
|
/** Create a new post */
|
|
130
130
|
declare function useCreatePost(): _tanstack_react_query.UseMutationResult<SerializedPost | null, Error, {
|
|
131
|
-
title: string;
|
|
132
|
-
published: boolean;
|
|
133
131
|
tags: ({
|
|
134
132
|
name: string;
|
|
135
133
|
} | {
|
|
@@ -137,8 +135,10 @@ declare function useCreatePost(): _tanstack_react_query.UseMutationResult<Serial
|
|
|
137
135
|
name: string;
|
|
138
136
|
slug: string;
|
|
139
137
|
})[];
|
|
138
|
+
title: string;
|
|
140
139
|
content: string;
|
|
141
140
|
excerpt: string;
|
|
141
|
+
published: boolean;
|
|
142
142
|
slug?: string | undefined;
|
|
143
143
|
createdAt?: Date | undefined;
|
|
144
144
|
updatedAt?: Date | undefined;
|
|
@@ -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.BQmuNl5p.mjs';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -128,8 +128,6 @@ declare function useSuspenseTags(): {
|
|
|
128
128
|
};
|
|
129
129
|
/** Create a new post */
|
|
130
130
|
declare function useCreatePost(): _tanstack_react_query.UseMutationResult<SerializedPost | null, Error, {
|
|
131
|
-
title: string;
|
|
132
|
-
published: boolean;
|
|
133
131
|
tags: ({
|
|
134
132
|
name: string;
|
|
135
133
|
} | {
|
|
@@ -137,8 +135,10 @@ declare function useCreatePost(): _tanstack_react_query.UseMutationResult<Serial
|
|
|
137
135
|
name: string;
|
|
138
136
|
slug: string;
|
|
139
137
|
})[];
|
|
138
|
+
title: string;
|
|
140
139
|
content: string;
|
|
141
140
|
excerpt: string;
|
|
141
|
+
published: boolean;
|
|
142
142
|
slug?: string | undefined;
|
|
143
143
|
createdAt?: Date | undefined;
|
|
144
144
|
updatedAt?: Date | undefined;
|
|
@@ -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.BQmuNl5p.js';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -128,8 +128,6 @@ declare function useSuspenseTags(): {
|
|
|
128
128
|
};
|
|
129
129
|
/** Create a new post */
|
|
130
130
|
declare function useCreatePost(): _tanstack_react_query.UseMutationResult<SerializedPost | null, Error, {
|
|
131
|
-
title: string;
|
|
132
|
-
published: boolean;
|
|
133
131
|
tags: ({
|
|
134
132
|
name: string;
|
|
135
133
|
} | {
|
|
@@ -137,8 +135,10 @@ declare function useCreatePost(): _tanstack_react_query.UseMutationResult<Serial
|
|
|
137
135
|
name: string;
|
|
138
136
|
slug: string;
|
|
139
137
|
})[];
|
|
138
|
+
title: string;
|
|
140
139
|
content: string;
|
|
141
140
|
excerpt: string;
|
|
141
|
+
published: boolean;
|
|
142
142
|
slug?: string | undefined;
|
|
143
143
|
createdAt?: Date | undefined;
|
|
144
144
|
updatedAt?: Date | undefined;
|
|
@@ -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.BQmuNl5p.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.BQmuNl5p.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.BQmuNl5p.js';
|
|
7
7
|
export { UsePostsOptions, UsePostsResult } from './hooks/index.js';
|
|
8
8
|
import 'zod';
|
|
9
9
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const queryKeyFactory = require('@lukemorales/query-key-factory');
|
|
4
|
+
const queryKeyDefs = require('../../packages/stack/src/plugins/blog/api/query-key-defs.cjs');
|
|
4
5
|
|
|
5
6
|
function isErrorResponse(response) {
|
|
6
7
|
return typeof response === "object" && response !== null && "error" in response && response.error !== null && response.error !== void 0;
|
|
@@ -28,12 +29,12 @@ function createPostsQueries(client, headers) {
|
|
|
28
29
|
return queryKeyFactory.createQueryKeys("posts", {
|
|
29
30
|
list: (params) => ({
|
|
30
31
|
queryKey: [
|
|
31
|
-
{
|
|
32
|
-
query: params?.query !== void 0 && params?.query?.trim() === "" ? void 0 : params?.query,
|
|
33
|
-
limit: params?.limit ?? 10,
|
|
32
|
+
queryKeyDefs.postsListDiscriminator({
|
|
34
33
|
published: params?.published ?? true,
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
limit: params?.limit ?? 10,
|
|
35
|
+
tagSlug: params?.tagSlug,
|
|
36
|
+
query: params?.query
|
|
37
|
+
})
|
|
37
38
|
],
|
|
38
39
|
queryFn: async ({ pageParam }) => {
|
|
39
40
|
try {
|