@wabot-dev/framework 0.2.1-beta.1 → 0.2.1-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/dist/src/addon/auth/api-key/PgApiKeyRepository.js +1 -1
  2. package/dist/src/addon/chat-controller/cmd/@cmd.js +0 -1
  3. package/dist/src/addon/chat-controller/socket/@socket.js +0 -1
  4. package/dist/src/addon/chat-controller/telegram/@telegram.js +0 -1
  5. package/dist/src/addon/chat-controller/whatsapp/@whatsApp.js +0 -1
  6. package/dist/src/addon/chat-controller/whatsapp/cloud-api/WhatsAppSenderByCloudApi.js +0 -1
  7. package/dist/src/addon/chat-controller/whatsapp/proxy/WhatsAppSenderByWabotProxy.js +0 -1
  8. package/dist/src/addon/mindset/html/HtmlModule.js +5 -12
  9. package/dist/src/core/description/metadata/@description.js +21 -0
  10. package/dist/src/core/description/metadata/DescriptionMetadataStore.js +21 -0
  11. package/dist/src/core/validation/metadata/@isArray.js +1 -0
  12. package/dist/src/core/validation/metadata/@isModel.js +1 -0
  13. package/dist/src/core/validation/validators/is-boolean/@isBoolean.js +1 -0
  14. package/dist/src/core/validation/validators/is-date/@isDate.js +1 -0
  15. package/dist/src/core/validation/validators/is-number/@isNumber.js +1 -0
  16. package/dist/src/core/validation/validators/is-string/@isString.js +1 -0
  17. package/dist/src/feature/chat-bot/ChatBot.js +0 -1
  18. package/dist/src/feature/chat-controller/runChatControllers.js +0 -1
  19. package/dist/src/feature/mindset/MindsetOperator.js +39 -33
  20. package/dist/src/feature/mindset/metadata/MindsetMetadataStore.js +62 -115
  21. package/dist/src/feature/mindset/metadata/mindsets/@mindset.js +2 -5
  22. package/dist/src/feature/mindset/metadata/modules/@mindsetModule.js +2 -4
  23. package/dist/src/index.d.ts +76 -85
  24. package/dist/src/index.js +2 -6
  25. package/package.json +1 -2
  26. package/dist/src/feature/mindset/metadata/functions/@mindsetFunction.js +0 -21
  27. package/dist/src/feature/mindset/metadata/functions/decoratorNames.js +0 -3
  28. package/dist/src/feature/mindset/metadata/mindsets/decoratorNames.js +0 -3
  29. package/dist/src/feature/mindset/metadata/modules/decoratorNames.js +0 -3
  30. package/dist/src/feature/mindset/metadata/params/@param.js +0 -21
  31. package/dist/src/feature/mindset/metadata/params/decoratorNames.js +0 -4
@@ -1,9 +1,9 @@
1
1
  import { __decorate, __metadata } from 'tslib';
2
2
  import { PgCrudRepository } from '../../../feature/pg/PgCrudRepository.js';
3
3
  import { Pool } from 'pg';
4
- import { singleton } from 'tsyringe';
5
4
  import { ApiKey } from './ApiKey.js';
6
5
  import { CustomError } from '../../../core/error/CustomError.js';
6
+ import { singleton } from '../../../core/injection/index.js';
7
7
 
8
8
  let PgApiKeyRepository = class PgApiKeyRepository extends PgCrudRepository {
9
9
  constructor(pool) {
@@ -5,7 +5,6 @@ import '../../../core/auth/Auth.js';
5
5
  import '../../../feature/chat-bot/ChatBot.js';
6
6
  import 'uuid';
7
7
  import '../../../feature/chat-bot/metadata/ChatBotMetadataStore.js';
8
- import 'reflect-metadata';
9
8
  import '../../../feature/mindset/metadata/MindsetMetadataStore.js';
10
9
  import '../../../feature/mindset/MindsetOperator.js';
11
10
  import { CmdChannel } from './CmdChannel.js';
@@ -5,7 +5,6 @@ import '../../../core/auth/Auth.js';
5
5
  import '../../../feature/chat-bot/ChatBot.js';
6
6
  import 'uuid';
7
7
  import '../../../feature/chat-bot/metadata/ChatBotMetadataStore.js';
8
- import 'reflect-metadata';
9
8
  import '../../../feature/mindset/metadata/MindsetMetadataStore.js';
10
9
  import '../../../feature/mindset/MindsetOperator.js';
11
10
  import { SocketChannel } from './SocketChannel.js';
@@ -5,7 +5,6 @@ import '../../../core/auth/Auth.js';
5
5
  import '../../../feature/chat-bot/ChatBot.js';
6
6
  import 'uuid';
7
7
  import '../../../feature/chat-bot/metadata/ChatBotMetadataStore.js';
8
- import 'reflect-metadata';
9
8
  import '../../../feature/mindset/metadata/MindsetMetadataStore.js';
10
9
  import '../../../feature/mindset/MindsetOperator.js';
11
10
  import { TelegramChannel } from './TelegramChannel.js';
@@ -6,7 +6,6 @@ import '../../../core/auth/Auth.js';
6
6
  import '../../../feature/chat-bot/ChatBot.js';
7
7
  import 'uuid';
8
8
  import '../../../feature/chat-bot/metadata/ChatBotMetadataStore.js';
9
- import 'reflect-metadata';
10
9
  import '../../../feature/mindset/metadata/MindsetMetadataStore.js';
11
10
  import '../../../feature/mindset/MindsetOperator.js';
12
11
  import { WhatsAppChannel } from './WhatsAppChannel.js';
@@ -9,7 +9,6 @@ import '../../../../feature/chat-bot/ChatBot.js';
9
9
  import { ChatRepository } from '../../../../feature/chat-bot/ChatRepository.js';
10
10
  import 'uuid';
11
11
  import '../../../../feature/chat-bot/metadata/ChatBotMetadataStore.js';
12
- import 'reflect-metadata';
13
12
  import '../../../../feature/mindset/metadata/MindsetMetadataStore.js';
14
13
  import '../../../../feature/mindset/MindsetOperator.js';
15
14
  import { WhatsAppRepository } from '../WhatsAppRepository.js';
@@ -9,7 +9,6 @@ import '../../../../feature/chat-bot/metadata/ChatBotMetadataStore.js';
9
9
  import '../../../../feature/chat-controller/metadata/ControllerMetadataStore.js';
10
10
  import { ChatResolver } from '../../../../feature/chat-controller/ChatResolver.js';
11
11
  import '../../../../core/auth/Auth.js';
12
- import 'reflect-metadata';
13
12
  import '../../../../feature/mindset/metadata/MindsetMetadataStore.js';
14
13
  import '../../../../feature/mindset/MindsetOperator.js';
15
14
  import { WhatsAppRepository } from '../WhatsAppRepository.js';
@@ -1,10 +1,9 @@
1
1
  import { __decorate, __metadata } from 'tslib';
2
- import { mindsetFunction } from '../../../feature/mindset/metadata/functions/@mindsetFunction.js';
3
- import 'reflect-metadata';
2
+ import { description } from '../../../core/description/metadata/@description.js';
3
+ import '../../../core/description/metadata/DescriptionMetadataStore.js';
4
4
  import '../../../core/injection/index.js';
5
5
  import '../../../feature/mindset/metadata/MindsetMetadataStore.js';
6
6
  import { mindsetModule } from '../../../feature/mindset/metadata/modules/@mindsetModule.js';
7
- import { param } from '../../../feature/mindset/metadata/params/@param.js';
8
7
  import '../../../feature/mindset/MindsetOperator.js';
9
8
  import { convert } from 'html-to-text';
10
9
 
@@ -33,9 +32,7 @@ class KeywordsReq {
33
32
  keywords = '';
34
33
  }
35
34
  __decorate([
36
- param({
37
- description: 'Keywords separated by space',
38
- }),
35
+ description('Keywords separated by space'),
39
36
  __metadata("design:type", String)
40
37
  ], KeywordsReq.prototype, "keywords", void 0);
41
38
  function HtmlModule(options) {
@@ -52,17 +49,13 @@ function HtmlModule(options) {
52
49
  }
53
50
  };
54
51
  __decorate([
55
- mindsetFunction({
56
- description: `Search information using keywords in the document "${options.title}". Priorize this info.`,
57
- }),
52
+ description(`Search information using keywords in the document "${options.title}". Priorize this info.`),
58
53
  __metadata("design:type", Function),
59
54
  __metadata("design:paramtypes", [KeywordsReq]),
60
55
  __metadata("design:returntype", Promise)
61
56
  ], HtmlModuleIntern.prototype, _a, null);
62
57
  HtmlModuleIntern = __decorate([
63
- mindsetModule({
64
- description: `Search information using keywords in the document ${options.title}`,
65
- })
58
+ mindsetModule()
66
59
  ], HtmlModuleIntern);
67
60
  return HtmlModuleIntern;
68
61
  }
@@ -0,0 +1,21 @@
1
+ import { container } from '../../injection/index.js';
2
+ import { DescriptionMetadataStore } from './DescriptionMetadataStore.js';
3
+
4
+ function description(description) {
5
+ return (target, propertyKey) => {
6
+ const propertyName = propertyKey.toString();
7
+ const propertyType = Reflect.getMetadata('design:type', target, propertyName);
8
+ const functionArgsTypes = Reflect.getMetadata('design:paramtypes', target, propertyName);
9
+ const store = container.resolve(DescriptionMetadataStore);
10
+ store.saveDescriptionMetadata({
11
+ constructor: target.constructor,
12
+ propertyName,
13
+ propertyType,
14
+ functionArgsTypes,
15
+ functionReturnType: undefined,
16
+ description
17
+ });
18
+ };
19
+ }
20
+
21
+ export { description };
@@ -0,0 +1,21 @@
1
+ import { __decorate } from 'tslib';
2
+ import { singleton } from '../../injection/index.js';
3
+
4
+ let DescriptionMetadataStore = class DescriptionMetadataStore {
5
+ descriptions = new Map();
6
+ saveDescriptionMetadata(metadata) {
7
+ let ctorDescriptions = this.descriptions.get(metadata.constructor);
8
+ if (!ctorDescriptions) {
9
+ this.descriptions.set(metadata.constructor, (ctorDescriptions = []));
10
+ }
11
+ ctorDescriptions.unshift(metadata);
12
+ }
13
+ getModelDescriptions(model) {
14
+ return this.descriptions.get(model) ?? [];
15
+ }
16
+ };
17
+ DescriptionMetadataStore = __decorate([
18
+ singleton()
19
+ ], DescriptionMetadataStore);
20
+
21
+ export { DescriptionMetadataStore };
@@ -11,6 +11,7 @@ function isArray(options) {
11
11
  propertyName,
12
12
  validator: validateArray,
13
13
  validatorOptions: options,
14
+ typeDescriptor: 'array'
14
15
  });
