@jcbuisson/express-x-client 1.0.3 → 1.0.5

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/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@jcbuisson/express-x-client",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "description": "",
5
- "main": "src/express-x-client.js",
5
+ "main": "src/index.js",
6
6
  "repository": {
7
7
  "type": "git",
8
- "url": "git@gitlab.com:buisson31/express-x.git"
8
+ "url": "git@gitlab.com:buisson31/express-x-client.git"
9
9
  },
10
10
  "author": "Jean-Christophe Buisson <buisson@enseeiht.fr> (jcbuisson.dev)",
11
11
  "license": "MIT",
@@ -5,7 +5,6 @@ function expressxClient(socket) {
5
5
 
6
6
  const waitingPromises = {}
7
7
  const action2service2handlers = {}
8
- const serviceActions = {}
9
8
 
10
9
  // on connection
11
10
  socket.on("connected", async (connectionId) => {
@@ -64,9 +63,11 @@ function expressxClient(socket) {
64
63
  serviceHandlers[name] = handler
65
64
  },
66
65
  }
66
+ // use a proxy to allow for any method name for a service
67
67
  const handler = {
68
68
  get(service, action) {
69
69
  if (!(action in service)) {
70
+ // newly used property: define it as the service method request function
70
71
  service[action] = (...args) => serviceMethodRequest(name, action, ...args)
71
72
  }
72
73
  return service[action]