@wabot-dev/framework 0.4.0-beta.2 → 0.4.0-beta.3

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.
Files changed (44) hide show
  1. package/dist/src/_virtual/CronDate.js +3 -0
  2. package/dist/src/_virtual/CronDayOfMonth.js +3 -0
  3. package/dist/src/_virtual/CronDayOfWeek.js +3 -0
  4. package/dist/src/_virtual/CronExpression.js +3 -0
  5. package/dist/src/_virtual/CronExpressionParser.js +3 -0
  6. package/dist/src/_virtual/CronField.js +3 -0
  7. package/dist/src/_virtual/CronFieldCollection.js +3 -0
  8. package/dist/src/_virtual/CronFileParser.js +3 -0
  9. package/dist/src/_virtual/CronHour.js +3 -0
  10. package/dist/src/_virtual/CronMinute.js +3 -0
  11. package/dist/src/_virtual/CronMonth.js +3 -0
  12. package/dist/src/_virtual/CronSecond.js +3 -0
  13. package/dist/src/_virtual/index.js +5 -0
  14. package/dist/src/_virtual/index2.js +3 -0
  15. package/dist/src/_virtual/index3.js +3 -0
  16. package/dist/src/_virtual/luxon.js +3 -0
  17. package/dist/src/_virtual/random.js +3 -0
  18. package/dist/src/_virtual/types.js +3 -0
  19. package/dist/src/addon/async/pg/PgJobRepository.js +1 -0
  20. package/dist/src/feature/async/@cron.js +17 -0
  21. package/dist/src/feature/async/CronJob.js +67 -0
  22. package/dist/src/feature/async/CronJobRepository.js +19 -0
  23. package/dist/src/feature/async/CronScheduler.js +165 -0
  24. package/dist/src/feature/async/runCronHandlers.js +18 -0
  25. package/dist/src/index.d.ts +11 -1
  26. package/dist/src/index.js +2 -0
  27. package/dist/src/node_modules/cron-parser/dist/CronDate.js +510 -0
  28. package/dist/src/node_modules/cron-parser/dist/CronExpression.js +420 -0
  29. package/dist/src/node_modules/cron-parser/dist/CronExpressionParser.js +396 -0
  30. package/dist/src/node_modules/cron-parser/dist/CronFieldCollection.js +382 -0
  31. package/dist/src/node_modules/cron-parser/dist/CronFileParser.js +122 -0
  32. package/dist/src/node_modules/cron-parser/dist/fields/CronDayOfMonth.js +55 -0
  33. package/dist/src/node_modules/cron-parser/dist/fields/CronDayOfWeek.js +62 -0
  34. package/dist/src/node_modules/cron-parser/dist/fields/CronField.js +193 -0
  35. package/dist/src/node_modules/cron-parser/dist/fields/CronHour.js +51 -0
  36. package/dist/src/node_modules/cron-parser/dist/fields/CronMinute.js +51 -0
  37. package/dist/src/node_modules/cron-parser/dist/fields/CronMonth.js +56 -0
  38. package/dist/src/node_modules/cron-parser/dist/fields/CronSecond.js +51 -0
  39. package/dist/src/node_modules/cron-parser/dist/fields/index.js +44 -0
  40. package/dist/src/node_modules/cron-parser/dist/fields/types.js +12 -0
  41. package/dist/src/node_modules/cron-parser/dist/index.js +49 -0
  42. package/dist/src/node_modules/cron-parser/dist/utils/random.js +48 -0
  43. package/dist/src/node_modules/luxon/build/node/luxon.js +7802 -0
  44. package/package.json +1 -1
