@botpress/sdk 0.6.15 → 0.8.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.
@@ -6,9 +6,6 @@ import { ToTags } from './client/types';
6
6
  import { type IntegrationContext } from './context';
7
7
  import { BaseIntegration } from './generic';
8
8
  import { IntegrationLogger } from './logger';
9
- type PrefixConfig<TIntegration extends BaseIntegration> = {
10
- enforcePrefix: TIntegration['name'];
11
- };
12
9
  type CommonArgs<TIntegration extends BaseIntegration> = {
13
10
  ctx: IntegrationContext<TIntegration['configuration']>;
14
11
  client: IntegrationSpecificClient<TIntegration>;
@@ -32,30 +29,30 @@ type ActionPayload<T extends string, I> = {
32
29
  };
33
30
  type ActionArgs<TIntegration extends BaseIntegration, T extends string, I> = CommonArgs<TIntegration> & ActionPayload<T, I>;
34
31
  type CreateUserPayload<TIntegration extends BaseIntegration> = {
35
- tags: ToTags<keyof TIntegration['user']['tags'], PrefixConfig<TIntegration>>;
32
+ tags: ToTags<keyof TIntegration['user']['tags']>;
36
33
  };
37
34
  type CreateUserArgs<TIntegration extends BaseIntegration> = CommonArgs<TIntegration> & CreateUserPayload<TIntegration>;
38
35
  type CreateConversationPayload<TIntegration extends BaseIntegration, TChannel extends keyof TIntegration['channels'] = keyof TIntegration['channels']> = {
39
36
  channel: TChannel;
40
- tags: ToTags<keyof TIntegration['channels'][TChannel]['conversation']['tags'], PrefixConfig<TIntegration>>;
37
+ tags: ToTags<keyof TIntegration['channels'][TChannel]['conversation']['tags']>;
41
38
  };
42
39
  type CreateConversationArgs<TIntegration extends BaseIntegration> = CommonArgs<TIntegration> & CreateConversationPayload<TIntegration>;
43
40
  type MessagePayload<TIntegration extends BaseIntegration, TChannel extends keyof TIntegration['channels'], TMessage extends keyof TIntegration['channels'][TChannel]['messages']> = {
44
41
  type: TMessage;
45
42
  payload: TIntegration['channels'][TChannel]['messages'][TMessage];
46
43
  conversation: Merge<Conversation, {
47
- tags: ToTags<keyof TIntegration['channels'][TChannel]['conversation']['tags'], PrefixConfig<TIntegration>>;
44
+ tags: ToTags<keyof TIntegration['channels'][TChannel]['conversation']['tags']>;
48
45
  }>;
49
46
  message: Merge<Message, {
50
- tags: ToTags<keyof TIntegration['channels'][TChannel]['message']['tags'], PrefixConfig<TIntegration>>;
47
+ tags: ToTags<keyof TIntegration['channels'][TChannel]['message']['tags']>;
51
48
  }>;
52
49
  user: Merge<User, {
53
- tags: ToTags<keyof TIntegration['user']['tags'], PrefixConfig<TIntegration>>;
50
+ tags: ToTags<keyof TIntegration['user']['tags']>;
54
51
  }>;
55
52
  };
56
53
  type MessageArgs<TIntegration extends BaseIntegration, TChannel extends keyof TIntegration['channels'], TMessage extends keyof TIntegration['channels'][TChannel]['messages']> = CommonArgs<TIntegration> & MessagePayload<TIntegration, TChannel, TMessage> & {
57
54
  ack: (props: {
58
- tags: ToTags<keyof TIntegration['channels'][TChannel]['message']['tags'], PrefixConfig<TIntegration>>;
55
+ tags: ToTags<keyof TIntegration['channels'][TChannel]['message']['tags']>;
59
56
  }) => Promise<void>;
60
57
  };
61
58
  export type RegisterFunction<TIntegration extends BaseIntegration> = (props: RegisterArgs<TIntegration>) => Promise<void>;
package/dist/message.d.ts CHANGED
@@ -1,91 +1,90 @@
1
- import { z } from 'zod';
2
1
  export declare const defaults: {
3
2
  readonly text: {
4
- readonly schema: z.ZodObject<{
5
- text: z.ZodString;
6
- }, "strip", z.ZodTypeAny, {
3
+ readonly schema: import("@bpinternal/zui").ZodObject<{
4
+ text: import("@bpinternal/zui").ZodString;
5
+ }, "strip", import("@bpinternal/zui").ZodTypeAny, {
7
6
  text: string;
8
7
  }, {
9
8
  text: string;
10
9
  }>;
11
10
  };
12
11
  readonly markdown: {
13
- readonly schema: z.ZodObject<{
14
- markdown: z.ZodString;
15
- }, "strip", z.ZodTypeAny, {
12
+ readonly schema: import("@bpinternal/zui").ZodObject<{
13
+ markdown: import("@bpinternal/zui").ZodString;
14
+ }, "strip", import("@bpinternal/zui").ZodTypeAny, {
16
15
  markdown: string;
17
16
  }, {
18
17
  markdown: string;
19
18
  }>;
20
19
  };
21
20
  readonly image: {
22
- readonly schema: z.ZodObject<{
23
- imageUrl: z.ZodString;
24
- }, "strip", z.ZodTypeAny, {
21
+ readonly schema: import("@bpinternal/zui").ZodObject<{
22
+ imageUrl: import("@bpinternal/zui").ZodString;
23
+ }, "strip", import("@bpinternal/zui").ZodTypeAny, {
25
24
  imageUrl: string;
26
25
  }, {
27
26
  imageUrl: string;
28
27
  }>;
29
28
  };
30
29
  readonly audio: {
31
- readonly schema: z.ZodObject<{
32
- audioUrl: z.ZodString;
33
- }, "strip", z.ZodTypeAny, {
30
+ readonly schema: import("@bpinternal/zui").ZodObject<{
31
+ audioUrl: import("@bpinternal/zui").ZodString;
32
+ }, "strip", import("@bpinternal/zui").ZodTypeAny, {
34
33
  audioUrl: string;
35
34
  }, {
36
35
  audioUrl: string;
37
36
  }>;
38
37
  };
39
38
  readonly video: {
40
- readonly schema: z.ZodObject<{
41
- videoUrl: z.ZodString;
42
- }, "strip", z.ZodTypeAny, {
39
+ readonly schema: import("@bpinternal/zui").ZodObject<{
40
+ videoUrl: import("@bpinternal/zui").ZodString;
41
+ }, "strip", import("@bpinternal/zui").ZodTypeAny, {
43
42
  videoUrl: string;
44
43
  }, {
45
44
  videoUrl: string;
46
45
  }>;
47
46
  };
48
47
  readonly file: {
49
- readonly schema: z.ZodObject<{
50
- fileUrl: z.ZodString;
51
- title: z.ZodOptional<z.ZodString>;
52
- }, "strip", z.ZodTypeAny, {
53
- title?: string | undefined;
48
+ readonly schema: import("@bpinternal/zui").ZodObject<{
49
+ fileUrl: import("@bpinternal/zui").ZodString;
50
+ title: import("@bpinternal/zui").ZodOptional<import("@bpinternal/zui").ZodString>;
51
+ }, "strip", import("@bpinternal/zui").ZodTypeAny, {
54
52
  fileUrl: string;
55
- }, {
56
53
  title?: string | undefined;
54
+ }, {
57
55
  fileUrl: string;
56
+ title?: string | undefined;
58
57
  }>;
59
58
  };
60
59
  readonly location: {
61
- readonly schema: z.ZodObject<{
62
- latitude: z.ZodNumber;
63
- longitude: z.ZodNumber;
64
- address: z.ZodOptional<z.ZodString>;
65
- title: z.ZodOptional<z.ZodString>;
66
- }, "strip", z.ZodTypeAny, {
67
- title?: string | undefined;
68
- address?: string | undefined;
60
+ readonly schema: import("@bpinternal/zui").ZodObject<{
61
+ latitude: import("@bpinternal/zui").ZodNumber;
62
+ longitude: import("@bpinternal/zui").ZodNumber;
63
+ address: import("@bpinternal/zui").ZodOptional<import("@bpinternal/zui").ZodString>;
64
+ title: import("@bpinternal/zui").ZodOptional<import("@bpinternal/zui").ZodString>;
65
+ }, "strip", import("@bpinternal/zui").ZodTypeAny, {
69
66
  latitude: number;
70
67
  longitude: number;
71
- }, {
72
68
  title?: string | undefined;
73
69
  address?: string | undefined;
70
+ }, {
74
71
  latitude: number;
75
72
  longitude: number;
73
+ title?: string | undefined;
74
+ address?: string | undefined;
76
75
  }>;
77
76
  };
78
77
  readonly carousel: {
79
- readonly schema: z.ZodObject<{
80
- items: z.ZodArray<z.ZodObject<{
81
- title: z.ZodString;
82
- subtitle: z.ZodOptional<z.ZodString>;
83
- imageUrl: z.ZodOptional<z.ZodString>;
84
- actions: z.ZodArray<z.ZodObject<{
85
- action: z.ZodEnum<["postback", "url", "say"]>;
86
- label: z.ZodString;
87
- value: z.ZodString;
88
- }, "strip", z.ZodTypeAny, {
78
+ readonly schema: import("@bpinternal/zui").ZodObject<{
79
+ items: import("@bpinternal/zui").ZodArray<import("@bpinternal/zui").ZodObject<{
80
+ title: import("@bpinternal/zui").ZodString;
81
+ subtitle: import("@bpinternal/zui").ZodOptional<import("@bpinternal/zui").ZodString>;
82
+ imageUrl: import("@bpinternal/zui").ZodOptional<import("@bpinternal/zui").ZodString>;
83
+ actions: import("@bpinternal/zui").ZodArray<import("@bpinternal/zui").ZodObject<{
84
+ action: import("@bpinternal/zui").ZodEnum<["postback", "url", "say"]>;
85
+ label: import("@bpinternal/zui").ZodString;
86
+ value: import("@bpinternal/zui").ZodString;
87
+ }, "strip", import("@bpinternal/zui").ZodTypeAny, {
89
88
  value: string;
90
89
  action: "postback" | "url" | "say";
91
90
  label: string;
@@ -94,59 +93,59 @@ export declare const defaults: {
94
93
  action: "postback" | "url" | "say";
95
94
  label: string;
96
95
  }>, "many">;
97
- }, "strip", z.ZodTypeAny, {
98
- imageUrl?: string | undefined;
99
- subtitle?: string | undefined;
96
+ }, "strip", import("@bpinternal/zui").ZodTypeAny, {
100
97
  title: string;
101
98
  actions: {
102
99
  value: string;
103
100
  action: "postback" | "url" | "say";
104
101
  label: string;
105
102
  }[];
106
- }, {
107
103
  imageUrl?: string | undefined;
108
104
  subtitle?: string | undefined;
105
+ }, {
109
106
  title: string;
110
107
  actions: {
111
108
  value: string;
112
109
  action: "postback" | "url" | "say";
113
110
  label: string;
114
111
  }[];
115
- }>, "many">;
116
- }, "strip", z.ZodTypeAny, {
117
- items: {
118
112
  imageUrl?: string | undefined;
119
113
  subtitle?: string | undefined;
114
+ }>, "many">;
115
+ }, "strip", import("@bpinternal/zui").ZodTypeAny, {
116
+ items: {
120
117
  title: string;
121
118
  actions: {
122
119
  value: string;
123
120
  action: "postback" | "url" | "say";
124
121
  label: string;
125
122
  }[];
123
+ imageUrl?: string | undefined;
124
+ subtitle?: string | undefined;
126
125
  }[];
127
126
  }, {
128
127
  items: {
129
- imageUrl?: string | undefined;
130
- subtitle?: string | undefined;
131
128
  title: string;
132
129
  actions: {
133
130
  value: string;
134
131
  action: "postback" | "url" | "say";
135
132
  label: string;
136
133
  }[];
134
+ imageUrl?: string | undefined;
135
+ subtitle?: string | undefined;
137
136
  }[];
138
137
  }>;
139
138
  };
140
139
  readonly card: {
141
- readonly schema: z.ZodObject<{
142
- title: z.ZodString;
143
- subtitle: z.ZodOptional<z.ZodString>;
144
- imageUrl: z.ZodOptional<z.ZodString>;
145
- actions: z.ZodArray<z.ZodObject<{
146
- action: z.ZodEnum<["postback", "url", "say"]>;
147
- label: z.ZodString;
148
- value: z.ZodString;
149
- }, "strip", z.ZodTypeAny, {
140
+ readonly schema: import("@bpinternal/zui").ZodObject<{
141
+ title: import("@bpinternal/zui").ZodString;
142
+ subtitle: import("@bpinternal/zui").ZodOptional<import("@bpinternal/zui").ZodString>;
143
+ imageUrl: import("@bpinternal/zui").ZodOptional<import("@bpinternal/zui").ZodString>;
144
+ actions: import("@bpinternal/zui").ZodArray<import("@bpinternal/zui").ZodObject<{
145
+ action: import("@bpinternal/zui").ZodEnum<["postback", "url", "say"]>;
146
+ label: import("@bpinternal/zui").ZodString;
147
+ value: import("@bpinternal/zui").ZodString;
148
+ }, "strip", import("@bpinternal/zui").ZodTypeAny, {
150
149
  value: string;
151
150
  action: "postback" | "url" | "say";
152
151
  label: string;
@@ -155,78 +154,78 @@ export declare const defaults: {
155
154
  action: "postback" | "url" | "say";
156
155
  label: string;
157
156
  }>, "many">;
158
- }, "strip", z.ZodTypeAny, {
159
- imageUrl?: string | undefined;
160
- subtitle?: string | undefined;
157
+ }, "strip", import("@bpinternal/zui").ZodTypeAny, {
161
158
  title: string;
162
159
  actions: {
163
160
  value: string;
164
161
  action: "postback" | "url" | "say";
165
162
  label: string;
166
163
  }[];
167
- }, {
168
164
  imageUrl?: string | undefined;
169
165
  subtitle?: string | undefined;
166
+ }, {
170
167
  title: string;
171
168
  actions: {
172
169
  value: string;
173
170
  action: "postback" | "url" | "say";
174
171
  label: string;
175
172
  }[];
173
+ imageUrl?: string | undefined;
174
+ subtitle?: string | undefined;
176
175
  }>;
177
176
  };
178
177
  readonly dropdown: {
179
- readonly schema: z.ZodObject<{
180
- text: z.ZodString;
181
- options: z.ZodArray<z.ZodObject<{
182
- label: z.ZodString;
183
- value: z.ZodString;
184
- }, "strip", z.ZodTypeAny, {
178
+ readonly schema: import("@bpinternal/zui").ZodObject<{
179
+ text: import("@bpinternal/zui").ZodString;
180
+ options: import("@bpinternal/zui").ZodArray<import("@bpinternal/zui").ZodObject<{
181
+ label: import("@bpinternal/zui").ZodString;
182
+ value: import("@bpinternal/zui").ZodString;
183
+ }, "strip", import("@bpinternal/zui").ZodTypeAny, {
185
184
  value: string;
186
185
  label: string;
187
186
  }, {
188
187
  value: string;
189
188
  label: string;
190
189
  }>, "many">;
191
- }, "strip", z.ZodTypeAny, {
192
- text: string;
190
+ }, "strip", import("@bpinternal/zui").ZodTypeAny, {
193
191
  options: {
194
192
  value: string;
195
193
  label: string;
196
194
  }[];
197
- }, {
198
195
  text: string;
196
+ }, {
199
197
  options: {
200
198
  value: string;
201
199
  label: string;
202
200
  }[];
201
+ text: string;
203
202
  }>;
204
203
  };
205
204
  readonly choice: {
206
- readonly schema: z.ZodObject<{
207
- text: z.ZodString;
208
- options: z.ZodArray<z.ZodObject<{
209
- label: z.ZodString;
210
- value: z.ZodString;
211
- }, "strip", z.ZodTypeAny, {
205
+ readonly schema: import("@bpinternal/zui").ZodObject<{
206
+ text: import("@bpinternal/zui").ZodString;
207
+ options: import("@bpinternal/zui").ZodArray<import("@bpinternal/zui").ZodObject<{
208
+ label: import("@bpinternal/zui").ZodString;
209
+ value: import("@bpinternal/zui").ZodString;
210
+ }, "strip", import("@bpinternal/zui").ZodTypeAny, {
212
211
  value: string;
213
212
  label: string;
214
213
  }, {
215
214
  value: string;
216
215
  label: string;
217
216
  }>, "many">;
218
- }, "strip", z.ZodTypeAny, {
219
- text: string;
217
+ }, "strip", import("@bpinternal/zui").ZodTypeAny, {
220
218
  options: {
221
219
  value: string;
222
220
  label: string;
223
221
  }[];
224
- }, {
225
222
  text: string;
223
+ }, {
226
224
  options: {
227
225
  value: string;
228
226
  label: string;
229
227
  }[];
228
+ text: string;
230
229
  }>;
231
230
  };
232
231
  };
package/dist/schema.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import type { z } from 'zod';
2
1
  import { AnyZodObject } from './type-utils';
2
+ import type z from './zui';
3
3
  type SchemaOptions<T> = {
4
4
  title: string;
5
5
  examples: T[];
@@ -10,6 +10,10 @@ type UiDefinition<TSchema extends AnyZodObject = AnyZodObject> = IsEmptyObject<z
10
10
  };
11
11
  export type SchemaDefinition<TSchema extends AnyZodObject = AnyZodObject> = {
12
12
  schema: TSchema;
13
+ /**
14
+ * @deprecated
15
+ * Use zod.Schema.displayAs() instead
16
+ **/
13
17
  ui?: Partial<UiDefinition<TSchema>>;
14
18
  };
15
19
  export {};
@@ -1,4 +1,4 @@
1
- import type { z } from 'zod';
1
+ import type z from './zui';
2
2
  export type AnyZodObject = z.ZodObject<any>;
3
3
  export type Merge<A extends object, B extends object> = Omit<A, keyof B> & B;
4
4
  export type Cast<T, U> = T extends U ? T : U;