@kapeta/local-cluster-service 0.34.1 → 0.34.2

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/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [0.34.2](https://github.com/kapetacom/local-cluster-service/compare/v0.34.1...v0.34.2) (2024-01-22)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * Forward query params correctly ([#121](https://github.com/kapetacom/local-cluster-service/issues/121)) ([1bbf6f0](https://github.com/kapetacom/local-cluster-service/commit/1bbf6f0cf0fee218c441f3b556683873e208c951))
7
+
1
8
  ## [0.34.1](https://github.com/kapetacom/local-cluster-service/compare/v0.34.0...v0.34.1) (2024-01-22)
2
9
 
3
10
 
@@ -14,6 +14,7 @@ const path_1 = __importDefault(require("path"));
14
14
  const pathTemplateParser_1 = require("../../utils/pathTemplateParser");
15
15
  const networkManager_1 = require("../../networkManager");
16
16
  const socketManager_1 = require("../../socketManager");
17
+ const qs_1 = require("qs");
17
18
  function getRestMethodId(restResource, httpMethod, httpPath) {
18
19
  return lodash_1.default.findKey(restResource.spec.methods, (method) => {
19
20
  let methodType = method.method ? method.method.toUpperCase() : 'GET';
@@ -77,7 +78,7 @@ function proxyRestRequest(req, res, opts) {
77
78
  providerPath = '/' + providerPath;
78
79
  }
79
80
  if (!lodash_1.default.isEmpty(req.query)) {
80
- providerPath += '?' + new URLSearchParams(req.query).toString();
81
+ providerPath += '?' + (0, qs_1.stringify)(req.query, { arrayFormat: 'repeat' });
81
82
  }
82
83
  const requestHeaders = lodash_1.default.clone(req.headers);
83
84
  delete requestHeaders['content-length'];
@@ -12,6 +12,7 @@ const request_1 = __importDefault(require("request"));
12
12
  const lodash_1 = __importDefault(require("lodash"));
13
13
  const networkManager_1 = require("../../networkManager");
14
14
  const socketManager_1 = require("../../socketManager");
15
+ const qs_1 = require("qs");
15
16
  function proxyHttpRequest(req, res, opts) {
16
17
  const requestHeaders = lodash_1.default.clone(req.headers);
17
18
  delete requestHeaders['content-length'];
@@ -26,7 +27,7 @@ function proxyHttpRequest(req, res, opts) {
26
27
  path = path.replace(sourceBasePath, targetBasePath);
27
28
  }
28
29
  if (!lodash_1.default.isEmpty(req.query)) {
29
- path += '?' + new URLSearchParams(req.query).toString();
30
+ path += '?' + (0, qs_1.stringify)(req.query, { arrayFormat: 'repeat' });
30
31
  }
31
32
  console.log('Proxy request to provider: %s => %s%s [http]', opts.consumerPath, opts.address, path);
32
33
  const reqOpts = {
@@ -14,6 +14,7 @@ const path_1 = __importDefault(require("path"));
14
14
  const pathTemplateParser_1 = require("../../utils/pathTemplateParser");
15
15
  const networkManager_1 = require("../../networkManager");
16
16
  const socketManager_1 = require("../../socketManager");
17
+ const qs_1 = require("qs");
17
18
  function getRestMethodId(restResource, httpMethod, httpPath) {
18
19
  return lodash_1.default.findKey(restResource.spec.methods, (method) => {
19
20
  let methodType = method.method ? method.method.toUpperCase() : 'GET';
@@ -77,7 +78,7 @@ function proxyRestRequest(req, res, opts) {
77
78
  providerPath = '/' + providerPath;
78
79
  }
79
80
  if (!lodash_1.default.isEmpty(req.query)) {
80
- providerPath += '?' + new URLSearchParams(req.query).toString();
81
+ providerPath += '?' + (0, qs_1.stringify)(req.query, { arrayFormat: 'repeat' });
81
82
  }
82
83
  const requestHeaders = lodash_1.default.clone(req.headers);
83
84
  delete requestHeaders['content-length'];
@@ -12,6 +12,7 @@ const request_1 = __importDefault(require("request"));
12
12
  const lodash_1 = __importDefault(require("lodash"));
13
13
  const networkManager_1 = require("../../networkManager");
14
14
  const socketManager_1 = require("../../socketManager");
15
+ const qs_1 = require("qs");
15
16
  function proxyHttpRequest(req, res, opts) {
16
17
  const requestHeaders = lodash_1.default.clone(req.headers);
17
18
  delete requestHeaders['content-length'];
@@ -26,7 +27,7 @@ function proxyHttpRequest(req, res, opts) {
26
27
  path = path.replace(sourceBasePath, targetBasePath);
27
28
  }
28
29
  if (!lodash_1.default.isEmpty(req.query)) {
29
- path += '?' + new URLSearchParams(req.query).toString();
30
+ path += '?' + (0, qs_1.stringify)(req.query, { arrayFormat: 'repeat' });
30
31
  }
31
32
  console.log('Proxy request to provider: %s => %s%s [http]', opts.consumerPath, opts.address, path);
32
33
  const reqOpts = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kapeta/local-cluster-service",
3
- "version": "0.34.1",
3
+ "version": "0.34.2",
4
4
  "description": "Manages configuration, ports and service discovery for locally running Kapeta systems",
5
5
  "type": "commonjs",
6
6
  "exports": {
@@ -48,18 +48,18 @@
48
48
  "homepage": "https://github.com/kapetacom/local-cluster-service#readme",
49
49
  "dependencies": {
50
50
  "@kapeta/codegen": "^1.2.1",
51
- "@kapeta/local-cluster-config": ">= 0.3.0 <2",
51
+ "@kapeta/kaplang-core": "^1.9.3",
52
+ "@kapeta/local-cluster-config": ">= 0.3.2 <2",
52
53
  "@kapeta/nodejs-api-client": ">=0.1.3 <2",
53
54
  "@kapeta/nodejs-process": "<2",
54
55
  "@kapeta/nodejs-registry-utils": ">=0.9.4 <2",
55
56
  "@kapeta/nodejs-utils": "<2",
56
- "@kapeta/sdk-config": "^2.0.0",
57
- "@kapeta/web-microfrontend": "^1",
58
- "@kapeta/kaplang-core": "^1.9",
59
57
  "@kapeta/schemas": "^2.0.0",
58
+ "@kapeta/sdk-config": "^2.0.0",
60
59
  "@kapeta/ui-web-components": "^3.0.1",
61
60
  "@kapeta/ui-web-plan-editor": "^2.0.0",
62
61
  "@kapeta/ui-web-types": "^1.2.0",
62
+ "@kapeta/web-microfrontend": "^1",
63
63
  "@sentry/node": "^7.94.1",
64
64
  "@types/dockerode": "^3.3.19",
65
65
  "@types/stream-json": "^1.7.3",
@@ -75,6 +75,7 @@
75
75
  "md5": "2.2.1",
76
76
  "node-cache": "^5.1.2",
77
77
  "node-uuid": "^1.4.8",
78
+ "qs": "^6.11.2",
78
79
  "request": "2.88.2",
79
80
  "request-promise": "4.2.6",
80
81
  "socket.io": "^4.5.2",
@@ -14,6 +14,7 @@ import { Request, Response } from 'express';
14
14
  import { ProxyRequestInfo, SimpleRequest, StringMap } from '../../types';
15
15
  import { StringBodyRequest } from '../../middleware/stringBody';
16
16
  import { Resource } from '@kapeta/schemas';
17
+ import { stringify } from 'qs';
17
18
 
18
19
  export function getRestMethodId(restResource: Resource, httpMethod: string, httpPath: string) {
19
20
  return _.findKey(restResource.spec.methods, (method) => {
@@ -105,7 +106,7 @@ export function proxyRestRequest(req: StringBodyRequest, res: Response, opts: Pr
105
106
  }
106
107
 
107
108
  if (!_.isEmpty(req.query)) {
108
- providerPath += '?' + new URLSearchParams(req.query as any).toString();
109
+ providerPath += '?' + stringify(req.query, { arrayFormat: 'repeat' });
109
110
  }
110
111
 
111
112
  const requestHeaders = _.clone(req.headers);
@@ -7,9 +7,10 @@ import request from 'request';
7
7
  import _ from 'lodash';
8
8
  import { networkManager } from '../../networkManager';
9
9
  import { socketManager } from '../../socketManager';
10
- import { Request, Response } from 'express';
10
+ import { Response } from 'express';
11
11
  import { ProxyRequestInfo, SimpleRequest, StringMap } from '../../types';
12
12
  import { StringBodyRequest } from '../../middleware/stringBody';
13
+ import { stringify } from 'qs';
13
14
 
14
15
  export function proxyHttpRequest(req: StringBodyRequest, res: Response, opts: ProxyRequestInfo) {
15
16
  const requestHeaders = _.clone(req.headers);
@@ -28,7 +29,7 @@ export function proxyHttpRequest(req: StringBodyRequest, res: Response, opts: Pr
28
29
  }
29
30
 
30
31
  if (!_.isEmpty(req.query)) {
31
- path += '?' + new URLSearchParams(req.query as any).toString();
32
+ path += '?' + stringify(req.query, { arrayFormat: 'repeat' });
32
33
  }
33
34
 
34
35
  console.log('Proxy request to provider: %s => %s%s [http]', opts.consumerPath, opts.address, path);