@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.
Files changed (126) hide show
  1. package/dist/authorization-attributes-ms-service.d.ts +95 -0
  2. package/dist/authorization-attributes-ms-service.d.ts.map +1 -0
  3. package/dist/authorization-attributes-ms-service.js +362 -0
  4. package/dist/authorization-attributes-service.d.ts +26 -47
  5. package/dist/authorization-attributes-service.d.ts.map +1 -1
  6. package/dist/authorization-attributes-service.js +33 -171
  7. package/dist/authorization-attributes-sns-service.d.ts +91 -0
  8. package/dist/authorization-attributes-sns-service.d.ts.map +1 -0
  9. package/dist/authorization-attributes-sns-service.js +217 -0
  10. package/dist/authorization-middleware.d.ts +2 -2
  11. package/dist/authorization-middleware.d.ts.map +1 -1
  12. package/dist/authorization-service.d.ts +3 -3
  13. package/dist/authorization-service.d.ts.map +1 -1
  14. package/dist/authorization-service.js +7 -34
  15. package/dist/base-attribute-assignment.d.ts +18 -0
  16. package/dist/base-attribute-assignment.d.ts.map +1 -0
  17. package/dist/base-attribute-assignment.js +43 -0
  18. package/dist/constants/sns.d.ts +12 -2
  19. package/dist/constants/sns.d.ts.map +1 -1
  20. package/dist/constants/sns.js +22 -2
  21. package/dist/entity-attribute-assignment.d.ts +14 -0
  22. package/dist/entity-attribute-assignment.d.ts.map +1 -0
  23. package/dist/entity-attribute-assignment.js +24 -0
  24. package/dist/entity-attributes-constants.d.ts +7 -0
  25. package/dist/entity-attributes-constants.d.ts.map +1 -0
  26. package/dist/entity-attributes-constants.js +9 -0
  27. package/dist/errors/argument-error.d.ts +4 -0
  28. package/dist/errors/argument-error.d.ts.map +1 -0
  29. package/dist/errors/argument-error.js +11 -0
  30. package/dist/esm/authorization-attributes-ms-service.d.ts +95 -0
  31. package/dist/esm/authorization-attributes-ms-service.d.ts.map +1 -0
  32. package/dist/esm/authorization-attributes-ms-service.mjs +360 -0
  33. package/dist/esm/authorization-attributes-service.d.ts +26 -47
  34. package/dist/esm/authorization-attributes-service.d.ts.map +1 -1
  35. package/dist/esm/authorization-attributes-service.mjs +33 -167
  36. package/dist/esm/authorization-attributes-sns-service.d.ts +91 -0
  37. package/dist/esm/authorization-attributes-sns-service.d.ts.map +1 -0
  38. package/dist/esm/authorization-attributes-sns-service.mjs +211 -0
  39. package/dist/esm/authorization-middleware.d.ts +2 -2
  40. package/dist/esm/authorization-middleware.d.ts.map +1 -1
  41. package/dist/esm/authorization-service.d.ts +3 -3
  42. package/dist/esm/authorization-service.d.ts.map +1 -1
  43. package/dist/esm/authorization-service.mjs +7 -34
  44. package/dist/esm/base-attribute-assignment.d.ts +18 -0
  45. package/dist/esm/base-attribute-assignment.d.ts.map +1 -0
  46. package/dist/esm/base-attribute-assignment.mjs +41 -0
  47. package/dist/esm/constants/sns.d.ts +12 -2
  48. package/dist/esm/constants/sns.d.ts.map +1 -1
  49. package/dist/esm/constants/sns.mjs +17 -3
  50. package/dist/esm/entity-attribute-assignment.d.ts +14 -0
  51. package/dist/esm/entity-attribute-assignment.d.ts.map +1 -0
  52. package/dist/esm/entity-attribute-assignment.mjs +22 -0
  53. package/dist/esm/entity-attributes-constants.d.ts +7 -0
  54. package/dist/esm/entity-attributes-constants.d.ts.map +1 -0
  55. package/dist/esm/entity-attributes-constants.mjs +7 -0
  56. package/dist/esm/errors/argument-error.d.ts +4 -0
  57. package/dist/esm/errors/argument-error.d.ts.map +1 -0
  58. package/dist/esm/errors/argument-error.mjs +9 -0
  59. package/dist/esm/index.d.ts +9 -0
  60. package/dist/esm/index.d.ts.map +1 -1
  61. package/dist/esm/index.mjs +7 -0
  62. package/dist/esm/prometheus-service.d.ts +1 -2
  63. package/dist/esm/prometheus-service.d.ts.map +1 -1
  64. package/dist/esm/resource-attribute-assignment.d.ts +24 -0
  65. package/dist/esm/resource-attribute-assignment.d.ts.map +1 -0
  66. package/dist/esm/resource-attribute-assignment.mjs +34 -0
  67. package/dist/esm/resource-attributes-constants.d.ts +15 -0
  68. package/dist/esm/resource-attributes-constants.d.ts.map +1 -0
  69. package/dist/esm/resource-attributes-constants.mjs +25 -0
  70. package/dist/esm/testKit/index.d.ts +4 -4
  71. package/dist/esm/testKit/index.d.ts.map +1 -1
  72. package/dist/esm/types/authorization-attributes-contracts.d.ts +27 -12
  73. package/dist/esm/types/authorization-attributes-contracts.d.ts.map +1 -1
  74. package/dist/esm/types/authorization-attributes-contracts.mjs +6 -6
  75. package/dist/esm/types/authorization-attributes-service.interface.d.ts +57 -0
  76. package/dist/esm/types/authorization-attributes-service.interface.d.ts.map +1 -0
  77. package/dist/esm/types/authorization-attributes-service.interface.mjs +1 -0
  78. package/dist/esm/types/general.d.ts +1 -2
  79. package/dist/esm/types/general.d.ts.map +1 -1
  80. package/dist/esm/utils/validation.d.ts +45 -0
  81. package/dist/esm/utils/validation.d.ts.map +1 -0
  82. package/dist/esm/utils/validation.mjs +117 -0
  83. package/dist/index.d.ts +9 -0
  84. package/dist/index.d.ts.map +1 -1
  85. package/dist/index.js +15 -0
  86. package/dist/prometheus-service.d.ts +1 -2
  87. package/dist/prometheus-service.d.ts.map +1 -1
  88. package/dist/resource-attribute-assignment.d.ts +24 -0
  89. package/dist/resource-attribute-assignment.d.ts.map +1 -0
  90. package/dist/resource-attribute-assignment.js +36 -0
  91. package/dist/resource-attributes-constants.d.ts +15 -0
  92. package/dist/resource-attributes-constants.d.ts.map +1 -0
  93. package/dist/resource-attributes-constants.js +28 -0
  94. package/dist/testKit/index.d.ts +4 -4
  95. package/dist/testKit/index.d.ts.map +1 -1
  96. package/dist/types/authorization-attributes-contracts.d.ts +27 -12
  97. package/dist/types/authorization-attributes-contracts.d.ts.map +1 -1
  98. package/dist/types/authorization-attributes-contracts.js +5 -5
  99. package/dist/types/authorization-attributes-service.interface.d.ts +57 -0
  100. package/dist/types/authorization-attributes-service.interface.d.ts.map +1 -0
  101. package/dist/types/authorization-attributes-service.interface.js +1 -0
  102. package/dist/types/general.d.ts +1 -2
  103. package/dist/types/general.d.ts.map +1 -1
  104. package/dist/utils/validation.d.ts +45 -0
  105. package/dist/utils/validation.d.ts.map +1 -0
  106. package/dist/utils/validation.js +119 -0
  107. package/package.json +3 -2
  108. package/src/authorization-attributes-ms-service.ts +528 -0
  109. package/src/authorization-attributes-service.ts +35 -222
  110. package/src/authorization-attributes-sns-service.ts +312 -0
  111. package/src/authorization-middleware.ts +2 -2
  112. package/src/authorization-service.ts +15 -75
  113. package/src/base-attribute-assignment.ts +55 -0
  114. package/src/constants/sns.ts +19 -2
  115. package/src/entity-attribute-assignment.ts +21 -0
  116. package/src/entity-attributes-constants.ts +7 -0
  117. package/src/errors/argument-error.ts +7 -0
  118. package/src/index.ts +9 -0
  119. package/src/prometheus-service.ts +1 -2
  120. package/src/resource-attribute-assignment.ts +43 -0
  121. package/src/resource-attributes-constants.ts +35 -0
  122. package/src/testKit/index.ts +5 -5
  123. package/src/types/authorization-attributes-contracts.ts +36 -11
  124. package/src/types/authorization-attributes-service.interface.ts +100 -0
  125. package/src/types/general.ts +3 -2
  126. 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
