@mondaydotcomorg/monday-authorization 3.7.0-feat-shaime-support-entity-attributes-4-49e1de0 → 3.7.1

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 (115) hide show
  1. package/README.md +7 -1
  2. package/dist/authorization-attributes-ms-service.d.ts +20 -40
  3. package/dist/authorization-attributes-ms-service.d.ts.map +1 -1
  4. package/dist/authorization-attributes-ms-service.js +48 -103
  5. package/dist/authorization-attributes-service.d.ts +12 -10
  6. package/dist/authorization-attributes-service.d.ts.map +1 -1
  7. package/dist/authorization-attributes-service.js +17 -15
  8. package/dist/authorization-attributes-sns-service.d.ts +37 -44
  9. package/dist/authorization-attributes-sns-service.d.ts.map +1 -1
  10. package/dist/authorization-attributes-sns-service.js +53 -90
  11. package/dist/authorization-service.d.ts +0 -1
  12. package/dist/authorization-service.d.ts.map +1 -1
  13. package/dist/authorization-service.js +2 -22
  14. package/dist/base-attribute-assignment.d.ts +6 -7
  15. package/dist/base-attribute-assignment.d.ts.map +1 -1
  16. package/dist/base-attribute-assignment.js +5 -7
  17. package/dist/base-authorization-attributes-service.d.ts +32 -0
  18. package/dist/base-authorization-attributes-service.d.ts.map +1 -0
  19. package/dist/base-authorization-attributes-service.js +63 -0
  20. package/dist/entity-attribute-assignment.d.ts +4 -8
  21. package/dist/entity-attribute-assignment.d.ts.map +1 -1
  22. package/dist/entity-attribute-assignment.js +3 -4
  23. package/dist/esm/authorization-attributes-ms-service.d.ts +20 -40
  24. package/dist/esm/authorization-attributes-ms-service.d.ts.map +1 -1
  25. package/dist/esm/authorization-attributes-ms-service.mjs +48 -103
  26. package/dist/esm/authorization-attributes-service.d.ts +12 -10
  27. package/dist/esm/authorization-attributes-service.d.ts.map +1 -1
  28. package/dist/esm/authorization-attributes-service.mjs +17 -15
  29. package/dist/esm/authorization-attributes-sns-service.d.ts +37 -44
  30. package/dist/esm/authorization-attributes-sns-service.d.ts.map +1 -1
  31. package/dist/esm/authorization-attributes-sns-service.mjs +53 -90
  32. package/dist/esm/authorization-service.d.ts +0 -1
  33. package/dist/esm/authorization-service.d.ts.map +1 -1
  34. package/dist/esm/authorization-service.mjs +3 -23
  35. package/dist/esm/base-attribute-assignment.d.ts +6 -7
  36. package/dist/esm/base-attribute-assignment.d.ts.map +1 -1
  37. package/dist/esm/base-attribute-assignment.mjs +5 -7
  38. package/dist/esm/base-authorization-attributes-service.d.ts +32 -0
  39. package/dist/esm/base-authorization-attributes-service.d.ts.map +1 -0
  40. package/dist/esm/base-authorization-attributes-service.mjs +61 -0
  41. package/dist/esm/entity-attribute-assignment.d.ts +4 -8
  42. package/dist/esm/entity-attribute-assignment.d.ts.map +1 -1
  43. package/dist/esm/entity-attribute-assignment.mjs +3 -4
  44. package/dist/esm/index.d.ts +6 -0
  45. package/dist/esm/index.d.ts.map +1 -1
  46. package/dist/esm/index.mjs +6 -0
  47. package/dist/esm/resource-attribute-assignment.d.ts +3 -7
  48. package/dist/esm/resource-attribute-assignment.d.ts.map +1 -1
  49. package/dist/esm/resource-attribute-assignment.mjs +8 -2
  50. package/dist/esm/resource-attributes-constants.d.ts +12 -10
  51. package/dist/esm/resource-attributes-constants.d.ts.map +1 -1
  52. package/dist/esm/resource-attributes-constants.mjs +4 -2
  53. package/dist/esm/testKit/index.d.ts +4 -4
  54. package/dist/esm/testKit/index.d.ts.map +1 -1
  55. package/dist/esm/types/authorization-attributes-contracts.d.ts +7 -21
  56. package/dist/esm/types/authorization-attributes-contracts.d.ts.map +1 -1
  57. package/dist/esm/types/general.d.ts +4 -3
  58. package/dist/esm/types/general.d.ts.map +1 -1
  59. package/dist/esm/utils/assignment-schema.d.ts +51 -0
  60. package/dist/esm/utils/assignment-schema.d.ts.map +1 -0
  61. package/dist/esm/utils/assignment-schema.mjs +54 -0
  62. package/dist/esm/utils/resource-schema.d.ts +9 -0
  63. package/dist/esm/utils/resource-schema.d.ts.map +1 -0
  64. package/dist/esm/utils/resource-schema.mjs +16 -0
  65. package/dist/esm/utils/validation.d.ts +11 -28
  66. package/dist/esm/utils/validation.d.ts.map +1 -1
  67. package/dist/esm/utils/validation.mjs +61 -118
  68. package/dist/index.d.ts +6 -0
  69. package/dist/index.d.ts.map +1 -1
  70. package/dist/index.js +24 -0
  71. package/dist/resource-attribute-assignment.d.ts +3 -7
  72. package/dist/resource-attribute-assignment.d.ts.map +1 -1
  73. package/dist/resource-attribute-assignment.js +8 -2
  74. package/dist/resource-attributes-constants.d.ts +12 -10
  75. package/dist/resource-attributes-constants.d.ts.map +1 -1
  76. package/dist/resource-attributes-constants.js +4 -2
  77. package/dist/testKit/index.d.ts +4 -4
  78. package/dist/testKit/index.d.ts.map +1 -1
  79. package/dist/types/authorization-attributes-contracts.d.ts +7 -21
  80. package/dist/types/authorization-attributes-contracts.d.ts.map +1 -1
  81. package/dist/types/general.d.ts +4 -3
  82. package/dist/types/general.d.ts.map +1 -1
  83. package/dist/utils/assignment-schema.d.ts +51 -0
  84. package/dist/utils/assignment-schema.d.ts.map +1 -0
  85. package/dist/utils/assignment-schema.js +63 -0
  86. package/dist/utils/resource-schema.d.ts +9 -0
  87. package/dist/utils/resource-schema.d.ts.map +1 -0
  88. package/dist/utils/resource-schema.js +22 -0
  89. package/dist/utils/validation.d.ts +11 -28
  90. package/dist/utils/validation.d.ts.map +1 -1
  91. package/dist/utils/validation.js +61 -118
  92. package/package.json +2 -3
  93. package/src/authorization-attributes-ms-service.ts +92 -154
  94. package/src/authorization-attributes-service.ts +18 -16
  95. package/src/authorization-attributes-sns-service.ts +132 -131
  96. package/src/authorization-service.ts +3 -28
  97. package/src/base-attribute-assignment.ts +10 -26
  98. package/src/base-authorization-attributes-service.ts +90 -0
  99. package/src/entity-attribute-assignment.ts +7 -6
  100. package/src/index.ts +17 -0
  101. package/src/resource-attribute-assignment.ts +13 -10
  102. package/src/resource-attributes-constants.ts +4 -2
  103. package/src/testKit/index.ts +5 -5
  104. package/src/types/authorization-attributes-contracts.ts +7 -27
  105. package/src/types/general.ts +4 -3
  106. package/src/utils/assignment-schema.ts +56 -0
  107. package/src/utils/resource-schema.ts +16 -0
  108. package/src/utils/validation.ts +90 -137
  109. package/dist/esm/types/authorization-attributes-service.interface.d.ts +0 -57
  110. package/dist/esm/types/authorization-attributes-service.interface.d.ts.map +0 -1
  111. package/dist/esm/types/authorization-attributes-service.interface.mjs +0 -1
  112. package/dist/types/authorization-attributes-service.interface.d.ts +0 -57
  113. package/dist/types/authorization-attributes-service.interface.d.ts.map +0 -1
  114. package/dist/types/authorization-attributes-service.interface.js +0 -1
  115. package/src/types/authorization-attributes-service.interface.ts +0 -101