15
16
  };
16
17
  }
@@ -11,6 +11,7 @@ function isModel(model) {
11
11
  propertyName,
12
12
  validator: validateModel,
13
13
  validatorOptions: store.getModelValidatorsInfo(model),
14
+ typeDescriptor: 'object'
14
15
  });
15
16
  };
16
17
  }
@@ -10,6 +10,7 @@ function isBoolean() {
10
10
  modelConstructor: target.constructor,
11
11
  propertyName,
12
12
  validator: validateIsBoolean,
13
+ validatorOptions: 'boolean',
13
14
  });
14
15
  };
15
16
  }
@@ -10,6 +10,7 @@ function isDate() {
10
10
  modelConstructor: target.constructor,
11
11
  propertyName,
12
12
  validator: validateIsDate,
13
+ typeDescriptor: 'date'
13
14
  });
14
15
  };
15
16
  }
@@ -10,6 +10,7 @@ function isNumber() {
10
10
  modelConstructor: target.constructor,
11
11
  propertyName,
12
12
  validator: validateIsNumber,
13
+ typeDescriptor: 'number'
13
14
  });
14
15
  };
15
16
  }
@@ -10,6 +10,7 @@ function isString() {
10
10
  modelConstructor: target.constructor,
11
11
  propertyName,
12
12
  validator: validateIsString,
13
+ typeDescriptor: 'string'
13
14
  });
14
15
  };
15
16
  }
@@ -1,5 +1,4 @@
1
1
  import { __decorate, __metadata } from 'tslib';
2
- import 'reflect-metadata';
3
2
  import { injectable } from '../../core/injection/index.js';
4
3
  import '../mindset/metadata/MindsetMetadataStore.js';
5
4
  import { MindsetOperator } from '../mindset/MindsetOperator.js';
@@ -6,7 +6,6 @@ import { ChatMemory } from '../chat-bot/ChatMemory.js';
6
6
  import { ChatRepository } from '../chat-bot/ChatRepository.js';
7
7
  import 'uuid';
8
8
  import { ChatBotMetadataStore } from '../chat-bot/metadata/ChatBotMetadataStore.js';
9
- import 'reflect-metadata';
10
9
  import '../mindset/metadata/MindsetMetadataStore.js';
11
10
  import { Mindset } from '../mindset/IMindset.js';
12
11
  import '../mindset/MindsetOperator.js';
@@ -2,6 +2,9 @@ import { __decorate, __metadata } from 'tslib';
2
2
  import { injectable } from '../../core/injection/index.js';
3
3
  import { Mindset } from './IMindset.js';
4
4
  import { MindsetMetadataStore } from './metadata/MindsetMetadataStore.js';
5
+ import { validateModel } from '../../core/validation/core/validateModel.js';
6
+ import '../../core/validation/metadata/ValidationMetadataStore.js';
7
+ import { CustomError } from '../../core/error/CustomError.js';
5
8
  import { Container } from '../../core/injection/Container.js';
6
9
 
