@vario-software/vario-app-framework-backend 2026.11.0 → 2026.12.0
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/api/Api.js +52 -2
- package/package.json +3 -3
package/api/Api.js
CHANGED
|
@@ -8,6 +8,7 @@ const redirectRequestFn = require('#backend/api/helpers/redirectRequest.js');
|
|
|
8
8
|
const vqlFn = require('#backend/api/helpers/vql.js');
|
|
9
9
|
const { getApp } = require('#backend/utils/context.js');
|
|
10
10
|
const HttpError = require('#backend/utils/httpError.js');
|
|
11
|
+
const { URLSearchParams } = require('url');
|
|
11
12
|
|
|
12
13
|
class Api
|
|
13
14
|
{
|
|
@@ -20,6 +21,7 @@ class Api
|
|
|
20
21
|
timeout = 15 * 60 * 1000,
|
|
21
22
|
suppressLogs = false,
|
|
22
23
|
secretsToMask = ['value'],
|
|
24
|
+
pathParams = {},
|
|
23
25
|
followRedirects,
|
|
24
26
|
body,
|
|
25
27
|
inputStream,
|
|
@@ -27,6 +29,7 @@ class Api
|
|
|
27
29
|
outputStream,
|
|
28
30
|
headers,
|
|
29
31
|
secret,
|
|
32
|
+
query,
|
|
30
33
|
...restOptions
|
|
31
34
|
} = {})
|
|
32
35
|
{
|
|
@@ -41,6 +44,8 @@ class Api
|
|
|
41
44
|
this.suppressLogs = suppressLogs;
|
|
42
45
|
this.followRedirects = followRedirects;
|
|
43
46
|
this.secretsToMask = secretsToMask;
|
|
47
|
+
this.pathParams = pathParams;
|
|
48
|
+
this.query = query;
|
|
44
49
|
|
|
45
50
|
this.app = getApp();
|
|
46
51
|
|
|
@@ -65,7 +70,19 @@ class Api
|
|
|
65
70
|
|
|
66
71
|
get fullPath()
|
|
67
72
|
{
|
|
68
|
-
return this.baseUrl + this.path;
|
|
73
|
+
return this.baseUrl + expandUrl(this.path, this.pathParams) + this.queryString;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
get queryString()
|
|
77
|
+
{
|
|
78
|
+
const parsedQuery = new URLSearchParams(this.query);
|
|
79
|
+
|
|
80
|
+
if(parsedQuery.size > 0)
|
|
81
|
+
{
|
|
82
|
+
return '?' + parsedQuery.toString();
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return '';
|
|
69
86
|
}
|
|
70
87
|
|
|
71
88
|
get serviceName()
|
|
@@ -85,7 +102,17 @@ class Api
|
|
|
85
102
|
|
|
86
103
|
setPath(path)
|
|
87
104
|
{
|
|
88
|
-
|
|
105
|
+
const splitPath = path?.split('?')
|
|
106
|
+
|
|
107
|
+
if(splitPath[0])
|
|
108
|
+
{
|
|
109
|
+
this.path = splitPath[0];
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
if(splitPath[1])
|
|
113
|
+
{
|
|
114
|
+
this.setQuery(Object.fromEntries(new URLSearchParams(splitPath[1]).entries()));
|
|
115
|
+
}
|
|
89
116
|
|
|
90
117
|
return this;
|
|
91
118
|
}
|
|
@@ -97,6 +124,16 @@ class Api
|
|
|
97
124
|
return this;
|
|
98
125
|
}
|
|
99
126
|
|
|
127
|
+
setQuery(query)
|
|
128
|
+
{
|
|
129
|
+
this.query = {
|
|
130
|
+
...this.query,
|
|
131
|
+
...query,
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
return this;
|
|
135
|
+
}
|
|
136
|
+
|
|
100
137
|
setHeaders(headers)
|
|
101
138
|
{
|
|
102
139
|
const headerBlacklist = [
|
|
@@ -449,3 +486,16 @@ function maskSpecificKey(response, secretsToMask = ['value'], mask = '[secret]')
|
|
|
449
486
|
return acc;
|
|
450
487
|
}, {});
|
|
451
488
|
}
|
|
489
|
+
|
|
490
|
+
function expandUrl(template, params)
|
|
491
|
+
{
|
|
492
|
+
return template.replace(/:([a-zA-Z_]\w*)/g, (match, key) =>
|
|
493
|
+
{
|
|
494
|
+
if (!(key in params))
|
|
495
|
+
{
|
|
496
|
+
throw new Error(`Missing parameter "${key}" for template "${template}"`);
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
return encodeURIComponent(params[key]);
|
|
500
|
+
});
|
|
501
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vario-software/vario-app-framework-backend",
|
|
3
|
-
"version": "2026.
|
|
3
|
+
"version": "2026.12.0",
|
|
4
4
|
"repository": "https://github.com/vario-software/vario-app-framework",
|
|
5
5
|
"author": "VARIO Software AG",
|
|
6
6
|
"homepage": "https://www.vario.ag",
|
|
@@ -11,13 +11,13 @@
|
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"body-parser": "2.2.0",
|
|
14
|
-
"cors": "
|
|
14
|
+
"cors": "2.8.5",
|
|
15
15
|
"express": "4.21.2",
|
|
16
16
|
"follow-redirects": "1.15.11",
|
|
17
17
|
"http-proxy-middleware": "3.0.5",
|
|
18
18
|
"jose": "6.1.0",
|
|
19
19
|
"lodash": "4.17.21",
|
|
20
|
-
"lowdb": "
|
|
20
|
+
"lowdb": "7.0.1"
|
|
21
21
|
},
|
|
22
22
|
"imports": {
|
|
23
23
|
"#backend/*": "./*"
|