@mondaydotcomorg/monday-authorization 3.5.2-feat-shaime-support-entity-attributes-4-ddec1d3 → 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 (89) hide show
  1. package/dist/authorization-attributes-ms-service.d.ts +1 -17
  2. package/dist/authorization-attributes-ms-service.d.ts.map +1 -1
  3. package/dist/authorization-attributes-ms-service.js +47 -58
  4. package/dist/authorization-attributes-sns-service.d.ts +2 -23
  5. package/dist/authorization-attributes-sns-service.d.ts.map +1 -1
  6. package/dist/authorization-attributes-sns-service.js +11 -49
  7. package/dist/base-attribute-assignment.d.ts +6 -7
  8. package/dist/base-attribute-assignment.d.ts.map +1 -1
  9. package/dist/base-attribute-assignment.js +5 -7
  10. package/dist/entity-attribute-assignment.d.ts +4 -8
  11. package/dist/entity-attribute-assignment.d.ts.map +1 -1
  12. package/dist/entity-attribute-assignment.js +4 -3
  13. package/dist/errors/argument-error.d.ts.map +1 -1
  14. package/dist/errors/argument-error.js +0 -1
  15. package/dist/esm/authorization-attributes-ms-service.d.ts +1 -17
  16. package/dist/esm/authorization-attributes-ms-service.d.ts.map +1 -1
  17. package/dist/esm/authorization-attributes-ms-service.mjs +47 -58
  18. package/dist/esm/authorization-attributes-sns-service.d.ts +2 -23
  19. package/dist/esm/authorization-attributes-sns-service.d.ts.map +1 -1
  20. package/dist/esm/authorization-attributes-sns-service.mjs +11 -49
  21. package/dist/esm/base-attribute-assignment.d.ts +6 -7
  22. package/dist/esm/base-attribute-assignment.d.ts.map +1 -1
  23. package/dist/esm/base-attribute-assignment.mjs +5 -7
  24. package/dist/esm/entity-attribute-assignment.d.ts +4 -8
  25. package/dist/esm/entity-attribute-assignment.d.ts.map +1 -1
  26. package/dist/esm/entity-attribute-assignment.mjs +4 -3
  27. package/dist/esm/errors/argument-error.d.ts.map +1 -1
  28. package/dist/esm/errors/argument-error.mjs +0 -1
  29. package/dist/esm/resource-attribute-assignment.d.ts +3 -7
  30. package/dist/esm/resource-attribute-assignment.d.ts.map +1 -1
  31. package/dist/esm/resource-attribute-assignment.mjs +3 -2
  32. package/dist/esm/resource-attributes-constants.d.ts +9 -9
  33. package/dist/esm/resource-attributes-constants.d.ts.map +1 -1
  34. package/dist/esm/resource-attributes-constants.mjs +2 -2
  35. package/dist/esm/testKit/index.d.ts +4 -4
  36. package/dist/esm/testKit/index.d.ts.map +1 -1
  37. package/dist/esm/types/authorization-attributes-contracts.d.ts +1 -2
  38. package/dist/esm/types/authorization-attributes-contracts.d.ts.map +1 -1
  39. package/dist/esm/types/authorization-attributes-service.interface.d.ts +2 -16
  40. package/dist/esm/types/authorization-attributes-service.interface.d.ts.map +1 -1
  41. package/dist/esm/types/general.d.ts +1 -1
  42. package/dist/esm/types/general.d.ts.map +1 -1
  43. package/dist/esm/utils/assigment-schema.d.ts +23 -0
  44. package/dist/esm/utils/assigment-schema.d.ts.map +1 -0
  45. package/dist/esm/utils/assigment-schema.mjs +29 -0
  46. package/dist/esm/utils/resource-schema.d.ts +17 -0
  47. package/dist/esm/utils/resource-schema.d.ts.map +1 -0
  48. package/dist/esm/utils/resource-schema.mjs +16 -0
  49. package/dist/esm/utils/validation.d.ts +9 -28
  50. package/dist/esm/utils/validation.d.ts.map +1 -1
  51. package/dist/esm/utils/validation.mjs +39 -121
  52. package/dist/resource-attribute-assignment.d.ts +3 -7
  53. package/dist/resource-attribute-assignment.d.ts.map +1 -1
  54. package/dist/resource-attribute-assignment.js +3 -2
  55. package/dist/resource-attributes-constants.d.ts +9 -9
  56. package/dist/resource-attributes-constants.d.ts.map +1 -1
  57. package/dist/resource-attributes-constants.js +2 -2
  58. package/dist/testKit/index.d.ts +4 -4
  59. package/dist/testKit/index.d.ts.map +1 -1
  60. package/dist/types/authorization-attributes-contracts.d.ts +1 -2
  61. package/dist/types/authorization-attributes-contracts.d.ts.map +1 -1
  62. package/dist/types/authorization-attributes-service.interface.d.ts +2 -16
  63. package/dist/types/authorization-attributes-service.interface.d.ts.map +1 -1
  64. package/dist/types/general.d.ts +1 -1
  65. package/dist/types/general.d.ts.map +1 -1
  66. package/dist/utils/assigment-schema.d.ts +23 -0
  67. package/dist/utils/assigment-schema.d.ts.map +1 -0
  68. package/dist/utils/assigment-schema.js +36 -0
  69. package/dist/utils/resource-schema.d.ts +17 -0
  70. package/dist/utils/resource-schema.d.ts.map +1 -0
  71. package/dist/utils/resource-schema.js +22 -0
  72. package/dist/utils/validation.d.ts +9 -28
  73. package/dist/utils/validation.d.ts.map +1 -1
  74. package/dist/utils/validation.js +39 -121
  75. package/package.json +1 -1
  76. package/src/authorization-attributes-ms-service.ts +93 -117
  77. package/src/authorization-attributes-sns-service.ts +14 -69
  78. package/src/base-attribute-assignment.ts +10 -26
  79. package/src/entity-attribute-assignment.ts +9 -6
  80. package/src/errors/argument-error.ts +0 -1
  81. package/src/resource-attribute-assignment.ts +10 -12
  82. package/src/resource-attributes-constants.ts +2 -2
  83. package/src/testKit/index.ts +5 -5
  84. package/src/types/authorization-attributes-contracts.ts +1 -1
  85. package/src/types/authorization-attributes-service.interface.ts +2 -33
  86. package/src/types/general.ts +1 -1
  87. package/src/utils/assigment-schema.ts +29 -0
  88. package/src/utils/resource-schema.ts +21 -0
  89. package/src/utils/validation.ts +51 -140
