@mondaydotcomorg/monday-authorization 3.5.1-fix-authorize-profile-picker-7481de0 → 3.5.3-feat-shaime-support-entity-attributes-in-authorization-sdk-e355942
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/authorization-attributes-ms-service.d.ts +95 -0
- package/dist/authorization-attributes-ms-service.d.ts.map +1 -0
- package/dist/authorization-attributes-ms-service.js +362 -0
- package/dist/authorization-attributes-service.d.ts +26 -47
- package/dist/authorization-attributes-service.d.ts.map +1 -1
- package/dist/authorization-attributes-service.js +33 -171
- package/dist/authorization-attributes-sns-service.d.ts +91 -0
- package/dist/authorization-attributes-sns-service.d.ts.map +1 -0
- package/dist/authorization-attributes-sns-service.js +217 -0
- package/dist/authorization-middleware.d.ts +2 -2
- package/dist/authorization-middleware.d.ts.map +1 -1
- package/dist/authorization-service.d.ts +3 -3
- package/dist/authorization-service.d.ts.map +1 -1
- package/dist/authorization-service.js +7 -34
- package/dist/base-attribute-assignment.d.ts +18 -0
- package/dist/base-attribute-assignment.d.ts.map +1 -0
- package/dist/base-attribute-assignment.js +43 -0
- package/dist/constants/sns.d.ts +12 -2
- package/dist/constants/sns.d.ts.map +1 -1
- package/dist/constants/sns.js +22 -2
- package/dist/entity-attribute-assignment.d.ts +14 -0
- package/dist/entity-attribute-assignment.d.ts.map +1 -0
- package/dist/entity-attribute-assignment.js +24 -0
- package/dist/entity-attributes-constants.d.ts +7 -0
- package/dist/entity-attributes-constants.d.ts.map +1 -0
- package/dist/entity-attributes-constants.js +9 -0
- package/dist/errors/argument-error.d.ts +4 -0
- package/dist/errors/argument-error.d.ts.map +1 -0
- package/dist/errors/argument-error.js +11 -0
- package/dist/esm/authorization-attributes-ms-service.d.ts +95 -0
- package/dist/esm/authorization-attributes-ms-service.d.ts.map +1 -0
- package/dist/esm/authorization-attributes-ms-service.mjs +360 -0
- package/dist/esm/authorization-attributes-service.d.ts +26 -47
- package/dist/esm/authorization-attributes-service.d.ts.map +1 -1
- package/dist/esm/authorization-attributes-service.mjs +33 -167
- package/dist/esm/authorization-attributes-sns-service.d.ts +91 -0
- package/dist/esm/authorization-attributes-sns-service.d.ts.map +1 -0
- package/dist/esm/authorization-attributes-sns-service.mjs +211 -0
- package/dist/esm/authorization-middleware.d.ts +2 -2
- package/dist/esm/authorization-middleware.d.ts.map +1 -1
- package/dist/esm/authorization-service.d.ts +3 -3
- package/dist/esm/authorization-service.d.ts.map +1 -1
- package/dist/esm/authorization-service.mjs +7 -34
- package/dist/esm/base-attribute-assignment.d.ts +18 -0
- package/dist/esm/base-attribute-assignment.d.ts.map +1 -0
- package/dist/esm/base-attribute-assignment.mjs +41 -0
- package/dist/esm/constants/sns.d.ts +12 -2
- package/dist/esm/constants/sns.d.ts.map +1 -1
- package/dist/esm/constants/sns.mjs +17 -3
- package/dist/esm/entity-attribute-assignment.d.ts +14 -0
- package/dist/esm/entity-attribute-assignment.d.ts.map +1 -0
- package/dist/esm/entity-attribute-assignment.mjs +22 -0
- package/dist/esm/entity-attributes-constants.d.ts +7 -0
- package/dist/esm/entity-attributes-constants.d.ts.map +1 -0
- package/dist/esm/entity-attributes-constants.mjs +7 -0
- package/dist/esm/errors/argument-error.d.ts +4 -0
- package/dist/esm/errors/argument-error.d.ts.map +1 -0
- package/dist/esm/errors/argument-error.mjs +9 -0
- package/dist/esm/index.d.ts +9 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.mjs +7 -0
- package/dist/esm/prometheus-service.d.ts +1 -2
- package/dist/esm/prometheus-service.d.ts.map +1 -1
- package/dist/esm/resource-attribute-assignment.d.ts +24 -0
- package/dist/esm/resource-attribute-assignment.d.ts.map +1 -0
- package/dist/esm/resource-attribute-assignment.mjs +34 -0
- package/dist/esm/resource-attributes-constants.d.ts +15 -0
- package/dist/esm/resource-attributes-constants.d.ts.map +1 -0
- package/dist/esm/resource-attributes-constants.mjs +25 -0
- package/dist/esm/testKit/index.d.ts +4 -4
- package/dist/esm/testKit/index.d.ts.map +1 -1
- package/dist/esm/types/authorization-attributes-contracts.d.ts +27 -12
- package/dist/esm/types/authorization-attributes-contracts.d.ts.map +1 -1
- package/dist/esm/types/authorization-attributes-contracts.mjs +6 -6
- package/dist/esm/types/authorization-attributes-service.interface.d.ts +57 -0
- package/dist/esm/types/authorization-attributes-service.interface.d.ts.map +1 -0
- package/dist/esm/types/authorization-attributes-service.interface.mjs +1 -0
- package/dist/esm/types/general.d.ts +1 -2
- package/dist/esm/types/general.d.ts.map +1 -1
- package/dist/esm/utils/validation.d.ts +45 -0
- package/dist/esm/utils/validation.d.ts.map +1 -0
- package/dist/esm/utils/validation.mjs +117 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +15 -0
- package/dist/prometheus-service.d.ts +1 -2
- package/dist/prometheus-service.d.ts.map +1 -1
- package/dist/resource-attribute-assignment.d.ts +24 -0
- package/dist/resource-attribute-assignment.d.ts.map +1 -0
- package/dist/resource-attribute-assignment.js +36 -0
- package/dist/resource-attributes-constants.d.ts +15 -0
- package/dist/resource-attributes-constants.d.ts.map +1 -0
- package/dist/resource-attributes-constants.js +28 -0
- package/dist/testKit/index.d.ts +4 -4
- package/dist/testKit/index.d.ts.map +1 -1
- package/dist/types/authorization-attributes-contracts.d.ts +27 -12
- package/dist/types/authorization-attributes-contracts.d.ts.map +1 -1
- package/dist/types/authorization-attributes-contracts.js +5 -5
- package/dist/types/authorization-attributes-service.interface.d.ts +57 -0
- package/dist/types/authorization-attributes-service.interface.d.ts.map +1 -0
- package/dist/types/authorization-attributes-service.interface.js +1 -0
- package/dist/types/general.d.ts +1 -2
- package/dist/types/general.d.ts.map +1 -1
- package/dist/utils/validation.d.ts +45 -0
- package/dist/utils/validation.d.ts.map +1 -0
- package/dist/utils/validation.js +119 -0
- package/package.json +3 -2
- package/src/authorization-attributes-ms-service.ts +528 -0
- package/src/authorization-attributes-service.ts +35 -222
- package/src/authorization-attributes-sns-service.ts +312 -0
- package/src/authorization-middleware.ts +2 -2
- package/src/authorization-service.ts +15 -75
- package/src/base-attribute-assignment.ts +55 -0
- package/src/constants/sns.ts +19 -2
- package/src/entity-attribute-assignment.ts +21 -0
- package/src/entity-attributes-constants.ts +7 -0
- package/src/errors/argument-error.ts +7 -0
- package/src/index.ts +9 -0
- package/src/prometheus-service.ts +1 -2
- package/src/resource-attribute-assignment.ts +43 -0
- package/src/resource-attributes-constants.ts +35 -0
- package/src/testKit/index.ts +5 -5
- package/src/types/authorization-attributes-contracts.ts +36 -11
- package/src/types/authorization-attributes-service.interface.ts +100 -0
- package/src/types/general.ts +3 -2
- package/src/utils/validation.ts +114 -0
|
@@ -96,33 +96,15 @@ class AuthorizationService {
|
|
|
96
96
|
authorizationInternalService.logger.error({ tag: 'authorization-service' }, 'AuthorizationService: igniteClient is not set, failing request');
|
|
97
97
|
throw new Error('AuthorizationService: igniteClient is not set, failing request');
|
|
98
98
|
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
authorizationInternalService.logger.error({ tag: 'auth-debug', accountId, userId, appName, allowedProfiles, isAllowedProfile }, 'AuthorizationService.getProfile: checking allowed profiles');
|
|
102
|
-
if (isAllowedProfile) {
|
|
103
|
-
const profile = attributionsService.getProfile();
|
|
104
|
-
authorizationInternalService.logger.error({ tag: 'auth-debug', accountId, userId, appName, profile }, 'AuthorizationService.getProfile: selected profile via allowed profiles');
|
|
105
|
-
return profile;
|
|
99
|
+
if (this.igniteClient.configuration.getObjectValue(ALLOWED_SDK_PLATFORM_PROFILES_KEY, []).includes(appName)) {
|
|
100
|
+
return attributionsService.getProfile();
|
|
106
101
|
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
accountId,
|
|
113
|
-
userId,
|
|
114
|
-
appName,
|
|
115
|
-
inReleaseProfiles,
|
|
116
|
-
isInReleaseProfile,
|
|
117
|
-
isFeatureFlagReleased,
|
|
118
|
-
featureFlag: PLATFORM_PROFILE_RELEASE_FF,
|
|
119
|
-
}, 'AuthorizationService.getProfile: checking feature flag release');
|
|
120
|
-
if (isInReleaseProfile && isFeatureFlagReleased) {
|
|
121
|
-
const profile = attributionsService.getProfile();
|
|
122
|
-
authorizationInternalService.logger.error({ tag: 'auth-debug', accountId, userId, appName, profile }, 'AuthorizationService.getProfile: selected profile via feature flag release');
|
|
123
|
-
return profile;
|
|
102
|
+
if (this.igniteClient.configuration
|
|
103
|
+
.getObjectValue(IN_RELEASE_SDK_PLATFORM_PROFILES_KEY, [])
|
|
104
|
+
.includes(appName) &&
|
|
105
|
+
this.igniteClient.isReleased(PLATFORM_PROFILE_RELEASE_FF, { accountId, userId })) {
|
|
106
|
+
return attributionsService.getProfile();
|
|
124
107
|
}
|
|
125
|
-
authorizationInternalService.logger.error({ tag: 'auth-debug', accountId, userId, appName, profile: attributionsService.PlatformProfile.APP }, 'AuthorizationService.getProfile: selected default APP profile');
|
|
126
108
|
return attributionsService.PlatformProfile.APP;
|
|
127
109
|
}
|
|
128
110
|
static async canActionInScopeMultiple(accountId, userId, scopedActions) {
|
|
@@ -130,24 +112,15 @@ class AuthorizationService {
|
|
|
130
112
|
return [];
|
|
131
113
|
}
|
|
132
114
|
const shouldNavigateToGraph = Boolean(this.igniteClient?.isReleased(NAVIGATE_CAN_ACTION_IN_SCOPE_TO_GRAPH_FF, { accountId, userId }));
|
|
133
|
-
authorizationInternalService.logger.error({
|
|
134
|
-
tag: 'auth-debug',
|
|
135
|
-
accountId,
|
|
136
|
-
userId,
|
|
137
|
-
shouldNavigateToGraph,
|
|
138
|
-
featureFlag: NAVIGATE_CAN_ACTION_IN_SCOPE_TO_GRAPH_FF,
|
|
139
|
-
}, 'AuthorizationService.canActionInScopeMultiple: determining which API flow to use');
|
|
140
115
|
const startTime = perf_hooks.performance.now();
|
|
141
116
|
let scopedActionResponseObjects;
|
|
142
117
|
let apiType;
|
|
143
118
|
if (shouldNavigateToGraph) {
|
|
144
119
|
apiType = 'graph';
|
|
145
|
-
authorizationInternalService.logger.error({ tag: 'auth-debug', accountId, userId, apiType }, 'AuthorizationService.canActionInScopeMultiple: using graph API flow');
|
|
146
120
|
scopedActionResponseObjects = await this.graphApi.checkPermissions(accountId, userId, scopedActions);
|
|
147
121
|
}
|
|
148
122
|
else {
|
|
149
123
|
apiType = 'platform';
|
|
150
|
-
authorizationInternalService.logger.error({ tag: 'auth-debug', accountId, userId, apiType }, 'AuthorizationService.canActionInScopeMultiple: using platform API flow');
|
|
151
124
|
const profile = this.getProfile(accountId, userId);
|
|
152
125
|
const internalAuthToken = authorizationInternalService.AuthorizationInternalService.generateInternalAuthToken(accountId, userId);
|
|
153
126
|
scopedActionResponseObjects = await this.platformApi.checkPermissions(profile, internalAuthToken, userId, scopedActions);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base class for attribute assignments (Resource or Entity)
|
|
3
|
+
* Provides common validation and functionality
|
|
4
|
+
*/
|
|
5
|
+
export declare abstract class BaseAttributeAssignment<TId extends number, TType extends string> {
|
|
6
|
+
readonly id: TId;
|
|
7
|
+
readonly type: TType;
|
|
8
|
+
readonly attributeKey: string;
|
|
9
|
+
readonly attributeValue: string;
|
|
10
|
+
constructor(id: TId, type: string, attributeKey: string, attributeValue: string, validTypes: readonly string[], idFieldName: string, typeFieldName: string);
|
|
11
|
+
/**
|
|
12
|
+
* Compares two assignments for equality
|
|
13
|
+
* @param other Another assignment instance
|
|
14
|
+
* @returns true if all properties are equal
|
|
15
|
+
*/
|
|
16
|
+
equals(other: BaseAttributeAssignment<TId, TType>): boolean;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=base-attribute-assignment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-attribute-assignment.d.ts","sourceRoot":"","sources":["../src/base-attribute-assignment.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,8BAAsB,uBAAuB,CAAC,GAAG,SAAS,MAAM,EAAE,KAAK,SAAS,MAAM;IACpF,SAAgB,EAAE,EAAE,GAAG,CAAC;IACxB,SAAgB,IAAI,EAAE,KAAK,CAAC;IAC5B,SAAgB,YAAY,EAAE,MAAM,CAAC;IACrC,SAAgB,cAAc,EAAE,MAAM,CAAC;gBAGrC,EAAE,EAAE,GAAG,EACP,IAAI,EAAE,MAAM,EACZ,YAAY,EAAE,MAAM,EACpB,cAAc,EAAE,MAAM,EACtB,UAAU,EAAE,SAAS,MAAM,EAAE,EAC7B,WAAW,EAAE,MAAM,EACnB,aAAa,EAAE,MAAM;IAmBvB;;;;OAIG;IACH,MAAM,CAAC,KAAK,EAAE,uBAAuB,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,OAAO;CAW5D"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
|
|
3
|
+
const utils_validation = require('./utils/validation.js');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Base class for attribute assignments (Resource or Entity)
|
|
7
|
+
* Provides common validation and functionality
|
|
8
|
+
*/
|
|
9
|
+
class BaseAttributeAssignment {
|
|
10
|
+
id;
|
|
11
|
+
type;
|
|
12
|
+
attributeKey;
|
|
13
|
+
attributeValue;
|
|
14
|
+
constructor(id, type, attributeKey, attributeValue, validTypes, idFieldName, typeFieldName) {
|
|
15
|
+
// Validate id
|
|
16
|
+
utils_validation.ValidationUtils.validateInteger(id, idFieldName);
|
|
17
|
+
// Validate type
|
|
18
|
+
this.type = utils_validation.ValidationUtils.validateEnum(type, validTypes, typeFieldName);
|
|
19
|
+
// Validate attributeKey
|
|
20
|
+
utils_validation.ValidationUtils.validateString(attributeKey, 'attributeKey');
|
|
21
|
+
// Validate attributeValue
|
|
22
|
+
utils_validation.ValidationUtils.validateString(attributeValue, 'attributeValue');
|
|
23
|
+
this.id = id;
|
|
24
|
+
this.attributeKey = attributeKey;
|
|
25
|
+
this.attributeValue = attributeValue;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Compares two assignments for equality
|
|
29
|
+
* @param other Another assignment instance
|
|
30
|
+
* @returns true if all properties are equal
|
|
31
|
+
*/
|
|
32
|
+
equals(other) {
|
|
33
|
+
if (!(other instanceof this.constructor)) {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
return (this.id === other.id &&
|
|
37
|
+
this.type === other.type &&
|
|
38
|
+
this.attributeKey === other.attributeKey &&
|
|
39
|
+
this.attributeValue === other.attributeValue);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
exports.BaseAttributeAssignment = BaseAttributeAssignment;
|
package/dist/constants/sns.d.ts
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
|
-
export declare
|
|
2
|
-
|
|
1
|
+
export declare enum SnsTopicType {
|
|
2
|
+
RESOURCE = "resource",
|
|
3
|
+
ENTITY = "entity"
|
|
4
|
+
}
|
|
5
|
+
export declare const RESOURCE_SNS_ARN_ENV_VAR_NAME = "SHARED_AUTHORIZATION_SNS_ENDPOINT_RESOURCE_ATTRIBUTES";
|
|
6
|
+
export declare const RESOURCE_SNS_DEV_TEST_NAME = "arn:aws:sns:us-east-1:000000000000:monday-authorization-resource-attributes-sns-local";
|
|
7
|
+
export declare const ENTITY_SNS_ARN_ENV_VAR_NAME = "SHARED_AUTHORIZATION_SNS_ENDPOINT_ENTITY_ATTRIBUTES";
|
|
8
|
+
export declare const ENTITY_SNS_DEV_TEST_NAME = "arn:aws:sns:us-east-1:000000000000:monday-authorization-entity-attributes-sns-local";
|
|
3
9
|
export declare const RESOURCE_ATTRIBUTES_SNS_UPDATE_OPERATION_MESSAGE_KIND = "resourceAttributeModification";
|
|
10
|
+
export declare const ENTITY_ATTRIBUTES_SNS_UPDATE_OPERATION_MESSAGE_KIND = "entityAttributeModification";
|
|
4
11
|
export declare const ASYNC_RESOURCE_ATTRIBUTES_MAX_OPERATIONS_PER_MESSAGE = 100;
|
|
12
|
+
export declare const ASYNC_ENTITY_ATTRIBUTES_MAX_OPERATIONS_PER_MESSAGE = 100;
|
|
13
|
+
export declare const SNS_ARN_ENV_VAR_NAME = "SHARED_AUTHORIZATION_SNS_ENDPOINT_RESOURCE_ATTRIBUTES";
|
|
14
|
+
export declare const SNS_DEV_TEST_NAME = "arn:aws:sns:us-east-1:000000000000:monday-authorization-resource-attributes-sns-local";
|
|
5
15
|
//# sourceMappingURL=sns.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sns.d.ts","sourceRoot":"","sources":["../../src/constants/sns.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"sns.d.ts","sourceRoot":"","sources":["../../src/constants/sns.ts"],"names":[],"mappings":"AAAA,oBAAY,YAAY;IACtB,QAAQ,aAAa;IACrB,MAAM,WAAW;CAClB;AAGD,eAAO,MAAM,6BAA6B,0DAA0D,CAAC;AACrG,eAAO,MAAM,0BAA0B,0FACkD,CAAC;AAG1F,eAAO,MAAM,2BAA2B,wDAAwD,CAAC;AACjG,eAAO,MAAM,wBAAwB,wFACkD,CAAC;AACxF,eAAO,MAAM,qDAAqD,kCAAkC,CAAC;AACrG,eAAO,MAAM,mDAAmD,gCAAgC,CAAC;AACjG,eAAO,MAAM,oDAAoD,MAAM,CAAC;AACxE,eAAO,MAAM,kDAAkD,MAAM,CAAC;AAGtE,eAAO,MAAM,oBAAoB,0DAAgC,CAAC;AAClE,eAAO,MAAM,iBAAiB,0FAA6B,CAAC"}
|
package/dist/constants/sns.js
CHANGED
|
@@ -1,11 +1,31 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
exports.SnsTopicType = void 0;
|
|
4
|
+
(function (SnsTopicType) {
|
|
5
|
+
SnsTopicType["RESOURCE"] = "resource";
|
|
6
|
+
SnsTopicType["ENTITY"] = "entity";
|
|
7
|
+
})(exports.SnsTopicType || (exports.SnsTopicType = {}));
|
|
8
|
+
// Resource SNS constants
|
|
9
|
+
const RESOURCE_SNS_ARN_ENV_VAR_NAME = 'SHARED_AUTHORIZATION_SNS_ENDPOINT_RESOURCE_ATTRIBUTES';
|
|
10
|
+
const RESOURCE_SNS_DEV_TEST_NAME = 'arn:aws:sns:us-east-1:000000000000:monday-authorization-resource-attributes-sns-local';
|
|
11
|
+
// Entity SNS constants
|
|
12
|
+
const ENTITY_SNS_ARN_ENV_VAR_NAME = 'SHARED_AUTHORIZATION_SNS_ENDPOINT_ENTITY_ATTRIBUTES';
|
|
13
|
+
const ENTITY_SNS_DEV_TEST_NAME = 'arn:aws:sns:us-east-1:000000000000:monday-authorization-entity-attributes-sns-local';
|
|
5
14
|
const RESOURCE_ATTRIBUTES_SNS_UPDATE_OPERATION_MESSAGE_KIND = 'resourceAttributeModification';
|
|
15
|
+
const ENTITY_ATTRIBUTES_SNS_UPDATE_OPERATION_MESSAGE_KIND = 'entityAttributeModification';
|
|
6
16
|
const ASYNC_RESOURCE_ATTRIBUTES_MAX_OPERATIONS_PER_MESSAGE = 100;
|
|
17
|
+
const ASYNC_ENTITY_ATTRIBUTES_MAX_OPERATIONS_PER_MESSAGE = 100;
|
|
18
|
+
// Legacy exports for backward compatibility
|
|
19
|
+
const SNS_ARN_ENV_VAR_NAME = RESOURCE_SNS_ARN_ENV_VAR_NAME;
|
|
20
|
+
const SNS_DEV_TEST_NAME = RESOURCE_SNS_DEV_TEST_NAME;
|
|
7
21
|
|
|
22
|
+
exports.ASYNC_ENTITY_ATTRIBUTES_MAX_OPERATIONS_PER_MESSAGE = ASYNC_ENTITY_ATTRIBUTES_MAX_OPERATIONS_PER_MESSAGE;
|
|
8
23
|
exports.ASYNC_RESOURCE_ATTRIBUTES_MAX_OPERATIONS_PER_MESSAGE = ASYNC_RESOURCE_ATTRIBUTES_MAX_OPERATIONS_PER_MESSAGE;
|
|
24
|
+
exports.ENTITY_ATTRIBUTES_SNS_UPDATE_OPERATION_MESSAGE_KIND = ENTITY_ATTRIBUTES_SNS_UPDATE_OPERATION_MESSAGE_KIND;
|
|
25
|
+
exports.ENTITY_SNS_ARN_ENV_VAR_NAME = ENTITY_SNS_ARN_ENV_VAR_NAME;
|
|
26
|
+
exports.ENTITY_SNS_DEV_TEST_NAME = ENTITY_SNS_DEV_TEST_NAME;
|
|
9
27
|
exports.RESOURCE_ATTRIBUTES_SNS_UPDATE_OPERATION_MESSAGE_KIND = RESOURCE_ATTRIBUTES_SNS_UPDATE_OPERATION_MESSAGE_KIND;
|
|
28
|
+
exports.RESOURCE_SNS_ARN_ENV_VAR_NAME = RESOURCE_SNS_ARN_ENV_VAR_NAME;
|
|
29
|
+
exports.RESOURCE_SNS_DEV_TEST_NAME = RESOURCE_SNS_DEV_TEST_NAME;
|
|
10
30
|
exports.SNS_ARN_ENV_VAR_NAME = SNS_ARN_ENV_VAR_NAME;
|
|
11
31
|
exports.SNS_DEV_TEST_NAME = SNS_DEV_TEST_NAME;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { EntityType } from './entity-attributes-constants';
|
|
2
|
+
import { BaseAttributeAssignment } from './base-attribute-assignment';
|
|
3
|
+
export declare class EntityAttributeAssignment extends BaseAttributeAssignment<number, EntityType> {
|
|
4
|
+
readonly entityId: number;
|
|
5
|
+
readonly entityType: EntityType;
|
|
6
|
+
constructor(entityId: number, entityType: string, attributeKey: string, attributeValue: string);
|
|
7
|
+
/**
|
|
8
|
+
* Compares two assignments for equality
|
|
9
|
+
* @param other Another EntityAttributeAssignment instance
|
|
10
|
+
* @returns true if all properties are equal
|
|
11
|
+
*/
|
|
12
|
+
equals(other: EntityAttributeAssignment): boolean;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=entity-attribute-assignment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entity-attribute-assignment.d.ts","sourceRoot":"","sources":["../src/entity-attribute-assignment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,UAAU,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAEtE,qBAAa,yBAA0B,SAAQ,uBAAuB,CAAC,MAAM,EAAE,UAAU,CAAC;IACxF,SAAgB,QAAQ,EAAE,MAAM,CAAC;IACjC,SAAgB,UAAU,EAAE,UAAU,CAAC;gBAE3B,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM;IAK9F;;;;OAIG;IACH,MAAM,CAAC,KAAK,EAAE,yBAAyB,GAAG,OAAO;CAGlD"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
|
|
3
|
+
const entityAttributesConstants = require('./entity-attributes-constants.js');
|
|
4
|
+
const baseAttributeAssignment = require('./base-attribute-assignment.js');
|
|
5
|
+
|
|
6
|
+
class EntityAttributeAssignment extends baseAttributeAssignment.BaseAttributeAssignment {
|
|
7
|
+
entityId;
|
|
8
|
+
entityType;
|
|
9
|
+
constructor(entityId, entityType, attributeKey, attributeValue) {
|
|
10
|
+
super(entityId, entityType, attributeKey, attributeValue, Object.values(entityAttributesConstants.ENTITY_TYPES), 'entityId', 'entityType');
|
|
11
|
+
this.entityId = entityId;
|
|
12
|
+
this.entityType = this.type;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Compares two assignments for equality
|
|
16
|
+
* @param other Another EntityAttributeAssignment instance
|
|
17
|
+
* @returns true if all properties are equal
|
|
18
|
+
*/
|
|
19
|
+
equals(other) {
|
|
20
|
+
return super.equals(other);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
exports.EntityAttributeAssignment = EntityAttributeAssignment;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entity-attributes-constants.d.ts","sourceRoot":"","sources":["../src/entity-attributes-constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY;;;;CAIf,CAAC;AAEX,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,OAAO,YAAY,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"argument-error.d.ts","sourceRoot":"","sources":["../../src/errors/argument-error.ts"],"names":[],"mappings":"AAAA,qBAAa,aAAc,SAAQ,KAAK;gBAC1B,OAAO,EAAE,MAAM;CAK5B"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
|
|
3
|
+
class ArgumentError extends Error {
|
|
4
|
+
constructor(message) {
|
|
5
|
+
super(message);
|
|
6
|
+
this.name = 'ArgumentError';
|
|
7
|
+
Object.setPrototypeOf(this, ArgumentError.prototype);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
exports.ArgumentError = ArgumentError;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { ResourceAttributeAssignment } from './resource-attribute-assignment';
|
|
2
|
+
import { EntityAttributeAssignment } from './entity-attribute-assignment';
|
|
3
|
+
import { EntityType } from './types/authorization-attributes-contracts';
|
|
4
|
+
import { IAuthorizationAttributesService } from './types/authorization-attributes-service.interface';
|
|
5
|
+
import { Resource } from './types/general';
|
|
6
|
+
import { ResourceAttributeOperation, EntityAttributeOperation } from './types/authorization-attributes-contracts';
|
|
7
|
+
/**
|
|
8
|
+
* Service class for managing resource attributes in the authorization microservice.
|
|
9
|
+
* Provides synchronous HTTP operations to create/update and delete attributes on resources.
|
|
10
|
+
*/
|
|
11
|
+
export declare class AuthorizationAttributesMsService implements IAuthorizationAttributesService {
|
|
12
|
+
private static LOG_TAG;
|
|
13
|
+
private static httpClient;
|
|
14
|
+
/**
|
|
15
|
+
* Resets the cached HTTP client (useful for testing)
|
|
16
|
+
*/
|
|
17
|
+
private static resetHttpClient;
|
|
18
|
+
/**
|
|
19
|
+
* Gets request headers including Authorization, Content-Type, and optional attribution headers
|
|
20
|
+
*/
|
|
21
|
+
private static getRequestHeaders;
|
|
22
|
+
/**
|
|
23
|
+
* Validates that all messages are instances of the specified message class
|
|
24
|
+
*/
|
|
25
|
+
private static validateMessages;
|
|
26
|
+
/**
|
|
27
|
+
* Generic helper for executing upsert requests
|
|
28
|
+
*/
|
|
29
|
+
private static executeUpsertRequest;
|
|
30
|
+
/**
|
|
31
|
+
* Generic helper for executing delete requests
|
|
32
|
+
*/
|
|
33
|
+
private static executeDeleteRequest;
|
|
34
|
+
/**
|
|
35
|
+
* Creates or updates resource attributes synchronously.
|
|
36
|
+
* @param accountId The account ID
|
|
37
|
+
* @param resourceAttributeAssignments Array of ResourceAttributeAssignment objects
|
|
38
|
+
* @returns Promise<void>
|
|
39
|
+
*/
|
|
40
|
+
upsertResourceAttributes(accountId: number, resourceAttributeAssignments: ResourceAttributeAssignment[], _appName?: string, _callerActionIdentifier?: string): Promise<void>;
|
|
41
|
+
/**
|
|
42
|
+
* Deletes specific attributes from a resource synchronously.
|
|
43
|
+
* @param accountId The account ID
|
|
44
|
+
* @param resource Object with resourceType (string) and resourceId (number)
|
|
45
|
+
* @param attributeKeys Array of attribute key strings to delete
|
|
46
|
+
* @returns Promise<void>
|
|
47
|
+
*/
|
|
48
|
+
deleteResourceAttributes(accountId: number, resource: Resource, attributeKeys: string[], _appName?: string, _callerActionIdentifier?: string): Promise<void>;
|
|
49
|
+
/**
|
|
50
|
+
* Creates or updates entity attributes synchronously.
|
|
51
|
+
* @param accountId The account ID
|
|
52
|
+
* @param entityAttributeAssignments Array of EntityAttributeAssignment objects
|
|
53
|
+
* @returns Promise<void>
|
|
54
|
+
*/
|
|
55
|
+
upsertEntityAttributes(accountId: number, entityAttributeAssignments: EntityAttributeAssignment[], _appName?: string, _callerActionIdentifier?: string): Promise<void>;
|
|
56
|
+
/**
|
|
57
|
+
* Deletes specific attributes from an entity synchronously.
|
|
58
|
+
* @param accountId The account ID
|
|
59
|
+
* @param entityType The entity type
|
|
60
|
+
* @param entityId The entity ID
|
|
61
|
+
* @param attributeKeys Array of attribute key strings to delete
|
|
62
|
+
* @returns Promise<void>
|
|
63
|
+
*/
|
|
64
|
+
deleteEntityAttributes(accountId: number, entityType: EntityType | string, entityId: number, attributeKeys: string[], _appName?: string, _callerActionIdentifier?: string): Promise<void>;
|
|
65
|
+
/**
|
|
66
|
+
* Updates resource attributes (batch operations).
|
|
67
|
+
* Note: MS service does not support batch operations directly.
|
|
68
|
+
* This method processes operations sequentially using upsert/delete methods.
|
|
69
|
+
* @param accountId The account ID
|
|
70
|
+
* @param appName App name (required for interface compatibility, but not used in MS service)
|
|
71
|
+
* @param callerActionIdentifier Action identifier (required for interface compatibility, but not used in MS service)
|
|
72
|
+
* @param resourceAttributeOperations Array of operations to perform
|
|
73
|
+
* @returns Promise<ResourceAttributesOperation[]> Array of processed operations
|
|
74
|
+
*/
|
|
75
|
+
updateResourceAttributes(accountId: number, _appName: string, _callerActionIdentifier: string, resourceAttributeOperations: ResourceAttributeOperation[]): Promise<ResourceAttributeOperation[]>;
|
|
76
|
+
/**
|
|
77
|
+
* Updates entity attributes (batch operations).
|
|
78
|
+
* Note: MS service does not support batch operations directly.
|
|
79
|
+
* This method processes operations sequentially using upsert/delete methods.
|
|
80
|
+
* @param accountId The account ID
|
|
81
|
+
* @param appName App name (required for interface compatibility, but not used in MS service)
|
|
82
|
+
* @param callerActionIdentifier Action identifier (required for interface compatibility, but not used in MS service)
|
|
83
|
+
* @param entityAttributeOperations Array of operations to perform
|
|
84
|
+
* @returns Promise<EntityAttributesOperation[]> Array of processed operations
|
|
85
|
+
*/
|
|
86
|
+
updateEntityAttributes(accountId: number, _appName: string, _callerActionIdentifier: string, entityAttributeOperations: EntityAttributeOperation[]): Promise<EntityAttributeOperation[]>;
|
|
87
|
+
/**
|
|
88
|
+
* Replaces path template parameters with actual values
|
|
89
|
+
* @param template Path template with placeholders like {accountId}
|
|
90
|
+
* @param params Object with parameter names and values
|
|
91
|
+
* @returns Path with all placeholders replaced
|
|
92
|
+
*/
|
|
93
|
+
private static replacePathParams;
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=authorization-attributes-ms-service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authorization-attributes-ms-service.d.ts","sourceRoot":"","sources":["../../src/authorization-attributes-ms-service.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,2BAA2B,EAAE,MAAM,iCAAiC,CAAC;AAC9E,OAAO,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAC1E,OAAO,EAAsB,UAAU,EAAE,MAAM,4CAA4C,CAAC;AAM5F,OAAO,EAAE,+BAA+B,EAAE,MAAM,oDAAoD,CAAC;AACrG,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,0BAA0B,EAAE,wBAAwB,EAAE,MAAM,4CAA4C,CAAC;AAWlH;;;GAGG;AACH,qBAAa,gCAAiC,YAAW,+BAA+B;IACtF,OAAO,CAAC,MAAM,CAAC,OAAO,CAAiC;IACvD,OAAO,CAAC,MAAM,CAAC,UAAU,CAAqD;IAE9E;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,eAAe;IAI9B;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,iBAAiB;IA+ChC;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,gBAAgB;IAsD/B;;OAEG;mBACkB,oBAAoB;IA4EzC;;OAEG;mBACkB,oBAAoB;IA2EzC;;;;;OAKG;IACG,wBAAwB,CAC5B,SAAS,EAAE,MAAM,EACjB,4BAA4B,EAAE,2BAA2B,EAAE,EAC3D,QAAQ,CAAC,EAAE,MAAM,EACjB,uBAAuB,CAAC,EAAE,MAAM,GAC/B,OAAO,CAAC,IAAI,CAAC;IAYhB;;;;;;OAMG;IACG,wBAAwB,CAC5B,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,QAAQ,EAClB,aAAa,EAAE,MAAM,EAAE,EACvB,QAAQ,CAAC,EAAE,MAAM,EACjB,uBAAuB,CAAC,EAAE,MAAM,GAC/B,OAAO,CAAC,IAAI,CAAC;IAyBhB;;;;;OAKG;IACG,sBAAsB,CAC1B,SAAS,EAAE,MAAM,EACjB,0BAA0B,EAAE,yBAAyB,EAAE,EACvD,QAAQ,CAAC,EAAE,MAAM,EACjB,uBAAuB,CAAC,EAAE,MAAM,GAC/B,OAAO,CAAC,IAAI,CAAC;IAYhB;;;;;;;OAOG;IACG,sBAAsB,CAC1B,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,UAAU,GAAG,MAAM,EAC/B,QAAQ,EAAE,MAAM,EAChB,aAAa,EAAE,MAAM,EAAE,EACvB,QAAQ,CAAC,EAAE,MAAM,EACjB,uBAAuB,CAAC,EAAE,MAAM,GAC/B,OAAO,CAAC,IAAI,CAAC;IAoBhB;;;;;;;;;OASG;IACG,wBAAwB,CAC5B,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,uBAAuB,EAAE,MAAM,EAC/B,2BAA2B,EAAE,0BAA0B,EAAE,GACxD,OAAO,CAAC,0BAA0B,EAAE,CAAC;IAoCxC;;;;;;;;;OASG;IACG,sBAAsB,CAC1B,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,uBAAuB,EAAE,MAAM,EAC/B,yBAAyB,EAAE,wBAAwB,EAAE,GACpD,OAAO,CAAC,wBAAwB,EAAE,CAAC;IAyBtC;;;;;OAKG;IACH,OAAO,CAAC,MAAM,CAAC,iBAAiB;CAOjC"}
|