@botpress/sdk 4.1.0 → 4.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/.turbo/turbo-build.log +4 -4
- package/dist/bot/client/types.d.ts +1 -1
- package/dist/bot/implementation.d.ts +10 -0
- package/dist/bot/server/types.d.ts +33 -2
- package/dist/fixtures.d.ts +8 -0
- package/dist/index.cjs +19 -19
- package/dist/index.cjs.map +3 -3
- package/dist/index.mjs +18 -18
- package/dist/index.mjs.map +3 -3
- package/dist/interface/definition.d.ts +8 -0
- package/dist/plugin/implementation.d.ts +10 -0
- package/dist/plugin/server/types.d.ts +42 -1
- package/package.json +2 -2
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
|
|
2
|
-
> @botpress/sdk@4.
|
|
2
|
+
> @botpress/sdk@4.3.0 build /home/runner/work/botpress/botpress/packages/sdk
|
|
3
3
|
> pnpm build:type && pnpm build:node && pnpm build:browser
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
> @botpress/sdk@4.
|
|
6
|
+
> @botpress/sdk@4.3.0 build:type /home/runner/work/botpress/botpress/packages/sdk
|
|
7
7
|
> tsc --emitDeclarationOnly --declaration
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
> @botpress/sdk@4.
|
|
10
|
+
> @botpress/sdk@4.3.0 build:node /home/runner/work/botpress/botpress/packages/sdk
|
|
11
11
|
> ts-node -T ./build.ts --node
|
|
12
12
|
|
|
13
13
|
Done
|
|
14
14
|
|
|
15
|
-
> @botpress/sdk@4.
|
|
15
|
+
> @botpress/sdk@4.3.0 build:browser /home/runner/work/botpress/botpress/packages/sdk
|
|
16
16
|
> ts-node -T ./build.ts --browser
|
|
17
17
|
|
|
18
18
|
Done
|
|
@@ -241,7 +241,7 @@ type ClientHooksBefore = {
|
|
|
241
241
|
[K in client.Operation]?: (x: client.ClientInputs[K]) => Promise<client.ClientInputs[K]>;
|
|
242
242
|
};
|
|
243
243
|
type ClientHooksAfter = {
|
|
244
|
-
[K in client.Operation]?: (
|
|
244
|
+
[K in client.Operation]?: (y: client.ClientOutputs[K], x: client.ClientInputs[K]) => Promise<client.ClientOutputs[K]>;
|
|
245
245
|
};
|
|
246
246
|
export type ClientHooks = {
|
|
247
247
|
before: ClientHooksBefore;
|
|
@@ -34,10 +34,20 @@ export declare class BotImplementation<TBot extends BaseBot = BaseBot, TPlugins
|
|
|
34
34
|
beforeIncomingMessage: <T extends utils.types.StringKeys<HookHandlersMap<TBot>["before_incoming_message"]>>(type: T, handler: HookHandlers<TBot>["before_incoming_message"][T]) => void;
|
|
35
35
|
beforeOutgoingMessage: <T extends utils.types.StringKeys<HookHandlersMap<TBot>["before_outgoing_message"]>>(type: T, handler: HookHandlers<TBot>["before_outgoing_message"][T]) => void;
|
|
36
36
|
beforeOutgoingCallAction: <T extends utils.types.StringKeys<HookHandlersMap<TBot>["before_outgoing_call_action"]>>(type: T, handler: HookHandlers<TBot>["before_outgoing_call_action"][T]) => void;
|
|
37
|
+
/**
|
|
38
|
+
* # EXPERIMENTAL
|
|
39
|
+
* This API is experimental and may change in the future.
|
|
40
|
+
*/
|
|
41
|
+
beforeIncomingCallAction: <T extends utils.types.StringKeys<HookHandlersMap<TBot>["before_incoming_call_action"]>>(type: T, handler: HookHandlers<TBot>["before_incoming_call_action"][T]) => void;
|
|
37
42
|
afterIncomingEvent: <T extends utils.types.StringKeys<HookHandlersMap<TBot>["after_incoming_event"]>>(type: T, handler: HookHandlers<TBot>["after_incoming_event"][T]) => void;
|
|
38
43
|
afterIncomingMessage: <T extends utils.types.StringKeys<HookHandlersMap<TBot>["after_incoming_message"]>>(type: T, handler: HookHandlers<TBot>["after_incoming_message"][T]) => void;
|
|
39
44
|
afterOutgoingMessage: <T extends utils.types.StringKeys<HookHandlersMap<TBot>["after_outgoing_message"]>>(type: T, handler: HookHandlers<TBot>["after_outgoing_message"][T]) => void;
|
|
40
45
|
afterOutgoingCallAction: <T extends utils.types.StringKeys<HookHandlersMap<TBot>["after_outgoing_call_action"]>>(type: T, handler: HookHandlers<TBot>["after_outgoing_call_action"][T]) => void;
|
|
46
|
+
/**
|
|
47
|
+
* # EXPERIMENTAL
|
|
48
|
+
* This API is experimental and may change in the future.
|
|
49
|
+
*/
|
|
50
|
+
afterIncomingCallAction: <T extends utils.types.StringKeys<HookHandlersMap<TBot>["after_incoming_call_action"]>>(type: T, handler: HookHandlers<TBot>["after_incoming_call_action"][T]) => void;
|
|
41
51
|
/**
|
|
42
52
|
* # EXPERIMENTAL
|
|
43
53
|
* This API is experimental and may change in the future.
|
|
@@ -56,15 +56,30 @@ type _OutgoingCallActionRequests<TBot extends common.BaseBot> = {
|
|
|
56
56
|
};
|
|
57
57
|
type _OutgoingCallActionResponses<TBot extends common.BaseBot> = {
|
|
58
58
|
[K in utils.StringKeys<common.EnumerateActionOutputs<TBot>>]: utils.Merge<client.ClientOutputs['callAction'], {
|
|
59
|
+
type: K;
|
|
59
60
|
output: common.EnumerateActionOutputs<TBot>[K];
|
|
60
61
|
}>;
|
|
61
62
|
};
|
|
63
|
+
type _IncomingCallActionRequest<TBot extends common.BaseBot> = {
|
|
64
|
+
[K in utils.StringKeys<TBot['actions']>]: {
|
|
65
|
+
type: K;
|
|
66
|
+
input: TBot['actions'][K]['input'];
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
type _IncomingCallActionResponses<TBot extends common.BaseBot> = {
|
|
70
|
+
[K in utils.StringKeys<TBot['actions']>]: {
|
|
71
|
+
type: K;
|
|
72
|
+
output: TBot['actions'][K]['output'];
|
|
73
|
+
};
|
|
74
|
+
};
|
|
62
75
|
export type AnyIncomingEvent<TBot extends common.BaseBot> = utils.ValueOf<_IncomingEvents<TBot>>;
|
|
63
76
|
export type AnyIncomingMessage<TBot extends common.BaseBot> = utils.ValueOf<_IncomingMessages<TBot>>;
|
|
64
77
|
export type AnyOutgoingMessageRequest<TBot extends common.BaseBot> = utils.ValueOf<_OutgoingMessageRequests<TBot>>;
|
|
65
78
|
export type AnyOutgoingMessageResponse<TBot extends common.BaseBot> = utils.ValueOf<_OutgoingMessageResponses<TBot>>;
|
|
66
79
|
export type AnyOutgoingCallActionRequest<TBot extends common.BaseBot> = utils.ValueOf<_OutgoingCallActionRequests<TBot>>;
|
|
67
80
|
export type AnyOutgoingCallActionResponse<TBot extends common.BaseBot> = utils.ValueOf<_OutgoingCallActionResponses<TBot>>;
|
|
81
|
+
export type AnyIncomingCallActionRequest<TBot extends common.BaseBot> = utils.ValueOf<_IncomingCallActionRequest<TBot>>;
|
|
82
|
+
export type AnyIncomingCallActionResponse<TBot extends common.BaseBot> = utils.ValueOf<_IncomingCallActionResponses<TBot>>;
|
|
68
83
|
export type IncomingEvents<TBot extends common.BaseBot> = _IncomingEvents<TBot> & {
|
|
69
84
|
'*': AnyIncomingEvent<TBot>;
|
|
70
85
|
};
|
|
@@ -86,6 +101,12 @@ export type OutgoingCallActionRequests<TBot extends common.BaseBot> = _OutgoingC
|
|
|
86
101
|
export type OutgoingCallActionResponses<TBot extends common.BaseBot> = _OutgoingCallActionResponses<TBot> & {
|
|
87
102
|
'*': AnyOutgoingCallActionResponse<TBot>;
|
|
88
103
|
};
|
|
104
|
+
export type IncomingCallActionRequest<TBot extends common.BaseBot> = _IncomingCallActionRequest<TBot> & {
|
|
105
|
+
'*': AnyIncomingCallActionRequest<TBot>;
|
|
106
|
+
};
|
|
107
|
+
export type IncomingCallActionResponses<TBot extends common.BaseBot> = _IncomingCallActionResponses<TBot> & {
|
|
108
|
+
'*': AnyIncomingCallActionResponse<TBot>;
|
|
109
|
+
};
|
|
89
110
|
export type BotClient<TBot extends common.BaseBot> = BotSpecificClient<TBot>;
|
|
90
111
|
export type CommonHandlerProps<TBot extends common.BaseBot> = {
|
|
91
112
|
ctx: BotContext;
|
|
@@ -170,8 +191,6 @@ type HookDefinition<THookDef extends BaseHookDefinition = BaseHookDefinition> =
|
|
|
170
191
|
* - after_register
|
|
171
192
|
* - before_state_expired
|
|
172
193
|
* - after_state_expired
|
|
173
|
-
* - before_incoming_call_action
|
|
174
|
-
* - after_incoming_call_action
|
|
175
194
|
*/
|
|
176
195
|
export type HookDefinitions<TBot extends common.BaseBot> = {
|
|
177
196
|
before_incoming_event: HookDefinition<{
|
|
@@ -198,6 +217,12 @@ export type HookDefinitions<TBot extends common.BaseBot> = {
|
|
|
198
217
|
'*': AnyOutgoingCallActionRequest<TBot>;
|
|
199
218
|
};
|
|
200
219
|
}>;
|
|
220
|
+
before_incoming_call_action: HookDefinition<{
|
|
221
|
+
stoppable: false;
|
|
222
|
+
data: _IncomingCallActionRequest<TBot> & {
|
|
223
|
+
'*': AnyIncomingCallActionRequest<TBot>;
|
|
224
|
+
};
|
|
225
|
+
}>;
|
|
201
226
|
after_incoming_event: HookDefinition<{
|
|
202
227
|
stoppable: true;
|
|
203
228
|
data: _IncomingEvents<TBot> & {
|
|
@@ -222,6 +247,12 @@ export type HookDefinitions<TBot extends common.BaseBot> = {
|
|
|
222
247
|
'*': AnyOutgoingCallActionResponse<TBot>;
|
|
223
248
|
};
|
|
224
249
|
}>;
|
|
250
|
+
after_incoming_call_action: HookDefinition<{
|
|
251
|
+
stoppable: false;
|
|
252
|
+
data: _IncomingCallActionResponses<TBot> & {
|
|
253
|
+
'*': AnyIncomingCallActionResponse<TBot>;
|
|
254
|
+
};
|
|
255
|
+
}>;
|
|
225
256
|
};
|
|
226
257
|
export type HookData<TBot extends common.BaseBot> = {
|
|
227
258
|
[THookType in utils.StringKeys<HookDefinitions<TBot>>]: {
|
package/dist/fixtures.d.ts
CHANGED