@botpress/sdk 1.6.3 → 2.0.1
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 +2 -2
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
|
|
2
|
-
> @botpress/sdk@
|
|
2
|
+
> @botpress/sdk@2.0.1 build /home/runner/work/botpress/botpress/packages/sdk
|
|
3
3
|
> pnpm build:type && pnpm build:node
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
> @botpress/sdk@
|
|
6
|
+
> @botpress/sdk@2.0.1 build:type /home/runner/work/botpress/botpress/packages/sdk
|
|
7
7
|
> tsc --emitDeclarationOnly --declaration
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
> @botpress/sdk@
|
|
10
|
+
> @botpress/sdk@2.0.1 build:node /home/runner/work/botpress/botpress/packages/sdk
|
|
11
11
|
> ts-node -T build.ts
|
|
12
12
|
|
|
@@ -41,6 +41,7 @@ export declare class BotSpecificClient<TBot extends common.BaseBot> implements t
|
|
|
41
41
|
getFile: types.GetFile<TBot>;
|
|
42
42
|
updateFileMetadata: types.UpdateFileMetadata<TBot>;
|
|
43
43
|
searchFiles: types.SearchFiles<TBot>;
|
|
44
|
+
trackAnalytics: types.TrackAnalytics<TBot>;
|
|
44
45
|
/**
|
|
45
46
|
* @deprecated Use `callAction` to delegate the conversation creation to an integration.
|
|
46
47
|
*/
|
|
@@ -86,6 +86,7 @@ export type ListFiles<_TBot extends common.BaseBot> = client.Client['listFiles']
|
|
|
86
86
|
export type GetFile<_TBot extends common.BaseBot> = client.Client['getFile'];
|
|
87
87
|
export type UpdateFileMetadata<_TBot extends common.BaseBot> = client.Client['updateFileMetadata'];
|
|
88
88
|
export type SearchFiles<_TBot extends common.BaseBot> = client.Client['searchFiles'];
|
|
89
|
+
export type TrackAnalytics<_TBot extends common.BaseBot> = client.Client['trackAnalytics'];
|
|
89
90
|
export type ClientOperations<TBot extends common.BaseBot> = {
|
|
90
91
|
getConversation: GetConversation<TBot>;
|
|
91
92
|
listConversations: ListConversations<TBot>;
|
|
@@ -119,6 +120,7 @@ export type ClientOperations<TBot extends common.BaseBot> = {
|
|
|
119
120
|
getFile: GetFile<TBot>;
|
|
120
121
|
updateFileMetadata: UpdateFileMetadata<TBot>;
|
|
121
122
|
searchFiles: SearchFiles<TBot>;
|
|
123
|
+
trackAnalytics: TrackAnalytics<TBot>;
|
|
122
124
|
};
|
|
123
125
|
export type ClientInputs<TBot extends common.BaseBot> = {
|
|
124
126
|
[K in keyof ClientOperations<TBot>]: Arg<ClientOperations<TBot>[K]>;
|
package/dist/bot/definition.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { IntegrationPackage } from '../package';
|
|
1
|
+
import { IntegrationPackage, PluginPackage } from '../package';
|
|
2
2
|
import { SchemaDefinition } from '../schema';
|
|
3
3
|
import { ValueOf } from '../utils/type-utils';
|
|
4
|
-
import z, {
|
|
5
|
-
type
|
|
6
|
-
type
|
|
7
|
-
type
|
|
4
|
+
import z, { ZuiObjectSchema } from '../zui';
|
|
5
|
+
type BaseConfig = ZuiObjectSchema;
|
|
6
|
+
type BaseStates = Record<string, ZuiObjectSchema>;
|
|
7
|
+
type BaseEvents = Record<string, ZuiObjectSchema>;
|
|
8
|
+
type BaseActions = Record<string, ZuiObjectSchema>;
|
|
8
9
|
export type TagDefinition = {
|
|
9
10
|
title?: string;
|
|
10
11
|
description?: string;
|
|
@@ -24,7 +25,7 @@ export type RecurringEventDefinition<TEvents extends BaseEvents = BaseEvents> =
|
|
|
24
25
|
};
|
|
25
26
|
}[keyof TEvents];
|
|
26
27
|
export type EventDefinition<TEvent extends BaseEvents[string] = BaseEvents[string]> = SchemaDefinition<TEvent>;
|
|
27
|
-
export type ConfigurationDefinition = SchemaDefinition
|
|
28
|
+
export type ConfigurationDefinition<TConfig extends BaseConfig = BaseConfig> = SchemaDefinition<TConfig>;
|
|
28
29
|
export type UserDefinition = {
|
|
29
30
|
tags?: Record<string, TagDefinition>;
|
|
30
31
|
};
|
|
@@ -38,7 +39,7 @@ export type ActionDefinition<TAction extends BaseActions[string] = BaseActions[s
|
|
|
38
39
|
title?: string;
|
|
39
40
|
description?: string;
|
|
40
41
|
input: SchemaDefinition<TAction>;
|
|
41
|
-
output: SchemaDefinition<
|
|
42
|
+
output: SchemaDefinition<ZuiObjectSchema>;
|
|
42
43
|
};
|
|
43
44
|
export type IntegrationConfigInstance<I extends IntegrationPackage = IntegrationPackage> = {
|
|
44
45
|
enabled: boolean;
|
|
@@ -51,11 +52,24 @@ export type IntegrationConfigInstance<I extends IntegrationPackage = Integration
|
|
|
51
52
|
configuration: z.infer<NonNullable<I['definition']['configurations']>[K]['schema']>;
|
|
52
53
|
};
|
|
53
54
|
}>);
|
|
55
|
+
export type PluginConfigInstance<P extends PluginPackage = PluginPackage> = {
|
|
56
|
+
configuration: z.infer<NonNullable<P['definition']['configuration']>['schema']>;
|
|
57
|
+
interfaces: {
|
|
58
|
+
[I in keyof NonNullable<P['definition']['interfaces']>]: {
|
|
59
|
+
name: string;
|
|
60
|
+
version: string;
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
};
|
|
54
64
|
export type IntegrationInstance = IntegrationPackage & IntegrationConfigInstance;
|
|
65
|
+
export type PluginInstance = PluginPackage & PluginConfigInstance;
|
|
55
66
|
export type BotDefinitionProps<TStates extends BaseStates = BaseStates, TEvents extends BaseEvents = BaseEvents, TActions extends BaseActions = BaseActions> = {
|
|
56
67
|
integrations?: {
|
|
57
68
|
[K: string]: IntegrationInstance;
|
|
58
69
|
};
|
|
70
|
+
plugins?: {
|
|
71
|
+
[K: string]: PluginInstance;
|
|
72
|
+
};
|
|
59
73
|
user?: UserDefinition;
|
|
60
74
|
conversation?: ConversationDefinition;
|
|
61
75
|
message?: MessageDefinition;
|
|
@@ -74,6 +88,7 @@ export type BotDefinitionProps<TStates extends BaseStates = BaseStates, TEvents
|
|
|
74
88
|
export declare class BotDefinition<TStates extends BaseStates = BaseStates, TEvents extends BaseEvents = BaseEvents, TActions extends BaseActions = BaseActions> {
|
|
75
89
|
readonly props: BotDefinitionProps<TStates, TEvents, TActions>;
|
|
76
90
|
readonly integrations: this['props']['integrations'];
|
|
91
|
+
readonly plugins: this['props']['plugins'];
|
|
77
92
|
readonly user: this['props']['user'];
|
|
78
93
|
readonly conversation: this['props']['conversation'];
|
|
79
94
|
readonly message: this['props']['message'];
|
|
@@ -83,6 +98,14 @@ export declare class BotDefinition<TStates extends BaseStates = BaseStates, TEve
|
|
|
83
98
|
readonly recurringEvents: this['props']['recurringEvents'];
|
|
84
99
|
readonly actions: this['props']['actions'];
|
|
85
100
|
constructor(props: BotDefinitionProps<TStates, TEvents, TActions>);
|
|
86
|
-
|
|
101
|
+
addIntegration<I extends IntegrationPackage>(integrationPkg: I, config: IntegrationConfigInstance<I>): this;
|
|
102
|
+
addPlugin<P extends PluginPackage>(pluginPkg: P, config: PluginConfigInstance<P>): this;
|
|
103
|
+
private _mergeUser;
|
|
104
|
+
private _mergeConversation;
|
|
105
|
+
private _mergeMessage;
|
|
106
|
+
private _mergeStates;
|
|
107
|
+
private _mergeEvents;
|
|
108
|
+
private _mergeRecurringEvents;
|
|
109
|
+
private _mergeActions;
|
|
87
110
|
}
|
|
88
111
|
export {};
|