@elysiumjs/core 0.4.1 → 0.4.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.
- package/package.json +2 -5
- package/src/app.ts +2 -2
- package/src/http.ts +2 -2
- package/src/module.ts +7 -3
- package/src/wamp.ts +0 -2
package/package.json
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elysiumjs/core",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.3",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "A super-charged web framework for Bun, built on top of ElysiaJS.",
|
|
6
6
|
"private": false,
|
|
7
|
-
"author":
|
|
8
|
-
"name": "Axel Nana",
|
|
9
|
-
"email": "axel.nana@workbud.com"
|
|
10
|
-
},
|
|
7
|
+
"author": "Workbud Technologies Inc.",
|
|
11
8
|
"repository": {
|
|
12
9
|
"type": "git",
|
|
13
10
|
"url": "https://github.com/Workerly/elysium"
|
package/src/app.ts
CHANGED
|
@@ -583,9 +583,9 @@ export abstract class Application extends InteractsWithConsole {
|
|
|
583
583
|
|
|
584
584
|
const module = Service.bind(moduleClass);
|
|
585
585
|
|
|
586
|
-
module.beforeRegister();
|
|
586
|
+
await module.beforeRegister();
|
|
587
587
|
this.#elysia.use(await plugin(module));
|
|
588
|
-
module.afterRegister();
|
|
588
|
+
await module.afterRegister();
|
|
589
589
|
}
|
|
590
590
|
|
|
591
591
|
Event.emit('elysium:server:after-init', this, this);
|
package/src/http.ts
CHANGED
|
@@ -346,9 +346,9 @@ export namespace Http {
|
|
|
346
346
|
|
|
347
347
|
if (props.scope === HttpControllerScope.SERVER) {
|
|
348
348
|
const controller = Service.make(target);
|
|
349
|
-
app.
|
|
349
|
+
app.resolve({ as: 'local' }, () => ({ controller: () => controller }));
|
|
350
350
|
} else if (props.scope === HttpControllerScope.REQUEST) {
|
|
351
|
-
app.
|
|
351
|
+
app.resolve({ as: 'local' }, () => ({ controller: () => Service.make(target) }));
|
|
352
352
|
}
|
|
353
353
|
|
|
354
354
|
const onRequest = Reflect.getMetadata('http:onRequest', target) ?? {};
|
package/src/module.ts
CHANGED
|
@@ -66,7 +66,7 @@ export abstract class Module {
|
|
|
66
66
|
const props = assign({ controllers: [] }, options) as Required<ModuleProps>;
|
|
67
67
|
|
|
68
68
|
const plugin: ElysiaApp = new Elysia({ name: target.name, prefix: options.prefix });
|
|
69
|
-
plugin.
|
|
69
|
+
plugin.resolve({ as: 'local' }, () => ({ module: m }));
|
|
70
70
|
|
|
71
71
|
const middlewares = Reflect.getMetadata(Symbols.middlewares, target) ?? [];
|
|
72
72
|
applyMiddlewares(middlewares, plugin);
|
|
@@ -95,10 +95,14 @@ export abstract class Module {
|
|
|
95
95
|
/**
|
|
96
96
|
* Hooks that are executed before the module is registered.
|
|
97
97
|
*/
|
|
98
|
-
public beforeRegister(): void {
|
|
98
|
+
public beforeRegister(): Promise<void> {
|
|
99
|
+
return Promise.resolve();
|
|
100
|
+
}
|
|
99
101
|
|
|
100
102
|
/**
|
|
101
103
|
* Hooks that are executed after the module is registered.
|
|
102
104
|
*/
|
|
103
|
-
public afterRegister(): void {
|
|
105
|
+
public afterRegister(): Promise<void> {
|
|
106
|
+
return Promise.resolve();
|
|
107
|
+
}
|
|
104
108
|
}
|
package/src/wamp.ts
CHANGED