@jcbuisson/express-x 1.5.19 → 1.5.22

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@jcbuisson/express-x",
3
- "version": "1.5.19",
3
+ "version": "1.5.22",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "src/index.mjs",
package/src/context.mjs CHANGED
@@ -50,8 +50,13 @@ export async function removeConnectionDataItem(context, key) {
50
50
  })
51
51
  }
52
52
 
53
- export async function sendEventToClient(context, type, value) {
53
+ export async function sendServiceEventToClient(context, name, action, result) {
54
54
  const id = context.params.connectionId
55
55
  const socket = context.app.cnx2Socket[id]
56
- socket.emit(type, value)
56
+ socket.emit('service-event', {
57
+ name,
58
+ action,
59
+ result,
60
+ })
61
+
57
62
  }
package/src/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
 
2
2
  import { expressX } from './server.mjs'
3
3
  import { hashPassword, protect, isAuthenticated } from './common-hooks.mjs'
4
- import { getContextConnection, resetConnection, getConnectionDataItem, setConnectionDataItem, removeConnectionDataItem, sendEventToClient } from './context.mjs'
4
+ import { getContextConnection, resetConnection, getConnectionDataItem, setConnectionDataItem, removeConnectionDataItem, sendServiceEventToClient } from './context.mjs'
5
5
 
6
6
  export {
7
7
  expressX,
@@ -13,7 +13,7 @@ export {
13
13
  setConnectionDataItem,
14
14
  removeConnectionDataItem,
15
15
 
16
- sendEventToClient,
16
+ sendServiceEventToClient,
17
17
 
18
18
  hashPassword,
19
19
  protect,