@jcbuisson/express-x 1.5.31 → 1.5.32
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 +1 -1
- package/src/server.mjs +4 -2
- package/test/index.test.js +1 -8
package/package.json
CHANGED
package/src/server.mjs
CHANGED
|
@@ -340,7 +340,8 @@ export function expressX(prisma, options = {}) {
|
|
|
340
340
|
|
|
341
341
|
try {
|
|
342
342
|
const result = await serviceMethod(context, ...args)
|
|
343
|
-
|
|
343
|
+
const trimmedResult = JSON.stringify(result).slice(0, 300)
|
|
344
|
+
app.log('verbose', `client-response ${uid} ${trimmedResult}`)
|
|
344
345
|
socket.emit('client-response', {
|
|
345
346
|
uid,
|
|
346
347
|
result,
|
|
@@ -386,7 +387,8 @@ export function expressX(prisma, options = {}) {
|
|
|
386
387
|
app.log('verbose', `service-event ${service.name} ${action} ${channelName}`)
|
|
387
388
|
const connectionList = await getChannelConnections(channelName)
|
|
388
389
|
for (const connection of connectionList) {
|
|
389
|
-
|
|
390
|
+
const trimmedResult = JSON.stringify(result).slice(0, 300)
|
|
391
|
+
app.log('verbose', `emit to ${connection.id} ${service.name} ${action} ${trimmedResult}`)
|
|
390
392
|
const socket = cnx2Socket[connection.id]
|
|
391
393
|
if (!socket) {
|
|
392
394
|
continue // SHOULD NOT HAPPEN
|
package/test/index.test.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
import bodyParser from 'body-parser'
|
|
3
3
|
import axios from 'axios'
|
|
4
|
-
import io from 'socket.io-client'
|
|
5
4
|
import { PrismaClient } from '@prisma/client'
|
|
6
5
|
|
|
7
6
|
|
|
@@ -10,13 +9,7 @@ import { strict as assert } from 'node:assert'
|
|
|
10
9
|
|
|
11
10
|
import { expressX } from '../src/index.mjs'
|
|
12
11
|
|
|
13
|
-
const prisma = new PrismaClient(
|
|
14
|
-
datasources: {
|
|
15
|
-
db: {
|
|
16
|
-
url: "file:./dev.db",
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
})
|
|
12
|
+
const prisma = new PrismaClient()
|
|
20
13
|
|
|
21
14
|
// `app` is a regular express application, enhanced with services and real-time features
|
|
22
15
|
const app = expressX(prisma)
|