@futdevpro/nts-dynamo 1.15.3 → 1.15.6
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/.cursor/rules/__main.mdc +3 -1
- package/.cursor/rules/default-command.mdc +324 -88
- package/_specifications/BACKLOG.md +15 -0
- package/_specifications/TODO.md +15 -0
- package/build/_modules/ai/_models/ai-test-generation-result.interface.d.ts +17 -0
- package/build/_modules/ai/_models/ai-test-generation-result.interface.d.ts.map +1 -0
- package/build/_modules/ai/_models/ai-test-generation-result.interface.js +3 -0
- package/build/_modules/ai/_models/ai-test-generation-result.interface.js.map +1 -0
- package/build/_modules/ai/_modules/anthropic/_services/aai-user-key.control-service.d.ts +36 -0
- package/build/_modules/ai/_modules/anthropic/_services/aai-user-key.control-service.d.ts.map +1 -0
- package/build/_modules/ai/_modules/anthropic/_services/aai-user-key.control-service.js +118 -0
- package/build/_modules/ai/_modules/anthropic/_services/aai-user-key.control-service.js.map +1 -0
- package/build/_modules/ai/_modules/anthropic/index.d.ts +3 -0
- package/build/_modules/ai/_modules/anthropic/index.d.ts.map +1 -0
- package/build/_modules/ai/_modules/anthropic/index.js +8 -0
- package/build/_modules/ai/_modules/anthropic/index.js.map +1 -0
- package/build/_modules/ai/_modules/fdp-ai/_services/fdpai-user-key.control-service.d.ts +35 -0
- package/build/_modules/ai/_modules/fdp-ai/_services/fdpai-user-key.control-service.d.ts.map +1 -0
- package/build/_modules/ai/_modules/fdp-ai/_services/fdpai-user-key.control-service.js +129 -0
- package/build/_modules/ai/_modules/fdp-ai/_services/fdpai-user-key.control-service.js.map +1 -0
- package/build/_modules/ai/_modules/fdp-ai/index.d.ts +3 -0
- package/build/_modules/ai/_modules/fdp-ai/index.d.ts.map +1 -0
- package/build/_modules/ai/_modules/fdp-ai/index.js +8 -0
- package/build/_modules/ai/_modules/fdp-ai/index.js.map +1 -0
- package/build/_modules/ai/_modules/open-ai/_services/oai-user-key.control-service.d.ts +40 -0
- package/build/_modules/ai/_modules/open-ai/_services/oai-user-key.control-service.d.ts.map +1 -0
- package/build/_modules/ai/_modules/open-ai/_services/oai-user-key.control-service.js +111 -0
- package/build/_modules/ai/_modules/open-ai/_services/oai-user-key.control-service.js.map +1 -0
- package/build/_modules/ai/_modules/open-ai/index.d.ts +1 -0
- package/build/_modules/ai/_modules/open-ai/index.d.ts.map +1 -1
- package/build/_modules/ai/_modules/open-ai/index.js +1 -0
- package/build/_modules/ai/_modules/open-ai/index.js.map +1 -1
- package/build/_modules/ai/_services/ai-user-key.service-base.d.ts +45 -0
- package/build/_modules/ai/_services/ai-user-key.service-base.d.ts.map +1 -0
- package/build/_modules/ai/_services/ai-user-key.service-base.js +15 -0
- package/build/_modules/ai/_services/ai-user-key.service-base.js.map +1 -0
- package/build/_modules/ai/index.d.ts +2 -0
- package/build/_modules/ai/index.d.ts.map +1 -1
- package/build/_modules/ai/index.js +2 -0
- package/build/_modules/ai/index.js.map +1 -1
- package/build/_modules/socket/_services/socket-client.service.d.ts.map +1 -1
- package/build/_modules/socket/_services/socket-client.service.js +2 -1
- package/build/_modules/socket/_services/socket-client.service.js.map +1 -1
- package/build/_modules/socket/app-extended.server.js +1 -1
- package/build/_modules/socket/app-extended.server.js.map +1 -1
- package/build/_services/base/data.service.d.ts +1 -1
- package/build/_services/base/data.service.js +1 -1
- package/build/_services/base/db.service.d.ts +1 -1
- package/build/_services/base/db.service.js +1 -1
- package/build/_services/core/auth.service.d.ts +2 -2
- package/build/_services/core/auth.service.js +1 -1
- package/build/_services/core/email.service.js +1 -1
- package/build/_services/core/email.service.js.map +1 -1
- package/build/_services/core/global.service.d.ts +1 -1
- package/build/_services/core/global.service.js +2 -2
- package/build/_services/core/global.service.js.map +1 -1
- package/build/_services/server/app.server.d.ts.map +1 -1
- package/build/_services/server/app.server.js +11 -1
- package/build/_services/server/app.server.js.map +1 -1
- package/package.json +17 -4
- package/src/_modules/ai/_models/ai-test-generation-result.interface.ts +16 -0
- package/src/_modules/ai/_modules/anthropic/_services/aai-user-key.control-service.ts +138 -0
- package/src/_modules/ai/_modules/anthropic/index.ts +5 -0
- package/src/_modules/ai/_modules/fdp-ai/_services/fdpai-user-key.control-service.ts +189 -0
- package/src/_modules/ai/_modules/fdp-ai/index.ts +5 -0
- package/src/_modules/ai/_modules/open-ai/_services/oai-user-key.control-service.ts +157 -0
- package/src/_modules/ai/_modules/open-ai/index.ts +1 -0
- package/src/_modules/ai/_services/ai-user-key.service-base.ts +59 -0
- package/src/_modules/ai/index.ts +2 -0
- package/src/_modules/socket/_services/socket-client.service.ts +2 -1
- package/src/_modules/socket/app-extended.server.ts +1 -1
- package/src/_services/base/data.service.ts +1 -1
- package/src/_services/base/db.service.ts +1 -1
- package/src/_services/core/auth.service.ts +2 -2
- package/src/_services/core/email.service.ts +1 -1
- package/src/_services/core/global.service.ts +2 -2
- package/src/_services/route/controller.service.ts +1 -1
- package/src/_services/server/app.server.ts +17 -1
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { OpenAI } from 'openai';
|
|
2
|
+
|
|
3
|
+
import { DyFM_AI_Provider, DyFM_AI_Config } from '@futdevpro/fsm-dynamo/ai';
|
|
4
|
+
import { DyFM_AI_UserProviderConfig } from '@futdevpro/fsm-dynamo/ai';
|
|
5
|
+
import { DyFM_OAI_UserProviderConfig } from '@futdevpro/fsm-dynamo/ai/open-ai';
|
|
6
|
+
import { DyFM_Log } from '@futdevpro/fsm-dynamo';
|
|
7
|
+
|
|
8
|
+
import { DyNTS_AI_UserKey_ServiceBase } from '../../../_services/ai-user-key.service-base';
|
|
9
|
+
import { DyNTS_AI_TestGeneration_Result } from '../../../_models/ai-test-generation-result.interface';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* OpenAI-specifikus user API key kezelo service
|
|
13
|
+
*
|
|
14
|
+
* A visszafejtett API kulcsbol OpenAI-specifikus konfigot allit ossze,
|
|
15
|
+
* es teszteli a kapcsolatot az OpenAI API-val.
|
|
16
|
+
*/
|
|
17
|
+
export class DyNTS_OAI_UserKey_ControlService extends DyNTS_AI_UserKey_ServiceBase {
|
|
18
|
+
|
|
19
|
+
static getInstance(): DyNTS_OAI_UserKey_ControlService {
|
|
20
|
+
return DyNTS_OAI_UserKey_ControlService.getSingletonInstance();
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
readonly aiProvider: DyFM_AI_Provider = DyFM_AI_Provider.OpenAI;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* OpenAI config osszeallitasa a visszafejtett kulcsbol
|
|
27
|
+
*/
|
|
28
|
+
resolveConfig(
|
|
29
|
+
userProviderConfig: DyFM_AI_UserProviderConfig,
|
|
30
|
+
decryptedApiKey: string
|
|
31
|
+
): DyFM_AI_Config {
|
|
32
|
+
const oaiConfig: DyFM_OAI_UserProviderConfig =
|
|
33
|
+
userProviderConfig as DyFM_OAI_UserProviderConfig;
|
|
34
|
+
|
|
35
|
+
return {
|
|
36
|
+
apiKey: decryptedApiKey,
|
|
37
|
+
organization: oaiConfig.organization,
|
|
38
|
+
project: oaiConfig.project,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* OpenAI kapcsolat tesztelese a models.list() hivassal
|
|
44
|
+
*/
|
|
45
|
+
async testConnection(
|
|
46
|
+
userProviderConfig: DyFM_AI_UserProviderConfig,
|
|
47
|
+
decryptedApiKey: string
|
|
48
|
+
): Promise<boolean> {
|
|
49
|
+
try {
|
|
50
|
+
const config: DyFM_AI_Config = this.resolveConfig(userProviderConfig, decryptedApiKey);
|
|
51
|
+
const openai: OpenAI = new OpenAI({
|
|
52
|
+
apiKey: config.apiKey,
|
|
53
|
+
organization: config.organization,
|
|
54
|
+
project: config.project,
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
await openai.models.list();
|
|
58
|
+
|
|
59
|
+
return true;
|
|
60
|
+
} catch (error) {
|
|
61
|
+
DyFM_Log.error(
|
|
62
|
+
'DyNTS_OAI_UserKey_ControlService',
|
|
63
|
+
'testConnection',
|
|
64
|
+
'OpenAI connection test failed',
|
|
65
|
+
{ error: error }
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Elerheto OpenAI modellek lekerdezese
|
|
74
|
+
* Szuri a chat/LLM modelleket (nem embedding, nem whisper stb.)
|
|
75
|
+
*/
|
|
76
|
+
async listAvailableModels(
|
|
77
|
+
userProviderConfig: DyFM_AI_UserProviderConfig,
|
|
78
|
+
decryptedApiKey: string
|
|
79
|
+
): Promise<string[]> {
|
|
80
|
+
const config: DyFM_AI_Config = this.resolveConfig(userProviderConfig, decryptedApiKey);
|
|
81
|
+
const openai: OpenAI = new OpenAI({
|
|
82
|
+
apiKey: config.apiKey,
|
|
83
|
+
organization: config.organization,
|
|
84
|
+
project: config.project,
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
const models = await openai.models.list();
|
|
88
|
+
|
|
89
|
+
return models.data
|
|
90
|
+
.map((m) => m.id)
|
|
91
|
+
.filter((id: string) => this.isLLMModel(id))
|
|
92
|
+
.sort();
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Teszt generalas az OpenAI API-val
|
|
97
|
+
*/
|
|
98
|
+
async testGeneration(set: {
|
|
99
|
+
userProviderConfig: DyFM_AI_UserProviderConfig;
|
|
100
|
+
decryptedApiKey: string;
|
|
101
|
+
model: string;
|
|
102
|
+
}): Promise<DyNTS_AI_TestGeneration_Result> {
|
|
103
|
+
const startTime: number = Date.now();
|
|
104
|
+
|
|
105
|
+
try {
|
|
106
|
+
const config: DyFM_AI_Config = this.resolveConfig(
|
|
107
|
+
set.userProviderConfig,
|
|
108
|
+
set.decryptedApiKey
|
|
109
|
+
);
|
|
110
|
+
const openai: OpenAI = new OpenAI({
|
|
111
|
+
apiKey: config.apiKey,
|
|
112
|
+
organization: config.organization,
|
|
113
|
+
project: config.project,
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
const response = await openai.chat.completions.create({
|
|
117
|
+
model: set.model,
|
|
118
|
+
messages: [{ role: 'user', content: 'Hello, this is a test. Reply with "OK".' }],
|
|
119
|
+
max_tokens: 10,
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
return {
|
|
123
|
+
success: true,
|
|
124
|
+
response: response.choices[0]?.message?.content,
|
|
125
|
+
model: set.model,
|
|
126
|
+
latencyMs: Date.now() - startTime,
|
|
127
|
+
};
|
|
128
|
+
} catch (error) {
|
|
129
|
+
DyFM_Log.error(
|
|
130
|
+
'DyNTS_OAI_UserKey_ControlService',
|
|
131
|
+
'testGeneration',
|
|
132
|
+
'OpenAI test generation failed',
|
|
133
|
+
{ error: error }
|
|
134
|
+
);
|
|
135
|
+
|
|
136
|
+
return {
|
|
137
|
+
success: false,
|
|
138
|
+
model: set.model,
|
|
139
|
+
latencyMs: Date.now() - startTime,
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* LLM/Chat modell szures -- kiszuri az embedding, whisper, tts stb. modelleket
|
|
146
|
+
*/
|
|
147
|
+
private isLLMModel(modelId: string): boolean {
|
|
148
|
+
const excludePatterns: string[] = [
|
|
149
|
+
'embedding', 'whisper', 'tts', 'dall-e',
|
|
150
|
+
'moderation', 'davinci', 'babbage', 'ada',
|
|
151
|
+
];
|
|
152
|
+
|
|
153
|
+
return !excludePatterns.some(
|
|
154
|
+
(pattern: string) => modelId.includes(pattern)
|
|
155
|
+
);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
@@ -65,6 +65,7 @@ export * from './_services/oai-embedding.service'; */
|
|
|
65
65
|
export * from './_services/oai-embedding.control-service';
|
|
66
66
|
export * from './_services/oai-llm-chat.service-base';
|
|
67
67
|
export * from './_services/oai-llm.service-base';
|
|
68
|
+
export * from './_services/oai-user-key.control-service';
|
|
68
69
|
// services/DATA-SERVICES
|
|
69
70
|
export * from './_services/data-services/oai-doc-chunk-data.service';
|
|
70
71
|
export * from './_services/data-services/oai-doc-page.data-service';
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { DyFM_AI_Provider, DyFM_AI_Config } from '@futdevpro/fsm-dynamo/ai';
|
|
2
|
+
import { DyFM_AI_UserProviderConfig } from '@futdevpro/fsm-dynamo/ai';
|
|
3
|
+
|
|
4
|
+
import { DyNTS_SingletonService } from '../../../_services/base/singleton.service';
|
|
5
|
+
import { DyNTS_AI_TestGeneration_Result } from '../_models/ai-test-generation-result.interface';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Absztrakt bazis osztaly a user AI provider kulcs kezeleshez
|
|
9
|
+
*
|
|
10
|
+
* A titkositas/visszafejtes NEM itt tortenik -- azt az fdp-auth-service Auth_ControlService-e vegzi.
|
|
11
|
+
* Ezek a service-ek a mar visszafejtett config-ot es API kulcsot kapjak,
|
|
12
|
+
* es abbol allitjak ossze a provider-specifikus konfigot.
|
|
13
|
+
*/
|
|
14
|
+
export abstract class DyNTS_AI_UserKey_ServiceBase extends DyNTS_SingletonService {
|
|
15
|
+
/** melyik provider-hez tartozik ez a service */
|
|
16
|
+
abstract readonly aiProvider: DyFM_AI_Provider;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Visszafejtett user config + kulcs -> provider-specifikus AI config osszeallitas
|
|
20
|
+
* @param userProviderConfig - a user provider konfiguracioja
|
|
21
|
+
* @param decryptedApiKey - a mar visszafejtett API kulcs
|
|
22
|
+
*/
|
|
23
|
+
abstract resolveConfig(
|
|
24
|
+
userProviderConfig: DyFM_AI_UserProviderConfig,
|
|
25
|
+
decryptedApiKey: string
|
|
26
|
+
): DyFM_AI_Config;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Kapcsolat tesztelese a provider-rel a visszafejtett kulccsal
|
|
30
|
+
* @param userProviderConfig - a user provider konfiguracioja
|
|
31
|
+
* @param decryptedApiKey - a mar visszafejtett API kulcs
|
|
32
|
+
*/
|
|
33
|
+
abstract testConnection(
|
|
34
|
+
userProviderConfig: DyFM_AI_UserProviderConfig,
|
|
35
|
+
decryptedApiKey: string
|
|
36
|
+
): Promise<boolean>;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Elerheto modellek lekerdezese a provider API-rol
|
|
40
|
+
* @param userProviderConfig - a user provider konfiguracioja
|
|
41
|
+
* @param decryptedApiKey - a mar visszafejtett API kulcs
|
|
42
|
+
*/
|
|
43
|
+
abstract listAvailableModels(
|
|
44
|
+
userProviderConfig: DyFM_AI_UserProviderConfig,
|
|
45
|
+
decryptedApiKey: string
|
|
46
|
+
): Promise<string[]>;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Teszt generalas a provider-rel
|
|
50
|
+
* @param set.userProviderConfig - a user provider konfiguracioja
|
|
51
|
+
* @param set.decryptedApiKey - a mar visszafejtett API kulcs
|
|
52
|
+
* @param set.model - a hasznalando modell
|
|
53
|
+
*/
|
|
54
|
+
abstract testGeneration(set: {
|
|
55
|
+
userProviderConfig: DyFM_AI_UserProviderConfig;
|
|
56
|
+
decryptedApiKey: string;
|
|
57
|
+
model: string;
|
|
58
|
+
}): Promise<DyNTS_AI_TestGeneration_Result>;
|
|
59
|
+
}
|
package/src/_modules/ai/index.ts
CHANGED
|
@@ -3,9 +3,11 @@ export * from '@futdevpro/fsm-dynamo/ai';
|
|
|
3
3
|
|
|
4
4
|
// AI Input Interfaces (moved from FSM)
|
|
5
5
|
export * from './_models/ai-input-interfaces';
|
|
6
|
+
export * from './_models/ai-test-generation-result.interface';
|
|
6
7
|
|
|
7
8
|
// Abstract Services
|
|
8
9
|
export * from './_services/ai-provider.service-base';
|
|
9
10
|
export * from './_services/ai-llm.service-base';
|
|
10
11
|
export * from './_services/ai-llm-chat.service-base';
|
|
11
12
|
export * from './_services/ai-embedding.service-base';
|
|
13
|
+
export * from './_services/ai-user-key.service-base';
|
|
@@ -105,8 +105,9 @@ export abstract class DyNTS_SocketClient_ServiceBase extends DyNTS_SingletonServ
|
|
|
105
105
|
try {
|
|
106
106
|
this._params = this.getParams();
|
|
107
107
|
this.incomingEvents = this.getIncomingEvents() ?? [];
|
|
108
|
+
const socketAddress = this.params.port ? `${this.params.address}:${this.params.port}` : this.params.address;
|
|
108
109
|
this.socket = SocketIOClient.io(
|
|
109
|
-
|
|
110
|
+
socketAddress,
|
|
110
111
|
{
|
|
111
112
|
reconnection: this.params.reconnect,
|
|
112
113
|
reconnectionDelay: this.params.reconnectDelay,
|
|
@@ -460,7 +460,7 @@ export abstract class DyNTS_AppExtended extends DyNTS_App {
|
|
|
460
460
|
`\n keyPath: FileSystem.PathLike,` +
|
|
461
461
|
`\n certPath: FileSystem.PathLike,` +
|
|
462
462
|
`\n }` +
|
|
463
|
-
`\nin
|
|
463
|
+
`\nin DynamoNTSServer - setupRoutingModules() to enable secure routes.`;
|
|
464
464
|
|
|
465
465
|
errorMsg += '\n\nThe socket services setted to use secure server:';
|
|
466
466
|
this.socketServices.forEach((service: DyNTS_SocketServerService<any>): void => {
|
|
@@ -2426,7 +2426,7 @@ export class DyNTS_DataService<T extends DyFM_Metadata> {
|
|
|
2426
2426
|
|
|
2427
2427
|
|
|
2428
2428
|
/**
|
|
2429
|
-
* setting up dependency dataHook by
|
|
2429
|
+
* setting up dependency dataHook by DynamoNTSDataModelParams
|
|
2430
2430
|
*/
|
|
2431
2431
|
private lookForDependencyDataSettings(): void {
|
|
2432
2432
|
const dependencyParams: DyFM_DataProperty_Params<any, T>[] =
|
|
@@ -1277,7 +1277,7 @@ export class DyNTS_DBService<T extends DyFM_Metadata> {
|
|
|
1277
1277
|
|
|
1278
1278
|
/**
|
|
1279
1279
|
* builds mongoose schema building settings object by dynamoDataModelParamsList
|
|
1280
|
-
* @param properties
|
|
1280
|
+
* @param properties DynamoNTSDataPropertyParams
|
|
1281
1281
|
* @returns mongoose schema object
|
|
1282
1282
|
*/
|
|
1283
1283
|
private buildMongooseSchemaSettingsObjByModelParams(properties: DyFM_DataProperties<T>): any {
|
|
@@ -12,7 +12,7 @@ import { DyNTS_global_settings } from '../../_collections/global-settings.const'
|
|
|
12
12
|
* You should use singleton instance getting function by implementing a
|
|
13
13
|
* static getInstance() function
|
|
14
14
|
* @example
|
|
15
|
-
* export class AuthService extends
|
|
15
|
+
* export class AuthService extends DyNTS_AuthService {
|
|
16
16
|
*
|
|
17
17
|
* static getInstance(): AuthService {
|
|
18
18
|
* return AuthService.getSingletonInstance();
|
|
@@ -150,7 +150,7 @@ export abstract class DyNTS_AuthService extends DyNTS_SingletonService {
|
|
|
150
150
|
abstract authenticate_tokenPerm_accUsageData: (req: Request, res: Response) => Promise<void>;
|
|
151
151
|
|
|
152
152
|
/**
|
|
153
|
-
* The
|
|
153
|
+
* The DynamoNTS System is using this to get issuer, that will be set on DBServices
|
|
154
154
|
* Don't throw error in this function, since it will be used in every request
|
|
155
155
|
* @param req
|
|
156
156
|
*
|
|
@@ -664,7 +664,7 @@ export class DyNTS_EmailService /* extends DyNTS_SingletonService */ {
|
|
|
664
664
|
while (propertyOpenTagIndex >= 0) {
|
|
665
665
|
if (propertyCloseTagIndex === -1) {
|
|
666
666
|
DyFM_Log.error(
|
|
667
|
-
`\
|
|
667
|
+
`\nDyNTS_EmailService ERROR, missing closing tag from email template! ` +
|
|
668
668
|
`(${propertyOpenTagIndex} -)`,
|
|
669
669
|
propertyKeys
|
|
670
670
|
);
|
|
@@ -30,7 +30,7 @@ import { DyNTS_SingletonService } from '../base/singleton.service';
|
|
|
30
30
|
import { DyNTS_getArchivedDBName } from '../../_collections/archive.util';
|
|
31
31
|
|
|
32
32
|
/**
|
|
33
|
-
* This is the main Global/Core Service Collection used by
|
|
33
|
+
* This is the main Global/Core Service Collection used by DynamoNTS,
|
|
34
34
|
* you also can use this to access main services as
|
|
35
35
|
* dbServices, emailServices, or authService
|
|
36
36
|
*/
|
|
@@ -373,7 +373,7 @@ export class DyNTS_GlobalService extends DyNTS_SingletonService {
|
|
|
373
373
|
throw new Error(
|
|
374
374
|
`\n Unique Email Service Collection missing!` +
|
|
375
375
|
`\n Please create a Unique Email Service Collection extending ` +
|
|
376
|
-
`
|
|
376
|
+
`DyNTS_EmailServiceCollection, ` +
|
|
377
377
|
'\n (If you set the globalErrorHandler, ' +
|
|
378
378
|
'please check if it is using the same node_modules as the app)' +
|
|
379
379
|
`\n and Setup with DyNTS_GlobalServiceC.setServices(...)\n` +
|
|
@@ -104,7 +104,7 @@ export abstract class DyNTS_Controller extends DyNTS_SingletonService {
|
|
|
104
104
|
this.setupEndpoints();
|
|
105
105
|
} catch (error) {
|
|
106
106
|
throw new DyFM_Error({
|
|
107
|
-
message: '
|
|
107
|
+
message: 'DynamoNTSController setup failed. Please check the setupEndpoints() method.',
|
|
108
108
|
errorCode: `${DyNTS_global_settings.systemShortCodeName}|DyNTS-COS-000',
|
|
109
109
|
issuerService: this?.constructor?.name,
|
|
110
110
|
error: error,
|
|
@@ -1256,8 +1256,17 @@ export abstract class DyNTS_App extends DyNTS_SingletonService {
|
|
|
1256
1256
|
private async mountSecureRoutes (): Promise<void> {
|
|
1257
1257
|
try {
|
|
1258
1258
|
if (this.fnLogs && this.deepLog) DyFM_Log.log('\nfn:. mountSecureRoutes');
|
|
1259
|
+
|
|
1260
|
+
if (!this.secureExpress) {
|
|
1261
|
+
throw new Error(
|
|
1262
|
+
'secureExpress was not initialized. ' +
|
|
1263
|
+
'Secure routes require getCertificationSettings and httpsPort, and cert files must exist.' +
|
|
1264
|
+
'\n\nYou need to set security to secure or both in any route and set httpsPort in getPortSettings.' +
|
|
1265
|
+
'\n\nYou need to set cert files in getCertificationSettings.'
|
|
1266
|
+
);
|
|
1267
|
+
}
|
|
1259
1268
|
|
|
1260
|
-
this.
|
|
1269
|
+
this.secureExpress.use(
|
|
1261
1270
|
(error, req, res, next): Promise<void> => this.expressErrorHandling(error, req, res, next)
|
|
1262
1271
|
);
|
|
1263
1272
|
|
|
@@ -1310,6 +1319,13 @@ export abstract class DyNTS_App extends DyNTS_SingletonService {
|
|
|
1310
1319
|
private async mountOpenRoutes(): Promise<void> {
|
|
1311
1320
|
try {
|
|
1312
1321
|
if (this.fnLogs && this.deepLog) DyFM_Log.log('\nfn:. mountOpenRoutes');
|
|
1322
|
+
|
|
1323
|
+
if (!this.openExpress) {
|
|
1324
|
+
throw new Error(
|
|
1325
|
+
'openExpress was not initialized. Open routes require getOpenExpress and httpPort.' +
|
|
1326
|
+
'\n\nYou need to set security to open or both in any route and set httpPort in getPortSettings.'
|
|
1327
|
+
);
|
|
1328
|
+
}
|
|
1313
1329
|
|
|
1314
1330
|
this.openExpress.use(
|
|
1315
1331
|
(error, req, res, next): Promise<void> => this.expressErrorHandling(error, req, res, next)
|