- const allowedProfiles = this.igniteClient.configuration.getObjectValue(ALLOWED_SDK_PLATFORM_PROFILES_KEY, []);
100
- const isAllowedProfile = allowedProfiles.includes(appName);
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
- const inReleaseProfiles = this.igniteClient.configuration.getObjectValue(IN_RELEASE_SDK_PLATFORM_PROFILES_KEY, []);
108
- const isInReleaseProfile = inReleaseProfiles.includes(appName);
109
- const isFeatureFlagReleased = this.igniteClient.isReleased(PLATFORM_PROFILE_RELEASE_FF, { accountId, userId });
110
- authorizationInternalService.logger.error({
111
- tag: 'auth-debug',
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;
@@ -1,5 +1,15 @@
1
- export declare const SNS_ARN_ENV_VAR_NAME = "SHARED_AUTHORIZATION_SNS_ENDPOINT_RESOURCE_ATTRIBUTES";
2
- export declare const SNS_DEV_TEST_NAME = "arn:aws:sns:us-east-1:000000000000:monday-authorization-resource-attributes-sns-local";
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,oBAAoB,0DAA0D,CAAC;AAC5F,eAAO,MAAM,iBAAiB,0FAC2D,CAAC;AAC1F,eAAO,MAAM,qDAAqD,kCAAkC,CAAC;AACrG,eAAO,MAAM,oDAAoD,MAAM,CAAC"}
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,11 +1,31 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
- const SNS_ARN_ENV_VAR_NAME = 'SHARED_AUTHORIZATION_SNS_ENDPOINT_RESOURCE_ATTRIBUTES';
4
- const SNS_DEV_TEST_NAME = 'arn:aws:sns:us-east-1:000000000000:monday-authorization-resource-attributes-sns-local';
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,7 @@
1
+ export declare const ENTITY_TYPES: {
2
+ readonly USER: "user";
3
+ readonly TEAM: "team";
4
+ readonly ACCOUNT: "account";
5
+ };
6
+ export type EntityType = (typeof ENTITY_TYPES)[keyof typeof ENTITY_TYPES];
7
+ //# sourceMappingURL=entity-attributes-constants.d.ts.map
@@ -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,9 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+
3
+ const ENTITY_TYPES = {
4
+ USER: 'user',
5
+ TEAM: 'team',
6
+ ACCOUNT: 'account',
7
+ };
8
+
9
+ exports.ENTITY_TYPES = ENTITY_TYPES;
@@ -0,0 +1,4 @@
1
+ export declare class ArgumentError extends Error {
2
+ constructor(message: string);
3
+ }
4
+ //# sourceMappingURL=argument-error.d.ts.map
@@ -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"}