@wabot-dev/framework 0.1.0-beta.5 → 0.1.0-beta.51
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/async/pg/PgJobRepository.js +26 -0
- package/dist/src/addon/auth/api-key/@apiKeyGuard.js +17 -0
- package/dist/src/addon/auth/api-key/ApiKey.js +53 -0
- package/dist/src/addon/auth/api-key/ApiKeyGuardMiddleware.js +45 -0
- package/dist/src/addon/auth/api-key/ApiKeyRepository.js +13 -0
- package/dist/src/addon/auth/api-key/PgApiKeyRepository.js +21 -0
- package/dist/src/addon/auth/jwt/@jwtConnectionGuard.js +16 -0
- package/dist/src/addon/auth/jwt/@jwtGuard.js +17 -0
- package/dist/src/addon/auth/jwt/Jwt.js +53 -0
- package/dist/src/addon/auth/jwt/JwtAccessAndRefreshTokenDto.js +20 -0
- package/dist/src/addon/auth/jwt/JwtConfig.js +28 -0
- package/dist/src/addon/auth/jwt/JwtConnectionGuardMiddleware.js +57 -0
- package/dist/src/addon/auth/jwt/JwtGuardMiddleware.js +45 -0
- package/dist/src/addon/auth/jwt/JwtRefreshToken.js +56 -0
- package/dist/src/addon/auth/jwt/JwtRefreshTokenRepository.js +25 -0
- package/dist/src/addon/auth/jwt/JwtSigner.js +36 -0
- package/dist/src/addon/auth/jwt/JwtTokenDto.js +22 -0
- package/dist/src/addon/auth/jwt/PgJwtRefreshTokenRepository.js +21 -0
- package/dist/src/addon/chat-bot/anthropic/AnthropicChatAdapter.js +135 -0
- package/dist/src/addon/chat-bot/deepseek/DeepSeekChatAdapter.js +137 -0
- package/dist/src/addon/chat-bot/google/GoogleChatAdapter.js +145 -0
- package/dist/src/addon/chat-bot/openia/OpenaiChatAdapter.js +117 -0
- package/dist/src/{pre-made/repository/chat → addon/chat-bot}/pg/PgChatMemory.js +6 -4
- package/dist/src/{pre-made/repository/chat → addon/chat-bot}/pg/PgChatRepository.js +6 -5
- package/dist/src/{pre-made/repository/chat → addon/chat-bot}/ram/RamChatRepository.js +2 -2
- package/dist/src/addon/chat-bot/wabot/WabotChatAdapter.js +41 -0
- package/dist/src/addon/chat-controller/cmd/@cmd.js +23 -0
- package/dist/src/{channels → addon/chat-controller}/cmd/CmdChannel.js +4 -26
- package/dist/src/{channels → addon/chat-controller}/socket/@socket.js +9 -4
- package/dist/src/{channels → addon/chat-controller}/socket/SocketChannel.js +5 -23
- package/dist/src/{channels → addon/chat-controller}/socket/SocketChannelConfig.js +1 -1
- package/dist/src/{channels → addon/chat-controller}/telegram/@telegram.js +9 -4
- package/dist/src/{channels → addon/chat-controller}/telegram/TelegramChannel.js +4 -22
- package/dist/src/addon/chat-controller/whatsapp/@whatsApp.js +25 -0
- package/dist/src/{channels → addon/chat-controller}/whatsapp/EnvWhatsAppRepository.js +3 -3
- package/dist/src/{channels → addon/chat-controller}/whatsapp/PgWhatsAppRepository.js +2 -2
- package/dist/src/{channels → addon/chat-controller}/whatsapp/WhatsApp.js +2 -4
- package/dist/src/{channels → addon/chat-controller}/whatsapp/WhatsAppChannel.js +6 -18
- package/dist/src/addon/chat-controller/whatsapp/WhatsAppReceiver.js +10 -0
- package/dist/src/{channels → addon/chat-controller}/whatsapp/WhatsAppSender.js +20 -41
- package/dist/src/addon/chat-controller/whatsapp/cloud-api/WhatsAppReceiverByCloudApi.js +97 -0
- package/dist/src/{channels/whatsapp → addon/chat-controller/whatsapp/cloud-api}/WhatsAppSenderByCloudApi.js +26 -20
- package/dist/src/addon/chat-controller/whatsapp/proxy/WhatsAppProxyContracts.js +5 -0
- package/dist/src/addon/chat-controller/whatsapp/proxy/WhatsAppReceiverByWabotProxy.js +65 -0
- package/dist/src/addon/chat-controller/whatsapp/proxy/WhatsAppSenderByWabotProxy.js +60 -0
- package/dist/src/addon/chat-controller/whatsapp/proxy/WhatsAppWabotProxyConnection.js +45 -0
- package/dist/src/addon/mindset/html/HtmlModule.js +70 -0
- package/dist/src/core/auth/Auth.js +24 -0
- package/dist/src/core/{Persistent.js → entity/Entity.js} +24 -9
- package/dist/src/core/env/Env.js +39 -0
- package/dist/src/core/error/CustomError.js +15 -0
- package/dist/src/core/injection/index.js +4 -0
- package/dist/src/core/mapper/Mapper.js +42 -0
- package/dist/src/core/password/Password.js +30 -0
- package/dist/src/core/random/Random.js +47 -0
- package/dist/src/core/storable/Storable.js +8 -0
- package/dist/src/core/validation/core/validateArray.js +51 -0
- package/dist/src/core/validation/core/validateIsOptional.js +5 -0
- package/dist/src/core/validation/core/validateModel.js +36 -0
- package/dist/src/core/validation/metadata/@isArray.js +18 -0
- package/dist/src/core/validation/metadata/@isModel.js +18 -0
- package/dist/src/core/validation/metadata/@isOptional.js +17 -0
- package/dist/src/core/validation/metadata/ValidationMetadataStore.js +98 -0
- package/dist/src/core/validation/modelInfo.js +9 -0
- package/dist/src/core/validation/validate.js +11 -0
- package/dist/src/core/validation/validators/is-boolean/@isBoolean.js +17 -0
- package/dist/src/core/validation/validators/is-boolean/validateIsBoolean.js +12 -0
- package/dist/src/core/validation/validators/is-date/@isDate.js +17 -0
- package/dist/src/core/validation/validators/is-date/validateIsDate.js +16 -0
- package/dist/src/core/validation/validators/is-not-empty/@isNotEmpty.js +17 -0
- package/dist/src/core/validation/validators/is-not-empty/validateIsNotEmpty.js +12 -0
- package/dist/src/core/validation/validators/is-number/@isNumber.js +17 -0
- package/dist/src/core/validation/validators/is-number/validateIsNumber.js +12 -0
- package/dist/src/core/validation/validators/is-present/@isPresent.js +17 -0
- package/dist/src/core/validation/validators/is-present/validateIsPresent.js +12 -0
- package/dist/src/core/validation/validators/is-string/@isString.js +17 -0
- package/dist/src/core/validation/validators/is-string/validateIsString.js +12 -0
- package/dist/src/core/validation/validators/max/@max.js +18 -0
- package/dist/src/core/validation/validators/max/validateMax.js +17 -0
- package/dist/src/core/validation/validators/min/@min.js +18 -0
- package/dist/src/core/validation/validators/min/validateMin.js +17 -0
- package/dist/src/feature/async/@command.js +11 -0
- package/dist/src/feature/async/@commandHandler.js +12 -0
- package/dist/src/feature/async/Async.js +38 -0
- package/dist/src/feature/async/Command.js +9 -0
- package/dist/src/feature/async/CommandMetadataStore.js +38 -0
- package/dist/src/feature/async/Job.js +24 -0
- package/dist/src/feature/async/JobRepository.js +31 -0
- package/dist/src/feature/async/JobRunner.js +45 -0
- package/dist/src/feature/async/JobsEventsHub.js +24 -0
- package/dist/src/feature/async/runCommandHandlers.js +29 -0
- package/dist/src/{core/chat → feature/chat-bot}/Chat.js +2 -2
- package/dist/src/feature/chat-bot/ChatAdapter.js +7 -0
- package/dist/src/feature/chat-bot/ChatBot.js +73 -0
- package/dist/src/feature/chat-bot/ChatItem.js +24 -0
- package/dist/src/feature/chat-bot/ChatMemory.js +10 -0
- package/dist/src/{core/chat/repository/IChatRepository.js → feature/chat-bot/ChatRepository.js} +2 -8
- package/dist/src/feature/chat-bot/IChatItem.js +3 -0
- package/dist/src/{chatbot → feature/chat-bot}/metadata/@chatBot.js +1 -1
- package/dist/src/{chatbot → feature/chat-bot}/metadata/ChatBotMetadataStore.js +1 -1
- package/dist/src/{controller/channel → feature/chat-controller}/ChatResolver.js +6 -4
- package/dist/src/{controller → feature/chat-controller}/metadata/ControllerMetadataStore.js +1 -1
- package/dist/src/{controller → feature/chat-controller}/metadata/controller/@chatController.js +1 -1
- package/dist/src/feature/chat-controller/runChatControllers.js +69 -0
- package/dist/src/{channels → feature}/express/ExpressProvider.js +2 -4
- package/dist/src/{channels → feature}/http/HttpServerProvider.js +2 -2
- package/dist/src/{mindset → feature/mindset}/IMindset.js +3 -0
- package/dist/src/{mindset → feature/mindset}/MindsetOperator.js +69 -42
- package/dist/src/{mindset → feature/mindset}/metadata/MindsetMetadataStore.js +1 -1
- package/dist/src/{mindset → feature/mindset}/metadata/functions/@mindsetFunction.js +1 -1
- package/dist/src/{mindset → feature/mindset}/metadata/mindsets/@mindset.js +1 -1
- package/dist/src/{mindset → feature/mindset}/metadata/modules/@mindsetModule.js +1 -2
- package/dist/src/{mindset → feature/mindset}/metadata/params/@param.js +1 -1
- package/dist/src/feature/money/Money.js +61 -0
- package/dist/src/feature/money/MoneyDto.js +22 -0
- package/dist/src/{repository → feature}/pg/PgCrudRepository.js +25 -2
- package/dist/src/{repository → feature}/pg/PgRepositoryBase.js +2 -2
- package/dist/src/feature/rest-controller/injection-tokens.js +4 -0
- package/dist/src/feature/rest-controller/metadata/@get.js +19 -0
- package/dist/src/feature/rest-controller/metadata/@middleware.js +16 -0
- package/dist/src/feature/rest-controller/metadata/@post.js +19 -0
- package/dist/src/feature/rest-controller/metadata/@restController.js +15 -0
- package/dist/src/feature/rest-controller/metadata/RestControllerMetadataStore.js +50 -0
- package/dist/src/feature/rest-controller/runRestControllers.js +102 -0
- package/dist/src/{channels → feature}/socket/SocketServerProvider.js +2 -2
- package/dist/src/feature/socket-controller/metadata/@connectionMiddleware.js +16 -0
- package/dist/src/feature/socket-controller/metadata/@socketConnection.js +18 -0
- package/dist/src/feature/socket-controller/metadata/@socketController.js +15 -0
- package/dist/src/feature/socket-controller/metadata/@socketEvent.js +18 -0
- package/dist/src/feature/socket-controller/metadata/SocketControllerMetadataStore.js +65 -0
- package/dist/src/feature/socket-controller/runSocketControllers.js +98 -0
- package/dist/src/index.d.ts +1151 -575
- package/dist/src/index.js +140 -76
- package/package.json +10 -4
- package/dist/src/ai/deepseek/DeepSeekChatBotAdapter.js +0 -106
- package/dist/src/ai/openia/OpenaiChatBotAdapter.js +0 -84
- package/dist/src/channels/cmd/@cmd.js +0 -18
- package/dist/src/channels/wabot/WabotDevConnection.js +0 -57
- package/dist/src/channels/wabot/WabotDevSocketContracts.js +0 -10
- package/dist/src/channels/whatsapp/@whatsapp.js +0 -20
- package/dist/src/channels/whatsapp/WhatsAppReceiver.js +0 -59
- package/dist/src/channels/whatsapp/WhatsAppReceiverByDevConnection.js +0 -32
- package/dist/src/channels/whatsapp/WhatsAppReceiverByWebHook.js +0 -63
- package/dist/src/channels/whatsapp/WhatsAppSenderByDevConnection.js +0 -61
- package/dist/src/chatbot/ChatBot.js +0 -51
- package/dist/src/chatbot/ChatBotAdapter.js +0 -72
- package/dist/src/controller/channel/UserResolver.js +0 -21
- package/dist/src/core/IMessageContext.js +0 -12
- package/dist/src/core/chat/ChatItem.js +0 -15
- package/dist/src/core/chat/repository/IChatMemory.js +0 -10
- package/dist/src/core/user/IUserRepository.js +0 -19
- package/dist/src/core/user/User.js +0 -26
- package/dist/src/env/WabotEnv.js +0 -27
- package/dist/src/injection/index.js +0 -4
- package/dist/src/mindset/metadata/params/@isOptional.js +0 -21
- package/dist/src/pre-made/module/authentication/AuthenticationModule.js +0 -97
- package/dist/src/pre-made/module/authentication/requests/SendOneTimePasswordRequest.js +0 -25
- package/dist/src/pre-made/module/authentication/requests/ValidateOneTimePasswordRequest.js +0 -25
- package/dist/src/pre-made/module/register-user/RegisterUserModule.js +0 -56
- package/dist/src/pre-made/module/register-user/requests/RegisterUserWithEmailRequest.js +0 -25
- package/dist/src/pre-made/repository/user/pg/PgUserRepository.js +0 -33
- package/dist/src/pre-made/repository/user/ram/RamUserRepository.js +0 -27
- package/dist/src/pre-made/service/EmailService.js +0 -13
- package/dist/src/pre-made/service/OtpService.js +0 -14
- package/dist/src/server/prepareChatContainer.js +0 -43
- package/dist/src/server/runChannel.js +0 -27
- package/dist/src/server/runServer.js +0 -40
- /package/dist/src/{pre-made/repository/chat → addon/chat-bot}/ram/RamChatMemory.js +0 -0
- /package/dist/src/{channels → addon/chat-controller}/telegram/TelegramChannelConfig.js +0 -0
- /package/dist/src/{channels → addon/chat-controller}/whatsapp/WhatsAppChannelConfig.js +0 -0
- /package/dist/src/{channels → addon/chat-controller}/whatsapp/WhatsAppRepository.js +0 -0
- /package/dist/src/{injection → core/injection}/Container.js +0 -0
- /package/dist/src/{logger → core/logger}/Logger.js +0 -0
- /package/dist/src/{mindset → feature/mindset}/metadata/functions/decoratorNames.js +0 -0
- /package/dist/src/{mindset → feature/mindset}/metadata/mindsets/decoratorNames.js +0 -0
- /package/dist/src/{mindset → feature/mindset}/metadata/modules/decoratorNames.js +0 -0
- /package/dist/src/{mindset → feature/mindset}/metadata/params/decoratorNames.js +0 -0
package/dist/src/index.d.ts
CHANGED
|
@@ -1,183 +1,420 @@
|
|
|
1
|
+
import * as tsyringe from 'tsyringe';
|
|
2
|
+
import { DependencyContainer as DependencyContainer$1 } from 'tsyringe';
|
|
3
|
+
export { DependencyContainer } from 'tsyringe';
|
|
1
4
|
import InjectionToken from 'tsyringe/dist/typings/providers/injection-token';
|
|
2
5
|
import DependencyContainer, { PreResolutionInterceptorCallback, PostResolutionInterceptorCallback } from 'tsyringe/dist/typings/types/dependency-container';
|
|
3
6
|
import InterceptionOptions from 'tsyringe/dist/typings/types/interceptor-options';
|
|
4
7
|
import { Server } from 'http';
|
|
5
|
-
import { Express } from 'express';
|
|
6
|
-
import
|
|
7
|
-
import { Socket } from 'socket.io-client';
|
|
8
|
+
import { Express, Request, Response } from 'express';
|
|
9
|
+
import * as big_js from 'big.js';
|
|
8
10
|
import { Pool } from 'pg';
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
11
|
-
|
|
11
|
+
import { Server as Server$1, Socket } from 'socket.io';
|
|
12
|
+
import { Algorithm } from 'jsonwebtoken';
|
|
13
|
+
import { Socket as Socket$1 } from 'socket.io-client';
|
|
12
14
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
+
type IPrimitive = null | number | string | boolean | undefined;
|
|
16
|
+
type IStorableData = {
|
|
17
|
+
[key: string]: IPrimitive | IPrimitive[] | IStorableData | IStorableData[];
|
|
18
|
+
};
|
|
19
|
+
declare class Storable<D extends IStorableData> {
|
|
20
|
+
protected data: D;
|
|
21
|
+
constructor(data: D);
|
|
15
22
|
}
|
|
16
23
|
|
|
17
|
-
declare
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
interface IMindsetFunctionDecoration {
|
|
22
|
-
decorationName: string;
|
|
23
|
-
functionName: string;
|
|
24
|
-
constructor: Function;
|
|
25
|
-
paramsTypes: Function[];
|
|
26
|
-
decorationConfig: any;
|
|
24
|
+
declare class Auth<D extends IStorableData> {
|
|
25
|
+
private authInfo;
|
|
26
|
+
require(): D;
|
|
27
|
+
assign(authInfo: D): void;
|
|
27
28
|
}
|
|
28
29
|
|
|
29
|
-
interface
|
|
30
|
+
interface IEntityData extends IStorableData {
|
|
30
31
|
id?: string;
|
|
31
32
|
createdAt?: number | null;
|
|
32
33
|
discardedAt?: number | null;
|
|
33
34
|
}
|
|
34
|
-
declare class
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
declare class Entity<D extends IEntityData> extends Storable<D> {
|
|
36
|
+
get id(): string;
|
|
37
|
+
/**
|
|
38
|
+
* @deprecated use id
|
|
39
|
+
*/
|
|
37
40
|
getId(): string;
|
|
41
|
+
get createdAt(): Date;
|
|
42
|
+
/**
|
|
43
|
+
* @deprecated use createdAt
|
|
44
|
+
*/
|
|
38
45
|
getCreatedAt(): Date;
|
|
39
|
-
update(newData: D): void;
|
|
46
|
+
update(newData: Omit<D, 'id' | 'createdAt' | 'discardedAt'>): void;
|
|
40
47
|
wasCreated(): boolean;
|
|
41
48
|
validate(): void;
|
|
42
49
|
discard(): void;
|
|
43
50
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
channelName: string;
|
|
49
|
-
id: string;
|
|
51
|
+
/**
|
|
52
|
+
* @deprecated Should use IEntityData
|
|
53
|
+
*/
|
|
54
|
+
interface IPersistentData extends IEntityData {
|
|
50
55
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
56
|
+
/**
|
|
57
|
+
* @deprecated Should use Entity
|
|
58
|
+
*/
|
|
59
|
+
declare class Persistent<D extends IPersistentData> extends Entity<D> {
|
|
54
60
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
|
|
62
|
+
type IEnvType = 'development' | 'staging' | 'testing' | 'production';
|
|
63
|
+
declare class Env {
|
|
64
|
+
private envType;
|
|
65
|
+
constructor();
|
|
66
|
+
isDevelopment(): boolean;
|
|
67
|
+
isProduction(): boolean;
|
|
68
|
+
isTesting(): boolean;
|
|
69
|
+
requireString(varName: string, options?: {
|
|
70
|
+
default?: string;
|
|
71
|
+
}): string;
|
|
72
|
+
requireNumber(varName: string, options?: {
|
|
73
|
+
default?: number;
|
|
74
|
+
}): number;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
interface ICustomErrorData {
|
|
78
|
+
message: string;
|
|
79
|
+
humanMessage?: string;
|
|
80
|
+
code?: string;
|
|
81
|
+
httpCode?: number;
|
|
82
|
+
cause?: Error;
|
|
83
|
+
info?: any;
|
|
84
|
+
}
|
|
85
|
+
declare class CustomError extends Error {
|
|
86
|
+
humanMessage?: string;
|
|
87
|
+
code?: string;
|
|
88
|
+
httpCode?: number;
|
|
89
|
+
info?: any;
|
|
90
|
+
constructor(data: ICustomErrorData);
|
|
63
91
|
}
|
|
64
92
|
|
|
65
|
-
|
|
93
|
+
type IConstructor<T> = new (...args: any[]) => T;
|
|
94
|
+
|
|
95
|
+
declare class Container implements DependencyContainer {
|
|
96
|
+
register(token: unknown, provider: unknown, options?: unknown): DependencyContainer;
|
|
97
|
+
registerSingleton(from: unknown, to?: unknown): DependencyContainer;
|
|
98
|
+
registerType<T>(from: InjectionToken<T>, to: InjectionToken<T>): DependencyContainer;
|
|
99
|
+
registerInstance<T>(token: InjectionToken<T>, instance: T): DependencyContainer;
|
|
100
|
+
resolve<T>(token: InjectionToken<T>): T;
|
|
101
|
+
resolveAll<T>(token: InjectionToken<T>): T[];
|
|
102
|
+
isRegistered<T>(token: InjectionToken<T>, recursive?: boolean): boolean;
|
|
103
|
+
reset(): void;
|
|
104
|
+
clearInstances(): void;
|
|
105
|
+
createChildContainer(): DependencyContainer;
|
|
106
|
+
beforeResolution<T>(token: InjectionToken<T>, callback: PreResolutionInterceptorCallback<T>, options?: InterceptionOptions): void;
|
|
107
|
+
afterResolution<T>(token: InjectionToken<T>, callback: PostResolutionInterceptorCallback<T>, options?: InterceptionOptions): void;
|
|
108
|
+
dispose(): Promise<void> | void;
|
|
66
109
|
}
|
|
67
110
|
|
|
68
|
-
|
|
111
|
+
declare const injectable: typeof tsyringe.injectable;
|
|
112
|
+
declare const container: tsyringe.DependencyContainer;
|
|
113
|
+
declare const singleton: typeof tsyringe.singleton;
|
|
114
|
+
declare const inject: typeof tsyringe.inject;
|
|
115
|
+
declare const scoped: typeof tsyringe.scoped;
|
|
116
|
+
declare const Lifecycle: typeof tsyringe.Lifecycle;
|
|
117
|
+
|
|
118
|
+
declare class Logger {
|
|
119
|
+
private debuggers;
|
|
120
|
+
constructor(name: string);
|
|
121
|
+
trace(...args: any[]): void;
|
|
122
|
+
debug(...args: any[]): void;
|
|
123
|
+
info(...args: any[]): void;
|
|
124
|
+
warn(...args: any[]): void;
|
|
125
|
+
error(...args: any[]): void;
|
|
126
|
+
fatal(...args: any[]): void;
|
|
127
|
+
private log;
|
|
69
128
|
}
|
|
70
129
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
id: string;
|
|
130
|
+
declare class Mapper {
|
|
131
|
+
map<T>(data: any, ctor: IConstructor<T>): T;
|
|
74
132
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
};
|
|
133
|
+
|
|
134
|
+
interface PasswordHashOptions {
|
|
135
|
+
password: string;
|
|
136
|
+
saltLength?: number;
|
|
137
|
+
keyLength?: number;
|
|
81
138
|
}
|
|
82
|
-
declare class
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
139
|
+
declare class Password {
|
|
140
|
+
static hash(options: PasswordHashOptions): string;
|
|
141
|
+
static isValid(req: {
|
|
142
|
+
password: string;
|
|
143
|
+
hash: string;
|
|
144
|
+
}): boolean;
|
|
145
|
+
static generate(length: number): string;
|
|
88
146
|
}
|
|
89
147
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
chatConnection: IChatConnection;
|
|
98
|
-
userConnection: IUserConnection;
|
|
99
|
-
userId?: string;
|
|
148
|
+
declare class Random {
|
|
149
|
+
static slug(name: string, options: {
|
|
150
|
+
randomLength: number;
|
|
151
|
+
}): string;
|
|
152
|
+
static alphaNumeric(length: number): string;
|
|
153
|
+
static alphaNumericLowerCase(length: number): string;
|
|
154
|
+
static numberCode(length: number): string;
|
|
100
155
|
}
|
|
101
156
|
|
|
102
|
-
interface
|
|
103
|
-
id: string
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
157
|
+
interface ICrudRepository<T> {
|
|
158
|
+
find(id: string): Promise<T | null>;
|
|
159
|
+
findOrThrow(id: string): Promise<T>;
|
|
160
|
+
findByIds(ids: string[]): Promise<T[]>;
|
|
161
|
+
findAll(id: string): Promise<T[]>;
|
|
162
|
+
create(item: T): Promise<void>;
|
|
163
|
+
update(item: T): Promise<void>;
|
|
164
|
+
discard(item: T): Promise<void>;
|
|
107
165
|
}
|
|
108
166
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
167
|
+
declare function isModel(model: IConstructor<any>): (target: object, propertyKey: string | symbol) => void;
|
|
168
|
+
|
|
169
|
+
declare function isOptional(): (target: object, propertyKey: string | symbol) => void;
|
|
170
|
+
|
|
171
|
+
interface IValidationError {
|
|
172
|
+
description: string;
|
|
173
|
+
}
|
|
174
|
+
interface IModelValidationError extends IValidationError {
|
|
175
|
+
properties: {
|
|
176
|
+
[key: string]: string[];
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
interface IArrayValidationError extends IValidationError {
|
|
180
|
+
items: (IValidationError[] | null)[];
|
|
181
|
+
}
|
|
182
|
+
type IValidationResult<V> = {
|
|
183
|
+
value: V;
|
|
184
|
+
error?: undefined;
|
|
185
|
+
} | {
|
|
186
|
+
value?: undefined;
|
|
187
|
+
error: IValidationError;
|
|
112
188
|
};
|
|
113
|
-
type
|
|
114
|
-
|
|
115
|
-
|
|
189
|
+
type IModelValidationResult<V> = {
|
|
190
|
+
value: V;
|
|
191
|
+
error?: undefined;
|
|
192
|
+
} | {
|
|
193
|
+
value?: undefined;
|
|
194
|
+
error: IModelValidationError;
|
|
116
195
|
};
|
|
117
|
-
type
|
|
118
|
-
|
|
119
|
-
|
|
196
|
+
type IArrayValidationResult<V> = {
|
|
197
|
+
value: V[];
|
|
198
|
+
error?: undefined;
|
|
199
|
+
} | {
|
|
200
|
+
value?: undefined;
|
|
201
|
+
error: IArrayValidationError;
|
|
120
202
|
};
|
|
121
|
-
type
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
203
|
+
type IValidator<V = any, O = any> = (value: V, options: O) => IValidationResult<V>;
|
|
204
|
+
interface IPropertyValidatorInfo {
|
|
205
|
+
propertyName: string;
|
|
206
|
+
validator: IValidator;
|
|
207
|
+
validatorOptions?: any;
|
|
208
|
+
}
|
|
209
|
+
type IModelValidatorsInfo<V> = {
|
|
210
|
+
modelConstructor: IConstructor<V>;
|
|
211
|
+
properties: {
|
|
212
|
+
[prop: string]: {
|
|
213
|
+
isOptional?: boolean;
|
|
214
|
+
validators?: IPropertyValidatorInfo[];
|
|
215
|
+
} | undefined;
|
|
216
|
+
};
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
interface IValidateArrayOptions {
|
|
220
|
+
minLength?: number;
|
|
221
|
+
maxLength?: number;
|
|
130
222
|
}
|
|
223
|
+
interface IValidateArrayOptionsWithItemsValidators extends IValidateArrayOptions {
|
|
224
|
+
itemsValidator?: {
|
|
225
|
+
validator: IValidator;
|
|
226
|
+
options: any;
|
|
227
|
+
}[];
|
|
228
|
+
}
|
|
229
|
+
declare function validateArray(value: any, options?: IValidateArrayOptionsWithItemsValidators): IArrayValidationResult<any>;
|
|
131
230
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
231
|
+
declare function isArray(options?: IValidateArrayOptions): (target: object, propertyKey: string | symbol) => void;
|
|
232
|
+
|
|
233
|
+
interface IValidatorMetadata {
|
|
234
|
+
modelConstructor: IConstructor<any>;
|
|
235
|
+
propertyName: string;
|
|
236
|
+
validator: IValidator;
|
|
237
|
+
validatorOptions?: any;
|
|
135
238
|
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
239
|
+
|
|
240
|
+
declare class ValidationMetadataStore {
|
|
241
|
+
private validators;
|
|
242
|
+
saveValidatorMetadata(validatorMetadata: IValidatorMetadata): void;
|
|
243
|
+
getModelValidatorsInfo<V>(modelConstructor: IConstructor<V>): IModelValidatorsInfo<V>;
|
|
244
|
+
private getConstructorPropertiesValidatorsInfo;
|
|
139
245
|
}
|
|
140
246
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
247
|
+
declare function validateModel<V>(value: any, info: IModelValidatorsInfo<V>): IModelValidationResult<V>;
|
|
248
|
+
|
|
249
|
+
declare function validate<V>(value: any, modelConstructor: IConstructor<V>): IModelValidationResult<V>;
|
|
250
|
+
|
|
251
|
+
declare function modelInfo<V>(modelConstructor: IConstructor<V>): IModelValidatorsInfo<V>;
|
|
252
|
+
|
|
253
|
+
declare function isBoolean(): (target: object, propertyKey: string | symbol) => void;
|
|
254
|
+
|
|
255
|
+
declare function validateIsBoolean(value: any): IValidationResult<boolean>;
|
|
256
|
+
|
|
257
|
+
declare function isDate(): (target: object, propertyKey: string | symbol) => void;
|
|
258
|
+
|
|
259
|
+
declare function validateIsDate(value: any): IValidationResult<Date>;
|
|
260
|
+
|
|
261
|
+
declare function isNotEmpty(): (target: object, propertyKey: string | symbol) => void;
|
|
262
|
+
|
|
263
|
+
declare function validateIsNotEmpty(value: any): IValidationResult<any>;
|
|
264
|
+
|
|
265
|
+
declare function isNumber(): (target: object, propertyKey: string | symbol) => void;
|
|
266
|
+
|
|
267
|
+
declare function validateIsNumber(value: any): IValidationResult<number>;
|
|
268
|
+
|
|
269
|
+
declare function isPresent(): (target: object, propertyKey: string | symbol) => void;
|
|
270
|
+
|
|
271
|
+
declare function validateIsPresent(value: any): IValidationResult<any>;
|
|
272
|
+
|
|
273
|
+
declare function isString(): (target: object, propertyKey: string | symbol) => void;
|
|
274
|
+
|
|
275
|
+
declare function validateIsString(value: any): IValidationResult<string>;
|
|
276
|
+
|
|
277
|
+
declare function min(limit: any): (target: object, propertyKey: string | symbol) => void;
|
|
278
|
+
|
|
279
|
+
interface IValidateMinOptions {
|
|
280
|
+
limit: any;
|
|
145
281
|
}
|
|
146
|
-
declare
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
282
|
+
declare function validateMin(value: any, options: IValidateMinOptions): IValidationResult<any>;
|
|
283
|
+
|
|
284
|
+
declare function max(limit: any): (target: object, propertyKey: string | symbol) => void;
|
|
285
|
+
|
|
286
|
+
interface IValidateMaxOptions {
|
|
287
|
+
limit: any;
|
|
150
288
|
}
|
|
289
|
+
declare function validateMax(value: any, options: IValidateMaxOptions): IValidationResult<any>;
|
|
151
290
|
|
|
152
|
-
interface
|
|
153
|
-
|
|
154
|
-
update(chat: User): Promise<void>;
|
|
155
|
-
findByConnection(query: IUserConnection): Promise<User | null>;
|
|
291
|
+
interface ICommandConfig {
|
|
292
|
+
name?: string;
|
|
156
293
|
}
|
|
157
|
-
declare
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
294
|
+
declare function command(config?: ICommandConfig): (target: IConstructor<any>) => void;
|
|
295
|
+
|
|
296
|
+
declare class Command<T extends IStorableData> extends Storable<T> {
|
|
297
|
+
getData(): T;
|
|
161
298
|
}
|
|
162
299
|
|
|
163
|
-
interface
|
|
164
|
-
|
|
165
|
-
chat: Chat;
|
|
166
|
-
user: User | null;
|
|
300
|
+
interface ICommandHandler<C extends Command<any>> {
|
|
301
|
+
handle(command: C): void | Promise<void>;
|
|
167
302
|
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
user: User | null;
|
|
172
|
-
constructor(message: IConnectionChatMessage, chat: Chat, user: User | null);
|
|
303
|
+
|
|
304
|
+
interface ICommandHandlerConfig<C extends Command<any>> {
|
|
305
|
+
command: IConstructor<C>;
|
|
173
306
|
}
|
|
307
|
+
declare function commandHandler<C extends Command<any>>(config: ICommandHandlerConfig<C>): (target: IConstructor<ICommandHandler<C>>) => void;
|
|
174
308
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
309
|
+
declare class CommandMetadataStore {
|
|
310
|
+
private handlersMap;
|
|
311
|
+
private handlersInverseMap;
|
|
312
|
+
private commandsMap;
|
|
313
|
+
private commandsInverseMap;
|
|
314
|
+
registerCommand(command: IConstructor<Command<any>>, commandName: string): void;
|
|
315
|
+
registerHandler(command: IConstructor<Command<any>>, handlerConstructor: IConstructor<ICommandHandler<any>>): void;
|
|
316
|
+
getHandlerForCommandName(commandName: string): IConstructor<ICommandHandler<any>> | null;
|
|
317
|
+
getCommandNameForHandler(handlerConstructor: IConstructor<ICommandHandler<any>>): string | null;
|
|
318
|
+
getCommandName(command: IConstructor<Command<any>>): string | null;
|
|
319
|
+
getCommandForCommandName(commandName: string): IConstructor<Command<any>> | null;
|
|
178
320
|
}
|
|
179
321
|
|
|
180
|
-
|
|
322
|
+
interface IJobData extends IEntityData {
|
|
323
|
+
commandName: string;
|
|
324
|
+
commandData: any;
|
|
325
|
+
startedAt?: number;
|
|
326
|
+
successAt?: number;
|
|
327
|
+
failedAt?: number;
|
|
328
|
+
error?: {
|
|
329
|
+
message: string;
|
|
330
|
+
stack?: string;
|
|
331
|
+
info?: any;
|
|
332
|
+
};
|
|
333
|
+
}
|
|
334
|
+
declare class Job extends Entity<IJobData> {
|
|
335
|
+
get commandName(): string;
|
|
336
|
+
setAsStarted(): void;
|
|
337
|
+
setAsSuccess(): void;
|
|
338
|
+
setAsFailed(error: Error): void;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
interface IJobRepository extends ICrudRepository<Job> {
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
declare class JobRepository implements IJobRepository {
|
|
345
|
+
find(id: string): Promise<Job | null>;
|
|
346
|
+
findOrThrow(id: string): Promise<Job>;
|
|
347
|
+
findByIds(ids: string[]): Promise<Job[]>;
|
|
348
|
+
findAll(id: string): Promise<Job[]>;
|
|
349
|
+
create(item: Job): Promise<void>;
|
|
350
|
+
update(item: Job): Promise<void>;
|
|
351
|
+
discard(item: Job): Promise<void>;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
interface IJobEvent extends IStorableData {
|
|
355
|
+
jobId: string;
|
|
356
|
+
type: 'created';
|
|
357
|
+
}
|
|
358
|
+
type IJobEventListener = (event: IJobEvent) => void | Promise<void>;
|
|
359
|
+
declare class JobsEventsHub {
|
|
360
|
+
private jobsEventsListener;
|
|
361
|
+
notifyJobCreated(job: Job): void;
|
|
362
|
+
listenJobsEvents(listener: IJobEventListener): void;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
declare class Async {
|
|
366
|
+
private jobRepository;
|
|
367
|
+
private handlerContainer;
|
|
368
|
+
private jobsEventsHub;
|
|
369
|
+
constructor(jobRepository: JobRepository, handlerContainer: CommandMetadataStore, jobsEventsHub: JobsEventsHub);
|
|
370
|
+
run<T extends IStorableData>(command: Command<T>): Promise<Job>;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
declare class JobRunner {
|
|
374
|
+
private jobRepository;
|
|
375
|
+
private handlerContainer;
|
|
376
|
+
constructor(jobRepository: JobRepository, handlerContainer: CommandMetadataStore);
|
|
377
|
+
run(job: Job): Promise<void>;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
declare function runAsyncCommandHandlers(handlers: IConstructor<ICommandHandler<any>>[]): void;
|
|
381
|
+
|
|
382
|
+
interface IChatConnection extends IStorableData {
|
|
383
|
+
channelName: string;
|
|
384
|
+
id: string;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
type IChatType = 'PRIVATE' | 'GROUP';
|
|
388
|
+
|
|
389
|
+
interface IChatData extends IEntityData {
|
|
390
|
+
type: IChatType;
|
|
391
|
+
connections: IChatConnection[];
|
|
392
|
+
}
|
|
393
|
+
declare class Chat extends Entity<IChatData> {
|
|
394
|
+
constructor(data: IChatData);
|
|
395
|
+
isPrivate(): boolean;
|
|
396
|
+
isGroup(): boolean;
|
|
397
|
+
hasConnection(connection: IChatConnection): boolean;
|
|
398
|
+
private validatePrivateChat;
|
|
399
|
+
private validateGroupChat;
|
|
400
|
+
validate(): void;
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
interface IMindsetFunctionConfig {
|
|
404
|
+
description: string;
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
declare function mindsetFunction(config: IMindsetFunctionConfig): (target: object, propertyKey: string | symbol) => void;
|
|
408
|
+
|
|
409
|
+
declare const MINDSET_FUNCTION_DECORATION_FUNCTION = "mindsetFunction";
|
|
410
|
+
|
|
411
|
+
interface IMindsetFunctionDecoration {
|
|
412
|
+
decorationName: string;
|
|
413
|
+
functionName: string;
|
|
414
|
+
constructor: Function;
|
|
415
|
+
paramsTypes: Function[];
|
|
416
|
+
decorationConfig: any;
|
|
417
|
+
}
|
|
181
418
|
|
|
182
419
|
interface IMindsetIdentity {
|
|
183
420
|
name: string;
|
|
@@ -186,15 +423,21 @@ interface IMindsetIdentity {
|
|
|
186
423
|
personality?: string;
|
|
187
424
|
emotions?: string;
|
|
188
425
|
}
|
|
426
|
+
interface IMindsetLlm {
|
|
427
|
+
provider?: string;
|
|
428
|
+
model: string;
|
|
429
|
+
}
|
|
189
430
|
interface IMindset {
|
|
190
431
|
identity(): Promise<IMindsetIdentity>;
|
|
191
432
|
skills(): Promise<string>;
|
|
192
433
|
limits(): Promise<string>;
|
|
434
|
+
llms(): Promise<IMindsetLlm[]>;
|
|
193
435
|
}
|
|
194
436
|
declare class Mindset implements IMindset {
|
|
195
437
|
identity(): Promise<IMindsetIdentity>;
|
|
196
438
|
skills(): Promise<string>;
|
|
197
439
|
limits(): Promise<string>;
|
|
440
|
+
llms(): Promise<IMindsetLlm[]>;
|
|
198
441
|
}
|
|
199
442
|
|
|
200
443
|
interface IMindsetConfig {
|
|
@@ -226,8 +469,6 @@ interface IMindsetModuleDecoration {
|
|
|
226
469
|
decorationConfig: any;
|
|
227
470
|
}
|
|
228
471
|
|
|
229
|
-
declare function isOptional(): PropertyDecorator;
|
|
230
|
-
|
|
231
472
|
interface IParamConfig {
|
|
232
473
|
name?: string;
|
|
233
474
|
optional?: boolean;
|
|
@@ -285,26 +526,17 @@ declare class MindsetMetadataStore {
|
|
|
285
526
|
getMindsetMetadata(ctor: Function): IMindsetMetadata;
|
|
286
527
|
}
|
|
287
528
|
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
createChildContainer(): DependencyContainer;
|
|
299
|
-
beforeResolution<T>(token: InjectionToken<T>, callback: PreResolutionInterceptorCallback<T>, options?: InterceptionOptions): void;
|
|
300
|
-
afterResolution<T>(token: InjectionToken<T>, callback: PostResolutionInterceptorCallback<T>, options?: InterceptionOptions): void;
|
|
301
|
-
dispose(): Promise<void> | void;
|
|
529
|
+
interface IMindsetToolParameter {
|
|
530
|
+
type: string;
|
|
531
|
+
name: string;
|
|
532
|
+
description: string;
|
|
533
|
+
}
|
|
534
|
+
interface IMindsetTool {
|
|
535
|
+
language: string;
|
|
536
|
+
name: string;
|
|
537
|
+
description: string;
|
|
538
|
+
parameters: IMindsetToolParameter[];
|
|
302
539
|
}
|
|
303
|
-
|
|
304
|
-
declare const injectable: typeof tsyringe.injectable;
|
|
305
|
-
declare const container: tsyringe.DependencyContainer;
|
|
306
|
-
declare const singleton: typeof tsyringe.singleton;
|
|
307
|
-
declare const inject: typeof tsyringe.inject;
|
|
308
540
|
|
|
309
541
|
declare class MindsetOperator implements IMindset {
|
|
310
542
|
private mindset;
|
|
@@ -314,98 +546,124 @@ declare class MindsetOperator implements IMindset {
|
|
|
314
546
|
identity(): Promise<IMindsetIdentity>;
|
|
315
547
|
skills(): Promise<string>;
|
|
316
548
|
limits(): Promise<string>;
|
|
549
|
+
llms(): Promise<IMindsetLlm[]>;
|
|
550
|
+
systemPrompt(): Promise<string>;
|
|
551
|
+
tools(): IMindsetTool[];
|
|
552
|
+
protected tool(fn: IMindsetFunctionMetadata, module: IMindsetModuleMetadata): IMindsetTool;
|
|
553
|
+
protected toolParameter(param: IMindsetFunctionParamMetadata): IMindsetToolParameter;
|
|
317
554
|
callFunction(name: string, params: string): Promise<string>;
|
|
318
|
-
allFunctionsDescriptors(): Promise<{
|
|
319
|
-
readonly type: "function";
|
|
320
|
-
readonly name: string;
|
|
321
|
-
readonly description: string;
|
|
322
|
-
readonly parameters: {
|
|
323
|
-
readonly type: "object";
|
|
324
|
-
readonly properties: {};
|
|
325
|
-
readonly required: string[];
|
|
326
|
-
};
|
|
327
|
-
}[]>;
|
|
328
|
-
private functionDescriptor;
|
|
329
|
-
private toolParam;
|
|
330
555
|
}
|
|
331
556
|
|
|
332
|
-
|
|
557
|
+
interface IChatMessage extends IStorableData {
|
|
558
|
+
senderId?: string;
|
|
559
|
+
senderName?: string;
|
|
560
|
+
text?: string;
|
|
561
|
+
}
|
|
333
562
|
|
|
334
|
-
interface
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
563
|
+
interface IFunctionCall extends IStorableData {
|
|
564
|
+
id: string;
|
|
565
|
+
name: string;
|
|
566
|
+
arguments?: string;
|
|
567
|
+
result?: string;
|
|
338
568
|
}
|
|
339
569
|
|
|
340
|
-
declare
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
570
|
+
declare const chatItemTypeOptions: readonly ["botMessage", "humanMessage", "functionCall"];
|
|
571
|
+
type IBotMessageItem = {
|
|
572
|
+
type: 'botMessage';
|
|
573
|
+
botMessage: IChatMessage;
|
|
574
|
+
};
|
|
575
|
+
type IHumanMessageItem = {
|
|
576
|
+
type: 'humanMessage';
|
|
577
|
+
humanMessage: IChatMessage;
|
|
578
|
+
};
|
|
579
|
+
type IFunctionCallItem = {
|
|
580
|
+
type: 'functionCall';
|
|
581
|
+
functionCall: IFunctionCall;
|
|
582
|
+
};
|
|
583
|
+
type IChatItem = IBotMessageItem | IHumanMessageItem | IFunctionCallItem;
|
|
584
|
+
type IChatItemType = (typeof chatItemTypeOptions)[number];
|
|
585
|
+
|
|
586
|
+
interface ILanguageModelUsage {
|
|
587
|
+
inputTokens: number;
|
|
588
|
+
outputTokens: number;
|
|
344
589
|
}
|
|
345
590
|
|
|
346
|
-
interface
|
|
347
|
-
|
|
591
|
+
interface IChatAdapterNextItemReq {
|
|
592
|
+
model: string;
|
|
593
|
+
systemPrompt: string;
|
|
594
|
+
tools: IMindsetTool[];
|
|
595
|
+
prevItems: IChatItem[];
|
|
348
596
|
}
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
generateNextChatItem(chatItems: ChatItem[]): Promise<ChatItem>;
|
|
353
|
-
protected systemPrompt(): Promise<string>;
|
|
354
|
-
protected buildBotMessageItem(text: string): Promise<ChatItem>;
|
|
355
|
-
protected buildFunctionCallItem(id: string, functionName: string, functionArguments: string): Promise<ChatItem>;
|
|
597
|
+
interface IChatAdapterNextItemRes {
|
|
598
|
+
chatItem: IChatItem;
|
|
599
|
+
usage: ILanguageModelUsage;
|
|
356
600
|
}
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
sendMessage(message: IChatMessage, callback: (message: IChatMessage) => void): void | Promise<void>;
|
|
601
|
+
interface IChatAdapter {
|
|
602
|
+
nextItem(req: IChatAdapterNextItemReq): Promise<IChatAdapterNextItemRes>;
|
|
360
603
|
}
|
|
361
604
|
|
|
362
|
-
declare class
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
sendMessage(message: IConnectionChatMessage, callback: (message: IChatMessage) => void): Promise<void>;
|
|
367
|
-
protected processLoop(callback: (message: IChatMessage) => void): Promise<void>;
|
|
605
|
+
declare class ChatAdapter implements IChatAdapter {
|
|
606
|
+
nextItem(req: IChatAdapterNextItemReq & {
|
|
607
|
+
provider?: string;
|
|
608
|
+
}): Promise<IChatAdapterNextItemRes>;
|
|
368
609
|
}
|
|
369
610
|
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
611
|
+
type IChatItemData = IEntityData & IChatItem;
|
|
612
|
+
declare class ChatItem extends Entity<IChatItemData> {
|
|
613
|
+
get type(): "botMessage" | "humanMessage" | "functionCall";
|
|
614
|
+
get botMessage(): IChatMessage;
|
|
615
|
+
get functionCall(): IFunctionCall;
|
|
616
|
+
setFunctionResult(result: string): void;
|
|
617
|
+
getData(): IChatItemData;
|
|
377
618
|
}
|
|
378
619
|
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
constructor(mindset: MindsetOperator);
|
|
383
|
-
generateNextChatItem(chatItems: ChatItem[]): Promise<ChatItem>;
|
|
384
|
-
private mapChatItems;
|
|
620
|
+
interface IChatMemory {
|
|
621
|
+
findLastItems(count: number): Promise<ChatItem[]>;
|
|
622
|
+
create(item: ChatItem): Promise<void>;
|
|
385
623
|
}
|
|
386
624
|
|
|
387
|
-
declare
|
|
625
|
+
declare class ChatMemory implements IChatMemory {
|
|
626
|
+
findLastItems(count: number): Promise<ChatItem[]>;
|
|
627
|
+
create(item: ChatItem): Promise<void>;
|
|
628
|
+
}
|
|
388
629
|
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
constructor(chatRepository: ChatRepository);
|
|
392
|
-
resolve(connection: IChatConnection): Promise<Chat>;
|
|
393
|
-
private resolveGroupChat;
|
|
394
|
-
private resolvePrivateChat;
|
|
630
|
+
interface IChatBot {
|
|
631
|
+
sendMessage(message: IChatMessage, callback: (message: IChatMessage) => void): void | Promise<void>;
|
|
395
632
|
}
|
|
396
633
|
|
|
397
|
-
|
|
398
|
-
|
|
634
|
+
declare class ChatBot implements IChatBot {
|
|
635
|
+
private memory;
|
|
636
|
+
private adapter;
|
|
637
|
+
private mindset;
|
|
638
|
+
constructor(memory: ChatMemory, adapter: ChatAdapter, mindset: MindsetOperator);
|
|
639
|
+
sendMessage(message: IChatMessage, callback: (message: IChatMessage) => void): Promise<void>;
|
|
640
|
+
protected processLoop(callback: (message: IChatMessage) => void): Promise<void>;
|
|
399
641
|
}
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
642
|
+
|
|
643
|
+
interface IChatRepository {
|
|
644
|
+
create(chat: Chat): Promise<void>;
|
|
645
|
+
findByConnection(query: IChatConnection): Promise<Chat | null>;
|
|
646
|
+
findMemory(chatId: string): Promise<IChatMemory | null>;
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
declare class ChatRepository implements IChatRepository {
|
|
650
|
+
create(chat: Chat): Promise<void>;
|
|
651
|
+
findByConnection(query: IChatConnection): Promise<Chat | null>;
|
|
652
|
+
findMemory(chatId: string): Promise<IChatMemory | null>;
|
|
403
653
|
}
|
|
404
654
|
|
|
405
|
-
declare
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
655
|
+
declare function chatBot(mindset: IConstructor<IMindset>): (target: object, propertyKey: string | symbol | undefined, parameterIndex: number) => void;
|
|
656
|
+
|
|
657
|
+
interface IChatBotMetadata {
|
|
658
|
+
constructor: IConstructor<any>;
|
|
659
|
+
mindsetConstructor: IConstructor<IMindset>;
|
|
660
|
+
injectionToken: string;
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
declare class ChatBotMetadataStore {
|
|
664
|
+
private chatBots;
|
|
665
|
+
saveChatBotMetadata(chatBot: IChatBotMetadata): void;
|
|
666
|
+
getChatBotsMetadata(): IChatBotMetadata[];
|
|
409
667
|
}
|
|
410
668
|
|
|
411
669
|
interface IchatControllerConfig {
|
|
@@ -417,6 +675,20 @@ interface IChatControllerMetadata {
|
|
|
417
675
|
controllerConstructor: Function;
|
|
418
676
|
}
|
|
419
677
|
|
|
678
|
+
interface IReceivedMessage {
|
|
679
|
+
message: IChatMessage;
|
|
680
|
+
reply: (message: IChatMessage) => void;
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
interface IChannelMessage extends IReceivedMessage {
|
|
684
|
+
chatConnection: IChatConnection;
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
interface IChatChannel {
|
|
688
|
+
listen(callback: (received: IChannelMessage) => void): void;
|
|
689
|
+
connect(): void;
|
|
690
|
+
}
|
|
691
|
+
|
|
420
692
|
interface IChannelMetadata {
|
|
421
693
|
controllerConstructor: IConstructor<any>;
|
|
422
694
|
functionName: string;
|
|
@@ -435,16 +707,20 @@ declare class ControllerMetadataStore {
|
|
|
435
707
|
} | null;
|
|
436
708
|
}
|
|
437
709
|
|
|
438
|
-
declare class
|
|
439
|
-
private
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
private
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
710
|
+
declare class ChatResolver {
|
|
711
|
+
private chatRepository;
|
|
712
|
+
constructor(chatRepository: ChatRepository);
|
|
713
|
+
resolve(connection: IChatConnection): Promise<Chat>;
|
|
714
|
+
private resolveGroupChat;
|
|
715
|
+
private resolvePrivateChat;
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
interface IMessageContext extends IReceivedMessage {
|
|
719
|
+
chat: Chat;
|
|
446
720
|
}
|
|
447
721
|
|
|
722
|
+
declare function runChatControllers(controllers: IConstructor<any>[]): void;
|
|
723
|
+
|
|
448
724
|
declare class HttpServerProvider {
|
|
449
725
|
server: Server | null;
|
|
450
726
|
private listening;
|
|
@@ -463,16 +739,148 @@ declare class ExpressProvider {
|
|
|
463
739
|
private createExpress;
|
|
464
740
|
}
|
|
465
741
|
|
|
466
|
-
interface
|
|
467
|
-
|
|
742
|
+
interface IMoneyData extends IStorableData {
|
|
743
|
+
amount: string;
|
|
744
|
+
currency: string;
|
|
745
|
+
}
|
|
746
|
+
declare class Money extends Storable<IMoneyData> {
|
|
747
|
+
getData(): {
|
|
748
|
+
[key: string]: IPrimitive | IStorableData | IPrimitive[] | IStorableData[];
|
|
749
|
+
amount: string;
|
|
750
|
+
currency: string;
|
|
751
|
+
};
|
|
752
|
+
get amount(): big_js.Big;
|
|
753
|
+
get currency(): string;
|
|
754
|
+
plus(money: Money): Money;
|
|
755
|
+
minus(money: Money): Money;
|
|
756
|
+
times(value: bigint | string): Money;
|
|
757
|
+
div(value: bigint | string): Money;
|
|
758
|
+
negative(): Money;
|
|
759
|
+
isGretterThan(money: Money): boolean;
|
|
760
|
+
protected validateEqualCurrencies(left: string, right: string): void;
|
|
761
|
+
static zero(currency: string): Money;
|
|
468
762
|
}
|
|
469
763
|
|
|
470
|
-
declare class
|
|
471
|
-
|
|
472
|
-
|
|
764
|
+
declare class MoneyDto {
|
|
765
|
+
amount: string;
|
|
766
|
+
currency: string;
|
|
473
767
|
}
|
|
474
768
|
|
|
475
|
-
|
|
769
|
+
type IPgRepositoryConfig<P extends Entity<IEntityData>> = {
|
|
770
|
+
schema?: string;
|
|
771
|
+
table: string;
|
|
772
|
+
constructor: IConstructor<P>;
|
|
773
|
+
add?: {
|
|
774
|
+
columns: {
|
|
775
|
+
[column: string]: {
|
|
776
|
+
type: string;
|
|
777
|
+
value: (item: P) => boolean | number | string | null | Date;
|
|
778
|
+
};
|
|
779
|
+
};
|
|
780
|
+
};
|
|
781
|
+
};
|
|
782
|
+
|
|
783
|
+
declare class PgRepositoryBase<P extends Entity<IEntityData>> {
|
|
784
|
+
protected pool: Pool;
|
|
785
|
+
protected config: IPgRepositoryConfig<any>;
|
|
786
|
+
private tableIsCreated;
|
|
787
|
+
protected schema: string;
|
|
788
|
+
protected table: string;
|
|
789
|
+
protected columnsList: string[];
|
|
790
|
+
protected columnsAndTypes: string;
|
|
791
|
+
protected columns: string;
|
|
792
|
+
protected vars: string;
|
|
793
|
+
protected updates: string;
|
|
794
|
+
addColumns: {
|
|
795
|
+
[columns: string]: {
|
|
796
|
+
type: string;
|
|
797
|
+
value: (item: P) => number | boolean | string | null | Date;
|
|
798
|
+
};
|
|
799
|
+
};
|
|
800
|
+
constructor(pool: Pool, config: IPgRepositoryConfig<any>);
|
|
801
|
+
protected values(item: P): (string | number | boolean | Date | null)[];
|
|
802
|
+
protected exec(sql: string, values: any[]): Promise<void>;
|
|
803
|
+
protected query(sql: string, values: any[]): Promise<P[]>;
|
|
804
|
+
protected connect(): Promise<Pool>;
|
|
805
|
+
protected ensureTable(): Promise<void>;
|
|
806
|
+
protected ensureColumns(): Promise<void>;
|
|
807
|
+
}
|
|
808
|
+
|
|
809
|
+
declare class PgCrudRepository<P extends Entity<IEntityData>> extends PgRepositoryBase<P> implements ICrudRepository<P> {
|
|
810
|
+
protected readonly config: IPgRepositoryConfig<P>;
|
|
811
|
+
constructor(pool: Pool, config: IPgRepositoryConfig<P>);
|
|
812
|
+
find(id: string): Promise<P | null>;
|
|
813
|
+
findByIds(ids: string[]): Promise<P[]>;
|
|
814
|
+
findOrThrow(id: string): Promise<P>;
|
|
815
|
+
findAll(): Promise<P[]>;
|
|
816
|
+
create(item: P): Promise<void>;
|
|
817
|
+
update(item: P): Promise<void>;
|
|
818
|
+
discard(item: P): Promise<void>;
|
|
819
|
+
}
|
|
820
|
+
|
|
821
|
+
interface IEndPointConfig {
|
|
822
|
+
path?: string;
|
|
823
|
+
disableJsonParser?: boolean;
|
|
824
|
+
disableUrlEncodedParser?: boolean;
|
|
825
|
+
}
|
|
826
|
+
|
|
827
|
+
declare function get(config?: string | IEndPointConfig): (target: object, propertyKey: string | symbol) => void;
|
|
828
|
+
|
|
829
|
+
interface IMiddleware {
|
|
830
|
+
handle(req: Request, res: Response, container: DependencyContainer$1): Promise<void>;
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
declare function middleware(middlewareConstructor: IConstructor<IMiddleware>): (target: object, propertyKey: string | symbol) => void;
|
|
834
|
+
|
|
835
|
+
declare function post(config?: string | IEndPointConfig): (target: object, propertyKey: string | symbol) => void;
|
|
836
|
+
|
|
837
|
+
interface IRestControllerConfig {
|
|
838
|
+
path: string;
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
declare function restController(config: string | IRestControllerConfig): (target: IConstructor<any>) => void;
|
|
842
|
+
|
|
843
|
+
interface IEndPointMetadata {
|
|
844
|
+
method: 'get' | 'post';
|
|
845
|
+
config?: IEndPointConfig;
|
|
846
|
+
controllerConstructor: IConstructor<any>;
|
|
847
|
+
functionName: string;
|
|
848
|
+
paramsTypes: any[];
|
|
849
|
+
}
|
|
850
|
+
|
|
851
|
+
interface IMiddlewareMetadata {
|
|
852
|
+
controllerConstructor: IConstructor<any>;
|
|
853
|
+
functionName: string;
|
|
854
|
+
middlewareConstructor: IConstructor<IMiddleware>;
|
|
855
|
+
}
|
|
856
|
+
|
|
857
|
+
interface IRestControllerMetadata {
|
|
858
|
+
controllerConstructor: IConstructor<any>;
|
|
859
|
+
path: string;
|
|
860
|
+
}
|
|
861
|
+
|
|
862
|
+
declare class RestControllerMetadataStore {
|
|
863
|
+
private endPoints;
|
|
864
|
+
private middlewares;
|
|
865
|
+
private restControllers;
|
|
866
|
+
saveControllerMetadata(controllerMetadata: IRestControllerMetadata): void;
|
|
867
|
+
saveEndPointMetadata(endPointMetadata: IEndPointMetadata): void;
|
|
868
|
+
saveMiddlewareMetadata(middlewareMetadata: IMiddlewareMetadata): void;
|
|
869
|
+
getControllerEndPointsInfo(controllerConstructor: IConstructor<any>): {
|
|
870
|
+
middlewares: IMiddlewareMetadata[];
|
|
871
|
+
controller: IRestControllerMetadata;
|
|
872
|
+
method: "get" | "post";
|
|
873
|
+
config?: IEndPointConfig;
|
|
874
|
+
controllerConstructor: IConstructor<any>;
|
|
875
|
+
functionName: string;
|
|
876
|
+
paramsTypes: any[];
|
|
877
|
+
}[];
|
|
878
|
+
}
|
|
879
|
+
|
|
880
|
+
declare function runRestControllers(controllers: IConstructor<any>[]): void;
|
|
881
|
+
|
|
882
|
+
declare const EXPRESS_REQ = "EXPRESS_REQ";
|
|
883
|
+
declare const EXPRESS_RES = "EXPRESS_RES";
|
|
476
884
|
|
|
477
885
|
declare class SocketServerProvider {
|
|
478
886
|
private httpServerProvider;
|
|
@@ -484,138 +892,381 @@ declare class SocketServerProvider {
|
|
|
484
892
|
private createSocketServer;
|
|
485
893
|
}
|
|
486
894
|
|
|
487
|
-
interface
|
|
488
|
-
|
|
489
|
-
userId: string;
|
|
490
|
-
senderName: string;
|
|
491
|
-
text: string;
|
|
895
|
+
interface IConnectionMiddleware {
|
|
896
|
+
handle(socket: Socket, container: DependencyContainer$1): Promise<void>;
|
|
492
897
|
}
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
private callBack;
|
|
499
|
-
private server;
|
|
500
|
-
constructor(config: SocketChannelConfig, socketServerProvider: SocketServerProvider, chatResolver: ChatResolver, userResolver: UserResolver);
|
|
501
|
-
listen(callback: (message: IReceivedMessage) => void): void;
|
|
502
|
-
connect(): void;
|
|
898
|
+
|
|
899
|
+
declare function connectionMiddleware(middlewareConstructor: IConstructor<IConnectionMiddleware>): (target: object, propertyKey: string | symbol) => void;
|
|
900
|
+
|
|
901
|
+
interface ISocketConnectionConfig {
|
|
902
|
+
namespace: string;
|
|
503
903
|
}
|
|
504
904
|
|
|
505
|
-
|
|
506
|
-
|
|
905
|
+
declare function socketConnection(config?: string | ISocketConnectionConfig): (target: object, propertyKey: string | symbol) => void;
|
|
906
|
+
|
|
907
|
+
interface ISocketControllerConfig {
|
|
908
|
+
namespace: string;
|
|
507
909
|
}
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
910
|
+
|
|
911
|
+
declare function socketController(config?: string | ISocketControllerConfig): (target: IConstructor<any>) => void;
|
|
912
|
+
|
|
913
|
+
interface ISocketEventConfig {
|
|
914
|
+
namespace?: string;
|
|
915
|
+
event: string;
|
|
511
916
|
}
|
|
512
917
|
|
|
513
|
-
declare function
|
|
918
|
+
declare function socketEvent(config: string | ISocketEventConfig): (target: object, propertyKey: string | symbol) => void;
|
|
514
919
|
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
private bot;
|
|
520
|
-
constructor(config: TelegramChannelConfig, chatResolver: ChatResolver, userResolver: UserResolver);
|
|
521
|
-
listen(callback: (message: IReceivedMessage) => void): void;
|
|
522
|
-
connect(): void;
|
|
920
|
+
interface IConnectionMiddlewareMetadata {
|
|
921
|
+
controllerConstructor: IConstructor<any>;
|
|
922
|
+
functionName: string;
|
|
923
|
+
middlewareConstructor: IConstructor<IConnectionMiddleware>;
|
|
523
924
|
}
|
|
524
925
|
|
|
525
|
-
interface
|
|
526
|
-
|
|
527
|
-
|
|
926
|
+
interface ISocketConnectionMetadata {
|
|
927
|
+
config?: ISocketConnectionConfig;
|
|
928
|
+
controllerConstructor: IConstructor<any>;
|
|
929
|
+
functionName: string;
|
|
930
|
+
paramsTypes: any[];
|
|
528
931
|
}
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
932
|
+
|
|
933
|
+
interface ISocketControllerMetadata {
|
|
934
|
+
controllerConstructor: IConstructor<any>;
|
|
935
|
+
config?: ISocketControllerConfig;
|
|
532
936
|
}
|
|
533
937
|
|
|
534
|
-
|
|
938
|
+
interface ISocketEventMetadata {
|
|
939
|
+
config: ISocketEventConfig;
|
|
940
|
+
controllerConstructor: IConstructor<any>;
|
|
941
|
+
functionName: string;
|
|
942
|
+
paramsTypes: any[];
|
|
943
|
+
}
|
|
944
|
+
|
|
945
|
+
declare class SocketControllerMetadataStore {
|
|
946
|
+
private socketControllers;
|
|
947
|
+
private socketConnections;
|
|
948
|
+
private socketEvents;
|
|
949
|
+
private connectionMiddlewares;
|
|
950
|
+
saveControllerMetadata(controllerMetadata: ISocketControllerMetadata): void;
|
|
951
|
+
saveSocketConnectionMetadata(socketConnectionMetadata: ISocketConnectionMetadata): void;
|
|
952
|
+
saveSocketEventMetadata(socketEventMetadata: ISocketEventMetadata): void;
|
|
953
|
+
saveConnectionMiddlewareMetadata(middlewareMetadata: IConnectionMiddlewareMetadata): void;
|
|
954
|
+
getControllerSockerConnectionsInfo(controllerConstructor: IConstructor<any>): {
|
|
955
|
+
events: ISocketEventMetadata[];
|
|
956
|
+
connectionMiddlewares: IConnectionMiddlewareMetadata[];
|
|
957
|
+
controller: ISocketControllerMetadata;
|
|
958
|
+
config?: ISocketConnectionConfig;
|
|
959
|
+
controllerConstructor: IConstructor<any>;
|
|
960
|
+
functionName: string;
|
|
961
|
+
paramsTypes: any[];
|
|
962
|
+
}[];
|
|
963
|
+
}
|
|
964
|
+
|
|
965
|
+
declare function runSocketControllers(controllers: IConstructor<any>[]): void;
|
|
966
|
+
|
|
967
|
+
declare class PgJobRepository extends PgCrudRepository<Job> implements IJobRepository {
|
|
968
|
+
constructor(pool: Pool);
|
|
969
|
+
}
|
|
535
970
|
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
971
|
+
declare function apiKeyGuard(): (target: object, propertyKey: string | symbol) => void;
|
|
972
|
+
|
|
973
|
+
interface IApiKeyData<A extends IStorableData> extends IEntityData {
|
|
974
|
+
passwordHash?: string;
|
|
975
|
+
authInfo: A;
|
|
976
|
+
}
|
|
977
|
+
declare class ApiKey<A extends IStorableData> extends Entity<IApiKeyData<A>> {
|
|
978
|
+
get authInfo(): A;
|
|
979
|
+
setAuthInfo(authInfo: A): void;
|
|
980
|
+
generatePassword(): string;
|
|
981
|
+
isValidPassword(password: string): boolean;
|
|
982
|
+
validatePassword(password: string): void;
|
|
983
|
+
static inflate(secret: string): {
|
|
984
|
+
id: string;
|
|
985
|
+
pass: string;
|
|
551
986
|
};
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
parameters: IWhatsAppTemplateParameter[];
|
|
987
|
+
static deflate(data: {
|
|
988
|
+
id: string;
|
|
989
|
+
pass: string;
|
|
990
|
+
}): string;
|
|
557
991
|
}
|
|
558
992
|
|
|
559
|
-
interface
|
|
560
|
-
|
|
561
|
-
|
|
993
|
+
interface IApiKeyRepository<A extends IStorableData> {
|
|
994
|
+
find(id: string): Promise<ApiKey<A> | null>;
|
|
995
|
+
findOrThrow(id: string): Promise<ApiKey<A>>;
|
|
996
|
+
create(item: ApiKey<A>): Promise<void>;
|
|
562
997
|
}
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
998
|
+
|
|
999
|
+
declare class ApiKeyRepository<A extends IStorableData> implements IApiKeyRepository<A> {
|
|
1000
|
+
find(id: string): Promise<ApiKey<A> | null>;
|
|
1001
|
+
findOrThrow(id: string): Promise<ApiKey<A>>;
|
|
1002
|
+
create(item: ApiKey<A>): Promise<void>;
|
|
566
1003
|
}
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
1004
|
+
|
|
1005
|
+
declare class ApiKeyGuardMiddleware implements IMiddleware {
|
|
1006
|
+
private apiKeyRepository;
|
|
1007
|
+
private auth;
|
|
1008
|
+
constructor(apiKeyRepository: ApiKeyRepository<any>, auth: Auth<any>);
|
|
1009
|
+
handle(req: Request, res: Response, container: DependencyContainer$1): Promise<void>;
|
|
571
1010
|
}
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
contacts?: IWhatsAppContact[];
|
|
576
|
-
messages?: IWhatsAppMessage[];
|
|
1011
|
+
|
|
1012
|
+
declare class PgApiKeyRepository<A extends IStorableData> extends PgCrudRepository<ApiKey<A>> implements IApiKeyRepository<A> {
|
|
1013
|
+
constructor(pool: Pool);
|
|
577
1014
|
}
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
1015
|
+
|
|
1016
|
+
declare function jwtConnectionGuard(): (target: object, propertyKey: string | symbol) => void;
|
|
1017
|
+
|
|
1018
|
+
declare function jwtGuard(): (target: object, propertyKey: string | symbol) => void;
|
|
1019
|
+
|
|
1020
|
+
interface IJwtRefreshTokenData<A extends IStorableData> extends IEntityData {
|
|
1021
|
+
authInfo: A;
|
|
1022
|
+
passwordHash?: string;
|
|
1023
|
+
expirationTime: number;
|
|
581
1024
|
}
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
1025
|
+
declare class JwtRefreshToken<A extends IStorableData> extends Entity<IJwtRefreshTokenData<A>> {
|
|
1026
|
+
get authInfo(): A;
|
|
1027
|
+
get expirationTime(): Date;
|
|
1028
|
+
generatePassword(): string;
|
|
1029
|
+
isValidPassword(password: string): boolean;
|
|
1030
|
+
validatePassword(password: string): void;
|
|
1031
|
+
static inflate(secret: string): {
|
|
1032
|
+
id: string;
|
|
1033
|
+
pass: string;
|
|
585
1034
|
};
|
|
586
|
-
|
|
1035
|
+
static deflate(data: {
|
|
1036
|
+
id: string;
|
|
1037
|
+
pass: string;
|
|
1038
|
+
}): string;
|
|
1039
|
+
}
|
|
1040
|
+
|
|
1041
|
+
interface IJwtRefreshTokenRepository<D extends IStorableData> extends ICrudRepository<JwtRefreshToken<D>> {
|
|
1042
|
+
}
|
|
1043
|
+
|
|
1044
|
+
declare class JwtTokenDto {
|
|
1045
|
+
token?: string;
|
|
1046
|
+
expiration?: Date;
|
|
1047
|
+
}
|
|
1048
|
+
|
|
1049
|
+
declare class JwtAccessAndRefreshTokenDto {
|
|
1050
|
+
access?: JwtTokenDto;
|
|
1051
|
+
refresh?: JwtTokenDto;
|
|
1052
|
+
}
|
|
1053
|
+
|
|
1054
|
+
declare class JwtConfig {
|
|
1055
|
+
secretOrPublicKey: string;
|
|
1056
|
+
secretOrPrivateKey: string;
|
|
1057
|
+
algorithm: Algorithm;
|
|
1058
|
+
accessExpirationSeconds: number;
|
|
1059
|
+
refreshExpirationSeconds: number;
|
|
1060
|
+
constructor(env: Env);
|
|
1061
|
+
}
|
|
1062
|
+
|
|
1063
|
+
declare class JwtSigner {
|
|
1064
|
+
private config;
|
|
1065
|
+
private mapper;
|
|
1066
|
+
constructor(config: JwtConfig, mapper: Mapper);
|
|
1067
|
+
signAccessToken<D extends IStorableData>(info: D | JwtRefreshToken<any>): Promise<JwtTokenDto>;
|
|
1068
|
+
}
|
|
1069
|
+
|
|
1070
|
+
declare class JwtRefreshTokenRepository<D extends IStorableData> implements IJwtRefreshTokenRepository<D> {
|
|
1071
|
+
find(id: string): Promise<JwtRefreshToken<D> | null>;
|
|
1072
|
+
findOrThrow(id: string): Promise<JwtRefreshToken<D>>;
|
|
1073
|
+
findByIds(ids: string[]): Promise<JwtRefreshToken<D>[]>;
|
|
1074
|
+
findAll(id: string): Promise<JwtRefreshToken<D>[]>;
|
|
1075
|
+
create(item: JwtRefreshToken<D>): Promise<void>;
|
|
1076
|
+
update(item: JwtRefreshToken<D>): Promise<void>;
|
|
1077
|
+
discard(item: JwtRefreshToken<D>): Promise<void>;
|
|
1078
|
+
}
|
|
1079
|
+
|
|
1080
|
+
declare class Jwt {
|
|
1081
|
+
private auth;
|
|
1082
|
+
private jwtSigner;
|
|
1083
|
+
private jwtRefreshTokenRepository;
|
|
1084
|
+
private config;
|
|
1085
|
+
constructor(auth: Auth<any>, jwtSigner: JwtSigner, jwtRefreshTokenRepository: JwtRefreshTokenRepository<any>, config: JwtConfig);
|
|
1086
|
+
createToken(): Promise<JwtAccessAndRefreshTokenDto>;
|
|
1087
|
+
refreshToken(refreshSecret: string): Promise<JwtTokenDto>;
|
|
1088
|
+
}
|
|
1089
|
+
|
|
1090
|
+
declare class JwtConnectionGuardMiddleware implements IConnectionMiddleware {
|
|
1091
|
+
private config;
|
|
1092
|
+
private auth;
|
|
1093
|
+
constructor(config: JwtConfig, auth: Auth<any>);
|
|
1094
|
+
handle(socket: Socket, container: DependencyContainer$1): Promise<void>;
|
|
1095
|
+
}
|
|
1096
|
+
|
|
1097
|
+
declare class JwtGuardMiddleware implements IMiddleware {
|
|
1098
|
+
private config;
|
|
1099
|
+
private auth;
|
|
1100
|
+
constructor(config: JwtConfig, auth: Auth<any>);
|
|
1101
|
+
handle(req: Request, res: Response, container: DependencyContainer$1): Promise<void>;
|
|
1102
|
+
}
|
|
1103
|
+
|
|
1104
|
+
declare class PgJwtRefreshTokenRepository<D extends IStorableData> extends PgCrudRepository<JwtRefreshToken<D>> implements IJwtRefreshTokenRepository<D> {
|
|
1105
|
+
constructor(pool: Pool);
|
|
1106
|
+
}
|
|
1107
|
+
|
|
1108
|
+
declare class AnthropicChatAdapter implements IChatAdapter {
|
|
1109
|
+
private env;
|
|
1110
|
+
private anthropic;
|
|
1111
|
+
private logger;
|
|
1112
|
+
constructor(env: Env);
|
|
1113
|
+
nextItem(req: IChatAdapterNextItemReq): Promise<IChatAdapterNextItemRes>;
|
|
1114
|
+
private mapChatItems;
|
|
1115
|
+
private mapHumanMessage;
|
|
1116
|
+
private mapBotMessage;
|
|
1117
|
+
private mapFunctionCall;
|
|
1118
|
+
private mapTool;
|
|
1119
|
+
private mapResponse;
|
|
1120
|
+
}
|
|
1121
|
+
|
|
1122
|
+
declare class DeepSeekChatAdapter implements IChatAdapter {
|
|
1123
|
+
private deepSeek;
|
|
1124
|
+
private logger;
|
|
1125
|
+
constructor();
|
|
1126
|
+
nextItem(req: IChatAdapterNextItemReq): Promise<IChatAdapterNextItemRes>;
|
|
1127
|
+
private mapChatItems;
|
|
1128
|
+
private mapHumanMessage;
|
|
1129
|
+
private mapBotMessage;
|
|
1130
|
+
private mapFunctionCall;
|
|
1131
|
+
private mapTool;
|
|
1132
|
+
private mapResponse;
|
|
1133
|
+
}
|
|
1134
|
+
|
|
1135
|
+
declare class GoogleChatAdapter implements IChatAdapter {
|
|
1136
|
+
private env;
|
|
1137
|
+
private genai;
|
|
1138
|
+
private logger;
|
|
1139
|
+
constructor(env: Env);
|
|
1140
|
+
nextItem(req: IChatAdapterNextItemReq): Promise<IChatAdapterNextItemRes>;
|
|
1141
|
+
private mapChatItems;
|
|
1142
|
+
private mapHumanMessage;
|
|
1143
|
+
private mapBotMessage;
|
|
1144
|
+
private mapFunctionCall;
|
|
1145
|
+
private mapTool;
|
|
1146
|
+
private mapResponse;
|
|
1147
|
+
}
|
|
1148
|
+
|
|
1149
|
+
declare class OpenaiChatAdapter implements IChatAdapter {
|
|
1150
|
+
private openai;
|
|
1151
|
+
private logger;
|
|
1152
|
+
nextItem(req: IChatAdapterNextItemReq): Promise<IChatAdapterNextItemRes>;
|
|
1153
|
+
private mapChatItems;
|
|
1154
|
+
private mapConectionMessage;
|
|
1155
|
+
private mapBotMessage;
|
|
1156
|
+
private mapFunctionCall;
|
|
1157
|
+
private mapTool;
|
|
1158
|
+
private mapResponse;
|
|
1159
|
+
}
|
|
1160
|
+
|
|
1161
|
+
declare class PgChatRepository extends PgCrudRepository<Chat> implements IChatRepository {
|
|
1162
|
+
constructor(pool: Pool);
|
|
1163
|
+
findByConnection(query: IChatConnection): Promise<Chat | null>;
|
|
1164
|
+
findMemory(chatId: string): Promise<IChatMemory | null>;
|
|
1165
|
+
}
|
|
1166
|
+
|
|
1167
|
+
declare class PgChatMemory extends PgCrudRepository<ChatItem> implements IChatMemory {
|
|
1168
|
+
private chatId;
|
|
1169
|
+
constructor(pool: Pool, chatId: string);
|
|
1170
|
+
findLastItems(count: number): Promise<ChatItem[]>;
|
|
1171
|
+
}
|
|
1172
|
+
|
|
1173
|
+
declare class RamChatMemory implements IChatMemory {
|
|
1174
|
+
private memory;
|
|
1175
|
+
findLastItems(count: number): Promise<ChatItem[]>;
|
|
1176
|
+
create(item: ChatItem): Promise<void>;
|
|
1177
|
+
clearMemory(): Promise<void>;
|
|
1178
|
+
}
|
|
1179
|
+
|
|
1180
|
+
declare class RamChatRepository implements IChatRepository {
|
|
1181
|
+
private items;
|
|
1182
|
+
private memories;
|
|
1183
|
+
create(chat: Chat): Promise<void>;
|
|
1184
|
+
findByConnection(query: IChatConnection): Promise<Chat | null>;
|
|
1185
|
+
findMemory(chatId: string): Promise<IChatMemory | null>;
|
|
1186
|
+
private getMemory;
|
|
1187
|
+
}
|
|
1188
|
+
|
|
1189
|
+
declare class WabotChatAdapter implements IChatAdapter {
|
|
1190
|
+
private apiKey;
|
|
1191
|
+
private baseUrl;
|
|
1192
|
+
private logger;
|
|
1193
|
+
constructor(env: Env);
|
|
1194
|
+
nextItem(req: IChatAdapterNextItemReq): Promise<IChatAdapterNextItemRes>;
|
|
1195
|
+
}
|
|
1196
|
+
|
|
1197
|
+
declare function cmd(): (target: object, propertyKey: string | symbol) => void;
|
|
1198
|
+
|
|
1199
|
+
declare class CmdChannel implements IChatChannel {
|
|
1200
|
+
private rl;
|
|
1201
|
+
private callBack;
|
|
1202
|
+
listen(callback: (message: IChannelMessage) => void): void;
|
|
1203
|
+
connect(): void;
|
|
1204
|
+
}
|
|
1205
|
+
|
|
1206
|
+
interface ISocketChannelConfig {
|
|
1207
|
+
channel: string;
|
|
1208
|
+
}
|
|
1209
|
+
|
|
1210
|
+
declare class SocketChannelConfig implements ISocketChannelConfig {
|
|
1211
|
+
channel: string;
|
|
1212
|
+
constructor(channel: string);
|
|
1213
|
+
}
|
|
1214
|
+
|
|
1215
|
+
declare function socket(config: SocketChannelConfig): (target: object, propertyKey: string | symbol) => void;
|
|
1216
|
+
|
|
1217
|
+
interface ISocketChannelReceivedMessage {
|
|
1218
|
+
chatId: string;
|
|
1219
|
+
userId: string;
|
|
1220
|
+
senderName: string;
|
|
1221
|
+
text: string;
|
|
1222
|
+
}
|
|
1223
|
+
declare class SocketChannel implements IChatChannel {
|
|
1224
|
+
private config;
|
|
1225
|
+
private socketServerProvider;
|
|
1226
|
+
private callBack;
|
|
1227
|
+
private server;
|
|
1228
|
+
constructor(config: SocketChannelConfig, socketServerProvider: SocketServerProvider);
|
|
1229
|
+
listen(callback: (message: IChannelMessage) => void): void;
|
|
1230
|
+
connect(): void;
|
|
1231
|
+
}
|
|
1232
|
+
|
|
1233
|
+
interface ITelegramChannelConfig {
|
|
1234
|
+
botToken: string;
|
|
1235
|
+
}
|
|
1236
|
+
declare class TelegramChannelConfig implements ITelegramChannelConfig {
|
|
1237
|
+
botToken: string;
|
|
1238
|
+
constructor(botToken: string);
|
|
587
1239
|
}
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
1240
|
+
|
|
1241
|
+
declare function telegram(config: ITelegramChannelConfig): (target: object, propertyKey: string | symbol) => void;
|
|
1242
|
+
|
|
1243
|
+
declare class TelegramChannel implements IChatChannel {
|
|
1244
|
+
private config;
|
|
1245
|
+
private bot;
|
|
1246
|
+
constructor(config: TelegramChannelConfig);
|
|
1247
|
+
listen(callback: (message: IChannelMessage) => void): void;
|
|
1248
|
+
connect(): void;
|
|
594
1249
|
}
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
};
|
|
1250
|
+
|
|
1251
|
+
interface IWhatsappChannelConfig {
|
|
1252
|
+
number: string;
|
|
1253
|
+
proxy?: string;
|
|
600
1254
|
}
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
mime_type: string;
|
|
605
|
-
sha256: string;
|
|
606
|
-
id: string;
|
|
607
|
-
voice: boolean;
|
|
608
|
-
};
|
|
1255
|
+
declare class WhatsappChannelConfig implements IWhatsappChannelConfig {
|
|
1256
|
+
number: string;
|
|
1257
|
+
constructor(number: string);
|
|
609
1258
|
}
|
|
610
1259
|
|
|
611
|
-
|
|
1260
|
+
declare function whatsApp(config: string | IWhatsappChannelConfig): (target: object, propertyKey: string | symbol) => void;
|
|
1261
|
+
|
|
1262
|
+
interface IWhatsAppBusinessNumber extends IStorableData {
|
|
612
1263
|
id: string;
|
|
613
1264
|
number: string;
|
|
614
1265
|
}
|
|
615
|
-
interface IWhatsAppBusinessAccount {
|
|
1266
|
+
interface IWhatsAppBusinessAccount extends IStorableData {
|
|
616
1267
|
id: string;
|
|
617
1268
|
}
|
|
618
|
-
interface IWhatsAppData extends
|
|
1269
|
+
interface IWhatsAppData extends IEntityData {
|
|
619
1270
|
slug: string;
|
|
620
1271
|
verifyToken: string;
|
|
621
1272
|
appSecret: string;
|
|
@@ -623,7 +1274,7 @@ interface IWhatsAppData extends IPersistentData {
|
|
|
623
1274
|
businessAccount: IWhatsAppBusinessAccount;
|
|
624
1275
|
businessNumbers: IWhatsAppBusinessNumber[];
|
|
625
1276
|
}
|
|
626
|
-
declare class WhatsApp extends
|
|
1277
|
+
declare class WhatsApp extends Entity<IWhatsAppData> {
|
|
627
1278
|
getVerifyToken(): string;
|
|
628
1279
|
getSlug(): string;
|
|
629
1280
|
getBusinessAccount(): IWhatsAppBusinessAccount;
|
|
@@ -634,57 +1285,88 @@ declare class WhatsApp extends Persistent<IWhatsAppData> {
|
|
|
634
1285
|
getBussinessNumber(number: string): IWhatsAppBusinessNumber | null;
|
|
635
1286
|
}
|
|
636
1287
|
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
1288
|
+
interface IWhatsAppRepository {
|
|
1289
|
+
findBySlug(slug: string): Promise<WhatsApp | null>;
|
|
1290
|
+
findByBusinessNumber(number: string): Promise<WhatsApp | null>;
|
|
1291
|
+
}
|
|
1292
|
+
|
|
1293
|
+
declare class EnvWhatsAppRepository implements IWhatsAppRepository {
|
|
1294
|
+
private env;
|
|
1295
|
+
constructor(env: Env);
|
|
1296
|
+
findBySlug(slug: string): Promise<WhatsApp | null>;
|
|
1297
|
+
findByBusinessNumber(number: string): Promise<WhatsApp | null>;
|
|
1298
|
+
private getFromEnvVars;
|
|
1299
|
+
}
|
|
1300
|
+
|
|
1301
|
+
declare class PgWhatsAppRepository extends PgCrudRepository<WhatsApp> implements IWhatsAppRepository {
|
|
1302
|
+
constructor(pool: Pool);
|
|
1303
|
+
findBySlug(slug: string): Promise<WhatsApp | null>;
|
|
1304
|
+
findByBusinessNumber(number: string): Promise<WhatsApp | null>;
|
|
647
1305
|
}
|
|
648
1306
|
|
|
649
|
-
type IWhatsAppMessageListener = (message:
|
|
1307
|
+
type IWhatsAppMessageListener = (message: Omit<IChannelMessage, 'reply'>) => Promise<void>;
|
|
650
1308
|
interface IListenWhatsAppMessageRequest {
|
|
651
1309
|
to: string;
|
|
652
1310
|
listener: IWhatsAppMessageListener;
|
|
653
1311
|
}
|
|
654
|
-
declare
|
|
655
|
-
|
|
656
|
-
private listeners;
|
|
657
|
-
constructor(logger: Logger);
|
|
658
|
-
abstract connect(): Promise<void>;
|
|
1312
|
+
declare class WhatsAppReceiver {
|
|
1313
|
+
connect(): Promise<void>;
|
|
659
1314
|
listenMessage(request: IListenWhatsAppMessageRequest): void;
|
|
660
|
-
protected handlePayload(payload: IWhatsAppWebhookPayload): Promise<void>;
|
|
661
|
-
private emmitMessage;
|
|
662
1315
|
}
|
|
663
1316
|
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
1317
|
+
type IWhatsAppCloudTemplateParameter = {
|
|
1318
|
+
type: 'text';
|
|
1319
|
+
text: string;
|
|
1320
|
+
parameter_name?: string;
|
|
1321
|
+
} | {
|
|
1322
|
+
type: 'currency';
|
|
1323
|
+
currency: {
|
|
1324
|
+
fallback_value: string;
|
|
1325
|
+
code: string;
|
|
1326
|
+
amount_1000: number;
|
|
1327
|
+
};
|
|
1328
|
+
} | {
|
|
1329
|
+
type: 'date_time';
|
|
1330
|
+
date_time: {
|
|
1331
|
+
fallback_value: string;
|
|
1332
|
+
};
|
|
1333
|
+
};
|
|
1334
|
+
interface IWhatsAppCloudTemplateMessage {
|
|
1335
|
+
templateName: string;
|
|
1336
|
+
languageCode: string;
|
|
1337
|
+
parameters: IWhatsAppCloudTemplateParameter[];
|
|
667
1338
|
}
|
|
668
1339
|
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
1340
|
+
interface IWhatsAppCloudTemplateResponse {
|
|
1341
|
+
data: IWhatsAppCloudTemplate[];
|
|
1342
|
+
paging: IWhatsAppCloudApiPaging;
|
|
672
1343
|
}
|
|
673
|
-
|
|
674
|
-
interface IWhatsAppTemplate {
|
|
1344
|
+
interface IWhatsAppCloudTemplate {
|
|
675
1345
|
name: string;
|
|
676
1346
|
parameter_format: 'POSITIONAL' | 'OTHER';
|
|
677
|
-
components:
|
|
1347
|
+
components: IWhatsAppCloudTemplateComponent[];
|
|
678
1348
|
language: string;
|
|
679
1349
|
status: string;
|
|
680
1350
|
category: string;
|
|
681
1351
|
id: string;
|
|
682
1352
|
}
|
|
683
|
-
interface
|
|
1353
|
+
interface IWhatsAppCloudTemplateComponent {
|
|
684
1354
|
type: 'HEADER' | 'BODY' | 'FOOTER';
|
|
685
1355
|
format?: 'TEXT';
|
|
686
1356
|
text?: string;
|
|
687
1357
|
}
|
|
1358
|
+
interface IWhatsAppCloudApiPaging {
|
|
1359
|
+
cursors: IWhatsAppCloudApiCursors;
|
|
1360
|
+
}
|
|
1361
|
+
interface IWhatsAppCloudApiCursors {
|
|
1362
|
+
before: string;
|
|
1363
|
+
after: string;
|
|
1364
|
+
}
|
|
1365
|
+
|
|
1366
|
+
declare class WhatsAppRepository implements IWhatsAppRepository {
|
|
1367
|
+
findBySlug(slug: string): Promise<WhatsApp | null>;
|
|
1368
|
+
findByBusinessNumber(number: string): Promise<WhatsApp | null>;
|
|
1369
|
+
}
|
|
688
1370
|
|
|
689
1371
|
interface ISendWhatsAppRequest {
|
|
690
1372
|
from: string;
|
|
@@ -694,7 +1376,7 @@ interface ISendWhatsAppRequest {
|
|
|
694
1376
|
interface ISendWhatsAppTemplateRequest {
|
|
695
1377
|
from: string;
|
|
696
1378
|
to: string;
|
|
697
|
-
templateMessage:
|
|
1379
|
+
templateMessage: IWhatsAppCloudTemplateMessage;
|
|
698
1380
|
senderName: string;
|
|
699
1381
|
}
|
|
700
1382
|
interface IGetWhatsAppTemplateRequest {
|
|
@@ -705,270 +1387,164 @@ interface IGetWhatsAppTemplateRequest {
|
|
|
705
1387
|
interface IWhatsAppSenderOptions {
|
|
706
1388
|
writeChatMemory?: boolean;
|
|
707
1389
|
}
|
|
708
|
-
declare
|
|
709
|
-
protected logger: Logger;
|
|
1390
|
+
declare class WhatsAppSender {
|
|
710
1391
|
protected chatRepository: ChatRepository;
|
|
711
1392
|
protected chatResolver: ChatResolver;
|
|
712
1393
|
protected whatsAppRepository: WhatsAppRepository;
|
|
713
|
-
constructor(
|
|
714
|
-
protected abstract handleSendRequest(request: ISendWhatsAppRequest): Promise<void>;
|
|
715
|
-
protected abstract handleSendTemplateRequest(request: ISendWhatsAppTemplateRequest): Promise<void>;
|
|
716
|
-
protected abstract handleGetWhatsAppTemplate(request: IGetWhatsAppTemplateRequest): Promise<IWhatsAppTemplate | null>;
|
|
1394
|
+
constructor(chatRepository: ChatRepository, chatResolver: ChatResolver, whatsAppRepository: WhatsAppRepository);
|
|
717
1395
|
sendWhatsApp(request: ISendWhatsAppRequest, options?: IWhatsAppSenderOptions): Promise<void>;
|
|
718
1396
|
sendWhatsAppTemplate(request: ISendWhatsAppTemplateRequest, options?: IWhatsAppSenderOptions): Promise<void>;
|
|
719
|
-
getWhatsAppTemplate(request: IGetWhatsAppTemplateRequest): Promise<
|
|
720
|
-
protected
|
|
1397
|
+
protected getWhatsAppTemplate(request: IGetWhatsAppTemplateRequest): Promise<IWhatsAppCloudTemplate | null>;
|
|
1398
|
+
protected mapTemplateToChatMessage(request: ISendWhatsAppTemplateRequest): Promise<IChatMessage>;
|
|
721
1399
|
protected writePrivateChatMemory(message: IChatMessage, to: string): Promise<void>;
|
|
722
|
-
|
|
1400
|
+
protected replaceTemplateParameters(template: string, data: IWhatsAppCloudTemplateParameter[]): string;
|
|
723
1401
|
}
|
|
724
1402
|
|
|
725
1403
|
declare class WhatsAppChannel implements IChatChannel {
|
|
726
1404
|
private config;
|
|
727
|
-
private chatResolver;
|
|
728
|
-
private userResolver;
|
|
729
1405
|
private sender;
|
|
730
1406
|
private receiver;
|
|
731
1407
|
private logger;
|
|
732
|
-
constructor(config: WhatsappChannelConfig,
|
|
733
|
-
listen(callback: (message:
|
|
1408
|
+
constructor(config: WhatsappChannelConfig, sender: WhatsAppSender, receiver: WhatsAppReceiver);
|
|
1409
|
+
listen(callback: (message: IChannelMessage) => void): void;
|
|
734
1410
|
connect(): void;
|
|
735
1411
|
}
|
|
736
1412
|
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
private devToken;
|
|
741
|
-
private logger;
|
|
742
|
-
static isTokenAvailable(): boolean;
|
|
743
|
-
constructor();
|
|
744
|
-
getSocket(): Promise<Socket>;
|
|
745
|
-
}
|
|
746
|
-
|
|
747
|
-
declare class WhatsAppReceiverByDevConnection extends WhatsAppReceiver {
|
|
748
|
-
private wabotDevConnection;
|
|
749
|
-
constructor(wabotDevConnection: WabotDevConnection);
|
|
750
|
-
connect(): Promise<void>;
|
|
1413
|
+
interface IWhatsAppCloudWebhookPayload {
|
|
1414
|
+
object: 'whatsapp_business_account';
|
|
1415
|
+
entry: IWhatsAppCloudEntry[];
|
|
751
1416
|
}
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
private whatsAppRepository;
|
|
756
|
-
private expressApp;
|
|
757
|
-
private webhookPath;
|
|
758
|
-
constructor(expressProvider: ExpressProvider, whatsAppRepository: WhatsAppRepository);
|
|
759
|
-
connect(): Promise<void>;
|
|
1417
|
+
interface IWhatsAppCloudEntry {
|
|
1418
|
+
id: string;
|
|
1419
|
+
changes: IWhatsAppCloudChange[];
|
|
760
1420
|
}
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
handleSendRequest(request: ISendWhatsAppRequest): Promise<void>;
|
|
766
|
-
handleSendTemplateRequest(request: ISendWhatsAppTemplateRequest): Promise<void>;
|
|
767
|
-
handleGetWhatsAppTemplate(request: IGetWhatsAppTemplateRequest): Promise<IWhatsAppTemplate | null>;
|
|
1421
|
+
type IWhatsAppCloudChange = IWhatsAppCloudMessagesChange;
|
|
1422
|
+
interface IWhatsAppCloudMessagesChange {
|
|
1423
|
+
value: IWhatsAppCloudMessagesChangeValue;
|
|
1424
|
+
field: 'messages';
|
|
768
1425
|
}
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
handleGetWhatsAppTemplate(request: IGetWhatsAppTemplateRequest): Promise<IWhatsAppTemplate | null>;
|
|
1426
|
+
interface IWhatsAppCloudMessagesChangeValue {
|
|
1427
|
+
messaging_product: 'whatsapp';
|
|
1428
|
+
metadata: IWhatsAppCloudMessageMetadata;
|
|
1429
|
+
contacts?: IWhatsAppCloudContact[];
|
|
1430
|
+
messages?: IWhatsAppCloudMessage[];
|
|
775
1431
|
}
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
findAll(id: string): Promise<T[]>;
|
|
780
|
-
create(item: T): Promise<void>;
|
|
781
|
-
update(item: T): Promise<void>;
|
|
782
|
-
discard(item: T): Promise<void>;
|
|
1432
|
+
interface IWhatsAppCloudMessageMetadata {
|
|
1433
|
+
display_phone_number: string;
|
|
1434
|
+
phone_number_id: string;
|
|
783
1435
|
}
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
table: string;
|
|
788
|
-
constructor: IConstructor<P>;
|
|
789
|
-
add?: {
|
|
790
|
-
columns: {
|
|
791
|
-
[column: string]: {
|
|
792
|
-
type: string;
|
|
793
|
-
value: (item: P) => boolean | number | string | null | Date;
|
|
794
|
-
};
|
|
795
|
-
};
|
|
796
|
-
};
|
|
797
|
-
};
|
|
798
|
-
|
|
799
|
-
declare class PgRepositoryBase<P extends Persistent> {
|
|
800
|
-
protected pool: Pool;
|
|
801
|
-
protected config: IPgRepositoryConfig<any>;
|
|
802
|
-
private tableIsCreated;
|
|
803
|
-
schema: string;
|
|
804
|
-
table: string;
|
|
805
|
-
columnsList: string[];
|
|
806
|
-
columnsAndTypes: string;
|
|
807
|
-
columns: string;
|
|
808
|
-
vars: string;
|
|
809
|
-
updates: string;
|
|
810
|
-
addColumns: {
|
|
811
|
-
[columns: string]: {
|
|
812
|
-
type: string;
|
|
813
|
-
value: (item: P) => number | boolean | string | null | Date;
|
|
814
|
-
};
|
|
1436
|
+
interface IWhatsAppCloudContact {
|
|
1437
|
+
profile: {
|
|
1438
|
+
name: string;
|
|
815
1439
|
};
|
|
816
|
-
|
|
817
|
-
values(item: P): (string | number | boolean | Date | null)[];
|
|
818
|
-
protected exec(sql: string, values: any[]): Promise<void>;
|
|
819
|
-
protected query(sql: string, values: any[]): Promise<any[]>;
|
|
820
|
-
protected connect(): Promise<Pool>;
|
|
821
|
-
protected ensureTable(): Promise<void>;
|
|
822
|
-
protected ensureColumns(): Promise<void>;
|
|
823
|
-
}
|
|
824
|
-
|
|
825
|
-
declare class PgCrudRepository<P extends Persistent> extends PgRepositoryBase<P> implements ICrudRepository<P> {
|
|
826
|
-
protected readonly config: IPgRepositoryConfig<P>;
|
|
827
|
-
constructor(pool: Pool, config: IPgRepositoryConfig<P>);
|
|
828
|
-
find(id: string): Promise<P | null>;
|
|
829
|
-
findAll(): Promise<P[]>;
|
|
830
|
-
create(item: P): Promise<void>;
|
|
831
|
-
update(item: P): Promise<void>;
|
|
832
|
-
discard(item: P): Promise<void>;
|
|
833
|
-
}
|
|
834
|
-
|
|
835
|
-
declare class PgWhatsAppRepository extends PgCrudRepository<WhatsApp> implements IWhatsAppRepository {
|
|
836
|
-
constructor(pool: Pool);
|
|
837
|
-
findBySlug(slug: string): Promise<WhatsApp | null>;
|
|
838
|
-
findByBusinessNumber(number: string): Promise<WhatsApp | null>;
|
|
1440
|
+
wa_id: string;
|
|
839
1441
|
}
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
isProduction(): boolean;
|
|
847
|
-
requireString(varName: string): string;
|
|
1442
|
+
type IWhatsAppCloudMessage = IWhatsAppCloudTextMessage | IWhatsAppCloudAudioMessage;
|
|
1443
|
+
interface IWhatsAppCloudBaseMessage {
|
|
1444
|
+
from: string;
|
|
1445
|
+
id: string;
|
|
1446
|
+
timestamp: string;
|
|
1447
|
+
type: string;
|
|
848
1448
|
}
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
findByBusinessNumber(number: string): Promise<WhatsApp | null>;
|
|
855
|
-
private getFromEnvVars;
|
|
1449
|
+
interface IWhatsAppCloudTextMessage extends IWhatsAppCloudBaseMessage {
|
|
1450
|
+
type: 'text';
|
|
1451
|
+
text: {
|
|
1452
|
+
body: string;
|
|
1453
|
+
};
|
|
856
1454
|
}
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
chatBotAdapter: IConstructor<IChatBotAdapter>;
|
|
1455
|
+
interface IWhatsAppCloudAudioMessage extends IWhatsAppCloudBaseMessage {
|
|
1456
|
+
type: 'audio';
|
|
1457
|
+
audio: {
|
|
1458
|
+
mime_type: string;
|
|
1459
|
+
sha256: string;
|
|
1460
|
+
id: string;
|
|
1461
|
+
voice: boolean;
|
|
1462
|
+
};
|
|
866
1463
|
}
|
|
867
|
-
declare function runChannel(props: IrunChannelProps): void;
|
|
868
1464
|
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
1465
|
+
declare class WhatsAppReceiverByCloudApi extends WhatsAppReceiver {
|
|
1466
|
+
private expressProvider;
|
|
1467
|
+
private whatsAppRepository;
|
|
1468
|
+
private listeners;
|
|
1469
|
+
private expressApp;
|
|
1470
|
+
private logger;
|
|
1471
|
+
private webhookPath;
|
|
1472
|
+
constructor(expressProvider: ExpressProvider, whatsAppRepository: WhatsAppRepository);
|
|
1473
|
+
connect(): Promise<void>;
|
|
1474
|
+
listenMessage(request: IListenWhatsAppMessageRequest): void;
|
|
1475
|
+
protected handlePayload(payload: IWhatsAppCloudWebhookPayload): Promise<void>;
|
|
1476
|
+
private emmitMessage;
|
|
877
1477
|
}
|
|
878
|
-
declare function runServer(config: IServerConfig): void;
|
|
879
1478
|
|
|
880
|
-
declare class
|
|
881
|
-
|
|
882
|
-
|
|
1479
|
+
declare class WhatsAppSenderByCloudApi extends WhatsAppSender {
|
|
1480
|
+
private logger;
|
|
1481
|
+
constructor(chatRepository: ChatRepository, chatResolver: ChatResolver, whatsAppRepository: WhatsAppRepository);
|
|
1482
|
+
sendWhatsApp(request: ISendWhatsAppRequest, options?: IWhatsAppSenderOptions): Promise<void>;
|
|
1483
|
+
sendWhatsAppTemplate(request: ISendWhatsAppTemplateRequest, options?: IWhatsAppSenderOptions): Promise<void>;
|
|
1484
|
+
protected getWhatsAppTemplate(request: IGetWhatsAppTemplateRequest): Promise<IWhatsAppCloudTemplate | null>;
|
|
883
1485
|
}
|
|
884
1486
|
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
otp: string;
|
|
1487
|
+
interface IWhatsAppProxyMessageContent {
|
|
1488
|
+
text: string;
|
|
888
1489
|
}
|
|
889
1490
|
|
|
890
|
-
interface
|
|
1491
|
+
interface IWhatsAppProxyMessage {
|
|
891
1492
|
from: string;
|
|
892
1493
|
to: string;
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
}
|
|
896
|
-
interface IEmailService {
|
|
897
|
-
sendEmail(request: ISendEmailRequest): Promise<void>;
|
|
898
|
-
}
|
|
899
|
-
declare class EmailService implements IEmailService {
|
|
900
|
-
sendEmail(request: ISendEmailRequest): Promise<void>;
|
|
901
|
-
}
|
|
902
|
-
|
|
903
|
-
interface IOtpService {
|
|
904
|
-
generate(): Promise<string>;
|
|
905
|
-
}
|
|
906
|
-
declare class OtpService implements IOtpService {
|
|
907
|
-
generate(): Promise<string>;
|
|
908
|
-
}
|
|
909
|
-
|
|
910
|
-
declare class AuthenticationModule {
|
|
911
|
-
private userRepository;
|
|
912
|
-
private emailService;
|
|
913
|
-
private otpService;
|
|
914
|
-
private context;
|
|
915
|
-
constructor(userRepository: UserRepository, emailService: EmailService, otpService: OtpService, context: MessageContext);
|
|
916
|
-
sendOneTimePassword(request: SendOneTimePasswordRequest): Promise<string>;
|
|
917
|
-
validateOneTimePassword(request: ValidateOneTimePasswordRequest): Promise<string>;
|
|
918
|
-
protected generateOtpEmailHtml(otp: string, user: User): Promise<string>;
|
|
919
|
-
protected generateOtpEmailSubject(): Promise<string>;
|
|
1494
|
+
senderName?: string;
|
|
1495
|
+
content: IWhatsAppProxyMessageContent;
|
|
920
1496
|
}
|
|
921
1497
|
|
|
922
|
-
declare
|
|
923
|
-
|
|
924
|
-
|
|
1498
|
+
declare const WHATSAPP_PROXY_SEND_MESSAGE_EVENT: "sendMessage";
|
|
1499
|
+
interface IWhatsAppProxySendMessageEventReq {
|
|
1500
|
+
event: typeof WHATSAPP_PROXY_SEND_MESSAGE_EVENT;
|
|
1501
|
+
data: IWhatsAppProxyMessage;
|
|
925
1502
|
}
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
constructor(userRepository: UserRepository, context: MessageContext);
|
|
931
|
-
registerUserWithEmail(request: RegisterUserWithEmailRequest): Promise<string>;
|
|
1503
|
+
declare const WHATSAPP_PROXY_LISTEN_MESSAGE_EVENT: "listenMessage";
|
|
1504
|
+
interface IWhatsAppProxyListenMessageEventReq {
|
|
1505
|
+
event: typeof WHATSAPP_PROXY_LISTEN_MESSAGE_EVENT;
|
|
1506
|
+
data: IWhatsAppProxyListenMessageEventData;
|
|
932
1507
|
}
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
findByConnection(query: IUserConnection): Promise<User | null>;
|
|
1508
|
+
interface IWhatsAppProxyListenMessageEventData {
|
|
1509
|
+
from?: string[];
|
|
1510
|
+
to: string[];
|
|
937
1511
|
}
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
findByConnection(query: IUserConnection): Promise<User | null>;
|
|
943
|
-
update(chat: User): Promise<void>;
|
|
1512
|
+
declare const WHATSAPP_MESSAGE_EVENT: "message";
|
|
1513
|
+
interface IWhatsAppProxyMessageEventReq {
|
|
1514
|
+
event: typeof WHATSAPP_MESSAGE_EVENT;
|
|
1515
|
+
data: IWhatsAppProxyMessage;
|
|
944
1516
|
}
|
|
945
1517
|
|
|
946
|
-
declare class
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
1518
|
+
declare class WhatsAppWabotProxyConnection {
|
|
1519
|
+
private baseUrl;
|
|
1520
|
+
private socket;
|
|
1521
|
+
private apiKey;
|
|
1522
|
+
private logger;
|
|
1523
|
+
constructor(env: Env);
|
|
1524
|
+
getSocket(): Promise<Socket$1>;
|
|
950
1525
|
}
|
|
951
1526
|
|
|
952
|
-
declare class
|
|
953
|
-
private
|
|
954
|
-
|
|
955
|
-
|
|
1527
|
+
declare class WhatsAppReceiverByWabotProxy extends WhatsAppReceiver {
|
|
1528
|
+
private connection;
|
|
1529
|
+
private loger;
|
|
1530
|
+
constructor(connection: WhatsAppWabotProxyConnection);
|
|
1531
|
+
connect(): Promise<void>;
|
|
1532
|
+
listenMessage(request: IListenWhatsAppMessageRequest): void;
|
|
956
1533
|
}
|
|
957
1534
|
|
|
958
|
-
declare class
|
|
959
|
-
private
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
1535
|
+
declare class WhatsAppSenderByWabotProxy extends WhatsAppSender {
|
|
1536
|
+
private wabotDevConnection;
|
|
1537
|
+
private logger;
|
|
1538
|
+
constructor(wabotDevConnection: WhatsAppWabotProxyConnection, chatRepository: ChatRepository, chatResolver: ChatResolver, whatsAppRepository: WhatsAppRepository);
|
|
1539
|
+
sendWhatsApp(request: ISendWhatsAppRequest, options?: IWhatsAppSenderOptions): Promise<void>;
|
|
963
1540
|
}
|
|
964
1541
|
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
create(chat: Chat): Promise<void>;
|
|
969
|
-
findByConnection(query: IChatConnection): Promise<Chat | null>;
|
|
970
|
-
findMemory(chatId: string): Promise<IChatMemory | null>;
|
|
971
|
-
private getMemory;
|
|
1542
|
+
interface IHtmlModuleOptions {
|
|
1543
|
+
url: string;
|
|
1544
|
+
title: string;
|
|
972
1545
|
}
|
|
1546
|
+
declare function HtmlModule(options: IHtmlModuleOptions): {
|
|
1547
|
+
new (): {};
|
|
1548
|
+
};
|
|
973
1549
|
|
|
974
|
-
export {
|
|
1550
|
+
export { AnthropicChatAdapter, ApiKey, ApiKeyGuardMiddleware, 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, HtmlModule, HttpServerProvider, type IApiKeyData, type IApiKeyRepository, type IArrayValidationError, type IArrayValidationResult, type IBotMessageItem, type IChannelMessage, type IChannelMetadata, type IChatAdapter, type IChatAdapterNextItemReq, type IChatAdapterNextItemRes, 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 IConnectionMiddleware, type IConnectionMiddlewareMetadata, type IConstructor, type ICrudRepository, type ICustomErrorData, type IEndPointConfig, type IEndPointMetadata, type IEntityData, type IEnvType, type IFunctionCall, type IFunctionCallItem, type IGetWhatsAppTemplateRequest, 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 IRestControllerConfig, type IRestControllerMetadata, type ISendWhatsAppRequest, type ISendWhatsAppTemplateRequest, type ISocketChannelConfig, type ISocketChannelReceivedMessage, type ISocketConnectionConfig, type ISocketConnectionMetadata, type ISocketControllerConfig, type ISocketControllerMetadata, type ISocketEventConfig, type ISocketEventMetadata, type IStorableData, type ITelegramChannelConfig, type IValidateArrayOptions, type IValidateArrayOptionsWithItemsValidators, 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, JwtConnectionGuardMiddleware, JwtGuardMiddleware, 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, RestControllerMetadataStore, SocketChannel, SocketChannelConfig, 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, chatBot, chatController, chatItemTypeOptions, cmd, command, commandHandler, connectionMiddleware, container, get, inject, injectable, isArray, isBoolean, isDate, isModel, isNotEmpty, isNumber, isOptional, isPresent, isString, jwtConnectionGuard, jwtGuard, max, middleware, min, mindset, mindsetFunction, mindsetModule, modelInfo, param, post, restController, runAsyncCommandHandlers, runChatControllers, runRestControllers, runSocketControllers, scoped, singleton, socket, socketConnection, socketController, socketEvent, telegram, validate, validateArray, validateIsBoolean, validateIsDate, validateIsNotEmpty, validateIsNumber, validateIsPresent, validateIsString, validateMax, validateMin, validateModel, whatsApp };
|