node-pluginsmanager-plugin 4.8.5 → 4.8.8

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 (2) hide show
  1. package/lib/index.d.ts +196 -128
  2. package/package.json +5 -5
package/lib/index.d.ts CHANGED
@@ -8,204 +8,272 @@ declare module "node-pluginsmanager-plugin" {
8
8
  import { Server as WebSocketServer } from "ws";
9
9
  import { Server as SocketIOServer } from "socket.io";
10
10
 
11
- // options
11
+ // checkers
12
12
 
13
- type tLogType = "log" | "info" | "warning" | "error";
13
+ // undefined
14
+ export function checkExists (dataName: string, data: any, async?: boolean): Promise<void>;
15
+ export function checkExists (dataName: string, data: any, async: boolean): null | ReferenceError;
14
16
 
15
- interface iDescriptorUserOptions {
16
- "descriptor": object | null;
17
- "externalRessourcesDirectory": string;
18
- "logger": Function | null;
19
- }
17
+ // native
18
+ export function checkBoolean (dataName: string, data: any, async?: boolean): Promise<void>;
19
+ export function checkBoolean (dataName: string, data: any, async: boolean): null | ReferenceError | TypeError;
20
20
 
21
- interface iMediatorUserOptions extends iDescriptorUserOptions {
22
- "mediator": Mediator | null;
23
- }
21
+ export function checkFunction (dataName: string, data: any, async?: boolean): Promise<void>;
22
+ export function checkFunction (dataName: string, data: any, async: boolean): null | ReferenceError | TypeError;
23
+
24
+ export function checkNumber (dataName: string, data: any, async?: boolean): Promise<void>;
25
+ export function checkNumber (dataName: string, data: any, async: boolean): null | ReferenceError | TypeError;
24
26
 
25
- interface iUrlParameters {
26
- "url": {
27
- "path": object;
28
- "query": object;
29
- "headers": object;
30
- "cookies": object;
31
- };
32
- }
27
+ export function checkObject (dataName: string, data: any, async?: boolean): Promise<void>;
28
+ export function checkObject (dataName: string, data: any, async: boolean): null | ReferenceError | TypeError;
33
29
 
34
- interface iOrchestratorOptions {
35
- "externalRessourcesDirectory": string;
36
- "packageFile": string;
37
- "descriptorFile": string;
38
- "mediatorFile": string;
39
- "serverFile": string;
40
- }
30
+ export function checkString (dataName: string, data: any, async?: boolean): Promise<void>;
31
+ export function checkString (dataName: string, data: any, async: boolean): null | ReferenceError | TypeError;
41
32
 
42
- // classes
33
+ // abstract
34
+ export function checkArray (dataName: string, data: any, async?: boolean): Promise<void>;
35
+ export function checkArray (dataName: string, data: any, async: boolean): null | ReferenceError | TypeError;
43
36
 
44
- class DescriptorUser extends EventEmitter {
37
+ export function checkInteger (dataName: string, data: any, async?: boolean): Promise<void>;
38
+ export function checkInteger (dataName: string, data: any, async: boolean): null | ReferenceError | TypeError;
45
39
 
46
- // attributes
40
+ // empty
41
+ export function checkNonEmptyArray (dataName: string, data: any, async?: boolean): Promise<void>;
42
+ export function checkNonEmptyArray (dataName: string, data: any, async: boolean): null | ReferenceError | TypeError | RangeError;
47
43
 
48
- // public
44
+ export function checkNonEmptyInteger (dataName: string, data: any, async?: boolean): Promise<void>;
45
+ export function checkNonEmptyInteger (dataName: string, data: any, async: boolean): null | ReferenceError | TypeError | RangeError;
49
46
 
50
- public initialized: boolean;
47
+ export function checkNonEmptyNumber (dataName: string, data: any, async?: boolean): Promise<void>;
48
+ export function checkNonEmptyNumber (dataName: string, data: any, async: boolean): null | ReferenceError | TypeError | RangeError;
51
49
 
52
- // protected
50
+ export function checkNonEmptyObject (dataName: string, data: any, async?: boolean): Promise<void>;
51
+ export function checkNonEmptyObject (dataName: string, data: any, async: boolean): null | ReferenceError | TypeError | RangeError;
53
52
 
54
- protected _descriptorValidated: boolean;
53
+ export function checkNonEmptyString (dataName: string, data: any, async?: boolean): Promise<void>;
54
+ export function checkNonEmptyString (dataName: string, data: any, async: boolean): null | ReferenceError | TypeError | RangeError;
55
55
 
56
- protected _externalRessourcesDirectory: string;
56
+ // range
57
+ export function checkArrayLength (dataName: string, data: any, length: number, async?: boolean): Promise<void>;
58
+ export function checkArrayLength (dataName: string, data: any, length: number, async: boolean): null | ReferenceError | TypeError | RangeError;
57
59
 
58
- protected _Descriptor: object | null;
59
- protected _Logger: Function | null;
60
+ export function checkArrayLengthBetween (dataName: string, data: any, min: number, max: number, async?: boolean): Promise<void>;
61
+ export function checkArrayLengthBetween (dataName: string, data: any, min: number, max: number, async: boolean): null | ReferenceError | TypeError | RangeError;
60
62
 
61
- // constructor
63
+ export function checkIntegerBetween (dataName: string, data: any, min: number, max: number, async?: boolean): Promise<void>;
64
+ export function checkIntegerBetween (dataName: string, data: any, min: number, max: number, async: boolean): null | ReferenceError | TypeError | RangeError;
62
65
 
63
- constructor (options: iDescriptorUserOptions);
66
+ export function checkNumberBetween (dataName: string, data: any, min: number, max: number, async?: boolean): Promise<void>;
67
+ export function checkNumberBetween (dataName: string, data: any, min: number, max: number, async: boolean): null | ReferenceError | TypeError | RangeError;
64
68
 
65
- // methods
69
+ export function checkObjectLength (dataName: string, data: any, length: number, async?: boolean): Promise<void>;
70
+ export function checkObjectLength (dataName: string, data: any, length: number, async: boolean): null | ReferenceError | TypeError | RangeError;
66
71
 
67
- // protected
72
+ export function checkObjectLengthBetween (dataName: string, data: any, min: number, max: number, async?: boolean): Promise<void>;
73
+ export function checkObjectLengthBetween (dataName: string, data: any, min: number, max: number, async: boolean): null | ReferenceError | TypeError | RangeError;
68
74
 
69
- protected _initWorkSpace(data?: any): Promise<void>;
70
- protected _releaseWorkSpace(data?: any): Promise<void>;
71
- protected _log(type: tLogType, message: string, bold?: boolean): this;
75
+ export function checkStringLength (dataName: string, data: any, length: number, async?: boolean): Promise<void>;
76
+ export function checkStringLength (dataName: string, data: any, length: number, async: boolean): null | ReferenceError | TypeError | RangeError;
72
77
 
73
- // public
78
+ export function checkStringLengthBetween (dataName: string, data: any, min: number, max: number, async?: boolean): Promise<void>;
79
+ export function checkStringLengthBetween (dataName: string, data: any, min: number, max: number, async: boolean): null | ReferenceError | TypeError | RangeError;
74
80
 
75
- public checkDescriptor(): Promise<void>;
76
- public init(data?: any): Promise<void>;
77
- public release(data?: any): Promise<void>;
81
+ // components
78
82
 
79
- }
83
+ export type tLogType = "log" | "info" | "warning" | "error" | "debug";
84
+
85
+ export interface iDescriptorUserOptions {
86
+ "descriptor": { [key:string]: any };
87
+ "externalRessourcesDirectory": string;
88
+ "logger"?: (type: tLogType, message: string, bold?: boolean) => void;
89
+ }
80
90
 
81
- export class Mediator extends DescriptorUser {
91
+ export interface iMediatorUserOptions extends iDescriptorUserOptions {
92
+ "mediator": Mediator | null;
93
+ }
94
+
95
+ export interface iUrlParameters {
96
+ "url": {
97
+ "path": object;
98
+ "query": object;
99
+ "headers": object;
100
+ "cookies": object;
101
+ };
102
+ }
82
103
 
83
- // attributes
104
+ export interface iOrchestratorOptions {
105
+ "externalRessourcesDirectory": string;
106
+ "packageFile": string;
107
+ "descriptorFile": string;
108
+ "mediatorFile": string;
109
+ "serverFile": string;
110
+ }
84
111
 
85
- public _validator: null | object;
112
+ export class DescriptorUser extends EventEmitter {
86
113
 
87
- // methods
114
+ // attributes
88
115
 
89
- public checkParameters(operationId: string, urlParams: iUrlParameters, bodyParams: object): Promise<void>;
90
- public checkResponse(operationId: string, res: Response): Promise<void>;
116
+ // public
91
117
 
92
- }
118
+ public initialized: boolean;
93
119
 
94
- class MediatorUser extends DescriptorUser {
120
+ // protected
95
121
 
96
- // attributes
122
+ protected _descriptorValidated: boolean;
97
123
 
98
- protected _Mediator: Mediator | null;
124
+ protected _externalRessourcesDirectory: string;
99
125
 
100
- // constructor
126
+ protected _Descriptor: object | null;
127
+ protected _Logger: Function | null;
101
128
 
102
- constructor (options: iMediatorUserOptions);
129
+ // constructor
103
130
 
104
- // methods
131
+ constructor (options: iDescriptorUserOptions);
105
132
 
106
- public checkMediator(): Promise<void>;
133
+ // methods
107
134
 
108
- }
135
+ // protected
109
136
 
110
- export class Server extends MediatorUser {
137
+ protected _initWorkSpace(data?: any): Promise<void>;
138
+ protected _releaseWorkSpace(data?: any): Promise<void>;
139
+ protected _log(type: tLogType, message: string, bold?: boolean): this;
111
140
 
112
- // attributes
141
+ // public
113
142
 
114
- protected _socketServer: WebSocketServer | SocketIOServer | null;
115
- protected _checkParameters: boolean;
116
- protected _checkResponse: boolean;
117
- protected _cors: boolean;
143
+ public checkDescriptor(): Promise<void>;
144
+ public init(data?: any): Promise<void>;
145
+ public release(data?: any): Promise<void>;
118
146
 
119
- // methods
147
+ }
120
148
 
121
- public disableCheckParameters(): this;
122
- public enableCheckParameters(): this;
123
- public disableCheckResponse(): this;
124
- public enableCheckResponse(): this;
149
+ export class Mediator extends DescriptorUser {
125
150
 
126
- public disableCors(): this;
127
- public enableCors(): this;
151
+ // attributes
128
152
 
129
- public appMiddleware(req: Request, res: Response, next: Function): void;
130
- public socketMiddleware(server: WebSocketServer | SocketIOServer): void;
131
- public push(command: string, data?: any): this;
153
+ public _validator: null | object;
132
154
 
133
- }
155
+ // methods
134
156
 
135
- export class Orchestrator extends MediatorUser {
157
+ public checkParameters(operationId: string, urlParams: iUrlParameters, bodyParams: object): Promise<void>;
158
+ public checkResponse(operationId: string, res: Response): Promise<void>;
136
159
 
137
- // attributes
160
+ }
138
161
 
139
- // protected
162
+ export class MediatorUser extends DescriptorUser {
163
+
164
+ // attributes
165
+
166
+ protected _Mediator: Mediator | null;
167
+
168
+ // constructor
169
+
170
+ constructor (options: iMediatorUserOptions);
171
+
172
+ // methods
173
+
174
+ public checkMediator(): Promise<void>;
175
+
176
+ }
177
+
178
+ export class Server extends MediatorUser {
179
+
180
+ // attributes
140
181
 
141
- protected _Server: Server | null;
142
182
  protected _socketServer: WebSocketServer | SocketIOServer | null;
143
183
  protected _checkParameters: boolean;
144
184
  protected _checkResponse: boolean;
185
+ protected _cors: boolean;
186
+
187
+ // methods
188
+
189
+ public disableCheckParameters(): this;
190
+ public enableCheckParameters(): this;
191
+ public disableCheckResponse(): this;
192
+ public enableCheckResponse(): this;
193
+
194
+ public disableCors(): this;
195
+ public enableCors(): this;
196
+
197
+ public appMiddleware(req: Request, res: Response, next: Function): void;
198
+ public socketMiddleware(server: WebSocketServer | SocketIOServer): void;
199
+ public push(command: string, data?: any): this;
145
200
 
146
- // params
147
- protected _packageFile: string;
148
- protected _descriptorFile: string;
149
- protected _mediatorFile: string;
150
- protected _serverFile: string;
201
+ }
202
+
203
+ export class Orchestrator extends MediatorUser {
204
+
205
+ // attributes
206
+
207
+ // protected
151
208
 
152
- protected _extended: Array<string>;
209
+ protected _Server: Server | null;
210
+ protected _socketServer: WebSocketServer | SocketIOServer | null;
211
+ protected _checkParameters: boolean;
212
+ protected _checkResponse: boolean;
153
213
 
154
- // public
214
+ // params
215
+ protected _packageFile: string;
216
+ protected _descriptorFile: string;
217
+ protected _mediatorFile: string;
218
+ protected _serverFile: string;
155
219
 
156
- public enabled: boolean;
220
+ protected _extended: Array<string>;
157
221
 
158
- // native
159
- public authors: Array<string> | null;
160
- public description: string;
161
- public dependencies: object | null;
162
- public devDependencies: object | null;
163
- public engines: object | null;
164
- public license: string;
165
- public main: string;
166
- public name: string;
167
- public scripts: object | null;
168
- public version: string;
222
+ // public
169
223
 
170
- // constructor
224
+ public enabled: boolean;
171
225
 
172
- constructor (options: iOrchestratorOptions);
226
+ // native
227
+ public authors: Array<string> | null;
228
+ public description: string;
229
+ public dependencies: object | null;
230
+ public devDependencies: object | null;
231
+ public engines: object | null;
232
+ public license: string;
233
+ public main: string;
234
+ public name: string;
235
+ public scripts: object | null;
236
+ public version: string;
173
237
 
174
- // methods
238
+ // constructor
175
239
 
176
- // checkers
240
+ constructor (options: iOrchestratorOptions);
177
241
 
178
- public checkConf(): Promise<void>;
179
- public isEnable(): Promise<void>;
180
- public checkFiles(): Promise<void>;
181
- public checkServer(): Promise<void>;
242
+ // methods
182
243
 
183
- // middleware
244
+ // checkers
184
245
 
185
- public disableCheckParameters(): this;
186
- public enableCheckParameters(): this;
187
- public disableCheckResponse(): this;
188
- public enableCheckResponse(): this;
246
+ public checkConf(): Promise<void>;
247
+ public isEnable(): Promise<void>;
248
+ public checkFiles(): Promise<void>;
249
+ public checkServer(): Promise<void>;
189
250
 
190
- public disableCors(): this;
191
- public enableCors(): this;
251
+ // middleware
192
252
 
193
- public appMiddleware(req: Request, res: Response, next: Function): void;
194
- public socketMiddleware(server: WebSocketServer | SocketIOServer): void;
253
+ public disableCheckParameters(): this;
254
+ public enableCheckParameters(): this;
255
+ public disableCheckResponse(): this;
256
+ public enableCheckResponse(): this;
195
257
 
196
- // init / release
258
+ public disableCors(): this;
259
+ public enableCors(): this;
197
260
 
198
- public load(data?: any): Promise<void>;
199
- public destroy(data?: any): Promise<void>;
261
+ public appMiddleware(req: Request, res: Response, next: Function): void;
262
+ public socketMiddleware(server: WebSocketServer | SocketIOServer): void;
200
263
 
201
- // write
264
+ // init / release
202
265
 
203
- public install(data?: any): Promise<void>;
204
- public update(data?: any): Promise<void>;
205
- public uninstall(data?: any): Promise<void>;
266
+ public load(data?: any): Promise<void>;
267
+ public destroy(data?: any): Promise<void>;
206
268
 
207
- }
269
+ // write
270
+
271
+ public install(data?: any): Promise<void>;
272
+ public update(data?: any): Promise<void>;
273
+ public uninstall(data?: any): Promise<void>;
274
+
275
+ }
208
276
 
209
- export class NotFoundError extends Error {}
277
+ export class NotFoundError extends Error {}
210
278
 
211
279
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-pluginsmanager-plugin",
3
- "version": "4.8.5",
3
+ "version": "4.8.8",
4
4
  "description": "An abstract parent plugin for node-pluginsmanager",
5
5
  "main": "lib/main.js",
6
6
  "typings": "lib/index.d.ts",
@@ -39,21 +39,21 @@
39
39
  "express-openapi-validate": "0.6.1"
40
40
  },
41
41
  "devDependencies": {
42
- "@types/node": "17.0.34",
42
+ "@types/node": "17.0.36",
43
43
  "@types/socket.io": "3.0.2",
44
44
  "@types/ws": "8.5.3",
45
45
  "check-version-modules": "1.3.5",
46
46
  "coveralls": "3.1.1",
47
47
  "colors": "1.4.0",
48
- "eslint": "8.15.0",
48
+ "eslint": "8.16.0",
49
49
  "express": "4.18.1",
50
50
  "husky": "8.0.1",
51
51
  "mocha": "10.0.0",
52
52
  "nyc": "15.1.0",
53
53
  "socket.io": "4.5.1",
54
54
  "socket.io-client": "4.5.1",
55
- "typescript": "4.6.4",
56
- "ws": "8.6.0"
55
+ "typescript": "4.7.2",
56
+ "ws": "8.7.0"
57
57
  },
58
58
  "homepage": "https://github.com/Psychopoulet/node-pluginsmanager-plugin#readme",
59
59
  "engines": {