@btst/stack 2.4.0 → 2.5.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/plugins/ai-chat/api/plugin.cjs +33 -47
- package/dist/packages/stack/src/plugins/ai-chat/api/plugin.mjs +33 -47
- package/dist/packages/stack/src/plugins/ai-chat/client/plugin.cjs +14 -21
- package/dist/packages/stack/src/plugins/ai-chat/client/plugin.mjs +15 -22
- package/dist/packages/stack/src/plugins/blog/api/plugin.cjs +28 -45
- package/dist/packages/stack/src/plugins/blog/api/plugin.mjs +22 -39
- package/dist/packages/stack/src/plugins/blog/client/plugin.cjs +23 -27
- package/dist/packages/stack/src/plugins/blog/client/plugin.mjs +24 -28
- package/dist/packages/stack/src/plugins/cms/api/plugin.cjs +14 -17
- package/dist/packages/stack/src/plugins/cms/api/plugin.mjs +14 -17
- package/dist/packages/stack/src/plugins/cms/client/plugin.cjs +11 -15
- package/dist/packages/stack/src/plugins/cms/client/plugin.mjs +12 -16
- package/dist/packages/stack/src/plugins/form-builder/api/plugin.cjs +58 -62
- package/dist/packages/stack/src/plugins/form-builder/api/plugin.mjs +58 -62
- package/dist/packages/stack/src/plugins/form-builder/client/plugin.cjs +12 -12
- package/dist/packages/stack/src/plugins/form-builder/client/plugin.mjs +13 -13
- package/dist/packages/stack/src/plugins/kanban/api/plugin.cjs +86 -117
- package/dist/packages/stack/src/plugins/kanban/api/plugin.mjs +83 -114
- package/dist/packages/stack/src/plugins/kanban/client/plugin.cjs +22 -29
- package/dist/packages/stack/src/plugins/kanban/client/plugin.mjs +23 -30
- package/dist/packages/stack/src/plugins/ui-builder/client/plugin.cjs +8 -8
- package/dist/packages/stack/src/plugins/ui-builder/client/plugin.mjs +9 -9
- package/dist/packages/stack/src/plugins/utils.cjs +42 -0
- package/dist/packages/stack/src/plugins/utils.mjs +41 -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/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 +8 -8
- package/dist/plugins/ai-chat/client/index.d.mts +8 -8
- package/dist/plugins/ai-chat/client/index.d.ts +8 -8
- 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.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/index.d.cts +12 -12
- package/dist/plugins/blog/client/index.d.mts +12 -12
- package/dist/plugins/blog/client/index.d.ts +12 -12
- package/dist/plugins/blog/query-keys.d.cts +1 -1
- package/dist/plugins/blog/query-keys.d.mts +1 -1
- package/dist/plugins/blog/query-keys.d.ts +1 -1
- 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.d.cts +2 -2
- package/dist/plugins/cms/api/index.d.mts +2 -2
- package/dist/plugins/cms/api/index.d.ts +2 -2
- 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/client/index.d.cts +6 -6
- package/dist/plugins/cms/client/index.d.mts +6 -6
- package/dist/plugins/cms/client/index.d.ts +6 -6
- package/dist/plugins/cms/query-keys.d.cts +2 -2
- package/dist/plugins/cms/query-keys.d.mts +2 -2
- package/dist/plugins/cms/query-keys.d.ts +2 -2
- package/dist/plugins/form-builder/api/index.d.cts +2 -2
- package/dist/plugins/form-builder/api/index.d.mts +2 -2
- package/dist/plugins/form-builder/api/index.d.ts +2 -2
- 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/client/index.d.cts +6 -6
- package/dist/plugins/form-builder/client/index.d.mts +6 -6
- package/dist/plugins/form-builder/client/index.d.ts +6 -6
- package/dist/plugins/form-builder/query-keys.d.cts +2 -2
- package/dist/plugins/form-builder/query-keys.d.mts +2 -2
- package/dist/plugins/form-builder/query-keys.d.ts +2 -2
- package/dist/plugins/kanban/api/index.d.cts +1 -1
- package/dist/plugins/kanban/api/index.d.mts +1 -1
- package/dist/plugins/kanban/api/index.d.ts +1 -1
- package/dist/plugins/kanban/client/index.d.cts +12 -12
- package/dist/plugins/kanban/client/index.d.mts +12 -12
- package/dist/plugins/kanban/client/index.d.ts +12 -12
- package/dist/plugins/kanban/query-keys.d.cts +1 -1
- package/dist/plugins/kanban/query-keys.d.mts +1 -1
- package/dist/plugins/kanban/query-keys.d.ts +1 -1
- package/dist/plugins/ui-builder/client/hooks/index.d.cts +1 -1
- package/dist/plugins/ui-builder/client/hooks/index.d.mts +1 -1
- package/dist/plugins/ui-builder/client/hooks/index.d.ts +1 -1
- package/dist/plugins/ui-builder/client/index.d.cts +3 -3
- package/dist/plugins/ui-builder/client/index.d.mts +3 -3
- package/dist/plugins/ui-builder/client/index.d.ts +3 -3
- package/dist/plugins/ui-builder/index.d.cts +2 -2
- package/dist/plugins/ui-builder/index.d.mts +2 -2
- package/dist/plugins/ui-builder/index.d.ts +2 -2
- package/dist/shared/{stack.C-WUPMT6.d.cts → stack.B2xZTSiO.d.cts} +4 -4
- package/dist/shared/{stack.CczspVn2.d.mts → stack.B58oHdqm.d.mts} +1 -1
- package/dist/shared/{stack.CVDTkMoO.d.mts → stack.B8QD11QU.d.cts} +7 -7
- package/dist/shared/{stack.CVDTkMoO.d.cts → stack.B8QD11QU.d.mts} +7 -7
- package/dist/shared/{stack.CVDTkMoO.d.ts → stack.B8QD11QU.d.ts} +7 -7
- package/dist/shared/{stack.Kq2-QzOC.d.ts → stack.BDVEpue1.d.ts} +2 -2
- package/dist/shared/{stack.B7ONvlD_.d.mts → stack.BTvbxZvw.d.cts} +2 -2
- package/dist/shared/{stack.DdI5W6MB.d.mts → stack.BozPgbrZ.d.cts} +19 -19
- package/dist/shared/{stack.DdI5W6MB.d.cts → stack.BozPgbrZ.d.mts} +19 -19
- package/dist/shared/{stack.DdI5W6MB.d.ts → stack.BozPgbrZ.d.ts} +19 -19
- package/dist/shared/{stack.BUkC2EsZ.d.cts → stack.C9Mg2Q46.d.cts} +1 -1
- package/dist/shared/{stack.BEn34wW6.d.ts → stack.CTDVxbrA.d.ts} +12 -12
- package/dist/shared/{stack.C-Ptrz8s.d.ts → stack.Cj_zKww4.d.ts} +4 -4
- package/dist/shared/{stack.BepFXT3w.d.mts → stack.CxaFNQCV.d.mts} +25 -25
- package/dist/shared/{stack.DWoCZff7.d.cts → stack.D-b5zbPm.d.cts} +12 -12
- package/dist/shared/{stack.kcdnD4gA.d.cts → stack.DTtmJPQO.d.mts} +2 -2
- package/dist/shared/{stack.CL8ts1Mu.d.ts → stack.DXnclTG7.d.ts} +8 -8
- package/dist/shared/{stack.heOA9gzA.d.cts → stack.DaZM10cp.d.cts} +8 -8
- package/dist/shared/{stack.DTDxgFj8.d.mts → stack.FVWf2JhZ.d.mts} +12 -12
- package/dist/shared/{stack.Dk5r4W1F.d.mts → stack.cfCkioTe.d.mts} +8 -8
- package/dist/shared/{stack.6fUOjLs9.d.mts → stack.dH7u-TJH.d.mts} +4 -4
- package/dist/shared/{stack.CgWzG5jH.d.ts → stack.j75TpKh2.d.ts} +25 -25
- package/dist/shared/{stack.D3GB6wKv.d.cts → stack.n1_i1p2B.d.cts} +25 -25
- package/dist/shared/{stack.DASmUVjX.d.ts → stack.sO33ZDhK.d.ts} +1 -1
- package/package.json +1 -1
- package/src/plugins/ai-chat/api/plugin.ts +48 -63
- package/src/plugins/ai-chat/client/plugin.tsx +23 -31
- package/src/plugins/blog/api/plugin.ts +31 -47
- package/src/plugins/blog/client/plugin.tsx +36 -39
- package/src/plugins/client/index.ts +5 -1
- package/src/plugins/cms/api/plugin.ts +14 -17
- package/src/plugins/cms/client/plugin.tsx +18 -21
- package/src/plugins/cms/types.ts +7 -7
- package/src/plugins/form-builder/api/plugin.ts +64 -64
- package/src/plugins/form-builder/client/plugin.tsx +19 -18
- package/src/plugins/form-builder/types.ts +19 -24
- package/src/plugins/kanban/api/plugin.ts +111 -136
- package/src/plugins/kanban/client/plugin.tsx +35 -41
- package/src/plugins/ui-builder/client/plugin.tsx +11 -10
- package/src/plugins/ui-builder/types.ts +4 -4
- package/src/plugins/utils.ts +92 -1
|
@@ -3,7 +3,7 @@ import * as react from 'react';
|
|
|
3
3
|
import react__default, { ComponentType } from 'react';
|
|
4
4
|
import * as _btst_yar from '@btst/yar';
|
|
5
5
|
import { QueryClient } from '@tanstack/react-query';
|
|
6
|
-
import { c as UIBuilderClientHooks } from '../../../shared/stack.
|
|
6
|
+
import { c as UIBuilderClientHooks } from '../../../shared/stack.dH7u-TJH.mjs';
|
|
7
7
|
import { a as ComponentRegistry, F as FieldConfigFunction, C as ComponentLayer } from '../../../shared/stack.D1DMlJp-.mjs';
|
|
8
8
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
9
9
|
import { A as AutoFormInputComponentProps, F as FieldConfigItem } from '../../../shared/stack.8nldKomx.mjs';
|
|
@@ -50,11 +50,11 @@ interface UIBuilderClientConfig {
|
|
|
50
50
|
* hooks: {
|
|
51
51
|
* beforeLoadPageList: async (ctx) => {
|
|
52
52
|
* const session = await getSession(ctx.headers)
|
|
53
|
-
*
|
|
53
|
+
* if (!session?.user?.isAdmin) throw new Error("Admin access required")
|
|
54
54
|
* },
|
|
55
55
|
* beforeLoadPageBuilder: async (pageId, ctx) => {
|
|
56
56
|
* const session = await getSession(ctx.headers)
|
|
57
|
-
*
|
|
57
|
+
* if (!session?.user?.isAdmin) throw new Error("Admin access required")
|
|
58
58
|
* },
|
|
59
59
|
* onLoadError: () => redirect("/auth/sign-in"),
|
|
60
60
|
* },
|
|
@@ -3,7 +3,7 @@ import * as react from 'react';
|
|
|
3
3
|
import react__default, { ComponentType } from 'react';
|
|
4
4
|
import * as _btst_yar from '@btst/yar';
|
|
5
5
|
import { QueryClient } from '@tanstack/react-query';
|
|
6
|
-
import { c as UIBuilderClientHooks } from '../../../shared/stack.
|
|
6
|
+
import { c as UIBuilderClientHooks } from '../../../shared/stack.Cj_zKww4.js';
|
|
7
7
|
import { a as ComponentRegistry, F as FieldConfigFunction, C as ComponentLayer } from '../../../shared/stack.GygI_T3X.js';
|
|
8
8
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
9
9
|
import { A as AutoFormInputComponentProps, F as FieldConfigItem } from '../../../shared/stack.8nldKomx.js';
|
|
@@ -50,11 +50,11 @@ interface UIBuilderClientConfig {
|
|
|
50
50
|
* hooks: {
|
|
51
51
|
* beforeLoadPageList: async (ctx) => {
|
|
52
52
|
* const session = await getSession(ctx.headers)
|
|
53
|
-
*
|
|
53
|
+
* if (!session?.user?.isAdmin) throw new Error("Admin access required")
|
|
54
54
|
* },
|
|
55
55
|
* beforeLoadPageBuilder: async (pageId, ctx) => {
|
|
56
56
|
* const session = await getSession(ctx.headers)
|
|
57
|
-
*
|
|
57
|
+
* if (!session?.user?.isAdmin) throw new Error("Admin access required")
|
|
58
58
|
* },
|
|
59
59
|
* onLoadError: () => redirect("/auth/sign-in"),
|
|
60
60
|
* },
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { C as ContentTypeConfig } from '../../shared/stack.
|
|
3
|
-
export { L as LoaderContext, b as PaginatedUIBuilderPages, P as ParsedUIBuilderPage, S as SerializedUIBuilderPage, c as UIBuilderClientHooks, a as UIBuilderPage, U as UIBuilderPageData } from '../../shared/stack.
|
|
2
|
+
import { C as ContentTypeConfig } from '../../shared/stack.B8QD11QU.cjs';
|
|
3
|
+
export { L as LoaderContext, b as PaginatedUIBuilderPages, P as ParsedUIBuilderPage, S as SerializedUIBuilderPage, c as UIBuilderClientHooks, a as UIBuilderPage, U as UIBuilderPageData } from '../../shared/stack.B2xZTSiO.cjs';
|
|
4
4
|
export { C as ComponentLayer, a as ComponentRegistry, R as RegistryEntry, V as Variable } from '../../shared/stack.B-YHz18S.cjs';
|
|
5
5
|
import 'react';
|
|
6
6
|
import '../../shared/stack.8nldKomx.cjs';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { C as ContentTypeConfig } from '../../shared/stack.
|
|
3
|
-
export { L as LoaderContext, b as PaginatedUIBuilderPages, P as ParsedUIBuilderPage, S as SerializedUIBuilderPage, c as UIBuilderClientHooks, a as UIBuilderPage, U as UIBuilderPageData } from '../../shared/stack.
|
|
2
|
+
import { C as ContentTypeConfig } from '../../shared/stack.B8QD11QU.mjs';
|
|
3
|
+
export { L as LoaderContext, b as PaginatedUIBuilderPages, P as ParsedUIBuilderPage, S as SerializedUIBuilderPage, c as UIBuilderClientHooks, a as UIBuilderPage, U as UIBuilderPageData } from '../../shared/stack.dH7u-TJH.mjs';
|
|
4
4
|
export { C as ComponentLayer, a as ComponentRegistry, R as RegistryEntry, V as Variable } from '../../shared/stack.D1DMlJp-.mjs';
|
|
5
5
|
import 'react';
|
|
6
6
|
import '../../shared/stack.8nldKomx.mjs';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { C as ContentTypeConfig } from '../../shared/stack.
|
|
3
|
-
export { L as LoaderContext, b as PaginatedUIBuilderPages, P as ParsedUIBuilderPage, S as SerializedUIBuilderPage, c as UIBuilderClientHooks, a as UIBuilderPage, U as UIBuilderPageData } from '../../shared/stack.
|
|
2
|
+
import { C as ContentTypeConfig } from '../../shared/stack.B8QD11QU.js';
|
|
3
|
+
export { L as LoaderContext, b as PaginatedUIBuilderPages, P as ParsedUIBuilderPage, S as SerializedUIBuilderPage, c as UIBuilderClientHooks, a as UIBuilderPage, U as UIBuilderPageData } from '../../shared/stack.Cj_zKww4.js';
|
|
4
4
|
export { C as ComponentLayer, a as ComponentRegistry, R as RegistryEntry, V as Variable } from '../../shared/stack.GygI_T3X.js';
|
|
5
5
|
import 'react';
|
|
6
6
|
import '../../shared/stack.8nldKomx.js';
|
|
@@ -83,21 +83,21 @@ interface LoaderContext {
|
|
|
83
83
|
*/
|
|
84
84
|
interface UIBuilderClientHooks {
|
|
85
85
|
/**
|
|
86
|
-
* Called before loading the page list.
|
|
86
|
+
* Called before loading the page list. Throw an error to cancel loading.
|
|
87
87
|
* @param context - Loader context with path, params, etc.
|
|
88
88
|
*/
|
|
89
|
-
beforeLoadPageList?: (context: LoaderContext) => Promise<
|
|
89
|
+
beforeLoadPageList?: (context: LoaderContext) => Promise<void> | void;
|
|
90
90
|
/**
|
|
91
91
|
* Called after the page list is loaded.
|
|
92
92
|
* @param context - Loader context
|
|
93
93
|
*/
|
|
94
94
|
afterLoadPageList?: (context: LoaderContext) => Promise<void> | void;
|
|
95
95
|
/**
|
|
96
|
-
* Called before loading the page builder.
|
|
96
|
+
* Called before loading the page builder. Throw an error to cancel loading.
|
|
97
97
|
* @param pageId - The page ID (undefined for new pages)
|
|
98
98
|
* @param context - Loader context
|
|
99
99
|
*/
|
|
100
|
-
beforeLoadPageBuilder?: (pageId: string | undefined, context: LoaderContext) => Promise<
|
|
100
|
+
beforeLoadPageBuilder?: (pageId: string | undefined, context: LoaderContext) => Promise<void> | void;
|
|
101
101
|
/**
|
|
102
102
|
* Called after the page builder is loaded.
|
|
103
103
|
* @param pageId - The page ID (undefined for new pages)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _btst_stack_plugins_api from '@btst/stack/plugins/api';
|
|
2
|
-
import { a as SerializedContentItemWithType, S as SerializedContentType, b as ContentType, c as ContentItem, d as SerializedContentItem, e as ContentItemWithType, f as CMSBackendConfig, I as InverseRelation } from './stack.
|
|
2
|
+
import { a as SerializedContentItemWithType, S as SerializedContentType, b as ContentType, c as ContentItem, d as SerializedContentItem, e as ContentItemWithType, f as CMSBackendConfig, I as InverseRelation } from './stack.B8QD11QU.mjs';
|
|
3
3
|
import * as better_call from 'better-call';
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
import { Adapter } from '@btst/db';
|
|
@@ -130,21 +130,21 @@ interface CMSHookContext {
|
|
|
130
130
|
/**
|
|
131
131
|
* Hooks for customizing CMS backend behavior
|
|
132
132
|
*
|
|
133
|
-
* Note: Before hooks
|
|
133
|
+
* Note: Before hooks deny operations by throwing an error.
|
|
134
134
|
* They cannot modify the data being saved. This ensures consistency
|
|
135
135
|
* between the stored content item data and relation junction tables.
|
|
136
136
|
*/
|
|
137
137
|
interface CMSBackendHooks {
|
|
138
|
-
/** Called before creating a content item.
|
|
139
|
-
onBeforeCreate?: (data: Record<string, unknown>, context: CMSHookContext) => Promise<
|
|
138
|
+
/** Called before creating a content item. Throw an error to deny the operation. */
|
|
139
|
+
onBeforeCreate?: (data: Record<string, unknown>, context: CMSHookContext) => Promise<void> | void;
|
|
140
140
|
/** Called after creating a content item */
|
|
141
141
|
onAfterCreate?: (item: SerializedContentItem, context: CMSHookContext) => Promise<void> | void;
|
|
142
|
-
/** Called before updating a content item.
|
|
143
|
-
onBeforeUpdate?: (id: string, data: Record<string, unknown>, context: CMSHookContext) => Promise<
|
|
142
|
+
/** Called before updating a content item. Throw an error to deny the operation. */
|
|
143
|
+
onBeforeUpdate?: (id: string, data: Record<string, unknown>, context: CMSHookContext) => Promise<void> | void;
|
|
144
144
|
/** Called after updating a content item */
|
|
145
145
|
onAfterUpdate?: (item: SerializedContentItem, context: CMSHookContext) => Promise<void> | void;
|
|
146
|
-
/** Called before deleting a content item */
|
|
147
|
-
onBeforeDelete?: (id: string, context: CMSHookContext) => Promise<
|
|
146
|
+
/** Called before deleting a content item. Throw an error to deny the operation. */
|
|
147
|
+
onBeforeDelete?: (id: string, context: CMSHookContext) => Promise<void> | void;
|
|
148
148
|
/** Called after deleting a content item */
|
|
149
149
|
onAfterDelete?: (id: string, context: CMSHookContext) => Promise<void> | void;
|
|
150
150
|
/** Called on any CMS error */
|
|
@@ -130,21 +130,21 @@ interface CMSHookContext {
|
|
|
130
130
|
/**
|
|
131
131
|
* Hooks for customizing CMS backend behavior
|
|
132
132
|
*
|
|
133
|
-
* Note: Before hooks
|
|
133
|
+
* Note: Before hooks deny operations by throwing an error.
|
|
134
134
|
* They cannot modify the data being saved. This ensures consistency
|
|
135
135
|
* between the stored content item data and relation junction tables.
|
|
136
136
|
*/
|
|
137
137
|
interface CMSBackendHooks {
|
|
138
|
-
/** Called before creating a content item.
|
|
139
|
-
onBeforeCreate?: (data: Record<string, unknown>, context: CMSHookContext) => Promise<
|
|
138
|
+
/** Called before creating a content item. Throw an error to deny the operation. */
|
|
139
|
+
onBeforeCreate?: (data: Record<string, unknown>, context: CMSHookContext) => Promise<void> | void;
|
|
140
140
|
/** Called after creating a content item */
|
|
141
141
|
onAfterCreate?: (item: SerializedContentItem, context: CMSHookContext) => Promise<void> | void;
|
|
142
|
-
/** Called before updating a content item.
|
|
143
|
-
onBeforeUpdate?: (id: string, data: Record<string, unknown>, context: CMSHookContext) => Promise<
|
|
142
|
+
/** Called before updating a content item. Throw an error to deny the operation. */
|
|
143
|
+
onBeforeUpdate?: (id: string, data: Record<string, unknown>, context: CMSHookContext) => Promise<void> | void;
|
|
144
144
|
/** Called after updating a content item */
|
|
145
145
|
onAfterUpdate?: (item: SerializedContentItem, context: CMSHookContext) => Promise<void> | void;
|
|
146
|
-
/** Called before deleting a content item */
|
|
147
|
-
onBeforeDelete?: (id: string, context: CMSHookContext) => Promise<
|
|
146
|
+
/** Called before deleting a content item. Throw an error to deny the operation. */
|
|
147
|
+
onBeforeDelete?: (id: string, context: CMSHookContext) => Promise<void> | void;
|
|
148
148
|
/** Called after deleting a content item */
|
|
149
149
|
onAfterDelete?: (id: string, context: CMSHookContext) => Promise<void> | void;
|
|
150
150
|
/** Called on any CMS error */
|
|
@@ -130,21 +130,21 @@ interface CMSHookContext {
|
|
|
130
130
|
/**
|
|
131
131
|
* Hooks for customizing CMS backend behavior
|
|
132
132
|
*
|
|
133
|
-
* Note: Before hooks
|
|
133
|
+
* Note: Before hooks deny operations by throwing an error.
|
|
134
134
|
* They cannot modify the data being saved. This ensures consistency
|
|
135
135
|
* between the stored content item data and relation junction tables.
|
|
136
136
|
*/
|
|
137
137
|
interface CMSBackendHooks {
|
|
138
|
-
/** Called before creating a content item.
|
|
139
|
-
onBeforeCreate?: (data: Record<string, unknown>, context: CMSHookContext) => Promise<
|
|
138
|
+
/** Called before creating a content item. Throw an error to deny the operation. */
|
|
139
|
+
onBeforeCreate?: (data: Record<string, unknown>, context: CMSHookContext) => Promise<void> | void;
|
|
140
140
|
/** Called after creating a content item */
|
|
141
141
|
onAfterCreate?: (item: SerializedContentItem, context: CMSHookContext) => Promise<void> | void;
|
|
142
|
-
/** Called before updating a content item.
|
|
143
|
-
onBeforeUpdate?: (id: string, data: Record<string, unknown>, context: CMSHookContext) => Promise<
|
|
142
|
+
/** Called before updating a content item. Throw an error to deny the operation. */
|
|
143
|
+
onBeforeUpdate?: (id: string, data: Record<string, unknown>, context: CMSHookContext) => Promise<void> | void;
|
|
144
144
|
/** Called after updating a content item */
|
|
145
145
|
onAfterUpdate?: (item: SerializedContentItem, context: CMSHookContext) => Promise<void> | void;
|
|
146
|
-
/** Called before deleting a content item */
|
|
147
|
-
onBeforeDelete?: (id: string, context: CMSHookContext) => Promise<
|
|
146
|
+
/** Called before deleting a content item. Throw an error to deny the operation. */
|
|
147
|
+
onBeforeDelete?: (id: string, context: CMSHookContext) => Promise<void> | void;
|
|
148
148
|
/** Called after deleting a content item */
|
|
149
149
|
onAfterDelete?: (id: string, context: CMSHookContext) => Promise<void> | void;
|
|
150
150
|
/** Called on any CMS error */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as _btst_stack_plugins_api from '@btst/stack/plugins/api';
|
|
2
2
|
import * as better_call from 'better-call';
|
|
3
|
-
import { S as SerializedForm, b as SerializedFormSubmissionWithData, F as Form, d as FormSubmission, a as SerializedFormSubmission, e as FormSubmissionWithForm, f as FormBuilderBackendConfig } from './stack.
|
|
3
|
+
import { S as SerializedForm, b as SerializedFormSubmissionWithData, F as Form, d as FormSubmission, a as SerializedFormSubmission, e as FormSubmissionWithForm, f as FormBuilderBackendConfig } from './stack.BozPgbrZ.js';
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
import { Adapter } from '@btst/db';
|
|
6
6
|
import { QueryClient } from '@tanstack/react-query';
|
|
@@ -191,8 +191,8 @@ declare const formBuilderBackendPlugin: (config?: FormBuilderBackendConfig) => _
|
|
|
191
191
|
};
|
|
192
192
|
submittedAt: string;
|
|
193
193
|
id: string;
|
|
194
|
-
data: string;
|
|
195
194
|
formId: string;
|
|
195
|
+
data: string;
|
|
196
196
|
submittedBy?: string | undefined;
|
|
197
197
|
ipAddress?: string | undefined;
|
|
198
198
|
userAgent?: string | undefined;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as _btst_stack_plugins_api from '@btst/stack/plugins/api';
|
|
2
2
|
import * as better_call from 'better-call';
|
|
3
|
-
import { S as SerializedForm, b as SerializedFormSubmissionWithData, F as Form, d as FormSubmission, a as SerializedFormSubmission, e as FormSubmissionWithForm, f as FormBuilderBackendConfig } from './stack.
|
|
3
|
+
import { S as SerializedForm, b as SerializedFormSubmissionWithData, F as Form, d as FormSubmission, a as SerializedFormSubmission, e as FormSubmissionWithForm, f as FormBuilderBackendConfig } from './stack.BozPgbrZ.cjs';
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
import { Adapter } from '@btst/db';
|
|
6
6
|
import { QueryClient } from '@tanstack/react-query';
|
|
@@ -191,8 +191,8 @@ declare const formBuilderBackendPlugin: (config?: FormBuilderBackendConfig) => _
|
|
|
191
191
|
};
|
|
192
192
|
submittedAt: string;
|
|
193
193
|
id: string;
|
|
194
|
-
data: string;
|
|
195
194
|
formId: string;
|
|
195
|
+
data: string;
|
|
196
196
|
submittedBy?: string | undefined;
|
|
197
197
|
ipAddress?: string | undefined;
|
|
198
198
|
userAgent?: string | undefined;
|
|
@@ -146,32 +146,32 @@ interface FormUpdate {
|
|
|
146
146
|
* Backend hooks for Form Builder plugin
|
|
147
147
|
*
|
|
148
148
|
* All CRUD hooks receive ipAddress and headers for auth/rate limiting.
|
|
149
|
-
*
|
|
149
|
+
* Throw an error from onBefore* hooks to reject the operation (throws 403).
|
|
150
150
|
*/
|
|
151
151
|
interface FormBuilderBackendHooks {
|
|
152
|
-
/** Called before listing forms.
|
|
153
|
-
onBeforeListForms?: (ctx: FormBuilderHookContext) => Promise<
|
|
154
|
-
/** Called before creating a form.
|
|
155
|
-
onBeforeFormCreated?: (data: FormInput, ctx: FormBuilderHookContext) => Promise<FormInput |
|
|
152
|
+
/** Called before listing forms. Throw an error to deny access (403). */
|
|
153
|
+
onBeforeListForms?: (ctx: FormBuilderHookContext) => Promise<void> | void;
|
|
154
|
+
/** Called before creating a form. Throw an error to deny, or return modified data. */
|
|
155
|
+
onBeforeFormCreated?: (data: FormInput, ctx: FormBuilderHookContext) => Promise<FormInput | void> | FormInput | void;
|
|
156
156
|
/** Called after a form is created */
|
|
157
157
|
onAfterFormCreated?: (form: SerializedForm, ctx: FormBuilderHookContext) => Promise<void> | void;
|
|
158
|
-
/** Called before getting a form by ID or slug.
|
|
159
|
-
onBeforeGetForm?: (idOrSlug: string, ctx: FormBuilderHookContext) => Promise<
|
|
160
|
-
/** Called before updating a form.
|
|
161
|
-
onBeforeFormUpdated?: (id: string, data: FormUpdate, ctx: FormBuilderHookContext) => Promise<FormUpdate |
|
|
158
|
+
/** Called before getting a form by ID or slug. Throw an error to deny access. */
|
|
159
|
+
onBeforeGetForm?: (idOrSlug: string, ctx: FormBuilderHookContext) => Promise<void> | void;
|
|
160
|
+
/** Called before updating a form. Throw an error to deny, or return modified data. */
|
|
161
|
+
onBeforeFormUpdated?: (id: string, data: FormUpdate, ctx: FormBuilderHookContext) => Promise<FormUpdate | void> | FormUpdate | void;
|
|
162
162
|
/** Called after a form is updated */
|
|
163
163
|
onAfterFormUpdated?: (form: SerializedForm, ctx: FormBuilderHookContext) => Promise<void> | void;
|
|
164
|
-
/** Called before deleting a form.
|
|
165
|
-
onBeforeFormDeleted?: (id: string, ctx: FormBuilderHookContext) => Promise<
|
|
164
|
+
/** Called before deleting a form. Throw an error to deny. */
|
|
165
|
+
onBeforeFormDeleted?: (id: string, ctx: FormBuilderHookContext) => Promise<void> | void;
|
|
166
166
|
/** Called after a form is deleted */
|
|
167
167
|
onAfterFormDeleted?: (id: string, ctx: FormBuilderHookContext) => Promise<void> | void;
|
|
168
168
|
/**
|
|
169
169
|
* Called before processing a form submission.
|
|
170
170
|
* Use for: spam protection, rate limiting, data validation/enrichment.
|
|
171
171
|
*
|
|
172
|
-
*
|
|
172
|
+
* Throw an error to reject submission (400), or return modified data to continue.
|
|
173
173
|
*/
|
|
174
|
-
onBeforeSubmission?: (formSlug: string, data: Record<string, unknown>, ctx: SubmissionHookContext) => Promise<Record<string, unknown> |
|
|
174
|
+
onBeforeSubmission?: (formSlug: string, data: Record<string, unknown>, ctx: SubmissionHookContext) => Promise<Record<string, unknown> | void> | Record<string, unknown> | void;
|
|
175
175
|
/**
|
|
176
176
|
* Called after a submission is saved.
|
|
177
177
|
* Use for: sending emails, storing in CRM, triggering workflows.
|
|
@@ -179,12 +179,12 @@ interface FormBuilderBackendHooks {
|
|
|
179
179
|
onAfterSubmission?: (submission: SerializedFormSubmission, form: SerializedForm, ctx: SubmissionHookContext) => Promise<void> | void;
|
|
180
180
|
/** Called when a submission fails */
|
|
181
181
|
onSubmissionError?: (error: Error, formSlug: string, data: Record<string, unknown>, ctx: SubmissionHookContext) => Promise<void> | void;
|
|
182
|
-
/** Called before listing submissions.
|
|
183
|
-
onBeforeListSubmissions?: (formId: string, ctx: FormBuilderHookContext) => Promise<
|
|
184
|
-
/** Called before getting a submission.
|
|
185
|
-
onBeforeGetSubmission?: (submissionId: string, ctx: FormBuilderHookContext) => Promise<
|
|
186
|
-
/** Called before deleting a submission.
|
|
187
|
-
onBeforeSubmissionDeleted?: (submissionId: string, ctx: FormBuilderHookContext) => Promise<
|
|
182
|
+
/** Called before listing submissions. Throw an error to deny access (403). */
|
|
183
|
+
onBeforeListSubmissions?: (formId: string, ctx: FormBuilderHookContext) => Promise<void> | void;
|
|
184
|
+
/** Called before getting a submission. Throw an error to deny access. */
|
|
185
|
+
onBeforeGetSubmission?: (submissionId: string, ctx: FormBuilderHookContext) => Promise<void> | void;
|
|
186
|
+
/** Called before deleting a submission. Throw an error to deny. */
|
|
187
|
+
onBeforeSubmissionDeleted?: (submissionId: string, ctx: FormBuilderHookContext) => Promise<void> | void;
|
|
188
188
|
/** Called after a submission is deleted */
|
|
189
189
|
onAfterSubmissionDeleted?: (submissionId: string, ctx: FormBuilderHookContext) => Promise<void> | void;
|
|
190
190
|
/** Called on any error */
|
|
@@ -146,32 +146,32 @@ interface FormUpdate {
|
|
|
146
146
|
* Backend hooks for Form Builder plugin
|
|
147
147
|
*
|
|
148
148
|
* All CRUD hooks receive ipAddress and headers for auth/rate limiting.
|
|
149
|
-
*
|
|
149
|
+
* Throw an error from onBefore* hooks to reject the operation (throws 403).
|
|
150
150
|
*/
|
|
151
151
|
interface FormBuilderBackendHooks {
|
|
152
|
-
/** Called before listing forms.
|
|
153
|
-
onBeforeListForms?: (ctx: FormBuilderHookContext) => Promise<
|
|
154
|
-
/** Called before creating a form.
|
|
155
|
-
onBeforeFormCreated?: (data: FormInput, ctx: FormBuilderHookContext) => Promise<FormInput |
|
|
152
|
+
/** Called before listing forms. Throw an error to deny access (403). */
|
|
153
|
+
onBeforeListForms?: (ctx: FormBuilderHookContext) => Promise<void> | void;
|
|
154
|
+
/** Called before creating a form. Throw an error to deny, or return modified data. */
|
|
155
|
+
onBeforeFormCreated?: (data: FormInput, ctx: FormBuilderHookContext) => Promise<FormInput | void> | FormInput | void;
|
|
156
156
|
/** Called after a form is created */
|
|
157
157
|
onAfterFormCreated?: (form: SerializedForm, ctx: FormBuilderHookContext) => Promise<void> | void;
|
|
158
|
-
/** Called before getting a form by ID or slug.
|
|
159
|
-
onBeforeGetForm?: (idOrSlug: string, ctx: FormBuilderHookContext) => Promise<
|
|
160
|
-
/** Called before updating a form.
|
|
161
|
-
onBeforeFormUpdated?: (id: string, data: FormUpdate, ctx: FormBuilderHookContext) => Promise<FormUpdate |
|
|
158
|
+
/** Called before getting a form by ID or slug. Throw an error to deny access. */
|
|
159
|
+
onBeforeGetForm?: (idOrSlug: string, ctx: FormBuilderHookContext) => Promise<void> | void;
|
|
160
|
+
/** Called before updating a form. Throw an error to deny, or return modified data. */
|
|
161
|
+
onBeforeFormUpdated?: (id: string, data: FormUpdate, ctx: FormBuilderHookContext) => Promise<FormUpdate | void> | FormUpdate | void;
|
|
162
162
|
/** Called after a form is updated */
|
|
163
163
|
onAfterFormUpdated?: (form: SerializedForm, ctx: FormBuilderHookContext) => Promise<void> | void;
|
|
164
|
-
/** Called before deleting a form.
|
|
165
|
-
onBeforeFormDeleted?: (id: string, ctx: FormBuilderHookContext) => Promise<
|
|
164
|
+
/** Called before deleting a form. Throw an error to deny. */
|
|
165
|
+
onBeforeFormDeleted?: (id: string, ctx: FormBuilderHookContext) => Promise<void> | void;
|
|
166
166
|
/** Called after a form is deleted */
|
|
167
167
|
onAfterFormDeleted?: (id: string, ctx: FormBuilderHookContext) => Promise<void> | void;
|
|
168
168
|
/**
|
|
169
169
|
* Called before processing a form submission.
|
|
170
170
|
* Use for: spam protection, rate limiting, data validation/enrichment.
|
|
171
171
|
*
|
|
172
|
-
*
|
|
172
|
+
* Throw an error to reject submission (400), or return modified data to continue.
|
|
173
173
|
*/
|
|
174
|
-
onBeforeSubmission?: (formSlug: string, data: Record<string, unknown>, ctx: SubmissionHookContext) => Promise<Record<string, unknown> |
|
|
174
|
+
onBeforeSubmission?: (formSlug: string, data: Record<string, unknown>, ctx: SubmissionHookContext) => Promise<Record<string, unknown> | void> | Record<string, unknown> | void;
|
|
175
175
|
/**
|
|
176
176
|
* Called after a submission is saved.
|
|
177
177
|
* Use for: sending emails, storing in CRM, triggering workflows.
|
|
@@ -179,12 +179,12 @@ interface FormBuilderBackendHooks {
|
|
|
179
179
|
onAfterSubmission?: (submission: SerializedFormSubmission, form: SerializedForm, ctx: SubmissionHookContext) => Promise<void> | void;
|
|
180
180
|
/** Called when a submission fails */
|
|
181
181
|
onSubmissionError?: (error: Error, formSlug: string, data: Record<string, unknown>, ctx: SubmissionHookContext) => Promise<void> | void;
|
|
182
|
-
/** Called before listing submissions.
|
|
183
|
-
onBeforeListSubmissions?: (formId: string, ctx: FormBuilderHookContext) => Promise<
|
|
184
|
-
/** Called before getting a submission.
|
|
185
|
-
onBeforeGetSubmission?: (submissionId: string, ctx: FormBuilderHookContext) => Promise<
|
|
186
|
-
/** Called before deleting a submission.
|
|
187
|
-
onBeforeSubmissionDeleted?: (submissionId: string, ctx: FormBuilderHookContext) => Promise<
|
|
182
|
+
/** Called before listing submissions. Throw an error to deny access (403). */
|
|
183
|
+
onBeforeListSubmissions?: (formId: string, ctx: FormBuilderHookContext) => Promise<void> | void;
|
|
184
|
+
/** Called before getting a submission. Throw an error to deny access. */
|
|
185
|
+
onBeforeGetSubmission?: (submissionId: string, ctx: FormBuilderHookContext) => Promise<void> | void;
|
|
186
|
+
/** Called before deleting a submission. Throw an error to deny. */
|
|
187
|
+
onBeforeSubmissionDeleted?: (submissionId: string, ctx: FormBuilderHookContext) => Promise<void> | void;
|
|
188
188
|
/** Called after a submission is deleted */
|
|
189
189
|
onAfterSubmissionDeleted?: (submissionId: string, ctx: FormBuilderHookContext) => Promise<void> | void;
|
|
190
190
|
/** Called on any error */
|
|
@@ -146,32 +146,32 @@ interface FormUpdate {
|
|
|
146
146
|
* Backend hooks for Form Builder plugin
|
|
147
147
|
*
|
|
148
148
|
* All CRUD hooks receive ipAddress and headers for auth/rate limiting.
|
|
149
|
-
*
|
|
149
|
+
* Throw an error from onBefore* hooks to reject the operation (throws 403).
|
|
150
150
|
*/
|
|
151
151
|
interface FormBuilderBackendHooks {
|
|
152
|
-
/** Called before listing forms.
|
|
153
|
-
onBeforeListForms?: (ctx: FormBuilderHookContext) => Promise<
|
|
154
|
-
/** Called before creating a form.
|
|
155
|
-
onBeforeFormCreated?: (data: FormInput, ctx: FormBuilderHookContext) => Promise<FormInput |
|
|
152
|
+
/** Called before listing forms. Throw an error to deny access (403). */
|
|
153
|
+
onBeforeListForms?: (ctx: FormBuilderHookContext) => Promise<void> | void;
|
|
154
|
+
/** Called before creating a form. Throw an error to deny, or return modified data. */
|
|
155
|
+
onBeforeFormCreated?: (data: FormInput, ctx: FormBuilderHookContext) => Promise<FormInput | void> | FormInput | void;
|
|
156
156
|
/** Called after a form is created */
|
|
157
157
|
onAfterFormCreated?: (form: SerializedForm, ctx: FormBuilderHookContext) => Promise<void> | void;
|
|
158
|
-
/** Called before getting a form by ID or slug.
|
|
159
|
-
onBeforeGetForm?: (idOrSlug: string, ctx: FormBuilderHookContext) => Promise<
|
|
160
|
-
/** Called before updating a form.
|
|
161
|
-
onBeforeFormUpdated?: (id: string, data: FormUpdate, ctx: FormBuilderHookContext) => Promise<FormUpdate |
|
|
158
|
+
/** Called before getting a form by ID or slug. Throw an error to deny access. */
|
|
159
|
+
onBeforeGetForm?: (idOrSlug: string, ctx: FormBuilderHookContext) => Promise<void> | void;
|
|
160
|
+
/** Called before updating a form. Throw an error to deny, or return modified data. */
|
|
161
|
+
onBeforeFormUpdated?: (id: string, data: FormUpdate, ctx: FormBuilderHookContext) => Promise<FormUpdate | void> | FormUpdate | void;
|
|
162
162
|
/** Called after a form is updated */
|
|
163
163
|
onAfterFormUpdated?: (form: SerializedForm, ctx: FormBuilderHookContext) => Promise<void> | void;
|
|
164
|
-
/** Called before deleting a form.
|
|
165
|
-
onBeforeFormDeleted?: (id: string, ctx: FormBuilderHookContext) => Promise<
|
|
164
|
+
/** Called before deleting a form. Throw an error to deny. */
|
|
165
|
+
onBeforeFormDeleted?: (id: string, ctx: FormBuilderHookContext) => Promise<void> | void;
|
|
166
166
|
/** Called after a form is deleted */
|
|
167
167
|
onAfterFormDeleted?: (id: string, ctx: FormBuilderHookContext) => Promise<void> | void;
|
|
168
168
|
/**
|
|
169
169
|
* Called before processing a form submission.
|
|
170
170
|
* Use for: spam protection, rate limiting, data validation/enrichment.
|
|
171
171
|
*
|
|
172
|
-
*
|
|
172
|
+
* Throw an error to reject submission (400), or return modified data to continue.
|
|
173
173
|
*/
|
|
174
|
-
onBeforeSubmission?: (formSlug: string, data: Record<string, unknown>, ctx: SubmissionHookContext) => Promise<Record<string, unknown> |
|
|
174
|
+
onBeforeSubmission?: (formSlug: string, data: Record<string, unknown>, ctx: SubmissionHookContext) => Promise<Record<string, unknown> | void> | Record<string, unknown> | void;
|
|
175
175
|
/**
|
|
176
176
|
* Called after a submission is saved.
|
|
177
177
|
* Use for: sending emails, storing in CRM, triggering workflows.
|
|
@@ -179,12 +179,12 @@ interface FormBuilderBackendHooks {
|
|
|
179
179
|
onAfterSubmission?: (submission: SerializedFormSubmission, form: SerializedForm, ctx: SubmissionHookContext) => Promise<void> | void;
|
|
180
180
|
/** Called when a submission fails */
|
|
181
181
|
onSubmissionError?: (error: Error, formSlug: string, data: Record<string, unknown>, ctx: SubmissionHookContext) => Promise<void> | void;
|
|
182
|
-
/** Called before listing submissions.
|
|
183
|
-
onBeforeListSubmissions?: (formId: string, ctx: FormBuilderHookContext) => Promise<
|
|
184
|
-
/** Called before getting a submission.
|
|
185
|
-
onBeforeGetSubmission?: (submissionId: string, ctx: FormBuilderHookContext) => Promise<
|
|
186
|
-
/** Called before deleting a submission.
|
|
187
|
-
onBeforeSubmissionDeleted?: (submissionId: string, ctx: FormBuilderHookContext) => Promise<
|
|
182
|
+
/** Called before listing submissions. Throw an error to deny access (403). */
|
|
183
|
+
onBeforeListSubmissions?: (formId: string, ctx: FormBuilderHookContext) => Promise<void> | void;
|
|
184
|
+
/** Called before getting a submission. Throw an error to deny access. */
|
|
185
|
+
onBeforeGetSubmission?: (submissionId: string, ctx: FormBuilderHookContext) => Promise<void> | void;
|
|
186
|
+
/** Called before deleting a submission. Throw an error to deny. */
|
|
187
|
+
onBeforeSubmissionDeleted?: (submissionId: string, ctx: FormBuilderHookContext) => Promise<void> | void;
|
|
188
188
|
/** Called after a submission is deleted */
|
|
189
189
|
onAfterSubmissionDeleted?: (submissionId: string, ctx: FormBuilderHookContext) => Promise<void> | void;
|
|
190
190
|
/** Called on any error */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _btst_stack_plugins_api from '@btst/stack/plugins/api';
|
|
2
|
-
import { a as SerializedContentItemWithType, S as SerializedContentType, b as ContentType, c as ContentItem, d as SerializedContentItem, e as ContentItemWithType, f as CMSBackendConfig, I as InverseRelation } from './stack.
|
|
2
|
+
import { a as SerializedContentItemWithType, S as SerializedContentType, b as ContentType, c as ContentItem, d as SerializedContentItem, e as ContentItemWithType, f as CMSBackendConfig, I as InverseRelation } from './stack.B8QD11QU.cjs';
|
|
3
3
|
import * as better_call from 'better-call';
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
import { Adapter } from '@btst/db';
|
|
@@ -24,49 +24,49 @@ interface ChatApiContext<TBody = any, TParams = any, TQuery = any> {
|
|
|
24
24
|
*/
|
|
25
25
|
interface AiChatBackendHooks {
|
|
26
26
|
/**
|
|
27
|
-
* Called before processing a chat message.
|
|
27
|
+
* Called before processing a chat message. Throw an error to deny access.
|
|
28
28
|
* @param messages - Array of messages being sent
|
|
29
29
|
* @param context - Request context with headers, etc.
|
|
30
30
|
*/
|
|
31
31
|
onBeforeChat?: (messages: Array<{
|
|
32
32
|
role: string;
|
|
33
33
|
content: string;
|
|
34
|
-
}>, context: ChatApiContext) => Promise<
|
|
34
|
+
}>, context: ChatApiContext) => Promise<void> | void;
|
|
35
35
|
/**
|
|
36
|
-
* Called before listing conversations.
|
|
36
|
+
* Called before listing conversations. Throw an error to deny access.
|
|
37
37
|
* @param context - Request context with headers, etc.
|
|
38
38
|
*/
|
|
39
|
-
onBeforeListConversations?: (context: ChatApiContext) => Promise<
|
|
39
|
+
onBeforeListConversations?: (context: ChatApiContext) => Promise<void> | void;
|
|
40
40
|
/**
|
|
41
|
-
* Called before getting a single conversation.
|
|
41
|
+
* Called before getting a single conversation. Throw an error to deny access.
|
|
42
42
|
* @param conversationId - ID of the conversation being accessed
|
|
43
43
|
* @param context - Request context with headers, etc.
|
|
44
44
|
*/
|
|
45
|
-
onBeforeGetConversation?: (conversationId: string, context: ChatApiContext) => Promise<
|
|
45
|
+
onBeforeGetConversation?: (conversationId: string, context: ChatApiContext) => Promise<void> | void;
|
|
46
46
|
/**
|
|
47
|
-
* Called before creating a conversation.
|
|
47
|
+
* Called before creating a conversation. Throw an error to deny access.
|
|
48
48
|
* @param data - Conversation data being created
|
|
49
49
|
* @param context - Request context with headers, etc.
|
|
50
50
|
*/
|
|
51
51
|
onBeforeCreateConversation?: (data: {
|
|
52
52
|
id?: string;
|
|
53
53
|
title?: string;
|
|
54
|
-
}, context: ChatApiContext) => Promise<
|
|
54
|
+
}, context: ChatApiContext) => Promise<void> | void;
|
|
55
55
|
/**
|
|
56
|
-
* Called before updating a conversation.
|
|
56
|
+
* Called before updating a conversation. Throw an error to deny access.
|
|
57
57
|
* @param conversationId - ID of the conversation being updated
|
|
58
58
|
* @param data - Updated conversation data
|
|
59
59
|
* @param context - Request context with headers, etc.
|
|
60
60
|
*/
|
|
61
61
|
onBeforeUpdateConversation?: (conversationId: string, data: {
|
|
62
62
|
title?: string;
|
|
63
|
-
}, context: ChatApiContext) => Promise<
|
|
63
|
+
}, context: ChatApiContext) => Promise<void> | void;
|
|
64
64
|
/**
|
|
65
|
-
* Called before deleting a conversation.
|
|
65
|
+
* Called before deleting a conversation. Throw an error to deny access.
|
|
66
66
|
* @param conversationId - ID of the conversation being deleted
|
|
67
67
|
* @param context - Request context with headers, etc.
|
|
68
68
|
*/
|
|
69
|
-
onBeforeDeleteConversation?: (conversationId: string, context: ChatApiContext) => Promise<
|
|
69
|
+
onBeforeDeleteConversation?: (conversationId: string, context: ChatApiContext) => Promise<void> | void;
|
|
70
70
|
/**
|
|
71
71
|
* Called after the structural routeName/allowlist validation, with the list
|
|
72
72
|
* of tool names that passed. Return a filtered subset to further restrict
|
|
@@ -83,21 +83,21 @@ interface LoaderContext {
|
|
|
83
83
|
*/
|
|
84
84
|
interface UIBuilderClientHooks {
|
|
85
85
|
/**
|
|
86
|
-
* Called before loading the page list.
|
|
86
|
+
* Called before loading the page list. Throw an error to cancel loading.
|
|
87
87
|
* @param context - Loader context with path, params, etc.
|
|
88
88
|
*/
|
|
89
|
-
beforeLoadPageList?: (context: LoaderContext) => Promise<
|
|
89
|
+
beforeLoadPageList?: (context: LoaderContext) => Promise<void> | void;
|
|
90
90
|
/**
|
|
91
91
|
* Called after the page list is loaded.
|
|
92
92
|
* @param context - Loader context
|
|
93
93
|
*/
|
|
94
94
|
afterLoadPageList?: (context: LoaderContext) => Promise<void> | void;
|
|
95
95
|
/**
|
|
96
|
-
* Called before loading the page builder.
|
|
96
|
+
* Called before loading the page builder. Throw an error to cancel loading.
|
|
97
97
|
* @param pageId - The page ID (undefined for new pages)
|
|
98
98
|
* @param context - Loader context
|
|
99
99
|
*/
|
|
100
|
-
beforeLoadPageBuilder?: (pageId: string | undefined, context: LoaderContext) => Promise<
|
|
100
|
+
beforeLoadPageBuilder?: (pageId: string | undefined, context: LoaderContext) => Promise<void> | void;
|
|
101
101
|
/**
|
|
102
102
|
* Called after the page builder is loaded.
|
|
103
103
|
* @param pageId - The page ID (undefined for new pages)
|