node-pluginsmanager-plugin 6.0.3 → 6.1.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.
Files changed (56) hide show
  1. package/lib/cjs/checkers/RangeError/checkArrayLength.js +1 -3
  2. package/lib/cjs/checkers/RangeError/checkArrayLengthBetween.js +1 -3
  3. package/lib/cjs/checkers/RangeError/checkIntegerBetween.js +1 -3
  4. package/lib/cjs/checkers/RangeError/checkNonEmptyArray.js +1 -3
  5. package/lib/cjs/checkers/RangeError/checkNonEmptyInteger.js +1 -3
  6. package/lib/cjs/checkers/RangeError/checkNonEmptyNumber.js +1 -3
  7. package/lib/cjs/checkers/RangeError/checkNonEmptyObject.js +1 -3
  8. package/lib/cjs/checkers/RangeError/checkNonEmptyString.js +1 -3
  9. package/lib/cjs/checkers/RangeError/checkNumberBetween.js +1 -3
  10. package/lib/cjs/checkers/RangeError/checkObjectLength.js +1 -3
  11. package/lib/cjs/checkers/RangeError/checkObjectLengthBetween.js +1 -3
  12. package/lib/cjs/checkers/RangeError/checkStringLength.js +1 -3
  13. package/lib/cjs/checkers/RangeError/checkStringLengthBetween.js +1 -3
  14. package/lib/cjs/checkers/ReferenceError/checkExists.js +1 -3
  15. package/lib/cjs/checkers/TypeError/checkArray.js +1 -3
  16. package/lib/cjs/checkers/TypeError/checkBoolean.js +1 -3
  17. package/lib/cjs/checkers/TypeError/checkFunction.js +1 -3
  18. package/lib/cjs/checkers/TypeError/checkInteger.js +1 -3
  19. package/lib/cjs/checkers/TypeError/checkNumber.js +1 -3
  20. package/lib/cjs/checkers/TypeError/checkObject.js +1 -3
  21. package/lib/cjs/checkers/TypeError/checkString.js +1 -3
  22. package/lib/cjs/components/DescriptorUser.d.ts +1 -1
  23. package/lib/cjs/components/DescriptorUser.js +22 -14
  24. package/lib/cjs/components/Mediator.d.ts +6 -14
  25. package/lib/cjs/components/Mediator.js +144 -147
  26. package/lib/cjs/components/MediatorUser.d.ts +1 -1
  27. package/lib/cjs/components/MediatorUser.js +4 -4
  28. package/lib/cjs/components/NotFoundError.js +1 -2
  29. package/lib/cjs/components/Orchestrator.d.ts +7 -8
  30. package/lib/cjs/components/Orchestrator.js +7 -9
  31. package/lib/cjs/components/Server.d.ts +14 -22
  32. package/lib/cjs/components/Server.js +40 -31
  33. package/lib/cjs/main.cjs +1 -1
  34. package/lib/cjs/main.d.cts +7 -7
  35. package/lib/cjs/utils/cleanSendedError.js +1 -2
  36. package/lib/cjs/utils/descriptor/extractParams.d.ts +1 -3
  37. package/lib/cjs/utils/descriptor/extractParams.js +1 -2
  38. package/lib/cjs/utils/descriptor/extractPathMethodByOperationId.js +1 -2
  39. package/lib/cjs/utils/descriptor/extractPattern.js +4 -4
  40. package/lib/cjs/utils/descriptor/extractSchemaType.d.ts +1 -3
  41. package/lib/cjs/utils/descriptor/extractSchemaType.js +1 -1
  42. package/lib/cjs/utils/file/checkFile.js +4 -4
  43. package/lib/cjs/utils/file/isFile.js +1 -2
  44. package/lib/cjs/utils/file/readJSONFile.js +1 -2
  45. package/lib/cjs/utils/jsonParser.js +1 -2
  46. package/lib/cjs/utils/removeFirstSlash.js +1 -2
  47. package/lib/cjs/utils/request/extractBody.d.ts +1 -1
  48. package/lib/cjs/utils/request/extractBody.js +4 -5
  49. package/lib/cjs/utils/request/extractCookies.d.ts +1 -3
  50. package/lib/cjs/utils/request/extractCookies.js +1 -1
  51. package/lib/cjs/utils/request/extractIp.js +1 -2
  52. package/lib/cjs/utils/request/extractMime.d.ts +4 -8
  53. package/lib/cjs/utils/request/extractMime.js +4 -11
  54. package/lib/cjs/utils/send.d.ts +6 -6
  55. package/lib/cjs/utils/send.js +88 -84
  56. package/package.json +97 -91