@@ -0,0 +1,3 @@
1
+ var CronDate = {};
2
+
3
+ export { CronDate as __exports };
@@ -0,0 +1,3 @@
1
+ var CronDayOfMonth = {};
2
+
3
+ export { CronDayOfMonth as __exports };
@@ -0,0 +1,3 @@
1
+ var CronDayOfWeek = {};
2
+
3
+ export { CronDayOfWeek as __exports };
@@ -0,0 +1,3 @@
1
+ var CronExpression = {};
2
+
3
+ export { CronExpression as __exports };
@@ -0,0 +1,3 @@
1
+ var CronExpressionParser = {};
2
+
3
+ export { CronExpressionParser as __exports };
@@ -0,0 +1,3 @@
1
+ var CronField = {};
2
+
3
+ export { CronField as __exports };
@@ -0,0 +1,3 @@
1
+ var CronFieldCollection = {};
2
+
3
+ export { CronFieldCollection as __exports };
@@ -0,0 +1,3 @@
1
+ var CronFileParser = {};
2
+
3
+ export { CronFileParser as __exports };
@@ -0,0 +1,3 @@
1
+ var CronHour = {};
2
+
3
+ export { CronHour as __exports };
@@ -0,0 +1,3 @@
1
+ var CronMinute = {};
2
+
3
+ export { CronMinute as __exports };
@@ -0,0 +1,3 @@
1
+ var CronMonth = {};
2
+
3
+ export { CronMonth as __exports };
@@ -0,0 +1,3 @@
1
+ var CronSecond = {};
2
+
3
+ export { CronSecond as __exports };
@@ -0,0 +1,5 @@
1
+ import { __require as requireDist } from '../node_modules/cron-parser/dist/index.js';
2
+
3
+ var distExports = requireDist();
4
+
5
+ export { distExports as d };
@@ -0,0 +1,3 @@
1
+ var dist = {};
2
+
3
+ export { dist as __exports };
@@ -0,0 +1,3 @@
1
+ var fields = {};
2
+
3
+ export { fields as __exports };
@@ -0,0 +1,3 @@
1
+ var luxon = {};
2
+
3
+ export { luxon as __exports };
@@ -0,0 +1,3 @@
1
+ var random = {};
2
+
3
+ export { random as __exports };
@@ -0,0 +1,3 @@
1
+ var types = {};
2
+
3
+ export { types as __exports };
@@ -14,6 +14,7 @@ import '../../../feature/async/JobRepository.js';
14
14
  import '../../../feature/async/JobRunner.js';
15
15
  import '../../../feature/async/JobScheduler.js';
16
16
  import '../../../feature/async/JobWatchdog.js';
17
+ import '../../../feature/async/CronScheduler.js';
17
18
 
