node-pluginsmanager-plugin 4.7.0 → 4.8.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.
@@ -156,6 +156,10 @@ module.exports = class DescriptorUser extends Events {
156
156
 
157
157
  }
158
158
 
159
+ if (multiple) {
160
+ break;
161
+ }
162
+
159
163
  }
160
164
 
161
165
  return multiple ? Promise.reject(new Error(
@@ -581,18 +581,18 @@ module.exports = class Orchestrator extends MediatorUser {
581
581
 
582
582
  return Promise.resolve().then(() => {
583
583
 
584
- return this._Server ? this._Server.release(...data).then(() => {
584
+ return this._Mediator ? this._Mediator.release(...data).then(() => {
585
585
 
586
- this._socketServer = null;
587
- this._Server = null;
586
+ this._Mediator = null;
588
587
 
589
588
  }) : Promise.resolve();
590
589
 
591
590
  }).then(() => {
592
591
 
593
- return this._Mediator ? this._Mediator.release(...data).then(() => {
592
+ return this._Server ? this._Server.release(...data).then(() => {
594
593
 
595
- this._Mediator = null;
594
+ this._socketServer = null;
595
+ this._Server = null;
596
596
 
597
597
  }) : Promise.resolve();
598
598
 
@@ -145,7 +145,7 @@ module.exports = class Server extends MediatorUser {
145
145
  );
146
146
 
147
147
  // get descriptor
148
- if ("/" + this._Descriptor.info.title + "/descriptor" === req.pattern && "get" === req.method) {
148
+ if ("/" + this._Descriptor.info.title + "/api/descriptor" === req.pattern && "get" === req.method) {
149
149
 
150
150
  return new Promise((resolve, reject) => {
151
151
 
@@ -157,6 +157,27 @@ module.exports = class Server extends MediatorUser {
157
157
  return err ? reject(err) : resolve(api);
158
158
  });
159
159
 
160
+ // add current server
161
+ }).then((api) => {
162
+
163
+ const protocol = res.socket && Boolean(res.socket.encrypted) ? "https" : "http";
164
+
165
+ let port = res.socket && res.socket.localPort ? res.socket.localPort : 0;
166
+ if (!port) {
167
+ port = "http" === protocol ? 80 : 443;
168
+ }
169
+
170
+ if (!api.servers) {
171
+ api.servers = [];
172
+ }
173
+
174
+ api.servers.push({
175
+ "url": protocol + "://" + req.validatedIp + ":" + port,
176
+ "description": "Actual current server"
177
+ });
178
+
179
+ return Promise.resolve(api);
180
+
160
181
  }).then((api) => {
161
182
 
162
183
  this._log("info", "<= [" + req.validatedIp + "] " + JSON.stringify(api));
@@ -179,7 +200,7 @@ module.exports = class Server extends MediatorUser {
179
200
  }
180
201
 
181
202
  // get plugin status
182
- else if ("/" + this._Descriptor.info.title + "/status" === req.pattern && "get" === req.method) {
203
+ else if ("/" + this._Descriptor.info.title + "/api/status" === req.pattern && "get" === req.method) {
183
204
 
184
205
  const initialized = this.initialized && this._Mediator.initialized;
185
206
  const status = initialized ? "INITIALIZED" : "ENABLED";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-pluginsmanager-plugin",
3
- "version": "4.7.0",
3
+ "version": "4.8.0",
4
4
  "description": "An abstract parent plugin for node-pluginsmanager",
5
5
  "main": "lib/main.js",
6
6
  "typings": "lib/index.d.ts",
@@ -35,25 +35,25 @@
35
35
  "url": "https://github.com/Psychopoulet/node-pluginsmanager-plugin/issues"
36
36
  },
37
37
  "dependencies": {
38
- "@apidevtools/swagger-parser": "10.0.2",
38
+ "@apidevtools/swagger-parser": "10.0.3",
39
39
  "express-openapi-validate": "0.6.1"
40
40
  },
41
41
  "devDependencies": {
42
- "@types/node": "16.4.3",
42
+ "@types/node": "17.0.23",
43
43
  "@types/socket.io": "3.0.2",
44
- "@types/ws": "7.4.7",
45
- "check-version-modules": "1.3.2",
44
+ "@types/ws": "8.5.3",
45
+ "check-version-modules": "1.3.5",
46
46
  "coveralls": "3.1.1",
47
47
  "colors": "1.4.0",
48
- "eslint": "7.31.0",
49
- "express": "4.17.1",
50
- "husky": "7.0.1",
51
- "mocha": "9.0.3",
48
+ "eslint": "8.12.0",
49
+ "express": "4.17.3",
50
+ "husky": "7.0.4",
51
+ "mocha": "9.2.2",
52
52
  "nyc": "15.1.0",
53
- "socket.io": "4.1.3",
54
- "socket.io-client": "4.1.3",
55
- "typescript": "4.3.5",
56
- "ws": "7.5.3"
53
+ "socket.io": "4.4.1",
54
+ "socket.io-client": "4.4.1",
55
+ "typescript": "4.6.3",
56
+ "ws": "8.5.0"
57
57
  },
58
58
  "homepage": "https://github.com/Psychopoulet/node-pluginsmanager-plugin#readme",
59
59
  "engines": {