@botpress/sdk 4.15.1 → 4.15.3

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.
@@ -3,13 +3,17 @@ import * as common from '../common';
3
3
  export type EnumerateMessages<TIntegration extends common.BaseIntegration> = utils.UnionToIntersection<utils.ValueOf<{
4
4
  [TChannelName in keyof TIntegration['channels']]: {
5
5
  [TMessageName in keyof TIntegration['channels'][TChannelName]['messages']]: {
6
- tags: TIntegration['channels'][TChannelName]['message']['tags'];
6
+ type: TMessageName;
7
+ tags: {
8
+ [Tag in keyof TIntegration['channels'][TChannelName]['message']['tags']]?: string;
9
+ };
7
10
  payload: TIntegration['channels'][TChannelName]['messages'][TMessageName];
8
11
  };
9
12
  };
10
13
  }>>;
11
14
  export type GetChannelByName<TIntegration extends common.BaseIntegration, TChannelName extends keyof TIntegration['channels']> = utils.Cast<TIntegration['channels'][TChannelName], common.BaseChannel>;
12
15
  export type GetMessageByName<TIntegration extends common.BaseIntegration, TMessageName extends keyof EnumerateMessages<TIntegration>> = utils.Cast<EnumerateMessages<TIntegration>[TMessageName], {
16
+ type: string;
13
17
  tags: Record<string, any>;
14
18
  payload: any;
15
19
  }>;
@@ -1,7 +1,7 @@
1
1
  import * as client from '@botpress/client';
2
2
  import * as utils from '../../utils/type-utils';
3
3
  import * as common from '../common';
4
- import { EnumerateMessages, ConversationTags, GetChannelByName, GetMessageByName, MessageTags, TagsOfMessage } from './sub-types';
4
+ import { EnumerateMessages, ConversationTags, GetChannelByName, GetMessageByName, MessageTags } from './sub-types';
5
5
  type Arg<F extends (...args: any[]) => any> = Parameters<F>[number];
6
6
  type Res<F extends (...args: any[]) => any> = ReturnType<F>;
7
7
  type ConversationResponse<TIntegration extends common.BaseIntegration, ChannelName extends keyof TIntegration['channels'] = keyof TIntegration['channels']> = {
@@ -49,11 +49,7 @@ export type ListEvents<TIntegration extends common.BaseIntegration> = (x: utils.
49
49
  type?: utils.Cast<keyof TIntegration['events'], string>;
50
50
  }>) => Res<client.Client['listEvents']>;
51
51
  type MessageResponse<TIntegration extends common.BaseIntegration, TMessage extends keyof EnumerateMessages<TIntegration> = keyof EnumerateMessages<TIntegration>> = {
52
- message: utils.Merge<Awaited<Res<client.Client['createMessage']>>['message'], {
53
- type: utils.Cast<TMessage, string>;
54
- payload: GetMessageByName<TIntegration, TMessage>['payload'];
55
- tags: common.ToTags<TagsOfMessage<TIntegration, TMessage>>;
56
- }>;
52
+ message: utils.Merge<Awaited<Res<client.Client['getMessage']>>['message'], utils.Cast<EnumerateMessages<TIntegration>[TMessage], object>>;
57
53
  };
