@mojaloop/sdk-scheme-adapter 24.13.0 → 24.14.0-snapshot.1
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/.yarn/cache/{@mojaloop-central-services-shared-npm-18.34.0-98deaad7cb-660f407a57.zip → @mojaloop-central-services-shared-npm-18.34.1-fc3be8e73c-f7ad2f9394.zip} +0 -0
- package/.yarn/cache/{@mojaloop-inter-scheme-proxy-cache-lib-npm-2.7.0-84455815f8-7748014a4c.zip → @mojaloop-inter-scheme-proxy-cache-lib-npm-2.9.0-cb33cd6786-fd3f20e6a7.zip} +0 -0
- package/.yarn/cache/@typescript-eslint-eslint-plugin-npm-8.46.0-e6114965b4-415afd894a.zip +0 -0
- package/.yarn/cache/@typescript-eslint-parser-npm-8.46.0-c44629050a-6838fde776.zip +0 -0
- package/.yarn/cache/@typescript-eslint-project-service-npm-8.46.0-85a4b9bb9c-de11af23ae.zip +0 -0
- package/.yarn/cache/@typescript-eslint-scope-manager-npm-8.46.0-fd8edaba78-ed85abd08c.zip +0 -0
- package/.yarn/cache/@typescript-eslint-tsconfig-utils-npm-8.46.0-8919c1f746-e78a66a854.zip +0 -0
- package/.yarn/cache/@typescript-eslint-type-utils-npm-8.46.0-dbfff922bb-5405b71b91.zip +0 -0
- package/.yarn/cache/@typescript-eslint-types-npm-8.46.0-b013400d3e-0118b0dd59.zip +0 -0
- package/.yarn/cache/@typescript-eslint-typescript-estree-npm-8.46.0-0b10d4388a-61053bd0c3.zip +0 -0
- package/.yarn/cache/@typescript-eslint-utils-npm-8.46.0-a7d3832f43-4e0da60de3.zip +0 -0
- package/.yarn/cache/@typescript-eslint-visitor-keys-npm-8.46.0-7d793afea5-37e6145b6a.zip +0 -0
- package/.yarn/install-state.gz +0 -0
- package/.yarn/releases/{yarn-4.10.2.cjs → yarn-4.10.3.cjs} +126 -126
- package/.yarnrc.yml +1 -1
- package/CLAUDE.md +186 -0
- package/modules/api-svc/package.json +2 -2
- package/modules/api-svc/src/ControlAgent/index.js +42 -11
- package/modules/api-svc/src/OutboundServer/handlers.js +1 -1
- package/modules/api-svc/src/config.js +1 -0
- package/modules/api-svc/src/index.js +244 -188
- package/modules/api-svc/src/lib/cache.js +3 -1
- package/modules/api-svc/src/lib/logger.js +1 -2
- package/modules/api-svc/test/unit/index.configPolling.test.js +229 -0
- package/modules/api-svc/test/unit/lib/model/InboundPingModel.test.js +2 -2
- package/modules/outbound-command-event-handler/package.json +4 -4
- package/modules/outbound-domain-event-handler/package.json +3 -3
- package/modules/private-shared-lib/package.json +4 -4
- package/package.json +4 -4
- package/{sbom-v24.12.0.csv → sbom-v24.13.0.csv} +220 -231
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
/*****
|
|
2
|
+
License
|
|
3
|
+
--------------
|
|
4
|
+
Copyright © 2020-2025 Mojaloop Foundation
|
|
5
|
+
The Mojaloop files are made available by the Mojaloop Foundation under the Apache License, Version 2.0 (the "License") and you may not use these files except in compliance with the License. You may obtain a copy of the License at
|
|
6
|
+
|
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
|
|
9
|
+
Unless required by applicable law or agreed to in writing, the Mojaloop files are distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
|
|
10
|
+
|
|
11
|
+
Contributors
|
|
12
|
+
--------------
|
|
13
|
+
This is the official list of the Mojaloop project contributors for this file.
|
|
14
|
+
Names of the original copyright holders (individuals or organizations)
|
|
15
|
+
should be listed with a '*' in the first column. People who have
|
|
16
|
+
contributed from an organization can be listed under the organization
|
|
17
|
+
that actually holds the copyright for their contributions (see the
|
|
18
|
+
Mojaloop Foundation for an example). Those individuals should have
|
|
19
|
+
their names indented and be marked with a '-'. Email address can be added
|
|
20
|
+
optionally within square brackets <email>.
|
|
21
|
+
|
|
22
|
+
* Mojaloop Foundation
|
|
23
|
+
* Eugen Klymniuk <eugen.klymniuk@infitx.com>
|
|
24
|
+
|
|
25
|
+
--------------
|
|
26
|
+
******/
|
|
27
|
+
|
|
28
|
+
process.env.PEER_ENDPOINT = 'localhost:4000';
|
|
29
|
+
process.env.BACKEND_ENDPOINT = 'localhost:4000';
|
|
30
|
+
process.env.CACHE_URL = 'redis://localhost:6379';
|
|
31
|
+
process.env.MGMT_API_WS_URL = 'localhost';
|
|
32
|
+
process.env.SUPPORTED_CURRENCIES = 'XXX';
|
|
33
|
+
|
|
34
|
+
jest.mock('~/lib/cache');
|
|
35
|
+
jest.mock('~/ControlAgent');
|
|
36
|
+
|
|
37
|
+
const promClient = require('prom-client');
|
|
38
|
+
const ControlAgent = require('~/ControlAgent');
|
|
39
|
+
const { Server } = require('~/index');
|
|
40
|
+
const { logger } = require('~/lib/logger');
|
|
41
|
+
const testConfig = require('./data/defaultConfig.json');
|
|
42
|
+
|
|
43
|
+
const POLL_INTERVAL_MS = 60_000;
|
|
44
|
+
|
|
45
|
+
describe('Config Polling Tests -->', () => {
|
|
46
|
+
let server;
|
|
47
|
+
let mockConfig;
|
|
48
|
+
let mockControlAgent;
|
|
49
|
+
|
|
50
|
+
beforeEach(() => {
|
|
51
|
+
jest.clearAllMocks();
|
|
52
|
+
jest.useFakeTimers();
|
|
53
|
+
promClient.register.clear(); // to prevent "metric already been registered" error
|
|
54
|
+
|
|
55
|
+
mockConfig = {
|
|
56
|
+
...testConfig,
|
|
57
|
+
pm4mlEnabled: true,
|
|
58
|
+
control: {
|
|
59
|
+
mgmtAPIWsUrl: 'localhost',
|
|
60
|
+
mgmtAPIWsPort: 4005,
|
|
61
|
+
mgmtAPILatencyAssumption: 2000,
|
|
62
|
+
mgmtAPIPollIntervalMs: POLL_INTERVAL_MS,
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
// Mock WebSocket client
|
|
67
|
+
mockControlAgent = {
|
|
68
|
+
getUpdatedConfig: jest.fn().mockResolvedValue({}),
|
|
69
|
+
readyState: 1, // OPEN
|
|
70
|
+
on: jest.fn(),
|
|
71
|
+
once: jest.fn(),
|
|
72
|
+
send: jest.fn(),
|
|
73
|
+
receive: jest.fn(),
|
|
74
|
+
stop: jest.fn().mockResolvedValue(true),
|
|
75
|
+
removeAllListeners: jest.fn(),
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
ControlAgent.createConnectedControlAgentWs = jest.fn().mockResolvedValue(mockControlAgent);
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
afterEach(async () => {
|
|
82
|
+
await server?.stop();
|
|
83
|
+
jest.useRealTimers();
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
it('should not start polling when MANAGEMENT_API_POLL_INTERVAL_MS is not configured', async () => {
|
|
87
|
+
const config = {
|
|
88
|
+
...mockConfig,
|
|
89
|
+
control: {
|
|
90
|
+
...mockConfig.control,
|
|
91
|
+
mgmtAPIPollIntervalMs: undefined,
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
server = new Server(config, logger);
|
|
96
|
+
await server.start();
|
|
97
|
+
|
|
98
|
+
await jest.advanceTimersByTimeAsync(POLL_INTERVAL_MS * 2);
|
|
99
|
+
expect(mockControlAgent.getUpdatedConfig).not.toHaveBeenCalled();
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
it('should not start polling when PM4ML is disabled', async () => {
|
|
103
|
+
const config = {
|
|
104
|
+
...mockConfig,
|
|
105
|
+
pm4mlEnabled: false,
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
server = new Server(config, logger);
|
|
109
|
+
await server.start();
|
|
110
|
+
|
|
111
|
+
await jest.advanceTimersByTimeAsync(POLL_INTERVAL_MS * 2);
|
|
112
|
+
expect(ControlAgent.Client.Create).not.toHaveBeenCalled();
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
it('should poll at configured interval', async () => {
|
|
116
|
+
server = new Server(mockConfig, logger);
|
|
117
|
+
await server.start();
|
|
118
|
+
expect(mockControlAgent.getUpdatedConfig).toHaveBeenCalledTimes(0);
|
|
119
|
+
|
|
120
|
+
await jest.advanceTimersByTimeAsync(POLL_INTERVAL_MS);
|
|
121
|
+
expect(mockControlAgent.getUpdatedConfig).toHaveBeenCalledTimes(1); // First poll
|
|
122
|
+
|
|
123
|
+
await jest.advanceTimersByTimeAsync(POLL_INTERVAL_MS);
|
|
124
|
+
expect(mockControlAgent.getUpdatedConfig).toHaveBeenCalledTimes(2); // Second poll
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
it('should call restart with merged config from polling', async () => {
|
|
128
|
+
const newJwsKey = 'new-jws-signing-key';
|
|
129
|
+
mockControlAgent.getUpdatedConfig.mockResolvedValue({
|
|
130
|
+
jwsSigningKey: newJwsKey
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
server = new Server(mockConfig, logger);
|
|
134
|
+
const restartSpy = jest.spyOn(server, 'restart');
|
|
135
|
+
|
|
136
|
+
await server.start();
|
|
137
|
+
restartSpy.mockClear();
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
await jest.advanceTimersByTimeAsync(POLL_INTERVAL_MS);
|
|
141
|
+
|
|
142
|
+
expect(restartSpy).toHaveBeenCalledWith(
|
|
143
|
+
expect.objectContaining({
|
|
144
|
+
jwsSigningKey: newJwsKey
|
|
145
|
+
}),
|
|
146
|
+
{ source: 'polling' }
|
|
147
|
+
);
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
it('should handle unchanged config efficiently (no-op)', async () => {
|
|
151
|
+
mockControlAgent.getUpdatedConfig.mockResolvedValue({});
|
|
152
|
+
|
|
153
|
+
server = new Server(mockConfig, logger);
|
|
154
|
+
const restartSpy = jest.spyOn(server, 'restart');
|
|
155
|
+
await server.start();
|
|
156
|
+
|
|
157
|
+
await jest.advanceTimersByTimeAsync(POLL_INTERVAL_MS - 10);
|
|
158
|
+
expect(restartSpy).toHaveBeenCalledTimes(1); // ping timeout
|
|
159
|
+
|
|
160
|
+
await jest.advanceTimersByTimeAsync(10);
|
|
161
|
+
|
|
162
|
+
expect(restartSpy).toHaveBeenCalledTimes(2);
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
it('should prevent race condition when update already in progress', async () => {
|
|
166
|
+
mockControlAgent.getUpdatedConfig.mockResolvedValue({ jwsSigningKey: 'new-key' });
|
|
167
|
+
|
|
168
|
+
server = new Server(mockConfig, logger);
|
|
169
|
+
await server.start();
|
|
170
|
+
// Simulate restart in progress
|
|
171
|
+
server._configUpdateInProgress = true;
|
|
172
|
+
|
|
173
|
+
await jest.advanceTimersByTimeAsync(POLL_INTERVAL_MS * 2);
|
|
174
|
+
|
|
175
|
+
expect(mockControlAgent.getUpdatedConfig).not.toHaveBeenCalled();
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
it('should skip polling when WebSocket not OPEN', async () => {
|
|
179
|
+
server = new Server(mockConfig, logger);
|
|
180
|
+
await server.start();
|
|
181
|
+
|
|
182
|
+
mockControlAgent.getUpdatedConfig.mockClear();
|
|
183
|
+
mockControlAgent.readyState = 0; // CONNECTING
|
|
184
|
+
await jest.advanceTimersByTimeAsync(POLL_INTERVAL_MS);
|
|
185
|
+
|
|
186
|
+
expect(mockControlAgent.getUpdatedConfig).not.toHaveBeenCalled();
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
describe('Error handling Tests -->', () => {
|
|
190
|
+
it('should handle network errors gracefully during polling', async () => {
|
|
191
|
+
mockControlAgent.getUpdatedConfig.mockRejectedValue(new Error('Connection refused'));
|
|
192
|
+
|
|
193
|
+
server = new Server(mockConfig, logger);
|
|
194
|
+
await server.start();
|
|
195
|
+
await jest.advanceTimersByTimeAsync(POLL_INTERVAL_MS);
|
|
196
|
+
|
|
197
|
+
// Error logged but polling continues - next poll should work
|
|
198
|
+
mockControlAgent.getUpdatedConfig.mockResolvedValue({});
|
|
199
|
+
await jest.advanceTimersByTimeAsync(POLL_INTERVAL_MS);
|
|
200
|
+
|
|
201
|
+
expect(mockControlAgent.getUpdatedConfig).toHaveBeenCalledTimes(2); // failed + success calls
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
it('should handle missing config response', async () => {
|
|
205
|
+
mockControlAgent.getUpdatedConfig.mockResolvedValue(null);
|
|
206
|
+
|
|
207
|
+
server = new Server(mockConfig, logger);
|
|
208
|
+
await server.start();
|
|
209
|
+
await jest.advanceTimersByTimeAsync(POLL_INTERVAL_MS);
|
|
210
|
+
|
|
211
|
+
// Should not crash, just log warning
|
|
212
|
+
expect(server).toBeDefined();
|
|
213
|
+
});
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
it('should stop polling when server stops', async () => {
|
|
217
|
+
server = new Server(mockConfig, logger);
|
|
218
|
+
await server.start();
|
|
219
|
+
|
|
220
|
+
expect(server._configPollInterval).toBeDefined();
|
|
221
|
+
await server.stop();
|
|
222
|
+
expect(server._configPollInterval).toBeNull();
|
|
223
|
+
|
|
224
|
+
mockControlAgent.getUpdatedConfig.mockClear();
|
|
225
|
+
await jest.advanceTimersByTimeAsync(POLL_INTERVAL_MS * 2);
|
|
226
|
+
|
|
227
|
+
expect(mockControlAgent.getUpdatedConfig).not.toHaveBeenCalled();
|
|
228
|
+
});
|
|
229
|
+
});
|
|
@@ -69,7 +69,7 @@ const pingHeadersDto = ({
|
|
|
69
69
|
...(signature && { [Headers.FSPIOP.SIGNATURE]: signature })
|
|
70
70
|
});
|
|
71
71
|
|
|
72
|
-
describe
|
|
72
|
+
describe('InboundPingModel Tests -->', () => {
|
|
73
73
|
beforeEach(() => {
|
|
74
74
|
mockAxios.reset();
|
|
75
75
|
});
|
|
@@ -86,7 +86,7 @@ describe.skip('InboundPingModel Tests -->', () => {
|
|
|
86
86
|
const sourceFspId = 'fromDfsp';
|
|
87
87
|
const dfspId = 'theSDK';
|
|
88
88
|
mockAxios.onPut().reply((reqConfig) => {
|
|
89
|
-
expect(reqConfig.url).toBe(`/ping/${requestId}
|
|
89
|
+
expect(reqConfig.url).toBe(`/ping/${requestId}`);
|
|
90
90
|
expect(reqConfig.headers[Headers.FSPIOP.SOURCE]).toBe(dfspId);
|
|
91
91
|
expect(reqConfig.headers[Headers.FSPIOP.DESTINATION]).toBe(sourceFspId);
|
|
92
92
|
return [200];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mojaloop/sdk-scheme-adapter-outbound-command-event-handler",
|
|
3
|
-
"version": "0.3.0-snapshot.
|
|
3
|
+
"version": "0.3.0-snapshot.67",
|
|
4
4
|
"description": "Mojaloop sdk scheme adapter command event handler",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://github.com/mojaloop/sdk-scheme-adapter/",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@mojaloop/api-snippets": "18.2.0",
|
|
45
|
-
"@mojaloop/central-services-shared": "18.34.
|
|
45
|
+
"@mojaloop/central-services-shared": "18.34.1",
|
|
46
46
|
"@mojaloop/logging-bc-client-lib": "0.5.8",
|
|
47
47
|
"@mojaloop/logging-bc-public-types-lib": "0.5.6",
|
|
48
48
|
"@mojaloop/sdk-scheme-adapter-private-shared-lib": "workspace:^",
|
|
@@ -65,8 +65,8 @@
|
|
|
65
65
|
"@types/supertest": "6.0.3",
|
|
66
66
|
"@types/swagger-ui-express": "4.1.8",
|
|
67
67
|
"@types/yamljs": "0.2.34",
|
|
68
|
-
"@typescript-eslint/eslint-plugin": "8.
|
|
69
|
-
"@typescript-eslint/parser": "8.
|
|
68
|
+
"@typescript-eslint/eslint-plugin": "8.46.0",
|
|
69
|
+
"@typescript-eslint/parser": "8.46.0",
|
|
70
70
|
"copyfiles": "2.4.1",
|
|
71
71
|
"eslint": "9.15.0",
|
|
72
72
|
"jest": "29.7.0",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mojaloop/sdk-scheme-adapter-outbound-domain-event-handler",
|
|
3
|
-
"version": "0.3.0-snapshot.
|
|
3
|
+
"version": "0.3.0-snapshot.67",
|
|
4
4
|
"description": "mojaloop sdk scheme adapter outbound domain event handler",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://github.com/mojaloop/sdk-scheme-adapter/",
|
|
@@ -62,8 +62,8 @@
|
|
|
62
62
|
"@types/supertest": "6.0.3",
|
|
63
63
|
"@types/swagger-ui-express": "4.1.8",
|
|
64
64
|
"@types/yamljs": "0.2.34",
|
|
65
|
-
"@typescript-eslint/eslint-plugin": "8.
|
|
66
|
-
"@typescript-eslint/parser": "8.
|
|
65
|
+
"@typescript-eslint/eslint-plugin": "8.46.0",
|
|
66
|
+
"@typescript-eslint/parser": "8.46.0",
|
|
67
67
|
"copyfiles": "2.4.1",
|
|
68
68
|
"eslint": "9.15.0",
|
|
69
69
|
"jest": "29.7.0",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mojaloop/sdk-scheme-adapter-private-shared-lib",
|
|
3
|
-
"version": "0.4.0-snapshot.
|
|
3
|
+
"version": "0.4.0-snapshot.67",
|
|
4
4
|
"description": "SDK Scheme Adapter private shared library.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://github.com/mojaloop/accounts-and-balances-bc/tree/main/modules/private-types",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@mojaloop/api-snippets": "18.2.0",
|
|
33
|
-
"@mojaloop/central-services-shared": "18.34.
|
|
33
|
+
"@mojaloop/central-services-shared": "18.34.1",
|
|
34
34
|
"@mojaloop/logging-bc-public-types-lib": "0.5.6",
|
|
35
35
|
"@mojaloop/platform-shared-lib-messaging-types-lib": "0.7.3",
|
|
36
36
|
"@mojaloop/platform-shared-lib-nodejs-kafka-client-lib": "0.5.18",
|
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
"@eslint/compat": "1.4.0",
|
|
43
43
|
"@types/node": "24.7.0",
|
|
44
44
|
"@types/uuid": "10.0.0",
|
|
45
|
-
"@typescript-eslint/eslint-plugin": "8.
|
|
46
|
-
"@typescript-eslint/parser": "8.
|
|
45
|
+
"@typescript-eslint/eslint-plugin": "8.46.0",
|
|
46
|
+
"@typescript-eslint/parser": "8.46.0",
|
|
47
47
|
"eslint": "9.15.0",
|
|
48
48
|
"jest": "29.7.0",
|
|
49
49
|
"npm-check-updates": "16.7.10",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mojaloop/sdk-scheme-adapter",
|
|
3
|
-
"version": "24.
|
|
3
|
+
"version": "24.14.0-snapshot.1",
|
|
4
4
|
"description": "mojaloop sdk-scheme-adapter",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://github.com/mojaloop/sdk-scheme-adapter",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"Yevhen Kyriukha <yevhen.kyriukha@modusbox.com>",
|
|
19
19
|
"Vijay Kumar Guthi <vijaya.guthi@modusbox.com>"
|
|
20
20
|
],
|
|
21
|
-
"packageManager": "yarn@4.10.
|
|
21
|
+
"packageManager": "yarn@4.10.3",
|
|
22
22
|
"engines": {
|
|
23
23
|
"yarn": "3.2.0"
|
|
24
24
|
},
|
|
@@ -85,8 +85,8 @@
|
|
|
85
85
|
"@types/jest": "30.0.0",
|
|
86
86
|
"@types/node": "24.7.0",
|
|
87
87
|
"@types/node-cache": "4.2.5",
|
|
88
|
-
"@typescript-eslint/eslint-plugin": "8.
|
|
89
|
-
"@typescript-eslint/parser": "8.
|
|
88
|
+
"@typescript-eslint/eslint-plugin": "8.46.0",
|
|
89
|
+
"@typescript-eslint/parser": "8.46.0",
|
|
90
90
|
"audit-ci": "7.1.0",
|
|
91
91
|
"eslint": "9.15.0",
|
|
92
92
|
"eslint-config-airbnb-typescript": "18.0.0",
|