18
19
  let PgJobRepository = class PgJobRepository extends PgCrudRepository {
19
20
  constructor(pool) {
@@ -0,0 +1,17 @@
1
+ import { AsyncMetadataStore } from './AsyncMetadataStore.js';
2
+ import { container, singleton } from '../../core/injection/index.js';
3
+
4
+ function cron(config) {
5
+ return function (target) {
6
+ const metadataStore = container.resolve(AsyncMetadataStore);
7
+ metadataStore.registerCron(target, {
8
+ name: config.name,
9
+ commandName: `cron:${config.name}`,
10
+ cron: config.cron,
11
+ enabled: !config.disabled,
12
+ });
13
+ singleton()(target);
14
+ };
15
+ }
16
+
17
+ export { cron };
@@ -0,0 +1,67 @@
1
+ import { d as distExports } from '../../_virtual/index.js';
2
+ import { Entity } from '../../core/entity/Entity.js';
3
+ import { Job } from './Job.js';
4
+
5
+ class CronJob extends Entity {
6
+ constructor(data) {
7
+ super(data);
8
+ if (!data.nextRunAt) {
9
+ this.computeNextRun(new Date());
10
+ }
11
+ }
12
+ get nextRunAt() {
13
+ return this.data.nextRunAt ? new Date(this.data.nextRunAt) : null;
14
+ }
15
+ get lastRunAt() {
16
+ return this.data.lastRunAt ? new Date(this.data.lastRunAt) : null;
17
+ }
18
+ get maxConcurrency() {
19
+ return this.data.maxRunningJobs ?? 1;
20
+ }
21
+ get misfirePolicy() {
22
+ return this.data.misfirePolicy ?? 'RUN_ONCE';
23
+ }
24
+ get commandName() {
25
+ return this.data.commandName;
26
+ }
27
+ get name() {
28
+ return this.data.name;
29
+ }
30
+ isDue(now) {
31
+ if (!this.data.nextRunAt)
32
+ throw new Error(`CronJon with id = '${this.data.id}' nextRunAt is invalid`);
33
+ return this.data.enabled && this.data.nextRunAt <= now.getTime();
34
+ }
35
+ computeNextRun(from) {
36
+ const interval = distExports.CronExpressionParser.parse(this.data.cron, {
37
+ currentDate: from,
38
+ });
39
+ this.data.nextRunAt = interval.next().getTime();
40
+ }
41
+ markAsExecuted(at) {
42
+ this.data.lastRunAt = at.getTime();
43
+ this.computeNextRun(at);
44
+ }
45
+ nextJob() {
46
+ return new Job({
47
+ commandName: this.data.commandName,
48
+ commandData: this.data.commandData,
49
+ scheduledAt: this.data.nextRunAt,
50
+ reintentsDelaysInSeconds: this.data.reintentsDelaysInSeconds,
51
+ aceptableRunningTimeSeconds: this.data.aceptableRunningTimeSeconds,
52
+ stuckRetryAttempts: this.data.stuckRetryAttempts,
53
+ });
54
+ }
55
+ validate() {
56
+ try {
57
+ distExports.CronExpressionParser.parse(this.data.cron);
58
+ }
59
+ catch (err) {
60
+ throw new Error(`CronJob with id = '${this.data.id}' has invalid cron expression: ${this.data.cron}`);
61
+ }
62
+ if (!this.data.nextRunAt)
63
+ throw new Error(`CronJon with id = '${this.data.id}' nextRunAt is invalid`);
64
+ }
65
+ }
66
+
67
+ export { CronJob };
@@ -0,0 +1,19 @@
1
+ class CronJobRepository {
2
+ create(cronJob) {
3
+ throw new Error('Method not implemented.');
4
+ }
5
+ findByName(name) {
6
+ throw new Error('Method not implemented.');
7
+ }
8
+ update(cronJob) {
9
+ throw new Error('Method not implemented.');
10
+ }
11
+ findDue(date) {
12
+ throw new Error('Method not implemented.');
13
+ }
14
+ findOrThrow(id) {
15
+ throw new Error('Method not implemented.');
16
+ }
17
+ }
18
+
19
+ export { CronJobRepository };
@@ -0,0 +1,165 @@
1
+ import { __decorate, __metadata } from 'tslib';
2
+ import { singleton } from '../../core/injection/index.js';
3
+ import { JobRepository } from './JobRepository.js';
4
+ import { Logger } from '../../core/logger/Logger.js';
5
+ import { CronJob } from './CronJob.js';
6
+ import { CronJobRepository } from './CronJobRepository.js';
7
+ import { JobScheduler } from './JobScheduler.js';
8
+ import { Locker } from '../../core/lock/Locker.js';
9
+ import { Env } from '../../core/env/Env.js';
10
+ import { JobWatchdog } from './JobWatchdog.js';
11
+
12
+ let CronScheduler = class CronScheduler {
13
+ locker;
14
+ cronRepo;
15
+ jobRepo;
16
+ jobScheduler;
17
+ jobWatchdog;
18
+ env;
19
+ running = false;
20
+ timeout;
21
+ configuredCrons = new Map();
22
+ logger = new Logger('wabot:cron-scheduler');
23
+ constructor(locker, cronRepo, jobRepo, jobScheduler, jobWatchdog, env) {
24
+ this.locker = locker;
25
+ this.cronRepo = cronRepo;
26
+ this.jobRepo = jobRepo;
27
+ this.jobScheduler = jobScheduler;
28
+ this.jobWatchdog = jobWatchdog;
29
+ this.env = env;
30
+ }
31
+ start(crons) {
32
+ crons.forEach((x) => this.configuredCrons.set(x.name, x));
33
+ if (this.configuredCrons.size > 0 && !this.running) {
34
+ this.running = true;
35
+ this.tick();
36
+ }
37
+ if (this.running)
38
+ this.reconciliation();
39
+ }
40
+ stop(crons) {
41
+ crons.forEach((x) => {
42
+ const configured = this.configuredCrons.get(x.name);
43
+ if (!configured) {
44
+ return;
45
+ }
46
+ if (configured.reconciliated) {
47
+ this.jobScheduler.stop([configured.commandName]);
48
+ this.jobWatchdog.stop([configured.commandName]);
49
+ }
50
+ this.configuredCrons.delete(x.name);
51
+ });
52
+ if (this.configuredCrons.size === 0) {
53
+ this.running = false;
54
+ if (this.timeout)
55
+ clearTimeout(this.timeout);
56
+ }
57
+ }
58
+ async reconciliation() {
59
+ const configToReconciliate = Array.from(this.configuredCrons.values()).filter((x) => !x.reconciliated);
60
+ this.logger.debug(`start reconciliation of crons ${configToReconciliate.map((x) => x.name).join(', ')}`);
61
+ try {
62
+ const cronJobs = await Promise.all(configToReconciliate.map((x) => this.reconciliateConfig(x)));
63
+ this.logger.info(`success reconciliation of reconciliation of crons ${configToReconciliate.map((x) => x.name).join(', ')}`);
64
+ this.jobScheduler.start(cronJobs.map((x) => x.commandName));
65
+ this.jobWatchdog.start(cronJobs.map((x) => x.commandName));
66
+ }
67
+ catch (e) {
68
+ this.logger.error(e);
69
+ this.stop(configToReconciliate);
70
+ this.logger.error(`reconciliation fail - stopped crons ${configToReconciliate.map((x) => x.name).join(', ')}`);
71
+ throw e;
72
+ }
73
+ }
74
+ async tick() {
75
+ if (!this.running)
76
+ return;
77
+ const interval = this.env.requireNumber('WABOT_CRON_SCHEDULER_INTERVAL_SECONDS', {
78
+ default: 30,
79
+ });
80
+ try {
81
+ await this.locker.withKey('wabot-cron-scheduler').run(async () => {
82
+ const now = new Date();
83
+ const dueCrons = await this.cronRepo.findDue(now);
84
+ const readyToRunCrons = dueCrons.filter((x) => x.isDue(now) && this.configuredCrons.get(x.name)?.reconciliated);
85
+ for (const cron of readyToRunCrons) {
86
+ await this.spawnJobs(cron);
87
+ }
88
+ });
89
+ }
90
+ catch (e) {
91
+ this.logger.error(e);
92
+ }
93
+ finally {
94
+ this.timeout = setTimeout(() => this.tick(), interval * 1000);
95
+ }
96
+ }
97
+ async spawnJobs(cron) {
98
+ await this.locker.withKey(`wabot-cron-${cron.id}`).run(async () => {
99
+ let now = new Date();
100
+ const fresh = await this.cronRepo.findOrThrow(cron.id);
101
+ if (!fresh.isDue(now))
102
+ return;
103
+ // ---- Overlap prevention ----
104
+ const running = await this.jobRepo.countRunningByCommand(fresh.commandName);
105
+ if (running >= fresh.maxConcurrency) {
106
+ this.logger.debug(`Cron ${fresh.id} skipped (running ${running}/${fresh.maxConcurrency})`);
107
+ return;
108
+ }
109
+ // ---- Misfire handling ----
110
+ now = new Date();
111
+ let executions = 0;
112
+ while (fresh.isDue(now)) {
113
+ executions++;
114
+ await this.jobRepo.create(fresh.nextJob());
115
+ fresh.markAsExecuted(now);
116
+ if (fresh.misfirePolicy === 'RUN_ONCE')
117
+ break;
118
+ if (fresh.misfirePolicy === 'SKIP') {
119
+ fresh.computeNextRun(now);
120
+ break;
121
+ }
122
+ // Safety guard (never infinite)
123
+ if (executions >= 10) {
124
+ this.logger.warn(`Cron ${fresh.id} reached max misfire executions`);
125
+ break;
126
+ }
127
+ }
128
+ await this.cronRepo.update(fresh);
129
+ this.logger.info(`Cron ${fresh.id} spawned ${executions} job(s), next at ${fresh.nextRunAt.toISOString()}`);
130
+ });
131
+ }
132
+ async reconciliateConfig(config) {
133
+ return await this.locker.withKey(`wabot-cron-config-${config.name}`).run(async () => {
134
+ let cronJob = await this.cronRepo.findByName(config.name);
135
+ if (cronJob) {
136
+ this.logger.debug(`found cron job for name='${config.name}'`);
137
+ cronJob.update({ cron: config.cron, enabled: config.enabled });
138
+ await this.cronRepo.update(cronJob);
139
+ this.logger.debug(`cron job for name='${config.name}' updated`);
140
+ }
141
+ else {
142
+ cronJob = new CronJob({
143
+ name: config.name,
144
+ cron: config.cron,
145
+ commandName: config.commandName,
146
+ enabled: config.enabled,
147
+ });
148
+ await this.cronRepo.create(cronJob);
149
+ }
150
+ config.reconciliated = true;
151
+ return cronJob;
152
+ });
153
+ }
154
+ };
155
+ CronScheduler = __decorate([
156
+ singleton(),
157
+ __metadata("design:paramtypes", [Locker,
158
+ CronJobRepository,
159
+ JobRepository,
160
+ JobScheduler,
161
+ JobWatchdog,
162
+ Env])
163
+ ], CronScheduler);
164
+
165
+ export { CronScheduler };
@@ -0,0 +1,18 @@
1
+ import { container } from '../../core/injection/index.js';
2
+ import { AsyncMetadataStore } from './AsyncMetadataStore.js';
3
+ import { CronScheduler } from './CronScheduler.js';
4
+
5
+ function runCronHandlers(handlers) {
6
+ const metadataStore = container.resolve(AsyncMetadataStore);
7
+ const cronScheduler = container.resolve(CronScheduler);
8
+ const cronsMetadata = handlers.map((x) => metadataStore.requireCronMetadata(x)).flat();
9
+ cronScheduler.start(cronsMetadata.map((x) => x.config));
10
+ }
11
+ function stopCronHandlers(handlers) {
12
+ const metadataStore = container.resolve(AsyncMetadataStore);
13
+ const cronScheduler = container.resolve(CronScheduler);
14
+ const cronsMetadata = handlers.map((x) => metadataStore.requireCronMetadata(x)).flat();
15
+ cronScheduler.stop(cronsMetadata.map((x) => x.config));
16
+ }
17
+
18
+ export { runCronHandlers, stopCronHandlers };
@@ -511,6 +511,16 @@ declare class Async {
511
511
  declare function runCommandHandlers(handlers: IConstructor<ICommandHandler<any>>[]): void;
512
512
  declare function stopCommandHandlers(handlers: IConstructor<ICommandHandler<any>>[]): void;
513
513
 
514
+ interface ICronConfig {
515
+ name: string;
516
+ cron: string;
517
+ disabled?: boolean;
518
+ }
519
+ declare function cron(config: ICronConfig): (target: IConstructor<ICronHandler>) => void;
520
+
521
+ declare function runCronHandlers(handlers: IConstructor<ICronHandler>[]): void;
522
+ declare function stopCronHandlers(handlers: IConstructor<ICronHandler>[]): void;
523
+
514
524
  interface IChatConnection {
515
525
  chatType: 'GROUP' | 'PRIVATE';
516
526
  channelName: string;
@@ -1785,4 +1795,4 @@ declare function HtmlModule(options: IHtmlModuleOptions): {
1785
1795
  new (): {};
1786
1796
  };
1787
1797
 
1788
- export { AnthropicChatAdapter, ApiKey, ApiKeyGuardMiddleware, ApiKeyHandshakeGuardMiddleware, ApiKeyRepository, Async, AsyncMetadataStore, Auth, Chat, ChatAdapter, ChatBot, ChatBotMetadataStore, ChatItem, ChatMemory, ChatRepository, ChatResolver, type ClientMap, CmdChannel, Container, ControllerMetadataStore, CustomError, DeepSeekChatAdapter, DescriptionMetadataStore, EXPRESS_REQ, EXPRESS_RES, Entity, Env, EnvWhatsAppRepository, ExpressProvider, GoogleChatAdapter, type GoogleChatAdapterV2Options, HtmlModule, HttpServerProvider, type IApiKeyData, type IApiKeyRepository, type IArrayValidationError, type IArrayValidationResult, type IBotMessageItem, type IChannelMessage, type IChannelMetadata, type IChatAdapter, type IChatAdapterNextItemsReq, type IChatAdapterNextItemsRes, type IChatBot, type IChatBotMetadata, type IChatChannel, type IChatConnection, type IChatControllerMetadata, type IChatData, type IChatItem, type IChatItemData, type IChatItemType, type IChatMemory, type IChatMessage, type IChatRepository, type IChatType, type ICommandConfig, type ICommandHandler, type ICommandHandlerConfig, type IConstructor, type ICrudRepository, type ICustomErrorData, type IDescriptionMetadata, type IEndPointConfig, type IEndPointMetadata, type IEntityData, type IEnvType, type IFunctionCall, type IFunctionCallItem, type IGenerateApiKeyReq, type IGenerateApiKeyRes, type IGetWhatsAppTemplateRequest, type IHandshakeMiddleware, type IHandshakeMiddlewareMetadata, type IHtmlModuleOptions, type IHumanMessageItem, type IJobData, type IJobRepository, type IJwtRefreshTokenData, type IJwtRefreshTokenRepository, type ILanguageModelUsage, type IListenWhatsAppMessageRequest, type ILockKey, type ILocker, type IMessageContext, type IMiddleware, type IMiddlewareMetadata, type IMindset, type IMindsetConfig, type IMindsetIdentity, type IMindsetLlm, type IMindsetMetadata, type IMindsetModuleConfig, type IMindsetModuleMetadata, type IMindsetTool, type IMindsetToolParameter, type IModelValidationError, type IModelValidationResult, type IModelValidatorsInfo, type IMoneyData, type IPersistentData, type IPgRepositoryConfig, type IPropertyValidatorInfo, type IReceivedMessage, type IRemoteApiKeyFetcher, type IRestControllerConfig, type IRestControllerMetadata, type ISendWhatsAppRequest, type ISendWhatsAppTemplateRequest, type ISocketChannelConfig, type ISocketChannelReceivedMessage, type ISocketControllerConfig, type ISocketControllerMetadata, type ISocketEventConfig, type ISocketEventMetadata, type IStorableData, type ITelegramChannelConfig, type IValidateArrayOptions, type IValidateArrayOptionsWithItemsValidators, type IValidateInputShape, type IValidateIsInOptions, type IValidateIsRecordOptions, 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, Jwt, JwtAccessAndRefreshTokenDto, JwtConfig, JwtGuardMiddleware, JwtHandshakeGuardMiddleware, JwtRefreshToken, JwtRefreshTokenRepository, JwtSigner, JwtTokenDto, Lifecycle, Locker, Logger, Mapper, Mindset, MindsetMetadataStore, MindsetOperator, Money, MoneyDto, OpenaiChatAdapter, Password, type PasswordHashOptions, Persistent, PgApiKeyRepository, PgChatMemory, PgChatRepository, PgCrudRepository, PgJobRepository, PgJwtRefreshTokenRepository, PgLockKey, PgLocker, PgRepositoryBase, PgWhatsAppRepository, RamChatMemory, RamChatRepository, Random, RemoteApiKeyRepository, RestControllerMetadataStore, RestRequest, SocketChannel, SocketChannelConfig, SocketChannelReceivedMessage, SocketControllerMetadataStore, SocketServerProvider, Storable, TelegramChannel, TelegramChannelConfig, ValidationMetadataStore, WHATSAPP_MESSAGE_EVENT, WHATSAPP_PROXY_LISTEN_MESSAGE_EVENT, WHATSAPP_PROXY_SEND_MESSAGE_EVENT, WabotChatAdapter, WhatsApp, WhatsAppChannel, WhatsAppReceiver, WhatsAppReceiverByCloudApi, WhatsAppReceiverByWabotProxy, WhatsAppRepository, WhatsAppSender, WhatsAppSenderByCloudApi, WhatsAppSenderByWabotProxy, WhatsAppWabotProxyConnection, WhatsappChannelConfig, apiKeyGuard, apiKeyHandshakeGuard, chatBot, chatController, chatItemTypeOptions, cmd, command, commandHandler, container, description, getClientMap, getPgClient, handshakeMiddlewares, inject, injectable, isArray, isBoolean, isDate, isIn, isModel, isNotEmpty, isNumber, isOptional, isPresent, isRecord, isString, jwtGuard, jwtHandshakeGuard, max, middleware, min, mindset, mindsetModule, modelInfo, onDelete, onGet, onPost, onPut, onSocketEvent, pgStorage, readJsonFromFile, restController, runChatControllers, runCommandHandlers, runRestControllers, runSocketControllers, scoped, singleton, socket, socketController, stopCommandHandlers, telegram, validateAndTransform, validateArray, validateIsBoolean, validateIsDate, validateIsIn, validateIsNotEmpty, validateIsNumber, validateIsPresent, validateIsRecord, validateIsString, validateMax, validateMin, validateModel, whatsApp, withPgClient, withPgTransaction, writeJsonToFile };
1798
+ export { AnthropicChatAdapter, ApiKey, ApiKeyGuardMiddleware, ApiKeyHandshakeGuardMiddleware, ApiKeyRepository, Async, AsyncMetadataStore, Auth, Chat, ChatAdapter, ChatBot, ChatBotMetadataStore, ChatItem, ChatMemory, ChatRepository, ChatResolver, type ClientMap, CmdChannel, Container, ControllerMetadataStore, CustomError, DeepSeekChatAdapter, DescriptionMetadataStore, EXPRESS_REQ, EXPRESS_RES, Entity, Env, EnvWhatsAppRepository, ExpressProvider, GoogleChatAdapter, type GoogleChatAdapterV2Options, HtmlModule, HttpServerProvider, type IApiKeyData, type IApiKeyRepository, type IArrayValidationError, type IArrayValidationResult, type IBotMessageItem, type IChannelMessage, type IChannelMetadata, type IChatAdapter, type IChatAdapterNextItemsReq, type IChatAdapterNextItemsRes, type IChatBot, type IChatBotMetadata, type IChatChannel, type IChatConnection, type IChatControllerMetadata, type IChatData, type IChatItem, type IChatItemData, type IChatItemType, type IChatMemory, type IChatMessage, type IChatRepository, type IChatType, type ICommandConfig, type ICommandHandler, type ICommandHandlerConfig, type IConstructor, type ICronConfig, type ICrudRepository, type ICustomErrorData, type IDescriptionMetadata, type IEndPointConfig, type IEndPointMetadata, type IEntityData, type IEnvType, type IFunctionCall, type IFunctionCallItem, type IGenerateApiKeyReq, type IGenerateApiKeyRes, type IGetWhatsAppTemplateRequest, type IHandshakeMiddleware, type IHandshakeMiddlewareMetadata, type IHtmlModuleOptions, type IHumanMessageItem, type IJobData, type IJobRepository, type IJwtRefreshTokenData, type IJwtRefreshTokenRepository, type ILanguageModelUsage, type IListenWhatsAppMessageRequest, type ILockKey, type ILocker, type IMessageContext, type IMiddleware, type IMiddlewareMetadata, type IMindset, type IMindsetConfig, type IMindsetIdentity, type IMindsetLlm, type IMindsetMetadata, type IMindsetModuleConfig, type IMindsetModuleMetadata, type IMindsetTool, type IMindsetToolParameter, type IModelValidationError, type IModelValidationResult, type IModelValidatorsInfo, type IMoneyData, type IPersistentData, type IPgRepositoryConfig, type IPropertyValidatorInfo, type IReceivedMessage, type IRemoteApiKeyFetcher, type IRestControllerConfig, type IRestControllerMetadata, type ISendWhatsAppRequest, type ISendWhatsAppTemplateRequest, type ISocketChannelConfig, type ISocketChannelReceivedMessage, type ISocketControllerConfig, type ISocketControllerMetadata, type ISocketEventConfig, type ISocketEventMetadata, type IStorableData, type ITelegramChannelConfig, type IValidateArrayOptions, type IValidateArrayOptionsWithItemsValidators, type IValidateInputShape, type IValidateIsInOptions, type IValidateIsRecordOptions, 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, Jwt, JwtAccessAndRefreshTokenDto, JwtConfig, JwtGuardMiddleware, JwtHandshakeGuardMiddleware, JwtRefreshToken, JwtRefreshTokenRepository, JwtSigner, JwtTokenDto, Lifecycle, Locker, Logger, Mapper, Mindset, MindsetMetadataStore, MindsetOperator, Money, MoneyDto, OpenaiChatAdapter, Password, type PasswordHashOptions, Persistent, PgApiKeyRepository, PgChatMemory, PgChatRepository, PgCrudRepository, PgJobRepository, PgJwtRefreshTokenRepository, PgLockKey, PgLocker, PgRepositoryBase, PgWhatsAppRepository, RamChatMemory, RamChatRepository, Random, RemoteApiKeyRepository, RestControllerMetadataStore, RestRequest, SocketChannel, SocketChannelConfig, SocketChannelReceivedMessage, SocketControllerMetadataStore, SocketServerProvider, Storable, TelegramChannel, TelegramChannelConfig, ValidationMetadataStore, WHATSAPP_MESSAGE_EVENT, WHATSAPP_PROXY_LISTEN_MESSAGE_EVENT, WHATSAPP_PROXY_SEND_MESSAGE_EVENT, WabotChatAdapter, WhatsApp, WhatsAppChannel, WhatsAppReceiver, WhatsAppReceiverByCloudApi, WhatsAppReceiverByWabotProxy, WhatsAppRepository, WhatsAppSender, WhatsAppSenderByCloudApi, WhatsAppSenderByWabotProxy, WhatsAppWabotProxyConnection, WhatsappChannelConfig, apiKeyGuard, apiKeyHandshakeGuard, chatBot, chatController, chatItemTypeOptions, cmd, command, commandHandler, container, cron, description, getClientMap, getPgClient, handshakeMiddlewares, inject, injectable, isArray, isBoolean, isDate, isIn, isModel, isNotEmpty, isNumber, isOptional, isPresent, isRecord, isString, jwtGuard, jwtHandshakeGuard, max, middleware, min, mindset, mindsetModule, modelInfo, onDelete, onGet, onPost, onPut, onSocketEvent, pgStorage, readJsonFromFile, restController, runChatControllers, runCommandHandlers, runCronHandlers, runRestControllers, runSocketControllers, scoped, singleton, socket, socketController, stopCommandHandlers, stopCronHandlers, telegram, validateAndTransform, validateArray, validateIsBoolean, validateIsDate, validateIsIn, validateIsNotEmpty, validateIsNumber, validateIsPresent, validateIsRecord, validateIsString, validateMax, validateMin, validateModel, whatsApp, withPgClient, withPgTransaction, writeJsonToFile };
package/dist/src/index.js CHANGED
@@ -47,6 +47,8 @@ export { Job } from './feature/async/Job.js';
47
47
  export { JobRepository } from './feature/async/JobRepository.js';
48
48
  export { JobRunner } from './feature/async/JobRunner.js';
49
49
  export { runCommandHandlers, stopCommandHandlers } from './feature/async/runCommandHandlers.js';
50
+ export { cron } from './feature/async/@cron.js';
51
+ export { runCronHandlers, stopCronHandlers } from './feature/async/runCronHandlers.js';
50
52
  export { Chat } from './feature/chat-bot/Chat.js';
51
53
  export { ChatAdapter } from './feature/chat-bot/ChatAdapter.js';
52
54
  export { ChatBot } from './feature/chat-bot/ChatBot.js';