@jcbuisson/express-x 1.4.1 → 1.4.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/package.json +1 -1
  2. package/src/server.mjs +2 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jcbuisson/express-x",
3
- "version": "1.4.1",
3
+ "version": "1.4.2",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "src/index.mjs",
package/src/server.mjs CHANGED
@@ -16,7 +16,7 @@ export function expressX(prisma, options = {}) {
16
16
  const services = {}
17
17
 
18
18
  app.connections = {}
19
- let lastConnectionId = 1
19
+ let lastConnectionId = options.initialConnectionId || 1
20
20
 
21
21
  app.printCnx = (label) => {
22
22
  console.log(label)
@@ -69,7 +69,6 @@ export function expressX(prisma, options = {}) {
69
69
  const beforeMethodHooks = service?.hooks?.before && service.hooks.before[methodName] || []
70
70
  const beforeAllHooks = service?.hooks?.before?.all || []
71
71
  for (const hook of [...beforeMethodHooks, ...beforeAllHooks]) {
72
- // context = await hook(context)
73
72
  await hook(context)
74
73
  }
75
74
 
@@ -82,10 +81,9 @@ export function expressX(prisma, options = {}) {
82
81
  const afterMethodHooks = service?.hooks?.after && service.hooks.after[methodName] || []
83
82
  const afterAllHooks = service?.hooks?.after?.all || []
84
83
  for (const hook of [...afterMethodHooks, ...afterAllHooks]) {
85
- // context = await hook(context)
86
84
  await hook(context)
87
85
  }
88
- return result
86
+ return context.result
89
87
  }
90
88
 
91
89
  // hooked version of method: `create`, etc., to be called from backend with no context