@botpress/sdk 2.0.4 → 2.1.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.
Files changed (66) hide show
  1. package/.turbo/turbo-build.log +12 -0
  2. package/dist/base-logger.d.ts +13 -0
  3. package/dist/bot/bot-logger.d.ts +14 -0
  4. package/dist/bot/client/index.d.ts +62 -0
  5. package/dist/bot/client/types.d.ts +141 -0
  6. package/dist/bot/client/types.test.d.ts +1 -0
  7. package/dist/bot/definition.d.ts +111 -0
  8. package/dist/bot/implementation.d.ts +39 -0
  9. package/dist/bot/index.d.ts +6 -0
  10. package/dist/bot/merge-bots.d.ts +2 -0
  11. package/dist/bot/server/context.d.ts +2 -0
  12. package/dist/bot/server/index.d.ts +5 -0
  13. package/dist/bot/server/types.d.ts +254 -0
  14. package/dist/bot/server/types.test.d.ts +1 -0
  15. package/dist/bot/types/common.d.ts +50 -0
  16. package/dist/bot/types/common.test.d.ts +1 -0
  17. package/dist/bot/types/generic.d.ts +31 -0
  18. package/dist/bot/types/generic.test.d.ts +1 -0
  19. package/dist/bot/types/index.d.ts +2 -0
  20. package/dist/const.d.ts +8 -0
  21. package/dist/fixtures.d.ts +108 -0
  22. package/dist/index.d.ts +15 -0
  23. package/dist/index.js +2 -0
  24. package/dist/index.js.map +7 -0
  25. package/dist/integration/client/index.d.ts +47 -0
  26. package/dist/integration/client/types.d.ts +177 -0
  27. package/dist/integration/client/types.test.d.ts +1 -0
  28. package/dist/integration/definition/branded-schema.d.ts +21 -0
  29. package/dist/integration/definition/generic.d.ts +9 -0
  30. package/dist/integration/definition/index.d.ts +76 -0
  31. package/dist/integration/definition/types.d.ts +106 -0
  32. package/dist/integration/implementation.d.ts +31 -0
  33. package/dist/integration/index.d.ts +5 -0
  34. package/dist/integration/server/action-metadata.d.ts +9 -0
  35. package/dist/integration/server/context.d.ts +3 -0
  36. package/dist/integration/server/index.d.ts +6 -0
  37. package/dist/integration/server/integration-logger.d.ts +16 -0
  38. package/dist/integration/server/types.d.ts +102 -0
  39. package/dist/integration/types/common.d.ts +11 -0
  40. package/dist/integration/types/generic.d.ts +52 -0
  41. package/dist/integration/types/generic.test.d.ts +1 -0
  42. package/dist/integration/types/index.d.ts +2 -0
  43. package/dist/interface/definition.d.ts +70 -0
  44. package/dist/interface/index.d.ts +1 -0
  45. package/dist/interface/types/generic.d.ts +34 -0
  46. package/dist/interface/types/generic.test.d.ts +1 -0
  47. package/dist/log.d.ts +7 -0
  48. package/dist/message.d.ts +474 -0
  49. package/dist/package.d.ts +58 -0
  50. package/dist/plugin/definition.d.ts +50 -0
  51. package/dist/plugin/implementation.d.ts +39 -0
  52. package/dist/plugin/index.d.ts +3 -0
  53. package/dist/plugin/server/types.d.ts +1 -0
  54. package/dist/plugin/server/types.test.d.ts +1 -0
  55. package/dist/plugin/types/generic.d.ts +30 -0
  56. package/dist/plugin/types/generic.test.d.ts +1 -0
  57. package/dist/retry.d.ts +2 -0
  58. package/dist/schema.d.ts +18 -0
  59. package/dist/serve.d.ts +20 -0
  60. package/dist/utils/array-utils.d.ts +1 -0
  61. package/dist/utils/index.d.ts +3 -0
  62. package/dist/utils/record-utils.d.ts +3 -0
  63. package/dist/utils/type-utils.d.ts +33 -0
  64. package/dist/utils/type-utils.test.d.ts +1 -0
  65. package/dist/zui.d.ts +5 -0
  66. package/package.json +2 -2
