timing-provider-server 5.0.0 → 5.0.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.
Files changed (2) hide show
  1. package/build/node/app.js +2 -8
  2. package/package.json +15 -15
package/build/node/app.js CHANGED
@@ -8,11 +8,9 @@ const commandLineArguments = yargs(argv.slice(2)).help().option('port', {
8
8
  describe: 'specify the port at which the server will be listening',
9
9
  type: 'number'
10
10
  }).strict().argv;
11
-
12
11
  if (commandLineArguments instanceof Promise) {
13
12
  throw new TypeError('The command line arguments are expected to get parsed synchronously.');
14
13
  }
15
-
16
14
  const {
17
15
  port
18
16
  } = commandLineArguments;
@@ -23,9 +21,7 @@ const server = new WebSocketServer({
23
21
  let origin = 0;
24
22
  server.on('connection', connection => {
25
23
  const id = generateUniqueNumber(activeConnections);
26
-
27
24
  const sendMessage = message => connection.send(JSON.stringify(message));
28
-
29
25
  activeConnections.set(id, sendMessage);
30
26
  sendMessage({
31
27
  events: [],
@@ -36,9 +32,9 @@ server.on('connection', connection => {
36
32
  connection.on('message', message => {
37
33
  const parsedMessage = JSON.parse(message.toString());
38
34
  const sendMessageToActiveConnection = activeConnections.get(parsedMessage.client.id);
39
-
40
35
  if (sendMessageToActiveConnection !== undefined && parsedMessage.type !== 'check') {
41
- sendMessageToActiveConnection({ ...parsedMessage,
36
+ sendMessageToActiveConnection({
37
+ ...parsedMessage,
42
38
  client: {
43
39
  id
44
40
  }
@@ -46,13 +42,11 @@ server.on('connection', connection => {
46
42
  }
47
43
  });
48
44
  connection.on('close', () => activeConnections.delete(id));
49
-
50
45
  for (const activeConnection of activeConnections) {
51
46
  if (activeConnection[0] !== id) {
52
47
  const ids = [id, activeConnection[0]].sort();
53
48
  const label = ids.join('-');
54
49
  const type = 'request';
55
-
56
50
  if (ids[0] === id) {
57
51
  sendMessage({
58
52
  client: {
package/package.json CHANGED
@@ -18,33 +18,33 @@
18
18
  }
19
19
  ],
20
20
  "dependencies": {
21
- "fast-unique-numbers": "^6.0.21",
22
- "tslib": "^2.4.0",
21
+ "fast-unique-numbers": "^6.0.23",
22
+ "tslib": "^2.4.1",
23
23
  "typescript": "^4.8.4",
24
- "ws": "^8.9.0",
25
- "yargs": "^17.6.0"
24
+ "ws": "^8.11.0",
25
+ "yargs": "^17.6.2"
26
26
  },
27
27
  "description": "A command line tool to spin up a server which can be used with the timing-provider.",
28
28
  "devDependencies": {
29
29
  "@babel/cli": "^7.19.3",
30
- "@babel/core": "^7.19.3",
31
- "@babel/preset-env": "^7.19.3",
30
+ "@babel/core": "^7.20.2",
31
+ "@babel/preset-env": "^7.20.2",
32
32
  "@babel/register": "^7.18.9",
33
- "@commitlint/cli": "^17.1.2",
34
- "@commitlint/config-angular": "^17.1.0",
33
+ "@commitlint/cli": "^17.2.0",
34
+ "@commitlint/config-angular": "^17.2.0",
35
35
  "@types/ws": "^8.5.3",
36
36
  "@types/yargs": "^17.0.13",
37
- "chai": "^4.3.6",
37
+ "chai": "^4.3.7",
38
38
  "commitizen": "^4.2.5",
39
39
  "cz-conventional-changelog": "^3.3.0",
40
- "eslint": "^8.24.0",
41
- "eslint-config-holy-grail": "^54.0.0",
42
- "husky": "^8.0.1",
43
- "mocha": "^10.0.0",
40
+ "eslint": "^8.27.0",
41
+ "eslint-config-holy-grail": "^54.0.3",
42
+ "husky": "^8.0.2",
43
+ "mocha": "^10.1.0",
44
44
  "prettier": "^2.7.1",
45
45
  "pretty-quick": "^3.1.3",
46
46
  "rimraf": "^3.0.2",
47
- "sinon": "^14.0.1",
47
+ "sinon": "^14.0.2",
48
48
  "sinon-chai": "^3.7.0",
49
49
  "tsconfig-holy-grail": "^11.1.36"
50
50
  },
@@ -85,5 +85,5 @@
85
85
  "test:unit": "if [ \"$TYPE\" = \"\" -o \"$TYPE\" = \"unit\" ]; then mocha --bail --parallel --recursive --require config/mocha/config-unit.js test/unit; fi"
86
86
  },
87
87
  "type": "module",
88
- "version": "5.0.0"
88
+ "version": "5.0.2"
89
89
  }