@@ -3,7 +3,6 @@ import { signAuthorizationHeader } from '@mondaydotcomorg/monday-jwt';
3
3
  import { ResourceAttributeAssignment } from './resource-attribute-assignment.mjs';
4
4
  import { EntityAttributeAssignment } from './entity-attribute-assignment.mjs';
5
5
  import { AttributeOperation } from './types/authorization-attributes-contracts.mjs';
6
- import { ArgumentError } from './errors/argument-error.mjs';
7
6
  import { logger, AuthorizationInternalService } from './authorization-internal-service.mjs';
8
7
  import { getAttributionsFromApi } from './attributions-service.mjs';
9
8
  import { APP_NAME } from './constants.mjs';
@@ -20,19 +19,7 @@ const DELETE_ENTITY_ATTRIBUTES_PATH = '/attributes/{accountId}/entity/{entityTyp
20
19
  */
21
20
  class AuthorizationAttributesMsService {
22
21
  static LOG_TAG = 'authorization_attributes_ms';
23
- static httpClient = Api.getPart('httpClient') ?? null;
24
- static destroyHttpClient() {
25
- AuthorizationAttributesMsService.httpClient = null;
26
- }
27
- /**
28
- * Creates or updates resource attributes synchronously.
29
- * @param accountId The account ID
30
- * @param resourceAttributeAssignments Array of ResourceAttributeAssignment objects
31
- * @returns Promise<void>
32
- */
33
- async upsertResourceAttributes(accountId, resourceAttributeAssignments, _appName, _callerActionIdentifier) {
34
- return AuthorizationAttributesMsService.executeUpsertRequest(accountId, resourceAttributeAssignments, UPSERT_RESOURCE_ATTRIBUTES_PATH, 'resourceAttributeAssignments', ResourceAttributeAssignment, 'resource', 'upsertResourceAttributes');
35
- }
22
+ static httpClient = Api.getPart('httpClient');
36
23
  /**
37
24
  * Deletes specific attributes from a resource synchronously.
38
25
  * @param accountId The account ID
@@ -42,20 +29,10 @@ class AuthorizationAttributesMsService {
42
29
  */
43
30
  async deleteResourceAttributes(accountId, resource, attributeKeys, _appName, _callerActionIdentifier) {
44
31
  ValidationUtils.validateResource(resource);
45
- ValidationUtils.validateStringArray(attributeKeys);
46
32
  return AuthorizationAttributesMsService.executeDeleteRequest(accountId, DELETE_RESOURCE_ATTRIBUTES_PATH, {
47
33
  resourceType: resource.type,
48
34
  resourceId: resource.id,
49
- }, attributeKeys, 'resource', 'deleteResourceAttributesSync', { resource });
50
- }
51
- /**
52
- * Creates or updates entity attributes synchronously.
53
- * @param accountId The account ID
54
- * @param entityAttributeAssignments Array of EntityAttributeAssignment objects
55
- * @returns Promise<void>
56
- */
57
- async upsertEntityAttributes(accountId, entityAttributeAssignments, _appName, _callerActionIdentifier) {
58
- return AuthorizationAttributesMsService.executeUpsertRequest(accountId, entityAttributeAssignments, UPSERT_ENTITY_ATTRIBUTES_PATH, 'entityAttributeAssignments', EntityAttributeAssignment, 'entity', 'upsertEntityAttributesSync');
35
+ }, attributeKeys, 'resource', 'deleteResourceAttributesSync');
59
36
  }
60
37
  /**
61
38
  * Deletes specific attributes from an entity synchronously.
@@ -66,14 +43,11 @@ class AuthorizationAttributesMsService {
66
43
  * @returns Promise<void>
67
44
  */
68
45
  async deleteEntityAttributes(accountId, entityType, entityId, attributeKeys, _appName, _callerActionIdentifier) {
69
- if (!entityType || typeof entityType !== 'string' || entityType.trim() === '') {
70
- throw new ArgumentError(`entityType must be a non-empty string, got: ${entityType}`);
71
- }
72
- ValidationUtils.validateInteger(entityId);
46
+ ValidationUtils.validateInteger(accountId);
73
47
  return AuthorizationAttributesMsService.executeDeleteRequest(accountId, DELETE_ENTITY_ATTRIBUTES_PATH, {
74
48
  entityType,
75
49
  entityId,
76
- }, attributeKeys, 'entity', 'deleteEntityAttributesSync', { entityType, entityId });
50
+ }, attributeKeys, 'entity', 'deleteEntityAttributesSync');
77
51
  }
78
52
  /**
79
53
  * Updates resource attributes (batch operations).
@@ -86,29 +60,27 @@ class AuthorizationAttributesMsService {
86
60
  * @returns Promise<ResourceAttributesOperation[]> Array of processed operations
87
61
  */
88
62
  async updateResourceAttributes(accountId, _appName, _callerActionIdentifier, resourceAttributeOperations) {
89
- const processedOperations = [];
90
- for (const operation of resourceAttributeOperations) {
63
+ // Process all operations in parallel using Promise.all
64
+ await Promise.all(resourceAttributeOperations.map(async (operation) => {
65
+ ValidationUtils.validateResourceAssignment({
66
+ resourceId: operation.resourceId,
67
+ resourceType: operation.resourceType,
68
+ key: operation.key,
69
+ value: operation.value || '',
70
+ });
91
71
  if (operation.operationType === AttributeOperation.UPSERT) {
92
- if (!operation.resourceId) {
93
- throw new ArgumentError('resourceId is required for upsert operation');
94
- }
95
72
  await this.upsertResourceAttributes(accountId, [
96
73
  new ResourceAttributeAssignment(operation.resourceId, operation.resourceType, operation.key, operation.value || ''),
97
74
  ]);
98
- processedOperations.push(operation);
99
75
  }
100
76
  else if (operation.operationType === AttributeOperation.DELETE) {
101
- if (!operation.resourceId) {
102
- throw new ArgumentError('resourceId is required for delete operation');
103
- }
104
77
  await this.deleteResourceAttributes(accountId, {
105
78
  type: operation.resourceType,
106
79
  id: operation.resourceId,
107
80
  }, [operation.key]);
108
- processedOperations.push(operation);
109
81
  }
110
- }
111
- return processedOperations;
82
+ }));
83
+ return resourceAttributeOperations;
112
84
  }
