@midwayjs/mock 3.4.0-beta.7 → 3.4.0
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/client/socketio.d.ts +6 -6
- package/dist/creator.js +3 -2
- package/package.json +9 -8
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/// <reference types="socket.io-client" />
|
|
2
1
|
/// <reference types="node" />
|
|
3
|
-
|
|
2
|
+
import type { ManagerOptions, SocketOptions, Socket } from 'socket.io-client';
|
|
3
|
+
export interface MidwaySocketIOClientOptions extends Partial<ManagerOptions & SocketOptions> {
|
|
4
4
|
url?: string;
|
|
5
5
|
protocol?: string;
|
|
6
6
|
host?: string;
|
|
@@ -11,12 +11,12 @@ export declare class SocketIOWrapperClient {
|
|
|
11
11
|
private readonly socket;
|
|
12
12
|
constructor(socket: any);
|
|
13
13
|
connect(): Promise<unknown>;
|
|
14
|
-
getSocket():
|
|
14
|
+
getSocket(): Socket<import("@socket.io/component-emitter").DefaultEventsMap, import("@socket.io/component-emitter").DefaultEventsMap>;
|
|
15
15
|
send(eventName: string, ...args: any[]): void;
|
|
16
16
|
on(eventName: string, handler: any): void;
|
|
17
|
-
once(eventName: string, handler: any):
|
|
18
|
-
removeListener(event: string, fn?: any):
|
|
19
|
-
emit(eventName: string, ...args: any[]):
|
|
17
|
+
once(eventName: string, handler: any): Socket<import("@socket.io/component-emitter").DefaultEventsMap, import("@socket.io/component-emitter").DefaultEventsMap>;
|
|
18
|
+
removeListener(event: string, fn?: any): Socket<import("@socket.io/component-emitter").DefaultEventsMap, import("@socket.io/component-emitter").DefaultEventsMap>;
|
|
19
|
+
emit(eventName: string, ...args: any[]): Socket<import("@socket.io/component-emitter").DefaultEventsMap, import("@socket.io/component-emitter").DefaultEventsMap>;
|
|
20
20
|
sendWithAck(eventName: string, ...args: any[]): Promise<unknown>;
|
|
21
21
|
close(): void;
|
|
22
22
|
}
|
package/dist/creator.js
CHANGED
|
@@ -11,6 +11,7 @@ const util_1 = require("util");
|
|
|
11
11
|
const fs_1 = require("fs");
|
|
12
12
|
const yaml = require("js-yaml");
|
|
13
13
|
const getRawBody = require("raw-body");
|
|
14
|
+
const async_hooks_context_manager_1 = require("@midwayjs/async-hooks-context-manager");
|
|
14
15
|
const debug = (0, util_1.debuglog)('midway:debug');
|
|
15
16
|
process.setMaxListeners(0);
|
|
16
17
|
function formatPath(baseDir, p) {
|
|
@@ -100,6 +101,7 @@ async function create(appDir = process.cwd(), options, customFramework) {
|
|
|
100
101
|
await (0, core_1.initializeGlobalApplicationContext)({
|
|
101
102
|
...options,
|
|
102
103
|
appDir,
|
|
104
|
+
asyncContextManager: (0, async_hooks_context_manager_1.createContextManager)(),
|
|
103
105
|
imports: []
|
|
104
106
|
.concat(options.imports)
|
|
105
107
|
.concat(options.baseDir
|
|
@@ -166,7 +168,6 @@ async function createFunctionApp(baseDir = process.cwd(), options, customFramewo
|
|
|
166
168
|
}
|
|
167
169
|
}
|
|
168
170
|
if (options.starter) {
|
|
169
|
-
options.exportAllHandler = true;
|
|
170
171
|
options.appDir = baseDir;
|
|
171
172
|
debug(`[mock]: Create app, appDir="${options.appDir}"`);
|
|
172
173
|
process.env.MIDWAY_TS_MODE = 'true';
|
|
@@ -236,7 +237,7 @@ async function createFunctionApp(baseDir = process.cwd(), options, customFramewo
|
|
|
236
237
|
if (customPort) {
|
|
237
238
|
await new Promise(resolve => {
|
|
238
239
|
let server;
|
|
239
|
-
if (
|
|
240
|
+
if (options.ssl) {
|
|
240
241
|
server = require('https').createServer({
|
|
241
242
|
key: (0, fs_1.readFileSync)((0, path_1.join)(__dirname, '../ssl/ssl.key'), 'utf8'),
|
|
242
243
|
cert: (0, fs_1.readFileSync)((0, path_1.join)(__dirname, '../ssl/ssl.pem'), 'utf8'),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@midwayjs/mock",
|
|
3
|
-
"version": "3.4.0
|
|
3
|
+
"version": "3.4.0",
|
|
4
4
|
"description": "create your test app from midway framework",
|
|
5
5
|
"main": "dist/index",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
@@ -27,17 +27,18 @@
|
|
|
27
27
|
},
|
|
28
28
|
"license": "MIT",
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@midwayjs/core": "^3.4.0
|
|
31
|
-
"@midwayjs/decorator": "^3.4.0
|
|
30
|
+
"@midwayjs/core": "^3.4.0",
|
|
31
|
+
"@midwayjs/decorator": "^3.4.0",
|
|
32
32
|
"@midwayjs/logger": "^2.15.0",
|
|
33
33
|
"@types/amqplib": "0.8.2",
|
|
34
34
|
"amqplib": "0.10.0",
|
|
35
|
-
"kafkajs": "1.
|
|
36
|
-
"socket.io": "4.
|
|
37
|
-
"socket.io-client": "4.
|
|
38
|
-
"ws": "8.8.
|
|
35
|
+
"kafkajs": "2.1.0",
|
|
36
|
+
"socket.io": "4.5.1",
|
|
37
|
+
"socket.io-client": "4.5.1",
|
|
38
|
+
"ws": "8.8.1"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
+
"@midwayjs/async-hooks-context-manager": "^3.4.0",
|
|
41
42
|
"@types/supertest": "2.0.12",
|
|
42
43
|
"fs-extra": "10.0.1",
|
|
43
44
|
"js-yaml": "4.1.0",
|
|
@@ -49,5 +50,5 @@
|
|
|
49
50
|
"type": "git",
|
|
50
51
|
"url": "http://github.com/midwayjs/midway.git"
|
|
51
52
|
},
|
|
52
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "e48ea9cb52c6e70ab25b68f1188006100eab8184"
|
|
53
54
|
}
|