@botpress/sdk 0.2.3 → 0.3.2

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.
@@ -1,740 +1,89 @@
1
- import { z } from 'zod';
2
- import { SchemaDefinition } from './schema';
3
- export declare const schemaSchema: z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>;
4
- export declare const configurationDefinitionSchema: z.ZodObject<{
5
- schema: z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>;
6
- }, "strip", z.ZodTypeAny, {
7
- schema: {} & {
8
- [k: string]: unknown;
9
- };
10
- }, {
11
- schema: {} & {
12
- [k: string]: unknown;
13
- };
14
- }>;
15
- export declare const eventDefinitionSchema: z.ZodObject<{
16
- title: z.ZodOptional<z.ZodString>;
17
- description: z.ZodOptional<z.ZodString>;
18
- schema: z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>;
19
- }, "strip", z.ZodTypeAny, {
20
- schema: {} & {
21
- [k: string]: unknown;
22
- };
23
- title?: string | undefined;
24
- description?: string | undefined;
25
- }, {
26
- schema: {} & {
27
- [k: string]: unknown;
28
- };
29
- title?: string | undefined;
30
- description?: string | undefined;
31
- }>;
32
- export declare const actionDefinitionSchema: z.ZodObject<{
33
- title: z.ZodOptional<z.ZodString>;
34
- description: z.ZodOptional<z.ZodString>;
35
- input: z.ZodObject<{
36
- schema: z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>;
37
- }, "strip", z.ZodTypeAny, {
38
- schema: {} & {
39
- [k: string]: unknown;
40
- };
41
- }, {
42
- schema: {} & {
43
- [k: string]: unknown;
44
- };
45
- }>;
46
- output: z.ZodObject<{
47
- schema: z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>;
48
- }, "strip", z.ZodTypeAny, {
49
- schema: {} & {
50
- [k: string]: unknown;
51
- };
52
- }, {
53
- schema: {} & {
54
- [k: string]: unknown;
55
- };
56
- }>;
57
- }, "strip", z.ZodTypeAny, {
58
- input: {
59
- schema: {} & {
60
- [k: string]: unknown;
61
- };
62
- };
63
- output: {
64
- schema: {} & {
65
- [k: string]: unknown;
66
- };
67
- };
68
- title?: string | undefined;
69
- description?: string | undefined;
70
- }, {
71
- input: {
72
- schema: {} & {
73
- [k: string]: unknown;
74
- };
75
- };
76
- output: {
77
- schema: {} & {
78
- [k: string]: unknown;
79
- };
80
- };
81
- title?: string | undefined;
82
- description?: string | undefined;
83
- }>;
84
- export declare const messageDefinitionSchema: z.ZodObject<{
85
- schema: z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>;
86
- }, "strip", z.ZodTypeAny, {
87
- schema: {} & {
88
- [k: string]: unknown;
89
- };
90
- }, {
91
- schema: {} & {
92
- [k: string]: unknown;
1
+ import { SchemaDefinition } from '../schema';
2
+ import { AnyZodObject } from '../type-utils';
3
+ type BaseConfig = AnyZodObject;
4
+ type BaseEvents = Record<string, AnyZodObject>;
5
+ type BaseActions = Record<string, Record<'input' | 'output', AnyZodObject>>;
6
+ type BaseChannels = Record<string, Record<string, AnyZodObject>>;
7
+ type BaseStates = Record<string, AnyZodObject>;
8
+ type TagDefinition = {
9
+ title?: string;
10
+ description?: string;
11
+ };
12
+ type ConfigurationDefinition<TConfig extends BaseConfig> = SchemaDefinition<TConfig>;
13
+ type EventDefinition<TEvent extends BaseEvents[string]> = SchemaDefinition<TEvent> & {
14
+ title?: string;
15
+ description?: string;
16
+ };
17
+ type ChannelDefinition<TChannel extends BaseChannels[string]> = {
18
+ title?: string;
19
+ description?: string;
20
+ messages: {
21
+ [K in keyof TChannel]: SchemaDefinition<TChannel[K]>;
93
22
  };
94
- }>;
95
- export declare const tagDefinitionSchema: z.ZodObject<{
96
- title: z.ZodOptional<z.ZodString>;
97
- description: z.ZodOptional<z.ZodString>;
98
- }, "strip", z.ZodTypeAny, {
99
- title?: string | undefined;
100
- description?: string | undefined;
101
- }, {
102
- title?: string | undefined;
103
- description?: string | undefined;
104
- }>;
105
- export declare const channelDefinitionSchema: z.ZodObject<{
106
- title: z.ZodOptional<z.ZodString>;
107
- description: z.ZodOptional<z.ZodString>;
108
- messages: z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodObject<{
109
- schema: z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>;
110
- }, "strip", z.ZodTypeAny, {
111
- schema: {} & {
112
- [k: string]: unknown;
113
- };
114
- }, {
115
- schema: {} & {
116
- [k: string]: unknown;
117
- };
118
- }>>, Record<string, {
119
- schema: {} & {
120
- [k: string]: unknown;
121
- };
122
- }>, Record<string, {
123
- schema: {} & {
124
- [k: string]: unknown;
125
- };
126
- }>>;
127
- message: z.ZodOptional<z.ZodObject<{
128
- tags: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
129
- title: z.ZodOptional<z.ZodString>;
130
- description: z.ZodOptional<z.ZodString>;
131
- }, "strip", z.ZodTypeAny, {
132
- title?: string | undefined;
133
- description?: string | undefined;
134
- }, {
135
- title?: string | undefined;
136
- description?: string | undefined;
137
- }>>>;
138
- }, "strip", z.ZodTypeAny, {
139
- tags?: Record<string, {
140
- title?: string | undefined;
141
- description?: string | undefined;
142
- }> | undefined;
143
- }, {
144
- tags?: Record<string, {
145
- title?: string | undefined;
146
- description?: string | undefined;
147
- }> | undefined;
148
- }>>;
149
- conversation: z.ZodOptional<z.ZodObject<{
150
- tags: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
151
- title: z.ZodOptional<z.ZodString>;
152
- description: z.ZodOptional<z.ZodString>;
153
- }, "strip", z.ZodTypeAny, {
154
- title?: string | undefined;
155
- description?: string | undefined;
156
- }, {
157
- title?: string | undefined;
158
- description?: string | undefined;
159
- }>>>;
160
- creation: z.ZodOptional<z.ZodObject<{
161
- enabled: z.ZodBoolean;
162
- requiredTags: z.ZodArray<z.ZodString, "many">;
163
- }, "strip", z.ZodTypeAny, {
164
- enabled: boolean;
165
- requiredTags: string[];
166
- }, {
167
- enabled: boolean;
168
- requiredTags: string[];
169
- }>>;
170
- }, "strip", z.ZodTypeAny, {
171
- tags?: Record<string, {
172
- title?: string | undefined;
173
- description?: string | undefined;
174
- }> | undefined;
175
- creation?: {
176
- enabled: boolean;
177
- requiredTags: string[];
178
- } | undefined;
179
- }, {
180
- tags?: Record<string, {
181
- title?: string | undefined;
182
- description?: string | undefined;
183
- }> | undefined;
184
- creation?: {
185
- enabled: boolean;
186
- requiredTags: string[];
187
- } | undefined;
188
- }>>;
189
- }, "strip", z.ZodTypeAny, {
190
- messages: Record<string, {
191
- schema: {} & {
192
- [k: string]: unknown;
193
- };
194
- }>;
195
- title?: string | undefined;
196
- description?: string | undefined;
197
23
  message?: {
198
- tags?: Record<string, {
199
- title?: string | undefined;
200
- description?: string | undefined;
201
- }> | undefined;
202
- } | undefined;
203
- conversation?: {
204
- tags?: Record<string, {
205
- title?: string | undefined;
206
- description?: string | undefined;
207
- }> | undefined;
208
- creation?: {
24
+ tags?: Record<string, TagDefinition>;
25
+ };
26
+ conversation?: Partial<{
27
+ tags: Record<string, TagDefinition>;
28
+ creation: {
209
29
  enabled: boolean;
210
30
  requiredTags: string[];
211
- } | undefined;
212
- } | undefined;
213
- }, {
214
- messages: Record<string, {
215
- schema: {} & {
216
- [k: string]: unknown;
217
31
  };
218
32
  }>;
219
- title?: string | undefined;
220
- description?: string | undefined;
221
- message?: {
222
- tags?: Record<string, {
223
- title?: string | undefined;
224
- description?: string | undefined;
225
- }> | undefined;
226
- } | undefined;
227
- conversation?: {
228
- tags?: Record<string, {
229
- title?: string | undefined;
230
- description?: string | undefined;
231
- }> | undefined;
232
- creation?: {
233
- enabled: boolean;
234
- requiredTags: string[];
235
- } | undefined;
236
- } | undefined;
237
- }>;
238
- export declare const stateDefinitionSchema: z.ZodObject<{
239
- type: z.ZodUnion<[z.ZodLiteral<"integration">, z.ZodLiteral<"conversation">, z.ZodLiteral<"user">]>;
240
- schema: z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>;
241
- }, "strip", z.ZodTypeAny, {
242
- type: "user" | "conversation" | "integration";
243
- schema: {} & {
244
- [k: string]: unknown;
245
- };
246
- }, {
247
- type: "user" | "conversation" | "integration";
248
- schema: {} & {
249
- [k: string]: unknown;
33
+ };
34
+ type ActionDefinition<TAction extends BaseActions[string]> = {
35
+ title?: string;
36
+ description?: string;
37
+ input: SchemaDefinition<TAction['input']>;
38
+ output: SchemaDefinition<TAction['output']>;
39
+ };
40
+ type StateDefinition<TState extends BaseStates[string]> = SchemaDefinition<TState> & {
41
+ type: 'integration' | 'conversation' | 'user';
42
+ };
43
+ type UserDefinition = Partial<{
44
+ tags: Record<string, TagDefinition>;
45
+ creation: {
46
+ enabled: boolean;
47
+ requiredTags: string[];
250
48
  };
251
49
  }>;
252
- declare const PUBLIC_VERSION: "0.2.0";
253
- declare const PRIVATE_VERSION: "0.0.1";
254
- export declare const integrationDefinitionSchema: z.ZodObject<{
255
- name: z.ZodString;
256
- version: z.ZodEnum<["0.0.1", "0.2.0"]>;
257
- title: z.ZodOptional<z.ZodString>;
258
- description: z.ZodOptional<z.ZodString>;
259
- icon: z.ZodOptional<z.ZodString>;
260
- readme: z.ZodOptional<z.ZodString>;
261
- configuration: z.ZodOptional<z.ZodObject<{
262
- schema: z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>;
263
- }, "strip", z.ZodTypeAny, {
264
- schema: {} & {
265
- [k: string]: unknown;
266
- };
267
- }, {
268
- schema: {} & {
269
- [k: string]: unknown;
270
- };
271
- }>>;
272
- events: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
273
- title: z.ZodOptional<z.ZodString>;
274
- description: z.ZodOptional<z.ZodString>;
275
- schema: z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>;
276
- }, "strip", z.ZodTypeAny, {
277
- schema: {} & {
278
- [k: string]: unknown;
279
- };
280
- title?: string | undefined;
281
- description?: string | undefined;
282
- }, {
283
- schema: {} & {
284
- [k: string]: unknown;
285
- };
286
- title?: string | undefined;
287
- description?: string | undefined;
288
- }>>>;
289
- actions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
290
- title: z.ZodOptional<z.ZodString>;
291
- description: z.ZodOptional<z.ZodString>;
292
- input: z.ZodObject<{
293
- schema: z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>;
294
- }, "strip", z.ZodTypeAny, {
295
- schema: {} & {
296
- [k: string]: unknown;
297
- };
298
- }, {
299
- schema: {} & {
300
- [k: string]: unknown;
301
- };
302
- }>;
303
- output: z.ZodObject<{
304
- schema: z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>;
305
- }, "strip", z.ZodTypeAny, {
306
- schema: {} & {
307
- [k: string]: unknown;
308
- };
309
- }, {
310
- schema: {} & {
311
- [k: string]: unknown;
312
- };
313
- }>;
314
- }, "strip", z.ZodTypeAny, {
315
- input: {
316
- schema: {} & {
317
- [k: string]: unknown;
318
- };
319
- };
320
- output: {
321
- schema: {} & {
322
- [k: string]: unknown;
323
- };
324
- };
325
- title?: string | undefined;
326
- description?: string | undefined;
327
- }, {
328
- input: {
329
- schema: {} & {
330
- [k: string]: unknown;
331
- };
332
- };
333
- output: {
334
- schema: {} & {
335
- [k: string]: unknown;
336
- };
337
- };
338
- title?: string | undefined;
339
- description?: string | undefined;
340
- }>>>;
341
- channels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
342
- title: z.ZodOptional<z.ZodString>;
343
- description: z.ZodOptional<z.ZodString>;
344
- messages: z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodObject<{
345
- schema: z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>;
346
- }, "strip", z.ZodTypeAny, {
347
- schema: {} & {
348
- [k: string]: unknown;
349
- };
350
- }, {
351
- schema: {} & {
352
- [k: string]: unknown;
353
- };
354
- }>>, Record<string, {
355
- schema: {} & {
356
- [k: string]: unknown;
357
- };
358
- }>, Record<string, {
359
- schema: {} & {
360
- [k: string]: unknown;
361
- };
362
- }>>;
363
- message: z.ZodOptional<z.ZodObject<{
364
- tags: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
365
- title: z.ZodOptional<z.ZodString>;
366
- description: z.ZodOptional<z.ZodString>;
367
- }, "strip", z.ZodTypeAny, {
368
- title?: string | undefined;
369
- description?: string | undefined;
370
- }, {
371
- title?: string | undefined;
372
- description?: string | undefined;
373
- }>>>;
374
- }, "strip", z.ZodTypeAny, {
375
- tags?: Record<string, {
376
- title?: string | undefined;
377
- description?: string | undefined;
378
- }> | undefined;
379
- }, {
380
- tags?: Record<string, {
381
- title?: string | undefined;
382
- description?: string | undefined;
383
- }> | undefined;
384
- }>>;
385
- conversation: z.ZodOptional<z.ZodObject<{
386
- tags: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
387
- title: z.ZodOptional<z.ZodString>;
388
- description: z.ZodOptional<z.ZodString>;
389
- }, "strip", z.ZodTypeAny, {
390
- title?: string | undefined;
391
- description?: string | undefined;
392
- }, {
393
- title?: string | undefined;
394
- description?: string | undefined;
395
- }>>>;
396
- creation: z.ZodOptional<z.ZodObject<{
397
- enabled: z.ZodBoolean;
398
- requiredTags: z.ZodArray<z.ZodString, "many">;
399
- }, "strip", z.ZodTypeAny, {
400
- enabled: boolean;
401
- requiredTags: string[];
402
- }, {
403
- enabled: boolean;
404
- requiredTags: string[];
405
- }>>;
406
- }, "strip", z.ZodTypeAny, {
407
- tags?: Record<string, {
408
- title?: string | undefined;
409
- description?: string | undefined;
410
- }> | undefined;
411
- creation?: {
412
- enabled: boolean;
413
- requiredTags: string[];
414
- } | undefined;
415
- }, {
416
- tags?: Record<string, {
417
- title?: string | undefined;
418
- description?: string | undefined;
419
- }> | undefined;
420
- creation?: {
421
- enabled: boolean;
422
- requiredTags: string[];
423
- } | undefined;
424
- }>>;
425
- }, "strip", z.ZodTypeAny, {
426
- messages: Record<string, {
427
- schema: {} & {
428
- [k: string]: unknown;
429
- };
430
- }>;
431
- title?: string | undefined;
432
- description?: string | undefined;
433
- message?: {
434
- tags?: Record<string, {
435
- title?: string | undefined;
436
- description?: string | undefined;
437
- }> | undefined;
438
- } | undefined;
439
- conversation?: {
440
- tags?: Record<string, {
441
- title?: string | undefined;
442
- description?: string | undefined;
443
- }> | undefined;
444
- creation?: {
445
- enabled: boolean;
446
- requiredTags: string[];
447
- } | undefined;
448
- } | undefined;
449
- }, {
450
- messages: Record<string, {
451
- schema: {} & {
452
- [k: string]: unknown;
453
- };
454
- }>;
455
- title?: string | undefined;
456
- description?: string | undefined;
457
- message?: {
458
- tags?: Record<string, {
459
- title?: string | undefined;
460
- description?: string | undefined;
461
- }> | undefined;
462
- } | undefined;
463
- conversation?: {
464
- tags?: Record<string, {
465
- title?: string | undefined;
466
- description?: string | undefined;
467
- }> | undefined;
468
- creation?: {
469
- enabled: boolean;
470
- requiredTags: string[];
471
- } | undefined;
472
- } | undefined;
473
- }>>>;
474
- states: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
475
- type: z.ZodUnion<[z.ZodLiteral<"integration">, z.ZodLiteral<"conversation">, z.ZodLiteral<"user">]>;
476
- schema: z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>;
477
- }, "strip", z.ZodTypeAny, {
478
- type: "user" | "conversation" | "integration";
479
- schema: {} & {
480
- [k: string]: unknown;
481
- };
482
- }, {
483
- type: "user" | "conversation" | "integration";
484
- schema: {} & {
485
- [k: string]: unknown;
486
- };
487
- }>>>;
488
- user: z.ZodOptional<z.ZodObject<{
489
- tags: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
490
- title: z.ZodOptional<z.ZodString>;
491
- description: z.ZodOptional<z.ZodString>;
492
- }, "strip", z.ZodTypeAny, {
493
- title?: string | undefined;
494
- description?: string | undefined;
495
- }, {
496
- title?: string | undefined;
497
- description?: string | undefined;
498
- }>>>;
499
- creation: z.ZodOptional<z.ZodObject<{
500
- enabled: z.ZodBoolean;
501
- requiredTags: z.ZodArray<z.ZodString, "many">;
502
- }, "strip", z.ZodTypeAny, {
503
- enabled: boolean;
504
- requiredTags: string[];
505
- }, {
506
- enabled: boolean;
507
- requiredTags: string[];
508
- }>>;
509
- }, "strip", z.ZodTypeAny, {
510
- tags?: Record<string, {
511
- title?: string | undefined;
512
- description?: string | undefined;
513
- }> | undefined;
514
- creation?: {
515
- enabled: boolean;
516
- requiredTags: string[];
517
- } | undefined;
518
- }, {
519
- tags?: Record<string, {
520
- title?: string | undefined;
521
- description?: string | undefined;
522
- }> | undefined;
523
- creation?: {
524
- enabled: boolean;
525
- requiredTags: string[];
526
- } | undefined;
527
- }>>;
528
- secrets: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
529
- }, "strip", z.ZodTypeAny, {
530
- name: string;
531
- version: "0.2.0" | "0.0.1";
532
- title?: string | undefined;
533
- description?: string | undefined;
534
- icon?: string | undefined;
535
- readme?: string | undefined;
536
- configuration?: {
537
- schema: {} & {
538
- [k: string]: unknown;
539
- };
540
- } | undefined;
541
- events?: Record<string, {
542
- schema: {} & {
543
- [k: string]: unknown;
544
- };
545
- title?: string | undefined;
546
- description?: string | undefined;
547
- }> | undefined;
548
- actions?: Record<string, {
549
- input: {
550
- schema: {} & {
551
- [k: string]: unknown;
552
- };
553
- };
554
- output: {
555
- schema: {} & {
556
- [k: string]: unknown;
557
- };
558
- };
559
- title?: string | undefined;
560
- description?: string | undefined;
561
- }> | undefined;
562
- channels?: Record<string, {
563
- messages: Record<string, {
564
- schema: {} & {
565
- [k: string]: unknown;
566
- };
567
- }>;
568
- title?: string | undefined;
569
- description?: string | undefined;
570
- message?: {
571
- tags?: Record<string, {
572
- title?: string | undefined;
573
- description?: string | undefined;
574
- }> | undefined;
575
- } | undefined;
576
- conversation?: {
577
- tags?: Record<string, {
578
- title?: string | undefined;
579
- description?: string | undefined;
580
- }> | undefined;
581
- creation?: {
582
- enabled: boolean;
583
- requiredTags: string[];
584
- } | undefined;
585
- } | undefined;
586
- }> | undefined;
587
- states?: Record<string, {
588
- type: "user" | "conversation" | "integration";
589
- schema: {} & {
590
- [k: string]: unknown;
591
- };
592
- }> | undefined;
593
- user?: {
594
- tags?: Record<string, {
595
- title?: string | undefined;
596
- description?: string | undefined;
597
- }> | undefined;
598
- creation?: {
599
- enabled: boolean;
600
- requiredTags: string[];
601
- } | undefined;
602
- } | undefined;
603
- secrets?: string[] | undefined;
604
- }, {
50
+ export type IntegrationDefinitionProps<TConfig extends BaseConfig = BaseConfig, TEvents extends BaseEvents = BaseEvents, TActions extends BaseActions = BaseActions, TChannels extends BaseChannels = BaseChannels, TStates extends BaseStates = BaseStates> = {
605
51
  name: string;
606
- version: "0.2.0" | "0.0.1";
607
- title?: string | undefined;
608
- description?: string | undefined;
609
- icon?: string | undefined;
610
- readme?: string | undefined;
611
- configuration?: {
612
- schema: {} & {
613
- [k: string]: unknown;
614
- };
615
- } | undefined;
616
- events?: Record<string, {
617
- schema: {} & {
618
- [k: string]: unknown;
619
- };
620
- title?: string | undefined;
621
- description?: string | undefined;
622
- }> | undefined;
623
- actions?: Record<string, {
624
- input: {
625
- schema: {} & {
626
- [k: string]: unknown;
627
- };
628
- };
629
- output: {
630
- schema: {} & {
631
- [k: string]: unknown;
632
- };
633
- };
634
- title?: string | undefined;
635
- description?: string | undefined;
636
- }> | undefined;
637
- channels?: Record<string, {
638
- messages: Record<string, {
639
- schema: {} & {
640
- [k: string]: unknown;
641
- };
642
- }>;
643
- title?: string | undefined;
644
- description?: string | undefined;
645
- message?: {
646
- tags?: Record<string, {
647
- title?: string | undefined;
648
- description?: string | undefined;
649
- }> | undefined;
650
- } | undefined;
651
- conversation?: {
652
- tags?: Record<string, {
653
- title?: string | undefined;
654
- description?: string | undefined;
655
- }> | undefined;
656
- creation?: {
657
- enabled: boolean;
658
- requiredTags: string[];
659
- } | undefined;
660
- } | undefined;
661
- }> | undefined;
662
- states?: Record<string, {
663
- type: "user" | "conversation" | "integration";
664
- schema: {} & {
665
- [k: string]: unknown;
666
- };
667
- }> | undefined;
668
- user?: {
669
- tags?: Record<string, {
670
- title?: string | undefined;
671
- description?: string | undefined;
672
- }> | undefined;
673
- creation?: {
674
- enabled: boolean;
675
- requiredTags: string[];
676
- } | undefined;
677
- } | undefined;
678
- secrets?: string[] | undefined;
679
- }>;
680
- export type ConfigurationDefinition = z.infer<typeof configurationDefinitionSchema>;
681
- export type EventDefinition = z.infer<typeof eventDefinitionSchema>;
682
- export type ChannelDefinition = z.infer<typeof channelDefinitionSchema>;
683
- export type ActionDefinition = z.infer<typeof actionDefinitionSchema>;
684
- export type MessageDefinition = z.infer<typeof messageDefinitionSchema>;
685
- export type StateDefinition = z.infer<typeof stateDefinitionSchema>;
686
- type IntegrationDefinitionOutput = z.infer<typeof integrationDefinitionSchema>;
687
- type AnyZodObject = z.ZodObject<any>;
688
- type Merge<A extends object, B extends object> = Omit<A, keyof B> & B;
689
- type Cast<T, U> = T extends U ? T : U;
690
- type BaseConfig = AnyZodObject;
691
- type BaseEvent = Record<string, AnyZodObject>;
692
- type BaseAction = Record<string, Record<'input' | 'output', AnyZodObject>>;
693
- type BaseChannel = Record<string, Record<string, AnyZodObject>>;
694
- type BaseState = Record<string, AnyZodObject>;
695
- type IntegrationDefinitionVersion = {
696
- /** Only version 0.2.0 is supported for public integrations yet. This is temporary. */
697
- version: typeof PUBLIC_VERSION;
698
- } | {
699
- /** Only version 0.0.1 is supported for private integrations yet. This is temporary. */
700
- version: typeof PRIVATE_VERSION;
701
- };
702
- export type IntegrationDefinitionProps<TConfig extends BaseConfig = BaseConfig, TEvent extends BaseEvent = BaseEvent, TAction extends BaseAction = BaseAction, TChannel extends BaseChannel = BaseChannel, TState extends BaseState = BaseState> = Omit<IntegrationDefinitionOutput, 'public' | 'version' | 'configuration' | 'events' | 'actions' | 'channels' | 'states'> & IntegrationDefinitionVersion & {
703
- configuration?: Merge<ConfigurationDefinition, SchemaDefinition<TConfig>>;
52
+ version: '0.2.0' | '0.0.1';
53
+ title?: string;
54
+ description?: string;
55
+ icon?: string;
56
+ readme?: string;
57
+ configuration?: ConfigurationDefinition<TConfig>;
704
58
  events?: {
705
- [K in keyof TEvent]: Merge<EventDefinition, SchemaDefinition<TEvent[K]>>;
59
+ [K in keyof TEvents]: EventDefinition<TEvents[K]>;
706
60
  };
707
61
  actions?: {
708
- [K in keyof TAction]: Merge<ActionDefinition, {
709
- ['input']: SchemaDefinition<Cast<TAction[K]['input'], AnyZodObject>>;
710
- ['output']: SchemaDefinition<Cast<TAction[K]['output'], AnyZodObject>>;
711
- }>;
62
+ [K in keyof TActions]: ActionDefinition<TActions[K]>;
712
63
  };
713
64
  channels?: {
714
- [K in keyof TChannel]: Merge<ChannelDefinition, {
715
- messages: {
716
- [L in keyof TChannel[K]]: Merge<MessageDefinition, SchemaDefinition<TChannel[K][L]>>;
717
- };
718
- }>;
65
+ [K in keyof TChannels]: ChannelDefinition<TChannels[K]>;
719
66
  };
720
67
  states?: {
721
- [K in keyof TState]: Merge<StateDefinition, SchemaDefinition<TState[K]>>;
68
+ [K in keyof TStates]: StateDefinition<TStates[K]>;
722
69
  };
70
+ user?: UserDefinition;
71
+ secrets?: string[];
723
72
  };
724
- export declare class IntegrationDefinition<TConfig extends BaseConfig = BaseConfig, TEvent extends BaseEvent = BaseEvent, TAction extends BaseAction = BaseAction, TChannel extends BaseChannel = BaseChannel, TState extends BaseState = BaseState> {
725
- readonly name: IntegrationDefinitionOutput['name'];
726
- readonly version: IntegrationDefinitionOutput['version'];
727
- readonly icon: IntegrationDefinitionOutput['icon'];
728
- readonly readme: IntegrationDefinitionOutput['readme'];
729
- readonly title: IntegrationDefinitionOutput['title'];
730
- readonly description: IntegrationDefinitionOutput['description'];
731
- readonly configuration: IntegrationDefinitionOutput['configuration'];
732
- readonly events: IntegrationDefinitionOutput['events'];
733
- readonly actions: IntegrationDefinitionOutput['actions'];
734
- readonly channels: IntegrationDefinitionOutput['channels'];
735
- readonly states: IntegrationDefinitionOutput['states'];
736
- readonly user: IntegrationDefinitionOutput['user'];
737
- readonly secrets: IntegrationDefinitionOutput['secrets'];
738
- constructor(props: IntegrationDefinitionProps<TConfig, TEvent, TAction, TChannel, TState>);
73
+ export declare class IntegrationDefinition<TConfig extends BaseConfig = BaseConfig, TEvents extends BaseEvents = BaseEvents, TActions extends BaseActions = BaseActions, TChannels extends BaseChannels = BaseChannels, TStates extends BaseStates = BaseStates> {
74
+ readonly name: IntegrationDefinitionProps<TConfig, TEvents, TActions, TChannels, TStates>['name'];
75
+ readonly version: IntegrationDefinitionProps<TConfig, TEvents, TActions, TChannels, TStates>['version'];
76
+ readonly title: IntegrationDefinitionProps<TConfig, TEvents, TActions, TChannels, TStates>['title'];
77
+ readonly description: IntegrationDefinitionProps<TConfig, TEvents, TActions, TChannels, TStates>['description'];
78
+ readonly icon: IntegrationDefinitionProps<TConfig, TEvents, TActions, TChannels, TStates>['icon'];
79
+ readonly readme: IntegrationDefinitionProps<TConfig, TEvents, TActions, TChannels, TStates>['readme'];
80
+ readonly configuration: IntegrationDefinitionProps<TConfig, TEvents, TActions, TChannels, TStates>['configuration'];
81
+ readonly events: IntegrationDefinitionProps<TConfig, TEvents, TActions, TChannels, TStates>['events'];
82
+ readonly actions: IntegrationDefinitionProps<TConfig, TEvents, TActions, TChannels, TStates>['actions'];
83
+ readonly channels: IntegrationDefinitionProps<TConfig, TEvents, TActions, TChannels, TStates>['channels'];
84
+ readonly states: IntegrationDefinitionProps<TConfig, TEvents, TActions, TChannels, TStates>['states'];
85
+ readonly user: IntegrationDefinitionProps<TConfig, TEvents, TActions, TChannels, TStates>['user'];
86
+ readonly secrets: IntegrationDefinitionProps<TConfig, TEvents, TActions, TChannels, TStates>['secrets'];
87
+ constructor(props: IntegrationDefinitionProps<TConfig, TEvents, TActions, TChannels, TStates>);
739
88
  }
740
89
  export {};