@vario-software/vario-app-framework-backend 2025.46.1 → 2025.46.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/api/ErpApi.js CHANGED
@@ -1,5 +1,5 @@
1
1
  const Api = require('#backend/api/Api.js');
2
- const { getTenant, getAppToken } = require('#backend/utils/context.js');
2
+ const { getTenant, getAppToken, getContext } = require('#backend/utils/context.js');
3
3
 
4
4
  const PromiseSingletonMap = require('#backend/utils/promiseSingletonMap.js');
5
5
  const refreshAccessToken = require('#backend/utils/keycloak.js');
@@ -13,13 +13,32 @@ const { validateOfflineToken } = require('#backend/utils/token.js');
13
13
  const singletonPromise = new PromiseSingletonMap();
14
14
  class ErpApi extends Api
15
15
  {
16
+ constructor(path, options = {})
17
+ {
18
+ const {
19
+ runAsAppUser = false,
20
+ } = getContext();
21
+
22
+ const {
23
+ excecuteAsAppUser = runAsAppUser,
24
+ ...restOptions
25
+ } = options;
26
+
27
+ super(path, restOptions);
28
+
29
+ this.excecuteAsAppUser = excecuteAsAppUser;
30
+ }
31
+
16
32
  async onBeforeRequest()
17
33
  {
18
34
  const { baseUrl, Authorization } = await this.getAuthorization();
19
35
 
20
- this.setHeaders({
21
- 'X-Forwarded-App-Token': getAppToken(),
22
- });
36
+ if (!this.excecuteAsAppUser)
37
+ {
38
+ this.setHeaders({
39
+ 'X-Forwarded-App-Token': getAppToken(),
40
+ });
41
+ }
23
42
 
24
43
  this.setAuthorization(Authorization);
25
44
 
@@ -1,7 +1,7 @@
1
1
  const { getRequest } = require('#backend/utils/context.js');
2
2
  const { getApp } = require('#backend/utils/context.js');
3
3
 
4
- const TextEnum = class
4
+ const Webhook = class
5
5
  {
6
6
  constructor(ApiAdapter)
7
7
  {
@@ -41,4 +41,4 @@ const TextEnum = class
41
41
  };
42
42
  };
43
43
 
44
- module.exports = TextEnum;
44
+ module.exports = Webhook;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vario-software/vario-app-framework-backend",
3
- "version": "2025.46.1",
3
+ "version": "2025.46.2",
4
4
  "repository": "https://github.com/vario-software/vario-app-framework",
5
5
  "author": "VARIO Software AG",
6
6
  "homepage": "https://www.vario.ag",
@@ -0,0 +1,21 @@
1
+ const { getContext, getApp } = require('#backend/utils/context.js');
2
+
3
+ async function runAsAppUser(value = true)
4
+ {
5
+ const context = getContext();
6
+
7
+ if (context.runAsAppUser !== value)
8
+ {
9
+ context.runAsAppUser = value;
10
+
11
+ const app = getApp();
12
+
13
+ await app.log(
14
+ `set "runAsAppUser" to "${value}"`,
15
+ 'setup/runAsAppUser',
16
+ 'INFO',
17
+ );
18
+ }
19
+ }
20
+
21
+ module.exports = runAsAppUser;