@botpress/sdk 4.8.4 → 4.9.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/fixtures.d.ts +7 -0
- package/dist/index.cjs +11 -11
- package/dist/index.cjs.map +4 -4
- package/dist/index.mjs +17 -17
- package/dist/index.mjs.map +4 -4
- package/dist/plugin/event-proxy/index.d.ts +2 -0
- package/dist/plugin/event-proxy/proxy.d.ts +5 -0
- package/dist/plugin/event-proxy/types.d.ts +14 -0
- package/dist/plugin/event-proxy/types.test.d.ts +1 -0
- package/dist/plugin/server/types.d.ts +2 -0
- package/package.json +2 -2
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Client } from '@botpress/client';
|
|
2
|
+
import { BotSpecificClient } from '../../bot';
|
|
3
|
+
import { BasePlugin, PluginRuntimeProps } from '../common';
|
|
4
|
+
import { EventProxy } from './types';
|
|
5
|
+
export declare const proxyEvents: <TPlugin extends BasePlugin>(client: BotSpecificClient<TPlugin> | Client, props: PluginRuntimeProps<TPlugin>) => EventProxy<TPlugin>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ClientInputs } from '@botpress/client';
|
|
2
|
+
import * as utils from '../../utils/type-utils';
|
|
3
|
+
import { BasePlugin } from '../common';
|
|
4
|
+
export type EventSchedule = NonNullable<ClientInputs['createEvent']['schedule']>;
|
|
5
|
+
export type EventSender<TPayload> = {
|
|
6
|
+
emit: (event: TPayload) => Promise<void>;
|
|
7
|
+
schedule: (event: TPayload, schedule: EventSchedule) => Promise<void>;
|
|
8
|
+
withConversationId: (conversationId: string) => EventSender<TPayload>;
|
|
9
|
+
withUserId: (userId: string) => EventSender<TPayload>;
|
|
10
|
+
withMessageId: (messageId: string) => EventSender<TPayload>;
|
|
11
|
+
};
|
|
12
|
+
export type EventProxy<TPlugin extends BasePlugin> = utils.Normalize<{
|
|
13
|
+
[TEventName in keyof TPlugin['events']]: EventSender<TPlugin['events'][TEventName]>;
|
|
14
|
+
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -4,6 +4,7 @@ import * as workflowProxy from '../../bot/workflow-proxy';
|
|
|
4
4
|
import * as utils from '../../utils/type-utils';
|
|
5
5
|
import * as actionProxy from '../action-proxy';
|
|
6
6
|
import * as common from '../common';
|
|
7
|
+
import * as eventProxy from '../event-proxy';
|
|
7
8
|
import * as stateProxy from '../state-proxy';
|
|
8
9
|
type EnumeratePluginEvents<TPlugin extends common.BasePlugin> = bot.EnumerateEvents<TPlugin> & common.EnumerateInterfaceEvents<TPlugin>;
|
|
9
10
|
type _IncomingEvents<TPlugin extends common.BasePlugin> = {
|
|
@@ -114,6 +115,7 @@ export type CommonHandlerProps<TPlugin extends common.BasePlugin> = {
|
|
|
114
115
|
interfaces: common.PluginInterfaceExtensions<TPlugin>;
|
|
115
116
|
actions: actionProxy.ActionProxy<TPlugin>;
|
|
116
117
|
states: stateProxy.StateProxy<TPlugin>;
|
|
118
|
+
events: eventProxy.EventProxy<TPlugin>;
|
|
117
119
|
alias?: string;
|
|
118
120
|
/**
|
|
119
121
|
* # EXPERIMENTAL
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@botpress/sdk",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.9.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.15.
|
|
19
|
+
"@botpress/client": "1.15.2",
|
|
20
20
|
"browser-or-node": "^2.1.1"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|