@mondaydotcomorg/monday-authorization 1.2.12 → 1.2.14
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,12 +1,20 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
|
|
3
3
|
const perf_hooks = require('perf_hooks');
|
|
4
|
-
const
|
|
4
|
+
const snakeCase = require('lodash/snakeCase.js');
|
|
5
|
+
const camelCase = require('lodash/camelCase.js');
|
|
6
|
+
const mapKeys = require('lodash/mapKeys.js');
|
|
5
7
|
const mondayFetch = require('@mondaydotcomorg/monday-fetch');
|
|
6
8
|
const prometheusService = require('./prometheus-service.js');
|
|
7
9
|
const authorizationInternalService = require('./authorization-internal-service.js');
|
|
8
10
|
const attributionsService = require('./attributions-service.js');
|
|
9
11
|
|
|
12
|
+
const _interopDefault = e => e && e.__esModule ? e : { default: e };
|
|
13
|
+
|
|
14
|
+
const snakeCase__default = /*#__PURE__*/_interopDefault(snakeCase);
|
|
15
|
+
const camelCase__default = /*#__PURE__*/_interopDefault(camelCase);
|
|
16
|
+
const mapKeys__default = /*#__PURE__*/_interopDefault(mapKeys);
|
|
17
|
+
|
|
10
18
|
const GRANTED_FEATURE_CACHE_EXPIRATION_SECONDS = 5 * 60;
|
|
11
19
|
function setRequestFetchOptions(customMondayFetchOptions) {
|
|
12
20
|
authorizationInternalService.AuthorizationInternalService.setRequestFetchOptions(customMondayFetchOptions);
|
|
@@ -60,7 +68,7 @@ class AuthorizationService {
|
|
|
60
68
|
static async canActionInScopeMultiple(accountId, userId, scopedActions) {
|
|
61
69
|
const internalAuthToken = authorizationInternalService.AuthorizationInternalService.generateInternalAuthToken(accountId, userId);
|
|
62
70
|
const scopedActionsPayload = scopedActions.map(scopedAction => {
|
|
63
|
-
return { ...scopedAction, scope:
|
|
71
|
+
return { ...scopedAction, scope: mapKeys__default.default(scopedAction.scope, (_, key) => snakeCase__default.default(key)) }; // for example: { workspaceId: 1 } => { workspace_id: 1 }
|
|
64
72
|
});
|
|
65
73
|
const attributionHeaders = attributionsService.getAttributionsFromApi();
|
|
66
74
|
const response = await mondayFetch.fetch(getCanActionsInScopesUrl(), {
|
|
@@ -78,7 +86,7 @@ class AuthorizationService {
|
|
|
78
86
|
}, authorizationInternalService.AuthorizationInternalService.getRequestFetchOptions());
|
|
79
87
|
authorizationInternalService.AuthorizationInternalService.throwOnHttpErrorIfNeeded(response, 'canActionInScopeMultiple');
|
|
80
88
|
const responseBody = await response.json();
|
|
81
|
-
const camelCaseKeys = obj => Object.fromEntries(Object.entries(obj).map(([key, value]) => [
|
|
89
|
+
const camelCaseKeys = obj => Object.fromEntries(Object.entries(obj).map(([key, value]) => [camelCase__default.default(key), value]));
|
|
82
90
|
const scopedActionsResponseObjects = responseBody.result.map(responseObject => {
|
|
83
91
|
const { scopedAction, permit } = responseObject;
|
|
84
92
|
const { scope } = scopedAction;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { performance } from 'perf_hooks';
|
|
2
|
-
import
|
|
2
|
+
import snakeCase from 'lodash/snakeCase.js';
|
|
3
|
+
import camelCase from 'lodash/camelCase.js';
|
|
4
|
+
import mapKeys from 'lodash/mapKeys.js';
|
|
3
5
|
import { fetch } from '@mondaydotcomorg/monday-fetch';
|
|
4
6
|
import { sendAuthorizationChecksPerRequestMetric, sendAuthorizationCheckResponseTimeMetric } from './prometheus-service.mjs';
|
|
5
7
|
import { AuthorizationInternalService, logger } from './authorization-internal-service.mjs';
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -8,6 +8,8 @@ export interface InitOptions {
|
|
|
8
8
|
}
|
|
9
9
|
export declare function init(options?: InitOptions): void;
|
|
10
10
|
export { authorizationCheckMiddleware, getAuthorizationMiddleware, skipAuthorizationMiddleware, } from './authorization-middleware';
|
|
11
|
-
export { AuthorizationService } from './authorization-service';
|
|
11
|
+
export { AuthorizationService, AuthorizeResponse } from './authorization-service';
|
|
12
12
|
export { AuthorizationAttributesService } from './authorization-attributes-service';
|
|
13
|
+
export { AuthorizationObject, Resource, BaseRequest, ResourceGetter, ContextGetter } from './types/general';
|
|
14
|
+
export { Translation, ScopedAction, ScopedActionResponseObject, ScopedActionPermit, } from './types/scoped-actions-contracts';
|
|
13
15
|
export { TestKit };
|
package/dist/index.d.ts
CHANGED
|
@@ -8,6 +8,8 @@ export interface InitOptions {
|
|
|
8
8
|
}
|
|
9
9
|
export declare function init(options?: InitOptions): void;
|
|
10
10
|
export { authorizationCheckMiddleware, getAuthorizationMiddleware, skipAuthorizationMiddleware, } from './authorization-middleware';
|
|
11
|
-
export { AuthorizationService } from './authorization-service';
|
|
11
|
+
export { AuthorizationService, AuthorizeResponse } from './authorization-service';
|
|
12
12
|
export { AuthorizationAttributesService } from './authorization-attributes-service';
|
|
13
|
+
export { AuthorizationObject, Resource, BaseRequest, ResourceGetter, ContextGetter } from './types/general';
|
|
14
|
+
export { Translation, ScopedAction, ScopedActionResponseObject, ScopedActionPermit, } from './types/scoped-actions-contracts';
|
|
13
15
|
export { TestKit };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mondaydotcomorg/monday-authorization",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.14",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"license": "BSD-3-Clause",
|
|
@@ -53,5 +53,5 @@
|
|
|
53
53
|
"esmMjsRename": true
|
|
54
54
|
}
|
|
55
55
|
},
|
|
56
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "ea9003745800084822937da597ad9782f212186f"
|
|
57
57
|
}
|