@botpress/sdk 4.10.0 → 4.11.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.
@@ -1,18 +1,18 @@
1
1
 
2
- > @botpress/sdk@4.10.0 build /home/runner/work/botpress/botpress/packages/sdk
2
+ > @botpress/sdk@4.11.1 build /home/runner/work/botpress/botpress/packages/sdk
3
3
  > pnpm build:type && pnpm build:node && pnpm build:browser
4
4
 
5
5
 
6
- > @botpress/sdk@4.10.0 build:type /home/runner/work/botpress/botpress/packages/sdk
6
+ > @botpress/sdk@4.11.1 build:type /home/runner/work/botpress/botpress/packages/sdk
7
7
  > tsc --emitDeclarationOnly --declaration
8
8
 
9
9
 
10
- > @botpress/sdk@4.10.0 build:node /home/runner/work/botpress/botpress/packages/sdk
10
+ > @botpress/sdk@4.11.1 build:node /home/runner/work/botpress/botpress/packages/sdk
11
11
  > ts-node -T ./build.ts --node
12
12
 
13
13
  Done
14
14
 
15
- > @botpress/sdk@4.10.0 build:browser /home/runner/work/botpress/botpress/packages/sdk
15
+ > @botpress/sdk@4.11.1 build:browser /home/runner/work/botpress/botpress/packages/sdk
16
16
  > ts-node -T ./build.ts --browser
17
17
 
18
18
  Done
@@ -3,12 +3,12 @@ import { IntegrationPackage, PluginPackage } from '../package';
3
3
  import { PluginInterfaceExtension } from '../plugin';
4
4
  import { SchemaDefinition } from '../schema';
5
5
  import { ValueOf, Merge, StringKeys } from '../utils/type-utils';
6
- import z, { ZuiObjectSchema } from '../zui';
6
+ import z, { ZuiObjectSchema, ZuiObjectOrRefSchema } from '../zui';
7
7
  type BaseConfig = ZuiObjectSchema;
8
- type BaseStates = Record<string, ZuiObjectSchema>;
9
- type BaseEvents = Record<string, ZuiObjectSchema>;
10
- type BaseActions = Record<string, ZuiObjectSchema>;
11
- type BaseTables = Record<string, ZuiObjectSchema>;
8
+ type BaseStates = Record<string, ZuiObjectOrRefSchema>;
9
+ type BaseEvents = Record<string, ZuiObjectOrRefSchema>;
10
+ type BaseActions = Record<string, ZuiObjectOrRefSchema>;
11
+ type BaseTables = Record<string, ZuiObjectOrRefSchema>;
12
12
  type BaseWorkflows = Record<string, ZuiObjectSchema>;
13
13
  export type TagDefinition = {
14
14
  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<ZuiObjectOrRefSchema>;
49
49
  attributes?: Record<string, string>;
50
50
  };
51
51
  export type WorkflowDefinition<TWorkflow extends BaseWorkflows[string] = BaseWorkflows[string]> = {
@@ -127,6 +127,8 @@ export declare class BotDefinition<TStates extends BaseStates = BaseStates, TEve
127
127
  readonly tables: this['props']['tables'];
128
128
  readonly workflows: this['props']['workflows'];
129
129
  readonly attributes: this['props']['attributes'];
130
+ /** Bot definition with plugins merged into it */
131
+ readonly withPlugins: Pick<this['props'], 'user' | 'conversation' | 'message' | 'states' | 'events' | 'recurringEvents' | 'actions' | 'tables' | 'workflows'>;
130
132
  constructor(props: BotDefinitionProps<TStates, TEvents, TActions, TTables, TWorkflows>);
131
133
  addIntegration<I extends IntegrationPackage>(integrationPkg: I, config: IntegrationConfigInstance<I>): this;
132
134
  addPlugin<P extends PluginPackage>(pluginPkg: P, config: PluginConfigInstance<P>): this;
@@ -139,6 +141,16 @@ export declare class BotDefinition<TStates extends BaseStates = BaseStates, TEve
139
141
  private _mergeActions;
140
142
  private _mergeTables;
141
143
  private _mergeWorkflows;
142
- private _prefixKeys;
144
+ private _prefixKeysWithPluginAlias;
145
+ /**
146
+ * Returns a copy of the bot definition where all interface entity references
147
+ * are resolved to the base entity schema as extended by the backing
148
+ * integration.
149
+ */
150
+ dereferencePluginEntities(): this;
151
+ private _buildZuiReferenceMap;
152
+ private _dereferenceZuiSchema;
153
+ private _dereferenceDefinitionSchemas;
154
+ private _dereferenceActionDefinitionSchemas;
143
155
  }
144
156
  export {};
@@ -347,10 +347,10 @@ export type BotHandlers<TBot extends common.BaseBot> = {
347
347
  hookHandlers: HookHandlersMap<TBot>;
348
348
  workflowHandlers: WorkflowHandlersMap<TBot>;
349
349
  };
350
- type _GetPluginPrefix<TKey extends string, TPlugin extends plugin.BasePlugin> = TKey extends TPlugin['name'] ? '' : `${TKey}#`;
350
+ type _GetPluginPrefix<TKey extends string> = `${TKey}#`;
351
351
  type ImplementedActions<_TBot extends common.BaseBot, TPlugins extends Record<string, plugin.BasePlugin>> = utils.UnionToIntersection<utils.ValueOf<{
352
352
  [TPlugin in utils.StringKeys<TPlugins>]: {
353
- [TAction in utils.StringKeys<TPlugins[TPlugin]['actions']> as `${_GetPluginPrefix<utils.Cast<TPlugin, string>, TPlugins[TPlugin]>}${utils.Cast<TAction, string>}`]: TPlugins[TPlugin]['actions'][TAction];
353
+ [TAction in utils.StringKeys<TPlugins[TPlugin]['actions']> as `${_GetPluginPrefix<utils.Cast<TPlugin, string>>}${utils.Cast<TAction, string>}`]: TPlugins[TPlugin]['actions'][TAction];
354
354
  };
355
355
  }>>;
356
356
  type UnimplementedActions<TBot extends common.BaseBot, TPlugins extends Record<string, plugin.BasePlugin>> = Omit<TBot['actions'], utils.StringKeys<ImplementedActions<TBot, TPlugins>>>;