@botpress/sdk 0.0.5 → 0.0.7

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,56 +1,84 @@
1
- import type { Merge } from 'type-fest';
2
1
  import { z } from 'zod';
3
- export declare const schemaSchema: z.ZodObject<{}, "passthrough", z.ZodTypeAny, {}, {}>;
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
4
  export declare const configurationDefinitionSchema: z.ZodObject<{
5
- schema: z.ZodObject<{}, "passthrough", z.ZodTypeAny, {}, {}>;
5
+ schema: z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>;
6
6
  }, "strip", z.ZodTypeAny, {
7
- schema: {};
7
+ schema: {} & {
8
+ [k: string]: unknown;
9
+ };
8
10
  }, {
9
- schema: {};
11
+ schema: {} & {
12
+ [k: string]: unknown;
13
+ };
10
14
  }>;
11
15
  export declare const eventDefinitionSchema: z.ZodObject<{
12
- schema: z.ZodObject<{}, "passthrough", z.ZodTypeAny, {}, {}>;
16
+ schema: z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>;
13
17
  }, "strip", z.ZodTypeAny, {
14
- schema: {};
18
+ schema: {} & {
19
+ [k: string]: unknown;
20
+ };
15
21
  }, {
16
- schema: {};
22
+ schema: {} & {
23
+ [k: string]: unknown;
24
+ };
17
25
  }>;
18
26
  export declare const actionDefinitionSchema: z.ZodObject<{
19
27
  input: z.ZodObject<{
20
- schema: z.ZodObject<{}, "passthrough", z.ZodTypeAny, {}, {}>;
28
+ schema: z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>;
21
29
  }, "strip", z.ZodTypeAny, {
22
- schema: {};
30
+ schema: {} & {
31
+ [k: string]: unknown;
32
+ };
23
33
  }, {
24
- schema: {};
34
+ schema: {} & {
35
+ [k: string]: unknown;
36
+ };
25
37
  }>;
26
38
  output: z.ZodObject<{
27
- schema: z.ZodObject<{}, "passthrough", z.ZodTypeAny, {}, {}>;
39
+ schema: z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>;
28
40
  }, "strip", z.ZodTypeAny, {
29
- schema: {};
41
+ schema: {} & {
42
+ [k: string]: unknown;
43
+ };
30
44
  }, {
31
- schema: {};
45
+ schema: {} & {
46
+ [k: string]: unknown;
47
+ };
32
48
  }>;
33
49
  }, "strip", z.ZodTypeAny, {
34
50
  input: {
35
- schema: {};
51
+ schema: {} & {
52
+ [k: string]: unknown;
53
+ };
36
54
  };
37
55
  output: {
38
- schema: {};
56
+ schema: {} & {
57
+ [k: string]: unknown;
58
+ };
39
59
  };
40
60
  }, {
41
61
  input: {
42
- schema: {};
62
+ schema: {} & {
63
+ [k: string]: unknown;
64
+ };
43
65
  };
44
66
  output: {
45
- schema: {};
67
+ schema: {} & {
68
+ [k: string]: unknown;
69
+ };
46
70
  };
47
71
  }>;
48
72
  export declare const messageDefinitionSchema: z.ZodObject<{
49
- schema: z.ZodObject<{}, "passthrough", z.ZodTypeAny, {}, {}>;
73
+ schema: z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>;
50
74
  }, "strip", z.ZodTypeAny, {
51
- schema: {};
75
+ schema: {} & {
76
+ [k: string]: unknown;
77
+ };
52
78
  }, {
53
- schema: {};
79
+ schema: {} & {
80
+ [k: string]: unknown;
81
+ };
54
82
  }>;
