@jcbuisson/express-x 1.5.17 → 1.5.19

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.17",
3
+ "version": "1.5.19",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "src/index.mjs",
package/src/context.mjs CHANGED
@@ -49,3 +49,9 @@ export async function removeConnectionDataItem(context, key) {
49
49
  }
50
50
  })
51
51
  }
52
+
53
+ export async function sendEventToClient(context, type, value) {
54
+ const id = context.params.connectionId
55
+ const socket = context.app.cnx2Socket[id]
56
+ socket.emit(type, value)
57
+ }
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 } from './context.mjs'
4
+ import { getContextConnection, resetConnection, getConnectionDataItem, setConnectionDataItem, removeConnectionDataItem, sendEventToClient } from './context.mjs'
5
5
 
6
6
  export {
7
7
  expressX,
@@ -12,6 +12,8 @@ export {
12
12
  getConnectionDataItem,
13
13
  setConnectionDataItem,
14
14
  removeConnectionDataItem,
15
+
16
+ sendEventToClient,
15
17
 
16
18
  hashPassword,
17
19
  protect,
package/src/server.mjs CHANGED
@@ -435,6 +435,7 @@ export function expressX(prisma, options = {}) {
435
435
  // enhance `app` with objects and methods
436
436
  return Object.assign(app, {
437
437
  options,
438
+ cnx2Socket,
438
439
  createDatabaseService,
439
440
  createService,
440
441
  service,