@botpress/sdk 3.5.0 → 3.6.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/bot-logger.d.ts +4 -0
- package/dist/bot/implementation.d.ts +26 -14
- package/dist/bot/server/types.d.ts +91 -63
- package/dist/bot/server/workflows/update-handler.d.ts +1 -1
- package/dist/bot/server/workflows/update-type-conv.d.ts +1 -2
- package/dist/index.cjs +25 -25
- package/dist/index.cjs.map +3 -3
- package/dist/index.mjs +27 -27
- package/dist/index.mjs.map +3 -3
- package/dist/plugin/implementation.d.ts +26 -24
- package/dist/plugin/server/types.d.ts +94 -38
- package/package.json +1 -1
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import type { MessageHandlersMap as BotMessageHandlersMap, EventHandlersMap as BotEventHandlersMap, StateExpiredHandlersMap as BotStateExpiredHandlersMap, HookHandlersMap as BotHookHandlersMap,
|
|
2
|
-
import
|
|
3
|
-
import { ActionProxy } from './action-proxy';
|
|
1
|
+
import type { MessageHandlersMap as BotMessageHandlersMap, EventHandlersMap as BotEventHandlersMap, StateExpiredHandlersMap as BotStateExpiredHandlersMap, HookHandlersMap as BotHookHandlersMap, WorkflowHandlersMap as BotWorkflowHandlersMap, ActionHandlers as BotActionHandlers, BotHandlers } from '../bot';
|
|
2
|
+
import * as utils from '../utils';
|
|
4
3
|
import { BasePlugin, PluginInterfaceExtensions } from './common';
|
|
5
|
-
import {
|
|
4
|
+
import { ActionHandlers, MessageHandlers, EventHandlers, StateExpiredHandlers, HookHandlers, WorkflowHandlers, MessageHandlersMap, EventHandlersMap, StateExpiredHandlersMap, HookHandlersMap, WorkflowHandlersMap, PluginConfiguration } from './server/types';
|
|
6
5
|
export type PluginImplementationProps<TPlugin extends BasePlugin = BasePlugin> = {
|
|
7
6
|
actions: ActionHandlers<TPlugin>;
|
|
8
7
|
};
|
|
@@ -11,13 +10,6 @@ export type PluginRuntimeProps<TPlugin extends BasePlugin = BasePlugin> = {
|
|
|
11
10
|
configuration: PluginConfiguration<TPlugin>;
|
|
12
11
|
interfaces: PluginInterfaceExtensions<TPlugin>;
|
|
13
12
|
};
|
|
14
|
-
type Tools<TPlugin extends BasePlugin = BasePlugin> = {
|
|
15
|
-
configuration: PluginConfiguration<TPlugin>;
|
|
16
|
-
interfaces: PluginInterfaceExtensions<TPlugin>;
|
|
17
|
-
actions: ActionProxy<TPlugin>;
|
|
18
|
-
workflows: WorkflowProxy<TPlugin>;
|
|
19
|
-
alias?: string;
|
|
20
|
-
};
|
|
21
13
|
export declare class PluginImplementation<TPlugin extends BasePlugin = BasePlugin> implements BotHandlers<TPlugin> {
|
|
22
14
|
readonly props: PluginImplementationProps<TPlugin>;
|
|
23
15
|
private _runtimeProps;
|
|
@@ -27,6 +19,7 @@ export declare class PluginImplementation<TPlugin extends BasePlugin = BasePlugi
|
|
|
27
19
|
private _stateExpiredHandlers;
|
|
28
20
|
private _hookHandlers;
|
|
29
21
|
private _workflowHandlers;
|
|
22
|
+
private _registerOrder;
|
|
30
23
|
constructor(props: PluginImplementationProps<TPlugin>);
|
|
31
24
|
initialize(props: PluginRuntimeProps<TPlugin>): this;
|
|
32
25
|
private get _runtime();
|
|
@@ -38,22 +31,32 @@ export declare class PluginImplementation<TPlugin extends BasePlugin = BasePlugi
|
|
|
38
31
|
get hookHandlers(): BotHookHandlersMap<TPlugin>;
|
|
39
32
|
get workflowHandlers(): BotWorkflowHandlersMap<TPlugin>;
|
|
40
33
|
readonly on: {
|
|
41
|
-
message: <T extends
|
|
34
|
+
message: <T extends utils.types.StringKeys<MessageHandlersMap<TPlugin>>>(type: T, handler: MessageHandlers<TPlugin>[T]) => void;
|
|
35
|
+
event: <T extends utils.types.StringKeys<EventHandlersMap<TPlugin>>>(type: T, handler: EventHandlers<TPlugin>[T]) => void;
|
|
36
|
+
stateExpired: <T extends utils.types.StringKeys<StateExpiredHandlersMap<TPlugin>>>(type: T, handler: StateExpiredHandlers<TPlugin>[T]) => void;
|
|
37
|
+
beforeIncomingEvent: <T extends utils.types.StringKeys<HookHandlersMap<TPlugin>["before_incoming_event"]>>(type: T, handler: HookHandlers<TPlugin>["before_incoming_event"][T]) => void;
|
|
38
|
+
beforeIncomingMessage: <T extends utils.types.StringKeys<HookHandlersMap<TPlugin>["before_incoming_message"]>>(type: T, handler: HookHandlers<TPlugin>["before_incoming_message"][T]) => void;
|
|
39
|
+
beforeOutgoingMessage: <T extends utils.types.StringKeys<HookHandlersMap<TPlugin>["before_outgoing_message"]>>(type: T, handler: HookHandlers<TPlugin>["before_outgoing_message"][T]) => void;
|
|
40
|
+
beforeOutgoingCallAction: <T extends utils.types.StringKeys<HookHandlersMap<TPlugin>["before_outgoing_call_action"]>>(type: T, handler: HookHandlers<TPlugin>["before_outgoing_call_action"][T]) => void;
|
|
41
|
+
afterIncomingEvent: <T extends utils.types.StringKeys<HookHandlersMap<TPlugin>["after_incoming_event"]>>(type: T, handler: HookHandlers<TPlugin>["after_incoming_event"][T]) => void;
|
|
42
|
+
afterIncomingMessage: <T extends utils.types.StringKeys<HookHandlersMap<TPlugin>["after_incoming_message"]>>(type: T, handler: HookHandlers<TPlugin>["after_incoming_message"][T]) => void;
|
|
43
|
+
afterOutgoingMessage: <T extends utils.types.StringKeys<HookHandlersMap<TPlugin>["after_outgoing_message"]>>(type: T, handler: HookHandlers<TPlugin>["after_outgoing_message"][T]) => void;
|
|
44
|
+
afterOutgoingCallAction: <T extends utils.types.StringKeys<HookHandlersMap<TPlugin>["after_outgoing_call_action"]>>(type: T, handler: HookHandlers<TPlugin>["after_outgoing_call_action"][T]) => void;
|
|
45
|
+
/**
|
|
46
|
+
* # EXPERIMENTAL
|
|
47
|
+
* This API is experimental and may change in the future.
|
|
48
|
+
*/
|
|
49
|
+
workflowStart: <T extends utils.types.StringKeys<WorkflowHandlersMap<TPlugin>["started"]>>(type: T, handler: WorkflowHandlers<TPlugin>[T]) => void;
|
|
50
|
+
/**
|
|
51
|
+
* # EXPERIMENTAL
|
|
52
|
+
* This API is experimental and may change in the future.
|
|
53
|
+
*/
|
|
54
|
+
workflowContinue: <T extends utils.types.StringKeys<WorkflowHandlersMap<TPlugin>["continued"]>>(type: T, handler: WorkflowHandlers<TPlugin>[T]) => void;
|
|
42
55
|
/**
|
|
43
56
|
* # EXPERIMENTAL
|
|
44
57
|
* This API is experimental and may change in the future.
|
|
45
58
|
*/
|
|
46
|
-
|
|
47
|
-
event: <T extends keyof EventHandlersMap<TPlugin>>(type: T, handler: EventHandlers<TPlugin>[T]) => void;
|
|
48
|
-
stateExpired: <T extends keyof StateExpiredHandlersMap<TPlugin>>(type: T, handler: StateExpiredHandlers<TPlugin>[T]) => void;
|
|
49
|
-
beforeIncomingEvent: <T extends keyof HookData<TPlugin>["before_incoming_event"]>(type: T, handler: HookHandlers<TPlugin>["before_incoming_event"][T]) => void;
|
|
50
|
-
beforeIncomingMessage: <T extends keyof HookData<TPlugin>["before_incoming_message"]>(type: T, handler: HookHandlers<TPlugin>["before_incoming_message"][T]) => void;
|
|
51
|
-
beforeOutgoingMessage: <T extends keyof HookData<TPlugin>["before_outgoing_message"]>(type: T, handler: HookHandlers<TPlugin>["before_outgoing_message"][T]) => void;
|
|
52
|
-
beforeOutgoingCallAction: <T extends keyof HookData<TPlugin>["before_outgoing_call_action"]>(type: T, handler: HookHandlers<TPlugin>["before_outgoing_call_action"][T]) => void;
|
|
53
|
-
afterIncomingEvent: <T extends keyof HookData<TPlugin>["after_incoming_event"]>(type: T, handler: HookHandlers<TPlugin>["after_incoming_event"][T]) => void;
|
|
54
|
-
afterIncomingMessage: <T extends keyof HookData<TPlugin>["after_incoming_message"]>(type: T, handler: HookHandlers<TPlugin>["after_incoming_message"][T]) => void;
|
|
55
|
-
afterOutgoingMessage: <T extends keyof HookData<TPlugin>["after_outgoing_message"]>(type: T, handler: HookHandlers<TPlugin>["after_outgoing_message"][T]) => void;
|
|
56
|
-
afterOutgoingCallAction: <T extends keyof HookData<TPlugin>["after_outgoing_call_action"]>(type: T, handler: HookHandlers<TPlugin>["after_outgoing_call_action"][T]) => void;
|
|
59
|
+
workflowTimeout: <T extends utils.types.StringKeys<WorkflowHandlersMap<TPlugin>["timed_out"]>>(type: T, handler: WorkflowHandlers<TPlugin>[T]) => void;
|
|
57
60
|
};
|
|
58
61
|
/**
|
|
59
62
|
* checks if the actual event resolves to the target event
|
|
@@ -61,4 +64,3 @@ export declare class PluginImplementation<TPlugin extends BasePlugin = BasePlugi
|
|
|
61
64
|
private _eventResolvesTo;
|
|
62
65
|
private _stripAliasPrefix;
|
|
63
66
|
}
|
|
64
|
-
export {};
|
|
@@ -6,31 +6,31 @@ import * as actionProxy from '../action-proxy';
|
|
|
6
6
|
import * as common from '../common';
|
|
7
7
|
type EnumeratePluginEvents<TPlugin extends common.BasePlugin> = bot.EnumerateEvents<TPlugin> & common.EnumerateInterfaceEvents<TPlugin>;
|
|
8
8
|
type _IncomingEvents<TPlugin extends common.BasePlugin> = {
|
|
9
|
-
[K in
|
|
9
|
+
[K in utils.StringKeys<EnumeratePluginEvents<TPlugin>>]: utils.Merge<client.Event, {
|
|
10
10
|
type: K;
|
|
11
11
|
payload: EnumeratePluginEvents<TPlugin>[K];
|
|
12
12
|
}>;
|
|
13
13
|
};
|
|
14
14
|
type _IncomingMessages<TPlugin extends common.BasePlugin> = {
|
|
15
|
-
[K in
|
|
15
|
+
[K in utils.StringKeys<bot.GetMessages<TPlugin>>]: utils.Merge<client.Message, {
|
|
16
16
|
type: K;
|
|
17
17
|
payload: bot.GetMessages<TPlugin>[K];
|
|
18
18
|
}>;
|
|
19
19
|
};
|
|
20
20
|
type _IncomingStates<TPlugin extends common.BasePlugin> = {
|
|
21
|
-
[K in
|
|
21
|
+
[K in utils.StringKeys<bot.EnumerateStates<TPlugin>>]: utils.Merge<client.State, {
|
|
22
22
|
name: K;
|
|
23
23
|
payload: bot.EnumerateStates<TPlugin>[K];
|
|
24
24
|
}>;
|
|
25
25
|
};
|
|
26
26
|
type _OutgoingMessageRequests<TPlugin extends common.BasePlugin> = {
|
|
27
|
-
[K in
|
|
27
|
+
[K in utils.StringKeys<bot.GetMessages<TPlugin>>]: utils.Merge<client.ClientInputs['createMessage'], {
|
|
28
28
|
type: K;
|
|
29
29
|
payload: bot.GetMessages<TPlugin>[K];
|
|
30
30
|
}>;
|
|
31
31
|
};
|
|
32
32
|
type _OutgoingMessageResponses<TPlugin extends common.BasePlugin> = {
|
|
33
|
-
[K in
|
|
33
|
+
[K in utils.StringKeys<bot.GetMessages<TPlugin>>]: utils.Merge<client.ClientOutputs['createMessage'], {
|
|
34
34
|
message: utils.Merge<client.Message, {
|
|
35
35
|
type: K;
|
|
36
36
|
payload: bot.GetMessages<TPlugin>[K];
|
|
@@ -38,13 +38,13 @@ type _OutgoingMessageResponses<TPlugin extends common.BasePlugin> = {
|
|
|
38
38
|
}>;
|
|
39
39
|
};
|
|
40
40
|
type _OutgoingCallActionRequests<TPlugin extends common.BasePlugin> = {
|
|
41
|
-
[K in
|
|
41
|
+
[K in utils.StringKeys<bot.EnumerateActionInputs<TPlugin>>]: utils.Merge<client.ClientInputs['callAction'], {
|
|
42
42
|
type: K;
|
|
43
43
|
input: bot.EnumerateActionInputs<TPlugin>[K];
|
|
44
44
|
}>;
|
|
45
45
|
};
|
|
46
46
|
type _OutgoingCallActionResponses<TPlugin extends common.BasePlugin> = {
|
|
47
|
-
[K in
|
|
47
|
+
[K in utils.StringKeys<bot.EnumerateActionOutputs<TPlugin>>]: utils.Merge<client.ClientOutputs['callAction'], {
|
|
48
48
|
output: bot.EnumerateActionOutputs<TPlugin>[K];
|
|
49
49
|
}>;
|
|
50
50
|
};
|
|
@@ -89,16 +89,15 @@ export type CommonHandlerProps<TPlugin extends common.BasePlugin> = {
|
|
|
89
89
|
* This API is experimental and may change in the future.
|
|
90
90
|
*/
|
|
91
91
|
workflows: workflowProxy.WorkflowProxy<TPlugin>;
|
|
92
|
-
alias: string;
|
|
93
92
|
};
|
|
94
93
|
export type MessagePayloads<TPlugin extends common.BasePlugin> = {
|
|
95
|
-
[
|
|
96
|
-
message: IncomingMessages<TPlugin>[
|
|
94
|
+
[TMessageName in utils.StringKeys<IncomingMessages<TPlugin>>]: CommonHandlerProps<TPlugin> & {
|
|
95
|
+
message: IncomingMessages<TPlugin>[TMessageName];
|
|
97
96
|
user: client.User;
|
|
98
97
|
conversation: client.Conversation;
|
|
99
98
|
event: client.Event;
|
|
100
99
|
states: {
|
|
101
|
-
[TState in
|
|
100
|
+
[TState in utils.StringKeys<TPlugin['states']>]: {
|
|
102
101
|
type: 'user' | 'conversation' | 'bot';
|
|
103
102
|
payload: TPlugin['states'][TState];
|
|
104
103
|
};
|
|
@@ -106,32 +105,46 @@ export type MessagePayloads<TPlugin extends common.BasePlugin> = {
|
|
|
106
105
|
};
|
|
107
106
|
};
|
|
108
107
|
export type MessageHandlers<TPlugin extends common.BasePlugin> = {
|
|
109
|
-
[
|
|
108
|
+
[TMessageName in utils.StringKeys<IncomingMessages<TPlugin>>]: (args: MessagePayloads<TPlugin>[TMessageName]) => Promise<void>;
|
|
110
109
|
};
|
|
111
110
|
export type EventPayloads<TPlugin extends common.BasePlugin> = {
|
|
112
|
-
[
|
|
113
|
-
event: IncomingEvents<TPlugin>[
|
|
111
|
+
[TEventName in utils.StringKeys<IncomingEvents<TPlugin>>]: CommonHandlerProps<TPlugin> & {
|
|
112
|
+
event: IncomingEvents<TPlugin>[TEventName];
|
|
114
113
|
};
|
|
115
114
|
};
|
|
116
115
|
export type EventHandlers<TPlugin extends common.BasePlugin> = {
|
|
117
|
-
[
|
|
116
|
+
[TEventName in utils.StringKeys<IncomingEvents<TPlugin>>]: (args: EventPayloads<TPlugin>[TEventName]) => Promise<void>;
|
|
118
117
|
};
|
|
119
118
|
export type StateExpiredPayloads<TPlugin extends common.BasePlugin> = {
|
|
120
|
-
[
|
|
121
|
-
state: IncomingStates<TPlugin>[
|
|
119
|
+
[TSateName in utils.StringKeys<IncomingStates<TPlugin>>]: CommonHandlerProps<TPlugin> & {
|
|
120
|
+
state: IncomingStates<TPlugin>[TSateName];
|
|
122
121
|
};
|
|
123
122
|
};
|
|
124
123
|
export type StateExpiredHandlers<TPlugin extends common.BasePlugin> = {
|
|
125
|
-
[
|
|
124
|
+
[TSateName in utils.StringKeys<IncomingStates<TPlugin>>]: (args: StateExpiredPayloads<TPlugin>[TSateName]) => Promise<void>;
|
|
126
125
|
};
|
|
127
126
|
export type ActionHandlerPayloads<TPlugin extends common.BasePlugin> = {
|
|
128
|
-
[
|
|
129
|
-
type?:
|
|
130
|
-
input: TPlugin['actions'][
|
|
127
|
+
[TActionName in utils.StringKeys<TPlugin['actions']>]: CommonHandlerProps<TPlugin> & {
|
|
128
|
+
type?: TActionName;
|
|
129
|
+
input: TPlugin['actions'][TActionName]['input'];
|
|
131
130
|
};
|
|
132
131
|
};
|
|
133
132
|
export type ActionHandlers<TPlugin extends common.BasePlugin> = {
|
|
134
|
-
[
|
|
133
|
+
[TActionName in utils.StringKeys<TPlugin['actions']>]: (props: ActionHandlerPayloads<TPlugin>[TActionName]) => Promise<TPlugin['actions'][TActionName]['output']>;
|
|
134
|
+
};
|
|
135
|
+
export type WorkflowPayloads<TPlugin extends common.BasePlugin> = {
|
|
136
|
+
[TWorkflowName in utils.StringKeys<TPlugin['workflows']>]: CommonHandlerProps<TPlugin> & {
|
|
137
|
+
conversation?: client.Conversation;
|
|
138
|
+
user?: client.User;
|
|
139
|
+
/**
|
|
140
|
+
* # EXPERIMENTAL
|
|
141
|
+
* This API is experimental and may change in the future.
|
|
142
|
+
*/
|
|
143
|
+
workflow: workflowProxy.WorkflowWithUtilities<TPlugin, TWorkflowName>;
|
|
144
|
+
};
|
|
145
|
+
};
|
|
146
|
+
export type WorkflowHandlers<TPlugin extends common.BasePlugin> = {
|
|
147
|
+
[TWorkflowName in utils.StringKeys<TPlugin['workflows']>]: (props: WorkflowPayloads<TPlugin>[TWorkflowName]) => Promise<void>;
|
|
135
148
|
};
|
|
136
149
|
type BaseHookDefinition = {
|
|
137
150
|
stoppable?: boolean;
|
|
@@ -199,43 +212,85 @@ export type HookDefinitions<TPlugin extends common.BasePlugin> = {
|
|
|
199
212
|
}>;
|
|
200
213
|
};
|
|
201
214
|
export type HookData<TPlugin extends common.BasePlugin> = {
|
|
202
|
-
[
|
|
203
|
-
[
|
|
215
|
+
[THookType in utils.StringKeys<HookDefinitions<TPlugin>>]: {
|
|
216
|
+
[THookDataName in utils.StringKeys<HookDefinitions<TPlugin>[THookType]['data']>]: HookDefinitions<TPlugin>[THookType]['data'][THookDataName];
|
|
204
217
|
};
|
|
205
218
|
};
|
|
206
219
|
export type HookInputs<TPlugin extends common.BasePlugin> = {
|
|
207
|
-
[
|
|
208
|
-
[
|
|
209
|
-
data: HookData<TPlugin>[
|
|
220
|
+
[THookType in utils.StringKeys<HookData<TPlugin>>]: {
|
|
221
|
+
[THookDataName in utils.StringKeys<HookData<TPlugin>[THookType]>]: CommonHandlerProps<TPlugin> & {
|
|
222
|
+
data: HookData<TPlugin>[THookType][THookDataName];
|
|
210
223
|
};
|
|
211
224
|
};
|
|
212
225
|
};
|
|
213
226
|
export type HookOutputs<TPlugin extends common.BasePlugin> = {
|
|
214
|
-
[
|
|
215
|
-
[
|
|
216
|
-
data?: HookData<TPlugin>[
|
|
217
|
-
} & (HookDefinitions<TPlugin>[
|
|
227
|
+
[THookType in utils.StringKeys<HookData<TPlugin>>]: {
|
|
228
|
+
[THookDataName in utils.StringKeys<HookData<TPlugin>[THookType]>]: {
|
|
229
|
+
data?: HookData<TPlugin>[THookType][THookDataName];
|
|
230
|
+
} & (HookDefinitions<TPlugin>[THookType]['stoppable'] extends true ? {
|
|
218
231
|
stop?: boolean;
|
|
219
232
|
} : {});
|
|
220
233
|
};
|
|
221
234
|
};
|
|
222
235
|
export type HookHandlers<TPlugin extends common.BasePlugin> = {
|
|
223
|
-
[
|
|
224
|
-
[
|
|
236
|
+
[THookType in utils.StringKeys<HookData<TPlugin>>]: {
|
|
237
|
+
[THookDataName in utils.StringKeys<HookData<TPlugin>[THookType]>]: (input: HookInputs<TPlugin>[THookType][THookDataName]) => Promise<HookOutputs<TPlugin>[THookType][THookDataName] | undefined>;
|
|
225
238
|
};
|
|
226
239
|
};
|
|
227
240
|
export type MessageHandlersMap<TPlugin extends common.BasePlugin> = {
|
|
228
|
-
[
|
|
241
|
+
[TMessageName in utils.StringKeys<IncomingMessages<TPlugin>>]?: MessageHandlers<TPlugin>[TMessageName][];
|
|
229
242
|
};
|
|
230
243
|
export type EventHandlersMap<TPlugin extends common.BasePlugin> = {
|
|
231
|
-
[
|
|
244
|
+
[TEventName in utils.StringKeys<IncomingEvents<TPlugin>>]?: EventHandlers<TPlugin>[TEventName][];
|
|
232
245
|
};
|
|
233
246
|
export type StateExpiredHandlersMap<TPlugin extends common.BasePlugin> = {
|
|
234
|
-
[
|
|
247
|
+
[TStateName in utils.StringKeys<IncomingStates<TPlugin>>]?: StateExpiredHandlers<TPlugin>[TStateName][];
|
|
235
248
|
};
|
|
236
249
|
export type HookHandlersMap<TPlugin extends common.BasePlugin> = {
|
|
237
|
-
[
|
|
238
|
-
[
|
|
250
|
+
[THookType in utils.StringKeys<HookData<TPlugin>>]: {
|
|
251
|
+
[THookDataName in utils.StringKeys<HookData<TPlugin>[THookType]>]?: HookHandlers<TPlugin>[THookType][THookDataName][];
|
|
252
|
+
};
|
|
253
|
+
};
|
|
254
|
+
export type WorkflowHandlersMap<TPlugin extends common.BasePlugin> = {
|
|
255
|
+
[TWorkflowUpdateType in bot.WorkflowUpdateType]: {
|
|
256
|
+
[TWorkflowName in utils.StringKeys<TPlugin['workflows']>]?: {
|
|
257
|
+
handler: WorkflowHandlers<TPlugin>[TWorkflowName];
|
|
258
|
+
order: number;
|
|
259
|
+
}[];
|
|
260
|
+
};
|
|
261
|
+
};
|
|
262
|
+
export type OrderedMessageHandlersMap<TPlugin extends common.BasePlugin> = {
|
|
263
|
+
[TMessageName in utils.StringKeys<IncomingMessages<TPlugin>>]?: {
|
|
264
|
+
handler: MessageHandlers<TPlugin>[TMessageName];
|
|
265
|
+
order: number;
|
|
266
|
+
}[];
|
|
267
|
+
};
|
|
268
|
+
export type OrderedEventHandlersMap<TPlugin extends common.BasePlugin> = {
|
|
269
|
+
[TEventName in utils.StringKeys<IncomingEvents<TPlugin>>]?: {
|
|
270
|
+
handler: EventHandlers<TPlugin>[TEventName];
|
|
271
|
+
order: number;
|
|
272
|
+
}[];
|
|
273
|
+
};
|
|
274
|
+
export type OrderedStateExpiredHandlersMap<TPlugin extends common.BasePlugin> = {
|
|
275
|
+
[TStateName in utils.StringKeys<IncomingStates<TPlugin>>]?: {
|
|
276
|
+
handler: StateExpiredHandlers<TPlugin>[TStateName];
|
|
277
|
+
order: number;
|
|
278
|
+
}[];
|
|
279
|
+
};
|
|
280
|
+
export type OrderedHookHandlersMap<TPlugin extends common.BasePlugin> = {
|
|
281
|
+
[THookType in utils.StringKeys<HookData<TPlugin>>]: {
|
|
282
|
+
[THookDataName in utils.StringKeys<HookData<TPlugin>[THookType]>]?: {
|
|
283
|
+
handler: HookHandlers<TPlugin>[THookType][THookDataName];
|
|
284
|
+
order: number;
|
|
285
|
+
}[];
|
|
286
|
+
};
|
|
287
|
+
};
|
|
288
|
+
export type OrderedWorkflowHandlersMap<TPlugin extends common.BasePlugin> = {
|
|
289
|
+
[TWorkflowUpdateType in bot.WorkflowUpdateType]: {
|
|
290
|
+
[TWorkflowName in utils.StringKeys<TPlugin['workflows']>]?: {
|
|
291
|
+
handler: WorkflowHandlers<TPlugin>[TWorkflowName];
|
|
292
|
+
order: number;
|
|
293
|
+
}[];
|
|
239
294
|
};
|
|
240
295
|
};
|
|
241
296
|
export type PluginHandlers<TPlugin extends common.BasePlugin> = {
|
|
@@ -244,5 +299,6 @@ export type PluginHandlers<TPlugin extends common.BasePlugin> = {
|
|
|
244
299
|
eventHandlers: EventHandlersMap<TPlugin>;
|
|
245
300
|
stateExpiredHandlers: StateExpiredHandlersMap<TPlugin>;
|
|
246
301
|
hookHandlers: HookHandlersMap<TPlugin>;
|
|
302
|
+
workflowHandlers: WorkflowHandlersMap<TPlugin>;
|
|
247
303
|
};
|
|
248
304
|
export {};
|