Compare View

switch
from
...
to
 
Commits (2)

Changes

Showing 4 changed files Side-by-side Diff

... ... @@ -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.44.6](https://gitlab.kodesumber.com/komodo/komodo-sdk/compare/v1.44.5...v1.44.6)
  8 +
  9 +- Change remote product separator to ";" and "," [`2678580`](https://gitlab.kodesumber.com/komodo/komodo-sdk/commit/2678580012966bf821ab52b4c3bb3c63f03cfbed)
  10 +
7 11 #### [v1.44.5](https://gitlab.kodesumber.com/komodo/komodo-sdk/compare/v1.44.4...v1.44.5)
8 12  
  13 +> 11 February 2022
  14 +
9 15 - Change product splitter separator to ";" and "," [`4a9c4be`](https://gitlab.kodesumber.com/komodo/komodo-sdk/commit/4a9c4be08a847820ce81831078d84dce290a4fca)
10 16  
11 17 #### [v1.44.4](https://gitlab.kodesumber.com/komodo/komodo-sdk/compare/v1.44.3...v1.44.4)
api-server/router-remote-products.js
1   -"use strict";
2   -
3 1 const express = require('express');
4 2 // const sortObj = require('sort-object');
5 3 const naturalCompare = require('string-natural-compare');
... ... @@ -10,11 +8,13 @@ const matrix = require('../matrix');
10 8 const router = express.Router();
11 9 module.exports = router;
12 10  
  11 +const splitProductSeparator = / *[;,]+ */;
  12 +
13 13 function pageIndex(req, res) {
14 14 res.json({
15 15 method: '/products',
16 16 error: null,
17   - result: config.remote_products
  17 + result: config.remote_products,
18 18 });
19 19 }
20 20  
... ... @@ -23,12 +23,12 @@ function pageSet(req, res) {
23 23 res.json({
24 24 method: '/remote-products/set',
25 25 error: true,
26   - error_msg: 'Usage: /remote-products/set/<LOCAL_PRODUCT>/<REMOTE_PRODUCT>'
  26 + error_msg: 'Usage: /remote-products/set/<LOCAL_PRODUCT>/<REMOTE_PRODUCT>',
27 27 });
28 28 }
29 29  
30 30 if (!req.params.localProduct && !req.query.local) {
31   - responseWithUsageHelp()
  31 + responseWithUsageHelp();
32 32 return;
33 33 }
34 34  
... ... @@ -37,7 +37,6 @@ function pageSet(req, res) {
37 37 return;
38 38 }
39 39  
40   -
41 40 const localProduct = (req.params.localProduct || req.query.local).trim().toUpperCase();
42 41 const remoteProduct = (req.params.remoteProduct || req.query.remote).trim();
43 42  
... ... @@ -50,7 +49,10 @@ function pageSet(req, res) {
50 49 */
51 50  
52 51 const sortedRemoteProducts = {};
53   - const remoteProductsKeys = Object.keys(config.remote_products).sort(naturalCompare.caseInsensitive);
  52 + const remoteProductsKeys = Object.keys(
  53 + config.remote_products,
  54 + ).sort(naturalCompare.caseInsensitive);
  55 +
54 56 remoteProductsKeys.forEach((item) => {
55 57 sortedRemoteProducts[item] = config.remote_products[item];
56 58 });
... ... @@ -63,8 +65,8 @@ function pageSet(req, res) {
63 65 error: null,
64 66 local_product: localProduct,
65 67 remote_product: remoteProduct,
66   - remote_products: config.remote_products
67   - })
  68 + remote_products: config.remote_products,
  69 + });
68 70 }
69 71  
70 72 function pageDel(req, res) {
... ... @@ -72,7 +74,7 @@ function pageDel(req, res) {
72 74 res.json({
73 75 method: '/remote-products/del',
74 76 error: true,
75   - error_msg: 'Usage: /remote-products/del/<LOCAL_PRODUCT>'
  77 + error_msg: 'Usage: /remote-products/del/<LOCAL_PRODUCT>',
76 78 });
77 79 }
78 80  
... ... @@ -83,11 +85,11 @@ function pageDel(req, res) {
83 85 }
84 86  
85 87 if (typeof localProducts === 'string') {
86   - localProducts = localProducts.split(/[\s,]+/);
  88 + localProducts = localProducts.split(splitProductSeparator);
87 89 }
88 90  
89 91 const localProductsCount = localProducts.length;
90   - for (let i=0; i<localProductsCount; i++) {
  92 + for (let i = 0; i < localProductsCount; i += 1) {
91 93 const localProduct = localProducts[i];
92 94  
93 95 if (localProduct) {
... ... @@ -100,8 +102,8 @@ function pageDel(req, res) {
100 102 method: '/remote-products/del',
101 103 error: null,
102 104 deleted_product: localProducts,
103   - remote_products: config.remote_products
104   - })
  105 + remote_products: config.remote_products,
  106 + });
105 107 }
106 108  
107 109 router.get('/', pageIndex);
1 1 {
2 2 "name": "komodo-sdk",
3   - "version": "1.44.5",
  3 + "version": "1.44.6",
4 4 "lockfileVersion": 2,
5 5 "requires": true,
6 6 "packages": {
7 7 "": {
8 8 "name": "komodo-sdk",
9   - "version": "1.44.5",
  9 + "version": "1.44.6",
10 10 "license": "ISC",
11 11 "dependencies": {
12 12 "array-unique": "^0.3.2",
1 1 {
2 2 "name": "komodo-sdk",
3   - "version": "1.44.5",
  3 + "version": "1.44.6",
4 4 "description": "SDK for Komodo",
5 5 "main": "index.js",
6 6 "scripts": {