@leyyo/http-mock 1.3.3 → 1.3.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/application/index.d.ts +1 -1
- package/dist/application/index.js +1 -18
- package/dist/application/index.types.js +1 -3
- package/dist/application/mock-application.d.ts +2 -2
- package/dist/application/mock-application.js +25 -13
- package/dist/enum/http-method.js +1 -5
- package/dist/enum/http-protocol.js +1 -5
- package/dist/enum/index.d.ts +2 -2
- package/dist/enum/index.js +2 -19
- package/dist/event/http-event.js +17 -36
- package/dist/event/index.d.ts +2 -2
- package/dist/event/index.js +2 -19
- package/dist/event/index.types.js +1 -3
- package/dist/http-mock.d.ts +1 -1
- package/dist/http-mock.js +15 -16
- package/dist/index.d.ts +8 -7
- package/dist/index.foretell.d.ts +1 -0
- package/dist/index.foretell.js +19 -0
- package/dist/index.js +8 -24
- package/dist/{loader.d.ts → index.loader.d.ts} +0 -1
- package/dist/index.loader.js +10 -0
- package/dist/index.types.d.ts +2 -2
- package/dist/index.types.js +1 -3
- package/dist/internal.d.ts +1 -1
- package/dist/internal.js +2 -6
- package/dist/request/index.d.ts +2 -2
- package/dist/request/index.js +2 -19
- package/dist/request/index.types.d.ts +3 -3
- package/dist/request/index.types.js +1 -3
- package/dist/request/mock.request.d.ts +3 -3
- package/dist/request/mock.request.js +135 -37
- package/dist/response/index-types.d.ts +1 -1
- package/dist/response/index-types.js +1 -3
- package/dist/response/index.d.ts +2 -2
- package/dist/response/index.js +2 -19
- package/dist/response/mock-response.d.ts +2 -2
- package/dist/response/mock-response.js +98 -46
- package/package.json +5 -4
- package/dist/application/index.js.map +0 -1
- package/dist/application/index.types.js.map +0 -1
- package/dist/application/mock-application.js.map +0 -1
- package/dist/enum/http-method.js.map +0 -1
- package/dist/enum/http-protocol.js.map +0 -1
- package/dist/enum/index.js.map +0 -1
- package/dist/event/http-event.js.map +0 -1
- package/dist/event/index.js.map +0 -1
- package/dist/event/index.types.js.map +0 -1
- package/dist/http-mock.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/index.types.js.map +0 -1
- package/dist/internal.js.map +0 -1
- package/dist/loader.js +0 -64
- package/dist/loader.js.map +0 -1
- package/dist/request/index.js.map +0 -1
- package/dist/request/index.types.js.map +0 -1
- package/dist/request/mock.request.js.map +0 -1
- package/dist/response/index-types.js.map +0 -1
- package/dist/response/index.js.map +0 -1
- package/dist/response/mock-response.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './mock-application';
|
|
1
|
+
export * from './mock-application.js';
|
|
@@ -1,18 +1 @@
|
|
|
1
|
-
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./mock-application"), exports);
|
|
18
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
export * from './mock-application.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Application, RequestParamHandler, Router } from "express";
|
|
2
2
|
import * as http from "http";
|
|
3
|
-
import { MockApplicationLike } from "./index.types";
|
|
4
|
-
import { HttpEvent } from "../event";
|
|
3
|
+
import { MockApplicationLike } from "./index.types.js";
|
|
4
|
+
import { HttpEvent } from "../event/index.js";
|
|
5
5
|
/**
|
|
6
6
|
* Http mock application, it extends express application
|
|
7
7
|
* */
|
|
@@ -1,17 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.MockApplication = void 0;
|
|
4
|
-
const event_1 = require("../event");
|
|
5
|
-
const common_1 = require("@leyyo/common");
|
|
1
|
+
import { HttpEvent } from "../event/index.js";
|
|
2
|
+
import { logCommon } from "@leyyo/common";
|
|
6
3
|
let _firstOrigin;
|
|
7
4
|
// noinspection JSUnusedGlobalSymbols
|
|
8
5
|
/**
|
|
9
6
|
* Http mock application, it extends express application
|
|
10
7
|
* */
|
|
11
|
-
class MockApplication extends
|
|
8
|
+
export class MockApplication extends HttpEvent {
|
|
9
|
+
// region properties
|
|
10
|
+
/** @inheritDoc */
|
|
11
|
+
_router;
|
|
12
|
+
/** @inheritDoc */
|
|
13
|
+
locals;
|
|
14
|
+
/** @inheritDoc */
|
|
15
|
+
map;
|
|
16
|
+
/** @inheritDoc */
|
|
17
|
+
mountpath;
|
|
12
18
|
constructor(origin) {
|
|
13
19
|
super(origin);
|
|
14
20
|
}
|
|
21
|
+
/** @inheritDoc */
|
|
22
|
+
resource;
|
|
23
|
+
/** @inheritDoc */
|
|
24
|
+
router;
|
|
25
|
+
/** @inheritDoc */
|
|
26
|
+
routes;
|
|
27
|
+
/** @inheritDoc */
|
|
28
|
+
settings;
|
|
29
|
+
/** @inheritDoc */
|
|
30
|
+
stack;
|
|
15
31
|
// endregion properties
|
|
16
32
|
// region http-methods
|
|
17
33
|
/** @inheritDoc */
|
|
@@ -206,13 +222,11 @@ class MockApplication extends event_1.HttpEvent {
|
|
|
206
222
|
}
|
|
207
223
|
/** @inheritDoc */
|
|
208
224
|
param(name, handler) {
|
|
209
|
-
|
|
210
|
-
return (_d = this._origin) === null || _d === void 0 ? void 0 : _d.param(name, handler);
|
|
225
|
+
return this._origin?.param(name, handler);
|
|
211
226
|
}
|
|
212
227
|
/** @inheritDoc */
|
|
213
228
|
path() {
|
|
214
|
-
|
|
215
|
-
return (_d = this._origin) === null || _d === void 0 ? void 0 : _d.path();
|
|
229
|
+
return this._origin?.path();
|
|
216
230
|
}
|
|
217
231
|
/** @inheritDoc */
|
|
218
232
|
render(_n, _o, _c) {
|
|
@@ -249,6 +263,4 @@ class MockApplication extends event_1.HttpEvent {
|
|
|
249
263
|
return _firstOrigin;
|
|
250
264
|
}
|
|
251
265
|
}
|
|
252
|
-
|
|
253
|
-
const logger = common_1.logCommon.of(MockApplication);
|
|
254
|
-
//# sourceMappingURL=mock-application.js.map
|
|
266
|
+
const logger = logCommon.of(MockApplication);
|
package/dist/enum/http-method.js
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.HttpMethodItems = void 0;
|
|
4
1
|
const literals = [
|
|
5
2
|
'delete',
|
|
6
3
|
'get',
|
|
@@ -17,5 +14,4 @@ const literals = [
|
|
|
17
14
|
/**
|
|
18
15
|
* @type {ReadonlyArray<HttpMethod>}
|
|
19
16
|
* */
|
|
20
|
-
|
|
21
|
-
//# sourceMappingURL=http-method.js.map
|
|
17
|
+
export const HttpMethodItems = literals;
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.HttpProtocolItems = void 0;
|
|
4
1
|
const literals = [
|
|
5
2
|
'http',
|
|
6
3
|
'https',
|
|
@@ -9,5 +6,4 @@ const literals = [
|
|
|
9
6
|
/**
|
|
10
7
|
* @type {ReadonlyArray<HttpProtocol>}
|
|
11
8
|
* */
|
|
12
|
-
|
|
13
|
-
//# sourceMappingURL=http-protocol.js.map
|
|
9
|
+
export const HttpProtocolItems = literals;
|
package/dist/enum/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './http-method';
|
|
2
|
-
export * from './http-protocol';
|
|
1
|
+
export * from './http-method.js';
|
|
2
|
+
export * from './http-protocol.js';
|
package/dist/enum/index.js
CHANGED
|
@@ -1,19 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./http-method"), exports);
|
|
18
|
-
__exportStar(require("./http-protocol"), exports);
|
|
19
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
export * from './http-method.js';
|
|
2
|
+
export * from './http-protocol.js';
|
package/dist/event/http-event.js
CHANGED
|
@@ -1,97 +1,78 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.HttpEvent = void 0;
|
|
4
1
|
/**
|
|
5
2
|
* Abstract class for Request and Response
|
|
6
3
|
* */
|
|
7
|
-
class HttpEvent {
|
|
4
|
+
export class HttpEvent {
|
|
5
|
+
_origin;
|
|
8
6
|
constructor(_origin) {
|
|
9
7
|
this._origin = _origin;
|
|
10
8
|
}
|
|
11
9
|
/** @inheritDoc */
|
|
12
10
|
addListener(e, l) {
|
|
13
|
-
|
|
14
|
-
(_a = this._origin) === null || _a === void 0 ? void 0 : _a.addListener(e, l);
|
|
11
|
+
this._origin?.addListener(e, l);
|
|
15
12
|
return this;
|
|
16
13
|
}
|
|
17
14
|
/** @inheritDoc */
|
|
18
15
|
emit(e, ...a) {
|
|
19
|
-
|
|
20
|
-
return (_b = (_a = this._origin) === null || _a === void 0 ? void 0 : _a.emit(e, a)) !== null && _b !== void 0 ? _b : false;
|
|
16
|
+
return this._origin?.emit(e, a) ?? false;
|
|
21
17
|
}
|
|
22
18
|
/** @inheritDoc */
|
|
23
19
|
eventNames() {
|
|
24
|
-
|
|
25
|
-
return (_b = (_a = this._origin) === null || _a === void 0 ? void 0 : _a.eventNames()) !== null && _b !== void 0 ? _b : [];
|
|
20
|
+
return this._origin?.eventNames() ?? [];
|
|
26
21
|
}
|
|
27
22
|
/** @inheritDoc */
|
|
28
23
|
getMaxListeners() {
|
|
29
|
-
|
|
30
|
-
return (_b = (_a = this._origin) === null || _a === void 0 ? void 0 : _a.getMaxListeners()) !== null && _b !== void 0 ? _b : 10;
|
|
24
|
+
return this._origin?.getMaxListeners() ?? 10;
|
|
31
25
|
}
|
|
32
26
|
/** @inheritDoc */
|
|
33
27
|
listenerCount(e) {
|
|
34
|
-
|
|
35
|
-
return (_b = (_a = this._origin) === null || _a === void 0 ? void 0 : _a.listenerCount(e)) !== null && _b !== void 0 ? _b : 0;
|
|
28
|
+
return this._origin?.listenerCount(e) ?? 0;
|
|
36
29
|
}
|
|
37
30
|
/** @inheritDoc */
|
|
38
31
|
listeners(e) {
|
|
39
|
-
|
|
40
|
-
return (_b = (_a = this._origin) === null || _a === void 0 ? void 0 : _a.listeners(e)) !== null && _b !== void 0 ? _b : [];
|
|
32
|
+
return this._origin?.listeners(e) ?? [];
|
|
41
33
|
}
|
|
42
34
|
/** @inheritDoc */
|
|
43
35
|
off(e, l) {
|
|
44
|
-
|
|
45
|
-
(_a = this._origin) === null || _a === void 0 ? void 0 : _a.off(e, l);
|
|
36
|
+
this._origin?.off(e, l);
|
|
46
37
|
return this;
|
|
47
38
|
}
|
|
48
39
|
/** @inheritDoc */
|
|
49
40
|
on(e, l) {
|
|
50
|
-
|
|
51
|
-
(_a = this._origin) === null || _a === void 0 ? void 0 : _a.on(e, l);
|
|
41
|
+
this._origin?.on(e, l);
|
|
52
42
|
return this;
|
|
53
43
|
}
|
|
54
44
|
/** @inheritDoc */
|
|
55
45
|
once(e, l) {
|
|
56
|
-
|
|
57
|
-
(_a = this._origin) === null || _a === void 0 ? void 0 : _a.once(e, l);
|
|
46
|
+
this._origin?.once(e, l);
|
|
58
47
|
return this;
|
|
59
48
|
}
|
|
60
49
|
/** @inheritDoc */
|
|
61
50
|
prependListener(e, l) {
|
|
62
|
-
|
|
63
|
-
(_a = this._origin) === null || _a === void 0 ? void 0 : _a.prependListener(e, l);
|
|
51
|
+
this._origin?.prependListener(e, l);
|
|
64
52
|
return this;
|
|
65
53
|
}
|
|
66
54
|
/** @inheritDoc */
|
|
67
55
|
prependOnceListener(e, l) {
|
|
68
|
-
|
|
69
|
-
(_a = this._origin) === null || _a === void 0 ? void 0 : _a.prependOnceListener(e, l);
|
|
56
|
+
this._origin?.prependOnceListener(e, l);
|
|
70
57
|
return this;
|
|
71
58
|
}
|
|
72
59
|
/** @inheritDoc */
|
|
73
60
|
rawListeners(e) {
|
|
74
|
-
|
|
75
|
-
return (_b = (_a = this._origin) === null || _a === void 0 ? void 0 : _a.rawListeners(e)) !== null && _b !== void 0 ? _b : [];
|
|
61
|
+
return this._origin?.rawListeners(e) ?? [];
|
|
76
62
|
}
|
|
77
63
|
/** @inheritDoc */
|
|
78
64
|
removeAllListeners(e) {
|
|
79
|
-
|
|
80
|
-
(_a = this._origin) === null || _a === void 0 ? void 0 : _a.removeAllListeners(e);
|
|
65
|
+
this._origin?.removeAllListeners(e);
|
|
81
66
|
return this;
|
|
82
67
|
}
|
|
83
68
|
/** @inheritDoc */
|
|
84
69
|
removeListener(e, l) {
|
|
85
|
-
|
|
86
|
-
(_a = this._origin) === null || _a === void 0 ? void 0 : _a.removeListener(e, l);
|
|
70
|
+
this._origin?.removeListener(e, l);
|
|
87
71
|
return this;
|
|
88
72
|
}
|
|
89
73
|
/** @inheritDoc */
|
|
90
74
|
setMaxListeners(m) {
|
|
91
|
-
|
|
92
|
-
(_a = this._origin) === null || _a === void 0 ? void 0 : _a.setMaxListeners(m);
|
|
75
|
+
this._origin?.setMaxListeners(m);
|
|
93
76
|
return this;
|
|
94
77
|
}
|
|
95
78
|
}
|
|
96
|
-
exports.HttpEvent = HttpEvent;
|
|
97
|
-
//# sourceMappingURL=http-event.js.map
|
package/dist/event/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './index.types';
|
|
2
|
-
export * from './http-event';
|
|
1
|
+
export * from './index.types.js';
|
|
2
|
+
export * from './http-event.js';
|
package/dist/event/index.js
CHANGED
|
@@ -1,19 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./index.types"), exports);
|
|
18
|
-
__exportStar(require("./http-event"), exports);
|
|
19
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
export * from './index.types.js';
|
|
2
|
+
export * from './http-event.js';
|
package/dist/http-mock.d.ts
CHANGED
package/dist/http-mock.js
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const response_1 = require("./response");
|
|
5
|
-
const request_1 = require("./request");
|
|
6
|
-
const application_1 = require("./application");
|
|
1
|
+
import { MockResponse } from "./response/index.js";
|
|
2
|
+
import { MockRequest } from "./request/index.js";
|
|
3
|
+
import { MockApplication } from "./application/index.js";
|
|
7
4
|
/**
|
|
8
5
|
* Http mock class
|
|
9
6
|
* */
|
|
10
7
|
class HttpMock {
|
|
8
|
+
/**
|
|
9
|
+
* Is it initialized?
|
|
10
|
+
* */
|
|
11
|
+
_initialized;
|
|
11
12
|
/** @inheritDoc */
|
|
12
13
|
init(req) {
|
|
13
14
|
if (this._initialized) {
|
|
14
15
|
return;
|
|
15
16
|
}
|
|
16
17
|
this._initialized = true;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
MockRequest.setFirstOrigin(req);
|
|
19
|
+
MockResponse.setFirstOrigin(req.res);
|
|
20
|
+
MockApplication.setFirstOrigin(req.app);
|
|
20
21
|
}
|
|
21
22
|
/** @inheritDoc */
|
|
22
23
|
fork() {
|
|
23
|
-
return [
|
|
24
|
+
return [MockRequest.firstOrigin, MockResponse.firstOrigin, MockApplication.firstOrigin];
|
|
24
25
|
}
|
|
25
26
|
/** @inheritDoc */
|
|
26
27
|
forBulk(req, service, resolver, custom) {
|
|
27
|
-
|
|
28
|
-
const
|
|
29
|
-
const
|
|
30
|
-
const newApp = (_a = application_1.MockApplication.firstOrigin) !== null && _a !== void 0 ? _a : new application_1.MockApplication(req.app);
|
|
28
|
+
const newReq = new MockRequest(service, req, custom);
|
|
29
|
+
const newRes = new MockResponse(resolver, req.res);
|
|
30
|
+
const newApp = MockApplication.firstOrigin ?? new MockApplication(req.app);
|
|
31
31
|
return [newReq, newRes, newApp];
|
|
32
32
|
}
|
|
33
33
|
}
|
|
@@ -37,5 +37,4 @@ class HttpMock {
|
|
|
37
37
|
*
|
|
38
38
|
* @type {HttpMockLike}
|
|
39
39
|
* */
|
|
40
|
-
|
|
41
|
-
//# sourceMappingURL=http-mock.js.map
|
|
40
|
+
export const httpMock = new HttpMock();
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
export * from './enum';
|
|
2
|
-
export * from './application';
|
|
3
|
-
export * from './request';
|
|
4
|
-
export * from './response';
|
|
5
|
-
export * from './http-mock';
|
|
6
|
-
export * from './index.types';
|
|
7
|
-
export * from './loader';
|
|
1
|
+
export * from './enum/index.js';
|
|
2
|
+
export * from './application/index.js';
|
|
3
|
+
export * from './request/index.js';
|
|
4
|
+
export * from './response/index.js';
|
|
5
|
+
export * from './http-mock.js';
|
|
6
|
+
export * from './index.types.js';
|
|
7
|
+
export * from './index.loader.js';
|
|
8
|
+
export * from './index.foretell.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const foretell_leyyoHttpMock: (() => void)[];
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// noinspection JSUnusedGlobalSymbols
|
|
2
|
+
import { foretell_leyyoCommon, literalPool } from "@leyyo/common";
|
|
3
|
+
import { FQN } from "./internal.js";
|
|
4
|
+
export const foretell_leyyoHttpMock = [
|
|
5
|
+
// dependencies
|
|
6
|
+
...foretell_leyyoCommon,
|
|
7
|
+
() => literalPool.register({
|
|
8
|
+
name: 'HttpMethod',
|
|
9
|
+
fqn: FQN,
|
|
10
|
+
i18n: true,
|
|
11
|
+
lazyTarget: import('./enum/http-method.js').then(m => m.HttpMethodItems)
|
|
12
|
+
}),
|
|
13
|
+
() => literalPool.register({
|
|
14
|
+
name: 'HttpProtocol',
|
|
15
|
+
fqn: FQN,
|
|
16
|
+
i18n: true,
|
|
17
|
+
lazyTarget: import('./enum/http-protocol.js').then(m => m.HttpProtocolItems)
|
|
18
|
+
})
|
|
19
|
+
];
|
package/dist/index.js
CHANGED
|
@@ -1,24 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./enum"), exports);
|
|
18
|
-
__exportStar(require("./application"), exports);
|
|
19
|
-
__exportStar(require("./request"), exports);
|
|
20
|
-
__exportStar(require("./response"), exports);
|
|
21
|
-
__exportStar(require("./http-mock"), exports);
|
|
22
|
-
__exportStar(require("./index.types"), exports);
|
|
23
|
-
__exportStar(require("./loader"), exports);
|
|
24
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
export * from './enum/index.js';
|
|
2
|
+
export * from './application/index.js';
|
|
3
|
+
export * from './request/index.js';
|
|
4
|
+
export * from './response/index.js';
|
|
5
|
+
export * from './http-mock.js';
|
|
6
|
+
export * from './index.types.js';
|
|
7
|
+
export * from './index.loader.js';
|
|
8
|
+
export * from './index.foretell.js';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// noinspection JSUnusedGlobalSymbols
|
|
2
|
+
import { defineLoader, loader_leyyoCommon } from "@leyyo/common";
|
|
3
|
+
import { FQN } from "./internal.js";
|
|
4
|
+
export const loader_leyyoHttpMock = defineLoader(FQN,
|
|
5
|
+
// dependencies
|
|
6
|
+
...loader_leyyoCommon,
|
|
7
|
+
// enums
|
|
8
|
+
() => import('./enum/http-method.js').then(m => m.HttpMethodItems), () => import('./enum/http-protocol.js').then(m => m.HttpProtocolItems),
|
|
9
|
+
// classes
|
|
10
|
+
() => import('./application/mock-application.js').then(m => m.MockApplication), () => import('./request/mock.request.js').then(m => m.MockRequest), () => import('./response/mock-response.js').then(m => m.MockResponse));
|
package/dist/index.types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Application, Request, Response } from "express";
|
|
2
|
-
import { MockResponseResolve, ResponseData } from "./response";
|
|
3
|
-
import { MockServiceRequest } from "./request";
|
|
2
|
+
import { MockResponseResolve, ResponseData } from "./response/index.js";
|
|
3
|
+
import { MockServiceRequest } from "./request/index.js";
|
|
4
4
|
import { Dict } from "@leyyo/common";
|
|
5
5
|
export type HttpMockTuple = [Request, Response, Application];
|
|
6
6
|
/**
|
package/dist/index.types.js
CHANGED
package/dist/internal.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const FQN
|
|
1
|
+
export declare const NME: string, FQN: string, VER: string, CNF: import("@leyyo/common").LeyyoConfig;
|
package/dist/internal.js
CHANGED
|
@@ -1,6 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.FQN = void 0;
|
|
4
|
-
// noinspection JSUnusedGlobalSymbols
|
|
5
|
-
exports.FQN = 'leyyo.http-mock';
|
|
6
|
-
//# sourceMappingURL=internal.js.map
|
|
1
|
+
import { sysAll } from '@leyyo/common';
|
|
2
|
+
export const { pck: { name: NME, fqn: FQN, version: VER }, config: CNF } = sysAll(import.meta.url);
|
package/dist/request/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './index.types';
|
|
2
|
-
export * from './mock.request';
|
|
1
|
+
export * from './index.types.js';
|
|
2
|
+
export * from './mock.request.js';
|
package/dist/request/index.js
CHANGED
|
@@ -1,19 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./index.types"), exports);
|
|
18
|
-
__exportStar(require("./mock.request"), exports);
|
|
19
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
export * from './index.types.js';
|
|
2
|
+
export * from './mock.request.js';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Request } from "express";
|
|
2
|
-
import { ResponseData } from "../response";
|
|
2
|
+
import { ResponseData } from "../response/index.js";
|
|
3
3
|
import { Arr } from "@leyyo/common";
|
|
4
|
-
import { HttpCookies, HttpData, HttpHeaders, HttpParams, HttpQuery } from "../event";
|
|
5
|
-
import { HttpMethod } from "../enum";
|
|
4
|
+
import { HttpCookies, HttpData, HttpHeaders, HttpParams, HttpQuery } from "../event/index.js";
|
|
5
|
+
import { HttpMethod } from "../enum/index.js";
|
|
6
6
|
export interface RequestLocal {
|
|
7
7
|
}
|
|
8
8
|
export type RequestBody = Arr | HttpData | string | unknown;
|
|
@@ -2,11 +2,11 @@ import { Application, MediaType, NextFunction, Request, Response } from "express
|
|
|
2
2
|
import { Socket } from "net";
|
|
3
3
|
import { IncomingHttpHeaders } from "http";
|
|
4
4
|
import RangeParser from "range-parser";
|
|
5
|
-
import { MockRequestLike, MockServiceRequest, PipeOption, RequestBody, RequestErrorCallback, RequestLocal } from "./index.types";
|
|
6
|
-
import { _StreamAbort, _StreamBool, _StreamCompose, _StreamGeneric, _StreamIterator, _StreamReduce, _StreamVoid, HttpCookies, HttpEvent, HttpParams, HttpQuery } from "../event";
|
|
5
|
+
import { MockRequestLike, MockServiceRequest, PipeOption, RequestBody, RequestErrorCallback, RequestLocal } from "./index.types.js";
|
|
6
|
+
import { _StreamAbort, _StreamBool, _StreamCompose, _StreamGeneric, _StreamIterator, _StreamReduce, _StreamVoid, HttpCookies, HttpEvent, HttpParams, HttpQuery } from "../event/index.js";
|
|
7
7
|
import { Dict, Fnc, HttpStatus, OneOrMore } from "@leyyo/common";
|
|
8
8
|
import { ArrayOptions, Readable } from "node:stream";
|
|
9
|
-
import { HttpMethod, HttpProtocol } from "../enum";
|
|
9
|
+
import { HttpMethod, HttpProtocol } from "../enum/index.js";
|
|
10
10
|
export declare class MockRequest<B extends RequestBody = RequestBody, L extends RequestLocal = RequestLocal> extends HttpEvent<Request> implements MockRequestLike<B, L> {
|
|
11
11
|
/** @inheritDoc */
|
|
12
12
|
readonly isFake: boolean;
|