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