@wabot-dev/framework 0.2.0-beta.8 → 0.2.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/dist/src/addon/auth/api-key/@apiKeyHandshakeGuard.js +16 -0
- package/dist/src/addon/auth/api-key/{ApiKeyConnectionGuardMiddleware.js → ApiKeyHandshakeGuardMiddleware.js} +4 -4
- package/dist/src/addon/auth/jwt/@jwtHandshakeGuard.js +16 -0
- package/dist/src/addon/auth/jwt/{JwtConnectionGuardMiddleware.js → JwtHandshakeGuardMiddleware.js} +4 -4
- package/dist/src/addon/chat-bot/anthropic/AnthropicChatAdapter.js +18 -20
- package/dist/src/addon/chat-bot/deepseek/DeepSeekChatAdapter.js +2 -2
- package/dist/src/addon/chat-bot/google/GoogleChatAdapter.js +81 -70
- package/dist/src/addon/chat-bot/openia/OpenaiChatAdapter.js +43 -19
- package/dist/src/addon/chat-bot/wabot/WabotChatAdapter.js +1 -1
- package/dist/src/addon/chat-controller/cmd/CmdChannel.js +17 -10
- package/dist/src/addon/chat-controller/socket/@socket.js +1 -1
- package/dist/src/addon/chat-controller/socket/SocketChannel.js +74 -33
- package/dist/src/addon/chat-controller/socket/SocketChannelConfig.js +6 -4
- package/dist/src/core/auth/Auth.js +6 -0
- package/dist/src/feature/chat-bot/ChatAdapter.js +1 -1
- package/dist/src/feature/chat-bot/ChatBot.js +14 -10
- package/dist/src/feature/chat-controller/runChatControllers.js +6 -7
- package/dist/src/feature/rest-controller/runRestControllers.js +1 -1
- package/dist/src/feature/socket-controller/metadata/@handshakeMiddlewares.js +16 -0
- package/dist/src/feature/socket-controller/metadata/{@socketEvent.js → @onSocketEvent.js} +2 -2
- package/dist/src/feature/socket-controller/metadata/SocketControllerMetadataStore.js +12 -34
- package/dist/src/feature/socket-controller/runSocketControllers.js +96 -77
- package/dist/src/index.d.ts +50 -61
- package/dist/src/index.js +7 -8
- package/package.json +5 -6
- package/dist/src/addon/auth/api-key/@apiKeyConnectionGuard.js +0 -16
- package/dist/src/addon/auth/jwt/@jwtConnectionGuard.js +0 -16
- package/dist/src/feature/socket-controller/metadata/@connectionMiddleware.js +0 -16
- package/dist/src/feature/socket-controller/metadata/@socketConnection.js +0 -18
package/dist/src/index.d.ts
CHANGED
|
@@ -23,11 +23,13 @@ declare class Storable<D extends IStorableData> {
|
|
|
23
23
|
|
|
24
24
|
declare class Auth<D extends IStorableData> {
|
|
25
25
|
private authInfo;
|
|
26
|
+
private overrided;
|
|
26
27
|
require(): D;
|
|
27
28
|
assign(authInfo: D): void;
|
|
28
29
|
override(authInfo: D): void;
|
|
29
30
|
clear(): void;
|
|
30
31
|
isAssigned(): boolean;
|
|
32
|
+
wasOverrided(): boolean;
|
|
31
33
|
}
|
|
32
34
|
|
|
33
35
|
interface IEntityData extends IStorableData {
|
|
@@ -613,24 +615,24 @@ interface ILanguageModelUsage {
|
|
|
613
615
|
outputTokens: number;
|
|
614
616
|
}
|
|
615
617
|
|
|
616
|
-
interface
|
|
618
|
+
interface IChatAdapterNextItemsReq {
|
|
617
619
|
model: string;
|
|
618
620
|
systemPrompt: string;
|
|
619
621
|
tools: IMindsetTool[];
|
|
620
622
|
prevItems: IChatItem[];
|
|
621
623
|
}
|
|
622
|
-
interface
|
|
623
|
-
|
|
624
|
+
interface IChatAdapterNextItemsRes {
|
|
625
|
+
nextItems: IChatItem[];
|
|
624
626
|
usage: ILanguageModelUsage;
|
|
625
627
|
}
|
|
626
628
|
interface IChatAdapter {
|
|
627
|
-
|
|
629
|
+
nextItems(req: IChatAdapterNextItemsReq): Promise<IChatAdapterNextItemsRes>;
|
|
628
630
|
}
|
|
629
631
|
|
|
630
632
|
declare class ChatAdapter implements IChatAdapter {
|
|
631
|
-
|
|
633
|
+
nextItems(req: IChatAdapterNextItemsReq & {
|
|
632
634
|
provider?: string;
|
|
633
|
-
}): Promise<
|
|
635
|
+
}): Promise<IChatAdapterNextItemsRes>;
|
|
634
636
|
}
|
|
635
637
|
|
|
636
638
|
type IChatItemData = IEntityData & IChatItem;
|
|
@@ -707,8 +709,7 @@ interface IReceivedMessage {
|
|
|
707
709
|
|
|
708
710
|
interface IChannelMessage extends IReceivedMessage {
|
|
709
711
|
chatConnection: IChatConnection;
|
|
710
|
-
|
|
711
|
-
setAuthInfo?: (authInfo: IStorableData | undefined) => void;
|
|
712
|
+
injectInstances?: [any, any][];
|
|
712
713
|
}
|
|
713
714
|
|
|
714
715
|
interface IChatChannel {
|
|
@@ -924,17 +925,11 @@ declare class SocketServerProvider {
|
|
|
924
925
|
private createSocketServer;
|
|
925
926
|
}
|
|
926
927
|
|
|
927
|
-
interface
|
|
928
|
+
interface IHandshakeMiddleware {
|
|
928
929
|
handle(socket: Socket, container: DependencyContainer$1): Promise<void>;
|
|
929
930
|
}
|
|
930
931
|
|
|
931
|
-
declare function
|
|
932
|
-
|
|
933
|
-
interface ISocketConnectionConfig {
|
|
934
|
-
namespace: string;
|
|
935
|
-
}
|
|
936
|
-
|
|
937
|
-
declare function socketConnection(config?: string | ISocketConnectionConfig): (target: object, propertyKey: string | symbol) => void;
|
|
932
|
+
declare function handshakeMiddlewares(middlewares: IConstructor<IHandshakeMiddleware>[]): (target: IConstructor<any>) => void;
|
|
938
933
|
|
|
939
934
|
interface ISocketControllerConfig {
|
|
940
935
|
namespace: string;
|
|
@@ -943,23 +938,14 @@ interface ISocketControllerConfig {
|
|
|
943
938
|
declare function socketController(config?: string | ISocketControllerConfig): (target: IConstructor<any>) => void;
|
|
944
939
|
|
|
945
940
|
interface ISocketEventConfig {
|
|
946
|
-
namespace?: string;
|
|
947
941
|
event: string;
|
|
948
942
|
}
|
|
949
943
|
|
|
950
|
-
declare function
|
|
951
|
-
|
|
952
|
-
interface IConnectionMiddlewareMetadata {
|
|
953
|
-
controllerConstructor: IConstructor<any>;
|
|
954
|
-
functionName: string;
|
|
955
|
-
middlewareConstructor: IConstructor<IConnectionMiddleware>;
|
|
956
|
-
}
|
|
944
|
+
declare function onSocketEvent(config: string | ISocketEventConfig): (target: object, propertyKey: string | symbol) => void;
|
|
957
945
|
|
|
958
|
-
interface
|
|
959
|
-
config?: ISocketConnectionConfig;
|
|
946
|
+
interface IHandshakeMiddlewareMetadata {
|
|
960
947
|
controllerConstructor: IConstructor<any>;
|
|
961
|
-
|
|
962
|
-
paramsTypes: any[];
|
|
948
|
+
middlewareConstructor: IConstructor<IHandshakeMiddleware>;
|
|
963
949
|
}
|
|
964
950
|
|
|
965
951
|
interface ISocketControllerMetadata {
|
|
@@ -976,22 +962,16 @@ interface ISocketEventMetadata {
|
|
|
976
962
|
|
|
977
963
|
declare class SocketControllerMetadataStore {
|
|
978
964
|
private socketControllers;
|
|
979
|
-
private socketConnections;
|
|
980
965
|
private socketEvents;
|
|
981
|
-
private
|
|
966
|
+
private handshakeMiddlewares;
|
|
982
967
|
saveControllerMetadata(controllerMetadata: ISocketControllerMetadata): void;
|
|
983
|
-
saveSocketConnectionMetadata(socketConnectionMetadata: ISocketConnectionMetadata): void;
|
|
984
968
|
saveSocketEventMetadata(socketEventMetadata: ISocketEventMetadata): void;
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
events: ISocketEventMetadata[];
|
|
988
|
-
connectionMiddlewares: IConnectionMiddlewareMetadata[];
|
|
969
|
+
saveHandshakeMiddlewareMetadata(handshakeMetadata: IHandshakeMiddlewareMetadata): void;
|
|
970
|
+
getSocketControllerInfo(controllerConstructor: IConstructor<any>): {
|
|
989
971
|
controller: ISocketControllerMetadata;
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
paramsTypes: any[];
|
|
994
|
-
}[];
|
|
972
|
+
events: Map<string, ISocketEventMetadata>;
|
|
973
|
+
handShakeMiddlewares: IHandshakeMiddlewareMetadata[] | undefined;
|
|
974
|
+
};
|
|
995
975
|
}
|
|
996
976
|
|
|
997
977
|
declare function runSocketControllers(controllers: IConstructor<any>[]): void;
|
|
@@ -1000,7 +980,7 @@ declare class PgJobRepository extends PgCrudRepository<Job> implements IJobRepos
|
|
|
1000
980
|
constructor(pool: Pool);
|
|
1001
981
|
}
|
|
1002
982
|
|
|
1003
|
-
declare function
|
|
983
|
+
declare function apiKeyHandshakeGuard(): (target: IConstructor<any>) => void;
|
|
1004
984
|
|
|
1005
985
|
declare function apiKeyGuard(): (target: object, propertyKey: string | symbol) => void;
|
|
1006
986
|
|
|
@@ -1051,7 +1031,7 @@ declare class ApiKeyRepository<A extends IStorableData> implements IApiKeyReposi
|
|
|
1051
1031
|
findAndValidate(secret: string): Promise<A>;
|
|
1052
1032
|
}
|
|
1053
1033
|
|
|
1054
|
-
declare class
|
|
1034
|
+
declare class ApiKeyHandshakeGuardMiddleware implements IHandshakeMiddleware {
|
|
1055
1035
|
private apiKeyRepository;
|
|
1056
1036
|
private auth;
|
|
1057
1037
|
constructor(apiKeyRepository: ApiKeyRepository<any>, auth: Auth<any>);
|
|
@@ -1090,7 +1070,7 @@ declare class RemoteApiKeyRepository<A extends IStorableData> implements IApiKey
|
|
|
1090
1070
|
generate(req: IGenerateApiKeyReq<A>): Promise<IGenerateApiKeyRes<A>>;
|
|
1091
1071
|
}
|
|
1092
1072
|
|
|
1093
|
-
declare function
|
|
1073
|
+
declare function jwtHandshakeGuard(): (target: IConstructor<any>) => void;
|
|
1094
1074
|
|
|
1095
1075
|
declare function jwtGuard(): (target: object, propertyKey: string | symbol) => void;
|
|
1096
1076
|
|
|
@@ -1169,7 +1149,7 @@ declare class Jwt {
|
|
|
1169
1149
|
findRefreshTokenAuthInfo(secret: string): Promise<any>;
|
|
1170
1150
|
}
|
|
1171
1151
|
|
|
1172
|
-
declare class
|
|
1152
|
+
declare class JwtHandshakeGuardMiddleware implements IHandshakeMiddleware {
|
|
1173
1153
|
private config;
|
|
1174
1154
|
private auth;
|
|
1175
1155
|
constructor(config: JwtConfig, auth: Auth<any>);
|
|
@@ -1195,7 +1175,7 @@ declare class AnthropicChatAdapter implements IChatAdapter {
|
|
|
1195
1175
|
private anthropic;
|
|
1196
1176
|
private logger;
|
|
1197
1177
|
constructor(env: Env);
|
|
1198
|
-
|
|
1178
|
+
nextItems(req: IChatAdapterNextItemsReq): Promise<IChatAdapterNextItemsRes>;
|
|
1199
1179
|
private mapChatItems;
|
|
1200
1180
|
private mapHumanMessage;
|
|
1201
1181
|
private mapBotMessage;
|
|
@@ -1208,7 +1188,7 @@ declare class DeepSeekChatAdapter implements IChatAdapter {
|
|
|
1208
1188
|
private deepSeek;
|
|
1209
1189
|
private logger;
|
|
1210
1190
|
constructor();
|
|
1211
|
-
|
|
1191
|
+
nextItems(req: IChatAdapterNextItemsReq): Promise<IChatAdapterNextItemsRes>;
|
|
1212
1192
|
private mapChatItems;
|
|
1213
1193
|
private mapHumanMessage;
|
|
1214
1194
|
private mapBotMessage;
|
|
@@ -1217,12 +1197,14 @@ declare class DeepSeekChatAdapter implements IChatAdapter {
|
|
|
1217
1197
|
private mapResponse;
|
|
1218
1198
|
}
|
|
1219
1199
|
|
|
1200
|
+
interface GoogleChatAdapterV2Options {
|
|
1201
|
+
apiKey?: string;
|
|
1202
|
+
}
|
|
1220
1203
|
declare class GoogleChatAdapter implements IChatAdapter {
|
|
1221
|
-
private
|
|
1222
|
-
private
|
|
1223
|
-
private logger;
|
|
1204
|
+
private ai;
|
|
1205
|
+
private readonly logger;
|
|
1224
1206
|
constructor(env: Env);
|
|
1225
|
-
|
|
1207
|
+
nextItems(req: IChatAdapterNextItemsReq): Promise<IChatAdapterNextItemsRes>;
|
|
1226
1208
|
private mapChatItems;
|
|
1227
1209
|
private mapHumanMessage;
|
|
1228
1210
|
private mapBotMessage;
|
|
@@ -1234,7 +1216,7 @@ declare class GoogleChatAdapter implements IChatAdapter {
|
|
|
1234
1216
|
declare class OpenaiChatAdapter implements IChatAdapter {
|
|
1235
1217
|
private openai;
|
|
1236
1218
|
private logger;
|
|
1237
|
-
|
|
1219
|
+
nextItems(req: IChatAdapterNextItemsReq): Promise<IChatAdapterNextItemsRes>;
|
|
1238
1220
|
private mapChatItems;
|
|
1239
1221
|
private mapConectionMessage;
|
|
1240
1222
|
private mapBotMessage;
|
|
@@ -1276,16 +1258,17 @@ declare class WabotChatAdapter implements IChatAdapter {
|
|
|
1276
1258
|
private baseUrl;
|
|
1277
1259
|
private logger;
|
|
1278
1260
|
constructor(env: Env);
|
|
1279
|
-
|
|
1261
|
+
nextItems(req: IChatAdapterNextItemsReq): Promise<IChatAdapterNextItemsRes>;
|
|
1280
1262
|
}
|
|
1281
1263
|
|
|
1282
1264
|
declare function cmd(): (target: object, propertyKey: string | symbol) => void;
|
|
1283
1265
|
|
|
1284
1266
|
declare class CmdChannel implements IChatChannel {
|
|
1285
|
-
private
|
|
1267
|
+
private auth;
|
|
1286
1268
|
private chatId;
|
|
1287
1269
|
private rl;
|
|
1288
1270
|
private callBack;
|
|
1271
|
+
constructor(auth: Auth<any>);
|
|
1289
1272
|
listen(callback: (message: IChannelMessage) => void): void;
|
|
1290
1273
|
connect(): void;
|
|
1291
1274
|
}
|
|
@@ -1293,28 +1276,34 @@ declare function writeJsonToFile<T>(filename: string, data: T): void;
|
|
|
1293
1276
|
declare function readJsonFromFile<T>(filename: string): T | null;
|
|
1294
1277
|
|
|
1295
1278
|
interface ISocketChannelConfig {
|
|
1296
|
-
|
|
1279
|
+
namespace: string;
|
|
1280
|
+
handshakeMidlewares?: IConstructor<IHandshakeMiddleware>[];
|
|
1297
1281
|
}
|
|
1298
1282
|
|
|
1299
1283
|
declare class SocketChannelConfig implements ISocketChannelConfig {
|
|
1300
|
-
|
|
1301
|
-
|
|
1284
|
+
namespace: string;
|
|
1285
|
+
handshakeMidlewares?: IConstructor<IHandshakeMiddleware>[] | undefined;
|
|
1286
|
+
constructor(namespace: string, handshakeMidlewares?: IConstructor<IHandshakeMiddleware>[] | undefined);
|
|
1302
1287
|
}
|
|
1303
1288
|
|
|
1304
1289
|
declare function socket(config: SocketChannelConfig): (target: object, propertyKey: string | symbol) => void;
|
|
1305
1290
|
|
|
1306
1291
|
interface ISocketChannelReceivedMessage {
|
|
1307
1292
|
chatId: string;
|
|
1308
|
-
|
|
1293
|
+
senderName: string;
|
|
1294
|
+
text: string;
|
|
1295
|
+
}
|
|
1296
|
+
declare class SocketChannelReceivedMessage implements ISocketChannelReceivedMessage {
|
|
1297
|
+
chatId: string;
|
|
1309
1298
|
senderName: string;
|
|
1310
1299
|
text: string;
|
|
1311
1300
|
}
|
|
1312
1301
|
declare class SocketChannel implements IChatChannel {
|
|
1313
1302
|
private config;
|
|
1314
|
-
private socketServerProvider;
|
|
1315
1303
|
private callBack;
|
|
1316
|
-
private
|
|
1317
|
-
constructor(config: SocketChannelConfig
|
|
1304
|
+
private controller;
|
|
1305
|
+
constructor(config: SocketChannelConfig);
|
|
1306
|
+
private configController;
|
|
1318
1307
|
listen(callback: (message: IChannelMessage) => void): void;
|
|
1319
1308
|
connect(): void;
|
|
1320
1309
|
}
|
|
@@ -1636,4 +1625,4 @@ declare function HtmlModule(options: IHtmlModuleOptions): {
|
|
|
1636
1625
|
new (): {};
|
|
1637
1626
|
};
|
|
1638
1627
|
|
|
1639
|
-
export { AnthropicChatAdapter, ApiKey,
|
|
1628
|
+
export { AnthropicChatAdapter, ApiKey, ApiKeyGuardMiddleware, ApiKeyHandshakeGuardMiddleware, ApiKeyRepository, Async, Auth, Chat, ChatAdapter, ChatBot, ChatBotMetadataStore, ChatItem, ChatMemory, ChatRepository, ChatResolver, CmdChannel, Command, CommandMetadataStore, Container, ControllerMetadataStore, CustomError, DeepSeekChatAdapter, EXPRESS_REQ, EXPRESS_RES, Entity, Env, EnvWhatsAppRepository, ExpressProvider, GoogleChatAdapter, type GoogleChatAdapterV2Options, HtmlModule, HttpServerProvider, type IApiKeyData, type IApiKeyRepository, type IArrayValidationError, type IArrayValidationResult, type IBotMessageItem, type IChannelMessage, type IChannelMetadata, type IChatAdapter, type IChatAdapterNextItemsReq, type IChatAdapterNextItemsRes, type IChatBot, type IChatBotMetadata, type IChatChannel, type IChatConnection, type IChatControllerMetadata, type IChatData, type IChatItem, type IChatItemData, type IChatItemType, type IChatMemory, type IChatMessage, type IChatRepository, type IChatType, type ICommandConfig, type ICommandHandler, type ICommandHandlerConfig, type IConstructor, type ICrudRepository, type ICustomErrorData, type IEndPointConfig, type IEndPointMetadata, type IEntityData, type IEnvType, type IFunctionCall, type IFunctionCallItem, type IGenerateApiKeyReq, type IGenerateApiKeyRes, type IGetWhatsAppTemplateRequest, type IHandshakeMiddleware, type IHandshakeMiddlewareMetadata, type IHtmlModuleOptions, type IHumanMessageItem, type IJobData, type IJobEvent, type IJobEventListener, type IJobRepository, type IJwtRefreshTokenData, type IJwtRefreshTokenRepository, type ILanguageModelUsage, type IListenWhatsAppMessageRequest, type IMessageContext, type IMiddleware, type IMiddlewareMetadata, type IMindset, type IMindsetDecoration, type IMindsetFunctionConfig, type IMindsetFunctionDecoration, type IMindsetFunctionMetadata, type IMindsetFunctionParamMetadata, type IMindsetIdentity, type IMindsetLlm, type IMindsetMetadata, type IMindsetModuleConfig, type IMindsetModuleDecoration, type IMindsetModuleMetadata, type IMindsetTool, type IMindsetToolParameter, type IModelValidationError, type IModelValidationResult, type IModelValidatorsInfo, type IMoneyData, type IParamConfig, type IParamDecoration, type IPersistentData, type IPgRepositoryConfig, type IPrimitive, type IPropertyValidatorInfo, type IReceivedMessage, type IRemoteApiKeyFetcher, type IRestControllerConfig, type IRestControllerMetadata, type ISendWhatsAppRequest, type ISendWhatsAppTemplateRequest, type ISocketChannelConfig, type ISocketChannelReceivedMessage, type ISocketControllerConfig, type ISocketControllerMetadata, type ISocketEventConfig, type ISocketEventMetadata, type IStorableData, type ITelegramChannelConfig, type IValidateArrayOptions, type IValidateArrayOptionsWithItemsValidators, type IValidateInputShape, type IValidateIsInOptions, type IValidateMaxOptions, type IValidateMinOptions, type IValidationError, type IValidationResult, type IValidator, type IValidatorMetadata, type IWhatsAppBusinessAccount, type IWhatsAppBusinessNumber, type IWhatsAppCloudContact, type IWhatsAppCloudMessage, type IWhatsAppCloudMessageMetadata, type IWhatsAppCloudTemplate, type IWhatsAppCloudTemplateComponent, type IWhatsAppCloudTemplateMessage, type IWhatsAppCloudTemplateParameter, type IWhatsAppCloudTemplateResponse, type IWhatsAppCloudWebhookPayload, type IWhatsAppData, type IWhatsAppMessageListener, type IWhatsAppProxyListenMessageEventData, type IWhatsAppProxyListenMessageEventReq, type IWhatsAppProxyMessage, type IWhatsAppProxyMessageContent, type IWhatsAppProxyMessageEventReq, type IWhatsAppProxySendMessageEventReq, type IWhatsAppRepository, type IWhatsAppSenderOptions, type IWhatsappChannelConfig, type IchatControllerConfig, Job, JobRepository, JobRunner, JobsEventsHub, Jwt, JwtAccessAndRefreshTokenDto, JwtConfig, JwtGuardMiddleware, JwtHandshakeGuardMiddleware, JwtRefreshToken, JwtRefreshTokenRepository, JwtSigner, JwtTokenDto, Lifecycle, Logger, MINDSET_DECORATION_MINDSET, MINDSET_FUNCTION_DECORATION_FUNCTION, MINDSET_MODULE_DECORATION_MODULE, Mapper, Mindset, MindsetMetadataStore, MindsetOperator, Money, MoneyDto, OpenaiChatAdapter, PARAM_DECORATION_IS_OPTIONAL, PARAM_DECORATION_PARAM, Password, type PasswordHashOptions, Persistent, PgApiKeyRepository, PgChatMemory, PgChatRepository, PgCrudRepository, PgJobRepository, PgJwtRefreshTokenRepository, PgRepositoryBase, PgWhatsAppRepository, RamChatMemory, RamChatRepository, Random, RemoteApiKeyRepository, RestControllerMetadataStore, SocketChannel, SocketChannelConfig, SocketChannelReceivedMessage, SocketControllerMetadataStore, SocketServerProvider, Storable, TelegramChannel, TelegramChannelConfig, ValidationMetadataStore, WHATSAPP_MESSAGE_EVENT, WHATSAPP_PROXY_LISTEN_MESSAGE_EVENT, WHATSAPP_PROXY_SEND_MESSAGE_EVENT, WabotChatAdapter, WhatsApp, WhatsAppChannel, WhatsAppReceiver, WhatsAppReceiverByCloudApi, WhatsAppReceiverByWabotProxy, WhatsAppRepository, WhatsAppSender, WhatsAppSenderByCloudApi, WhatsAppSenderByWabotProxy, WhatsAppWabotProxyConnection, WhatsappChannelConfig, apiKeyGuard, apiKeyHandshakeGuard, chatBot, chatController, chatItemTypeOptions, cmd, command, commandHandler, container, handshakeMiddlewares, inject, injectable, isArray, isBoolean, isDate, isIn, isModel, isNotEmpty, isNumber, isOptional, isPresent, isString, jwtGuard, jwtHandshakeGuard, max, middleware, min, mindset, mindsetFunction, mindsetModule, modelInfo, onDelete, onGet, onPost, onPut, onSocketEvent, param, readJsonFromFile, restController, runAsyncCommandHandlers, runChatControllers, runRestControllers, runSocketControllers, scoped, singleton, socket, socketController, telegram, validateAndTransform, validateArray, validateIsBoolean, validateIsDate, validateIsIn, validateIsNotEmpty, validateIsNumber, validateIsPresent, validateIsString, validateMax, validateMin, validateModel, whatsApp, writeJsonToFile };
|
package/dist/src/index.js
CHANGED
|
@@ -84,27 +84,26 @@ export { RestControllerMetadataStore } from './feature/rest-controller/metadata/
|
|
|
84
84
|
export { runRestControllers } from './feature/rest-controller/runRestControllers.js';
|
|
85
85
|
export { EXPRESS_REQ, EXPRESS_RES } from './feature/rest-controller/injection-tokens.js';
|
|
86
86
|
export { SocketServerProvider } from './feature/socket/SocketServerProvider.js';
|
|
87
|
-
export {
|
|
88
|
-
export { socketConnection } from './feature/socket-controller/metadata/@socketConnection.js';
|
|
87
|
+
export { handshakeMiddlewares } from './feature/socket-controller/metadata/@handshakeMiddlewares.js';
|
|
89
88
|
export { socketController } from './feature/socket-controller/metadata/@socketController.js';
|
|
90
|
-
export {
|
|
89
|
+
export { onSocketEvent } from './feature/socket-controller/metadata/@onSocketEvent.js';
|
|
91
90
|
export { SocketControllerMetadataStore } from './feature/socket-controller/metadata/SocketControllerMetadataStore.js';
|
|
92
91
|
export { runSocketControllers } from './feature/socket-controller/runSocketControllers.js';
|
|
93
92
|
export { PgJobRepository } from './addon/async/pg/PgJobRepository.js';
|
|
94
|
-
export {
|
|
93
|
+
export { apiKeyHandshakeGuard } from './addon/auth/api-key/@apiKeyHandshakeGuard.js';
|
|
95
94
|
export { apiKeyGuard } from './addon/auth/api-key/@apiKeyGuard.js';
|
|
96
95
|
export { ApiKey } from './addon/auth/api-key/ApiKey.js';
|
|
97
|
-
export {
|
|
96
|
+
export { ApiKeyHandshakeGuardMiddleware } from './addon/auth/api-key/ApiKeyHandshakeGuardMiddleware.js';
|
|
98
97
|
export { ApiKeyGuardMiddleware } from './addon/auth/api-key/ApiKeyGuardMiddleware.js';
|
|
99
98
|
export { ApiKeyRepository } from './addon/auth/api-key/ApiKeyRepository.js';
|
|
100
99
|
export { PgApiKeyRepository } from './addon/auth/api-key/PgApiKeyRepository.js';
|
|
101
100
|
export { RemoteApiKeyRepository } from './addon/auth/api-key/RemoteApiKeyRepository.js';
|
|
102
|
-
export {
|
|
101
|
+
export { jwtHandshakeGuard } from './addon/auth/jwt/@jwtHandshakeGuard.js';
|
|
103
102
|
export { jwtGuard } from './addon/auth/jwt/@jwtGuard.js';
|
|
104
103
|
export { Jwt } from './addon/auth/jwt/Jwt.js';
|
|
105
104
|
export { JwtAccessAndRefreshTokenDto } from './addon/auth/jwt/JwtAccessAndRefreshTokenDto.js';
|
|
106
105
|
export { JwtConfig } from './addon/auth/jwt/JwtConfig.js';
|
|
107
|
-
export {
|
|
106
|
+
export { JwtHandshakeGuardMiddleware } from './addon/auth/jwt/JwtHandshakeGuardMiddleware.js';
|
|
108
107
|
export { JwtGuardMiddleware } from './addon/auth/jwt/JwtGuardMiddleware.js';
|
|
109
108
|
export { JwtRefreshToken } from './addon/auth/jwt/JwtRefreshToken.js';
|
|
110
109
|
export { JwtRefreshTokenRepository } from './addon/auth/jwt/JwtRefreshTokenRepository.js';
|
|
@@ -123,7 +122,7 @@ export { WabotChatAdapter } from './addon/chat-bot/wabot/WabotChatAdapter.js';
|
|
|
123
122
|
export { cmd } from './addon/chat-controller/cmd/@cmd.js';
|
|
124
123
|
export { CmdChannel, readJsonFromFile, writeJsonToFile } from './addon/chat-controller/cmd/CmdChannel.js';
|
|
125
124
|
export { socket } from './addon/chat-controller/socket/@socket.js';
|
|
126
|
-
export { SocketChannel } from './addon/chat-controller/socket/SocketChannel.js';
|
|
125
|
+
export { SocketChannel, SocketChannelReceivedMessage } from './addon/chat-controller/socket/SocketChannel.js';
|
|
127
126
|
export { SocketChannelConfig } from './addon/chat-controller/socket/SocketChannelConfig.js';
|
|
128
127
|
export { telegram } from './addon/chat-controller/telegram/@telegram.js';
|
|
129
128
|
export { TelegramChannelConfig } from './addon/chat-controller/telegram/TelegramChannelConfig.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wabot-dev/framework",
|
|
3
|
-
"version": "0.2.0
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Framework for IA Chat Bots",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/src/index.js",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"scripts": {
|
|
13
13
|
"build": "rollup --config rollup.config.ts --configPlugin typescript && tsup --dts-only --format esm --out-dir dist/src src/index.ts",
|
|
14
14
|
"test:units": "node --import @yucacodes/ts/src/custom-import.mjs --test './src/**/*.unit.test.ts'",
|
|
15
|
-
"test:integration": "node --import @yucacodes/ts/src/custom-import.mjs --test './src/**/*.integration.test.ts'",
|
|
15
|
+
"test:integration": "node --import ./env.mjs --import @yucacodes/ts/src/custom-import.mjs --test './src/**/*.integration.test.ts'",
|
|
16
16
|
"fmt": "prettier --write .",
|
|
17
17
|
"fmt:check": "prettier --check .",
|
|
18
18
|
"types:check": "tsc --noEmit",
|
|
@@ -24,10 +24,6 @@
|
|
|
24
24
|
"@rollup/plugin-json": "6.1.0",
|
|
25
25
|
"@rollup/plugin-node-resolve": "16.0.1",
|
|
26
26
|
"@rollup/plugin-typescript": "12.1.2",
|
|
27
|
-
"@types/big.js": "^6.2.2",
|
|
28
|
-
"@types/html-to-text": "^9.0.4",
|
|
29
|
-
"@types/node": "22.14.1",
|
|
30
|
-
"@types/react": "^19.1.2",
|
|
31
27
|
"@yucacodes/ts": "^0.0.4",
|
|
32
28
|
"prettier": "^3.5.3",
|
|
33
29
|
"resend": "^4.4.1",
|
|
@@ -38,9 +34,12 @@
|
|
|
38
34
|
"peerDependencies": {
|
|
39
35
|
"@anthropic-ai/sdk": "^0.60.0",
|
|
40
36
|
"@google/genai": "^1.16.0",
|
|
37
|
+
"@types/big.js": "^6.2.2",
|
|
41
38
|
"@types/debug": "^4.1.12",
|
|
42
39
|
"@types/express": "^5.0.1",
|
|
40
|
+
"@types/html-to-text": "^9.0.4",
|
|
43
41
|
"@types/jsonwebtoken": "^9.0.10",
|
|
42
|
+
"@types/node": "22.14.1",
|
|
44
43
|
"@types/pg": "^8.11.14",
|
|
45
44
|
"@yucacodes/ts": "^0.0.4",
|
|
46
45
|
"big.js": "^7.0.1",
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { connectionMiddleware } from '../../../feature/socket-controller/metadata/@connectionMiddleware.js';
|
|
2
|
-
import '../../../core/injection/index.js';
|
|
3
|
-
import '../../../feature/socket-controller/metadata/SocketControllerMetadataStore.js';
|
|
4
|
-
import 'path';
|
|
5
|
-
import 'debug';
|
|
6
|
-
import '../../../feature/socket/SocketServerProvider.js';
|
|
7
|
-
import '../../../core/validation/metadata/ValidationMetadataStore.js';
|
|
8
|
-
import { ApiKeyConnectionGuardMiddleware } from './ApiKeyConnectionGuardMiddleware.js';
|
|
9
|
-
|
|
10
|
-
function apiKeyConnectionGuard() {
|
|
11
|
-
return function (target, propertyKey) {
|
|
12
|
-
connectionMiddleware(ApiKeyConnectionGuardMiddleware)(target, propertyKey);
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export { apiKeyConnectionGuard };
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { connectionMiddleware } from '../../../feature/socket-controller/metadata/@connectionMiddleware.js';
|
|
2
|
-
import '../../../core/injection/index.js';
|
|
3
|
-
import '../../../feature/socket-controller/metadata/SocketControllerMetadataStore.js';
|
|
4
|
-
import 'path';
|
|
5
|
-
import 'debug';
|
|
6
|
-
import '../../../feature/socket/SocketServerProvider.js';
|
|
7
|
-
import '../../../core/validation/metadata/ValidationMetadataStore.js';
|
|
8
|
-
import { JwtConnectionGuardMiddleware } from './JwtConnectionGuardMiddleware.js';
|
|
9
|
-
|
|
10
|
-
function jwtConnectionGuard() {
|
|
11
|
-
return function (target, propertyKey) {
|
|
12
|
-
connectionMiddleware(JwtConnectionGuardMiddleware)(target, propertyKey);
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export { jwtConnectionGuard };
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { SocketControllerMetadataStore } from './SocketControllerMetadataStore.js';
|
|
2
|
-
import { container } from '../../../core/injection/index.js';
|
|
3
|
-
|
|
4
|
-
function connectionMiddleware(middlewareConstructor) {
|
|
5
|
-
return function (target, propertyKey) {
|
|
6
|
-
const functionName = propertyKey.toString();
|
|
7
|
-
const store = container.resolve(SocketControllerMetadataStore);
|
|
8
|
-
store.saveConnectionMiddlewareMetadata({
|
|
9
|
-
controllerConstructor: target.constructor,
|
|
10
|
-
functionName,
|
|
11
|
-
middlewareConstructor: middlewareConstructor,
|
|
12
|
-
});
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export { connectionMiddleware };
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { container } from '../../../core/injection/index.js';
|
|
2
|
-
import { SocketControllerMetadataStore } from './SocketControllerMetadataStore.js';
|
|
3
|
-
|
|
4
|
-
function socketConnection(config) {
|
|
5
|
-
return function (target, propertyKey) {
|
|
6
|
-
const functionName = propertyKey.toString();
|
|
7
|
-
const paramsTypes = Reflect.getMetadata('design:paramtypes', target, functionName);
|
|
8
|
-
const store = container.resolve(SocketControllerMetadataStore);
|
|
9
|
-
store.saveSocketConnectionMetadata({
|
|
10
|
-
controllerConstructor: target.constructor,
|
|
11
|
-
config: typeof config === 'string' ? { namespace: config } : config,
|
|
12
|
-
functionName,
|
|
13
|
-
paramsTypes,
|
|
14
|
-
});
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export { socketConnection };
|