@jcbuisson/express-x 1.5.5 → 1.5.6

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.5",
3
+ "version": "1.5.6",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "src/index.mjs",
@@ -31,11 +31,12 @@ export function protect(field) {
31
31
 
32
32
  export async function isAuthenticated(context) {
33
33
  if (context.transport !== 'ws') return
34
- // extract user from connection data
35
- const user = await getConnectionDataItem(context, 'user')
36
- // const id = context.params.connectionId
37
- // const connection = await context.app.service('Connection')._findUnique({ where: { id }})
38
- // const data = JSON.parse(connection.data)
39
- // const user = data.user
40
- if (!user) throw Error(`AuthCode hook: not authenticated ${id}`)
34
+ // extract userId from connection data
35
+ const userId = await getConnectionDataItem(context, 'userId')
36
+ if (!userId) throw Error(`Not authenticated, userId ${userId}`)
37
+ }
38
+
39
+ export const isExpired = (delay) => async (context) => {
40
+ if (context.transport !== 'ws') return
41
+ // TODO
41
42
  }