@mondaydotcomorg/monday-authorization 3.5.1 → 3.5.2-feat-shaime-support-entity-attributes-3-6202ab7

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 (111) hide show
  1. package/dist/authorization-attributes-ms-service.d.ts +72 -0
  2. package/dist/authorization-attributes-ms-service.d.ts.map +1 -0
  3. package/dist/authorization-attributes-ms-service.js +279 -0
  4. package/dist/authorization-attributes-service.d.ts +25 -47
  5. package/dist/authorization-attributes-service.d.ts.map +1 -1
  6. package/dist/authorization-attributes-service.js +32 -171
  7. package/dist/authorization-attributes-sns-service.d.ts +70 -0
  8. package/dist/authorization-attributes-sns-service.d.ts.map +1 -0
  9. package/dist/authorization-attributes-sns-service.js +179 -0
  10. package/dist/base-attribute-assignment.d.ts +19 -0
  11. package/dist/base-attribute-assignment.d.ts.map +1 -0
  12. package/dist/base-attribute-assignment.js +34 -0
  13. package/dist/constants/sns.d.ts +12 -2
  14. package/dist/constants/sns.d.ts.map +1 -1
  15. package/dist/constants/sns.js +22 -2
  16. package/dist/entity-attribute-assignment.d.ts +16 -0
  17. package/dist/entity-attribute-assignment.d.ts.map +1 -0
  18. package/dist/entity-attribute-assignment.js +33 -0
  19. package/dist/entity-attributes-constants.d.ts +7 -0
  20. package/dist/entity-attributes-constants.d.ts.map +1 -0
  21. package/dist/entity-attributes-constants.js +11 -0
  22. package/dist/errors/argument-error.d.ts +4 -0
  23. package/dist/errors/argument-error.d.ts.map +1 -0
  24. package/dist/errors/argument-error.js +10 -0
  25. package/dist/esm/authorization-attributes-ms-service.d.ts +72 -0
  26. package/dist/esm/authorization-attributes-ms-service.d.ts.map +1 -0
  27. package/dist/esm/authorization-attributes-ms-service.mjs +277 -0
  28. package/dist/esm/authorization-attributes-service.d.ts +25 -47
  29. package/dist/esm/authorization-attributes-service.d.ts.map +1 -1
  30. package/dist/esm/authorization-attributes-service.mjs +32 -167
  31. package/dist/esm/authorization-attributes-sns-service.d.ts +70 -0
  32. package/dist/esm/authorization-attributes-sns-service.d.ts.map +1 -0
  33. package/dist/esm/authorization-attributes-sns-service.mjs +173 -0
  34. package/dist/esm/base-attribute-assignment.d.ts +19 -0
  35. package/dist/esm/base-attribute-assignment.d.ts.map +1 -0
  36. package/dist/esm/base-attribute-assignment.mjs +28 -0
  37. package/dist/esm/constants/sns.d.ts +12 -2
  38. package/dist/esm/constants/sns.d.ts.map +1 -1
  39. package/dist/esm/constants/sns.mjs +17 -3
  40. package/dist/esm/entity-attribute-assignment.d.ts +16 -0
  41. package/dist/esm/entity-attribute-assignment.d.ts.map +1 -0
  42. package/dist/esm/entity-attribute-assignment.mjs +31 -0
  43. package/dist/esm/entity-attributes-constants.d.ts +7 -0
  44. package/dist/esm/entity-attributes-constants.d.ts.map +1 -0
  45. package/dist/esm/entity-attributes-constants.mjs +9 -0
  46. package/dist/esm/errors/argument-error.d.ts +4 -0
  47. package/dist/esm/errors/argument-error.d.ts.map +1 -0
  48. package/dist/esm/errors/argument-error.mjs +8 -0
  49. package/dist/esm/resource-attribute-assignment.d.ts +16 -0
  50. package/dist/esm/resource-attribute-assignment.d.ts.map +1 -0
  51. package/dist/esm/resource-attribute-assignment.mjs +31 -0
  52. package/dist/esm/resource-attributes-constants.d.ts +25 -0
  53. package/dist/esm/resource-attributes-constants.d.ts.map +1 -0
  54. package/dist/esm/resource-attributes-constants.mjs +28 -0
  55. package/dist/esm/types/authorization-attributes-contracts.d.ts +26 -12
  56. package/dist/esm/types/authorization-attributes-contracts.d.ts.map +1 -1
  57. package/dist/esm/types/authorization-attributes-contracts.mjs +6 -6
  58. package/dist/esm/types/authorization-attributes-service.interface.d.ts +43 -0
  59. package/dist/esm/types/authorization-attributes-service.interface.d.ts.map +1 -0
  60. package/dist/esm/types/authorization-attributes-service.interface.mjs +1 -0
  61. package/dist/esm/types/general.d.ts +1 -1
  62. package/dist/esm/types/general.d.ts.map +1 -1
  63. package/dist/esm/utils/assigment-schema.d.ts +23 -0
  64. package/dist/esm/utils/assigment-schema.d.ts.map +1 -0
  65. package/dist/esm/utils/assigment-schema.mjs +29 -0
  66. package/dist/esm/utils/resource-schema.d.ts +17 -0
  67. package/dist/esm/utils/resource-schema.d.ts.map +1 -0
  68. package/dist/esm/utils/resource-schema.mjs +16 -0
  69. package/dist/esm/utils/validation.d.ts +26 -0
  70. package/dist/esm/utils/validation.d.ts.map +1 -0
  71. package/dist/esm/utils/validation.mjs +70 -0
  72. package/dist/resource-attribute-assignment.d.ts +16 -0
  73. package/dist/resource-attribute-assignment.d.ts.map +1 -0
  74. package/dist/resource-attribute-assignment.js +33 -0
  75. package/dist/resource-attributes-constants.d.ts +25 -0
  76. package/dist/resource-attributes-constants.d.ts.map +1 -0
  77. package/dist/resource-attributes-constants.js +31 -0
  78. package/dist/types/authorization-attributes-contracts.d.ts +26 -12
  79. package/dist/types/authorization-attributes-contracts.d.ts.map +1 -1
  80. package/dist/types/authorization-attributes-contracts.js +5 -5
  81. package/dist/types/authorization-attributes-service.interface.d.ts +43 -0
  82. package/dist/types/authorization-attributes-service.interface.d.ts.map +1 -0
  83. package/dist/types/authorization-attributes-service.interface.js +1 -0
  84. package/dist/types/general.d.ts +1 -1
  85. package/dist/types/general.d.ts.map +1 -1
  86. package/dist/utils/assigment-schema.d.ts +23 -0
  87. package/dist/utils/assigment-schema.d.ts.map +1 -0
  88. package/dist/utils/assigment-schema.js +36 -0
  89. package/dist/utils/resource-schema.d.ts +17 -0
  90. package/dist/utils/resource-schema.d.ts.map +1 -0
  91. package/dist/utils/resource-schema.js +22 -0
  92. package/dist/utils/validation.d.ts +26 -0
  93. package/dist/utils/validation.d.ts.map +1 -0
  94. package/dist/utils/validation.js +76 -0
  95. package/package.json +3 -1
  96. package/src/authorization-attributes-ms-service.ts +414 -0
  97. package/src/authorization-attributes-service.ts +34 -222
  98. package/src/authorization-attributes-sns-service.ts +257 -0
  99. package/src/base-attribute-assignment.ts +30 -0
  100. package/src/constants/sns.ts +19 -2
  101. package/src/entity-attribute-assignment.ts +33 -0
  102. package/src/entity-attributes-constants.ts +7 -0
  103. package/src/errors/argument-error.ts +6 -0
  104. package/src/resource-attribute-assignment.ts +36 -0
  105. package/src/resource-attributes-constants.ts +27 -0
  106. package/src/types/authorization-attributes-contracts.ts +34 -11
  107. package/src/types/authorization-attributes-service.interface.ts +70 -0
  108. package/src/types/general.ts +1 -1
  109. package/src/utils/assigment-schema.ts +29 -0
  110. package/src/utils/resource-schema.ts +21 -0
  111. package/src/utils/validation.ts +82 -0