7
10
  let MindsetOperator = class MindsetOperator {
@@ -11,7 +14,7 @@ let MindsetOperator = class MindsetOperator {
11
14
  constructor(mindset, container, metadataStore) {
12
15
  this.mindset = mindset;
13
16
  this.container = container;
14
- this.metadata = metadataStore.getMindsetMetadata(this.mindset.constructor);
17
+ this.metadata = metadataStore.getMindsetInfo(this.mindset.constructor);
15
18
  }
16
19
  identity() {
17
20
  return this.mindset.identity();
@@ -68,41 +71,36 @@ let MindsetOperator = class MindsetOperator {
68
71
  }
69
72
  tools() {
70
73
  return this.metadata.modules
71
- .map((module) => module.functions.map((fn) => this.tool(fn, module)))
74
+ .map((module) => module.functions.map((fn) => {
75
+ return {
76
+ language: module.config?.language ?? 'english',
77
+ name: fn.name,
78
+ description: fn.description,
79
+ parameters: fn.argsDescriptions.map((x) => ({
80
+ type: this.paramType(x.typeDescriptor),
81
+ name: x.propertyName,
82
+ description: this.paramDescription(x.description, x.typeDescriptor),
83
+ })),
84
+ };
85
+ }))
72
86
  .flat();
73
87
  }
74
- tool(fn, module) {
75
- const description = fn.config.description.replaceAll('#', ' ');
76
- return {
77
- language: module.config.language ?? 'english',
78
- name: fn.name,
79
- description,
80
- parameters: fn.params.map((param) => this.toolParameter(param)),
81
- };
82
- }
83
- toolParameter(param) {
88
+ paramDescription(rawDescription, rawType) {
84
89
  let description = `
85
90
  ### description (in your main language)
86
- ${param.config.description.replaceAll('#', ' ')}
87
- `;
88
- const type = (() => {
89
- if (param.type === Number)
90
- return 'number';
91
- if (param.type === String)
92
- return 'string';
93
- if (param.type === Date) {
94
- description = `${description}
91
+ ${rawDescription.replaceAll('#', ' ')}
92
+ `;
93
+ if (rawType === 'date') {
94
+ description = `${description}
95
95
  ### format: ISO 8681 - YYYY-MM-DDTHH:mm:ssZ
96
- `;
97
- return 'string';
98
- }
99
- throw new Error(`Unsupported type`);
100
- })();
101
- return {
102
- type,
103
- name: param.name,
104
- description,
105
- };
96
+ `;
97
+ }
98
+ return description;
99
+ }
100
+ paramType(rawType) {
101
+ if (rawType === 'date')
102
+ return 'string';
103
+ return rawType;
106
104
  }
107
105
  async callFunction(name, params) {
108
106
  const fnMetadata = this.metadata.modules
@@ -112,9 +110,17 @@ let MindsetOperator = class MindsetOperator {
112
110
  if (!fnMetadata) {
113
111
  throw new Error(`Function ${name} not found`);
114
112
  }
115
- const paramsObj = JSON.parse(params);
116
- const module = this.container.resolve(fnMetadata.moduleConstructor);
117
113
  try {
114
+ let paramsObj = JSON.parse(params);
115
+ const modelValidationInfo = fnMetadata.argsValidatorsInfo;
116
+ if (modelValidationInfo) {
117
+ const validation = validateModel(paramsObj, modelValidationInfo);
118
+ if (validation.error) {
119
+ throw new CustomError({ message: 'IA Params Are invalid', info: validation.error });
120
+ }
121
+ paramsObj = validation.value;
122
+ }
123
+ const module = this.container.resolve(fnMetadata.moduleConstructor);
118
124
  const response = await module[name](paramsObj);
119
125
  if (!response) {
120
126
  return 'success';
@@ -1,134 +1,81 @@
1
- import { __decorate } from 'tslib';
1
+ import { __decorate, __metadata } from 'tslib';
2
2
  import { singleton } from '../../../core/injection/index.js';
3
- import { MINDSET_FUNCTION_DECORATION_FUNCTION } from './functions/decoratorNames.js';
4
- import { MINDSET_DECORATION_MINDSET } from './mindsets/decoratorNames.js';
5
- import { MINDSET_MODULE_DECORATION_MODULE } from './modules/decoratorNames.js';
3
+ import { DescriptionMetadataStore } from '../../../core/description/metadata/DescriptionMetadataStore.js';
4
+ import { ValidationMetadataStore } from '../../../core/validation/metadata/ValidationMetadataStore.js';
6
5
 
7
6
  let MindsetMetadataStore = class MindsetMetadataStore {
8
- paramsDecorations = new Map();
9
- functionsDecorations = new Map();
10
- modulesDecorations = new Map();
11
- mindsetsDecorations = new Map();
12
- saveParamDecoration(paramDecoration) {
13
- let paramsMap = this.paramsDecorations.get(paramDecoration.constructor);
14
- if (!paramsMap) {
15
- paramsMap = new Map();
16
- this.paramsDecorations.set(paramDecoration.constructor, paramsMap);
17
- }
18
- let decorations = paramsMap.get(paramDecoration.paramName);
19
- if (!decorations) {
20
- decorations = [];
21
- paramsMap.set(paramDecoration.paramName, decorations);
22
- }
23
- decorations.push(paramDecoration);
7
+ descriptionMetadataStore;
8
+ validationMetadataStore;
9
+ modules = new Map();
10
+ mindsets = new Map();
11
+ constructor(descriptionMetadataStore, validationMetadataStore) {
12
+ this.descriptionMetadataStore = descriptionMetadataStore;
13
+ this.validationMetadataStore = validationMetadataStore;
24
14
  }
25
- saveFunctionDecoration(functionDecoration) {
26
- let functionsMap = this.functionsDecorations.get(functionDecoration.constructor);
27
- if (!functionsMap) {
28
- functionsMap = new Map();
29
- this.functionsDecorations.set(functionDecoration.constructor, functionsMap);
30
- }
31
- let decorations = functionsMap.get(functionDecoration.functionName);
32
- if (!decorations) {
33
- decorations = [];
34
- functionsMap.set(functionDecoration.functionName, decorations);
35
- }
36
- decorations.push(functionDecoration);
15
+ saveModuleMetadata(metadata) {
16
+ this.modules.set(metadata.constructor, metadata);
37
17
  }
38
- saveModuleDecoration(moduleDecoration) {
39
- let modulesDecorations = this.modulesDecorations.get(moduleDecoration.constructor);
40
- if (!modulesDecorations) {
41
- modulesDecorations = [];
42
- this.modulesDecorations.set(moduleDecoration.constructor, modulesDecorations);
43
- }
44
- modulesDecorations.push(moduleDecoration);
45
- }
46
- saveMindsetDecoration(mindsetDecoration) {
47
- let mindsetsDecorations = this.mindsetsDecorations.get(mindsetDecoration.constructor);
48
- if (!mindsetsDecorations) {
49
- mindsetsDecorations = [];
50
- this.mindsetsDecorations.set(mindsetDecoration.constructor, mindsetsDecorations);
51
- }
52
- mindsetsDecorations.push(mindsetDecoration);
18
+ saveMindsetMetadata(metadata) {
19
+ this.mindsets.set(metadata.constructor, metadata);
53
20
  }
54
- getRequestParamsMetadata(requestConstructor) {
55
- const paramsMap = this.paramsDecorations.get(requestConstructor);
56
- if (!paramsMap) {
57
- return [];
58
- }
59
- const paramsMetadata = [];
60
- paramsMap.forEach((decorations, paramName) => {
61
- const paramMainDecoration = decorations.find((decoration) => decoration.decorationConfig);
62
- if (!paramMainDecoration) {
63
- return;
64
- }
65
- paramsMetadata.push({
66
- config: paramMainDecoration.decorationConfig,
67
- name: paramName,
68
- type: paramMainDecoration.paramType,
69
- });
70
- // TODO: add support for validation decorators
71
- });
72
- return paramsMetadata;
73
- }
74
- getFunctionsMetadata(moduleConstructor) {
75
- const functionsMap = this.functionsDecorations.get(moduleConstructor);
76
- if (!functionsMap) {
77
- return [];
78
- }
79
- const functionsMetadata = [];
80
- functionsMap.forEach((decorations) => {
81
- const mainDecoration = decorations.find((decoration) => decoration.decorationName === MINDSET_FUNCTION_DECORATION_FUNCTION);
82
- if (!mainDecoration) {
83
- return;
84
- }
85
- functionsMetadata.push({
86
- moduleConstructor: mainDecoration.constructor,
87
- config: mainDecoration.decorationConfig,
88
- name: mainDecoration.functionName,
89
- requestConstructor: mainDecoration.paramsTypes[0],
90
- params: mainDecoration.paramsTypes[0]
91
- ? this.getRequestParamsMetadata(mainDecoration.paramsTypes[0])
92
- : [],
93
- });
94
- });
95
- return functionsMetadata;
96
- }
97
- getModuleMetadata(moduleConstructor) {
98
- const decorations = this.modulesDecorations.get(moduleConstructor);
99
- if (!decorations) {
100
- throw new Error(`Module ${moduleConstructor.name} not found`);
101
- }
102
- const mainDecoration = decorations.find((decoration) => decoration.decorationName === MINDSET_MODULE_DECORATION_MODULE);
103
- if (!mainDecoration) {
104
- throw new Error(`Module ${moduleConstructor.name} not found`);
21
+ getModuleInfo(moduleCtor) {
22
+ const module = this.modules.get(moduleCtor);
23
+ if (!module) {
24
+ throw new Error(`not found mindsetModule info for ${moduleCtor.name}`);
105
25
  }
26
+ const descriptions = this.descriptionMetadataStore.getModelDescriptions(moduleCtor);
27
+ const functions = descriptions.filter((x) => x.propertyType === Function);
106
28
  return {
107
- constructor: moduleConstructor,
108
- config: mainDecoration.decorationConfig,
109
- functions: this.getFunctionsMetadata(moduleConstructor),
29
+ config: module.config,
30
+ functions: functions.map((x) => {
31
+ if (x.functionArgsTypes && x.functionArgsTypes.length > 1) {
32
+ throw new Error(`invalid mindset function ${x.propertyName}, should have none or one object parámeter`);
33
+ }
34
+ const functionArgsModel = x.functionArgsTypes && x.functionArgsTypes.length === 1 ? x.functionArgsTypes[0] : null;
35
+ const argsDescriptions = (functionArgsModel &&
36
+ this.descriptionMetadataStore.getModelDescriptions(functionArgsModel)) ??
37
+ [];
38
+ const functionArgsModelValidatorsInfo = functionArgsModel &&
39
+ this.validationMetadataStore.getModelValidatorsInfo(functionArgsModel);
40
+ const argsValidators = functionArgsModelValidatorsInfo?.properties ?? {};
41
+ const argsDescriptionsWithTypes = argsDescriptions.map((argDescription) => {
42
+ const argValidator = argsValidators[argDescription.propertyName];
43
+ const typeValidator = argValidator?.validators?.find((x) => x.typeDescriptor);
44
+ const typeDescriptor = typeValidator?.typeDescriptor;
45
+ if (!typeDescriptor) {
46
+ throw new Error(`the property '${argDescription.constructor.name}.${argDescription.propertyName}' should have a type validator`);
47
+ }
48
+ return { ...argDescription, typeDescriptor };
49
+ });
50
+ if (argsDescriptions.length !== Object.keys(argsValidators).length) {
51
+ throw new Error(`the model '${moduleCtor.name}' have properties without descriptions`);
52
+ }
53
+ return {
54
+ moduleConstructor: moduleCtor,
55
+ function: x,
56
+ name: x.propertyName,
57
+ description: x.description,
58
+ argsDescriptions: argsDescriptionsWithTypes,
59
+ argsValidatorsInfo: functionArgsModelValidatorsInfo,
60
+ };
61
+ }),
110
62
  };
111
63
  }
112
- getMindsetMetadata(ctor) {
113
- const decorations = this.mindsetsDecorations.get(ctor);
114
- if (!decorations) {
115
- throw new Error(`Mindset ${ctor.name} not found`);
116
- }
117
- const mainDecoration = decorations.find((decoration) => decoration.decorationName === MINDSET_DECORATION_MINDSET);
118
- if (!mainDecoration) {
119
- throw new Error(`Mindset ${ctor.name} not found`);
64
+ getMindsetInfo(mindsetCtor) {
65
+ const mindset = this.mindsets.get(mindsetCtor);
66
+ if (!mindset) {
67
+ throw new Error(`not found mindset info for ${mindsetCtor.name}`);
120
68
  }
121
69
  return {
122
- constructor: ctor,
123
- config: mainDecoration.decorationConfig,
124
- modules: mainDecoration.decorationConfig.modules
125
- ? mainDecoration.decorationConfig.modules.map((module) => this.getModuleMetadata(module))
126
- : [],
70
+ config: mindset.config,
71
+ modules: mindset.config?.modules?.map((x) => this.getModuleInfo(x)) ?? [],
127
72
  };
128
73
  }
129
74
  };
130
75
  MindsetMetadataStore = __decorate([
131
- singleton()
76
+ singleton(),
77
+ __metadata("design:paramtypes", [DescriptionMetadataStore,
78
+ ValidationMetadataStore])
132
79
  ], MindsetMetadataStore);
133
80
 
134
81
  export { MindsetMetadataStore };
@@ -1,15 +1,12 @@
1
- import 'reflect-metadata';
2
1
  import { container, injectable } from '../../../../core/injection/index.js';
3
2
  import { MindsetMetadataStore } from '../MindsetMetadataStore.js';
4
- import { MINDSET_DECORATION_MINDSET } from './decoratorNames.js';
5
3
 
6
4
  function mindset(config) {
7
5
  return function (target) {
8
6
  const store = container.resolve(MindsetMetadataStore);
9
- store.saveMindsetDecoration({
10
- decorationName: MINDSET_DECORATION_MINDSET,
7
+ store.saveMindsetMetadata({
11
8
  constructor: target,
12
- decorationConfig: config ?? {},
9
+ config,
13
10
  });
14
11
  injectable()(target);
15
12
  };
@@ -1,14 +1,12 @@
1
1
  import { container, injectable } from '../../../../core/injection/index.js';
2
2
  import { MindsetMetadataStore } from '../MindsetMetadataStore.js';
3
- import { MINDSET_MODULE_DECORATION_MODULE } from './decoratorNames.js';
4
3
 
5
4
  function mindsetModule(config) {
6
5
  return function (target) {
7
6
  const store = container.resolve(MindsetMetadataStore);
8
- store.saveModuleDecoration({
9
- decorationName: MINDSET_MODULE_DECORATION_MODULE,
7
+ store.saveModuleMetadata({
10
8
  constructor: target,
11
- decorationConfig: config,
9
+ config: config,
12
10
  });
13
11
  injectable()(target);
14
12
  };
@@ -172,6 +172,7 @@ interface IPropertyValidatorInfo {
172
172
  propertyName: string;
173
173
  validator: IValidator;
174
174
  validatorOptions?: any;
175
+ typeDescriptor?: string;
175
176
  }
176
177
  type IModelValidatorsInfo<V> = {
177
178
  modelConstructor: IConstructor<V>;
@@ -203,6 +204,7 @@ interface IValidatorMetadata {
203
204
  propertyName: string;
204
205
  validator: IValidator;
205
206
  validatorOptions?: any;
207
+ typeDescriptor?: string;
206
208
  }
207
209
 
208
210
  declare class ValidationMetadataStore {
@@ -315,6 +317,23 @@ interface ICrudRepository<T> {
315
317
  delete(item: T): Promise<void>;
316
318
  }
317
319
 
320
+ declare function description(description: string): (target: any, propertyKey: string | symbol) => void;
321
+
322
+ interface IDescriptionMetadata {
323
+ constructor: IConstructor<any>;
324
+ propertyName: string;
325
+ propertyType?: Function;
326
+ functionArgsTypes?: Function[];
327
+ functionReturnType?: Function;
328
+ description: string;
329
+ }
330
+
331
+ declare class DescriptionMetadataStore {
332
+ private descriptions;
333
+ saveDescriptionMetadata(metadata: IDescriptionMetadata): void;
334
+ getModelDescriptions(model: IConstructor<any>): IDescriptionMetadata[];
335
+ }
336
+
318
337
  interface ICommandConfig {
319
338
  name?: string;
320
339
  }
@@ -431,22 +450,6 @@ declare class Chat extends Entity<IChatData> {
431
450
  validate(): void;
432
451
  }
433
452
 
434
- interface IMindsetFunctionConfig {
435
- description: string;
436
- }
437
-
438
- declare function mindsetFunction(config: IMindsetFunctionConfig): (target: object, propertyKey: string | symbol) => void;
439
-
440
- declare const MINDSET_FUNCTION_DECORATION_FUNCTION = "mindsetFunction";
441
-
442
- interface IMindsetFunctionDecoration {
443
- decorationName: string;
444
- functionName: string;
445
- constructor: Function;
446
- paramsTypes: Function[];
447
- decorationConfig: any;
448
- }
449
-
450
453
  interface IMindsetIdentity {
451
454
  name: string;
452
455
  language: string;
@@ -479,84 +482,71 @@ interface IMindsetConfig {
479
482
 
480
483
  declare function mindset(config?: IMindsetConfig): (target: IConstructor<IMindset>) => void;
481
484
 
482
- declare const MINDSET_DECORATION_MINDSET = "mindset";
483
-
484
- interface IMindsetDecoration {
485
- decorationName: string;
486
- constructor: Function;
487
- decorationConfig: IMindsetConfig;
485
+ interface IMindsetMetadata {
486
+ constructor: IConstructor<IMindset>;
487
+ config?: IMindsetConfig;
488
488
  }
489
489
 
490
490
  interface IMindsetModuleConfig {
491
- description: string;
492
491
  language?: string;
493
492
  }
494
493
 
495
- declare function mindsetModule<A>(config: IMindsetModuleConfig): (target: IConstructor<A>) => void;
496
-
497
- declare const MINDSET_MODULE_DECORATION_MODULE = "mindsetModule";
494
+ declare function mindsetModule<A>(config?: IMindsetModuleConfig): (target: IConstructor<A>) => void;
498
495
 
499
- interface IMindsetModuleDecoration {
500
- decorationName: string;
501
- constructor: Function;
502
- decorationConfig: any;
503
- }
504
-
505
- interface IParamConfig {
506
- name?: string;
507
- optional?: boolean;
508
- description: string;
509
- }
510
-
511
- declare function param(config: IParamConfig): PropertyDecorator;
512
-
513
- interface IParamDecoration {
514
- decorationName: string;
515
- paramType: any;
516
- paramName: string;
517
- constructor: Function;
518
- decorationConfig: any;
519
- }
520
-
521
- declare const PARAM_DECORATION_IS_OPTIONAL = "isOptional";
522
- declare const PARAM_DECORATION_PARAM = "param";
523
-
524
- interface IMindsetFunctionParamMetadata {
525
- config: IParamConfig;
526
- name: string;
527
- type: Function;
528
- }
529
- interface IMindsetFunctionMetadata {
530
- moduleConstructor: Function;
531
- requestConstructor?: Function;
532
- name: string;
533
- config: IMindsetFunctionConfig;
534
- params: IMindsetFunctionParamMetadata[];
535
- }
536
496
  interface IMindsetModuleMetadata {
537
497
  constructor: Function;
538
- config: IMindsetModuleConfig;
539
- functions: IMindsetFunctionMetadata[];
540
- }
541
- interface IMindsetMetadata {
542
- constructor: IConstructor<IMindset>;
543
- config: IMindsetConfig;
544
- modules: IMindsetModuleMetadata[];
498
+ config?: IMindsetModuleConfig;
545
499
  }
546
500
 
547
501
  declare class MindsetMetadataStore {
548
- private readonly paramsDecorations;
549
- private readonly functionsDecorations;
550
- private readonly modulesDecorations;
551
- private readonly mindsetsDecorations;
552
- saveParamDecoration(paramDecoration: IParamDecoration): void;
553
- saveFunctionDecoration(functionDecoration: IMindsetFunctionDecoration): void;
554
- saveModuleDecoration(moduleDecoration: IMindsetModuleDecoration): void;
555
- saveMindsetDecoration(mindsetDecoration: IMindsetDecoration): void;
556
- getRequestParamsMetadata(requestConstructor: Function): IMindsetFunctionParamMetadata[];
557
- getFunctionsMetadata(moduleConstructor: Function): IMindsetFunctionMetadata[];
558
- getModuleMetadata(moduleConstructor: Function): IMindsetModuleMetadata;
559
- getMindsetMetadata(ctor: Function): IMindsetMetadata;
502
+ private descriptionMetadataStore;
503
+ private validationMetadataStore;
504
+ private readonly modules;
505
+ private readonly mindsets;
506
+ constructor(descriptionMetadataStore: DescriptionMetadataStore, validationMetadataStore: ValidationMetadataStore);
507
+ saveModuleMetadata(metadata: IMindsetModuleMetadata): void;
508
+ saveMindsetMetadata(metadata: IMindsetMetadata): void;
509
+ getModuleInfo(moduleCtor: IConstructor<any>): {
510
+ config: IMindsetModuleConfig | undefined;
511
+ functions: {
512
+ moduleConstructor: IConstructor<any>;
513
+ function: IDescriptionMetadata;
514
+ name: string;
515
+ description: string;
516
+ argsDescriptions: {
517
+ typeDescriptor: string;
518
+ constructor: IConstructor<any>;
519
+ propertyName: string;
520
+ propertyType?: Function;
521
+ functionArgsTypes?: Function[];
522
+ functionReturnType?: Function;
523
+ description: string;
524
+ }[];
525
+ argsValidatorsInfo: IModelValidatorsInfo<unknown> | null;
526
+ }[];
527
+ };
528
+ getMindsetInfo(mindsetCtor: IConstructor<IMindset>): {
529
+ config: IMindsetConfig | undefined;
530
+ modules: {
531
+ config: IMindsetModuleConfig | undefined;
532
+ functions: {
533
+ moduleConstructor: IConstructor<any>;
534
+ function: IDescriptionMetadata;
535
+ name: string;
536
+ description: string;
537
+ argsDescriptions: {
538
+ typeDescriptor: string;
539
+ constructor: IConstructor<any>;
540
+ propertyName: string;
541
+ propertyType?: Function;
542
+ functionArgsTypes?: Function[];
543
+ functionReturnType?: Function;
544
+ description: string;
545
+ }[];
546
+ argsValidatorsInfo: IModelValidatorsInfo<unknown> | null;
547
+ }[];
548
+ }[];
549
+ };
560
550
  }
561
551
 
562
552
  interface IMindsetToolParameter {
@@ -564,6 +554,7 @@ interface IMindsetToolParameter {
564
554
  name: string;
565
555
  description: string;
566
556
  }
557
+
567
558
  interface IMindsetTool {
568
559
  language: string;
569
560
  name: string;
@@ -583,8 +574,8 @@ declare class MindsetOperator implements IMindset {
583
574
  llms(): Promise<IMindsetLlm[]>;
584
575
  systemPrompt(): Promise<string>;
585
576
  tools(): IMindsetTool[];
586
- protected tool(fn: IMindsetFunctionMetadata, module: IMindsetModuleMetadata): IMindsetTool;
587
- protected toolParameter(param: IMindsetFunctionParamMetadata): IMindsetToolParameter;
577
+ protected paramDescription(rawDescription: string, rawType: string): string;
578
+ protected paramType(rawType: string): string;
588
579
  callFunction(name: string, params: string): Promise<string>;
589
580
  functionResponseToString(response: any): Promise<string>;
590
581
  functionErrorToString(error: any): Promise<string>;
@@ -1638,4 +1629,4 @@ declare function HtmlModule(options: IHtmlModuleOptions): {
1638
1629
  new (): {};
1639
1630
  };
1640
1631
 
1641
- export { AnthropicChatAdapter, ApiKey, ApiKeyGuardMiddleware, ApiKeyHandshakeGuardMiddleware, ApiKeyRepository, Async, Auth, Chat, ChatAdapter, ChatBot, ChatBotMetadataStore, ChatItem, ChatMemory, ChatRepository, ChatResolver, CmdChannel, Command, CommandMetadataStore, Container, ControllerMetadataStore, CustomError, DeepSeekChatAdapter, EXPRESS_REQ, EXPRESS_RES, Entity, Env, EnvWhatsAppRepository, ExpressProvider, GoogleChatAdapter, type GoogleChatAdapterV2Options, HtmlModule, HttpServerProvider, type IApiKeyData, type IApiKeyRepository, type IArrayValidationError, type IArrayValidationResult, type IBotMessageItem, type IChannelMessage, type IChannelMetadata, type IChatAdapter, type IChatAdapterNextItemsReq, type IChatAdapterNextItemsRes, type IChatBot, type IChatBotMetadata, type IChatChannel, type IChatConnection, type IChatControllerMetadata, type IChatData, type IChatItem, type IChatItemData, type IChatItemType, type IChatMemory, type IChatMessage, type IChatRepository, type IChatType, type ICommandConfig, type ICommandHandler, type ICommandHandlerConfig, type IConstructor, type ICrudRepository, type ICustomErrorData, type IEndPointConfig, type IEndPointMetadata, type IEntityData, type IEnvType, type IFunctionCall, type IFunctionCallItem, type IGenerateApiKeyReq, type IGenerateApiKeyRes, type IGetWhatsAppTemplateRequest, type IHandshakeMiddleware, type IHandshakeMiddlewareMetadata, type IHtmlModuleOptions, type IHumanMessageItem, type IJobData, type IJobEvent, type IJobEventListener, type IJobRepository, type IJwtRefreshTokenData, type IJwtRefreshTokenRepository, type ILanguageModelUsage, type IListenWhatsAppMessageRequest, type IMessageContext, type IMiddleware, type IMiddlewareMetadata, type IMindset, type IMindsetDecoration, type IMindsetFunctionConfig, type IMindsetFunctionDecoration, type IMindsetFunctionMetadata, type IMindsetFunctionParamMetadata, type IMindsetIdentity, type IMindsetLlm, type IMindsetMetadata, type IMindsetModuleConfig, type IMindsetModuleDecoration, type IMindsetModuleMetadata, type IMindsetTool, type IMindsetToolParameter, type IModelValidationError, type IModelValidationResult, type IModelValidatorsInfo, type IMoneyData, type IParamConfig, type IParamDecoration, type IPersistentData, type IPgRepositoryConfig, type IPrimitive, type IPropertyValidatorInfo, type IReceivedMessage, type IRemoteApiKeyFetcher, type IRestControllerConfig, type IRestControllerMetadata, type ISendWhatsAppRequest, type ISendWhatsAppTemplateRequest, type ISocketChannelConfig, type ISocketChannelReceivedMessage, type ISocketControllerConfig, type ISocketControllerMetadata, type ISocketEventConfig, type ISocketEventMetadata, type IStorableData, type ITelegramChannelConfig, type IValidateArrayOptions, type IValidateArrayOptionsWithItemsValidators, type IValidateInputShape, type IValidateIsInOptions, type IValidateIsRecordOptions, type IValidateMaxOptions, type IValidateMinOptions, type IValidationError, type IValidationResult, type IValidator, type IValidatorMetadata, type IWhatsAppBusinessAccount, type IWhatsAppBusinessNumber, type IWhatsAppCloudContact, type IWhatsAppCloudMessage, type IWhatsAppCloudMessageMetadata, type IWhatsAppCloudTemplate, type IWhatsAppCloudTemplateComponent, type IWhatsAppCloudTemplateMessage, type IWhatsAppCloudTemplateParameter, type IWhatsAppCloudTemplateResponse, type IWhatsAppCloudWebhookPayload, type IWhatsAppData, type IWhatsAppMessageListener, type IWhatsAppProxyListenMessageEventData, type IWhatsAppProxyListenMessageEventReq, type IWhatsAppProxyMessage, type IWhatsAppProxyMessageContent, type IWhatsAppProxyMessageEventReq, type IWhatsAppProxySendMessageEventReq, type IWhatsAppRepository, type IWhatsAppSenderOptions, type IWhatsappChannelConfig, type IchatControllerConfig, Job, JobRepository, JobRunner, JobsEventsHub, Jwt, JwtAccessAndRefreshTokenDto, JwtConfig, JwtGuardMiddleware, JwtHandshakeGuardMiddleware, JwtRefreshToken, JwtRefreshTokenRepository, JwtSigner, JwtTokenDto, Lifecycle, Logger, MINDSET_DECORATION_MINDSET, MINDSET_FUNCTION_DECORATION_FUNCTION, MINDSET_MODULE_DECORATION_MODULE, Mapper, Mindset, MindsetMetadataStore, MindsetOperator, Money, MoneyDto, OpenaiChatAdapter, PARAM_DECORATION_IS_OPTIONAL, PARAM_DECORATION_PARAM, Password, type PasswordHashOptions, Persistent, PgApiKeyRepository, PgChatMemory, PgChatRepository, PgCrudRepository, PgJobRepository, PgJwtRefreshTokenRepository, PgRepositoryBase, PgWhatsAppRepository, RamChatMemory, RamChatRepository, Random, RemoteApiKeyRepository, RestControllerMetadataStore, RestRequest, SocketChannel, SocketChannelConfig, SocketChannelReceivedMessage, SocketControllerMetadataStore, SocketServerProvider, Storable, TelegramChannel, TelegramChannelConfig, ValidationMetadataStore, WHATSAPP_MESSAGE_EVENT, WHATSAPP_PROXY_LISTEN_MESSAGE_EVENT, WHATSAPP_PROXY_SEND_MESSAGE_EVENT, WabotChatAdapter, WhatsApp, WhatsAppChannel, WhatsAppReceiver, WhatsAppReceiverByCloudApi, WhatsAppReceiverByWabotProxy, WhatsAppRepository, WhatsAppSender, WhatsAppSenderByCloudApi, WhatsAppSenderByWabotProxy, WhatsAppWabotProxyConnection, WhatsappChannelConfig, apiKeyGuard, apiKeyHandshakeGuard, chatBot, chatController, chatItemTypeOptions, cmd, command, commandHandler, container, handshakeMiddlewares, inject, injectable, isArray, isBoolean, isDate, isIn, isModel, isNotEmpty, isNumber, isOptional, isPresent, isRecord, isString, jwtGuard, jwtHandshakeGuard, max, middleware, min, mindset, mindsetFunction, mindsetModule, modelInfo, onDelete, onGet, onPost, onPut, onSocketEvent, param, readJsonFromFile, restController, runAsyncCommandHandlers, runChatControllers, runRestControllers, runSocketControllers, scoped, singleton, socket, socketController, telegram, validateAndTransform, validateArray, validateIsBoolean, validateIsDate, validateIsIn, validateIsNotEmpty, validateIsNumber, validateIsPresent, validateIsRecord, validateIsString, validateMax, validateMin, validateModel, whatsApp, writeJsonToFile };
1632
+ export { AnthropicChatAdapter, ApiKey, ApiKeyGuardMiddleware, ApiKeyHandshakeGuardMiddleware, ApiKeyRepository, Async, Auth, Chat, ChatAdapter, ChatBot, ChatBotMetadataStore, ChatItem, ChatMemory, ChatRepository, ChatResolver, CmdChannel, Command, CommandMetadataStore, Container, ControllerMetadataStore, CustomError, DeepSeekChatAdapter, DescriptionMetadataStore, EXPRESS_REQ, EXPRESS_RES, Entity, Env, EnvWhatsAppRepository, ExpressProvider, GoogleChatAdapter, type GoogleChatAdapterV2Options, HtmlModule, HttpServerProvider, type IApiKeyData, type IApiKeyRepository, type IArrayValidationError, type IArrayValidationResult, type IBotMessageItem, type IChannelMessage, type IChannelMetadata, type IChatAdapter, type IChatAdapterNextItemsReq, type IChatAdapterNextItemsRes, type IChatBot, type IChatBotMetadata, type IChatChannel, type IChatConnection, type IChatControllerMetadata, type IChatData, type IChatItem, type IChatItemData, type IChatItemType, type IChatMemory, type IChatMessage, type IChatRepository, type IChatType, type ICommandConfig, type ICommandHandler, type ICommandHandlerConfig, type IConstructor, type ICrudRepository, type ICustomErrorData, type IDescriptionMetadata, type IEndPointConfig, type IEndPointMetadata, type IEntityData, type IEnvType, type IFunctionCall, type IFunctionCallItem, type IGenerateApiKeyReq, type IGenerateApiKeyRes, type IGetWhatsAppTemplateRequest, type IHandshakeMiddleware, type IHandshakeMiddlewareMetadata, type IHtmlModuleOptions, type IHumanMessageItem, type IJobData, type IJobEvent, type IJobEventListener, type IJobRepository, type IJwtRefreshTokenData, type IJwtRefreshTokenRepository, type ILanguageModelUsage, type IListenWhatsAppMessageRequest, 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 IPrimitive, type IPropertyValidatorInfo, type IReceivedMessage, type IRemoteApiKeyFetcher, type IRestControllerConfig, type IRestControllerMetadata, type ISendWhatsAppRequest, type ISendWhatsAppTemplateRequest, type ISocketChannelConfig, type ISocketChannelReceivedMessage, type ISocketControllerConfig, type ISocketControllerMetadata, type ISocketEventConfig, type ISocketEventMetadata, type IStorableData, type ITelegramChannelConfig, type IValidateArrayOptions, type IValidateArrayOptionsWithItemsValidators, type IValidateInputShape, type IValidateIsInOptions, type IValidateIsRecordOptions, type IValidateMaxOptions, type IValidateMinOptions, type IValidationError, type IValidationResult, type IValidator, type IValidatorMetadata, type IWhatsAppBusinessAccount, type IWhatsAppBusinessNumber, type IWhatsAppCloudContact, type IWhatsAppCloudMessage, type IWhatsAppCloudMessageMetadata, type IWhatsAppCloudTemplate, type IWhatsAppCloudTemplateComponent, type IWhatsAppCloudTemplateMessage, type IWhatsAppCloudTemplateParameter, type IWhatsAppCloudTemplateResponse, type IWhatsAppCloudWebhookPayload, type IWhatsAppData, type IWhatsAppMessageListener, type IWhatsAppProxyListenMessageEventData, type IWhatsAppProxyListenMessageEventReq, type IWhatsAppProxyMessage, type IWhatsAppProxyMessageContent, type IWhatsAppProxyMessageEventReq, type IWhatsAppProxySendMessageEventReq, type IWhatsAppRepository, type IWhatsAppSenderOptions, type IWhatsappChannelConfig, type IchatControllerConfig, Job, JobRepository, JobRunner, JobsEventsHub, Jwt, JwtAccessAndRefreshTokenDto, JwtConfig, JwtGuardMiddleware, JwtHandshakeGuardMiddleware, JwtRefreshToken, JwtRefreshTokenRepository, JwtSigner, JwtTokenDto, Lifecycle, Logger, Mapper, Mindset, MindsetMetadataStore, MindsetOperator, Money, MoneyDto, OpenaiChatAdapter, Password, type PasswordHashOptions, Persistent, PgApiKeyRepository, PgChatMemory, PgChatRepository, PgCrudRepository, PgJobRepository, PgJwtRefreshTokenRepository, PgRepositoryBase, PgWhatsAppRepository, RamChatMemory, RamChatRepository, Random, RemoteApiKeyRepository, RestControllerMetadataStore, RestRequest, SocketChannel, SocketChannelConfig, SocketChannelReceivedMessage, SocketControllerMetadataStore, SocketServerProvider, Storable, TelegramChannel, TelegramChannelConfig, ValidationMetadataStore, WHATSAPP_MESSAGE_EVENT, WHATSAPP_PROXY_LISTEN_MESSAGE_EVENT, WHATSAPP_PROXY_SEND_MESSAGE_EVENT, WabotChatAdapter, WhatsApp, WhatsAppChannel, WhatsAppReceiver, WhatsAppReceiverByCloudApi, WhatsAppReceiverByWabotProxy, WhatsAppRepository, WhatsAppSender, WhatsAppSenderByCloudApi, WhatsAppSenderByWabotProxy, WhatsAppWabotProxyConnection, WhatsappChannelConfig, apiKeyGuard, apiKeyHandshakeGuard, chatBot, chatController, chatItemTypeOptions, cmd, command, commandHandler, container, description, handshakeMiddlewares, inject, injectable, isArray, isBoolean, isDate, isIn, isModel, isNotEmpty, isNumber, isOptional, isPresent, isRecord, isString, jwtGuard, jwtHandshakeGuard, max, middleware, min, mindset, mindsetModule, modelInfo, onDelete, onGet, onPost, onPut, onSocketEvent, readJsonFromFile, restController, runAsyncCommandHandlers, runChatControllers, runRestControllers, runSocketControllers, scoped, singleton, socket, socketController, telegram, validateAndTransform, validateArray, validateIsBoolean, validateIsDate, validateIsIn, validateIsNotEmpty, validateIsNumber, validateIsPresent, validateIsRecord, validateIsString, validateMax, validateMin, validateModel, whatsApp, writeJsonToFile };
package/dist/src/index.js CHANGED
@@ -36,6 +36,8 @@ export { min } from './core/validation/validators/min/@min.js';
36
36
  export { validateMin } from './core/validation/validators/min/validateMin.js';
37
37
  export { isRecord } from './core/validation/validators/is-record/@isRecord.js';
38
38
  export { validateIsRecord } from './core/validation/validators/is-record/validateIsRecord.js';
39
+ export { description } from './core/description/metadata/@description.js';
40
+ export { DescriptionMetadataStore } from './core/description/metadata/DescriptionMetadataStore.js';
39
41
  export { command } from './feature/async/@command.js';
40
42
  export { commandHandler } from './feature/async/@commandHandler.js';
41
43
  export { Async } from './feature/async/Async.js';
@@ -61,14 +63,8 @@ export { ChatResolver } from './feature/chat-controller/ChatResolver.js';
61
63
  export { runChatControllers } from './feature/chat-controller/runChatControllers.js';
62
64
  export { ExpressProvider } from './feature/express/ExpressProvider.js';
63
65
  export { HttpServerProvider } from './feature/http/HttpServerProvider.js';
64
- export { mindsetFunction } from './feature/mindset/metadata/functions/@mindsetFunction.js';
65
- export { MINDSET_FUNCTION_DECORATION_FUNCTION } from './feature/mindset/metadata/functions/decoratorNames.js';
66
66
  export { mindset } from './feature/mindset/metadata/mindsets/@mindset.js';
67
- export { MINDSET_DECORATION_MINDSET } from './feature/mindset/metadata/mindsets/decoratorNames.js';
68
67
  export { mindsetModule } from './feature/mindset/metadata/modules/@mindsetModule.js';
69
- export { MINDSET_MODULE_DECORATION_MODULE } from './feature/mindset/metadata/modules/decoratorNames.js';
70
- export { param } from './feature/mindset/metadata/params/@param.js';
71
- export { PARAM_DECORATION_IS_OPTIONAL, PARAM_DECORATION_PARAM } from './feature/mindset/metadata/params/decoratorNames.js';
72
68
  export { MindsetMetadataStore } from './feature/mindset/metadata/MindsetMetadataStore.js';
73
69
  export { Mindset } from './feature/mindset/IMindset.js';
74
70
  export { MindsetOperator } from './feature/mindset/MindsetOperator.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wabot-dev/framework",
3
- "version": "0.2.1-beta.1",
3
+ "version": "0.2.1-beta.3",
4
4
  "description": "Framework for IA Chat Bots",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",
@@ -26,7 +26,6 @@
26
26
  "@rollup/plugin-typescript": "12.1.2",
27
27
  "@yucacodes/ts": "^0.0.4",
28
28
  "prettier": "^3.5.3",
29
- "resend": "^4.4.1",
30
29
  "rollup": "4.39.0",
31
30
  "tsup": "^8.4.0",
32
31
  "typescript": "5.8.3"
@@ -1,21 +0,0 @@
1
- import 'reflect-metadata';
2
- import { container } from '../../../../core/injection/index.js';
3
- import { MindsetMetadataStore } from '../MindsetMetadataStore.js';
4
- import { MINDSET_FUNCTION_DECORATION_FUNCTION } from './decoratorNames.js';
5
-
6
- function mindsetFunction(config) {
7
- return function (target, propertyKey) {
8
- const functionName = propertyKey.toString();
9
- const paramsTypes = Reflect.getMetadata('design:paramtypes', target, functionName);
10
- const store = container.resolve(MindsetMetadataStore);
11
- store.saveFunctionDecoration({
12
- decorationName: MINDSET_FUNCTION_DECORATION_FUNCTION,
13
- paramsTypes: paramsTypes,
14
- functionName,
15
- constructor: target.constructor,
16
- decorationConfig: config,
17
- });
18
- };
19
- }
20
-
21
- export { mindsetFunction };
@@ -1,3 +0,0 @@
1
- const MINDSET_FUNCTION_DECORATION_FUNCTION = 'mindsetFunction';
2
-
3
- export { MINDSET_FUNCTION_DECORATION_FUNCTION };
@@ -1,3 +0,0 @@
1
- const MINDSET_DECORATION_MINDSET = 'mindset';
2
-
3
- export { MINDSET_DECORATION_MINDSET };
@@ -1,3 +0,0 @@
1
- const MINDSET_MODULE_DECORATION_MODULE = 'mindsetModule';
2
-
3
- export { MINDSET_MODULE_DECORATION_MODULE };
@@ -1,21 +0,0 @@
1
- import 'reflect-metadata';
2
- import { MindsetMetadataStore } from '../MindsetMetadataStore.js';
3
- import { container } from '../../../../core/injection/index.js';
4
- import { PARAM_DECORATION_PARAM } from './decoratorNames.js';
5
-
6
- function param(config) {
7
- return (target, propertyKey) => {
8
- const paramName = propertyKey.toString();
9
- const paramType = Reflect.getMetadata('design:type', target, paramName);
10
- const store = container.resolve(MindsetMetadataStore);
11
- store.saveParamDecoration({
12
- decorationName: PARAM_DECORATION_PARAM,
13
- paramType: paramType,
14
- paramName: paramName,
15
- constructor: target.constructor,
16
- decorationConfig: config,
17
- });
18
- };
19
- }
20
-
21
- export { param };
@@ -1,4 +0,0 @@
1
- const PARAM_DECORATION_IS_OPTIONAL = 'isOptional';
2
- const PARAM_DECORATION_PARAM = 'param';
3
-
4
- export { PARAM_DECORATION_IS_OPTIONAL, PARAM_DECORATION_PARAM };