113
85
  /**
114
86
  * Updates entity attributes (batch operations).
@@ -121,20 +93,25 @@ class AuthorizationAttributesMsService {
121
93
  * @returns Promise<EntityAttributesOperation[]> Array of processed operations
122
94
  */
123
95
  async updateEntityAttributes(accountId, _appName, _callerActionIdentifier, entityAttributeOperations) {
124
- const processedOperations = [];
125
- for (const operation of entityAttributeOperations) {
96
+ // Process all operations in parallel using Promise.all
97
+ await Promise.all(entityAttributeOperations.map(async (operation) => {
98
+ // Validate before processing
99
+ ValidationUtils.validateEntityAssignment({
100
+ entityId: operation.entityId,
101
+ entityType: operation.entityType,
102
+ key: operation.key,
103
+ value: operation.value || '',
104
+ });
126
105
  if (operation.operationType === 'upsert') {
127
- await this.upsertEntityAttributes(accountId, [
106
+ await AuthorizationAttributesMsService.executeUpsertRequest(accountId, [
128
107
  new EntityAttributeAssignment(operation.entityId, operation.entityType, operation.key, operation.value || ''),
129
- ]);
130
- processedOperations.push(operation);
108
+ ], UPSERT_ENTITY_ATTRIBUTES_PATH, 'entityAttributeAssignments', 'entity', 'upsertEntityAttributesSync');
131
109
  }
132
110
  else if (operation.operationType === 'delete') {
133
111
  await this.deleteEntityAttributes(accountId, operation.entityType, operation.entityId, [operation.key]);
134
- processedOperations.push(operation);
135
112
  }
136
- }
137
- return processedOperations;
113
+ }));
114
+ return entityAttributeOperations;
138
115
  }
139
116
  /**
140
117
  * Replaces path template parameters with actual values
@@ -152,7 +129,7 @@ class AuthorizationAttributesMsService {
152
129
  /**
153
130
  * Generic helper for executing delete requests
154
131
  */
