@botpress/sdk 3.6.3 → 4.0.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 +10 -9
- package/dist/bot/common/generic.d.ts +6 -1
- package/dist/bot/server/types.d.ts +2 -1
- package/dist/fixtures.d.ts +5 -2
- package/dist/index.cjs.map +2 -2
- package/dist/index.mjs.map +2 -2
- package/dist/integration/client/types.d.ts +10 -4
- package/dist/integration/common/generic.d.ts +6 -1
- package/dist/integration/definition/types.d.ts +2 -1
- package/dist/message.d.ts +44 -44
- package/dist/plugin/common/generic.d.ts +6 -1
- package/dist/utils/type-utils.d.ts +10 -0
- package/package.json +1 -1
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
|
|
2
|
-
> @botpress/sdk@
|
|
2
|
+
> @botpress/sdk@4.0.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@
|
|
6
|
+
> @botpress/sdk@4.0.0 build:type /home/runner/work/botpress/botpress/packages/sdk
|
|
7
7
|
> tsc --emitDeclarationOnly --declaration
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
> @botpress/sdk@
|
|
10
|
+
> @botpress/sdk@4.0.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@
|
|
15
|
+
> @botpress/sdk@4.0.0 build:browser /home/runner/work/botpress/botpress/packages/sdk
|
|
16
16
|
> ts-node -T ./build.ts --browser
|
|
17
17
|
|
|
18
18
|
Done
|
|
@@ -21,7 +21,8 @@ type MessageResponse<TBot extends common.BaseBot, TMessage extends keyof common.
|
|
|
21
21
|
};
|
|
22
22
|
type StateResponse<TBot extends common.BaseBot, TState extends keyof TBot['states'] = keyof TBot['states']> = utils.Merge<Awaited<Res<client.Client['getState']>>, {
|
|
23
23
|
state: utils.Merge<Awaited<Res<client.Client['getState']>>['state'], {
|
|
24
|
-
|
|
24
|
+
type: utils.Cast<TBot['states'][TState]['type'], string>;
|
|
25
|
+
payload: TBot['states'][TState]['payload'];
|
|
25
26
|
}>;
|
|
26
27
|
}>;
|
|
27
28
|
export type CreateConversation<_TBot extends common.BaseBot> = client.Client['createConversation'];
|
|
@@ -60,23 +61,23 @@ export type UpdateUser<_TBot extends common.BaseBot> = client.Client['updateUser
|
|
|
60
61
|
export type DeleteUser<_TBot extends common.BaseBot> = client.Client['deleteUser'];
|
|
61
62
|
export type GetState<TBot extends common.BaseBot> = <TState extends keyof TBot['states']>(x: utils.Merge<Arg<client.Client['getState']>, {
|
|
62
63
|
name: utils.Cast<TState, string>;
|
|
64
|
+
type: utils.Cast<TBot['states'][TState]['type'], string>;
|
|
63
65
|
}>) => Promise<StateResponse<TBot, TState>>;
|
|
64
66
|
export type SetState<TBot extends common.BaseBot> = <TState extends keyof TBot['states']>(x: utils.Merge<Arg<client.Client['setState']>, {
|
|
65
67
|
name: utils.Cast<TState, string>;
|
|
66
|
-
|
|
68
|
+
type: utils.Cast<TBot['states'][TState]['type'], string>;
|
|
69
|
+
payload: TBot['states'][TState]['payload'] | null;
|
|
67
70
|
}>) => Promise<StateResponse<TBot, TState>>;
|
|
68
71
|
export type GetOrSetState<TBot extends common.BaseBot> = <TState extends keyof TBot['states']>(x: utils.Merge<Arg<client.Client['getOrSetState']>, {
|
|
69
72
|
name: utils.Cast<TState, string>;
|
|
70
|
-
|
|
73
|
+
type: utils.Cast<TBot['states'][TState]['type'], string>;
|
|
74
|
+
payload: TBot['states'][TState]['payload'];
|
|
71
75
|
}>) => Promise<StateResponse<TBot, TState>>;
|
|
72
76
|
export type PatchState<TBot extends common.BaseBot> = <TState extends keyof TBot['states']>(x: utils.Merge<Arg<client.Client['patchState']>, {
|
|
73
77
|
name: utils.Cast<TState, string>;
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
payload: TBot['states'][TState];
|
|
78
|
-
}>;
|
|
79
|
-
}>;
|
|
78
|
+
type: utils.Cast<TBot['states'][TState]['type'], string>;
|
|
79
|
+
payload: Partial<TBot['states'][TState]['payload']>;
|
|
80
|
+
}>) => Promise<StateResponse<TBot, TState>>;
|
|
80
81
|
export type CallAction<TBot extends common.BaseBot> = <ActionType extends keyof common.EnumerateActions<TBot>>(x: utils.Merge<Arg<client.Client['callAction']>, {
|
|
81
82
|
type: utils.Cast<ActionType, string>;
|
|
82
83
|
input: utils.Cast<common.EnumerateActions<TBot>[ActionType], common.IntegrationInstanceActionDefinition>['input'];
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { BaseIntegration, DefaultIntegration, InputBaseIntegration } from '../../integration/common/generic';
|
|
2
2
|
import * as utils from '../../utils/type-utils';
|
|
3
|
+
import * as def from '../definition';
|
|
3
4
|
export * from '../../integration/common/generic';
|
|
4
5
|
export type BaseAction = {
|
|
5
6
|
input: any;
|
|
@@ -15,10 +16,14 @@ export type BaseWorkflow = {
|
|
|
15
16
|
[k: string]: string;
|
|
16
17
|
};
|
|
17
18
|
};
|
|
19
|
+
export type BaseState = {
|
|
20
|
+
type: def.StateType;
|
|
21
|
+
payload: any;
|
|
22
|
+
};
|
|
18
23
|
export type BaseBot = {
|
|
19
24
|
integrations: Record<string, BaseIntegration>;
|
|
20
25
|
events: Record<string, any>;
|
|
21
|
-
states: Record<string,
|
|
26
|
+
states: Record<string, BaseState>;
|
|
22
27
|
actions: Record<string, BaseAction>;
|
|
23
28
|
tables: Record<string, BaseTable>;
|
|
24
29
|
workflows: Record<string, BaseWorkflow>;
|
|
@@ -30,7 +30,8 @@ type _IncomingMessages<TBot extends common.BaseBot> = {
|
|
|
30
30
|
type _IncomingStates<TBot extends common.BaseBot> = {
|
|
31
31
|
[K in utils.StringKeys<common.EnumerateStates<TBot>>]: utils.Merge<client.State, {
|
|
32
32
|
name: K;
|
|
33
|
-
|
|
33
|
+
type: common.EnumerateStates<TBot>[K]['type'];
|
|
34
|
+
payload: common.EnumerateStates<TBot>[K]['payload'];
|
|
34
35
|
}>;
|
|
35
36
|
};
|
|
36
37
|
type _OutgoingMessageRequests<TBot extends common.BaseBot> = {
|
package/dist/fixtures.d.ts
CHANGED