@@ -0,0 +1,474 @@
1
+ /**
2
+ * @deprecated use `text` instead
3
+ */
4
+ export declare const markdown: {
5
+ schema: import("@bpinternal/zui").ZodObject<{
6
+ markdown: import("@bpinternal/zui").ZodString;
7
+ }, "strip", import("@bpinternal/zui").ZodTypeAny, {
8
+ markdown: string;
9
+ }, {
10
+ markdown: string;
11
+ }>;
12
+ };
13
+ export declare const defaults: {
14
+ readonly text: {
15
+ readonly schema: import("@bpinternal/zui").ZodObject<{
16
+ text: import("@bpinternal/zui").ZodString;
17
+ }, "strip", import("@bpinternal/zui").ZodTypeAny, {
18
+ text: string;
19
+ }, {
20
+ text: string;
21
+ }>;
22
+ };
23
+ readonly image: {
24
+ readonly schema: import("@bpinternal/zui").ZodObject<{
25
+ imageUrl: import("@bpinternal/zui").ZodString;
26
+ }, "strip", import("@bpinternal/zui").ZodTypeAny, {
27
+ imageUrl: string;
28
+ }, {
29
+ imageUrl: string;
30
+ }>;
31
+ };
32
+ readonly audio: {
33
+ readonly schema: import("@bpinternal/zui").ZodObject<{
34
+ audioUrl: import("@bpinternal/zui").ZodString;
35
+ }, "strip", import("@bpinternal/zui").ZodTypeAny, {
36
+ audioUrl: string;
37
+ }, {
38
+ audioUrl: string;
39
+ }>;
40
+ };
41
+ readonly video: {
42
+ readonly schema: import("@bpinternal/zui").ZodObject<{
43
+ videoUrl: import("@bpinternal/zui").ZodString;
44
+ }, "strip", import("@bpinternal/zui").ZodTypeAny, {
45
+ videoUrl: string;
46
+ }, {
47
+ videoUrl: string;
48
+ }>;
49
+ };
50
+ readonly file: {
51
+ readonly schema: import("@bpinternal/zui").ZodObject<{
52
+ fileUrl: import("@bpinternal/zui").ZodString;
53
+ title: import("@bpinternal/zui").ZodOptional<import("@bpinternal/zui").ZodString>;
54
+ }, "strip", import("@bpinternal/zui").ZodTypeAny, {
55
+ fileUrl: string;
56
+ title?: string | undefined;
57
+ }, {
58
+ fileUrl: string;
59
+ title?: string | undefined;
60
+ }>;
61
+ };
62
+ readonly location: {
63
+ readonly schema: import("@bpinternal/zui").ZodObject<{
64
+ latitude: import("@bpinternal/zui").ZodNumber;
65
+ longitude: import("@bpinternal/zui").ZodNumber;
66
+ address: import("@bpinternal/zui").ZodOptional<import("@bpinternal/zui").ZodString>;
67
+ title: import("@bpinternal/zui").ZodOptional<import("@bpinternal/zui").ZodString>;
68
+ }, "strip", import("@bpinternal/zui").ZodTypeAny, {
69
+ latitude: number;
70
+ longitude: number;
71
+ title?: string | undefined;
72
+ address?: string | undefined;
73
+ }, {
74
+ latitude: number;
75
+ longitude: number;
76
+ title?: string | undefined;
77
+ address?: string | undefined;
78
+ }>;
79
+ };
80
+ readonly carousel: {
81
+ readonly schema: import("@bpinternal/zui").ZodObject<{
82
+ items: import("@bpinternal/zui").ZodArray<import("@bpinternal/zui").ZodObject<{
83
+ title: import("@bpinternal/zui").ZodString;
84
+ subtitle: import("@bpinternal/zui").ZodOptional<import("@bpinternal/zui").ZodString>;
85
+ imageUrl: import("@bpinternal/zui").ZodOptional<import("@bpinternal/zui").ZodString>;
86
+ actions: import("@bpinternal/zui").ZodArray<import("@bpinternal/zui").ZodObject<{
87
+ action: import("@bpinternal/zui").ZodEnum<["postback", "url", "say"]>;
88
+ label: import("@bpinternal/zui").ZodString;
89
+ value: import("@bpinternal/zui").ZodString;
90
+ }, "strip", import("@bpinternal/zui").ZodTypeAny, {
91
+ value: string;
92
+ action: "postback" | "url" | "say";
93
+ label: string;
94
+ }, {
95
+ value: string;
96
+ action: "postback" | "url" | "say";
97
+ label: string;
98
+ }>, "many">;
99
+ }, "strip", import("@bpinternal/zui").ZodTypeAny, {
100
+ actions: {
101
+ value: string;
102
+ action: "postback" | "url" | "say";
103
+ label: string;
104
+ }[];
105
+ title: string;
106
+ imageUrl?: string | undefined;
107
+ subtitle?: string | undefined;
108
+ }, {
109
+ actions: {
110
+ value: string;
111
+ action: "postback" | "url" | "say";
112
+ label: string;
113
+ }[];
114
+ title: string;
115
+ imageUrl?: string | undefined;
116
+ subtitle?: string | undefined;
117
+ }>, "many">;
118
+ }, "strip", import("@bpinternal/zui").ZodTypeAny, {
119
+ items: {
120
+ actions: {
121
+ value: string;
122
+ action: "postback" | "url" | "say";
123
+ label: string;
124
+ }[];
125
+ title: string;
126
+ imageUrl?: string | undefined;
127
+ subtitle?: string | undefined;
128
+ }[];
129
+ }, {
130
+ items: {
131
+ actions: {
132
+ value: string;
133
+ action: "postback" | "url" | "say";
134
+ label: string;
135
+ }[];
136
+ title: string;
137
+ imageUrl?: string | undefined;
138
+ subtitle?: string | undefined;
139
+ }[];
140
+ }>;
141
+ };
142
+ readonly card: {
143
+ readonly schema: import("@bpinternal/zui").ZodObject<{
144
+ title: import("@bpinternal/zui").ZodString;
145
+ subtitle: import("@bpinternal/zui").ZodOptional<import("@bpinternal/zui").ZodString>;
146
+ imageUrl: import("@bpinternal/zui").ZodOptional<import("@bpinternal/zui").ZodString>;
147
+ actions: import("@bpinternal/zui").ZodArray<import("@bpinternal/zui").ZodObject<{
148
+ action: import("@bpinternal/zui").ZodEnum<["postback", "url", "say"]>;
149
+ label: import("@bpinternal/zui").ZodString;
150
+ value: import("@bpinternal/zui").ZodString;
151
+ }, "strip", import("@bpinternal/zui").ZodTypeAny, {
152
+ value: string;
153
+ action: "postback" | "url" | "say";
154
+ label: string;
155
+ }, {
156
+ value: string;
157
+ action: "postback" | "url" | "say";
158
+ label: string;
159
+ }>, "many">;
160
+ }, "strip", import("@bpinternal/zui").ZodTypeAny, {
161
+ actions: {
162
+ value: string;
163
+ action: "postback" | "url" | "say";
164
+ label: string;
165
+ }[];
166
+ title: string;
167
+ imageUrl?: string | undefined;
168
+ subtitle?: string | undefined;
169
+ }, {
170
+ actions: {
171
+ value: string;
172
+ action: "postback" | "url" | "say";
173
+ label: string;
174
+ }[];
175
+ title: string;
176
+ imageUrl?: string | undefined;
177
+ subtitle?: string | undefined;
178
+ }>;
179
+ };
180
+ readonly dropdown: {
181
+ readonly schema: import("@bpinternal/zui").ZodObject<{
182
+ text: import("@bpinternal/zui").ZodString;
183
+ options: import("@bpinternal/zui").ZodArray<import("@bpinternal/zui").ZodObject<{
184
+ label: import("@bpinternal/zui").ZodString;
185
+ value: import("@bpinternal/zui").ZodString;
186
+ }, "strip", import("@bpinternal/zui").ZodTypeAny, {
187
+ value: string;
188
+ label: string;
189
+ }, {
190
+ value: string;
191
+ label: string;
192
+ }>, "many">;
193
+ }, "strip", import("@bpinternal/zui").ZodTypeAny, {
194
+ options: {
195
+ value: string;
196
+ label: string;
197
+ }[];
198
+ text: string;
199
+ }, {
200
+ options: {
201
+ value: string;
202
+ label: string;
203
+ }[];
204
+ text: string;
205
+ }>;
206
+ };
207
+ readonly choice: {
208
+ readonly schema: import("@bpinternal/zui").ZodObject<{
209
+ text: import("@bpinternal/zui").ZodString;
210
+ options: import("@bpinternal/zui").ZodArray<import("@bpinternal/zui").ZodObject<{
211
+ label: import("@bpinternal/zui").ZodString;
212
+ value: import("@bpinternal/zui").ZodString;
213
+ }, "strip", import("@bpinternal/zui").ZodTypeAny, {
214
+ value: string;
215
+ label: string;
216
+ }, {
217
+ value: string;
218
+ label: string;
219
+ }>, "many">;
220
+ }, "strip", import("@bpinternal/zui").ZodTypeAny, {
221
+ options: {
222
+ value: string;
223
+ label: string;
224
+ }[];
225
+ text: string;
226
+ }, {
227
+ options: {
228
+ value: string;
229
+ label: string;
230
+ }[];
231
+ text: string;
232
+ }>;
233
+ };
234
+ readonly bloc: {
235
+ readonly schema: import("@bpinternal/zui").ZodObject<{
236
+ items: import("@bpinternal/zui").ZodArray<import("@bpinternal/zui").ZodUnion<[import("@bpinternal/zui").ZodObject<{
237
+ type: import("@bpinternal/zui").ZodLiteral<"text">;
238
+ payload: import("@bpinternal/zui").ZodObject<{
239
+ text: import("@bpinternal/zui").ZodString;
240
+ }, "strip", import("@bpinternal/zui").ZodTypeAny, {
241
+ text: string;
242
+ }, {
243
+ text: string;
244
+ }>;
245
+ }, "strip", import("@bpinternal/zui").ZodTypeAny, {
246
+ type: "text";
247
+ payload: {
248
+ text: string;
249
+ };
250
+ }, {
251
+ type: "text";
252
+ payload: {
253
+ text: string;
254
+ };
255
+ }>, import("@bpinternal/zui").ZodObject<{
256
+ type: import("@bpinternal/zui").ZodLiteral<"markdown">;
257
+ payload: import("@bpinternal/zui").ZodObject<{
258
+ markdown: import("@bpinternal/zui").ZodString;
259
+ }, "strip", import("@bpinternal/zui").ZodTypeAny, {
260
+ markdown: string;
261
+ }, {
262
+ markdown: string;
263
+ }>;
264
+ }, "strip", import("@bpinternal/zui").ZodTypeAny, {
265
+ type: "markdown";
266
+ payload: {
267
+ markdown: string;
268
+ };
269
+ }, {
270
+ type: "markdown";
271
+ payload: {
272
+ markdown: string;
273
+ };
274
+ }>, import("@bpinternal/zui").ZodObject<{
275
+ type: import("@bpinternal/zui").ZodLiteral<"image">;
276
+ payload: import("@bpinternal/zui").ZodObject<{
277
+ imageUrl: import("@bpinternal/zui").ZodString;
278
+ }, "strip", import("@bpinternal/zui").ZodTypeAny, {
279
+ imageUrl: string;
280
+ }, {
281
+ imageUrl: string;
282
+ }>;
283
+ }, "strip", import("@bpinternal/zui").ZodTypeAny, {
284
+ type: "image";
285
+ payload: {
286
+ imageUrl: string;
287
+ };
288
+ }, {
289
+ type: "image";
290
+ payload: {
291
+ imageUrl: string;
292
+ };
293
+ }>, import("@bpinternal/zui").ZodObject<{
294
+ type: import("@bpinternal/zui").ZodLiteral<"audio">;
295
+ payload: import("@bpinternal/zui").ZodObject<{
296
+ audioUrl: import("@bpinternal/zui").ZodString;
297
+ }, "strip", import("@bpinternal/zui").ZodTypeAny, {
298
+ audioUrl: string;
299
+ }, {
300
+ audioUrl: string;
301
+ }>;
302
+ }, "strip", import("@bpinternal/zui").ZodTypeAny, {
303
+ type: "audio";
304
+ payload: {
305
+ audioUrl: string;
306
+ };
307
+ }, {
308
+ type: "audio";
309
+ payload: {
310
+ audioUrl: string;
311
+ };
312
+ }>, import("@bpinternal/zui").ZodObject<{
313
+ type: import("@bpinternal/zui").ZodLiteral<"video">;
314
+ payload: import("@bpinternal/zui").ZodObject<{
315
+ videoUrl: import("@bpinternal/zui").ZodString;
316
+ }, "strip", import("@bpinternal/zui").ZodTypeAny, {
317
+ videoUrl: string;
318
+ }, {
319
+ videoUrl: string;
320
+ }>;
321
+ }, "strip", import("@bpinternal/zui").ZodTypeAny, {
322
+ type: "video";
323
+ payload: {
324
+ videoUrl: string;
325
+ };
326
+ }, {
327
+ type: "video";
328
+ payload: {
329
+ videoUrl: string;
330
+ };
331
+ }>, import("@bpinternal/zui").ZodObject<{
332
+ type: import("@bpinternal/zui").ZodLiteral<"file">;
333
+ payload: import("@bpinternal/zui").ZodObject<{
334
+ fileUrl: import("@bpinternal/zui").ZodString;
335
+ title: import("@bpinternal/zui").ZodOptional<import("@bpinternal/zui").ZodString>;
336
+ }, "strip", import("@bpinternal/zui").ZodTypeAny, {
337
+ fileUrl: string;
338
+ title?: string | undefined;
339
+ }, {
340
+ fileUrl: string;
341
+ title?: string | undefined;
342
+ }>;
343
+ }, "strip", import("@bpinternal/zui").ZodTypeAny, {
344
+ type: "file";
345
+ payload: {
346
+ fileUrl: string;
347
+ title?: string | undefined;
348
+ };
349
+ }, {
350
+ type: "file";
351
+ payload: {
352
+ fileUrl: string;
353
+ title?: string | undefined;
354
+ };
355
+ }>, import("@bpinternal/zui").ZodObject<{
356
+ type: import("@bpinternal/zui").ZodLiteral<"location">;
357
+ payload: import("@bpinternal/zui").ZodObject<{
358
+ latitude: import("@bpinternal/zui").ZodNumber;
359
+ longitude: import("@bpinternal/zui").ZodNumber;
360
+ address: import("@bpinternal/zui").ZodOptional<import("@bpinternal/zui").ZodString>;
361
+ title: import("@bpinternal/zui").ZodOptional<import("@bpinternal/zui").ZodString>;
362
+ }, "strip", import("@bpinternal/zui").ZodTypeAny, {
363
+ latitude: number;
364
+ longitude: number;
365
+ title?: string | undefined;
366
+ address?: string | undefined;
367
+ }, {
368
+ latitude: number;
369
+ longitude: number;
370
+ title?: string | undefined;
371
+ address?: string | undefined;
372
+ }>;
373
+ }, "strip", import("@bpinternal/zui").ZodTypeAny, {
374
+ type: "location";
375
+ payload: {
376
+ latitude: number;
377
+ longitude: number;
378
+ title?: string | undefined;
379
+ address?: string | undefined;
380
+ };
381
+ }, {
382
+ type: "location";
383
+ payload: {
384
+ latitude: number;
385
+ longitude: number;
386
+ title?: string | undefined;
387
+ address?: string | undefined;
388
+ };
389
+ }>]>, "many">;
390
+ }, "strip", import("@bpinternal/zui").ZodTypeAny, {
391
+ items: ({
392
+ type: "text";
393
+ payload: {
394
+ text: string;
395
+ };
396
+ } | {
397
+ type: "markdown";
398
+ payload: {
399
+ markdown: string;
400
+ };
401
+ } | {
402
+ type: "image";
403
+ payload: {
404
+ imageUrl: string;
405
+ };
406
+ } | {
407
+ type: "audio";
408
+ payload: {
409
+ audioUrl: string;
410
+ };
411
+ } | {
412
+ type: "video";
413
+ payload: {
414
+ videoUrl: string;
415
+ };
416
+ } | {
417
+ type: "file";
418
+ payload: {
419
+ fileUrl: string;
420
+ title?: string | undefined;
421
+ };
422
+ } | {
423
+ type: "location";
424
+ payload: {
425
+ latitude: number;
426
+ longitude: number;
427
+ title?: string | undefined;
428
+ address?: string | undefined;
429
+ };
430
+ })[];
431
+ }, {
432
+ items: ({
433
+ type: "text";
434
+ payload: {
435
+ text: string;
436
+ };
437
+ } | {
438
+ type: "markdown";
439
+ payload: {
440
+ markdown: string;
441
+ };
442
+ } | {
443
+ type: "image";
444
+ payload: {
445
+ imageUrl: string;
446
+ };
447
+ } | {
448
+ type: "audio";
449
+ payload: {
450
+ audioUrl: string;
451
+ };
452
+ } | {
453
+ type: "video";
454
+ payload: {
455
+ videoUrl: string;
456
+ };
457
+ } | {
458
+ type: "file";
459
+ payload: {
460
+ fileUrl: string;
461
+ title?: string | undefined;
462
+ };
463
+ } | {
464
+ type: "location";
465
+ payload: {
466
+ latitude: number;
467
+ longitude: number;
468
+ title?: string | undefined;
469
+ address?: string | undefined;
470
+ };
471
+ })[];
472
+ }>;
473
+ };
474
+ };
@@ -0,0 +1,58 @@
1
+ import * as integration from './integration';
2
+ import * as plugin from './plugin';
3
+ type NameVersion = {
4
+ name: string;
5
+ version: string;
6
+ };
7
+ type PackageReference = NameVersion & {
8
+ id?: string;
9
+ uri?: string;
10
+ };
11
+ type IntegrationPackageDefinition = NameVersion & {
12
+ configuration?: integration.ConfigurationDefinition;
13
+ configurations?: Record<string, integration.AdditionalConfigurationDefinition>;
14
+ events?: Record<string, integration.EventDefinition>;
15
+ actions?: Record<string, integration.ActionDefinition>;
16
+ channels?: Record<string, integration.ChannelDefinition>;
17
+ states?: Record<string, integration.StateDefinition>;
18
+ user?: integration.UserDefinition;
19
+ secrets?: Record<string, integration.SecretDefinition>;
20
+ entities?: Record<string, integration.EntityDefinition>;
21
+ interfaces?: Record<string, PackageReference>;
22
+ };
23
+ type InterfacePackageDefinition = NameVersion & {
24
+ templateName?: string;
25
+ entities?: Record<string, integration.EntityDefinition>;
26
+ events?: Record<string, integration.EventDefinition>;
27
+ actions?: Record<string, integration.ActionDefinition>;
28
+ channels?: Record<string, integration.ChannelDefinition>;
29
+ };
30
+ type PluginPackageDefinition = NameVersion & {
31
+ integrations?: Record<string, PackageReference>;
32
+ interfaces?: Record<string, PackageReference>;
33
+ user?: plugin.UserDefinition;
34
+ conversation?: plugin.ConversationDefinition;
35
+ message?: plugin.MessageDefinition;
36
+ states?: Record<string, plugin.StateDefinition>;
37
+ configuration?: plugin.ConfigurationDefinition;
38
+ events?: Record<string, plugin.EventDefinition>;
39
+ recurringEvents?: Record<string, plugin.RecurringEventDefinition>;
40
+ actions?: Record<string, plugin.ActionDefinition>;
41
+ };
42
+ export type IntegrationPackage = PackageReference & {
43
+ type: 'integration';
44
+ definition: IntegrationPackageDefinition;
45
+ implementation?: null;
46
+ };
47
+ export type InterfacePackage = PackageReference & {
48
+ type: 'interface';
49
+ definition: InterfacePackageDefinition;
50
+ implementation?: null;
51
+ };
52
+ export type PluginPackage = PackageReference & {
53
+ type: 'plugin';
54
+ definition: PluginPackageDefinition;
55
+ implementation: Buffer;
56
+ };
57
+ export type Package = IntegrationPackage | InterfacePackage | PluginPackage;
58
+ export {};
@@ -0,0 +1,50 @@
1
+ import { StateDefinition, RecurringEventDefinition, EventDefinition, ConfigurationDefinition, UserDefinition, ConversationDefinition, MessageDefinition, ActionDefinition } from '../bot/definition';
2
+ import { IntegrationPackage, InterfacePackage } from '../package';
3
+ import { ZuiObjectSchema } from '../zui';
4
+ export { StateDefinition, RecurringEventDefinition, EventDefinition, ConfigurationDefinition, UserDefinition, ConversationDefinition, MessageDefinition, ActionDefinition, IntegrationConfigInstance, } from '../bot/definition';
5
+ type BaseConfig = ZuiObjectSchema;
6
+ type BaseStates = Record<string, ZuiObjectSchema>;
7
+ type BaseEvents = Record<string, ZuiObjectSchema>;
8
+ type BaseActions = Record<string, ZuiObjectSchema>;
9
+ type BaseInterfaces = Record<string, any>;
10
+ type BaseIntegrations = Record<string, any>;
11
+ export type PluginDefinitionProps<TName extends string = string, TVersion extends string = string, TConfig extends BaseConfig = BaseConfig, TStates extends BaseStates = BaseStates, TEvents extends BaseEvents = BaseEvents, TActions extends BaseActions = BaseActions, TInterfaces extends BaseInterfaces = BaseInterfaces, TIntegrations extends BaseIntegrations = BaseIntegrations> = {
12
+ name: TName;
13
+ version: TVersion;
14
+ integrations?: {
15
+ [K in keyof TIntegrations]: IntegrationPackage;
16
+ };
17
+ interfaces?: {
18
+ [K in keyof TInterfaces]: InterfacePackage;
19
+ };
20
+ user?: UserDefinition;
21
+ conversation?: ConversationDefinition;
22
+ message?: MessageDefinition;
23
+ states?: {
24
+ [K in keyof TStates]: StateDefinition<TStates[K]>;
25
+ };
26
+ configuration?: ConfigurationDefinition<TConfig>;
27
+ events?: {
28
+ [K in keyof TEvents]: EventDefinition<TEvents[K]>;
29
+ };
30
+ recurringEvents?: Record<string, RecurringEventDefinition<TEvents>>;
31
+ actions?: {
32
+ [K in keyof TActions]: ActionDefinition<TActions[K]>;
33
+ };
34
+ };
35
+ export declare class PluginDefinition<TName extends string = string, TVersion extends string = string, TConfig extends BaseConfig = BaseConfig, TStates extends BaseStates = BaseStates, TEvents extends BaseEvents = BaseEvents, TActions extends BaseActions = BaseActions, TInterfaces extends BaseInterfaces = BaseInterfaces, TIntegrations extends BaseIntegrations = BaseIntegrations> {
36
+ readonly props: PluginDefinitionProps<TName, TVersion, TConfig, TStates, TEvents, TActions, TInterfaces, TIntegrations>;
37
+ readonly name: this['props']['name'];
38
+ readonly version: this['props']['version'];
39
+ readonly integrations: this['props']['integrations'];
40
+ readonly interfaces: this['props']['interfaces'];
41
+ readonly user: this['props']['user'];
42
+ readonly conversation: this['props']['conversation'];
43
+ readonly message: this['props']['message'];
44
+ readonly states: this['props']['states'];
45
+ readonly configuration: this['props']['configuration'];
46
+ readonly events: this['props']['events'];
47
+ readonly recurringEvents: this['props']['recurringEvents'];
48
+ readonly actions: this['props']['actions'];
49
+ constructor(props: PluginDefinitionProps<TName, TVersion, TConfig, TStates, TEvents, TActions, TInterfaces, TIntegrations>);
50
+ }
@@ -0,0 +1,39 @@
1
+ import { MessageHandlersMap, MessageHandlers, EventHandlersMap, EventHandlers, StateExpiredHandlersMap, StateExpiredHandlers, HookHandlersMap, HookData, HookHandlers, ActionHandlers, BotHandlers } from './server/types';
2
+ import { BasePlugin } from './types/generic';
3
+ export type PluginImplementationProps<TPlugin extends BasePlugin = BasePlugin> = {
4
+ actions: ActionHandlers<TPlugin>;
5
+ };
6
+ export type PluginRuntimeProps<TPlugin extends BasePlugin = BasePlugin> = {
7
+ configuration: TPlugin['configuration'];
8
+ interfaces: {
9
+ [K in keyof TPlugin['interfaces']]: {
10
+ name: string;
11
+ version: string;
12
+ };
13
+ };
14
+ };
15
+ export declare class PluginImplementation<TPlugin extends BasePlugin = BasePlugin> implements BotHandlers<TPlugin> {
16
+ readonly props: PluginImplementationProps<TPlugin>;
17
+ private _runtimeProps;
18
+ readonly actionHandlers: ActionHandlers<TPlugin>;
19
+ readonly messageHandlers: MessageHandlersMap<TPlugin>;
20
+ readonly eventHandlers: EventHandlersMap<TPlugin>;
21
+ readonly stateExpiredHandlers: StateExpiredHandlersMap<TPlugin>;
22
+ readonly hookHandlers: HookHandlersMap<TPlugin>;
23
+ constructor(props: PluginImplementationProps<TPlugin>);
24
+ initialize(config: PluginRuntimeProps<TPlugin>): this;
25
+ get config(): PluginRuntimeProps<TPlugin>;
26
+ readonly on: {
27
+ message: <T extends keyof MessageHandlersMap<TPlugin>>(type: T, handler: MessageHandlers<TPlugin>[T]) => void;
28
+ event: <T extends keyof EventHandlersMap<TPlugin>>(type: T, handler: EventHandlers<TPlugin>[T]) => void;
29
+ stateExpired: <T extends keyof StateExpiredHandlersMap<TPlugin>>(type: T, handler: StateExpiredHandlers<TPlugin>[T]) => void;
30
+ beforeIncomingEvent: <T extends keyof HookData<TPlugin>["before_incoming_event"]>(type: T, handler: HookHandlers<TPlugin>["before_incoming_event"][T]) => void;
31
+ beforeIncomingMessage: <T extends keyof HookData<TPlugin>["before_incoming_message"]>(type: T, handler: HookHandlers<TPlugin>["before_incoming_message"][T]) => void;
32
+ beforeOutgoingMessage: <T extends keyof HookData<TPlugin>["before_outgoing_message"]>(type: T, handler: HookHandlers<TPlugin>["before_outgoing_message"][T]) => void;
33
+ beforeOutgoingCallAction: <T extends keyof HookData<TPlugin>["before_outgoing_call_action"]>(type: T, handler: HookHandlers<TPlugin>["before_outgoing_call_action"][T]) => void;
34
+ afterIncomingEvent: <T extends keyof HookData<TPlugin>["after_incoming_event"]>(type: T, handler: HookHandlers<TPlugin>["after_incoming_event"][T]) => void;
35
+ afterIncomingMessage: <T extends keyof HookData<TPlugin>["after_incoming_message"]>(type: T, handler: HookHandlers<TPlugin>["after_incoming_message"][T]) => void;
36
+ afterOutgoingMessage: <T extends keyof HookData<TPlugin>["after_outgoing_message"]>(type: T, handler: HookHandlers<TPlugin>["after_outgoing_message"][T]) => void;
37
+ afterOutgoingCallAction: <T extends keyof HookData<TPlugin>["after_outgoing_call_action"]>(type: T, handler: HookHandlers<TPlugin>["after_outgoing_call_action"][T]) => void;
38
+ };
39
+ }
@@ -0,0 +1,3 @@
1
+ export * from './definition';
2
+ export * from './implementation';
3
+ export * from './types/generic';
@@ -0,0 +1 @@
1
+ export * from '../../bot/server/types';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,30 @@
1
+ import { BaseIntegration, DefaultIntegration, InputBaseIntegration } from '../../integration/types/generic';
2
+ import { BaseInterface, InputBaseInterface, DefaultInterface } from '../../interface/types/generic';
3
+ import * as utils from '../../utils/type-utils';
4
+ export type BaseAction = {
5
+ input: any;
6
+ output: any;
7
+ };
8
+ export type BasePlugin = {
9
+ configuration: any;
10
+ integrations: Record<string, BaseIntegration>;
11
+ interfaces: Record<string, BaseInterface>;
12
+ events: Record<string, any>;
13
+ states: Record<string, any>;
14
+ actions: Record<string, BaseAction>;
15
+ unknownDefinitions: true;
16
+ };
17
+ export type InputBasePlugin = utils.DeepPartial<BasePlugin>;
18
+ export type DefaultPlugin<B extends utils.DeepPartial<BasePlugin>> = {
19
+ configuration: utils.Default<B['configuration'], BasePlugin['configuration']>;
20
+ events: utils.Default<B['events'], BasePlugin['events']>;
21
+ states: utils.Default<B['states'], BasePlugin['states']>;
22
+ actions: utils.Default<B['actions'], BasePlugin['actions']>;
23
+ unknownDefinitions: utils.Default<B['unknownDefinitions'], BasePlugin['unknownDefinitions']>;
24
+ integrations: undefined extends B['integrations'] ? BasePlugin['integrations'] : {
25
+ [K in keyof B['integrations']]: DefaultIntegration<utils.Cast<B['integrations'][K], InputBaseIntegration>>;
26
+ };
27
+ interfaces: undefined extends B['interfaces'] ? BasePlugin['interfaces'] : {
28
+ [K in keyof B['interfaces']]: DefaultInterface<utils.Cast<B['interfaces'][K], InputBaseInterface>>;
29
+ };
30
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ import { RetryConfig } from '@botpress/client';
2
+ export declare const retryConfig: RetryConfig;