@@ -1,185 +1,46 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
- const chunk = require('lodash/chunk.js');
4
- const tridentBackendApi = require('@mondaydotcomorg/trident-backend-api');
5
- const mondaySns = require('@mondaydotcomorg/monday-sns');
6
- const mondayFetchApi = require('@mondaydotcomorg/monday-fetch-api');
7
- const authorizationInternalService = require('./authorization-internal-service.js');
8
- const attributionsService = require('./attributions-service.js');
9
- const constants_sns = require('./constants/sns.js');
10
- const constants = require('./constants.js');
11
-
12
- const _interopDefault = e => e && e.__esModule ? e : { default: e };
13
-
14
- const chunk__default = /*#__PURE__*/_interopDefault(chunk);
3
+ const authorizationAttributesMsService = require('./authorization-attributes-ms-service.js');
4
+ const authorizationAttributesSnsService = require('./authorization-attributes-sns-service.js');
15
5
 
6
+ /**
7
+ * Main service class for managing resource and entity attributes.
8
+ * Provides access to both direct (MS) and SNS operations.
9
+ *
10
+ * @example
11
+ * const service = new AuthorizationAttributesService();
12
+ *
13
+ * // Use direct operations
14
+ * await service.direct().upsertResourceAttributes(accountId, assignments);
15
+ *
16
+ * // Use SNS operations
17
+ * await service.sns().upsertResourceAttributes(accountId, assignments, appName, actionId);
18
+ * ```
19
+ */
16
20
  class AuthorizationAttributesService {
17
- static LOG_TAG = 'authorization_attributes';
18
- static API_PATHS = {
19
- UPSERT_RESOURCE_ATTRIBUTES: '/attributes/{accountId}/resource',
20
- DELETE_RESOURCE_ATTRIBUTES: '/attributes/{accountId}/resource/{resourceType}/{resourceId}',
21
- };
22
- httpClient;
23
- fetchOptions;
24
- snsArn;
21
+ _directService = null;
22
+ _snsService = null;
25
23
  /**
26
- * Public constructor to create the AuthorizationAttributesService instance.
27
- * @param httpClient The HTTP client to use for API requests, if not provided, the default HTTP client from Api will be used.
28
- * @param fetchOptions The fetch options to use for API requests, if not provided, the default fetch options will be used.
24
+ * Gets the direct (MS) service instance.
25
+ * Initializes the service on first access (lazy initialization).
26
+ * @returns IAuthorizationAttributesService instance
29
27
  */
30
- constructor(httpClient, fetchOptions) {
31
- if (!httpClient) {
32
- httpClient = tridentBackendApi.Api.getPart('httpClient');
33
- if (!httpClient) {
34
- throw new Error(constants.ERROR_MESSAGES.HTTP_CLIENT_NOT_INITIALIZED);
35
- }
36
- }
37
- if (!fetchOptions) {
38
- fetchOptions = constants.DEFAULT_FETCH_OPTIONS;
39
- }
40
- else {
41
- fetchOptions = {
42
- ...constants.DEFAULT_FETCH_OPTIONS,
43
- ...fetchOptions,
44
- };
28
+ direct() {
29
+ if (this._directService === null) {
30
+ this._directService = new authorizationAttributesMsService.AuthorizationAttributesMsService();
45
31
  }
46
- this.httpClient = httpClient;
47
- this.fetchOptions = fetchOptions;
48
- this.snsArn = AuthorizationAttributesService.getSnsTopicArn();
32
+ return this._directService;
49
33
  }
50
34
  /**
51
- * Upsert resource attributes synchronously, performing http call to the authorization MS to assign the given attributes to the given resource.
52
- * @param accountId
53
- * @param resourceAttributeAssignments - Array of resource (resourceType, resourceId) and attribute (key, value) pairs to upsert in the authorization MS.
54
- * e.g. [{ resourceType: 'board', resourceId: 123, key: 'board_kind', value: 'private' }]
55
- * @returns ResourceAttributeResponse - The affected (created and updated_ resource attributes assignments in the `attributes` field.
35
+ * Gets the SNS service instance.
36
+ * Initializes the service on first access (lazy initialization).
37
+ * @returns IAuthorizationAttributesService instance
56
38
  */
57
- async upsertResourceAttributes(accountId, resourceAttributeAssignments) {
58
- const attributionHeaders = attributionsService.getAttributionsFromApi();
59
- try {
60
- return await this.httpClient.fetch({
61
- url: {
62
- appName: constants.APP_NAME,
63
- path: AuthorizationAttributesService.API_PATHS.UPSERT_RESOURCE_ATTRIBUTES.replace('{accountId}', accountId.toString()),
64
- },
65
- method: 'POST',
66
- headers: {
67
- 'Content-Type': 'application/json',
68
- ...attributionHeaders,
69
- },
70
- body: JSON.stringify({ resourceAttributeAssignments }),
71
- }, this.fetchOptions);
72
- }
73
- catch (err) {
74
- if (err instanceof mondayFetchApi.HttpFetcherError) {
75
- throw new Error(constants.ERROR_MESSAGES.REQUEST_FAILED('upsertResourceAttributes', err.status, err.message));
76
- }
77
- throw err;
78
- }
79
- }
80
- /**
81
- * Delete resource attributes assignments synchronously, performing http call to the authorization MS to delete the given attributes from the given singular resource.
82
- * @param accountId
83
- * @param resource - The resource (resourceType, resourceId) to delete the attributes for.
84
- * @param attributeKeys - Array of attribute keys to delete for the resource.
85
- * @returns ResourceAttributeResponse - The affected (deleted) resource attributes assignments in the `attributes` field.
86
- */
87
- async deleteResourceAttributes(accountId, resource, attributeKeys) {
88
- const attributionHeaders = attributionsService.getAttributionsFromApi();
89
- if (!resource.id) {
90
- throw new Error('Resource ID is required');
91
- }
92
- try {
93
- return await this.httpClient.fetch({
94
- url: {
95
- appName: constants.APP_NAME,
96
- path: AuthorizationAttributesService.API_PATHS.DELETE_RESOURCE_ATTRIBUTES.replace('{accountId}', accountId.toString())
97
- .replace('{resourceType}', resource.type)
98
- .replace('{resourceId}', resource.id.toString()),
99
- },
100
- method: 'DELETE',
101
- headers: {
102
- 'Content-Type': 'application/json',
103
- ...attributionHeaders,
104
- },
105
- body: JSON.stringify({ keys: attributeKeys }),
106
- }, this.fetchOptions);
107
- }
108
- catch (err) {
109
- if (err instanceof mondayFetchApi.HttpFetcherError) {
110
- throw new Error(constants.ERROR_MESSAGES.REQUEST_FAILED('deleteResourceAttributes', err.status, err.message));
111
- }
112
- throw err;
113
- }
114
- }
115
- /**
116
- * Async function, this function only send the updates request to SNS and return before the change actually took place
117
- * @param accountId
118
- * @param appName - App name of the calling app
119
- * @param callerActionIdentifier - action identifier
120
- * @param resourceAttributeOperations - Array of operations to do on resource attributes.
121
- * @return {Promise<ResourceAttributesOperation[]>} Array of sent operations
122
- * */
123
- async updateResourceAttributesAsync(accountId, appName, callerActionIdentifier, resourceAttributeOperations) {
124
- const topicArn = this.snsArn;
125
- const sendToSnsPromises = [];
126
- const operationChucks = chunk__default.default(resourceAttributeOperations, constants_sns.ASYNC_RESOURCE_ATTRIBUTES_MAX_OPERATIONS_PER_MESSAGE);
127
- for (const operationsChunk of operationChucks) {
128
- sendToSnsPromises.push(this.sendSingleSnsMessage(topicArn, accountId, appName, callerActionIdentifier, operationsChunk));
129
- }
130
- return (await Promise.all(sendToSnsPromises)).flat();
131
- }
132
- async sendSingleSnsMessage(topicArn, accountId, appName, callerActionIdentifier, operations) {
133
- const payload = {
134
- kind: constants_sns.RESOURCE_ATTRIBUTES_SNS_UPDATE_OPERATION_MESSAGE_KIND,
135
- payload: {
136
- accountId: accountId,
137
- callerAppName: appName,
138
- callerActionIdentifier: callerActionIdentifier,
139
- operations: operations,
140
- },
141
- };
142
- try {
143
- await mondaySns.sendToSns(payload, topicArn);
144
- return operations;
145
- }
146
- catch (error) {
147
- authorizationInternalService.logger.error({ error, tag: AuthorizationAttributesService.LOG_TAG }, 'Authorization resource attributes async update: failed to send operations to SNS');
148
- return [];
149
- }
150
- }
151
- static getSnsTopicArn() {
152
- const arnFromEnv = process.env[constants_sns.SNS_ARN_ENV_VAR_NAME];
153
- if (arnFromEnv) {
154
- return arnFromEnv;
155
- }
156
- if (process.env.NODE_ENV === 'development' || process.env.NODE_ENV === 'test') {
157
- return constants_sns.SNS_DEV_TEST_NAME;
158
- }
159
- throw new Error('Unable to get sns topic arn from env variable');
160
- }
161
- /**
162
- * Checks we can contact the required SNS topic that used to send attribute updates to Authorization MS.
163
- * This function can be used as health check for services that updating resource attributes in async is crucial.
164
- * Note this function only verify the POD can contact AWS SDK and the topic exists, but the user still might get
165
- * errors when pushing for the SNS (e.g: in case the AWS role of the POD don't have permissions to push messages).
166
- * However, this is the best we can do without actually push dummy messages to the SNS.
167
- * @return {Promise<boolean>} - true if succeeded
168
- */
169
- async asyncResourceAttributesHealthCheck() {
170
- try {
171
- const requestedTopicArn = this.snsArn;
172
- const attributes = await mondaySns.getTopicAttributes(requestedTopicArn);
173
- const isHealthy = !(!attributes || !('TopicArn' in attributes) || attributes.TopicArn !== requestedTopicArn);
174
- if (!isHealthy) {
175
- authorizationInternalService.logger.error({ requestedTopicArn, snsReturnedAttributes: attributes, tag: AuthorizationAttributesService.LOG_TAG }, 'authorization-attributes-service failed in health check');
176
- }
177
- return isHealthy;
178
- }
179
- catch (error) {
180
- authorizationInternalService.logger.error({ error, tag: AuthorizationAttributesService.LOG_TAG }, 'authorization-attributes-service got error during health check');
181
- return false;
39
+ sns() {
40
+ if (this._snsService === null) {
41
+ this._snsService = new authorizationAttributesSnsService.AuthorizationAttributesSnsService();
182
42
  }
43
+ return this._snsService;
183
44
  }
184
45
  }
185
46
 
@@ -0,0 +1,70 @@
1
+ import { ResourceAttributeOperation, EntityAttributeOperation } from './types/authorization-attributes-contracts';
2
+ import { Resource } from './types/general';
3
+ import { AuthorizationAttributesService } from './types/authorization-attributes-service.interface';
4
+ import { EntityType } from './entity-attributes-constants';
5
+ /**
6
+ * Service class for managing resource attributes asynchronously via SNS.
7
+ * Provides asynchronous operations to create/update and delete attributes on resources.
8
+ */
9
+ export declare class AuthorizationAttributesSnsService implements AuthorizationAttributesService {
10
+ private static LOG_TAG;
11
+ private resourceSnsArn;
12
+ private entitySnsArn;
13
+ /**
14
+ * Public constructor to create the AuthorizationAttributesSnsService instance.
15
+ */
16
+ constructor();
17
+ /**
18
+ * Async function to delete resource attributes using SNS.
19
+ * Sends the updates request to SNS and returns before the change actually took place.
20
+ * @param accountId The account ID
21
+ * @param appName App name of the calling app
22
+ * @param callerActionIdentifier Action identifier
23
+ * @param resource The resource (resourceType, resourceId)
24
+ * @param attributeKeys Array of attribute keys to delete
25
+ * @return Promise with array of sent operations
26
+ */
27
+ deleteResourceAttributes(accountId: number, resource: Resource, attributeKeys: string[], appName?: string, callerActionIdentifier?: string): Promise<ResourceAttributeOperation[]>;
28
+ /**
29
+ * Async function to delete entity attributes using SNS.
30
+ * Sends the updates request to SNS and returns before the change actually took place.
31
+ * @param accountId The account ID
32
+ * @param appName App name of the calling app
33
+ * @param callerActionIdentifier Action identifier
34
+ * @param entityType The entity type
35
+ * @param entityId The entity ID
36
+ * @param attributeKeys Array of attribute keys to delete
37
+ * @return Promise with array of sent operations
38
+ */
39
+ deleteEntityAttributes(accountId: number, entityType: EntityType, entityId: number, attributeKeys: string[], appName?: string, callerActionIdentifier?: string): Promise<EntityAttributeOperation[]>;
40
+ /**
41
+ * Async function, this function only send the updates request to SNS and return before the change actually took place
42
+ * @param accountId
43
+ * @param appName - App name of the calling app
44
+ * @param callerActionIdentifier - action identifier
45
+ * @param resourceAttributeOperations - Array of operations to do on resource attributes.
46
+ * @return {Promise<ResourceAttributesOperation[]>} Array of sent operations
47
+ * */
48
+ updateResourceAttributes(accountId: number, appName: string, callerActionIdentifier: string, resourceAttributeOperations: ResourceAttributeOperation[]): Promise<ResourceAttributeOperation[]>;
49
+ /**
50
+ * Async function, this function only send the updates request to SNS and return before the change actually took place
51
+ * @param accountId
52
+ * @param appName - App name of the calling app
53
+ * @param callerActionIdentifier - action identifier
54
+ * @param entityAttributeOperations - Array of operations to do on entity attributes.
55
+ * @return {Promise<EntityAttributeOperation[]>} Array of sent operations
56
+ * */
57
+ updateEntityAttributes(accountId: number, appName: string, callerActionIdentifier: string, entityAttributeOperations: EntityAttributeOperation[]): Promise<EntityAttributeOperation[]>;
58
+ private sendSingleSnsMessage;
59
+ private static getSnsTopicArn;
60
+ /**
61
+ * Checks we can contact the required SNS topic that used to send attribute updates to Authorization MS.
62
+ * This function can be used as health check for services that updating resource attributes in async is crucial.
63
+ * Note this function only verify the POD can contact AWS SDK and the topic exists, but the user still might get
64
+ * errors when pushing for the SNS (e.g: in case the AWS role of the POD don't have permissions to push messages).
65
+ * However, this is the best we can do without actually push dummy messages to the SNS.
66
+ * @return {Promise<boolean>} - true if succeeded
67
+ */
68
+ asyncResourceAttributesHealthCheck(): Promise<boolean>;
69
+ }
70
+ //# 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,0BAA0B,EAC1B,wBAAwB,EAEzB,MAAM,4CAA4C,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAa3C,OAAO,EAAE,8BAA8B,EAAE,MAAM,oDAAoD,CAAC;AACpG,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAI3D;;;GAGG;AACH,qBAAa,iCAAkC,YAAW,8BAA8B;IACtF,OAAO,CAAC,MAAM,CAAC,OAAO,CAA8B;IACpD,OAAO,CAAC,cAAc,CAAS;IAC/B,OAAO,CAAC,YAAY,CAAS;IAE7B;;OAEG;;IAMH;;;;;;;;;OASG;IACG,wBAAwB,CAC5B,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,QAAQ,EAClB,aAAa,EAAE,MAAM,EAAE,EACvB,OAAO,CAAC,EAAE,MAAM,EAChB,sBAAsB,CAAC,EAAE,MAAM,GAC9B,OAAO,CAAC,0BAA0B,EAAE,CAAC;IAgBxC;;;;;;;;;;OAUG;IACG,sBAAsB,CAC1B,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,MAAM,EAChB,aAAa,EAAE,MAAM,EAAE,EACvB,OAAO,CAAC,EAAE,MAAM,EAChB,sBAAsB,CAAC,EAAE,MAAM,GAC9B,OAAO,CAAC,wBAAwB,EAAE,CAAC;IAiBtC;;;;;;;UAOM;IACA,wBAAwB,CAC5B,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,EACf,sBAAsB,EAAE,MAAM,EAC9B,2BAA2B,EAAE,0BAA0B,EAAE,GACxD,OAAO,CAAC,0BAA0B,EAAE,CAAC;IAoBxC;;;;;;;UAOM;IACA,sBAAsB,CAC1B,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,EACf,sBAAsB,EAAE,MAAM,EAC9B,yBAAyB,EAAE,wBAAwB,EAAE,GACpD,OAAO,CAAC,wBAAwB,EAAE,CAAC;YAoBxB,oBAAoB;IA2BlC,OAAO,CAAC,MAAM,CAAC,cAAc;IA0B7B;;;;;;;OAOG;IACG,kCAAkC,IAAI,OAAO,CAAC,OAAO,CAAC;CAoB7D"}
@@ -0,0 +1,179 @@
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 authorizationInternalService = require('./authorization-internal-service.js');
7
+ const constants_sns = require('./constants/sns.js');
8
+ const utils_validation = require('./utils/validation.js');
9
+
10
+ const _interopDefault = e => e && e.__esModule ? e : { default: e };
11
+
12
+ const chunk__default = /*#__PURE__*/_interopDefault(chunk);
13
+
14
+ /**
15
+ * Service class for managing resource attributes asynchronously via SNS.
16
+ * Provides asynchronous operations to create/update and delete attributes on resources.
17
+ */
18
+ class AuthorizationAttributesSnsService {
19
+ static LOG_TAG = 'authorization_attributes';
20
+ resourceSnsArn;
21
+ entitySnsArn;
22
+ /**
23
+ * Public constructor to create the AuthorizationAttributesSnsService instance.
24
+ */
25
+ constructor() {
26
+ this.resourceSnsArn = AuthorizationAttributesSnsService.getSnsTopicArn(constants_sns.SnsTopicType.RESOURCE);
27
+ this.entitySnsArn = AuthorizationAttributesSnsService.getSnsTopicArn(constants_sns.SnsTopicType.ENTITY);
28
+ }
29
+ /**
30
+ * Async function to delete resource attributes using SNS.
31
+ * Sends the updates request to SNS and returns before the change actually took place.
32
+ * @param accountId The account ID
33
+ * @param appName App name of the calling app
34
+ * @param callerActionIdentifier Action identifier
35
+ * @param resource The resource (resourceType, resourceId)
36
+ * @param attributeKeys Array of attribute keys to delete
37
+ * @return Promise with array of sent operations
38
+ */
39
+ async deleteResourceAttributes(accountId, resource, attributeKeys, appName, callerActionIdentifier) {
40
+ if (!appName || !callerActionIdentifier) {
41
+ throw new Error('appName and callerActionIdentifier are required for SNS service');
42
+ }
43
+ const operations = attributeKeys.map(key => ({
44
+ resourceType: resource.type,
45
+ resourceId: resource.id,
46
+ key,
47
+ operationType: types_authorizationAttributesContracts.AttributeOperation.DELETE,
48
+ }));
49
+ return this.updateResourceAttributes(accountId, appName, callerActionIdentifier, operations);
50
+ }
51
+ /**
52
+ * Async function to delete entity attributes using SNS.
53
+ * Sends the updates request to SNS and returns before the change actually took place.
54
+ * @param accountId The account ID
55
+ * @param appName App name of the calling app
56
+ * @param callerActionIdentifier Action identifier
57
+ * @param entityType The entity type
58
+ * @param entityId The entity ID
59
+ * @param attributeKeys Array of attribute keys to delete
60
+ * @return Promise with array of sent operations
61
+ */
62
+ async deleteEntityAttributes(accountId, entityType, entityId, attributeKeys, appName, callerActionIdentifier) {
63
+ if (!appName || !callerActionIdentifier) {
64
+ throw new Error('appName and callerActionIdentifier are required for SNS service');
65
+ }
66
+ const operations = attributeKeys.map(key => {
67
+ utils_validation.ValidationUtils.validateEntityAssignment({ entityId, entityType, key, value: '' });
68
+ return {
69
+ entityType: entityType,
70
+ entityId,
71
+ key,
72
+ operationType: types_authorizationAttributesContracts.AttributeOperation.DELETE,
73
+ value: '',
74
+ };
75
+ });
76
+ return this.updateEntityAttributes(accountId, appName, callerActionIdentifier, operations);
77
+ }
78
+ /**
79
+ * Async function, this function only send the updates request to SNS and return before the change actually took place
80
+ * @param accountId
81
+ * @param appName - App name of the calling app
82
+ * @param callerActionIdentifier - action identifier
83
+ * @param resourceAttributeOperations - Array of operations to do on resource attributes.
84
+ * @return {Promise<ResourceAttributesOperation[]>} Array of sent operations
85
+ * */
86
+ async updateResourceAttributes(accountId, appName, callerActionIdentifier, resourceAttributeOperations) {
87
+ const topicArn = this.resourceSnsArn;
88
+ const sendToSnsPromises = [];
89
+ const operationChucks = chunk__default.default(resourceAttributeOperations, constants_sns.ASYNC_RESOURCE_ATTRIBUTES_MAX_OPERATIONS_PER_MESSAGE);
90
+ for (const operationsChunk of operationChucks) {
91
+ 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'));
92
+ }
93
+ return (await Promise.all(sendToSnsPromises)).flat();
94
+ }
95
+ /**
96
+ * Async function, this function only send the updates request to SNS and return before the change actually took place
97
+ * @param accountId
98
+ * @param appName - App name of the calling app
99
+ * @param callerActionIdentifier - action identifier
100
+ * @param entityAttributeOperations - Array of operations to do on entity attributes.
101
+ * @return {Promise<EntityAttributeOperation[]>} Array of sent operations
102
+ * */
103
+ async updateEntityAttributes(accountId, appName, callerActionIdentifier, entityAttributeOperations) {
104
+ const topicArn = this.entitySnsArn;
105
+ const sendToSnsPromises = [];
106
+ const operationChucks = chunk__default.default(entityAttributeOperations, constants_sns.ASYNC_ENTITY_ATTRIBUTES_MAX_OPERATIONS_PER_MESSAGE);
107
+ for (const operationsChunk of operationChucks) {
108
+ 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'));
109
+ }
110
+ return (await Promise.all(sendToSnsPromises)).flat();
111
+ }
112
+ async sendSingleSnsMessage(topicArn, accountId, appName, callerActionIdentifier, operations, kind, errorLogMessage) {
113
+ const payload = {
114
+ kind,
115
+ payload: {
116
+ accountId: accountId,
117
+ callerAppName: appName,
118
+ callerActionIdentifier: callerActionIdentifier,
119
+ operations: operations,
120
+ },
121
+ };
122
+ try {
123
+ await mondaySns.sendToSns(payload, topicArn);
124
+ return operations;
125
+ }
126
+ catch (error) {
127
+ authorizationInternalService.logger.error({ error, tag: AuthorizationAttributesSnsService.LOG_TAG }, errorLogMessage);
128
+ return [];
129
+ }
130
+ }
131
+ static getSnsTopicArn(type) {
132
+ let envVarName;
133
+ let devTestName;
134
+ switch (type) {
135
+ case constants_sns.SnsTopicType.ENTITY:
136
+ envVarName = constants_sns.ENTITY_SNS_ARN_ENV_VAR_NAME;
137
+ devTestName = constants_sns.ENTITY_SNS_DEV_TEST_NAME;
138
+ break;
139
+ default:
140
+ // Default to resource SNS constants
141
+ envVarName = constants_sns.RESOURCE_SNS_ARN_ENV_VAR_NAME;
142
+ devTestName = constants_sns.RESOURCE_SNS_DEV_TEST_NAME;
143
+ break;
144
+ }
145
+ const arnFromEnv = process.env[envVarName];
146
+ if (arnFromEnv) {
147
+ return arnFromEnv;
148
+ }
149
+ if (process.env.NODE_ENV === 'development' || process.env.NODE_ENV === 'test') {
150
+ return devTestName;
151
+ }
152
+ throw new Error(`Unable to get ${type} sns topic arn from env variable`);
153
+ }
154
+ /**
155
+ * Checks we can contact the required SNS topic that used to send attribute updates to Authorization MS.
156
+ * This function can be used as health check for services that updating resource attributes in async is crucial.
157
+ * Note this function only verify the POD can contact AWS SDK and the topic exists, but the user still might get
158
+ * errors when pushing for the SNS (e.g: in case the AWS role of the POD don't have permissions to push messages).
159
+ * However, this is the best we can do without actually push dummy messages to the SNS.
160
+ * @return {Promise<boolean>} - true if succeeded
161
+ */
162
+ async asyncResourceAttributesHealthCheck() {
163
+ try {
164
+ const requestedTopicArn = this.resourceSnsArn;
165
+ const attributes = await mondaySns.getTopicAttributes(requestedTopicArn);
166
+ const isHealthy = !(!attributes || !('TopicArn' in attributes) || attributes.TopicArn !== requestedTopicArn);
167
+ if (!isHealthy) {
168
+ authorizationInternalService.logger.error({ requestedTopicArn, snsReturnedAttributes: attributes, tag: AuthorizationAttributesSnsService.LOG_TAG }, 'authorization-attributes-service failed in health check');
169
+ }
170
+ return isHealthy;
171
+ }
172
+ catch (error) {
173
+ authorizationInternalService.logger.error({ error, tag: AuthorizationAttributesSnsService.LOG_TAG }, 'authorization-attributes-service got error during health check');
174
+ return false;
175
+ }
176
+ }
177
+ }
178
+
179
+ exports.AuthorizationAttributesSnsService = AuthorizationAttributesSnsService;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Base class for attribute assignments (Resource or Entity)
3
+ * Provides common validation and functionality
4
+ */
5
+ export declare abstract class BaseAttributeAssignment<T, R> {
6
+ readonly id: number;
7
+ readonly type: T;
8
+ readonly attributeKey: string;
9
+ readonly attributeValue: string;
10
+ constructor(id: number, type: T, attributeKey: string, attributeValue: 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<T, R>): boolean;
17
+ abstract toDataTransferObject(): R;
18
+ }
19
+ //# 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,CAAC,EAAE,CAAC;IAChD,SAAgB,EAAE,EAAE,MAAM,CAAC;IAC3B,SAAgB,IAAI,EAAE,CAAC,CAAC;IACxB,SAAgB,YAAY,EAAE,MAAM,CAAC;IACrC,SAAgB,cAAc,EAAE,MAAM,CAAC;gBAE3B,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,YAAY,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM;IAO7E;;;;OAIG;IACH,MAAM,CAAC,KAAK,EAAE,uBAAuB,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,OAAO;IAIrD,QAAQ,CAAC,oBAAoB,IAAI,CAAC;CACnC"}
@@ -0,0 +1,34 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+
3
+ const isEqual = require('lodash/isEqual.js');
4
+
5
+ const _interopDefault = e => e && e.__esModule ? e : { default: e };
6
+
7
+ const isEqual__default = /*#__PURE__*/_interopDefault(isEqual);
8
+
9
+ /**
10
+ * Base class for attribute assignments (Resource or Entity)
11
+ * Provides common validation and functionality
12
+ */
13
+ class BaseAttributeAssignment {
14
+ id;
15
+ type;
16
+ attributeKey;
17
+ attributeValue;
18
+ constructor(id, type, attributeKey, attributeValue) {
19
+ this.id = id;
20
+ this.type = type;
21
+ this.attributeKey = attributeKey;
22
+ this.attributeValue = attributeValue;
23
+ }
24
+ /**
25
+ * Compares two assignments for equality
26
+ * @param other Another assignment instance
27
+ * @returns true if all properties are equal
28
+ */
29
+ equals(other) {
30
+ return isEqual__default.default(this, other);
31
+ }
32
+ }
33
+
34
+ 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,16 @@
1
+ import { EntityType } from './entity-attributes-constants';
2
+ import { BaseAttributeAssignment } from './base-attribute-assignment';
3
+ import { EntityAttributeAssignment as EntityAttributeAssignmentContract } from './types/authorization-attributes-contracts';
4
+ export declare class EntityAttributeAssignment extends BaseAttributeAssignment<EntityType, EntityAttributeAssignmentContract> {
5
+ readonly entityId: number;
6
+ readonly entityType: EntityType;
7
+ constructor(entityId: number, entityType: EntityType, attributeKey: string, attributeValue: string);
8
+ toDataTransferObject(): EntityAttributeAssignmentContract;
9
+ /**
10
+ * Compares two assignments for equality
11
+ * @param other Another EntityAttributeAssignment instance
12
+ * @returns true if all properties are equal
13
+ */
14
+ equals(other: EntityAttributeAssignment): boolean;
15
+ }
16
+ //# 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,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,EAAE,yBAAyB,IAAI,iCAAiC,EAAE,MAAM,4CAA4C,CAAC;AAG5H,qBAAa,yBAA0B,SAAQ,uBAAuB,CAAC,UAAU,EAAE,iCAAiC,CAAC;IACnH,SAAgB,QAAQ,EAAE,MAAM,CAAC;IACjC,SAAgB,UAAU,EAAE,UAAU,CAAC;gBAE3B,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM;IAOlG,oBAAoB,IAAI,iCAAiC;IAQzD;;;;OAIG;IACH,MAAM,CAAC,KAAK,EAAE,yBAAyB,GAAG,OAAO;CAGlD"}
@@ -0,0 +1,33 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+
3
+ const baseAttributeAssignment = require('./base-attribute-assignment.js');
4
+ const utils_validation = require('./utils/validation.js');
5
+
6
+ class EntityAttributeAssignment extends baseAttributeAssignment.BaseAttributeAssignment {
7
+ entityId;
8
+ entityType;
9
+ constructor(entityId, entityType, attributeKey, attributeValue) {
10
+ utils_validation.ValidationUtils.validateEntityAssignment({ entityId, entityType, key: attributeKey, value: attributeValue });
11
+ super(entityId, entityType, attributeKey, attributeValue);
12
+ this.entityId = entityId;
13
+ this.entityType = entityType;
14
+ }
15
+ toDataTransferObject() {
16
+ return {
17
+ entityId: this.entityId,
18
+ entityType: this.entityType,
19
+ key: this.attributeKey,
20
+ value: this.attributeValue,
21
+ };
22
+ }
23
+ /**
24
+ * Compares two assignments for equality
25
+ * @param other Another EntityAttributeAssignment instance
26
+ * @returns true if all properties are equal
27
+ */
28
+ equals(other) {
29
+ return super.equals(other);
30
+ }
31
+ }
32
+
33
+ exports.EntityAttributeAssignment = EntityAttributeAssignment;
@@ -0,0 +1,7 @@
1
+ export declare enum EntityType {
2
+ User = "user",
3
+ Team = "team",
4
+ Account = "account"
5
+ }
6
+ export declare const ENTITY_TYPES: readonly EntityType[];
7
+ //# sourceMappingURL=entity-attributes-constants.d.ts.map