155
- static async executeDeleteRequest(accountId, pathTemplate, pathParams, keys, logPrefix, methodName, context = {}) {
132
+ static async executeDeleteRequest(accountId, pathTemplate, pathParams, keys, logPrefix, methodName) {
156
133
  // Validate inputs
157
134
  ValidationUtils.validateInteger(accountId);
158
135
  ValidationUtils.validateStringArray(keys);
@@ -188,7 +165,6 @@ class AuthorizationAttributesMsService {
188
165
  method: methodName,
189
166
  accountId,
190
167
  ...pathParams,
191
- ...context,
192
168
  error: err instanceof Error ? err.message : String(err),
193
169
  }, `Failed in ${methodName}`);
194
170
  throw err;
@@ -242,12 +218,7 @@ class AuthorizationAttributesMsService {
242
218
  /**
243
219
  * Generic helper for executing upsert requests
244
220
  */
245
- static async executeUpsertRequest(accountId, assignments, pathTemplate, requestBodyKey, assignmentClass, logPrefix, methodName) {
246
- ValidationUtils.validateInteger(accountId);
247
- ValidationUtils.validateArrayTypeOf(assignments, assignmentClass);
248
- if (!assignments.length) {
249
- return;
250
- }
221
+ static async executeUpsertRequest(accountId, assignments, pathTemplate, requestBodyKey, logPrefix, methodName) {
251
222
  const assignmentDto = assignments.map(assignment => assignment.toDataTransferObject());
252
223
  const requestBody = requestBodyKey === 'resourceAttributeAssignments'
253
224
  ? { resourceAttributeAssignments: assignmentDto }
@@ -283,6 +254,24 @@ class AuthorizationAttributesMsService {
283
254
  throw err;
284
255
  }
285
256
  }
257
+ async upsertResourceAttributes(accountId, resourceAttributeAssignments) {
258
+ const attributionHeaders = getAttributionsFromApi();
259
+ if (!AuthorizationAttributesMsService.httpClient) {
260
+ throw new Error('AuthorizationAttributesMsService: HTTP client is not initialized');
261
+ }
262
+ return await AuthorizationAttributesMsService.httpClient.fetch({
263
+ url: {
264
+ appName: APP_NAME,
265
+ path: UPSERT_RESOURCE_ATTRIBUTES_PATH.replace('{accountId}', accountId.toString()),
266
+ },
267
+ method: 'POST',
268
+ headers: {
269
+ 'Content-Type': 'application/json',
270
+ ...attributionHeaders,
271
+ },
272
+ body: JSON.stringify({ resourceAttributeAssignments }),
273
+ });
274
+ }
286
275
  }
287
276
 
288
277
  export { AuthorizationAttributesMsService };
@@ -1,5 +1,4 @@
1
- import { ResourceAttributeAssignment, ResourceAttributeOperation, EntityAttributeOperation } from './types/authorization-attributes-contracts';
2
- import { EntityAttributeAssignment } from './entity-attribute-assignment';
1
+ import { ResourceAttributeOperation, EntityAttributeOperation } from './types/authorization-attributes-contracts';
3
2
  import { Resource } from './types/general';
4
3
  import { AuthorizationAttributesService } from './types/authorization-attributes-service.interface';
5
4
  import { EntityType } from './entity-attributes-constants';
@@ -15,16 +14,6 @@ export declare class AuthorizationAttributesSnsService implements AuthorizationA
15
14
  * Public constructor to create the AuthorizationAttributesSnsService instance.
16
15
  */
17
16
  constructor();
18
- /**
19
- * Async function to upsert resource attributes using SNS.
20
- * Sends the updates request to SNS and returns before the change actually took place.
21
- * @param accountId The account ID
22
- * @param appName App name of the calling app
23
- * @param callerActionIdentifier Action identifier
24
- * @param resourceAttributeAssignments Array of resource attribute assignments to upsert
25
- * @return Promise with array of sent operations
26
- */
27
- upsertResourceAttributes(accountId: number, resourceAttributeAssignments: ResourceAttributeAssignment[], appName?: string, callerActionIdentifier?: string): Promise<ResourceAttributeOperation[]>;
28
17
  /**
29
18
  * Async function to delete resource attributes using SNS.
30
19
  * Sends the updates request to SNS and returns before the change actually took place.
@@ -36,16 +25,6 @@ export declare class AuthorizationAttributesSnsService implements AuthorizationA
36
25
  * @return Promise with array of sent operations
37
26
  */
38
27
  deleteResourceAttributes(accountId: number, resource: Resource, attributeKeys: string[], appName?: string, callerActionIdentifier?: string): Promise<ResourceAttributeOperation[]>;
39
- /**
40
- * Async function to upsert entity attributes using SNS.
41
- * Sends the updates request to SNS and returns before the change actually took place.
42
- * @param accountId The account ID
43
- * @param appName App name of the calling app
44
- * @param callerActionIdentifier Action identifier
45
- * @param entityAttributeAssignments Array of entity attribute assignments to upsert
46
- * @return Promise with array of sent operations
47
- */
48
- upsertEntityAttributes(accountId: number, entityAttributeAssignments: EntityAttributeAssignment[], appName?: string, callerActionIdentifier?: string): Promise<EntityAttributeOperation[]>;
49
28
  /**
50
29
  * Async function to delete entity attributes using SNS.
51
30
  * Sends the updates request to SNS and returns before the change actually took place.
@@ -57,7 +36,7 @@ export declare class AuthorizationAttributesSnsService implements AuthorizationA
57
36
  * @param attributeKeys Array of attribute keys to delete
58
37
  * @return Promise with array of sent operations
59
38
  */
60
- deleteEntityAttributes(accountId: number, entityType: EntityType | string, entityId: number, attributeKeys: string[], appName?: string, callerActionIdentifier?: string): Promise<EntityAttributeOperation[]>;
39
+ deleteEntityAttributes(accountId: number, entityType: EntityType, entityId: number, attributeKeys: string[], appName?: string, callerActionIdentifier?: string): Promise<EntityAttributeOperation[]>;
61
40
  /**
62
41
  * Async function, this function only send the updates request to SNS and return before the change actually took place
63
42
  * @param accountId
@@ -1 +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,0BAA0B,EAC1B,wBAAwB,EAEzB,MAAM,4CAA4C,CAAC;AACpD,OAAO,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAC1E,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAc3C,OAAO,EAAE,8BAA8B,EAAE,MAAM,oDAAoD,CAAC;AACpG,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAE3D;;;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;;;;;;;;OAQG;IACG,wBAAwB,CAC5B,SAAS,EAAE,MAAM,EACjB,4BAA4B,EAAE,2BAA2B,EAAE,EAC3D,OAAO,CAAC,EAAE,MAAM,EAChB,sBAAsB,CAAC,EAAE,MAAM,GAC9B,OAAO,CAAC,0BAA0B,EAAE,CAAC;IAWxC;;;;;;;;;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;;;;;;;;OAQG;IACG,sBAAsB,CAC1B,SAAS,EAAE,MAAM,EACjB,0BAA0B,EAAE,yBAAyB,EAAE,EACvD,OAAO,CAAC,EAAE,MAAM,EAChB,sBAAsB,CAAC,EAAE,MAAM,GAC9B,OAAO,CAAC,wBAAwB,EAAE,CAAC;IAgBtC;;;;;;;;;;OAUG;IACG,sBAAsB,CAC1B,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,UAAU,GAAG,MAAM,EAC/B,QAAQ,EAAE,MAAM,EAChB,aAAa,EAAE,MAAM,EAAE,EACvB,OAAO,CAAC,EAAE,MAAM,EAChB,sBAAsB,CAAC,EAAE,MAAM,GAC9B,OAAO,CAAC,wBAAwB,EAAE,CAAC;IAgBtC;;;;;;;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"}
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"}
@@ -3,6 +3,7 @@ import { sendToSns, getTopicAttributes } from '@mondaydotcomorg/monday-sns';
3
3
  import { AttributeOperation } from './types/authorization-attributes-contracts.mjs';
4
4
  import { logger } from './authorization-internal-service.mjs';
5
5
  import { SnsTopicType, ASYNC_RESOURCE_ATTRIBUTES_MAX_OPERATIONS_PER_MESSAGE, RESOURCE_ATTRIBUTES_SNS_UPDATE_OPERATION_MESSAGE_KIND, ASYNC_ENTITY_ATTRIBUTES_MAX_OPERATIONS_PER_MESSAGE, ENTITY_ATTRIBUTES_SNS_UPDATE_OPERATION_MESSAGE_KIND, RESOURCE_SNS_ARN_ENV_VAR_NAME, RESOURCE_SNS_DEV_TEST_NAME, ENTITY_SNS_ARN_ENV_VAR_NAME, ENTITY_SNS_DEV_TEST_NAME } from './constants/sns.mjs';
6
+ import { ValidationUtils } from './utils/validation.mjs';
6
7
 
7
8
  /**
8
9
  * Service class for managing resource attributes asynchronously via SNS.
@@ -19,25 +20,6 @@ class AuthorizationAttributesSnsService {
19
20
  this.resourceSnsArn = AuthorizationAttributesSnsService.getSnsTopicArn(SnsTopicType.RESOURCE);
20
21
  this.entitySnsArn = AuthorizationAttributesSnsService.getSnsTopicArn(SnsTopicType.ENTITY);
21
22
  }
22
- /**
23
- * Async function to upsert 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 resourceAttributeAssignments Array of resource attribute assignments to upsert
29
- * @return Promise with array of sent operations
30
- */
31
- async upsertResourceAttributes(accountId, resourceAttributeAssignments, appName, callerActionIdentifier) {
32
- if (!appName || !callerActionIdentifier) {
33
- throw new Error('appName and callerActionIdentifier are required for SNS service');
34
- }
35
- const operations = resourceAttributeAssignments.map(assignment => ({
36
- ...assignment,
37
- operationType: AttributeOperation.UPSERT,
38
- }));
39
- return this.updateResourceAttributes(accountId, appName, callerActionIdentifier, operations);
40
- }
41
23
  /**
42
24
  * Async function to delete resource attributes using SNS.
43
25
  * Sends the updates request to SNS and returns before the change actually took place.
@@ -60,30 +42,6 @@ class AuthorizationAttributesSnsService {
60
42
  }));
61
43
  return this.updateResourceAttributes(accountId, appName, callerActionIdentifier, operations);
62
44
  }
63
- /**
64
- * Async function to upsert entity attributes using SNS.
65
- * Sends the updates request to SNS and returns before the change actually took place.
66
- * @param accountId The account ID
67
- * @param appName App name of the calling app
68
- * @param callerActionIdentifier Action identifier
69
- * @param entityAttributeAssignments Array of entity attribute assignments to upsert
70
- * @return Promise with array of sent operations
71
- */
72
- async upsertEntityAttributes(accountId, entityAttributeAssignments, appName, callerActionIdentifier) {
73
- if (!appName || !callerActionIdentifier) {
74
- throw new Error('appName and callerActionIdentifier are required for SNS service');
75
- }
76
- const operations = entityAttributeAssignments.map(assignment => {
77
- return {
78
- entityId: assignment.entityId,
79
- entityType: assignment.entityType,
80
- key: assignment.attributeKey,
81
- value: assignment.attributeValue,
82
- operationType: AttributeOperation.UPSERT,
83
- };
84
- });
85
- return this.updateEntityAttributes(accountId, appName, callerActionIdentifier, operations);
86
- }
87
45
  /**
88
46
  * Async function to delete entity attributes using SNS.
89
47
  * Sends the updates request to SNS and returns before the change actually took place.
@@ -99,12 +57,16 @@ class AuthorizationAttributesSnsService {
99
57
  if (!appName || !callerActionIdentifier) {
100
58
  throw new Error('appName and callerActionIdentifier are required for SNS service');
101
59
  }
102
- const operations = attributeKeys.map(key => ({
103
- entityType: entityType,
104
- entityId,
105
- key,
106
- operationType: AttributeOperation.DELETE,
107
- }));
60
+ const operations = attributeKeys.map(key => {
61
+ ValidationUtils.validateEntityAssignment({ entityId, entityType, key, value: '' });
62
+ return {
63
+ entityType: entityType,
64
+ entityId,
65
+ key,
66
+ operationType: AttributeOperation.DELETE,
67
+ value: '',
68
+ };
69
+ });
108
70
  return this.updateEntityAttributes(accountId, appName, callerActionIdentifier, operations);
109
71
  }
110
72
  /**
@@ -1,20 +1,19 @@
1
- import { EntityAttributeAssignment, ResourceAttributeDelete } from './types/authorization-attributes-contracts';
2
1
  /**
3
2
  * Base class for attribute assignments (Resource or Entity)
4
3
  * Provides common validation and functionality
5
4
  */
6
- export declare abstract class BaseAttributeAssignment<TId extends number, TType extends string> {
7
- readonly id: TId;
8
- readonly type: TType;
5
+ export declare abstract class BaseAttributeAssignment<T, R> {
6
+ readonly id: number;
7
+ readonly type: T;
9
8
  readonly attributeKey: string;
10
9
  readonly attributeValue: string;
11
- constructor(id: TId, type: string, attributeKey: string, attributeValue: string, validTypes: readonly string[], idFieldName: string, typeFieldName: string);
10
+ constructor(id: number, type: T, attributeKey: string, attributeValue: string);
12
11
  /**
13
12
  * Compares two assignments for equality
14
13
  * @param other Another assignment instance
15
14
  * @returns true if all properties are equal
16
15
  */
17
- equals(other: BaseAttributeAssignment<TId, TType>): boolean;
18
- abstract toDataTransferObject(): EntityAttributeAssignment | ResourceAttributeDelete;
16
+ equals(other: BaseAttributeAssignment<T, R>): boolean;
17
+ abstract toDataTransferObject(): R;
19
18
  }
20
19
  //# sourceMappingURL=base-attribute-assignment.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"base-attribute-assignment.d.ts","sourceRoot":"","sources":["../../src/base-attribute-assignment.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,yBAAyB,EAAE,uBAAuB,EAAE,MAAM,4CAA4C,CAAC;AAEhH;;;GAGG;AACH,8BAAsB,uBAAuB,CAAC,GAAG,SAAS,MAAM,EAAE,KAAK,SAAS,MAAM;IACpF,SAAgB,EAAE,EAAE,GAAG,CAAC;IACxB,SAAgB,IAAI,EAAE,KAAK,CAAC;IAC5B,SAAgB,YAAY,EAAE,MAAM,CAAC;IACrC,SAAgB,cAAc,EAAE,MAAM,CAAC;gBAGrC,EAAE,EAAE,GAAG,EACP,IAAI,EAAE,MAAM,EACZ,YAAY,EAAE,MAAM,EACpB,cAAc,EAAE,MAAM,EACtB,UAAU,EAAE,SAAS,MAAM,EAAE,EAC7B,WAAW,EAAE,MAAM,EACnB,aAAa,EAAE,MAAM;IAcvB;;;;OAIG;IACH,MAAM,CAAC,KAAK,EAAE,uBAAuB,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,OAAO;IAI3D,QAAQ,CAAC,oBAAoB,IAAI,yBAAyB,GAAG,uBAAuB;CACrF"}
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"}
@@ -1,4 +1,3 @@
1
- import { ValidationUtils } from './utils/validation.mjs';
2
1
  import isEqual from 'lodash/isEqual.js';
3
2
 
4
3
  /**
@@ -10,12 +9,11 @@ class BaseAttributeAssignment {
10
9
  type;
11
10
  attributeKey;
12
11
  attributeValue;
13
- constructor(id, type, attributeKey, attributeValue, validTypes, idFieldName, typeFieldName) {
14
- const validated = ValidationUtils.validateAssignment({ id, type, attributeKey, attributeValue }, validTypes, { id: idFieldName, type: typeFieldName });
15
- this.id = validated.id;
16
- this.type = validated.type;
17
- this.attributeKey = validated.attributeKey;
18
- this.attributeValue = validated.attributeValue;
12
+ constructor(id, type, attributeKey, attributeValue) {
13
+ this.id = id;
14
+ this.type = type;
15
+ this.attributeKey = attributeKey;
16
+ this.attributeValue = attributeValue;
19
17
  }
20
18
  /**
21
19
  * Compares two assignments for equality
@@ -1,15 +1,11 @@
1
1
  import { EntityType } from './entity-attributes-constants';
2
2
  import { BaseAttributeAssignment } from './base-attribute-assignment';
3
- export declare class EntityAttributeAssignment extends BaseAttributeAssignment<number, EntityType> {
3
+ import { EntityAttributeAssignment as EntityAttributeAssignmentContract } from './types/authorization-attributes-contracts';
4
+ export declare class EntityAttributeAssignment extends BaseAttributeAssignment<EntityType, EntityAttributeAssignmentContract> {
4
5
  readonly entityId: number;
5
6
  readonly entityType: EntityType;
6
- constructor(entityId: number, entityType: string, attributeKey: string, attributeValue: string);
7
- toDataTransferObject(): {
8
- entityId: number;
9
- entityType: EntityType;
10
- key: string;
11
- value: string;
12
- };
7
+ constructor(entityId: number, entityType: EntityType, attributeKey: string, attributeValue: string);
8
+ toDataTransferObject(): EntityAttributeAssignmentContract;
13
9
  /**
14
10
  * Compares two assignments for equality
15
11
  * @param other Another EntityAttributeAssignment instance
@@ -1 +1 @@
1
- {"version":3,"file":"entity-attribute-assignment.d.ts","sourceRoot":"","sources":["../../src/entity-attribute-assignment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,UAAU,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAEtE,qBAAa,yBAA0B,SAAQ,uBAAuB,CAAC,MAAM,EAAE,UAAU,CAAC;IACxF,SAAgB,QAAQ,EAAE,MAAM,CAAC;IACjC,SAAgB,UAAU,EAAE,UAAU,CAAC;gBAE3B,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM;IAM9F,oBAAoB;;;;;;IAQpB;;;;OAIG;IACH,MAAM,CAAC,KAAK,EAAE,yBAAyB,GAAG,OAAO;CAGlD"}
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"}
@@ -1,13 +1,14 @@
1
- import { ENTITY_TYPES } from './entity-attributes-constants.mjs';
2
1
  import { BaseAttributeAssignment } from './base-attribute-assignment.mjs';
2
+ import { ValidationUtils } from './utils/validation.mjs';
3
3
 
4
4
  class EntityAttributeAssignment extends BaseAttributeAssignment {
5
5
  entityId;
6
6
  entityType;
7
7
  constructor(entityId, entityType, attributeKey, attributeValue) {
8
- super(entityId, entityType, attributeKey, attributeValue, ENTITY_TYPES, 'entityId', 'entityType');
8
+ ValidationUtils.validateEntityAssignment({ entityId, entityType, key: attributeKey, value: attributeValue });
9
+ super(entityId, entityType, attributeKey, attributeValue);
9
10
  this.entityId = entityId;
10
- this.entityType = this.type;
11
+ this.entityType = entityType;
11
12
  }
12
13
  toDataTransferObject() {
13
14
  return {
@@ -1 +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"}
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;CAI5B"}
@@ -2,7 +2,6 @@ class ArgumentError extends Error {
2
2
  constructor(message) {
3
3
  super(message);
4
4
  this.name = 'ArgumentError';
5
- Object.setPrototypeOf(this, ArgumentError.prototype);
6
5
  }
7
6
  }
8
7
 
@@ -1,15 +1,11 @@
1
1
  import { ResourceType } from './resource-attributes-constants';
2
2
  import { BaseAttributeAssignment } from './base-attribute-assignment';
3
- export declare class ResourceAttributeAssignment extends BaseAttributeAssignment<number, ResourceType> {
3
+ import { ResourceAttributeAssignment as ResourceAttributeAssignmentContract } from './types/authorization-attributes-contracts';
4
+ export declare class ResourceAttributeAssignment extends BaseAttributeAssignment<ResourceType, ResourceAttributeAssignmentContract> {
4
5
  readonly resourceId: number;
5
6
  readonly resourceType: ResourceType;
6
7
  constructor(resourceId: number, resourceType: ResourceType, attributeKey: string, attributeValue: string);
7
- toDataTransferObject(): {
8
- resourceId: number;
9
- resourceType: ResourceType;
10
- key: string;
11
- value: string;
12
- };
8
+ toDataTransferObject(): ResourceAttributeAssignmentContract;
13
9
  /**
14
10
  * Compares two assignments for equality
15
11
  * @param other Another ResourceAttributeAssignment instance
@@ -1 +1 @@
1
- {"version":3,"file":"resource-attribute-assignment.d.ts","sourceRoot":"","sources":["../../src/resource-attribute-assignment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/E,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAEtE,qBAAa,2BAA4B,SAAQ,uBAAuB,CAAC,MAAM,EAAE,YAAY,CAAC;IAC5F,SAAgB,UAAU,EAAE,MAAM,CAAC;IACnC,SAAgB,YAAY,EAAE,YAAY,CAAC;gBAE/B,UAAU,EAAE,MAAM,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM;IAcxG,oBAAoB;;;;;;IAQpB;;;;OAIG;IACH,MAAM,CAAC,KAAK,EAAE,2BAA2B,GAAG,OAAO;CAGpD"}
1
+ {"version":3,"file":"resource-attribute-assignment.d.ts","sourceRoot":"","sources":["../../src/resource-attribute-assignment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,EAAE,2BAA2B,IAAI,mCAAmC,EAAE,MAAM,4CAA4C,CAAC;AAGhI,qBAAa,2BAA4B,SAAQ,uBAAuB,CACtE,YAAY,EACZ,mCAAmC,CACpC;IACC,SAAgB,UAAU,EAAE,MAAM,CAAC;IACnC,SAAgB,YAAY,EAAE,YAAY,CAAC;gBAE/B,UAAU,EAAE,MAAM,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM;IAOxG,oBAAoB,IAAI,mCAAmC;IAQ3D;;;;OAIG;IACH,MAAM,CAAC,KAAK,EAAE,2BAA2B,GAAG,OAAO;CAGpD"}
@@ -1,11 +1,12 @@
1
- import { RESOURCE_TYPES } from './resource-attributes-constants.mjs';
2
1
  import { BaseAttributeAssignment } from './base-attribute-assignment.mjs';
2
+ import { ValidationUtils } from './utils/validation.mjs';
3
3
 
4
4
  class ResourceAttributeAssignment extends BaseAttributeAssignment {
5
5
  resourceId;
6
6
  resourceType;
7
7
  constructor(resourceId, resourceType, attributeKey, attributeValue) {
8
- super(resourceId, resourceType, attributeKey, attributeValue, Object.values(RESOURCE_TYPES), 'resourceId', 'resourceType');
8
+ ValidationUtils.validateResourceAssignment({ resourceId, resourceType, key: attributeKey, value: attributeValue });
9
+ super(resourceId, resourceType, attributeKey, attributeValue);
9
10
  this.resourceId = resourceId;
10
11
  this.resourceType = this.type;
11
12
  }
@@ -1,15 +1,15 @@
1
- export declare const RESOURCE_ATTRIBUTES_CONSTANTS: {
2
- readonly ACCOUNT_RESOURCE_ATTRIBUTES: {
3
- readonly ENABLE_MEMBERS_INVITE_FROM_NON_AUTH_DOMAIN: "enable_members_invite_from_non_auth_domain";
1
+ export declare const RESOURCE_ATTRIBUTES_CONSTANTS: Readonly<{
2
+ ACCOUNT_RESOURCE_ATTRIBUTES: {
3
+ ENABLE_MEMBERS_INVITE_FROM_NON_AUTH_DOMAIN: string;
4
4
  };
5
- readonly WORKSPACE_RESOURCE_ATTRIBUTES: {
6
- readonly IS_DEFAULT_WORKSPACE: "is_default_workspace";
5
+ WORKSPACE_RESOURCE_ATTRIBUTES: {
6
+ IS_DEFAULT_WORKSPACE: string;
7
7
  };
8
- readonly BOARD_RESOURCE_ATTRIBUTES: {
9
- readonly IS_SYNCABLE_CHILD_ENTITY: "is_syncable_child_entity";
10
- readonly SYSTEM_ENTITY_TYPE: "system_entity_type";
8
+ BOARD_RESOURCE_ATTRIBUTES: {
9
+ IS_SYNCABLE_CHILD_ENTITY: string;
10
+ SYSTEM_ENTITY_TYPE: string;
11
11
  };
12
- };
12
+ }>;
13
13
  export declare enum ResourceType {
14
14
  Account = "account",
15
15
  AccountProduct = "account_product",
@@ -1 +1 @@
1
- {"version":3,"file":"resource-attributes-constants.d.ts","sourceRoot":"","sources":["../../src/resource-attributes-constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,6BAA6B;;;;;;;;;;;CAWhC,CAAC;AAEX,oBAAY,YAAY;IACtB,OAAO,YAAY;IACnB,cAAc,oBAAoB;IAClC,SAAS,cAAc;IACvB,KAAK,UAAU;IACf,IAAI,SAAS;IACb,IAAI,SAAS;IACb,QAAQ,aAAa;IACrB,QAAQ,aAAa;IACrB,GAAG,QAAQ;CACZ;AAGD,eAAO,MAAM,cAAc,yBAA6C,CAAC"}
1
+ {"version":3,"file":"resource-attributes-constants.d.ts","sourceRoot":"","sources":["../../src/resource-attributes-constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,6BAA6B;;;;;;;;;;;EAWxC,CAAC;AAEH,oBAAY,YAAY;IACtB,OAAO,YAAY;IACnB,cAAc,oBAAoB;IAClC,SAAS,cAAc;IACvB,KAAK,UAAU;IACf,IAAI,SAAS;IACb,IAAI,SAAS;IACb,QAAQ,aAAa;IACrB,QAAQ,aAAa;IACrB,GAAG,QAAQ;CACZ;AAGD,eAAO,MAAM,cAAc,yBAA6C,CAAC"}
@@ -1,4 +1,4 @@
1
- const RESOURCE_ATTRIBUTES_CONSTANTS = {
1
+ const RESOURCE_ATTRIBUTES_CONSTANTS = Object.freeze({
2
2
  ACCOUNT_RESOURCE_ATTRIBUTES: {
3
3
  ENABLE_MEMBERS_INVITE_FROM_NON_AUTH_DOMAIN: 'enable_members_invite_from_non_auth_domain',
4
4
  },
@@ -9,7 +9,7 @@ const RESOURCE_ATTRIBUTES_CONSTANTS = {
9
9
  IS_SYNCABLE_CHILD_ENTITY: 'is_syncable_child_entity',
10
10
  SYSTEM_ENTITY_TYPE: 'system_entity_type',
11
11
  },
12
- };
12
+ });
13
13
  var ResourceType;
14
14
  (function (ResourceType) {
15
15
  ResourceType["Account"] = "account";
@@ -1,12 +1,12 @@
1
- import { BaseRequest, BaseResponse, ContextGetter, Resource, ResourceGetter } from '../types/general';
1
+ import { Action, BaseRequest, BaseResponse, ContextGetter, Resource, ResourceGetter } from '../types/general';
2
2
  import type { NextFunction } from 'express';
3
3
  export type TestPermittedAction = {
4
4
  accountId: number;
5
5
  userId: number;
6
6
  resources: Resource[];
7
- action: string;
7
+ action: Action;
8
8
  };
9
- export declare const addTestPermittedAction: (accountId: number, userId: number, resources: Resource[], action: string) => void;
9
+ export declare const addTestPermittedAction: (accountId: number, userId: number, resources: Resource[], action: Action) => void;
10
10
  export declare const clearTestPermittedActions: () => void;
11
- export declare const getTestAuthorizationMiddleware: (action: string, resourceGetter: ResourceGetter, contextGetter?: ContextGetter) => (request: BaseRequest, response: BaseResponse, next: NextFunction) => Promise<void>;
11
+ export declare const getTestAuthorizationMiddleware: (action: Action, resourceGetter: ResourceGetter, contextGetter?: ContextGetter) => (request: BaseRequest, response: BaseResponse, next: NextFunction) => Promise<void>;
12
12
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/testKit/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,aAAa,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGtG,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C,MAAM,MAAM,mBAAmB,GAAG;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,QAAQ,EAAE,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAGF,eAAO,MAAM,sBAAsB,GAAI,WAAW,MAAM,EAAE,QAAQ,MAAM,EAAE,WAAW,QAAQ,EAAE,EAAE,QAAQ,MAAM,SAE9G,CAAC;AAEF,eAAO,MAAM,yBAAyB,YAErC,CAAC;AA4BF,eAAO,MAAM,8BAA8B,GACzC,QAAQ,MAAM,EACd,gBAAgB,cAAc,EAC9B,gBAAgB,aAAa,MAG3B,SAAS,WAAW,EACpB,UAAU,YAAY,EACtB,MAAM,YAAY,KACjB,OAAO,CAAC,IAAI,CAYhB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/testKit/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,YAAY,EAAE,aAAa,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAG9G,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C,MAAM,MAAM,mBAAmB,GAAG;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,QAAQ,EAAE,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAGF,eAAO,MAAM,sBAAsB,GAAI,WAAW,MAAM,EAAE,QAAQ,MAAM,EAAE,WAAW,QAAQ,EAAE,EAAE,QAAQ,MAAM,SAE9G,CAAC;AAEF,eAAO,MAAM,yBAAyB,YAErC,CAAC;AA4BF,eAAO,MAAM,8BAA8B,GACzC,QAAQ,MAAM,EACd,gBAAgB,cAAc,EAC9B,gBAAgB,aAAa,MAG3B,SAAS,WAAW,EACpB,UAAU,YAAY,EACtB,MAAM,YAAY,KACjB,OAAO,CAAC,IAAI,CAYhB,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import { Resource } from './general';
2
2
  import type { EntityType } from '../entity-attributes-constants';
3
3
  import type { ResourceType } from '../resource-attributes-constants';
4
- interface AttributeAssignment {
4
+ export interface AttributeAssignment {
5
5
  key: string;
6
6
  value: string;
7
7
  }
@@ -39,5 +39,4 @@ export interface ResourceAttributeOperation extends ResourceAttributeAssignment
39
39
  export interface EntityAttributeOperation extends EntityAttributeAssignment {
40
40
  operationType: AttributeOperation;
41
41
  }
42
- export {};
43
42
  //# sourceMappingURL=authorization-attributes-contracts.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"authorization-attributes-contracts.d.ts","sourceRoot":"","sources":["../../../src/types/authorization-attributes-contracts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAErE,UAAU,mBAAmB;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;CACf;AAGD,MAAM,WAAW,2BAA4B,SAAQ,mBAAmB;IACtE,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,YAAY,CAAC;CAC5B;AAID,MAAM,WAAW,yBAA0B,SAAQ,mBAAmB;IACpE,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,UAAU,CAAC;CACxB;AAGD,MAAM,WAAW,uBAAuB;IACtC,YAAY,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC/B,UAAU,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC3B,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,qBAAqB;IACpC,UAAU,EAAE,UAAU,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;CACb;AAED,oBAAY,kBAAkB;IAC5B,MAAM,WAAW;IACjB,MAAM,WAAW;CAClB;AAGD,MAAM,WAAW,yBAAyB;IACxC,UAAU,EAAE,2BAA2B,EAAE,CAAC;CAC3C;AAED,MAAM,WAAW,uBAAuB;IACtC,UAAU,EAAE,yBAAyB,EAAE,CAAC;CACzC;AAED,MAAM,WAAW,0BAA2B,SAAQ,2BAA2B;IAC7E,aAAa,EAAE,kBAAkB,CAAC;CACnC;AAED,MAAM,WAAW,wBAAyB,SAAQ,yBAAyB;IACzE,aAAa,EAAE,kBAAkB,CAAC;CACnC"}
1
+ {"version":3,"file":"authorization-attributes-contracts.d.ts","sourceRoot":"","sources":["../../../src/types/authorization-attributes-contracts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAErE,MAAM,WAAW,mBAAmB;IAClC,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;CACf;AAGD,MAAM,WAAW,2BAA4B,SAAQ,mBAAmB;IACtE,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,YAAY,CAAC;CAC5B;AAID,MAAM,WAAW,yBAA0B,SAAQ,mBAAmB;IACpE,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,UAAU,CAAC;CACxB;AAGD,MAAM,WAAW,uBAAuB;IACtC,YAAY,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC/B,UAAU,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC3B,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,qBAAqB;IACpC,UAAU,EAAE,UAAU,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;CACb;AAED,oBAAY,kBAAkB;IAC5B,MAAM,WAAW;IACjB,MAAM,WAAW;CAClB;AAGD,MAAM,WAAW,yBAAyB;IACxC,UAAU,EAAE,2BAA2B,EAAE,CAAC;CAC3C;AAED,MAAM,WAAW,uBAAuB;IACtC,UAAU,EAAE,yBAAyB,EAAE,CAAC;CACzC;AAED,MAAM,WAAW,0BAA2B,SAAQ,2BAA2B;IAC7E,aAAa,EAAE,kBAAkB,CAAC;CACnC;AAED,MAAM,WAAW,wBAAyB,SAAQ,yBAAyB;IACzE,aAAa,EAAE,kBAAkB,CAAC;CACnC"}