@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
@@ -1,5 +1,3 @@
1
- import { ResourceAttributeAssignment } from './resource-attribute-assignment';
2
- import { EntityAttributeAssignment } from './entity-attribute-assignment';
3
1
  import { ResourceAttributeOperation, EntityAttributeOperation } from './types/authorization-attributes-contracts';
4
2
  import { EntityType } from './entity-attributes-constants';
5
3
  import { AuthorizationAttributesService } from './types/authorization-attributes-service.interface';
@@ -11,14 +9,6 @@ import { Resource } from './types/general';
11
9
  export declare class AuthorizationAttributesMsService implements AuthorizationAttributesService {
12
10
  private static LOG_TAG;
13
11
  private static httpClient;
14
- static destroyHttpClient(): void;
15
- /**
16
- * Creates or updates resource attributes synchronously.
17
- * @param accountId The account ID
18
- * @param resourceAttributeAssignments Array of ResourceAttributeAssignment objects
19
- * @returns Promise<void>
20
- */
21
- upsertResourceAttributes(accountId: number, resourceAttributeAssignments: ResourceAttributeAssignment[], _appName?: string, _callerActionIdentifier?: string): Promise<void>;
22
12
  /**
23
13
  * Deletes specific attributes from a resource synchronously.
24
14
  * @param accountId The account ID
@@ -27,13 +17,6 @@ export declare class AuthorizationAttributesMsService implements AuthorizationAt
27
17
  * @returns Promise<void>
28
18
  */
29
19
  deleteResourceAttributes(accountId: number, resource: Resource, attributeKeys: string[], _appName?: string, _callerActionIdentifier?: string): Promise<void>;
30
- /**
31
- * Creates or updates entity attributes synchronously.
32
- * @param accountId The account ID
33
- * @param entityAttributeAssignments Array of EntityAttributeAssignment objects
34
- * @returns Promise<void>
35
- */
36
- upsertEntityAttributes(accountId: number, entityAttributeAssignments: EntityAttributeAssignment[], _appName?: string, _callerActionIdentifier?: string): Promise<void>;
37
20
  /**
38
21
  * Deletes specific attributes from an entity synchronously.
39
22
  * @param accountId The account ID
@@ -84,5 +67,6 @@ export declare class AuthorizationAttributesMsService implements AuthorizationAt
84
67
  * Generic helper for executing upsert requests
85
68
  */
86
69
  private static executeUpsertRequest;
70
+ private upsertResourceAttributes;
87
71
  }
88
72
  //# sourceMappingURL=authorization-attributes-ms-service.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"authorization-attributes-ms-service.d.ts","sourceRoot":"","sources":["../src/authorization-attributes-ms-service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,2BAA2B,EAAE,MAAM,iCAAiC,CAAC;AAC9E,OAAO,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAC1E,OAAO,EAEL,0BAA0B,EAC1B,wBAAwB,EACzB,MAAM,4CAA4C,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAM3D,OAAO,EAAE,8BAA8B,EAAE,MAAM,oDAAoD,CAAC;AACpG,OAAO,EAAE,QAAQ,EAAE,M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,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,uBAAuB,EAAE,MAAM,EAC/B,yBAAyB,EAAE,wBAAwB,EAAE,GACpD,OAAO,CAAC,wBAAwB,EAAE,CAAC;IAiBtC;;;;;OAKG;IACH,OAAO,CAAC,MAAM,CAAC,iBAAiB;IAQhC;;OAEG;mBACkB,oBAAoB;IAmEzC;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,iBAAiB;IA+ChC;;OAEG;mBACkB,oBAAoB;CAkE1C"}
