@mondaydotcomorg/monday-authorization 3.5.0-upgrade-observability-kit-2ebbd01 → 3.5.1-feat-shaime-support-entity-attributes-in-authorization-sdk-59162a3

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 (121) hide show
  1. package/dist/attributions-service.d.ts.map +1 -1
  2. package/dist/attributions-service.js +1 -0
  3. package/dist/authorization-attributes-ms-service.d.ts +67 -0
  4. package/dist/authorization-attributes-ms-service.d.ts.map +1 -0
  5. package/dist/authorization-attributes-ms-service.js +256 -0
  6. package/dist/authorization-attributes-sns-service.d.ts +85 -0
  7. package/dist/authorization-attributes-sns-service.d.ts.map +1 -0
  8. package/dist/authorization-attributes-sns-service.js +203 -0
  9. package/dist/base-attribute-assignment.d.ts +18 -0
  10. package/dist/base-attribute-assignment.d.ts.map +1 -0
  11. package/dist/base-attribute-assignment.js +43 -0
  12. package/dist/clients/graph-api.d.ts.map +1 -1
  13. package/dist/clients/graph-api.js +1 -0
  14. package/dist/constants/sns.d.ts +12 -2
  15. package/dist/constants/sns.d.ts.map +1 -1
  16. package/dist/constants/sns.js +22 -2
  17. package/dist/constants.d.ts +3 -0
  18. package/dist/constants.d.ts.map +1 -1
  19. package/dist/constants.js +4 -0
  20. package/dist/entity-attribute-assignment.d.ts +24 -0
  21. package/dist/entity-attribute-assignment.d.ts.map +1 -0
  22. package/dist/entity-attribute-assignment.js +36 -0
  23. package/dist/entity-attributes-constants.d.ts +7 -0
  24. package/dist/entity-attributes-constants.d.ts.map +1 -0
  25. package/dist/entity-attributes-constants.js +9 -0
  26. package/dist/errors/argument-error.d.ts +4 -0
  27. package/dist/errors/argument-error.d.ts.map +1 -0
  28. package/dist/errors/argument-error.js +11 -0
  29. package/dist/esm/attributions-service.d.ts.map +1 -1
  30. package/dist/esm/attributions-service.mjs +1 -0
  31. package/dist/esm/authorization-attributes-ms-service.d.ts +67 -0
  32. package/dist/esm/authorization-attributes-ms-service.d.ts.map +1 -0
  33. package/dist/esm/authorization-attributes-ms-service.mjs +254 -0
  34. package/dist/esm/authorization-attributes-sns-service.d.ts +85 -0
  35. package/dist/esm/authorization-attributes-sns-service.d.ts.map +1 -0
  36. package/dist/esm/authorization-attributes-sns-service.mjs +197 -0
  37. package/dist/esm/base-attribute-assignment.d.ts +18 -0
  38. package/dist/esm/base-attribute-assignment.d.ts.map +1 -0
  39. package/dist/esm/base-attribute-assignment.mjs +41 -0
  40. package/dist/esm/clients/graph-api.d.ts.map +1 -1
  41. package/dist/esm/clients/graph-api.mjs +2 -1
  42. package/dist/esm/constants/sns.d.ts +12 -2
  43. package/dist/esm/constants/sns.d.ts.map +1 -1
  44. package/dist/esm/constants/sns.mjs +17 -3
  45. package/dist/esm/constants.d.ts +3 -0
  46. package/dist/esm/constants.d.ts.map +1 -1
  47. package/dist/esm/constants.mjs +5 -1
  48. package/dist/esm/entity-attribute-assignment.d.ts +24 -0
  49. package/dist/esm/entity-attribute-assignment.d.ts.map +1 -0
  50. package/dist/esm/entity-attribute-assignment.mjs +34 -0
  51. package/dist/esm/entity-attributes-constants.d.ts +7 -0
  52. package/dist/esm/entity-attributes-constants.d.ts.map +1 -0
  53. package/dist/esm/entity-attributes-constants.mjs +7 -0
  54. package/dist/esm/errors/argument-error.d.ts +4 -0
  55. package/dist/esm/errors/argument-error.d.ts.map +1 -0
  56. package/dist/esm/errors/argument-error.mjs +9 -0
  57. package/dist/esm/index.d.ts +9 -1
  58. package/dist/esm/index.d.ts.map +1 -1
  59. package/dist/esm/index.mjs +7 -1
  60. package/dist/esm/resource-attribute-assignment.d.ts +24 -0
  61. package/dist/esm/resource-attribute-assignment.d.ts.map +1 -0
  62. package/dist/esm/resource-attribute-assignment.mjs +34 -0
  63. package/dist/esm/resource-attributes-constants.d.ts +25 -0
  64. package/dist/esm/resource-attributes-constants.d.ts.map +1 -0
  65. package/dist/esm/resource-attributes-constants.mjs +25 -0
  66. package/dist/esm/roles-service.d.ts +1 -1
  67. package/dist/esm/roles-service.mjs +1 -1
  68. package/dist/esm/types/authorization-attributes-contracts.d.ts +36 -4
  69. package/dist/esm/types/authorization-attributes-contracts.d.ts.map +1 -1
  70. package/dist/esm/types/authorization-attributes-contracts.mjs +6 -1
  71. package/dist/esm/utils/path-utils.d.ts +8 -0
  72. package/dist/esm/utils/path-utils.d.ts.map +1 -0
  73. package/dist/esm/utils/path-utils.mjs +15 -0
  74. package/dist/esm/utils/validation.d.ts +45 -0
  75. package/dist/esm/utils/validation.d.ts.map +1 -0
  76. package/dist/esm/utils/validation.mjs +75 -0
  77. package/dist/index.d.ts +9 -1
  78. package/dist/index.d.ts.map +1 -1
  79. package/dist/index.js +15 -2
  80. package/dist/resource-attribute-assignment.d.ts +24 -0
  81. package/dist/resource-attribute-assignment.d.ts.map +1 -0
  82. package/dist/resource-attribute-assignment.js +36 -0
  83. package/dist/resource-attributes-constants.d.ts +25 -0
  84. package/dist/resource-attributes-constants.d.ts.map +1 -0
  85. package/dist/resource-attributes-constants.js +28 -0
  86. package/dist/roles-service.d.ts +1 -1
  87. package/dist/roles-service.js +1 -1
  88. package/dist/types/authorization-attributes-contracts.d.ts +36 -4
  89. package/dist/types/authorization-attributes-contracts.d.ts.map +1 -1
  90. package/dist/types/authorization-attributes-contracts.js +5 -0
  91. package/dist/utils/path-utils.d.ts +8 -0
  92. package/dist/utils/path-utils.d.ts.map +1 -0
  93. package/dist/utils/path-utils.js +17 -0
  94. package/dist/utils/validation.d.ts +45 -0
  95. package/dist/utils/validation.d.ts.map +1 -0
  96. package/dist/utils/validation.js +77 -0
  97. package/package.json +2 -2
  98. package/src/attributions-service.ts +4 -0
  99. package/src/authorization-attributes-ms-service.ts +400 -0
  100. package/src/authorization-attributes-sns-service.ts +290 -0
  101. package/src/base-attribute-assignment.ts +56 -0
  102. package/src/clients/graph-api.ts +2 -1
  103. package/src/constants/sns.ts +19 -2
  104. package/src/constants.ts +4 -0
  105. package/src/entity-attribute-assignment.ts +43 -0
  106. package/src/entity-attributes-constants.ts +7 -0
  107. package/src/errors/argument-error.ts +7 -0
  108. package/src/index.ts +18 -1
  109. package/src/resource-attribute-assignment.ts +43 -0
  110. package/src/resource-attributes-constants.ts +26 -0
  111. package/src/roles-service.ts +1 -1
  112. package/src/types/authorization-attributes-contracts.ts +56 -3
  113. package/src/utils/path-utils.ts +14 -0
  114. package/src/utils/validation.ts +84 -0
  115. package/dist/authorization-attributes-service.d.ts +0 -54
  116. package/dist/authorization-attributes-service.d.ts.map +0 -1
  117. package/dist/authorization-attributes-service.js +0 -186
  118. package/dist/esm/authorization-attributes-service.d.ts +0 -54
  119. package/dist/esm/authorization-attributes-service.d.ts.map +0 -1
  120. package/dist/esm/authorization-attributes-service.mjs +0 -180
  121. package/src/authorization-attributes-service.ts +0 -234
