@botpress/sdk 1.6.3 → 2.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.
- package/.turbo/turbo-build.log +3 -3
- package/dist/bot/client/index.d.ts +1 -0
- package/dist/bot/client/types.d.ts +2 -0
- package/dist/bot/definition.d.ts +31 -8
- package/dist/bot/implementation.d.ts +561 -150
- package/dist/bot/merge-bots.d.ts +2 -0
- package/dist/bot/server/types.d.ts +174 -84
- package/dist/bot/types/generic.d.ts +11 -1
- package/dist/fixtures.d.ts +31 -0
- package/dist/index.d.ts +4 -3
- package/dist/index.js +1 -1
- package/dist/index.js.map +4 -4
- package/dist/integration/definition/generic.d.ts +7 -7
- package/dist/integration/definition/index.d.ts +8 -8
- package/dist/integration/definition/types.d.ts +2 -2
- package/dist/interface/definition.d.ts +12 -12
- package/dist/interface/types/generic.d.ts +34 -0
- package/dist/interface/types/generic.test.d.ts +1 -0
- package/dist/package.d.ts +29 -11
- package/dist/plugin/definition.d.ts +50 -0
- package/dist/plugin/implementation.d.ts +900 -0
- package/dist/plugin/index.d.ts +3 -0
- package/dist/plugin/server/types.d.ts +1 -0
- package/dist/plugin/server/types.test.d.ts +1 -0
- package/dist/plugin/types/generic.d.ts +30 -0
- package/dist/plugin/types/generic.test.d.ts +1 -0
- package/dist/schema.d.ts +3 -3
- package/dist/utils/array-utils.d.ts +1 -1
- package/dist/utils/record-utils.d.ts +1 -0
- package/dist/zui.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SchemaDefinition } from '../../schema';
|
|
2
|
-
import {
|
|
2
|
+
import { ZuiObjectSchema } from '../../zui';
|
|
3
3
|
import { BaseConfig, BaseEvents, BaseActions, BaseMessages, BaseChannels, BaseStates, BaseEntities, BaseConfigs } from './generic';
|
|
4
4
|
export type TagDefinition = {
|
|
5
5
|
title?: string;
|
|
@@ -44,7 +44,7 @@ export type ActionDefinition<TAction extends BaseActions[string] = BaseActions[s
|
|
|
44
44
|
title?: string;
|
|
45
45
|
description?: string;
|
|
46
46
|
input: SchemaDefinition<TAction>;
|
|
47
|
-
output: SchemaDefinition<
|
|
47
|
+
output: SchemaDefinition<ZuiObjectSchema>;
|
|
48
48
|
billable?: boolean;
|
|
49
49
|
cacheable?: boolean;
|
|
50
50
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { ActionDefinition, ChannelDefinition, EntityDefinition, EventDefinition } from '../integration/definition';
|
|
2
|
-
import {
|
|
3
|
-
type BaseEvents = Record<string,
|
|
4
|
-
type BaseActions = Record<string,
|
|
5
|
-
type BaseMessages = Record<string,
|
|
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>;
|
|
6
6
|
type BaseChannels = Record<string, BaseMessages>;
|
|
7
|
-
type BaseEntities = Record<string,
|
|
7
|
+
type BaseEntities = Record<string, ZuiObjectSchema>;
|
|
8
8
|
type EntityReferences<TEntities extends BaseEntities> = {
|
|
9
9
|
[K in keyof TEntities]: ZodRef;
|
|
10
10
|
};
|
|
@@ -25,12 +25,12 @@ type GenericActionDefinition<TEntities extends BaseEntities, TAction extends Bas
|
|
|
25
25
|
schema: GenericZuiSchema<EntityReferences<TEntities>, TAction>;
|
|
26
26
|
};
|
|
27
27
|
output: {
|
|
28
|
-
schema: GenericZuiSchema<EntityReferences<TEntities>,
|
|
28
|
+
schema: GenericZuiSchema<EntityReferences<TEntities>, ZuiObjectSchema>;
|
|
29
29
|
};
|
|
30
30
|
};
|
|
31
|
-
export type
|
|
32
|
-
name:
|
|
33
|
-
version:
|
|
31
|
+
export type InterfaceDefinitionProps<TName extends string = string, TVersion extends string = string, TEntities extends BaseEntities = BaseEntities, TActions extends BaseActions = BaseActions, TEvents extends BaseEntities = BaseEntities, TChannels extends BaseChannels = BaseChannels> = {
|
|
32
|
+
name: TName;
|
|
33
|
+
version: TVersion;
|
|
34
34
|
entities?: {
|
|
35
35
|
[K in keyof TEntities]: EntityDefinition<TEntities[K]>;
|
|
36
36
|
};
|
|
@@ -45,8 +45,8 @@ export type InterfaceDeclarationProps<TEntities extends BaseEntities = BaseEntit
|
|
|
45
45
|
};
|
|
46
46
|
templateName?: string;
|
|
47
47
|
};
|
|
48
|
-
export declare class
|
|
49
|
-
readonly props:
|
|
48
|
+
export declare class InterfaceDefinition<TName extends string = string, TVersion extends string = string, TEntities extends BaseEntities = BaseEntities, TActions extends BaseActions = BaseActions, TEvents extends BaseEvents = BaseEvents, TChannels extends BaseChannels = BaseChannels> {
|
|
49
|
+
readonly props: InterfaceDefinitionProps<TName, TVersion, TEntities, TActions, TEvents, TChannels>;
|
|
50
50
|
readonly name: this['props']['name'];
|
|
51
51
|
readonly version: this['props']['version'];
|
|
52
52
|
readonly entities: {
|
|
@@ -62,7 +62,7 @@ export declare class InterfaceDeclaration<TEntities extends BaseEntities = BaseE
|
|
|
62
62
|
[K in keyof TChannels]: ChannelDefinition<TChannels[K]>;
|
|
63
63
|
};
|
|
64
64
|
readonly templateName: this['props']['templateName'];
|
|
65
|
-
constructor(props:
|
|
65
|
+
constructor(props: InterfaceDefinitionProps<TName, TVersion, TEntities, TActions, TEvents, TChannels>);
|
|
66
66
|
private _getEntityReference;
|
|
67
67
|
}
|
|
68
68
|
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import * as utils from '../../utils/type-utils';
|
|
2
|
+
export type BaseChannel = {
|
|
3
|
+
messages: Record<string, any>;
|
|
4
|
+
};
|
|
5
|
+
export type BaseUser = {
|
|
6
|
+
tags: Record<string, any>;
|
|
7
|
+
};
|
|
8
|
+
export type BaseAction = {
|
|
9
|
+
input: any;
|
|
10
|
+
output: any;
|
|
11
|
+
};
|
|
12
|
+
export type BaseInterface = {
|
|
13
|
+
name: string;
|
|
14
|
+
version: string;
|
|
15
|
+
actions: Record<string, BaseAction>;
|
|
16
|
+
channels: Record<string, BaseChannel>;
|
|
17
|
+
events: Record<string, any>;
|
|
18
|
+
entities: Record<string, any>;
|
|
19
|
+
};
|
|
20
|
+
export type InputBaseChannel = utils.DeepPartial<BaseChannel>;
|
|
21
|
+
export type DefaultChannel<C extends InputBaseChannel> = {
|
|
22
|
+
messages: utils.Default<C['messages'], BaseChannel['messages']>;
|
|
23
|
+
};
|
|
24
|
+
export type InputBaseInterface = utils.DeepPartial<BaseInterface>;
|
|
25
|
+
export type DefaultInterface<I extends InputBaseInterface> = {
|
|
26
|
+
name: utils.Default<I['name'], BaseInterface['name']>;
|
|
27
|
+
version: utils.Default<I['version'], BaseInterface['version']>;
|
|
28
|
+
actions: utils.Default<I['actions'], BaseInterface['actions']>;
|
|
29
|
+
events: utils.Default<I['events'], BaseInterface['events']>;
|
|
30
|
+
entities: utils.Default<I['entities'], BaseInterface['entities']>;
|
|
31
|
+
channels: undefined extends I['channels'] ? BaseInterface['channels'] : {
|
|
32
|
+
[K in keyof I['channels']]: DefaultChannel<utils.Cast<I['channels'][K], InputBaseChannel>>;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/package.d.ts
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
1
2
|
import * as integration from './integration';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
} | {
|
|
5
|
-
uri?: string;
|
|
6
|
-
};
|
|
7
|
-
type IntegrationPackageDefinition = {
|
|
3
|
+
import * as plugin from './plugin';
|
|
4
|
+
type NameVersion = {
|
|
8
5
|
name: string;
|
|
9
6
|
version: string;
|
|
7
|
+
};
|
|
8
|
+
type PackageReference = NameVersion & {
|
|
9
|
+
id?: string;
|
|
10
|
+
uri?: string;
|
|
11
|
+
};
|
|
12
|
+
type IntegrationPackageDefinition = NameVersion & {
|
|
10
13
|
configuration?: integration.ConfigurationDefinition;
|
|
11
14
|
configurations?: Record<string, integration.AdditionalConfigurationDefinition>;
|
|
12
15
|
events?: Record<string, integration.EventDefinition>;
|
|
@@ -16,17 +19,27 @@ type IntegrationPackageDefinition = {
|
|
|
16
19
|
user?: integration.UserDefinition;
|
|
17
20
|
secrets?: Record<string, integration.SecretDefinition>;
|
|
18
21
|
entities?: Record<string, integration.EntityDefinition>;
|
|
19
|
-
interfaces?: Record<string,
|
|
22
|
+
interfaces?: Record<string, PackageReference>;
|
|
20
23
|
};
|
|
21
|
-
type InterfacePackageDefinition = {
|
|
22
|
-
name: string;
|
|
23
|
-
version: string;
|
|
24
|
+
type InterfacePackageDefinition = NameVersion & {
|
|
24
25
|
templateName?: string;
|
|
25
26
|
entities?: Record<string, integration.EntityDefinition>;
|
|
26
27
|
events?: Record<string, integration.EventDefinition>;
|
|
27
28
|
actions?: Record<string, integration.ActionDefinition>;
|
|
28
29
|
channels?: Record<string, integration.ChannelDefinition>;
|
|
29
30
|
};
|
|
31
|
+
type PluginPackageDefinition = NameVersion & {
|
|
32
|
+
integrations?: Record<string, PackageReference>;
|
|
33
|
+
interfaces?: Record<string, PackageReference>;
|
|
34
|
+
user?: plugin.UserDefinition;
|
|
35
|
+
conversation?: plugin.ConversationDefinition;
|
|
36
|
+
message?: plugin.MessageDefinition;
|
|
37
|
+
states?: Record<string, plugin.StateDefinition>;
|
|
38
|
+
configuration?: plugin.ConfigurationDefinition;
|
|
39
|
+
events?: Record<string, plugin.EventDefinition>;
|
|
40
|
+
recurringEvents?: Record<string, plugin.RecurringEventDefinition>;
|
|
41
|
+
actions?: Record<string, plugin.ActionDefinition>;
|
|
42
|
+
};
|
|
30
43
|
export type IntegrationPackage = PackageReference & {
|
|
31
44
|
type: 'integration';
|
|
32
45
|
definition: IntegrationPackageDefinition;
|
|
@@ -37,5 +50,10 @@ export type InterfacePackage = PackageReference & {
|
|
|
37
50
|
definition: InterfacePackageDefinition;
|
|
38
51
|
implementation?: null;
|
|
39
52
|
};
|
|
40
|
-
export type
|
|
53
|
+
export type PluginPackage = PackageReference & {
|
|
54
|
+
type: 'plugin';
|
|
55
|
+
definition: PluginPackageDefinition;
|
|
56
|
+
implementation: Buffer;
|
|
57
|
+
};
|
|
58
|
+
export type Package = IntegrationPackage | InterfacePackage | PluginPackage;
|
|
41
59
|
export {};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { StateDefinition, RecurringEventDefinition, EventDefinition, ConfigurationDefinition, UserDefinition, ConversationDefinition, MessageDefinition, ActionDefinition } from '../bot/definition';
|
|
2
|
+
import { IntegrationPackage, InterfacePackage } from '../package';
|
|
3
|
+
import { ZuiObjectSchema } from '../zui';
|
|
4
|
+
export { StateDefinition, RecurringEventDefinition, EventDefinition, ConfigurationDefinition, UserDefinition, ConversationDefinition, MessageDefinition, ActionDefinition, IntegrationConfigInstance, } from '../bot/definition';
|
|
5
|
+
type BaseConfig = ZuiObjectSchema;
|
|
6
|
+
type BaseStates = Record<string, ZuiObjectSchema>;
|
|
7
|
+
type BaseEvents = Record<string, ZuiObjectSchema>;
|
|
8
|
+
type BaseActions = Record<string, ZuiObjectSchema>;
|
|
9
|
+
type BaseInterfaces = Record<string, any>;
|
|
10
|
+
type BaseIntegrations = Record<string, any>;
|
|
11
|
+
export type PluginDefinitionProps<TName extends string = string, TVersion extends string = string, TConfig extends BaseConfig = BaseConfig, TStates extends BaseStates = BaseStates, TEvents extends BaseEvents = BaseEvents, TActions extends BaseActions = BaseActions, TInterfaces extends BaseInterfaces = BaseInterfaces, TIntegrations extends BaseIntegrations = BaseIntegrations> = {
|
|
12
|
+
name: TName;
|
|
13
|
+
version: TVersion;
|
|
14
|
+
integrations?: {
|
|
15
|
+
[K in keyof TIntegrations]: IntegrationPackage;
|
|
16
|
+
};
|
|
17
|
+
interfaces?: {
|
|
18
|
+
[K in keyof TInterfaces]: InterfacePackage;
|
|
19
|
+
};
|
|
20
|
+
user?: UserDefinition;
|
|
21
|
+
conversation?: ConversationDefinition;
|
|
22
|
+
message?: MessageDefinition;
|
|
23
|
+
states?: {
|
|
24
|
+
[K in keyof TStates]: StateDefinition<TStates[K]>;
|
|
25
|
+
};
|
|
26
|
+
configuration?: ConfigurationDefinition<TConfig>;
|
|
27
|
+
events?: {
|
|
28
|
+
[K in keyof TEvents]: EventDefinition<TEvents[K]>;
|
|
29
|
+
};
|
|
30
|
+
recurringEvents?: Record<string, RecurringEventDefinition<TEvents>>;
|
|
31
|
+
actions?: {
|
|
32
|
+
[K in keyof TActions]: ActionDefinition<TActions[K]>;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
export declare class PluginDefinition<TName extends string = string, TVersion extends string = string, TConfig extends BaseConfig = BaseConfig, TStates extends BaseStates = BaseStates, TEvents extends BaseEvents = BaseEvents, TActions extends BaseActions = BaseActions, TInterfaces extends BaseInterfaces = BaseInterfaces, TIntegrations extends BaseIntegrations = BaseIntegrations> {
|
|
36
|
+
readonly props: PluginDefinitionProps<TName, TVersion, TConfig, TStates, TEvents, TActions, TInterfaces, TIntegrations>;
|
|
37
|
+
readonly name: this['props']['name'];
|
|
38
|
+
readonly version: this['props']['version'];
|
|
39
|
+
readonly integrations: this['props']['integrations'];
|
|
40
|
+
readonly interfaces: this['props']['interfaces'];
|
|
41
|
+
readonly user: this['props']['user'];
|
|
42
|
+
readonly conversation: this['props']['conversation'];
|
|
43
|
+
readonly message: this['props']['message'];
|
|
44
|
+
readonly states: this['props']['states'];
|
|
45
|
+
readonly configuration: this['props']['configuration'];
|
|
46
|
+
readonly events: this['props']['events'];
|
|
47
|
+
readonly recurringEvents: this['props']['recurringEvents'];
|
|
48
|
+
readonly actions: this['props']['actions'];
|
|
49
|
+
constructor(props: PluginDefinitionProps<TName, TVersion, TConfig, TStates, TEvents, TActions, TInterfaces, TIntegrations>);
|
|
50
|
+
}
|