@@ -2,9 +2,9 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
3
  const chunk = require('lodash/chunk.js');
4
4
  const mondaySns = require('@mondaydotcomorg/monday-sns');
5
- const types_authorizationAttributesContracts = require('./types/authorization-attributes-contracts.js');
6
5
  const authorizationInternalService = require('./authorization-internal-service.js');
7
6
  const constants_sns = require('./constants/sns.js');
7
+ const baseAuthorizationAttributesService = require('./base-authorization-attributes-service.js');
8
8
 
9
9
  const _interopDefault = e => e && e.__esModule ? e : { default: e };
10
10
 
@@ -14,7 +14,7 @@ const chunk__default = /*#__PURE__*/_interopDefault(chunk);
14
14
  * Service class for managing resource attributes asynchronously via SNS.
15
15
  * Provides asynchronous operations to create/update and delete attributes on resources.
16
16
  */
17
- class AuthorizationAttributesSnsService {
17
+ class AuthorizationAttributesSnsService extends baseAuthorizationAttributesService.BaseAuthorizationAttributesService {
18
18
  static LOG_TAG = 'authorization_attributes';
19
19
  resourceSnsArn;
20
20
  entitySnsArn;
@@ -22,128 +22,91 @@ class AuthorizationAttributesSnsService {
22
22
  * Public constructor to create the AuthorizationAttributesSnsService instance.
23
23
  */
24
24
  constructor() {
25
+ super();
25
26
  this.resourceSnsArn = AuthorizationAttributesSnsService.getSnsTopicArn(constants_sns.SnsTopicType.RESOURCE);
26
27
  this.entitySnsArn = AuthorizationAttributesSnsService.getSnsTopicArn(constants_sns.SnsTopicType.ENTITY);
27
28
  }
28
29
  /**
29
- * Async function to upsert resource attributes using SNS.
30
- * Sends the updates request to SNS and returns before the change actually took place.
30
+ * Async function to delete a resource attribute using SNS.
31
+ * Sends the delete request to SNS and returns before the change actually took place.
31
32
  * @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
- /**
48
- * Async function to delete resource attributes using SNS.
49
- * Sends the updates request to SNS and returns before the change actually took place.
50
- * @param accountId The account ID
51
- * @param appName App name of the calling app
52
- * @param callerActionIdentifier Action identifier
53
33
  * @param resource The resource (resourceType, resourceId)
54
- * @param attributeKeys Array of attribute keys to delete
55
- * @return Promise with array of sent operations
56
- */
57
- async deleteResourceAttributes(accountId, resource, attributeKeys, appName, callerActionIdentifier) {
58
- if (!appName || !callerActionIdentifier) {
59
- throw new Error('appName and callerActionIdentifier are required for SNS service');
60
- }
61
- const operations = attributeKeys.map(key => ({
62
- resourceType: resource.type,
63
- resourceId: resource.id,
64
- key,
65
- operationType: types_authorizationAttributesContracts.AttributeOperation.DELETE,
66
- }));
67
- return this.updateResourceAttributes(accountId, appName, callerActionIdentifier, operations);
68
- }
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
34
+ * @param attributeKey Attribute key to delete
73
35
  * @param appName App name of the calling app
74
36
  * @param callerActionIdentifier Action identifier
75
- * @param entityAttributeAssignments Array of entity attribute assignments to upsert
76
- * @return Promise with array of sent operations
37
+ * @return Promise with sent operation
77
38
  */
78
- async upsertEntityAttributes(accountId, entityAttributeAssignments, appName, callerActionIdentifier) {
39
+ async deleteResourceAttributes(accountId, resource, attributeKey, appName, callerActionIdentifier) {
79
40
  if (!appName || !callerActionIdentifier) {
80
41
  throw new Error('appName and callerActionIdentifier are required for SNS service');
81
42
  }
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);
43
+ const operation = await super.deleteResourceAttributes(accountId, resource, attributeKey);
44
+ const [result] = await this.sendOperationsToSns(this.resourceSnsArn, accountId, appName, callerActionIdentifier, [operation], constants_sns.ASYNC_RESOURCE_ATTRIBUTES_MAX_OPERATIONS_PER_MESSAGE, constants_sns.RESOURCE_ATTRIBUTES_SNS_UPDATE_OPERATION_MESSAGE_KIND, 'Authorization resource attributes async delete: failed to send operations to SNS');
45
+ return result;
92
46
  }
93
47
  /**
94
- * Async function to delete entity attributes using SNS.
95
- * Sends the updates request to SNS and returns before the change actually took place.
48
+ * Async function to delete an entity attribute using SNS.
49
+ * Sends the delete request to SNS and returns before the change actually took place.
96
50
  * @param accountId The account ID
97
- * @param appName App name of the calling app
98
- * @param callerActionIdentifier Action identifier
99
51
  * @param entityType The entity type
100
52
  * @param entityId The entity ID
101
- * @param attributeKeys Array of attribute keys to delete
102
- * @return Promise with array of sent operations
53
+ * @param attributeKey Attribute key to delete
54
+ * @param appName App name of the calling app
55
+ * @param callerActionIdentifier Action identifier
56
+ * @return Promise with sent operation
103
57
  */
104
- async deleteEntityAttributes(accountId, entityType, entityId, attributeKeys, appName, callerActionIdentifier) {
58
+ async deleteEntityAttributes(accountId, entityType, entityId, attributeKey, appName, callerActionIdentifier) {
105
59
  if (!appName || !callerActionIdentifier) {
106
60
  throw new Error('appName and callerActionIdentifier are required for SNS service');
107
61
  }
108
- const operations = attributeKeys.map(key => ({
109
- entityType: entityType,
110
- entityId,
111
- key,
112
- operationType: types_authorizationAttributesContracts.AttributeOperation.DELETE,
113
- }));
114
- return this.updateEntityAttributes(accountId, appName, callerActionIdentifier, operations);
62
+ const operation = await super.deleteEntityAttributes(accountId, entityType, entityId, attributeKey);
63
+ const [result] = await this.sendOperationsToSns(this.entitySnsArn, accountId, appName, callerActionIdentifier, [operation], constants_sns.ASYNC_ENTITY_ATTRIBUTES_MAX_OPERATIONS_PER_MESSAGE, constants_sns.ENTITY_ATTRIBUTES_SNS_UPDATE_OPERATION_MESSAGE_KIND, 'Authorization entity attributes async delete: failed to send operations to SNS');
64
+ return result;
115
65
  }
116
66
  /**
117
- * Async function, this function only send the updates request to SNS and return before the change actually took place
67
+ * Async function, this function only send the update request to SNS and return before the change actually took place
118
68
  * @param accountId
119
69
  * @param appName - App name of the calling app
120
70
  * @param callerActionIdentifier - action identifier
121
- * @param resourceAttributeOperations - Array of operations to do on resource attributes.
122
- * @return {Promise<ResourceAttributesOperation[]>} Array of sent operations
71
+ * @param resourceAttributeOperation - Operation to do on resource attribute.
72
+ * @return {Promise<ResourceAttributeUpsertOperation>} Sent operation
123
73
  * */
124
- async updateResourceAttributes(accountId, appName, callerActionIdentifier, resourceAttributeOperations) {
125
- const topicArn = this.resourceSnsArn;
126
- const sendToSnsPromises = [];
127
- const operationChucks = chunk__default.default(resourceAttributeOperations, constants_sns.ASYNC_RESOURCE_ATTRIBUTES_MAX_OPERATIONS_PER_MESSAGE);
128
- for (const operationsChunk of operationChucks) {
129
- 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'));
130
- }
131
- return (await Promise.all(sendToSnsPromises)).flat();
74
+ async updateResourceAttributes(accountId, appName, callerActionIdentifier, resourceAttributeOperation) {
75
+ await super.updateResourceAttributes(accountId, appName, callerActionIdentifier, resourceAttributeOperation);
76
+ const [result] = await this.sendOperationsToSns(this.resourceSnsArn, accountId, appName, callerActionIdentifier, [resourceAttributeOperation], constants_sns.ASYNC_RESOURCE_ATTRIBUTES_MAX_OPERATIONS_PER_MESSAGE, constants_sns.RESOURCE_ATTRIBUTES_SNS_UPDATE_OPERATION_MESSAGE_KIND, 'Authorization resource attributes async update: failed to send operations to SNS');
77
+ return result;
132
78
  }
133
79
  /**
134
- * Async function, this function only send the updates request to SNS and return before the change actually took place
80
+ * Async function, this function only send the update request to SNS and return before the change actually took place
135
81
  * @param accountId
136
82
  * @param appName - App name of the calling app
137
83
  * @param callerActionIdentifier - action identifier
138
- * @param entityAttributeOperations - Array of operations to do on entity attributes.
139
- * @return {Promise<EntityAttributeOperation[]>} Array of sent operations
84
+ * @param entityAttributeOperation - Operation to do on entity attribute.
85
+ * @return {Promise<EntityAttributeUpsertOperation>} Sent operation
140
86
  * */
141
- async updateEntityAttributes(accountId, appName, callerActionIdentifier, entityAttributeOperations) {
142
- const topicArn = this.entitySnsArn;
87
+ async updateEntityAttributes(accountId, appName, callerActionIdentifier, entityAttributeOperation) {
88
+ await super.updateEntityAttributes(accountId, appName, callerActionIdentifier, entityAttributeOperation);
89
+ const [result] = await this.sendOperationsToSns(this.entitySnsArn, accountId, appName, callerActionIdentifier, [entityAttributeOperation], constants_sns.ASYNC_ENTITY_ATTRIBUTES_MAX_OPERATIONS_PER_MESSAGE, constants_sns.ENTITY_ATTRIBUTES_SNS_UPDATE_OPERATION_MESSAGE_KIND, 'Authorization entity attributes async update: failed to send operations to SNS');
90
+ return result;
91
+ }
92
+ /**
93
+ * Base function to send attribute operations to SNS.
94
+ * Chunks operations and sends them in parallel.
95
+ * @param topicArn The SNS topic ARN to send messages to
96
+ * @param accountId The account ID
97
+ * @param appName App name of the calling app
98
+ * @param callerActionIdentifier Action identifier
99
+ * @param operations Array of operations to send
100
+ * @param chunkSize Maximum number of operations per message
101
+ * @param messageKind The kind of message being sent
102
+ * @param errorLogMessage Error message to log if sending fails
103
+ * @return Promise with array of sent operations
104
+ */
105
+ async sendOperationsToSns(topicArn, accountId, appName, callerActionIdentifier, operations, chunkSize, messageKind, errorLogMessage) {
143
106
  const sendToSnsPromises = [];
144
- const operationChucks = chunk__default.default(entityAttributeOperations, constants_sns.ASYNC_ENTITY_ATTRIBUTES_MAX_OPERATIONS_PER_MESSAGE);
145
- for (const operationsChunk of operationChucks) {
146
- 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'));
107
+ const operationChunks = chunk__default.default(operations, chunkSize);
108
+ for (const operationsChunk of operationChunks) {
109
+ sendToSnsPromises.push(this.sendSingleSnsMessage(topicArn, accountId, appName, callerActionIdentifier, operationsChunk, messageKind, errorLogMessage));
147
110
  }
148
111
  return (await Promise.all(sendToSnsPromises)).flat();
149
112
  }
@@ -33,7 +33,6 @@ export declare class AuthorizationService {
33
33
  private static fetchIsUserGrantedWithFeature;
34
34
  private static getCachedKeyName;
35
35
  static canActionInScope(accountId: number, userId: number, action: string, scope: ScopeOptions): Promise<ScopedActionPermit>;
36
- private static getProfile;
37
36
  static canActionInScopeMultiple(accountId: number, userId: number, scopedActions: ScopedAction[]): Promise<ScopedActionResponseObject[]>;
38
37
  private static isAuthorizedSingular;
39
38
  private static isAuthorizedMultiple;
@@ -1 +1 @@
1
- {"version":3,"file":"authorization-service.d.ts","sourceRoot":"","sources":["../src/authorization-service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAGnE,OAAO,EAAmB,YAAY,EAAE,MAAM,6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AAgB,cAAc,CAC5B,MAAM,KAAA,EACN,sCAAsC,GAAE,MAAiD,QAY1F;AAED,wBAAsB,eAAe,kBAMpC;AAED,wBAAgB,yBAAyB,CAAC,SAAS,EAAE,QAAQ,EAAE,EAAE,MAAM,EAAE,MAAM,GAAG,mBAAmB,CAepG"}
@@ -14,9 +14,6 @@ const utils_authorization_utils = require('./utils/authorization.utils.js');
14
14
 
15
15
  const GRANTED_FEATURE_CACHE_EXPIRATION_SECONDS = 5 * 60;
16
16
  const PLATFORM_AUTHORIZE_PATH = '/internal_ms/authorization/authorize';
17
- const ALLOWED_SDK_PLATFORM_PROFILES_KEY = 'allowed-sdk-platform-profiles';
18
- const IN_RELEASE_SDK_PLATFORM_PROFILES_KEY = 'in-release-sdk-platform-profile';
19
- const PLATFORM_PROFILE_RELEASE_FF = 'sdk-platform-profiles';
20
17
  const NAVIGATE_CAN_ACTION_IN_SCOPE_TO_GRAPH_FF = 'navigate-can-action-in-scope-to-graph';
21
18
  function setRequestFetchOptions(customMondayFetchOptions) {
22
19
  authorizationInternalService.AuthorizationInternalService.setRequestFetchOptions(customMondayFetchOptions);
@@ -90,23 +87,6 @@ class AuthorizationService {
90
87
  const scopedActionResponseObjects = await this.canActionInScopeMultiple(accountId, userId, scopedActions);
91
88
  return scopedActionResponseObjects[0].permit;
92
89
  }
93
- static getProfile(accountId, userId) {
94
- const appName = process.env.APP_NAME ?? 'INVALID_APP_NAME';
95
- if (!this.igniteClient) {
96
- authorizationInternalService.logger.error({ tag: 'authorization-service' }, 'AuthorizationService: igniteClient is not set, failing request');
97
- throw new Error('AuthorizationService: igniteClient is not set, failing request');
98
- }
99
- if (this.igniteClient.configuration.getObjectValue(ALLOWED_SDK_PLATFORM_PROFILES_KEY, []).includes(appName)) {
100
- return attributionsService.getProfile();
101
- }
102
- if (this.igniteClient.configuration
103
- .getObjectValue(IN_RELEASE_SDK_PLATFORM_PROFILES_KEY, [])
104
- .includes(appName) &&
105
- this.igniteClient.isReleased(PLATFORM_PROFILE_RELEASE_FF, { accountId, userId })) {
106
- return attributionsService.getProfile();
107
- }
108
- return attributionsService.PlatformProfile.APP;
109
- }
110
90
  static async canActionInScopeMultiple(accountId, userId, scopedActions) {
111
91
  if (scopedActions.length === 0) {
112
92
  return [];
@@ -121,7 +101,7 @@ class AuthorizationService {
121
101
  }
122
102
  else {
123
103
  apiType = 'platform';
124
- const profile = this.getProfile(accountId, userId);
104
+ const profile = attributionsService.getProfile();
125
105
  const internalAuthToken = authorizationInternalService.AuthorizationInternalService.generateInternalAuthToken(accountId, userId);
126
106
  scopedActionResponseObjects = await this.platformApi.checkPermissions(profile, internalAuthToken, userId, scopedActions);
127
107
  }
@@ -142,7 +122,7 @@ class AuthorizationService {
142
122
  return this.isAuthorizedMultiple(accountId, userId, authorizationObjects);
143
123
  }
144
124
  static async isAuthorizedMultiple(accountId, userId, authorizationRequestObjects) {
145
- const profile = this.getProfile(accountId, userId);
125
+ const profile = attributionsService.getProfile();
146
126
  const internalAuthToken = authorizationInternalService.AuthorizationInternalService.generateInternalAuthToken(accountId, userId);
147
127
  const startTime = perf_hooks.performance.now();
148
128
  const attributionHeaders = attributionsService.getAttributionsFromApi();
@@ -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
@@ -0,0 +1,32 @@
1
+ import { EntityType } from './entity-attributes-constants';
2
+ import { ResourceAttributeDeleteOperation, EntityAttributeDeleteOperation, ResourceAttributeUpsertOperation, EntityAttributeUpsertOperation } from './types/authorization-attributes-contracts';
3
+ import { Resource } from './types/general';
4
+ /**
5
+ * Abstract base class for authorization attributes operations.
6
+ * Both MS (HTTP) and SNS (async) services extend this class.
7
+ */
8
+ export declare abstract class BaseAuthorizationAttributesService {
9
+ /**
10
+ * Deletes a resource attribute.
11
+ * Returns Promise<ResourceAttributeDeleteOperation>
12
+ */
13
+ deleteResourceAttributes(accountId: number, resource: Resource, attributeKey: string, _appName?: string, _callerActionIdentifier?: string): Promise<ResourceAttributeDeleteOperation>;
14
+ /**
15
+ * Deletes an entity attribute.
16
+ * Returns Promise<EntityAttributeDeleteOperation>
17
+ */
18
+ deleteEntityAttributes(accountId: number, entityType: EntityType, entityId: number, attributeKey: string): Promise<EntityAttributeDeleteOperation>;
19
+ /**
20
+ * Updates a resource attribute (single operation - upsert only).
21
+ * For MS service: performs upsert operation
22
+ * For SNS service: returns Promise<ResourceAttributeUpsertOperation>
23
+ */
24
+ updateResourceAttributes(accountId: number, _appName: string, _callerActionIdentifier: string, resourceAttributeOperation: ResourceAttributeUpsertOperation): Promise<ResourceAttributeUpsertOperation>;
25
+ /**
26
+ * Updates an entity attribute (single operation - upsert only).
27
+ * For MS service: performs upsert operation
28
+ * For SNS service: returns Promise<EntityAttributeUpsertOperation>
29
+ */
30
+ updateEntityAttributes(accountId: number, _appName: string, _callerActionIdentifier: string, entityAttributeOperation: EntityAttributeUpsertOperation): Promise<EntityAttributeUpsertOperation>;
31
+ }
32
+ //# sourceMappingURL=base-authorization-attributes-service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base-authorization-attributes-service.d.ts","sourceRoot":"","sources":["../src/base-authorization-attributes-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EACL,gCAAgC,EAChC,8BAA8B,EAC9B,gCAAgC,EAChC,8BAA8B,EAE/B,MAAM,4CAA4C,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAG3C;;;GAGG;AACH,8BAAsB,kCAAkC;IACtD;;;OAGG;IACH,wBAAwB,CACtB,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,QAAQ,EAClB,YAAY,EAAE,MAAM,EACpB,QAAQ,CAAC,EAAE,MAAM,EACjB,uBAAuB,CAAC,EAAE,MAAM,GAC/B,OAAO,CAAC,gCAAgC,CAAC;IAY5C;;;OAGG;IACH,sBAAsB,CACpB,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,8BAA8B,CAAC;IAY1C;;;;OAIG;IACH,wBAAwB,CACtB,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,uBAAuB,EAAE,MAAM,EAC/B,0BAA0B,EAAE,gCAAgC,GAC3D,OAAO,CAAC,gCAAgC,CAAC;IAK5C;;;;OAIG;IACH,sBAAsB,CACpB,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,uBAAuB,EAAE,MAAM,EAC/B,wBAAwB,EAAE,8BAA8B,GACvD,OAAO,CAAC,8BAA8B,CAAC;CAK3C"}
@@ -0,0 +1,63 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+
3
+ const types_authorizationAttributesContracts = require('./types/authorization-attributes-contracts.js');
4
+ const utils_validation = require('./utils/validation.js');
5
+
6
+ /**
7
+ * Abstract base class for authorization attributes operations.
8
+ * Both MS (HTTP) and SNS (async) services extend this class.
9
+ */
10
+ class BaseAuthorizationAttributesService {
11
+ /**
12
+ * Deletes a resource attribute.
13
+ * Returns Promise<ResourceAttributeDeleteOperation>
14
+ */
15
+ deleteResourceAttributes(accountId, resource, attributeKey, _appName, _callerActionIdentifier) {
16
+ const operation = {
17
+ resourceType: resource.type,
18
+ resourceId: resource.id,
19
+ key: attributeKey,
20
+ operationType: types_authorizationAttributesContracts.AttributeOperation.DELETE,
21
+ };
22
+ utils_validation.ValidationUtils.validateInteger(accountId);
23
+ utils_validation.ValidationUtils.validatDeleteResourceAssignment(operation);
24
+ return Promise.resolve(operation);
25
+ }
26
+ /**
27
+ * Deletes an entity attribute.
28
+ * Returns Promise<EntityAttributeDeleteOperation>
29
+ */
30
+ deleteEntityAttributes(accountId, entityType, entityId, attributeKey) {
31
+ const operation = {
32
+ entityType: entityType,
33
+ entityId: entityId,
34
+ key: attributeKey,
35
+ operationType: types_authorizationAttributesContracts.AttributeOperation.DELETE,
36
+ };
37
+ utils_validation.ValidationUtils.validateInteger(accountId);
38
+ utils_validation.ValidationUtils.validatDeleteEntityAssignment(operation);
39
+ return Promise.resolve(operation);
40
+ }
41
+ /**
42
+ * Updates a resource attribute (single operation - upsert only).
43
+ * For MS service: performs upsert operation
44
+ * For SNS service: returns Promise<ResourceAttributeUpsertOperation>
45
+ */
46
+ updateResourceAttributes(accountId, _appName, _callerActionIdentifier, resourceAttributeOperation) {
47
+ utils_validation.ValidationUtils.validateInteger(accountId);
48
+ utils_validation.ValidationUtils.validatUpsertResourceAssignment(resourceAttributeOperation);
49
+ return Promise.resolve(resourceAttributeOperation);
50
+ }
51
+ /**
52
+ * Updates an entity attribute (single operation - upsert only).
53
+ * For MS service: performs upsert operation
54
+ * For SNS service: returns Promise<EntityAttributeUpsertOperation>
55
+ */
56
+ updateEntityAttributes(accountId, _appName, _callerActionIdentifier, entityAttributeOperation) {
57
+ utils_validation.ValidationUtils.validateInteger(accountId);
58
+ utils_validation.ValidationUtils.validatUpsertEntityAssignment(entityAttributeOperation);
59
+ return Promise.resolve(entityAttributeOperation);
60
+ }
61
+ }
62
+
63
+ exports.BaseAuthorizationAttributesService = BaseAuthorizationAttributesService;
@@ -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, key: string, value: 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;AAE5H,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,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAMhF,oBAAoB,IAAI,iCAAiC;IAQzD;;;;OAIG;IACH,MAAM,CAAC,KAAK,EAAE,yBAAyB,GAAG,OAAO;CAGlD"}
@@ -1,15 +1,14 @@
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');
5
4
 
6
5
  class EntityAttributeAssignment extends baseAttributeAssignment.BaseAttributeAssignment {
7
6
  entityId;
8
7
  entityType;
9
- constructor(entityId, entityType, attributeKey, attributeValue) {
10
- super(entityId, entityType, attributeKey, attributeValue, entityAttributesConstants.ENTITY_TYPES, 'entityId', 'entityType');
8
+ constructor(entityId, entityType, key, value) {
9
+ super(entityId, entityType, key, value);
11
10
  this.entityId = entityId;
12
- this.entityType = this.type;
11
+ this.entityType = entityType;
13
12
  }
14
13
  toDataTransferObject() {
15
14
  return {
@@ -1,70 +1,50 @@
1
- import { ResourceAttributeAssignment } from './resource-attribute-assignment';
2
- import { EntityAttributeAssignment } from './entity-attribute-assignment';
3
- import { ResourceAttributeOperation, EntityAttributeOperation } from './types/authorization-attributes-contracts';
1
+ import { ResourceAttributeUpsertOperation, ResourceAttributeDeleteOperation, EntityAttributeUpsertOperation, EntityAttributeDeleteOperation } from './types/authorization-attributes-contracts';
4
2
  import { EntityType } from './entity-attributes-constants';
5
- import { AuthorizationAttributesService } from './types/authorization-attributes-service.interface';
3
+ import { BaseAuthorizationAttributesService } from './base-authorization-attributes-service';
6
4
  import { Resource } from './types/general';
7
5
  /**
8
6
  * Service class for managing resource attributes in the authorization microservice.
9
7
  * Provides synchronous HTTP operations to create/update and delete attributes on resources.
10
8
  */
11
- export declare class AuthorizationAttributesMsService implements AuthorizationAttributesService {
9
+ export declare class AuthorizationAttributesMsService extends BaseAuthorizationAttributesService {
12
10
  private static LOG_TAG;
13
11
  private static httpClient;
14
- static destroyHttpClient(): void;
12
+ constructor();
15
13
  /**
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
- /**
23
- * Deletes specific attributes from a resource synchronously.
14
+ * Deletes a specific attribute from a resource synchronously.
24
15
  * @param accountId The account ID
25
16
  * @param resource Object with resourceType (string) and resourceId (number)
26
- * @param attributeKeys Array of attribute key strings to delete
27
- * @returns Promise<void>
28
- */
29
- 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>
17
+ * @param attributeKey Attribute key string to delete
18
+ * @returns Promise<ResourceAttributeDeleteOperation>
35
19
  */
36
- upsertEntityAttributes(accountId: number, entityAttributeAssignments: EntityAttributeAssignment[], _appName?: string, _callerActionIdentifier?: string): Promise<void>;
20
+ deleteResourceAttributes(accountId: number, resource: Resource, attributeKey: string, _appName?: string, _callerActionIdentifier?: string): Promise<ResourceAttributeDeleteOperation>;
37
21
  /**
38
- * Deletes specific attributes from an entity synchronously.
22
+ * Deletes a specific attribute from an entity synchronously.
39
23
  * @param accountId The account ID
40
24
  * @param entityType The entity type
41
25
  * @param entityId The entity ID
42
- * @param attributeKeys Array of attribute key strings to delete
43
- * @returns Promise<void>
26
+ * @param attributeKey Attribute key string to delete
27
+ * @returns Promise<EntityAttributeDeleteOperation>
44
28
  */
45
- deleteEntityAttributes(accountId: number, entityType: EntityType, entityId: number, attributeKeys: string[], _appName?: string, _callerActionIdentifier?: string): Promise<void>;
29
+ deleteEntityAttributes(accountId: number, entityType: EntityType, entityId: number, attributeKey: string, _appName?: string, _callerActionIdentifier?: string): Promise<EntityAttributeDeleteOperation>;
46
30
  /**
47
- * Updates resource attributes (batch operations).
48
- * Note: MS service does not support batch operations directly.
49
- * This method processes operations sequentially using upsert/delete methods.
31
+ * Updates a resource attribute (single operation - upsert only).
50
32
  * @param accountId The account ID
51
33
  * @param appName App name (required for interface compatibility, but not used in MS service)
52
34
  * @param callerActionIdentifier Action identifier (required for interface compatibility, but not used in MS service)
53
- * @param resourceAttributeOperations Array of operations to perform
54
- * @returns Promise<ResourceAttributesOperation[]> Array of processed operations
35
+ * @param resourceAttributeOperation Operation to perform (must be UPSERT)
36
+ * @returns Promise<ResourceAttributeUpsertOperation> Processed operation
55
37
  */
56
- updateResourceAttributes(accountId: number, _appName: string, _callerActionIdentifier: string, resourceAttributeOperations: ResourceAttributeOperation[]): Promise<ResourceAttributeOperation[]>;
38
+ updateResourceAttributes(accountId: number, _appName: string, _callerActionIdentifier: string, resourceAttributeOperation: ResourceAttributeUpsertOperation): Promise<ResourceAttributeUpsertOperation>;
57
39
  /**
58
- * Updates entity attributes (batch operations).
59
- * Note: MS service does not support batch operations directly.
60
- * This method processes operations sequentially using upsert/delete methods.
40
+ * Updates an entity attribute (single operation - upsert only).
61
41
  * @param accountId The account ID
62
42
  * @param appName App name (required for interface compatibility, but not used in MS service)
63
43
  * @param callerActionIdentifier Action identifier (required for interface compatibility, but not used in MS service)
64
- * @param entityAttributeOperations Array of operations to perform
65
- * @returns Promise<EntityAttributesOperation[]> Array of processed operations
44
+ * @param entityAttributeOperation Operation to perform (must be UPSERT)
45
+ * @returns Promise<EntityAttributeUpsertOperation> Processed operation
66
46
  */
67
- updateEntityAttributes(accountId: number, _appName: string, _callerActionIdentifier: string, entityAttributeOperations: EntityAttributeOperation[]): Promise<EntityAttributeOperation[]>;
47
+ updateEntityAttributes(accountId: number, _appName: string, _callerActionIdentifier: string, entityAttributeOperation: EntityAttributeUpsertOperation): Promise<EntityAttributeUpsertOperation>;
68
48
  /**
69
49
  * Replaces path template parameters with actual values
70
50
  * @param template Path template with placeholders like {accountId}
@@ -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;AAW3C;;;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,EACL,gCAAgC,EAChC,gCAAgC,EAChC,8BAA8B,EAC9B,8BAA8B,EAC/B,MAAM,4CAA4C,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAI3D,OAAO,EAAE,kCAAkC,EAAE,MAAM,yCAAyC,CAAC;AAC7F,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAY3C;;;GAGG;AACH,qBAAa,gCAAiC,SAAQ,kCAAkC;IACtF,OAAO,CAAC,MAAM,CAAC,OAAO,CAAiC;IACvD,OAAO,CAAC,MAAM,CAAC,UAAU,CAAqD;;IAY9E;;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