@jcbuisson/express-x 1.7.12 → 1.7.13

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 +6 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jcbuisson/express-x",
3
- "version": "1.7.12",
3
+ "version": "1.7.13",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "src/index.mjs",
package/src/server.mjs CHANGED
@@ -202,16 +202,17 @@ export function expressX(prisma, config) {
202
202
  }
203
203
 
204
204
  // introspect schema and return a map: field name => prisma type
205
- async function getTypesMap() {
206
- const dmmf = await service.prisma._getDmmf()
207
- const fieldDescriptions = dmmf.modelMap[service.name].fields
205
+ function getTypesMap() {
206
+ // const dmmf = await service.prisma._getDmmf()
207
+ // const fieldDescriptions = dmmf.modelMap[service.name].fields
208
+ const dmmf = service.prisma._runtimeDataModel
209
+ const fieldDescriptions = dmmf.models[service.name].fields
208
210
  return fieldDescriptions.reduce((accu, descr) => {
209
211
  accu[descr.name] = descr.type
210
212
  return accu
211
213
  }, {})
212
214
  }
213
215
 
214
-
215
216
  app.post(path, async (req, res) => {
216
217
  app.log('verbose', `http request POST ${req.url}`)
217
218
  context.params.req = req
@@ -232,7 +233,7 @@ export function expressX(prisma, config) {
232
233
  // the values in `req.query` are all strings, but Prisma need proper types
233
234
  // we need to introspect column types and do the proper transtyping
234
235
  for (const fieldName in query) {
235
- const typesDict = await getTypesMap()
236
+ const typesDict = getTypesMap()
236
237
  const fieldType = typesDict[fieldName]
237
238
 
238
239
  if (fieldType === 'Int') {
@@ -333,7 +334,6 @@ export function expressX(prisma, config) {
333
334
  setSocket(connection.id, socket)
334
335
 
335
336
  // emit 'connection' event for app (expressjs extends EventEmitter)
336
- console.log('EMIT CONNECTION')
337
337
  app.emit('connection', connection)
338
338
 
339
339
  // send 'connected' event to client