1
+ {"version":3,"file":"authorization-attributes-ms-service.d.ts","sourceRoot":"","sources":["../src/authorization-attributes-ms-service.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,0BAA0B,EAC1B,wBAAwB,EAEzB,MAAM,4CAA4C,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAK3D,OAAO,EAAE,8BAA8B,EAAE,MAAM,oDAAoD,CAAC;AACpG,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAY3C;;;GAGG;AACH,qBAAa,gCAAiC,YAAW,8BAA8B;IACrF,OAAO,CAAC,MAAM,CAAC,OAAO,CAAiC;IACvD,OAAO,CAAC,MAAM,CAAC,UAAU,CAAqD;IAE9E;;;;;;OAMG;IACG,wBAAwB,CAC5B,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,QAAQ,EAClB,aAAa,EAAE,MAAM,EAAE,EACvB,QAAQ,CAAC,EAAE,MAAM,EACjB,uBAAuB,CAAC,EAAE,MAAM,GAC/B,OAAO,CAAC,IAAI,CAAC;IAehB;;;;;;;OAOG;IACG,sBAAsB,CAC1B,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,MAAM,EAChB,aAAa,EAAE,MAAM,EAAE,EACvB,QAAQ,CAAC,EAAE,MAAM,EACjB,uBAAuB,CAAC,EAAE,MAAM,GAC/B,OAAO,CAAC,IAAI,CAAC;IAehB;;;;;;;;;OASG;IACG,wBAAwB,CAC5B,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,uBAAuB,EAAE,MAAM,EAC/B,2BAA2B,EAAE,0BAA0B,EAAE,GACxD,OAAO,CAAC,0BAA0B,EAAE,CAAC;IAmCxC;;;;;;;;;OASG;IACG,sBAAsB,CAC1B,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,uBAAuB,EAAE,MAAM,EAC/B,yBAAyB,EAAE,wBAAwB,EAAE,GACpD,OAAO,CAAC,wBAAwB,EAAE,CAAC;IAqCtC;;;;;OAKG;IACH,OAAO,CAAC,MAAM,CAAC,iBAAiB;IAQhC;;OAEG;mBACkB,oBAAoB;IAiEzC;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,iBAAiB;IA+ChC;;OAEG;mBACkB,oBAAoB;YA6D3B,wBAAwB;CAqBvC"}
@@ -5,7 +5,6 @@ const mondayJwt = require('@mondaydotcomorg/monday-jwt');
5
5
  const resourceAttributeAssignment = require('./resource-attribute-assignment.js');
6
6
  const entityAttributeAssignment = require('./entity-attribute-assignment.js');
7
7
  const types_authorizationAttributesContracts = require('./types/authorization-attributes-contracts.js');
8
- const errors_argumentError = require('./errors/argument-error.js');
9
8
  const authorizationInternalService = require('./authorization-internal-service.js');
10
9
  const attributionsService = require('./attributions-service.js');
11
10
  const constants = require('./constants.js');
@@ -22,19 +21,7 @@ const DELETE_ENTITY_ATTRIBUTES_PATH = '/attributes/{accountId}/entity/{entityTyp
22
21
  */
23
22
  class AuthorizationAttributesMsService {
24
23
  static LOG_TAG = 'authorization_attributes_ms';
25
- static httpClient = tridentBackendApi.Api.getPart('httpClient') ?? null;
26
- static destroyHttpClient() {
27
- AuthorizationAttributesMsService.httpClient = null;
28
- }
29
- /**
30
- * Creates or updates resource attributes synchronously.
31
- * @param accountId The account ID
32
- * @param resourceAttributeAssignments Array of ResourceAttributeAssignment objects
33
- * @returns Promise<void>
34
- */
35
- async upsertResourceAttributes(accountId, resourceAttributeAssignments, _appName, _callerActionIdentifier) {
36
- return AuthorizationAttributesMsService.executeUpsertRequest(accountId, resourceAttributeAssignments, UPSERT_RESOURCE_ATTRIBUTES_PATH, 'resourceAttributeAssignments', resourceAttributeAssignment.ResourceAttributeAssignment, 'resource', 'upsertResourceAttributes');
37
- }
24
+ static httpClient = tridentBackendApi.Api.getPart('httpClient');
38
25
  /**
39
26
  * Deletes specific attributes from a resource synchronously.
40
27
  * @param accountId The account ID
@@ -44,20 +31,10 @@ class AuthorizationAttributesMsService {
44
31
  */
45
32
  async deleteResourceAttributes(accountId, resource, attributeKeys, _appName, _callerActionIdentifier) {
46
33
  utils_validation.ValidationUtils.validateResource(resource);
47
- utils_validation.ValidationUtils.validateStringArray(attributeKeys);
48
34
  return AuthorizationAttributesMsService.executeDeleteRequest(accountId, DELETE_RESOURCE_ATTRIBUTES_PATH, {
49
35
  resourceType: resource.type,
50
36
  resourceId: resource.id,
51
- }, attributeKeys, 'resource', 'deleteResourceAttributesSync', { resource });
52
- }
53
- /**
54
- * Creates or updates entity attributes synchronously.
55
- * @param accountId The account ID
56
- * @param entityAttributeAssignments Array of EntityAttributeAssignment objects
57
- * @returns Promise<void>
58
- */
59
- async upsertEntityAttributes(accountId, entityAttributeAssignments, _appName, _callerActionIdentifier) {
60
- return AuthorizationAttributesMsService.executeUpsertRequest(accountId, entityAttributeAssignments, UPSERT_ENTITY_ATTRIBUTES_PATH, 'entityAttributeAssignments', entityAttributeAssignment.EntityAttributeAssignment, 'entity', 'upsertEntityAttributesSync');
37
+ }, attributeKeys, 'resource', 'deleteResourceAttributesSync');
61
38
  }