@@ -1 +1 @@
1
- {"version":3,"file":"attributions-service.d.ts","sourceRoot":"","sources":["../src/attributions-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAStF,oBAAY,eAAe;IACzB,YAAY,iBAAiB;IAC7B,IAAI,SAAS;IACb,QAAQ,aAAa;IACrB,GAAG,QAAQ;CACZ;AAED,wBAAgB,UAAU,mFAiBzB;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,GAAG,gBAAgB,CAEtE;AAED,wBAAgB,sBAAsB,IAAI;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,CAqClE"}
1
+ {"version":3,"file":"attributions-service.d.ts","sourceRoot":"","sources":["../src/attributions-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAStF,oBAAY,eAAe;IACzB,YAAY,iBAAiB;IAC7B,IAAI,SAAS;IACb,QAAQ,aAAa;IACrB,GAAG,QAAQ;CACZ;AAED,wBAAgB,UAAU,mFAiBzB;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,GAAG,gBAAgB,CAEtE;AAED,wBAAgB,sBAAsB,IAAI;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,CAyClE"}
@@ -46,6 +46,7 @@ function getAttributionsFromApi() {
46
46
  const { runtimeAttributions } = tridentContext;
47
47
  const runtimeAttributionsOutgoingHeaders = runtimeAttributions?.buildOutgoingHeaders('HTTP_INTERNAL');
48
48
  if (!runtimeAttributionsOutgoingHeaders) {
49
+ authorizationInternalService.logger.info({ tag: 'authorization-service', runtimeAttributionsOutgoingHeaders }, 'No runtime attributions outgoing headers');
49
50
  return callerAppNameFromSdk;
50
51
  }
51
52
  const attributionsHeaders = Object.fromEntries(runtimeAttributionsOutgoingHeaders);
@@ -0,0 +1,67 @@
1
+ import { ResourceAttributeAssignment } from './resource-attribute-assignment';
2
+ import { EntityAttributeAssignment } from './entity-attribute-assignment';
3
+ import { EntityType, EntityAttributeKeyType } from './types/authorization-attributes-contracts';
4
+ interface Resource {
5
+ resourceType: string;
6
+ resourceId: number;
7
+ }
8
+ /**
9
+ * Service class for managing resource attributes in the authorization microservice.
10
+ * Provides synchronous HTTP operations to create/update and delete attributes on resources.
11
+ */
12
+ export declare class AuthorizationAttributesMsService {
13
+ private static LOG_TAG;
14
+ /**
15
+ * Gets request headers including Authorization, Content-Type, and optional attribution headers
16
+ */
17
+ private static getRequestHeaders;
18
+ /**
19
+ * Validates that all messages are instances of the specified message class
20
+ */
21
+ private static validateMessages;
22
+ /**
23
+ * Handles request errors with consistent logging and error formatting
24
+ */
25
+ private static handleRequestError;
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
+ static upsertResourceAttributesSync(accountId: number, resourceAttributeAssignments: ResourceAttributeAssignment[]): 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
+ static deleteResourceAttributesSync(accountId: number, resource: Resource, attributeKeys: 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
+ static upsertEntityAttributesSync(accountId: number, entityAttributeAssignments: EntityAttributeAssignment[]): 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
+ static deleteEntityAttributesSync(accountId: number, entityType: EntityType, entityId: number, attributeKeys: EntityAttributeKeyType[]): Promise<void>;
65
+ }
66
+ export {};
67
+ //# 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":"AAGA,OAAO,EAAE,2BAA2B,EAAE,MAAM,iCAAiC,CAAC;AAC9E,OAAO,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAC1E,OAAO,EAAE,UAAU,EAAE,sBAAsB,EAAE,MAAM,4CAA4C,CAAC;AAchG,UAAU,QAAQ;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;CACpB;AAwBD;;;GAGG;AACH,qBAAa,gCAAgC;IAC3C,OAAO,CAAC,MAAM,CAAC,OAAO,CAAiC;IAEvD;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,iBAAiB;IA+ChC;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,gBAAgB;IAiB/B;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,kBAAkB;IAmBjC;;OAEG;mBACkB,oBAAoB;IA0EzC;;OAEG;mBACkB,oBAAoB;IAmEzC;;;;;OAKG;WACU,4BAA4B,CACvC,SAAS,EAAE,MAAM,EACjB,4BAA4B,EAAE,2BAA2B,EAAE,GAC1D,OAAO,CAAC,IAAI,CAAC;IAYhB;;;;;;OAMG;WACU,4BAA4B,CACvC,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,QAAQ,EAClB,aAAa,EAAE,MAAM,EAAE,GACtB,OAAO,CAAC,IAAI,CAAC;IAsBhB;;;;;OAKG;WACU,0BAA0B,CACrC,SAAS,EAAE,MAAM,EACjB,0BAA0B,EAAE,yBAAyB,EAAE,GACtD,OAAO,CAAC,IAAI,CAAC;IAYhB;;;;;;;OAOG;WACU,0BAA0B,CACrC,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,MAAM,EAChB,aAAa,EAAE,sBAAsB,EAAE,GACtC,OAAO,CAAC,IAAI,CAAC;CAmBjB"}
@@ -0,0 +1,256 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+
3
+ const tridentBackendApi = require('@mondaydotcomorg/trident-backend-api');
4
+ const mondayJwt = require('@mondaydotcomorg/monday-jwt');
5
+ const mondayFetchApi = require('@mondaydotcomorg/monday-fetch-api');
6
+ const resourceAttributeAssignment = require('./resource-attribute-assignment.js');
7
+ const entityAttributeAssignment = require('./entity-attribute-assignment.js');
8
+ const errors_argumentError = require('./errors/argument-error.js');
9
+ const authorizationInternalService = require('./authorization-internal-service.js');
10
+ const attributionsService = require('./attributions-service.js');
11
+ const constants = require('./constants.js');
12
+ const utils_validation = require('./utils/validation.js');
13
+ const utils_pathUtils = require('./utils/path-utils.js');
14
+
15
+ const INTERNAL_APP_NAME = 'internal_ms';
16
+ const UPSERT_RESOURCE_ATTRIBUTES_PATH = '/attributes/{accountId}/resource';
17
+ const DELETE_RESOURCE_ATTRIBUTES_PATH = '/attributes/{accountId}/resource/{resourceType}/{resourceId}';
18
+ const UPSERT_ENTITY_ATTRIBUTES_PATH = '/attributes/{accountId}/entity';
19
+ const DELETE_ENTITY_ATTRIBUTES_PATH = '/attributes/{accountId}/entity/{entityType}/{entityId}';
20
+ /**
21
+ * Service class for managing resource attributes in the authorization microservice.
22
+ * Provides synchronous HTTP operations to create/update and delete attributes on resources.
23
+ */
24
+ class AuthorizationAttributesMsService {
25
+ static LOG_TAG = 'authorization_attributes_ms';
26
+ /**
27
+ * Gets request headers including Authorization, Content-Type, and optional attribution headers
28
+ */
29
+ static getRequestHeaders(accountId, userId) {
30
+ const headers = {
31
+ 'Content-Type': 'application/json',
32
+ };
33
+ // Generate Authorization token
34
+ const authToken = mondayJwt.signAuthorizationHeader({
35
+ appName: INTERNAL_APP_NAME,
36
+ accountId,
37
+ userId,
38
+ });
39
+ headers.Authorization = authToken;
40
+ // Add attribution headers if available
41
+ const attributionHeaders = attributionsService.getAttributionsFromApi();
42
+ for (const key in attributionHeaders) {
43
+ if (Object.prototype.hasOwnProperty.call(attributionHeaders, key)) {
44
+ headers[key] = attributionHeaders[key];
45
+ }
46
+ }
47
+ // Add X-REQUEST-ID if available from context
48
+ try {
49
+ const tridentContext = tridentBackendApi.Api.getPart('context');
50
+ if (tridentContext?.runtimeAttributions) {
51
+ const outgoingHeaders = tridentContext.runtimeAttributions.buildOutgoingHeaders('HTTP_INTERNAL');
52
+ if (outgoingHeaders) {
53
+ const attributionHeadersMap = {};
54
+ for (const [key, value] of outgoingHeaders) {
55
+ attributionHeadersMap[key] = value;
56
+ }
57
+ if (attributionHeadersMap['x-request-id']) {
58
+ headers['X-REQUEST-ID'] = attributionHeadersMap['x-request-id'];
59
+ }
60
+ }
61
+ }
62
+ }
63
+ catch (error) {
64
+ // Silently fail if context is not available
65
+ authorizationInternalService.logger.debug({ tag: this.LOG_TAG, error }, 'Failed to get request ID from context');
66
+ }
67
+ // Add X-REQUEST-START timestamp
68
+ headers['X-REQUEST-START'] = Math.floor(Date.now() / 1000).toString();
69
+ return headers;
70
+ }
71
+ /**
72
+ * Validates that all messages are instances of the specified message class
73
+ */
74
+ static validateMessages(attributesMessages, messageClass) {
75
+ if (typeof messageClass !== 'function') {
76
+ throw new errors_argumentError.ArgumentError('messageClass must be a class/constructor function');
77
+ }
78
+ utils_validation.ValidationUtils.validateArray(attributesMessages, 'attributesMessages');
79
+ for (let i = 0; i < attributesMessages.length; i++) {
80
+ if (!(attributesMessages[i] instanceof messageClass)) {
81
+ const className = messageClass.name || 'ResourceAttributeAssignment';
82
+ throw new errors_argumentError.ArgumentError(`All attributesMessages must be instances of ${className}, but item at index ${i} is not`);
83
+ }
84
+ }
85
+ }
86
+ /**
87
+ * Handles request errors with consistent logging and error formatting
88
+ */
89
+ static handleRequestError(err, methodName, context) {
90
+ authorizationInternalService.logger.error({
91
+ tag: this.LOG_TAG,
92
+ method: methodName,
93
+ ...context,
94
+ error: err instanceof Error ? err.message : String(err),
95
+ }, `Failed in ${methodName}`);
96
+ if (err instanceof mondayFetchApi.HttpFetcherError) {
97
+ throw new Error(`AuthorizationAttributesMsService: [${methodName}] request failed with status ${err.status}: ${err.message}`);
98
+ }
99
+ throw err;
100
+ }
101
+ /**
102
+ * Generic helper for executing upsert requests
103
+ */
104
+ static async executeUpsertRequest(accountId, assignments, pathTemplate, requestBodyKey, assignmentClass, logPrefix, methodName) {
105
+ // Skip HTTP requests in test environment
106
+ if (process.env.NODE_ENV === 'test') {
107
+ authorizationInternalService.logger.debug({ tag: this.LOG_TAG, accountId, count: assignments.length }, `Skipping ${methodName} in test environment`);
108
+ return;
109
+ }
110
+ // Validate inputs
111
+ utils_validation.ValidationUtils.validateInteger(accountId, 'accountId');
112
+ utils_validation.ValidationUtils.validateArray(assignments, 'assignments');
113
+ if (assignments.length === 0) {
114
+ authorizationInternalService.logger.warn({ tag: this.LOG_TAG, accountId }, `${methodName} called with empty array`);
115
+ return;
116
+ }
117
+ // Validate all assignments are instances of the correct class
118
+ this.validateMessages(assignments, assignmentClass);
119
+ // Convert assignments to hash format
120
+ const assignmentsHash = assignments.map(assignment => assignment.toH());
121
+ // Build request body
122
+ const requestBody = requestBodyKey === 'resourceAttributeAssignments'
123
+ ? { resourceAttributeAssignments: assignmentsHash }
124
+ : { entityAttributeAssignments: assignmentsHash };
125
+ const httpClient = tridentBackendApi.Api.getPart('httpClient');
126
+ if (!httpClient) {
127
+ throw new Error('AuthorizationAttributesMsService: HTTP client is not initialized');
128
+ }
129
+ const path = utils_pathUtils.replacePathParams(pathTemplate, { accountId });
130
+ const headers = this.getRequestHeaders(accountId);
131
+ try {
132
+ authorizationInternalService.logger.info({ tag: this.LOG_TAG, accountId, count: assignments.length }, `Upserting ${logPrefix} attributes`);
133
+ await httpClient.fetch({
134
+ url: {
135
+ appName: constants.APP_NAME,
136
+ path,
137
+ },
138
+ method: 'POST',
139
+ headers,
140
+ body: JSON.stringify(requestBody),
141
+ }, {
142
+ timeout: authorizationInternalService.AuthorizationInternalService.getRequestTimeout(),
143
+ retryPolicy: authorizationInternalService.AuthorizationInternalService.getRetriesPolicy(),
144
+ });
145
+ authorizationInternalService.logger.info({ tag: this.LOG_TAG, accountId, count: assignments.length }, `Successfully upserted ${logPrefix} attributes`);
146
+ }
147
+ catch (err) {
148
+ this.handleRequestError(err, methodName, { accountId });
149
+ }
150
+ }
151
+ /**
152
+ * Generic helper for executing delete requests
153
+ */
154
+ static async executeDeleteRequest(accountId, pathTemplate, pathParams, keys, logPrefix, methodName, context = {}) {
155
+ // Skip HTTP requests in test environment
156
+ if (process.env.NODE_ENV === 'test') {
157
+ authorizationInternalService.logger.debug({ tag: this.LOG_TAG, accountId, ...pathParams, keys }, `Skipping ${methodName} in test environment`);
158
+ return;
159
+ }
160
+ // Validate inputs
161
+ utils_validation.ValidationUtils.validateInteger(accountId, 'accountId');
162
+ utils_validation.ValidationUtils.validateArray(keys, 'attributeKeys');
163
+ if (keys.length === 0) {
164
+ authorizationInternalService.logger.warn({ tag: this.LOG_TAG, accountId, ...pathParams }, `${methodName} called with empty keys array`);
165
+ return;
166
+ }
167
+ // Validate all keys are strings
168
+ utils_validation.ValidationUtils.validateStringArray(keys, 'attributeKeys');
169
+ // Build request body
170
+ const requestBody = {
171
+ keys,
172
+ };
173
+ const httpClient = tridentBackendApi.Api.getPart('httpClient');
174
+ if (!httpClient) {
175
+ throw new Error('AuthorizationAttributesMsService: HTTP client is not initialized');
176
+ }
177
+ const path = utils_pathUtils.replacePathParams(pathTemplate, { accountId, ...pathParams });
178
+ const headers = this.getRequestHeaders(accountId);
179
+ try {
180
+ authorizationInternalService.logger.info({ tag: this.LOG_TAG, accountId, ...pathParams, keys }, `Deleting ${logPrefix} attributes`);
181
+ await httpClient.fetch({
182
+ url: {
183
+ appName: constants.APP_NAME,
184
+ path,
185
+ },
186
+ method: 'DELETE',
187
+ headers,
188
+ body: JSON.stringify(requestBody),
189
+ }, {
190
+ timeout: authorizationInternalService.AuthorizationInternalService.getRequestTimeout(),
191
+ retryPolicy: authorizationInternalService.AuthorizationInternalService.getRetriesPolicy(),
192
+ });
193
+ authorizationInternalService.logger.info({ tag: this.LOG_TAG, accountId, ...pathParams, keys }, `Successfully deleted ${logPrefix} attributes`);
194
+ }
195
+ catch (err) {
196
+ this.handleRequestError(err, methodName, { accountId, ...pathParams, ...context });
197
+ }
198
+ }
199
+ /**
200
+ * Creates or updates resource attributes synchronously.
201
+ * @param accountId The account ID
202
+ * @param resourceAttributeAssignments Array of ResourceAttributeAssignment objects
203
+ * @returns Promise<void>
204
+ */
205
+ static async upsertResourceAttributesSync(accountId, resourceAttributeAssignments) {
206
+ return this.executeUpsertRequest(accountId, resourceAttributeAssignments, UPSERT_RESOURCE_ATTRIBUTES_PATH, 'resourceAttributeAssignments', resourceAttributeAssignment.ResourceAttributeAssignment, 'resource', 'upsertResourceAttributesSync');
207
+ }
208
+ /**
209
+ * Deletes specific attributes from a resource synchronously.
210
+ * @param accountId The account ID
211
+ * @param resource Object with resourceType (string) and resourceId (number)
212
+ * @param attributeKeys Array of attribute key strings to delete
213
+ * @returns Promise<void>
214
+ */
215
+ static async deleteResourceAttributesSync(accountId, resource, attributeKeys) {
216
+ // Validate resource object
217
+ if (!resource || typeof resource !== 'object') {
218
+ throw new errors_argumentError.ArgumentError('resource must be an object');
219
+ }
220
+ utils_validation.ValidationUtils.validateInteger(resource.resourceId, 'resource.resourceId');
221
+ utils_validation.ValidationUtils.validateString(resource.resourceType, 'resource.resourceType');
222
+ return this.executeDeleteRequest(accountId, DELETE_RESOURCE_ATTRIBUTES_PATH, {
223
+ resourceType: resource.resourceType,
224
+ resourceId: resource.resourceId,
225
+ }, attributeKeys, 'resource', 'deleteResourceAttributesSync', { resource });
226
+ }
227
+ /**
228
+ * Creates or updates entity attributes synchronously.
229
+ * @param accountId The account ID
230
+ * @param entityAttributeAssignments Array of EntityAttributeAssignment objects
231
+ * @returns Promise<void>
232
+ */
233
+ static async upsertEntityAttributesSync(accountId, entityAttributeAssignments) {
234
+ return this.executeUpsertRequest(accountId, entityAttributeAssignments, UPSERT_ENTITY_ATTRIBUTES_PATH, 'entityAttributeAssignments', entityAttributeAssignment.EntityAttributeAssignment, 'entity', 'upsertEntityAttributesSync');
235
+ }
236
+ /**
237
+ * Deletes specific attributes from an entity synchronously.
238
+ * @param accountId The account ID
239
+ * @param entityType The entity type
240
+ * @param entityId The entity ID
241
+ * @param attributeKeys Array of attribute key strings to delete
242
+ * @returns Promise<void>
243
+ */
244
+ static async deleteEntityAttributesSync(accountId, entityType, entityId, attributeKeys) {
245
+ if (!entityType || typeof entityType !== 'string' || entityType.trim() === '') {
246
+ throw new errors_argumentError.ArgumentError(`entityType must be a non-empty string, got: ${entityType}`);
247
+ }
248
+ utils_validation.ValidationUtils.validateInteger(entityId, 'entityId');
249
+ return this.executeDeleteRequest(accountId, DELETE_ENTITY_ATTRIBUTES_PATH, {
250
+ entityType,
251
+ entityId,
252
+ }, attributeKeys, 'entity', 'deleteEntityAttributesSync', { entityType, entityId });
253
+ }
254
+ }
255
+
256
+ exports.AuthorizationAttributesMsService = AuthorizationAttributesMsService;
@@ -0,0 +1,85 @@
1
+ import { ResourceAttributeAssignment, ResourceAttributesOperation, EntityAttributesOperation } from './types/authorization-attributes-contracts';
2
+ import { EntityAttributeAssignment } from './entity-attribute-assignment';
3
+ import { Resource } from './types/general';
4
+ export declare class AuthorizationAttributesSnsService {
5
+ private static LOG_TAG;
6
+ private resourceSnsArn;
7
+ private entitySnsArn;
8
+ /**
9
+ * Public constructor to create the AuthorizationAttributesSnsService instance.
10
+ */
11
+ constructor();
12
+ /**
13
+ * Async function to upsert resource attributes using SNS.
14
+ * Sends the updates request to SNS and returns before the change actually took place.
15
+ * @param accountId The account ID
16
+ * @param appName App name of the calling app
17
+ * @param callerActionIdentifier Action identifier
18
+ * @param resourceAttributeAssignments Array of resource attribute assignments to upsert
19
+ * @return Promise with array of sent operations
20
+ */
21
+ upsertResourceAttributesAsync(accountId: number, appName: string, callerActionIdentifier: string, resourceAttributeAssignments: ResourceAttributeAssignment[]): Promise<ResourceAttributesOperation[]>;
22
+ /**
23
+ * Async function to delete resource attributes using SNS.
24
+ * Sends the updates request to SNS and returns before the change actually took place.
25
+ * @param accountId The account ID
26
+ * @param appName App name of the calling app
27
+ * @param callerActionIdentifier Action identifier
28
+ * @param resource The resource (resourceType, resourceId)
29
+ * @param attributeKeys Array of attribute keys to delete
30
+ * @return Promise with array of sent operations
31
+ */
32
+ deleteResourceAttributesAsync(accountId: number, appName: string, callerActionIdentifier: string, resource: Resource, attributeKeys: string[]): Promise<ResourceAttributesOperation[]>;
33
+ /**
34
+ * Async function to upsert entity attributes using SNS.
35
+ * Sends the updates request to SNS and returns before the change actually took place.
36
+ * @param accountId The account ID
37
+ * @param appName App name of the calling app
38
+ * @param callerActionIdentifier Action identifier
39
+ * @param entityAttributeAssignments Array of entity attribute assignments to upsert
40
+ * @return Promise with array of sent operations
41
+ */
42
+ upsertEntityAttributesAsync(accountId: number, appName: string, callerActionIdentifier: string, entityAttributeAssignments: EntityAttributeAssignment[]): Promise<EntityAttributesOperation[]>;
43
+ /**
44
+ * Async function to delete entity attributes using SNS.
45
+ * Sends the updates request to SNS and returns before the change actually took place.
46
+ * @param accountId The account ID
47
+ * @param appName App name of the calling app
48
+ * @param callerActionIdentifier Action identifier
49
+ * @param entityType The entity type
50
+ * @param entityId The entity ID
51
+ * @param attributeKeys Array of attribute keys to delete
52
+ * @return Promise with array of sent operations
53
+ */
54
+ deleteEntityAttributesAsync(accountId: number, appName: string, callerActionIdentifier: string, entityType: string, entityId: number, attributeKeys: string[]): Promise<EntityAttributesOperation[]>;
55
+ /**
56
+ * Async function, this function only send the updates request to SNS and return before the change actually took place
57
+ * @param accountId
58
+ * @param appName - App name of the calling app
59
+ * @param callerActionIdentifier - action identifier
60
+ * @param resourceAttributeOperations - Array of operations to do on resource attributes.
61
+ * @return {Promise<ResourceAttributesOperation[]>} Array of sent operations
62
+ * */
63
+ updateResourceAttributesAsync(accountId: number, appName: string, callerActionIdentifier: string, resourceAttributeOperations: ResourceAttributesOperation[]): Promise<ResourceAttributesOperation[]>;
64
+ /**
65
+ * Async function, this function only send the updates request to SNS and return before the change actually took place
66
+ * @param accountId
67
+ * @param appName - App name of the calling app
68
+ * @param callerActionIdentifier - action identifier
69
+ * @param entityAttributeOperations - Array of operations to do on entity attributes.
70
+ * @return {Promise<EntityAttributesOperation[]>} Array of sent operations
71
+ * */
72
+ updateEntityAttributesAsync(accountId: number, appName: string, callerActionIdentifier: string, entityAttributeOperations: EntityAttributesOperation[]): Promise<EntityAttributesOperation[]>;
73
+ private sendSingleSnsMessage;
74
+ private static getSnsTopicArn;
75
+ /**
76
+ * Checks we can contact the required SNS topic that used to send attribute updates to Authorization MS.
77
+ * This function can be used as health check for services that updating resource attributes in async is crucial.
78
+ * Note this function only verify the POD can contact AWS SDK and the topic exists, but the user still might get
79
+ * errors when pushing for the SNS (e.g: in case the AWS role of the POD don't have permissions to push messages).
80
+ * However, this is the best we can do without actually push dummy messages to the SNS.
81
+ * @return {Promise<boolean>} - true if succeeded
82
+ */
83
+ asyncResourceAttributesHealthCheck(): Promise<boolean>;
84
+ }
85
+ //# sourceMappingURL=authorization-attributes-sns-service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authorization-attributes-sns-service.d.ts","sourceRoot":"","sources":["../src/authorization-attributes-sns-service.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,2BAA2B,EAC3B,2BAA2B,EAC3B,yBAAyB,EAG1B,MAAM,4CAA4C,CAAC;AACpD,OAAO,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAC1E,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAe3C,qBAAa,iCAAiC;IAC5C,OAAO,CAAC,MAAM,CAAC,OAAO,CAA8B;IACpD,OAAO,CAAC,cAAc,CAAS;IAC/B,OAAO,CAAC,YAAY,CAAS;IAE7B;;OAEG;;IAMH;;;;;;;;OAQG;IACG,6BAA6B,CACjC,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,EACf,sBAAsB,EAAE,MAAM,EAC9B,4BAA4B,EAAE,2BAA2B,EAAE,GAC1D,OAAO,CAAC,2BAA2B,EAAE,CAAC;IAQzC;;;;;;;;;OASG;IACG,6BAA6B,CACjC,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,EACf,sBAAsB,EAAE,MAAM,EAC9B,QAAQ,EAAE,QAAQ,EAClB,aAAa,EAAE,MAAM,EAAE,GACtB,OAAO,CAAC,2BAA2B,EAAE,CAAC;IAUzC;;;;;;;;OAQG;IACG,2BAA2B,CAC/B,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,EACf,sBAAsB,EAAE,MAAM,EAC9B,0BAA0B,EAAE,yBAAyB,EAAE,GACtD,OAAO,CAAC,yBAAyB,EAAE,CAAC;IAcvC;;;;;;;;;;OAUG;IACG,2BAA2B,CAC/B,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,EACf,sBAAsB,EAAE,MAAM,EAC9B,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,aAAa,EAAE,MAAM,EAAE,GACtB,OAAO,CAAC,yBAAyB,EAAE,CAAC;IAUvC;;;;;;;UAOM;IACA,6BAA6B,CACjC,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,EACf,sBAAsB,EAAE,MAAM,EAC9B,2BAA2B,EAAE,2BAA2B,EAAE,GACzD,OAAO,CAAC,2BAA2B,EAAE,CAAC;IAoBzC;;;;;;;UAOM;IACA,2BAA2B,CAC/B,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,EACf,sBAAsB,EAAE,MAAM,EAC9B,yBAAyB,EAAE,yBAAyB,EAAE,GACrD,OAAO,CAAC,yBAAyB,EAAE,CAAC;YAoBzB,oBAAoB;IA2BlC,OAAO,CAAC,MAAM,CAAC,cAAc;IA0B7B;;;;;;;OAOG;IACG,kCAAkC,IAAI,OAAO,CAAC,OAAO,CAAC;CAoB7D"}
@@ -0,0 +1,203 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+
3
+ const chunk = require('lodash/chunk.js');
4
+ const mondaySns = require('@mondaydotcomorg/monday-sns');
5
+ const types_authorizationAttributesContracts = require('./types/authorization-attributes-contracts.js');
6
+ const entityAttributeAssignment = require('./entity-attribute-assignment.js');
7
+ const authorizationInternalService = require('./authorization-internal-service.js');
8
+ const constants_sns = require('./constants/sns.js');
9
+
10
+ const _interopDefault = e => e && e.__esModule ? e : { default: e };
11
+
12
+ const chunk__default = /*#__PURE__*/_interopDefault(chunk);
13
+
14
+ class AuthorizationAttributesSnsService {
15
+ static LOG_TAG = 'authorization_attributes';
16
+ resourceSnsArn;
17
+ entitySnsArn;
18
+ /**
19
+ * Public constructor to create the AuthorizationAttributesSnsService instance.
20
+ */
21
+ constructor() {
22
+ this.resourceSnsArn = AuthorizationAttributesSnsService.getSnsTopicArn(constants_sns.SnsTopicType.RESOURCE);
23
+ this.entitySnsArn = AuthorizationAttributesSnsService.getSnsTopicArn(constants_sns.SnsTopicType.ENTITY);
24
+ }
25
+ /**
26
+ * Async function to upsert resource attributes using SNS.
27
+ * Sends the updates request to SNS and returns before the change actually took place.
28
+ * @param accountId The account ID
29
+ * @param appName App name of the calling app
30
+ * @param callerActionIdentifier Action identifier
31
+ * @param resourceAttributeAssignments Array of resource attribute assignments to upsert
32
+ * @return Promise with array of sent operations
33
+ */
34
+ async upsertResourceAttributesAsync(accountId, appName, callerActionIdentifier, resourceAttributeAssignments) {
35
+ const operations = resourceAttributeAssignments.map(assignment => ({
36
+ ...assignment,
37
+ operationType: types_authorizationAttributesContracts.ResourceAttributeOperationEnum.UPSERT,
38
+ }));
39
+ return this.updateResourceAttributesAsync(accountId, appName, callerActionIdentifier, operations);
40
+ }
41
+ /**
42
+ * Async function to delete resource attributes using SNS.
43
+ * Sends the updates request to SNS and returns before the change actually took place.
44
+ * @param accountId The account ID
45
+ * @param appName App name of the calling app
46
+ * @param callerActionIdentifier Action identifier
47
+ * @param resource The resource (resourceType, resourceId)
48
+ * @param attributeKeys Array of attribute keys to delete
49
+ * @return Promise with array of sent operations
50
+ */
51
+ async deleteResourceAttributesAsync(accountId, appName, callerActionIdentifier, resource, attributeKeys) {
52
+ const operations = attributeKeys.map(key => ({
53
+ resourceType: resource.type,
54
+ resourceId: resource.id,
55
+ key,
56
+ operationType: types_authorizationAttributesContracts.ResourceAttributeOperationEnum.DELETE,
57
+ }));
58
+ return this.updateResourceAttributesAsync(accountId, appName, callerActionIdentifier, operations);
59
+ }
60
+ /**
61
+ * Async function to upsert entity attributes using SNS.
62
+ * Sends the updates request to SNS and returns before the change actually took place.
63
+ * @param accountId The account ID
64
+ * @param appName App name of the calling app
65
+ * @param callerActionIdentifier Action identifier
66
+ * @param entityAttributeAssignments Array of entity attribute assignments to upsert
67
+ * @return Promise with array of sent operations
68
+ */
69
+ async upsertEntityAttributesAsync(accountId, appName, callerActionIdentifier, entityAttributeAssignments) {
70
+ const operations = entityAttributeAssignments.map(assignment => {
71
+ const assignmentData = assignment instanceof entityAttributeAssignment.EntityAttributeAssignment ? assignment.toH() : assignment;
72
+ return {
73
+ entityId: assignmentData.entityId,
74
+ entityType: assignmentData.entityType,
75
+ key: assignmentData.key,
76
+ value: assignmentData.value,
77
+ operationType: types_authorizationAttributesContracts.EntityAttributeOperationEnum.UPSERT,
78
+ };
79
+ });
80
+ return this.updateEntityAttributesAsync(accountId, appName, callerActionIdentifier, operations);
81
+ }
82
+ /**
83
+ * Async function to delete entity attributes using SNS.
84
+ * Sends the updates request to SNS and returns before the change actually took place.
85
+ * @param accountId The account ID
86
+ * @param appName App name of the calling app
87
+ * @param callerActionIdentifier Action identifier
88
+ * @param entityType The entity type
89
+ * @param entityId The entity ID
90
+ * @param attributeKeys Array of attribute keys to delete
91
+ * @return Promise with array of sent operations
92
+ */
93
+ async deleteEntityAttributesAsync(accountId, appName, callerActionIdentifier, entityType, entityId, attributeKeys) {
94
+ const operations = attributeKeys.map(key => ({
95
+ entityType: entityType,
96
+ entityId,
97
+ key,
98
+ operationType: types_authorizationAttributesContracts.EntityAttributeOperationEnum.DELETE,
99
+ }));
100
+ return this.updateEntityAttributesAsync(accountId, appName, callerActionIdentifier, operations);
101
+ }
102
+ /**
103
+ * Async function, this function only send the updates request to SNS and return before the change actually took place
104
+ * @param accountId
105
+ * @param appName - App name of the calling app
106
+ * @param callerActionIdentifier - action identifier
107
+ * @param resourceAttributeOperations - Array of operations to do on resource attributes.
108
+ * @return {Promise<ResourceAttributesOperation[]>} Array of sent operations
109
+ * */
110
+ async updateResourceAttributesAsync(accountId, appName, callerActionIdentifier, resourceAttributeOperations) {
111
+ const topicArn = this.resourceSnsArn;
112
+ const sendToSnsPromises = [];
113
+ const operationChucks = chunk__default.default(resourceAttributeOperations, constants_sns.ASYNC_RESOURCE_ATTRIBUTES_MAX_OPERATIONS_PER_MESSAGE);
114
+ for (const operationsChunk of operationChucks) {
115
+ sendToSnsPromises.push(this.sendSingleSnsMessage(topicArn, accountId, appName, callerActionIdentifier, operationsChunk, constants_sns.RESOURCE_ATTRIBUTES_SNS_UPDATE_OPERATION_MESSAGE_KIND, 'Authorization resource attributes async update: failed to send operations to SNS'));
116
+ }
117
+ return (await Promise.all(sendToSnsPromises)).flat();
118
+ }
119
+ /**
120
+ * Async function, this function only send the updates request to SNS and return before the change actually took place
121
+ * @param accountId
122
+ * @param appName - App name of the calling app
123
+ * @param callerActionIdentifier - action identifier
124
+ * @param entityAttributeOperations - Array of operations to do on entity attributes.
125
+ * @return {Promise<EntityAttributesOperation[]>} Array of sent operations
126
+ * */
127
+ async updateEntityAttributesAsync(accountId, appName, callerActionIdentifier, entityAttributeOperations) {
128
+ const topicArn = this.entitySnsArn;
129
+ const sendToSnsPromises = [];
130
+ const operationChucks = chunk__default.default(entityAttributeOperations, constants_sns.ASYNC_ENTITY_ATTRIBUTES_MAX_OPERATIONS_PER_MESSAGE);
131
+ for (const operationsChunk of operationChucks) {
132
+ sendToSnsPromises.push(this.sendSingleSnsMessage(topicArn, accountId, appName, callerActionIdentifier, operationsChunk, constants_sns.ENTITY_ATTRIBUTES_SNS_UPDATE_OPERATION_MESSAGE_KIND, 'Authorization entity attributes async update: failed to send operations to SNS'));
133
+ }
134
+ return (await Promise.all(sendToSnsPromises)).flat();
135
+ }
136
+ async sendSingleSnsMessage(topicArn, accountId, appName, callerActionIdentifier, operations, kind, errorLogMessage) {
137
+ const payload = {
138
+ kind,
139
+ payload: {
140
+ accountId: accountId,
141
+ callerAppName: appName,
142
+ callerActionIdentifier: callerActionIdentifier,
143
+ operations: operations,
144
+ },
145
+ };
146
+ try {
147
+ await mondaySns.sendToSns(payload, topicArn);
148
+ return operations;
149
+ }
150
+ catch (error) {
151
+ authorizationInternalService.logger.error({ error, tag: AuthorizationAttributesSnsService.LOG_TAG }, errorLogMessage);
152
+ return [];
153
+ }
154
+ }
155
+ static getSnsTopicArn(type) {
156
+ let envVarName;
157
+ let devTestName;
158
+ switch (type) {
159
+ case constants_sns.SnsTopicType.ENTITY:
160
+ envVarName = constants_sns.ENTITY_SNS_ARN_ENV_VAR_NAME;
161
+ devTestName = constants_sns.ENTITY_SNS_DEV_TEST_NAME;
162
+ break;
163
+ default:
164
+ // Default to resource SNS constants
165
+ envVarName = constants_sns.RESOURCE_SNS_ARN_ENV_VAR_NAME;
166
+ devTestName = constants_sns.RESOURCE_SNS_DEV_TEST_NAME;
167
+ break;
168
+ }
169
+ const arnFromEnv = process.env[envVarName];
170
+ if (arnFromEnv) {
171
+ return arnFromEnv;
172
+ }
173
+ if (process.env.NODE_ENV === 'development' || process.env.NODE_ENV === 'test') {
174
+ return devTestName;
175
+ }
176
+ throw new Error(`Unable to get ${type} sns topic arn from env variable`);
177
+ }
178
+ /**
179
+ * Checks we can contact the required SNS topic that used to send attribute updates to Authorization MS.
180
+ * This function can be used as health check for services that updating resource attributes in async is crucial.
181
+ * Note this function only verify the POD can contact AWS SDK and the topic exists, but the user still might get
182
+ * errors when pushing for the SNS (e.g: in case the AWS role of the POD don't have permissions to push messages).
183
+ * However, this is the best we can do without actually push dummy messages to the SNS.
184
+ * @return {Promise<boolean>} - true if succeeded
185
+ */
186
+ async asyncResourceAttributesHealthCheck() {
187
+ try {
188
+ const requestedTopicArn = this.resourceSnsArn;
189
+ const attributes = await mondaySns.getTopicAttributes(requestedTopicArn);
190
+ const isHealthy = !(!attributes || !('TopicArn' in attributes) || attributes.TopicArn !== requestedTopicArn);
191
+ if (!isHealthy) {
192
+ authorizationInternalService.logger.error({ requestedTopicArn, snsReturnedAttributes: attributes, tag: AuthorizationAttributesSnsService.LOG_TAG }, 'authorization-attributes-service failed in health check');
193
+ }
194
+ return isHealthy;
195
+ }
196
+ catch (error) {
197
+ authorizationInternalService.logger.error({ error, tag: AuthorizationAttributesSnsService.LOG_TAG }, 'authorization-attributes-service got error during health check');
198
+ return false;
199
+ }
200
+ }
201
+ }
202
+
203
+ exports.AuthorizationAttributesSnsService = AuthorizationAttributesSnsService;
@@ -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"}