55
83
  export declare const tagsDefinitionSchema: z.ZodObject<{
56
84
  conversations: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
@@ -78,15 +106,23 @@ export declare const channelDefinitionSchema: z.ZodObject<{
78
106
  messages?: string[] | undefined;
79
107
  }>>;
80
108
  messages: z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodObject<{
81
- schema: z.ZodObject<{}, "passthrough", z.ZodTypeAny, {}, {}>;
109
+ schema: z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>;
82
110
  }, "strip", z.ZodTypeAny, {
83
- schema: {};
111
+ schema: {} & {
112
+ [k: string]: unknown;
113
+ };
84
114
  }, {
85
- schema: {};
115
+ schema: {} & {
116
+ [k: string]: unknown;
117
+ };
86
118
  }>>, Record<string, {
87
- schema: {};
119
+ schema: {} & {
120
+ [k: string]: unknown;
121
+ };
88
122
  }>, Record<string, {
89
- schema: {};
123
+ schema: {} & {
124
+ [k: string]: unknown;
125
+ };
90
126
  }>>;
91
127
  conversation: z.ZodOptional<z.ZodObject<{
92
128
  creation: z.ZodObject<{
@@ -111,43 +147,51 @@ export declare const channelDefinitionSchema: z.ZodObject<{
111
147
  };
112
148
  }>>;
113
149
  }, "strip", z.ZodTypeAny, {
150
+ messages: Record<string, {
151
+ schema: {} & {
152
+ [k: string]: unknown;
153
+ };
154
+ }>;
155
+ tags?: {
156
+ conversations?: string[] | undefined;
157
+ messages?: string[] | undefined;
158
+ } | undefined;
114
159
  conversation?: {
115
160
  creation: {
116
161
  enabled: boolean;
117
162
  requiredTags: string[];
118
163
  };
119
164
  } | undefined;
165
+ }, {
166
+ messages: Record<string, {
167
+ schema: {} & {
168
+ [k: string]: unknown;
169
+ };
170
+ }>;
120
171
  tags?: {
121
172
  conversations?: string[] | undefined;
122
173
  messages?: string[] | undefined;
123
174
  } | undefined;
124
- messages: Record<string, {
125
- schema: {};
126
- }>;
127
- }, {
128
175
  conversation?: {
129
176
  creation: {
130
177
  enabled: boolean;
131
178
  requiredTags: string[];
132
179
  };
133
180
  } | undefined;
134
- tags?: {
135
- conversations?: string[] | undefined;
136
- messages?: string[] | undefined;
137
- } | undefined;
138
- messages: Record<string, {
139
- schema: {};
140
- }>;
141
181
  }>;
142
182
  export declare const stateDefinitionSchema: z.ZodObject<{
143
183
  type: z.ZodUnion<[z.ZodLiteral<"integration">, z.ZodLiteral<"conversation">, z.ZodLiteral<"user">]>;
144
- schema: z.ZodObject<{}, "passthrough", z.ZodTypeAny, {}, {}>;
184
+ schema: z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>;
145
185
  }, "strip", z.ZodTypeAny, {
146
186
  type: "user" | "conversation" | "integration";
147
- schema: {};
187
+ schema: {} & {
188
+ [k: string]: unknown;
189
+ };
148
190
  }, {
149
191
  type: "user" | "conversation" | "integration";
150
- schema: {};
192
+ schema: {} & {
193
+ [k: string]: unknown;
194
+ };
151
195
  }>;
152
196
  export declare const integrationDefinitionSchema: z.ZodObject<{
153
197
  name: z.ZodString;
@@ -165,47 +209,71 @@ export declare const integrationDefinitionSchema: z.ZodObject<{
165
209
  users?: string[] | undefined;
166
210
  }>>;
167
211
  configuration: z.ZodOptional<z.ZodObject<{
168
- schema: z.ZodObject<{}, "passthrough", z.ZodTypeAny, {}, {}>;
212
+ schema: z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>;
169
213
  }, "strip", z.ZodTypeAny, {
170
- schema: {};
214
+ schema: {} & {
215
+ [k: string]: unknown;
216
+ };
171
217
  }, {
172
- schema: {};
218
+ schema: {} & {
219
+ [k: string]: unknown;
220
+ };
173
221
  }>>;
174
222
  events: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
175
- schema: z.ZodObject<{}, "passthrough", z.ZodTypeAny, {}, {}>;
223
+ schema: z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>;
176
224
  }, "strip", z.ZodTypeAny, {
177
- schema: {};
225
+ schema: {} & {
226
+ [k: string]: unknown;
227
+ };
178
228
  }, {
179
- schema: {};
229
+ schema: {} & {
230
+ [k: string]: unknown;
231
+ };
180
232
  }>>>;
181
233
  actions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
182
234
  input: z.ZodObject<{
183
- schema: z.ZodObject<{}, "passthrough", z.ZodTypeAny, {}, {}>;
235
+ schema: z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>;
184
236
  }, "strip", z.ZodTypeAny, {
185
- schema: {};
237
+ schema: {} & {
238
+ [k: string]: unknown;
239
+ };
186
240
  }, {
187
- schema: {};
241
+ schema: {} & {
242
+ [k: string]: unknown;
243
+ };
188
244
  }>;
189
245
  output: z.ZodObject<{
190
- schema: z.ZodObject<{}, "passthrough", z.ZodTypeAny, {}, {}>;
246
+ schema: z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>;
191
247
  }, "strip", z.ZodTypeAny, {
192
- schema: {};
248
+ schema: {} & {
249
+ [k: string]: unknown;
250
+ };
193
251
  }, {
194
- schema: {};
252
+ schema: {} & {
253
+ [k: string]: unknown;
254
+ };
195
255
  }>;
196
256
  }, "strip", z.ZodTypeAny, {
197
257
  input: {
198
- schema: {};
258
+ schema: {} & {
259
+ [k: string]: unknown;
260
+ };
199
261
  };
200
262
  output: {
201
- schema: {};
263
+ schema: {} & {
264
+ [k: string]: unknown;
265
+ };
202
266
  };
203
267
  }, {
204
268
  input: {
205
- schema: {};
269
+ schema: {} & {
270
+ [k: string]: unknown;
271
+ };
206
272
  };
207
273
  output: {
208
- schema: {};
274
+ schema: {} & {
275
+ [k: string]: unknown;
276
+ };
209
277
  };
210
278
  }>>>;
