@mondaydotcomorg/monday-authorization 3.5.0-feat-use-profile-for-graph-can-action-in-scope-f1451ab → 3.5.0-feat-shaime-support-entity-attributes-in-authorization-sdk-397ce54
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.
- package/dist/authorization-attributes-ms-service.d.ts +37 -0
- package/dist/authorization-attributes-ms-service.d.ts.map +1 -0
- package/dist/authorization-attributes-ms-service.js +232 -0
- package/dist/authorization-attributes-service.d.ts +45 -1
- package/dist/authorization-attributes-service.d.ts.map +1 -1
- package/dist/authorization-attributes-service.js +262 -0
- package/dist/clients/graph-api.d.ts.map +1 -1
- package/dist/clients/graph-api.js +0 -1
- package/dist/constants.d.ts +0 -3
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +0 -4
- package/dist/errors/argument-error.d.ts +4 -0
- package/dist/errors/argument-error.d.ts.map +1 -0
- package/dist/errors/argument-error.js +11 -0
- package/dist/esm/authorization-attributes-ms-service.d.ts +37 -0
- package/dist/esm/authorization-attributes-ms-service.d.ts.map +1 -0
- package/dist/esm/authorization-attributes-ms-service.mjs +230 -0
- package/dist/esm/authorization-attributes-service.d.ts +45 -1
- package/dist/esm/authorization-attributes-service.d.ts.map +1 -1
- package/dist/esm/authorization-attributes-service.mjs +263 -1
- package/dist/esm/clients/graph-api.d.ts.map +1 -1
- package/dist/esm/clients/graph-api.mjs +1 -2
- package/dist/esm/constants.d.ts +0 -3
- package/dist/esm/constants.d.ts.map +1 -1
- package/dist/esm/constants.mjs +1 -5
- package/dist/esm/errors/argument-error.d.ts +4 -0
- package/dist/esm/errors/argument-error.d.ts.map +1 -0
- package/dist/esm/errors/argument-error.mjs +9 -0
- package/dist/esm/index.d.ts +5 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.mjs +4 -0
- package/dist/esm/resource-attribute-assignment.d.ts +25 -0
- package/dist/esm/resource-attribute-assignment.d.ts.map +1 -0
- package/dist/esm/resource-attribute-assignment.mjs +60 -0
- package/dist/esm/resource-attributes-constants.d.ts +25 -0
- package/dist/esm/resource-attributes-constants.d.ts.map +1 -0
- package/dist/esm/resource-attributes-constants.mjs +25 -0
- package/dist/esm/types/authorization-attributes-contracts.d.ts +19 -3
- package/dist/esm/types/authorization-attributes-contracts.d.ts.map +1 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -0
- package/dist/resource-attribute-assignment.d.ts +25 -0
- package/dist/resource-attribute-assignment.d.ts.map +1 -0
- package/dist/resource-attribute-assignment.js +62 -0
- package/dist/resource-attributes-constants.d.ts +25 -0
- package/dist/resource-attributes-constants.d.ts.map +1 -0
- package/dist/resource-attributes-constants.js +28 -0
- package/dist/types/authorization-attributes-contracts.d.ts +19 -3
- package/dist/types/authorization-attributes-contracts.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/authorization-attributes-ms-service.ts +327 -0
- package/src/authorization-attributes-service.ts +325 -0
- package/src/clients/graph-api.ts +1 -2
- package/src/constants.ts +0 -4
- package/src/errors/argument-error.ts +8 -0
- package/src/index.ts +16 -0
- package/src/resource-attribute-assignment.ts +70 -0
- package/src/resource-attributes-constants.ts +27 -0
- package/src/types/authorization-attributes-contracts.ts +49 -3
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { ResourceAttributeAssignment } from './resource-attribute-assignment';
|
|
2
|
+
interface Resource {
|
|
3
|
+
resourceType: string;
|
|
4
|
+
resourceId: number;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Service class for managing resource attributes in the authorization microservice.
|
|
8
|
+
* Provides synchronous HTTP operations to create/update and delete attributes on resources.
|
|
9
|
+
*/
|
|
10
|
+
export declare class AuthorizationAttributesMsService {
|
|
11
|
+
private static LOG_TAG;
|
|
12
|
+
/**
|
|
13
|
+
* Gets request headers including Authorization, Content-Type, and optional attribution headers
|
|
14
|
+
*/
|
|
15
|
+
private static getRequestHeaders;
|
|
16
|
+
/**
|
|
17
|
+
* Validates that all messages are instances of the specified message class
|
|
18
|
+
*/
|
|
19
|
+
private static validateMessages;
|
|
20
|
+
/**
|
|
21
|
+
* Creates or updates resource attributes synchronously.
|
|
22
|
+
* @param accountId The account ID
|
|
23
|
+
* @param resourceAttributeAssignments Array of ResourceAttributeAssignment objects
|
|
24
|
+
* @returns Promise<void>
|
|
25
|
+
*/
|
|
26
|
+
static upsertResourceAttributesSync(accountId: number, resourceAttributeAssignments: ResourceAttributeAssignment[]): Promise<void>;
|
|
27
|
+
/**
|
|
28
|
+
* Deletes specific attributes from a resource synchronously.
|
|
29
|
+
* @param accountId The account ID
|
|
30
|
+
* @param resource Object with resourceType (string) and resourceId (number)
|
|
31
|
+
* @param attributeKeys Array of attribute key strings to delete
|
|
32
|
+
* @returns Promise<void>
|
|
33
|
+
*/
|
|
34
|
+
static deleteResourceAttributesSync(accountId: number, resource: Resource, attributeKeys: string[]): Promise<void>;
|
|
35
|
+
}
|
|
36
|
+
export {};
|
|
37
|
+
//# sourceMappingURL=authorization-attributes-ms-service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authorization-attributes-ms-service.d.ts","sourceRoot":"","sources":["../src/authorization-attributes-ms-service.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,2BAA2B,EAAE,MAAM,iCAAiC,CAAC;AAW9E,UAAU,QAAQ;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;CACpB;AAeD;;;GAGG;AACH,qBAAa,gCAAgC;IAC3C,OAAO,CAAC,MAAM,CAAC,OAAO,CAAiC;IAEvD;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,iBAAiB;IA+ChC;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,gBAAgB;IAsB/B;;;;;OAKG;WACU,4BAA4B,CACvC,SAAS,EAAE,MAAM,EACjB,4BAA4B,EAAE,2BAA2B,EAAE,GAC1D,OAAO,CAAC,IAAI,CAAC;IAwFhB;;;;;;OAMG;WACU,4BAA4B,CACvC,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,QAAQ,EAClB,aAAa,EAAE,MAAM,EAAE,GACtB,OAAO,CAAC,IAAI,CAAC;CAuGjB"}
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
|
|
3
|
+
const tridentBackendApi = require('@mondaydotcomorg/trident-backend-api');
|
|
4
|
+
const mondayJwt = require('@mondaydotcomorg/monday-jwt');
|
|
5
|
+
const mondayFetchApi = require('@mondaydotcomorg/monday-fetch-api');
|
|
6
|
+
const resourceAttributeAssignment = require('./resource-attribute-assignment.js');
|
|
7
|
+
const errors_argumentError = require('./errors/argument-error.js');
|
|
8
|
+
const authorizationInternalService = require('./authorization-internal-service.js');
|
|
9
|
+
const attributionsService = require('./attributions-service.js');
|
|
10
|
+
const constants = require('./constants.js');
|
|
11
|
+
|
|
12
|
+
const INTERNAL_APP_NAME = 'internal_ms';
|
|
13
|
+
const UPSERT_RESOURCE_ATTRIBUTES_PATH = '/attributes/{accountId}/resource';
|
|
14
|
+
const DELETE_RESOURCE_ATTRIBUTES_PATH = '/attributes/{accountId}/resource/{resourceType}/{resourceId}';
|
|
15
|
+
/**
|
|
16
|
+
* Service class for managing resource attributes in the authorization microservice.
|
|
17
|
+
* Provides synchronous HTTP operations to create/update and delete attributes on resources.
|
|
18
|
+
*/
|
|
19
|
+
class AuthorizationAttributesMsService {
|
|
20
|
+
static LOG_TAG = 'authorization_attributes_ms';
|
|
21
|
+
/**
|
|
22
|
+
* Gets request headers including Authorization, Content-Type, and optional attribution headers
|
|
23
|
+
*/
|
|
24
|
+
static getRequestHeaders(accountId, userId) {
|
|
25
|
+
const headers = {
|
|
26
|
+
'Content-Type': 'application/json',
|
|
27
|
+
};
|
|
28
|
+
// Generate Authorization token
|
|
29
|
+
const authToken = mondayJwt.signAuthorizationHeader({
|
|
30
|
+
appName: INTERNAL_APP_NAME,
|
|
31
|
+
accountId,
|
|
32
|
+
userId,
|
|
33
|
+
});
|
|
34
|
+
headers.Authorization = authToken;
|
|
35
|
+
// Add attribution headers if available
|
|
36
|
+
const attributionHeaders = attributionsService.getAttributionsFromApi();
|
|
37
|
+
for (const key in attributionHeaders) {
|
|
38
|
+
if (attributionHeaders.hasOwnProperty(key)) {
|
|
39
|
+
headers[key] = attributionHeaders[key];
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
// Add X-REQUEST-ID if available from context
|
|
43
|
+
try {
|
|
44
|
+
const tridentContext = tridentBackendApi.Api.getPart('context');
|
|
45
|
+
if (tridentContext?.runtimeAttributions) {
|
|
46
|
+
const outgoingHeaders = tridentContext.runtimeAttributions.buildOutgoingHeaders('HTTP_INTERNAL');
|
|
47
|
+
if (outgoingHeaders) {
|
|
48
|
+
const attributionHeadersMap = {};
|
|
49
|
+
for (const [key, value] of outgoingHeaders) {
|
|
50
|
+
attributionHeadersMap[key] = value;
|
|
51
|
+
}
|
|
52
|
+
if (attributionHeadersMap['x-request-id']) {
|
|
53
|
+
headers['X-REQUEST-ID'] = attributionHeadersMap['x-request-id'];
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
catch (error) {
|
|
59
|
+
// Silently fail if context is not available
|
|
60
|
+
authorizationInternalService.logger.debug({ tag: this.LOG_TAG, error }, 'Failed to get request ID from context');
|
|
61
|
+
}
|
|
62
|
+
// Add X-REQUEST-START timestamp
|
|
63
|
+
headers['X-REQUEST-START'] = Math.floor(Date.now() / 1000).toString();
|
|
64
|
+
return headers;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Validates that all messages are instances of the specified message class
|
|
68
|
+
*/
|
|
69
|
+
static validateMessages(attributesMessages, messageClass) {
|
|
70
|
+
if (typeof messageClass !== 'function') {
|
|
71
|
+
throw new errors_argumentError.ArgumentError('messageClass must be a class/constructor function');
|
|
72
|
+
}
|
|
73
|
+
if (!Array.isArray(attributesMessages)) {
|
|
74
|
+
throw new errors_argumentError.ArgumentError('attributesMessages must be an array');
|
|
75
|
+
}
|
|
76
|
+
for (let i = 0; i < attributesMessages.length; i++) {
|
|
77
|
+
if (!(attributesMessages[i] instanceof messageClass)) {
|
|
78
|
+
const className = messageClass.name || 'ResourceAttributeAssignment';
|
|
79
|
+
throw new errors_argumentError.ArgumentError(`All attributesMessages must be instances of ${className}, but item at index ${i} is not`);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Creates or updates resource attributes synchronously.
|
|
85
|
+
* @param accountId The account ID
|
|
86
|
+
* @param resourceAttributeAssignments Array of ResourceAttributeAssignment objects
|
|
87
|
+
* @returns Promise<void>
|
|
88
|
+
*/
|
|
89
|
+
static async upsertResourceAttributesSync(accountId, resourceAttributeAssignments) {
|
|
90
|
+
// Skip HTTP requests in test environment
|
|
91
|
+
if (process.env.NODE_ENV === 'test') {
|
|
92
|
+
authorizationInternalService.logger.debug({ tag: this.LOG_TAG, accountId, count: resourceAttributeAssignments.length }, 'Skipping upsertResourceAttributesSync in test environment');
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
// Validate inputs
|
|
96
|
+
if (!Number.isInteger(accountId)) {
|
|
97
|
+
throw new errors_argumentError.ArgumentError(`accountId must be an integer, got: ${accountId}`);
|
|
98
|
+
}
|
|
99
|
+
if (!Array.isArray(resourceAttributeAssignments)) {
|
|
100
|
+
throw new errors_argumentError.ArgumentError('resourceAttributeAssignments must be an array');
|
|
101
|
+
}
|
|
102
|
+
if (resourceAttributeAssignments.length === 0) {
|
|
103
|
+
authorizationInternalService.logger.warn({ tag: this.LOG_TAG, accountId }, 'upsertResourceAttributesSync called with empty array');
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
// Validate all assignments are instances of ResourceAttributeAssignment
|
|
107
|
+
this.validateMessages(resourceAttributeAssignments, resourceAttributeAssignment.ResourceAttributeAssignment);
|
|
108
|
+
// Convert assignments to hash format
|
|
109
|
+
const assignmentsHash = resourceAttributeAssignments.map(assignment => assignment.toH());
|
|
110
|
+
// Build request body
|
|
111
|
+
const requestBody = {
|
|
112
|
+
resourceAttributeAssignments: assignmentsHash,
|
|
113
|
+
};
|
|
114
|
+
const httpClient = tridentBackendApi.Api.getPart('httpClient');
|
|
115
|
+
if (!httpClient) {
|
|
116
|
+
throw new Error('AuthorizationAttributesMsService: HTTP client is not initialized');
|
|
117
|
+
}
|
|
118
|
+
const path = UPSERT_RESOURCE_ATTRIBUTES_PATH.replace('{accountId}', accountId.toString());
|
|
119
|
+
const headers = this.getRequestHeaders(accountId);
|
|
120
|
+
try {
|
|
121
|
+
authorizationInternalService.logger.info({ tag: this.LOG_TAG, accountId, count: resourceAttributeAssignments.length }, 'Upserting resource attributes');
|
|
122
|
+
await httpClient.fetch({
|
|
123
|
+
url: {
|
|
124
|
+
appName: constants.APP_NAME,
|
|
125
|
+
path,
|
|
126
|
+
},
|
|
127
|
+
method: 'POST',
|
|
128
|
+
headers,
|
|
129
|
+
body: JSON.stringify(requestBody),
|
|
130
|
+
}, {
|
|
131
|
+
timeout: authorizationInternalService.AuthorizationInternalService.getRequestTimeout(),
|
|
132
|
+
retryPolicy: authorizationInternalService.AuthorizationInternalService.getRetriesPolicy(),
|
|
133
|
+
});
|
|
134
|
+
authorizationInternalService.logger.info({ tag: this.LOG_TAG, accountId, count: resourceAttributeAssignments.length }, 'Successfully upserted resource attributes');
|
|
135
|
+
}
|
|
136
|
+
catch (err) {
|
|
137
|
+
authorizationInternalService.logger.error({
|
|
138
|
+
tag: this.LOG_TAG,
|
|
139
|
+
accountId,
|
|
140
|
+
method: 'upsertResourceAttributesSync',
|
|
141
|
+
error: err instanceof Error ? err.message : String(err),
|
|
142
|
+
}, 'Failed to upsert resource attributes');
|
|
143
|
+
if (err instanceof mondayFetchApi.HttpFetcherError) {
|
|
144
|
+
throw new Error(`AuthorizationAttributesMsService: [upsertResourceAttributesSync] request failed with status ${err.status}: ${err.message}`);
|
|
145
|
+
}
|
|
146
|
+
throw err;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Deletes specific attributes from a resource synchronously.
|
|
151
|
+
* @param accountId The account ID
|
|
152
|
+
* @param resource Object with resourceType (string) and resourceId (number)
|
|
153
|
+
* @param attributeKeys Array of attribute key strings to delete
|
|
154
|
+
* @returns Promise<void>
|
|
155
|
+
*/
|
|
156
|
+
static async deleteResourceAttributesSync(accountId, resource, attributeKeys) {
|
|
157
|
+
// Skip HTTP requests in test environment
|
|
158
|
+
if (process.env.NODE_ENV === 'test') {
|
|
159
|
+
authorizationInternalService.logger.debug({ tag: this.LOG_TAG, accountId, resource, attributeKeys }, 'Skipping deleteResourceAttributesSync in test environment');
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
// Validate inputs
|
|
163
|
+
if (!Number.isInteger(accountId)) {
|
|
164
|
+
throw new errors_argumentError.ArgumentError(`accountId must be an integer, got: ${accountId}`);
|
|
165
|
+
}
|
|
166
|
+
if (!resource || typeof resource !== 'object') {
|
|
167
|
+
throw new errors_argumentError.ArgumentError('resource must be an object');
|
|
168
|
+
}
|
|
169
|
+
if (!Number.isInteger(resource.resourceId)) {
|
|
170
|
+
throw new errors_argumentError.ArgumentError(`resource.resourceId must be an integer, got: ${resource.resourceId}`);
|
|
171
|
+
}
|
|
172
|
+
if (typeof resource.resourceType !== 'string') {
|
|
173
|
+
throw new errors_argumentError.ArgumentError(`resource.resourceType must be a string, got: ${typeof resource.resourceType}`);
|
|
174
|
+
}
|
|
175
|
+
if (!Array.isArray(attributeKeys)) {
|
|
176
|
+
throw new errors_argumentError.ArgumentError('attributeKeys must be an array');
|
|
177
|
+
}
|
|
178
|
+
if (attributeKeys.length === 0) {
|
|
179
|
+
authorizationInternalService.logger.warn({ tag: this.LOG_TAG, accountId, resource }, 'deleteResourceAttributesSync called with empty keys array');
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
// Validate all keys are strings
|
|
183
|
+
for (let i = 0; i < attributeKeys.length; i++) {
|
|
184
|
+
if (typeof attributeKeys[i] !== 'string') {
|
|
185
|
+
throw new errors_argumentError.ArgumentError(`All attributeKeys must be strings, but item at index ${i} is not`);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
// Build request body
|
|
189
|
+
const requestBody = {
|
|
190
|
+
keys: attributeKeys,
|
|
191
|
+
};
|
|
192
|
+
const httpClient = tridentBackendApi.Api.getPart('httpClient');
|
|
193
|
+
if (!httpClient) {
|
|
194
|
+
throw new Error('AuthorizationAttributesMsService: HTTP client is not initialized');
|
|
195
|
+
}
|
|
196
|
+
const path = DELETE_RESOURCE_ATTRIBUTES_PATH.replace('{accountId}', accountId.toString())
|
|
197
|
+
.replace('{resourceType}', resource.resourceType)
|
|
198
|
+
.replace('{resourceId}', resource.resourceId.toString());
|
|
199
|
+
const headers = this.getRequestHeaders(accountId);
|
|
200
|
+
try {
|
|
201
|
+
authorizationInternalService.logger.info({ tag: this.LOG_TAG, accountId, resource, keys: attributeKeys }, 'Deleting resource attributes');
|
|
202
|
+
await httpClient.fetch({
|
|
203
|
+
url: {
|
|
204
|
+
appName: constants.APP_NAME,
|
|
205
|
+
path,
|
|
206
|
+
},
|
|
207
|
+
method: 'DELETE',
|
|
208
|
+
headers,
|
|
209
|
+
body: JSON.stringify(requestBody),
|
|
210
|
+
}, {
|
|
211
|
+
timeout: authorizationInternalService.AuthorizationInternalService.getRequestTimeout(),
|
|
212
|
+
retryPolicy: authorizationInternalService.AuthorizationInternalService.getRetriesPolicy(),
|
|
213
|
+
});
|
|
214
|
+
authorizationInternalService.logger.info({ tag: this.LOG_TAG, accountId, resource, keys: attributeKeys }, 'Successfully deleted resource attributes');
|
|
215
|
+
}
|
|
216
|
+
catch (err) {
|
|
217
|
+
authorizationInternalService.logger.error({
|
|
218
|
+
tag: this.LOG_TAG,
|
|
219
|
+
accountId,
|
|
220
|
+
method: 'deleteResourceAttributesSync',
|
|
221
|
+
resource,
|
|
222
|
+
error: err instanceof Error ? err.message : String(err),
|
|
223
|
+
}, 'Failed to delete resource attributes');
|
|
224
|
+
if (err instanceof mondayFetchApi.HttpFetcherError) {
|
|
225
|
+
throw new Error(`AuthorizationAttributesMsService: [deleteResourceAttributesSync] request failed with status ${err.status}: ${err.message}`);
|
|
226
|
+
}
|
|
227
|
+
throw err;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
exports.AuthorizationAttributesMsService = AuthorizationAttributesMsService;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FetcherConfig, HttpClient } from '@mondaydotcomorg/trident-backend-api';
|
|
2
2
|
import { RecursivePartial } from '@mondaydotcomorg/monday-fetch-api';
|
|
3
|
-
import { ResourceAttributeAssignment, ResourceAttributeResponse, ResourceAttributesOperation } from './types/authorization-attributes-contracts';
|
|
3
|
+
import { ResourceAttributeAssignment, ResourceAttributeResponse, ResourceAttributesOperation, EntityAttributeAssignment, EntityAttributeResponse, ResourceType, EntityType, ResourceAttributeKeyType, EntityAttributeKeyType } from './types/authorization-attributes-contracts';
|
|
4
4
|
import { Resource } from './types/general';
|
|
5
5
|
export declare class AuthorizationAttributesService {
|
|
6
6
|
private static LOG_TAG;
|
|
@@ -50,5 +50,49 @@ export declare class AuthorizationAttributesService {
|
|
|
50
50
|
* @return {Promise<boolean>} - true if succeeded
|
|
51
51
|
*/
|
|
52
52
|
asyncResourceAttributesHealthCheck(): Promise<boolean>;
|
|
53
|
+
/**
|
|
54
|
+
* Validates resource attribute assignments array
|
|
55
|
+
*/
|
|
56
|
+
private static validateResourceAttributeAssignments;
|
|
57
|
+
/**
|
|
58
|
+
* Validates entity attribute assignments array
|
|
59
|
+
*/
|
|
60
|
+
private static validateEntityAttributeAssignments;
|
|
61
|
+
/**
|
|
62
|
+
* Upsert resource attributes synchronously.
|
|
63
|
+
* Matches API endpoint: POST /attributes/:accountId/resource
|
|
64
|
+
* @param accountId The account ID
|
|
65
|
+
* @param resourceAttributeAssignments Array of ResourceAttributeAssignment objects (1-100 items)
|
|
66
|
+
* @returns Promise with response containing affected attributes
|
|
67
|
+
*/
|
|
68
|
+
static upsertResourceAttributesSync(accountId: number, resourceAttributeAssignments: ResourceAttributeAssignment[]): Promise<ResourceAttributeResponse>;
|
|
69
|
+
/**
|
|
70
|
+
* Delete resource attributes synchronously.
|
|
71
|
+
* Matches API endpoint: DELETE /attributes/:accountId/resource/:resourceType/:resourceId
|
|
72
|
+
* @param accountId The account ID
|
|
73
|
+
* @param resourceType The resource type
|
|
74
|
+
* @param resourceId The resource ID
|
|
75
|
+
* @param keys Array of attribute keys to delete
|
|
76
|
+
* @returns Promise with response containing affected attributes
|
|
77
|
+
*/
|
|
78
|
+
static deleteResourceAttributesSync(accountId: number, resourceType: ResourceType, resourceId: number, keys: ResourceAttributeKeyType[]): Promise<ResourceAttributeResponse>;
|
|
79
|
+
/**
|
|
80
|
+
* Upsert entity attributes synchronously.
|
|
81
|
+
* Matches API endpoint: POST /attributes/:accountId/entity
|
|
82
|
+
* @param accountId The account ID
|
|
83
|
+
* @param entityAttributeAssignments Array of EntityAttributeAssignment objects (1-100 items)
|
|
84
|
+
* @returns Promise with response containing affected attributes
|
|
85
|
+
*/
|
|
86
|
+
static upsertEntityAttributesSync(accountId: number, entityAttributeAssignments: EntityAttributeAssignment[]): Promise<EntityAttributeResponse>;
|
|
87
|
+
/**
|
|
88
|
+
* Delete entity attributes synchronously.
|
|
89
|
+
* Matches API endpoint: DELETE /attributes/:accountId/entity/:entityType/:entityId
|
|
90
|
+
* @param accountId The account ID
|
|
91
|
+
* @param entityType The entity type
|
|
92
|
+
* @param entityId The entity ID
|
|
93
|
+
* @param keys Array of attribute keys to delete
|
|
94
|
+
* @returns Promise with response containing affected attributes
|
|
95
|
+
*/
|
|
96
|
+
static deleteEntityAttributesSync(accountId: number, entityType: EntityType, entityId: number, keys: EntityAttributeKeyType[]): Promise<EntityAttributeResponse>;
|
|
53
97
|
}
|
|
54
98
|
//# sourceMappingURL=authorization-attributes-service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authorization-attributes-service.d.ts","sourceRoot":"","sources":["../src/authorization-attributes-service.ts"],"names":[],"mappings":"AACA,OAAO,EAAO,aAAa,EAAE,UAAU,EAAE,MAAM,sCAAsC,CAAC;AAEtF,OAAO,EAAoB,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACvF,OAAO,EACL,2BAA2B,EAC3B,yBAAyB,EACzB,2BAA2B,
|
|
1
|
+
{"version":3,"file":"authorization-attributes-service.d.ts","sourceRoot":"","sources":["../src/authorization-attributes-service.ts"],"names":[],"mappings":"AACA,OAAO,EAAO,aAAa,EAAE,UAAU,EAAE,MAAM,sCAAsC,CAAC;AAEtF,OAAO,EAAoB,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACvF,OAAO,EACL,2BAA2B,EAC3B,yBAAyB,EACzB,2BAA2B,EAC3B,yBAAyB,EACzB,uBAAuB,EACvB,YAAY,EACZ,UAAU,EACV,wBAAwB,EACxB,sBAAsB,EACvB,MAAM,4CAA4C,CAAC;AAEpD,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAY3C,qBAAa,8BAA8B;IACzC,OAAO,CAAC,MAAM,CAAC,OAAO,CAA8B;IACpD,OAAO,CAAC,MAAM,CAAC,SAAS,CAKb;IACX,OAAO,CAAC,UAAU,CAAa;IAC/B,OAAO,CAAC,YAAY,CAAkC;IACtD,OAAO,CAAC,MAAM,CAAS;IAEvB;;;;OAIG;gBACS,UAAU,CAAC,EAAE,UAAU,EAAE,YAAY,CAAC,EAAE,gBAAgB,CAAC,aAAa,CAAC;IAqBnF;;;;;;OAMG;IACG,wBAAwB,CAC5B,SAAS,EAAE,MAAM,EACjB,4BAA4B,EAAE,2BAA2B,EAAE,GAC1D,OAAO,CAAC,yBAAyB,CAAC;IA6BrC;;;;;;OAMG;IACG,wBAAwB,CAC5B,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,QAAQ,EAClB,aAAa,EAAE,MAAM,EAAE,GACtB,OAAO,CAAC,yBAAyB,CAAC;IAkCrC;;;;;;;UAOM;IACA,6BAA6B,CACjC,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,EACf,sBAAsB,EAAE,MAAM,EAC9B,2BAA2B,EAAE,2BAA2B,EAAE,GACzD,OAAO,CAAC,2BAA2B,EAAE,CAAC;YAY3B,oBAAoB;IA4BlC,OAAO,CAAC,MAAM,CAAC,cAAc;IAW7B;;;;;;;OAOG;IACG,kCAAkC,IAAI,OAAO,CAAC,OAAO,CAAC;IAqB5D;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,oCAAoC;IA6BnD;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,kCAAkC;IA2BjD;;;;;;OAMG;WACU,4BAA4B,CACvC,SAAS,EAAE,MAAM,EACjB,4BAA4B,EAAE,2BAA2B,EAAE,GAC1D,OAAO,CAAC,yBAAyB,CAAC;IA6CrC;;;;;;;;OAQG;WACU,4BAA4B,CACvC,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,YAAY,EAC1B,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,wBAAwB,EAAE,GAC/B,OAAO,CAAC,yBAAyB,CAAC;IA0DrC;;;;;;OAMG;WACU,0BAA0B,CACrC,SAAS,EAAE,MAAM,EACjB,0BAA0B,EAAE,yBAAyB,EAAE,GACtD,OAAO,CAAC,uBAAuB,CAAC;IA6CnC;;;;;;;;OAQG;WACU,0BAA0B,CACrC,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,sBAAsB,EAAE,GAC7B,OAAO,CAAC,uBAAuB,CAAC;CAyDpC"}
|
|
@@ -18,6 +18,8 @@ class AuthorizationAttributesService {
|
|
|
18
18
|
static API_PATHS = {
|
|
19
19
|
UPSERT_RESOURCE_ATTRIBUTES: '/attributes/{accountId}/resource',
|
|
20
20
|
DELETE_RESOURCE_ATTRIBUTES: '/attributes/{accountId}/resource/{resourceType}/{resourceId}',
|
|
21
|
+
UPSERT_ENTITY_ATTRIBUTES: '/attributes/{accountId}/entity',
|
|
22
|
+
DELETE_ENTITY_ATTRIBUTES: '/attributes/{accountId}/entity/{entityType}/{entityId}',
|
|
21
23
|
};
|
|
22
24
|
httpClient;
|
|
23
25
|
fetchOptions;
|
|
@@ -181,6 +183,266 @@ class AuthorizationAttributesService {
|
|
|
181
183
|
return false;
|
|
182
184
|
}
|
|
183
185
|
}
|
|
186
|
+
/**
|
|
187
|
+
* Validates resource attribute assignments array
|
|
188
|
+
*/
|
|
189
|
+
static validateResourceAttributeAssignments(assignments) {
|
|
190
|
+
if (!Array.isArray(assignments)) {
|
|
191
|
+
throw new Error('resourceAttributeAssignments must be an array');
|
|
192
|
+
}
|
|
193
|
+
if (assignments.length === 0) {
|
|
194
|
+
throw new Error('resourceAttributeAssignments must contain at least 1 item');
|
|
195
|
+
}
|
|
196
|
+
if (assignments.length > 100) {
|
|
197
|
+
throw new Error('resourceAttributeAssignments must contain at most 100 items');
|
|
198
|
+
}
|
|
199
|
+
for (let i = 0; i < assignments.length; i++) {
|
|
200
|
+
const assignment = assignments[i];
|
|
201
|
+
if (!assignment.resourceId || typeof assignment.resourceId !== 'number') {
|
|
202
|
+
throw new Error(`resourceAttributeAssignments[${i}].resourceId is required and must be a number`);
|
|
203
|
+
}
|
|
204
|
+
if (!assignment.resourceType || typeof assignment.resourceType !== 'string') {
|
|
205
|
+
throw new Error(`resourceAttributeAssignments[${i}].resourceType is required and must be a string`);
|
|
206
|
+
}
|
|
207
|
+
if (!assignment.key || typeof assignment.key !== 'string') {
|
|
208
|
+
throw new Error(`resourceAttributeAssignments[${i}].key is required and must be a string`);
|
|
209
|
+
}
|
|
210
|
+
if (assignment.value === undefined || typeof assignment.value !== 'string') {
|
|
211
|
+
throw new Error(`resourceAttributeAssignments[${i}].value is required and must be a string`);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Validates entity attribute assignments array
|
|
217
|
+
*/
|
|
218
|
+
static validateEntityAttributeAssignments(assignments) {
|
|
219
|
+
if (!Array.isArray(assignments)) {
|
|
220
|
+
throw new Error('entityAttributeAssignments must be an array');
|
|
221
|
+
}
|
|
222
|
+
if (assignments.length === 0) {
|
|
223
|
+
throw new Error('entityAttributeAssignments must contain at least 1 item');
|
|
224
|
+
}
|
|
225
|
+
if (assignments.length > 100) {
|
|
226
|
+
throw new Error('entityAttributeAssignments must contain at most 100 items');
|
|
227
|
+
}
|
|
228
|
+
for (let i = 0; i < assignments.length; i++) {
|
|
229
|
+
const assignment = assignments[i];
|
|
230
|
+
if (!assignment.entityId || typeof assignment.entityId !== 'number') {
|
|
231
|
+
throw new Error(`entityAttributeAssignments[${i}].entityId is required and must be a number`);
|
|
232
|
+
}
|
|
233
|
+
if (!assignment.entityType || typeof assignment.entityType !== 'string') {
|
|
234
|
+
throw new Error(`entityAttributeAssignments[${i}].entityType is required and must be a string`);
|
|
235
|
+
}
|
|
236
|
+
if (!assignment.key || typeof assignment.key !== 'string') {
|
|
237
|
+
throw new Error(`entityAttributeAssignments[${i}].key is required and must be a string`);
|
|
238
|
+
}
|
|
239
|
+
if (assignment.value === undefined || typeof assignment.value !== 'string') {
|
|
240
|
+
throw new Error(`entityAttributeAssignments[${i}].value is required and must be a string`);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* Upsert resource attributes synchronously.
|
|
246
|
+
* Matches API endpoint: POST /attributes/:accountId/resource
|
|
247
|
+
* @param accountId The account ID
|
|
248
|
+
* @param resourceAttributeAssignments Array of ResourceAttributeAssignment objects (1-100 items)
|
|
249
|
+
* @returns Promise with response containing affected attributes
|
|
250
|
+
*/
|
|
251
|
+
static async upsertResourceAttributesSync(accountId, resourceAttributeAssignments) {
|
|
252
|
+
// Validate inputs
|
|
253
|
+
if (!Number.isInteger(accountId)) {
|
|
254
|
+
throw new Error(`accountId must be an integer, got: ${accountId}`);
|
|
255
|
+
}
|
|
256
|
+
AuthorizationAttributesService.validateResourceAttributeAssignments(resourceAttributeAssignments);
|
|
257
|
+
const httpClient = tridentBackendApi.Api.getPart('httpClient');
|
|
258
|
+
if (!httpClient) {
|
|
259
|
+
throw new Error(constants.ERROR_MESSAGES.HTTP_CLIENT_NOT_INITIALIZED);
|
|
260
|
+
}
|
|
261
|
+
const attributionHeaders = attributionsService.getAttributionsFromApi();
|
|
262
|
+
const path = AuthorizationAttributesService.API_PATHS.UPSERT_RESOURCE_ATTRIBUTES.replace('{accountId}', accountId.toString());
|
|
263
|
+
try {
|
|
264
|
+
return await httpClient.fetch({
|
|
265
|
+
url: {
|
|
266
|
+
appName: constants.APP_NAME,
|
|
267
|
+
path,
|
|
268
|
+
},
|
|
269
|
+
method: 'POST',
|
|
270
|
+
headers: {
|
|
271
|
+
'Content-Type': 'application/json',
|
|
272
|
+
...attributionHeaders,
|
|
273
|
+
},
|
|
274
|
+
body: JSON.stringify({ resourceAttributeAssignments }),
|
|
275
|
+
}, {
|
|
276
|
+
timeout: authorizationInternalService.AuthorizationInternalService.getRequestTimeout(),
|
|
277
|
+
retryPolicy: authorizationInternalService.AuthorizationInternalService.getRetriesPolicy(),
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
catch (err) {
|
|
281
|
+
if (err instanceof mondayFetchApi.HttpFetcherError) {
|
|
282
|
+
throw new Error(constants.ERROR_MESSAGES.REQUEST_FAILED('upsertResourceAttributesSync', err.status, err.message));
|
|
283
|
+
}
|
|
284
|
+
throw err;
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* Delete resource attributes synchronously.
|
|
289
|
+
* Matches API endpoint: DELETE /attributes/:accountId/resource/:resourceType/:resourceId
|
|
290
|
+
* @param accountId The account ID
|
|
291
|
+
* @param resourceType The resource type
|
|
292
|
+
* @param resourceId The resource ID
|
|
293
|
+
* @param keys Array of attribute keys to delete
|
|
294
|
+
* @returns Promise with response containing affected attributes
|
|
295
|
+
*/
|
|
296
|
+
static async deleteResourceAttributesSync(accountId, resourceType, resourceId, keys) {
|
|
297
|
+
// Validate inputs
|
|
298
|
+
if (!Number.isInteger(accountId)) {
|
|
299
|
+
throw new Error(`accountId must be an integer, got: ${accountId}`);
|
|
300
|
+
}
|
|
301
|
+
if (!resourceType || typeof resourceType !== 'string') {
|
|
302
|
+
throw new Error(`resourceType must be a string, got: ${typeof resourceType}`);
|
|
303
|
+
}
|
|
304
|
+
if (!Number.isInteger(resourceId)) {
|
|
305
|
+
throw new Error(`resourceId must be an integer, got: ${resourceId}`);
|
|
306
|
+
}
|
|
307
|
+
if (!Array.isArray(keys)) {
|
|
308
|
+
throw new Error('keys must be an array');
|
|
309
|
+
}
|
|
310
|
+
if (keys.length === 0) {
|
|
311
|
+
throw new Error('keys must contain at least 1 item');
|
|
312
|
+
}
|
|
313
|
+
const httpClient = tridentBackendApi.Api.getPart('httpClient');
|
|
314
|
+
if (!httpClient) {
|
|
315
|
+
throw new Error(constants.ERROR_MESSAGES.HTTP_CLIENT_NOT_INITIALIZED);
|
|
316
|
+
}
|
|
317
|
+
const attributionHeaders = attributionsService.getAttributionsFromApi();
|
|
318
|
+
const path = AuthorizationAttributesService.API_PATHS.DELETE_RESOURCE_ATTRIBUTES.replace('{accountId}', accountId.toString())
|
|
319
|
+
.replace('{resourceType}', resourceType)
|
|
320
|
+
.replace('{resourceId}', resourceId.toString());
|
|
321
|
+
try {
|
|
322
|
+
return await httpClient.fetch({
|
|
323
|
+
url: {
|
|
324
|
+
appName: constants.APP_NAME,
|
|
325
|
+
path,
|
|
326
|
+
},
|
|
327
|
+
method: 'DELETE',
|
|
328
|
+
headers: {
|
|
329
|
+
'Content-Type': 'application/json',
|
|
330
|
+
...attributionHeaders,
|
|
331
|
+
},
|
|
332
|
+
body: JSON.stringify({ keys }),
|
|
333
|
+
}, {
|
|
334
|
+
timeout: authorizationInternalService.AuthorizationInternalService.getRequestTimeout(),
|
|
335
|
+
retryPolicy: authorizationInternalService.AuthorizationInternalService.getRetriesPolicy(),
|
|
336
|
+
});
|
|
337
|
+
}
|
|
338
|
+
catch (err) {
|
|
339
|
+
if (err instanceof mondayFetchApi.HttpFetcherError) {
|
|
340
|
+
throw new Error(constants.ERROR_MESSAGES.REQUEST_FAILED('deleteResourceAttributesSync', err.status, err.message));
|
|
341
|
+
}
|
|
342
|
+
throw err;
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
/**
|
|
346
|
+
* Upsert entity attributes synchronously.
|
|
347
|
+
* Matches API endpoint: POST /attributes/:accountId/entity
|
|
348
|
+
* @param accountId The account ID
|
|
349
|
+
* @param entityAttributeAssignments Array of EntityAttributeAssignment objects (1-100 items)
|
|
350
|
+
* @returns Promise with response containing affected attributes
|
|
351
|
+
*/
|
|
352
|
+
static async upsertEntityAttributesSync(accountId, entityAttributeAssignments) {
|
|
353
|
+
// Validate inputs
|
|
354
|
+
if (!Number.isInteger(accountId)) {
|
|
355
|
+
throw new Error(`accountId must be an integer, got: ${accountId}`);
|
|
356
|
+
}
|
|
357
|
+
AuthorizationAttributesService.validateEntityAttributeAssignments(entityAttributeAssignments);
|
|
358
|
+
const httpClient = tridentBackendApi.Api.getPart('httpClient');
|
|
359
|
+
if (!httpClient) {
|
|
360
|
+
throw new Error(constants.ERROR_MESSAGES.HTTP_CLIENT_NOT_INITIALIZED);
|
|
361
|
+
}
|
|
362
|
+
const attributionHeaders = attributionsService.getAttributionsFromApi();
|
|
363
|
+
const path = AuthorizationAttributesService.API_PATHS.UPSERT_ENTITY_ATTRIBUTES.replace('{accountId}', accountId.toString());
|
|
364
|
+
try {
|
|
365
|
+
return await httpClient.fetch({
|
|
366
|
+
url: {
|
|
367
|
+
appName: constants.APP_NAME,
|
|
368
|
+
path,
|
|
369
|
+
},
|
|
370
|
+
method: 'POST',
|
|
371
|
+
headers: {
|
|
372
|
+
'Content-Type': 'application/json',
|
|
373
|
+
...attributionHeaders,
|
|
374
|
+
},
|
|
375
|
+
body: JSON.stringify({ entityAttributeAssignments }),
|
|
376
|
+
}, {
|
|
377
|
+
timeout: authorizationInternalService.AuthorizationInternalService.getRequestTimeout(),
|
|
378
|
+
retryPolicy: authorizationInternalService.AuthorizationInternalService.getRetriesPolicy(),
|
|
379
|
+
});
|
|
380
|
+
}
|
|
381
|
+
catch (err) {
|
|
382
|
+
if (err instanceof mondayFetchApi.HttpFetcherError) {
|
|
383
|
+
throw new Error(constants.ERROR_MESSAGES.REQUEST_FAILED('upsertEntityAttributesSync', err.status, err.message));
|
|
384
|
+
}
|
|
385
|
+
throw err;
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
/**
|
|
389
|
+
* Delete entity attributes synchronously.
|
|
390
|
+
* Matches API endpoint: DELETE /attributes/:accountId/entity/:entityType/:entityId
|
|
391
|
+
* @param accountId The account ID
|
|
392
|
+
* @param entityType The entity type
|
|
393
|
+
* @param entityId The entity ID
|
|
394
|
+
* @param keys Array of attribute keys to delete
|
|
395
|
+
* @returns Promise with response containing affected attributes
|
|
396
|
+
*/
|
|
397
|
+
static async deleteEntityAttributesSync(accountId, entityType, entityId, keys) {
|
|
398
|
+
// Validate inputs
|
|
399
|
+
if (!Number.isInteger(accountId)) {
|
|
400
|
+
throw new Error(`accountId must be an integer, got: ${accountId}`);
|
|
401
|
+
}
|
|
402
|
+
if (!entityType || typeof entityType !== 'string') {
|
|
403
|
+
throw new Error(`entityType must be a string, got: ${typeof entityType}`);
|
|
404
|
+
}
|
|
405
|
+
if (!Number.isInteger(entityId)) {
|
|
406
|
+
throw new Error(`entityId must be an integer, got: ${entityId}`);
|
|
407
|
+
}
|
|
408
|
+
if (!Array.isArray(keys)) {
|
|
409
|
+
throw new Error('keys must be an array');
|
|
410
|
+
}
|
|
411
|
+
if (keys.length === 0) {
|
|
412
|
+
throw new Error('keys must contain at least 1 item');
|
|
413
|
+
}
|
|
414
|
+
const httpClient = tridentBackendApi.Api.getPart('httpClient');
|
|
415
|
+
if (!httpClient) {
|
|
416
|
+
throw new Error(constants.ERROR_MESSAGES.HTTP_CLIENT_NOT_INITIALIZED);
|
|
417
|
+
}
|
|
418
|
+
const attributionHeaders = attributionsService.getAttributionsFromApi();
|
|
419
|
+
const path = AuthorizationAttributesService.API_PATHS.DELETE_ENTITY_ATTRIBUTES.replace('{accountId}', accountId.toString())
|
|
420
|
+
.replace('{entityType}', entityType)
|
|
421
|
+
.replace('{entityId}', entityId.toString());
|
|
422
|
+
try {
|
|
423
|
+
return await httpClient.fetch({
|
|
424
|
+
url: {
|
|
425
|
+
appName: constants.APP_NAME,
|
|
426
|
+
path,
|
|
427
|
+
},
|
|
428
|
+
method: 'DELETE',
|
|
429
|
+
headers: {
|
|
430
|
+
'Content-Type': 'application/json',
|
|
431
|
+
...attributionHeaders,
|
|
432
|
+
},
|
|
433
|
+
body: JSON.stringify({ keys }),
|
|
434
|
+
}, {
|
|
435
|
+
timeout: authorizationInternalService.AuthorizationInternalService.getRequestTimeout(),
|
|
436
|
+
retryPolicy: authorizationInternalService.AuthorizationInternalService.getRetriesPolicy(),
|
|
437
|
+
});
|
|
438
|
+
}
|
|
439
|
+
catch (err) {
|
|
440
|
+
if (err instanceof mondayFetchApi.HttpFetcherError) {
|
|
441
|
+
throw new Error(constants.ERROR_MESSAGES.REQUEST_FAILED('deleteEntityAttributesSync', err.status, err.message));
|
|
442
|
+
}
|
|
443
|
+
throw err;
|
|
444
|
+
}
|
|
445
|
+
}
|
|
184
446
|
}
|
|
185
447
|
|
|
186
448
|
exports.AuthorizationAttributesService = AuthorizationAttributesService;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graph-api.d.ts","sourceRoot":"","sources":["../../src/clients/graph-api.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,YAAY,EACZ,0BAA0B,EAG3B,MAAM,mCAAmC,CAAC;AAG3C,OAAO,EAEL,sBAAsB,EAMvB,MAAM,0BAA0B,CAAC;AAQlC;;GAEG;AACH,qBAAa,QAAQ;IACnB,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAa;IACxC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAS;;IAezC;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,gBAAgB;IAyB/B;;OAEG;IACG,gBAAgB,CAAC,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"graph-api.d.ts","sourceRoot":"","sources":["../../src/clients/graph-api.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,YAAY,EACZ,0BAA0B,EAG3B,MAAM,mCAAmC,CAAC;AAG3C,OAAO,EAEL,sBAAsB,EAMvB,MAAM,0BAA0B,CAAC;AAQlC;;GAEG;AACH,qBAAa,QAAQ;IACnB,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAa;IACxC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAS;;IAezC;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,gBAAgB;IAyB/B;;OAEG;IACG,gBAAgB,CAAC,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAgCzG;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,WAAW;IAiC1B;;OAEG;IACG,gBAAgB,CACpB,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,YAAY,EAAE,GAC5B,OAAO,CAAC,0BAA0B,EAAE,CAAC;IAMxC,OAAO,CAAC,MAAM,CAAC,iBAAiB;CAWjC"}
|
package/dist/constants.d.ts
CHANGED
|
@@ -2,9 +2,6 @@ import { RecursivePartial } from '@mondaydotcomorg/monday-fetch-api';
|
|
|
2
2
|
import { FetcherConfig } from '@mondaydotcomorg/trident-backend-api';
|
|
3
3
|
export declare const APP_NAME = "authorization";
|
|
4
4
|
export declare const GRAPH_APP_NAME = "authorization-graph";
|
|
5
|
-
export declare enum GraphProfile {
|
|
6
|
-
PERMISSION = "authorization-graph-permission"
|
|
7
|
-
}
|
|
8
5
|
export declare const ERROR_MESSAGES: {
|
|
9
6
|
readonly HTTP_CLIENT_NOT_INITIALIZED: "MondayAuthorization: HTTP client is not initialized";
|
|
10
7
|
readonly REQUEST_FAILED: (method: string, status: number, reason: string) => string;
|
package/dist/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AAErE,eAAO,MAAM,QAAQ,kBAAkB,CAAC;AACxC,eAAO,MAAM,cAAc,wBAAwB,CAAC;AAEpD,
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AAErE,eAAO,MAAM,QAAQ,kBAAkB,CAAC;AACxC,eAAO,MAAM,cAAc,wBAAwB,CAAC;AAEpD,eAAO,MAAM,cAAc;;sCAEA,MAAM,UAAU,MAAM,UAAU,MAAM;CAEvD,CAAC;AAEX,eAAO,MAAM,qBAAqB,EAAE,gBAAgB,CAAC,aAAa,CAUjE,CAAC"}
|
package/dist/constants.js
CHANGED
|
@@ -2,10 +2,6 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
2
2
|
|
|
3
3
|
const APP_NAME = 'authorization';
|
|
4
4
|
const GRAPH_APP_NAME = 'authorization-graph';
|
|
5
|
-
exports.GraphProfile = void 0;
|
|
6
|
-
(function (GraphProfile) {
|
|
7
|
-
GraphProfile["PERMISSION"] = "authorization-graph-permission";
|
|
8
|
-
})(exports.GraphProfile || (exports.GraphProfile = {}));
|
|
9
5
|
const ERROR_MESSAGES = {
|
|
10
6
|
HTTP_CLIENT_NOT_INITIALIZED: 'MondayAuthorization: HTTP client is not initialized',
|
|
11
7
|
REQUEST_FAILED: (method, status, reason) => `MondayAuthorization: [${method}] request failed with status ${status} with reason: ${reason}`,
|