File tree 12 files changed +112
-70
lines changed
12 files changed +112
-70
lines changed Original file line number Diff line number Diff line change @@ -8,4 +8,5 @@ __snapshots__
8
8
.ignore.me. *
9
9
.env
10
10
.botpress
11
- .botpresshome
11
+ .botpresshome
12
+ .botpresshome. *
Original file line number Diff line number Diff line change 21
21
dist
22
22
.botpress
23
23
.botpresshome
24
+ .botpresshome. *
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " @botpress/cli" ,
3
- "version" : " 0.6.0 " ,
3
+ "version" : " 0.6.1 " ,
4
4
"description" : " Botpress CLI" ,
5
5
"scripts" : {
6
6
"build" : " pnpm run bundle && pnpm run template:gen" ,
20
20
},
21
21
"main" : " dist/index.js" ,
22
22
"dependencies" : {
23
- "@botpress/client" : " 0.11.4 " ,
23
+ "@botpress/client" : " 0.11.5 " ,
24
24
"@bpinternal/const" : " ^0.0.20" ,
25
25
"@bpinternal/tunnel" : " ^0.1.1" ,
26
26
"@bpinternal/yargs-extra" : " ^0.0.3" ,
49
49
"zod" : " ^3.20.6"
50
50
},
51
51
"devDependencies" : {
52
- "@botpress/sdk" : " 0.6.0 " ,
52
+ "@botpress/sdk" : " 0.6.1 " ,
53
53
"@bpinternal/log4bot" : " ^0.0.4" ,
54
54
"@types/bluebird" : " ^3.5.38" ,
55
55
"@types/json-schema" : " ^7.0.11" ,
Original file line number Diff line number Diff line change 8
8
"author" : " " ,
9
9
"license" : " MIT" ,
10
10
"dependencies" : {
11
- "@botpress/client" : " 0.11.4 " ,
12
- "@botpress/sdk" : " 0.6.0 " ,
11
+ "@botpress/client" : " 0.11.5 " ,
12
+ "@botpress/sdk" : " 0.6.1 " ,
13
13
"zod" : " ^3.20.6"
14
14
},
15
15
"devDependencies" : {
Original file line number Diff line number Diff line change 8
8
"author" : " " ,
9
9
"license" : " MIT" ,
10
10
"dependencies" : {
11
- "@botpress/client" : " 0.11.4 " ,
12
- "@botpress/sdk" : " 0.6.0 " ,
11
+ "@botpress/client" : " 0.11.5 " ,
12
+ "@botpress/sdk" : " 0.6.1 " ,
13
13
"zod" : " ^3.20.6"
14
14
},
15
15
"devDependencies" : {
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " @botpress/client" ,
3
- "version" : " 0.11.4 " ,
3
+ "version" : " 0.11.5 " ,
4
4
"description" : " Botpress Client" ,
5
5
"main" : " ./dist/index.cjs" ,
6
6
"module" : " ./dist/index.mjs" ,
21
21
"type-fest" : " ^3.4.0"
22
22
},
23
23
"devDependencies" : {
24
- "@botpress/api" : " 0.17 .0" ,
24
+ "@botpress/api" : " 0.18 .0" ,
25
25
"esbuild" : " ^0.16.12"
26
26
}
27
27
}
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " @botpress/sdk" ,
3
- "version" : " 0.6.0 " ,
3
+ "version" : " 0.6.1 " ,
4
4
"description" : " Botpress SDK" ,
5
5
"main" : " ./dist/index.js" ,
6
6
"types" : " ./dist/index.d.ts" ,
14
14
"author" : " " ,
15
15
"license" : " MIT" ,
16
16
"dependencies" : {
17
- "@botpress/client" : " 0.11.4 " ,
17
+ "@botpress/client" : " 0.11.5 " ,
18
18
"zod" : " ^3.20.6"
19
19
},
20
20
"devDependencies" : {
Original file line number Diff line number Diff line change @@ -34,12 +34,18 @@ export class BotSpecificClient<TBot extends BaseBot> {
34
34
public updateUser : routes . UpdateUser < TBot > = ( x ) => this . client . updateUser ( x )
35
35
public deleteUser : routes . DeleteUser < TBot > = ( x ) => this . client . deleteUser ( x )
36
36
37
- public getState : routes . GetState < TBot > = ( x ) =>
38
- this . client . getState ( x ) . then ( ( y ) => ( { state : { ...y . state , payload : y . state . payload as any } } ) )
39
- public setState : routes . SetState < TBot > = ( x ) =>
40
- this . client . setState ( x ) . then ( ( y ) => ( { state : { ...y . state , payload : y . state . payload as any } } ) )
41
- public patchState : routes . PatchState < TBot > = ( x ) =>
42
- this . client . patchState ( x ) . then ( ( y ) => ( { state : { ...y . state , payload : y . state . payload as any } } ) )
37
+ public getState : routes . GetState < TBot > = ( ( x ) =>
38
+ this . client . getState ( x ) . then ( ( y ) => ( { state : { ...y . state , payload : y . state . payload } } ) ) ) as routes . GetState < TBot >
39
+ public setState : routes . SetState < TBot > = ( ( x ) =>
40
+ this . client . setState ( x ) . then ( ( y ) => ( { state : { ...y . state , payload : y . state . payload } } ) ) ) as routes . SetState < TBot >
41
+ public getOrSetState : routes . GetOrSetState < TBot > = ( ( x ) =>
42
+ this . client
43
+ . getOrSetState ( x )
44
+ . then ( ( y ) => ( { state : { ...y . state , payload : y . state . payload } } ) ) ) as routes . GetOrSetState < TBot >
45
+ public patchState : routes . PatchState < TBot > = ( ( x ) =>
46
+ this . client
47
+ . patchState ( x )
48
+ . then ( ( y ) => ( { state : { ...y . state , payload : y . state . payload } } ) ) ) as routes . PatchState < TBot >
43
49
44
50
public callAction : routes . CallAction < TBot > = ( x ) => this . client . callAction ( x )
45
51
Original file line number Diff line number Diff line change @@ -90,6 +90,23 @@ export type SetState<TBot extends BaseBot> = <TState extends keyof TBot['states'
90
90
>
91
91
} >
92
92
93
+ export type GetOrSetState < TBot extends BaseBot > = < TState extends keyof TBot [ 'states' ] > (
94
+ x : Merge <
95
+ Arg < Client [ 'getOrSetState' ] > ,
96
+ {
97
+ name : Cast < TState , string > // TODO: use state name to infer state type (cannot be done until there is a bot.definition.ts file)
98
+ payload : TBot [ 'states' ] [ TState ]
99
+ }
100
+ >
101
+ ) => Promise < {
102
+ state : Merge <
103
+ Awaited < Res < Client [ 'getOrSetState' ] > > [ 'state' ] ,
104
+ {
105
+ payload : TBot [ 'states' ] [ TState ]
106
+ }
107
+ >
108
+ } >
109
+
93
110
export type PatchState < TBot extends BaseBot > = < TState extends keyof TBot [ 'states' ] > (
94
111
x : Merge <
95
112
Arg < Client [ 'patchState' ] > ,
Original file line number Diff line number Diff line change @@ -55,6 +55,8 @@ export class IntegrationSpecificClient<TIntegration extends BaseIntegration> {
55
55
56
56
public getState : routes . GetState < TIntegration > = ( ( x ) => this . client . getState ( x ) ) as routes . GetState < TIntegration >
57
57
public setState : routes . SetState < TIntegration > = ( ( x ) => this . client . setState ( x ) ) as routes . SetState < TIntegration >
58
+ public getOrSetState : routes . GetOrSetState < TIntegration > = ( ( x ) =>
59
+ this . client . getOrSetState ( x ) ) as routes . GetOrSetState < TIntegration >
58
60
public patchState : routes . PatchState < TIntegration > = ( ( x ) =>
59
61
this . client . patchState ( x ) ) as routes . PatchState < TIntegration >
60
62
Original file line number Diff line number Diff line change @@ -235,6 +235,16 @@ export type SetState<TIntegration extends BaseIntegration> = <TState extends key
235
235
>
236
236
) => Promise < StateResponse < TIntegration , TState > >
237
237
238
+ export type GetOrSetState < TIntegration extends BaseIntegration > = < TState extends keyof TIntegration [ 'states' ] > (
239
+ x : Merge <
240
+ Arg < Client [ 'getOrSetState' ] > ,
241
+ {
242
+ name : Cast < TState , string > // TODO: use state name to infer state type
243
+ payload : TIntegration [ 'states' ] [ TState ]
244
+ }
245
+ >
246
+ ) => Promise < StateResponse < TIntegration , TState > >
247
+
238
248
export type PatchState < TIntegration extends BaseIntegration > = < TState extends keyof TIntegration [ 'states' ] > (
239
249
x : Merge <
240
250
Arg < Client [ 'patchState' ] > ,
You can’t perform that action at this time.
0 commit comments