@wabot-dev/framework 0.8.3 → 0.9.0
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/PgCronJobRepository.js +2 -0
- package/dist/src/addon/async/pg/PgJobRepository.js +2 -0
- package/dist/src/addon/auth/api-key/@apiKeyGuard.js +2 -2
- package/dist/src/addon/auth/api-key/PgApiKeyRepository.js +3 -1
- package/dist/src/addon/auth/jwt/@jwtGuard.js +2 -2
- package/dist/src/addon/auth/jwt/PgJwtRefreshTokenRepository.js +2 -0
- package/dist/src/addon/chat-bot/anthropic/AnthropicChatAdapter.js +38 -14
- package/dist/src/addon/chat-bot/deepseek/DeepSeekChatAdapter.js +42 -13
- package/dist/src/addon/chat-bot/google/GoogleChatAdapter.js +77 -26
- package/dist/src/addon/chat-bot/openia/OpenaiChatAdapter.js +31 -9
- package/dist/src/addon/chat-bot/openrouter/OpenRouterChatAdapter.js +23 -4
- package/dist/src/addon/chat-bot/pg/PgChatMemory.js +6 -1
- package/dist/src/addon/chat-bot/pg/PgChatRepository.js +5 -0
- package/dist/src/addon/chat-bot/ram/RamChatRepository.js +3 -0
- package/dist/src/addon/chat-bot/wabot/WabotChatAdapter.js +9 -0
- package/dist/src/addon/chat-controller/cmd/CmdChannel.js +3 -3
- package/dist/src/addon/chat-controller/wasender/WasenderWebhookController.js +1 -1
- package/dist/src/addon/chat-controller/whatsapp/PgWhatsAppRepository.js +2 -0
- package/dist/src/addon/chat-controller/whatsapp/WhatsAppSender.js +3 -0
- package/dist/src/addon/chat-controller/whatsapp/cloud-api/WhatsAppSenderByCloudApi.js +3 -0
- package/dist/src/addon/chat-controller/whatsapp/proxy/WhatsAppSenderByWabotProxy.js +3 -0
- package/dist/src/feature/chat-bot/Chat.js +2 -1
- package/dist/src/feature/chat-bot/ChatAdapterRegistry.js +26 -0
- package/dist/src/feature/chat-bot/ChatBot.js +9 -6
- package/dist/src/feature/chat-bot/UnionChatAdapter.js +64 -0
- package/dist/src/feature/chat-bot/isChatMessageEmpty.js +1 -1
- package/dist/src/feature/chat-bot/isRetryableError.js +63 -0
- package/dist/src/feature/chat-bot/metadata/@chatAdapter.js +11 -0
- package/dist/src/feature/chat-bot/metadata/ChatAdapterMetadataStore.js +17 -0
- package/dist/src/feature/chat-bot/runChatAdapters.js +22 -0
- package/dist/src/feature/chat-controller/ChatResolver.js +3 -0
- package/dist/src/feature/chat-controller/runChatControllers.js +3 -0
- package/dist/src/feature/http/HttpServerProvider.js +1 -1
- package/dist/src/feature/mindset/IMindset.js +4 -0
- package/dist/src/feature/mindset/MindsetOperator.js +30 -2
- package/dist/src/feature/pg/pgStorage.js +1 -1
- package/dist/src/feature/pg/query/@pgJsonRepository.js +73 -0
- package/dist/src/feature/pg/query/@query.js +14 -0
- package/dist/src/feature/pg/query/PgJsonRepository.js +23 -0
- package/dist/src/feature/pg/query/PgRepositoryMetadataStore.js +44 -0
- package/dist/src/feature/pg/query/buildQuerySql.js +164 -0
- package/dist/src/feature/pg/query/parseQueryMethodName.js +151 -0
- package/dist/src/feature/pg/withPgClient.js +1 -1
- package/dist/src/feature/rest-controller/runRestControllers.js +2 -2
- package/dist/src/index.d.ts +134 -17
- package/dist/src/index.js +14 -2
- package/dist/src/node_modules/cron-parser/dist/CronFileParser.js +2 -2
- package/package.json +1 -1
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
// Fields stored as top-level columns; routed to the column instead of
|
|
2
|
+
// extracting from the JSON blob (uses the index, preserves native type
|
|
3
|
+
// for ordering/comparison). All other fields fall back to data->>'field',
|
|
4
|
+
// which yields TEXT — so ORDER BY on numeric JSON fields is lexicographic
|
|
5
|
+
// and In/NotIn compares as text. Use add.columns for sortable hot paths.
|
|
6
|
+
const RESERVED_COLUMN_BY_FIELD = {
|
|
7
|
+
id: 'id',
|
|
8
|
+
createdAt: 'created_at',
|
|
9
|
+
};
|
|
10
|
+
function operatorArity(op) {
|
|
11
|
+
if (op === 'IsNull' || op === 'IsNotNull')
|
|
12
|
+
return 0;
|
|
13
|
+
return 1;
|
|
14
|
+
}
|
|
15
|
+
function escapeJsonKey(field) {
|
|
16
|
+
return field.replace(/'/g, "''");
|
|
17
|
+
}
|
|
18
|
+
function isReservedColumn(field) {
|
|
19
|
+
return Object.prototype.hasOwnProperty.call(RESERVED_COLUMN_BY_FIELD, field);
|
|
20
|
+
}
|
|
21
|
+
function fieldRef(field) {
|
|
22
|
+
const reserved = RESERVED_COLUMN_BY_FIELD[field];
|
|
23
|
+
if (reserved)
|
|
24
|
+
return reserved;
|
|
25
|
+
return `data->>'${escapeJsonKey(field)}'`;
|
|
26
|
+
}
|
|
27
|
+
function fieldExpr(field, op) {
|
|
28
|
+
const ref = fieldRef(field);
|
|
29
|
+
if (op === 'Gt' || op === 'Gte' || op === 'Lt' || op === 'Lte') {
|
|
30
|
+
if (isReservedColumn(field))
|
|
31
|
+
return ref;
|
|
32
|
+
return `(${ref})::numeric`;
|
|
33
|
+
}
|
|
34
|
+
return ref;
|
|
35
|
+
}
|
|
36
|
+
function renderCondition(cond, paramIndex) {
|
|
37
|
+
const lhs = fieldExpr(cond.field, cond.operator);
|
|
38
|
+
const reserved = isReservedColumn(cond.field);
|
|
39
|
+
const numCast = reserved ? '' : '::numeric';
|
|
40
|
+
// Note: In/NotIn cast the param to text[]; passing non-text JSON values
|
|
41
|
+
// (numbers, booleans) relies on pg's TEXT serialization. For sortable
|
|
42
|
+
// numeric fields, prefer a typed add.columns column.
|
|
43
|
+
const arrCast = reserved ? '' : '::text[]';
|
|
44
|
+
switch (cond.operator) {
|
|
45
|
+
case 'Equals':
|
|
46
|
+
return `${lhs} = $${paramIndex}`;
|
|
47
|
+
case 'Not':
|
|
48
|
+
return `${lhs} <> $${paramIndex}`;
|
|
49
|
+
case 'Like':
|
|
50
|
+
return `${lhs} LIKE $${paramIndex}`;
|
|
51
|
+
case 'NotLike':
|
|
52
|
+
return `${lhs} NOT LIKE $${paramIndex}`;
|
|
53
|
+
case 'In':
|
|
54
|
+
return `${lhs} = ANY($${paramIndex}${arrCast})`;
|
|
55
|
+
case 'NotIn':
|
|
56
|
+
return `NOT (${lhs} = ANY($${paramIndex}${arrCast}))`;
|
|
57
|
+
case 'Gt':
|
|
58
|
+
return `${lhs} > $${paramIndex}${numCast}`;
|
|
59
|
+
case 'Gte':
|
|
60
|
+
return `${lhs} >= $${paramIndex}${numCast}`;
|
|
61
|
+
case 'Lt':
|
|
62
|
+
return `${lhs} < $${paramIndex}${numCast}`;
|
|
63
|
+
case 'Lte':
|
|
64
|
+
return `${lhs} <= $${paramIndex}${numCast}`;
|
|
65
|
+
// IS NULL matches both missing JSON keys and explicit JSON nulls
|
|
66
|
+
// (PostgreSQL `data->>'k'` returns NULL for both cases).
|
|
67
|
+
case 'IsNull':
|
|
68
|
+
return `${lhs} IS NULL`;
|
|
69
|
+
case 'IsNotNull':
|
|
70
|
+
return `${lhs} IS NOT NULL`;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
function renderWhere(conditions) {
|
|
74
|
+
if (conditions.length === 0)
|
|
75
|
+
return { sql: '', argCount: 0 };
|
|
76
|
+
const parts = [];
|
|
77
|
+
let paramIndex = 1;
|
|
78
|
+
conditions.forEach((cond, i) => {
|
|
79
|
+
const piece = renderCondition(cond, paramIndex);
|
|
80
|
+
paramIndex += operatorArity(cond.operator);
|
|
81
|
+
if (i === 0) {
|
|
82
|
+
parts.push(piece);
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
parts.push((cond.connector ?? 'And').toUpperCase(), piece);
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
return { sql: ` WHERE ${parts.join(' ')}`, argCount: paramIndex - 1 };
|
|
89
|
+
}
|
|
90
|
+
function renderOrderBy(ast) {
|
|
91
|
+
if (ast.orderBy.length === 0)
|
|
92
|
+
return '';
|
|
93
|
+
const parts = ast.orderBy.map((o) => `${fieldRef(o.field)} ${o.direction}`);
|
|
94
|
+
return ` ORDER BY ${parts.join(', ')}`;
|
|
95
|
+
}
|
|
96
|
+
function renderLimit(ast) {
|
|
97
|
+
if (ast.prefix === 'findOne')
|
|
98
|
+
return ' LIMIT 1';
|
|
99
|
+
if (ast.limit !== undefined)
|
|
100
|
+
return ` LIMIT ${ast.limit}`;
|
|
101
|
+
return '';
|
|
102
|
+
}
|
|
103
|
+
function buildSelectSql(ast, table, columns) {
|
|
104
|
+
const where = renderWhere(ast.conditions);
|
|
105
|
+
const order = renderOrderBy(ast);
|
|
106
|
+
const limit = renderLimit(ast);
|
|
107
|
+
const sql = `SELECT ${columns} FROM ${table}${where.sql}${order}${limit}`;
|
|
108
|
+
return { sql, argCount: where.argCount };
|
|
109
|
+
}
|
|
110
|
+
function buildCountSql(ast, table) {
|
|
111
|
+
const where = renderWhere(ast.conditions);
|
|
112
|
+
const sql = `SELECT COUNT(*)::int AS count FROM ${table}${where.sql}`;
|
|
113
|
+
return { sql, argCount: where.argCount };
|
|
114
|
+
}
|
|
115
|
+
function buildExistsSql(ast, table) {
|
|
116
|
+
const where = renderWhere(ast.conditions);
|
|
117
|
+
const sql = `SELECT EXISTS(SELECT 1 FROM ${table}${where.sql} LIMIT 1) AS "exists"`;
|
|
118
|
+
return { sql, argCount: where.argCount };
|
|
119
|
+
}
|
|
120
|
+
function buildDeleteSql(ast, table) {
|
|
121
|
+
const where = renderWhere(ast.conditions);
|
|
122
|
+
const sql = `DELETE FROM ${table}${where.sql}`;
|
|
123
|
+
return { sql, argCount: where.argCount };
|
|
124
|
+
}
|
|
125
|
+
function buildQuerySql(ast, table, columns) {
|
|
126
|
+
let sql;
|
|
127
|
+
let argCount;
|
|
128
|
+
switch (ast.prefix) {
|
|
129
|
+
case 'find':
|
|
130
|
+
case 'findOne': {
|
|
131
|
+
const r = buildSelectSql(ast, table, columns);
|
|
132
|
+
sql = r.sql;
|
|
133
|
+
argCount = r.argCount;
|
|
134
|
+
break;
|
|
135
|
+
}
|
|
136
|
+
case 'count': {
|
|
137
|
+
const r = buildCountSql(ast, table);
|
|
138
|
+
sql = r.sql;
|
|
139
|
+
argCount = r.argCount;
|
|
140
|
+
break;
|
|
141
|
+
}
|
|
142
|
+
case 'exists': {
|
|
143
|
+
const r = buildExistsSql(ast, table);
|
|
144
|
+
sql = r.sql;
|
|
145
|
+
argCount = r.argCount;
|
|
146
|
+
break;
|
|
147
|
+
}
|
|
148
|
+
case 'delete': {
|
|
149
|
+
const r = buildDeleteSql(ast, table);
|
|
150
|
+
sql = r.sql;
|
|
151
|
+
argCount = r.argCount;
|
|
152
|
+
break;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
const buildParams = (args) => {
|
|
156
|
+
if (args.length !== argCount) {
|
|
157
|
+
throw new Error(`Query expected ${argCount} argument(s), received ${args.length}`);
|
|
158
|
+
}
|
|
159
|
+
return args;
|
|
160
|
+
};
|
|
161
|
+
return { sql, argCount, buildParams };
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
export { buildQuerySql };
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
const PREFIXES = ['findOne', 'find', 'count', 'exists', 'delete'];
|
|
2
|
+
const OPERATOR_MATCHERS = [
|
|
3
|
+
{ tokens: ['Greater', 'Than', 'Equal'], op: 'Gte' },
|
|
4
|
+
{ tokens: ['Less', 'Than', 'Equal'], op: 'Lte' },
|
|
5
|
+
{ tokens: ['Greater', 'Than'], op: 'Gt' },
|
|
6
|
+
{ tokens: ['Less', 'Than'], op: 'Lt' },
|
|
7
|
+
{ tokens: ['Is', 'Not', 'Null'], op: 'IsNotNull' },
|
|
8
|
+
{ tokens: ['Is', 'Null'], op: 'IsNull' },
|
|
9
|
+
{ tokens: ['Not', 'Like'], op: 'NotLike' },
|
|
10
|
+
{ tokens: ['Not', 'In'], op: 'NotIn' },
|
|
11
|
+
{ tokens: ['Like'], op: 'Like' },
|
|
12
|
+
{ tokens: ['In'], op: 'In' },
|
|
13
|
+
{ tokens: ['Not'], op: 'Not' },
|
|
14
|
+
{ tokens: ['Gte'], op: 'Gte' },
|
|
15
|
+
{ tokens: ['Lte'], op: 'Lte' },
|
|
16
|
+
{ tokens: ['Gt'], op: 'Gt' },
|
|
17
|
+
{ tokens: ['Lt'], op: 'Lt' },
|
|
18
|
+
];
|
|
19
|
+
const CONNECTOR_TOKENS = new Set(['And', 'Or']);
|
|
20
|
+
const FIELD_NAME_REGEX = /^[a-zA-Z_][a-zA-Z0-9_]*$/;
|
|
21
|
+
function splitCamelCase(s) {
|
|
22
|
+
return s.match(/[A-Z][a-z0-9]*/g) ?? [];
|
|
23
|
+
}
|
|
24
|
+
function tokensToFieldName(tokens) {
|
|
25
|
+
if (tokens.length === 0) {
|
|
26
|
+
throw new Error('Query method: missing field name');
|
|
27
|
+
}
|
|
28
|
+
const joined = tokens.join('');
|
|
29
|
+
const field = joined.charAt(0).toLowerCase() + joined.slice(1);
|
|
30
|
+
if (!FIELD_NAME_REGEX.test(field)) {
|
|
31
|
+
throw new Error(`Query method: invalid field name "${field}"`);
|
|
32
|
+
}
|
|
33
|
+
return field;
|
|
34
|
+
}
|
|
35
|
+
function matchPrefix(name) {
|
|
36
|
+
for (const prefix of PREFIXES) {
|
|
37
|
+
if (name.startsWith(prefix)) {
|
|
38
|
+
const next = name.charAt(prefix.length);
|
|
39
|
+
if (next === '' || (next >= 'A' && next <= 'Z')) {
|
|
40
|
+
return { prefix, rest: name.slice(prefix.length) };
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
throw new Error(`Query method "${name}" must start with one of: ${PREFIXES.join(', ')}`);
|
|
45
|
+
}
|
|
46
|
+
function parseConditionTokens(tokens) {
|
|
47
|
+
for (const matcher of OPERATOR_MATCHERS) {
|
|
48
|
+
if (tokens.length < matcher.tokens.length)
|
|
49
|
+
continue;
|
|
50
|
+
const tail = tokens.slice(tokens.length - matcher.tokens.length);
|
|
51
|
+
if (tail.every((t, i) => t === matcher.tokens[i])) {
|
|
52
|
+
const head = tokens.slice(0, tokens.length - matcher.tokens.length);
|
|
53
|
+
return { field: tokensToFieldName(head), operator: matcher.op };
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return { field: tokensToFieldName(tokens), operator: 'Equals' };
|
|
57
|
+
}
|
|
58
|
+
function parseConditions(body) {
|
|
59
|
+
if (body === '')
|
|
60
|
+
return [];
|
|
61
|
+
const tokens = splitCamelCase(body);
|
|
62
|
+
if (tokens.length === 0)
|
|
63
|
+
return [];
|
|
64
|
+
if (CONNECTOR_TOKENS.has(tokens[0])) {
|
|
65
|
+
throw new Error(`Query method: condition cannot start with connector "${tokens[0]}"`);
|
|
66
|
+
}
|
|
67
|
+
const conditions = [];
|
|
68
|
+
let buffer = [];
|
|
69
|
+
let pendingConnector;
|
|
70
|
+
const flush = () => {
|
|
71
|
+
if (buffer.length === 0) {
|
|
72
|
+
throw new Error('Query method: empty condition between connectors');
|
|
73
|
+
}
|
|
74
|
+
const { field, operator } = parseConditionTokens(buffer);
|
|
75
|
+
conditions.push({ field, operator, connector: pendingConnector });
|
|
76
|
+
buffer = [];
|
|
77
|
+
};
|
|
78
|
+
for (const token of tokens) {
|
|
79
|
+
if (CONNECTOR_TOKENS.has(token) && buffer.length > 0) {
|
|
80
|
+
flush();
|
|
81
|
+
pendingConnector = token;
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
buffer.push(token);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
flush();
|
|
88
|
+
return conditions;
|
|
89
|
+
}
|
|
90
|
+
function parseOrderBy(body) {
|
|
91
|
+
const tokens = splitCamelCase(body);
|
|
92
|
+
const result = [];
|
|
93
|
+
let buffer = [];
|
|
94
|
+
for (const token of tokens) {
|
|
95
|
+
if (token === 'Asc' || token === 'Desc') {
|
|
96
|
+
if (buffer.length === 0) {
|
|
97
|
+
throw new Error('Query method: OrderBy direction without field');
|
|
98
|
+
}
|
|
99
|
+
result.push({
|
|
100
|
+
field: tokensToFieldName(buffer),
|
|
101
|
+
direction: token === 'Asc' ? 'ASC' : 'DESC',
|
|
102
|
+
});
|
|
103
|
+
buffer = [];
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
buffer.push(token);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
if (buffer.length > 0) {
|
|
110
|
+
throw new Error(`Query method: OrderBy field "${tokensToFieldName(buffer)}" missing Asc/Desc direction`);
|
|
111
|
+
}
|
|
112
|
+
if (result.length === 0) {
|
|
113
|
+
throw new Error('Query method: OrderBy clause has no fields');
|
|
114
|
+
}
|
|
115
|
+
return result;
|
|
116
|
+
}
|
|
117
|
+
// Conditions are joined left-to-right; the DSL has no parentheses,
|
|
118
|
+
// so SQL precedence applies (AND binds tighter than OR). Group with
|
|
119
|
+
// explicit method names if the implicit precedence is not what you want.
|
|
120
|
+
function parseQueryMethodName(name) {
|
|
121
|
+
const { prefix, rest: afterPrefix } = matchPrefix(name);
|
|
122
|
+
let rest = afterPrefix;
|
|
123
|
+
let limit;
|
|
124
|
+
const limitMatch = rest.match(/Limit(\d+)$/);
|
|
125
|
+
if (limitMatch) {
|
|
126
|
+
if (prefix === 'findOne') {
|
|
127
|
+
throw new Error(`Query method "${name}": findOne implies LIMIT 1; remove the Limit suffix`);
|
|
128
|
+
}
|
|
129
|
+
limit = parseInt(limitMatch[1], 10);
|
|
130
|
+
rest = rest.slice(0, rest.length - limitMatch[0].length);
|
|
131
|
+
}
|
|
132
|
+
let orderBy = [];
|
|
133
|
+
const orderByIdx = rest.indexOf('OrderBy');
|
|
134
|
+
if (orderByIdx >= 0) {
|
|
135
|
+
orderBy = parseOrderBy(rest.slice(orderByIdx + 'OrderBy'.length));
|
|
136
|
+
rest = rest.slice(0, orderByIdx);
|
|
137
|
+
}
|
|
138
|
+
let conditions = [];
|
|
139
|
+
if (rest === '' || rest === 'All') {
|
|
140
|
+
conditions = [];
|
|
141
|
+
}
|
|
142
|
+
else if (rest.startsWith('By')) {
|
|
143
|
+
conditions = parseConditions(rest.slice(2));
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
throw new Error(`Query method "${name}": expected "By<...>" or "All" after prefix, got "${rest}"`);
|
|
147
|
+
}
|
|
148
|
+
return { prefix, conditions, orderBy, limit };
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export { parseQueryMethodName };
|
|
@@ -6,11 +6,11 @@ import { validateModel } from '../../core/validation/core/validateModel.js';
|
|
|
6
6
|
import { ValidationMetadataStore } from '../../core/validation/metadata/ValidationMetadataStore.js';
|
|
7
7
|
import { ExpressProvider } from '../express/ExpressProvider.js';
|
|
8
8
|
import { json, urlencoded } from 'express';
|
|
9
|
-
import path__default from 'path';
|
|
9
|
+
import path__default from 'node:path';
|
|
10
10
|
import { EXPRESS_REQ, EXPRESS_RES } from './injection-tokens.js';
|
|
11
11
|
import { RestControllerMetadataStore } from './metadata/RestControllerMetadataStore.js';
|
|
12
12
|
import { RestRequest } from './RestRequest.js';
|
|
13
|
-
import { IncomingMessage } from 'http';
|
|
13
|
+
import { IncomingMessage } from 'node:http';
|
|
14
14
|
import { Container } from '../../core/injection/Container.js';
|
|
15
15
|
|
|
16
16
|
function buildRequest(req) {
|
package/dist/src/index.d.ts
CHANGED
|
@@ -4,11 +4,11 @@ export { DependencyContainer } from 'tsyringe';
|
|
|
4
4
|
import InjectionToken from 'tsyringe/dist/typings/providers/injection-token';
|
|
5
5
|
import DependencyContainer, { PreResolutionInterceptorCallback, PostResolutionInterceptorCallback } from 'tsyringe/dist/typings/types/dependency-container';
|
|
6
6
|
import InterceptionOptions from 'tsyringe/dist/typings/types/interceptor-options';
|
|
7
|
-
import { Server, IncomingMessage } from 'http';
|
|
7
|
+
import { Server, IncomingMessage } from 'node:http';
|
|
8
8
|
import { Express, Request, Response } from 'express';
|
|
9
9
|
import * as big_js from 'big.js';
|
|
10
10
|
import { Pool, PoolClient } from 'pg';
|
|
11
|
-
import { AsyncLocalStorage } from 'async_hooks';
|
|
11
|
+
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
12
12
|
import { Server as Server$1, Socket } from 'socket.io';
|
|
13
13
|
import { Algorithm } from 'jsonwebtoken';
|
|
14
14
|
import { Socket as Socket$1 } from 'socket.io-client';
|
|
@@ -724,17 +724,34 @@ interface IMindsetIdentity {
|
|
|
724
724
|
personality?: string;
|
|
725
725
|
emotions?: string;
|
|
726
726
|
}
|
|
727
|
+
/** @deprecated use {@link IMindsetModelRef} */
|
|
727
728
|
interface IMindsetLlm {
|
|
728
729
|
provider?: string;
|
|
729
730
|
model: string;
|
|
730
731
|
}
|
|
732
|
+
interface IMindsetModelRef {
|
|
733
|
+
provider?: string;
|
|
734
|
+
model: string;
|
|
735
|
+
}
|
|
736
|
+
type IMindsetModelKind = 'llm' | 'visionLlm' | 'audioLlm' | 'speechToText' | 'textToSpeech' | 'imageGen' | 'embedding';
|
|
737
|
+
interface IMindsetModels {
|
|
738
|
+
llm?: IMindsetModelRef[];
|
|
739
|
+
visionLlm?: IMindsetModelRef[];
|
|
740
|
+
audioLlm?: IMindsetModelRef[];
|
|
741
|
+
speechToText?: IMindsetModelRef[];
|
|
742
|
+
textToSpeech?: IMindsetModelRef[];
|
|
743
|
+
imageGen?: IMindsetModelRef[];
|
|
744
|
+
embedding?: IMindsetModelRef[];
|
|
745
|
+
}
|
|
731
746
|
interface IMindset {
|
|
732
747
|
context(): Promise<string>;
|
|
733
748
|
identity(): Promise<IMindsetIdentity>;
|
|
734
749
|
skills(): Promise<string>;
|
|
735
750
|
limits(): Promise<string>;
|
|
736
751
|
workflow(): Promise<string>;
|
|
737
|
-
|
|
752
|
+
models?(): Promise<IMindsetModels>;
|
|
753
|
+
/** @deprecated implement {@link IMindset.models} instead */
|
|
754
|
+
llms?(): Promise<IMindsetLlm[]>;
|
|
738
755
|
}
|
|
739
756
|
declare class Mindset implements IMindset {
|
|
740
757
|
context(): Promise<string>;
|
|
@@ -742,7 +759,9 @@ declare class Mindset implements IMindset {
|
|
|
742
759
|
skills(): Promise<string>;
|
|
743
760
|
limits(): Promise<string>;
|
|
744
761
|
workflow(): Promise<string>;
|
|
745
|
-
|
|
762
|
+
models?(): Promise<IMindsetModels>;
|
|
763
|
+
/** @deprecated implement {@link Mindset.models} instead */
|
|
764
|
+
llms?(): Promise<IMindsetLlm[]>;
|
|
746
765
|
}
|
|
747
766
|
|
|
748
767
|
interface IMindsetConfig {
|
|
@@ -842,7 +861,10 @@ declare class MindsetOperator implements IMindset {
|
|
|
842
861
|
skills(): Promise<string>;
|
|
843
862
|
limits(): Promise<string>;
|
|
844
863
|
workflow(): Promise<string>;
|
|
864
|
+
/** @deprecated use {@link MindsetOperator.models} */
|
|
845
865
|
llms(): Promise<IMindsetLlm[]>;
|
|
866
|
+
models(): Promise<IMindsetModels>;
|
|
867
|
+
resolveModels(kind: IMindsetModelKind): Promise<IMindsetModelRef[]>;
|
|
846
868
|
systemPrompt(): Promise<string>;
|
|
847
869
|
tools(): IMindsetTool[];
|
|
848
870
|
protected paramDescription(rawDescription: string, rawType: string): string;
|
|
@@ -887,6 +909,7 @@ interface IFunctionCall {
|
|
|
887
909
|
name: string;
|
|
888
910
|
arguments?: string;
|
|
889
911
|
result?: string;
|
|
912
|
+
signature?: string;
|
|
890
913
|
}
|
|
891
914
|
|
|
892
915
|
declare const chatItemTypeOptions: readonly ["botMessage", "humanMessage", "functionCall"];
|
|
@@ -914,10 +937,15 @@ type IChatItemType = (typeof chatItemTypeOptions)[number];
|
|
|
914
937
|
interface ILanguageModelUsage {
|
|
915
938
|
inputTokens: number;
|
|
916
939
|
outputTokens: number;
|
|
940
|
+
cacheReadTokens?: number;
|
|
941
|
+
cacheWriteTokens?: number;
|
|
942
|
+
costUsd?: number;
|
|
943
|
+
provider?: string;
|
|
944
|
+
model?: string;
|
|
917
945
|
}
|
|
918
946
|
|
|
919
947
|
interface IChatAdapterNextItemsReq {
|
|
920
|
-
|
|
948
|
+
models: IMindsetModelRef[];
|
|
921
949
|
systemPrompt: string;
|
|
922
950
|
tools: IMindsetTool[];
|
|
923
951
|
prevItems: IChatItem[];
|
|
@@ -931,9 +959,16 @@ interface IChatAdapter {
|
|
|
931
959
|
}
|
|
932
960
|
|
|
933
961
|
declare class ChatAdapter implements IChatAdapter {
|
|
934
|
-
nextItems(req: IChatAdapterNextItemsReq
|
|
935
|
-
|
|
936
|
-
|
|
962
|
+
nextItems(req: IChatAdapterNextItemsReq): Promise<IChatAdapterNextItemsRes>;
|
|
963
|
+
}
|
|
964
|
+
|
|
965
|
+
declare class ChatAdapterRegistry {
|
|
966
|
+
private adapters;
|
|
967
|
+
private order;
|
|
968
|
+
register(provider: string, adapter: IChatAdapter): void;
|
|
969
|
+
get(provider: string): IChatAdapter | undefined;
|
|
970
|
+
defaultProvider(): string | undefined;
|
|
971
|
+
size(): number;
|
|
937
972
|
}
|
|
938
973
|
|
|
939
974
|
type IChatItemData = IEntityData & IChatItem;
|
|
@@ -1001,8 +1036,47 @@ declare class ChatOperator {
|
|
|
1001
1036
|
removeAssociation(association: IChatAssociation): Promise<void>;
|
|
1002
1037
|
}
|
|
1003
1038
|
|
|
1039
|
+
declare class UnionChatAdapter implements IChatAdapter {
|
|
1040
|
+
private registry;
|
|
1041
|
+
private logger;
|
|
1042
|
+
constructor(registry: ChatAdapterRegistry);
|
|
1043
|
+
nextItems(req: IChatAdapterNextItemsReq): Promise<IChatAdapterNextItemsRes>;
|
|
1044
|
+
private groupByProvider;
|
|
1045
|
+
}
|
|
1046
|
+
|
|
1047
|
+
interface IExtractChatMessageTextOptions {
|
|
1048
|
+
supportedImageMimeTypes?: readonly string[];
|
|
1049
|
+
supportedDocumentMimeTypes?: readonly string[];
|
|
1050
|
+
}
|
|
1051
|
+
declare function extractChatMessageText(message: IChatMessage, options?: IExtractChatMessageTextOptions): string;
|
|
1052
|
+
|
|
1053
|
+
declare function isChatMessageEmpty(message: IChatMessage): boolean;
|
|
1054
|
+
|
|
1055
|
+
/**
|
|
1056
|
+
* Returns true when an error from a chat adapter is worth retrying with another
|
|
1057
|
+
* model or another adapter (transient/availability issues), false when retrying
|
|
1058
|
+
* would just propagate the same configuration problem (auth, validation).
|
|
1059
|
+
*/
|
|
1060
|
+
declare function isRetryableError(err: unknown): boolean;
|
|
1061
|
+
|
|
1062
|
+
interface IChatAdapterDecoratorConfig {
|
|
1063
|
+
provider: string;
|
|
1064
|
+
}
|
|
1065
|
+
declare function chatAdapter(config: IChatAdapterDecoratorConfig): (target: IConstructor<IChatAdapter>) => void;
|
|
1066
|
+
|
|
1004
1067
|
declare function chatBot(mindset: IConstructor<IMindset>): (target: object, propertyKey: string | symbol | undefined, parameterIndex: number) => void;
|
|
1005
1068
|
|
|
1069
|
+
interface IChatAdapterMetadata {
|
|
1070
|
+
constructor: IConstructor<IChatAdapter>;
|
|
1071
|
+
provider: string;
|
|
1072
|
+
}
|
|
1073
|
+
|
|
1074
|
+
declare class ChatAdapterMetadataStore {
|
|
1075
|
+
private adapters;
|
|
1076
|
+
save(metadata: IChatAdapterMetadata): void;
|
|
1077
|
+
get(ctor: IConstructor<IChatAdapter>): IChatAdapterMetadata | undefined;
|
|
1078
|
+
}
|
|
1079
|
+
|
|
1006
1080
|
interface IChatBotMetadata {
|
|
1007
1081
|
constructor: IConstructor<any>;
|
|
1008
1082
|
mindsetConstructor: IConstructor<IMindset>;
|
|
@@ -1015,15 +1089,9 @@ declare class ChatBotMetadataStore {
|
|
|
1015
1089
|
getChatBotsMetadata(): IChatBotMetadata[];
|
|
1016
1090
|
}
|
|
1017
1091
|
|
|
1018
|
-
declare function
|
|
1019
|
-
|
|
1020
|
-
interface IExtractChatMessageTextOptions {
|
|
1021
|
-
supportedImageMimeTypes?: readonly string[];
|
|
1022
|
-
supportedDocumentMimeTypes?: readonly string[];
|
|
1023
|
-
}
|
|
1024
|
-
declare function extractChatMessageText(message: IChatMessage, options?: IExtractChatMessageTextOptions): string;
|
|
1092
|
+
declare function runChatAdapters(adapters: IConstructor<IChatAdapter>[]): void;
|
|
1025
1093
|
|
|
1026
|
-
declare function
|
|
1094
|
+
declare function safeJsonParse<T = unknown>(json: string | undefined | null, context?: string): T;
|
|
1027
1095
|
|
|
1028
1096
|
interface IchatControllerConfig {
|
|
1029
1097
|
}
|
|
@@ -1206,6 +1274,55 @@ declare const pgStorage: AsyncLocalStorage<ClientMap>;
|
|
|
1206
1274
|
*/
|
|
1207
1275
|
declare function getClientMap(): ClientMap;
|
|
1208
1276
|
|
|
1277
|
+
declare function pgJsonRepository<P extends Entity<IEntityData>>(config: IPgRepositoryConfig<P>): (target: IConstructor<any>) => void;
|
|
1278
|
+
|
|
1279
|
+
declare function query(): (target: object, propertyKey: string | symbol) => void;
|
|
1280
|
+
|
|
1281
|
+
declare class PgJsonRepository<P extends Entity<IEntityData>> extends PgCrudRepository<P> {
|
|
1282
|
+
constructor(pool: Pool);
|
|
1283
|
+
}
|
|
1284
|
+
|
|
1285
|
+
interface IQueryMethodMetadata {
|
|
1286
|
+
repositoryConstructor: IConstructor<any>;
|
|
1287
|
+
functionName: string;
|
|
1288
|
+
}
|
|
1289
|
+
declare class PgRepositoryMetadataStore {
|
|
1290
|
+
private queryMethods;
|
|
1291
|
+
private repositoryConfigs;
|
|
1292
|
+
saveQueryMethodMetadata(metadata: IQueryMethodMetadata): void;
|
|
1293
|
+
saveRepositoryConfig<P extends Entity<IEntityData>>(ctor: IConstructor<any>, config: IPgRepositoryConfig<P>): void;
|
|
1294
|
+
getRepositoryConfig(ctor: IConstructor<any>): IPgRepositoryConfig<any> | undefined;
|
|
1295
|
+
getQueryMethods(ctor: IConstructor<any>): IQueryMethodMetadata[];
|
|
1296
|
+
}
|
|
1297
|
+
|
|
1298
|
+
type QueryPrefix = 'find' | 'findOne' | 'count' | 'exists' | 'delete';
|
|
1299
|
+
type QueryOperator = 'Equals' | 'Not' | 'Like' | 'NotLike' | 'In' | 'NotIn' | 'Gt' | 'Gte' | 'Lt' | 'Lte' | 'IsNull' | 'IsNotNull';
|
|
1300
|
+
type QueryConnector = 'And' | 'Or';
|
|
1301
|
+
interface IQueryCondition {
|
|
1302
|
+
field: string;
|
|
1303
|
+
operator: QueryOperator;
|
|
1304
|
+
connector?: QueryConnector;
|
|
1305
|
+
}
|
|
1306
|
+
interface IQueryOrderBy {
|
|
1307
|
+
field: string;
|
|
1308
|
+
direction: 'ASC' | 'DESC';
|
|
1309
|
+
}
|
|
1310
|
+
interface IQueryAst {
|
|
1311
|
+
prefix: QueryPrefix;
|
|
1312
|
+
conditions: IQueryCondition[];
|
|
1313
|
+
orderBy: IQueryOrderBy[];
|
|
1314
|
+
limit?: number;
|
|
1315
|
+
}
|
|
1316
|
+
|
|
1317
|
+
interface IBuiltQuery {
|
|
1318
|
+
sql: string;
|
|
1319
|
+
argCount: number;
|
|
1320
|
+
buildParams: (args: any[]) => any[];
|
|
1321
|
+
}
|
|
1322
|
+
declare function buildQuerySql(ast: IQueryAst, table: string, columns: string): IBuiltQuery;
|
|
1323
|
+
|
|
1324
|
+
declare function parseQueryMethodName(name: string): IQueryAst;
|
|
1325
|
+
|
|
1209
1326
|
/**
|
|
1210
1327
|
* Runs a function with a shared Postgres client for the given pool.
|
|
1211
1328
|
* Reuses the client if already present in the async context.
|
|
@@ -2256,4 +2373,4 @@ declare function HtmlModule(options: IHtmlModuleOptions): {
|
|
|
2256
2373
|
new (): {};
|
|
2257
2374
|
};
|
|
2258
2375
|
|
|
2259
|
-
export { AnthropicChatAdapter, ApiKey, ApiKeyGuardMiddleware, ApiKeyHandshakeGuardMiddleware, ApiKeyRepository, Async, AsyncMetadataStore, Auth, Chat, ChatAdapter, ChatBot, ChatBotMetadataStore, ChatItem, ChatMemory, ChatOperator, ChatRepository, ChatResolver, type ClientMap, CmdChannel, type ConfigReference, type ConfigReferenceType, ConfigResolver, Container, ControllerMetadataStore, CronJob, CronJobRepository, CustomError, DeepSeekChatAdapter, DescriptionMetadataStore, EXPRESS_REQ, EXPRESS_RES, Entity, Env, EnvWhatsAppRepository, type ErrorSeverity, 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 IChatAssociation, type IChatBot, type IChatBotMetadata, type IChatChannel, type IChatConnection, type IChatControllerMetadata, type IChatData, type IChatItem, type IChatItemData, type IChatItemType, type IChatMemory, type IChatMessage, type IChatMessageDocument, type IChatMessageFile, type IChatMessageImage, type IChatMessagesPrivateFile, type IChatMessagesPublicFile, type IChatRepository, type IChatType, type ICmdChannelMessage, type ICmdReceivedMessage, type ICommandConfig, type ICommandHandler, type ICommandHandlerConfig, type IConstructor, type ICronConfig, type ICronJobData, type ICrudRepository, type ICustomErrorData, type IDescriptionMetadata, type IEndPointConfig, type IEndPointMetadata, type IEntityData, type IEnvType, type IErrorHandlersConfig, type IErrorMonitor, type IErrorMonitorContext, type IExtractChatMessageTextOptions, 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 ILockerKey, 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 IScheduleAt, type IScheduleDelay, type ISendByWasenderRequest, type ISendWhatsAppRequest, type ISendWhatsAppTemplateRequest, type ISocketChannelConfig, type ISocketChannelMessage, type ISocketChannelReceivedMessage, type ISocketControllerConfig, type ISocketControllerMetadata, type ISocketEventConfig, type ISocketEventMetadata, type ISocketReceivedMessage, type IStorableData, type ITelegramChannelConfig, type ITelegramChannelMessage, type ITelegramReceivedMessage, type IValidateArrayOptions, type IValidateArrayOptionsWithItemsValidators, type IValidateInputShape, type IValidateIsInOptions, type IValidateIsRecordOptions, type IValidateMaxOptions, type IValidateMinOptions, type IValidationError, type IValidationResult, type IValidator, type IValidatorMetadata, type IWasenderChannelMessageListener, type IWasenderDeviceListMetadata, type IWasenderEvent, type IWasenderMessageContent, type IWasenderMessageContextInfo, type IWasenderMessageKey, type IWasenderMessageReceivedData, type IWasenderMessageReceivedEvent, type IWasenderQrUpdatedEvent, type IWhatsAppBusinessAccount, type IWhatsAppBusinessNumber, type IWhatsAppByWasenderChannelConfig, type IWhatsAppByWasenderReceivedMessage, type IWhatsAppChannelMessage, 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 IWhatsAppReceivedMessage, 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, OpenRouterChatAdapter, OpenaiChatAdapter, Password, type PasswordHashOptions, Persistent, PgApiKeyRepository, PgChatMemory, PgChatRepository, PgCronJobRepository, PgCrudRepository, PgJobRepository, PgJwtRefreshTokenRepository, PgLockKey, PgLocker, PgRepositoryBase, PgWhatsAppRepository, RamChatMemory, RamChatRepository, Random, RemoteApiKeyRepository, RestControllerMetadataStore, RestRequest, SocketChannel, SocketChannelConfig, SocketChannelMessageFile, SocketChannelReceivedMessage, SocketControllerMetadataStore, SocketServerConfig, SocketServerProvider, Storable, TelegramChannel, TelegramChannelConfig, ValidationMetadataStore, WHATSAPP_MESSAGE_EVENT, WHATSAPP_PROXY_LISTEN_MESSAGE_EVENT, WHATSAPP_PROXY_SEND_MESSAGE_EVENT, WabotChatAdapter, WasenderWebhookController, WhatsApp, WhatsAppByWasenderChannel, WhatsAppByWasenderChannelConfig, WhatsAppChannel, WhatsAppReceiver, WhatsAppReceiverByCloudApi, WhatsAppReceiverByWabotProxy, WhatsAppReceiverByWasender, WhatsAppRepository, WhatsAppSender, WhatsAppSenderByCloudApi, WhatsAppSenderByWabotProxy, WhatsAppSenderByWasender, WhatsAppWabotProxyConnection, WhatsappChannelConfig, apiKeyGuard, apiKeyHandshakeGuard, bool, boolArr, chatBot, chatController, chatItemTypeOptions, cmd, cmdChannelName, command, commandHandler, container, cron, description, errorToPlainObject, extractChatMessageText, extractNumberFromWasenderMessageKey, getClientMap, getPgClient, handshakeMiddlewares, inject, injectable, isArray, isBoolean, isChatMessageEmpty, isDate, isIn, isModel, isNotEmpty, isNumber, isOptional, isPresent, isRecord, isString, jwtGuard, jwtHandshakeGuard, max, middleware, min, mindset, mindsetModule, modelInfo, num, numArr, obj, onDelete, onGet, onPost, onPut, onSocketEvent, pgStorage, readJsonFromFile, resolveConfigReferences, restController, runChatControllers, runCommandHandlers, runCronHandlers, runRestControllers, runSocketControllers, safeJsonParse, scoped, setupErrorHandlers, singleton, socket, socketChannelName, socketController, stopCommandHandlers, stopCronHandlers, str, strArr, telegram, telegramChannelName, validateAndTransform, validateArray, validateIsBoolean, validateIsDate, validateIsIn, validateIsNotEmpty, validateIsNumber, validateIsPresent, validateIsRecord, validateIsString, validateMax, validateMin, validateModel, whatsApp, whatsAppByWasender, whatsAppByWasenderChannelName, whatsAppChannelName, withPgClient, withPgTransaction, writeJsonToFile };
|
|
2376
|
+
export { AnthropicChatAdapter, ApiKey, ApiKeyGuardMiddleware, ApiKeyHandshakeGuardMiddleware, ApiKeyRepository, Async, AsyncMetadataStore, Auth, Chat, ChatAdapter, ChatAdapterMetadataStore, ChatAdapterRegistry, ChatBot, ChatBotMetadataStore, ChatItem, ChatMemory, ChatOperator, ChatRepository, ChatResolver, type ClientMap, CmdChannel, type ConfigReference, type ConfigReferenceType, ConfigResolver, Container, ControllerMetadataStore, CronJob, CronJobRepository, CustomError, DeepSeekChatAdapter, DescriptionMetadataStore, EXPRESS_REQ, EXPRESS_RES, Entity, Env, EnvWhatsAppRepository, type ErrorSeverity, ExpressProvider, GoogleChatAdapter, type GoogleChatAdapterV2Options, HtmlModule, HttpServerProvider, type IApiKeyData, type IApiKeyRepository, type IArrayValidationError, type IArrayValidationResult, type IBotMessageItem, type IBuiltQuery, type IChannelMessage, type IChannelMetadata, type IChatAdapter, type IChatAdapterDecoratorConfig, type IChatAdapterMetadata, type IChatAdapterNextItemsReq, type IChatAdapterNextItemsRes, type IChatAssociation, type IChatBot, type IChatBotMetadata, type IChatChannel, type IChatConnection, type IChatControllerMetadata, type IChatData, type IChatItem, type IChatItemData, type IChatItemType, type IChatMemory, type IChatMessage, type IChatMessageDocument, type IChatMessageFile, type IChatMessageImage, type IChatMessagesPrivateFile, type IChatMessagesPublicFile, type IChatRepository, type IChatType, type ICmdChannelMessage, type ICmdReceivedMessage, type ICommandConfig, type ICommandHandler, type ICommandHandlerConfig, type IConstructor, type ICronConfig, type ICronJobData, type ICrudRepository, type ICustomErrorData, type IDescriptionMetadata, type IEndPointConfig, type IEndPointMetadata, type IEntityData, type IEnvType, type IErrorHandlersConfig, type IErrorMonitor, type IErrorMonitorContext, type IExtractChatMessageTextOptions, 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 ILockerKey, type IMessageContext, type IMiddleware, type IMiddlewareMetadata, type IMindset, type IMindsetConfig, type IMindsetIdentity, type IMindsetLlm, type IMindsetMetadata, type IMindsetModelKind, type IMindsetModelRef, type IMindsetModels, type IMindsetModuleConfig, type IMindsetModuleMetadata, type IMindsetTool, type IMindsetToolParameter, type IModelValidationError, type IModelValidationResult, type IModelValidatorsInfo, type IMoneyData, type IPersistentData, type IPgRepositoryConfig, type IPropertyValidatorInfo, type IQueryAst, type IQueryCondition, type IQueryMethodMetadata, type IQueryOrderBy, type IReceivedMessage, type IRemoteApiKeyFetcher, type IRestControllerConfig, type IRestControllerMetadata, type IScheduleAt, type IScheduleDelay, type ISendByWasenderRequest, type ISendWhatsAppRequest, type ISendWhatsAppTemplateRequest, type ISocketChannelConfig, type ISocketChannelMessage, type ISocketChannelReceivedMessage, type ISocketControllerConfig, type ISocketControllerMetadata, type ISocketEventConfig, type ISocketEventMetadata, type ISocketReceivedMessage, type IStorableData, type ITelegramChannelConfig, type ITelegramChannelMessage, type ITelegramReceivedMessage, type IValidateArrayOptions, type IValidateArrayOptionsWithItemsValidators, type IValidateInputShape, type IValidateIsInOptions, type IValidateIsRecordOptions, type IValidateMaxOptions, type IValidateMinOptions, type IValidationError, type IValidationResult, type IValidator, type IValidatorMetadata, type IWasenderChannelMessageListener, type IWasenderDeviceListMetadata, type IWasenderEvent, type IWasenderMessageContent, type IWasenderMessageContextInfo, type IWasenderMessageKey, type IWasenderMessageReceivedData, type IWasenderMessageReceivedEvent, type IWasenderQrUpdatedEvent, type IWhatsAppBusinessAccount, type IWhatsAppBusinessNumber, type IWhatsAppByWasenderChannelConfig, type IWhatsAppByWasenderReceivedMessage, type IWhatsAppChannelMessage, 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 IWhatsAppReceivedMessage, 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, OpenRouterChatAdapter, OpenaiChatAdapter, Password, type PasswordHashOptions, Persistent, PgApiKeyRepository, PgChatMemory, PgChatRepository, PgCronJobRepository, PgCrudRepository, PgJobRepository, PgJsonRepository, PgJwtRefreshTokenRepository, PgLockKey, PgLocker, PgRepositoryBase, PgRepositoryMetadataStore, PgWhatsAppRepository, type QueryConnector, type QueryOperator, type QueryPrefix, RamChatMemory, RamChatRepository, Random, RemoteApiKeyRepository, RestControllerMetadataStore, RestRequest, SocketChannel, SocketChannelConfig, SocketChannelMessageFile, SocketChannelReceivedMessage, SocketControllerMetadataStore, SocketServerConfig, SocketServerProvider, Storable, TelegramChannel, TelegramChannelConfig, UnionChatAdapter, ValidationMetadataStore, WHATSAPP_MESSAGE_EVENT, WHATSAPP_PROXY_LISTEN_MESSAGE_EVENT, WHATSAPP_PROXY_SEND_MESSAGE_EVENT, WabotChatAdapter, WasenderWebhookController, WhatsApp, WhatsAppByWasenderChannel, WhatsAppByWasenderChannelConfig, WhatsAppChannel, WhatsAppReceiver, WhatsAppReceiverByCloudApi, WhatsAppReceiverByWabotProxy, WhatsAppReceiverByWasender, WhatsAppRepository, WhatsAppSender, WhatsAppSenderByCloudApi, WhatsAppSenderByWabotProxy, WhatsAppSenderByWasender, WhatsAppWabotProxyConnection, WhatsappChannelConfig, apiKeyGuard, apiKeyHandshakeGuard, bool, boolArr, buildQuerySql, chatAdapter, chatBot, chatController, chatItemTypeOptions, cmd, cmdChannelName, command, commandHandler, container, cron, description, errorToPlainObject, extractChatMessageText, extractNumberFromWasenderMessageKey, getClientMap, getPgClient, handshakeMiddlewares, inject, injectable, isArray, isBoolean, isChatMessageEmpty, isDate, isIn, isModel, isNotEmpty, isNumber, isOptional, isPresent, isRecord, isRetryableError, isString, jwtGuard, jwtHandshakeGuard, max, middleware, min, mindset, mindsetModule, modelInfo, num, numArr, obj, onDelete, onGet, onPost, onPut, onSocketEvent, parseQueryMethodName, pgJsonRepository, pgStorage, query, readJsonFromFile, resolveConfigReferences, restController, runChatAdapters, runChatControllers, runCommandHandlers, runCronHandlers, runRestControllers, runSocketControllers, safeJsonParse, scoped, setupErrorHandlers, singleton, socket, socketChannelName, socketController, stopCommandHandlers, stopCronHandlers, str, strArr, telegram, telegramChannelName, validateAndTransform, validateArray, validateIsBoolean, validateIsDate, validateIsIn, validateIsNotEmpty, validateIsNumber, validateIsPresent, validateIsRecord, validateIsString, validateMax, validateMin, validateModel, whatsApp, whatsAppByWasender, whatsAppByWasenderChannelName, whatsAppChannelName, withPgClient, withPgTransaction, writeJsonToFile };
|
package/dist/src/index.js
CHANGED
|
@@ -57,17 +57,23 @@ export { runCommandHandlers, stopCommandHandlers } from './feature/async/runComm
|
|
|
57
57
|
export { runCronHandlers, stopCronHandlers } from './feature/async/runCronHandlers.js';
|
|
58
58
|
export { Chat } from './feature/chat-bot/Chat.js';
|
|
59
59
|
export { ChatAdapter } from './feature/chat-bot/ChatAdapter.js';
|
|
60
|
+
export { ChatAdapterRegistry } from './feature/chat-bot/ChatAdapterRegistry.js';
|
|
60
61
|
export { ChatBot } from './feature/chat-bot/ChatBot.js';
|
|
61
62
|
export { ChatItem } from './feature/chat-bot/ChatItem.js';
|
|
62
63
|
export { ChatMemory } from './feature/chat-bot/ChatMemory.js';
|
|
63
64
|
export { ChatOperator } from './feature/chat-bot/ChatOperator.js';
|
|
64
65
|
export { ChatRepository } from './feature/chat-bot/ChatRepository.js';
|
|
65
66
|
export { chatItemTypeOptions } from './feature/chat-bot/IChatItem.js';
|
|
67
|
+
export { UnionChatAdapter } from './feature/chat-bot/UnionChatAdapter.js';
|
|
68
|
+
export { extractChatMessageText } from './feature/chat-bot/extractChatMessageText.js';
|
|
69
|
+
export { isChatMessageEmpty } from './feature/chat-bot/isChatMessageEmpty.js';
|
|
70
|
+
export { isRetryableError } from './feature/chat-bot/isRetryableError.js';
|
|
71
|
+
export { chatAdapter } from './feature/chat-bot/metadata/@chatAdapter.js';
|
|
66
72
|
export { chatBot } from './feature/chat-bot/metadata/@chatBot.js';
|
|
73
|
+
export { ChatAdapterMetadataStore } from './feature/chat-bot/metadata/ChatAdapterMetadataStore.js';
|
|
67
74
|
export { ChatBotMetadataStore } from './feature/chat-bot/metadata/ChatBotMetadataStore.js';
|
|
75
|
+
export { runChatAdapters } from './feature/chat-bot/runChatAdapters.js';
|
|
68
76
|
export { safeJsonParse } from './feature/chat-bot/safeJsonParse.js';
|
|
69
|
-
export { extractChatMessageText } from './feature/chat-bot/extractChatMessageText.js';
|
|
70
|
-
export { isChatMessageEmpty } from './feature/chat-bot/isChatMessageEmpty.js';
|
|
71
77
|
export { chatController } from './feature/chat-controller/metadata/controller/@chatController.js';
|
|
72
78
|
export { ControllerMetadataStore } from './feature/chat-controller/metadata/ControllerMetadataStore.js';
|
|
73
79
|
export { ChatResolver } from './feature/chat-controller/ChatResolver.js';
|
|
@@ -86,6 +92,12 @@ export { PgLocker } from './feature/pg/PgLocker.js';
|
|
|
86
92
|
export { PgLockKey } from './feature/pg/PgLockKey.js';
|
|
87
93
|
export { PgRepositoryBase } from './feature/pg/PgRepositoryBase.js';
|
|
88
94
|
export { getClientMap, pgStorage } from './feature/pg/pgStorage.js';
|
|
95
|
+
export { pgJsonRepository } from './feature/pg/query/@pgJsonRepository.js';
|
|
96
|
+
export { query } from './feature/pg/query/@query.js';
|
|
97
|
+
export { PgJsonRepository } from './feature/pg/query/PgJsonRepository.js';
|
|
98
|
+
export { PgRepositoryMetadataStore } from './feature/pg/query/PgRepositoryMetadataStore.js';
|
|
99
|
+
export { buildQuerySql } from './feature/pg/query/buildQuerySql.js';
|
|
100
|
+
export { parseQueryMethodName } from './feature/pg/query/parseQueryMethodName.js';
|
|
89
101
|
export { getPgClient, withPgClient } from './feature/pg/withPgClient.js';
|
|
90
102
|
export { withPgTransaction } from './feature/pg/withPgTransaction.js';
|
|
91
103
|
export { onGet } from './feature/rest-controller/metadata/@onGet.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __exports as CronFileParser } from '../../../_virtual/CronFileParser.js';
|
|
2
2
|
import { __require as requireCronExpressionParser } from './CronExpressionParser.js';
|
|
3
3
|
import require$$1 from 'fs/promises';
|
|
4
|
-
import
|
|
4
|
+
import require$$2 from 'fs';
|
|
5
5
|
|
|
6
6
|
var hasRequiredCronFileParser;
|
|
7
7
|
|
|
@@ -67,7 +67,7 @@ function requireCronFileParser () {
|
|
|
67
67
|
*/
|
|
68
68
|
static parseFileSync(filePath) {
|
|
69
69
|
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
70
|
-
const { readFileSync } =
|
|
70
|
+
const { readFileSync } = require$$2;
|
|
71
71
|
const data = readFileSync(filePath, 'utf8');
|
|
72
72
|
return CronFileParser.#parseContent(data);
|
|
73
73
|
}
|