@wabot-dev/framework 0.2.6 → 0.4.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -12
- package/dist/src/addon/async/pg/PgJobRepository.js +50 -2
- package/dist/src/addon/auth/api-key/PgApiKeyRepository.js +5 -0
- package/dist/src/addon/auth/jwt/PgJwtRefreshTokenRepository.js +7 -2
- package/dist/src/addon/chat-bot/openia/OpenaiChatAdapter.js +15 -3
- package/dist/src/addon/chat-bot/pg/PgChatMemory.js +5 -0
- package/dist/src/addon/chat-bot/pg/PgChatRepository.js +5 -0
- package/dist/src/addon/chat-bot/wabot/WabotChatAdapter.js +1 -1
- package/dist/src/addon/chat-controller/whatsapp/PgWhatsAppRepository.js +5 -0
- package/dist/src/addon/chat-controller/whatsapp/proxy/WhatsAppReceiverByWabotProxy.js +1 -0
- package/dist/src/core/lock/Locker.js +7 -0
- package/dist/src/feature/async/@command.js +3 -3
- package/dist/src/feature/async/@commandHandler.js +3 -3
- package/dist/src/feature/async/Async.js +21 -14
- package/dist/src/feature/async/{CommandMetadataStore.js → AsyncMetadataStore.js} +27 -5
- package/dist/src/feature/async/Job.js +92 -2
- package/dist/src/feature/async/JobExecutor.js +62 -0
- package/dist/src/feature/async/JobRepository.js +9 -0
- package/dist/src/feature/async/JobRunner.js +17 -6
- package/dist/src/feature/async/JobScheduler.js +80 -0
- package/dist/src/feature/async/JobWatchdog.js +74 -0
- package/dist/src/feature/async/runCommandHandlers.js +19 -25
- package/dist/src/feature/chat-bot/Chat.js +3 -0
- package/dist/src/feature/chat-controller/runChatControllers.js +1 -1
- package/dist/src/feature/pg/PgCrudRepository.js +7 -1
- package/dist/src/feature/pg/PgLock.js +20 -0
- package/dist/src/feature/pg/PgLockKey.js +68 -0
- package/dist/src/feature/pg/PgRepositoryBase.js +40 -27
- package/dist/src/feature/pg/pgStorage.js +16 -0
- package/dist/src/feature/pg/withPgClient.js +45 -0
- package/dist/src/feature/pg/withPgTransaction.js +45 -0
- package/dist/src/index.d.ts +252 -96
- package/dist/src/index.js +8 -4
- package/package.json +8 -6
- package/dist/src/feature/async/Command.js +0 -9
- package/dist/src/feature/async/JobsEventsHub.js +0 -36
package/dist/src/index.js
CHANGED
|
@@ -38,16 +38,15 @@ export { isRecord } from './core/validation/validators/is-record/@isRecord.js';
|
|
|
38
38
|
export { validateIsRecord } from './core/validation/validators/is-record/validateIsRecord.js';
|
|
39
39
|
export { description } from './core/description/metadata/@description.js';
|
|
40
40
|
export { DescriptionMetadataStore } from './core/description/metadata/DescriptionMetadataStore.js';
|
|
41
|
+
export { Locker } from './core/lock/Locker.js';
|
|
41
42
|
export { command } from './feature/async/@command.js';
|
|
42
43
|
export { commandHandler } from './feature/async/@commandHandler.js';
|
|
43
44
|
export { Async } from './feature/async/Async.js';
|
|
44
|
-
export {
|
|
45
|
-
export { CommandMetadataStore } from './feature/async/CommandMetadataStore.js';
|
|
45
|
+
export { AsyncMetadataStore } from './feature/async/AsyncMetadataStore.js';
|
|
46
46
|
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
|
-
export {
|
|
50
|
-
export { runAsyncCommandHandlers } from './feature/async/runCommandHandlers.js';
|
|
49
|
+
export { runCommandHandlers, stopCommandHandlers } from './feature/async/runCommandHandlers.js';
|
|
51
50
|
export { Chat } from './feature/chat-bot/Chat.js';
|
|
52
51
|
export { ChatAdapter } from './feature/chat-bot/ChatAdapter.js';
|
|
53
52
|
export { ChatBot } from './feature/chat-bot/ChatBot.js';
|
|
@@ -71,7 +70,12 @@ export { MindsetOperator } from './feature/mindset/MindsetOperator.js';
|
|
|
71
70
|
export { Money } from './feature/money/Money.js';
|
|
72
71
|
export { MoneyDto } from './feature/money/MoneyDto.js';
|
|
73
72
|
export { PgCrudRepository } from './feature/pg/PgCrudRepository.js';
|
|
73
|
+
export { PgLocker } from './feature/pg/PgLock.js';
|
|
74
|
+
export { PgLockKey } from './feature/pg/PgLockKey.js';
|
|
74
75
|
export { PgRepositoryBase } from './feature/pg/PgRepositoryBase.js';
|
|
76
|
+
export { getClientMap, pgStorage } from './feature/pg/pgStorage.js';
|
|
77
|
+
export { getPgClient, withPgClient } from './feature/pg/withPgClient.js';
|
|
78
|
+
export { withPgTransaction } from './feature/pg/withPgTransaction.js';
|
|
75
79
|
export { onGet } from './feature/rest-controller/metadata/@onGet.js';
|
|
76
80
|
export { middleware } from './feature/rest-controller/metadata/@middleware.js';
|
|
77
81
|
export { onPost } from './feature/rest-controller/metadata/@onPost.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wabot-dev/framework",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0-beta.1",
|
|
4
4
|
"description": "Framework for IA Chat Bots",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/src/index.js",
|
|
@@ -18,12 +18,13 @@
|
|
|
18
18
|
],
|
|
19
19
|
"scripts": {
|
|
20
20
|
"build": "rollup --config rollup.config.ts --configPlugin typescript && tsup --dts-only --format esm --out-dir dist/src src/index.ts",
|
|
21
|
-
"test:units": "node --import @yucacodes/ts
|
|
22
|
-
"test:integration": "node --import
|
|
21
|
+
"test:units": "node --import @yucacodes/ts --test './src/**/*.unit.test.ts'",
|
|
22
|
+
"test:integration": "node --import @yucacodes/ts --import ./env.mjs --test './src/**/*.integration.test.ts'",
|
|
23
|
+
"test:multiprocess": "node --import @yucacodes/ts --import ./env.mjs --test './src/**/*.multiprocess.test.ts'",
|
|
23
24
|
"fmt": "prettier --write .",
|
|
24
25
|
"fmt:check": "prettier --check .",
|
|
25
26
|
"types:check": "tsc --noEmit",
|
|
26
|
-
"elia:dev": "
|
|
27
|
+
"elia:dev": "node --import @yucacodes/ts --import ./env.mjs ./test/elia/run.ts"
|
|
27
28
|
},
|
|
28
29
|
"devDependencies": {
|
|
29
30
|
"@rollup/plugin-alias": "5.1.1",
|
|
@@ -31,7 +32,7 @@
|
|
|
31
32
|
"@rollup/plugin-json": "6.1.0",
|
|
32
33
|
"@rollup/plugin-node-resolve": "16.0.1",
|
|
33
34
|
"@rollup/plugin-typescript": "12.1.2",
|
|
34
|
-
"@yucacodes/ts": "
|
|
35
|
+
"@yucacodes/ts": "0.0.6",
|
|
35
36
|
"prettier": "^3.5.3",
|
|
36
37
|
"rollup": "4.39.0",
|
|
37
38
|
"tsup": "^8.4.0",
|
|
@@ -50,13 +51,14 @@
|
|
|
50
51
|
"@yucacodes/ts": "^0.0.4",
|
|
51
52
|
"big.js": "^7.0.1",
|
|
52
53
|
"body-parser": "^2.2.0",
|
|
54
|
+
"cron-parser": "^5.4.0",
|
|
53
55
|
"debug": "^4.4.0",
|
|
54
56
|
"dotenv": "^16.5.0",
|
|
55
57
|
"express": "^5.1.0",
|
|
56
58
|
"grammy": "^1.36.0",
|
|
57
59
|
"html-to-text": "^9.0.5",
|
|
58
60
|
"jsonwebtoken": "^9.0.2",
|
|
59
|
-
"openai": "^
|
|
61
|
+
"openai": "^6.10.0",
|
|
60
62
|
"pg": "^8.15.6",
|
|
61
63
|
"reflect-metadata": "^0.2.2",
|
|
62
64
|
"short-uuid": "^5.2.0",
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { __decorate } from 'tslib';
|
|
2
|
-
import { singleton } from '../../core/injection/index.js';
|
|
3
|
-
import { Logger } from '../../core/logger/Logger.js';
|
|
4
|
-
|
|
5
|
-
let JobsEventsHub = class JobsEventsHub {
|
|
6
|
-
logger = new Logger('wabot:jobs-events-hub');
|
|
7
|
-
jobsEventsListener = null;
|
|
8
|
-
notifyJobCreated(job) {
|
|
9
|
-
const timer = setTimeout(async () => {
|
|
10
|
-
if (!this.jobsEventsListener) {
|
|
11
|
-
return;
|
|
12
|
-
}
|
|
13
|
-
try {
|
|
14
|
-
await this.jobsEventsListener({
|
|
15
|
-
jobId: job.id,
|
|
16
|
-
commandName: job.commandName,
|
|
17
|
-
type: 'created',
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
catch (err) {
|
|
21
|
-
this.logger.error(err);
|
|
22
|
-
}
|
|
23
|
-
finally {
|
|
24
|
-
clearTimeout(timer);
|
|
25
|
-
}
|
|
26
|
-
}, 1000);
|
|
27
|
-
}
|
|
28
|
-
listenJobsEvents(listener) {
|
|
29
|
-
this.jobsEventsListener = listener;
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
JobsEventsHub = __decorate([
|
|
33
|
-
singleton()
|
|
34
|
-
], JobsEventsHub);
|
|
35
|
-
|
|
36
|
-
export { JobsEventsHub };
|