@mondaydotcomorg/monday-authorization 1.1.7-technical-reason.429 → 1.1.7-technical-reason.431

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.
@@ -22,6 +22,7 @@ export declare class AuthorizationService {
22
22
  private static fetchIsUserGrantedWithFeature;
23
23
  private static getCachedKeyName;
24
24
  static canActionInScope(accountId: number, userId: number, action: string, scope: ScopeOptions): Promise<ScopedActionPermit>;
25
+ static getResponse(accountId: number, userId: number, scopedActions: ScopedAction[]): Promise<String>;
25
26
  static canActionInScopeMultiple(accountId: number, userId: number, scopedActions: ScopedAction[]): Promise<ScopedActionResponseObject[]>;
26
27
  private static isAuthorizedSingular;
27
28
  private static isAuthorizedMultiple;
@@ -115,6 +115,26 @@ class AuthorizationService {
115
115
  return scopedActionResponseObjects[0].permit;
116
116
  });
117
117
  }
118
+ static getResponse(accountId, userId, scopedActions) {
119
+ return __awaiter(this, void 0, void 0, function* () {
120
+ const internalAuthToken = (0, monday_jwt_1.signAuthorizationHeader)({ appName: INTERNAL_APP_NAME, accountId, userId });
121
+ const scopedActionsPayload = scopedActions.map(scopedAction => {
122
+ return Object.assign(Object.assign({}, scopedAction), { scope: (0, lodash_1.mapKeys)(scopedAction.scope, (_, key) => (0, lodash_1.snakeCase)(key)) }); // for example: { workspaceId: 1 } => { workspace_id: 1 }
123
+ });
124
+ const response = yield (0, monday_fetch_1.fetch)(getCanActionsInScopesUrl(), {
125
+ method: 'POST',
126
+ headers: { Authorization: internalAuthToken, 'Content-Type': 'application/json' },
127
+ timeout: getRequestTimeout(),
128
+ body: JSON.stringify({
129
+ user_id: userId,
130
+ scoped_actions: scopedActionsPayload,
131
+ }),
132
+ }, mondayFetchOptions);
133
+ throwOnHttpErrorIfNeeded(response, 'canActionInScopeMultiple');
134
+ const responseBody = yield response.json();
135
+ return JSON.stringify(responseBody);
136
+ });
137
+ }
118
138
  static canActionInScopeMultiple(accountId, userId, scopedActions) {
119
139
  return __awaiter(this, void 0, void 0, function* () {
120
140
  const internalAuthToken = (0, monday_jwt_1.signAuthorizationHeader)({ appName: INTERNAL_APP_NAME, accountId, userId });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mondaydotcomorg/monday-authorization",
3
- "version": "1.1.7-technical-reason.429+aab4b36eb",
3
+ "version": "1.1.7-technical-reason.431+9c5a6ce76",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "license": "BSD-3-Clause",
@@ -32,5 +32,5 @@
32
32
  "files": [
33
33
  "dist/"
34
34
  ],
35
- "gitHead": "aab4b36eb0d7be10c58fcbbb02ed1f2bb3e0bb7c"
35
+ "gitHead": "9c5a6ce7666cd7c01e0c1ffe5561cc36dd844478"
36
36
  }