systemlynx 1.7.0 → 1.7.2

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/index.test.js CHANGED
@@ -39,7 +39,9 @@ describe("SystemLynx Objects", () => {
39
39
  "startService",
40
40
  "loadService",
41
41
  "onLoad",
42
- "config"
42
+ "config",
43
+ "server",
44
+ "WebSocket"
43
45
  )
44
46
  .that.respondsTo("module")
45
47
  .that.respondsTo("on")
@@ -69,10 +71,8 @@ describe("SystemLynx Objects", () => {
69
71
  it("should return a SystemLynx LoadBalancer", () => {
70
72
  expect(LoadBalancer)
71
73
  .to.be.an("object")
72
- .that.has.all.keys("startService", "Server", "WebSocket", "clones", "module")
74
+ .that.has.all.keys("startService", "server", "WebSocket", "clones", "module")
73
75
  .that.respondsTo("startService")
74
- .that.respondsTo("Server")
75
- .that.respondsTo("WebSocket")
76
76
  .that.respondsTo("module");
77
77
  expect(LoadBalancer.clones)
78
78
  .to.be.an("object")
@@ -89,18 +89,12 @@ describe("SystemLynx Objects", () => {
89
89
  it("should return a SystemLynx ServerManager instance", () => {
90
90
  expect(ServerManager)
91
91
  .to.be.an("Object")
92
- .that.has.all.keys(["startService", "addModule", "Server", "WebSocket"])
92
+ .that.has.all.keys(["startService", "addModule", "server", "WebSocket"])
93
93
  .that.respondsTo("startService")
94
- .that.respondsTo("addModule")
95
- .that.respondsTo("Server")
96
- .that.respondsTo("WebSocket");
94
+ .that.respondsTo("addModule");
97
95
  });
98
96
 
99
97
  it("should return a new instance of a Service", () => {
100
- expect(Service)
101
- .to.be.an("object")
102
- .that.respondsTo("startService")
103
- .that.respondsTo("Server")
104
- .that.respondsTo("WebSocket");
98
+ expect(Service).to.be.an("object").that.respondsTo("startService");
105
99
  });
106
100
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "systemlynx",
3
- "version": "1.7.0",
3
+ "version": "1.7.2",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -30,6 +30,8 @@ module.exports = function SystemLynxApp() {
30
30
  system.modules.push({ name, __constructor });
31
31
  return App;
32
32
  };
33
+ App.server = system.Service.server;
34
+ App.WebSocket = system.Service.WebSocket;
33
35
  }
34
36
 
35
37
  App.loadService = (name, url) => {
@@ -17,7 +17,9 @@ describe("SystemLynxApp()", () => {
17
17
  "startService",
18
18
  "loadService",
19
19
  "onLoad",
20
- "config"
20
+ "config",
21
+ "server",
22
+ "WebSocket"
21
23
  )
22
24
  .that.respondsTo("module")
23
25
  .that.respondsTo("on")
@@ -9,10 +9,8 @@ describe("LoadBalancer()", () => {
9
9
  it("should return a SystemLynx LoadBalancer", () => {
10
10
  expect(LoadBalancer)
11
11
  .to.be.an("object")
12
- .that.has.all.keys("startService", "Server", "WebSocket", "module", "clones")
12
+ .that.has.all.keys("startService", "server", "WebSocket", "module", "clones")
13
13
  .that.respondsTo("startService")
14
- .that.respondsTo("Server")
15
- .that.respondsTo("WebSocket")
16
14
  .that.respondsTo("module");
17
15
  expect(LoadBalancer.clones)
18
16
  .to.be.an("object")
@@ -24,7 +24,7 @@ module.exports = function SystemLynxServerManager() {
24
24
  const moduleQueue = [];
25
25
  const modules = [];
26
26
 
27
- const ServerManager = { Server: () => server, WebSocket: () => WebSocket };
27
+ const ServerManager = { server, WebSocket };
28
28
 
29
29
  ServerManager.startService = (options) => {
30
30
  let { route, host = "localhost", port, socketPort, staticRouting } = options;
@@ -8,11 +8,9 @@ describe("SystemLynxServerManager function", () => {
8
8
 
9
9
  expect(ServerManager)
10
10
  .to.be.an("Object")
11
- .that.has.all.keys(["startService", "addModule", "Server", "WebSocket"])
11
+ .that.has.all.keys(["startService", "addModule", "server", "WebSocket"])
12
12
  .that.respondsTo("startService")
13
- .that.respondsTo("addModule")
14
- .that.respondsTo("Server")
15
- .that.respondsTo("WebSocket");
13
+ .that.respondsTo("addModule");
16
14
  });
17
15
  });
18
16
  describe("ServerManager", () => {
@@ -4,8 +4,8 @@ const SystemLynxDispatcher = require("../Dispatcher/Dispatcher");
4
4
 
5
5
  module.exports = function SystemLynxService(systemContext = {}) {
6
6
  const ServerManager = SystemLynxServerManager();
7
- const { startService, Server, WebSocket } = ServerManager;
8
- const Service = { startService, Server, WebSocket };
7
+ const { startService, server, WebSocket } = ServerManager;
8
+ const Service = { startService, server, WebSocket };
9
9
 
10
10
  Service.module = function (name, constructor, reserved_methods = []) {
11
11
  const exclude_methods = reserved_methods.concat(
@@ -29,7 +29,7 @@ module.exports = function SystemLynxService(systemContext = {}) {
29
29
  undefined,
30
30
  systemContext,
31
31
  ]);
32
- constructor.apply(Module, [ServerManager.Server(), ServerManager.WebSocket()]);
32
+ constructor.apply(Module, [server, WebSocket]);
33
33
  ServerManager.addModule(name, Module, exclude_methods);
34
34
  return Module;
35
35
  }
@@ -7,11 +7,9 @@ describe("SystemLynxService", () => {
7
7
  const Service = SystemLynxService();
8
8
  expect(Service)
9
9
  .to.be.an("object")
10
- .that.has.all.keys("startService", "module", "Server", "WebSocket")
10
+ .that.has.all.keys("startService", "module", "server", "WebSocket")
11
11
  .that.respondsTo("startService")
12
- .that.respondsTo("module")
13
- .that.respondsTo("Server")
14
- .that.respondsTo("WebSocket");
12
+ .that.respondsTo("module");
15
13
  });
16
14
  });
17
15