62
39
  /**
63
40
  * Deletes specific attributes from an entity synchronously.
@@ -68,14 +45,11 @@ class AuthorizationAttributesMsService {
68
45
  * @returns Promise<void>
69
46
  */
70
47
  async deleteEntityAttributes(accountId, entityType, entityId, attributeKeys, _appName, _callerActionIdentifier) {
71
- if (!entityType || typeof entityType !== 'string' || entityType.trim() === '') {
72
- throw new errors_argumentError.ArgumentError(`entityType must be a non-empty string, got: ${entityType}`);
73
- }
74
- utils_validation.ValidationUtils.validateInteger(entityId);
48
+ utils_validation.ValidationUtils.validateInteger(accountId);
75
49
  return AuthorizationAttributesMsService.executeDeleteRequest(accountId, DELETE_ENTITY_ATTRIBUTES_PATH, {
76
50
  entityType,
77
51
  entityId,
78
- }, attributeKeys, 'entity', 'deleteEntityAttributesSync', { entityType, entityId });
52
+ }, attributeKeys, 'entity', 'deleteEntityAttributesSync');
79
53
  }
80
54
  /**
81
55
  * Updates resource attributes (batch operations).
@@ -88,29 +62,27 @@ class AuthorizationAttributesMsService {
88
62
  * @returns Promise<ResourceAttributesOperation[]> Array of processed operations
89
63
  */
90
64
  async updateResourceAttributes(accountId, _appName, _callerActionIdentifier, resourceAttributeOperations) {
91
- const processedOperations = [];
92
- for (const operation of resourceAttributeOperations) {
65
+ // Process all operations in parallel using Promise.all
66
+ await Promise.all(resourceAttributeOperations.map(async (operation) => {
67
+ utils_validation.ValidationUtils.validateResourceAssignment({
68
+ resourceId: operation.resourceId,
69
+ resourceType: operation.resourceType,
70
+ key: operation.key,
71
+ value: operation.value || '',
72
+ });
93
73
  if (operation.operationType === types_authorizationAttributesContracts.AttributeOperation.UPSERT) {
94
- if (!operation.resourceId) {
95
- throw new errors_argumentError.ArgumentError('resourceId is required for upsert operation');
96
- }
97
74
  await this.upsertResourceAttributes(accountId, [
98
75
  new resourceAttributeAssignment.ResourceAttributeAssignment(operation.resourceId, operation.resourceType, operation.key, operation.value || ''),
99
76
  ]);
100
- processedOperations.push(operation);
101
77
  }
102
78
  else if (operation.operationType === types_authorizationAttributesContracts.AttributeOperation.DELETE) {
103
- if (!operation.resourceId) {
104
- throw new errors_argumentError.ArgumentError('resourceId is required for delete operation');
105
- }
106
79
  await this.deleteResourceAttributes(accountId, {
107
80
  type: operation.resourceType,
108
81
  id: operation.resourceId,
109
82
  }, [operation.key]);
110
- processedOperations.push(operation);
111
83
  }
112
- }
113
- return processedOperations;
84
+ }));
85
+ return resourceAttributeOperations;
114
86
  }
115
87
  /**
116
88
  * Updates entity attributes (batch operations).
@@ -123,20 +95,25 @@ class AuthorizationAttributesMsService {
123
95
  * @returns Promise<EntityAttributesOperation[]> Array of processed operations
124
96
  */