211
279
  channels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
@@ -221,15 +289,23 @@ export declare const integrationDefinitionSchema: z.ZodObject<{
221
289
  messages?: string[] | undefined;
222
290
  }>>;
223
291
  messages: z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodObject<{
224
- schema: z.ZodObject<{}, "passthrough", z.ZodTypeAny, {}, {}>;
292
+ schema: z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>;
225
293
  }, "strip", z.ZodTypeAny, {
226
- schema: {};
294
+ schema: {} & {
295
+ [k: string]: unknown;
296
+ };
227
297
  }, {
228
- schema: {};
298
+ schema: {} & {
299
+ [k: string]: unknown;
300
+ };
229
301
  }>>, Record<string, {
230
- schema: {};
302
+ schema: {} & {
303
+ [k: string]: unknown;
304
+ };
231
305
  }>, Record<string, {
232
- schema: {};
306
+ schema: {} & {
307
+ [k: string]: unknown;
308
+ };
233
309
  }>>;
234
310
  conversation: z.ZodOptional<z.ZodObject<{
235
311
  creation: z.ZodObject<{
@@ -254,43 +330,51 @@ export declare const integrationDefinitionSchema: z.ZodObject<{
254
330
  };
255
331
  }>>;
256
332
  }, "strip", z.ZodTypeAny, {
333
+ messages: Record<string, {
334
+ schema: {} & {
335
+ [k: string]: unknown;
336
+ };
337
+ }>;
338
+ tags?: {
339
+ conversations?: string[] | undefined;
340
+ messages?: string[] | undefined;
341
+ } | undefined;
257
342
  conversation?: {
258
343
  creation: {
259
344
  enabled: boolean;
260
345
  requiredTags: string[];
261
346
  };
262
347
  } | undefined;
348
+ }, {
349
+ messages: Record<string, {
350
+ schema: {} & {
351
+ [k: string]: unknown;
352
+ };
353
+ }>;
263
354
  tags?: {
264
355
  conversations?: string[] | undefined;
265
356
  messages?: string[] | undefined;
266
357
  } | undefined;
267
- messages: Record<string, {
268
- schema: {};
269
- }>;
270
- }, {
271
358
  conversation?: {
272
359
  creation: {
273
360
  enabled: boolean;
274
361
  requiredTags: string[];
275
362
  };
276
363
  } | undefined;
277
- tags?: {
278
- conversations?: string[] | undefined;
279
- messages?: string[] | undefined;
280
- } | undefined;
281
- messages: Record<string, {
282
- schema: {};
283
- }>;
284
364
  }>>>;
