account-lookup-service 15.6.0-iso.3 → 15.6.0-iso.5
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +3 -3
- package/src/plugins.js +32 -8
- package/src/server.js +0 -19
- package/test/unit/domain/timeout/dto.test.js +1 -2
- package/test/unit/plugins.test.js +2 -0
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "account-lookup-service",
|
3
3
|
"description": "Account Lookup Service is used to validate Party and Participant lookups.",
|
4
|
-
"version": "15.6.0-iso.
|
4
|
+
"version": "15.6.0-iso.5",
|
5
5
|
"license": "Apache-2.0",
|
6
6
|
"author": "ModusBox",
|
7
7
|
"contributors": [
|
@@ -95,12 +95,12 @@
|
|
95
95
|
"@mojaloop/central-services-health": "15.0.0",
|
96
96
|
"@mojaloop/central-services-logger": "11.5.1",
|
97
97
|
"@mojaloop/central-services-metrics": "12.0.8",
|
98
|
-
"@mojaloop/central-services-shared": "18.10.
|
98
|
+
"@mojaloop/central-services-shared": "18.10.1-snapshot.3",
|
99
99
|
"@mojaloop/central-services-stream": "11.3.1",
|
100
100
|
"@mojaloop/database-lib": "11.0.6",
|
101
101
|
"@mojaloop/event-sdk": "14.1.1",
|
102
102
|
"@mojaloop/inter-scheme-proxy-cache-lib": "2.3.0",
|
103
|
-
"@mojaloop/ml-schema-transformer-lib": "1.1.
|
103
|
+
"@mojaloop/ml-schema-transformer-lib": "1.1.3",
|
104
104
|
"@mojaloop/sdk-standard-components": "19.0.0",
|
105
105
|
"@now-ims/hapi-now-auth": "2.1.0",
|
106
106
|
"ajv": "8.17.1",
|
package/src/plugins.js
CHANGED
@@ -24,16 +24,22 @@
|
|
24
24
|
******/
|
25
25
|
'use strict'
|
26
26
|
|
27
|
-
const
|
27
|
+
const { randomUUID } = require('node:crypto')
|
28
28
|
const Inert = require('@hapi/inert')
|
29
29
|
const Vision = require('@hapi/vision')
|
30
30
|
const Blipp = require('blipp')
|
31
31
|
const ErrorHandling = require('@mojaloop/central-services-error-handling')
|
32
|
-
const
|
33
|
-
|
34
|
-
|
35
|
-
|
32
|
+
const {
|
33
|
+
APIDocumentation,
|
34
|
+
FSPIOPHeaderValidation,
|
35
|
+
HapiEventPlugin,
|
36
|
+
HapiRawPayload,
|
37
|
+
OpenapiBackendValidator
|
38
|
+
} = require('@mojaloop/central-services-shared').Util.Hapi
|
39
|
+
|
40
|
+
const Config = require('./lib/config')
|
36
41
|
const MetricsPlugin = require('./metrics/plugin')
|
42
|
+
const RequestLogger = require('./lib/requestLogger')
|
37
43
|
|
38
44
|
const registerPlugins = async (server, openAPIBackend) => {
|
39
45
|
await server.register(OpenapiBackendValidator)
|
@@ -121,10 +127,10 @@ const registerPlugins = async (server, openAPIBackend) => {
|
|
121
127
|
Inert,
|
122
128
|
Vision,
|
123
129
|
ErrorHandling,
|
124
|
-
|
125
|
-
|
130
|
+
HapiRawPayload,
|
131
|
+
HapiEventPlugin,
|
126
132
|
{
|
127
|
-
plugin:
|
133
|
+
plugin: FSPIOPHeaderValidation.plugin,
|
128
134
|
options: getOptionsForFSPIOPHeaderValidation()
|
129
135
|
}
|
130
136
|
])
|
@@ -132,6 +138,24 @@ const registerPlugins = async (server, openAPIBackend) => {
|
|
132
138
|
if (Config.DISPLAY_ROUTES === true) {
|
133
139
|
await server.register([Blipp])
|
134
140
|
}
|
141
|
+
|
142
|
+
await server.ext([
|
143
|
+
{
|
144
|
+
type: 'onRequest',
|
145
|
+
method: (request, h) => {
|
146
|
+
request.headers.traceid = request.headers.traceid || randomUUID()
|
147
|
+
RequestLogger.logRequest(request)
|
148
|
+
return h.continue
|
149
|
+
}
|
150
|
+
},
|
151
|
+
{
|
152
|
+
type: 'onPreResponse',
|
153
|
+
method: (request, h) => {
|
154
|
+
RequestLogger.logResponse(request)
|
155
|
+
return h.continue
|
156
|
+
}
|
157
|
+
}
|
158
|
+
])
|
135
159
|
}
|
136
160
|
|
137
161
|
module.exports = {
|
package/src/server.js
CHANGED
@@ -23,7 +23,6 @@
|
|
23
23
|
******/
|
24
24
|
'use strict'
|
25
25
|
|
26
|
-
const { randomUUID } = require('node:crypto')
|
27
26
|
const Hapi = require('@hapi/hapi')
|
28
27
|
const Boom = require('@hapi/boom')
|
29
28
|
|
@@ -37,7 +36,6 @@ const { name, version } = require('../package.json')
|
|
37
36
|
const Db = require('./lib/db')
|
38
37
|
const Util = require('./lib/util')
|
39
38
|
const Plugins = require('./plugins')
|
40
|
-
const RequestLogger = require('./lib/requestLogger')
|
41
39
|
const Migrator = require('./lib/migrator')
|
42
40
|
const APIHandlers = require('./api')
|
43
41
|
const Routes = require('./api/routes')
|
@@ -104,23 +102,6 @@ const createServer = async (port, api, routes, isAdmin, proxyCacheConfig, proxyM
|
|
104
102
|
}
|
105
103
|
}
|
106
104
|
|
107
|
-
await server.ext([
|
108
|
-
{
|
109
|
-
type: 'onPreHandler',
|
110
|
-
method: (request, h) => {
|
111
|
-
request.headers.traceid = request.headers.traceid || randomUUID()
|
112
|
-
RequestLogger.logRequest(request)
|
113
|
-
return h.continue
|
114
|
-
}
|
115
|
-
},
|
116
|
-
{
|
117
|
-
type: 'onPreResponse',
|
118
|
-
method: (request, h) => {
|
119
|
-
RequestLogger.logResponse(request)
|
120
|
-
return h.continue
|
121
|
-
}
|
122
|
-
}
|
123
|
-
])
|
124
105
|
await Plugins.registerPlugins(server, api, isAdmin)
|
125
106
|
|
126
107
|
server.route(routes)
|
@@ -9,8 +9,7 @@ describe('timeoutCallbackDto Tests -->', () => {
|
|
9
9
|
config.API_TYPE = realApiType
|
10
10
|
})
|
11
11
|
|
12
|
-
|
13
|
-
test.skip('should produce ISO payload', async () => {
|
12
|
+
test('should produce ISO payload', async () => {
|
14
13
|
config.API_TYPE = API_TYPES.iso20022
|
15
14
|
const destination = 'D1'
|
16
15
|
const partyId = 'P1'
|
@@ -50,6 +50,7 @@ describe('Plugin Tests', () => {
|
|
50
50
|
// Arrange
|
51
51
|
const server = {
|
52
52
|
register: sandbox.spy(),
|
53
|
+
ext: sandbox.spy(),
|
53
54
|
info: {
|
54
55
|
port: '8000'
|
55
56
|
}
|
@@ -72,6 +73,7 @@ describe('Plugin Tests', () => {
|
|
72
73
|
// Arrange
|
73
74
|
const server = {
|
74
75
|
register: sandbox.spy(),
|
76
|
+
ext: sandbox.spy(),
|
75
77
|
info: {
|
76
78
|
port: '8000'
|
77
79
|
}
|