125
97
  async updateEntityAttributes(accountId, _appName, _callerActionIdentifier, entityAttributeOperations) {
126
- const processedOperations = [];
127
- for (const operation of entityAttributeOperations) {
98
+ // Process all operations in parallel using Promise.all
99
+ await Promise.all(entityAttributeOperations.map(async (operation) => {
100
+ // Validate before processing
101
+ utils_validation.ValidationUtils.validateEntityAssignment({
102
+ entityId: operation.entityId,
103
+ entityType: operation.entityType,
104
+ key: operation.key,
105
+ value: operation.value || '',
106
+ });
128
107
  if (operation.operationType === 'upsert') {
129
- await this.upsertEntityAttributes(accountId, [
108
+ await AuthorizationAttributesMsService.executeUpsertRequest(accountId, [
130
109
  new entityAttributeAssignment.EntityAttributeAssignment(operation.entityId, operation.entityType, operation.key, operation.value || ''),
131
- ]);
132
- processedOperations.push(operation);
110
+ ], UPSERT_ENTITY_ATTRIBUTES_PATH, 'entityAttributeAssignments', 'entity', 'upsertEntityAttributesSync');
133
111
  }
134
112
  else if (operation.operationType === 'delete') {
135
113
  await this.deleteEntityAttributes(accountId, operation.entityType, operation.entityId, [operation.key]);
136
- processedOperations.push(operation);
137
114
  }
138
- }
139
- return processedOperations;
115
+ }));
116
+ return entityAttributeOperations;
140
117
  }
141
118
  /**
142
119
  * Replaces path template parameters with actual values
@@ -154,7 +131,7 @@ class AuthorizationAttributesMsService {
154
131
  /**
155
132
  * Generic helper for executing delete requests
156
133
  */
