@mondaydotcomorg/monday-authorization 3.5.1-fix-authorize-profile-picker-7481de0 → 3.5.2-feat-shaime-support-entity-attributes-4-ddec1d3
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 +88 -0
- package/dist/authorization-attributes-ms-service.d.ts.map +1 -0
- package/dist/authorization-attributes-ms-service.js +290 -0
- package/dist/authorization-attributes-service.d.ts +25 -47
- package/dist/authorization-attributes-service.d.ts.map +1 -1
- package/dist/authorization-attributes-service.js +32 -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-service.d.ts.map +1 -1
- package/dist/authorization-service.js +7 -34
- package/dist/base-attribute-assignment.d.ts +20 -0
- package/dist/base-attribute-assignment.d.ts.map +1 -0
- package/dist/base-attribute-assignment.js +36 -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 +20 -0
- package/dist/entity-attribute-assignment.d.ts.map +1 -0
- package/dist/entity-attribute-assignment.js +32 -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 +11 -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 +88 -0
- package/dist/esm/authorization-attributes-ms-service.d.ts.map +1 -0
- package/dist/esm/authorization-attributes-ms-service.mjs +288 -0
- package/dist/esm/authorization-attributes-service.d.ts +25 -47
- package/dist/esm/authorization-attributes-service.d.ts.map +1 -1
- package/dist/esm/authorization-attributes-service.mjs +32 -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-service.d.ts.map +1 -1
- package/dist/esm/authorization-service.mjs +7 -34
- package/dist/esm/base-attribute-assignment.d.ts +20 -0
- package/dist/esm/base-attribute-assignment.d.ts.map +1 -0
- package/dist/esm/base-attribute-assignment.mjs +30 -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 +20 -0
- package/dist/esm/entity-attribute-assignment.d.ts.map +1 -0
- package/dist/esm/entity-attribute-assignment.mjs +30 -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 +9 -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/resource-attribute-assignment.d.ts +20 -0
- package/dist/esm/resource-attribute-assignment.d.ts.map +1 -0
- package/dist/esm/resource-attribute-assignment.mjs +30 -0
- package/dist/esm/resource-attributes-constants.d.ts +25 -0
- package/dist/esm/resource-attributes-constants.d.ts.map +1 -0
- package/dist/esm/resource-attributes-constants.mjs +28 -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 +26 -11
- 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/utils/validation.d.ts +45 -0
- package/dist/esm/utils/validation.d.ts.map +1 -0
- package/dist/esm/utils/validation.mjs +152 -0
- package/dist/resource-attribute-assignment.d.ts +20 -0
- package/dist/resource-attribute-assignment.d.ts.map +1 -0
- package/dist/resource-attribute-assignment.js +32 -0
- package/dist/resource-attributes-constants.d.ts +25 -0
- package/dist/resource-attributes-constants.d.ts.map +1 -0
- package/dist/resource-attributes-constants.js +31 -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 +26 -11
- 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/utils/validation.d.ts +45 -0
- package/dist/utils/validation.d.ts.map +1 -0
- package/dist/utils/validation.js +158 -0
- package/package.json +3 -1
- package/src/authorization-attributes-ms-service.ts +438 -0
- package/src/authorization-attributes-service.ts +34 -222
- package/src/authorization-attributes-sns-service.ts +312 -0
- package/src/authorization-service.ts +11 -71
- package/src/base-attribute-assignment.ts +46 -0
- package/src/constants/sns.ts +19 -2
- package/src/entity-attribute-assignment.ts +30 -0
- package/src/entity-attributes-constants.ts +7 -0
- package/src/errors/argument-error.ts +7 -0
- package/src/resource-attribute-assignment.ts +38 -0
- package/src/resource-attributes-constants.ts +27 -0
- package/src/testKit/index.ts +5 -5
- package/src/types/authorization-attributes-contracts.ts +34 -11
- package/src/types/authorization-attributes-service.interface.ts +101 -0
- package/src/utils/validation.ts +171 -0
|
@@ -94,33 +94,15 @@ class AuthorizationService {
|
|
|
94
94
|
logger.error({ tag: 'authorization-service' }, 'AuthorizationService: igniteClient is not set, failing request');
|
|
95
95
|
throw new Error('AuthorizationService: igniteClient is not set, failing request');
|
|
96
96
|
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
logger.error({ tag: 'auth-debug', accountId, userId, appName, allowedProfiles, isAllowedProfile }, 'AuthorizationService.getProfile: checking allowed profiles');
|
|
100
|
-
if (isAllowedProfile) {
|
|
101
|
-
const profile = getProfile();
|
|
102
|
-
logger.error({ tag: 'auth-debug', accountId, userId, appName, profile }, 'AuthorizationService.getProfile: selected profile via allowed profiles');
|
|
103
|
-
return profile;
|
|
97
|
+
if (this.igniteClient.configuration.getObjectValue(ALLOWED_SDK_PLATFORM_PROFILES_KEY, []).includes(appName)) {
|
|
98
|
+
return getProfile();
|
|
104
99
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
accountId,
|
|
111
|
-
userId,
|
|
112
|
-
appName,
|
|
113
|
-
inReleaseProfiles,
|
|
114
|
-
isInReleaseProfile,
|
|
115
|
-
isFeatureFlagReleased,
|
|
116
|
-
featureFlag: PLATFORM_PROFILE_RELEASE_FF,
|
|
117
|
-
}, 'AuthorizationService.getProfile: checking feature flag release');
|
|
118
|
-
if (isInReleaseProfile && isFeatureFlagReleased) {
|
|
119
|
-
const profile = getProfile();
|
|
120
|
-
logger.error({ tag: 'auth-debug', accountId, userId, appName, profile }, 'AuthorizationService.getProfile: selected profile via feature flag release');
|
|
121
|
-
return profile;
|
|
100
|
+
if (this.igniteClient.configuration
|
|
101
|
+
.getObjectValue(IN_RELEASE_SDK_PLATFORM_PROFILES_KEY, [])
|
|
102
|
+
.includes(appName) &&
|
|
103
|
+
this.igniteClient.isReleased(PLATFORM_PROFILE_RELEASE_FF, { accountId, userId })) {
|
|
104
|
+
return getProfile();
|
|
122
105
|
}
|
|
123
|
-
logger.error({ tag: 'auth-debug', accountId, userId, appName, profile: PlatformProfile.APP }, 'AuthorizationService.getProfile: selected default APP profile');
|
|
124
106
|
return PlatformProfile.APP;
|
|
125
107
|
}
|
|
126
108
|
static async canActionInScopeMultiple(accountId, userId, scopedActions) {
|
|
@@ -128,24 +110,15 @@ class AuthorizationService {
|
|
|
128
110
|
return [];
|
|
129
111
|
}
|
|
130
112
|
const shouldNavigateToGraph = Boolean(this.igniteClient?.isReleased(NAVIGATE_CAN_ACTION_IN_SCOPE_TO_GRAPH_FF, { accountId, userId }));
|
|
131
|
-
logger.error({
|
|
132
|
-
tag: 'auth-debug',
|
|
133
|
-
accountId,
|
|
134
|
-
userId,
|
|
135
|
-
shouldNavigateToGraph,
|
|
136
|
-
featureFlag: NAVIGATE_CAN_ACTION_IN_SCOPE_TO_GRAPH_FF,
|
|
137
|
-
}, 'AuthorizationService.canActionInScopeMultiple: determining which API flow to use');
|
|
138
113
|
const startTime = performance.now();
|
|
139
114
|
let scopedActionResponseObjects;
|
|
140
115
|
let apiType;
|
|
141
116
|
if (shouldNavigateToGraph) {
|
|
142
117
|
apiType = 'graph';
|
|
143
|
-
logger.error({ tag: 'auth-debug', accountId, userId, apiType }, 'AuthorizationService.canActionInScopeMultiple: using graph API flow');
|
|
144
118
|
scopedActionResponseObjects = await this.graphApi.checkPermissions(accountId, userId, scopedActions);
|
|
145
119
|
}
|
|
146
120
|
else {
|
|
147
121
|
apiType = 'platform';
|
|
148
|
-
logger.error({ tag: 'auth-debug', accountId, userId, apiType }, 'AuthorizationService.canActionInScopeMultiple: using platform API flow');
|
|
149
122
|
const profile = this.getProfile(accountId, userId);
|
|
150
123
|
const internalAuthToken = AuthorizationInternalService.generateInternalAuthToken(accountId, userId);
|
|
151
124
|
scopedActionResponseObjects = await this.platformApi.checkPermissions(profile, internalAuthToken, userId, scopedActions);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { EntityAttributeAssignment, ResourceAttributeDelete } from './types/authorization-attributes-contracts';
|
|
2
|
+
/**
|
|
3
|
+
* Base class for attribute assignments (Resource or Entity)
|
|
4
|
+
* Provides common validation and functionality
|
|
5
|
+
*/
|
|
6
|
+
export declare abstract class BaseAttributeAssignment<TId extends number, TType extends string> {
|
|
7
|
+
readonly id: TId;
|
|
8
|
+
readonly type: TType;
|
|
9
|
+
readonly attributeKey: string;
|
|
10
|
+
readonly attributeValue: string;
|
|
11
|
+
constructor(id: TId, type: string, attributeKey: string, attributeValue: string, validTypes: readonly string[], idFieldName: string, typeFieldName: string);
|
|
12
|
+
/**
|
|
13
|
+
* Compares two assignments for equality
|
|
14
|
+
* @param other Another assignment instance
|
|
15
|
+
* @returns true if all properties are equal
|
|
16
|
+
*/
|
|
17
|
+
equals(other: BaseAttributeAssignment<TId, TType>): boolean;
|
|
18
|
+
abstract toDataTransferObject(): EntityAttributeAssignment | ResourceAttributeDelete;
|
|
19
|
+
}
|
|
20
|
+
//# 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,OAAO,EAAE,yBAAyB,EAAE,uBAAuB,EAAE,MAAM,4CAA4C,CAAC;AAEhH;;;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;IAcvB;;;;OAIG;IACH,MAAM,CAAC,KAAK,EAAE,uBAAuB,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,OAAO;IAI3D,QAAQ,CAAC,oBAAoB,IAAI,yBAAyB,GAAG,uBAAuB;CACrF"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ValidationUtils } from './utils/validation.mjs';
|
|
2
|
+
import isEqual from 'lodash/isEqual.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Base class for attribute assignments (Resource or Entity)
|
|
6
|
+
* Provides common validation and functionality
|
|
7
|
+
*/
|
|
8
|
+
class BaseAttributeAssignment {
|
|
9
|
+
id;
|
|
10
|
+
type;
|
|
11
|
+
attributeKey;
|
|
12
|
+
attributeValue;
|
|
13
|
+
constructor(id, type, attributeKey, attributeValue, validTypes, idFieldName, typeFieldName) {
|
|
14
|
+
const validated = ValidationUtils.validateAssignment({ id, type, attributeKey, attributeValue }, validTypes, { id: idFieldName, type: typeFieldName });
|
|
15
|
+
this.id = validated.id;
|
|
16
|
+
this.type = validated.type;
|
|
17
|
+
this.attributeKey = validated.attributeKey;
|
|
18
|
+
this.attributeValue = validated.attributeValue;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Compares two assignments for equality
|
|
22
|
+
* @param other Another assignment instance
|
|
23
|
+
* @returns true if all properties are equal
|
|
24
|
+
*/
|
|
25
|
+
equals(other) {
|
|
26
|
+
return isEqual(this, other);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export { BaseAttributeAssignment };
|
|
@@ -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"}
|
|
@@ -1,6 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
var SnsTopicType;
|
|
2
|
+
(function (SnsTopicType) {
|
|
3
|
+
SnsTopicType["RESOURCE"] = "resource";
|
|
4
|
+
SnsTopicType["ENTITY"] = "entity";
|
|
5
|
+
})(SnsTopicType || (SnsTopicType = {}));
|
|
6
|
+
// Resource SNS constants
|
|
7
|
+
const RESOURCE_SNS_ARN_ENV_VAR_NAME = 'SHARED_AUTHORIZATION_SNS_ENDPOINT_RESOURCE_ATTRIBUTES';
|
|
8
|
+
const RESOURCE_SNS_DEV_TEST_NAME = 'arn:aws:sns:us-east-1:000000000000:monday-authorization-resource-attributes-sns-local';
|
|
9
|
+
// Entity SNS constants
|
|
10
|
+
const ENTITY_SNS_ARN_ENV_VAR_NAME = 'SHARED_AUTHORIZATION_SNS_ENDPOINT_ENTITY_ATTRIBUTES';
|
|
11
|
+
const ENTITY_SNS_DEV_TEST_NAME = 'arn:aws:sns:us-east-1:000000000000:monday-authorization-entity-attributes-sns-local';
|
|
3
12
|
const RESOURCE_ATTRIBUTES_SNS_UPDATE_OPERATION_MESSAGE_KIND = 'resourceAttributeModification';
|
|
13
|
+
const ENTITY_ATTRIBUTES_SNS_UPDATE_OPERATION_MESSAGE_KIND = 'entityAttributeModification';
|
|
4
14
|
const ASYNC_RESOURCE_ATTRIBUTES_MAX_OPERATIONS_PER_MESSAGE = 100;
|
|
15
|
+
const ASYNC_ENTITY_ATTRIBUTES_MAX_OPERATIONS_PER_MESSAGE = 100;
|
|
16
|
+
// Legacy exports for backward compatibility
|
|
17
|
+
const SNS_ARN_ENV_VAR_NAME = RESOURCE_SNS_ARN_ENV_VAR_NAME;
|
|
18
|
+
const SNS_DEV_TEST_NAME = RESOURCE_SNS_DEV_TEST_NAME;
|
|
5
19
|
|
|
6
|
-
export { ASYNC_RESOURCE_ATTRIBUTES_MAX_OPERATIONS_PER_MESSAGE, RESOURCE_ATTRIBUTES_SNS_UPDATE_OPERATION_MESSAGE_KIND, SNS_ARN_ENV_VAR_NAME, SNS_DEV_TEST_NAME };
|
|
20
|
+
export { ASYNC_ENTITY_ATTRIBUTES_MAX_OPERATIONS_PER_MESSAGE, ASYNC_RESOURCE_ATTRIBUTES_MAX_OPERATIONS_PER_MESSAGE, ENTITY_ATTRIBUTES_SNS_UPDATE_OPERATION_MESSAGE_KIND, ENTITY_SNS_ARN_ENV_VAR_NAME, ENTITY_SNS_DEV_TEST_NAME, RESOURCE_ATTRIBUTES_SNS_UPDATE_OPERATION_MESSAGE_KIND, RESOURCE_SNS_ARN_ENV_VAR_NAME, RESOURCE_SNS_DEV_TEST_NAME, SNS_ARN_ENV_VAR_NAME, SNS_DEV_TEST_NAME, SnsTopicType };
|
|
@@ -0,0 +1,20 @@
|
|
|
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
|
+
toDataTransferObject(): {
|
|
8
|
+
entityId: number;
|
|
9
|
+
entityType: EntityType;
|
|
10
|
+
key: string;
|
|
11
|
+
value: string;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Compares two assignments for equality
|
|
15
|
+
* @param other Another EntityAttributeAssignment instance
|
|
16
|
+
* @returns true if all properties are equal
|
|
17
|
+
*/
|
|
18
|
+
equals(other: EntityAttributeAssignment): boolean;
|
|
19
|
+
}
|
|
20
|
+
//# 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;IAM9F,oBAAoB;;;;;;IAQpB;;;;OAIG;IACH,MAAM,CAAC,KAAK,EAAE,yBAAyB,GAAG,OAAO;CAGlD"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ENTITY_TYPES } from './entity-attributes-constants.mjs';
|
|
2
|
+
import { BaseAttributeAssignment } from './base-attribute-assignment.mjs';
|
|
3
|
+
|
|
4
|
+
class EntityAttributeAssignment extends BaseAttributeAssignment {
|
|
5
|
+
entityId;
|
|
6
|
+
entityType;
|
|
7
|
+
constructor(entityId, entityType, attributeKey, attributeValue) {
|
|
8
|
+
super(entityId, entityType, attributeKey, attributeValue, ENTITY_TYPES, 'entityId', 'entityType');
|
|
9
|
+
this.entityId = entityId;
|
|
10
|
+
this.entityType = this.type;
|
|
11
|
+
}
|
|
12
|
+
toDataTransferObject() {
|
|
13
|
+
return {
|
|
14
|
+
entityId: this.entityId,
|
|
15
|
+
entityType: this.entityType,
|
|
16
|
+
key: this.attributeKey,
|
|
17
|
+
value: this.attributeValue,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Compares two assignments for equality
|
|
22
|
+
* @param other Another EntityAttributeAssignment instance
|
|
23
|
+
* @returns true if all properties are equal
|
|
24
|
+
*/
|
|
25
|
+
equals(other) {
|
|
26
|
+
return super.equals(other);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export { EntityAttributeAssignment };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entity-attributes-constants.d.ts","sourceRoot":"","sources":["../../src/entity-attributes-constants.ts"],"names":[],"mappings":"AAAA,oBAAY,UAAU;IACpB,IAAI,SAAS;IACb,IAAI,SAAS;IACb,OAAO,YAAY;CACpB;AAED,eAAO,MAAM,YAAY,uBAA2C,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
var EntityType;
|
|
2
|
+
(function (EntityType) {
|
|
3
|
+
EntityType["User"] = "user";
|
|
4
|
+
EntityType["Team"] = "team";
|
|
5
|
+
EntityType["Account"] = "account";
|
|
6
|
+
})(EntityType || (EntityType = {}));
|
|
7
|
+
const ENTITY_TYPES = Object.freeze(Object.values(EntityType));
|
|
8
|
+
|
|
9
|
+
export { ENTITY_TYPES, EntityType };
|
|
@@ -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,20 @@
|
|
|
1
|
+
import { ResourceType } from './resource-attributes-constants';
|
|
2
|
+
import { BaseAttributeAssignment } from './base-attribute-assignment';
|
|
3
|
+
export declare class ResourceAttributeAssignment extends BaseAttributeAssignment<number, ResourceType> {
|
|
4
|
+
readonly resourceId: number;
|
|
5
|
+
readonly resourceType: ResourceType;
|
|
6
|
+
constructor(resourceId: number, resourceType: ResourceType, attributeKey: string, attributeValue: string);
|
|
7
|
+
toDataTransferObject(): {
|
|
8
|
+
resourceId: number;
|
|
9
|
+
resourceType: ResourceType;
|
|
10
|
+
key: string;
|
|
11
|
+
value: string;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Compares two assignments for equality
|
|
15
|
+
* @param other Another ResourceAttributeAssignment instance
|
|
16
|
+
* @returns true if all properties are equal
|
|
17
|
+
*/
|
|
18
|
+
equals(other: ResourceAttributeAssignment): boolean;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=resource-attribute-assignment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resource-attribute-assignment.d.ts","sourceRoot":"","sources":["../../src/resource-attribute-assignment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/E,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAEtE,qBAAa,2BAA4B,SAAQ,uBAAuB,CAAC,MAAM,EAAE,YAAY,CAAC;IAC5F,SAAgB,UAAU,EAAE,MAAM,CAAC;IACnC,SAAgB,YAAY,EAAE,YAAY,CAAC;gBAE/B,UAAU,EAAE,MAAM,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM;IAcxG,oBAAoB;;;;;;IAQpB;;;;OAIG;IACH,MAAM,CAAC,KAAK,EAAE,2BAA2B,GAAG,OAAO;CAGpD"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { RESOURCE_TYPES } from './resource-attributes-constants.mjs';
|
|
2
|
+
import { BaseAttributeAssignment } from './base-attribute-assignment.mjs';
|
|
3
|
+
|
|
4
|
+
class ResourceAttributeAssignment extends BaseAttributeAssignment {
|
|
5
|
+
resourceId;
|
|
6
|
+
resourceType;
|
|
7
|
+
constructor(resourceId, resourceType, attributeKey, attributeValue) {
|
|
8
|
+
super(resourceId, resourceType, attributeKey, attributeValue, Object.values(RESOURCE_TYPES), 'resourceId', 'resourceType');
|
|
9
|
+
this.resourceId = resourceId;
|
|
10
|
+
this.resourceType = this.type;
|
|
11
|
+
}
|
|
12
|
+
toDataTransferObject() {
|
|
13
|
+
return {
|
|
14
|
+
resourceId: this.resourceId,
|
|
15
|
+
resourceType: this.resourceType,
|
|
16
|
+
key: this.attributeKey,
|
|
17
|
+
value: this.attributeValue,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Compares two assignments for equality
|
|
22
|
+
* @param other Another ResourceAttributeAssignment instance
|
|
23
|
+
* @returns true if all properties are equal
|
|
24
|
+
*/
|
|
25
|
+
equals(other) {
|
|
26
|
+
return super.equals(other);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export { ResourceAttributeAssignment };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export declare const RESOURCE_ATTRIBUTES_CONSTANTS: {
|
|
2
|
+
readonly ACCOUNT_RESOURCE_ATTRIBUTES: {
|
|
3
|
+
readonly ENABLE_MEMBERS_INVITE_FROM_NON_AUTH_DOMAIN: "enable_members_invite_from_non_auth_domain";
|
|
4
|
+
};
|
|
5
|
+
readonly WORKSPACE_RESOURCE_ATTRIBUTES: {
|
|
6
|
+
readonly IS_DEFAULT_WORKSPACE: "is_default_workspace";
|
|
7
|
+
};
|
|
8
|
+
readonly BOARD_RESOURCE_ATTRIBUTES: {
|
|
9
|
+
readonly IS_SYNCABLE_CHILD_ENTITY: "is_syncable_child_entity";
|
|
10
|
+
readonly SYSTEM_ENTITY_TYPE: "system_entity_type";
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
export declare enum ResourceType {
|
|
14
|
+
Account = "account",
|
|
15
|
+
AccountProduct = "account_product",
|
|
16
|
+
Workspace = "workspace",
|
|
17
|
+
Board = "board",
|
|
18
|
+
Item = "item",
|
|
19
|
+
Team = "team",
|
|
20
|
+
Overview = "overview",
|
|
21
|
+
Document = "document",
|
|
22
|
+
Crm = "crm"
|
|
23
|
+
}
|
|
24
|
+
export declare const RESOURCE_TYPES: readonly ResourceType[];
|
|
25
|
+
//# sourceMappingURL=resource-attributes-constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resource-attributes-constants.d.ts","sourceRoot":"","sources":["../../src/resource-attributes-constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,6BAA6B;;;;;;;;;;;CAWhC,CAAC;AAEX,oBAAY,YAAY;IACtB,OAAO,YAAY;IACnB,cAAc,oBAAoB;IAClC,SAAS,cAAc;IACvB,KAAK,UAAU;IACf,IAAI,SAAS;IACb,IAAI,SAAS;IACb,QAAQ,aAAa;IACrB,QAAQ,aAAa;IACrB,GAAG,QAAQ;CACZ;AAGD,eAAO,MAAM,cAAc,yBAA6C,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
const RESOURCE_ATTRIBUTES_CONSTANTS = {
|
|
2
|
+
ACCOUNT_RESOURCE_ATTRIBUTES: {
|
|
3
|
+
ENABLE_MEMBERS_INVITE_FROM_NON_AUTH_DOMAIN: 'enable_members_invite_from_non_auth_domain',
|
|
4
|
+
},
|
|
5
|
+
WORKSPACE_RESOURCE_ATTRIBUTES: {
|
|
6
|
+
IS_DEFAULT_WORKSPACE: 'is_default_workspace',
|
|
7
|
+
},
|
|
8
|
+
BOARD_RESOURCE_ATTRIBUTES: {
|
|
9
|
+
IS_SYNCABLE_CHILD_ENTITY: 'is_syncable_child_entity',
|
|
10
|
+
SYSTEM_ENTITY_TYPE: 'system_entity_type',
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
var ResourceType;
|
|
14
|
+
(function (ResourceType) {
|
|
15
|
+
ResourceType["Account"] = "account";
|
|
16
|
+
ResourceType["AccountProduct"] = "account_product";
|
|
17
|
+
ResourceType["Workspace"] = "workspace";
|
|
18
|
+
ResourceType["Board"] = "board";
|
|
19
|
+
ResourceType["Item"] = "item";
|
|
20
|
+
ResourceType["Team"] = "team";
|
|
21
|
+
ResourceType["Overview"] = "overview";
|
|
22
|
+
ResourceType["Document"] = "document";
|
|
23
|
+
ResourceType["Crm"] = "crm";
|
|
24
|
+
})(ResourceType || (ResourceType = {}));
|
|
25
|
+
// Define the array of strings and use 'as const' to make its contents literal types
|
|
26
|
+
const RESOURCE_TYPES = Object.freeze(Object.values(ResourceType));
|
|
27
|
+
|
|
28
|
+
export { RESOURCE_ATTRIBUTES_CONSTANTS, RESOURCE_TYPES, ResourceType };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BaseRequest, BaseResponse, ContextGetter, Resource, ResourceGetter } from '../types/general';
|
|
2
2
|
import type { NextFunction } from 'express';
|
|
3
3
|
export type TestPermittedAction = {
|
|
4
4
|
accountId: number;
|
|
5
5
|
userId: number;
|
|
6
6
|
resources: Resource[];
|
|
7
|
-
action:
|
|
7
|
+
action: string;
|
|
8
8
|
};
|
|
9
|
-
export declare const addTestPermittedAction: (accountId: number, userId: number, resources: Resource[], action:
|
|
9
|
+
export declare const addTestPermittedAction: (accountId: number, userId: number, resources: Resource[], action: string) => void;
|
|
10
10
|
export declare const clearTestPermittedActions: () => void;
|
|
11
|
-
export declare const getTestAuthorizationMiddleware: (action:
|
|
11
|
+
export declare const getTestAuthorizationMiddleware: (action: string, resourceGetter: ResourceGetter, contextGetter?: ContextGetter) => (request: BaseRequest, response: BaseResponse, next: NextFunction) => Promise<void>;
|
|
12
12
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/testKit/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/testKit/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,aAAa,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGtG,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C,MAAM,MAAM,mBAAmB,GAAG;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,QAAQ,EAAE,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAGF,eAAO,MAAM,sBAAsB,GAAI,WAAW,MAAM,EAAE,QAAQ,MAAM,EAAE,WAAW,QAAQ,EAAE,EAAE,QAAQ,MAAM,SAE9G,CAAC;AAEF,eAAO,MAAM,yBAAyB,YAErC,CAAC;AA4BF,eAAO,MAAM,8BAA8B,GACzC,QAAQ,MAAM,EACd,gBAAgB,cAAc,EAC9B,gBAAgB,aAAa,MAG3B,SAAS,WAAW,EACpB,UAAU,YAAY,EACtB,MAAM,YAAY,KACjB,OAAO,CAAC,IAAI,CAYhB,CAAC"}
|
|
@@ -1,28 +1,43 @@
|
|
|
1
1
|
import { Resource } from './general';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import type { EntityType } from '../entity-attributes-constants';
|
|
3
|
+
import type { ResourceType } from '../resource-attributes-constants';
|
|
4
|
+
interface AttributeAssignment {
|
|
5
5
|
key: string;
|
|
6
6
|
value: string;
|
|
7
7
|
}
|
|
8
|
-
export interface
|
|
9
|
-
|
|
8
|
+
export interface ResourceAttributeAssignment extends AttributeAssignment {
|
|
9
|
+
resourceId: number;
|
|
10
|
+
resourceType: ResourceType;
|
|
11
|
+
}
|
|
12
|
+
export interface EntityAttributeAssignment extends AttributeAssignment {
|
|
13
|
+
entityId: number;
|
|
14
|
+
entityType: EntityType;
|
|
10
15
|
}
|
|
11
16
|
export interface ResourceAttributeDelete {
|
|
12
17
|
resourceType: Resource['type'];
|
|
13
18
|
resourceId: Resource['id'];
|
|
14
19
|
key: string;
|
|
15
20
|
}
|
|
16
|
-
export
|
|
21
|
+
export interface EntityAttributeDelete {
|
|
22
|
+
entityType: EntityType;
|
|
23
|
+
entityId: number;
|
|
24
|
+
key: string;
|
|
25
|
+
}
|
|
26
|
+
export declare enum AttributeOperation {
|
|
17
27
|
UPSERT = "upsert",
|
|
18
28
|
DELETE = "delete"
|
|
19
29
|
}
|
|
20
|
-
interface
|
|
21
|
-
|
|
30
|
+
export interface ResourceAttributeResponse {
|
|
31
|
+
attributes: ResourceAttributeAssignment[];
|
|
32
|
+
}
|
|
33
|
+
export interface EntityAttributeResponse {
|
|
34
|
+
attributes: EntityAttributeAssignment[];
|
|
35
|
+
}
|
|
36
|
+
export interface ResourceAttributeOperation extends ResourceAttributeAssignment {
|
|
37
|
+
operationType: AttributeOperation;
|
|
22
38
|
}
|
|
23
|
-
interface
|
|
24
|
-
operationType:
|
|
39
|
+
export interface EntityAttributeOperation extends EntityAttributeAssignment {
|
|
40
|
+
operationType: AttributeOperation;
|
|
25
41
|
}
|
|
26
|
-
export type ResourceAttributesOperation = UpsertResourceAttributeOperation | DeleteResourceAttributeOperation;
|
|
27
42
|
export {};
|
|
28
43
|
//# sourceMappingURL=authorization-attributes-contracts.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authorization-attributes-contracts.d.ts","sourceRoot":"","sources":["../../../src/types/authorization-attributes-contracts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"authorization-attributes-contracts.d.ts","sourceRoot":"","sources":["../../../src/types/authorization-attributes-contracts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAErE,UAAU,mBAAmB;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;CACf;AAGD,MAAM,WAAW,2BAA4B,SAAQ,mBAAmB;IACtE,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,YAAY,CAAC;CAC5B;AAID,MAAM,WAAW,yBAA0B,SAAQ,mBAAmB;IACpE,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,UAAU,CAAC;CACxB;AAGD,MAAM,WAAW,uBAAuB;IACtC,YAAY,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC/B,UAAU,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC3B,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,qBAAqB;IACpC,UAAU,EAAE,UAAU,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;CACb;AAED,oBAAY,kBAAkB;IAC5B,MAAM,WAAW;IACjB,MAAM,WAAW;CAClB;AAGD,MAAM,WAAW,yBAAyB;IACxC,UAAU,EAAE,2BAA2B,EAAE,CAAC;CAC3C;AAED,MAAM,WAAW,uBAAuB;IACtC,UAAU,EAAE,yBAAyB,EAAE,CAAC;CACzC;AAED,MAAM,WAAW,0BAA2B,SAAQ,2BAA2B;IAC7E,aAAa,EAAE,kBAAkB,CAAC;CACnC;AAED,MAAM,WAAW,wBAAyB,SAAQ,yBAAyB;IACzE,aAAa,EAAE,kBAAkB,CAAC;CACnC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
var
|
|
2
|
-
(function (
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
})(
|
|
1
|
+
var AttributeOperation;
|
|
2
|
+
(function (AttributeOperation) {
|
|
3
|
+
AttributeOperation["UPSERT"] = "upsert";
|
|
4
|
+
AttributeOperation["DELETE"] = "delete";
|
|
5
|
+
})(AttributeOperation || (AttributeOperation = {}));
|
|
6
6
|
|
|
7
|
-
export {
|
|
7
|
+
export { AttributeOperation };
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { ResourceAttributeAssignment as ResourceAttributeAssignmentContract, EntityAttributeAssignment as EntityAttributeAssignmentContract, ResourceAttributeOperation, EntityAttributeOperation } from './authorization-attributes-contracts';
|
|
2
|
+
import { ResourceAttributeAssignment } from '../resource-attribute-assignment';
|
|
3
|
+
import { EntityAttributeAssignment } from '../entity-attribute-assignment';
|
|
4
|
+
import { Resource } from './general';
|
|
5
|
+
import { EntityType } from '../entity-attributes-constants';
|
|
6
|
+
/**
|
|
7
|
+
* Resource type compatible with both MS and SNS services
|
|
8
|
+
*/
|
|
9
|
+
export interface CompatibleResource {
|
|
10
|
+
resourceType?: string;
|
|
11
|
+
resourceId?: number;
|
|
12
|
+
type?: string;
|
|
13
|
+
id?: number;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Interface for authorization attributes operations.
|
|
17
|
+
* Both MS (direct) and SNS (async) services implement this interface.
|
|
18
|
+
*/
|
|
19
|
+
export interface AuthorizationAttributesService {
|
|
20
|
+
/**authorization-attributes-service.ts
|
|
21
|
+
* Upserts resource attributes.
|
|
22
|
+
* For MS service: returns Promise<void>
|
|
23
|
+
* For SNS service: requires appName and callerActionIdentifier, returns Promise<ResourceAttributesOperation[]>
|
|
24
|
+
*/
|
|
25
|
+
upsertResourceAttributes(accountId: number, resourceAttributeAssignments: ResourceAttributeAssignment[] | ResourceAttributeAssignmentContract[], appName?: string, callerActionIdentifier?: string): Promise<void | ResourceAttributeOperation[]>;
|
|
26
|
+
/**
|
|
27
|
+
* Deletes resource attributes.
|
|
28
|
+
* For MS service: returns Promise<void>
|
|
29
|
+
* For SNS service: requires appName and callerActionIdentifier, returns Promise<ResourceAttributesOperation[]>
|
|
30
|
+
*/
|
|
31
|
+
deleteResourceAttributes(accountId: number, resource: CompatibleResource | Resource, attributeKeys: string[], appName?: string, callerActionIdentifier?: string): Promise<void | ResourceAttributeOperation[]>;
|
|
32
|
+
/**
|
|
33
|
+
* Upserts entity attributes.
|
|
34
|
+
* For MS service: returns Promise<void>
|
|
35
|
+
* For SNS service: requires appName and callerActionIdentifier, returns Promise<EntityAttributesOperation[]>
|
|
36
|
+
*/
|
|
37
|
+
upsertEntityAttributes(accountId: number, entityAttributeAssignments: EntityAttributeAssignment[] | EntityAttributeAssignmentContract[], appName?: string, callerActionIdentifier?: string): Promise<void | EntityAttributeOperation[]>;
|
|
38
|
+
/**
|
|
39
|
+
* Deletes entity attributes.
|
|
40
|
+
* For MS service: returns Promise<void>
|
|
41
|
+
* For SNS service: requires appName and callerActionIdentifier, returns Promise<EntityAttributesOperation[]>
|
|
42
|
+
*/
|
|
43
|
+
deleteEntityAttributes(accountId: number, entityType: EntityType | string, entityId: number, attributeKeys: string[], appName?: string, callerActionIdentifier?: string): Promise<void | EntityAttributeOperation[]>;
|
|
44
|
+
/**
|
|
45
|
+
* Updates resource attributes (batch operations).
|
|
46
|
+
* For MS service: may throw error or delegate to upsert/delete
|
|
47
|
+
* For SNS service: returns Promise<ResourceAttributesOperation[]>
|
|
48
|
+
*/
|
|
49
|
+
updateResourceAttributes(accountId: number, appName: string, callerActionIdentifier: string, resourceAttributeOperations: ResourceAttributeOperation[]): Promise<ResourceAttributeOperation[]>;
|
|
50
|
+
/**
|
|
51
|
+
* Updates entity attributes (batch operations).
|
|
52
|
+
* For MS service: may throw error or delegate to upsert/delete
|
|
53
|
+
* For SNS service: returns Promise<EntityAttributesOperation[]>
|
|
54
|
+
*/
|
|
55
|
+
updateEntityAttributes(accountId: number, appName: string, callerActionIdentifier: string, entityAttributeOperations: EntityAttributeOperation[]): Promise<EntityAttributeOperation[]>;
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=authorization-attributes-service.interface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authorization-attributes-service.interface.d.ts","sourceRoot":"","sources":["../../../src/types/authorization-attributes-service.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,2BAA2B,IAAI,mCAAmC,EAClE,yBAAyB,IAAI,iCAAiC,EAC9D,0BAA0B,EAC1B,wBAAwB,EACzB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAC;AAC/E,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAE5D;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAED;;;GAGG;AACH,MAAM,WAAW,8BAA8B;IAC7C;;;;OAIG;IACH,wBAAwB,CACtB,SAAS,EAAE,MAAM,EACjB,4BAA4B,EAAE,2BAA2B,EAAE,GAAG,mCAAmC,EAAE,EACnG,OAAO,CAAC,EAAE,MAAM,EAChB,sBAAsB,CAAC,EAAE,MAAM,GAC9B,OAAO,CAAC,IAAI,GAAG,0BAA0B,EAAE,CAAC,CAAC;IAEhD;;;;OAIG;IACH,wBAAwB,CACtB,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,kBAAkB,GAAG,QAAQ,EACvC,aAAa,EAAE,MAAM,EAAE,EACvB,OAAO,CAAC,EAAE,MAAM,EAChB,sBAAsB,CAAC,EAAE,MAAM,GAC9B,OAAO,CAAC,IAAI,GAAG,0BAA0B,EAAE,CAAC,CAAC;IAEhD;;;;OAIG;IACH,sBAAsB,CACpB,SAAS,EAAE,MAAM,EACjB,0BAA0B,EAAE,yBAAyB,EAAE,GAAG,iCAAiC,EAAE,EAC7F,OAAO,CAAC,EAAE,MAAM,EAChB,sBAAsB,CAAC,EAAE,MAAM,GAC9B,OAAO,CAAC,IAAI,GAAG,wBAAwB,EAAE,CAAC,CAAC;IAE9C;;;;OAIG;IACH,sBAAsB,CACpB,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,UAAU,GAAG,MAAM,EAC/B,QAAQ,EAAE,MAAM,EAChB,aAAa,EAAE,MAAM,EAAE,EACvB,OAAO,CAAC,EAAE,MAAM,EAChB,sBAAsB,CAAC,EAAE,MAAM,GAC9B,OAAO,CAAC,IAAI,GAAG,wBAAwB,EAAE,CAAC,CAAC;IAE9C;;;;OAIG;IACH,wBAAwB,CACtB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,EACf,sBAAsB,EAAE,MAAM,EAC9B,2BAA2B,EAAE,0BAA0B,EAAE,GACxD,OAAO,CAAC,0BAA0B,EAAE,CAAC,CAAC;IAEzC;;;;OAIG;IACH,sBAAsB,CACpB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,EACf,sBAAsB,EAAE,MAAM,EAC9B,yBAAyB,EAAE,wBAAwB,EAAE,GACpD,OAAO,CAAC,wBAAwB,EAAE,CAAC,CAAC;CACxC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Resource } from '../types/general';
|
|
2
|
+
/**
|
|
3
|
+
* Utility class for common validation operations using AJV
|
|
4
|
+
*/
|
|
5
|
+
export declare class ValidationUtils {
|
|
6
|
+
private static ajv;
|
|
7
|
+
/**
|
|
8
|
+
* Validates that a value is an integer. Throws ArgumentError with a descriptive message on failure.
|
|
9
|
+
*/
|
|
10
|
+
static validateInteger(value: number): void;
|
|
11
|
+
/**
|
|
12
|
+
* Validates that a value is a non-empty string. Throws ArgumentError on failure.
|
|
13
|
+
*/
|
|
14
|
+
static validateString(value: string): void;
|
|
15
|
+
/**
|
|
16
|
+
* Validates that a value is an array of non-empty strings. Throws ArgumentError on failure.
|
|
17
|
+
* Allows empty arrays - caller should handle early return.
|
|
18
|
+
*/
|
|
19
|
+
static validateStringArray(value: string[]): void;
|
|
20
|
+
/**
|
|
21
|
+
* Validates an attribute assignment object using a single AJV schema.
|
|
22
|
+
* Preserves legacy error messages for each field.
|
|
23
|
+
*/
|
|
24
|
+
static validateAssignment<TType extends string>(data: {
|
|
25
|
+
id: any;
|
|
26
|
+
type: string;
|
|
27
|
+
attributeKey: any;
|
|
28
|
+
attributeValue: any;
|
|
29
|
+
}, validTypes: readonly TType[], fieldNames: {
|
|
30
|
+
id: string;
|
|
31
|
+
type: string;
|
|
32
|
+
}): {
|
|
33
|
+
id: number;
|
|
34
|
+
type: TType;
|
|
35
|
+
attributeKey: string;
|
|
36
|
+
attributeValue: string;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Validates a Resource-like object shape: { id: number; type: string }.
|
|
40
|
+
* Throws ArgumentError with legacy-compatible messages.
|
|
41
|
+
*/
|
|
42
|
+
static validateResource(resource: Resource): void;
|
|
43
|
+
static validateArrayTypeOf<T>(attributesMessages: T[], messageClass: abstract new (...args: any[]) => T): void;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=validation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../../src/utils/validation.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C;;GAEG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,MAAM,CAAC,GAAG,CAAgC;IAClD;;OAEG;IACH,MAAM,CAAC,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAS3C;;OAEG;IACH,MAAM,CAAC,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAa1C;;;OAGG;IACH,MAAM,CAAC,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI;IAkBjD;;;OAGG;IACH,MAAM,CAAC,kBAAkB,CAAC,KAAK,SAAS,MAAM,EAC5C,IAAI,EAAE;QAAE,EAAE,EAAE,GAAG,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,GAAG,CAAC;QAAC,cAAc,EAAE,GAAG,CAAA;KAAE,EACvE,UAAU,EAAE,SAAS,KAAK,EAAE,EAC5B,UAAU,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,GACvC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,KAAK,CAAC;QAAC,YAAY,EAAE,MAAM,CAAC;QAAC,cAAc,EAAE,MAAM,CAAA;KAAE;IA0D5E;;;OAGG;IACH,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI;IAqBjD,MAAM,CAAC,mBAAmB,CAAC,CAAC,EAAE,kBAAkB,EAAE,CAAC,EAAE,EAAE,YAAY,EAAE,QAAQ,MAAM,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,IAAI;CAoB/G"}
|