@botpress/sdk 5.1.1 → 5.2.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 +5 -5
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +2 -2
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +2 -2
- package/dist/integration/client/index.d.ts +1 -0
- package/dist/integration/client/sub-types.d.ts +2 -0
- package/dist/integration/client/types.d.ts +20 -5
- package/package.json +2 -2
|
@@ -33,6 +33,7 @@ export declare class IntegrationSpecificClient<TIntegration extends common.BaseI
|
|
|
33
33
|
updateMessage: types.UpdateMessage<TIntegration>;
|
|
34
34
|
listMessages: types.ListMessages<TIntegration>;
|
|
35
35
|
deleteMessage: types.DeleteMessage<TIntegration>;
|
|
36
|
+
initializeIncomingMessage: types.InitializeIncomingMessage<TIntegration>;
|
|
36
37
|
createUser: types.CreateUser<TIntegration>;
|
|
37
38
|
getUser: types.GetUser<TIntegration>;
|
|
38
39
|
listUsers: types.ListUsers<TIntegration>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { commonTypes } from 'src/common';
|
|
1
2
|
import * as utils from '../../utils/type-utils';
|
|
2
3
|
import * as common from '../common';
|
|
3
4
|
export type EnumerateMessages<TIntegration extends common.BaseIntegration> = utils.UnionToIntersection<utils.ValueOf<{
|
|
@@ -23,4 +24,5 @@ export type ConversationTags<TIntegration extends common.BaseIntegration> = keyo
|
|
|
23
24
|
export type MessageTags<TIntegration extends common.BaseIntegration> = keyof utils.UnionToIntersection<utils.ValueOf<{
|
|
24
25
|
[TChannelName in keyof TIntegration['channels']]: TIntegration['channels'][TChannelName]['message']['tags'];
|
|
25
26
|
}>>;
|
|
27
|
+
export type UserTags<TIntegration extends common.BaseIntegration> = commonTypes.ToTags<keyof TIntegration['user']['tags']>;
|
|
26
28
|
export type TagsOfMessage<TIntegration extends common.BaseIntegration, TMessageName extends keyof EnumerateMessages<TIntegration>> = keyof utils.UnionToIntersection<GetMessageByName<TIntegration, TMessageName>['tags']>;
|
|
@@ -2,7 +2,7 @@ import * as client from '@botpress/client';
|
|
|
2
2
|
import type { commonTypes } from '../../common';
|
|
3
3
|
import * as utils from '../../utils/type-utils';
|
|
4
4
|
import * as common from '../common';
|
|
5
|
-
import { EnumerateMessages, ConversationTags, GetChannelByName, GetMessageByName, MessageTags } from './sub-types';
|
|
5
|
+
import { EnumerateMessages, ConversationTags, GetChannelByName, GetMessageByName, MessageTags, UserTags } from './sub-types';
|
|
6
6
|
type Arg<F extends (...args: any[]) => any> = Parameters<F>[number];
|
|
7
7
|
type Res<F extends (...args: any[]) => any> = ReturnType<F>;
|
|
8
8
|
type ConversationResponse<TIntegration extends common.BaseIntegration, ChannelName extends keyof TIntegration['channels'] = keyof TIntegration['channels']> = utils.ValueOf<{
|
|
@@ -75,24 +75,39 @@ export type ListMessages<TIntegration extends common.BaseIntegration> = (x: util
|
|
|
75
75
|
export type DeleteMessage<_TIntegration extends common.BaseIntegration> = client.Client['deleteMessage'];
|
|
76
76
|
type UserResponse<TIntegration extends common.BaseIntegration> = {
|
|
77
77
|
user: utils.Merge<Awaited<Res<client.Client['getUser']>>['user'], {
|
|
78
|
-
tags:
|
|
78
|
+
tags: UserTags<TIntegration>;
|
|
79
79
|
}>;
|
|
80
80
|
};
|
|
81
81
|
export type CreateUser<TIntegration extends common.BaseIntegration> = (x: utils.Merge<Arg<client.Client['createUser']>, {
|
|
82
|
-
tags:
|
|
82
|
+
tags: UserTags<TIntegration>;
|
|
83
83
|
}>) => Promise<UserResponse<TIntegration>>;
|
|
84
84
|
export type GetUser<TIntegration extends common.BaseIntegration> = (x: Arg<client.Client['getUser']>) => Promise<UserResponse<TIntegration>>;
|
|
85
85
|
export type ListUsers<TIntegration extends common.BaseIntegration> = (x: utils.Merge<Arg<client.Client['listUsers']>, {
|
|
86
|
-
tags?:
|
|
86
|
+
tags?: UserTags<TIntegration>;
|
|
87
87
|
}>) => Res<client.Client['listUsers']>;
|
|
88
88
|
export type GetOrCreateUser<TIntegration extends common.BaseIntegration> = <TTags extends keyof TIntegration['user']['tags']>(x: utils.Merge<Arg<client.Client['getOrCreateUser']>, {
|
|
89
89
|
tags: commonTypes.ToTags<TTags>;
|
|
90
90
|
discriminateByTags?: NoInfer<utils.Cast<TTags[], string[]>>;
|
|
91
91
|
}>) => Promise<UserResponse<TIntegration>>;
|
|
92
92
|
export type UpdateUser<TIntegration extends common.BaseIntegration> = (x: utils.Merge<Arg<client.Client['updateUser']>, {
|
|
93
|
-
tags?:
|
|
93
|
+
tags?: UserTags<TIntegration>;
|
|
94
94
|
}>) => Promise<UserResponse<TIntegration>>;
|
|
95
95
|
export type DeleteUser<_TIntegration extends common.BaseIntegration> = client.Client['deleteUser'];
|
|
96
|
+
export type InitializeIncomingMessage<TIntegration extends common.BaseIntegration> = (x: utils.Merge<Arg<client.Client['initializeIncomingMessage']>, {
|
|
97
|
+
user?: utils.Merge<NonNullable<Arg<client.Client['initializeIncomingMessage']>['user']>, {
|
|
98
|
+
tags: UserTags<TIntegration>;
|
|
99
|
+
}>;
|
|
100
|
+
conversation?: utils.Merge<NonNullable<Arg<client.Client['initializeIncomingMessage']>['conversation']>, {
|
|
101
|
+
tags: commonTypes.ToTags<ConversationTags<TIntegration>>;
|
|
102
|
+
}>;
|
|
103
|
+
message?: utils.Merge<NonNullable<Arg<client.Client['initializeIncomingMessage']>['message']>, {
|
|
104
|
+
tags: commonTypes.ToTags<MessageTags<TIntegration>>;
|
|
105
|
+
}>;
|
|
106
|
+
}>) => Promise<{
|
|
107
|
+
user: Awaited<Res<client.Client['getUser']>>['user'];
|
|
108
|
+
conversation: Awaited<Res<client.Client['getConversation']>>['conversation'];
|
|
109
|
+
message?: MessageResponse<TIntegration>;
|
|
110
|
+
}>;
|
|
96
111
|
type StateResponse<TIntegration extends common.BaseIntegration, TState extends keyof TIntegration['states']> = {
|
|
97
112
|
state: utils.Merge<Awaited<Res<client.Client['getState']>>['state'], {
|
|
98
113
|
name: utils.Cast<TState, string>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@botpress/sdk",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.2.0",
|
|
4
4
|
"description": "Botpress SDK",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"author": "",
|
|
20
20
|
"license": "MIT",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@botpress/client": "1.
|
|
22
|
+
"@botpress/client": "1.29.0",
|
|
23
23
|
"browser-or-node": "^2.1.1",
|
|
24
24
|
"semver": "^7.3.8"
|
|
25
25
|
},
|