@botpress/sdk 4.11.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.
- package/.turbo/turbo-build.log +4 -4
- package/dist/index.cjs +10 -10
- package/dist/index.cjs.map +3 -3
- package/dist/index.mjs +21 -21
- package/dist/index.mjs.map +3 -3
- package/dist/integration/implementation.d.ts +3 -3
- package/dist/integration/server/types.d.ts +3 -4
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Server } from 'node:http';
|
|
2
2
|
import { BaseIntegration } from './common';
|
|
3
|
-
import { RegisterHandler as RegisterFunction, UnregisterHandler as UnregisterFunction, WebhookHandler as WebhookFunction, CreateUserHandler as CreateUserFunction, CreateConversationHandler as CreateConversationFunction, ActionHandlers as ActionFunctions, ChannelHandlers as ChannelFunctions,
|
|
3
|
+
import { RegisterHandler as RegisterFunction, UnregisterHandler as UnregisterFunction, WebhookHandler as WebhookFunction, CreateUserHandler as CreateUserFunction, CreateConversationHandler as CreateConversationFunction, ActionHandlers as ActionFunctions, ChannelHandlers as ChannelFunctions, UnknownOperationHandler as UnknownOperationFunction } from './server';
|
|
4
4
|
export type IntegrationImplementationProps<TIntegration extends BaseIntegration = BaseIntegration> = {
|
|
5
5
|
register: RegisterFunction<TIntegration>;
|
|
6
6
|
unregister: UnregisterFunction<TIntegration>;
|
|
@@ -16,7 +16,7 @@ export type IntegrationImplementationProps<TIntegration extends BaseIntegration
|
|
|
16
16
|
actions: ActionFunctions<TIntegration>;
|
|
17
17
|
channels: ChannelFunctions<TIntegration>;
|
|
18
18
|
__advanced?: {
|
|
19
|
-
|
|
19
|
+
unknownOperationHandler?: UnknownOperationFunction<TIntegration>;
|
|
20
20
|
};
|
|
21
21
|
};
|
|
22
22
|
export declare class IntegrationImplementation<TIntegration extends BaseIntegration = BaseIntegration> {
|
|
@@ -28,7 +28,7 @@ export declare class IntegrationImplementation<TIntegration extends BaseIntegrat
|
|
|
28
28
|
readonly createUser: IntegrationImplementationProps<TIntegration>['createUser'];
|
|
29
29
|
readonly createConversation: IntegrationImplementationProps<TIntegration>['createConversation'];
|
|
30
30
|
readonly webhook: IntegrationImplementationProps<TIntegration>['handler'];
|
|
31
|
-
readonly
|
|
31
|
+
readonly unknownOperationHandler: NonNullable<IntegrationImplementationProps<TIntegration>['__advanced']>['unknownOperationHandler'];
|
|
32
32
|
constructor(props: IntegrationImplementationProps<TIntegration>);
|
|
33
33
|
readonly handler: (req: import("../serve").Request) => Promise<import("../serve").Response | void>;
|
|
34
34
|
readonly start: (port?: number) => Promise<Server>;
|
|
@@ -4,7 +4,6 @@ import { Cast, Merge, ValueOf } from '../../utils/type-utils';
|
|
|
4
4
|
import { IntegrationSpecificClient } from '../client';
|
|
5
5
|
import { BaseIntegration, ToTags } from '../common';
|
|
6
6
|
import { type IntegrationLogger } from './integration-logger';
|
|
7
|
-
type IntegrationOperation = 'webhook_received' | 'message_created' | 'action_triggered' | 'register' | 'unregister' | 'ping' | 'create_user' | 'create_conversation';
|
|
8
7
|
type IntegrationContextConfig<TIntegration extends BaseIntegration> = {
|
|
9
8
|
configurationType: null;
|
|
10
9
|
configuration: TIntegration['configuration'];
|
|
@@ -19,7 +18,7 @@ export type IntegrationContext<TIntegration extends BaseIntegration = BaseIntegr
|
|
|
19
18
|
botUserId: string;
|
|
20
19
|
integrationId: string;
|
|
21
20
|
webhookId: string;
|
|
22
|
-
operation:
|
|
21
|
+
operation: string;
|
|
23
22
|
} & IntegrationContextConfig<TIntegration>;
|
|
24
23
|
export type CommonHandlerProps<TIntegration extends BaseIntegration> = {
|
|
25
24
|
ctx: IntegrationContext<TIntegration>;
|
|
@@ -90,7 +89,7 @@ export type ChannelHandlers<TIntegration extends BaseIntegration> = {
|
|
|
90
89
|
};
|
|
91
90
|
};
|
|
92
91
|
};
|
|
93
|
-
export type
|
|
92
|
+
export type UnknownOperationHandler<TIntegration extends BaseIntegration> = (props: CommonHandlerProps<TIntegration> & {
|
|
94
93
|
req: Request;
|
|
95
94
|
}) => Promise<Response | void>;
|
|
96
95
|
export type IntegrationHandlers<TIntegration extends BaseIntegration> = {
|
|
@@ -101,6 +100,6 @@ export type IntegrationHandlers<TIntegration extends BaseIntegration> = {
|
|
|
101
100
|
createConversation?: CreateConversationHandler<TIntegration>;
|
|
102
101
|
actions: ActionHandlers<TIntegration>;
|
|
103
102
|
channels: ChannelHandlers<TIntegration>;
|
|
104
|
-
|
|
103
|
+
unknownOperationHandler?: UnknownOperationHandler<TIntegration>;
|
|
105
104
|
};
|
|
106
105
|
export {};
|