58
54
  export type CreateMessage<TIntegration extends common.BaseIntegration> = <TMessage extends keyof EnumerateMessages<TIntegration>>(x: utils.Merge<Arg<client.Client['createMessage']>, {
59
55
  type: utils.Cast<TMessage, string>;
package/dist/message.d.ts CHANGED
@@ -243,15 +243,15 @@ export declare const defaults: {
243
243
  text: string;
244
244
  }>;
245
245
  }, "strip", {
246
+ type: "text";
246
247
  payload: {
247
248
  text: string;
248
249
  };
249
- type: "text";
250
250
  }, {
251
+ type: "text";
251
252
  payload: {
252
253
  text: string;
253
254
  };
254
- type: "text";
255
255
  }>, import("@bpinternal/zui").ZodObject<{
256
256
  type: import("@bpinternal/zui").ZodLiteral<"markdown">;
257
257
  payload: import("@bpinternal/zui").ZodObject<{
@@ -262,15 +262,15 @@ export declare const defaults: {
262
262
  markdown: string;
263
263
  }>;
264
264
  }, "strip", {
265
+ type: "markdown";
265
266
  payload: {
266
267
  markdown: string;
267
268
  };
268
- type: "markdown";
269
269
  }, {
270
+ type: "markdown";
270
271
  payload: {
271
272
  markdown: string;
272
273
  };
273
- type: "markdown";
274
274
  }>, import("@bpinternal/zui").ZodObject<{
275
275
  type: import("@bpinternal/zui").ZodLiteral<"image">;
276
276
  payload: import("@bpinternal/zui").ZodObject<{
@@ -281,15 +281,15 @@ export declare const defaults: {
281
281
  imageUrl: string;
282
282
  }>;
283
283
  }, "strip", {
284
+ type: "image";
284
285
  payload: {
285
286
  imageUrl: string;
286
287
  };
287
- type: "image";
288
288
  }, {
289
+ type: "image";
289
290
  payload: {
290
291
  imageUrl: string;
291
292
  };
292
- type: "image";
293
293
  }>, import("@bpinternal/zui").ZodObject<{
294
294
  type: import("@bpinternal/zui").ZodLiteral<"audio">;
295
295
  payload: import("@bpinternal/zui").ZodObject<{
@@ -300,15 +300,15 @@ export declare const defaults: {
300
300
  audioUrl: string;
301
301
  }>;
302
302
  }, "strip", {
303
+ type: "audio";
303
304
  payload: {
304
305
  audioUrl: string;
305
306
  };
306
- type: "audio";
307
307
  }, {
308
+ type: "audio";
308
309
  payload: {
309
310
  audioUrl: string;
310
311
  };
311
- type: "audio";
312
312
  }>, import("@bpinternal/zui").ZodObject<{
313
313
  type: import("@bpinternal/zui").ZodLiteral<"video">;
314
314
  payload: import("@bpinternal/zui").ZodObject<{
@@ -319,15 +319,15 @@ export declare const defaults: {
319
319
  videoUrl: string;
320
320
  }>;
321
321
  }, "strip", {
322
+ type: "video";
322
323
  payload: {
323
324
  videoUrl: string;
324
325
  };
325
- type: "video";
326
326
  }, {
327
+ type: "video";
327
328
  payload: {
328
329
  videoUrl: string;
329
330
  };
330
- type: "video";
331
331
  }>, import("@bpinternal/zui").ZodObject<{
332
332
  type: import("@bpinternal/zui").ZodLiteral<"file">;
333
333
  payload: import("@bpinternal/zui").ZodObject<{
@@ -341,17 +341,17 @@ export declare const defaults: {
341
341
  title?: string | undefined;
342
342
  }>;
343
343
  }, "strip", {
344
+ type: "file";
344
345
  payload: {
345
346
  fileUrl: string;
346
347
  title?: string | undefined;
347
348
  };
348
- type: "file";
349
349
  }, {
350
+ type: "file";
350
351
  payload: {
351
352
  fileUrl: string;
352
353
  title?: string | undefined;
353
354
  };
354
- type: "file";
355
355
  }>, import("@bpinternal/zui").ZodObject<{
356
356
  type: import("@bpinternal/zui").ZodLiteral<"location">;
357
357
  payload: import("@bpinternal/zui").ZodObject<{
@@ -371,103 +371,103 @@ export declare const defaults: {
371
371
  address?: string | undefined;
372
372
  }>;
373
373
  }, "strip", {
374
+ type: "location";
374
375
  payload: {
375
376
  latitude: number;
376
377
  longitude: number;
377
378
  title?: string | undefined;
378
379
  address?: string | undefined;
379
380
  };
380
- type: "location";
381
381
  }, {
382
+ type: "location";
382
383
  payload: {
383
384
  latitude: number;
384
385
  longitude: number;
385
386
  title?: string | undefined;
386
387
  address?: string | undefined;
387
388
  };
388
- type: "location";
389
389
  }>]>, "many">;
390
390
  }, "strip", {
391
391
  items: ({
392
+ type: "text";
392
393
  payload: {
393
394
  text: string;
394
395
  };
395
- type: "text";
396
396
  } | {
397
+ type: "markdown";
397
398
  payload: {
398
399
  markdown: string;
399
400
  };
400
- type: "markdown";
401
401
  } | {
402
+ type: "image";
402
403
  payload: {
403
404
  imageUrl: string;
404
405
  };
405
- type: "image";
406
406
  } | {
407
+ type: "audio";
407
408
  payload: {
408
409
  audioUrl: string;
409
410
  };
410
- type: "audio";
411
411
  } | {
412
+ type: "video";
412
413
  payload: {
413
414
  videoUrl: string;
414
415
  };
415
- type: "video";
416
416
  } | {
417
+ type: "file";
417
418
  payload: {
418
419
  fileUrl: string;
419
420
  title?: string | undefined;
420
421
  };
421
- type: "file";
422
422
  } | {
423
+ type: "location";
423
424
  payload: {
424
425
  latitude: number;
425
426
  longitude: number;
426
427
  title?: string | undefined;
427
428
  address?: string | undefined;
428
429
  };
429
- type: "location";
430
430
  })[];
431
431
  }, {
432
432
  items: ({
433
+ type: "text";
433
434
  payload: {
434
435
  text: string;
435
436
  };
436
- type: "text";
437
437
  } | {
438
+ type: "markdown";
438
439
  payload: {
439
440
  markdown: string;
440
441
  };
441
- type: "markdown";
442
442
  } | {
443
+ type: "image";
443
444
  payload: {
444
445
  imageUrl: string;
445
446
  };
446
- type: "image";
447
447
  } | {
448
+ type: "audio";
448
449
  payload: {
449
450
  audioUrl: string;
450
451
  };
451
- type: "audio";
452
452
  } | {
453
+ type: "video";
453
454
  payload: {
454
455
  videoUrl: string;
455
456
  };
456
- type: "video";
457
457
  } | {
458
+ type: "file";
458
459
  payload: {
459
460
  fileUrl: string;
460
461
  title?: string | undefined;
461
462
  };
462
- type: "file";
463
463
  } | {
464
+ type: "location";
464
465
  payload: {
465
466
  latitude: number;
466
467
  longitude: number;
467
468
  title?: string | undefined;
468
469
  address?: string | undefined;
469
470
  };
470
- type: "location";
471
471
  })[];
472
472
  }>;
473
473
  };
@@ -32,13 +32,13 @@ export type ActionDefinition<TAction extends BaseActions[string] = BaseActions[s
32
32
  };
33
33
  }>;
34
34
  export type RecurringEventDefinition<TEvents extends BaseEvents = BaseEvents> = {
35
- [K in keyof TEvents]: TEvents[K] extends ZuiObjectSchema ? {
35
+ [K in keyof TEvents]: {
36
36
  type: K;
37
37
  payload: z.infer<TEvents[K]>;
38
38
  schedule: {
39
39
  cron: string;
40
40
  };
41
- } : never;
41
+ };
42
42
  }[keyof TEvents];
43
43
  export type ZuiSchemaWithEntityReferences<TInterfaces extends BaseInterfaces, TReturnType extends ZuiObjectOrRefSchema> = ((props: {
44
44
  entities: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@botpress/sdk",
3
- "version": "4.15.1",
3
+ "version": "4.15.3",
4
4
  "description": "Botpress SDK",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.mjs",
@@ -16,7 +16,7 @@
16
16
  "author": "",
17
17
  "license": "MIT",
18
18
  "dependencies": {
19
- "@botpress/client": "1.20.0",
19
+ "@botpress/client": "1.22.2",
20
20
  "browser-or-node": "^2.1.1"
21
21
  },
22
22
  "devDependencies": {