@botpress/sdk 5.4.4 → 6.0.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.
@@ -13,6 +13,14 @@ type ConversationResponse<TIntegration extends common.BaseIntegration, ChannelNa
13
13
  }>;
14
14
  };
15
15
  }>;
16
+ type GetOrCreateConversationResponse<TIntegration extends common.BaseIntegration, ChannelName extends keyof TIntegration['channels'] = keyof TIntegration['channels']> = utils.ValueOf<{
17
+ [TChannelName in ChannelName]: utils.Merge<Awaited<Res<client.Client['getOrCreateConversation']>>, {
18
+ conversation: utils.Merge<Awaited<Res<client.Client['getOrCreateConversation']>>['conversation'], {
19
+ channel: TChannelName;
20
+ tags: commonTypes.ToTags<keyof TIntegration['channels'][TChannelName]['conversation']['tags']>;
21
+ }>;
22
+ }>;
23
+ }>;
16
24
  export type CreateConversation<TIntegration extends common.BaseIntegration> = <ChannelName extends keyof TIntegration['channels']>(x: {
17
25
  channel: utils.Cast<ChannelName, string>;
18
26
  tags: commonTypes.ToTags<keyof GetChannelByName<TIntegration, ChannelName>['conversation']['tags']>;
@@ -26,7 +34,7 @@ export type GetOrCreateConversation<TIntegration extends common.BaseIntegration>
26
34
  channel: utils.Cast<ChannelName, string>;
27
35
  tags: commonTypes.ToTags<TTags>;
28
36
  discriminateByTags?: NoInfer<utils.Cast<TTags[], string[]>>;
29
- }>) => Promise<ConversationResponse<TIntegration, ChannelName>>;
37
+ }>) => Promise<GetOrCreateConversationResponse<TIntegration, ChannelName>>;
30
38
  export type UpdateConversation<TIntegration extends common.BaseIntegration> = (x: utils.Merge<Arg<client.Client['updateConversation']>, {
31
39
  tags?: commonTypes.ToTags<ConversationTags<TIntegration>>;
32
40
  }>) => Promise<ConversationResponse<TIntegration>>;
@@ -1,9 +1,9 @@
1
- import { ZuiObjectSchema } from '../../zui';
2
- export type BaseConfig = ZuiObjectSchema;
1
+ import { z } from '../../zui';
2
+ export type BaseConfig = z.ZuiObjectSchema;
3
3
  export type BaseConfigs = Record<string, BaseConfig>;
4
- export type BaseEvents = Record<string, ZuiObjectSchema>;
5
- export type BaseActions = Record<string, ZuiObjectSchema>;
6
- export type BaseMessages = Record<string, ZuiObjectSchema>;
4
+ export type BaseEvents = Record<string, z.ZuiObjectSchema>;
5
+ export type BaseActions = Record<string, z.ZuiObjectSchema>;
6
+ export type BaseMessages = Record<string, z.ZuiObjectSchema>;
7
7
  export type BaseChannels = Record<string, BaseMessages>;
8
- export type BaseStates = Record<string, ZuiObjectSchema>;
9
- export type BaseEntities = Record<string, ZuiObjectSchema>;
8
+ export type BaseStates = Record<string, z.ZuiObjectSchema>;
9
+ export type BaseEntities = Record<string, z.ZuiObjectSchema>;
@@ -123,4 +123,5 @@ export declare class IntegrationDefinition<TName extends string = string, TVersi
123
123
  private _mergeEvents;
124
124
  private _mergeChannels;
125
125
  private _mergeMessage;
126
+ private _mergeObjectSchemas;
126
127
  }
@@ -1,5 +1,5 @@
1
1
  import { SchemaDefinition } from '../../schema';
2
- import { ZuiObjectSchema } from '../../zui';
2
+ import { z } from '../../zui';
3
3
  import { BaseConfig, BaseEvents, BaseActions, BaseMessages, BaseChannels, BaseStates, BaseEntities, BaseConfigs } from './generic';
