@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.
@@ -34,6 +34,10 @@ type GenericActionDefinition<TEntities extends BaseEntities, TAction extends Bas
34
34
  export type InterfaceDefinitionProps<TName extends string = string, TVersion extends string = string, TEntities extends BaseEntities = BaseEntities, TActions extends BaseActions = BaseActions, TEvents extends BaseEntities = BaseEntities, TChannels extends BaseChannels = BaseChannels> = {
35
35
  name: TName;
36
36
  version: TVersion;
37
+ title?: string;
38
+ description?: string;
39
+ icon?: string;
40
+ readme?: string;
37
41
  entities?: {
38
42
  [K in keyof TEntities]: EntityDefinition<TEntities[K]>;
39
43
  };
@@ -51,6 +55,10 @@ export declare class InterfaceDefinition<TName extends string = string, TVersion
51
55
  readonly props: InterfaceDefinitionProps<TName, TVersion, TEntities, TActions, TEvents, TChannels>;
52
56
  readonly name: this['props']['name'];
53
57
  readonly version: this['props']['version'];
58
+ readonly title: this['props']['title'];
59
+ readonly description: this['props']['description'];
60
+ readonly icon: this['props']['icon'];
61
+ readonly readme: this['props']['readme'];
54
62
  readonly entities: {
55
63
  [K in keyof TEntities]: EntityDefinition<TEntities[K]>;
56
64
  };
@@ -33,10 +33,20 @@ export declare class PluginImplementation<TPlugin extends BasePlugin = BasePlugi
33
33
  beforeIncomingMessage: <T extends utils.types.StringKeys<HookHandlersMap<TPlugin>["before_incoming_message"]>>(type: T, handler: HookHandlers<TPlugin>["before_incoming_message"][T]) => void;
34
34
  beforeOutgoingMessage: <T extends utils.types.StringKeys<HookHandlersMap<TPlugin>["before_outgoing_message"]>>(type: T, handler: HookHandlers<TPlugin>["before_outgoing_message"][T]) => void;
35
35
  beforeOutgoingCallAction: <T extends utils.types.StringKeys<HookHandlersMap<TPlugin>["before_outgoing_call_action"]>>(type: T, handler: HookHandlers<TPlugin>["before_outgoing_call_action"][T]) => void;
36
+ /**
37
+ * # EXPERIMENTAL
38
+ * This API is experimental and may change in the future.
39
+ */
40
+ beforeIncomingCallAction: <T extends utils.types.StringKeys<HookHandlersMap<TPlugin>["before_incoming_call_action"]>>(type: T, handler: HookHandlers<TPlugin>["before_incoming_call_action"][T]) => void;
36
41
  afterIncomingEvent: <T extends utils.types.StringKeys<HookHandlersMap<TPlugin>["after_incoming_event"]>>(type: T, handler: HookHandlers<TPlugin>["after_incoming_event"][T]) => void;
37
42
  afterIncomingMessage: <T extends utils.types.StringKeys<HookHandlersMap<TPlugin>["after_incoming_message"]>>(type: T, handler: HookHandlers<TPlugin>["after_incoming_message"][T]) => void;
38
43
  afterOutgoingMessage: <T extends utils.types.StringKeys<HookHandlersMap<TPlugin>["after_outgoing_message"]>>(type: T, handler: HookHandlers<TPlugin>["after_outgoing_message"][T]) => void;
39
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
+ afterIncomingCallAction: <T extends utils.types.StringKeys<HookHandlersMap<TPlugin>["after_incoming_call_action"]>>(type: T, handler: HookHandlers<TPlugin>["after_incoming_call_action"][T]) => void;
40
50
  /**
41
51
  * # EXPERIMENTAL
42
52
  * This API is experimental and may change in the future.
@@ -46,15 +46,38 @@ type _OutgoingCallActionRequests<TPlugin extends common.BasePlugin> = {
46
46
  };
47
47
  type _OutgoingCallActionResponses<TPlugin extends common.BasePlugin> = {
48
48
  [K in utils.StringKeys<bot.EnumerateActionOutputs<TPlugin>>]: utils.Merge<client.ClientOutputs['callAction'], {
49
+ type: K;
49
50
  output: bot.EnumerateActionOutputs<TPlugin>[K];
50
51
  }>;
51
52
  };
53
+ type _IncomingCallActionRequests<TPlugin extends common.BasePlugin> = {
54
+ [K in utils.StringKeys<TPlugin['actions']>]: {
55
+ type: K;
56
+ input: TPlugin['actions'][K]['input'];
57
+ };
58
+ };
59
+ type _IncomingCallActionResponses<TPlugin extends common.BasePlugin> = {
60
+ [K in utils.StringKeys<TPlugin['actions']>]: {
61
+ type: K;
62
+ output: TPlugin['actions'][K]['output'];
63
+ };
64
+ };
52
65
  export type AnyIncomingEvent<_TPlugin extends common.BasePlugin> = client.Event;
53
66
  export type AnyIncomingMessage<_TPlugin extends common.BasePlugin> = client.Message;
54
67
  export type AnyOutgoingMessageRequest<_TPlugin extends common.BasePlugin> = client.ClientInputs['createMessage'];
55
68
  export type AnyOutgoingMessageResponse<_TPlugin extends common.BasePlugin> = client.ClientOutputs['createMessage'];
56
69
  export type AnyOutgoingCallActionRequest<_TPlugin extends common.BasePlugin> = client.ClientInputs['callAction'];
57
- export type AnyOutgoingCallActionResponse<_TPlugin extends common.BasePlugin> = client.ClientOutputs['callAction'];
70
+ export type AnyOutgoingCallActionResponse<_TPlugin extends common.BasePlugin> = client.ClientOutputs['callAction'] & {
71
+ type: string;
72
+ };
73
+ export type AnyIncomingCallActionRequest<_TPlugin extends common.BasePlugin> = {
74
+ type: string;
75
+ input: Record<string, unknown>;
76
+ };
77
+ export type AnyIncomingCallActionResponse<_TPlugin extends common.BasePlugin> = {
78
+ type: string;
79
+ output: Record<string, unknown>;
80
+ };
58
81
  export type IncomingEvents<TPlugin extends common.BasePlugin> = _IncomingEvents<TPlugin> & {
59
82
  '*': AnyIncomingEvent<TPlugin>;
60
83
  };
@@ -76,6 +99,12 @@ export type OutgoingCallActionRequests<TPlugin extends common.BasePlugin> = _Out
76
99
  export type OutgoingCallActionResponses<TPlugin extends common.BasePlugin> = _OutgoingCallActionResponses<TPlugin> & {
77
100
  '*': AnyOutgoingCallActionResponse<TPlugin>;
78
101
  };
102
+ export type IncomingCallActionRequest<TPlugin extends common.BasePlugin> = _IncomingCallActionRequests<TPlugin> & {
103
+ '*': AnyIncomingCallActionRequest<TPlugin>;
104
+ };
105
+ export type IncomingCallActionResponse<TPlugin extends common.BasePlugin> = _IncomingCallActionResponses<TPlugin> & {
106
+ '*': AnyIncomingCallActionResponse<TPlugin>;
107
+ };
79
108
  export type PluginClient<_TPlugin extends common.BasePlugin> = bot.BotSpecificClient<common.BasePlugin>;
80
109
  export type CommonHandlerProps<TPlugin extends common.BasePlugin> = {
81
110
  ctx: bot.BotContext;
@@ -181,6 +210,12 @@ export type HookDefinitions<TPlugin extends common.BasePlugin> = {
181
210
  '*': AnyOutgoingCallActionRequest<TPlugin>;
182
211
  };
183
212
  }>;
213
+ before_incoming_call_action: HookDefinition<{
214
+ stoppable: true;
215
+ data: _IncomingCallActionRequests<TPlugin> & {
216
+ '*': AnyIncomingCallActionRequest<TPlugin>;
217
+ };
218
+ }>;
184
219
  after_incoming_event: HookDefinition<{
185
220
  stoppable: true;
186
221
  data: _IncomingEvents<TPlugin> & {
@@ -205,6 +240,12 @@ export type HookDefinitions<TPlugin extends common.BasePlugin> = {
205
240
  '*': AnyOutgoingCallActionResponse<TPlugin>;
206
241
  };
207
242
  }>;
243
+ after_incoming_call_action: HookDefinition<{
244
+ stoppable: true;
245
+ data: _IncomingCallActionResponses<TPlugin> & {
246
+ '*': AnyIncomingCallActionResponse<TPlugin>;
247
+ };
248
+ }>;
208
249
  };
209
250
  export type HookData<TPlugin extends common.BasePlugin> = {
210
251
  [THookType in utils.StringKeys<HookDefinitions<TPlugin>>]: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@botpress/sdk",
3
- "version": "4.1.0",
3
+ "version": "4.3.0",
4
4
  "description": "Botpress SDK",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.mjs",
@@ -16,7 +16,7 @@
16
16
  "author": "",
17
17
  "license": "MIT",
18
18
  "dependencies": {
19
- "@botpress/client": "1.6.0",
19
+ "@botpress/client": "1.7.0",
20
20
  "browser-or-node": "^2.1.1"
21
21
  },
22
22
  "devDependencies": {