Compare View
Commits (2)
Changes
Showing 4 changed files Side-by-side Diff
CHANGELOG.md
... | ... | @@ -4,8 +4,14 @@ All notable changes to this project will be documented in this file. Dates are d |
4 | 4 | |
5 | 5 | Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). |
6 | 6 | |
7 | +#### [v1.45.22](https://gitlab.kodesumber.com/komodo/komodo-sdk/compare/v1.45.21...v1.45.22) | |
8 | + | |
9 | +- MODULE_NAME on gateway.advice-push-server [`bd290f7`](https://gitlab.kodesumber.com/komodo/komodo-sdk/commit/bd290f7c51f7c386d6844b40a7956528129ae923) | |
10 | + | |
7 | 11 | #### [v1.45.21](https://gitlab.kodesumber.com/komodo/komodo-sdk/compare/v1.45.20...v1.45.21) |
8 | 12 | |
13 | +> 12 August 2025 | |
14 | + | |
9 | 15 | - Bump express from 4.18.2 to 4.21.2 [`52f5134`](https://gitlab.kodesumber.com/komodo/komodo-sdk/commit/52f513417dcd38e9238f813cc96711195354e3aa) |
10 | 16 | - Bump express-session from 1.15.6 to 1.18.2 [`f3fe3af`](https://gitlab.kodesumber.com/komodo/komodo-sdk/commit/f3fe3afbc2d2b8a491de0ccc01b60e79b9bf1fc8) |
11 | 17 | - Change repo url to https://github.com/tektrans/komodo-sdk.git [`beb1e3b`](https://gitlab.kodesumber.com/komodo/komodo-sdk/commit/beb1e3b559839e2bb8d9459185f2508d54e772ab) |
gateway/advice-push-server.js
1 | +const MODULE_NAME = 'KOMODO-SDK.GATEWAY.ADVICE-PUSH-SERVER'; | |
2 | + | |
1 | 3 | const express = require('express'); |
2 | 4 | const bodyParser = require('body-parser'); |
3 | 5 | const logger = require('tektrans-logger'); |
... | ... | @@ -12,47 +14,57 @@ let partner = null; |
12 | 14 | function setPartner(_partner) { |
13 | 15 | partner = _partner; |
14 | 16 | |
15 | - if (!config || !config.push_server || !config.push_server.apikey || !config.push_server.advice || !config.push_server.advice.url || !config.push_server.advice.port) { | |
17 | + if ( | |
18 | + !config | |
19 | + || !config.push_server | |
20 | + || !config.push_server.apikey | |
21 | + || !config.push_server.advice | |
22 | + || !config.push_server.advice.url | |
23 | + || !config.push_server.advice.port) { | |
16 | 24 | return; |
17 | 25 | } |
18 | 26 | |
19 | - app.listen(config.push_server.advice.port, function () { | |
20 | - logger.info('Advice server listening', {port: config.push_server.advice.port}); | |
27 | + app.listen(config.push_server.advice.port, () => { | |
28 | + logger.info(`${MODULE_NAME} 7C994547: Listening`, { | |
29 | + port: config.push_server.advice.port, | |
30 | + }); | |
21 | 31 | }); |
22 | 32 | } |
23 | 33 | |
24 | 34 | function isValidApikey(req, res, next) { |
25 | - if (config.push_server && config.push_server.apikey && (req.params.apikey === config.push_server.apikey)) { | |
35 | + if ( | |
36 | + config.push_server | |
37 | + && config.push_server.apikey | |
38 | + && (req.params.apikey === config.push_server.apikey) | |
39 | + ) { | |
26 | 40 | next(); |
27 | - } | |
28 | - else { | |
41 | + } else { | |
29 | 42 | res.end('INVALID_APIKEY'); |
30 | 43 | } |
31 | 44 | } |
32 | 45 | |
33 | 46 | function adviceHandler(req, res) { |
34 | - | |
35 | 47 | if (!partner) { |
36 | - logger.warn('PUSH-ADVICE: Undefined partner, skipped'); | |
48 | + logger.warn(`${MODULE_NAME} 58FACCD9: Undefined partner, skipped`); | |
37 | 49 | res.end('UNDEFINED_PARTNER'); |
38 | 50 | return; |
39 | 51 | } |
40 | 52 | |
41 | 53 | if (!partner.advice) { |
42 | - logger.warn('PUSH-ADVICE: Partner does not have ADVICE capabilities'); | |
54 | + logger.warn(`${MODULE_NAME} 73E745A0: Partner does not have ADVICE capabilities`); | |
43 | 55 | res.end('UNSUPPORTED'); |
44 | 56 | return; |
45 | 57 | } |
46 | 58 | |
47 | - let task = req.body; | |
59 | + const task = req.body; | |
48 | 60 | |
49 | 61 | if (!task || !task.trx_id || !task.destination || !task.product) { |
50 | - logger.warn('PUSH-ADVICE: Invalid task'); | |
62 | + logger.warn(`${MODULE_NAME} DABD50A5: Invalid task`); | |
51 | 63 | res.end('INVALID_TASK'); |
52 | 64 | return; |
53 | 65 | } |
54 | 66 | |
55 | - logger.verbose('PUSH-ADVICE: Got advice push', {task: task}); | |
67 | + logger.verbose(`${MODULE_NAME} DB27D06B: Got advice push`, { task }); | |
56 | 68 | |
57 | 69 | task.remote_product = pull.getRemoteProduct(task.product); |
58 | 70 | if (Number(config.sdk_trx_id_adder)) { |
package-lock.json
1 | 1 | { |
2 | 2 | "name": "komodo-sdk", |
3 | - "version": "1.45.21", | |
3 | + "version": "1.45.22", | |
4 | 4 | "lockfileVersion": 2, |
5 | 5 | "requires": true, |
6 | 6 | "packages": { |
7 | 7 | "": { |
8 | 8 | "name": "komodo-sdk", |
9 | - "version": "1.45.21", | |
9 | + "version": "1.45.22", | |
10 | 10 | "license": "ISC", |
11 | 11 | "dependencies": { |
12 | 12 | "array-unique": "^0.3.2", |