4
4
  export type TagDefinition = {
5
5
  title?: string;
@@ -45,7 +45,7 @@ export type ActionDefinition<TAction extends BaseActions[string] = BaseActions[s
45
45
  title?: string;
46
46
  description?: string;
47
47
  input: SchemaDefinition<TAction>;
48
- output: SchemaDefinition<ZuiObjectSchema>;
48
+ output: SchemaDefinition<z.ZuiObjectSchema>;
49
49
  billable?: boolean;
50
50
  cacheable?: boolean;
51
51
  attributes?: Record<string, string>;
@@ -1,3 +1,4 @@
1
+ import { z } from '@bpinternal/zui';
1
2
  import { IntegrationContext } from './types';
2
- export declare const integrationOperationSchema: import("@bpinternal/zui").ZodEnum<["webhook_received", "message_created", "action_triggered", "register", "unregister", "ping", "create_user", "create_conversation"]>;
3
+ export declare const integrationOperationSchema: z.ZodEnum<["webhook_received", "message_created", "action_triggered", "register", "unregister", "ping", "create_user", "create_conversation"]>;
3
4
  export declare const extractContext: (headers: Record<string, string | undefined>) => IntegrationContext;
@@ -1,21 +1,21 @@
1
1
  import { ActionDefinition, ChannelDefinition, EntityDefinition, EventDefinition } from '../integration/definition';
2
- import { ZuiObjectSchema, GenericZuiSchema, ZodRef } from '../zui';
3
- type BaseEvents = Record<string, ZuiObjectSchema>;
4
- type BaseActions = Record<string, ZuiObjectSchema>;
5
- type BaseMessages = Record<string, ZuiObjectSchema>;
2
+ import { z } from '../zui';
3
+ type BaseEvents = Record<string, z.ZuiObjectSchema>;
4
+ type BaseActions = Record<string, z.ZuiObjectSchema>;
5
+ type BaseMessages = Record<string, z.ZuiObjectSchema>;
6
6
  type BaseChannels = Record<string, BaseMessages>;
7
- type BaseEntities = Record<string, ZuiObjectSchema>;
7
+ type BaseEntities = Record<string, z.ZuiObjectSchema>;
8
8
  type EntityReferences<TEntities extends BaseEntities> = {
9
- [K in keyof TEntities]: ZodRef;
9
+ [K in keyof TEntities]: z.ZodRef;
10
10
  };
11
11
  type GenericEventDefinition<TEntities extends BaseEntities, TEvent extends BaseEvents[string] = BaseEvents[string]> = {
12
- schema: GenericZuiSchema<EntityReferences<TEntities>, TEvent>;
12
+ schema: z.GenericZuiSchema<EntityReferences<TEntities>, TEvent>;
13
13
  attributes?: Record<string, string>;
14
14
  };
15
15
  type GenericChannelDefinition<TEntities extends BaseEntities, TChannel extends BaseChannels[string] = BaseChannels[string]> = {
16
16
  messages: {
17
17
  [K in keyof TChannel]: {
18
- schema: GenericZuiSchema<EntityReferences<TEntities>, TChannel[K]>;
18
+ schema: z.GenericZuiSchema<EntityReferences<TEntities>, TChannel[K]>;
19
19
  };
20
20
  };
21
21
  };
@@ -25,10 +25,10 @@ type GenericActionDefinition<TEntities extends BaseEntities, TAction extends Bas
25
25
  billable?: boolean;
26
26
  cacheable?: boolean;
27
27
  input: {
28
- schema: GenericZuiSchema<EntityReferences<TEntities>, TAction>;
28
+ schema: z.GenericZuiSchema<EntityReferences<TEntities>, TAction>;
29
29
  };
30
30
  output: {
31
- schema: GenericZuiSchema<EntityReferences<TEntities>, ZuiObjectSchema>;
31
+ schema: z.GenericZuiSchema<EntityReferences<TEntities>, z.ZuiObjectSchema>;
32
32
  };
33
33
  attributes?: Record<string, string>;
34
34
  };
@@ -1,10 +1,10 @@
1
1
  import { ActionOverrideProps, ChannelOverrideProps, EventOverrideProps, InterfaceExtension, ResolvedInterface } from '../integration';
2
2
  import { InterfacePackage } from '../package';
3
- import { ZuiObjectSchema } from '../zui';
3
+ import { z } from '../zui';
4
4
  type ResolveInterfaceInput = InterfacePackage & {
5
5
  entities: Record<string, {
6
6
  name: string;
7
- schema: ZuiObjectSchema;
7
+ schema: z.ZuiObjectSchema;
8
8
  }>;
9
9
  actions: Record<string, ActionOverrideProps>;
10
10
  events: Record<string, EventOverrideProps>;
package/dist/message.d.ts CHANGED
@@ -1,9 +1,10 @@
1
+ import { z } from './zui';
1
2
  /**
2
3
  * @deprecated use `text` instead
3
4
  */
4
5
  export declare const markdown: {
5
- schema: import("@bpinternal/zui").ZodObject<{
6
- markdown: import("@bpinternal/zui").ZodString;
6
+ schema: z.ZodObject<{
7
+ markdown: z.ZodString;
7
8
  }, "strip", {
8
9
  markdown: string;
9
10
  }, {
@@ -16,11 +17,11 @@ export declare const markdown: {
16
17
  * @deprecated use `bloc` instead
17
18
  */
18
19
  export declare const markdownBloc: {
19
- schema: import("@bpinternal/zui").ZodObject<{
20
- items: import("@bpinternal/zui").ZodArray<import("@bpinternal/zui").ZodUnion<[import("@bpinternal/zui").ZodObject<{
21
- type: import("@bpinternal/zui").ZodLiteral<"text">;
22
- payload: import("@bpinternal/zui").ZodObject<{
23
- text: import("@bpinternal/zui").ZodString;
20
+ schema: z.ZodObject<{
21
+ items: z.ZodArray<z.ZodUnion<[z.ZodObject<{
22
+ type: z.ZodLiteral<"text">;
23
+ payload: z.ZodObject<{
24
+ text: z.ZodString;
24
25
  }, "strip", {
25
26
  text: string;
26
27
  }, {
@@ -36,11 +37,11 @@ export declare const markdownBloc: {
36
37
  payload: {
37
38
  text: string;
38
39
  };
39
- }>, import("@bpinternal/zui").ZodObject<{
40
- type: import("@bpinternal/zui").ZodLiteral<"image">;
41
- payload: import("@bpinternal/zui").ZodObject<{
42
- imageUrl: import("@bpinternal/zui").ZodString;
43
- title: import("@bpinternal/zui").ZodOptional<import("@bpinternal/zui").ZodString>;
40
+ }>, z.ZodObject<{
41
+ type: z.ZodLiteral<"image">;
42
+ payload: z.ZodObject<{
43
+ imageUrl: z.ZodString;
44
+ title: z.ZodOptional<z.ZodString>;
44
45
  }, "strip", {
45
46
  imageUrl: string;
46
47
  title?: string | undefined;
@@ -60,11 +61,11 @@ export declare const markdownBloc: {
60
61
  imageUrl: string;
61
62
  title?: string | undefined;
62
63
  };
63
- }>, import("@bpinternal/zui").ZodObject<{
64
- type: import("@bpinternal/zui").ZodLiteral<"audio">;
65
- payload: import("@bpinternal/zui").ZodObject<{
66
- audioUrl: import("@bpinternal/zui").ZodString;
67
- title: import("@bpinternal/zui").ZodOptional<import("@bpinternal/zui").ZodString>;
64
+ }>, z.ZodObject<{
65
+ type: z.ZodLiteral<"audio">;
66
+ payload: z.ZodObject<{
67
+ audioUrl: z.ZodString;
68
+ title: z.ZodOptional<z.ZodString>;
68
69
  }, "strip", {
69
70
  audioUrl: string;
70
71
  title?: string | undefined;
@@ -84,11 +85,11 @@ export declare const markdownBloc: {
84
85
  audioUrl: string;
85
86
  title?: string | undefined;
86
87
  };
87
- }>, import("@bpinternal/zui").ZodObject<{
88
- type: import("@bpinternal/zui").ZodLiteral<"video">;
89
- payload: import("@bpinternal/zui").ZodObject<{
90
- videoUrl: import("@bpinternal/zui").ZodString;
91
- title: import("@bpinternal/zui").ZodOptional<import("@bpinternal/zui").ZodString>;
88
+ }>, z.ZodObject<{
89
+ type: z.ZodLiteral<"video">;
90
+ payload: z.ZodObject<{
91
+ videoUrl: z.ZodString;
92
+ title: z.ZodOptional<z.ZodString>;
92
93
  }, "strip", {
93
94
  videoUrl: string;
94
95
  title?: string | undefined;
@@ -108,11 +109,11 @@ export declare const markdownBloc: {
108
109
  videoUrl: string;
109
110
  title?: string | undefined;
110
111
  };
111
- }>, import("@bpinternal/zui").ZodObject<{
112
- type: import("@bpinternal/zui").ZodLiteral<"file">;
113
- payload: import("@bpinternal/zui").ZodObject<{
114
- fileUrl: import("@bpinternal/zui").ZodString;
115
- title: import("@bpinternal/zui").ZodOptional<import("@bpinternal/zui").ZodString>;
112
+ }>, z.ZodObject<{
113
+ type: z.ZodLiteral<"file">;
114
+ payload: z.ZodObject<{
115
+ fileUrl: z.ZodString;
116
+ title: z.ZodOptional<z.ZodString>;
116
117
  }, "strip", {
117
118
  fileUrl: string;
118
119
  title?: string | undefined;
@@ -132,13 +133,13 @@ export declare const markdownBloc: {
132
133
  fileUrl: string;
133
134
  title?: string | undefined;
134
135
  };
135
- }>, import("@bpinternal/zui").ZodObject<{
136
- type: import("@bpinternal/zui").ZodLiteral<"location">;
137
- payload: import("@bpinternal/zui").ZodObject<{
138
- latitude: import("@bpinternal/zui").ZodNumber;
139
- longitude: import("@bpinternal/zui").ZodNumber;
140
- address: import("@bpinternal/zui").ZodOptional<import("@bpinternal/zui").ZodString>;
141
- title: import("@bpinternal/zui").ZodOptional<import("@bpinternal/zui").ZodString>;
136
+ }>, z.ZodObject<{
137
+ type: z.ZodLiteral<"location">;
138
+ payload: z.ZodObject<{
139
+ latitude: z.ZodNumber;
140
+ longitude: z.ZodNumber;
141
+ address: z.ZodOptional<z.ZodString>;
142
+ title: z.ZodOptional<z.ZodString>;
142
143
  }, "strip", {
143
144
  latitude: number;
144
145
  longitude: number;
@@ -166,10 +167,10 @@ export declare const markdownBloc: {
166
167
  title?: string | undefined;
167
168
  address?: string | undefined;
168
169
  };
169
- }>, import("@bpinternal/zui").ZodObject<{
170
- type: import("@bpinternal/zui").ZodLiteral<"markdown">;
171
- payload: import("@bpinternal/zui").ZodObject<{
172
- markdown: import("@bpinternal/zui").ZodString;
170
+ }>, z.ZodObject<{
171
+ type: z.ZodLiteral<"markdown">;
172
+ payload: z.ZodObject<{
173
+ markdown: z.ZodString;
173
174
  }, "strip", {
174
175
  markdown: string;
175
176
  }, {
@@ -278,8 +279,8 @@ export declare const markdownBloc: {
278
279
  };
279
280
  export declare const defaults: {
280
281
  readonly text: {
281
- readonly schema: import("@bpinternal/zui").ZodObject<{
282
- text: import("@bpinternal/zui").ZodString;
282
+ readonly schema: z.ZodObject<{
283
+ text: z.ZodString;
283
284
  }, "strip", {
284
285
  text: string;
285
286
  }, {
@@ -287,9 +288,9 @@ export declare const defaults: {
287
288
  }>;
288
289
  };
289
290
  readonly image: {
290
- readonly schema: import("@bpinternal/zui").ZodObject<{
291
- imageUrl: import("@bpinternal/zui").ZodString;
292
- title: import("@bpinternal/zui").ZodOptional<import("@bpinternal/zui").ZodString>;
291
+ readonly schema: z.ZodObject<{
292
+ imageUrl: z.ZodString;
293
+ title: z.ZodOptional<z.ZodString>;
293
294
  }, "strip", {
294
295
  imageUrl: string;
295
296
  title?: string | undefined;
@@ -299,9 +300,9 @@ export declare const defaults: {
299
300
  }>;
300
301
  };
301
302
  readonly audio: {
302
- readonly schema: import("@bpinternal/zui").ZodObject<{
303
- audioUrl: import("@bpinternal/zui").ZodString;
304
- title: import("@bpinternal/zui").ZodOptional<import("@bpinternal/zui").ZodString>;
303
+ readonly schema: z.ZodObject<{
304
+ audioUrl: z.ZodString;
305
+ title: z.ZodOptional<z.ZodString>;
305
306
  }, "strip", {
306
307
  audioUrl: string;
307
308
  title?: string | undefined;
@@ -311,9 +312,9 @@ export declare const defaults: {
311
312
  }>;
312
313
  };
313
314
  readonly video: {
314
- readonly schema: import("@bpinternal/zui").ZodObject<{
315
- videoUrl: import("@bpinternal/zui").ZodString;
316
- title: import("@bpinternal/zui").ZodOptional<import("@bpinternal/zui").ZodString>;
315
+ readonly schema: z.ZodObject<{
316
+ videoUrl: z.ZodString;
317
+ title: z.ZodOptional<z.ZodString>;
317
318
  }, "strip", {
318
319
  videoUrl: string;
319
320
  title?: string | undefined;
@@ -323,9 +324,9 @@ export declare const defaults: {
323
324
  }>;
324
325
  };
325
326
  readonly file: {
326
- readonly schema: import("@bpinternal/zui").ZodObject<{
327
- fileUrl: import("@bpinternal/zui").ZodString;
328
- title: import("@bpinternal/zui").ZodOptional<import("@bpinternal/zui").ZodString>;
327
+ readonly schema: z.ZodObject<{
328
+ fileUrl: z.ZodString;
329
+ title: z.ZodOptional<z.ZodString>;
329
330
  }, "strip", {
330
331
  fileUrl: string;
331
332
  title?: string | undefined;
@@ -335,11 +336,11 @@ export declare const defaults: {
335
336
  }>;
336
337
  };
337
338
  readonly location: {
338
- readonly schema: import("@bpinternal/zui").ZodObject<{
339
- latitude: import("@bpinternal/zui").ZodNumber;
340
- longitude: import("@bpinternal/zui").ZodNumber;
341
- address: import("@bpinternal/zui").ZodOptional<import("@bpinternal/zui").ZodString>;
342
- title: import("@bpinternal/zui").ZodOptional<import("@bpinternal/zui").ZodString>;
339
+ readonly schema: z.ZodObject<{
340
+ latitude: z.ZodNumber;
341
+ longitude: z.ZodNumber;
342
+ address: z.ZodOptional<z.ZodString>;
343
+ title: z.ZodOptional<z.ZodString>;
343
344
  }, "strip", {
344
345
  latitude: number;
345
346
  longitude: number;
@@ -353,15 +354,15 @@ export declare const defaults: {
353
354
  }>;
354
355
  };
355
356
  readonly carousel: {
356
- readonly schema: import("@bpinternal/zui").ZodObject<{
357
- items: import("@bpinternal/zui").ZodArray<import("@bpinternal/zui").ZodObject<{
358
- title: import("@bpinternal/zui").ZodString;
359
- subtitle: import("@bpinternal/zui").ZodOptional<import("@bpinternal/zui").ZodString>;
360
- imageUrl: import("@bpinternal/zui").ZodOptional<import("@bpinternal/zui").ZodString>;
361
- actions: import("@bpinternal/zui").ZodArray<import("@bpinternal/zui").ZodObject<{
362
- action: import("@bpinternal/zui").ZodEnum<["postback", "url", "say"]>;
363
- label: import("@bpinternal/zui").ZodString;
364
- value: import("@bpinternal/zui").ZodString;
357
+ readonly schema: z.ZodObject<{
358
+ items: z.ZodArray<z.ZodObject<{
359
+ title: z.ZodString;
360
+ subtitle: z.ZodOptional<z.ZodString>;
361
+ imageUrl: z.ZodOptional<z.ZodString>;
362
+ actions: z.ZodArray<z.ZodObject<{
363
+ action: z.ZodEnum<["postback", "url", "say"]>;
364
+ label: z.ZodString;
365
+ value: z.ZodString;
365
366
  }, "strip", {
366
367
  value: string;
367
368
  action: "url" | "postback" | "say";
@@ -415,14 +416,14 @@ export declare const defaults: {
415
416
  }>;
416
417
  };
417
418
  readonly card: {
418
- readonly schema: import("@bpinternal/zui").ZodObject<{
419
- title: import("@bpinternal/zui").ZodString;
420
- subtitle: import("@bpinternal/zui").ZodOptional<import("@bpinternal/zui").ZodString>;
421
- imageUrl: import("@bpinternal/zui").ZodOptional<import("@bpinternal/zui").ZodString>;
422
- actions: import("@bpinternal/zui").ZodArray<import("@bpinternal/zui").ZodObject<{
423
- action: import("@bpinternal/zui").ZodEnum<["postback", "url", "say"]>;
424
- label: import("@bpinternal/zui").ZodString;
425
- value: import("@bpinternal/zui").ZodString;
419
+ readonly schema: z.ZodObject<{
420
+ title: z.ZodString;
421
+ subtitle: z.ZodOptional<z.ZodString>;
422
+ imageUrl: z.ZodOptional<z.ZodString>;
423
+ actions: z.ZodArray<z.ZodObject<{
424
+ action: z.ZodEnum<["postback", "url", "say"]>;
425
+ label: z.ZodString;
426
+ value: z.ZodString;
426
427
  }, "strip", {
427
428
  value: string;
428
429
  action: "url" | "postback" | "say";
@@ -453,11 +454,11 @@ export declare const defaults: {
453
454
  }>;
454
455
  };
455
456
  readonly dropdown: {
456
- readonly schema: import("@bpinternal/zui").ZodObject<{
457
- text: import("@bpinternal/zui").ZodString;
458
- options: import("@bpinternal/zui").ZodArray<import("@bpinternal/zui").ZodObject<{
459
- label: import("@bpinternal/zui").ZodString;
460
- value: import("@bpinternal/zui").ZodString;
457
+ readonly schema: z.ZodObject<{
458
+ text: z.ZodString;
459
+ options: z.ZodArray<z.ZodObject<{
460
+ label: z.ZodString;
461
+ value: z.ZodString;
461
462
  }, "strip", {
462
463
  value: string;
463
464
  label: string;
@@ -466,25 +467,25 @@ export declare const defaults: {
466
467
  label: string;
467
468
  }>, "many">;
468
469
  }, "strip", {
470
+ text: string;
469
471
  options: {
470
472
  value: string;
471
473
  label: string;
472
474
  }[];
473
- text: string;
474
475
  }, {
476
+ text: string;
475
477
  options: {
476
478
  value: string;
477
479
  label: string;
478
480
  }[];
479
- text: string;
480
481
  }>;
481
482
  };
482
483
  readonly choice: {
483
- readonly schema: import("@bpinternal/zui").ZodObject<{
484
- text: import("@bpinternal/zui").ZodString;
485
- options: import("@bpinternal/zui").ZodArray<import("@bpinternal/zui").ZodObject<{
486
- label: import("@bpinternal/zui").ZodString;
487
- value: import("@bpinternal/zui").ZodString;
484
+ readonly schema: z.ZodObject<{
485
+ text: z.ZodString;
486
+ options: z.ZodArray<z.ZodObject<{
487
+ label: z.ZodString;
488
+ value: z.ZodString;
488
489
  }, "strip", {
489
490
  value: string;
490
491
  label: string;
@@ -493,25 +494,25 @@ export declare const defaults: {
493
494
  label: string;
494
495
  }>, "many">;
495
496
  }, "strip", {
497
+ text: string;
496
498
  options: {
497
499
  value: string;
498
500
  label: string;
499
501
  }[];
500
- text: string;
501
502
  }, {
503
+ text: string;
502
504
  options: {
503
505
  value: string;
504
506
  label: string;
505
507
  }[];
506
- text: string;
507
508
  }>;
508
509
  };
509
510
  readonly bloc: {
510
- readonly schema: import("@bpinternal/zui").ZodObject<{
511
- items: import("@bpinternal/zui").ZodArray<import("@bpinternal/zui").ZodUnion<[import("@bpinternal/zui").ZodObject<{
512
- type: import("@bpinternal/zui").ZodLiteral<"text">;
513
- payload: import("@bpinternal/zui").ZodObject<{
514
- text: import("@bpinternal/zui").ZodString;
511
+ readonly schema: z.ZodObject<{
512
+ items: z.ZodArray<z.ZodUnion<[z.ZodObject<{
513
+ type: z.ZodLiteral<"text">;
514
+ payload: z.ZodObject<{
515
+ text: z.ZodString;
515
516
  }, "strip", {
516
517
  text: string;
517
518
  }, {
@@ -527,11 +528,11 @@ export declare const defaults: {
527
528
  payload: {
528
529
  text: string;
529
530
  };
530
- }>, import("@bpinternal/zui").ZodObject<{
531
- type: import("@bpinternal/zui").ZodLiteral<"image">;
532
- payload: import("@bpinternal/zui").ZodObject<{
533
- imageUrl: import("@bpinternal/zui").ZodString;
534
- title: import("@bpinternal/zui").ZodOptional<import("@bpinternal/zui").ZodString>;
531
+ }>, z.ZodObject<{
532
+ type: z.ZodLiteral<"image">;
533
+ payload: z.ZodObject<{
534
+ imageUrl: z.ZodString;
535
+ title: z.ZodOptional<z.ZodString>;
535
536
  }, "strip", {
536
537
  imageUrl: string;
537
538
  title?: string | undefined;
@@ -551,11 +552,11 @@ export declare const defaults: {
551
552
  imageUrl: string;
552
553
  title?: string | undefined;
553
554
  };
554
- }>, import("@bpinternal/zui").ZodObject<{
555
- type: import("@bpinternal/zui").ZodLiteral<"audio">;
556
- payload: import("@bpinternal/zui").ZodObject<{
557
- audioUrl: import("@bpinternal/zui").ZodString;
558
- title: import("@bpinternal/zui").ZodOptional<import("@bpinternal/zui").ZodString>;
555
+ }>, z.ZodObject<{
556
+ type: z.ZodLiteral<"audio">;
557
+ payload: z.ZodObject<{
558
+ audioUrl: z.ZodString;
559
+ title: z.ZodOptional<z.ZodString>;
559
560
  }, "strip", {
560
561
  audioUrl: string;
561
562
  title?: string | undefined;
@@ -575,11 +576,11 @@ export declare const defaults: {
575
576
  audioUrl: string;
576
577
  title?: string | undefined;
577
578
  };
578
- }>, import("@bpinternal/zui").ZodObject<{
579
- type: import("@bpinternal/zui").ZodLiteral<"video">;
580
- payload: import("@bpinternal/zui").ZodObject<{
581
- videoUrl: import("@bpinternal/zui").ZodString;
582
- title: import("@bpinternal/zui").ZodOptional<import("@bpinternal/zui").ZodString>;
579
+ }>, z.ZodObject<{
580
+ type: z.ZodLiteral<"video">;
581
+ payload: z.ZodObject<{
582
+ videoUrl: z.ZodString;
583
+ title: z.ZodOptional<z.ZodString>;
583
584
  }, "strip", {
584
585
  videoUrl: string;
585
586
  title?: string | undefined;
@@ -599,11 +600,11 @@ export declare const defaults: {
599
600
  videoUrl: string;
600
601
  title?: string | undefined;
601
602
  };
602
- }>, import("@bpinternal/zui").ZodObject<{
603
- type: import("@bpinternal/zui").ZodLiteral<"file">;
604
- payload: import("@bpinternal/zui").ZodObject<{
605
- fileUrl: import("@bpinternal/zui").ZodString;
606
- title: import("@bpinternal/zui").ZodOptional<import("@bpinternal/zui").ZodString>;
603
+ }>, z.ZodObject<{
604
+ type: z.ZodLiteral<"file">;
605
+ payload: z.ZodObject<{
606
+ fileUrl: z.ZodString;
607
+ title: z.ZodOptional<z.ZodString>;
607
608
  }, "strip", {
608
609
  fileUrl: string;
609
610
  title?: string | undefined;
@@ -623,13 +624,13 @@ export declare const defaults: {
623
624
  fileUrl: string;
624
625
  title?: string | undefined;
625
626
  };
626
- }>, import("@bpinternal/zui").ZodObject<{
627
- type: import("@bpinternal/zui").ZodLiteral<"location">;
628
- payload: import("@bpinternal/zui").ZodObject<{
629
- latitude: import("@bpinternal/zui").ZodNumber;
630
- longitude: import("@bpinternal/zui").ZodNumber;
631
- address: import("@bpinternal/zui").ZodOptional<import("@bpinternal/zui").ZodString>;
632
- title: import("@bpinternal/zui").ZodOptional<import("@bpinternal/zui").ZodString>;
627
+ }>, z.ZodObject<{
628
+ type: z.ZodLiteral<"location">;
629
+ payload: z.ZodObject<{
630
+ latitude: z.ZodNumber;
631
+ longitude: z.ZodNumber;
632
+ address: z.ZodOptional<z.ZodString>;
633
+ title: z.ZodOptional<z.ZodString>;
633
634
  }, "strip", {
634
635
  latitude: number;
635
636
  longitude: number;
@@ -1,16 +1,16 @@
1
1
  import { StateDefinition as BotStateDefinition, EventDefinition as BotEventDefinition, ConfigurationDefinition as BotConfigurationDefinition, UserDefinition, ConversationDefinition, MessageDefinition, ActionDefinition as BotActionDefinition, TableDefinition as BotTableDefinition, WorkflowDefinition } from '../bot/definition';
2
2
  import { IntegrationPackage, InterfacePackage } from '../package';
3
3
  import * as typeUtils from '../utils/type-utils';
4
- import { ZuiObjectSchema, ZuiObjectOrRefSchema, z } from '../zui';
4
+ import { z } from '../zui';
5
5
  export { UserDefinition, ConversationDefinition, MessageDefinition, WorkflowDefinition } from '../bot/definition';
6
- type BaseConfig = ZuiObjectOrRefSchema;
7
- type BaseStates = Record<string, ZuiObjectOrRefSchema>;
8
- type BaseEvents = Record<string, ZuiObjectOrRefSchema>;
9
- type BaseActions = Record<string, ZuiObjectOrRefSchema>;
6
+ type BaseConfig = z.ZuiObjectOrRefSchema;
7
+ type BaseStates = Record<string, z.ZuiObjectOrRefSchema>;
8
+ type BaseEvents = Record<string, z.ZuiObjectOrRefSchema>;
9
+ type BaseActions = Record<string, z.ZuiObjectOrRefSchema>;
10
10
  type BaseInterfaces = Record<string, InterfacePackage>;
11
11
  type BaseIntegrations = Record<string, IntegrationPackage>;
12
- type BaseTables = Record<string, ZuiObjectOrRefSchema>;
13
- type BaseWorkflows = Record<string, ZuiObjectSchema>;
12
+ type BaseTables = Record<string, z.ZuiObjectOrRefSchema>;
13
+ type BaseWorkflows = Record<string, z.ZuiObjectSchema>;
14
14
  export type TableDefinition<TTable extends BaseTables[string] = BaseTables[string]> = typeUtils.Merge<BotTableDefinition, {
15
15
  schema: TTable;
16
16
  }>;
@@ -28,7 +28,7 @@ export type ActionDefinition<TAction extends BaseActions[string] = BaseActions[s
28
28
  schema: TAction;
29
29
  };
30
30
  output: {
31
- schema: ZuiObjectOrRefSchema;
31
+ schema: z.ZuiObjectOrRefSchema;
32
32
  };
33
33
  }>;
34
34
  export type RecurringEventDefinition<TEvents extends BaseEvents = BaseEvents> = {
@@ -40,7 +40,7 @@ export type RecurringEventDefinition<TEvents extends BaseEvents = BaseEvents> =
40
40
  };
41
41
  };
42
42
  }[keyof TEvents];
43
- export type ZuiSchemaWithEntityReferences<TInterfaces extends BaseInterfaces, TReturnType extends ZuiObjectOrRefSchema> = ((props: {
43
+ export type ZuiSchemaWithEntityReferences<TInterfaces extends BaseInterfaces, TReturnType extends z.ZuiObjectOrRefSchema> = ((props: {
44
44
  entities: {
45
45
  [TInterfaceAlias in keyof TInterfaces]: {
46
46
  [TEntityName in keyof TInterfaces[TInterfaceAlias]['definition']['entities']]: z.ZodRef;
@@ -48,7 +48,7 @@ export type ZuiSchemaWithEntityReferences<TInterfaces extends BaseInterfaces, TR
48
48
  };
49
49
  }) => TReturnType) | TReturnType;
50
50
  type GenericDefinition<TInterfaces extends BaseInterfaces, TDefinition extends {
51
- schema: ZuiObjectOrRefSchema;
51
+ schema: z.ZuiObjectOrRefSchema;
52
52
  }> = typeUtils.Merge<TDefinition, {
53
53
  schema: ZuiSchemaWithEntityReferences<TInterfaces, TDefinition['schema']>;
54
54
  }>;
package/dist/schema.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import * as z from './zui';
1
+ import { z } from './zui';
2
2
  type SchemaOptions<T> = {
3
3
  title: string;
4
4
  examples: T[];
package/dist/zui.d.ts CHANGED
@@ -1,7 +1,9 @@
1
- import { z } from '@bpinternal/zui';
2
- export * from '@bpinternal/zui';
3
- export type GenericZuiSchema<A extends Record<string, z.ZodTypeAny> = Record<string, z.ZodTypeAny>, R extends z.ZodTypeAny = z.ZodTypeAny> = (typeArguments: A) => R;
4
- export type ZuiObjectSchema = z.ZodObject | z.ZodRecord;
5
- export type ZuiObjectOrRefSchema = ZuiObjectSchema | z.ZodRef;
6
- export declare const mergeObjectSchemas: (a: ZuiObjectSchema, b: ZuiObjectSchema) => ZuiObjectSchema;
7
- export default z;
1
+ import '@bpinternal/zui';
2
+ declare module '@bpinternal/zui' {
3
+ namespace z {
4
+ type GenericZuiSchema<A extends Record<string, z.ZodType> = Record<string, z.ZodType>, R extends z.ZodType = z.ZodType> = (typeArguments: A) => R;
5
+ type ZuiObjectSchema = z.ZodObject | z.ZodRecord;
6
+ type ZuiObjectOrRefSchema = ZuiObjectSchema | z.ZodRef;
7
+ }
8
+ }
9
+ export { z } from '@bpinternal/zui';