@mondaydotcomorg/monday-authorization 1.1.9-featurebelkaauthz-sdk-update.2217 → 1.1.9-featurebelkaauthz-sdk-update.2218

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.
@@ -1,2 +1 @@
1
- export declare function getCurrentAppName(): string;
2
1
  export declare function getAttributionsFromApi(): {};
@@ -1,20 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getAttributionsFromApi = exports.getCurrentAppName = void 0;
4
- const authorization_internal_service_1 = require("lib/authorization-internal-service");
3
+ exports.getAttributionsFromApi = void 0;
5
4
  const trident_backend_api_1 = require("@mondaydotcomorg/trident-backend-api");
6
- const APP_NAME_VARIABLE_KEY = 'APP_NAME';
7
5
  const FROM_SDK_HEADER_SUFFIX = `-from-sdk`;
8
- function getCurrentAppName() {
9
- try {
10
- return getVariable(APP_NAME_VARIABLE_KEY);
11
- }
12
- catch (error) {
13
- authorization_internal_service_1.logger.warn('Failed to get app name environment variable for runtime attributions', { error: error });
14
- return 'MISSING';
15
- }
16
- }
17
- exports.getCurrentAppName = getCurrentAppName;
18
6
  function getAttributionsFromApi() {
19
7
  const tridentContext = trident_backend_api_1.Api.getPart('context');
20
8
  // @ts-expect-error not an error
@@ -27,25 +15,3 @@ function getAttributionsFromApi() {
27
15
  return attributionHeadersFromSdk;
28
16
  }
29
17
  exports.getAttributionsFromApi = getAttributionsFromApi;
30
- function getVariable(key, options = { silent: false }) {
31
- const result = tryJsonParse(getEnvVariable(key));
32
- if (result === undefined && !options.silent) {
33
- authorization_internal_service_1.logger.warn(`Configuration variable ${key} is undefined`);
34
- }
35
- return result;
36
- }
37
- function getEnvVariable(key) {
38
- const envVar = process.env[key] || process.env[key.toUpperCase()] || process.env[key.toLowerCase()];
39
- return envVar;
40
- }
41
- function tryJsonParse(value) {
42
- if (!value) {
43
- return value;
44
- }
45
- try {
46
- return JSON.parse(value);
47
- }
48
- catch (_err) {
49
- return value;
50
- }
51
- }
@@ -28,7 +28,7 @@ class AuthorizationAttributesService {
28
28
  const attributionHeaders = (0, attributions_service_1.getAttributionsFromApi)();
29
29
  const response = yield (0, monday_fetch_1.fetch)(this.getResourceAttributesUrl(accountId), {
30
30
  method: 'POST',
31
- headers: Object.assign({ Authorization: internalAuthToken, 'Content-Type': 'application/json', 'X-INTERNAL-CONTROLLER-CALLER-APP-NAME': (0, attributions_service_1.getCurrentAppName)() }, attributionHeaders),
31
+ headers: Object.assign({ Authorization: internalAuthToken, 'Content-Type': 'application/json' }, attributionHeaders),
32
32
  timeout: authorization_internal_service_1.AuthorizationInternalService.getRequestTimeout(),
33
33
  body: JSON.stringify({ resourceAttributeAssignments }),
34
34
  }, authorization_internal_service_1.AuthorizationInternalService.getRequestFetchOptions());
@@ -52,7 +52,7 @@ class AuthorizationAttributesService {
52
52
  const attributionHeaders = (0, attributions_service_1.getAttributionsFromApi)();
53
53
  const response = yield (0, monday_fetch_1.fetch)(url, {
54
54
  method: 'DELETE',
55
- headers: Object.assign({ Authorization: internalAuthToken, 'Content-Type': 'application/json', 'X-INTERNAL-CONTROLLER-CALLER-APP-NAME': (0, attributions_service_1.getCurrentAppName)() }, attributionHeaders),
55
+ headers: Object.assign({ Authorization: internalAuthToken, 'Content-Type': 'application/json' }, attributionHeaders),
56
56
  timeout: authorization_internal_service_1.AuthorizationInternalService.getRequestTimeout(),
57
57
  body: JSON.stringify({ keys: attributeKeys }),
58
58
  }, authorization_internal_service_1.AuthorizationInternalService.getRequestFetchOptions());
@@ -94,7 +94,7 @@ class AuthorizationService {
94
94
  const attributionHeaders = (0, attributions_service_1.getAttributionsFromApi)();
95
95
  const response = yield (0, monday_fetch_1.fetch)(getCanActionsInScopesUrl(), {
96
96
  method: 'POST',
97
- headers: Object.assign({ Authorization: internalAuthToken, 'Content-Type': 'application/json', 'X-INTERNAL-CONTROLLER-CALLER-APP-NAME': (0, attributions_service_1.getCurrentAppName)() }, attributionHeaders),
97
+ headers: Object.assign({ Authorization: internalAuthToken, 'Content-Type': 'application/json' }, attributionHeaders),
98
98
  timeout: authorization_internal_service_1.AuthorizationInternalService.getRequestTimeout(),
99
99
  body: JSON.stringify({
100
100
  user_id: userId,
@@ -126,7 +126,7 @@ class AuthorizationService {
126
126
  const attributionHeaders = (0, attributions_service_1.getAttributionsFromApi)();
127
127
  const response = yield (0, monday_fetch_1.fetch)(getAuthorizeUrl(), {
128
128
  method: 'POST',
129
- headers: Object.assign({ Authorization: internalAuthToken, 'Content-Type': 'application/json', 'X-INTERNAL-CONTROLLER-CALLER-APP-NAME': (0, attributions_service_1.getCurrentAppName)() }, attributionHeaders),
129
+ headers: Object.assign({ Authorization: internalAuthToken, 'Content-Type': 'application/json' }, attributionHeaders),
130
130
  timeout: authorization_internal_service_1.AuthorizationInternalService.getRequestTimeout(),
131
131
  body: JSON.stringify({
132
132
  user_id: userId,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mondaydotcomorg/monday-authorization",
3
- "version": "1.1.9-featurebelkaauthz-sdk-update.2217+471e6bc2f",
3
+ "version": "1.1.9-featurebelkaauthz-sdk-update.2218+6089f7fd7",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "license": "BSD-3-Clause",
@@ -33,5 +33,5 @@
33
33
  "files": [
34
34
  "dist/"
35
35
  ],
36
- "gitHead": "471e6bc2fcabc30a05277b5d95702a35303360a0"
36
+ "gitHead": "6089f7fd700a4b48deb8d603fe433324bda9bf95"
37
37
  }