285
365
  states: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
286
366
  type: z.ZodUnion<[z.ZodLiteral<"integration">, z.ZodLiteral<"conversation">, z.ZodLiteral<"user">]>;
287
- schema: z.ZodObject<{}, "passthrough", z.ZodTypeAny, {}, {}>;
367
+ schema: z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>;
288
368
  }, "strip", z.ZodTypeAny, {
289
369
  type: "user" | "conversation" | "integration";
290
- schema: {};
370
+ schema: {} & {
371
+ [k: string]: unknown;
372
+ };
291
373
  }, {
292
374
  type: "user" | "conversation" | "integration";
293
- schema: {};
375
+ schema: {} & {
376
+ [k: string]: unknown;
377
+ };
294
378
  }>>>;
295
379
  user: z.ZodOptional<z.ZodObject<{
296
380
  creation: z.ZodObject<{
@@ -316,103 +400,127 @@ export declare const integrationDefinitionSchema: z.ZodObject<{
316
400
  }>>;
317
401
  public: z.ZodOptional<z.ZodBoolean>;
318
402
  }, "strip", z.ZodTypeAny, {
319
- user?: {
320
- creation: {
321
- enabled: boolean;
322
- requiredTags: string[];
323
- };
324
- } | undefined;
325
- configuration?: {
326
- schema: {};
327
- } | undefined;
403
+ name: string;
404
+ version: string;
405
+ icon?: string | undefined;
406
+ title?: string | undefined;
407
+ description?: string | undefined;
328
408
  tags?: {
329
409
  users?: string[] | undefined;
330
410
  } | undefined;
411
+ configuration?: {
412
+ schema: {} & {
413
+ [k: string]: unknown;
414
+ };
415
+ } | undefined;
416
+ events?: Record<string, {
417
+ schema: {} & {
418
+ [k: string]: unknown;
419
+ };
420
+ }> | undefined;
331
421
  actions?: Record<string, {
332
422
  input: {
333
- schema: {};
423
+ schema: {} & {
424
+ [k: string]: unknown;
425
+ };
334
426
  };
335
427
  output: {
336
- schema: {};
428
+ schema: {} & {
429
+ [k: string]: unknown;
430
+ };
337
431
  };
338
432
  }> | undefined;
339
433
  channels?: Record<string, {
434
+ messages: Record<string, {
435
+ schema: {} & {
436
+ [k: string]: unknown;
437
+ };
438
+ }>;
439
+ tags?: {
440
+ conversations?: string[] | undefined;
441
+ messages?: string[] | undefined;
442
+ } | undefined;
340
443
  conversation?: {
341
444
  creation: {
342
445
  enabled: boolean;
343
446
  requiredTags: string[];
344
447
  };
345
448
  } | undefined;
346
- tags?: {
347
- conversations?: string[] | undefined;
348
- messages?: string[] | undefined;
349
- } | undefined;
350
- messages: Record<string, {
351
- schema: {};
352
- }>;
353
- }> | undefined;
354
- icon?: string | undefined;
355
- title?: string | undefined;
356
- description?: string | undefined;
357
- events?: Record<string, {
358
- schema: {};
359
449
  }> | undefined;
360
450
  states?: Record<string, {
361
451
  type: "user" | "conversation" | "integration";
362
- schema: {};
452
+ schema: {} & {
453
+ [k: string]: unknown;
454
+ };
363
455
  }> | undefined;
364
- public?: boolean | undefined;
365
- name: string;
366
- version: string;
367
- }, {
368
456
  user?: {
369
457
  creation: {
370
458
  enabled: boolean;
371
459
  requiredTags: string[];
372
460
  };
373
461
  } | undefined;
374
- configuration?: {
375
- schema: {};
376
- } | undefined;
462
+ public?: boolean | undefined;
463
+ }, {
464
+ name: string;
465
+ version: string;
466
+ icon?: string | undefined;
467
+ title?: string | undefined;
468
+ description?: string | undefined;
377
469
  tags?: {
378
470
  users?: string[] | undefined;
379
471
  } | undefined;
472
+ configuration?: {
473
+ schema: {} & {
474
+ [k: string]: unknown;
475
+ };
476
+ } | undefined;
477
+ events?: Record<string, {
478
+ schema: {} & {
479
+ [k: string]: unknown;
480
+ };
481
+ }> | undefined;
380
482
  actions?: Record<string, {
381
483
  input: {
382
- schema: {};
484
+ schema: {} & {
485
+ [k: string]: unknown;
486
+ };
383
487
  };
384
488
  output: {
385
- schema: {};
489
+ schema: {} & {
490
+ [k: string]: unknown;
491
+ };
386
492
  };
387
493
  }> | undefined;
388
494
  channels?: Record<string, {
495
+ messages: Record<string, {
496
+ schema: {} & {
497
+ [k: string]: unknown;
498
+ };
499
+ }>;
500
+ tags?: {
501
+ conversations?: string[] | undefined;
502
+ messages?: string[] | undefined;
503
+ } | undefined;
389
504
  conversation?: {
390
505
  creation: {
391
506
  enabled: boolean;
392
507
  requiredTags: string[];
393
508
  };
394
509
  } | undefined;
395
- tags?: {
396
- conversations?: string[] | undefined;
397
- messages?: string[] | undefined;
398
- } | undefined;
399
- messages: Record<string, {
400
- schema: {};
401
- }>;
402
- }> | undefined;
403
- icon?: string | undefined;
404
- title?: string | undefined;
405
- description?: string | undefined;
406
- events?: Record<string, {
407
- schema: {};
408
510
  }> | undefined;
409
511
  states?: Record<string, {
410
512
  type: "user" | "conversation" | "integration";
411
- schema: {};
513
+ schema: {} & {
514
+ [k: string]: unknown;
515
+ };
412
516
  }> | undefined;
517
+ user?: {
518
+ creation: {
519
+ enabled: boolean;
520
+ requiredTags: string[];
521
+ };
522
+ } | undefined;
413
523
  public?: boolean | undefined;
414
- name: string;
415
- version: string;
416
524
  }>;
417
525
  export type ConfigurationDefinition = z.infer<typeof configurationDefinitionSchema>;
418
526
  export type EventDefinition = z.infer<typeof eventDefinitionSchema>;
@@ -422,31 +530,41 @@ export type ActionDefinition = z.infer<typeof actionDefinitionSchema>;
422
530
  export type MessageDefinition = z.infer<typeof messageDefinitionSchema>;
423
531
  export type StateDefinition = z.infer<typeof stateDefinitionSchema>;
424
532
  type IntegrationDefinitionOutput = z.infer<typeof integrationDefinitionSchema>;
425
- export type IntegrationDefinitionProps<T = z.ZodSchema<any>> = Omit<IntegrationDefinitionOutput, 'configuration' | 'events' | 'actions' | 'channels' | 'states'> & {
426
- configuration?: Merge<ConfigurationDefinition, {
427
- schema: T;
428
- }>;
429
- events?: Record<string, Merge<EventDefinition, {
430
- schema: T;
431
- }>>;
432
- actions?: Record<string, Merge<ActionDefinition, {
433
- input: {
434
- schema: T;
435
- };
436
- output: {
437
- schema: T;
438
- };
439
- }>>;
440
- channels?: Record<string, Merge<ChannelDefinition, {
441
- messages: Record<string, Merge<MessageDefinition, {
442
- schema: T;
443
- }>>;
444
- }>>;
445
- states?: Record<string, Merge<StateDefinition, {
446
- schema: T;
447
- }>>;
533
+ type AnyZodObject = z.ZodObject<any>;
534
+ type Merge<A extends object, B extends object> = Omit<A, keyof B> & B;
535
+ type Cast<T, U> = T extends U ? T : U;
536
+ type BaseConfig = AnyZodObject;
537
+ type BaseEvent = Record<string, AnyZodObject>;
538
+ type BaseAction = Record<string, Record<'input' | 'output', AnyZodObject>>;
539
+ type BaseChannel = Record<string, Record<string, AnyZodObject>>;
540
+ type BaseState = Record<string, AnyZodObject>;
541
+ export type IntegrationDefinitionProps<TConfig extends BaseConfig, TEvent extends BaseEvent, TAction extends BaseAction, TChannel extends BaseChannel, TState extends BaseState> = Omit<IntegrationDefinitionOutput, 'configuration' | 'events' | 'actions' | 'channels' | 'states'> & {
542
+ configuration?: Merge<ConfigurationDefinition, SchemaDefinition<TConfig>>;
543
+ events?: {
544
+ [K in keyof TEvent]: Merge<EventDefinition, SchemaDefinition<TEvent[K]>>;
545
+ };
546
+ /**
547
+ * TODO:
548
+ * - remove the need to cast
549
+ * - the type inference breaks when using keys "input" and "output" instead of keyof TAction[K]
550
+ */
551
+ actions?: {
552
+ [K in keyof TAction]: Merge<ActionDefinition, {
553
+ [L in keyof TAction[K]]: SchemaDefinition<Cast<TAction[K][L], AnyZodObject>>;
554
+ }>;
555
+ };
556
+ channels?: {
557
+ [K in keyof TChannel]: Merge<ChannelDefinition, {
558
+ messages: {
559
+ [L in keyof TChannel[K]]: Merge<MessageDefinition, SchemaDefinition<TChannel[K][L]>>;
560
+ };
561
+ }>;
562
+ };
563
+ states?: {
564
+ [K in keyof TState]: Merge<StateDefinition, SchemaDefinition<TState[K]>>;
565
+ };
448
566
  };
449
- export declare class IntegrationDefinition {
567
+ export declare class IntegrationDefinition<TConfig extends BaseConfig = BaseConfig, TEvent extends BaseEvent = BaseEvent, TAction extends BaseAction = BaseAction, TChannel extends BaseChannel = BaseChannel, TState extends BaseState = BaseState> {
450
568
  readonly name: IntegrationDefinitionOutput['name'];
451
569
  readonly version: IntegrationDefinitionOutput['version'];
452
570
  readonly icon: IntegrationDefinitionOutput['icon'];
@@ -460,6 +578,6 @@ export declare class IntegrationDefinition {
460
578
  readonly states: IntegrationDefinitionOutput['states'];
461
579
  readonly user: IntegrationDefinitionOutput['user'];
462
580
  readonly public: IntegrationDefinitionOutput['public'];
463
- constructor(props: IntegrationDefinitionProps);
581
+ constructor(props: IntegrationDefinitionProps<TConfig, TEvent, TAction, TChannel, TState>);
464
582
  }
465
583
  export {};
@@ -0,0 +1,16 @@
1
+ import type { z } from 'zod';
2
+ import zodToJsonSchema from 'zod-to-json-schema';
3
+ export type SchemaOptions<T> = {
4
+ title: string;
5
+ examples: T[];
6
+ };
7
+ type IsEmptyObject<T> = keyof T extends never ? true : false;
8
+ export type UiDefinition<TSchema extends z.ZodObject<any>> = IsEmptyObject<z.infer<TSchema>> extends true ? Record<string, never> : {
9
+ [K in keyof z.infer<TSchema>]: Partial<SchemaOptions<z.infer<TSchema>[K]>>;
10
+ };
11
+ export type SchemaDefinition<TSchema extends z.ZodObject<any>> = {
12
+ schema: TSchema;
13
+ ui?: Partial<UiDefinition<TSchema>>;
14
+ };
15
+ export declare function schemaDefinitionToJsonSchema(definition: SchemaDefinition<z.ZodObject<any>>): ReturnType<typeof zodToJsonSchema>;
16
+ export {};