@botpress/sdk 0.6.15 → 0.8.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/dist/bot/context.d.ts +2 -2
- package/dist/bot/implementation.d.ts +1 -1
- package/dist/index.d.ts +1 -6
- package/dist/index.js +1 -1
- package/dist/index.js.map +4 -4
- package/dist/integration/client/routes.d.ts +15 -18
- package/dist/integration/client/types.d.ts +1 -1
- package/dist/integration/context.d.ts +2 -2
- package/dist/integration/server.d.ts +6 -9
- package/dist/message.d.ts +80 -81
- package/dist/schema.d.ts +5 -1
- package/dist/type-utils.d.ts +1 -1
- package/dist/zui.d.ts +290 -0
- package/package.json +8 -7
|
@@ -6,9 +6,6 @@ import { ToTags } from './client/types';
|
|
|
6
6
|
import { type IntegrationContext } from './context';
|
|
7
7
|
import { BaseIntegration } from './generic';
|
|
8
8
|
import { IntegrationLogger } from './logger';
|
|
9
|
-
type PrefixConfig<TIntegration extends BaseIntegration> = {
|
|
10
|
-
enforcePrefix: TIntegration['name'];
|
|
11
|
-
};
|
|
12
9
|
type CommonArgs<TIntegration extends BaseIntegration> = {
|
|
13
10
|
ctx: IntegrationContext<TIntegration['configuration']>;
|
|
14
11
|
client: IntegrationSpecificClient<TIntegration>;
|
|
@@ -32,30 +29,30 @@ type ActionPayload<T extends string, I> = {
|
|
|
32
29
|
};
|
|
33
30
|
type ActionArgs<TIntegration extends BaseIntegration, T extends string, I> = CommonArgs<TIntegration> & ActionPayload<T, I>;
|
|
34
31
|
type CreateUserPayload<TIntegration extends BaseIntegration> = {
|
|
35
|
-
tags: ToTags<keyof TIntegration['user']['tags']
|
|
32
|
+
tags: ToTags<keyof TIntegration['user']['tags']>;
|
|
36
33
|
};
|
|
37
34
|
type CreateUserArgs<TIntegration extends BaseIntegration> = CommonArgs<TIntegration> & CreateUserPayload<TIntegration>;
|
|
38
35
|
type CreateConversationPayload<TIntegration extends BaseIntegration, TChannel extends keyof TIntegration['channels'] = keyof TIntegration['channels']> = {
|
|
39
36
|
channel: TChannel;
|
|
40
|
-
tags: ToTags<keyof TIntegration['channels'][TChannel]['conversation']['tags']
|
|
37
|
+
tags: ToTags<keyof TIntegration['channels'][TChannel]['conversation']['tags']>;
|
|
41
38
|
};
|
|
42
39
|
type CreateConversationArgs<TIntegration extends BaseIntegration> = CommonArgs<TIntegration> & CreateConversationPayload<TIntegration>;
|
|
43
40
|
type MessagePayload<TIntegration extends BaseIntegration, TChannel extends keyof TIntegration['channels'], TMessage extends keyof TIntegration['channels'][TChannel]['messages']> = {
|
|
44
41
|
type: TMessage;
|
|
45
42
|
payload: TIntegration['channels'][TChannel]['messages'][TMessage];
|
|
46
43
|
conversation: Merge<Conversation, {
|
|
47
|
-
tags: ToTags<keyof TIntegration['channels'][TChannel]['conversation']['tags']
|
|
44
|
+
tags: ToTags<keyof TIntegration['channels'][TChannel]['conversation']['tags']>;
|
|
48
45
|
}>;
|
|
49
46
|
message: Merge<Message, {
|
|
50
|
-
tags: ToTags<keyof TIntegration['channels'][TChannel]['message']['tags']
|
|
47
|
+
tags: ToTags<keyof TIntegration['channels'][TChannel]['message']['tags']>;
|
|
51
48
|
}>;
|
|
52
49
|
user: Merge<User, {
|
|
53
|
-
tags: ToTags<keyof TIntegration['user']['tags']
|
|
50
|
+
tags: ToTags<keyof TIntegration['user']['tags']>;
|
|
54
51
|
}>;
|
|
55
52
|
};
|
|
56
53
|
type MessageArgs<TIntegration extends BaseIntegration, TChannel extends keyof TIntegration['channels'], TMessage extends keyof TIntegration['channels'][TChannel]['messages']> = CommonArgs<TIntegration> & MessagePayload<TIntegration, TChannel, TMessage> & {
|
|
57
54
|
ack: (props: {
|
|
58
|
-
tags: ToTags<keyof TIntegration['channels'][TChannel]['message']['tags']
|
|
55
|
+
tags: ToTags<keyof TIntegration['channels'][TChannel]['message']['tags']>;
|
|
59
56
|
}) => Promise<void>;
|
|
60
57
|
};
|
|
61
58
|
export type RegisterFunction<TIntegration extends BaseIntegration> = (props: RegisterArgs<TIntegration>) => Promise<void>;
|
package/dist/message.d.ts
CHANGED
|
@@ -1,91 +1,90 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
1
|
export declare const defaults: {
|
|
3
2
|
readonly text: {
|
|
4
|
-
readonly schema:
|
|
5
|
-
text:
|
|
6
|
-
}, "strip",
|
|
3
|
+
readonly schema: import("@bpinternal/zui").ZodObject<{
|
|
4
|
+
text: import("@bpinternal/zui").ZodString;
|
|
5
|
+
}, "strip", import("@bpinternal/zui").ZodTypeAny, {
|
|
7
6
|
text: string;
|
|
8
7
|
}, {
|
|
9
8
|
text: string;
|
|
10
9
|
}>;
|
|
11
10
|
};
|
|
12
11
|
readonly markdown: {
|
|
13
|
-
readonly schema:
|
|
14
|
-
markdown:
|
|
15
|
-
}, "strip",
|
|
12
|
+
readonly schema: import("@bpinternal/zui").ZodObject<{
|
|
13
|
+
markdown: import("@bpinternal/zui").ZodString;
|
|
14
|
+
}, "strip", import("@bpinternal/zui").ZodTypeAny, {
|
|
16
15
|
markdown: string;
|
|
17
16
|
}, {
|
|
18
17
|
markdown: string;
|
|
19
18
|
}>;
|
|
20
19
|
};
|
|
21
20
|
readonly image: {
|
|
22
|
-
readonly schema:
|
|
23
|
-
imageUrl:
|
|
24
|
-
}, "strip",
|
|
21
|
+
readonly schema: import("@bpinternal/zui").ZodObject<{
|
|
22
|
+
imageUrl: import("@bpinternal/zui").ZodString;
|
|
23
|
+
}, "strip", import("@bpinternal/zui").ZodTypeAny, {
|
|
25
24
|
imageUrl: string;
|
|
26
25
|
}, {
|
|
27
26
|
imageUrl: string;
|
|
28
27
|
}>;
|
|
29
28
|
};
|
|
30
29
|
readonly audio: {
|
|
31
|
-
readonly schema:
|
|
32
|
-
audioUrl:
|
|
33
|
-
}, "strip",
|
|
30
|
+
readonly schema: import("@bpinternal/zui").ZodObject<{
|
|
31
|
+
audioUrl: import("@bpinternal/zui").ZodString;
|
|
32
|
+
}, "strip", import("@bpinternal/zui").ZodTypeAny, {
|
|
34
33
|
audioUrl: string;
|
|
35
34
|
}, {
|
|
36
35
|
audioUrl: string;
|
|
37
36
|
}>;
|
|
38
37
|
};
|
|
39
38
|
readonly video: {
|
|
40
|
-
readonly schema:
|
|
41
|
-
videoUrl:
|
|
42
|
-
}, "strip",
|
|
39
|
+
readonly schema: import("@bpinternal/zui").ZodObject<{
|
|
40
|
+
videoUrl: import("@bpinternal/zui").ZodString;
|
|
41
|
+
}, "strip", import("@bpinternal/zui").ZodTypeAny, {
|
|
43
42
|
videoUrl: string;
|
|
44
43
|
}, {
|
|
45
44
|
videoUrl: string;
|
|
46
45
|
}>;
|
|
47
46
|
};
|
|
48
47
|
readonly file: {
|
|
49
|
-
readonly schema:
|
|
50
|
-
fileUrl:
|
|
51
|
-
title:
|
|
52
|
-
}, "strip",
|
|
53
|
-
title?: string | undefined;
|
|
48
|
+
readonly schema: import("@bpinternal/zui").ZodObject<{
|
|
49
|
+
fileUrl: import("@bpinternal/zui").ZodString;
|
|
50
|
+
title: import("@bpinternal/zui").ZodOptional<import("@bpinternal/zui").ZodString>;
|
|
51
|
+
}, "strip", import("@bpinternal/zui").ZodTypeAny, {
|
|
54
52
|
fileUrl: string;
|
|
55
|
-
}, {
|
|
56
53
|
title?: string | undefined;
|
|
54
|
+
}, {
|
|
57
55
|
fileUrl: string;
|
|
56
|
+
title?: string | undefined;
|
|
58
57
|
}>;
|
|
59
58
|
};
|
|
60
59
|
readonly location: {
|
|
61
|
-
readonly schema:
|
|
62
|
-
latitude:
|
|
63
|
-
longitude:
|
|
64
|
-
address:
|
|
65
|
-
title:
|
|
66
|
-
}, "strip",
|
|
67
|
-
title?: string | undefined;
|
|
68
|
-
address?: string | undefined;
|
|
60
|
+
readonly schema: import("@bpinternal/zui").ZodObject<{
|
|
61
|
+
latitude: import("@bpinternal/zui").ZodNumber;
|
|
62
|
+
longitude: import("@bpinternal/zui").ZodNumber;
|
|
63
|
+
address: import("@bpinternal/zui").ZodOptional<import("@bpinternal/zui").ZodString>;
|
|
64
|
+
title: import("@bpinternal/zui").ZodOptional<import("@bpinternal/zui").ZodString>;
|
|
65
|
+
}, "strip", import("@bpinternal/zui").ZodTypeAny, {
|
|
69
66
|
latitude: number;
|
|
70
67
|
longitude: number;
|
|
71
|
-
}, {
|
|
72
68
|
title?: string | undefined;
|
|
73
69
|
address?: string | undefined;
|
|
70
|
+
}, {
|
|
74
71
|
latitude: number;
|
|
75
72
|
longitude: number;
|
|
73
|
+
title?: string | undefined;
|
|
74
|
+
address?: string | undefined;
|
|
76
75
|
}>;
|
|
77
76
|
};
|
|
78
77
|
readonly carousel: {
|
|
79
|
-
readonly schema:
|
|
80
|
-
items:
|
|
81
|
-
title:
|
|
82
|
-
subtitle:
|
|
83
|
-
imageUrl:
|
|
84
|
-
actions:
|
|
85
|
-
action:
|
|
86
|
-
label:
|
|
87
|
-
value:
|
|
88
|
-
}, "strip",
|
|
78
|
+
readonly schema: import("@bpinternal/zui").ZodObject<{
|
|
79
|
+
items: import("@bpinternal/zui").ZodArray<import("@bpinternal/zui").ZodObject<{
|
|
80
|
+
title: import("@bpinternal/zui").ZodString;
|
|
81
|
+
subtitle: import("@bpinternal/zui").ZodOptional<import("@bpinternal/zui").ZodString>;
|
|
82
|
+
imageUrl: import("@bpinternal/zui").ZodOptional<import("@bpinternal/zui").ZodString>;
|
|
83
|
+
actions: import("@bpinternal/zui").ZodArray<import("@bpinternal/zui").ZodObject<{
|
|
84
|
+
action: import("@bpinternal/zui").ZodEnum<["postback", "url", "say"]>;
|
|
85
|
+
label: import("@bpinternal/zui").ZodString;
|
|
86
|
+
value: import("@bpinternal/zui").ZodString;
|
|
87
|
+
}, "strip", import("@bpinternal/zui").ZodTypeAny, {
|
|
89
88
|
value: string;
|
|
90
89
|
action: "postback" | "url" | "say";
|
|
91
90
|
label: string;
|
|
@@ -94,59 +93,59 @@ export declare const defaults: {
|
|
|
94
93
|
action: "postback" | "url" | "say";
|
|
95
94
|
label: string;
|
|
96
95
|
}>, "many">;
|
|
97
|
-
}, "strip",
|
|
98
|
-
imageUrl?: string | undefined;
|
|
99
|
-
subtitle?: string | undefined;
|
|
96
|
+
}, "strip", import("@bpinternal/zui").ZodTypeAny, {
|
|
100
97
|
title: string;
|
|
101
98
|
actions: {
|
|
102
99
|
value: string;
|
|
103
100
|
action: "postback" | "url" | "say";
|
|
104
101
|
label: string;
|
|
105
102
|
}[];
|
|
106
|
-
}, {
|
|
107
103
|
imageUrl?: string | undefined;
|
|
108
104
|
subtitle?: string | undefined;
|
|
105
|
+
}, {
|
|
109
106
|
title: string;
|
|
110
107
|
actions: {
|
|
111
108
|
value: string;
|
|
112
109
|
action: "postback" | "url" | "say";
|
|
113
110
|
label: string;
|
|
114
111
|
}[];
|
|
115
|
-
}>, "many">;
|
|
116
|
-
}, "strip", z.ZodTypeAny, {
|
|
117
|
-
items: {
|
|
118
112
|
imageUrl?: string | undefined;
|
|
119
113
|
subtitle?: string | undefined;
|
|
114
|
+
}>, "many">;
|
|
115
|
+
}, "strip", import("@bpinternal/zui").ZodTypeAny, {
|
|
116
|
+
items: {
|
|
120
117
|
title: string;
|
|
121
118
|
actions: {
|
|
122
119
|
value: string;
|
|
123
120
|
action: "postback" | "url" | "say";
|
|
124
121
|
label: string;
|
|
125
122
|
}[];
|
|
123
|
+
imageUrl?: string | undefined;
|
|
124
|
+
subtitle?: string | undefined;
|
|
126
125
|
}[];
|
|
127
126
|
}, {
|
|
128
127
|
items: {
|
|
129
|
-
imageUrl?: string | undefined;
|
|
130
|
-
subtitle?: string | undefined;
|
|
131
128
|
title: string;
|
|
132
129
|
actions: {
|
|
133
130
|
value: string;
|
|
134
131
|
action: "postback" | "url" | "say";
|
|
135
132
|
label: string;
|
|
136
133
|
}[];
|
|
134
|
+
imageUrl?: string | undefined;
|
|
135
|
+
subtitle?: string | undefined;
|
|
137
136
|
}[];
|
|
138
137
|
}>;
|
|
139
138
|
};
|
|
140
139
|
readonly card: {
|
|
141
|
-
readonly schema:
|
|
142
|
-
title:
|
|
143
|
-
subtitle:
|
|
144
|
-
imageUrl:
|
|
145
|
-
actions:
|
|
146
|
-
action:
|
|
147
|
-
label:
|
|
148
|
-
value:
|
|
149
|
-
}, "strip",
|
|
140
|
+
readonly schema: import("@bpinternal/zui").ZodObject<{
|
|
141
|
+
title: import("@bpinternal/zui").ZodString;
|
|
142
|
+
subtitle: import("@bpinternal/zui").ZodOptional<import("@bpinternal/zui").ZodString>;
|
|
143
|
+
imageUrl: import("@bpinternal/zui").ZodOptional<import("@bpinternal/zui").ZodString>;
|
|
144
|
+
actions: import("@bpinternal/zui").ZodArray<import("@bpinternal/zui").ZodObject<{
|
|
145
|
+
action: import("@bpinternal/zui").ZodEnum<["postback", "url", "say"]>;
|
|
146
|
+
label: import("@bpinternal/zui").ZodString;
|
|
147
|
+
value: import("@bpinternal/zui").ZodString;
|
|
148
|
+
}, "strip", import("@bpinternal/zui").ZodTypeAny, {
|
|
150
149
|
value: string;
|
|
151
150
|
action: "postback" | "url" | "say";
|
|
152
151
|
label: string;
|
|
@@ -155,78 +154,78 @@ export declare const defaults: {
|
|
|
155
154
|
action: "postback" | "url" | "say";
|
|
156
155
|
label: string;
|
|
157
156
|
}>, "many">;
|
|
158
|
-
}, "strip",
|
|
159
|
-
imageUrl?: string | undefined;
|
|
160
|
-
subtitle?: string | undefined;
|
|
157
|
+
}, "strip", import("@bpinternal/zui").ZodTypeAny, {
|
|
161
158
|
title: string;
|
|
162
159
|
actions: {
|
|
163
160
|
value: string;
|
|
164
161
|
action: "postback" | "url" | "say";
|
|
165
162
|
label: string;
|
|
166
163
|
}[];
|
|
167
|
-
}, {
|
|
168
164
|
imageUrl?: string | undefined;
|
|
169
165
|
subtitle?: string | undefined;
|
|
166
|
+
}, {
|
|
170
167
|
title: string;
|
|
171
168
|
actions: {
|
|
172
169
|
value: string;
|
|
173
170
|
action: "postback" | "url" | "say";
|
|
174
171
|
label: string;
|
|
175
172
|
}[];
|
|
173
|
+
imageUrl?: string | undefined;
|
|
174
|
+
subtitle?: string | undefined;
|
|
176
175
|
}>;
|
|
177
176
|
};
|
|
178
177
|
readonly dropdown: {
|
|
179
|
-
readonly schema:
|
|
180
|
-
text:
|
|
181
|
-
options:
|
|
182
|
-
label:
|
|
183
|
-
value:
|
|
184
|
-
}, "strip",
|
|
178
|
+
readonly schema: import("@bpinternal/zui").ZodObject<{
|
|
179
|
+
text: import("@bpinternal/zui").ZodString;
|
|
180
|
+
options: import("@bpinternal/zui").ZodArray<import("@bpinternal/zui").ZodObject<{
|
|
181
|
+
label: import("@bpinternal/zui").ZodString;
|
|
182
|
+
value: import("@bpinternal/zui").ZodString;
|
|
183
|
+
}, "strip", import("@bpinternal/zui").ZodTypeAny, {
|
|
185
184
|
value: string;
|
|
186
185
|
label: string;
|
|
187
186
|
}, {
|
|
188
187
|
value: string;
|
|
189
188
|
label: string;
|
|
190
189
|
}>, "many">;
|
|
191
|
-
}, "strip",
|
|
192
|
-
text: string;
|
|
190
|
+
}, "strip", import("@bpinternal/zui").ZodTypeAny, {
|
|
193
191
|
options: {
|
|
194
192
|
value: string;
|
|
195
193
|
label: string;
|
|
196
194
|
}[];
|
|
197
|
-
}, {
|
|
198
195
|
text: string;
|
|
196
|
+
}, {
|
|
199
197
|
options: {
|
|
200
198
|
value: string;
|
|
201
199
|
label: string;
|
|
202
200
|
}[];
|
|
201
|
+
text: string;
|
|
203
202
|
}>;
|
|
204
203
|
};
|
|
205
204
|
readonly choice: {
|
|
206
|
-
readonly schema:
|
|
207
|
-
text:
|
|
208
|
-
options:
|
|
209
|
-
label:
|
|
210
|
-
value:
|
|
211
|
-
}, "strip",
|
|
205
|
+
readonly schema: import("@bpinternal/zui").ZodObject<{
|
|
206
|
+
text: import("@bpinternal/zui").ZodString;
|
|
207
|
+
options: import("@bpinternal/zui").ZodArray<import("@bpinternal/zui").ZodObject<{
|
|
208
|
+
label: import("@bpinternal/zui").ZodString;
|
|
209
|
+
value: import("@bpinternal/zui").ZodString;
|
|
210
|
+
}, "strip", import("@bpinternal/zui").ZodTypeAny, {
|
|
212
211
|
value: string;
|
|
213
212
|
label: string;
|
|
214
213
|
}, {
|
|
215
214
|
value: string;
|
|
216
215
|
label: string;
|
|
217
216
|
}>, "many">;
|
|
218
|
-
}, "strip",
|
|
219
|
-
text: string;
|
|
217
|
+
}, "strip", import("@bpinternal/zui").ZodTypeAny, {
|
|
220
218
|
options: {
|
|
221
219
|
value: string;
|
|
222
220
|
label: string;
|
|
223
221
|
}[];
|
|
224
|
-
}, {
|
|
225
222
|
text: string;
|
|
223
|
+
}, {
|
|
226
224
|
options: {
|
|
227
225
|
value: string;
|
|
228
226
|
label: string;
|
|
229
227
|
}[];
|
|
228
|
+
text: string;
|
|
230
229
|
}>;
|
|
231
230
|
};
|
|
232
231
|
};
|
package/dist/schema.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { z } from 'zod';
|
|
2
1
|
import { AnyZodObject } from './type-utils';
|
|
2
|
+
import type z from './zui';
|
|
3
3
|
type SchemaOptions<T> = {
|
|
4
4
|
title: string;
|
|
5
5
|
examples: T[];
|
|
@@ -10,6 +10,10 @@ type UiDefinition<TSchema extends AnyZodObject = AnyZodObject> = IsEmptyObject<z
|
|
|
10
10
|
};
|
|
11
11
|
export type SchemaDefinition<TSchema extends AnyZodObject = AnyZodObject> = {
|
|
12
12
|
schema: TSchema;
|
|
13
|
+
/**
|
|
14
|
+
* @deprecated
|
|
15
|
+
* Use zod.Schema.displayAs() instead
|
|
16
|
+
**/
|
|
13
17
|
ui?: Partial<UiDefinition<TSchema>>;
|
|
14
18
|
};
|
|
15
19
|
export {};
|
package/dist/type-utils.d.ts
CHANGED