@@ -1,147 +1,144 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const checkExists_1 = require("../checkers/ReferenceError/checkExists");
7
- const checkObject_1 = require("../checkers/TypeError/checkObject");
8
- const checkNonEmptyString_1 = require("../checkers/RangeError/checkNonEmptyString");
9
- const checkNonEmptyObject_1 = require("../checkers/RangeError/checkNonEmptyObject");
10
- const extractPathMethodByOperationId_1 = __importDefault(require("../utils/descriptor/extractPathMethodByOperationId"));
11
- const DescriptorUser_1 = __importDefault(require("./DescriptorUser"));
12
- // types & interfaces
13
- // externals
14
- const express_openapi_validate_1 = require("express-openapi-validate");
15
- ;
16
- ;
17
- ;
18
- // module
19
- class Mediator extends DescriptorUser_1.default {
20
- // constructor
21
- constructor(options) {
22
- super(options);
23
- this._validator = null;
24
- }
25
- // public
26
- // Check sended parameters by method name (used by the Server)
27
- checkParameters(operationId, urlParams, bodyParams) {
28
- // parameters validation
29
- return this.checkDescriptor().then(() => {
30
- return (0, checkNonEmptyString_1.checkNonEmptyString)("operationId", operationId);
31
- }).then(() => {
32
- return (0, checkNonEmptyObject_1.checkNonEmptyObject)("urlParams", urlParams).then(() => {
33
- return (0, checkObject_1.checkObject)("urlParams.path", urlParams.path);
34
- }).then(() => {
35
- return (0, checkObject_1.checkObject)("urlParams.query", urlParams.query);
36
- }).then(() => {
37
- return (0, checkObject_1.checkObject)("urlParams.headers", urlParams.headers);
38
- }).then(() => {
39
- return (0, checkObject_1.checkObject)("urlParams.cookies", urlParams.cookies);
40
- });
41
- }).then(() => {
42
- return (0, checkExists_1.checkExists)("bodyParams", bodyParams);
43
- }).then(() => {
44
- // search wanted operation
45
- const foundPathMethod = (0, extractPathMethodByOperationId_1.default)(this._Descriptor.paths, operationId);
46
- return !foundPathMethod ? Promise.reject(new ReferenceError("Unknown operationId \"" + operationId + "\"")) : new Promise((resolve, reject) => {
47
- const req = {
48
- "path": foundPathMethod.path,
49
- "method": foundPathMethod.method,
50
- "params": urlParams.path,
51
- "query": urlParams.query,
52
- "headers": urlParams.headers,
53
- "cookies": urlParams.cookies,
54
- "body": bodyParams
55
- };
56
- const validateRequest = this._validator.validate(req.method, req.path); // set to "any" for ts validation
57
- validateRequest(req, null, (err) => {
58
- return err ? reject(err) : resolve();
59
- });
60
- });
61
- }).catch((err) => {
62
- return err instanceof express_openapi_validate_1.ValidationError ? Promise.resolve().then(() => {
63
- switch (err.data[0].keyword) { // extract first Error
64
- case "required":
65
- return Promise.reject(new ReferenceError(err.message));
66
- case "type":
67
- return Promise.reject(new TypeError(err.message));
68
- case "minimum":
69
- case "maximum":
70
- case "minLength":
71
- case "maxLength":
72
- case "minItems":
73
- case "maxItems":
74
- case "enum":
75
- return Promise.reject(new RangeError(err.message));
76
- default:
77
- return Promise.reject(new Error(err.message));
78
- }
79
- }) : Promise.reject(err);
80
- });
81
- }
82
- // Check sended parameters by method name (used by the Server)
83
- checkResponse(operationId, res) {
84
- // parameters validation
85
- return this.checkDescriptor().then(() => {
86
- return (0, checkNonEmptyString_1.checkNonEmptyString)("operationId", operationId);
87
- }).then(() => {
88
- // search wanted operation
89
- const foundPathMethod = (0, extractPathMethodByOperationId_1.default)(this._Descriptor.paths, operationId);
90
- return !foundPathMethod ? Promise.reject(new ReferenceError("Unknown operationId \"" + operationId + "\"")) : new Promise((resolve, reject) => {
91
- // no content, no validation
92
- if (204 === res.statusCode) {
93
- return "undefined" !== typeof res.body ? reject(new ReferenceError("You should not have content data with 204 statusCode")) : resolve();
94
- }
95
- // no content, no validation (put requests)
96
- else if (201 === res.statusCode && "undefined" === typeof res.body) {
97
- return resolve();
98
- }
99
- // validator cannot correctly check pure boolean return
100
- else if ("undefined" !== typeof res.body && ["true", "false"].includes(res.body)) {
101
- return resolve();
102
- }
103
- else {
104
- try {
105
- const mutedRes = Object.assign({}, res);
106
- mutedRes.headers = res.getHeaders();
107
- if ("undefined" === typeof mutedRes.body || "" === mutedRes.body) {
108
- mutedRes.body = {};
109
- }
110
- const validateResponse = this._validator.validateResponse(foundPathMethod.method, foundPathMethod.path);
111
- validateResponse(mutedRes);
112
- return resolve();
113
- }
114
- catch (e) {
115
- return reject(new Error("[" + foundPathMethod.method + "]" +
116
- foundPathMethod.path +
117
- " (" + foundPathMethod.operationId + ") => " +
118
- res.statusCode +
119
- "\r\n" +
120
- (e.message ? e.message : e)));
121
- }
122
- }
123
- });
124
- });
125
- }
126
- // init / release
127
- init(...data) {
128
- return this._initWorkSpace(...data).then(() => {
129
- this._validator = new express_openapi_validate_1.OpenApiValidator(this._Descriptor);
130
- this.initialized = true;
131
- this.emit("initialized", ...data);
132
- });
133
- }
134
- release(...data) {
135
- return this._releaseWorkSpace(...data).then(() => {
136
- // can only be released by Orchestrator
137
- this._Descriptor = null;
138
- this._validator = null;
139
- this.initialized = false;
140
- this.emit("released", ...data);
141
- }).then(() => {
142
- this.removeAllListeners();
143
- });
144
- }
145
- }
146
- exports.default = Mediator;
147
- ;
1
+ "use strict";
2
+ // deps
3
+ var __importDefault = (this && this.__importDefault) || function (mod) {
4
+ return (mod && mod.__esModule) ? mod : { "default": mod };
5
+ };
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ // externals
8
+ const express_openapi_validate_1 = require("express-openapi-validate");
9
+ // locals
10
+ const checkExists_1 = require("../checkers/ReferenceError/checkExists");
11
+ const checkObject_1 = require("../checkers/TypeError/checkObject");
12
+ const checkNonEmptyString_1 = require("../checkers/RangeError/checkNonEmptyString");
13
+ const checkNonEmptyObject_1 = require("../checkers/RangeError/checkNonEmptyObject");
14
+ const extractPathMethodByOperationId_1 = __importDefault(require("../utils/descriptor/extractPathMethodByOperationId"));
15
+ const DescriptorUser_1 = __importDefault(require("./DescriptorUser"));
16
+ // module
17
+ class Mediator extends DescriptorUser_1.default {
18
+ // constructor
19
+ constructor(options) {
20
+ super(options);
21
+ this._validator = null;
22
+ }
23
+ // public
24
+ // Check sended parameters by method name (used by the Server)
25
+ checkParameters(operationId, urlParams, bodyParams) {
26
+ // parameters validation
27
+ return this.checkDescriptor().then(() => {
28
+ return (0, checkNonEmptyString_1.checkNonEmptyString)("operationId", operationId);
29
+ }).then(() => {
30
+ return (0, checkNonEmptyObject_1.checkNonEmptyObject)("urlParams", urlParams).then(() => {
31
+ return (0, checkObject_1.checkObject)("urlParams.path", urlParams.path);
32
+ }).then(() => {
33
+ return (0, checkObject_1.checkObject)("urlParams.query", urlParams.query);
34
+ }).then(() => {
35
+ return (0, checkObject_1.checkObject)("urlParams.headers", urlParams.headers);
36
+ }).then(() => {
37
+ return (0, checkObject_1.checkObject)("urlParams.cookies", urlParams.cookies);
38
+ });
39
+ }).then(() => {
40
+ return (0, checkExists_1.checkExists)("bodyParams", bodyParams);
41
+ }).then(() => {
42
+ // search wanted operation
43
+ const foundPathMethod = (0, extractPathMethodByOperationId_1.default)(this._Descriptor.paths, operationId);
44
+ return !foundPathMethod ? Promise.reject(new ReferenceError("Unknown operationId \"" + operationId + "\"")) : new Promise((resolve, reject) => {
45
+ const req = {
46
+ "path": foundPathMethod.path,
47
+ "method": foundPathMethod.method,
48
+ "params": urlParams.path,
49
+ "query": urlParams.query,
50
+ "headers": urlParams.headers,
51
+ "cookies": urlParams.cookies,
52
+ "body": bodyParams
53
+ };
54
+ const validateRequest = this._validator.validate(req.method, req.path); // set to "any" for ts validation
55
+ validateRequest(req, null, (err) => {
56
+ return err ? reject(err) : resolve();
57
+ });
58
+ });
59
+ }).catch((err) => {
60
+ return err instanceof express_openapi_validate_1.ValidationError ? Promise.resolve().then(() => {
61
+ switch (err.data[0].keyword) { // extract first Error
62
+ case "required":
63
+ return Promise.reject(new ReferenceError(err.message));
64
+ case "type":
65
+ return Promise.reject(new TypeError(err.message));
66
+ case "minimum":
67
+ case "maximum":
68
+ case "minLength":
69
+ case "maxLength":
70
+ case "minItems":
71
+ case "maxItems":
72
+ case "enum":
73
+ return Promise.reject(new RangeError(err.message));
74
+ default:
75
+ return Promise.reject(new Error(err.message));
76
+ }
77
+ }) : Promise.reject(err);
78
+ });
79
+ }
80
+ // Check sended parameters by method name (used by the Server)
81
+ checkResponse(operationId, res) {
82
+ // parameters validation
83
+ return this.checkDescriptor().then(() => {
84
+ return (0, checkNonEmptyString_1.checkNonEmptyString)("operationId", operationId);
85
+ }).then(() => {
86
+ // search wanted operation
87
+ const foundPathMethod = (0, extractPathMethodByOperationId_1.default)(this._Descriptor.paths, operationId);
88
+ return !foundPathMethod ? Promise.reject(new ReferenceError("Unknown operationId \"" + operationId + "\"")) : new Promise((resolve, reject) => {
89
+ // no content, no validation
90
+ if (204 === res.statusCode) {
91
+ return "undefined" !== typeof res.body ? reject(new ReferenceError("You should not have content data with 204 statusCode")) : resolve();
92
+ }
93
+ // no content, no validation (put requests)
94
+ else if (201 === res.statusCode && "undefined" === typeof res.body) {
95
+ return resolve();
96
+ }
97
+ // validator cannot correctly check pure boolean return
98
+ else if ("undefined" !== typeof res.body && ["true", "false"].includes(res.body)) {
99
+ return resolve();
100
+ }
101
+ else {
102
+ try {
103
+ const mutedRes = Object.assign({}, res);
104
+ mutedRes.headers = res.getHeaders();
105
+ if ("undefined" === typeof mutedRes.body || "" === mutedRes.body) {
106
+ mutedRes.body = {};
107
+ }
108
+ const validateResponse = this._validator.validateResponse(foundPathMethod.method, foundPathMethod.path);
109
+ validateResponse(mutedRes);
110
+ return resolve();
111
+ }
112
+ catch (e) {
113
+ return reject(new Error("[" + foundPathMethod.method + "]"
114
+ + foundPathMethod.path
115
+ + " (" + foundPathMethod.operationId + ") => "
116
+ + res.statusCode
117
+ + "\r\n"
118
+ + (e.message ? e.message : e)));
119
+ }
120
+ }
121
+ });
122
+ });
123
+ }
124
+ // init / release
125
+ init(...data) {
126
+ return this._initWorkSpace(...data).then(() => {
127
+ this._validator = new express_openapi_validate_1.OpenApiValidator(this._Descriptor);
128
+ this.initialized = true;
129
+ this.emit("initialized", ...data);
130
+ });
131
+ }
132
+ release(...data) {
133
+ return this._releaseWorkSpace(...data).then(() => {
134
+ // can only be released by Orchestrator
135
+ this._Descriptor = null;
136
+ this._validator = null;
137
+ this.initialized = false;
138
+ this.emit("released", ...data);
139
+ }).then(() => {
140
+ this.removeAllListeners();
141
+ });
142
+ }
143
+ }
144
+ exports.default = Mediator;
@@ -1,4 +1,4 @@
1
- import DescriptorUser, { iDescriptorUserOptions } from "./DescriptorUser";
1
+ import DescriptorUser, { type iDescriptorUserOptions } from "./DescriptorUser";
2
2
  import Mediator from "./Mediator";
