@moostjs/event-http 0.2.3 → 0.2.4
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 +16 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.mjs +16 -0
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -28,6 +28,19 @@ function __awaiter$1(thisArg, _arguments, P, generator) {
|
|
|
28
28
|
});
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
+
function createProvideRegistry(...args) {
|
|
32
|
+
const provide = {};
|
|
33
|
+
for (const a of args) {
|
|
34
|
+
const [type, fn] = a;
|
|
35
|
+
const key = typeof type === 'string' ? type : Symbol.for(type);
|
|
36
|
+
provide[key] = {
|
|
37
|
+
fn,
|
|
38
|
+
resolved: false,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
return provide;
|
|
42
|
+
}
|
|
43
|
+
|
|
31
44
|
class MoostHttp {
|
|
32
45
|
constructor(httpApp) {
|
|
33
46
|
this.pathBuilders = {};
|
|
@@ -50,6 +63,9 @@ class MoostHttp {
|
|
|
50
63
|
listen(...args) {
|
|
51
64
|
return this.httpApp.listen(...args);
|
|
52
65
|
}
|
|
66
|
+
getProvideRegistry() {
|
|
67
|
+
return createProvideRegistry([eventHttp.WooksHttp, () => this.getHttpApp()], ['WooksHttp', () => this.getHttpApp()]);
|
|
68
|
+
}
|
|
53
69
|
bindHandler(opts) {
|
|
54
70
|
let fn;
|
|
55
71
|
for (const handler of opts.handlers) {
|
package/dist/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ import { ServerResponse } from 'http';
|
|
|
5
5
|
import { TMoostAdapter } from 'moost';
|
|
6
6
|
import { TMoostAdapterOptions } from 'moost';
|
|
7
7
|
import { TProstoRouterPathBuilder } from '@prostojs/router';
|
|
8
|
+
import { TProvideRegistry } from '@prostojs/infact';
|
|
8
9
|
import { TWooksHttpOptions } from '@wooksjs/event-http';
|
|
9
10
|
import { WooksHttp } from '@wooksjs/event-http';
|
|
10
11
|
|
|
@@ -102,6 +103,7 @@ export declare class MoostHttp implements TMoostAdapter<THttpHandlerMeta> {
|
|
|
102
103
|
DELETE?: TProstoRouterPathBuilder<Record<string, string | string[]>>;
|
|
103
104
|
};
|
|
104
105
|
};
|
|
106
|
+
getProvideRegistry(): TProvideRegistry;
|
|
105
107
|
bindHandler<T extends object = object>(opts: TMoostAdapterOptions<THttpHandlerMeta, T>): void | Promise<void>;
|
|
106
108
|
}
|
|
107
109
|
|
package/dist/index.mjs
CHANGED
|
@@ -26,6 +26,19 @@ function __awaiter$1(thisArg, _arguments, P, generator) {
|
|
|
26
26
|
});
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
+
function createProvideRegistry(...args) {
|
|
30
|
+
const provide = {};
|
|
31
|
+
for (const a of args) {
|
|
32
|
+
const [type, fn] = a;
|
|
33
|
+
const key = typeof type === 'string' ? type : Symbol.for(type);
|
|
34
|
+
provide[key] = {
|
|
35
|
+
fn,
|
|
36
|
+
resolved: false,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
return provide;
|
|
40
|
+
}
|
|
41
|
+
|
|
29
42
|
class MoostHttp {
|
|
30
43
|
constructor(httpApp) {
|
|
31
44
|
this.pathBuilders = {};
|
|
@@ -48,6 +61,9 @@ class MoostHttp {
|
|
|
48
61
|
listen(...args) {
|
|
49
62
|
return this.httpApp.listen(...args);
|
|
50
63
|
}
|
|
64
|
+
getProvideRegistry() {
|
|
65
|
+
return createProvideRegistry([WooksHttp, () => this.getHttpApp()], ['WooksHttp', () => this.getHttpApp()]);
|
|
66
|
+
}
|
|
51
67
|
bindHandler(opts) {
|
|
52
68
|
let fn;
|
|
53
69
|
for (const handler of opts.handlers) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moostjs/event-http",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4",
|
|
4
4
|
"description": "@moostjs/event-http",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
},
|
|
29
29
|
"homepage": "https://github.com/moostjs/moostjs/tree/main/packages/event-http#readme",
|
|
30
30
|
"peerDependencies": {
|
|
31
|
-
"moost": "0.2.
|
|
31
|
+
"moost": "0.2.4",
|
|
32
32
|
"wooks": "^0.2.5"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|