opticore-webapp 1.0.66 → 1.0.67
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/index.cjs +483 -305
- package/dist/index.d.cts +50 -67
- package/dist/index.d.ts +50 -67
- package/dist/index.js +496 -325
- package/dist/utils/translations/message.translation.en.json +32 -1
- package/dist/utils/translations/message.translation.fr.json +26 -1
- package/package.json +7 -7
package/dist/index.d.cts
CHANGED
|
@@ -1,19 +1,26 @@
|
|
|
1
|
-
import { CorsOptions } from 'cors';
|
|
2
1
|
import { Server } from 'http';
|
|
2
|
+
import { TDependency } from 'opticore-dependency-inject';
|
|
3
3
|
import { express } from 'opticore-express';
|
|
4
4
|
import { LoggerCore } from 'opticore-logger';
|
|
5
|
-
import {
|
|
5
|
+
import { CorsOptions } from 'cors';
|
|
6
|
+
import { TFeatureRoutes } from 'opticore-router';
|
|
6
7
|
|
|
7
|
-
interface
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
interface WebServerConstructorInterface {
|
|
9
|
+
app: express.Application;
|
|
10
|
+
loggerConfig: LoggerCore;
|
|
11
|
+
localLanguage: string;
|
|
12
|
+
environmentPath: any;
|
|
13
|
+
corsOriginOptions?: Partial<CorsOptions>;
|
|
10
14
|
}
|
|
11
15
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
/**
|
|
17
|
+
* WebServerCore - Architecture Serveur-Autorité
|
|
18
|
+
*
|
|
19
|
+
* Le serveur gère strictement ses états :
|
|
20
|
+
* - READY : Prêt à recevoir des demandes de hot reload
|
|
21
|
+
* - RELOADING : En cours de hot reload
|
|
22
|
+
* - BLOCKED : Bloqué par une erreur, refuse les nouveaux reloads
|
|
23
|
+
*/
|
|
17
24
|
declare class WebServerCore {
|
|
18
25
|
private serverUtility;
|
|
19
26
|
private expressApp;
|
|
@@ -23,82 +30,58 @@ declare class WebServerCore {
|
|
|
23
30
|
private readonly getEnvironment;
|
|
24
31
|
private readonly environmentPath;
|
|
25
32
|
private serverListenEvent;
|
|
26
|
-
private isHotReloading;
|
|
27
33
|
private currentRoutes;
|
|
28
34
|
private currentDependencies;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
* @param databaseCallback
|
|
39
|
-
* @param dependenciesProvider
|
|
40
|
-
*/
|
|
41
|
-
onStartServer(routers: TFeatureRoutes[], databaseCallback: (env: any) => void, dependenciesProvider?: TDependency[]): any;
|
|
42
|
-
/**
|
|
43
|
-
*
|
|
44
|
-
* @param serverWeb
|
|
45
|
-
*/
|
|
46
|
-
onListeningOnServerEvent(serverWeb: Server): void;
|
|
47
|
-
/**
|
|
48
|
-
*
|
|
49
|
-
* @param serverWeb
|
|
50
|
-
*/
|
|
51
|
-
onRequestOnServerEvent(serverWeb: Server): void;
|
|
52
|
-
/**
|
|
53
|
-
*
|
|
54
|
-
* @param allFeatureRoutes
|
|
55
|
-
* @private
|
|
56
|
-
*/
|
|
57
|
-
private registerRoutes;
|
|
58
|
-
/**
|
|
59
|
-
*
|
|
60
|
-
* @param localLanguage
|
|
61
|
-
* @private
|
|
62
|
-
*/
|
|
63
|
-
private stackTraceErrorHandling;
|
|
35
|
+
private server;
|
|
36
|
+
private errorEmitter;
|
|
37
|
+
private serverState;
|
|
38
|
+
private lastError;
|
|
39
|
+
private hotReloadAttempts;
|
|
40
|
+
private hotReloadSuccesses;
|
|
41
|
+
private hotReloadFailures;
|
|
42
|
+
constructor(paramsConstructor: WebServerConstructorInterface);
|
|
43
|
+
onStartServer(routers: TFeatureRoutes[], databaseCallback?: (env: any) => void, dependenciesProvider?: TDependency[]): Server | undefined;
|
|
64
44
|
/**
|
|
65
|
-
*
|
|
66
|
-
* @private
|
|
45
|
+
* ✅✅✅ Configuration de la gestion d'erreurs
|
|
67
46
|
*/
|
|
68
|
-
private
|
|
47
|
+
private setupErrorHandling;
|
|
48
|
+
private setupServerEvents;
|
|
49
|
+
private notifyServerReady;
|
|
69
50
|
private setupSignalHandlers;
|
|
51
|
+
private setupIPCHandlers;
|
|
70
52
|
/**
|
|
71
|
-
*
|
|
53
|
+
* ✅✅✅ HOT RELOAD avec gestion d'état stricte
|
|
72
54
|
*/
|
|
73
|
-
private
|
|
55
|
+
private performTrueHotReload;
|
|
74
56
|
/**
|
|
75
|
-
*
|
|
57
|
+
* Nettoie le cache des modules applicatifs
|
|
76
58
|
*/
|
|
77
|
-
private
|
|
59
|
+
private clearApplicationModulesCache;
|
|
60
|
+
private reloadConfigurations;
|
|
61
|
+
private reloadDependencies;
|
|
78
62
|
/**
|
|
79
|
-
*
|
|
63
|
+
* ✅✅✅ Notifier le watcher : SUCCÈS
|
|
80
64
|
*/
|
|
81
|
-
private
|
|
65
|
+
private notifyWatcherReloadSuccess;
|
|
82
66
|
/**
|
|
83
|
-
*
|
|
67
|
+
* ✅✅✅ Notifier le watcher : BLOQUÉ PAR ERREUR TRANSFORM
|
|
84
68
|
*/
|
|
85
|
-
private
|
|
69
|
+
private notifyWatcherBlockedByError;
|
|
86
70
|
/**
|
|
87
|
-
*
|
|
71
|
+
* ✅✅✅ Notifier le watcher : ERREUR GÉNÉRIQUE
|
|
88
72
|
*/
|
|
89
|
-
private
|
|
73
|
+
private notifyWatcherReloadError;
|
|
90
74
|
/**
|
|
91
|
-
*
|
|
75
|
+
* ✅✅✅ Parser les détails d'une TransformError
|
|
92
76
|
*/
|
|
93
|
-
private
|
|
77
|
+
private parseTransformError;
|
|
78
|
+
private registerRoutes;
|
|
79
|
+
private infoWebApp;
|
|
80
|
+
private shutdown;
|
|
94
81
|
}
|
|
95
82
|
|
|
96
83
|
declare const envPath: string;
|
|
97
84
|
|
|
98
|
-
type
|
|
99
|
-
featureRoute: IRouteDefinition[];
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
type KernelModuleType = [TFeatureRouteDefinition[], () => void];
|
|
85
|
+
type KernelModuleType = [any[], () => void];
|
|
103
86
|
|
|
104
|
-
export { type
|
|
87
|
+
export { type KernelModuleType, WebServerCore as WebServer, envPath };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,19 +1,26 @@
|
|
|
1
|
-
import { CorsOptions } from 'cors';
|
|
2
1
|
import { Server } from 'http';
|
|
2
|
+
import { TDependency } from 'opticore-dependency-inject';
|
|
3
3
|
import { express } from 'opticore-express';
|
|
4
4
|
import { LoggerCore } from 'opticore-logger';
|
|
5
|
-
import {
|
|
5
|
+
import { CorsOptions } from 'cors';
|
|
6
|
+
import { TFeatureRoutes } from 'opticore-router';
|
|
6
7
|
|
|
7
|
-
interface
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
interface WebServerConstructorInterface {
|
|
9
|
+
app: express.Application;
|
|
10
|
+
loggerConfig: LoggerCore;
|
|
11
|
+
localLanguage: string;
|
|
12
|
+
environmentPath: any;
|
|
13
|
+
corsOriginOptions?: Partial<CorsOptions>;
|
|
10
14
|
}
|
|
11
15
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
/**
|
|
17
|
+
* WebServerCore - Architecture Serveur-Autorité
|
|
18
|
+
*
|
|
19
|
+
* Le serveur gère strictement ses états :
|
|
20
|
+
* - READY : Prêt à recevoir des demandes de hot reload
|
|
21
|
+
* - RELOADING : En cours de hot reload
|
|
22
|
+
* - BLOCKED : Bloqué par une erreur, refuse les nouveaux reloads
|
|
23
|
+
*/
|
|
17
24
|
declare class WebServerCore {
|
|
18
25
|
private serverUtility;
|
|
19
26
|
private expressApp;
|
|
@@ -23,82 +30,58 @@ declare class WebServerCore {
|
|
|
23
30
|
private readonly getEnvironment;
|
|
24
31
|
private readonly environmentPath;
|
|
25
32
|
private serverListenEvent;
|
|
26
|
-
private isHotReloading;
|
|
27
33
|
private currentRoutes;
|
|
28
34
|
private currentDependencies;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
* @param databaseCallback
|
|
39
|
-
* @param dependenciesProvider
|
|
40
|
-
*/
|
|
41
|
-
onStartServer(routers: TFeatureRoutes[], databaseCallback: (env: any) => void, dependenciesProvider?: TDependency[]): any;
|
|
42
|
-
/**
|
|
43
|
-
*
|
|
44
|
-
* @param serverWeb
|
|
45
|
-
*/
|
|
46
|
-
onListeningOnServerEvent(serverWeb: Server): void;
|
|
47
|
-
/**
|
|
48
|
-
*
|
|
49
|
-
* @param serverWeb
|
|
50
|
-
*/
|
|
51
|
-
onRequestOnServerEvent(serverWeb: Server): void;
|
|
52
|
-
/**
|
|
53
|
-
*
|
|
54
|
-
* @param allFeatureRoutes
|
|
55
|
-
* @private
|
|
56
|
-
*/
|
|
57
|
-
private registerRoutes;
|
|
58
|
-
/**
|
|
59
|
-
*
|
|
60
|
-
* @param localLanguage
|
|
61
|
-
* @private
|
|
62
|
-
*/
|
|
63
|
-
private stackTraceErrorHandling;
|
|
35
|
+
private server;
|
|
36
|
+
private errorEmitter;
|
|
37
|
+
private serverState;
|
|
38
|
+
private lastError;
|
|
39
|
+
private hotReloadAttempts;
|
|
40
|
+
private hotReloadSuccesses;
|
|
41
|
+
private hotReloadFailures;
|
|
42
|
+
constructor(paramsConstructor: WebServerConstructorInterface);
|
|
43
|
+
onStartServer(routers: TFeatureRoutes[], databaseCallback?: (env: any) => void, dependenciesProvider?: TDependency[]): Server | undefined;
|
|
64
44
|
/**
|
|
65
|
-
*
|
|
66
|
-
* @private
|
|
45
|
+
* ✅✅✅ Configuration de la gestion d'erreurs
|
|
67
46
|
*/
|
|
68
|
-
private
|
|
47
|
+
private setupErrorHandling;
|
|
48
|
+
private setupServerEvents;
|
|
49
|
+
private notifyServerReady;
|
|
69
50
|
private setupSignalHandlers;
|
|
51
|
+
private setupIPCHandlers;
|
|
70
52
|
/**
|
|
71
|
-
*
|
|
53
|
+
* ✅✅✅ HOT RELOAD avec gestion d'état stricte
|
|
72
54
|
*/
|
|
73
|
-
private
|
|
55
|
+
private performTrueHotReload;
|
|
74
56
|
/**
|
|
75
|
-
*
|
|
57
|
+
* Nettoie le cache des modules applicatifs
|
|
76
58
|
*/
|
|
77
|
-
private
|
|
59
|
+
private clearApplicationModulesCache;
|
|
60
|
+
private reloadConfigurations;
|
|
61
|
+
private reloadDependencies;
|
|
78
62
|
/**
|
|
79
|
-
*
|
|
63
|
+
* ✅✅✅ Notifier le watcher : SUCCÈS
|
|
80
64
|
*/
|
|
81
|
-
private
|
|
65
|
+
private notifyWatcherReloadSuccess;
|
|
82
66
|
/**
|
|
83
|
-
*
|
|
67
|
+
* ✅✅✅ Notifier le watcher : BLOQUÉ PAR ERREUR TRANSFORM
|
|
84
68
|
*/
|
|
85
|
-
private
|
|
69
|
+
private notifyWatcherBlockedByError;
|
|
86
70
|
/**
|
|
87
|
-
*
|
|
71
|
+
* ✅✅✅ Notifier le watcher : ERREUR GÉNÉRIQUE
|
|
88
72
|
*/
|
|
89
|
-
private
|
|
73
|
+
private notifyWatcherReloadError;
|
|
90
74
|
/**
|
|
91
|
-
*
|
|
75
|
+
* ✅✅✅ Parser les détails d'une TransformError
|
|
92
76
|
*/
|
|
93
|
-
private
|
|
77
|
+
private parseTransformError;
|
|
78
|
+
private registerRoutes;
|
|
79
|
+
private infoWebApp;
|
|
80
|
+
private shutdown;
|
|
94
81
|
}
|
|
95
82
|
|
|
96
83
|
declare const envPath: string;
|
|
97
84
|
|
|
98
|
-
type
|
|
99
|
-
featureRoute: IRouteDefinition[];
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
type KernelModuleType = [TFeatureRouteDefinition[], () => void];
|
|
85
|
+
type KernelModuleType = [any[], () => void];
|
|
103
86
|
|
|
104
|
-
export { type
|
|
87
|
+
export { type KernelModuleType, WebServerCore as WebServer, envPath };
|