@botpress/sdk 5.4.4 → 5.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +5 -5
- package/dist/bot/definition.d.ts +9 -9
- package/dist/index.cjs +26 -26
- package/dist/index.cjs.map +4 -4
- package/dist/index.mjs +57 -57
- package/dist/index.mjs.map +4 -4
- package/dist/integration/client/types.d.ts +9 -1
- package/dist/integration/definition/generic.d.ts +7 -7
- package/dist/integration/definition/index.d.ts +1 -0
- package/dist/integration/definition/types.d.ts +2 -2
- package/dist/integration/server/context.d.ts +2 -1
- package/dist/interface/definition.d.ts +10 -10
- package/dist/interface/resolve.d.ts +2 -2
- package/dist/message.d.ts +121 -120
- package/dist/plugin/definition.d.ts +10 -10
- package/dist/schema.d.ts +1 -1
- package/dist/zui.d.ts +9 -7
- package/package.json +2 -2
|
@@ -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<
|
|
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 {
|
|
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>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SchemaDefinition } from '../../schema';
|
|
2
|
-
import {
|
|
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:
|
|
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 {
|
|
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 {
|
|
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:
|
|
6
|
-
markdown:
|
|
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:
|
|
20
|
-
items:
|
|
21
|
-
type:
|
|
22
|
-
payload:
|
|
23
|
-
text:
|
|
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
|
-
}>,
|
|
40
|
-
type:
|
|
41
|
-
payload:
|
|
42
|
-
imageUrl:
|
|
43
|
-
title:
|
|
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
|
-
}>,
|
|
64
|
-
type:
|
|
65
|
-
payload:
|
|
66
|
-
audioUrl:
|
|
67
|
-
title:
|
|
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
|
-
}>,
|
|
88
|
-
type:
|
|
89
|
-
payload:
|
|
90
|
-
videoUrl:
|
|
91
|
-
title:
|
|
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
|
-
}>,
|
|
112
|
-
type:
|
|
113
|
-
payload:
|
|
114
|
-
fileUrl:
|
|
115
|
-
title:
|
|
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
|
-
}>,
|
|
136
|
-
type:
|
|
137
|
-
payload:
|
|
138
|
-
latitude:
|
|
139
|
-
longitude:
|
|
140
|
-
address:
|
|
141
|
-
title:
|
|
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
|
-
}>,
|
|
170
|
-
type:
|
|
171
|
-
payload:
|
|
172
|
-
markdown:
|
|
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:
|
|
282
|
-
text:
|
|
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:
|
|
291
|
-
imageUrl:
|
|
292
|
-
title:
|
|
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:
|
|
303
|
-
audioUrl:
|
|
304
|
-
title:
|
|
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:
|
|
315
|
-
videoUrl:
|
|
316
|
-
title:
|
|
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:
|
|
327
|
-
fileUrl:
|
|
328
|
-
title:
|
|
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:
|
|
339
|
-
latitude:
|
|
340
|
-
longitude:
|
|
341
|
-
address:
|
|
342
|
-
title:
|
|
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:
|
|
357
|
-
items:
|
|
358
|
-
title:
|
|
359
|
-
subtitle:
|
|
360
|
-
imageUrl:
|
|
361
|
-
actions:
|
|
362
|
-
action:
|
|
363
|
-
label:
|
|
364
|
-
value:
|
|
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:
|
|
419
|
-
title:
|
|
420
|
-
subtitle:
|
|
421
|
-
imageUrl:
|
|
422
|
-
actions:
|
|
423
|
-
action:
|
|
424
|
-
label:
|
|
425
|
-
value:
|
|
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:
|
|
457
|
-
text:
|
|
458
|
-
options:
|
|
459
|
-
label:
|
|
460
|
-
value:
|
|
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:
|
|
484
|
-
text:
|
|
485
|
-
options:
|
|
486
|
-
label:
|
|
487
|
-
value:
|
|
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:
|
|
511
|
-
items:
|
|
512
|
-
type:
|
|
513
|
-
payload:
|
|
514
|
-
text:
|
|
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
|
-
}>,
|
|
531
|
-
type:
|
|
532
|
-
payload:
|
|
533
|
-
imageUrl:
|
|
534
|
-
title:
|
|
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
|
-
}>,
|
|
555
|
-
type:
|
|
556
|
-
payload:
|
|
557
|
-
audioUrl:
|
|
558
|
-
title:
|
|
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
|
-
}>,
|
|
579
|
-
type:
|
|
580
|
-
payload:
|
|
581
|
-
videoUrl:
|
|
582
|
-
title:
|
|
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
|
-
}>,
|
|
603
|
-
type:
|
|
604
|
-
payload:
|
|
605
|
-
fileUrl:
|
|
606
|
-
title:
|
|
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
|
-
}>,
|
|
627
|
-
type:
|
|
628
|
-
payload:
|
|
629
|
-
latitude:
|
|
630
|
-
longitude:
|
|
631
|
-
address:
|
|
632
|
-
title:
|
|
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 {
|
|
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
package/dist/zui.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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';
|