157
- static async executeDeleteRequest(accountId, pathTemplate, pathParams, keys, logPrefix, methodName, context = {}) {
134
+ static async executeDeleteRequest(accountId, pathTemplate, pathParams, keys, logPrefix, methodName) {
158
135
  // Validate inputs
159
136
  utils_validation.ValidationUtils.validateInteger(accountId);
160
137
  utils_validation.ValidationUtils.validateStringArray(keys);
@@ -190,7 +167,6 @@ class AuthorizationAttributesMsService {
190
167
  method: methodName,
191
168
  accountId,
192
169
  ...pathParams,
193
- ...context,
194
170
  error: err instanceof Error ? err.message : String(err),
195
171
  }, `Failed in ${methodName}`);
196
172
  throw err;
@@ -244,12 +220,7 @@ class AuthorizationAttributesMsService {
244
220
  /**
245
221
  * Generic helper for executing upsert requests
246
222
  */
247
- static async executeUpsertRequest(accountId, assignments, pathTemplate, requestBodyKey, assignmentClass, logPrefix, methodName) {
248
- utils_validation.ValidationUtils.validateInteger(accountId);
249
- utils_validation.ValidationUtils.validateArrayTypeOf(assignments, assignmentClass);
250
- if (!assignments.length) {
251
- return;
252
- }
223
+ static async executeUpsertRequest(accountId, assignments, pathTemplate, requestBodyKey, logPrefix, methodName) {
253
224
  const assignmentDto = assignments.map(assignment => assignment.toDataTransferObject());
254
225
  const requestBody = requestBodyKey === 'resourceAttributeAssignments'
255
226
  ? { resourceAttributeAssignments: assignmentDto }
@@ -285,6 +256,24 @@ class AuthorizationAttributesMsService {
285
256
  throw err;
286
257
  }
287
258
  }
259
+ async upsertResourceAttributes(accountId, resourceAttributeAssignments) {
260
+ const attributionHeaders = attributionsService.getAttributionsFromApi();
261
+ if (!AuthorizationAttributesMsService.httpClient) {
262
+ throw new Error('AuthorizationAttributesMsService: HTTP client is not initialized');
263
+ }
264
+ return await AuthorizationAttributesMsService.httpClient.fetch({
265
+ url: {
266
+ appName: constants.APP_NAME,
267
+ path: UPSERT_RESOURCE_ATTRIBUTES_PATH.replace('{accountId}', accountId.toString()),
268
+ },
269
+ method: 'POST',
270
+ headers: {
271
+ 'Content-Type': 'application/json',
272
+ ...attributionHeaders,
273
+ },
274
+ body: JSON.stringify({ resourceAttributeAssignments }),
275
+ });
276
+ }
288
277
  }
289
278
 
290
279
  exports.AuthorizationAttributesMsService = 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,EA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C,IAAI,OAAO,CAAC,OAAO,CAAC;CAoB7D"}
@@ -5,6 +5,7 @@ const mondaySns = require('@mondaydotcomorg/monday-sns');
5
5
  const types_authorizationAttributesContracts = require('./types/authorization-attributes-contracts.js');
6
6
  const authorizationInternalService = require('./authorization-internal-service.js');
7
7
  const constants_sns = require('./constants/sns.js');
8
+ const utils_validation = require('./utils/validation.js');
8
9
 
9
10
  const _interopDefault = e => e && e.__esModule ? e : { default: e };
10
11
 
@@ -25,25 +26,6 @@ class AuthorizationAttributesSnsService {
25
26
  this.resourceSnsArn = AuthorizationAttributesSnsService.getSnsTopicArn(constants_sns.SnsTopicType.RESOURCE);
26
27
  this.entitySnsArn = AuthorizationAttributesSnsService.getSnsTopicArn(constants_sns.SnsTopicType.ENTITY);
27
28
  }
28
- /**
29
- * Async function to upsert resource 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 resourceAttributeAssignments Array of resource attribute assignments to upsert
35
- * @return Promise with array of sent operations
36
- */
37
- async upsertResourceAttributes(accountId, resourceAttributeAssignments, appName, callerActionIdentifier) {
38
- if (!appName || !callerActionIdentifier) {
39
- throw new Error('appName and callerActionIdentifier are required for SNS service');
40
- }
41
- const operations = resourceAttributeAssignments.map(assignment => ({
42
- ...assignment,
43
- operationType: types_authorizationAttributesContracts.AttributeOperation.UPSERT,
44
- }));
45
- return this.updateResourceAttributes(accountId, appName, callerActionIdentifier, operations);
46
- }
47
29
  /**
48
30
  * Async function to delete resource attributes using SNS.
49
31
  * Sends the updates request to SNS and returns before the change actually took place.
@@ -66,30 +48,6 @@ class AuthorizationAttributesSnsService {
66
48
  }));
67
49
  return this.updateResourceAttributes(accountId, appName, callerActionIdentifier, operations);
68
50
  }
69
- /**
70
- * Async function to upsert entity attributes using SNS.
71
- * Sends the updates request to SNS and returns before the change actually took place.
72
- * @param accountId The account ID
73
- * @param appName App name of the calling app
74
- * @param callerActionIdentifier Action identifier
75
- * @param entityAttributeAssignments Array of entity attribute assignments to upsert
76
- * @return Promise with array of sent operations
77
- */
78
- async upsertEntityAttributes(accountId, entityAttributeAssignments, appName, callerActionIdentifier) {
79
- if (!appName || !callerActionIdentifier) {
80
- throw new Error('appName and callerActionIdentifier are required for SNS service');
81
- }
82
- const operations = entityAttributeAssignments.map(assignment => {
83
- return {
84
- entityId: assignment.entityId,
85
- entityType: assignment.entityType,
86
- key: assignment.attributeKey,
87
- value: assignment.attributeValue,
88
- operationType: types_authorizationAttributesContracts.AttributeOperation.UPSERT,
89
- };
90
- });
91
- return this.updateEntityAttributes(accountId, appName, callerActionIdentifier, operations);
92
- }
93
51
  /**
94
52
  * Async function to delete entity attributes using SNS.
95
53
  * Sends the updates request to SNS and returns before the change actually took place.
@@ -105,12 +63,16 @@ class AuthorizationAttributesSnsService {
105
63
  if (!appName || !callerActionIdentifier) {
106
64
  throw new Error('appName and callerActionIdentifier are required for SNS service');
107
65
  }
108
- const operations = attributeKeys.map(key => ({
109
- entityType: entityType,
110
- entityId,
111
- key,
112
- operationType: types_authorizationAttributesContracts.AttributeOperation.DELETE,
113
- }));
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
+ });
114
76
  return this.updateEntityAttributes(accountId, appName, callerActionIdentifier, operations);
115
77
  }
116
78
  /**
@@ -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,6 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
- const utils_validation = require('./utils/validation.js');
4
3
  const isEqual = require('lodash/isEqual.js');
5
4
 
6
5
  const _interopDefault = e => e && e.__esModule ? e : { default: e };
@@ -16,12 +15,11 @@ class BaseAttributeAssignment {
16
15
  type;
17
16
  attributeKey;
18
17
  attributeValue;
19
- constructor(id, type, attributeKey, attributeValue, validTypes, idFieldName, typeFieldName) {
20
- const validated = utils_validation.ValidationUtils.validateAssignment({ id, type, attributeKey, attributeValue }, validTypes, { id: idFieldName, type: typeFieldName });
21
- this.id = validated.id;
22
- this.type = validated.type;
23
- this.attributeKey = validated.attributeKey;
24
- this.attributeValue = validated.attributeValue;
18
+ constructor(id, type, attributeKey, attributeValue) {
19
+ this.id = id;
20
+ this.type = type;
21
+ this.attributeKey = attributeKey;
22
+ this.attributeValue = attributeValue;
25
23
  }
26
24
  /**
27
25
  * 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,15 +1,16 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
- const entityAttributesConstants = require('./entity-attributes-constants.js');
4
3
  const baseAttributeAssignment = require('./base-attribute-assignment.js');
4
+ const utils_validation = require('./utils/validation.js');
5
5
 
6
6
  class EntityAttributeAssignment extends baseAttributeAssignment.BaseAttributeAssignment {
7
7
  entityId;
8
8
  entityType;
9
9
  constructor(entityId, entityType, attributeKey, attributeValue) {
10
- super(entityId, entityType, attributeKey, attributeValue, entityAttributesConstants.ENTITY_TYPES, 'entityId', 'entityType');
10
+ utils_validation.ValidationUtils.validateEntityAssignment({ entityId, entityType, key: attributeKey, value: attributeValue });
11
+ super(entityId, entityType, attributeKey, attributeValue);
11
12
  this.entityId = entityId;
12
- this.entityType = this.type;
13
+ this.entityType = entityType;
13
14
  }
14
15
  toDataTransferObject() {
15
16
  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"}
@@ -4,7 +4,6 @@ class ArgumentError extends Error {
4
4
  constructor(message) {
5
5
  super(message);
6
6
  this.name = 'ArgumentError';
7
- Object.setPrototypeOf(this, ArgumentError.prototype);
8
7
  }
9
8
  }
10
9
 
@@ -1,5 +1,3 @@
1
- import { ResourceAttributeAssignment } from './resource-attribute-assignment';
2
- import { EntityAttributeAssignment } from './entity-attribute-assignment';
3
1
  import { ResourceAttributeOperation, EntityAttributeOperation } from './types/authorization-attributes-contracts';
4
2
  import { EntityType } from './entity-attributes-constants';
5
3
  import { AuthorizationAttributesService } from './types/authorization-attributes-service.interface';
@@ -11,14 +9,6 @@ import { Resource } from './types/general';
11
9
  export declare class AuthorizationAttributesMsService implements AuthorizationAttributesService {
12
10
  private static LOG_TAG;
13
11
  private static httpClient;
14
- static destroyHttpClient(): void;
15
- /**
16
- * Creates or updates resource attributes synchronously.
17
- * @param accountId The account ID
18
- * @param resourceAttributeAssignments Array of ResourceAttributeAssignment objects
19
- * @returns Promise<void>
20
- */
21
- upsertResourceAttributes(accountId: number, resourceAttributeAssignments: ResourceAttributeAssignment[], _appName?: string, _callerActionIdentifier?: string): Promise<void>;
22
12
  /**
23
13
  * Deletes specific attributes from a resource synchronously.
24
14
  * @param accountId The account ID
@@ -27,13 +17,6 @@ export declare class AuthorizationAttributesMsService implements AuthorizationAt
27
17
  * @returns Promise<void>
28
18
  */
29
19
  deleteResourceAttributes(accountId: number, resource: Resource, attributeKeys: string[], _appName?: string, _callerActionIdentifier?: string): Promise<void>;
30
- /**
31
- * Creates or updates entity attributes synchronously.
32
- * @param accountId The account ID
33
- * @param entityAttributeAssignments Array of EntityAttributeAssignment objects
34
- * @returns Promise<void>
35
- */
36
- upsertEntityAttributes(accountId: number, entityAttributeAssignments: EntityAttributeAssignment[], _appName?: string, _callerActionIdentifier?: string): Promise<void>;
37
20
  /**
38
21
  * Deletes specific attributes from an entity synchronously.
39
22
  * @param accountId The account ID
@@ -84,5 +67,6 @@ export declare class AuthorizationAttributesMsService implements AuthorizationAt
84
67
  * Generic helper for executing upsert requests
85
68
  */
86
69
  private static executeUpsertRequest;
70
+ private upsertResourceAttributes;
87
71
  }
88
72
  //# sourceMappingURL=authorization-attributes-ms-service.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"authorization-attributes-ms-service.d.ts","sourceRoot":"","sources":["../../src/authorization-attributes-ms-service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,2BAA2B,EAAE,MAAM,iCAAiC,CAAC;AAC9E,OAAO,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAC1E,OAAO,EAEL,0BAA0B,EAC1B,wBAAwB,EACzB,MAAM,4CAA4C,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAM3D,OAAO,EAAE,8BAA8B,EAAE,MAAM,oDAAoD,CAAC;AACpG,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAY3C;;;GAGG;AACH,qBAAa,gCAAiC,YAAW,8BAA8B;IACrF,OAAO,CAAC,MAAM,CAAC,OAAO,CAAiC;IACvD,OAAO,CAAC,MAAM,CAAC,UAAU,CAAwD;WAEnE,iBAAiB,IAAI,IAAI;IAIvC;;;;;OAKG;IACG,wBAAwB,CAC5B,SAAS,EAAE,MAAM,EACjB,4BAA4B,EAAE,2BAA2B,EAAE,EAC3D,QAAQ,CAAC,EAAE,MAAM,EACjB,uBAAuB,CAAC,EAAE,MAAM,GAC/B,OAAO,CAAC,IAAI,CAAC;IAYhB;;;;;;OAMG;IACG,wBAAwB,CAC5B,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,QAAQ,EAClB,aAAa,EAAE,MAAM,EAAE,EACvB,QAAQ,CAAC,EAAE,MAAM,EACjB,uBAAuB,CAAC,EAAE,MAAM,GAC/B,OAAO,CAAC,IAAI,CAAC;IAiBhB;;;;;OAKG;IACG,sBAAsB,CAC1B,SAAS,EAAE,MAAM,EACjB,0BAA0B,EAAE,yBAAyB,EAAE,EACvD,QAAQ,CAAC,EAAE,MAAM,EACjB,uBAAuB,CAAC,EAAE,MAAM,GAC/B,OAAO,CAAC,IAAI,CAAC;IAYhB;;;;;;;OAOG;IACG,sBAAsB,CAC1B,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,MAAM,EAChB,aAAa,EAAE,MAAM,EAAE,EACvB,QAAQ,CAAC,EAAE,MAAM,EACjB,uBAAuB,CAAC,EAAE,MAAM,GAC/B,OAAO,CAAC,IAAI,CAAC;IAoBhB;;;;;;;;;OASG;IACG,wBAAwB,CAC5B,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,uBAAuB,EAAE,MAAM,EAC/B,2BAA2B,EAAE,0BAA0B,EAAE,GACxD,OAAO,CAAC,0BAA0B,EAAE,CAAC;IAoCxC;;;;;;;;;OASG;IACG,sBAAsB,CAC1B,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,uBAAuB,EAAE,MAAM,EAC/B,yBAAyB,EAAE,wBAAwB,EAAE,GACpD,OAAO,CAAC,wBAAwB,EAAE,CAAC;IAiBtC;;;;;OAKG;IACH,OAAO,CAAC,MAAM,CAAC,iBAAiB;IAQhC;;OAEG;mBACkB,oBAAoB;IAmEzC;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,iBAAiB;IA+ChC;;OAEG;mBACkB,oBAAoB;CAkE1C"}
1
+ {"version":3,"file":"authorization-attributes-ms-service.d.ts","sourceRoot":"","sources":["../../src/authorization-attributes-ms-service.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,0BAA0B,EAC1B,wBAAwB,EAEzB,MAAM,4CAA4C,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAK3D,OAAO,EAAE,8BAA8B,EAAE,MAAM,oDAAoD,CAAC;AACpG,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAY3C;;;GAGG;AACH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