@mondaydotcomorg/monday-authorization 1.1.9-authzbashanyeasync-resource-attributes-support.3211 → 1.1.9-authzbashanyeasync-resource-attributes-support.3214
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/dist/lib/authorization-attributes-service.d.ts +1 -3
- package/dist/lib/authorization-attributes-service.js +7 -8
- package/dist/lib/authorization-attributes-service.js.map +1 -1
- package/dist/lib/constants/sns.d.ts +3 -0
- package/dist/lib/constants/sns.js +7 -0
- package/dist/lib/constants/sns.js.map +1 -0
- package/dist/lib/types/authorization-attributes-contracts.d.ts +3 -2
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -2
|
@@ -2,8 +2,6 @@ import { ResourceAttributeAssignment, ResourceAttributeResponse, ResourceAttribu
|
|
|
2
2
|
import { Resource } from './types/general';
|
|
3
3
|
export declare class AuthorizationAttributesService {
|
|
4
4
|
private static LOG_TAG;
|
|
5
|
-
static RESOURCE_ATTRIBUTES_SNS_MESSAGE_KIND: string;
|
|
6
|
-
static ASYNC_MAX_OPERATIONS_PER_MESSAGE: number;
|
|
7
5
|
/**
|
|
8
6
|
* Upsert resource attributes synchronously, performing http call to the authorization MS to assign the given attributes to the given resource.
|
|
9
7
|
* @param accountId
|
|
@@ -30,7 +28,7 @@ export declare class AuthorizationAttributesService {
|
|
|
30
28
|
* @param resourceAttributeOperations - Array of operations to do on resource attributes.
|
|
31
29
|
* @return {Promise<ResourceAttributesOperation[]>} Array of sent operations
|
|
32
30
|
* */
|
|
33
|
-
static
|
|
31
|
+
static updateResourceAttributesAsync(accountId: number, appName: string, callerActionIdentifier: string, resourceAttributeOperations: ResourceAttributesOperation[]): Promise<ResourceAttributesOperation[]>;
|
|
34
32
|
private static sendSingleSnsMessage;
|
|
35
33
|
private static getSnsTopicArn;
|
|
36
34
|
private static getResourceAttributesUrl;
|
|
@@ -13,12 +13,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.AuthorizationAttributesService = void 0;
|
|
16
|
-
const
|
|
16
|
+
const chunk_1 = __importDefault(require("lodash/chunk"));
|
|
17
17
|
const monday_fetch_1 = require("@mondaydotcomorg/monday-fetch");
|
|
18
18
|
const authorization_internal_service_1 = require("./authorization-internal-service");
|
|
19
19
|
const attributions_service_1 = require("./attributions-service");
|
|
20
20
|
const trident_backend_api_1 = require("@mondaydotcomorg/trident-backend-api");
|
|
21
21
|
const monday_sns_1 = require("@mondaydotcomorg/monday-sns");
|
|
22
|
+
const sns_1 = require("./constants/sns");
|
|
22
23
|
class AuthorizationAttributesService {
|
|
23
24
|
/**
|
|
24
25
|
* Upsert resource attributes synchronously, performing http call to the authorization MS to assign the given attributes to the given resource.
|
|
@@ -75,11 +76,11 @@ class AuthorizationAttributesService {
|
|
|
75
76
|
* @param resourceAttributeOperations - Array of operations to do on resource attributes.
|
|
76
77
|
* @return {Promise<ResourceAttributesOperation[]>} Array of sent operations
|
|
77
78
|
* */
|
|
78
|
-
static
|
|
79
|
+
static updateResourceAttributesAsync(accountId, appName, callerActionIdentifier, resourceAttributeOperations) {
|
|
79
80
|
return __awaiter(this, void 0, void 0, function* () {
|
|
80
81
|
const topicArn = this.getSnsTopicArn();
|
|
81
82
|
const sendToSnsPromises = [];
|
|
82
|
-
const operationChucks =
|
|
83
|
+
const operationChucks = (0, chunk_1.default)(resourceAttributeOperations, sns_1.ASYNC_MAX_OPERATIONS_PER_MESSAGE);
|
|
83
84
|
for (const operationsChunk of operationChucks) {
|
|
84
85
|
sendToSnsPromises.push(this.sendSingleSnsMessage(topicArn, accountId, appName, callerActionIdentifier, operationsChunk));
|
|
85
86
|
}
|
|
@@ -89,7 +90,7 @@ class AuthorizationAttributesService {
|
|
|
89
90
|
static sendSingleSnsMessage(topicArn, accountId, appName, callerActionIdentifier, operations) {
|
|
90
91
|
return __awaiter(this, void 0, void 0, function* () {
|
|
91
92
|
const payload = {
|
|
92
|
-
kind:
|
|
93
|
+
kind: sns_1.RESOURCE_ATTRIBUTES_SNS_MESSAGE_KIND,
|
|
93
94
|
payload: {
|
|
94
95
|
accountId: accountId,
|
|
95
96
|
callerAppName: appName,
|
|
@@ -109,8 +110,8 @@ class AuthorizationAttributesService {
|
|
|
109
110
|
}
|
|
110
111
|
static getSnsTopicArn() {
|
|
111
112
|
var _a;
|
|
112
|
-
return ((_a = trident_backend_api_1.Api.getPart('configurationVariables')) === null || _a === void 0 ? void 0 : _a.get(
|
|
113
|
-
process.env.
|
|
113
|
+
return ((_a = trident_backend_api_1.Api.getPart('configurationVariables')) === null || _a === void 0 ? void 0 : _a.get(sns_1.RESOURCE_ATTRIBUTES_SECRET_NAME).arn) ||
|
|
114
|
+
JSON.parse(process.env[sns_1.RESOURCE_ATTRIBUTES_SECRET_NAME]).arn;
|
|
114
115
|
}
|
|
115
116
|
static getResourceAttributesUrl(accountId) {
|
|
116
117
|
return `${process.env.AUTHORIZATION_URL}/attributes/${accountId}/resource`;
|
|
@@ -138,6 +139,4 @@ class AuthorizationAttributesService {
|
|
|
138
139
|
}
|
|
139
140
|
exports.AuthorizationAttributesService = AuthorizationAttributesService;
|
|
140
141
|
AuthorizationAttributesService.LOG_TAG = "authorization_attributes";
|
|
141
|
-
AuthorizationAttributesService.RESOURCE_ATTRIBUTES_SNS_MESSAGE_KIND = 'resourceAttributeModification';
|
|
142
|
-
AuthorizationAttributesService.ASYNC_MAX_OPERATIONS_PER_MESSAGE = 100;
|
|
143
142
|
//# sourceMappingURL=authorization-attributes-service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authorization-attributes-service.js","sourceRoot":"","sources":["../../lib/authorization-attributes-service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"authorization-attributes-service.js","sourceRoot":"","sources":["../../lib/authorization-attributes-service.ts"],"names":[],"mappings":";;;;;;;;;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AI,UAAU,CAAC,IAAI,UAAU,CAAC,QAAQ,KAAK,iBAAiB,CAAC,CAAC;YACpG,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO,KAAK,CAAC;YACf,CAAC;QACH,CAAC;KAAA;;AA5IH,wEA6IC;AA5IgB,sCAAO,GAAG,0BAA0B,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ASYNC_MAX_OPERATIONS_PER_MESSAGE = exports.RESOURCE_ATTRIBUTES_SNS_MESSAGE_KIND = exports.RESOURCE_ATTRIBUTES_SECRET_NAME = void 0;
|
|
4
|
+
exports.RESOURCE_ATTRIBUTES_SECRET_NAME = 'AUTHORIZATION_RESOURCE_ATTRIBUTES_SNS_TOPIC';
|
|
5
|
+
exports.RESOURCE_ATTRIBUTES_SNS_MESSAGE_KIND = 'resourceAttributeModification';
|
|
6
|
+
exports.ASYNC_MAX_OPERATIONS_PER_MESSAGE = 100;
|
|
7
|
+
//# sourceMappingURL=sns.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sns.js","sourceRoot":"","sources":["../../../lib/constants/sns.ts"],"names":[],"mappings":";;;AAAa,QAAA,+BAA+B,GAAG,6CAA6C,CAAA;AAC/E,QAAA,oCAAoC,GAAG,+BAA+B,CAAC;AACvE,QAAA,gCAAgC,GAAG,GAAG,CAAC"}
|
|
@@ -17,10 +17,11 @@ export declare enum ResourceAttributeOperationEnum {
|
|
|
17
17
|
UPSERT = "upsert",
|
|
18
18
|
DELETE = "delete"
|
|
19
19
|
}
|
|
20
|
-
|
|
20
|
+
interface UpsertResourceAttributeOperation extends ResourceAttributeAssignment {
|
|
21
21
|
operationType: ResourceAttributeOperationEnum.UPSERT;
|
|
22
22
|
}
|
|
23
|
-
|
|
23
|
+
interface DeleteResourceAttributeOperation extends ResourceAttributeDelete {
|
|
24
24
|
operationType: ResourceAttributeOperationEnum.DELETE;
|
|
25
25
|
}
|
|
26
26
|
export type ResourceAttributesOperation = UpsertResourceAttributeOperation | DeleteResourceAttributeOperation;
|
|
27
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"root":["../index.ts","../lib/attributions-service.ts","../lib/authorization-attributes-service.ts","../lib/authorization-internal-service.ts","../lib/authorization-middleware.ts","../lib/authorization-service.ts","../lib/prometheus-service.ts","../lib/testKit/index.ts","../lib/types/authorization-attributes-contracts.ts","../lib/types/express.ts","../lib/types/general.ts","../lib/types/scoped-actions-contracts.ts"],"version":"5.6.3"}
|
|
1
|
+
{"root":["../index.ts","../lib/attributions-service.ts","../lib/authorization-attributes-service.ts","../lib/authorization-internal-service.ts","../lib/authorization-middleware.ts","../lib/authorization-service.ts","../lib/prometheus-service.ts","../lib/constants/sns.ts","../lib/testKit/index.ts","../lib/types/authorization-attributes-contracts.ts","../lib/types/express.ts","../lib/types/general.ts","../lib/types/scoped-actions-contracts.ts"],"version":"5.6.3"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mondaydotcomorg/monday-authorization",
|
|
3
|
-
"version": "1.1.9-authzbashanyeasync-resource-attributes-support.
|
|
3
|
+
"version": "1.1.9-authzbashanyeasync-resource-attributes-support.3214+3ff72e577",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"license": "BSD-3-Clause",
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
"@mondaydotcomorg/monday-logger": "^4.0.11",
|
|
32
32
|
"@mondaydotcomorg/monday-sns": "^1.0.6",
|
|
33
33
|
"@mondaydotcomorg/trident-backend-api": "^0.23.10",
|
|
34
|
+
"@types/lodash": "^4.17.10",
|
|
34
35
|
"lodash": "^4.17.21",
|
|
35
36
|
"node-fetch": "^2.6.7",
|
|
36
37
|
"on-headers": "^1.0.2",
|
|
@@ -55,5 +56,5 @@
|
|
|
55
56
|
"files": [
|
|
56
57
|
"dist/"
|
|
57
58
|
],
|
|
58
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "3ff72e577a6a6a2176266650210071ea086bb2ec"
|
|
59
60
|
}
|