3
3
  export interface iMediatorUserOptions extends iDescriptorUserOptions {
4
4
  "mediator"?: Mediator;
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
+ // deps
2
3
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
4
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
5
  };
5
6
  Object.defineProperty(exports, "__esModule", { value: true });
6
- // deps
7
7
  // locals
8
8
  const DescriptorUser_1 = __importDefault(require("./DescriptorUser"));
9
9
  const Mediator_1 = __importDefault(require("./Mediator"));
@@ -13,8 +13,9 @@ class MediatorUser extends DescriptorUser_1.default {
13
13
  // constructor
14
14
  constructor(options) {
15
15
  super(options);
16
- this._Mediator = options && "undefined" !== typeof options.mediator ?
17
- options.mediator : null;
16
+ this._Mediator = options && "undefined" !== typeof options.mediator
17
+ ? options.mediator
18
+ : null;
18
19
  }
19
20
  // protected
20
21
  _initWorkSpace(...data) {
@@ -37,4 +38,3 @@ class MediatorUser extends DescriptorUser_1.default {
37
38
  }
38
39
  }
39
40
  exports.default = MediatorUser;
40
- ;
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
2
  // module
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
4
  class NotFoundError extends Error {
5
5
  }
6
6
  exports.default = NotFoundError;
7
- ;
@@ -1,9 +1,8 @@
1
1
  import MediatorUser from "./MediatorUser";
2
- import Server from "./Server";
3
- import { Server as WebSocketServer } from "ws";
4
- import { Server as SocketIOServer } from "socket.io";
5
- import { tLogger } from "./DescriptorUser";
6
- import { iIncomingMessage, iServerResponse } from "./Server";
2
+ import Server, { type iIncomingMessage, type iServerResponse } from "./Server";
3
+ import type { Server as WebSocketServer } from "ws";
4
+ import type { Server as SocketIOServer } from "socket.io";
5
+ import type { tLogger } from "./DescriptorUser";
7
6
  export interface iOrchestratorOptions {
8
7
  "externalRessourcesDirectory": string;
9
8
  "packageFile": string;
@@ -21,9 +20,9 @@ export default class Orchestrator extends MediatorUser {
21
20
  protected _descriptorFile: string;
22
21
  protected _mediatorFile: string;
23
22
  protected _serverFile: string;
24
- protected _extended: Array<string>;
23
+ protected _extended: string[];
25
24
  enabled: boolean;
26
- authors: Array<string>;
25
+ authors: string[];
27
26
  description: string;
28
27
  dependencies: object | null;
29
28
  devDependencies: object | null;
@@ -44,7 +43,7 @@ export default class Orchestrator extends MediatorUser {
44
43
  enableCheckResponse(): this;
45
44
  disableCors(): this;
46
45
  enableCors(): this;
47
- appMiddleware(req: iIncomingMessage, res: iServerResponse, next: Function): void;
46
+ appMiddleware(req: iIncomingMessage, res: iServerResponse, next: () => void): void;
48
47
  socketMiddleware(server: WebSocketServer | SocketIOServer): void;
49
48
  load(...data: any): Promise<void>;
50
49
  destroy(...data: any): Promise<void>;
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
+ // deps
2
3
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
4
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
5
  };
5
6
  Object.defineProperty(exports, "__esModule", { value: true });
6
- // deps
7
7
  // natives
8
8
  const node_path_1 = require("node:path");
9
9
  // locals
@@ -12,7 +12,6 @@ const MediatorUser_1 = __importDefault(require("./MediatorUser"));
12
12
  const Server_1 = __importDefault(require("./Server"));
13
13
  const checkFile_1 = __importDefault(require("../utils/file/checkFile"));
14
14
  const readJSONFile_1 = __importDefault(require("../utils/file/readJSONFile"));
15
- ;
16
15
  // module
17
16
  class Orchestrator extends MediatorUser_1.default {
18
17
  // constructor
@@ -264,14 +263,14 @@ class Orchestrator extends MediatorUser_1.default {
264
263
  });
265
264
  // compare title to package name
266
265
  }).then(() => {
267
- return this._Descriptor.info.title !== this.name ? Promise.reject(new Error("The descriptor's title (\"" + this._Descriptor.info.title + "\") " +
268
- "is not equals to " +
269
- "the package's name (\"" + this.name + "\")")) : Promise.resolve();
266
+ return this._Descriptor.info.title !== this.name ? Promise.reject(new Error("The descriptor's title (\"" + this._Descriptor.info.title + "\") "
267
+ + "is not equals to "
268
+ + "the package's name (\"" + this.name + "\")")) : Promise.resolve();
270
269
  // compare version to package version
271
270
  }).then(() => {
272
- return this._Descriptor.info.version !== this.version ? Promise.reject(new Error("The descriptor's version (\"" + this._Descriptor.info.version + "\") " +
273
- "is not equals to " +
274
- "the package's version (\"" + this.version + "\")")) : Promise.resolve();
271
+ return this._Descriptor.info.version !== this.version ? Promise.reject(new Error("The descriptor's version (\"" + this._Descriptor.info.version + "\") "
272
+ + "is not equals to "
273
+ + "the package's version (\"" + this.version + "\")")) : Promise.resolve();
275
274
  });
276
275
  // create Mediator
277
276
  }).then(() => {
@@ -397,4 +396,3 @@ class Orchestrator extends MediatorUser_1.default {
397
396
  }
398
397
  }
399
398
  exports.default = Orchestrator;
400
- ;
@@ -1,9 +1,8 @@
1
1
  /// <reference types="node" />
2
- import MediatorUser from "./MediatorUser";
3
- import { IncomingMessage, ServerResponse } from "node:http";
4
- import { Server as WebSocketServer } from "ws";
5
- import { Server as SocketIOServer } from "socket.io";
6
- import { iMediatorUserOptions } from "./MediatorUser";
2
+ import MediatorUser, { type iMediatorUserOptions } from "./MediatorUser";
3
+ import type { IncomingMessage, ServerResponse } from "node:http";
4
+ import type { Server as WebSocketServer } from "ws";
5
+ import type { Server as SocketIOServer } from "socket.io";
7
6
  export interface iClient {
8
7
  "id": string;
9
8
  "status": "CONNECTED" | "DISCONNECTED";
@@ -12,25 +11,15 @@ export interface iIncomingMessage extends IncomingMessage {
12
11
  "method": string;
13
12
  "pattern": string;
14
13
  "validatedIp": string;
15
- "headers": {
16
- [key: string]: any;
17
- };
18
- "cookies": {
19
- [key: string]: any;
20
- };
21
- "query": {
22
- [key: string]: any;
23
- };
24
- "params": {
25
- [key: string]: any;
26
- };
14
+ "headers": Record<string, any>;
15
+ "cookies": Record<string, any>;
16
+ "query": Record<string, any>;
17
+ "params": Record<string, any>;
27
18
  "body": string;
28
19
  }
29
20
  export interface iServerResponse extends ServerResponse {
30
21
  "body": string;
31
- "headers": {
32
- [key: string]: any;
33
- };
22
+ "headers": Record<string, any>;
34
23
  }
35
24
  export default class Server extends MediatorUser {
36
25
  protected _socketServer: WebSocketServer | SocketIOServer | null;
@@ -39,16 +28,19 @@ export default class Server extends MediatorUser {
39
28
  protected _cors: boolean;
40
29
  constructor(opt: iMediatorUserOptions);
41
30
  protected _serverType(): "NO_SERVER" | "WEBSOCKET" | "SOCKETIO" | "UNKNOWN";
31
+ protected _getUsableSocketIOClient(clientId: string): {
32
+ "emit": (event: string, data: any) => void;
33
+ } | undefined;
42
34
  disableCheckParameters(): this;
43
35
  enableCheckParameters(): this;
44
36
  disableCheckResponse(): this;
45
37
  enableCheckResponse(): this;
46
38
  disableCors(): this;
47
39
  enableCors(): this;
48
- appMiddleware(req: iIncomingMessage, res: iServerResponse, next: Function): void;
40
+ appMiddleware(req: iIncomingMessage, res: iServerResponse, next: () => void): void;
49
41
  socketMiddleware(socketServer: WebSocketServer | SocketIOServer): void;
50
42
  push(command: string, data?: any, log?: boolean): this;
51
- getClients(): Array<iClient>;
43
+ getClients(): iClient[];
52
44
  pushClient(clientId: string, command: string, data: any, log?: boolean): this;
53
45
  init(...data: any): Promise<void>;
54
46
  release(...data: any): Promise<void>;