@wabot-dev/framework 0.1.0-beta.22 → 0.1.0-beta.24
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/async/@command.js +11 -0
- package/dist/src/async/@commandHandler.js +12 -0
- package/dist/src/async/Async.js +38 -0
- package/dist/src/async/Command.js +11 -0
- package/dist/src/async/CommandMetadataStore.js +38 -0
- package/dist/src/async/Job.js +26 -0
- package/dist/src/async/JobRepository.js +21 -0
- package/dist/src/async/JobRunner.js +45 -0
- package/dist/src/async/JobsEventsHub.js +24 -0
- package/dist/src/async/runCommandHandlers.js +29 -0
- package/dist/src/auth/Auth.js +24 -0
- package/dist/src/index.d.ts +164 -62
- package/dist/src/index.js +14 -1
- package/dist/src/injection/index.js +2 -2
- package/dist/src/mapper/Mapper.js +44 -0
- package/dist/src/random/Random.js +37 -0
- package/package.json +3 -1
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { CommandMetadataStore } from './CommandMetadataStore.js';
|
|
2
|
+
import { container } from '../injection/index.js';
|
|
3
|
+
|
|
4
|
+
function command(config) {
|
|
5
|
+
return function (target) {
|
|
6
|
+
const handlerContainer = container.resolve(CommandMetadataStore);
|
|
7
|
+
handlerContainer.registerCommand(target, config?.name ?? target.name);
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export { command };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CommandMetadataStore } from './CommandMetadataStore.js';
|
|
2
|
+
import { container, injectable } from '../injection/index.js';
|
|
3
|
+
|
|
4
|
+
function commandHandler(config) {
|
|
5
|
+
return function (target) {
|
|
6
|
+
const handlerContainer = container.resolve(CommandMetadataStore);
|
|
7
|
+
handlerContainer.registerHandler(config.command, target);
|
|
8
|
+
injectable()(target);
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export { commandHandler };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { __decorate, __metadata } from 'tslib';
|
|
2
|
+
import { singleton } from '../injection/index.js';
|
|
3
|
+
import { CommandMetadataStore } from './CommandMetadataStore.js';
|
|
4
|
+
import { Job } from './Job.js';
|
|
5
|
+
import { JobRepository } from './JobRepository.js';
|
|
6
|
+
import { JobsEventsHub } from './JobsEventsHub.js';
|
|
7
|
+
|
|
8
|
+
let Async = class Async {
|
|
9
|
+
jobRepository;
|
|
10
|
+
handlerContainer;
|
|
11
|
+
jobsEventsHub;
|
|
12
|
+
constructor(jobRepository, handlerContainer, jobsEventsHub) {
|
|
13
|
+
this.jobRepository = jobRepository;
|
|
14
|
+
this.handlerContainer = handlerContainer;
|
|
15
|
+
this.jobsEventsHub = jobsEventsHub;
|
|
16
|
+
}
|
|
17
|
+
async run(command) {
|
|
18
|
+
const commandName = this.handlerContainer.getCommandName(command.constructor);
|
|
19
|
+
if (!commandName) {
|
|
20
|
+
throw new Error(`${command.constructor.name} is not registered as command`);
|
|
21
|
+
}
|
|
22
|
+
const job = new Job({
|
|
23
|
+
commandName,
|
|
24
|
+
commandData: command['data'],
|
|
25
|
+
});
|
|
26
|
+
await this.jobRepository.create(job);
|
|
27
|
+
this.jobsEventsHub.notifyJobCreated(job);
|
|
28
|
+
return job;
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
Async = __decorate([
|
|
32
|
+
singleton(),
|
|
33
|
+
__metadata("design:paramtypes", [JobRepository,
|
|
34
|
+
CommandMetadataStore,
|
|
35
|
+
JobsEventsHub])
|
|
36
|
+
], Async);
|
|
37
|
+
|
|
38
|
+
export { Async };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { __decorate } from 'tslib';
|
|
2
|
+
import { singleton } from '../injection/index.js';
|
|
3
|
+
|
|
4
|
+
let CommandMetadataStore = class CommandMetadataStore {
|
|
5
|
+
handlersMap = new Map();
|
|
6
|
+
handlersInverseMap = new Map();
|
|
7
|
+
commandsMap = new Map();
|
|
8
|
+
commandsInverseMap = new Map();
|
|
9
|
+
registerCommand(command, commandName) {
|
|
10
|
+
this.commandsMap.set(commandName, command);
|
|
11
|
+
this.commandsInverseMap.set(command, commandName);
|
|
12
|
+
}
|
|
13
|
+
registerHandler(command, handlerConstructor) {
|
|
14
|
+
let commandName = this.commandsInverseMap.get(command);
|
|
15
|
+
if (!commandName) {
|
|
16
|
+
throw new Error(`Should use @command decorator on command class ${command.name}`);
|
|
17
|
+
}
|
|
18
|
+
this.handlersMap.set(commandName, handlerConstructor);
|
|
19
|
+
this.handlersInverseMap.set(handlerConstructor, commandName);
|
|
20
|
+
}
|
|
21
|
+
getHandlerForCommandName(commandName) {
|
|
22
|
+
return this.handlersMap.get(commandName) ?? null;
|
|
23
|
+
}
|
|
24
|
+
getCommandNameForHandler(handlerConstructor) {
|
|
25
|
+
return this.handlersInverseMap.get(handlerConstructor) ?? null;
|
|
26
|
+
}
|
|
27
|
+
getCommandName(command) {
|
|
28
|
+
return this.commandsInverseMap.get(command) ?? null;
|
|
29
|
+
}
|
|
30
|
+
getCommandForCommandName(commandName) {
|
|
31
|
+
return this.commandsMap.get(commandName) ?? null;
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
CommandMetadataStore = __decorate([
|
|
35
|
+
singleton()
|
|
36
|
+
], CommandMetadataStore);
|
|
37
|
+
|
|
38
|
+
export { CommandMetadataStore };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import '../core/chat/repository/IChatRepository.js';
|
|
2
|
+
import { Entity } from '../core/Entity.js';
|
|
3
|
+
import '../core/user/IUserRepository.js';
|
|
4
|
+
import { CustomError } from '../error/CustomError.js';
|
|
5
|
+
|
|
6
|
+
class Job extends Entity {
|
|
7
|
+
get commandName() {
|
|
8
|
+
return this.data.commandName;
|
|
9
|
+
}
|
|
10
|
+
setAsStarted() {
|
|
11
|
+
this.data.startedAt = new Date().getTime();
|
|
12
|
+
}
|
|
13
|
+
setAsSuccess() {
|
|
14
|
+
this.data.successAt = new Date().getTime();
|
|
15
|
+
}
|
|
16
|
+
setAsFailed(error) {
|
|
17
|
+
this.data.failedAt = new Date().getTime();
|
|
18
|
+
this.data.error = {
|
|
19
|
+
message: error.message,
|
|
20
|
+
stack: error.stack,
|
|
21
|
+
info: error instanceof CustomError ? error.info : undefined,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export { Job };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { __decorate, __metadata } from 'tslib';
|
|
2
|
+
import { Pool } from 'pg';
|
|
3
|
+
import { Job } from './Job.js';
|
|
4
|
+
import { singleton } from '../injection/index.js';
|
|
5
|
+
import { PgCrudRepository } from '../repository/pg/PgCrudRepository.js';
|
|
6
|
+
|
|
7
|
+
let JobRepository = class JobRepository extends PgCrudRepository {
|
|
8
|
+
constructor(pool) {
|
|
9
|
+
super(pool, {
|
|
10
|
+
schema: 'wabot',
|
|
11
|
+
table: 'job',
|
|
12
|
+
constructor: Job,
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
JobRepository = __decorate([
|
|
17
|
+
singleton(),
|
|
18
|
+
__metadata("design:paramtypes", [Pool])
|
|
19
|
+
], JobRepository);
|
|
20
|
+
|
|
21
|
+
export { JobRepository };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { __decorate, __metadata } from 'tslib';
|
|
2
|
+
import { CommandMetadataStore } from './CommandMetadataStore.js';
|
|
3
|
+
import { JobRepository } from './JobRepository.js';
|
|
4
|
+
import { singleton, container } from '../injection/index.js';
|
|
5
|
+
|
|
6
|
+
let JobRunner = class JobRunner {
|
|
7
|
+
jobRepository;
|
|
8
|
+
handlerContainer;
|
|
9
|
+
constructor(jobRepository, handlerContainer) {
|
|
10
|
+
this.jobRepository = jobRepository;
|
|
11
|
+
this.handlerContainer = handlerContainer;
|
|
12
|
+
}
|
|
13
|
+
async run(job) {
|
|
14
|
+
try {
|
|
15
|
+
const { commandName, commandData } = job['data'];
|
|
16
|
+
const handlerConstructor = this.handlerContainer.getHandlerForCommandName(commandName);
|
|
17
|
+
if (!handlerConstructor) {
|
|
18
|
+
throw new Error(`Not found handler for command '${commandName}'`);
|
|
19
|
+
}
|
|
20
|
+
const handler = container.resolve(handlerConstructor);
|
|
21
|
+
const commandConstructor = this.handlerContainer.getCommandForCommandName(commandName);
|
|
22
|
+
if (!commandConstructor) {
|
|
23
|
+
throw new Error(`Not found class for command name '${commandName}'`);
|
|
24
|
+
}
|
|
25
|
+
job.setAsStarted();
|
|
26
|
+
await this.jobRepository.update(job);
|
|
27
|
+
const command = new commandConstructor(commandData);
|
|
28
|
+
await handler.handle(command);
|
|
29
|
+
job.setAsSuccess();
|
|
30
|
+
}
|
|
31
|
+
catch (e) {
|
|
32
|
+
job.setAsFailed(e instanceof Error ? e : new Error('Invalid Job error'));
|
|
33
|
+
}
|
|
34
|
+
finally {
|
|
35
|
+
await this.jobRepository.update(job);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
JobRunner = __decorate([
|
|
40
|
+
singleton(),
|
|
41
|
+
__metadata("design:paramtypes", [JobRepository,
|
|
42
|
+
CommandMetadataStore])
|
|
43
|
+
], JobRunner);
|
|
44
|
+
|
|
45
|
+
export { JobRunner };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { __decorate } from 'tslib';
|
|
2
|
+
import { singleton } from '../injection/index.js';
|
|
3
|
+
|
|
4
|
+
let JobsEventsHub = class JobsEventsHub {
|
|
5
|
+
jobsEventsListener = null;
|
|
6
|
+
notifyJobCreated(job) {
|
|
7
|
+
if (!this.jobsEventsListener) {
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
this.jobsEventsListener({
|
|
11
|
+
jobId: job.id,
|
|
12
|
+
commandName: job.commandName,
|
|
13
|
+
type: 'created',
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
listenJobsEvents(listener) {
|
|
17
|
+
this.jobsEventsListener = listener;
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
JobsEventsHub = __decorate([
|
|
21
|
+
singleton()
|
|
22
|
+
], JobsEventsHub);
|
|
23
|
+
|
|
24
|
+
export { JobsEventsHub };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { JobsEventsHub } from './JobsEventsHub.js';
|
|
2
|
+
import { JobRunner } from './JobRunner.js';
|
|
3
|
+
import { CommandMetadataStore } from './CommandMetadataStore.js';
|
|
4
|
+
import { JobRepository } from './JobRepository.js';
|
|
5
|
+
import { container } from '../injection/index.js';
|
|
6
|
+
|
|
7
|
+
function runAsyncCommandHandlers(handlers) {
|
|
8
|
+
const eventsHub = container.resolve(JobsEventsHub);
|
|
9
|
+
const jobRunner = container.resolve(JobRunner);
|
|
10
|
+
const jobRepository = container.resolve(JobRepository);
|
|
11
|
+
const commandsHandlersContainer = container.resolve(CommandMetadataStore);
|
|
12
|
+
const handledCommands = handlers
|
|
13
|
+
.map((x) => commandsHandlersContainer.getCommandNameForHandler(x))
|
|
14
|
+
.filter((x) => x)
|
|
15
|
+
.map((x) => x);
|
|
16
|
+
eventsHub.listenJobsEvents(async (event) => {
|
|
17
|
+
try {
|
|
18
|
+
const job = await jobRepository.findOrThrow(event.jobId);
|
|
19
|
+
if (handledCommands.includes(job.commandName)) {
|
|
20
|
+
jobRunner.run(job);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
catch (e) {
|
|
24
|
+
console.error(e);
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export { runAsyncCommandHandlers };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { __decorate } from 'tslib';
|
|
2
|
+
import { CustomError } from '../error/CustomError.js';
|
|
3
|
+
import { scoped, Lifecycle } from '../injection/index.js';
|
|
4
|
+
|
|
5
|
+
let Auth = class Auth {
|
|
6
|
+
authInfo = null;
|
|
7
|
+
require() {
|
|
8
|
+
if (!this.authInfo) {
|
|
9
|
+
throw new CustomError({ message: 'Unauthorized', httpCode: 401 });
|
|
10
|
+
}
|
|
11
|
+
return this.authInfo;
|
|
12
|
+
}
|
|
13
|
+
assign(authInfo) {
|
|
14
|
+
if (this.authInfo) {
|
|
15
|
+
throw new CustomError({ message: 'Authorization info already assigned', httpCode: 401 });
|
|
16
|
+
}
|
|
17
|
+
this.authInfo = authInfo;
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
Auth = __decorate([
|
|
21
|
+
scoped(Lifecycle.ContainerScoped)
|
|
22
|
+
], Auth);
|
|
23
|
+
|
|
24
|
+
export { Auth };
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import InjectionToken from 'tsyringe/dist/typings/providers/injection-token';
|
|
2
2
|
import DependencyContainer, { PreResolutionInterceptorCallback, PostResolutionInterceptorCallback } from 'tsyringe/dist/typings/types/dependency-container';
|
|
3
3
|
import InterceptionOptions from 'tsyringe/dist/typings/types/interceptor-options';
|
|
4
|
+
import { Pool } from 'pg';
|
|
4
5
|
import { Server } from 'http';
|
|
5
6
|
import { Express, Request, Response } from 'express';
|
|
6
7
|
import { Server as Server$1 } from 'socket.io';
|
|
7
|
-
import { Pool } from 'pg';
|
|
8
8
|
import { Socket } from 'socket.io-client';
|
|
9
9
|
import * as tsyringe from 'tsyringe';
|
|
10
10
|
import { DependencyContainer as DependencyContainer$1 } from 'tsyringe';
|
|
@@ -320,6 +320,8 @@ declare const injectable: typeof tsyringe.injectable;
|
|
|
320
320
|
declare const container: tsyringe.DependencyContainer;
|
|
321
321
|
declare const singleton: typeof tsyringe.singleton;
|
|
322
322
|
declare const inject: typeof tsyringe.inject;
|
|
323
|
+
declare const scoped: typeof tsyringe.scoped;
|
|
324
|
+
declare const Lifecycle: typeof tsyringe.Lifecycle;
|
|
323
325
|
|
|
324
326
|
declare class MindsetOperator implements IMindset {
|
|
325
327
|
private mindset;
|
|
@@ -409,6 +411,154 @@ declare class ClaudeChatBotAdapter extends ChatBotAdapter {
|
|
|
409
411
|
private mapChatItems;
|
|
410
412
|
}
|
|
411
413
|
|
|
414
|
+
interface ICommandConfig {
|
|
415
|
+
name?: string;
|
|
416
|
+
}
|
|
417
|
+
declare function command(config?: ICommandConfig): (target: IConstructor<any>) => void;
|
|
418
|
+
|
|
419
|
+
declare class Command<T extends IStorableData> extends Storable<T> {
|
|
420
|
+
getData(): T;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
interface ICommandHandler<C extends Command<any>> {
|
|
424
|
+
handle(command: C): void | Promise<void>;
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
interface ICommandHandlerConfig<C extends Command<any>> {
|
|
428
|
+
command: IConstructor<C>;
|
|
429
|
+
}
|
|
430
|
+
declare function commandHandler<C extends Command<any>>(config: ICommandHandlerConfig<C>): (target: IConstructor<ICommandHandler<C>>) => void;
|
|
431
|
+
|
|
432
|
+
declare class CommandMetadataStore {
|
|
433
|
+
private handlersMap;
|
|
434
|
+
private handlersInverseMap;
|
|
435
|
+
private commandsMap;
|
|
436
|
+
private commandsInverseMap;
|
|
437
|
+
registerCommand(command: IConstructor<Command<any>>, commandName: string): void;
|
|
438
|
+
registerHandler(command: IConstructor<Command<any>>, handlerConstructor: IConstructor<ICommandHandler<any>>): void;
|
|
439
|
+
getHandlerForCommandName(commandName: string): IConstructor<ICommandHandler<any>> | null;
|
|
440
|
+
getCommandNameForHandler(handlerConstructor: IConstructor<ICommandHandler<any>>): string | null;
|
|
441
|
+
getCommandName(command: IConstructor<Command<any>>): string | null;
|
|
442
|
+
getCommandForCommandName(commandName: string): IConstructor<Command<any>> | null;
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
interface IJobData extends IEntityData {
|
|
446
|
+
commandName: string;
|
|
447
|
+
commandData: any;
|
|
448
|
+
startedAt?: number;
|
|
449
|
+
successAt?: number;
|
|
450
|
+
failedAt?: number;
|
|
451
|
+
error?: {
|
|
452
|
+
message: string;
|
|
453
|
+
stack?: string;
|
|
454
|
+
info?: any;
|
|
455
|
+
};
|
|
456
|
+
}
|
|
457
|
+
declare class Job extends Entity<IJobData> {
|
|
458
|
+
get commandName(): string;
|
|
459
|
+
setAsStarted(): void;
|
|
460
|
+
setAsSuccess(): void;
|
|
461
|
+
setAsFailed(error: Error): void;
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
interface ICrudRepository<T> {
|
|
465
|
+
find(id: string): Promise<T | null>;
|
|
466
|
+
findOrThrow(id: string): Promise<T>;
|
|
467
|
+
findAll(id: string): Promise<T[]>;
|
|
468
|
+
create(item: T): Promise<void>;
|
|
469
|
+
update(item: T): Promise<void>;
|
|
470
|
+
discard(item: T): Promise<void>;
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
type IPgRepositoryConfig<P extends Entity<IEntityData>> = {
|
|
474
|
+
schema?: string;
|
|
475
|
+
table: string;
|
|
476
|
+
constructor: IConstructor<P>;
|
|
477
|
+
add?: {
|
|
478
|
+
columns: {
|
|
479
|
+
[column: string]: {
|
|
480
|
+
type: string;
|
|
481
|
+
value: (item: P) => boolean | number | string | null | Date;
|
|
482
|
+
};
|
|
483
|
+
};
|
|
484
|
+
};
|
|
485
|
+
};
|
|
486
|
+
|
|
487
|
+
declare class PgRepositoryBase<P extends Entity<IEntityData>> {
|
|
488
|
+
protected pool: Pool;
|
|
489
|
+
protected config: IPgRepositoryConfig<any>;
|
|
490
|
+
private tableIsCreated;
|
|
491
|
+
protected schema: string;
|
|
492
|
+
protected table: string;
|
|
493
|
+
protected columnsList: string[];
|
|
494
|
+
protected columnsAndTypes: string;
|
|
495
|
+
protected columns: string;
|
|
496
|
+
protected vars: string;
|
|
497
|
+
protected updates: string;
|
|
498
|
+
addColumns: {
|
|
499
|
+
[columns: string]: {
|
|
500
|
+
type: string;
|
|
501
|
+
value: (item: P) => number | boolean | string | null | Date;
|
|
502
|
+
};
|
|
503
|
+
};
|
|
504
|
+
constructor(pool: Pool, config: IPgRepositoryConfig<any>);
|
|
505
|
+
protected values(item: P): (string | number | boolean | Date | null)[];
|
|
506
|
+
protected exec(sql: string, values: any[]): Promise<void>;
|
|
507
|
+
protected query(sql: string, values: any[]): Promise<any[]>;
|
|
508
|
+
protected connect(): Promise<Pool>;
|
|
509
|
+
protected ensureTable(): Promise<void>;
|
|
510
|
+
protected ensureColumns(): Promise<void>;
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
declare class PgCrudRepository<P extends Entity<IEntityData>> extends PgRepositoryBase<P> implements ICrudRepository<P> {
|
|
514
|
+
protected readonly config: IPgRepositoryConfig<P>;
|
|
515
|
+
constructor(pool: Pool, config: IPgRepositoryConfig<P>);
|
|
516
|
+
find(id: string): Promise<P | null>;
|
|
517
|
+
findOrThrow(id: string): Promise<P>;
|
|
518
|
+
findAll(): Promise<P[]>;
|
|
519
|
+
create(item: P): Promise<void>;
|
|
520
|
+
update(item: P): Promise<void>;
|
|
521
|
+
discard(item: P): Promise<void>;
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
declare class JobRepository extends PgCrudRepository<Job> {
|
|
525
|
+
constructor(pool: Pool);
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
interface IJobEvent extends IStorableData {
|
|
529
|
+
jobId: string;
|
|
530
|
+
type: 'created';
|
|
531
|
+
}
|
|
532
|
+
type IJobEventListener = (event: IJobEvent) => void | Promise<void>;
|
|
533
|
+
declare class JobsEventsHub {
|
|
534
|
+
private jobsEventsListener;
|
|
535
|
+
notifyJobCreated(job: Job): void;
|
|
536
|
+
listenJobsEvents(listener: IJobEventListener): void;
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
declare class Async {
|
|
540
|
+
private jobRepository;
|
|
541
|
+
private handlerContainer;
|
|
542
|
+
private jobsEventsHub;
|
|
543
|
+
constructor(jobRepository: JobRepository, handlerContainer: CommandMetadataStore, jobsEventsHub: JobsEventsHub);
|
|
544
|
+
run<T extends IStorableData>(command: Command<T>): Promise<Job>;
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
declare class JobRunner {
|
|
548
|
+
private jobRepository;
|
|
549
|
+
private handlerContainer;
|
|
550
|
+
constructor(jobRepository: JobRepository, handlerContainer: CommandMetadataStore);
|
|
551
|
+
run(job: Job): Promise<void>;
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
declare function runAsyncCommandHandlers(handlers: IConstructor<ICommandHandler<any>>[]): void;
|
|
555
|
+
|
|
556
|
+
declare class Auth<D extends IStorableData> {
|
|
557
|
+
private authInfo;
|
|
558
|
+
require(): D;
|
|
559
|
+
assign(authInfo: D): void;
|
|
560
|
+
}
|
|
561
|
+
|
|
412
562
|
declare function cmd(): (target: object, propertyKey: string | symbol) => void;
|
|
413
563
|
|
|
414
564
|
declare class ChatResolver {
|
|
@@ -713,66 +863,6 @@ interface IAudioMessage extends IBaseMessage {
|
|
|
713
863
|
};
|
|
714
864
|
}
|
|
715
865
|
|
|
716
|
-
interface ICrudRepository<T> {
|
|
717
|
-
find(id: string): Promise<T | null>;
|
|
718
|
-
findOrThrow(id: string): Promise<T>;
|
|
719
|
-
findAll(id: string): Promise<T[]>;
|
|
720
|
-
create(item: T): Promise<void>;
|
|
721
|
-
update(item: T): Promise<void>;
|
|
722
|
-
discard(item: T): Promise<void>;
|
|
723
|
-
}
|
|
724
|
-
|
|
725
|
-
type IPgRepositoryConfig<P extends Entity<IEntityData>> = {
|
|
726
|
-
schema?: string;
|
|
727
|
-
table: string;
|
|
728
|
-
constructor: IConstructor<P>;
|
|
729
|
-
add?: {
|
|
730
|
-
columns: {
|
|
731
|
-
[column: string]: {
|
|
732
|
-
type: string;
|
|
733
|
-
value: (item: P) => boolean | number | string | null | Date;
|
|
734
|
-
};
|
|
735
|
-
};
|
|
736
|
-
};
|
|
737
|
-
};
|
|
738
|
-
|
|
739
|
-
declare class PgRepositoryBase<P extends Entity<IEntityData>> {
|
|
740
|
-
protected pool: Pool;
|
|
741
|
-
protected config: IPgRepositoryConfig<any>;
|
|
742
|
-
private tableIsCreated;
|
|
743
|
-
protected schema: string;
|
|
744
|
-
protected table: string;
|
|
745
|
-
protected columnsList: string[];
|
|
746
|
-
protected columnsAndTypes: string;
|
|
747
|
-
protected columns: string;
|
|
748
|
-
protected vars: string;
|
|
749
|
-
protected updates: string;
|
|
750
|
-
addColumns: {
|
|
751
|
-
[columns: string]: {
|
|
752
|
-
type: string;
|
|
753
|
-
value: (item: P) => number | boolean | string | null | Date;
|
|
754
|
-
};
|
|
755
|
-
};
|
|
756
|
-
constructor(pool: Pool, config: IPgRepositoryConfig<any>);
|
|
757
|
-
protected values(item: P): (string | number | boolean | Date | null)[];
|
|
758
|
-
protected exec(sql: string, values: any[]): Promise<void>;
|
|
759
|
-
protected query(sql: string, values: any[]): Promise<any[]>;
|
|
760
|
-
protected connect(): Promise<Pool>;
|
|
761
|
-
protected ensureTable(): Promise<void>;
|
|
762
|
-
protected ensureColumns(): Promise<void>;
|
|
763
|
-
}
|
|
764
|
-
|
|
765
|
-
declare class PgCrudRepository<P extends Entity<IEntityData>> extends PgRepositoryBase<P> implements ICrudRepository<P> {
|
|
766
|
-
protected readonly config: IPgRepositoryConfig<P>;
|
|
767
|
-
constructor(pool: Pool, config: IPgRepositoryConfig<P>);
|
|
768
|
-
find(id: string): Promise<P | null>;
|
|
769
|
-
findOrThrow(id: string): Promise<P>;
|
|
770
|
-
findAll(): Promise<P[]>;
|
|
771
|
-
create(item: P): Promise<void>;
|
|
772
|
-
update(item: P): Promise<void>;
|
|
773
|
-
discard(item: P): Promise<void>;
|
|
774
|
-
}
|
|
775
|
-
|
|
776
866
|
declare class PgWhatsAppRepository extends PgCrudRepository<WhatsApp> implements IWhatsAppRepository {
|
|
777
867
|
constructor(pool: Pool);
|
|
778
868
|
findBySlug(slug: string): Promise<WhatsApp | null>;
|
|
@@ -915,6 +1005,10 @@ declare class CustomError extends Error {
|
|
|
915
1005
|
constructor(data: ICustomErrorData);
|
|
916
1006
|
}
|
|
917
1007
|
|
|
1008
|
+
declare class Mapper {
|
|
1009
|
+
map<T>(data: any, ctor: IConstructor<T>): T;
|
|
1010
|
+
}
|
|
1011
|
+
|
|
918
1012
|
declare class SendOneTimePasswordRequest {
|
|
919
1013
|
fromEmail: string;
|
|
920
1014
|
toEmail: string;
|
|
@@ -1017,6 +1111,14 @@ declare class RamChatRepository implements IChatRepository {
|
|
|
1017
1111
|
private getMemory;
|
|
1018
1112
|
}
|
|
1019
1113
|
|
|
1114
|
+
declare class Random {
|
|
1115
|
+
static slug(name: string, options: {
|
|
1116
|
+
randomLength: number;
|
|
1117
|
+
}): string;
|
|
1118
|
+
static string(length: number): string;
|
|
1119
|
+
static numberCode(length: number): string;
|
|
1120
|
+
}
|
|
1121
|
+
|
|
1020
1122
|
interface IGetConfig {
|
|
1021
1123
|
path?: string;
|
|
1022
1124
|
}
|
|
@@ -1200,4 +1302,4 @@ declare function validateModel<V>(value: any, info: IModelValidatorsInfo<V>): IM
|
|
|
1200
1302
|
|
|
1201
1303
|
declare function validate<V>(value: any, modelConstructor: IConstructor<V>): IModelValidationResult<V>;
|
|
1202
1304
|
|
|
1203
|
-
export { AuthenticationModule, Chat, ChatBot, ChatBotAdapter, ChatBotMetadataStore, ChatItem, ChatMemory, ChatRepository, ChatResolver, ClaudeChatBotAdapter, CmdChannel, Container, ControllerMetadataStore, CustomError, DeepSeekChatBotAdapter, EmailService, Entity, Env, EnvWhatsAppRepository, ExpressProvider, HtmlModule, HttpServerProvider, type IChannelMetadata, type IChatBot, type IChatBotAdapter, type IChatBotMetadata, type IChatChannel, type IChatConnection, type IChatControllerMetadata, type IChatData, type IChatFunctionCall, type IChatItemData, type IChatItemType, type IChatMemory, type IChatMessage, type IChatRepository, type IChatType, type IConnectionChatMessage, type IConstructor, type ICrudRepository, type ICustomErrorData, type IEmailService, type IEndPointMetadata, type IEntityData, type IEnvType, type IGetConfig, type IGetWhatsAppTemplateRequest, type IHtmlModuleOptions, type IListenWhatsAppMessageRequest, type IMessageContext, type IMessageMetadata, type IMiddleware, type IMiddlewareMetadata, type IMindset, type IMindsetDecoration, type IMindsetFunctionConfig, type IMindsetFunctionDecoration, type IMindsetFunctionMetadata, type IMindsetFunctionParamMetadata, type IMindsetIdentity, type IMindsetMetadata, type IMindsetModuleConfig, type IMindsetModuleDecoration, type IMindsetModuleMetadata, type IModelValidationError, type IModelValidationResult, type IModelValidatorsInfo, type IOtpService, type IParamConfig, type IParamDecoration, type IPersistentData, type IPgRepositoryConfig, type IPostConfig, type IPrimitive, type IPropertyValidatorInfo, type IReceivedMessage, type IReceivedMessageItem, type IRestControllerConfig, type IRestControllerMetadata, type ISendEmailRequest, type ISendWhatsAppRequest, type ISendWhatsAppTemplateRequest, type IServerConfig, type IServerProvider, type ISocketChannelConfig, type ISocketChannelReceivedMessage, type IStorableData, type ISystemFunctionCallItem, type ISystemMessageItem, type ITelegramChannelConfig, type IUserConnection, type IUserData, type IUserRepository, type IValidateMaxOptions, type IValidateMinOptions, type IValidationError, type IValidationResult, type IValidator, type IValidatorMetadata, type IWhatsAppBusinessAccount, type IWhatsAppBusinessNumber, type IWhatsAppContact, type IWhatsAppData, type IWhatsAppMessage, type IWhatsAppMessageListener, type IWhatsAppRepository, type IWhatsAppSenderOptions, type IWhatsAppTemplate, type IWhatsAppTemplateComponent, type IWhatsAppTemplateMessage, type IWhatsAppTemplateParameter, type IWhatsAppTemplateResponse, type IWhatsAppWebhookPayload, type IWhatsappChannelConfig, type IchatControllerConfig, type IrunChannelProps, Logger, MINDSET_DECORATION_MINDSET, MINDSET_FUNCTION_DECORATION_FUNCTION, MINDSET_MODULE_DECORATION_MODULE, MessageContext, Mindset, MindsetMetadataStore, MindsetOperator, OpenaiChatBotAdapter, OtpService, PARAM_DECORATION_IS_OPTIONAL, PARAM_DECORATION_PARAM, Persistent, PgChatMemory, PgChatRepository, PgCrudRepository, PgRepositoryBase, PgUserRepository, PgWhatsAppRepository, RamChatMemory, RamChatRepository, RamUserRepository, RegisterUserModule, RegisterUserWithEmailRequest, RestControllerMetadataStore, SendOneTimePasswordRequest, SocketChannel, SocketChannelConfig, SocketServerProvider, Storable, TelegramChannel, TelegramChannelConfig, User, UserRepository, UserResolver, ValidateOneTimePasswordRequest, ValidationMetadataStore, WhatsApp, WhatsAppChannel, WhatsAppReceiver, WhatsAppReceiverByDevConnection, WhatsAppReceiverByWebHook, WhatsAppRepository, WhatsAppSender, WhatsAppSenderByCloudApi, WhatsAppSenderByDevConnection, WhatsappChannelConfig, chatBot, chatController, cmd, container, get, inject, injectable, isBoolean, isDate, isModel, isNotEmpty, isNumber, isOptional, isPresent, isString, max, middleware, min, mindset, mindsetFunction, mindsetModule, param, post, prepareChatContainer, restController, runChannel, runRestControllers, runServer, singleton, socket, telegram, validate, validateIsBoolean, validateIsDate, validateIsNotEmpty, validateIsNumber, validateIsPresent, validateIsString, validateMax, validateMin, validateModel, whatsapp };
|
|
1305
|
+
export { Async, Auth, AuthenticationModule, Chat, ChatBot, ChatBotAdapter, ChatBotMetadataStore, ChatItem, ChatMemory, ChatRepository, ChatResolver, ClaudeChatBotAdapter, CmdChannel, Command, CommandMetadataStore, Container, ControllerMetadataStore, CustomError, DeepSeekChatBotAdapter, EmailService, Entity, Env, EnvWhatsAppRepository, ExpressProvider, HtmlModule, HttpServerProvider, type IChannelMetadata, type IChatBot, type IChatBotAdapter, type IChatBotMetadata, type IChatChannel, type IChatConnection, type IChatControllerMetadata, type IChatData, type IChatFunctionCall, type IChatItemData, type IChatItemType, type IChatMemory, type IChatMessage, type IChatRepository, type IChatType, type ICommandConfig, type ICommandHandler, type ICommandHandlerConfig, type IConnectionChatMessage, type IConstructor, type ICrudRepository, type ICustomErrorData, type IEmailService, type IEndPointMetadata, type IEntityData, type IEnvType, type IGetConfig, type IGetWhatsAppTemplateRequest, type IHtmlModuleOptions, type IJobData, type IJobEvent, type IJobEventListener, type IListenWhatsAppMessageRequest, type IMessageContext, type IMessageMetadata, type IMiddleware, type IMiddlewareMetadata, type IMindset, type IMindsetDecoration, type IMindsetFunctionConfig, type IMindsetFunctionDecoration, type IMindsetFunctionMetadata, type IMindsetFunctionParamMetadata, type IMindsetIdentity, type IMindsetMetadata, type IMindsetModuleConfig, type IMindsetModuleDecoration, type IMindsetModuleMetadata, type IModelValidationError, type IModelValidationResult, type IModelValidatorsInfo, type IOtpService, type IParamConfig, type IParamDecoration, type IPersistentData, type IPgRepositoryConfig, type IPostConfig, type IPrimitive, type IPropertyValidatorInfo, type IReceivedMessage, type IReceivedMessageItem, type IRestControllerConfig, type IRestControllerMetadata, type ISendEmailRequest, type ISendWhatsAppRequest, type ISendWhatsAppTemplateRequest, type IServerConfig, type IServerProvider, type ISocketChannelConfig, type ISocketChannelReceivedMessage, type IStorableData, type ISystemFunctionCallItem, type ISystemMessageItem, type ITelegramChannelConfig, type IUserConnection, type IUserData, type IUserRepository, type IValidateMaxOptions, type IValidateMinOptions, type IValidationError, type IValidationResult, type IValidator, type IValidatorMetadata, type IWhatsAppBusinessAccount, type IWhatsAppBusinessNumber, type IWhatsAppContact, type IWhatsAppData, type IWhatsAppMessage, type IWhatsAppMessageListener, type IWhatsAppRepository, type IWhatsAppSenderOptions, type IWhatsAppTemplate, type IWhatsAppTemplateComponent, type IWhatsAppTemplateMessage, type IWhatsAppTemplateParameter, type IWhatsAppTemplateResponse, type IWhatsAppWebhookPayload, type IWhatsappChannelConfig, type IchatControllerConfig, type IrunChannelProps, Job, JobRepository, JobRunner, JobsEventsHub, Lifecycle, Logger, MINDSET_DECORATION_MINDSET, MINDSET_FUNCTION_DECORATION_FUNCTION, MINDSET_MODULE_DECORATION_MODULE, Mapper, MessageContext, Mindset, MindsetMetadataStore, MindsetOperator, OpenaiChatBotAdapter, OtpService, PARAM_DECORATION_IS_OPTIONAL, PARAM_DECORATION_PARAM, Persistent, PgChatMemory, PgChatRepository, PgCrudRepository, PgRepositoryBase, PgUserRepository, PgWhatsAppRepository, RamChatMemory, RamChatRepository, RamUserRepository, Random, RegisterUserModule, RegisterUserWithEmailRequest, RestControllerMetadataStore, SendOneTimePasswordRequest, SocketChannel, SocketChannelConfig, SocketServerProvider, Storable, TelegramChannel, TelegramChannelConfig, User, UserRepository, UserResolver, ValidateOneTimePasswordRequest, ValidationMetadataStore, WhatsApp, WhatsAppChannel, WhatsAppReceiver, WhatsAppReceiverByDevConnection, WhatsAppReceiverByWebHook, WhatsAppRepository, WhatsAppSender, WhatsAppSenderByCloudApi, WhatsAppSenderByDevConnection, WhatsappChannelConfig, chatBot, chatController, cmd, command, commandHandler, container, get, inject, injectable, isBoolean, isDate, isModel, isNotEmpty, isNumber, isOptional, isPresent, isString, max, middleware, min, mindset, mindsetFunction, mindsetModule, param, post, prepareChatContainer, restController, runAsyncCommandHandlers, runChannel, runRestControllers, runServer, scoped, singleton, socket, telegram, validate, validateIsBoolean, validateIsDate, validateIsNotEmpty, validateIsNumber, validateIsPresent, validateIsString, validateMax, validateMin, validateModel, whatsapp };
|
package/dist/src/index.js
CHANGED
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
export { DeepSeekChatBotAdapter } from './ai/deepseek/DeepSeekChatBotAdapter.js';
|
|
2
2
|
export { OpenaiChatBotAdapter } from './ai/openia/OpenaiChatBotAdapter.js';
|
|
3
3
|
export { ClaudeChatBotAdapter } from './ai/claude/ClaudeChatBotAdapter.js';
|
|
4
|
+
export { command } from './async/@command.js';
|
|
5
|
+
export { commandHandler } from './async/@commandHandler.js';
|
|
6
|
+
export { Async } from './async/Async.js';
|
|
7
|
+
export { Command } from './async/Command.js';
|
|
8
|
+
export { CommandMetadataStore } from './async/CommandMetadataStore.js';
|
|
9
|
+
export { Job } from './async/Job.js';
|
|
10
|
+
export { JobRepository } from './async/JobRepository.js';
|
|
11
|
+
export { JobRunner } from './async/JobRunner.js';
|
|
12
|
+
export { JobsEventsHub } from './async/JobsEventsHub.js';
|
|
13
|
+
export { runAsyncCommandHandlers } from './async/runCommandHandlers.js';
|
|
14
|
+
export { Auth } from './auth/Auth.js';
|
|
4
15
|
export { cmd } from './channels/cmd/@cmd.js';
|
|
5
16
|
export { CmdChannel } from './channels/cmd/CmdChannel.js';
|
|
6
17
|
export { ExpressProvider } from './channels/express/ExpressProvider.js';
|
|
@@ -44,8 +55,9 @@ export { Entity, Persistent } from './core/Entity.js';
|
|
|
44
55
|
export { Storable } from './core/Storable.js';
|
|
45
56
|
export { Env } from './env/Env.js';
|
|
46
57
|
export { CustomError } from './error/CustomError.js';
|
|
47
|
-
export { container, inject, injectable, singleton } from './injection/index.js';
|
|
58
|
+
export { Lifecycle, container, inject, injectable, scoped, singleton } from './injection/index.js';
|
|
48
59
|
export { Logger } from './logger/Logger.js';
|
|
60
|
+
export { Mapper } from './mapper/Mapper.js';
|
|
49
61
|
export { mindsetFunction } from './mindset/metadata/functions/@mindsetFunction.js';
|
|
50
62
|
export { MINDSET_FUNCTION_DECORATION_FUNCTION } from './mindset/metadata/functions/decoratorNames.js';
|
|
51
63
|
export { mindset } from './mindset/metadata/mindsets/@mindset.js';
|
|
@@ -71,6 +83,7 @@ export { PgChatRepository } from './pre-made/repository/chat/pg/PgChatRepository
|
|
|
71
83
|
export { PgChatMemory } from './pre-made/repository/chat/pg/PgChatMemory.js';
|
|
72
84
|
export { RamChatMemory } from './pre-made/repository/chat/ram/RamChatMemory.js';
|
|
73
85
|
export { RamChatRepository } from './pre-made/repository/chat/ram/RamChatRepository.js';
|
|
86
|
+
export { Random } from './random/Random.js';
|
|
74
87
|
export { PgCrudRepository } from './repository/pg/PgCrudRepository.js';
|
|
75
88
|
export { PgRepositoryBase } from './repository/pg/PgRepositoryBase.js';
|
|
76
89
|
export { get } from './rest-controller/metadata/@get.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
await import('reflect-metadata');
|
|
2
|
-
const { injectable, container, singleton, inject } = await import('tsyringe');
|
|
2
|
+
const { injectable, container, singleton, inject, scoped, Lifecycle } = await import('tsyringe');
|
|
3
3
|
|
|
4
|
-
export { container, inject, injectable, singleton };
|
|
4
|
+
export { Lifecycle, container, inject, injectable, scoped, singleton };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import '../core/chat/repository/IChatRepository.js';
|
|
2
|
+
import { Storable } from '../core/Storable.js';
|
|
3
|
+
import '../core/user/IUserRepository.js';
|
|
4
|
+
import { CustomError } from '../error/CustomError.js';
|
|
5
|
+
import '../injection/index.js';
|
|
6
|
+
import '../validation/metadata/ValidationMetadataStore.js';
|
|
7
|
+
import { validate } from '../validation/validate.js';
|
|
8
|
+
|
|
9
|
+
function deepCopyWithStorable(obj) {
|
|
10
|
+
if (obj === null || typeof obj !== 'object') {
|
|
11
|
+
return obj;
|
|
12
|
+
}
|
|
13
|
+
if (obj instanceof Date) {
|
|
14
|
+
return obj.getTime();
|
|
15
|
+
}
|
|
16
|
+
if (obj instanceof Storable) {
|
|
17
|
+
return deepCopyWithStorable(obj['data']);
|
|
18
|
+
}
|
|
19
|
+
if (Array.isArray(obj)) {
|
|
20
|
+
return obj.map((item) => deepCopyWithStorable(item));
|
|
21
|
+
}
|
|
22
|
+
const copy = {};
|
|
23
|
+
for (const key in obj) {
|
|
24
|
+
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
25
|
+
copy[key] = deepCopyWithStorable(obj[key]);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return copy;
|
|
29
|
+
}
|
|
30
|
+
class Mapper {
|
|
31
|
+
map(data, ctor) {
|
|
32
|
+
const validationResult = validate(deepCopyWithStorable(data), ctor);
|
|
33
|
+
if (validationResult.error) {
|
|
34
|
+
throw new CustomError({
|
|
35
|
+
httpCode: 500,
|
|
36
|
+
message: `Cant map value to ${ctor.name}`,
|
|
37
|
+
info: validationResult.error,
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
return validationResult.value;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export { Mapper };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { randomBytes } from 'node:crypto';
|
|
2
|
+
|
|
3
|
+
const DIGITS = '0123456789';
|
|
4
|
+
const CHARSET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
|
5
|
+
class Random {
|
|
6
|
+
static slug(name, options) {
|
|
7
|
+
const base = name
|
|
8
|
+
.toLowerCase()
|
|
9
|
+
.trim()
|
|
10
|
+
.replace(/[\s\_]+/g, '-') // spaces/underscores to hyphens
|
|
11
|
+
.replace(/[^a-z0-9\-]/g, '') // remove non-alphanumeric except hyphens
|
|
12
|
+
.replace(/\-+/g, '-') // collapse multiple hyphens
|
|
13
|
+
.replace(/^\-+|\-+$/g, ''); // trim hyphens from ends
|
|
14
|
+
const random = this.string(options.randomLength);
|
|
15
|
+
return `${base}-${random}`;
|
|
16
|
+
}
|
|
17
|
+
static string(length) {
|
|
18
|
+
const bytes = randomBytes(length);
|
|
19
|
+
let result = '';
|
|
20
|
+
for (let i = 0; i < length; i++) {
|
|
21
|
+
const index = bytes[i] % CHARSET.length;
|
|
22
|
+
result += CHARSET[index];
|
|
23
|
+
}
|
|
24
|
+
return result;
|
|
25
|
+
}
|
|
26
|
+
static numberCode(length) {
|
|
27
|
+
const bytes = randomBytes(length);
|
|
28
|
+
let result = '';
|
|
29
|
+
for (let i = 0; i < length; i++) {
|
|
30
|
+
const index = bytes[i] % 10; // 0–9
|
|
31
|
+
result += DIGITS[index];
|
|
32
|
+
}
|
|
33
|
+
return result;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export { Random };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wabot-dev/framework",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.24",
|
|
4
4
|
"description": "Framework for IA Chat Bots",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/src/index.js",
|
|
@@ -38,6 +38,7 @@
|
|
|
38
38
|
"@anthropic-ai/sdk": "^0.60.0",
|
|
39
39
|
"@types/debug": "^4.1.12",
|
|
40
40
|
"@types/express": "^5.0.1",
|
|
41
|
+
"@types/jsonwebtoken": "^9.0.10",
|
|
41
42
|
"@types/pg": "^8.11.14",
|
|
42
43
|
"@yucacodes/ts": "^0.0.4",
|
|
43
44
|
"body-parser": "^2.2.0",
|
|
@@ -46,6 +47,7 @@
|
|
|
46
47
|
"express": "^5.1.0",
|
|
47
48
|
"grammy": "^1.36.0",
|
|
48
49
|
"html-to-text": "^9.0.5",
|
|
50
|
+
"jsonwebtoken": "^9.0.2",
|
|
49
51
|
"openai": "^4.93.0",
|
|
50
52
|
"pg": "^8.15.6",
|
|
51
53
|
"reflect-metadata": "^0.2.2",
|